From 26639f1397774e6df051c77454c4d5660850dd25 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Fri, 15 Oct 2021 12:43:19 +0100 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: 9590b610 SPIGOT-6749: Library Loader does not correctly isolate dependencies CraftBukkit Changes: 11c9299f #940: Fixed a NPE during CraftBlockEntityState#update. 960f3109 #937: Fixes related to unplaced BlockStates and the recent world generation changes. 4faf479e SPIGOT-6754: We ignore any still present TileEntity now when we create a BlockState for a block of type AIR. a72d5404 SPIGOT-6754: Temporarily restore previous behaviour for tile entities with removed blocks Spigot Changes: dc75aca8 Remove redundant 'Log null TileEntity Owner' patch --- ...-get-a-BlockState-without-a-snapshot.patch | 6 +--- ...block-states-after-new-chunk-gen-API.patch | 32 +------------------ ...licable-for-CraftBlockEntityState-up.patch | 21 ------------ work/Bukkit | 2 +- work/CraftBukkit | 2 +- work/Spigot | 2 +- 6 files changed, 5 insertions(+), 60 deletions(-) delete mode 100644 patches/server/Null-check-isApplicable-for-CraftBlockEntityState-up.patch diff --git a/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch b/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch index 0cbc48ae0e..62900b68f5 100644 --- a/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch +++ b/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch @@ -43,12 +43,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public InventoryHolder getOwner(boolean useSnapshot) { + // Paper end if (this.level == null) return null; - // Spigot start org.bukkit.block.Block block = this.level.getWorld().getBlockAt(this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ()); -@@ -0,0 +0,0 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject { - return null; - } - // Spigot end + if (block.getType() == org.bukkit.Material.AIR) return null; - org.bukkit.block.BlockState state = block.getState(); + org.bukkit.block.BlockState state = block.getState(useSnapshot); // Paper if (state instanceof InventoryHolder) return (InventoryHolder) state; diff --git a/patches/server/Fix-unplaced-block-states-after-new-chunk-gen-API.patch b/patches/server/Fix-unplaced-block-states-after-new-chunk-gen-API.patch index 23b616c6a3..96875e2875 100644 --- a/patches/server/Fix-unplaced-block-states-after-new-chunk-gen-API.patch +++ b/patches/server/Fix-unplaced-block-states-after-new-chunk-gen-API.patch @@ -9,11 +9,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java @@ -0,0 +0,0 @@ public class CraftBeehive extends CraftBlockEntityState impl - - @Override - public List releaseEntities() { -- Preconditions.checkState(getWorldHandle() instanceof net.minecraft.world.level.Level, "Can't release entities during world generation"); - List bees = new ArrayList<>(); if (isPlaced()) { @@ -21,37 +16,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BeehiveBlockEntity beehive = ((BeehiveBlockEntity) this.getTileEntityFromWorld()); for (Entity bee : beehive.releaseBees(this.getHandle(), BeeReleaseStatus.BEE_RELEASED, true)) { bees.add((Bee) bee.getBukkitEntity()); -diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java -+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java -@@ -0,0 +0,0 @@ public class CraftBlockState implements BlockState { - - public LevelAccessor getWorldHandle() { - if (this.weakWorld == null) { -+ requirePlaced(); // Paper - return this.world.getHandle(); - } - - LevelAccessor access = this.weakWorld.get(); - if (access == null) { - this.weakWorld = null; -+ requirePlaced(); // Paper - return this.world.getHandle(); - } - diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java @@ -0,0 +0,0 @@ public class CraftChest extends CraftLootable implements Chest - - @Override - public Inventory getInventory() { -- Preconditions.checkState(getWorldHandle() instanceof net.minecraft.world.level.Level, "Can't get inventory during world generation, use getBlockInventory() instead"); - - CraftInventory inventory = (CraftInventory) this.getBlockInventory(); - if (!isPlaced()) { + if (!isPlaced() || isWorldGeneration()) { return inventory; } + Preconditions.checkState(getWorldHandle() instanceof net.minecraft.world.level.Level, "Can't get inventory during world generation, use getBlockInventory() instead"); // Paper - move after placed check diff --git a/patches/server/Null-check-isApplicable-for-CraftBlockEntityState-up.patch b/patches/server/Null-check-isApplicable-for-CraftBlockEntityState-up.patch deleted file mode 100644 index 83a8df5ad8..0000000000 --- a/patches/server/Null-check-isApplicable-for-CraftBlockEntityState-up.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Tue, 12 Oct 2021 13:32:52 -0700 -Subject: [PATCH] Null check isApplicable for CraftBlockEntityState#update - -If the update call removed the TE, then isApplicable would -have NPE'd. - -diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -@@ -0,0 +0,0 @@ public abstract class CraftBlockEntityState extends Craft - } - - protected boolean isApplicable(BlockEntity tileEntity) { -- return this.tileEntity.getClass() == tileEntity.getClass(); -+ return tileEntity != null && this.tileEntity.getClass() == tileEntity.getClass(); // Paper - fix NPE if the TE was removed - } - - @Override diff --git a/work/Bukkit b/work/Bukkit index 6be36d3638..9590b610cf 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 6be36d3638f97e6e0dc053f3e0fd0e68e8ec93f0 +Subproject commit 9590b610cfa705b082c0593b595a7d563a89dc85 diff --git a/work/CraftBukkit b/work/CraftBukkit index 1df303e707..11c9299fbb 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 1df303e70742418fd30760a750a9545f3dea5b9b +Subproject commit 11c9299fbb8f559c1ba38e8f0e1695c4d33109ba diff --git a/work/Spigot b/work/Spigot index 8e907441bd..dc75aca853 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 8e907441bde900ddc564d3a5fac831287a1a8b75 +Subproject commit dc75aca85361e65679880f2abd5c92f6db448ae2