EntityArchetype equipment

Hello! Is there any way to set EntityArchetype equipment like Helmet or Hand Items?
I’m currently creating Entity and calling createArchetype() method, but for me it’s very messy.
I need archetype to create custom MobSpawner.

While i dont know about modifing the EntityArchetype. Due to the fact you want it as a custom mob spawner. You could listen for EntitySpawnEvent and check if the cause was one of the custom mob spawners. From there do the modifications you wish

So… I solved my problem. When creating EntityArchetype via builder, you can set all interesting you vales to DataContainer which must be formatted just like in NbtTagCompound.
And there is code for people who will encounter the same problem:

DataContainer customEntityData = DataContainer.createNew();
DataContainer mainHand = DataContainer.createNew();
DataContainer offHand = DataContainer.createNew();

mainHand.set(DataQuery.of(“id”), ItemTypes.DIAMOND_AXE.getId());
mainHand.set(DataQuery.of(“Count”), (short)1);

customEntityData.set(DataQuery.of(“HandItems”), Arrays.asList(mainHand, offHand));

EntityArchetype archetype = EntityArchetype.builder()
.type(EntityTypes.SKELETON)
.entityData(customEntityData)
.build();

1 Like