aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2021-12-21 16:40:24 -0800
committerGitHub <[email protected]>2021-12-21 16:40:24 -0800
commitd4c819056dfe7bde94ac89b8ca71547d7f7c7922 (patch)
treeb34b8bd30f183431e18cf74d31d811748180989d
parent76f327471de778aa6ebb3a8e52f1c92b6a07564f (diff)
downloadPaper-d4c819056dfe7bde94ac89b8ca71547d7f7c7922.tar.gz
Paper-d4c819056dfe7bde94ac89b8ca71547d7f7c7922.zip
Forward CraftEntity in teleport command (#7025)
-rw-r--r--patches/server/0070-Use-a-Shared-Random-for-Entities.patch2
-rw-r--r--patches/server/0092-LootTable-API-Replenishable-Lootables-Feature.patch2
-rw-r--r--patches/server/0833-Forward-CraftEntity-in-teleport-command.patch39
3 files changed, 41 insertions, 2 deletions
diff --git a/patches/server/0070-Use-a-Shared-Random-for-Entities.patch b/patches/server/0070-Use-a-Shared-Random-for-Entities.patch
index 618da6448d..60afe5e84c 100644
--- a/patches/server/0070-Use-a-Shared-Random-for-Entities.patch
+++ b/patches/server/0070-Use-a-Shared-Random-for-Entities.patch
@@ -6,7 +6,7 @@ Subject: [PATCH] Use a Shared Random for Entities
Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
-index ddbbef22813831267c407d9864ce8decb5706df5..664d7199e21f0c617ba41bc7596ead99a0325792 100644
+index fd43c6053b14f60d77e902326df8957d272b944c..6ed53d50f395dc2a629d7393b01074d14f0a60d4 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -152,6 +152,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
diff --git a/patches/server/0092-LootTable-API-Replenishable-Lootables-Feature.patch b/patches/server/0092-LootTable-API-Replenishable-Lootables-Feature.patch
index 7b4afb04c8..456a8ccfeb 100644
--- a/patches/server/0092-LootTable-API-Replenishable-Lootables-Feature.patch
+++ b/patches/server/0092-LootTable-API-Replenishable-Lootables-Feature.patch
@@ -515,7 +515,7 @@ index 0000000000000000000000000000000000000000..3377b86c337d0234bbb9b0349e4034a7
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
-index 664d7199e21f0c617ba41bc7596ead99a0325792..1dba6be93f1078b71712d0b5a24224bdcaeb61a0 100644
+index 6ed53d50f395dc2a629d7393b01074d14f0a60d4..493ddc76367226fa6344a1ee333378410e42b165 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -167,6 +167,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
diff --git a/patches/server/0833-Forward-CraftEntity-in-teleport-command.patch b/patches/server/0833-Forward-CraftEntity-in-teleport-command.patch
new file mode 100644
index 0000000000..e8e89b6b09
--- /dev/null
+++ b/patches/server/0833-Forward-CraftEntity-in-teleport-command.patch
@@ -0,0 +1,39 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jake Potrebic <[email protected]>
+Date: Sat, 4 Dec 2021 17:04:47 -0800
+Subject: [PATCH] Forward CraftEntity in teleport command
+
+
+diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
+index 9bb44918af119d9afae4a0a050c6a5381f028364..8ea81f6ac7503c68f0aea34802843bc545f46db0 100644
+--- a/src/main/java/net/minecraft/world/entity/Entity.java
++++ b/src/main/java/net/minecraft/world/entity/Entity.java
+@@ -3154,6 +3154,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
+ }
+
+ public void restoreFrom(Entity original) {
++ // Paper start
++ CraftEntity bukkitEntity = original.bukkitEntity;
++ if (bukkitEntity != null) {
++ bukkitEntity.setHandle(this);
++ this.bukkitEntity = bukkitEntity;
++ }
++ // Paper end
+ CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag());
+
+ nbttagcompound.remove("Dimension");
+@@ -3231,10 +3238,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
+ if (worldserver.getTypeKey() == LevelStem.END) { // CraftBukkit
+ ServerLevel.makeObsidianPlatform(worldserver, this); // CraftBukkit
+ }
+- // CraftBukkit start - Forward the CraftEntity to the new entity
+- this.getBukkitEntity().setHandle(entity);
+- entity.bukkitEntity = this.getBukkitEntity();
+- // CraftBukkit end
++ // // CraftBukkit start - Forward the CraftEntity to the new entity // Paper - moved to Entity#restoreFrom
++ // this.getBukkitEntity().setHandle(entity);
++ // entity.bukkitEntity = this.getBukkitEntity();
++ // // CraftBukkit end
+ }
+
+ this.removeAfterChangingDimensions();