Jump to content

[SOLVED][1.6.2] Armor Render Issue? or Code?


SuperHB

Recommended Posts

Hey guys SuperHB here! :) I am working on my mod MobDrops right now and I was working on the Armor and when I try it on it gives me an error. I'm not sure if my code is bad or because there is something wrong with Forge right now. here is the error and the code i used:

 

Error

2013-07-15 14:32:39 [WARNING] [Minecraft-Client] Failed to load texture: minecraft:/assests/minecraft/textures/armor/wolf_1
java.io.FileNotFoundException: minecraft:/assests/minecraft/textures/armor/wolf_1
at net.minecraft.client.resources.FallbackResourceManager.func_110536_a(FallbackResourceManager.java:64)
at net.minecraft.client.resources.SimpleReloadableResourceManager.func_110536_a(SimpleReloadableResourceManager.java:63)
at net.minecraft.client.renderer.texture.SimpleTexture.func_110551_a(SimpleTexture.java:31)
at net.minecraft.client.renderer.texture.TextureManager.func_110579_a(TextureManager.java:84)
at net.minecraft.client.renderer.texture.TextureManager.func_110577_a(TextureManager.java:41)
at net.minecraft.client.renderer.entity.Render.func_110776_a(Render.java:50)
at net.minecraft.client.renderer.entity.RenderPlayer.setArmorModel(RenderPlayer.java:72)
at net.minecraft.client.renderer.entity.RenderPlayer.shouldRenderPass(RenderPlayer.java:519)
at net.minecraft.client.renderer.entity.RendererLivingEntity.func_130000_a(RendererLivingEntity.java:162)
at net.minecraft.client.renderer.entity.RenderPlayer.func_130009_a(RenderPlayer.java:170)
at net.minecraft.client.renderer.entity.RenderPlayer.doRender(RenderPlayer.java:558)
at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:313)
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:674)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1037)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:933)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:826)
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:57)
at net.minecraft.launchwrapper.Launch.main(Launch.java:18)
2013-07-15 14:32:41 [WARNING] [Minecraft-Client] Failed to load texture: minecraft:assets/minecraft/textures/armor/creeper_1
java.io.FileNotFoundException: minecraft:assets/minecraft/textures/armor/creeper_1
at net.minecraft.client.resources.FallbackResourceManager.func_110536_a(FallbackResourceManager.java:64)
at net.minecraft.client.resources.SimpleReloadableResourceManager.func_110536_a(SimpleReloadableResourceManager.java:63)
at net.minecraft.client.renderer.texture.SimpleTexture.func_110551_a(SimpleTexture.java:31)
at net.minecraft.client.renderer.texture.TextureManager.func_110579_a(TextureManager.java:84)
at net.minecraft.client.renderer.texture.TextureManager.func_110577_a(TextureManager.java:41)
at net.minecraft.client.renderer.entity.Render.func_110776_a(Render.java:50)
at net.minecraft.client.renderer.entity.RenderPlayer.setArmorModel(RenderPlayer.java:72)
at net.minecraft.client.renderer.entity.RenderPlayer.shouldRenderPass(RenderPlayer.java:519)
at net.minecraft.client.renderer.entity.RendererLivingEntity.func_130000_a(RendererLivingEntity.java:162)
at net.minecraft.client.renderer.entity.RenderPlayer.func_130009_a(RenderPlayer.java:170)
at net.minecraft.client.renderer.entity.RenderPlayer.doRender(RenderPlayer.java:558)
at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:313)
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:674)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1037)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:933)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:826)
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:57)
at net.minecraft.launchwrapper.Launch.main(Launch.java:18)

 

Code

package net.MobDrops.superhb.mod.armor;

import net.MobDrops.superhb.mod.MobDropsAll;
import net.minecraft.entity.Entity;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;

public class ArmorTest extends ItemArmor
{
    public String armorNamePrefix;
    public EnumArmorMaterial material;

    public ArmorTest(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4, String armornamePrefix)
    {
        super(par1, par2EnumArmorMaterial, par3, par4);
        this.material = par2EnumArmorMaterial;
        par2EnumArmorMaterial.getDamageReductionAmount(par4);
        this.setMaxDamage(par2EnumArmorMaterial.getDurability(par4));
        this.maxStackSize = 1;
        this.setCreativeTab(MobDropsAll.tabMobDropsArmor);
        armorNamePrefix = armornamePrefix;
    }

    public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
    {
        if (stack.toString().contains("leggings"))
        {
            return "/assests/minecraft/textures/armor/wolf_2";
        }

        if (stack.toString().contains("Leggings"))
        {
            return "/assests/minecraft/textures/armor/wolf_2";
        }

        return "/assests/minecraft/textures/armor/wolf_1";
    }
}

 

Second Code Link:

http://gw.minecraftforge.net/NHLo

 

If you know the code please give it to me and i'll put you in the credits of MobDrops!

 

Thanks,

    SuperHB

Link to comment
Share on other sites

3 problems with this with your return "armour path"

 

You need to use this format return "modID:textures/models/armor/armorName_layer_(1 or 2).png"

 

So that would be something like return "lmp:textures/models/armor/titanium_layer_1.png"

Link to comment
Share on other sites

  • 2 weeks later...

It didnt work for me. I still got the beautiful black and purple armor textures. :/

 

Here is the Modified Code:

package net.MobDrops.superhb.mod.armor;

import net.MobDrops.superhb.mod.MobDropsAll;
import net.minecraft.entity.Entity;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;

public class CreeperArmor extends ItemArmor
{
    public String armorNamePrefix;
    public EnumArmorMaterial material;

    public CreeperArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4)
    {
        super(par1, par2EnumArmorMaterial, par3, par4);
        this.material = par2EnumArmorMaterial;
        par2EnumArmorMaterial.getDamageReductionAmount(par4);
        this.setMaxDamage(par2EnumArmorMaterial.getDurability(par4));
        this.maxStackSize = 1;
        this.setCreativeTab(MobDropsAll.tabMobDropsArmor);
    }

    public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
    {
        if (this.material == MobDropsAll.CreeperArmor)
        {
            if (stack.getItem().itemID == MobDropsAll.creeperarmorhelmet.itemID)
            {
                return "mobdrops:textures/armor/creeper_" + (this.armorType == 2 ? 2 : 1) + ".png";
            }
            else if (stack.getItem().itemID == MobDropsAll.creeperarmorchestplate.itemID || stack.getItem().itemID == MobDropsAll.creeperarmorboots.itemID)
            {
                return "mobdrops:textures/armor/creeper_" + (this.armorType == 2 ? 2 : 1) + ".png";
            }
            else if (stack.getItem().itemID == MobDropsAll.creeperarmorleggings.itemID)
            {
                return "mobdrops:textures/armor/creeper_" + (this.armorType == 2 ? 2 : 1) + ".png";
            }
        }

        return null;
    }
}

 

Link to comment
Share on other sites

You're sure your armour textures are in: mcp/src/assets/minecraft/mobdrops/textures/armor? Also all of those folders MUST be in lowercase!

That should be mcp/src/minecraft/assets/mobdrops/textures/armor, but close enough ;)

Oh haha didn't even notice I did that

Link to comment
Share on other sites

I would create a variable in the base class with my modid, like this:

public static final String modid = "[Your Modid]";

Then I would move the texture localasition from: "mcp/src/minecraft/assest/mobdrops/textures/armor" to "mcp/src/minecraft/assest/[Your Modid]/textures/armor"

now I would change this Method

public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
    {
        if (stack.toString().contains("leggings"))
        {
            return "/assests/minecraft/textures/armor/wolf_2";
        }

        if (stack.toString().contains("Leggings"))
        {
            return "/assests/minecraft/textures/armor/wolf_2";
        }

        return "/assests/minecraft/textures/armor/wolf_1";
    }

to something like this Method:

public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) {
        if(stack.itemID == [Your Base Class].[Your Helmet].itemID || stack.itemID == [Your Base Class].[Your Chestplate].itemID || stack.itemID == [Your Base Class].[Your Helmet].[Your Boots].itemID) {
        	return armorTexture+ "wolf_1.png";
        }
        
        if(stack.itemID == [Your Base Class].[Your Leggins].itemID) {
        	return armorTexture+ "wolf_2.png";
        }
}

and the variable "armorTexture" I would define so:

private final String armorTexture = [Your Base Class].modid + "textures/armor/";

 

I hope you can understand this.

 

Link to comment
Share on other sites

There is a much easier way just say if slotID is 2 then load layer 2. it works fine!

 

package minecraftwero.baconMod.common.items;

import java.util.Random;

import minecraftwero.baconMod.Bacon;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

/**
* 
* @author MinecraftWero, Speiger
*
*/
public class BaconArmor extends ItemArmor
{

public String par10;
public String par11;

public BaconArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4, String texture, String name)
{
	super(par1, par2EnumArmorMaterial, par3, par4);
	par10 = name;
	this.setMaxStackSize(1);
	par11 = texture;
	this.setCreativeTab(Bacon.baconMod);
	this.setNoRepair();
	this.func_111206_d(texture);
}



@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) 
{
	if(slot == 2)return "minecraftwero:textures/models/armor/bacon_layer_2.png";
	else return "minecraftwero:textures/models/armor/bacon_layer_1.png";
}


public String getItemDisplayName(ItemStack par1)
{
	return par10;
}


@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IconRegister par1IconRegister)
{
	this.itemIcon = par1IconRegister.registerIcon(par11);
}




}

Link to comment
Share on other sites

I would create a variable in the base class with my modid, like this:

public static final String modid = "[Your Modid]";

Then I would move the texture localasition from: "mcp/src/minecraft/assest/mobdrops/textures/armor" to "mcp/src/minecraft/assest/[Your Modid]/textures/armor"

now I would change this Method

public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
    {
        if (stack.toString().contains("leggings"))
        {
            return "/assests/minecraft/textures/armor/wolf_2";
        }

        if (stack.toString().contains("Leggings"))
        {
            return "/assests/minecraft/textures/armor/wolf_2";
        }

        return "/assests/minecraft/textures/armor/wolf_1";
    }

to something like this Method:

public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) {
        if(stack.itemID == [Your Base Class].[Your Helmet].itemID || stack.itemID == [Your Base Class].[Your Chestplate].itemID || stack.itemID == [Your Base Class].[Your Helmet].[Your Boots].itemID) {
        	return armorTexture+ "wolf_1.png";
        }
        
        if(stack.itemID == [Your Base Class].[Your Leggins].itemID) {
        	return armorTexture+ "wolf_2.png";
        }
}

and the variable "armorTexture" I would define so:

private final String armorTexture = [Your Base Class].modid + "textures/armor/";

 

I hope you can understand this.

 

 

/\

|

That didn't work for me :/

 

There is a much easier way just say if slotID is 2 then load layer 2. it works fine!

 

package minecraftwero.baconMod.common.items;

import java.util.Random;

import minecraftwero.baconMod.Bacon;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

/**
* 
* @author MinecraftWero, Speiger
*
*/
public class BaconArmor extends ItemArmor
{

public String par10;
public String par11;

public BaconArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4, String texture, String name)
{
	super(par1, par2EnumArmorMaterial, par3, par4);
	par10 = name;
	this.setMaxStackSize(1);
	par11 = texture;
	this.setCreativeTab(Bacon.baconMod);
	this.setNoRepair();
	this.func_111206_d(texture);
}



@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) 
{
	if(slot == 2)return "minecraftwero:textures/models/armor/bacon_layer_2.png";
	else return "minecraftwero:textures/models/armor/bacon_layer_1.png";
}


public String getItemDisplayName(ItemStack par1)
{
	return par10;
}


@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IconRegister par1IconRegister)
{
	this.itemIcon = par1IconRegister.registerIcon(par11);
}




}

 

/\

|

This one could work but i would like to know the code that you used in the base class?

EX:

public static Item creeperarmorhelmet = new CreeperArmor(5225, CreeperArmor, ModLoader.addArmor("Creeper"), 0).setCreativeTab(MobDropsAll.tabMobDropsArmor).setUnlocalizedName("CHelmet").func_111206_d("CHelmet");

Link to comment
Share on other sites

Yeah:

 

The item has to look like this:

 

public static Item creeperArmor = new BaconArmor(500, CreeperArmor, ModLoader.addArmor("Creeper"), 0, "modID:Texture", "Creeper Armor");

 

You do not need to add a creative tab.

The creative tab is inside of the class^^

Link to comment
Share on other sites

Yeah:

 

The item has to look like this:

 

public static Item creeperArmor = new BaconArmor(500, CreeperArmor, ModLoader.addArmor("Creeper"), 0, "modID:Texture", "Creeper Armor");

 

You do not need to add a creative tab.

The creative tab is inside of the class^^

 

Didn't work for me :( it makes the item in my hand black and purple as well...

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • https://mclo.gs/4UC49Ao
    • Way back in the Forge 1.17 days, work started for adding JPMS (Java Platform Module Support) to ModLauncher and ForgeModLoader. This has been used internally by Forge and some libraries for a while now, but mods (those with mods.toml specifically) have not been able to take advantage of it. As of Forge 1.21.1 and 1.21.3, this is now possible!   What is JPMS and what does it mean for modders? JPMS is the Java Platform Module System, introduced in Java 9. It allows you to define modules, which are collections of packages and resources that can be exported or hidden from other modules. This allows for much more fine-tuned control over visibility, cleaner syntax for service declarations and support for sealed types across packages. For example, you might have a mod with a module called `com.example.mod` that exports `com.example.mod.api` and `com.example.mod.impl` to other mods, but hides `com.example.mod.internal` from them. This would allow you to have a clean API for other mods to use, while keeping your internal implementation details hidden from IDE hints, helping prevent accidental usage of internals that might break without prior notice. This is particularly useful if you'd like to use public records with module-private constructors or partially module-private record components, as you can create a sealed interface that only your record implements, having the interface be exported and the record hidden. It's also nice for declaring and using services, as you'll get compile-time errors from the Java compiler for typos and the like, rather than deferring to runtime errors. In more advanced cases, you can also have public methods that are only accessible to specific other modules -- handy if you want internal interactions between multiple of your own mods.   How do I bypass it? We understand there may be drama in implementing a system that prevents mods from accessing each other's internals when necessary (like when a mod is abandoned or you need to fix a compat issue) -- after all, we are already modding a game that doesn't have explicit support for Java mods yet. We have already thought of this and are offering APIs from day one to selectively bypass module restrictions. Let me be clear: Forge mods are not required to use JPMS. If you don't want to use it, you don't have to. The default behaviour is to have fully open, fully exported automatic modules. In Java, you can use the `Add-Opens` and `Add-Exports` manifest attributes to selectively bypass module restrictions of other mods at launch time, and we've added explicit support for these when loading your Forge mods. At compile-time, you can use existing solutions such as the extra-java-module-info Gradle plugin to deal with non-modular dependencies and add extra opens and exports to other modules. Here's an example on how to make the internal package `com.example.examplemod.internal` open to your mod in your build.gradle: tasks.named('jar', Jar) { manifest { attributes([ 'Add-Opens' : 'com.example.examplemod/com.example.examplemod.internal' 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors // (...) ]) } } With the above in your mod's jar manifest, you can now reflectively access the classes inside that internal package. Multiple entries are separated with a space, as per Java's official spec. You can also use Add-Exports to directly call without reflection, however you'd need to use the Gradle plugin mentioned earlier to be able to compile. The syntax for Add-Exports is the same as Add-Opens, and instructions for the compile-time step with the Gradle plugin are detailed later in this post. Remember to prefer the opens and exports keywords inside module-info.java for sources you control. The Add-Opens/Add-Exports attributes are only intended for forcing open other mods.   What else is new with module support? Previously, the runtime module name was always forced to the first mod ID in your `mods.toml` file and all packages were forced fully open and exported. Module names are now distinguished from mod IDs, meaning the module name in your module-info.java can be different from the mod ID in your `mods.toml`. This allows you to have a more descriptive module name that doesn't have to be the same as your mod ID, however we strongly recommend including your mod ID as part of your module name to aid troubleshooting. The `Automatic-Module-Name` manifest attribute is now also honoured, allowing you to specify a module name for your mod without needing to create a `module-info.java` file. This is particularly useful for mods that don't care about JPMS features but want to have a more descriptive module name and easier integration with other mods that do use JPMS.   How do I use it? The first step is to create a `module-info.java` file in your mod's source directory. This file should be in the same package as your main mod class, and should look something like this: open module com.example.examplemod { requires net.minecraftforge.eventbus; requires net.minecraftforge.fmlcore; requires net.minecraftforge.forge; requires net.minecraftforge.javafmlmod; requires net.minecraftforge.mergetool.api; requires org.slf4j; requires logging; } For now, we're leaving the whole module open to reflection, which is a good starting point. When we know we want to close something off, we can remove the open modifier from the module and open or export individual packages instead. Remember that you need to be open to Forge (module name net.minecraftforge.forge), otherwise it can't call your mod's constructor. Next is fixing modules in Gradle. While Forge and Java support modules properly, Gradle does not put automatic modules on the module path by default, meaning that the logging module (from com.mojang:logging) is not found. To fix this, add the Gradle plugin and add a compile-time module definition for that Mojang library: plugins { // (...) id 'org.gradlex.extra-java-module-info' version "1.9" } // (...) extraJavaModuleInfo { failOnMissingModuleInfo = false automaticModule("com.mojang:logging", "logging") } The automatic module override specified in your build.gradle should match the runtime one to avoid errors. You can do the same for any library or mod dependency that is missing either a module-info or explicit Automatic-Module-Name, however be aware that you may need to update your mod once said library adds one. That's all you need to get started with module support in your mods. You can learn more about modules and how to use them at dev.java.
    • Faire la mise à jour grâce à ce lien m'a aider personnellement, merci à @Paint_Ninja. https://www.amd.com/en/support 
    • When I came across the 'Exit Code: I got a 1 error in my Minecraft mods, so I decided to figure out what was wrong. First, I took a look at the logs. In the mods folder (usually where you'd find logs or crash reports), I found the latest.log file or the corresponding crash report. I read it through carefully, looking for any lines with errors or warnings. Then I checked the Minecraft Forge support site, where you can often find info on what causes errors and how to fix them. I then disabled half of my mods and tried running the game. If the error disappeared, it meant that the problem was with the disabled mod. I repeated this several times to find the problem mod.
    • I have no idea - switch to a pre-configured modpack and use it as working base    
  • Topics

×
×
  • Create New...

Important Information

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