public void run(int PlayerId) {
   Material material = MaterialData.getOrCreateMaterial(id, data);
   if (material == null) {
     material = MaterialData.getCustomItem(data);
   }
   if (name.equals("[resetall]")) {
     MaterialData.reset();
   }
   if (material != null) {
     if (name.equals("[reset]")) {
       material.setName(material.getNotchianName());
     } else {
       material.setName(name);
     }
   }
 }
Exemple #2
0
  public void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3) {
    GL11.glPushMatrix();
    // Spout Start
    boolean custom = false;
    BlockDesign design = null;
    if (par2ItemStack.itemID == 318) {
      org.spoutcraft.spoutcraftapi.material.CustomItem item =
          MaterialData.getCustomItem(par2ItemStack.getItemDamage());
      if (item != null) {
        String textureURI = item.getTexture();
        if (textureURI == null) {
          org.spoutcraft.spoutcraftapi.material.CustomBlock block =
              MaterialData.getCustomBlock(par2ItemStack.getItemDamage());
          design = block != null ? block.getBlockDesign() : null;
          textureURI = design != null ? design.getTexureURL() : null;
        }
        if (textureURI != null) {
          Texture texture =
              CustomTextureManager.getTextureFromUrl(
                  item.getAddon().getDescription().getName(), textureURI);
          if (texture != null) {
            GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID());
            custom = true;
          }
        }
      }
    }

    if (!custom) {
      if (par2ItemStack.itemID < 256) {
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
      } else {
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/items.png"));
      }
    }

    if (design != null) {
      design.renderItemstack(null, -0.5F, -0.5F, -0.5F, 0, 1F, rand);
    } else if (par2ItemStack.itemID < 256
        && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) {
      this.renderBlocksInstance.renderBlockAsItem(
          Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F);
    } else {

      Tessellator var4 = Tessellator.instance;
      int var5 = par1EntityLiving.getItemIcon(par2ItemStack, par3);
      float var6 = ((float) (var5 % 16 * TileSize.int_size) + 0.0F) / TileSize.float_size16;
      float var7 =
          ((float) (var5 % 16 * TileSize.int_size) + TileSize.float_sizeMinus0_01)
              / TileSize.float_size16;
      float var8 = ((float) (var5 / 16 * TileSize.int_size) + 0.0F) / TileSize.float_size16;
      float var9 =
          ((float) (var5 / 16 * TileSize.int_size) + TileSize.float_sizeMinus0_01)
              / TileSize.float_size16;

      if (custom) {
        var6 = 0;
        var7 = 1;
        var8 = 1;
        var9 = 0;
      }
      // Spout end
      float var10 = 0.0F;
      float var11 = 0.3F;
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      GL11.glTranslatef(-var10, -var11, 0.0F);
      float var12 = 1.5F;
      GL11.glScalef(var12, var12, var12);
      GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
      GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
      Colorizer.colorizeWaterBlockGL(par2ItemStack.itemID); // Spout HD
      this.renderItemIn2D(var4, var7, var8, var6, var9);
      if (par2ItemStack != null && par2ItemStack.hasEffect() && par3 == 0) {
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);
        this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture("%blur%/misc/glint.png"));
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        float var13 = 0.76F;
        GL11.glColor4f(0.5F * var13, 0.25F * var13, 0.8F * var13, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        float var14 = 0.125F;
        GL11.glScalef(var14, var14, var14);
        float var15 = (float) (System.currentTimeMillis() % 3000L) / 3000.0F * 8.0F;
        GL11.glTranslatef(var15, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
        this.renderItemIn2D(var4, 0.0F, 0.0F, 1.0F, 1.0F);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(var14, var14, var14);
        var15 = (float) (System.currentTimeMillis() % 4873L) / 4873.0F * 8.0F;
        GL11.glTranslatef(-var15, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
        this.renderItemIn2D(var4, 0.0F, 0.0F, 1.0F, 1.0F);
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
      }

      GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    }

    GL11.glPopMatrix();
  }