Jump to content

[1.6.4] [SOLVED] Different Armor texture path?!


Recommended Posts

Posted

What must I change, that the texture for my armor will load from my folder and not from the 1.6.4.jar like Twilight Forest Mod do it.

 

Here is my code:

SCItem

public class SCItem 
{	
// creative tabs
public static CreativeTabs CreativeTabSCBlocks = new CreativeTabSCBlocks(CreativeTabs.getNextID(), "Building Blocks"){};
public static CreativeTabs CreativeTabSCMaterials = new CreativeTabSCMaterials(CreativeTabs.getNextID(), "Materials"){};
public static CreativeTabs CreativeTabSCFood = new CreativeTabSCFood(CreativeTabs.getNextID(), "Foodstuffs"){};
public static CreativeTabs CreativeTabSCTool = new CreativeTabSCTool(CreativeTabs.getNextID(), "Tools"){};
public static CreativeTabs CreativeTabSCCombat = new CreativeTabSCCombat(CreativeTabs.getNextID(), "Combat"){};

// Uranium armor
public static Item helmetUranium;
public static Item plateUranium;
public static Item legsUranium;
public static Item bootsUranium;

// Copper armor
public static Item helmetCopper;
public static Item plateCopper;
public static Item legsCopper;
public static Item bootsCopper;

// Unobtanium armor
public static Item helmetUnobtanium;
public static Item plateUnobtanium;
public static Item legsUnobtanium;
public static Item bootsUnobtanium;

// Enum Armor Material
    public static EnumArmorMaterial ARMOR_URANIUM = net.minecraftforge.common.EnumHelper.addArmorMaterial("URANIUM", 18, new int[] 
    {
    		2, 7, 5, 2
    }, 9);
    public static EnumArmorMaterial ARMOR_COPPER = net.minecraftforge.common.EnumHelper.addArmorMaterial("COPPER", 8, new int[] 
    {
    		2, 4, 3, 1
    }, 28);
    public static EnumArmorMaterial UNOBTANIUM = net.minecraftforge.common.EnumHelper.addArmorMaterial("UNOBTANIUM", 35, new int[]
    {
    		4, 10, 8, 4
    }, 12);
    
    public static EnumArmorMaterial Arnomr = EnumHelper.addArmorMaterial("Unob", 8, new int[] {2, 5, 6, 1}, 30);
    
    // renderer
    int uraniumRenderID = SeroCraft.proxy.registerArmorRenderID("serocraft/UraniumArmor_");
    int copperRenderID = SeroCraft.proxy.registerArmorRenderID("serocraft/CopperArmor_");
    int unobtaniumRenderID = SeroCraft.proxy.registerArmorRenderID("serocraft/UnobtaniumArmor_");

public SCItem()
{
// define uranium armor
	helmetUranium = (new ItemSCUraniumArmor(SCConfigurationIDs.idItemHelmetUranium, ARMOR_URANIUM, uraniumRenderID, 0)).setUnlocalizedName("helmetUranium");
	plateUranium = (new ItemSCUraniumArmor(SCConfigurationIDs.idItemPlateUranium, ARMOR_URANIUM, uraniumRenderID, 1)).setUnlocalizedName("plateUranium");
	legsUranium = (new ItemSCUraniumArmor(SCConfigurationIDs.idItemLegsUranium, ARMOR_URANIUM, uraniumRenderID, 2)).setUnlocalizedName("legsUranium");
	bootsUranium = (new ItemSCUraniumArmor(SCConfigurationIDs.idItemBootsUranium, ARMOR_URANIUM, uraniumRenderID, 3)).setUnlocalizedName("bootsUranium");

	// define copper armor
	helmetCopper = (new ItemSCCopperArmor(SCConfigurationIDs.idItemHelmetCopper, ARMOR_COPPER, copperRenderID, 0)).setUnlocalizedName("helmetCopper");
	plateCopper = (new ItemSCCopperArmor(SCConfigurationIDs.idItemPlateCopper, ARMOR_COPPER, copperRenderID, 1)).setUnlocalizedName("plateCopper");
	legsCopper = (new ItemSCCopperArmor(SCConfigurationIDs.idItemLegsCopper, ARMOR_COPPER, copperRenderID, 2)).setUnlocalizedName("legsCopper");
	bootsCopper = (new ItemSCCopperArmor(SCConfigurationIDs.idItemBootsCopper, ARMOR_COPPER, copperRenderID, 3)).setUnlocalizedName("bootsCopper");

	// define unobtanium armor
	helmetUnobtanium = (new ItemSCUnobtaniumArmor(SCConfigurationIDs.idItemHelmetUnobtanium, UNOBTANIUM, unobtaniumRenderID, 0)).setUnlocalizedName("helmetUnobtanium");
	plateUnobtanium = (new ItemSCUnobtaniumArmor(SCConfigurationIDs.idItemPlateUnobtanium, UNOBTANIUM, unobtaniumRenderID, 1)).setUnlocalizedName("plateUnobtanium");
	legsUnobtanium = (new ItemSCUnobtaniumArmor(SCConfigurationIDs.idItemLegsUnobtanium, UNOBTANIUM, unobtaniumRenderID, 2)).setUnlocalizedName("legsUnobtanium");
	bootsUnobtanium = (new ItemSCUnobtaniumArmor(SCConfigurationIDs.idItemBootsUnobtanium, UNOBTANIUM, unobtaniumRenderID, 3)).setUnlocalizedName("bootsUnobtanium");

	// register uranium armor
	registerSCItems(helmetUranium, "helmetUranium");
	registerSCItems(plateUranium, "plateUranium");
	registerSCItems(legsUranium, "legsUranium");
	registerSCItems(bootsUranium, "bootsUranium");

	// register copper armor
	registerSCItems(helmetCopper, "helmetCopper");
	registerSCItems(plateCopper, "plateCopper");
	registerSCItems(legsCopper, "legsCopper");
	registerSCItems(bootsCopper, "bootsCopper");

	// register unobtanium armor
	registerSCItems(helmetUnobtanium, "helmetUnobtanium");
	registerSCItems(plateUnobtanium, "plateUnobtanium");
	registerSCItems(legsUnobtanium, "legsUnobtanium");
	registerSCItems(bootsUnobtanium, "bootsUnobtanium");
}

// register items
private void registerSCItems(Item item, String englishName)
{
	GameRegistry.registerItem(item, item.getUnlocalizedName(), "serocraft");
}

ClientProxy

package minecraftplaye.serocraft;

import net.minecraft.client.renderer.entity.RenderBiped;
import minecraftplaye.serocraft.entity.EntitySCMutant;
import minecraftplaye.serocraft.entity.model.ModelSCMutant;
import minecraftplaye.serocraft.entity.render.RenderSCMutant;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;

public class SCClientProxy extends SCCommonProxy
{
public SCClientProxy()
{
}

    public void doPreLoadRegistration()
    {
    	
    }
    
    public void registerRenderInformation()
    {
    	//RenderingRegistry.registerEntityRenderingHandler(EntityAngryBat.class, new RenderAngryBat());
    	RenderingRegistry.registerEntityRenderingHandler(EntitySCMutant.class, new RenderBiped(new ModelSCMutant(), 0.625F));
    }
    
public void doOnLoadRegistration()
{

}

public int registerArmorRenderID(String prefix)
{
	return RenderingRegistry.addNewArmourRendererPrefix(prefix);
}
}

CommonProxy

package minecraftplaye.serocraft;

import minecraftplaye.serocraft.entity.EntitySCMutant;
import cpw.mods.fml.common.registry.EntityRegistry;

public class SCCommonProxy 
{

public void doPreLoadRegistration() 
{

}

public void init()
{
	EntityRegistry.registerGlobalEntityID(EntitySCMutant.class, "Mutant", EntityRegistry.findGlobalUniqueEntityId(), 424313, 45131);
	//registerRenderInformation();
}

public void registerRenderInformation()
{
	// Nothing here as the server doesn't render graphics
}

public int registerArmorRenderID(String string) // registerArmorRenderID
{
	return 0;
}
}

ItemSCUnobtaniumArmor

package minecraftplaye.serocraft.items;

import minecraftplaye.serocraft.SeroCraft;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;

public class ItemSCUnobtaniumArmor extends ItemArmor
{

public ItemSCUnobtaniumArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int renderIndex, int armorType) 
{
	super(par1, par2EnumArmorMaterial, renderIndex, armorType);
	this.setCreativeTab(SCItem.CreativeTabSCCombat);
}

    public String getArmorTextureFile(ItemStack itemstack, Entity entity, int slot, int layer)
    {
    	if (itemstack.itemID == SCItem.helmetUnobtanium.itemID || itemstack.itemID == SCItem.plateUnobtanium.itemID || itemstack.itemID == SCItem.bootsUnobtanium.itemID) 
    	{
    		//return "serocraft:UnobtaniumArmor_layer_1.png";
            //return SeroCraft.ARMOR_DIR + "UnobtaniumArmor_1.png";
    		return "serocraft:textures/armor/UnobtaniumArmor_1.png";
    	}
    	if (itemstack.itemID == SCItem.legsUnobtanium.itemID) 
    	{
    		//return "serocraft:UnobtaniumArmor_layer_2.png";
    		//return SeroCraft.ARMOR_DIR + "UnobtaniumArmor_2.png";
    		return "serocraft:textures/armor/UnobtaniumArmor_2.png";
    	} 
    	else
    	{
    		return "serocraft:textures/armor/UnobtaniumArmor_1.png";
    	}
    }
    
    public void registerIcons(IconRegister reg)
    { // Make sure to import IconRegister!
    	if (itemID == SCItem.plateUnobtanium.itemID)
    	{
    		this.itemIcon = reg.registerIcon(SeroCraft.modid + ":" + "plateUnobtanium"); // You can also replace blockID and blockIcon with itemID and itemIcon
    	}

    	if (itemID == SCItem.legsUnobtanium.itemID) 
    	{
    		this.itemIcon = reg.registerIcon(SeroCraft.modid + ":" + "legsUnobtanium"); // You can also replace blockID and blockIcon with itemID and itemIcon
    	}

    	if (itemID == SCItem.bootsUnobtanium.itemID) 
    	{
    		this.itemIcon = reg.registerIcon(SeroCraft.modid + ":" + "bootsUnobtanium"); // You can also replace blockID and blockIcon with itemID and itemIcon
    	}

    	if (itemID == SCItem.helmetUnobtanium.itemID) 
    	{
    		this.itemIcon = reg.registerIcon(SeroCraft.modid + ":" + "helmetUnobtanium"); // You can also replace blockID and blockIcon with itemID and itemIcon
    	}
    }
    
    public EnumRarity func_77613_e(ItemStack par1ItemStack)
    {
        return EnumRarity.uncommon;
    }
}

 

With this code, I get every time this error:

2014-01-09 19:38:51 [Warnung] [Minecraft-Client] Failed to load texture: minecraft:textures/models/armor/serocraft/UnobtaniumArmor__layer_1.png
java.io.FileNotFoundException: minecraft:textures/models/armor/serocraft/UnobtaniumArmor__layer_1.png
at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:64)
at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:63)
at net.minecraft.client.renderer.texture.SimpleTexture.loadTexture(SimpleTexture.java:31)
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:84)
at net.minecraft.client.renderer.texture.TextureManager.bindTexture(TextureManager.java:41)
at net.minecraft.client.renderer.entity.Render.bindTexture(Render.java:53)
at net.minecraft.client.renderer.entity.RenderPlayer.setArmorModel(RenderPlayer.java:72)
at net.minecraft.client.renderer.entity.RenderPlayer.shouldRenderPass(RenderPlayer.java:514)
at net.minecraft.client.renderer.entity.RendererLivingEntity.doRenderLiving(RendererLivingEntity.java:164)
at net.minecraft.client.renderer.entity.RenderPlayer.func_130009_a(RenderPlayer.java:166)
at net.minecraft.client.renderer.entity.RenderPlayer.doRender(RenderPlayer.java:556)
at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:312)
at net.minecraft.client.gui.inventory.GuiInventory.func_110423_a(GuiInventory.java:121)
at net.minecraft.client.gui.inventory.GuiContainerCreative.drawGuiContainerBackgroundLayer(GuiContainerCreative.java:849)
at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:111)
at net.minecraft.client.renderer.InventoryEffectRenderer.drawScreen(InventoryEffectRenderer.java:43)
at net.minecraft.client.gui.inventory.GuiContainerCreative.drawScreen(GuiContainerCreative.java:683)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1036)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:944)
at net.minecraft.client.Minecraft.run(Minecraft.java:836)
at net.minecraft.client.main.Main.main(Main.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
2014-01-09 19:38:51 [Warnung] [Minecraft-Client] Failed to load texture: minecraft:textures/models/armor/serocraft/UnobtaniumArmor__layer_2.png
java.io.FileNotFoundException: minecraft:textures/models/armor/serocraft/UnobtaniumArmor__layer_2.png
at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:64)
at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:63)
at net.minecraft.client.renderer.texture.SimpleTexture.loadTexture(SimpleTexture.java:31)
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:84)
at net.minecraft.client.renderer.texture.TextureManager.bindTexture(TextureManager.java:41)
at net.minecraft.client.renderer.entity.Render.bindTexture(Render.java:53)
at net.minecraft.client.renderer.entity.RenderPlayer.setArmorModel(RenderPlayer.java:72)
at net.minecraft.client.renderer.entity.RenderPlayer.shouldRenderPass(RenderPlayer.java:514)
at net.minecraft.client.renderer.entity.RendererLivingEntity.doRenderLiving(RendererLivingEntity.java:164)
at net.minecraft.client.renderer.entity.RenderPlayer.func_130009_a(RenderPlayer.java:166)
at net.minecraft.client.renderer.entity.RenderPlayer.doRender(RenderPlayer.java:556)
at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:312)
at net.minecraft.client.gui.inventory.GuiInventory.func_110423_a(GuiInventory.java:121)
at net.minecraft.client.gui.inventory.GuiContainerCreative.drawGuiContainerBackgroundLayer(GuiContainerCreative.java:849)
at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:111)
at net.minecraft.client.renderer.InventoryEffectRenderer.drawScreen(InventoryEffectRenderer.java:43)
at net.minecraft.client.gui.inventory.GuiContainerCreative.drawScreen(GuiContainerCreative.java:683)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1036)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:944)
at net.minecraft.client.Minecraft.run(Minecraft.java:836)
at net.minecraft.client.main.Main.main(Main.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
at net.minecraft.launchwrapper.Launch.main(Launch.java:27)

 

I hope that you can help me.

Developer of Primeval Forest.

Posted

That DOES help.  Here's your problem:

 

    int uraniumRenderID = SeroCraft.proxy.registerArmorRenderID("serocraft/UraniumArmor_");

    int copperRenderID = SeroCraft.proxy.registerArmorRenderID("serocraft/CopperArmor_");

    int unobtaniumRenderID = SeroCraft.proxy.registerArmorRenderID("serocraft/UnobtaniumArmor_");

 

Compare and contrast to

 

"serocraft:textures/armor/UnobtaniumArmor_1.png";

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Try this:

    int uraniumRenderID = SeroCraft.proxy.registerArmorRenderID("serocraft:textures/armor/UraniumArmor");
    int copperRenderID = SeroCraft.proxy.registerArmorRenderID("serocraft:textures/armor/CopperArmor");
    int unobtaniumRenderID = SeroCraft.proxy.registerArmorRenderID("serocraft:textures/armor/UnobtaniumArmor");

 

The problem is that "_layer_#.png" is already added, so "serocraft/Armor_" makes Minecraft look for textures in "minecraft:textures/models/armor/serocraft/Armor__layer_#.png" (two underscores after "Armor").

 

Also, put your armor textures in "serocraft:textures/models/armor" rather than "serocraft:textures/armor". You might need to change some code here and there, but it helps with compatibility.

Before you even think about modding,

  Quote
Posted

This won't work:

Failed to load texture: textures/models/armor/serocraft:textures/models/armor/UnobtaniumArmor_layer_1.png
Failed to load texture: textures/models/armor/serocraft:textures/models/armor/UnobtaniumArmor_layer_2.png

 

My code: (SCItem)

 

  Reveal hidden contents

 

 

ItemSCUnobtaniumArmor

 

  Reveal hidden contents

 

 

SCClientProxy

 

  Reveal hidden contents

 

 

SCCommonProxy

 

  Reveal hidden contents

 

 

I hope that this will help you.

Developer of Primeval Forest.

Posted

Looking over my own code, I'm pretty sure I know what's the problem. But before we get fixing, change your render IDs:

    int uraniumRenderID = SeroCraft.proxy.registerArmorRenderID(ARMOR_URANIUM.name());
    int copperRenderID = SeroCraft.proxy.registerArmorRenderID(ARMOR_COPPER.name());
    int unobtaniumRenderID = SeroCraft.proxy.registerArmorRenderID(UNOBTANIUM.name());

 

You have to change them again because

RenderingRegistry.addNewArmourRendererPrefix

(which is in your client proxy) adds an armor prefix to the string array

RenderBiped.bipedArmorFilenamePrefix

.

bipedArmorFilenamePrefix

is defined as an array of armor type strings (

new String[] {"leather", "chainmail", "iron", "diamond", "gold"}

), so your code should register armor type strings, rather than texture paths, when using

SeroCraft.proxy.registerArmorRenderID

.

 

Now getting to the actual fixing, change

public String getArmorTextureFile(ItemStack itemstack, Entity entity, int slot, int layer)

to

public String getArmorTexture(ItemStack itemstack, Entity entity, int slot, int layer)

. This is in the armor class (e.g. ItemSCUnobtaniumArmor).

Before you even think about modding,

  Quote
Posted
  On 1/11/2014 at 9:48 PM, general3214 said:

Looking over my own code, I'm pretty sure I know what's the problem. But before we get fixing, change your render IDs:

    int uraniumRenderID = SeroCraft.proxy.registerArmorRenderID(ARMOR_URANIUM.name());
    int copperRenderID = SeroCraft.proxy.registerArmorRenderID(ARMOR_COPPER.name());
    int unobtaniumRenderID = SeroCraft.proxy.registerArmorRenderID(UNOBTANIUM.name());

 

You have to change them again because

RenderingRegistry.addNewArmourRendererPrefix

(which is in your client proxy) adds an armor prefix to the string array

RenderBiped.bipedArmorFilenamePrefix

.

bipedArmorFilenamePrefix

is defined as an array of armor type strings (

new String[] {"leather", "chainmail", "iron", "diamond", "gold"}

), so your code should register armor type strings, rather than texture paths, when using

SeroCraft.proxy.registerArmorRenderID

.

 

Now getting to the actual fixing, change

public String getArmorTextureFile(ItemStack itemstack, Entity entity, int slot, int layer)

to

public String getArmorTexture(ItemStack itemstack, Entity entity, int slot, int layer)

. This is in the armor class (e.g. ItemSCUnobtaniumArmor).

 

That fixed everything. :D

Thanks...

Developer of Primeval Forest.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello! Faced with the same problem. Can you please describe in more detail how you rewrote the toNetwork and fromNetwork methods?
    • Why not?   Please explain what you have tried, in detail. Step by step is installing the server, placing mod .jar files in the mods folder within the folder you installed the server, and running the run.bat file. If this is not working for you, please post the debug.log from the logs folder to a site like https://mclo.gs and post the link to it here.
    • I can't put mods on it if I only use Run.bat, I haven't been able to start it with mods, I've checked the mods and they don't have any problems but even so I understood that a created file called start.bat was used and configured, the mods would work there, if not I don't know how I can do it, I need help please, step by step if possible and be able to understand once and for all  
    • That is incorrect. Use the run.bat or run.sh to run the server.
    • Hello, I have been trying for days to create my server with forge-1.20.1-47.4.1-installer, which installs the server, but the forge-1.20.1-47.4.1.jar file, which is necessary to create the server, does not appear. I no longer know what to do. Help. hola buenas, llevo dias intentando poder hacer mi servidor con forge-1.20.1-47.4.1-installer el cual instalo el server, pero no aparece el archivo forge-1.20.1-47.4.1.jar , el cual es necesario para poder crear el server, ya no se que hacer ayuda.
  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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