@SubscribeEvent public void onWorldTick(TickEvent.WorldTickEvent event) { if(event.world.isRemote){ return; } // Not called on client long time = event.world.getWorldTime(); if (time > Util.ticksInDay) { MapStorage storage = event.world.getPerWorldStorage(); TimeData td = (TimeData) storage.getOrLoadData(TimeData.class, "firmatime"); if(td==null){ td = new TimeData(""); storage.setData("firmatime", td); } td.addDay(); event.world.setWorldTime(time - Util.ticksInDay); td.setDirty(true); System.out.println("Day inceremented on Server " + td.toString()); } }
public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) { super(saveHandlerIn, info, net.minecraftforge.common.DimensionManager.createProviderFor(dimensionId), profilerIn, false); this.mcServer = server; this.theEntityTracker = new EntityTracker(this); this.thePlayerManager = new PlayerChunkMap(this); // Guarantee the dimension ID was not reset by the provider int providerDim = this.provider.getDimension(); this.provider.registerWorld(this); this.provider.setDimension(providerDim); this.chunkProvider = this.createChunkProvider(); perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn)); this.worldTeleporter = new Teleporter(this); this.calculateInitialSkylight(); this.calculateInitialWeather(); this.getWorldBorder().setSize(server.getMaxWorldSize()); net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this, mcServer); }
protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) { this.eventListeners = Lists.newArrayList(new IWorldEventListener[] {this.pathListener}); this.theCalendar = Calendar.getInstance(); this.worldScoreboard = new Scoreboard(); this.spawnHostileMobs = true; this.spawnPeacefulMobs = true; this.lightUpdateBlockList = new int[32768]; this.saveHandler = saveHandlerIn; this.theProfiler = profilerIn; this.worldInfo = info; this.provider = providerIn; this.isRemote = client; this.worldBorder = providerIn.createWorldBorder(); perWorldStorage = new MapStorage((ISaveHandler)null); }
public static SavedData get(World world) { if(instance == null) { MapStorage storage = world.getMapStorage(); if(storage == null) { FMLLog.log(Level.ERROR, "Map storage is null for world"); return null; } instance = (SavedData)storage.getOrLoadData(SavedData.class, DATA_NAME); if(instance == null) { instance = new SavedData(); storage.setData(DATA_NAME, instance); instance.markDirty(); } } return instance; }
@SideOnly(Side.CLIENT) public World(ISaveHandler p_i45368_1_, String p_i45368_2_, WorldProvider p_i45368_3_, WorldSettings p_i45368_4_, Profiler p_i45368_5_) { this.ambientTickCountdown = this.rand.nextInt(12000); this.spawnHostileMobs = true; this.spawnPeacefulMobs = true; this.collidingBoundingBoxes = new ArrayList(); this.lightUpdateBlockList = new int[32768]; this.saveHandler = p_i45368_1_; this.theProfiler = p_i45368_5_; this.worldInfo = new WorldInfo(p_i45368_4_, p_i45368_2_); this.provider = p_i45368_3_; perWorldStorage = new MapStorage((ISaveHandler)null); // Cauldron start this.world = null; this.timings = null; this.spigotConfig = null; this.activeChunkSet_CB = null; this.chunkTickRadius = 0; // Cauldron end }
@SideOnly(Side.CLIENT) public World(ISaveHandler p_i1953_1_, String p_i1953_2_, WorldProvider p_i1953_3_, WorldSettings p_i1953_4_, Profiler p_i1953_5_, ILogAgent p_i1953_6_) { this.field_72990_M = this.field_73012_v.nextInt(12000); this.field_72994_J = new int['\u8000']; this.field_73019_z = p_i1953_1_; this.field_72984_F = p_i1953_5_; this.field_72986_A = new WorldInfo(p_i1953_4_, p_i1953_2_); this.field_73011_w = p_i1953_3_; this.field_72988_C = new MapStorage(p_i1953_1_); this.field_98181_L = p_i1953_6_; VillageCollection var7 = (VillageCollection)this.field_72988_C.func_75742_a(VillageCollection.class, "villages"); if(var7 == null) { this.field_72982_D = new VillageCollection(this); this.field_72988_C.func_75745_a("villages", this.field_72982_D); } else { this.field_72982_D = var7; this.field_72982_D.func_82566_a(this); } p_i1953_3_.func_76558_a(this); this.field_73020_y = this.func_72970_h(); this.func_72966_v(); this.func_72947_a(); }
protected static MapStorage getPerWorldStorage(World worldObj) { if (Versions.isForgeInstalled()) { //return worldObj.getPerWorldStorage(); if (_getPerWorldStorage == null) { _getPerWorldStorage = Reflect.lookupMethod(ForgeWorldAccess.class, World.class, MapStorage.class, "getPerWorldStorage"); } if (_getPerWorldStorage.valid()) { try { return _getPerWorldStorage.getLambda(worldObj).getPerWorldStorage(); } catch (Throwable e) { _getPerWorldStorage.invalidate(); } } } return worldObj.getMapStorage(); }
public static RandoresWorldData getSimply(World world) { MapStorage storage = world.getMapStorage(); RandoresWorldData data = (RandoresWorldData) storage.getOrLoadData(RandoresWorldData.class, NAME); if (data == null) { data = new RandoresWorldData(); data.setSeed(genSeed(world)); storage.setData(NAME, data); } return data; }
@Override public MapStorage getMapStorage() { if (m_proxyWorld != null && Util.isPrefixInCallStack(m_modPrefix)) { return m_proxyWorld.getMapStorage(); } else if (m_realWorld != null) { return m_realWorld.getMapStorage(); } else { return super.getMapStorage(); } }
@Override public MapStorage getPerWorldStorage() { if (m_proxyWorld != null && Util.isPrefixInCallStack(m_modPrefix)) { return m_proxyWorld.getPerWorldStorage(); } else if (m_realWorld != null) { return m_realWorld.getPerWorldStorage(); } else { return super.getPerWorldStorage(); } }
@SuppressWarnings("ConstantConditions") public static WorldMonolithData get(World world) { MapStorage storage = world.getMapStorage(); WorldMonolithData data = (WorldMonolithData) storage.getOrLoadData(WorldMonolithData.class, NAME); if(data == null) { data = new WorldMonolithData(NAME); storage.setData(NAME, data); } return data; }
public static WorldQuantumData get(World world) { MapStorage storage = world.getMapStorage(); //noinspection ConstantConditions WorldQuantumData data = (WorldQuantumData) storage.getOrLoadData(WorldQuantumData.class, NAME); if(data == null) { data = new WorldQuantumData(NAME); storage.setData(NAME, data); } return data; }
public static TileList get(World world) { MapStorage storage = world.getMapStorage(); TileList instance = (TileList)storage.getOrLoadData(TileList.class, DATA_NAME); TileList.world = world; if (instance == null) { System.out.println("It was null"); instance = new TileList(); storage.setData(DATA_NAME, instance); } return instance; }
public static WorldTurn get(World world) { MapStorage storage = world.getMapStorage(); System.out.println(storage); WorldTurn instance = (WorldTurn)storage.getOrLoadData(WorldTurn.class, DATA_NAME); if (instance == null) { System.out.println("It was null"); instance = new WorldTurn(); storage.setData(DATA_NAME, instance); } return instance; }
public static EmpireList get(World world) { EmpireList.world = world; MapStorage storage = world.getMapStorage(); EmpireList instance = (EmpireList)storage.getOrLoadData(EmpireList.class, DATA_NAME); if (instance == null) { System.out.println("It was null"); instance = new EmpireList(); storage.setData(DATA_NAME, instance); } return instance; }
public static CraftingParadiseSaveData get(World world) { MapStorage storage = world.getMapStorage(); CraftingParadiseSaveData instance = (CraftingParadiseSaveData) storage.getOrLoadData(CraftingParadiseSaveData.class, KEY); if(instance == null) { instance = new CraftingParadiseSaveData(); storage.setData(KEY, instance); } return instance; }
public static INemesisRegistry get(World world) { MapStorage storage = world.getPerWorldStorage(); NemesisRegistry instance = (NemesisRegistry) storage.getOrLoadData(NemesisRegistry.class, NemesisRegistry.NAME); if (instance == null) { instance = new NemesisRegistry(); storage.setData(NemesisRegistry.NAME, instance); } return instance; }
/** * Get world data * @return World saved data */ public WorldData getWorldData() { MapStorage storage = world.getPerWorldStorage(); WorldData result = (WorldData) storage.getOrLoadData(WorldData.class, WorldData.DATA_NAME); if (result == null) { result = new WorldData(WorldData.DATA_NAME); storage.setData(WorldData.DATA_NAME, result); } return result; }
/** * Get world data * @return World saved data */ public WorldData getWorldData() { MapStorage storage = world.perWorldStorage; WorldData result = (WorldData) storage.loadData(WorldData.class, WorldData.DATA_NAME); if (result == null) { result = new WorldData(WorldData.DATA_NAME); storage.setData(WorldData.DATA_NAME, result); } return result; }
public static WirelessChestManager get(World world) { MapStorage storage = world.getMapStorage(); WirelessChestManager instance = (WirelessChestManager) storage.getOrLoadData(WirelessChestManager.class, StorageKey); if (instance == null) { instance = new WirelessChestManager(); storage.setData(StorageKey, instance); } return instance; }
public static EnderBufferManager get(World world) { MapStorage storage = world.getMapStorage(); EnderBufferManager instance = (EnderBufferManager) storage.getOrLoadData(EnderBufferManager.class, StorageKey); if (instance == null) { instance = new EnderBufferManager(); storage.setData(StorageKey, instance); } return instance; }
public static WorldSavedDataAok get(World world) { MapStorage storage = world.mapStorage; WorldSavedDataAok data = (WorldSavedDataAok) storage.loadData(WorldSavedDataAok.class, AgeOfKingdom.MODID); if(data == null) { storage.setData(AgeOfKingdom.MODID, data = new WorldSavedDataAok()); data.markDirty(); } return data; }
public void loadData(String saveName, Savee<Type> worldsaveddata, World world, Maker<Type> maker){ final ISaveHandler saveHandler = saveHandlerAccess.get(world.getMapStorage()); final MapStorage mapStorage = world.getMapStorage(); if (saveHandler != null){ try { File file1 = saveHandler.getMapFileFromName(saveName); if (file1 != null && file1.exists()) { FileInputStream fileinputstream = new FileInputStream(file1); NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(fileinputstream); fileinputstream.close(); worldsaveddata.readFromNBT(nbttagcompound.getCompoundTag("data")); } } catch (Exception exception1){ exception1.printStackTrace(); } } if (worldsaveddata.data() == null) { worldsaveddata.data = maker.item(); worldsaveddata.data.informOnChange(toSelf); } if (worldsaveddata != null) { mapStorage.setData(mapName, worldsaveddata); worldsaveddata.setDirty(true); mapStorage.saveAllData(); } }
public FakeWorld(MinecraftServer server, World parent) { //super(null, parent.getWorldInfo(), new WorldProviderSurface(), null, false); //super(new FakeServer(Minecraft.getMinecraft(), "fake", "fake", new WorldSettings(parent.getWorldInfo()), null, null, null, null), // null, parent.getWorldInfo(), 1, parent.theProfiler); super(server, server.getActiveAnvilConverter().getSaveLoader("pp_fake", false), parent.getWorldInfo(), PlacementPreview.dimId, parent.profiler); this.parent = parent; this.chunk = new FakeChunk(this); this.chunkProvider = this.createChunkProvider(); this.provider.setWorld(this); this.provider.setDimension(PlacementPreview.dimId); this.mapStorage = new MapStorage(this.saveHandler); this.perWorldStorage = new MapStorage((ISaveHandler) null); }
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; }
public static MeteorWorldSaveData getForWorld(World world) { MapStorage storage = world.getPerWorldStorage(); MeteorWorldSaveData instance = (MeteorWorldSaveData) storage.getOrLoadData(MeteorWorldSaveData.class, DATA_NAME); if (instance == null) { instance = new MeteorWorldSaveData(); storage.setData(DATA_NAME, instance); } return instance; }
@Nonnull public static DimensionEffectData get(@Nonnull final World world) { final MapStorage storage = world.getPerWorldStorage(); DimensionEffectData data = (DimensionEffectData) storage.getOrLoadData(DimensionEffectData.class, DSurround.MOD_ID); if (data == null) { data = new DimensionEffectData(world.provider.getDimension()); storage.setData(DSurround.MOD_ID, data); } return data; }
public static ResearchDimensions get(World world){ MapStorage storage = world.getMapStorage(); ResearchDimensions instance = (ResearchDimensions) storage.getOrLoadData(ResearchDimensions.class, DATA_NAME); if(instance == null){ instance = new ResearchDimensions(); storage.setData(DATA_NAME, instance); } return instance; }
public static ResearchRoomManager get(World world) { MapStorage storage = world.getPerWorldStorage(); ResearchRoomManager instance = (ResearchRoomManager) storage.getOrLoadData(ResearchRoomManager.class, DATA_NAME); if (instance == null) { instance = new ResearchRoomManager(); storage.setData(DATA_NAME, instance); } return instance; }
public static InventoryManager get(World world) { MapStorage storage = world.getMapStorage(); InventoryManager instance = (InventoryManager) storage.getOrLoadData(InventoryManager.class, StorageKey); if (instance == null) { instance = new InventoryManager(); storage.setData(StorageKey, instance); } return instance; }
public static BlockSystemSavedData get(World world, boolean load) { MapStorage storage = world.getPerWorldStorage(); READING_WORLD.set(world); LOAD.set(load); BlockSystemSavedData data = (BlockSystemSavedData) storage.getOrLoadData(BlockSystemSavedData.class, KEY); if (data == null) { data = new BlockSystemSavedData(); storage.setData(KEY, data); } data.world = world; return data; }
public static BonfireWorldSavedData get(World world) { MapStorage storage = world.getMapStorage(); BonfireWorldSavedData instance = (BonfireWorldSavedData) storage.getOrLoadData(BonfireWorldSavedData.class, DATA_NAME); if (instance == null) { instance = new BonfireWorldSavedData(); storage.setData(DATA_NAME, instance); } return instance; }
/** * Gets the saved game data from the given world * @param world The world to get it from * @return The saved game data */ public static SavedGameData get(World world) { MapStorage storage = world.getMapStorage(); SavedGameData instance = (SavedGameData) storage.getOrLoadData(SavedGameData.class, DATA_NAME); // If we got a good instance... if(instance != null) return instance; // Otherwise, new it up... instance = new SavedGameData(); storage.setData(DATA_NAME, instance); return instance; }
public static WorldSavedDataPlayers get(World world){ MapStorage storage = world.getMapStorage(); WorldSavedDataPlayers instance = (WorldSavedDataPlayers) storage.getOrLoadData(WorldSavedDataPlayers.class, DATA_NAME); if(instance == null){ instance = new WorldSavedDataPlayers(); storage.setData(DATA_NAME, instance); } return instance; }
public static ScarecrowTracking get(World world) { // The IS_GLOBAL constant is there for clarity, and should be simplified into the right branch. MapStorage storage = world.getPerWorldStorage(); ScarecrowTracking instance = (ScarecrowTracking)storage.getOrLoadData(ScarecrowTracking.class, NAME); if (instance == null) { instance = new ScarecrowTracking(); storage.setData(NAME, instance); } return instance; }
public static TaskSaveHandler get(World w) { MapStorage storage = w.getMapStorage(); TaskSaveHandler instance = (TaskSaveHandler) storage.getOrLoadData(TaskSaveHandler.class, DATA_NAME); if (instance == null) { instance = new TaskSaveHandler(); storage.setData(DATA_NAME, instance); instance.init(); } return instance; }
public static SettlementWorldData forWorld(World world) { MapStorage storage = world.getPerWorldStorage(); SettlementWorldData data = (SettlementWorldData) storage.getOrLoadData(SettlementWorldData.class, KEY); if(data == null) { data = new SettlementWorldData(world); storage.setData(KEY, data); } else { data.setWorld(world); } return data; }
public static EAWorldData forWorld(WorldServer world) { MapStorage storage = world.perWorldStorage; EAWorldData returnable = (EAWorldData)storage.loadData(EAWorldData.class, "EAWorldData"); if(returnable == null) { returnable = new EAWorldData(); storage.setData("EAWorldData", returnable); } return returnable; }