xMyou Posted March 11, 2013 Posted March 11, 2013 I have some problem with creating a new Armor with Forge ... Everythings works fine except for the .itemID error it gives me for some reason inside the SapphireArmor.java I can't fix it myself so I hope someone can help me Just in case the mod_file etc. is needed, I will post them too SapphireHelmet.itemID SapphireChest.itemID SapphirePants.itemID SapphireBoots.itemID These .itemID gives the error SapphireArmor.java package modding.morematerials; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraftforge.common.IArmorTextureProvider; public class SapphireArmor extends ItemArmor implements IArmorTextureProvider{ public SapphireArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) { super(par1, par2EnumArmorMaterial, par3, par4); } @Override public String getArmorTextureFile(ItemStack itemstack) { if(itemstack.itemID == mod_MainClass.SapphireHelmet.itemID || itemstack.itemID == mod_MainClass.SapphireChest.itemID || itemstack.itemID == mod_MainClass.SapphireBoots.itemID){ return "/MoreMaterials/Armor/Sapphire_1.png"; } if(itemstack.itemID == mod_MainClass.SapphirePants.itemID){ return "/MoreMaterials/Armor/Sapphire_2.png"; } else return "/MoreMaterials/Armor/Sapphire_2.png"; } public String getTextureFile(){ return"/MoreMaterials/Items.png"; } } mod_MainClass.java package modding.morematerials; import net.minecraft.block.Block; import net.minecraft.item.EnumArmorMaterial; import net.minecraftforge.common.EnumHelper; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Item; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid = "morematerials", name = "More Materials", version = "1.4.7") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class mod_MainClass { private static final EnumArmorMaterial SapphireArmorMaterial = null; private static final String SapphireArmor = null; @SidedProxy(clientSide = "modding.morematerials.ClientProxy", serverSide = "modding.morematerials.ServerProxy") public static ServerProxy proxy; //Ore public static Block SapphireOre; public static Block TopazOre; public static Block AmethystOre; public static Block RubyOre; //Blocks public static Block SapphireBlock; public static Block TopazBlock; public static Block AmethystBlock; public static Block RubyBlock; //Armor public static Item SapphireHelmet; public static Item SapphireChest; public static Item SapphirePants; public static Item SapphireBoots; //Item @PreInit public void load(FMLPreInitializationEvent Preevent){ } @Init public void load(FMLInitializationEvent event){ proxy.registerRenderThings(); proxy.registerServerTickHandler(); //Ore SapphireOre = new SapphireOre (504, 16).setHardness(1.5F).setResistance(10.0F).setBlockName("SaphOre"); TopazOre = new TopazOre (505, 17).setHardness(1.5F).setResistance(10.0F).setBlockName("TopaOre"); RubyOre = new RubyOre (506, 18).setHardness(1.5F).setResistance(10.0F).setBlockName("RubOre"); AmethystOre = new AmethystOre (507, 19).setHardness(1.5F).setResistance(10.0F).setBlockName("AmetOre"); //Block SapphireBlock = new SapphireBlock (500, 0).setHardness(1.5F).setResistance(10.0F).setBlockName("SaphBlock"); TopazBlock = new TopazBlock (501, 1).setHardness(1.5F).setResistance(10.0F).setBlockName("TopaBlock"); RubyBlock = new RubyBlock (502, 2).setHardness(1.5F).setResistance(10.0F).setBlockName("RubBlock"); AmethystBlock = new AmethystBlock (503, 3).setHardness(1.5F).setResistance(10.0F).setBlockName("AmetBlock"); //Item SapphireHelmet = (Item) new SapphireArmor(4000, SapphireArmorMaterial, proxy.addArmor(SapphireArmor), 0).setItemName("Sapphire Helmet").setIconIndex(0); SapphireChest = (Item) new SapphireArmor(4001, SapphireArmorMaterial, proxy.addArmor(SapphireArmor), 1).setItemName("Sapphire Chestplate").setIconIndex(0); SapphirePants = (Item) new SapphireArmor(4002, SapphireArmorMaterial, proxy.addArmor(SapphireArmor), 2).setItemName("Sapphire Leggings").setIconIndex(0); SapphireBoots = (Item) new SapphireArmor(4003, SapphireArmorMaterial, proxy.addArmor(SapphireArmor), 3).setItemName("Sapphire Boots").setIconIndex(0); //EnumArmorMaterial EnumArmorMaterial SapphireArmorMaterial = EnumHelper.addArmorMaterial("Sapphire_Armor", 22, new int[] {3, 6, 4, 3}, 14); //Armor //EnumToolMaterial //Tools //Registry GameRegistry.registerBlock(SapphireBlock, "Saph_Block"); GameRegistry.registerBlock(TopazBlock, "Topa_Block"); GameRegistry.registerBlock(AmethystBlock, "Amet_Block"); GameRegistry.registerBlock(RubyBlock, "Rub_Block"); GameRegistry.registerBlock(SapphireOre, "Saph_Ore"); GameRegistry.registerBlock(TopazOre, "Topa_Ore"); GameRegistry.registerBlock(AmethystOre, "Amet_Ore"); GameRegistry.registerBlock(RubyOre, "Rub_Ore"); //Harvest Level MinecraftForge.setBlockHarvestLevel(SapphireOre, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(TopazOre, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(AmethystOre, "pickaxe", 2); MinecraftForge.setBlockHarvestLevel(RubyOre, "pickaxe", 2); //Name LanguageRegistry.addName(SapphireBlock, "Sapphire Block"); LanguageRegistry.addName(TopazBlock, "Topaz Block"); LanguageRegistry.addName(AmethystBlock, "Amethyst Block"); LanguageRegistry.addName(RubyBlock, "Ruby Block"); LanguageRegistry.addName(SapphireOre, "Sapphire Ore"); LanguageRegistry.addName(TopazOre, "Topaz Ore"); LanguageRegistry.addName(AmethystOre, "Amethyst Ore"); LanguageRegistry.addName(RubyOre, "Ruby Ore"); LanguageRegistry.addName(SapphireHelmet, "Sapphire Helmet"); LanguageRegistry.addName(SapphireChest, "Sapphire Chestplate"); LanguageRegistry.addName(SapphirePants, "Sapphire Leggings"); LanguageRegistry.addName(SapphireBoots, "Sapphire Boots"); } } ClientProxy.java package modding.morematerials; import cpw.mods.fml.client.registry.RenderingRegistry; import net.minecraftforge.client.MinecraftForgeClient; public class ClientProxy extends ServerProxy{ @Override public void registerRenderThings(){ MinecraftForgeClient.preloadTexture("/MoreMaterials/Blocks.png"); MinecraftForgeClient.preloadTexture("/MoreMaterials/Items.png"); } public int addArmor(String Armor){ return RenderingRegistry.addNewArmourRendererPrefix(Armor); } } ServerProxy.java package modding.morematerials; import cpw.mods.fml.common.registry.TickRegistry; import cpw.mods.fml.relauncher.Side; public class ServerProxy { public void registerRenderThings(){ } public void registerServerTickHandler(){ TickRegistry.registerTickHandler(new ServerTickHandler(), Side.SERVER); } public int addArmor(String Armor) { return 0; } } Quote
ashtonr12 Posted March 11, 2013 Posted March 11, 2013 replace .itemID with .shiftedIndex Quote Use examples, i have aspergers. Examples make sense to me.
ashtonr12 Posted March 11, 2013 Posted March 11, 2013 here is my armor plate code, this DEFINITELY works, all you have to do to change it to boots and such is change the class name. package ashtonsmod.common; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraftforge.common.IArmorTextureProvider; public class ObsidianPlate extends ItemArmor implements IArmorTextureProvider{ public ObsidianPlate(int par1,EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) { super(par1, par2EnumArmorMaterial, par3, par4); } @Override public String getTextureFile(){ return CommonProxy.items_png; } public String getArmorTextureFile(ItemStack par1){ if ( par1.itemID==ashtonsmod.ObsidianHelmet.shiftedIndex|| par1.itemID==ashtonsmod.ObsidianPlate.shiftedIndex|| par1.itemID==ashtonsmod.ObsidianBoots.shiftedIndex){ return "/armor/ObsidianArmor_1.png"; }if(par1.itemID==ashtonsmod.ObsidianLegs.shiftedIndex){ return "/armor/ObsidianArmor_2.png"; }return "/armor/ObsidianArmor_2.png"; } } Quote Use examples, i have aspergers. Examples make sense to me.
xMyou Posted March 11, 2013 Author Posted March 11, 2013 Well .... Didn't worked too .... Seems like there has to be something wrong in one of the other .java files >__< Edit: Since there has to be something wrong I will make a completly new modding folder and try it again and well ... maybe it doesnt give me an error then Did the same as in the Tutorials and still that error -__- Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.