#Modifying Villagers

4 messages · Page 1 of 1 (latest)

west ivy
#

I'm looking to modify villagers and would like some pointers.
I'm trying to do things like adding extra nbt data to villagers but I'm not sure the best approach for this.

I've started by hooking into ServerEntityEvents.ENTITY_LOAD.register(...) but that runs every time the villager is loaded, whereas I'd like it to only run when a villager is first spawned from either worldgen or breeding.

I could just add an extra tag like "done: true" but that doesn't feel like the best way, is it?

tough ivy
#

I'm trying to do things like adding extra nbt data to villagers

entities dont have nbt unless being saved or loaded (or serialized into a packet)
adding things to entities requires adding fields to the class, then adding save/load handling in the writeNbt/readNbt methods respectively

#

the initialize method is used to setup entities initial state

#

Mixins will be valuable here