Jump to content

Custom Armors and Forge 4.0.0.217


blued00r

Recommended Posts

Hello I'm recieving this error if my custom armor protection values are over 8.

 

Not too sure if the way armors are made in the new version of forge has changed since 1.2.5. If it did change could someone just point me in the right direction on how to convert my armors to the new way forge manages armors

 

2012-08-21 23:47:41 [iNFO] [sTDERR] java.lang.ArrayIndexOutOfBoundsException: 8
2012-08-21 23:47:41 [iNFO] [sTDERR] 	at net.minecraft.src.RenderPlayer.setArmorModel(RenderPlayer.java:41)
2012-08-21 23:47:41 [iNFO] [sTDERR] 	at net.minecraft.src.RenderPlayer.shouldRenderPass(RenderPlayer.java:416)
2012-08-21 23:47:41 [iNFO] [sTDERR] 	at net.minecraft.src.RenderLiving.doRenderLiving(RenderLiving.java:107)
2012-08-21 23:47:41 [iNFO] [sTDERR] 	at net.minecraft.src.RenderPlayer.renderPlayer(RenderPlayer.java:91)
2012-08-21 23:47:41 [iNFO] [sTDERR] 	at net.minecraft.src.RenderPlayer.doRender(RenderPlayer.java:450)
2012-08-21 23:47:41 [iNFO] [sTDERR] 	at net.minecraft.src.RenderManager.renderEntityWithPosYaw(RenderManager.java:188)
2012-08-21 23:47:41 [iNFO] [sTDERR] 	at net.minecraft.src.GuiInventory.func_74223_a(GuiInventory.java:106)
2012-08-21 23:47:41 [iNFO] [sTDERR] 	at net.minecraft.src.GuiInventory.drawGuiContainerBackgroundLayer(GuiInventory.java:83)
2012-08-21 23:47:41 [iNFO] [sTDERR] 	at net.minecraft.src.GuiContainer.drawScreen(GuiContainer.java:57)
2012-08-21 23:47:41 [iNFO] [sTDERR] 	at net.minecraft.src.InventoryEffectRenderer.drawScreen(InventoryEffectRenderer.java:35)
2012-08-21 23:47:41 [iNFO] [sTDERR] 	at net.minecraft.src.GuiInventory.drawScreen(GuiInventory.java:67)
2012-08-21 23:47:41 [iNFO] [sTDERR] 	at net.minecraft.src.EntityRenderer.updateCameraAndRender(EntityRenderer.java:925)
2012-08-21 23:47:41 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:868)
2012-08-21 23:47:41 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.run(Minecraft.java:761)
2012-08-21 23:47:41 [iNFO] [sTDERR] 	at java.lang.Thread.run(Unknown Source)

 

In my mod file I have

 

static EnumArmorMaterial bedrockarmor = EnumHelper.addArmorMaterial("Bedrock", 33, new int[]{3, 8, 6, 6}, 10);
public static final Item bedrockHead = new ItemBedrockArmor(578, bedrockarmor, 3, 0).setIconIndex(6).setItemName("bedrockhead");
public static final Item bedrockBody = new ItemBedrockArmor(571, bedrockarmor, 8, 1).setIconIndex(.setItemName("bedrockbody");
public static final Item bedrockLegs = new ItemBedrockArmor(579, bedrockarmor, 6, 2).setIconIndex(9).setItemName("bedrocklegs");
public static final Item bedrockBoots = new ItemBedrockArmor(580, bedrockarmor, 3, 3).setIconIndex(7).setItemName("bedrockboots");

 

The Bedrock legs and bedrock body are giving me errors as I apply the armor to the player and do not show on the player

Link to comment
Share on other sites

8 is not a valid render id "java.lang.ArrayIndexOutOfBoundsException: 8"

public static final Item bedrockBody = new ItemBedrockArmor(571, bedrockarmor, 8, 1).setIconIndex(.setItemName("bedrockbody");

Where you have "8" is the armor render index.

0 to 4 are used by the default armors.

 

 

look at the code I posted here

http://www.minecraftforge.net/forum/index.php/topic,1455.0.html

Link to comment
Share on other sites

Not your EnumArmorMaterial, its within range

private static final int[] maxDamageArray = new int[] {11, 16, 15, 13};

 

Your armor is calling an invalid id, until you register one the array stops at 4 and they are used by the default armors.

 

 

    public static Item helmetLeather = (new ItemArmor(42, EnumArmorMaterial.CLOTH, 0, 0)).setIconCoord(0, 0).setItemName("helmetCloth");
    public static Item plateLeather = (new ItemArmor(43, EnumArmorMaterial.CLOTH, 0, 1)).setIconCoord(0, 1).setItemName("chestplateCloth");
    public static Item legsLeather = (new ItemArmor(44, EnumArmorMaterial.CLOTH, 0, 2)).setIconCoord(0, 2).setItemName("leggingsCloth");
    public static Item bootsLeather = (new ItemArmor(45, EnumArmorMaterial.CLOTH, 0, 3)).setIconCoord(0, 3).setItemName("bootsCloth");
    public static Item helmetChain = (new ItemArmor(46, EnumArmorMaterial.CHAIN, 1, 0)).setIconCoord(1, 0).setItemName("helmetChain");
    public static Item plateChain = (new ItemArmor(47, EnumArmorMaterial.CHAIN, 1, 1)).setIconCoord(1, 1).setItemName("chestplateChain");
    public static Item legsChain = (new ItemArmor(48, EnumArmorMaterial.CHAIN, 1, 2)).setIconCoord(1, 2).setItemName("leggingsChain");
    public static Item bootsChain = (new ItemArmor(49, EnumArmorMaterial.CHAIN, 1, 3)).setIconCoord(1, 3).setItemName("bootsChain");
    public static Item helmetSteel = (new ItemArmor(50, EnumArmorMaterial.IRON, 2, 0)).setIconCoord(2, 0).setItemName("helmetIron");
    public static Item plateSteel = (new ItemArmor(51, EnumArmorMaterial.IRON, 2, 1)).setIconCoord(2, 1).setItemName("chestplateIron");
    public static Item legsSteel = (new ItemArmor(52, EnumArmorMaterial.IRON, 2, 2)).setIconCoord(2, 2).setItemName("leggingsIron");
    public static Item bootsSteel = (new ItemArmor(53, EnumArmorMaterial.IRON, 2, 3)).setIconCoord(2, 3).setItemName("bootsIron");
    public static Item helmetDiamond = (new ItemArmor(54, EnumArmorMaterial.DIAMOND, 3, 0)).setIconCoord(3, 0).setItemName("helmetDiamond");
    public static Item plateDiamond = (new ItemArmor(55, EnumArmorMaterial.DIAMOND, 3, 1)).setIconCoord(3, 1).setItemName("chestplateDiamond");
    public static Item legsDiamond = (new ItemArmor(56, EnumArmorMaterial.DIAMOND, 3, 2)).setIconCoord(3, 2).setItemName("leggingsDiamond");
    public static Item bootsDiamond = (new ItemArmor(57, EnumArmorMaterial.DIAMOND, 3, 3)).setIconCoord(3, 3).setItemName("bootsDiamond");
    public static Item helmetGold = (new ItemArmor(58, EnumArmorMaterial.GOLD, 4, 0)).setIconCoord(4, 0).setItemName("helmetGold");
    public static Item plateGold = (new ItemArmor(59, EnumArmorMaterial.GOLD, 4, 1)).setIconCoord(4, 1).setItemName("chestplateGold");
    public static Item legsGold = (new ItemArmor(60, EnumArmorMaterial.GOLD, 4, 2)).setIconCoord(4, 2).setItemName("leggingsGold");
    public static Item bootsGold = (new ItemArmor(61, EnumArmorMaterial.GOLD, 4, 3)).setIconCoord(4, 3).setItemName("bootsGold");

 

 

bedrockHead is using the dimond id ( 3 )

bedrockBody is using an invalid id ( 8 )

bedrockLegs is using an invalid id ( 6 )

bedrockBoots is using dimond id ( 3 )

 

you've also got two issues with your item Id's

#1 - they are hard coded, use a config file so users can change the id if they need to

#2 - they are too low, you need to be above 4096 to get into item id's

 

 

Here I'll give you a little push.

 

Put this where your current code is:

public static Item bedrockHead;
public static Item bedrockBody;
public static Item bedrockLegs;
public static Item bedrockBoots;

 

Put this in your @Init

//Read from Config File Here
bedrockHeadId = /*GetValue From Config, Default:*/ 7578; //I added 7000 to your old ids
bedrockBodyId = /*GetValue From Config, Default:*/ 7571;
bedrockLegsId = /*GetValue From Config, Default:*/ 7579;
bedrockBootsId = /*GetValue From Config, Default:*/ 7580;

EnumArmorMaterial bedrockarmor = EnumHelper.addArmorMaterial("Bedrock", 33, new int[]{3, 8, 6, 6}, 10);
int bedRockArmorId = proxy.addArmor("BedRock"); //There is more info about this in the link I gave you

bedrockHead = new ItemBedrockArmor(bedrockHeadId, bedrockarmor, bedRockArmorId, 0).setIconIndex(6).setItemName("bedrockhead");
bedrockBody = new ItemBedrockArmor(bedrockBodyId, bedrockarmor, bedRockArmorId, 1).setIconIndex(.setItemName("bedrockbody");
bedrockLegs = new ItemBedrockArmor(bedrockLegsId, bedrockarmor, bedRockArmorId, 2).setIconIndex(9).setItemName("bedrocklegs");
bedrockBoots = new ItemBedrockArmor(bedrockBootsId, bedrockarmor, bedRockArmorId, 3).setIconIndex(7).setItemName("bedrockboots");

 

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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