Fabric API

Fabric API

106M Downloads

API for serializing/deserializing dimensional data

haykam821 opened this issue ยท 2 comments

commented

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");
}
commented

PersistentState should do I believe?

commented

Hmm, imo world data should be reliable enough, since it is already persistent and bound to each world, which is already bound with a dimension.