mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 20:07:41 +01:00
Fix unplaced block states after new chunk gen API (#6747)
This commit is contained in:
parent
2708960eba
commit
4675996335
@ -0,0 +1,60 @@
|
||||
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
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- 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<BeehiveBlockEntity> impl
|
||||
|
||||
@Override
|
||||
public List<Bee> releaseEntities() {
|
||||
- Preconditions.checkState(getWorldHandle() instanceof net.minecraft.world.level.Level, "Can't release entities during world generation");
|
||||
|
||||
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/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<ChestBlockEntity> 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()) {
|
||||
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();
|
Loading…
Reference in New Issue
Block a user