Tschipp Posted October 13, 2019 Posted October 13, 2019 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? Quote
Tschipp Posted October 14, 2019 Author Posted October 14, 2019 5 hours ago, diesieben07 said: It does not. Yeah, after a few hours of stepping through the debugger I noticed that too... How does the client then acquire an updated version of entities from the server? Is it a packet? (Probably) Do you see any other solution for my problem? Quote
Recommended Posts
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.