3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-21 05:50:05 +01:00

Fix #5856 Entity origin (#5861)

Dieser Commit ist enthalten in:
djytw 2021-06-18 03:37:23 +00:00 committet von GitHub
Ursprung d76f8e018c
Commit c5070937e4
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
9 geänderte Dateien mit 30 neuen und 30 gelöschten Zeilen

Datei anzeigen

@ -5,13 +5,13 @@ Subject: [PATCH] Entity Origin API
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 5c5cfc31ced6695af7b1dd06cb867274fa38d85f..d5a12238317f1c85b9ad8cb63b936e501a4326ba 100644 index 5c5cfc31ced6695af7b1dd06cb867274fa38d85f..a127467fdd25b7513c727e1a0634f85087ec542e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1110,6 +1110,11 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -1894,6 +1894,11 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
entityplayer.connection.send(new ClientboundBlockDestructionPacket(entityId, pos, progress));
}
} }
entity.valid = true; // CraftBukkit
+ // Paper start - Set origin location when the entity is being added to the world + // Paper start - Set origin location when the entity is being added to the world
+ if (entity.getOriginVector() == null) { + if (entity.getOriginVector() == null) {
+ entity.setOrigin(entity.getBukkitEntity().getLocation()); + entity.setOrigin(entity.getBukkitEntity().getLocation());
@ -19,7 +19,7 @@ index 5c5cfc31ced6695af7b1dd06cb867274fa38d85f..d5a12238317f1c85b9ad8cb63b936e50
+ // Paper end + // Paper end
} }
} public void onTrackingEnd(Entity entity) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 018792503e5d18470ad17b9f4b4524d5dfba31e9..5d4d5628e5c0d82301f988691eac363758af6a4b 100644 index 018792503e5d18470ad17b9f4b4524d5dfba31e9..5d4d5628e5c0d82301f988691eac363758af6a4b 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java

Datei anzeigen

@ -5,17 +5,17 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index dd7ad5ec09d88722b683acd5921ad3711cececcf..f69b1edf90ee7e368927293d0b039025222d5d40 100644 index d0e92ed344cb5f7b673b4a1c777828dae1393fb8..e847abaac06d22337f2764021ab32feea4894332 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1116,6 +1116,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -1900,6 +1900,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
entity.setOrigin(entity.getBukkitEntity().getLocation()); entity.setOrigin(entity.getBukkitEntity().getLocation());
} }
// Paper end // Paper end
+ new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid + new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
} }
} public void onTrackingEnd(Entity entity) {
@@ -1964,6 +1965,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -1964,6 +1965,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
} }

Datei anzeigen

@ -10,10 +10,10 @@ Adds an option to control the force mode of the particle.
This adds a new Builder API which is much friendlier to use. This adds a new Builder API which is much friendlier to use.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 960471d86a599ca20aaede2e0ae07f7428b7ec4f..894e828280d6ccc175cffd8813602b3406c8e95a 100644 index 766edb072a38a4b5613e0f26f5070d3fcab835f4..c98c7dabc2274fe758cafb334ec4c4d3952b85e7 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1287,12 +1287,17 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -1281,12 +1281,17 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
} }
public <T extends ParticleOptions> int sendParticles(ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) { public <T extends ParticleOptions> int sendParticles(ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add hand to bucket events
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0f45f6022a4dc9638032278cce0f8d6fc431bd56..4df153a3b2cc4b6be499107a997a054abe3569d8 100644 index d1c1cf5061f9294d67086b5361166e940536a8a0..e9b1d967f5e97ec9a85465e8cfbcac98020d5ecc 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1419,15 +1419,17 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -1413,15 +1413,17 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
this.getServer().getPlayerList().broadcastAll(new ClientboundSetDefaultSpawnPositionPacket(pos, angle)); this.getServer().getPlayerList().broadcastAll(new ClientboundSetDefaultSpawnPositionPacket(pos, angle));
} }
@ -117,7 +117,7 @@ index 24272b384b96bb98a8231fe8583f404ad0c96de5..7c3e94c6bf8337ef660473d8ed451606
int i = blockposition.getX(); int i = blockposition.getX();
int j = blockposition.getY(); int j = blockposition.getY();
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index f820232e037fa05f7d666fddac6ad1b8b18b04e0..f354fe35c7fb4b869c9229b14a2cb6b00c7f0973 100644 index a74895271378571583e33c8d3992f2eb863b5a40..c9e6dd18193c7dc2ae76f688e6bbf9463a1149c7 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -291,6 +291,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -291,6 +291,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

Datei anzeigen

@ -23,7 +23,7 @@ index 13e730b18c346934c061fb570048623ad66e7344..090958a30ce20ff01ae77d4cd821a167
config.addDefault("world-settings.default." + path, def); config.addDefault("world-settings.default." + path, def);
return config.getBoolean("world-settings." + worldName + "." + path, config.getBoolean("world-settings.default." + path)); return config.getBoolean("world-settings." + worldName + "." + path, config.getBoolean("world-settings.default." + path));
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f24ce5a2543513650a3efb73e2bb5f8cd992ef88..29c1b3a43dd369419e8c93b571679a2ba024e4f6 100644 index 15928916ec8001ec57068b945300517d60dec0b0..49c87dfc50033b22f67f45ad1d67003864ce5ecb 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -775,35 +775,36 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -775,35 +775,36 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -85,7 +85,7 @@ index f24ce5a2543513650a3efb73e2bb5f8cd992ef88..29c1b3a43dd369419e8c93b571679a2b
// CraftBukkit start // CraftBukkit start
// this.updateSpawnFlags(); // this.updateSpawnFlags();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 1192033c0c2248554ba452c7f3f8f05f29d9ac3a..708bc5689e68d9e3e415e9d2dc1082cf85ee8b58 100644 index 03fde7df39384436e31bf57476feb680a0849030..54c2f27208a826b04dba5cb3dd4873987731ef54 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -61,6 +61,7 @@ import net.minecraft.network.protocol.game.ClientboundSoundEntityPacket; @@ -61,6 +61,7 @@ import net.minecraft.network.protocol.game.ClientboundSoundEntityPacket;
@ -96,7 +96,7 @@ index 1192033c0c2248554ba452c7f3f8f05f29d9ac3a..708bc5689e68d9e3e415e9d2dc1082cf
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ServerScoreboard; import net.minecraft.server.ServerScoreboard;
import net.minecraft.server.level.progress.ChunkProgressListener; import net.minecraft.server.level.progress.ChunkProgressListener;
@@ -1510,12 +1511,84 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -1504,12 +1505,84 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex::load, MapIndex::new, "idcounts")).getFreeAuxValueForMap(); return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex::load, MapIndex::new, "idcounts")).getFreeAuxValueForMap();
} }

Datei anzeigen

@ -7,7 +7,7 @@ Suspected case would be around the technique used in .stopRiding
Stack will identify any causer of this and warn instead of crashing. Stack will identify any causer of this and warn instead of crashing.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 7e62a86e4ab376c47340d96620f6b1df19fa95ca..f75a78f60565be1c8e8b0ce5f3937441f59e1f29 100644 index 1d22a2179fcd3b613bea609770b551c7702a581e..db7eb46f3b77835d1b5b67674d2e66fb99cc2fb7 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1507,6 +1507,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1507,6 +1507,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -26,10 +26,10 @@ index 7e62a86e4ab376c47340d96620f6b1df19fa95ca..f75a78f60565be1c8e8b0ce5f3937441
EntityType<?> entitytypes = entity.getType(); EntityType<?> entitytypes = entity.getType();
int i = entitytypes.clientTrackingRange() * 16; int i = entitytypes.clientTrackingRange() * 16;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index cb1efab5c5cfd47cfbdab609009cc6a5cd6f1dc4..fca0453ee83f7592e7ad7c572e238202247a93a1 100644 index cafd2299ccc0a803f6c7e131c49644b6bdf508a6..a3b7bcdda3465e4ae8a9cdb8169673f2c7dbce5d 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2106,7 +2106,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -2100,7 +2100,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
public void onTrackingStart(Entity entity) { public void onTrackingStart(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot
@ -38,11 +38,11 @@ index cb1efab5c5cfd47cfbdab609009cc6a5cd6f1dc4..fca0453ee83f7592e7ad7c572e238202
if (entity instanceof ServerPlayer) { if (entity instanceof ServerPlayer) {
ServerLevel.this.players.add((ServerPlayer) entity); ServerLevel.this.players.add((ServerPlayer) entity);
ServerLevel.this.updateSleepingPlayerList(); ServerLevel.this.updateSleepingPlayerList();
@@ -2128,6 +2128,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -2122,6 +2122,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
} }
entity.valid = true; // CraftBukkit entity.valid = true; // CraftBukkit
+ ServerLevel.this.getChunkSource().addEntity(entity); + ServerLevel.this.getChunkSource().addEntity(entity);
} // Paper start - Set origin location when the entity is being added to the world
if (entity.getOriginVector() == null) {
public void onTrackingEnd(Entity entity) { entity.setOrigin(entity.getBukkitEntity().getLocation());

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 070bc5f072163b35868ef234e5f34c3eede4c934..9790d6f7f451233e5abcaad24befb8b638ad8df3 100644 index aeaefd8c2a58344d6298e044c060689062b7233d..c72a0158b702fe0ad97bef2a0660cc7d83db11c8 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1666,6 +1666,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -1660,6 +1660,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
//ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c())); //ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c()));
this.levelData.setSpawn(pos, angle); this.levelData.setSpawn(pos, angle);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Remove stale POIs
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 8621141c4000001a6c52434dc81994251afc1a5b..e0f478f234f53d9bfb600ce69463ae6d8bfc100c 100644 index 6585bcc9dd0ae52d0e3565f546c625c1b0e100ed..550013408a212d1213d6651b71f80698d85290c6 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1748,6 +1748,11 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -1742,6 +1742,11 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
}); });
optional1.ifPresent((villageplacetype) -> { optional1.ifPresent((villageplacetype) -> {
this.getServer().execute(() -> { this.getServer().execute(() -> {

Datei anzeigen

@ -20,10 +20,10 @@ index 7fc5bf095afa6d5881285b89091d2ff48ffb69f0..0eba516110b82d917c3374a9fe5bbf33
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a678cab496bbeb757a3b60267e4cc3c0e54dfa2f..1e2139e7f82009e3f9a8b89b10a1fc031602d430 100644 index f690f20d8dc7c3957aa5287c74e5366db57a5bd4..26024b122c4a7c4339114191a544230a223fd5f7 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1345,6 +1345,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -1339,6 +1339,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
@Override @Override
public void sendBlockUpdated(BlockPos pos, BlockState oldState, BlockState newState, int flags) { public void sendBlockUpdated(BlockPos pos, BlockState oldState, BlockState newState, int flags) {
this.getChunkSource().blockChanged(pos); this.getChunkSource().blockChanged(pos);
@ -31,7 +31,7 @@ index a678cab496bbeb757a3b60267e4cc3c0e54dfa2f..1e2139e7f82009e3f9a8b89b10a1fc03
VoxelShape voxelshape = oldState.getCollisionShape(this, pos); VoxelShape voxelshape = oldState.getCollisionShape(this, pos);
VoxelShape voxelshape1 = newState.getCollisionShape(this, pos); VoxelShape voxelshape1 = newState.getCollisionShape(this, pos);
@@ -1372,6 +1373,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -1366,6 +1367,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
} }
} }