Jump to content

Recommended Posts

Posted

I know this is the McForge forum, but nobody responds on the Mc Forums, and I really need help! Sorry :-*

 

I am at a point in my mod, where I include armour.

I put in the code, and texture (of the armour itself), and ran it.

It (howsoever) doesn't show the texture of me wearing my armour (in my inventory).

 

Then, if I look in the console of Eclipse, I get this error:

 

java.lang.ArrayIndexOutOfBoundsException: 5
at net.minecraft.src.RenderPlayer.setArmorModel(RenderPlayer.java:35)
at net.minecraft.src.RenderPlayer.shouldRenderPass(RenderPlayer.java:498)
at net.minecraft.src.RenderLiving.doRenderLiving(RenderLiving.java:113)
at net.minecraft.src.RenderPlayer.renderPlayer(RenderPlayer.java:140)
at net.minecraft.src.RenderPlayer.doRender(RenderPlayer.java:532)
at net.minecraft.src.RenderManager.renderEntityWithPosYaw(RenderManager.java:218)
at net.minecraft.src.GuiInventory.func_74223_a(GuiInventory.java:106)
at net.minecraft.src.GuiInventory.drawGuiContainerBackgroundLayer(GuiInventory.java:83)
at net.minecraft.src.GuiContainer.drawScreen(GuiContainer.java:66)
at net.minecraft.src.InventoryEffectRenderer.drawScreen(InventoryEffectRenderer.java:35)
at net.minecraft.src.GuiInventory.drawScreen(GuiInventory.java:67)
at net.minecraft.src.EntityRenderer.updateCameraAndRender(EntityRenderer.java:970)
at net.minecraft.src.EntityRendererProxy.updateCameraAndRender(EntityRendererProxy.java:20)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:872)
at net.minecraft.client.Minecraft.run(Minecraft.java:768)
at java.lang.Thread.run(Thread.java:680)

 

How do I fix this?

I'm guessing I have to put the texture of the person wearing it somewhere, but I don't know where...

Where do I put it?

Posted

There are only 4 armour slots, 0-3. I'm guessing your mod is a jar mod, so somewhere you're causing line 35 of RenderPlayer to screw up, accessing an index in the array which is out of bounds.

Protip: try and find answers yourself before asking on the forum.

It's pretty likely that there is an answer.

 

Was I helpful? Give me a thank you!

 

 

width=635 height=903http://bit.ly/HZ03zy[/img]

 

 

Tired of waiting for mods to port to bukkit?

use BukkitForge! (now with a working version of WorldEdit!)

Posted

I have looked at the 0-3, and found that I did indeed make a mistake there, but it didn't fix the problem;

 

	public static final Item Chestplate_Titanium = (new ItemArmor(2107, EnumArmorMaterial.Titanium ,5,1 ).setItemName("Titanium Chestplate"));
public static final Item Leggings_Titanium = (new ItemArmor(2108, EnumArmorMaterial.Titanium ,5,2 ).setItemName("Titanium Leggings"));
public static final Item Helmet_Titanium = (new ItemArmor(2109, EnumArmorMaterial.Titanium ,5,0 ).setItemName("Titanium Helmet"));
public static final Item Boots_Titanium = (new ItemArmor(2110, EnumArmorMaterial.Titanium ,5,3 ).setItemName("Titanium Boots"));

 

		// Titanium Chestplate
	Chestplate_Titanium.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/ItemChestplate_Titanium.png");
	ModLoader.addName(Chestplate_Titanium, "Titanium Chestplate");
	ModLoader.addRecipe(new ItemStack(Chestplate_Titanium,1), new Object[]{
		"* *", "***", "***", Character.valueOf('*'), Ingot_Titanium});

	// Titanium Leggings
	Leggings_Titanium.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/ItemLeggings_Titanium.png");
	ModLoader.addName(Leggings_Titanium, "Titanium Leggings");
	ModLoader.addRecipe(new ItemStack(Leggings_Titanium,2), new Object[]{
		"***", "* *", "* *", Character.valueOf('*'), Ingot_Titanium});

	// Titanium Helmet
	Helmet_Titanium.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/ItemHelmet_Titanium.png");
	ModLoader.addName(Helmet_Titanium, "Titanium Helmet");
	ModLoader.addRecipe(new ItemStack(Helmet_Titanium,0), new Object[]{
		"***", "* *", "   ", Character.valueOf('*'), Ingot_Titanium});

	// Titanium Boots
	Boots_Titanium.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/ItemBoots_Titanium.png");
	ModLoader.addName(Boots_Titanium, "Titanium Boots");
	ModLoader.addRecipe(new ItemStack(Boots_Titanium,3), new Object[]{
		"   ", "* *", "* *", Character.valueOf('*'), Ingot_Titanium});

Posted

Are you calling addNewArmorRendererPrefix? It seems like it is throwing an error since '5' isn't a valid index in armorPrefixes, which that would solve. IE:If you have /armor/titanium1,2,3 etc. you should add 'titanium' as a prefix.

Posted

What have no idea what the ... 5 is, I just started modding, and copied the code from a tutorial. I just wrote the code (which I gave in my post above), and added TITANIUM to the EnumArmourMaterial.java...

Then I put the textures for the armour in:

mcp > eclipse > client > items

mcp > eclipse > client > bin > items

mcp > eclipse > server > items

 

And the titanium_1 and titanium_2 in:

mcp > temp > bin > minecraft > armour

 

EnumArmourMaterial.java :

    CLOTH(5, new int[]{1, 3, 2, 1}, 15),
    CHAIN(15, new int[]{2, 5, 4, 1}, 12),
    IRON(15, new int[]{2, 6, 5, 2}, 9),
    GOLD(7, new int[]{2, 5, 3, 1}, 25),
    DIAMOND(33, new int[]{3, 8, 6, 3}, 10),
    TITANIUM(15, new int[]{2, 6, 5, 2}, 10);

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.