From a9394b8c1a9033f9cb3d530829b95c6d2e4bc1e6 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Tue, 22 Jun 2021 11:54:49 +0100 Subject: [PATCH] Try even harder to get an origin world and avoid NPEs (Fixes #5931) --- patches/server/0025-Entity-Origin-API.patch | 19 +++++++++++++------ ...dd-configurable-portal-search-radius.patch | 4 ++-- ...oreboards-for-non-players-by-default.patch | 4 ++-- ...Entity-AddTo-RemoveFrom-World-Events.patch | 8 ++++---- ...item-frames-performance-and-bug-fixe.patch | 6 +++--- ...llow-entities-to-ride-themselves-572.patch | 4 ++-- .../server/0147-Entity-fromMobSpawner.patch | 8 ++++---- .../0220-InventoryCloseEvent-Reason-API.patch | 4 ++-- ...-more-information-to-Entity.toString.patch | 4 ++-- ...entity-dismount-during-teleportation.patch | 10 +++++----- .../0316-Entity-getEntitySpawnReason.patch | 10 +++++----- ...x-items-vanishing-through-end-portal.patch | 4 ++-- ...n-to-nerf-pigmen-from-nether-portals.patch | 6 +++--- ...pawn-point-if-spawn-in-unloaded-worl.patch | 4 ++-- ...m-duplication-issues-and-teleport-is.patch | 12 ++++++------ ...sure-Entity-AABB-s-are-never-invalid.patch | 4 ++-- ...y-Counter-to-allow-plugins-to-use-va.patch | 4 ++-- patches/server/0530-Entity-isTicking.patch | 4 ++-- ...ng-a-passenger-in-CreatureSpawnEvent.patch | 4 ++-- .../0569-MC-4-Fix-item-position-desync.patch | 4 ++-- .../0706-Fix-dangerous-end-portal-logic.patch | 4 ++-- 21 files changed, 69 insertions(+), 62 deletions(-) diff --git a/patches/server/0025-Entity-Origin-API.patch b/patches/server/0025-Entity-Origin-API.patch index c00b65131..fd1c454a5 100644 --- a/patches/server/0025-Entity-Origin-API.patch +++ b/patches/server/0025-Entity-Origin-API.patch @@ -5,10 +5,10 @@ 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 -index 5c5cfc31ced6695af7b1dd06cb867274fa38d85f..a127467fdd25b7513c727e1a0634f85087ec542e 100644 +index 5c5cfc31ced6695af7b1dd06cb867274fa38d85f..fb6e3f0c86c78024203e24d1d7ef51e0ed0283cd 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1894,6 +1894,11 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl +@@ -1894,6 +1894,15 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl } entity.valid = true; // CraftBukkit @@ -16,12 +16,16 @@ index 5c5cfc31ced6695af7b1dd06cb867274fa38d85f..a127467fdd25b7513c727e1a0634f850 + if (entity.getOriginVector() == null) { + entity.setOrigin(entity.getBukkitEntity().getLocation()); + } ++ // Default to current world if unknown, gross assumption but entities rarely change world ++ if (entity.getOriginWorld() == null) { ++ entity.setOrigin(entity.getOriginVector().toLocation(getWorld())); ++ } + // 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 -index 018792503e5d18470ad17b9f4b4524d5dfba31e9..fcf7113ce8e14ce5e8ae75d8400c6b66e752c4b4 100644 +index 018792503e5d18470ad17b9f4b4524d5dfba31e9..c8b9381c83d62c8884ec5bbe4aa7ba89d51e5e16 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -280,6 +280,27 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -52,20 +56,23 @@ index 018792503e5d18470ad17b9f4b4524d5dfba31e9..fcf7113ce8e14ce5e8ae75d8400c6b66 // Spigot start public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; -@@ -1812,6 +1833,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -1812,6 +1833,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n this.bukkitEntity.storeBukkitValues(nbt); } // CraftBukkit end + // Paper start - Save the entity's origin location + if (this.origin != null) { -+ nbt.putUUID("Paper.OriginWorld", originWorld); ++ UUID originWorld = this.originWorld != null ? this.originWorld : this.level != null ? this.level.getWorld().getUID() : null; ++ if (originWorld != null) { ++ nbt.putUUID("Paper.OriginWorld", originWorld); ++ } + nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); + } + // Paper end return nbt; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); -@@ -1938,6 +1965,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -1938,6 +1968,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } // CraftBukkit end diff --git a/patches/server/0050-Add-configurable-portal-search-radius.patch b/patches/server/0050-Add-configurable-portal-search-radius.patch index deed5a4ac..36884a0f8 100644 --- a/patches/server/0050-Add-configurable-portal-search-radius.patch +++ b/patches/server/0050-Add-configurable-portal-search-radius.patch @@ -23,10 +23,10 @@ index 416a6760883cb40367535c7c5acd779742bb8af5..670efbe53241a0ae32d618c83da601cc + } } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 0ad85e12ec6f7b98f4c00628ca9504dbbbf65c19..31974112440f571ccb4e893dacd64b1c45a9aa29 100644 +index ab291f39efb8b4b41bf5b637caeaef8f7ad677ae..b64f8a4c07a0bb57f68b6fa2c1b12b509a634ad6 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2897,7 +2897,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2900,7 +2900,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n double d4 = DimensionType.getTeleportationScale(this.level.dimensionType(), destination.dimensionType()); BlockPos blockposition = new BlockPos(Mth.clamp(this.getX() * d4, d0, d2), this.getY(), Mth.clamp(this.getZ() * d4, d1, d3)); // CraftBukkit start diff --git a/patches/server/0055-Disable-Scoreboards-for-non-players-by-default.patch b/patches/server/0055-Disable-Scoreboards-for-non-players-by-default.patch index 930e9cf67..59fc0f876 100644 --- a/patches/server/0055-Disable-Scoreboards-for-non-players-by-default.patch +++ b/patches/server/0055-Disable-Scoreboards-for-non-players-by-default.patch @@ -25,10 +25,10 @@ index abbbe1786eb68af02f9d39650aad730ac44aac8a..3ac2ac3db9b1c271b3c21930bb137166 + } } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 31974112440f571ccb4e893dacd64b1c45a9aa29..3c8832df810f585ef6ff353d5a73d86d14809a8d 100644 +index b64f8a4c07a0bb57f68b6fa2c1b12b509a634ad6..d5816bd67e468924a8f8ff8133883eef18872c4c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2546,6 +2546,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2549,6 +2549,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @Nullable public Team getTeam() { diff --git a/patches/server/0071-Entity-AddTo-RemoveFrom-World-Events.patch b/patches/server/0071-Entity-AddTo-RemoveFrom-World-Events.patch index 39ebc6b13..4d8f3b331 100644 --- a/patches/server/0071-Entity-AddTo-RemoveFrom-World-Events.patch +++ b/patches/server/0071-Entity-AddTo-RemoveFrom-World-Events.patch @@ -5,18 +5,18 @@ 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 -index d0e92ed344cb5f7b673b4a1c777828dae1393fb8..e847abaac06d22337f2764021ab32feea4894332 100644 +index 005d8d32ad3a7129688ba919e0ab6a5ee8b711c8..3129332c9e520c5f774b846e81f52103cbf97b8e 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1900,6 +1900,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - entity.setOrigin(entity.getBukkitEntity().getLocation()); +@@ -1904,6 +1904,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl + entity.setOrigin(entity.getOriginVector().toLocation(getWorld())); } // Paper end + 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 +@@ -1968,6 +1969,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl } entity.valid = false; // CraftBukkit diff --git a/patches/server/0090-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/patches/server/0090-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch index f3935be5e..5abc76baf 100644 --- a/patches/server/0090-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch +++ b/patches/server/0090-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch @@ -13,10 +13,10 @@ custom renderers are in use, defaulting to the much simpler Vanilla system. Additionally, numerous issues to player position tracking on maps has been fixed. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index b1c9a21574d6adba5d01caea0abac16a0e214a8f..8323ddb363f49d266dd95f11241a30a9a27250aa 100644 +index 3129332c9e520c5f774b846e81f52103cbf97b8e..8a43b7ebf0195198f11b26a18d6f57bf97885889 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1920,6 +1920,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl +@@ -1924,6 +1924,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl { if ( iter.next().player == entity ) { @@ -25,7 +25,7 @@ index b1c9a21574d6adba5d01caea0abac16a0e214a8f..8323ddb363f49d266dd95f11241a30a9 } } diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index a76f1cab566a3c8c8d1b0204b5c2c8492312c9f0..e8768625e55f849cd31784cb46e67293bcd93abf 100644 +index 4588d0ac68c56942af6ab59f26c68dc65996c6a1..33a61c0ab7e6ed03030bdd8d8635d989b28bd169 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -88,6 +88,7 @@ import net.minecraft.world.item.ElytraItem; diff --git a/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch b/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch index 40072bfdf..7b93e36f6 100644 --- a/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch +++ b/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't allow entities to ride themselves - #572 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 83993fd6ea3702bb30d75f40e1a66f27ab2007b9..cd307f4eb94285c2687588ae53c1ed0382238332 100644 +index 8024e7d245960b3ef6ab33a285b63e9d2ad117e2..6e9155710d51b4f7a8143f0c1d0ecf0190fc8681 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2241,6 +2241,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2244,6 +2244,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } protected boolean addPassenger(Entity entity) { // CraftBukkit diff --git a/patches/server/0147-Entity-fromMobSpawner.patch b/patches/server/0147-Entity-fromMobSpawner.patch index e94792b96..e70b82d79 100644 --- a/patches/server/0147-Entity-fromMobSpawner.patch +++ b/patches/server/0147-Entity-fromMobSpawner.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Entity#fromMobSpawner() diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 5f43d3d2742bffe743ce02da58059e3b6f17f160..855e48c9a1d9632bef831aa2fca519c782fb09c5 100644 +index 7c8df6781ffe142b6d1c4fd7b18f9a2f280194e7..2aa6c6b4a5a431b6860e91684cf20514fbb52676 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -321,6 +321,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -16,8 +16,8 @@ index 5f43d3d2742bffe743ce02da58059e3b6f17f160..855e48c9a1d9632bef831aa2fca519c7 protected int numCollisions = 0; // Paper public void inactiveTick() { } // Spigot end -@@ -1859,6 +1860,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n - nbt.putUUID("Paper.OriginWorld", originWorld); +@@ -1862,6 +1863,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n + } nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } + // Save entity's from mob spawner status @@ -27,7 +27,7 @@ index 5f43d3d2742bffe743ce02da58059e3b6f17f160..855e48c9a1d9632bef831aa2fca519c7 // Paper end return nbt; } catch (Throwable throwable) { -@@ -1998,6 +2003,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2001,6 +2006,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n this.originWorld = originWorld; origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2)); } diff --git a/patches/server/0220-InventoryCloseEvent-Reason-API.patch b/patches/server/0220-InventoryCloseEvent-Reason-API.patch index 4b9eae33a..fec00ee18 100644 --- a/patches/server/0220-InventoryCloseEvent-Reason-API.patch +++ b/patches/server/0220-InventoryCloseEvent-Reason-API.patch @@ -7,7 +7,7 @@ Allows you to determine why an inventory was closed, enabling plugin developers to "confirm" things based on if it was player triggered close or not. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index c98c7dabc2274fe758cafb334ec4c4d3952b85e7..d1c1cf5061f9294d67086b5361166e940536a8a0 100644 +index 9fb3998a9fc8ce6ffd50e800dccc331df5ab86df..4d816f0b2225677b31f39730ac13dcea28f55520 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1055,7 +1055,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -19,7 +19,7 @@ index c98c7dabc2274fe758cafb334ec4c4d3952b85e7..d1c1cf5061f9294d67086b5361166e94 } } } -@@ -1937,7 +1937,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl +@@ -1941,7 +1941,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl // Spigot Start if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder) { for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) { diff --git a/patches/server/0225-add-more-information-to-Entity.toString.patch b/patches/server/0225-add-more-information-to-Entity.toString.patch index 5314e611b..1db8a9149 100644 --- a/patches/server/0225-add-more-information-to-Entity.toString.patch +++ b/patches/server/0225-add-more-information-to-Entity.toString.patch @@ -6,10 +6,10 @@ Subject: [PATCH] add more information to Entity.toString() UUID, ticks lived, valid, dead diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 855e48c9a1d9632bef831aa2fca519c782fb09c5..9de0c954dd6cc300e8cc8792e491ec5031a8b33c 100644 +index 2aa6c6b4a5a431b6860e91684cf20514fbb52676..d32b3ae17d61753f759008316aa6818cdaa1ef83 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2806,7 +2806,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2809,7 +2809,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } public String toString() { diff --git a/patches/server/0297-force-entity-dismount-during-teleportation.patch b/patches/server/0297-force-entity-dismount-during-teleportation.patch index e21fb0420..f66409677 100644 --- a/patches/server/0297-force-entity-dismount-during-teleportation.patch +++ b/patches/server/0297-force-entity-dismount-during-teleportation.patch @@ -41,10 +41,10 @@ index 8e896afe43307a46ad8375ff8b35b107d2524502..eb70747ec90770752a45ddf28cf207e2 if (entity1 != entity && this.connection != null) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index c80781e24f56138fc68c926ea741000128e26584..d99c283aa25f2d0f4e8478b257299efd30437d09 100644 +index ca03f791a44cc3c44f42c705fb1715826eefa664..3518044845ec400ff6c2ddf7fc7dc32f1f7769b6 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2236,12 +2236,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2239,12 +2239,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } @@ -62,7 +62,7 @@ index c80781e24f56138fc68c926ea741000128e26584..d99c283aa25f2d0f4e8478b257299efd } } -@@ -2304,7 +2307,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2307,7 +2310,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n return true; // CraftBukkit } @@ -74,7 +74,7 @@ index c80781e24f56138fc68c926ea741000128e26584..d99c283aa25f2d0f4e8478b257299efd if (entity.getVehicle() == this) { throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); } else { -@@ -2314,7 +2320,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2317,7 +2323,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { VehicleExitEvent event = new VehicleExitEvent( (Vehicle) this.getBukkitEntity(), @@ -83,7 +83,7 @@ index c80781e24f56138fc68c926ea741000128e26584..d99c283aa25f2d0f4e8478b257299efd ); // Suppress during worldgen if (this.valid) { -@@ -2328,7 +2334,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2331,7 +2337,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } // CraftBukkit end // Spigot start diff --git a/patches/server/0316-Entity-getEntitySpawnReason.patch b/patches/server/0316-Entity-getEntitySpawnReason.patch index 4ae0f305c..7a9e5b17a 100644 --- a/patches/server/0316-Entity-getEntitySpawnReason.patch +++ b/patches/server/0316-Entity-getEntitySpawnReason.patch @@ -10,7 +10,7 @@ persistenting Living Entity, SPAWNER for spawners, or DEFAULT since data was not stored. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index b60f035394c9c0949e4cc68d895918510e3c67cf..03fde7df39384436e31bf57476feb680a0849030 100644 +index ab4dba5af019b60cbb82360eae7f6008aafcd38c..cdb19ab7e0d90dcd6885226aa2fd3a58ed53d29b 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1111,6 +1111,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @@ -35,7 +35,7 @@ index f1e3ea6b023119adc69eb0b414994bc7f9f3ed4a..42b7568d1c3ce145b2816202e6f5c8ca }); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index d99c283aa25f2d0f4e8478b257299efd30437d09..b11e5b8082073a28adf7a4fb80372cf2e020c7a8 100644 +index 3518044845ec400ff6c2ddf7fc7dc32f1f7769b6..16c1b0135cbd466c7e404e2f3ee638c511dc8e37 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -67,6 +67,8 @@ import net.minecraft.world.InteractionHand; @@ -55,8 +55,8 @@ index d99c283aa25f2d0f4e8478b257299efd30437d09..b11e5b8082073a28adf7a4fb80372cf2 // Paper end public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper -@@ -1862,6 +1865,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n - nbt.putUUID("Paper.OriginWorld", originWorld); +@@ -1865,6 +1868,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n + } nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } + if (spawnReason != null) { @@ -65,7 +65,7 @@ index d99c283aa25f2d0f4e8478b257299efd30437d09..b11e5b8082073a28adf7a4fb80372cf2 // Save entity's from mob spawner status if (spawnedViaMobSpawner) { nbt.putBoolean("Paper.FromMobSpawner", true); -@@ -2007,6 +2013,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2010,6 +2016,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status diff --git a/patches/server/0371-Fix-items-vanishing-through-end-portal.patch b/patches/server/0371-Fix-items-vanishing-through-end-portal.patch index e416a7f23..5a1ffb097 100644 --- a/patches/server/0371-Fix-items-vanishing-through-end-portal.patch +++ b/patches/server/0371-Fix-items-vanishing-through-end-portal.patch @@ -13,10 +13,10 @@ Quickly loading the exact world spawn chunk before searching the heightmap resolves the issue without having to load all spawn chunks. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9eaa5abc34b96e96fe14efc182fe2bca5f60e75d..a8074530b038268ac4a8f636d59485cd8cad95d1 100644 +index b108ba1c99423011f75881bf3d7440c501084c28..5d0118a753b044b1cd83298964be16a1ee87729f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3004,6 +3004,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3007,6 +3007,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n BlockPos blockposition1; if (flag1) { diff --git a/patches/server/0380-Add-option-to-nerf-pigmen-from-nether-portals.patch b/patches/server/0380-Add-option-to-nerf-pigmen-from-nether-portals.patch index 673ab33c8..6d0dce98b 100644 --- a/patches/server/0380-Add-option-to-nerf-pigmen-from-nether-portals.patch +++ b/patches/server/0380-Add-option-to-nerf-pigmen-from-nether-portals.patch @@ -21,7 +21,7 @@ index f2e4939c8144b9bc7441130302ab3e2358c42063..3d14a7dbcc6bc46141596a7e04f790bf private void lightQueueSize() { lightQueueSize = getInt("light-queue-size", lightQueueSize); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a8074530b038268ac4a8f636d59485cd8cad95d1..ae56d308a6915ab8c43e85efb64a95a94c37c31d 100644 +index 5d0118a753b044b1cd83298964be16a1ee87729f..c98938c1fa057001783b7f39e88f107b8cb700f0 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -328,6 +328,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -32,7 +32,7 @@ index a8074530b038268ac4a8f636d59485cd8cad95d1..ae56d308a6915ab8c43e85efb64a95a9 protected int numCollisions = 0; // Paper public void inactiveTick() { } // Spigot end -@@ -1881,6 +1882,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -1884,6 +1885,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n if (spawnedViaMobSpawner) { nbt.putBoolean("Paper.FromMobSpawner", true); } @@ -42,7 +42,7 @@ index a8074530b038268ac4a8f636d59485cd8cad95d1..ae56d308a6915ab8c43e85efb64a95a9 // Paper end return nbt; } catch (Throwable throwable) { -@@ -2022,6 +2026,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2025,6 +2029,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status diff --git a/patches/server/0419-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/patches/server/0419-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index 141d4d875..e4834ed85 100644 --- a/patches/server/0419-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/patches/server/0419-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch @@ -7,10 +7,10 @@ The code following this has better support for null worlds to move them back to the world spawn. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4d2209baf88a3f097e0df1645f88d4afd718c414..f08c8212f7a07fd10da127c65d4cea76921585e4 100644 +index 9783b06104f6dfe12988733f580ce5e3c5cf1e28..bd807a3d06457e619df0e77cf6114b0802b7d685 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1999,9 +1999,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2002,9 +2002,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n bworld = server.getWorld(worldName); } diff --git a/patches/server/0424-Fix-numerous-item-duplication-issues-and-teleport-is.patch b/patches/server/0424-Fix-numerous-item-duplication-issues-and-teleport-is.patch index f112f6808..417a7c2b4 100644 --- a/patches/server/0424-Fix-numerous-item-duplication-issues-and-teleport-is.patch +++ b/patches/server/0424-Fix-numerous-item-duplication-issues-and-teleport-is.patch @@ -16,10 +16,10 @@ So even if something NEW comes up, it would be impossible to drop the same item twice because the source was destroyed. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9175b9a85cb294c1b911f529d9a2432e0e508323..c677e9bcfd673dc645a0288334489dfd5dd84a1d 100644 +index bd807a3d06457e619df0e77cf6114b0802b7d685..8d0f5ca024d7b473f2d5b5e92b190df6502587b0 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2148,11 +2148,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2151,11 +2151,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } else { // CraftBukkit start - Capture drops for death event if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) { @@ -34,7 +34,7 @@ index 9175b9a85cb294c1b911f529d9a2432e0e508323..c677e9bcfd673dc645a0288334489dfd entityitem.setDefaultPickUpDelay(); // CraftBukkit start -@@ -2894,6 +2895,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2897,6 +2898,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @Nullable public Entity teleportTo(ServerLevel worldserver, BlockPos location) { // CraftBukkit end @@ -47,7 +47,7 @@ index 9175b9a85cb294c1b911f529d9a2432e0e508323..c677e9bcfd673dc645a0288334489dfd if (this.level instanceof ServerLevel && !this.isRemoved()) { this.level.getProfiler().push("changeDimension"); // CraftBukkit start -@@ -2914,6 +2921,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2917,6 +2924,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n // CraftBukkit end this.level.getProfiler().popPush("reloading"); @@ -59,7 +59,7 @@ index 9175b9a85cb294c1b911f529d9a2432e0e508323..c677e9bcfd673dc645a0288334489dfd Entity entity = this.getType().create((Level) worldserver); if (entity != null) { -@@ -2927,10 +2939,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2930,10 +2942,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n // CraftBukkit start - Forward the CraftEntity to the new entity this.getBukkitEntity().setHandle(entity); entity.bukkitEntity = this.getBukkitEntity(); @@ -70,7 +70,7 @@ index 9175b9a85cb294c1b911f529d9a2432e0e508323..c677e9bcfd673dc645a0288334489dfd // CraftBukkit end } -@@ -3055,7 +3063,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3058,7 +3066,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } public boolean canChangeDimensions() { diff --git a/patches/server/0467-Ensure-Entity-AABB-s-are-never-invalid.patch b/patches/server/0467-Ensure-Entity-AABB-s-are-never-invalid.patch index ba222b6d6..d2509166b 100644 --- a/patches/server/0467-Ensure-Entity-AABB-s-are-never-invalid.patch +++ b/patches/server/0467-Ensure-Entity-AABB-s-are-never-invalid.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ensure Entity AABB's are never invalid diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 48cd0b772ef3097418adc31f7c6747311e1dc6a2..bf561c813d62bafe96e607f7377eeff4ecb1de4d 100644 +index 912723108af2ffe660f0c2e528e4e028f7f74bcb..b208f561ab8bb0ea9ad06fb2a30becef4583c2e6 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -560,7 +560,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -17,7 +17,7 @@ index 48cd0b772ef3097418adc31f7c6747311e1dc6a2..bf561c813d62bafe96e607f7377eeff4 } protected AABB makeBoundingBox() { -@@ -3737,6 +3737,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3740,6 +3740,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } public final void setPosRaw(double x, double y, double z) { diff --git a/patches/server/0528-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/0528-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index b6a282dcd..be684ee9a 100644 --- a/patches/server/0528-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/patches/server/0528-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4ff1b026d71dbaaabc4026e8b6221a13f0c4438c..99d7be13ad0037eb2b8d7b8d1dbbc057727e3424 100644 +index 6fe23851c3ab105c8ebc4fd7ded47da205d5036c..487b22171521de0cae30e57ca7f62cf05aeb3b0c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3924,4 +3924,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3927,4 +3927,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n void accept(Entity entity, double x, double y, double z); } diff --git a/patches/server/0530-Entity-isTicking.patch b/patches/server/0530-Entity-isTicking.patch index 29f61f200..7398d8604 100644 --- a/patches/server/0530-Entity-isTicking.patch +++ b/patches/server/0530-Entity-isTicking.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Entity#isTicking diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 99d7be13ad0037eb2b8d7b8d1dbbc057727e3424..b659b497f42c01df825d27a9cf4a581edbfb36e7 100644 +index 487b22171521de0cae30e57ca7f62cf05aeb3b0c..a8d000717a52e3896c0c81e8cf754d8cfbeadf52 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -52,6 +52,7 @@ import net.minecraft.resources.ResourceKey; @@ -16,7 +16,7 @@ index 99d7be13ad0037eb2b8d7b8d1dbbc057727e3424..b659b497f42c01df825d27a9cf4a581e import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.TicketType; -@@ -3929,5 +3930,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3932,5 +3933,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n public static int nextEntityId() { return ENTITY_COUNTER.incrementAndGet(); } diff --git a/patches/server/0532-Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch b/patches/server/0532-Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch index 55e39fadd..c9b8461bc 100644 --- a/patches/server/0532-Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch +++ b/patches/server/0532-Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix CME on adding a passenger in CreatureSpawnEvent diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index b659b497f42c01df825d27a9cf4a581edbfb36e7..5ec142705d5f56f49ad58ef7933747e9b3f0b90b 100644 +index a8d000717a52e3896c0c81e8cf754d8cfbeadf52..6d49bd2693b30441d426c2a33399e0017edafe99 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3433,7 +3433,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3436,7 +3436,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } private Stream getIndirectPassengersStream() { diff --git a/patches/server/0569-MC-4-Fix-item-position-desync.patch b/patches/server/0569-MC-4-Fix-item-position-desync.patch index d5c20baf0..18f37c7c5 100644 --- a/patches/server/0569-MC-4-Fix-item-position-desync.patch +++ b/patches/server/0569-MC-4-Fix-item-position-desync.patch @@ -41,10 +41,10 @@ index b30c08bfb8c55161543a4ef09f2e462e0a1fe4ae..ec93f5300cc7d423ec0d292f0f8443f9 public Vec3 updateEntityPosition(Vec3 orig) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index cc521eb8bdf1ffb4bfd9524713a994b322bdce78..55ccceec596bf5c8f9b7108595578352c0a9af09 100644 +index 9c37264884d1353de9b1ef388773d1991f5db2b4..bf8e02e23fce3c48fc07c0bdb4ac137c8ba13e03 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3751,6 +3751,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3754,6 +3754,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } public final void setPosRaw(double x, double y, double z) { diff --git a/patches/server/0706-Fix-dangerous-end-portal-logic.patch b/patches/server/0706-Fix-dangerous-end-portal-logic.patch index 482c146e5..57d0f0ad9 100644 --- a/patches/server/0706-Fix-dangerous-end-portal-logic.patch +++ b/patches/server/0706-Fix-dangerous-end-portal-logic.patch @@ -11,7 +11,7 @@ Move the tick logic into the post tick, where portaling was designed to happen in the first place. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index e54d8b088e953ae7dd6aa050593b56b7ed80d016..7e8c3073993cd4b143049882779427d4d104c6f3 100644 +index 9bff440ed2063d9663da96fa45ec49c1d80606e2..4fd030ef9537d9b31c6167d73349f4c4a6b33a15 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -361,6 +361,37 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -52,7 +52,7 @@ index e54d8b088e953ae7dd6aa050593b56b7ed80d016..7e8c3073993cd4b143049882779427d4 public Entity(EntityType type, Level world) { this.id = Entity.ENTITY_COUNTER.incrementAndGet(); this.passengers = ImmutableList.of(); -@@ -2508,6 +2539,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -2511,6 +2542,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } this.processPortalCooldown();