ForgePatch/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch

98 lines
4.5 KiB
Diff

--- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java
+++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java
@@ -74,8 +74,6 @@
protected void func_71247_a(String p_71247_1_, String p_71247_2_, long p_71247_3_, WorldType p_71247_5_, String p_71247_6_)
{
this.func_71237_c(p_71247_1_);
- this.field_71305_c = new WorldServer[3];
- this.field_71312_k = new long[this.field_71305_c.length][100];
ISaveHandler isavehandler = this.func_71254_M().func_75804_a(p_71247_1_, true);
this.func_175584_a(this.func_71270_I(), isavehandler);
WorldInfo worldinfo = isavehandler.func_75757_d();
@@ -88,45 +86,25 @@
{
worldinfo.func_76062_a(p_71247_2_);
}
+ WorldServer overWorld = (func_71242_L() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.field_71304_b)).func_175643_b() :
+ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.field_71304_b)).func_175643_b());
+ overWorld.func_72963_a(this.field_71350_m);
- for (int j = 0; j < this.field_71305_c.length; ++j)
+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs())
{
- byte b0 = 0;
- if (j == 1)
+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.field_71304_b)).func_175643_b());
+ world.func_72954_a(new WorldManager(this, world));
+ if (!this.func_71264_H())
{
- b0 = -1;
+ world.func_72912_H().func_76060_a(func_71265_f());
}
-
- if (j == 2)
- {
- b0 = 1;
- }
-
- if (j == 0)
- {
- if (this.func_71242_L())
- {
- this.field_71305_c[j] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.field_71304_b)).func_175643_b();
- }
- else
- {
- this.field_71305_c[j] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, b0, this.field_71304_b)).func_175643_b();
- }
-
- this.field_71305_c[j].func_72963_a(this.field_71350_m);
- }
- else
- {
- this.field_71305_c[j] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.field_71305_c[0], this.field_71304_b)).func_175643_b();
- }
-
- this.field_71305_c[j].func_72954_a(new WorldManager(this, this.field_71305_c[j]));
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world));
}
- this.func_71203_ab().func_72364_a(this.field_71305_c);
+ this.func_71203_ab().func_72364_a(new WorldServer[]{ overWorld });
- if (this.field_71305_c[0].func_72912_H().func_176130_y() == null)
+ if (overWorld.func_72912_H().func_176130_y() == null)
{
this.func_147139_a(this.field_71349_l.field_71474_y.field_74318_M);
}
@@ -144,9 +122,10 @@
this.func_71245_h(true);
field_147148_h.info("Generating keypair");
this.func_71253_a(CryptManager.func_75891_b());
+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false;
this.func_71247_a(this.func_71270_I(), this.func_71221_J(), this.field_71350_m.func_77160_d(), this.field_71350_m.func_77165_h(), this.field_71350_m.func_82749_j());
this.func_71205_p(this.func_71214_G() + " - " + this.field_71305_c[0].func_72912_H().func_76065_j());
- return true;
+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this);
}
public void func_71217_p()
@@ -171,7 +150,7 @@
{
try
{
- ((FutureTask)this.field_175589_i.poll()).run();
+ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.field_175589_i.poll()));
}
catch (Throwable throwable)
{
@@ -232,6 +211,7 @@
public EnumDifficulty func_147135_j()
{
+ if (this.field_71349_l.field_71441_e == null) return this.field_71349_l.field_71474_y.field_74318_M; // Fix NPE just in case.
return this.field_71349_l.field_71441_e.func_72912_H().func_176130_y();
}