@SubscribeEvent public static void onWorldLoad(WorldEvent.Load event) { if (event.getWorld().provider.getDimension() == DIM && !event.getWorld().isRemote) { WorldServer world = (WorldServer)event.getWorld(); ReflectionHelper.setPrivateValue(World.class, world, new DerivedWorldInfo(world.getWorldInfo()) { public WorldType getTerrainType() { return WorldType.DEFAULT; } }, "field_72986_" + "A", "worldInfo", "field_72986_A"); world.provider.registerWorld(world); world.getChunkProvider().chunkGenerator = world.provider.createChunkGenerator(); } }
public static GameRules getGameRuleInstance(DerivedWorldInfo worldInfo) { World worldObj = null; for (World world : DimensionManager.getWorlds()) { if (world.getWorldInfo() == worldInfo) { worldObj = world; break; } } if (worldObj != null) { return getGameRuleInstance(worldObj); } return null; }
/** * Overrides the current WorldInfo with WorldInfoJED. * @param world * @param dimension */ public static void loadAndSetCustomWorldInfo(World world) { if ((world.provider instanceof IWorldProviderJED) && ((IWorldProviderJED) world.provider).getWorldInfoHasBeenSet()) { return; } final int dimension = world.provider.getDimension(); if (DimensionConfig.instance().useCustomWorldInfoFor(dimension)) { // The DerivedWorldInfo check is necessary for the case where WorldEvent.CreateSpawnPosition // has ran before WorldEvent.Load and already set it, OR when using one of the JED WorldProviders, // in which case the WorldInfo override first happens from WorldProvider#setDimension() and // then would happen again from WorldEvent.Load. // It's also necessary with Sponge, which uses their own WorldProperties stuff in place of the vanilla WorldInfo. if (world.getWorldInfo().getClass() == DerivedWorldInfo.class) { JustEnoughDimensions.logInfo("WorldInfoUtils.loadAndSetCustomWorldInfo(): Overriding the existing " + "DerivedWorldInfo with WorldInfoJED in dimension {}", dimension); WorldInfoJED info = createCustomWorldInfoFor(world, dimension); setWorldInfo(world, info); } // We might be running under Sponge here, so instead of overriding the WorldInfo instance, try to apply // the configured properties to the existing one... else if ((world.getWorldInfo() instanceof WorldInfoJED) == false) { JustEnoughDimensions.logInfo("WorldInfoUtils.loadAndSetCustomWorldInfo(): Applying WorldInfo properties " + "to an existing WorldInfo instance of type '{}' in dimension {}", world.getWorldInfo().getClass().getName(), dimension); applyValuesToExistingWorldInfo(world, dimension); applyChangesFromNewWorldInfo(world); } } }
public WorldServerMulti(MinecraftServer p_i45283_1_, ISaveHandler p_i45283_2_, String p_i45283_3_, int p_i45283_4_, WorldSettings p_i45283_5_, WorldServer p_i45283_6_, Profiler p_i45283_7_) { super(p_i45283_1_, p_i45283_2_, p_i45283_3_, p_i45283_4_, p_i45283_5_, p_i45283_7_); this.mapStorage = p_i45283_6_.mapStorage; this.worldScoreboard = p_i45283_6_.getScoreboard(); this.worldInfo = new DerivedWorldInfo(p_i45283_6_.getWorldInfo()); }
public WorldServerMultiOF(MinecraftServer p_i45283_1_, ISaveHandler p_i45283_2_, String p_i45283_3_, int p_i45283_4_, WorldSettings p_i45283_5_, WorldServer p_i45283_6_, Profiler p_i45283_7_) { super(p_i45283_1_, p_i45283_2_, p_i45283_3_, p_i45283_4_, p_i45283_5_, p_i45283_7_); this.mapStorage = p_i45283_6_.mapStorage; this.worldScoreboard = p_i45283_6_.getScoreboard(); this.worldInfo = new DerivedWorldInfo(p_i45283_6_.getWorldInfo()); }
public WorldServerMulti(MinecraftServer par1MinecraftServer, ISaveHandler par2ISaveHandler, String par3Str, int par4, WorldSettings par5WorldSettings, WorldServer par6WorldServer, Profiler par7Profiler, ILogAgent par8ILogAgent) { super(par1MinecraftServer, par2ISaveHandler, par3Str, par4, par5WorldSettings, par7Profiler, par8ILogAgent); this.mapStorage = par6WorldServer.mapStorage; this.worldScoreboard = par6WorldServer.getScoreboard(); this.worldInfo = new DerivedWorldInfo(par6WorldServer.getWorldInfo()); }
public WorldServerMulti(MinecraftServer p_i1514_1_, ISaveHandler p_i1514_2_, String p_i1514_3_, int p_i1514_4_, WorldSettings p_i1514_5_, WorldServer p_i1514_6_, Profiler p_i1514_7_, ILogAgent p_i1514_8_) { super(p_i1514_1_, p_i1514_2_, p_i1514_3_, p_i1514_4_, p_i1514_5_, p_i1514_7_, p_i1514_8_); this.field_72988_C = p_i1514_6_.field_72988_C; this.field_96442_D = p_i1514_6_.func_96441_U(); this.field_72986_A = new DerivedWorldInfo(p_i1514_6_.func_72912_H()); }