mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 19:39:22 +00:00
186 lines
8.9 KiB
Diff
186 lines
8.9 KiB
Diff
--- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java
|
|
+++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java
|
|
@@ -55,11 +55,15 @@
|
|
import net.minecraft.util.EnumChatFormatting;
|
|
import net.minecraft.util.IChatComponent;
|
|
import net.minecraft.util.MathHelper;
|
|
+import net.minecraft.world.Teleporter;
|
|
import net.minecraft.world.World;
|
|
+import net.minecraft.world.WorldProvider;
|
|
import net.minecraft.world.WorldServer;
|
|
import net.minecraft.world.WorldSettings;
|
|
import net.minecraft.world.demo.DemoWorldManager;
|
|
import net.minecraft.world.storage.IPlayerFileData;
|
|
+import net.minecraftforge.common.chunkio.ChunkIOExecutor;
|
|
+
|
|
import org.apache.logging.log4j.LogManager;
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
@@ -108,7 +112,17 @@
|
|
String s = gameprofile1 == null ? gameprofile.getName() : gameprofile1.getName();
|
|
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);
|
|
+ ChunkCoordinates spawnPoint = playerWorld.field_73011_w.getRandomizedSpawnPoint();
|
|
+ p_72355_2_.func_70107_b(spawnPoint.field_71574_a, spawnPoint.field_71572_b, spawnPoint.field_71573_c);
|
|
+ }
|
|
+
|
|
+ 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";
|
|
|
|
@@ -242,6 +256,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
|
|
{
|
|
@@ -269,6 +284,7 @@
|
|
this.func_148540_a(new S38PacketPlayerListItem(p_72377_1_.func_70005_c_(), true, 1000));
|
|
this.field_72404_b.add(p_72377_1_);
|
|
WorldServer worldserver = this.field_72400_f.func_71218_a(p_72377_1_.field_71093_bK);
|
|
+ ChunkIOExecutor.adjustPoolSize(this.func_72394_k());
|
|
worldserver.func_72838_d(p_72377_1_);
|
|
this.func_72375_a(p_72377_1_, (WorldServer)null);
|
|
|
|
@@ -301,6 +317,7 @@
|
|
worldserver.func_73040_p().func_72695_c(p_72367_1_);
|
|
this.field_72404_b.remove(p_72367_1_);
|
|
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(p_72367_1_.func_70005_c_(), false, 9999));
|
|
}
|
|
|
|
@@ -382,13 +399,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_);
|
|
- ChunkCoordinates chunkcoordinates = p_72368_1_.func_70997_bJ();
|
|
- boolean flag1 = p_72368_1_.func_82245_bX();
|
|
+ ChunkCoordinates chunkcoordinates = 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;
|
|
|
|
@@ -404,6 +431,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());
|
|
WorldServer worldserver = this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK);
|
|
this.func_72381_a(entityplayermp1, p_72368_1_, worldserver);
|
|
@@ -448,6 +476,11 @@
|
|
|
|
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_, 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_;
|
|
@@ -455,7 +488,7 @@
|
|
p_72356_1_.field_71135_a.func_147359_a(new S07PacketRespawn(p_72356_1_.field_71093_bK, p_72356_1_.field_70170_p.field_73013_u, p_72356_1_.field_70170_p.func_72912_H().func_76067_t(), p_72356_1_.field_71134_c.func_73081_b()));
|
|
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);
|
|
@@ -473,38 +506,47 @@
|
|
|
|
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;
|
|
- double d2 = 8.0D;
|
|
+ transferEntityToWorld(p_82448_1_, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.func_85176_s());
|
|
+ }
|
|
+
|
|
+ public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, Teleporter teleporter)
|
|
+ {
|
|
+ WorldProvider pOld = p_82448_3_.field_73011_w;
|
|
+ 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 d3 = p_82448_1_.field_70165_t;
|
|
double d4 = p_82448_1_.field_70163_u;
|
|
double d5 = p_82448_1_.field_70161_v;
|
|
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 (par1Entity.dimension == -1)
|
|
{
|
|
d0 /= d2;
|
|
d1 /= d2;
|
|
- 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);
|
|
+ par1Entity.setLocationAndAngles(d0, par1Entity.posY, d1, par1Entity.rotationYaw, par1Entity.rotationPitch);
|
|
|
|
- if (p_82448_1_.func_70089_S())
|
|
+ if (par1Entity.isEntityAlive())
|
|
{
|
|
- p_82448_3_.func_72866_a(p_82448_1_, false);
|
|
+ par3WorldServer.updateEntityWithOptionalForce(par1Entity, false);
|
|
}
|
|
}
|
|
- else if (p_82448_1_.field_71093_bK == 0)
|
|
+ else if (par1Entity.dimension == 0)
|
|
{
|
|
d0 *= d2;
|
|
d1 *= d2;
|
|
- 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);
|
|
+ par1Entity.setLocationAndAngles(d0, par1Entity.posY, d1, par1Entity.rotationYaw, par1Entity.rotationPitch);
|
|
|
|
- if (p_82448_1_.func_70089_S())
|
|
+ if (par1Entity.isEntityAlive())
|
|
{
|
|
- p_82448_3_.func_72866_a(p_82448_1_, false);
|
|
+ par3WorldServer.updateEntityWithOptionalForce(par1Entity, false);
|
|
}
|
|
}
|
|
- else
|
|
+ */
|
|
+ if (p_82448_1_.field_71093_bK == 1)
|
|
{
|
|
ChunkCoordinates chunkcoordinates;
|
|
|
|
@@ -539,7 +581,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_77185_a(p_82448_1_, d3, d4, d5, f);
|
|
+ teleporter.func_77185_a(p_82448_1_, d3, d4, d5, f);
|
|
p_82448_4_.func_72838_d(p_82448_1_);
|
|
p_82448_4_.func_72866_a(p_82448_1_, false);
|
|
}
|