Jump to content

Recommended Posts

Posted

Hello,

I added an item, which makes the player's arm point in the direction the player is looking.

The rendering of the arm is working, but the item is always rendering at the body of the player.

I know there is the LayerHeldItem class, which renders the item, but i don't know how to remove the normal LayerHeldItem and add a new one.

Is there also a way to do this without creating a new RenderPlayer class?

Here is my code:

  Reveal hidden contents
  Reveal hidden contents

 

Posted
  On 10/10/2019 at 1:47 PM, Lyon said:

But is there a way to change the item rotation based on the direction the player is looking?

Expand  

Yes but you'll have to either cancel the players default rendering in the RenderPlayerEvent.Pre and then render everything your self the way you want it. Or you can use reflection to change the players model specifically for the layer the item is rendered in.

  • Thanks 1

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
  On 10/10/2019 at 1:47 PM, Lyon said:

But is there a way to change the item rotation based on the direction the player is looking?

Expand  

One small point: the item's position will be relative to the arm which you are already adjusting to match the direction the player is looking, so you shouldn't actually need the item to do any additional rotation itself; just have it set up in the json file. Right?

  • Thanks 1
Posted
  On 10/10/2019 at 8:05 PM, salvestrom said:

Right?

Expand  

No he makes the arm invisible in the Pre event so it doesnt render via PlayerRenderer but instead renders in the Post event. Therefore the item has already be rendered at the normal arm position.

 

  On 10/11/2019 at 4:47 PM, Lyon said:

but how can I cancel the normal rendring of the the item.

Expand  

Not sure you'll have to look at the code where it renders the item(s) being held.

  • Thanks 1

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 got it working, but I am not sure if it is the best solution.

Thank you very much!

However here is my code:

  Reveal hidden contents

 

Posted

With what you're doing here, could you instead access the model file and insert an if statement to the animation method that checks for your item in hand and alters the angles there, before rendering?

Posted

So I improved some things and everything is working well in Eclipse.

But when I build the mod and launch it in minecraft, the item rendering isn't cancelled.

Here is my new code:

ItemRenderHandler:

  Reveal hidden contents

SpecialLayerHeldItem:

  Reveal hidden contents

 

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.