Files
MinecraftForge/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch
T

224 lines
12 KiB
Diff

--- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java
+++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java
@@ -103,7 +103,7 @@
this.field_72405_c = 8;
}
- public void func_72355_a(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_)
+ public void func_72355_a(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_, NetHandlerPlayServer nethandlerplayserver)
{
GameProfile gameprofile = p_72355_2_.func_146103_bH();
PlayerProfileCache playerprofilecache = this.field_72400_f.func_152358_ax();
@@ -112,6 +112,17 @@
playerprofilecache.func_152649_a(gameprofile);
NBTTagCompound nbttagcompound = this.func_72380_a(p_72355_2_);
p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK));
+
+ World playerWorld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK);
+ if (playerWorld == null)
+ {
+ p_72355_2_.field_71093_bK=0;
+ playerWorld=this.field_72400_f.func_71218_a(0);
+ BlockPos spawnPoint = playerWorld.field_73011_w.getRandomizedSpawnPoint();
+ p_72355_2_.func_70107_b(spawnPoint.func_177958_n(), spawnPoint.func_177956_o(), spawnPoint.func_177952_p());
+ }
+
+ p_72355_2_.func_70029_a(playerWorld);
p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p);
String s1 = "local";
@@ -125,7 +136,7 @@
WorldInfo worldinfo = worldserver.func_72912_H();
BlockPos blockpos = worldserver.func_175694_M();
this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver);
- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.field_72400_f, p_72355_1_, p_72355_2_);
+ p_72355_2_.field_71135_a = nethandlerplayserver;
nethandlerplayserver.func_147359_a(new S01PacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.func_177502_q(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo")));
nethandlerplayserver.func_147359_a(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).func_180714_a(this.func_72365_p().getServerModName())));
nethandlerplayserver.func_147359_a(new S41PacketServerDifficulty(worldinfo.func_176130_y(), worldinfo.func_176123_z()));
@@ -168,6 +179,7 @@
p_72355_2_.func_71116_b();
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(p_72355_2_);
if (nbttagcompound != null && nbttagcompound.func_150297_b("Riding", 10))
{
Entity entity = EntityList.func_75615_a(nbttagcompound.func_74775_l("Riding"), worldserver);
@@ -272,6 +284,7 @@
p_72380_1_.func_70020_e(nbttagcompound);
nbttagcompound1 = nbttagcompound;
field_148546_d.debug("loading single player");
+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_72380_1_, this.field_72412_k, p_72380_1_.func_110124_au().toString());
}
else
{
@@ -281,8 +294,23 @@
return nbttagcompound1;
}
+ public NBTTagCompound getPlayerNBT(EntityPlayerMP player)
+ {
+ // Hacky method to allow loading the NBT for a player prior to login
+ NBTTagCompound nbttagcompound = this.field_72400_f.field_71305_c[0].func_72912_H().func_76072_h();
+ if (player.func_70005_c_().equals(this.field_72400_f.func_71214_G()) && nbttagcompound != null)
+ {
+ return nbttagcompound;
+ }
+ else
+ {
+ return ((net.minecraft.world.storage.SaveHandler)this.field_72412_k).getPlayerNBT(player);
+ }
+ }
protected void func_72391_b(EntityPlayerMP p_72391_1_)
{
+ if (p_72391_1_.field_71135_a == null) return;
+
this.field_72412_k.func_75753_a(p_72391_1_);
StatisticsFile statisticsfile = (StatisticsFile)this.field_148547_k.get(p_72391_1_.func_110124_au());
@@ -298,6 +326,7 @@
this.field_177454_f.put(p_72377_1_.func_110124_au(), p_72377_1_);
this.func_148540_a(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {p_72377_1_}));
WorldServer worldserver = this.field_72400_f.func_71218_a(p_72377_1_.field_71093_bK);
+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k());
worldserver.func_72838_d(p_72377_1_);
this.func_72375_a(p_72377_1_, (WorldServer)null);
@@ -315,6 +344,7 @@
public void func_72367_e(EntityPlayerMP p_72367_1_)
{
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(p_72367_1_);
p_72367_1_.func_71029_a(StatList.field_75947_j);
this.func_72391_b(p_72367_1_);
WorldServer worldserver = p_72367_1_.func_71121_q();
@@ -330,6 +360,7 @@
this.field_72404_b.remove(p_72367_1_);
this.field_177454_f.remove(p_72367_1_.func_110124_au());
this.field_148547_k.remove(p_72367_1_.func_110124_au());
+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k());
this.func_148540_a(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {p_72367_1_}));
}
@@ -411,13 +442,23 @@
public EntityPlayerMP func_72368_a(EntityPlayerMP p_72368_1_, int p_72368_2_, boolean p_72368_3_)
{
+ World world = field_72400_f.func_71218_a(p_72368_2_);
+ if (world == null)
+ {
+ p_72368_2_ = 0;
+ }
+ else if (!world.field_73011_w.func_76567_e())
+ {
+ p_72368_2_ = world.field_73011_w.getRespawnDimension(p_72368_1_);
+ }
+
p_72368_1_.func_71121_q().func_73039_n().func_72787_a(p_72368_1_);
p_72368_1_.func_71121_q().func_73039_n().func_72790_b(p_72368_1_);
p_72368_1_.func_71121_q().func_73040_p().func_72695_c(p_72368_1_);
this.field_72404_b.remove(p_72368_1_);
this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK).func_72973_f(p_72368_1_);
- BlockPos blockpos = p_72368_1_.func_180470_cg();
- boolean flag1 = p_72368_1_.func_82245_bX();
+ BlockPos blockpos = p_72368_1_.getBedLocation(p_72368_2_);
+ boolean flag1 = p_72368_1_.isSpawnForced(p_72368_2_);
p_72368_1_.field_71093_bK = p_72368_2_;
Object object;
@@ -433,6 +474,7 @@
EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), (ItemInWorldManager)object);
entityplayermp1.field_71135_a = p_72368_1_.field_71135_a;
entityplayermp1.func_71049_a(p_72368_1_, p_72368_3_);
+ entityplayermp1.field_71093_bK = p_72368_2_;
entityplayermp1.func_145769_d(p_72368_1_.func_145782_y());
entityplayermp1.func_174817_o(p_72368_1_);
WorldServer worldserver = this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK);
@@ -473,19 +515,25 @@
this.field_177454_f.put(entityplayermp1.func_110124_au(), entityplayermp1);
entityplayermp1.func_71116_b();
entityplayermp1.func_70606_j(entityplayermp1.func_110143_aJ());
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1);
return entityplayermp1;
}
public void func_72356_a(EntityPlayerMP p_72356_1_, int p_72356_2_)
{
+ transferPlayerToDimension(p_72356_1_, p_72356_2_, field_72400_f.func_71218_a(p_72356_2_).func_85176_s());
+ }
+
+ public void transferPlayerToDimension(EntityPlayerMP p_72356_1_, int p_72356_2_, net.minecraft.world.Teleporter teleporter)
+ {
int j = p_72356_1_.field_71093_bK;
WorldServer worldserver = this.field_72400_f.func_71218_a(p_72356_1_.field_71093_bK);
p_72356_1_.field_71093_bK = p_72356_2_;
WorldServer worldserver1 = this.field_72400_f.func_71218_a(p_72356_1_.field_71093_bK);
- p_72356_1_.field_71135_a.func_147359_a(new S07PacketRespawn(p_72356_1_.field_71093_bK, p_72356_1_.field_70170_p.func_175659_aa(), p_72356_1_.field_70170_p.func_72912_H().func_76067_t(), p_72356_1_.field_71134_c.func_73081_b()));
+ p_72356_1_.field_71135_a.func_147359_a(new S07PacketRespawn(p_72356_1_.field_71093_bK, worldserver1.func_175659_aa(), worldserver1.func_72912_H().func_76067_t(), p_72356_1_.field_71134_c.func_73081_b())); // Forge: Use new dimensions information
worldserver.func_72973_f(p_72356_1_);
p_72356_1_.field_70128_L = false;
- this.func_82448_a(p_72356_1_, j, worldserver, worldserver1);
+ this.transferEntityToWorld(p_72356_1_, j, worldserver, worldserver1, teleporter);
this.func_72375_a(p_72356_1_, worldserver);
p_72356_1_.field_71135_a.func_147364_a(p_72356_1_.field_70165_t, p_72356_1_.field_70163_u, p_72356_1_.field_70161_v, p_72356_1_.field_70177_z, p_72356_1_.field_70125_A);
p_72356_1_.field_71134_c.func_73080_a(worldserver1);
@@ -498,17 +546,27 @@
PotionEffect potioneffect = (PotionEffect)iterator.next();
p_72356_1_.field_71135_a.func_147359_a(new S1DPacketEntityEffect(p_72356_1_.func_145782_y(), potioneffect));
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_72356_1_, j, p_72356_2_);
}
public void func_82448_a(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_)
{
- double d0 = p_82448_1_.field_70165_t;
- double d1 = p_82448_1_.field_70161_v;
+ transferEntityToWorld(p_82448_1_, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.func_85176_s());
+ }
+
+ @SuppressWarnings("unused")
+ public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter)
+ {
+ net.minecraft.world.WorldProvider pOld = p_82448_3_.field_73011_w;
+ net.minecraft.world.WorldProvider pNew = p_82448_4_.field_73011_w;
+ double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor();
+ double d0 = p_82448_1_.field_70165_t * moveFactor;
+ double d1 = p_82448_1_.field_70161_v * moveFactor;
double d2 = 8.0D;
float f = p_82448_1_.field_70177_z;
p_82448_3_.field_72984_F.func_76320_a("moving");
- if (p_82448_1_.field_71093_bK == -1)
+ if (false && p_82448_1_.field_71093_bK == -1) //Forge Kill it but dont comment out so we can rename it.
{
d0 = MathHelper.func_151237_a(d0 / d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D);
d1 = MathHelper.func_151237_a(d1 / d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D);
@@ -519,7 +577,7 @@
p_82448_3_.func_72866_a(p_82448_1_, false);
}
}
- else if (p_82448_1_.field_71093_bK == 0)
+ else if (false && p_82448_1_.field_71093_bK == 0) //Forge Kill it but dont comment out so we can rename it.
{
d0 = MathHelper.func_151237_a(d0 * d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D);
d1 = MathHelper.func_151237_a(d1 * d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D);
@@ -530,7 +588,8 @@
p_82448_3_.func_72866_a(p_82448_1_, false);
}
}
- else
+
+ if (p_82448_1_.field_71093_bK == 1)
{
BlockPos blockpos;
@@ -565,7 +624,7 @@
if (p_82448_1_.func_70089_S())
{
p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A);
- p_82448_4_.func_85176_s().func_180266_a(p_82448_1_, f);
+ teleporter.func_180266_a(p_82448_1_, f);
p_82448_4_.func_72838_d(p_82448_1_);
p_82448_4_.func_72866_a(p_82448_1_, false);
}