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)

Active 1 year ago
Joined Nov 2022
Points:
226

User statistics:

  • Modifications: 0
  • Forum topics: 4
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 6
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

Active 5 months ago
Joined Feb 2021
Points:
730

User statistics:

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

Only possible with biped models

Active 1 year ago
Joined Nov 2022
Points:
226

User statistics:

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

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

 

Active 1 year ago
Joined Mar 2020
Points:
652

User statistics:

  • Modifications: 2
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 61
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.

Active 1 year ago
Joined Mar 2020
Points:
652

User statistics:

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

Besides using Biped model, of course.

Active 1 year ago
Joined Mar 2020
Points:
652

User statistics:

  • Modifications: 2
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 61
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.


Active 1 day ago
Joined Dec 2017
Points:
785

User statistics:

  • Modifications: 0
  • Forum topics: 12
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 91
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

Active 10 months ago
Joined Nov 2023
Points:
76

User statistics:

  • Modifications: 0
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 6
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?

Active 1 month ago
Joined Nov 2023
Points:
91

User statistics:

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

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