Java Code Examples for net.minecraft.world.storage.MapStorage#setData()

The following examples show how to use net.minecraft.world.storage.MapStorage#setData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorldMana.java    From YouTubeModdingTutorial with MIT License 5 votes vote down vote up
public static WorldMana get(World world) {
    MapStorage storage = world.getPerWorldStorage();
    WorldMana instance = (WorldMana) storage.getOrLoadData(WorldMana.class, NAME);

    if (instance == null) {
        instance = new WorldMana();
        storage.setData(NAME, instance);
    }
    return instance;
}
 
Example 2
Source File: CivilizationsWorldSaveData.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
public static CivilizationDataAccessor get(World world) {
	MapStorage storage = world.getMapStorage();
	CivilizationsWorldSaveData instance = (CivilizationsWorldSaveData) storage.getOrLoadData(CivilizationsWorldSaveData.class, DATA_NAME);
	if (instance == null) {
		instance = new CivilizationsWorldSaveData();
		storage.setData(DATA_NAME, instance);
	}
	instance.world = world;
	return instance;
}
 
Example 3
Source File: EncryptionSavedData.java    From qcraft-mod with Apache License 2.0 5 votes vote down vote up
public static EncryptionSavedData get(World world) {
    MapStorage storage = world.mapStorage;
    EncryptionSavedData instance = (EncryptionSavedData) storage.loadData(EncryptionSavedData.class, DATA_NAME);

    if (instance == null) {
        instance = new EncryptionSavedData();
        storage.setData(DATA_NAME, instance);
    }
    return instance;
}
 
Example 4
Source File: EntanglementSavedData.java    From qcraft-mod with Apache License 2.0 5 votes vote down vote up
public static EntanglementSavedData get(World world) {
    MapStorage storage = world.mapStorage;
    EntanglementSavedData instance = (EntanglementSavedData) storage.loadData(EntanglementSavedData.class, DATA_NAME);

    if (instance == null) {
        instance = new EntanglementSavedData();
        storage.setData(DATA_NAME, instance);
    }
    return instance;
}