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

Started by Law17 on

Topic category: Help with Minecraft modding (Java Edition)

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

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

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?

 

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.

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.

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.


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

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?

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
TheVoidShadows, could you…
Sun, 11/17/2024 - 02:28

TheVoidShadows, could you elaborate on how could that be done?