Jump to content

[1.8] ItemBlock's textures using the wrong texture


macncheezy

Recommended Posts

I had this problem before but assumed it was just a problem with my coding so I restarted my project and it's still happening so I ask, why does a blocks texture while in the player's inventory use another blocks texture?

 

The block that's using another blocks texture

Registeration

public static Block ChanceBlock;
ChanceBlock = new ChanceBlock(Material.cloth);
GameRegistry.registerBlock(ChanceBlock, "ChanceBlock");
registerRender(ChanceBlock);
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation("avon:ChanceBlock", "inventory"));

All the methods the above code are in is called in the init().

Blockstate.json

{
    "variants": {
        "normal": { "model": "avon:ChanceBlock" }
    }
}

Blockmodel.json

{
    "parent": "block/cube_all",
    "textures": {
        "all": "avon:blocks/ChanceBlock"
    }
}

Itemmodel.json

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

 

The block that the texture is being taken from

Registration

public static BlockOre XeserOre;
XeserOre = new XeserOre(Material.rock);
GameRegistry.registerBlock(XeserOre, "XeserOre");
registerRender(XeserOre);
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation("avon:XeserOre", "inventory"));

Again, all called in init();

Blockstate.json

{
    "variants": {
        "normal": { "model": "avon:XeserOre" }
    }
}

Blockmodel.json

{
    "parent": "block/cube_all",
    "textures": {
        "all": "avon:blocks/XeserOre"
    }
}

Itemmodel.json

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

 

If you need any more code to help me, I'd gladly get it to you as soon as I can.

Thanks

  ~Macncheezy

Link to comment
Share on other sites

  • 2 weeks later...
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation("avon:ChanceBlock", "inventory"));

 

I think you should be using the 'getItemFromBlock' method from the Item class as the first argument in the .register function.

 

Maybe try

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ChanceBlock), 0, new ModelResourceLocation("avon:ChanceBlock", "inventory"));

 

Also, you should camelCase your variables instead of TitleCase.  It's a little confusing to read.

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.