Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

  • 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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.