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

Hi guys,

 

I'm having problem rendering blocks on inventory. If I place the block, the rendering is good, it's only on my inventory. There is nothing suspect in logs.

 

I'm overriding BlockOre and using a "setTexture" method to register the block :

 

public BlockOre setTexture(String texture)
{
	setUnlocalizedName(texture);
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(this), 0, new ModelResourceLocation(MyMod.MODID + ":" + texture, "inventory"));
	GameRegistry.registerBlock(this, texture);
	return this;
}

 

on FMInitializationEvent I do :

 

rubyOre = new IronBlockOre().setTexture("ruby_ore").setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundTypePiston);

 

 

and here are jsons files :

 

src/main/resources/assets/my_modid/models/block/ruby_ore.json :

 

{
    "parent": "block/cube_all",
    "textures": {
        "all": "my_modid:blocks/ruby_ore"
    }
}

 

src/main/resources/assets/my_modid/models/item/ruby_ore.json :

 

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

 

src/main/resources/assets/my_modid/blockstates/ruby_ore.json :

 

{
    "variants": {
        "normal": { "model": "my_modid:ruby_ore" }
    }
}

 

the texture is at src/main/resources/assets/my_modid/textures/blocks/ruby_ore.png

 

What am i doing wrong ?

 

Thanks you for your help.

 

Rendering registration should be done in load (init) in proxy. Also - why are you using GameRegistry in setTexture?

 

To be more precise - move your rendering registration to Main#proxy#registerRenderers() and call it in init. GameRegistry and setting UN should stay in preInit, separately. Tip: Rename your setTexture method - it's confusing, also you can do that in constructor if you really want.

1.7.10 is no longer supported by forge, you are on your own.

  • Author

Thanks for your response. ;)

 

I don't understand how it works, I need to declare blocks and GameRegistry.registerBlock on preInit and setting texture on init ?

 

And yes I'll rename "setTexture", it's confusing. :P   

 

PS : Nevermind, I figured out by myself. It was a problem with preInit and init like you said, thanks you Ernio. ;)                                   

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.