forked from PaperMC/Paper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forward CraftEntity in teleport command (PaperMC#7025)
- Loading branch information
1 parent
76f3274
commit d4c8190
Showing
3 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
patches/server/0833-Forward-CraftEntity-in-teleport-command.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |