Jump to content

black/purple icons in inventory(armor) [1.10]


Struxx

Recommended Posts

hi why is my armor purple black? i think i have all right heres my workplace please help me .____.

 

 

workplace: http://www.mediafire.com/download/imp01zip8jgruod/struxx.rar

 

 

ItemPlasticArmor.java

 

package com.PlasticMod;

 

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.Entity;

import net.minecraft.inventory.EntityEquipmentSlot;

import net.minecraft.item.Item;

import net.minecraft.item.ItemArmor;

import net.minecraft.item.ItemStack;

 

public class ItemPlasticArmor extends ItemArmor {

 

    public ItemPlasticArmor(ArmorMaterial materialIn, EntityEquipmentSlot equipmentSlotIn) {

        super(materialIn, 0, equipmentSlotIn);

    }

    @Override

    public Item setCreativeTab(CreativeTabs tab) {

     

        return super.setCreativeTab(PlasticMod.TabCustomTab);

    }

    public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {

        if (slot == EntityEquipmentSlot.HEAD || slot == EntityEquipmentSlot.CHEST || slot == EntityEquipmentSlot.FEET) {

            return "ID:textures/models/armor/armor_layer_1.png";

        } else if (slot == EntityEquipmentSlot.LEGS) {

            return "ID:textures/models/armor/armor_layer_2.png";

        } else {

            return null;

        }

    }

 

}

 

 

 

 

PlasticMod.Java

 

package com.PlasticMod;

 

 

 

import com.PlasticMod.blocks.BlockPlasticblock;

import com.PlasticMod.blocks.BlockPlasticore;

import com.PlasticMod.items.ItemPlasticAxe;

import com.PlasticMod.items.ItemPlasticDust;

import com.PlasticMod.items.ItemPlasticHoe;

import com.PlasticMod.items.ItemPlasticIngot;

import com.PlasticMod.items.ItemPlasticPickaxe;

import com.PlasticMod.items.ItemPlasticShovel;

import com.PlasticMod.items.ItemRawPlastic;

import com.PlasticMod.items.itemPlasticSword;

import com.PlasticMod.util.CustomCreativeTab;

 

import net.minecraft.block.Block;

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.init.SoundEvents;

import net.minecraft.inventory.EntityEquipmentSlot;

import net.minecraft.item.Item;

import net.minecraft.item.Item.ToolMaterial;

import net.minecraft.item.ItemArmor;

import net.minecraft.item.ItemArmor.ArmorMaterial;

import net.minecraft.item.ItemAxe;

import net.minecraft.item.ItemHoe;

import net.minecraft.item.ItemPickaxe;

import net.minecraft.item.ItemSpade;

import net.minecraft.item.ItemStack;

import net.minecraft.item.ItemSword;

import net.minecraftforge.common.util.EnumHelper;

import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.common.Mod.EventHandler;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import net.minecraftforge.fml.common.registry.GameRegistry;

 

@Mod (modid = PlasticMod.MODID)

public class PlasticMod {

 

    public static final String MODID = "plasticmod";

 

    /* Tool Materials */

 

public static ToolMaterial plasticToolMaterial = EnumHelper.addToolMaterial("PlastikToolMaterial", 2, 44, 6, 7, 3);

 

/* Armor Materials */

 

public static ArmorMaterial plasticArmorMaterial = EnumHelper.addArmorMaterial("plasticArmorMaterial", "hallo", 48, new int [] {3, 7, 5, 3,}, 3, SoundEvents.BLOCK_END_GATEWAY_SPAWN, 3);

 

 

/* Creative-Tabs */

 

public static CreativeTabs TabCustomTab = new CustomCreativeTab();

 

    /* Items */

 

 

    public static Item plasticdust = new ItemPlasticDust();

    public static Item plasticingot = new ItemPlasticIngot();

    public static Item rawplastic = new ItemRawPlastic();

    public static ItemSword plasticsword = new itemPlasticSword();

    public static ItemSpade plasticshovel = new ItemPlasticShovel();

    public static ItemPickaxe plasticpickaxe = new ItemPlasticPickaxe();

    public static ItemHoe plastichoe = new ItemPlasticHoe();

    public static ItemArmor plastichelmet = new ItemPlasticArmor(plasticArmorMaterial, EntityEquipmentSlot.HEAD);

    public static ItemArmor plasticchest = new ItemPlasticArmor(plasticArmorMaterial, EntityEquipmentSlot.CHEST);

    public static ItemArmor plasticlegs = new ItemPlasticArmor(plasticArmorMaterial, EntityEquipmentSlot.LEGS);

    public static ItemArmor plasticboots = new ItemPlasticArmor(plasticArmorMaterial, EntityEquipmentSlot.FEET);

 

 

 

 

    /* Blocks */

 

public static Block plasticblock = new BlockPlasticblock();

public static Block plasticore = new BlockPlasticore();

 

 

    @EventHandler

    public void preInit (FMLPreInitializationEvent event) {

        //shapeless Crafting

        ItemStack stackWool = new ItemStack(Blocks.WOOL);

        ItemStack stackWeb = new ItemStack(Blocks.WEB, 5);

     

 

     

        GameRegistry.addShapelessRecipe(stackWeb, stackWool);

        //Crafting Recipe

       

        ItemStack stackPlasticDust = new ItemStack(plasticdust);

        ItemStack stackRawPlastic = new ItemStack(rawplastic, 3);

       

        GameRegistry.addRecipe(stackRawPlastic, "ppp", "ppp", "ppp", 'p', stackPlasticDust);

       

        ItemStack stackPlasticIngot = new ItemStack(plasticingot);

        ItemStack stackStick = new ItemStack(Items.STICK);

        ItemStack stackPlasticSword = new ItemStack(plasticsword);

     

        GameRegistry.addRecipe(stackPlasticSword, "p", "p", "t", 'p', stackPlasticIngot, 't', stackStick);

       

        ItemStack stackPlasticPickAxe = new ItemStack(plasticpickaxe);

     

        GameRegistry.addRecipe(stackPlasticPickAxe, "ppp", " t ", " t ", 'p', stackPlasticIngot, 't', stackStick);

     

        ItemStack stackPlasticSpade = new ItemStack(plasticshovel);

     

        GameRegistry.addRecipe(stackPlasticSpade, "p", "t", "t", 'p', stackPlasticIngot, 't', stackStick );

     

        ItemStack stackPlasticHoe = new ItemStack(plastichoe);

     

        GameRegistry.addRecipe(stackPlasticHoe, "pp ", " t ", " t ", 'p', stackPlasticIngot, 't', stackStick);

     

     

        //Smelting

        ItemStack stackCoalBlock = new ItemStack(Blocks.COAL_BLOCK);

        ItemStack stackDiamond = new ItemStack(Items.DIAMOND);

        GameRegistry.addSmelting(stackCoalBlock, stackDiamond, 10);

       

        GameRegistry.addSmelting(rawplastic, stackPlasticIngot, 100);

       

       

    }

 

 

    @EventHandler

    public void init (FMLInitializationEvent event) {

     

        /* Item Registry */

     

 

    GameRegistry.registerItem(plasticdust, "plasticdust");

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(plasticdust, 0, new ModelResourceLocation("plasticmod:plasticdust", "Inventory"));

 

    GameRegistry.registerItem(plasticingot, "plasticingot");

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(plasticingot, 0, new ModelResourceLocation("plasticmod:plasticingot", "Inventory"));

 

    GameRegistry.registerItem(rawplastic, "rawplastic");

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(rawplastic, 0, new ModelResourceLocation("plasticmod:rawplastic", "Inventory"));

 

    GameRegistry.registerItem(plasticsword, "plasticsword");

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(plasticsword, 0, new ModelResourceLocation("plasticmod:plasticsword", "Inventory"));

 

    GameRegistry.registerItem(plasticshovel, "plasticshovel");

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(plasticshovel, 0, new ModelResourceLocation("plasticmod:plasticshovel", "Inventory"));

 

    GameRegistry.registerItem(plasticpickaxe, "plasticpickaxe");

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(plasticpickaxe, 0, new ModelResourceLocation("plasticmod:plasticpickaxe", "Inventory"));

 

    GameRegistry.registerItem(plastichoe, "plastichoe");

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(plastichoe, 0, new ModelResourceLocation("plasticmod:plastichoe", "inventory"));

 

    GameRegistry.registerItem(plasticboots, "plasticboots");

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(plasticboots, 0, new ModelResourceLocation("plasticmod:plasticboots", "inventory"));

 

    GameRegistry.registerItem(plasticchest, "plasticchest");

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(plasticchest, 0, new ModelResourceLocation("plasticmod:plasticchest", "inventory"));

 

    GameRegistry.registerItem(plastichelmet, "plastichelmet");

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(plastichelmet, 0, new ModelResourceLocation("plasticmod:plastichelmet", "inventory"));

 

    GameRegistry.registerItem(plasticlegs, "plasticlegs");

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(plasticlegs, 0, new ModelResourceLocation("plasticmod:plasticlegs", "inventory"));

 

 

 

    /* Block Registry */

 

    GameRegistry.registerBlock(plasticblock, "plasticblock");

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(plasticblock), 0, new ModelResourceLocation("plasticmod:plasticblock", "Inventory"));

 

    GameRegistry.registerBlock(plasticore, "plasticore");

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(plasticore), 0, new ModelResourceLocation("plasticmod:plasticore", "Inventory"));

 

    }

    @EventHandler

    public void postInit (FMLPostInitializationEvent event) {

 

     

     

     

     

}

 

}

 

 

plasticchest.json

 

{

    "parent": "item/generated",

    "textures": {

        "layer0": "plasticmod:items/plasticchest",

        "layer1": "plasticmod:armor/armor_layer_1"

    }

}

 

 

Link to comment
Share on other sites

Do not use

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().

Instead use

ModelLoader.setCustomModelResourceLocation(...)

This is provided by forge as the vanilla on is kinda "broken" (it doesnt work how it is expected to). Also you will need to do it in preInit.

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.

Link to comment
Share on other sites

thats the .json File:

 

{

    "parent": "item/generated",

    "textures": {

        "layer0": "plasticmod:items/plasticlegs",

        "layer1": "plasticmod:armor/armor_layer_2"

    }

}

 

and thats the itemPlasticArmor.java:

 

package com.PlasticMod;

 

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.Entity;

import net.minecraft.inventory.EntityEquipmentSlot;

import net.minecraft.item.Item;

import net.minecraft.item.ItemArmor;

import net.minecraft.item.ItemStack;

 

public class ItemPlasticArmor extends ItemArmor {

 

public ItemPlasticArmor(ArmorMaterial materialIn, EntityEquipmentSlot equipmentSlotIn) {

super(materialIn, 0, equipmentSlotIn);

}

@Override

public Item setCreativeTab(CreativeTabs tab) {

 

return super.setCreativeTab(PlasticMod.TabCustomTab);

}

public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {

if (slot == EntityEquipmentSlot.HEAD || slot == EntityEquipmentSlot.CHEST || slot == EntityEquipmentSlot.FEET) {

return "plasticmod:textures/models/armor/armor_layer_1.png";

} else if (slot == EntityEquipmentSlot.LEGS) {

return "plasticmod:textures/models/armor/armor_layer_2.png";

} else {

return null;

}

}

 

}

 

Link to comment
Share on other sites

Post the error that logs in the console.

It wouldn't use the black and purple unless it either can't find the model or can't find the texture. So make sure your textures are at

assets.modid.textures.items

and at

assets.modid.textures.armor

(as you specified in your json file) and your model at

assets.modid.models.item/plasticlegs.json

(as you specified in setCustomModelResourceLocation).

 

also unrelated but use setUnlocalisedName when registering your item so you can give it a name in gui

Link to comment
Share on other sites

thats the .json File:

 

{

    "parent": "item/generated",

    "textures": {

        "layer0": "plasticmod:items/plasticlegs",

        "layer1": "plasticmod:armor/armor_layer_2"

    }

}

 

and thats the itemPlasticArmor.java:

 

package com.PlasticMod;

 

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.Entity;

import net.minecraft.inventory.EntityEquipmentSlot;

import net.minecraft.item.Item;

import net.minecraft.item.ItemArmor;

import net.minecraft.item.ItemStack;

 

public class ItemPlasticArmor extends ItemArmor {

 

public ItemPlasticArmor(ArmorMaterial materialIn, EntityEquipmentSlot equipmentSlotIn) {

super(materialIn, 0, equipmentSlotIn);

}

@Override

public Item setCreativeTab(CreativeTabs tab) {

 

return super.setCreativeTab(PlasticMod.TabCustomTab);

}

public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {

if (slot == EntityEquipmentSlot.HEAD || slot == EntityEquipmentSlot.CHEST || slot == EntityEquipmentSlot.FEET) {

return "plasticmod:textures/models/armor/armor_layer_1.png";

} else if (slot == EntityEquipmentSlot.LEGS) {

return "plasticmod:textures/models/armor/armor_layer_2.png";

} else {

return null;

}

}

 

}

 

What are you doing plastic_layer_0 and 1 are completely different from the JSON. You need to make item textures the layers are the models texture.

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.

Link to comment
Share on other sites

How it looks on your body is completely different from how it looks in a gui. The GUI is handled by the JSON files I assume you made an item called plastic. Do it like that. The way it looks on your body is handled by the code itself getArmorTextureLocation() i thinknit is called.

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.

Link to comment
Share on other sites

which method? :D

How it looks on your body is completely different from how it looks in a gui. The GUI is handled by the JSON files I assume you made an item called plastic. Do it like that. The way it looks on your body is handled by the code itself getArmorTextureLocation() i thinknit is called.

I wonder...

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.

Link to comment
Share on other sites

i dont have a getArmorTextureLocation() i just have getArmorTexture(string, entity, equipmentslot, type)

i fill it with getArmorTexture(plastichelmet, 49, 0 ,null); but then is "getArmorTexture" red marker and eclipse want: change method getArmorTexture(string, entity, equipmentslot, type) to getArmorTexture(ItemArmor,int,int,string) what musst i fill here?

Link to comment
Share on other sites

maybe u find the error

 

package com.PlasticMod;

 

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.Entity;

import net.minecraft.inventory.EntityEquipmentSlot;

import net.minecraft.item.Item;

import net.minecraft.item.ItemArmor;

import net.minecraft.item.ItemStack;

 

public class ItemPlasticArmor extends ItemArmor {

 

public ItemPlasticArmor(ArmorMaterial materialIn, EntityEquipmentSlot equipmentSlotIn) {

super(materialIn, 0, equipmentSlotIn);

 

ItemArmor plastichelmet = new ItemPlasticArmor(PlasticMod.plasticArmorMaterial, EntityEquipmentSlot.HEAD);

getArmorTexture(plastichelmet, 49, 0, null);

}

@Override

public Item setCreativeTab(CreativeTabs tab) {

 

return super.setCreativeTab(PlasticMod.TabCustomTab);

}

public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {

if (slot == EntityEquipmentSlot.HEAD || slot == EntityEquipmentSlot.CHEST || slot == EntityEquipmentSlot.FEET) {

return "plasticmod:textures/models/armor/armor_layer_1.png";

} else if (slot == EntityEquipmentSlot.LEGS) {

return "plasticmod:textures/models/armor/armor_layer_2.png";

} else {

return null;

}

}

 

}

 

Link to comment
Share on other sites

what I need to do so it works? the GUI texture is missing

was kann ich tun damit die GUI eine textur hat hab ja alles richtig gemacht glaube ich

You have layer_0 and layer_1, but in code you say layer_1 and layer_2.

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.

Link to comment
Share on other sites

  • 2 weeks later...

I think those backgrounds are the slots -- what should show outlines when empty. Even your empty leggings slot is broken.

 

Go back through your code and avoid messing with them. Perhaps you inserted your own domain (modid) somewhere you didn't need to?

 

However... the helm in normal inventory also has the missing texture behind it. That's super weird. I think it's time to post a full log file (not mere console output), your armor class, and anything you're rendering.

 

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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.

Announcements



×
×
  • Create New...

Important Information

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