3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00

Only double switch if the dimension is the same

Dieser Commit ist enthalten in:
Thinkofdeath 2015-03-08 10:58:10 +00:00
Ursprung d03ffbf54b
Commit ad2f806097

Datei anzeigen

@ -1,5 +1,5 @@
--- /home/matt/mc-dev-private//net/minecraft/server/PlayerList.java 2015-03-08 10:28:09.527576065 +0000
+++ src/main/java/net/minecraft/server/PlayerList.java 2015-03-08 10:28:09.531576065 +0000
--- /home/matt/mc-dev-private//net/minecraft/server/PlayerList.java 2015-03-08 10:56:47.731557415 +0000
+++ src/main/java/net/minecraft/server/PlayerList.java 2015-03-08 10:56:47.735557415 +0000
@@ -18,6 +18,26 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -367,7 +367,7 @@
entityplayer.dimension = i;
Object object;
@@ -355,80 +509,268 @@
@@ -355,80 +509,270 @@
}
EntityPlayer entityplayer1 = new EntityPlayer(this.server, this.server.getWorldServer(entityplayer.dimension), entityplayer.getProfile(), (PlayerInteractManager) object);
@ -441,7 +441,9 @@
+ // CraftBukkit start
+ byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId());
+ // Force the client to refresh their chunk cache
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn((byte) (actualDimension >= 0 ? -1 : 0), worldserver.getDifficulty(), worldserver.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode()));
+ if (fromWorld.getEnvironment() == worldserver.getWorld().getEnvironment()) {
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn((byte) (actualDimension >= 0 ? -1 : 0), worldserver.getDifficulty(), worldserver.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode()));
+ }
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(actualDimension, worldserver.getDifficulty(), worldserver.getWorldData().getType(), entityplayer1.playerInteractManager.getGameMode()));
+ entityplayer1.spawnIn(worldserver);
+ entityplayer1.dead = false;
@ -674,7 +676,7 @@
if (entity.dimension == -1) {
d0 = MathHelper.a(d0 / d2, worldserver1.getWorldBorder().b() + 16.0D, worldserver1.getWorldBorder().d() - 16.0D);
d1 = MathHelper.a(d1 / d2, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D);
@@ -447,6 +789,8 @@
@@ -447,6 +791,8 @@
BlockPosition blockposition;
if (i == 1) {
@ -683,7 +685,7 @@
blockposition = worldserver1.getSpawn();
} else {
blockposition = worldserver1.getDimensionSpawn();
@@ -460,15 +804,26 @@
@@ -460,15 +806,26 @@
worldserver.entityJoinedWorld(entity, false);
}
}
@ -712,7 +714,7 @@
worldserver1.addEntity(entity);
worldserver1.entityJoinedWorld(entity, false);
}
@@ -477,6 +832,7 @@
@@ -477,6 +834,7 @@
}
entity.spawnIn(worldserver1);
@ -720,7 +722,7 @@
}
public void tick() {
@@ -494,6 +850,15 @@
@@ -494,6 +852,15 @@
}
@ -736,7 +738,7 @@
public void a(Packet packet, int i) {
for (int j = 0; j < this.players.size(); ++j) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
@@ -589,10 +954,24 @@
@@ -589,10 +956,24 @@
public void addOp(GameProfile gameprofile) {
this.operators.add(new OpListEntry(gameprofile, this.server.p()));
@ -761,7 +763,7 @@
}
public boolean isWhitelisted(GameProfile gameprofile) {
@@ -600,7 +979,7 @@
@@ -600,7 +981,7 @@
}
public boolean isOp(GameProfile gameprofile) {
@ -770,7 +772,7 @@
}
public EntityPlayer getPlayer(String s) {
@@ -627,6 +1006,12 @@
@@ -627,6 +1008,12 @@
for (int j = 0; j < this.players.size(); ++j) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
@ -783,7 +785,7 @@
if (entityplayer != entityhuman && entityplayer.dimension == i) {
double d4 = d0 - entityplayer.locX;
double d5 = d1 - entityplayer.locY;
@@ -674,21 +1059,26 @@
@@ -674,21 +1061,26 @@
public void reloadWhitelist() {}
public void b(EntityPlayer entityplayer, WorldServer worldserver) {
@ -815,7 +817,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
}
@@ -701,7 +1091,7 @@
@@ -701,7 +1093,7 @@
}
public String[] getSeenPlayers() {
@ -824,7 +826,7 @@
}
public boolean getHasWhitelist() {
@@ -751,16 +1141,26 @@
@@ -751,16 +1143,26 @@
public void u() {
for (int i = 0; i < this.players.size(); ++i) {
@ -853,7 +855,7 @@
}
public void sendMessage(IChatBaseComponent ichatbasecomponent) {
@@ -797,8 +1197,10 @@
@@ -797,8 +1199,10 @@
WorldServer[] aworldserver = this.server.worldServer;
int j = aworldserver.length;