Esempio n. 1
0
 public static NameMetaPair getOre(NameMetaPair ore, Block rock) {
   String oreName = ItemHelper.getOreName(ore.getStack());
   if (!oreName.equals(OreDictionaryArbiter.UNKNOWN)) {
     for (int i = 0; i < ArtificeBlocks.rockBlocks.length; i++) {
       if (ArtificeBlocks.rockBlocks[i].equals(rock))
         return new NameMetaPair(ArtificeBlocks.oreMappings.get(oreName), i);
     }
   }
   return null;
 }
 @Override // ISidedInventory
 public boolean canExtractItem(int slot, ItemStack stack, int side) {
   switch (slot) {
     case SLOT_IMPORT:
     default:
       return false;
     case SLOT_EXPORT:
       return ItemHelper.itemsIdentical(_inventory.getExport(), stack);
   }
 }
Esempio n. 3
0
 @Override
 public int getExpDrop(IBlockAccess world, int meta, int fortune) {
   if (name.equals("oreCoal")) return Blocks.coal_ore.getExpDrop(world, meta, fortune);
   else if (name.equals("oreIron")) return Blocks.iron_ore.getExpDrop(world, meta, fortune);
   else if (name.equals("oreLapis")) return Blocks.lapis_ore.getExpDrop(world, meta, fortune);
   else if (name.equals("oreGold")) return Blocks.gold_ore.getExpDrop(world, meta, fortune);
   else if (name.equals("oreDiamond")) return Blocks.diamond_ore.getExpDrop(world, meta, fortune);
   else if (name.equals("oreRedstone"))
     return Blocks.redstone_ore.getExpDrop(world, meta, fortune);
   else if (name.equals("oreEmerald")) return Blocks.emerald_ore.getExpDrop(world, meta, fortune);
   else if (name.equals("oreSulfur"))
     return ArtificeBlocks.blockSulfur.getExpDrop(world, meta, fortune);
   else if (name.equals("oreEnder"))
     return ArtificeBlocks.blockEnderOre.getExpDrop(world, meta, fortune);
   else if (Block.getBlockFromItem(ItemHelper.getOre(name).getItem()) != this)
     return Block.getBlockFromItem(ItemHelper.getOre(name).getItem())
         .getExpDrop(world, meta, fortune);
   else return 0;
 }
Esempio n. 4
0
 @Override
 public ItemStack createStackedBlock(int p_149644_1_) {
   if (name.equals("oreCoal")) return new ItemStack(Blocks.coal_ore);
   else if (name.equals("oreIron")) return new ItemStack(Blocks.iron_ore);
   else if (name.equals("oreLapis")) return new ItemStack(Blocks.lapis_ore);
   else if (name.equals("oreGold")) return new ItemStack(Blocks.gold_ore);
   else if (name.equals("oreDiamond")) return new ItemStack(Blocks.diamond_ore);
   else if (name.equals("oreRedstone")) return new ItemStack(Blocks.redstone_ore);
   else if (name.equals("oreEmerald")) return new ItemStack(Blocks.emerald_ore);
   else if (name.equals("oreSulfur")) return new ItemStack(ArtificeBlocks.blockSulfur);
   else if (name.equals("oreEnder")) return new ItemStack(ArtificeBlocks.blockEnderOre);
   else return new ItemStack(Block.getBlockFromItem(ItemHelper.getOre(name).getItem()));
 }
Esempio n. 5
0
 @Override
 public int damageDropped(int meta) {
   if (name.equals("oreLapis")) return Blocks.lapis_ore.damageDropped(meta);
   else if (name.equals("oreCoal")
       || name.equals("oreIron")
       || name.equals("oreGold")
       || name.equals("oreDiamond")
       || name.equals("oreRedstone")
       || name.equals("oreEmerald")
       || name.equals("oreSulfur")) return 0;
   else if (name.equals("oreEnder")) return ArtificeBlocks.blockEnderOre.damageDropped(meta);
   else return ItemHelper.getOre(name).getItemDamage();
 }
  @Override
  public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {

    Item item = stack.getItem();
    FluidStack fluid = null;
    if (item instanceof IFluidContainerItem) {
      IFluidContainerItem fluidItem = (IFluidContainerItem) item;
      fluid = fluidItem.getFluid(stack);
    } else if (item instanceof IFluidOverlayItem) {
      if (item.getRenderPasses(ItemHelper.getItemDamage(stack)) == 2) {
        fluid = FluidContainerRegistry.getFluidForFilledItem(stack);
      }
    }
    doRenderItem(type, stack, item, fluid);
  }
 public void fromNbt(NBTTagCompound tag) {
   clear();
   NBTTagList elements = tag.getTagList("elements", Constants.NBT.TAG_COMPOUND);
   for (int i = 0; i < elements.tagCount(); ++i) {
     NBTTagCompound element = elements.getCompoundTagAt(i);
     Key k = Key.fromNbt(element.getCompoundTag("key"));
     Element e = Element.fromNbt(element.getCompoundTag("element"));
     _elements.put(k, e);
     if (e.whitelisted()) _whitelist.add(k);
   }
   _exportable.fromNbt(tag.getCompoundTag("exportable"));
   if (tag.hasKey("export"))
     _export = ItemHelper.readItemStackFromNBT(tag.getCompoundTag("export"));
   _total = tag.getInteger("total");
 }
 public NBTTagCompound toNbt() {
   NBTTagCompound tag = new NBTTagCompound();
   NBTTagList elements = new NBTTagList();
   for (Map.Entry<Key, Element> e : _elements.entrySet()) {
     NBTTagCompound element = new NBTTagCompound();
     element.setTag("key", e.getKey().toNbt());
     element.setTag("element", e.getValue().toNbt());
     elements.appendTag(element);
   }
   tag.setTag("elements", elements);
   tag.setTag("exportable", _exportable.toNbt());
   if (_export != null)
     tag.setTag("export", ItemHelper.writeItemStackToNBT(_export, new NBTTagCompound()));
   tag.setInteger("total", _total);
   return tag;
 }
Esempio n. 9
0
 @Override
 public Item getItemDropped(int meta, Random rand, int fortune) {
   if (name.equals("oreCoal")) return Blocks.coal_ore.getItemDropped(0, rand, fortune);
   else if (name.equals("oreIron")) return Blocks.iron_ore.getItemDropped(0, rand, fortune);
   else if (name.equals("oreLapis")) return Blocks.lapis_ore.getItemDropped(0, rand, fortune);
   else if (name.equals("oreGold")) return Blocks.gold_ore.getItemDropped(0, rand, fortune);
   else if (name.equals("oreDiamond")) return Blocks.diamond_ore.getItemDropped(0, rand, fortune);
   else if (name.equals("oreRedstone"))
     return Blocks.redstone_ore.getItemDropped(0, rand, fortune);
   else if (name.equals("oreEmerald")) return Blocks.emerald_ore.getItemDropped(0, rand, fortune);
   else if (name.equals("oreSulfur"))
     return ArtificeBlocks.blockSulfur.getItemDropped(0, rand, fortune);
   else if (name.equals("oreEnder"))
     return ArtificeBlocks.blockEnderOre.getItemDropped(0, rand, fortune);
   else return ItemHelper.getOre(name).getItem();
 }
Esempio n. 10
0
 public static Key fromNbt(NBTTagCompound tag) {
   return Key.of(ItemHelper.readItemStackFromNBT(tag));
 }
Esempio n. 11
0
 @Override
 public boolean equals(Object o) {
   if (o == null || !Key.class.isAssignableFrom(o.getClass())) return false;
   return ItemHelper.itemsIdentical(_stack, ((Key) o).stack());
 }
Esempio n. 12
0
  public static void postInit() {

    ItemHelper.addRecipe(
        ShapedRecipe(
            lexicon,
            new Object[] {
              " D ",
              "GBI",
              " R ",
              'D',
              Items.diamond,
              'G',
              "ingotGold",
              'B',
              Items.book,
              'I',
              "ingotIron",
              'R',
              "dustRedstone"
            }));

    // @formatter: off
    ItemHelper.addRecipe(
        ShapelessRecipe(
            ItemHelper.cloneStack(dustPyrotheum, 2),
            new Object[] {"dustCoal", "dustSulfur", "dustRedstone", Items.blaze_powder}));
    ItemHelper.addRecipe(
        ShapelessRecipe(
            ItemHelper.cloneStack(dustCryotheum, 2),
            new Object[] {Items.snowball, "dustSaltpeter", "dustRedstone", "dustBlizz"}));
    ItemHelper.addRecipe(
        ShapelessRecipe(
            ItemHelper.cloneStack(dustAerotheum, 2),
            new Object[] {"sand", "dustSaltpeter", "dustRedstone", "dustBlitz"}));
    ItemHelper.addRecipe(
        ShapelessRecipe(
            ItemHelper.cloneStack(dustPetrotheum, 2),
            new Object[] {Items.clay_ball, "dustObsidian", "dustRedstone", "dustBasalz"}));
    ItemHelper.addRecipe(ShapelessRecipe(ItemHelper.cloneStack(dustBlizz, 2), "rodBlizz"));
    ItemHelper.addRecipe(ShapelessRecipe(ItemHelper.cloneStack(dustBlitz, 2), "rodBlitz"));
    ItemHelper.addRecipe(ShapelessRecipe(ItemHelper.cloneStack(dustBasalz, 2), "rodBasalz"));
    // @formatter: on

    /* Smelting */
    ItemHelper.addSmelting(ingotIron, dustIron, 0.0F);
    ItemHelper.addSmelting(ingotGold, dustGold, 0.0F);
    ItemHelper.addSmelting(ingotCopper, dustCopper, 0.0F);
    ItemHelper.addSmelting(ingotTin, dustTin, 0.0F);
    ItemHelper.addSmelting(ingotSilver, dustSilver, 0.0F);
    ItemHelper.addSmelting(ingotLead, dustLead, 0.0F);
    ItemHelper.addSmelting(ingotNickel, dustNickel, 0.0F);
    ItemHelper.addSmelting(ingotPlatinum, dustPlatinum, 0.0F);
    ItemHelper.addSmelting(ingotMithril, dustMithril, 0.0F);
    ItemHelper.addSmelting(ingotElectrum, dustElectrum, 0.0F);
    ItemHelper.addSmelting(ingotInvar, dustInvar, 0.0F);
    ItemHelper.addSmelting(ingotBronze, dustBronze, 0.0F);
    ItemHelper.addSmelting(ingotSignalum, dustSignalum, 0.0F);
    ItemHelper.addSmelting(ingotLumium, dustLumium, 0.0F);
    // No Enderium

    /* Alloy Recipes */
    // @formatter: off
    ItemHelper.addRecipe(
        ShapelessRecipe(
            ItemHelper.cloneStack(dustElectrum, 2), new Object[] {"dustGold", "dustSilver"}));
    ItemHelper.addRecipe(
        ShapelessRecipe(
            ItemHelper.cloneStack(dustInvar, 3),
            new Object[] {"dustIron", "dustIron", "dustNickel"}));
    ItemHelper.addRecipe(
        ShapelessRecipe(
            ItemHelper.cloneStack(dustBronze, 4),
            new Object[] {"dustCopper", "dustCopper", "dustCopper", "dustTin"}));
    ItemHelper.addRecipe(
        ShapelessRecipe(
            ItemHelper.cloneStack(dustSignalum, 4),
            new Object[] {
              "dustCopper", "dustCopper", "dustCopper", "dustSilver", "bucketRedstone"
            }));
    ItemHelper.addRecipe(
        ShapelessRecipe(
            ItemHelper.cloneStack(dustLumium, 4),
            new Object[] {"dustTin", "dustTin", "dustTin", "dustSilver", "bucketGlowstone"}));
    ItemHelper.addRecipe(
        ShapelessRecipe(
            ItemHelper.cloneStack(dustEnderium, 4),
            new Object[] {"dustTin", "dustTin", "dustSilver", "dustPlatinum", "bucketEnder"}));
    // @formatter: on

    /* Storage */
    ItemHelper.addTwoWayStorageRecipe(ingotIron, "ingotIron", nuggetIron, "nuggetIron");
    ItemHelper.addTwoWayStorageRecipe(ingotCopper, "ingotCopper", nuggetCopper, "nuggetCopper");
    ItemHelper.addTwoWayStorageRecipe(ingotTin, "ingotTin", nuggetTin, "nuggetTin");
    ItemHelper.addTwoWayStorageRecipe(ingotSilver, "ingotSilver", nuggetSilver, "nuggetSilver");
    ItemHelper.addTwoWayStorageRecipe(ingotLead, "ingotLead", nuggetLead, "nuggetLead");
    ItemHelper.addTwoWayStorageRecipe(ingotNickel, "ingotNickel", nuggetNickel, "nuggetNickel");
    ItemHelper.addTwoWayStorageRecipe(
        ingotPlatinum, "ingotPlatinum", nuggetPlatinum, "nuggetPlatinum");
    ItemHelper.addTwoWayStorageRecipe(ingotMithril, "ingotMithril", nuggetMithril, "nuggetMithril");
    ItemHelper.addTwoWayStorageRecipe(
        ingotElectrum, "ingotElectrum", nuggetElectrum, "nuggetElectrum");
    ItemHelper.addTwoWayStorageRecipe(ingotInvar, "ingotInvar", nuggetInvar, "nuggetInvar");
    ItemHelper.addTwoWayStorageRecipe(ingotBronze, "ingotBronze", nuggetBronze, "nuggetBronze");
    ItemHelper.addTwoWayStorageRecipe(
        ingotSignalum, "ingotSignalum", nuggetSignalum, "nuggetSignalum");
    ItemHelper.addTwoWayStorageRecipe(ingotLumium, "ingotLumium", nuggetLumium, "nuggetLumium");
    ItemHelper.addTwoWayStorageRecipe(
        ingotEnderium, "ingotEnderium", nuggetEnderium, "nuggetEnderium");

    ItemHelper.addReverseStorageRecipe(ingotCopper, "blockCopper");
    ItemHelper.addReverseStorageRecipe(ingotTin, "blockTin");
    ItemHelper.addReverseStorageRecipe(ingotSilver, "blockSilver");
    ItemHelper.addReverseStorageRecipe(ingotLead, "blockLead");
    ItemHelper.addReverseStorageRecipe(ingotNickel, "blockNickel");
    ItemHelper.addReverseStorageRecipe(ingotPlatinum, "blockPlatinum");
    ItemHelper.addReverseStorageRecipe(ingotMithril, "blockMithril");
    ItemHelper.addReverseStorageRecipe(ingotElectrum, "blockElectrum");
    ItemHelper.addReverseStorageRecipe(ingotInvar, "blockInvar");
    ItemHelper.addReverseStorageRecipe(ingotBronze, "blockBronze");
    ItemHelper.addReverseStorageRecipe(ingotSignalum, "blockSignalum");
    ItemHelper.addReverseStorageRecipe(ingotLumium, "blockLumium");
    ItemHelper.addReverseStorageRecipe(ingotEnderium, "blockEnderium");

    /* Gears */
    ItemHelper.addGearRecipe(gearIron, "ingotIron");
    ItemHelper.addGearRecipe(gearGold, "ingotGold");
    ItemHelper.addGearRecipe(gearCopper, "ingotCopper");
    ItemHelper.addGearRecipe(gearTin, "ingotTin");
    ItemHelper.addGearRecipe(gearSilver, "ingotSilver");
    ItemHelper.addGearRecipe(gearLead, "ingotLead");
    ItemHelper.addGearRecipe(gearNickel, "ingotNickel");
    ItemHelper.addGearRecipe(gearPlatinum, "ingotPlatinum");
    ItemHelper.addGearRecipe(gearMithril, "ingotMithril");
    ItemHelper.addGearRecipe(gearElectrum, "ingotElectrum");
    ItemHelper.addGearRecipe(gearInvar, "ingotInvar");
    ItemHelper.addGearRecipe(gearBronze, "ingotBronze");
    ItemHelper.addGearRecipe(gearSignalum, "ingotSignalum");
    ItemHelper.addGearRecipe(gearLumium, "ingotLumium");
    ItemHelper.addGearRecipe(gearEnderium, "ingotEnderium");

    /* Equipment */
    Equipment.postInit();
  }