API for serializing/deserializing dimensional data
haykam821 opened this issue ยท 2 comments
The End dimension currently uses the following methods to save and load world data:
CompoundTag tag = world.getLevelProperties().getWorldData(DimensionType.THE_END); // in constructor
world.getLevelProperties().setWorldData(DimensionType.THE_END, newTag); // in 'saveWorldData' method
This used to store data for the Ender Dragon fight.
It would be more beneficial to use the toTag
/fromTag
in order to store and retrieve arbitrary data for the dimension, like other parts of Minecraft already do:
public CompoundTag toTag(CompoundTag tag) {
tag.putInt("DimensionalNumber", this.dimensionalNumber);
return tag;
}
public void fromTag(CompoundTag tag) {
this.dimensionalNumber = tag.getInt("DimensionalNumber");
}