Rendering item on custom entity

Started by Overtek on

Topic category: Advanced modding

Joined Oct 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Rendering item on custom entity

Hello anyone know how to render item on custom entity ? I don't thing it's possible with mcreator or blockbench and I need to go to the code but I don't know how to do that. If anyone can help me it would be nice :)

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yep super simple in code…
Sun, 05/31/2020 - 03:56

Yep super simple in code. Are you using a biped entity?

To place items in your entities Equipment Slots use the snipped below in your entity class,

    @Override
    public void onAddedToWorld() {
        super.onAddedToWorld();
        this.setItemStackToSlot(EquipmentSlotType.MAINHAND, new ItemStack(YourItem));
        this.setItemStackToSlot(EquipmentSlotType.HEAD, new ItemStack(YourItem));
    }

To render it on the entity, though, use the snippet below in the entity render class,

        this.addLayer(new HeldItemLayer<>(this));
        this.addLayer(new BipedArmorLayer(this, new BipedModel(0.5f), new BipedModel(1.0f)));
        this.addLayer(new ElytraLayer<>(this));

 

Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Am I supposed to extend…
Tue, 08/25/2020 - 19:46

Am I supposed to extend something because the addLayer method isn't recognised?

Does the model have to be biped?

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is this still working?
Tue, 12/06/2022 - 04:57

Is this still working?