use of net.minecraft.world.storage.WorldSavedData in project ElementalSorcery by Yuzunyannn.
the class ElfPostOffice method getPostOffice.
/**
* 获取邮局对象
*/
public static ElfPostOffice getPostOffice(World world) {
MapStorage storage = world.getMapStorage();
WorldSavedData worldSave = storage.getOrLoadData(ElfPostOffice.class, "ESPostOffice");
if (worldSave == null) {
worldSave = new ElfPostOffice("ESPostOffice");
storage.setData("ESPostOffice", worldSave);
}
return (ElfPostOffice) worldSave;
}
use of net.minecraft.world.storage.WorldSavedData in project Solar by Martacus.
the class WorldData method getInternal.
private static WorldData getInternal(World world) {
if (data == null) {
WorldSavedData savedData = world.loadData(WorldData.class, DATA_TAG);
if (!(savedData instanceof WorldData)) {
System.out.println("No WorldData found, creating...");
WorldData newData = new WorldData(DATA_TAG);
world.setData(DATA_TAG, newData);
data = newData;
} else {
data = (WorldData) savedData;
System.out.println("Successfully loaded WorldData!");
}
}
return data;
}
use of net.minecraft.world.storage.WorldSavedData in project ManaCraft by Yaossg.
the class MPCache method get.
public static MPCache get(World world) {
WorldSavedData data = world.getPerWorldStorage().getOrLoadData(MPCache.class, data_id);
if (data == null) {
data = new MPCache(data_id);
world.getPerWorldStorage().setData(data_id, data);
}
return (MPCache) data;
}
use of net.minecraft.world.storage.WorldSavedData in project Random-Things by lumien231.
the class RTWorldInformation method getInstance.
public static RTWorldInformation getInstance() {
WorldServer world = FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(0);
if (world != null) {
WorldSavedData handler = world.getMapStorage().getOrLoadData(RTWorldInformation.class, ID);
if (handler == null) {
handler = new RTWorldInformation();
world.getMapStorage().setData(ID, handler);
}
return (RTWorldInformation) handler;
}
return null;
}
use of net.minecraft.world.storage.WorldSavedData in project Random-Things by lumien231.
the class SpectreHandler method getInstance.
public static SpectreHandler getInstance() {
WorldServer world = DimensionManager.getWorld(ModDimensions.SPECTRE_ID);
if (world != null) {
WorldSavedData handler = world.getPerWorldStorage().getOrLoadData(SpectreHandler.class, ID);
if (handler == null) {
handler = new SpectreHandler();
world.getPerWorldStorage().setData(ID, handler);
}
return (SpectreHandler) handler;
}
return null;
}
Aggregations