@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());
}
}
java类net.minecraft.world.storage.MapStorage的实例源码
CommonProxy.java 文件源码
项目:Firma
阅读 31
收藏 0
点赞 0
评论 0
WorldServer.java 文件源码
项目:CustomWorldGen
阅读 24
收藏 0
点赞 0
评论 0
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);
}
World.java 文件源码
项目:CustomWorldGen
阅读 26
收藏 0
点赞 0
评论 0
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);
}
SavedData.java 文件源码
项目:AChunkLoader
阅读 27
收藏 0
点赞 0
评论 0
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;
}
World.java 文件源码
项目:Cauldron
阅读 28
收藏 0
点赞 0
评论 0
@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
}
World.java 文件源码
项目:RuneCraftery
阅读 25
收藏 0
点赞 0
评论 0
@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();
}
ForgeWorld.java 文件源码
项目:BlazeLoader
阅读 27
收藏 0
点赞 0
评论 0
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();
}
RandoresWorldData.java 文件源码
项目:Randores2
阅读 22
收藏 0
点赞 0
评论 0
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;
}
WorldServerProxy.java 文件源码
项目:UniversalRemote
阅读 23
收藏 0
点赞 0
评论 0
@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();
}
}
WorldServerProxy.java 文件源码
项目:UniversalRemote
阅读 25
收藏 0
点赞 0
评论 0
@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();
}
}
WorldMonolithData.java 文件源码
项目:Solar
阅读 23
收藏 0
点赞 0
评论 0
@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;
}
WorldQuantumData.java 文件源码
项目:Solar
阅读 25
收藏 0
点赞 0
评论 0
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;
}
TileList.java 文件源码
项目:modName
阅读 26
收藏 0
点赞 0
评论 0
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;
}
WorldTurn.java 文件源码
项目:modName
阅读 25
收藏 0
点赞 0
评论 0
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;
}
EmpireList.java 文件源码
项目:modName
阅读 39
收藏 0
点赞 0
评论 0
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;
}
CraftingParadiseSaveData.java 文件源码
项目:CraftingParadiseMod
阅读 22
收藏 0
点赞 0
评论 0
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;
}
NemesisRegistryProvider.java 文件源码
项目:NemesisSystem
阅读 24
收藏 0
点赞 0
评论 0
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;
}
UWorld.java 文件源码
项目:StructPro
阅读 28
收藏 0
点赞 0
评论 0
/**
* 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;
}
UWorld.java 文件源码
项目:StructPro
阅读 25
收藏 0
点赞 0
评论 0
/**
* 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;
}
UWorld.java 文件源码
项目:StructPro
阅读 27
收藏 0
点赞 0
评论 0
/**
* 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;
}
UWorld.java 文件源码
项目:StructPro
阅读 37
收藏 0
点赞 0
评论 0
/**
* 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;
}
WirelessChestManager.java 文件源码
项目:CrystalMod
阅读 26
收藏 0
点赞 0
评论 0
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;
}
EnderBufferManager.java 文件源码
项目:CrystalMod
阅读 26
收藏 0
点赞 0
评论 0
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;
}
WorldSavedDataAok.java 文件源码
项目:Age-of-Kingdom
阅读 24
收藏 0
点赞 0
评论 0
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;
}
Savee.java 文件源码
项目:Geographicraft
阅读 23
收藏 0
点赞 0
评论 0
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();
}
}
FakeWorld.java 文件源码
项目:placementpreview
阅读 23
收藏 0
点赞 0
评论 0
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);
}
CivilizationsWorldSaveData.java 文件源码
项目:ToroQuest
阅读 30
收藏 0
点赞 0
评论 0
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;
}
MeteorWorldSaveData.java 文件源码
项目:TAIGA
阅读 26
收藏 0
点赞 0
评论 0
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;
}
DimensionEffectData.java 文件源码
项目:DynamicSurroundings
阅读 25
收藏 0
点赞 0
评论 0
@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;
}
ResearchDimensions.java 文件源码
项目:Malgra
阅读 22
收藏 0
点赞 0
评论 0
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;
}