From 32f222857a4e2bbe9fe058c7d199907b98a0917f Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Mon, 9 May 2022 11:03:07 +0200 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 312281ea PR-742: Make World implement Keyed CraftBukkit Changes: 2ac7fa7a SPIGOT-7014: getLootTable API should not persistently update loot table 7fdd7941 PR-1046: Make World implement Keyed 7bc728a6 PR-1045: Revert changes to persistence required checks Spigot Changes: b6d12d17 Rebuild patches --- ... => Add-methods-to-get-world-by-key.patch} | 31 +----------------- patches/api/Adventure.patch | 4 +-- ...rovide-E-TE-Chunk-count-stat-methods.patch | 2 +- ...-despawn-distances-for-living-entiti.patch | 4 +-- ... => Add-methods-to-get-world-by-key.patch} | 18 +---------- ...-axolotls-from-buckets-as-persistent.patch | 32 ------------------- ...awns-should-honor-nametags-and-leash.patch | 4 +-- work/Bukkit | 2 +- work/CraftBukkit | 2 +- work/Spigot | 2 +- 10 files changed, 12 insertions(+), 89 deletions(-) rename patches/api/{Implement-Keyed-on-World.patch => Add-methods-to-get-world-by-key.patch} (79%) rename patches/server/{Implement-Keyed-on-World.patch => Add-methods-to-get-world-by-key.patch} (68%) delete mode 100644 patches/server/Mark-fish-and-axolotls-from-buckets-as-persistent.patch diff --git a/patches/api/Implement-Keyed-on-World.patch b/patches/api/Add-methods-to-get-world-by-key.patch similarity index 79% rename from patches/api/Implement-Keyed-on-World.patch rename to patches/api/Add-methods-to-get-world-by-key.patch index e0a850be7..369e91ed1 100644 --- a/patches/api/Implement-Keyed-on-World.patch +++ b/patches/api/Add-methods-to-get-world-by-key.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Wed, 6 Jan 2021 00:34:10 -0800 -Subject: [PATCH] Implement Keyed on World +Subject: [PATCH] Add methods to get world by key diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java @@ -49,35 +49,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** * Create a new virtual {@link WorldBorder}. *

-diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents a world, which may contain entities, chunks and blocks - */ --public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, PersistentDataHolder, net.kyori.adventure.audience.ForwardingAudience { // Paper -+public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, PersistentDataHolder, net.kyori.adventure.audience.ForwardingAudience, Keyed { // Paper - - // Paper start - /** -@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - - @NotNull - java.util.concurrent.CompletableFuture getChunkAtAsync(int x, int z, boolean gen, boolean urgent); -+ -+ /** -+ * Get the world's key -+ * -+ * @return the world's key -+ */ -+ @NotNull -+ @Override -+ NamespacedKey getKey(); - // Paper end - - /** diff --git a/src/main/java/org/bukkit/WorldCreator.java b/src/main/java/org/bukkit/WorldCreator.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/WorldCreator.java diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index 2915685d4..ab621a131 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -1138,8 +1138,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** * Represents a world, which may contain entities, chunks and blocks */ --public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, PersistentDataHolder { -+public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, PersistentDataHolder, net.kyori.adventure.audience.ForwardingAudience { // Paper +-public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, PersistentDataHolder, Keyed { ++public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, PersistentDataHolder, Keyed, net.kyori.adventure.audience.ForwardingAudience { // Paper /** * Gets the {@link Block} at the given coordinates diff --git a/patches/api/Provide-E-TE-Chunk-count-stat-methods.patch b/patches/api/Provide-E-TE-Chunk-count-stat-methods.patch index f76242a59..080044557 100644 --- a/patches/api/Provide-E-TE-Chunk-count-stat-methods.patch +++ b/patches/api/Provide-E-TE-Chunk-count-stat-methods.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/World.java @@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; */ - public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, PersistentDataHolder, net.kyori.adventure.audience.ForwardingAudience { // Paper + public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, PersistentDataHolder, Keyed, net.kyori.adventure.audience.ForwardingAudience { // Paper + // Paper start + /** diff --git a/patches/server/Add-configurable-despawn-distances-for-living-entiti.patch b/patches/server/Add-configurable-despawn-distances-for-living-entiti.patch index 635d65c55..dfdecd922 100644 --- a/patches/server/Add-configurable-despawn-distances-for-living-entiti.patch +++ b/patches/server/Add-configurable-despawn-distances-for-living-entiti.patch @@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int i = this.level.paperConfig.hardDespawnDistances.getInt(this.getType().getCategory()); // Paper - custom despawn distances int j = i * i; - if (d0 > (double) j) { // CraftBukkit - remove isTypeNotPersistent() check + if (d0 > (double) j && this.removeWhenFarAway(d0)) { this.discard(); } @@ -84,4 +84,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int k = this.level.paperConfig.softDespawnDistances.getInt(this.getType().getCategory()); // Paper - custom despawn distances int l = k * k; - if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l) { // CraftBukkit - remove isTypeNotPersistent() check + if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) { diff --git a/patches/server/Implement-Keyed-on-World.patch b/patches/server/Add-methods-to-get-world-by-key.patch similarity index 68% rename from patches/server/Implement-Keyed-on-World.patch rename to patches/server/Add-methods-to-get-world-by-key.patch index ef96a9738..96c59fbc2 100644 --- a/patches/server/Implement-Keyed-on-World.patch +++ b/patches/server/Add-methods-to-get-world-by-key.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Wed, 6 Jan 2021 00:34:04 -0800 -Subject: [PATCH] Implement Keyed on World +Subject: [PATCH] Add methods to get world by key diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -33,19 +33,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void addWorld(World world) { // Check if a World already exists with the UID. if (this.getWorld(world.getUID()) != null) { -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { - return java.util.concurrent.CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk()); - }, net.minecraft.server.MinecraftServer.getServer()); - } -+ -+ @Override -+ public org.bukkit.NamespacedKey getKey() { -+ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(world.dimension().location()); -+ } - // Paper end - - @Override diff --git a/patches/server/Mark-fish-and-axolotls-from-buckets-as-persistent.patch b/patches/server/Mark-fish-and-axolotls-from-buckets-as-persistent.patch deleted file mode 100644 index b2cb76d54..000000000 --- a/patches/server/Mark-fish-and-axolotls-from-buckets-as-persistent.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 13 Aug 2021 16:38:08 -0700 -Subject: [PATCH] Mark fish and axolotls from buckets as persistent - - -diff --git a/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java b/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java -+++ b/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java -@@ -0,0 +0,0 @@ public abstract class AbstractFish extends WaterAnimal implements Bucketable { - @Override - public void setFromBucket(boolean fromBucket) { - this.entityData.set(AbstractFish.FROM_BUCKET, fromBucket); -- this.setPersistenceRequired(this.isPersistenceRequired()); // CraftBukkit - SPIGOT-4106 update persistence -+ this.setPersistenceRequired(fromBucket || this.isPersistenceRequired()); // CraftBukkit - SPIGOT-4106 update persistence // Paper - actually set as persistent - } - - @Override -diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -+++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -@@ -0,0 +0,0 @@ public class Axolotl extends Animal implements LerpingModel, Bucketable { - @Override - public void setFromBucket(boolean fromBucket) { - this.entityData.set(Axolotl.FROM_BUCKET, fromBucket); -- this.setPersistenceRequired(this.isPersistenceRequired()); // CraftBukkit - SPIGOT-4106 update persistence -+ this.setPersistenceRequired(fromBucket || this.isPersistenceRequired()); // CraftBukkit - SPIGOT-4106 update persistence // Paper - actually set as persistent - } - - @Nullable diff --git a/patches/server/Ocelot-despawns-should-honor-nametags-and-leash.patch b/patches/server/Ocelot-despawns-should-honor-nametags-and-leash.patch index 5991b42c2..35def0416 100644 --- a/patches/server/Ocelot-despawns-should-honor-nametags-and-leash.patch +++ b/patches/server/Ocelot-despawns-should-honor-nametags-and-leash.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean removeWhenFarAway(double distanceSquared) { -- return !this.isTrusting() /*&& this.tickCount > 2400*/; // CraftBukkit -+ return !this.isTrusting() && !this.hasCustomName() && !this.isLeashed() /*&& this.tickCount > 2400*/; // CraftBukkit // Paper - honor name and leash +- return !this.isTrusting() && this.tickCount > 2400; ++ return !this.isTrusting() && this.tickCount > 2400 && !this.hasCustomName() && !this.isLeashed(); // Paper - honor name and leash } public static AttributeSupplier.Builder createAttributes() { diff --git a/work/Bukkit b/work/Bukkit index 315147744..312281ead 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 31514774479a17c4a8cfb2d44f392a590a2b282c +Subproject commit 312281eade984b060ae27c84b63f48cafbb76fd8 diff --git a/work/CraftBukkit b/work/CraftBukkit index 9cc7d766d..2ac7fa7af 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 9cc7d766dc36bf5f565381f0d1be885911895c1a +Subproject commit 2ac7fa7af6c1e1ddb0a61d7761eb66eda96f8207 diff --git a/work/Spigot b/work/Spigot index 42b61526f..b6d12d17c 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 42b61526f13ff472e32714d8e7b75fce31cf1151 +Subproject commit b6d12d17cd1763d488a42cb9f3e6c424de5f12a8