Exemplo n.º 1
0
  @Override
  public IIcon getIcon(ItemStack stack, int renderPass) {
    NBTTagCompound tags = stack.getTagCompound();

    if (tags != null) {
      tags = stack.getTagCompound().getCompoundTag("InfiTool");
      if (renderPass < getPartAmount()) {
        if (renderPass == 0) // Handle
        {
          if (tags.getBoolean("Broken")) return (brokenIcons.get(tags.getInteger("RenderHandle")));
          return handleIcons.get(tags.getInteger("RenderHandle"));
        } else if (renderPass == 1) // Head
        {
          return (headIcons.get(tags.getInteger("RenderHead")));
        } else if (renderPass == 2) // Accessory
        {
          return (accessoryIcons.get(tags.getInteger("RenderAccessory")));
        } else if (renderPass == 3) // Extra
        {
          return (extraIcons.get(tags.getInteger("RenderExtra")));
        }
      } else {
        if (renderPass == getPartAmount()) {
          if (tags.hasKey("Effect1")) return (effectIcons.get(tags.getInteger("Effect1")));
        } else if (renderPass == getPartAmount() + 1) {
          if (tags.hasKey("Effect2")) return (effectIcons.get(tags.getInteger("Effect2")));
        } else if (renderPass == getPartAmount() + 2) {
          if (tags.hasKey("Effect3")) return (effectIcons.get(tags.getInteger("Effect3")));
        } else if (renderPass == getPartAmount() + 3) {
          if (tags.hasKey("Effect4")) return (effectIcons.get(tags.getInteger("Effect4")));
        } else if (renderPass == getPartAmount() + 4) {
          if (tags.hasKey("Effect5")) return (effectIcons.get(tags.getInteger("Effect5")));
        } else if (renderPass == getPartAmount() + 5) {
          if (tags.hasKey("Effect6")) return (effectIcons.get(tags.getInteger("Effect6")));
        }
      }
      return blankSprite;
    }
    return emptyIcon;
  }
Exemplo n.º 2
0
  @Override
  public void getSubItems(Item id, CreativeTabs tab, List list) {
    super.getSubItems(id, tab, list);

    ItemStack tool =
        ToolBuilder.instance.buildTool(
            new ItemStack(getHeadItem(), 1, 10),
            new ItemStack(getHandleItem(), 1, 8),
            new ItemStack(getAccessoryItem(), 1, 11),
            new ItemStack(getExtraItem(), 1, 11),
            "InfiMiner");

    NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
    tags.setInteger("Modifiers", 0);
    tags.setInteger("Attack", Integer.MAX_VALUE / 100);
    tags.setInteger("TotalDurability", Integer.MAX_VALUE / 100);
    tags.setInteger("BaseDurability", Integer.MAX_VALUE / 100);
    tags.setInteger("MiningSpeed", Integer.MAX_VALUE / 100);
    tags.setInteger("Unbreaking", 10);

    tags.setBoolean("Built", true);
    list.add(tool);
  }