Adorned (Curios)

Adorned (Curios)

93 Downloads

Serialization fails for FakePlayers

Darkere opened this issue ยท 5 comments

commented

For editing playerdata while the players are offline I load the player in as a fake player, do some changes and then resaved.
https://github.com/Darkere/CrashUtilities/blob/c18402c1c5f6e181d73c85b037a7b2ce8a8abae0/src/main/java/com/darkere/crashutils/WorldUtils.java#L73

During this save the curios serialization fails because the CuriosInventory does not seem to get initialized for Fakeplayers.

Any chance this can be changed? Maybe there are some changes I can do to the fakeplayer that will allow them to initialise?

commented

That's an interesting issue. Was it working in previous versions of Curios?

commented

yes. I've been using this since 1.16.
Probably due to the changes for DataAttachaments?

commented

right, so probably something that broke in 1.20.4 or 1.20.6 before I got it
do you know what needs to be changed?

commented

no. not sure why it does not get initialised. The nbt does get loaded

commented

It appears that the CuriosInventory is initialised, during EntityConstruction, at which point the fake player (and presumable also every other entity?) does not have any data to load yet.

Since the inventory is lazily updated this doesn't update after I load in the nbt and the save runs without the loaded data.