I have a contraption that renders static entities, meaning the entities don't exist in the world.
The entity NBT must be read before the render to conserve information such as sheep color or entity age.
This used to work fine for all cases in 1.12, but I'm having trouble with Villagers and Foxes.
I'll illustrate my issue for foxes:
First, I call IForgeEntity#deserializeNBT.
That then calls Entity#read, which eventually calls Entity#readAdditional.
For foxes, that method then calls a method of FoxEntity called "func_213501_ej".
That function adds attack goals to the fox. Problem is, that those attack goals haven't been initialized yet and are null, causing a NPE further down the line in the TargetSelector class.
One potential solution that I see for this is that I call MobEntity#registerGoals before the NBT read. However, I would need to use reflection for that.
MobEntity#registerGoals is usually called from the MobEntity constructor but registerGoals only gets executed when the world is not remote.
But I wonder, how does vanilla do it? I mean the game reads the NBT on the client at some point, but doesn't get any crashes from uninitialized AI Goals...
Am I calling the wrong serialize/deserialize functions?
So I done diddly did this :
And this in my main mod class : LootConditionManager.registerCondition(new Ready.Serializer());
So now how do I actually use it so that the boolean here changes when I need it to from my block class?