3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

Forward CraftEntity in teleport command (#7025)

Dieser Commit ist enthalten in:
Jake Potrebic 2021-12-21 16:40:24 -08:00 committet von GitHub
Ursprung 76f327471d
Commit d4c819056d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
3 geänderte Dateien mit 41 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -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

Datei anzeigen

@ -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

Datei anzeigen

@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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();