Jump to content

[1.15.2] [SOLVED] Transforming First Person Items


Frostnox

Recommended Posts

I was wondering about the most effective way to apply transformations to items rendered in first person. For context, I am trying to create animations for custom weapon attacks. At first I tried transforming the MatrixStack from RenderHandEvent, and the effect is what I'm looking for but it unfortunately applies to items in both hands. My next idea was to cancel the vanilla rendering for my item (this works on specific hands) and then render it with the transformations. However, I'm not sure exactly how to do that since RenderHandEvent does not have a rendering method. My first guess is FirstPersonRenderer#renderItemInFirstPerson, but I don't know what to provide for IRenderTypeBuffer.Impl and I can't find any usages of this method in the vanilla code. If this is the right method, what is typically provided to do vanilla rendering of a held item?

As a side-note, I only need animations for my items, so would it be better to do this through JSON files instead? At least three variables would be necessary though, so I'm not sure this would be simpler than what I am trying currently.

Link to comment
Share on other sites

Howdy

There are a couple of ways I think you can do this-

1) Create your own custom IBakedModel for your item- this will let you set whatever transform and whatever rendering you want.  You alter the getItemCameraTransforms(), not the MatrixStack

or (similar)

2) Use an ISTER for your item which lets you use a TileEntity renderer - again lets you set the transform and rendering, but gives you more flexilibity about the shape/appearance of the item that you draw

 

There's a working example of the first one here - it alters the quads not the transform, but hopefully it's clear how you could adapt it.

https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe15_item_dynamic_item_model

 

The second one - search this forum for ISTER, there was someone else recently doing the same thing

 

-TGG

Link to comment
Share on other sites

  • Frostnox changed the title to [1.15.2] [SOLVED] Transforming First Person Items

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.