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

Started by Law17 on Sun, 11/13/2022 - 17:56

Topic category: Help with modding (Java Edition)

Last seen on 22:17, 19. Jan 2023
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
how to give an entity an item and display it in their hand
Sun, 11/13/2022 - 17:56

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 02:40, 22. Jan 2023
Joined Feb 2021
Points:

User statistics:

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

Only possible with biped models

Last seen on 22:17, 19. Jan 2023
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 23:14, 22. Jan 2023
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 23:14, 22. Jan 2023
Joined Mar 2020
Points:

User statistics:

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

Besides using Biped model, of course.

Last seen on 23:14, 22. Jan 2023
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 03:11, 29. Nov 2022
Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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