1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-01-31 20:13:33 +01:00

Make sure the entity is still added to the world

This commit is contained in:
Zach Brown 2017-03-17 00:04:34 -05:00
parent 4a940edbe8
commit 0b19d62632

View file

@ -5,24 +5,59 @@ Subject: [PATCH] Fix a duplicate alive entity on second world
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0e1d9817..4cabdd7a 100644
index 0e1d9817..92ba4fcb 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
// CraftBukkit end */
// CraftBukkit start - Ensure chunks are loaded in case TravelAgent is not used which would initially cause chunks to load during find/create
// minecraftserver.getPlayerList().changeWorld(this, j, worldserver, worldserver1);
+ this.dead = true; // Paper - Mark entity as dead before we actually move it to the new world
worldserver1.getMinecraftServer().getPlayerList().repositionEntity(this, exit, portal);
// worldserver.entityJoinedWorld(this, false); // Handled in repositionEntity
// CraftBukkit end
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
// CraftBukkit end
}
- this.dead = true;
+ //this.dead = true; // Paper - Moved this up to ensure that the entity is dead when it's placed on the new world
this.world.methodProfiler.b();
worldserver.m();
worldserver1.m();
this.world.kill(this);
- this.dead = false;
+ //this.dead = false; // Paper - Mark entity as dead before we actually move it to the new world
this.world.methodProfiler.a("reposition");
/* CraftBukkit start - Handled in calculateTarget
BlockPosition blockposition;
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index a9d59bbf..a83a3054 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList {
entityplayer.playerConnection.sendPacket(new PacketPlayOutRespawn(entityplayer.dimension, entityplayer.world.getDifficulty(), entityplayer.world.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode()));
this.f(entityplayer);
worldserver.removeEntity(entityplayer);
- entityplayer.dead = false;
+ //entityplayer.dead = false; // Paper - He's dead jim - Handle players the same way we do all entities
this.changeWorld(entityplayer, j, worldserver, worldserver1);
this.a(entityplayer, worldserver);
entityplayer.playerConnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
@@ -0,0 +0,0 @@ public abstract class PlayerList {
worldserver.methodProfiler.a("moving");
entity.setPositionRotation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch());
- if (entity.isAlive()) {
+ //if (entity.isAlive()) { // Paper - The entity will be dead, that's okay
worldserver.entityJoinedWorld(entity, false);
- }
+ //} // Paper
/*
if (entity.dimension == -1) {
d0 = MathHelper.a(d0 / 8.0D, worldserver1.getWorldBorder().b() + 16.0D, worldserver1.getWorldBorder().d() - 16.0D);
@@ -0,0 +0,0 @@ public abstract class PlayerList {
d0 = (double) MathHelper.clamp((int) d0, -29999872, 29999872);
d1 = (double) MathHelper.clamp((int) d1, -29999872, 29999872);
*/
- if (entity.isAlive()) {
+ //if (entity.isAlive()) { // Paper - The entity will be dead, that's okay
// entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
// worldserver1.getTravelAgent().a(entity, f);
if (portal) {
@@ -0,0 +0,0 @@ public abstract class PlayerList {
}
// worldserver1.addEntity(entity);
worldserver1.entityJoinedWorld(entity, false);
- }
+ //} // Paper
worldserver.methodProfiler.b();
}
--