Tabnine Logo
MapStorage.setData
Code IndexAdd Tabnine to your IDE (free)

How to use
setData
method
in
net.minecraft.world.storage.MapStorage

Best Java code snippets using net.minecraft.world.storage.MapStorage.setData (Showing top 20 results out of 315)

origin: Vazkii/Botania

  public static WorldData get(World world) {
    if(world.getMapStorage() == null)
      return null;
    WorldData data = (WorldData) world.getMapStorage().getOrLoadData(WorldData.class, ID);
    if (data == null) {
      data = new WorldData(ID);
      data.markDirty();
      world.getMapStorage().setData(ID, data);
    }
    return data;
  }
}
origin: P3pp3rF1y/AncientWarfare2

private <T extends WorldSavedData> T initData(MapStorage storage, Class<T> clz) {
  String name = "AW" + clz.getSimpleName();
  T data = (T) storage.getOrLoadData(clz, name);
  if (data == null) {
    try {
      data = clz.getConstructor(String.class).newInstance(name);
      storage.setData(name, data);
    }
    catch (Exception e) {
      e.printStackTrace();
    }
  }
  return data;
}
origin: TeamLapen/Vampirism

public static @Nonnull
VampirismWorldData get(@Nonnull World world) {
  String s = fileNameForProvider(world.provider);
  VampirismWorldData data = (VampirismWorldData) world.getPerWorldStorage().getOrLoadData(VampirismWorldData.class, s);
  if (data == null) {
    data = new VampirismWorldData(world);
    world.getPerWorldStorage().setData(s, data);
  } else {
    data.world = world;
  }
  return data;
}
origin: raoulvdberge/refinedstorage

@Nonnull
@Override
public IStorageDiskManager getStorageDiskManager(World world) {
  if (world.isRemote) {
    throw new IllegalArgumentException("Attempting to access storage disk manager on the client");
  }
  MapStorage storage = world.getMapStorage();
  StorageDiskManager instance = (StorageDiskManager) storage.getOrLoadData(StorageDiskManager.class, StorageDiskManager.NAME);
  if (instance == null) {
    instance = new StorageDiskManager(StorageDiskManager.NAME);
    storage.setData(StorageDiskManager.NAME, instance);
  } else {
    instance.tryReadDisks(world);
  }
  return instance;
}
origin: vadis365/TheErebus

public static WorldDataGiantEucalyptus forWorld(World world) {
  MapStorage storage = world.getPerWorldStorage();
  WorldDataGiantEucalyptus result = (WorldDataGiantEucalyptus) storage.getOrLoadData(WorldDataGiantEucalyptus.class, KEY);
  if (result == null) {
    result = new WorldDataGiantEucalyptus(KEY);
    storage.setData(KEY, result);
  }
  return result;
}
origin: vadis365/TheErebus

public static WorldDataAntlionMaze forWorld(World world) {
  MapStorage storage = world.getPerWorldStorage();
  WorldDataAntlionMaze result = (WorldDataAntlionMaze) storage.getOrLoadData(WorldDataAntlionMaze.class, KEY);
  if (result == null) {
    result = new WorldDataAntlionMaze(KEY);
    storage.setData(KEY, result);
  }
  return result;
}
origin: Electrical-Age/ElectricalAge

public static ElnWorldStorage forWorld(World world) {
  // Retrieves the MyWorldData instance for the given world, creating it if necessary
  MapStorage storage = world.perWorldStorage;
  int dim = world.provider.dimensionId;
  ElnWorldStorage result = (ElnWorldStorage) storage.loadData(ElnWorldStorage.class, key + dim);
  if (result == null) {
    result = (ElnWorldStorage) storage.loadData(ElnWorldStorage.class, key + dim + "back");
  }
  if (result == null) {
    result = new ElnWorldStorage(key + dim);
    result.dim = dim;
    storage.setData(key + dim, result);
  }
  return result;
}
origin: raoulvdberge/refinedstorage

@Override
public INetworkNodeManager getNetworkNodeManager(World world) {
  if (world.isRemote) {
    throw new IllegalArgumentException("Attempting to access network node manager on the client");
  }
  MapStorage storage = world.getPerWorldStorage();
  NetworkNodeManager instance = (NetworkNodeManager) storage.getOrLoadData(NetworkNodeManager.class, NetworkNodeManager.NAME);
  if (instance == null) {
    instance = new NetworkNodeManager(NetworkNodeManager.NAME);
    storage.setData(NetworkNodeManager.NAME, instance);
  } else {
    instance.tryReadNodes(world);
  }
  return instance;
}
origin: Alex-the-666/Ice_and_Fire

public static MyrmexWorldData get(World world) {
  MapStorage storage =  world.getPerWorldStorage();
  MyrmexWorldData instance = (MyrmexWorldData) storage.getOrLoadData(MyrmexWorldData.class, IDENTIFIER);
  if (instance == null) {
    instance = new MyrmexWorldData(world);
    storage.setData(IDENTIFIER, instance);
  }
  instance.markDirty();
  return instance;
}
origin: ForestryMC/ForestryMC

  @Override
  public IWorldClimateHolder getWorldClimate(World world) {
    MapStorage storage = world.getPerWorldStorage();
    WorldClimateHolder holder = (WorldClimateHolder) storage.getOrLoadData(WorldClimateHolder.class, WorldClimateHolder.NAME);
    if (holder == null) {
      holder = new WorldClimateHolder(WorldClimateHolder.NAME);

      storage.setData(WorldClimateHolder.NAME, holder);
    }
    holder.setWorld(world);
    return holder;
  }
}
origin: jabelar/ExampleMod-1.12

/**
 * Gets the world saved data instance associated to a given world.
 *
 * @param world
 *            the world
 * @return the data instance
 */
public static ProtectedAreaData getDataInstance(World world)
{
  MapStorage storage = world.getMapStorage();
  ProtectedAreaData instance = (ProtectedAreaData) storage.getOrLoadData(ProtectedAreaData.class, DATA_NAME);
  if (instance == null)
  {
    instance = new ProtectedAreaData();
    storage.setData(DATA_NAME, instance);
  }
  return instance;
}
origin: RS485/LogisticsPipes

public ChannelManager(World world) {
  savedData = (SavedData) world.getMapStorage().getOrLoadData(SavedData.class, DATA_NAME);
  if(savedData == null) {
    savedData = new SavedData();
    world.getMapStorage().setData(DATA_NAME, savedData);
  }
}
origin: superckl/BiomeTweaker

public static WorldSavedDataASMTweaks get(final World world){
  WorldSavedDataASMTweaks data = (WorldSavedDataASMTweaks) world.getMapStorage().getOrLoadData(WorldSavedDataASMTweaks.class, WorldSavedDataASMTweaks.DATA_NAME);
  if(data == null){
    data = new WorldSavedDataASMTweaks(true);
    world.getMapStorage().setData(WorldSavedDataASMTweaks.DATA_NAME, data);
  }
  return data;
}
origin: PenguinSquad/Harvest-Festival

public ServerHandler(World world) {
  data = (HFSavedData) world.getPerWorldStorage().getOrLoadData(HFSavedData.class, HFSavedData.DATA_NAME);
  if (data == null) {
    data = new HFSavedData(HFSavedData.DATA_NAME);
    world.getPerWorldStorage().setData(HFSavedData.DATA_NAME, data);
  }
}
origin: WayofTime/BloodMagic

/**
 * Gets the SoulNetwork for the player.
 *
 * @param uuid - The UUID of the SoulNetwork owner - this is UUID.toString().
 * @return - The SoulNetwork for the given name.
 */
public static SoulNetwork getSoulNetwork(String uuid) {
  World world = DimensionManager.getWorld(0);
  if (world == null || world.getMapStorage() == null) //Hack-ish way to fix the lava crystal.
    return new BMWorldSavedData().getNetwork(UUID.fromString(uuid));
  BMWorldSavedData saveData = (BMWorldSavedData) world.getMapStorage().getOrLoadData(BMWorldSavedData.class, BMWorldSavedData.ID);
  if (saveData == null) {
    saveData = new BMWorldSavedData();
    world.getMapStorage().setData(BMWorldSavedData.ID, saveData);
  }
  return saveData.getNetwork(UUID.fromString(uuid));
}
origin: PenguinSquad/Harvest-Festival

private static TownTrackerServer getServerTowns(World overworld) {
  if (SERVER_TOWNS == null) {
    TownSavedData data = (TownSavedData) overworld.getPerWorldStorage().getOrLoadData(TownSavedData.class, TOWN_NAME);
    if (data == null) {
      data = new TownSavedData(TOWN_NAME);
      overworld.getPerWorldStorage().setData(TOWN_NAME, data);
    }
    SERVER_TOWNS = data.getData();
    SERVER_TOWNS.setWorld(data, overworld);
  }
  return SERVER_TOWNS;
}
origin: thraaawn/CompactMachines

@SubscribeEvent
public static void loadWorld(WorldEvent.Load event) {
  World world = event.getWorld();
  if (world.isRemote || !(world.getWorldType() instanceof SkyWorldType)) {
    return;
  }
  SkyWorldSavedData data = (SkyWorldSavedData) world.getMapStorage().getOrLoadData(SkyWorldSavedData.class, SAVED_DATA_NAME);
  if(data == null) {
    data = new SkyWorldSavedData(SAVED_DATA_NAME);
    data.markDirty();
  }
  Logz.info("Compact Skies Machine Owners: %d", data.hubMachineOwners.size());
  instance = data;
  world.getMapStorage().setData(SAVED_DATA_NAME, data);
}
origin: PenguinSquad/Harvest-Festival

private static CalendarServer getServerCalendar(World overworld) {
  if (SERVER_CALENDAR == null) {
    CalendarSavedData data = (CalendarSavedData) overworld.getPerWorldStorage().getOrLoadData(CalendarSavedData.class, CALENDAR_NAME);
    if (data == null) {
      data = new CalendarSavedData(CALENDAR_NAME);
      overworld.getPerWorldStorage().setData(CALENDAR_NAME, data);
    }
    SERVER_CALENDAR = data.getCalendar();
    SERVER_CALENDAR.setWorld(data, overworld);
    SERVER_CALENDAR.recalculate(overworld);
  }
  return SERVER_CALENDAR;
}
origin: thraaawn/CompactMachines

@SubscribeEvent
public static void loadWorld(WorldEvent.Load event) {
  if(event.getWorld().isRemote || event.getWorld().provider.getDimension() != ConfigurationHandler.Settings.dimensionId) {
    return;
  }
  Logz.info("Loading saved data for machine world");
  WorldSavedDataMachines wsd = (WorldSavedDataMachines)event.getWorld().getMapStorage().getOrLoadData(WorldSavedDataMachines.class, "WorldSavedDataMachines");
  if(wsd == null) {
    wsd = new WorldSavedDataMachines("WorldSavedDataMachines");
    wsd.markDirty();
  }
  Logz.info(" > %d spawn points", wsd.spawnPoints.size());
  Logz.info(" > Next machine id: %d", wsd.nextCoord);
  Logz.info(" > Players with beds in CM dimension: %d", wsd.bedCoords.size());
  WorldSavedDataMachines.INSTANCE = wsd;
  event.getWorld().getMapStorage().setData("WorldSavedDataMachines", wsd);
}
origin: PenguinSquad/Harvest-Festival

public static MineManager getMineManager(World world) {
  if (MINE_MANAGER == null) {
    MINE_MANAGER = (MineManager) world.getPerWorldStorage().getOrLoadData(MineManager.class, MINING_NAME);
    if (MINE_MANAGER == null) {
      MINE_MANAGER = new MineManager(MINING_NAME);
      //TODO: Remove this legacy loading in
      NBTTagCompound tag = world.getWorldInfo().getDimensionData(MINE_WORLD);
      if (tag.hasKey("MineManager") && tag.getCompoundTag("MineManager").hasKey("PortalCoordinates")) {
        MINE_MANAGER.readFromNBT(tag.getCompoundTag("MineManager"));
        MINE_MANAGER.markDirty();
      }
      world.getPerWorldStorage().setData(MINING_NAME, MINE_MANAGER);
    }
  }
  return MINE_MANAGER;
}
net.minecraft.world.storageMapStoragesetData

Popular methods of MapStorage

  • getOrLoadData
  • <init>
  • loadData

Popular in Java

  • Reading from database using SQL prepared statement
  • getContentResolver (Context)
  • getApplicationContext (Context)
  • requestLocationUpdates (LocationManager)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now