Jump to content

Recommended Posts

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.

 

Posted

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.

Posted

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

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