Jump to content

[1.8.9] Armor Equipted shows no Texture ... -_-(path finding is wrong)


Recommended Posts

Posted

Hello Dear Forum,

 

Im stucking at a small problem ...

 

i cant solve it O.o

 

i codet an armor, armor class:

public class BlockUpdateArmorClass extends ItemArmor{

public BlockUpdateArmorClass(String unlocalizedName,ArmorMaterial material, int renderIndex, int armorType) {
        super(material, renderIndex, armorType);
        this.setUnlocalizedName(unlocalizedName);
        
        switch(armorType) {
        case 0: setUnlocalizedName("Test_Armor_Helmet"); break;
        case 1: setUnlocalizedName("Test_Armor_Chestplate"); break;
        case 2: setUnlocalizedName("Test_Armor_Legs"); break;
        case 3: setUnlocalizedName("Test_Armor_Boots"); break;
     
        
        }    
}	       
}

then i created a test material:

public static ArmorMaterial Test_Armor_Material = EnumHelper.addArmorMaterial("Test_Armor_Material", "blockupdate:item", 16, new int[] {3, 8, 6, 3}, 30);

 

then i registered it:

		Test_Armor_Helmet = new BlockUpdateArmorClass("Test_Armor_Helmet", Test_Armor_Material, 1, 0);
	Test_Armor_Chestplate = new BlockUpdateArmorClass("Test_Armor_Chestplate", Test_Armor_Material, 1, 1);
	Test_Armor_Legs = new BlockUpdateArmorClass("Test_Armor_Legs", Test_Armor_Material, 2, 2);
	Test_Armor_Boots = new BlockUpdateArmorClass("Test_Armor_Boots", Test_Armor_Material, 1, 3);

 

		GameRegistry.registerItem(Test_Armor_Helmet, Test_Armor_Helmet.getUnlocalizedName().substring(5));
	GameRegistry.registerItem(Test_Armor_Chestplate, Test_Armor_Chestplate.getUnlocalizedName().substring(5));
	GameRegistry.registerItem(Test_Armor_Legs, Test_Armor_Legs.getUnlocalizedName().substring(5));
	GameRegistry.registerItem(Test_Armor_Boots, Test_Armor_Boots.getUnlocalizedName().substring(5));

 

 

the Json files are alright, here just to proof, the helmet for example:

{
"parent": "builtin/generated",
"textures": {
	"layer0": "blockupdate:item/Test_Armor_Helmet"
    },
    "display": {
        "thirdperson": {
            "rotation": [ -90, 0, 0 ],
            "translation": [ 0, 1, -3 ],
            "scale": [ 0.55, 0.55, 0.55 ]
        },
        "firstperson": {
            "rotation": [ 0, -135, 25 ],
            "translation": [ 0, 4, 2 ],
            "scale": [ 1.7, 1.7, 1.7 ]
        }
    }
}

 

and there we go,

 

the problem is at the "Layer" path in the new "Material",

this is the path to my layers :

 

src\main\resources\assets\blockupdate\textures\models\armor

 

names of the Layers:

Test_Armor_Layer1

Test_Armor_Layer2

 

 

Posted

just edited my class:

 

public class BlockUpdateArmorClass extends ItemArmor{

public BlockUpdateArmorClass(ArmorMaterial material, int renderIndex, int armorType) {
        super(material, renderIndex, armorType);
        
        switch(armorType) {
        case 0: setUnlocalizedName("Test_Armor_Helmet"); break;
        case 1: setUnlocalizedName("Test_Armor_Chestplate"); break;
        case 2: setUnlocalizedName("Test_Armor_Legs"); break;
        case 3: setUnlocalizedName("Test_Armor_Boots"); break;
    
        }  
        
}	    
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type){
	if (slot == 0  || slot == 1 || slot == 3){
		return "blockupdate:textures/models/armor/Test_Armor_Layer1";
	} else if (slot == 2) {
		return "blockupdate:textures/models/armor/Test_Armor_Layer2";
	} else {
		return null;
	}
}
}

 

in this case i could leave the "PATH" to the layer empty ... but it still doesnt work .. :/ anyone any suggestions?

 

 

Posted

just edited my class:

 

public class BlockUpdateArmorClass extends ItemArmor{

public BlockUpdateArmorClass(ArmorMaterial material, int renderIndex, int armorType) {
        super(material, renderIndex, armorType);
        
        switch(armorType) {
        case 0: setUnlocalizedName("Test_Armor_Helmet"); break;
        case 1: setUnlocalizedName("Test_Armor_Chestplate"); break;
        case 2: setUnlocalizedName("Test_Armor_Legs"); break;
        case 3: setUnlocalizedName("Test_Armor_Boots"); break;
    
        }  
        
}	    
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type){
	if (slot == 0  || slot == 1 || slot == 3){
		return "blockupdate:textures/models/armor/Test_Armor_Layer1";
	} else if (slot == 2) {
		return "blockupdate:textures/models/armor/Test_Armor_Layer2";
	} else {
		return null;
	}
}
}

 

in this case i could leave the "PATH" to the layer empty ... but it still doesnt work .. :/ anyone any suggestions?

The first string is just the name the second string is the path. It would be like this "modid:test_armor" and the actual files need to be lower case.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

OK I FOUND IT!! :D

 

thats to "gabrielbl" and to you "Animefan8888" ,

 

the problem was that i didnt wrote ".png" behind the layer texture ... -_- , i found this at the post from gabriel,

 

so now it work as this:

 

	@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type){
	if (slot == 0  || slot == 1 || slot == 3){
		return "blockupdate:textures/models/armor/test_armor_layer1.png";
	} else if (slot == 2) {
		return "blockupdate:textures/models/armor/test_armor_layer2.png";
	} else {
		return null;
	}
}
}

 

 

thanks guys ! :)

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.