javaminecraftminecraft-forge

Why is my modded Minecraft block missing it's texture in the inventory?


I'm modding Minecraft version 1.8.9 (Forge 11.15.1.2318). If I run the game, my mod's block item's texture is missing texture.

Screenshot

The placed block texture appears alright.

ClientProxy.java

public class ClientProxy extends CommonProxy {

    @Override
    public void registerRenders() {
        ModItems.registerRenders();
        ModBlocks.registerRenders();
    }

}

ModBlocks.java

public class ModBlocks {

    public static Block vibranium_ore;
    public static Block vibranium_block;

    public static void init() {
        vibranium_ore = new BlockVibraniumOre("vibranium_ore");
        vibranium_block = new BlockVibraniumBlock("vibranium_block");
    }

    public static void register() {
        registerBlock(vibranium_ore);
        registerBlock(vibranium_block);
    }

    public static void registerRenders() {
        registerRender(vibranium_ore);
        registerRender(vibranium_block);
    }

    public static void registerBlock(Block block) {
        GameRegistry.registerBlock(block, block.getUnlocalizedName().substring(5));
        Logging.log("Registered Block: " + block.getUnlocalizedName().substring(5));
    }

    public static void registerRender(Block block) {
        Item item = Item.getItemFromBlock(block);
        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0,
                new ModelResourceLocation(Reference.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
    }

}

I tried changing models like this: Block Model

{
    "parent": "block/cube_all",
    "textures": {
        "all": "legtech:blocks/res/pure/ingot/vb"
    }
}

Item Model

{
    "parent": "block/vibranium_block",
    "textures": {
        "layer0": "legtech:blocks/res/pure/ingot/vb"
    },
    "display": {
        "thirdperson": {
            "rotation": [ 10, -45, 170 ],
            "translation": [ 0, 1.5, -2.75 ],
            "scale": [ 0.375, 0.375, 0.375 ]
        }
    }
}


Solution

  • You are missing your modID in the parent name of the Item Model! Instead of this:

    {
        "parent": "block/vibranium_block",
        "textures": {
            "layer0": "legtech:blocks/res/pure/ingot/vb"
        },
        "display": {
            "thirdperson": {
                "rotation": [ 10, -45, 170 ],
                "translation": [ 0, 1.5, -2.75 ],
                "scale": [ 0.375, 0.375, 0.375 ]
            }
        }
    }
    

    write this:

    {
        "parent": "legtech:block/vibranium_block",
        "display": {
            "thirdperson": {
                "rotation": [ 10, -45, 170 ],
                "translation": [ 0, 1.5, -2.75 ],
                "scale": [ 0.375, 0.375, 0.375 ]
            }
        }
    }