Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Smoozy_01

Members
  • Joined

  • Last visited

  1. Hey I'm really stuck with an issue and I can't get help anywhere. I'm trying to render new armors to the game, everything is working correctly until I add one additionnal armor to the game although I use the same code for every armor. The game does not crash but the console get an error when I switch to 3rd person view. Here's my code, I got the issue for the Onyx armor package com.shoana.mod; import com.shoana.mod.items.*; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemFood; import net.minecraftforge.common.util.EnumHelper; import com.shoana.mod.items.ItemArmorTopaze; import com.shoana.mod.items.ItemArmorAzurite; import com.shoana.mod.items.ItemArmorAmethyst; import com.shoana.mod.items.ItemArmorVoracium; public class ModItem { public static ItemArmor.ArmorMaterial topaze_armor = EnumHelper.addArmorMaterial("topaze_armor", 34, new int[]{3, 7, 6, 9}, 30); public static ItemArmor.ArmorMaterial azurite_armor = EnumHelper.addArmorMaterial("azurite_armor", 35, new int[]{3, 8, 7, 3}, 30); public static ItemArmor.ArmorMaterial amethyst_armor = EnumHelper.addArmorMaterial("amethyst_armor", 36, new int[]{3, 9, 7, 3}, 30); public static ItemArmor.ArmorMaterial onyx_armor = EnumHelper.addArmorMaterial("onyx_armor", 40, new int[]{5, 10, 9, 5}, 30); public static ItemArmor.ArmorMaterial voracium_armor = EnumHelper.addArmorMaterial("voracium_armor", 40, new int[]{5, 10, 9, 5}, 30); public static final Item.ToolMaterial topaze_toolMaterial = EnumHelper.addToolMaterial("topaze_toolMaterial", 3, 1700, 9.0F, 3.8F, 30); public static final Item.ToolMaterial azurite_toolMaterial = EnumHelper.addToolMaterial("azurite_toolMaterial", 3, 1800, 9.0F, 4.1F, 30); public static final Item.ToolMaterial amethyst_toolMaterial = EnumHelper.addToolMaterial("amethyst_toolMaterial", 3, 2050, 10.0F, 4.8F, 30); public static final Item.ToolMaterial onyx_toolMaterial = EnumHelper.addToolMaterial("onyx_toolMaterial", 3, 2600, 10.0F, 5.4F, 30); public static final Item.ToolMaterial voracium_toolMaterial = EnumHelper.addToolMaterial("voracium_toolMaterial", 3, 3000, 10.0F, 5.8F, 30); public static Item topaze_helmet, topaze_chestplate, topaze_leggings, topaze_boots; public static Item azurite_helmet, azurite_chestplate, azurite_leggings, azurite_boots; public static Item amethyst_helmet, amethyst_chestplate, amethyst_leggings, amethyst_boots; public static Item voracium_helmet, voracium_chestplate, voracium_leggings, voracium_boots; public static Item onyx_helmet, onyx_chestplate, onyx_leggings, onyx_boots; public static Item topaze_pickaxe, topaze_axe, topaze_shovel, topaze_hoe, topaze_sword; public static Item azurite_pickaxe, azurite_axe, azurite_shovel, azurite_hoe, azurite_sword; public static Item amethyst_pickaxe, amethyst_axe, amethyst_shovel, amethyst_hoe, amethyst_sword; public static Item onyx_pickaxe, onyx_axe, onyx_shovel, onyx_hoe, onyx_sword; public static Item voracium_sword; public static Item pinnapleItem, pineapple_seed; public static Item chaud_ananas; public static Item weedItem; public static void init() { topaze_helmet = new ItemArmorTopaze(topaze_armor, 1, 0).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":topaze_helmet").setUnlocalizedName("topaze_helmet"); topaze_chestplate = new ItemArmorTopaze(topaze_armor, 1, 1).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":topaze_chestplate").setUnlocalizedName("topaze_chestplate"); topaze_leggings = new ItemArmorTopaze(topaze_armor, 1, 2).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":topaze_leggings").setUnlocalizedName("topaze_leggings"); topaze_boots = new ItemArmorTopaze(topaze_armor, 1, 3).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":topaze_boots").setUnlocalizedName("topaze_boots"); azurite_helmet = new ItemArmorAzurite(azurite_armor, 2, 0).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":azurite_helmet").setUnlocalizedName("azurite_helmet"); azurite_chestplate = new ItemArmorAzurite(azurite_armor, 2, 1).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":azurite_chestplate").setUnlocalizedName("azurite_chestplate"); azurite_leggings = new ItemArmorAzurite(azurite_armor, 2, 2).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":azurite_leggings").setUnlocalizedName("azurite_leggings"); azurite_boots = new ItemArmorAzurite(azurite_armor, 2, 3).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":azurite_boots").setUnlocalizedName("azurite_boots"); amethyst_helmet = new ItemArmorAmethyst(amethyst_armor, 3, 0).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":amethyst_helmet").setUnlocalizedName("amethyst_helmet"); amethyst_chestplate = new ItemArmorAmethyst(amethyst_armor, 3, 1).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":amethyst_chestplate").setUnlocalizedName("amethyst_chestplate"); amethyst_leggings = new ItemArmorAmethyst(amethyst_armor, 3, 2).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":amethyst_leggings").setUnlocalizedName("amethyst_leggings"); amethyst_boots = new ItemArmorAmethyst(amethyst_armor, 3, 3).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":amethyst_boots").setUnlocalizedName("amethyst_boots"); voracium_helmet = new ItemArmorVoracium(voracium_armor, 4, 0).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":voracium_helmet").setUnlocalizedName("voracium_helmet"); voracium_chestplate = new ItemArmorVoracium(voracium_armor, 4, 1).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":voracium_chestplate").setUnlocalizedName("voracium_chestplate"); voracium_leggings = new ItemArmorVoracium(voracium_armor, 4, 2).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":voracium_leggings").setUnlocalizedName("voracium_leggings"); voracium_boots = new ItemArmorVoracium(voracium_armor, 4, 3).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":voracium_boots").setUnlocalizedName("voracium_boots"); onyx_helmet = new ItemArmorVoracium(onyx_armor, 5, 0).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":onyx_helmet").setUnlocalizedName("onyx_helmet"); onyx_chestplate = new ItemArmorVoracium(onyx_armor, 5, 1).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":onyx_chestplate").setUnlocalizedName("onyx_chestplate"); onyx_leggings = new ItemArmorVoracium(onyx_armor, 5, 2).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":onyx_leggings").setUnlocalizedName("onyx_leggings"); onyx_boots = new ItemArmorVoracium(onyx_armor, 5, 3).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":onyx_boots").setUnlocalizedName("onyx_boots"); topaze_pickaxe = new ItemTopazePickaxe(topaze_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":topaze_pickaxe").setUnlocalizedName("topaze_pickaxe"); topaze_axe = new ItemTopazeAxe(topaze_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":topaze_axe").setUnlocalizedName("topaze_axe"); topaze_shovel = new ItemTopazeShovel(topaze_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":topaze_shovel").setUnlocalizedName("topaze_shovel"); topaze_hoe = new ItemTopazeHoe(topaze_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":topaze_hoe").setUnlocalizedName("topaze_hoe"); topaze_sword = new ItemTopazeSword(topaze_toolMaterial).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":topaze_sword").setUnlocalizedName("topaze_sword"); azurite_pickaxe = new ItemAzuritePickaxe(azurite_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":azurite_pickaxe").setUnlocalizedName("azurite_pickaxe"); azurite_axe = new ItemAzuriteAxe(azurite_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":azurite_axe").setUnlocalizedName("azurite_axe"); azurite_shovel = new ItemAzuriteShovel(azurite_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":azurite_shovel").setUnlocalizedName("azurite_shovel"); azurite_hoe = new ItemAzuriteHoe(azurite_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":azurite_hoe").setUnlocalizedName("azurite_hoe"); azurite_sword = new ItemAzuriteSword(azurite_toolMaterial).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":azurite_sword").setUnlocalizedName("azurite_sword"); amethyst_pickaxe = new ItemAmethystPickaxe(amethyst_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":amethyst_pickaxe").setUnlocalizedName("amethyst_pickaxe"); amethyst_axe = new ItemAmethystAxe(amethyst_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":amethyst_axe").setUnlocalizedName("amethyst_axe"); amethyst_shovel = new ItemAmethystShovel(amethyst_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":amethyst_shovel").setUnlocalizedName("amethyst_shovel"); amethyst_hoe = new ItemAmethystHoe(amethyst_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":amethyst_hoe").setUnlocalizedName("amethyst_hoe"); amethyst_sword = new ItemAmethystSword(amethyst_toolMaterial).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":amethyst_sword").setUnlocalizedName("amethyst_sword"); onyx_pickaxe = new ItemOnyxPickaxe(onyx_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":onyx_pickaxe").setUnlocalizedName("onyx_pickaxe"); onyx_axe = new ItemOnyxAxe(onyx_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":onyx_axe").setUnlocalizedName("onyx_axe"); onyx_shovel = new ItemOnyxShovel(onyx_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":onyx_shovel").setUnlocalizedName("onyx_shovel"); onyx_hoe = new ItemOnyxHoe(onyx_toolMaterial).setCreativeTab(CreativeTabs.tabTools).setTextureName(Reference.MODID + ":onyx_hoe").setUnlocalizedName("onyx_hoe"); onyx_sword = new ItemOnyxSword(onyx_toolMaterial).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":onyx_sword").setUnlocalizedName("onyx_sword"); voracium_sword = new ItemVoraciumSword(voracium_toolMaterial).setCreativeTab(CreativeTabs.tabCombat).setTextureName(Reference.MODID + ":voracium_sword").setUnlocalizedName("voracium_sword"); pinnapleItem = new itemPinnaple(4, 0.3F, false).setTextureName(Reference.MODID + ":apple_golden"); pineapple_seed = new itemSeedPineapple(); chaud_ananas = new itemShoananas(4, 0.3F, false).setTextureName(Reference.MODID + ":chaud_ananas"); weedItem = new itemWeed((ModBlocks.weed_block)).setUnlocalizedName("weedItem").setCreativeTab(CreativeTabs.tabFood).setTextureName(Reference.MODID + ":weed_item"); } public static void register() { GameRegistry.registerItem(topaze_helmet, "topaze_helmet"); GameRegistry.registerItem(topaze_chestplate, "topaze_chestplate"); GameRegistry.registerItem(topaze_leggings, "topaze_leggings"); GameRegistry.registerItem(topaze_boots, "topaze_boots"); GameRegistry.registerItem(azurite_helmet, "azurite_helmet"); GameRegistry.registerItem(azurite_chestplate, "azurite_chestplate"); GameRegistry.registerItem(azurite_leggings, "azurite_leggings"); GameRegistry.registerItem(azurite_boots, "azurite_boots"); GameRegistry.registerItem(amethyst_helmet, "amethyst_helmet"); GameRegistry.registerItem(amethyst_chestplate, "amethyst_chestplate"); GameRegistry.registerItem(amethyst_leggings, "amethyst_leggings"); GameRegistry.registerItem(amethyst_boots, "amethyst_boots"); GameRegistry.registerItem(voracium_helmet, "voracium_helmet"); GameRegistry.registerItem(voracium_chestplate, "voracium_chestplate"); GameRegistry.registerItem(voracium_leggings, "voracium_leggings"); GameRegistry.registerItem(voracium_boots, "voracium_boots"); GameRegistry.registerItem(onyx_helmet, "onyx_helmet"); GameRegistry.registerItem(onyx_chestplate, "onyx_chestplate"); GameRegistry.registerItem(onyx_leggings, "onyx_leggings"); GameRegistry.registerItem(onyx_boots, "onyx_boots"); GameRegistry.registerItem(pinnapleItem, "pinnaple_item"); GameRegistry.registerItem(pineapple_seed, "pineapple_seed"); GameRegistry.registerItem(chaud_ananas, "chaud_ananas"); GameRegistry.registerItem(topaze_pickaxe, "topaze_pickaxe"); GameRegistry.registerItem(topaze_axe, "topaze_axe"); GameRegistry.registerItem(topaze_shovel, "topaze_shovel"); GameRegistry.registerItem(topaze_hoe, "topaze_hoe"); GameRegistry.registerItem(topaze_sword, "topaze_sword"); GameRegistry.registerItem(azurite_pickaxe, "azurite_pickaxe"); GameRegistry.registerItem(azurite_axe, "azurite_axe"); GameRegistry.registerItem(azurite_shovel, "azurite_shovel"); GameRegistry.registerItem(azurite_hoe, "azurite_hoe"); GameRegistry.registerItem(azurite_sword, "azurite_sword"); GameRegistry.registerItem(amethyst_pickaxe, "amethyst_pickaxe"); GameRegistry.registerItem(amethyst_axe, "amethyst_axe"); GameRegistry.registerItem(amethyst_shovel, "amethyst_shovel"); GameRegistry.registerItem(amethyst_hoe, "amethyst_hoe"); GameRegistry.registerItem(amethyst_sword, "amethyst_sword"); GameRegistry.registerItem(onyx_pickaxe, "onyx_pickaxe"); GameRegistry.registerItem(onyx_axe, "onyx_axe"); GameRegistry.registerItem(onyx_shovel, "onyx_shovel"); GameRegistry.registerItem(onyx_hoe, "onyx_hoe"); GameRegistry.registerItem(onyx_sword, "onyx_sword"); GameRegistry.registerItem(voracium_sword, "voracium_sword"); GameRegistry.registerItem(weedItem, "weed_item"); } } package com.shoana.mod.items; import com.shoana.mod.ModItem; import com.shoana.mod.Reference; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; public class itemArmorOnyx extends ItemArmor { public itemArmorOnyx(ArmorMaterial material, int renderIndex, int armorType) { super(material, renderIndex, armorType); } @Override public String getArmorTexture(ItemStack stack, Entity entity, int metaData, String type) { if(stack.getItem() == ModItem.onyx_leggings) { return Reference.MODID + ":textures/models/armor/onyx_layer_2.png"; } else if(stack.getItem() == ModItem.onyx_helmet || stack.getItem() == ModItem.onyx_chestplate || stack.getItem() == ModItem.onyx_boots) { return Reference.MODID + ":textures/models/armor/onyx_layer_1.png"; } return null; } } I get tis error java.lang.ArrayIndexOutOfBoundsException: 5 at net.minecraft.client.renderer.entity.RenderBiped.getArmorResource(RenderBiped.java:408) ~[RenderBiped.class:?] at net.minecraft.client.renderer.entity.RenderPlayer.shouldRenderPass(RenderPlayer.java:70) ~[RenderPlayer.class:?] at net.minecraft.client.renderer.entity.RenderPlayer.shouldRenderPass(RenderPlayer.java:517) ~[RenderPlayer.class:?] at net.minecraft.client.renderer.entity.RendererLivingEntity.doRender(RendererLivingEntity.java:173) [RendererLivingEntity.class:?] at net.minecraft.client.renderer.entity.RenderPlayer.doRender(RenderPlayer.java:167) [RenderPlayer.class:?] at net.minecraft.client.renderer.entity.RenderPlayer.doRender(RenderPlayer.java:565) [RenderPlayer.class:?] at net.minecraft.client.renderer.entity.RenderManager.func_147939_a(RenderManager.java:300) [RenderManager.class:?] at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:283) [RenderManager.class:?] at net.minecraft.client.gui.inventory.GuiInventory.func_147046_a(GuiInventory.java:112) [GuiInventory.class:?] at net.minecraft.client.gui.inventory.GuiContainerCreative.drawGuiContainerBackgroundLayer(GuiContainerCreative.java:839) [GuiContainerCreative.class:?] at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:93) [GuiContainer.class:?] at net.minecraft.client.renderer.InventoryEffectRenderer.drawScreen(InventoryEffectRenderer.java:44) [InventoryEffectRenderer.class:?] at net.minecraft.client.gui.inventory.GuiContainerCreative.drawScreen(GuiContainerCreative.java:673) [GuiContainerCreative.class:?] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1137) [EntityRenderer.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:962) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_202] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_202] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_202] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_202] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?] at GradleStart.main(Unknown Source) [start/:?]

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.