Jump to content

Recommended Posts

Posted

Here is my problem.

 

Before I updated my Forge [4.0.0] to [4.1.1] my armor worked just fine, now suddenly, it went invisible.

When equipping it, the armor is invisible and strangely, the item held go's invisible in third person too (?!)

 

This is very strange because I haven't touched the code.

 

NihiliumItemArmor

 

package net.minecraft.src;

 

import net.minecraftforge.common.IArmorTextureProvider;

 

public class NihiliumItemArmor extends ItemArmor implements IArmorTextureProvider

{

 

        public NihiliumItemArmor(int i, EnumArmorMaterial enumarmormaterial, int j, int k)

        {

                super(i, enumarmormaterial, j, k);

        }

       

        public String getTextureFile()

        {

                return "/DPIndex.png";

        }

@Override

public String getArmorTextureFile(ItemStack itemstack) {

            if(itemstack.itemID == mod_NihiliumArmour.NihiliumHelmet.shiftedIndex || itemstack.itemID == mod_NihiliumArmour.NihiliumBody.shiftedIndex || itemstack.itemID == mod_NihiliumArmour.NihiliumBoots.shiftedIndex)

            {

                    return "/NihiliumArmor1.png";

            }

            if(itemstack.itemID == mod_NihiliumArmour.NihiliumLegs.shiftedIndex)

            {

                    return "/NihiliumArmor2.png";

            }

            return "/NihiliumArmor1.png";

}

 

}

               

 

Help?

Posted

There is nothing that has changed related to this, so you'd have to find out whats causing it.

 

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

It looks like the console spams this message when equipping armor:

 

 

012-09-16 18:53:40 [iNFO] [sTDERR] java.lang.ArrayIndexOutOfBoundsException: 6

2012-09-16 18:53:40 [iNFO] [sTDERR] at net.minecraft.src.RenderPlayer.setArmorModel(RenderPlayer.java:44)

2012-09-16 18:53:40 [iNFO] [sTDERR] at net.minecraft.src.RenderPlayer.shouldRenderPass(RenderPlayer.java:419)

2012-09-16 18:53:40 [iNFO] [sTDERR] at net.minecraft.src.RenderLiving.doRenderLiving(RenderLiving.java:110)

2012-09-16 18:53:40 [iNFO] [sTDERR] at net.minecraft.src.RenderPlayer.renderPlayer(RenderPlayer.java:94)

2012-09-16 18:53:40 [iNFO] [sTDERR] at net.minecraft.src.RenderPlayer.doRender(RenderPlayer.java:453)

2012-09-16 18:53:40 [iNFO] [sTDERR] at net.minecraft.src.RenderManager.renderEntityWithPosYaw(RenderManager.java:191)

2012-09-16 18:53:40 [iNFO] [sTDERR] at net.minecraft.src.GuiInventory.func_74223_a(GuiInventory.java:109)

2012-09-16 18:53:40 [iNFO] [sTDERR] at net.minecraft.src.GuiContainerCreative.drawGuiContainerBackgroundLayer(GuiContainerCreative.java:588)

2012-09-16 18:53:40 [iNFO] [sTDERR] at net.minecraft.src.GuiContainer.drawScreen(GuiContainer.java:60)

2012-09-16 18:53:40 [iNFO] [sTDERR] at net.minecraft.src.InventoryEffectRenderer.drawScreen(InventoryEffectRenderer.java:38)

2012-09-16 18:53:40 [iNFO] [sTDERR] at net.minecraft.src.GuiContainerCreative.drawScreen(GuiContainerCreative.java:522)

2012-09-16 18:53:40 [iNFO] [sTDERR] at net.minecraft.src.EntityRenderer.updateCameraAndRender(EntityRenderer.java:917)

2012-09-16 18:53:40 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:871)

2012-09-16 18:53:40 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:764)

2012-09-16 18:53:40 [iNFO] [sTDERR] at java.lang.Thread.run(Unknown Source)

 

 

 

This is weird, because, I didn't touch the code in any way and this worked before.

 

EDIT: Here is the code wich calls the 6.

mod_NihiliumArmor

 

package net.minecraft.src;

import java.util.Random;

 

import cpw.mods.fml.common.registry.GameRegistry;

import net.minecraft.src.ItemArmor;

import net.minecraftforge.client.MinecraftForgeClient;

 

 

 

public class mod_NihiliumArmour extends BaseMod

 

 

{

//First number: data value

//Second number: durability/strength of NihiliumArmour

//Third number: skin (what the NihiliumArmour looks like when you're wearing it)

//Fourth number: type of amour (0 = Helm, 1 = NihiliumBody, 2 = NihiliumLegs, 3 = NihiliumBoots)

 

public static final Item NihiliumHelmet = new NihiliumItemArmor(4012, EnumArmorMaterial.NIHILIUM,  6, 0).setItemName("Nihilium Helmet").setIconIndex(27);

public static final Item NihiliumBody = new NihiliumItemArmor(4013, EnumArmorMaterial.NIHILIUM, 6, 1).setItemName("Nihilium Chestplate").setIconIndex(26);

public static final Item NihiliumLegs = new NihiliumItemArmor(4014, EnumArmorMaterial.NIHILIUM, 6, 2).setItemName("Nihilium Legs").setIconIndex(25);

public static final Item NihiliumBoots = new NihiliumItemArmor(4011, EnumArmorMaterial.NIHILIUM, 6, 3).setItemName("Nihilium Boots").setIconIndex(24);

 

public mod_NihiliumArmour()

{

 

//This adds the item textures, which is what the NihiliumArmour looks like when you're holding it

//This sets the recipes for each piece of NihiliumArmour.

//Note: I made it so the recipes are the same as regular NihiliumArmour recipes,

// except they're made completely out of dirt

//The next four lines add the in-game names to each piece of NihiliumArmour.

ModLoader.addName(NihiliumHelmet, "Nihilium Helmet");

ModLoader.addName(NihiliumBody, "Nihilium Chest Plate");

ModLoader.addName(NihiliumLegs, "Nihilium Greaves");

ModLoader.addName(NihiliumBoots, "Nihilium Boots");

 

}

 

//This function tells ModLoader what "version" your mod is (don't worry about it, I put in pi for you)

public String getVersion(){

return "1.3.2";

}

public void load() {

ModLoader.addRecipe(new ItemStack(NihiliumHelmet, 1), new Object[] {

"***", "* *", Character.valueOf('*'), mod_NihiliumBar.NihiliumBar

});

ModLoader.addRecipe(new ItemStack(NihiliumBody, 1), new Object[] {

"* *", "***", "***", Character.valueOf('*'), mod_NihiliumBar.NihiliumBar

});

ModLoader.addRecipe(new ItemStack(NihiliumLegs, 1), new Object[] {

"***", "* *", "* *", Character.valueOf('*'), mod_NihiliumBar.NihiliumBar

});

ModLoader.addRecipe(new ItemStack(NihiliumBoots, 1), new Object[] {

"* *", "* *", Character.valueOf('*'), mod_NihiliumBar.NihiliumBar

});

}

}

 

Posted

This bug is really simple to fix.

 

Change this:

 

NihiliumHelmet = new NihiliumItemArmor(4012, EnumArmorMaterial.NIHILIUM,  6, 0).setItemName("Nihilium Helmet").setIconIndex(27);

 

into this:

 

NihiliumHelmet = new NihiliumItemArmor(4012, EnumArmorMaterial.NIHILIUM,  3, 0).setItemName("Nihilium Helmet").setIconIndex(27);

 

I don't kow why modders can't use their own armor render ID, but if you use the diamonds one (3), it works.

Posted

You actually can use another way than setting that int to 3, it is a ModLoader function. instead of that int use: ModLoader.addArmor(String). Don't know if it is the best way, but it works.

Posted

That or you could provide your own armor texture without using ModLoader, or you could use the FML version of the ML functions, or you could do it a million ways. Its fairly basic.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

You actually can use another way than setting that int to 3, it is a ModLoader function. instead of that int use: ModLoader.addArmor(String). Don't know if it is the best way, but it works.

Why not use the forge methods? They seem better IMO, since you are using forge anyways :P

RenderingRegistery.addNewArmourRendererPrefix(String armor);

1 minute of searching around and I found it :)

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.