Jump to content

Recommended Posts

Posted

How would I go about rendering an item on my block, when right-clicked with the item.

 

Reading through forum posts, I've seen people suggesting using a TileEntityRenderer and also baking the Item into the block using the IModel(s) (however I cant find that in the same package in 1.15 although its on the 1.15 docs, is something else used now?)

 

Which approach is better in certain circumstances and how would I go about implementing either of them? Any advice is greatly appreciated.

Posted
  On 4/18/2020 at 6:50 PM, Ryze said:

How would I go about rendering an item on my block, when right-clicked with the item.

Expand  

It depends on your situation. Is there a finite number of possible Items? Will there be animation IE moving parts?

If there are finite possible items just make a model for each state.

If there are moving parts you have to use a TER.

If there are no moving parts, but an infinite amount of possible Items then you should have a custom IBakedModel.

 

The first is obvious how to do. The second vanilla has a Model class that it uses, you should probably use that. Take a peek at the Vanilla TileEntityRenderers. For the third option you need your own IBakedModel implementation that combines the Quads of an Item(s) with the Quads of your Block model. Then you must register it using the ModelBakeEvent by just putting it in the registry.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

I have the Item rendering on the block using a custom IBakedModel implementation, but the item seems to have a 16 x 16 invisible background that clips through the model at certain angles, any ideas?

 

The model without an item

  Reveal hidden contents

And with

  Reveal hidden contents

My IBakedModel implementation

  Reveal hidden contents

 

Posted
  On 4/24/2020 at 11:32 PM, Ryze said:

I have the Item rendering on the block using a custom IBakedModel implementation, but the item seems to have a 16 x 16 invisible background that clips through the model at certain angles, any ideas?

Expand  

Nevermind, just had to change the RenderType for the block.

Posted

check net.minecraft.client.renderer.ItemRenderer#renderItem out

you can get it with Minecraft#getItemRenderer

and the minecraft instance just with Minecraft#getInstance

 

 I will make fun of you if you are not able to look into the (vanilla-) code.

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.