Jump to content

[1.11.2] Making my custom Entity equip items


Coron

Recommended Posts

Whenever my entity, which extends EntityCreature, is spawned, I run the following:

this.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(Blocks.PUMPKIN));

But it seemingly has no effect. I've also tried to run it a while after it has spawned and confirmed that is does execute. However, my entity still does not equip anything. I've also tried equipping it with a sword, but that also has no effect.

Link to comment
Share on other sites

3 minutes ago, diesieben07 said:

Show your code. Also, what makes you think that it's not equipped? Have you checked with the debugger? Does your renderer actually handle equipped items?

Was not aware of the need to add it to the render, but of course that was it, thanks.

 

For those with the same issue, I added the following to the constructor of my render:

this.addLayer(new LayerHeldItem(this));
Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.