mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-15 07:01:36 +08:00
58 lines
2.7 KiB
Diff
58 lines
2.7 KiB
Diff
From 9b910d46c99320223dfa35efe4f3453bfa008313 Mon Sep 17 00:00:00 2001
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
Date: Fri, 17 Mar 2017 01:45:15 +0000
|
|
Subject: [PATCH] Do not allow portals to move dead entities across worlds
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index 0e1d9817..38532977 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -2325,7 +2325,7 @@ public abstract class Entity implements ICommandListener {
|
|
// CraftBukkit end */
|
|
|
|
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;
|
|
@@ -2376,7 +2376,20 @@ public abstract class Entity implements ICommandListener {
|
|
entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
|
|
}
|
|
// CraftBukkit end */
|
|
-
|
|
+ // Paper Start - relocate code to modify the entities exit in a portal
|
|
+ if (portal) {
|
|
+ org.bukkit.util.Vector velocity = entity.getBukkitEntity().getVelocity();
|
|
+ worldserver1.getTravelAgent().adjustExit(entity, exit, velocity);
|
|
+ entity.setPositionRotation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch());
|
|
+ if (entity.motX != velocity.getX() || entity.motY != velocity.getY() || entity.motZ != velocity.getZ()) {
|
|
+ //entity.getBukkitEntity().setVelocity(velocity); // We don't have a CraftEntity yet, set these manually...
|
|
+ entity.motX = velocity.getX();
|
|
+ entity.motY = velocity.getY();
|
|
+ entity.motZ = velocity.getZ();
|
|
+ entity.velocityChanged = true;
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
boolean flag = entity.attachedToPlayer;
|
|
|
|
entity.attachedToPlayer = true;
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
|
index a9d59bbf..2d8717f4 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
|
@@ -987,7 +987,7 @@ public abstract class PlayerList {
|
|
worldserver.methodProfiler.b();
|
|
}
|
|
|
|
- entity.spawnIn(worldserver1);
|
|
+ if (!entity.dead) entity.spawnIn(worldserver1); // Paper - Do not move dead entities
|
|
// CraftBukkit end
|
|
}
|
|
|
|
--
|
|
2.12.0
|
|
|