From 2d9af1748c38df07c354b432246db067223a88fc Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 25 Jul 2015 08:51:28 +0200 Subject: [PATCH] Made work what I just did --- .../actuallyadditions/items/InitItems.java | 25 +++++++++---------- .../actuallyadditions/items/ItemArmorAA.java | 11 +++++--- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java index b7de5b04c..210653006 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java @@ -9,7 +9,6 @@ import ellpeck.actuallyadditions.material.InitToolMaterials; import ellpeck.actuallyadditions.util.CompatUtil; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; -import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; @@ -112,22 +111,22 @@ public class InitItems{ public static void init(){ ModUtil.LOGGER.info("Initializing Items..."); - itemHelmEmerald = new ItemArmorAA("itemHelmEmerald", InitArmorMaterials.armorMaterialEmerald, 0, new ItemStack(Items.emerald), "armorEmerald"); - itemChestEmerald = new ItemArmorAA("itemChestEmerald", InitArmorMaterials.armorMaterialEmerald, 1, new ItemStack(Items.emerald), "armorEmerald"); - itemPantsEmerald = new ItemArmorAA("itemPantsEmerald", InitArmorMaterials.armorMaterialEmerald, 2, new ItemStack(Items.emerald), "armorEmerald"); - itemBootsEmerald = new ItemArmorAA("itemBootsEmerald", InitArmorMaterials.armorMaterialEmerald, 3, new ItemStack(Items.emerald), "armorEmerald"); + itemHelmEmerald = new ItemArmorAA("itemHelmEmerald", InitArmorMaterials.armorMaterialEmerald, 0, "gemEmerald", "armorEmerald"); + itemChestEmerald = new ItemArmorAA("itemChestEmerald", InitArmorMaterials.armorMaterialEmerald, 1, "gemEmerald", "armorEmerald"); + itemPantsEmerald = new ItemArmorAA("itemPantsEmerald", InitArmorMaterials.armorMaterialEmerald, 2, "gemEmerald", "armorEmerald"); + itemBootsEmerald = new ItemArmorAA("itemBootsEmerald", InitArmorMaterials.armorMaterialEmerald, 3, "gemEmerald", "armorEmerald"); ItemUtil.registerItems(new Item[]{itemHelmEmerald, itemChestEmerald, itemPantsEmerald, itemBootsEmerald}); - itemHelmObsidian = new ItemArmorAA("itemHelmObsidian", InitArmorMaterials.armorMaterialObsidian, 0, new ItemStack(Blocks.obsidian), "armorObsidian"); - itemChestObsidian = new ItemArmorAA("itemChestObsidian", InitArmorMaterials.armorMaterialObsidian, 1, new ItemStack(Blocks.obsidian), "armorObsidian"); - itemPantsObsidian = new ItemArmorAA("itemPantsObsidian", InitArmorMaterials.armorMaterialObsidian, 2, new ItemStack(Blocks.obsidian), "armorObsidian"); - itemBootsObsidian = new ItemArmorAA("itemBootsObsidian", InitArmorMaterials.armorMaterialObsidian, 3, new ItemStack(Blocks.obsidian), "armorObsidian"); + itemHelmObsidian = new ItemArmorAA("itemHelmObsidian", InitArmorMaterials.armorMaterialObsidian, 0, "obsidian", "armorObsidian"); + itemChestObsidian = new ItemArmorAA("itemChestObsidian", InitArmorMaterials.armorMaterialObsidian, 1, "obsidian", "armorObsidian"); + itemPantsObsidian = new ItemArmorAA("itemPantsObsidian", InitArmorMaterials.armorMaterialObsidian, 2, "obsidian", "armorObsidian"); + itemBootsObsidian = new ItemArmorAA("itemBootsObsidian", InitArmorMaterials.armorMaterialObsidian, 3, "obsidian", "armorObsidian"); ItemUtil.registerItems(new Item[]{itemHelmObsidian, itemChestObsidian, itemPantsObsidian, itemBootsObsidian}); - itemHelmQuartz = new ItemArmorAA("itemHelmQuartz", InitArmorMaterials.armorMaterialQuartz, 0, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz"); - itemChestQuartz = new ItemArmorAA("itemChestQuartz", InitArmorMaterials.armorMaterialQuartz, 1, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz"); - itemPantsQuartz = new ItemArmorAA("itemPantsQuartz", InitArmorMaterials.armorMaterialQuartz, 2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz"); - itemBootsQuartz = new ItemArmorAA("itemBootsQuartz", InitArmorMaterials.armorMaterialQuartz, 3, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz"); + itemHelmQuartz = new ItemArmorAA("itemHelmQuartz", InitArmorMaterials.armorMaterialQuartz, 0, "gemQuartzBlack", "armorQuartz"); + itemChestQuartz = new ItemArmorAA("itemChestQuartz", InitArmorMaterials.armorMaterialQuartz, 1, "gemQuartzBlack", "armorQuartz"); + itemPantsQuartz = new ItemArmorAA("itemPantsQuartz", InitArmorMaterials.armorMaterialQuartz, 2, "gemQuartzBlack", "armorQuartz"); + itemBootsQuartz = new ItemArmorAA("itemBootsQuartz", InitArmorMaterials.armorMaterialQuartz, 3, "gemQuartzBlack", "armorQuartz"); ItemUtil.registerItems(new Item[]{itemHelmQuartz, itemChestQuartz, itemPantsQuartz, itemBootsQuartz}); itemTeleStaff = new ItemTeleStaff(); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemArmorAA.java b/src/main/java/ellpeck/actuallyadditions/items/ItemArmorAA.java index 7a0e9bc1c..64f8ffb64 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemArmorAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemArmorAA.java @@ -12,16 +12,17 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; +import net.minecraftforge.oredict.OreDictionary; import java.util.List; public class ItemArmorAA extends ItemArmor implements INameableItem{ - private ItemStack repairItem; + private String repairItem; private String name; private String[] textures; - public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, String textureBase){ + public ItemArmorAA(String name, ArmorMaterial material, int type, String repairItem, String textureBase){ super(material, 0, type); this.repairItem = repairItem; this.name = name; @@ -59,7 +60,11 @@ public class ItemArmorAA extends ItemArmor implements INameableItem{ @Override public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ - return this.repairItem != null && stack.getItem() == this.repairItem.getItem(); + int[] idsStack = OreDictionary.getOreIDs(stack); + for(int id : idsStack){ + if(OreDictionary.getOreName(id).equals(repairItem)) return true; + } + return false; } @Override