2021-10-08 21:06:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Thu, 7 Oct 2021 20:49:13 -0700
Subject: [PATCH] Fix unplaced block states after new chunk gen API
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java
2021-10-15 13:43:19 +02:00
index e00210950cbf005b0e65aed68dfbb7c281aefd87..b4a10c1ef095faaefbedc2a1fd84aea721a4ba98 100644
2021-10-08 21:06:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java
2021-10-15 13:43:19 +02:00
@@ -65,6 +65,7 @@ public class CraftBeehive extends CraftBlockEntityState<BeehiveBlockEntity> impl
2021-10-08 21:06:28 +02:00
List<Bee> bees = new ArrayList<>();
if (isPlaced()) {
+ Preconditions.checkState(getWorldHandle() instanceof net.minecraft.world.level.Level, "Can't release entities during world generation"); // Paper - don't fail if block isnt placed, this method did not use to fail
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/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
2021-10-15 13:43:19 +02:00
index 9806697cb7566c5af1df74b7eaa8088d19ee4fdc..ad833481414d3b60bdbcf87727b494ecff84f2c3 100644
2021-10-08 21:06:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
2021-10-15 13:43:19 +02:00
@@ -42,6 +42,7 @@ public class CraftChest extends CraftLootable<ChestBlockEntity> implements Chest
if (!isPlaced() || isWorldGeneration()) {
2021-10-08 21:06:28 +02:00
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
// The logic here is basically identical to the logic in BlockChest.interact
CraftWorld world = (CraftWorld) this.getWorld();