how to give an entity an item and display it in their hand

Started by Law17 on

Topic category: Help with modding (Java Edition)

Last seen on 01:32, 22. Oct 2023
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how to give an entity an item and display it in their hand

i want to figure out how to make an entity display an item in their hand when right clicked on, like the allay or tuff golem, it would be great if anyone could help out

Last seen on 03:52, 28. Jul 2023
Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Only possible with biped…
Wed, 11/16/2022 - 09:49

Only possible with biped models

Last seen on 01:32, 22. Oct 2023
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
could i render the model as…
Wed, 11/16/2022 - 18:14

could i render the model as biped but its not biped?

 

Last seen on 19:20, 25. Jun 2023
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't think this is…
Sun, 11/27/2022 - 23:44

I don't think this is possible without modifying the code of the entity itself through the "edit as code" button.

Last seen on 19:20, 25. Jun 2023
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Besides using Biped model,…
Sun, 11/27/2022 - 23:44

Besides using Biped model, of course.

Last seen on 19:20, 25. Jun 2023
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Unfortunately, this doesn't…
Sun, 11/27/2022 - 23:58

Unfortunately, this doesn't appear to be possible without custom code.

The biped models appear to have special code on their models that update based on what they are holding.

This, the only line of code I could find that represents this, doesn't even reference the model: this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(<insert_mod_item_here>.get()));

Even looking in the renderer code, it doesn't reference the mainhand/offhand item models.


Last seen on 17:34, 2. Oct 2023
Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
another option, and hear me…
Mon, 11/28/2022 - 01:04

another option, and hear me out, is to make the entity model with the item in-hand already. Unfortunately, this would mean you can't use bows and the item can't be swapped or randomized.

 

Other than that, only Biped entities can hold items in-hand

Last seen on 22:22, 13. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Dear user, Is the entity you…
Tue, 11/07/2023 - 15:31

Dear user, Is the entity you want to display the item in the hand of custom?