Jump to content

[1.16.5] ItemStack renderer


SSKirillSS

Recommended Posts

Hello. I simply want to render my own texture like a regular itemstack (with 3D-effect) without creating an own item or model for it. Here is how itementity renderers:
1610912596926.png.d53b0cc9963a6d573e9184321c93aae5.png

On this screenshot you can see that by default it creates something like depth effect for making it looks like an 3D-thing. And here is my example. In this case I just draw plain texture via vertexes:
1610912685587.png.b3194e4f67476488768a1a41836587e3.png

So, As a result I want to render my floating shields like itemstack, but this is not actually an item, this is just texture, and, as I understand, I can't use in this case something like it (because this is not an item):

Minecraft.getInstance().getItemRenderer().renderItem()


I've tried to analyze code of itemstack rendering, but it looks too complicated and contains a lot of references from other classes, so, I can't simply understand which part of rendering I should analyze.
 

Link to comment
Share on other sites

I think that the LayerRenderer is what you need. check for instance the ElytraLayer to get an example.

in there just override the render method, check if the entity should have the layer rendered, and if it should, draw the objects (note that the rendering code is somewhat complicated, nothing that brute force won't fix)

and then to "register" the layer, you can simply add a new instance of it to the player, under the RenderPlayerEvent (note: don't do this on the server side, only on the client side)

Edited by kiou.23
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.