Skip to content

Commit 311810f

Browse files
committed
fix copper chest inventory
Closes #13117
1 parent 00bf128 commit 311810f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import net.minecraft.world.level.block.entity.ChestBlockEntity;
77
import net.minecraft.world.level.block.state.BlockState;
88
import org.bukkit.Location;
9-
import org.bukkit.Material;
109
import org.bukkit.World;
1110
import org.bukkit.block.Chest;
1211
import org.bukkit.craftbukkit.CraftWorld;
@@ -45,14 +44,13 @@ public Inventory getInventory() {
4544
return inventory;
4645
}
4746

48-
// The logic here is basically identical to the logic in BlockChest.interact
4947
CraftWorld world = (CraftWorld) this.getWorld();
5048

51-
ChestBlock blockChest = (ChestBlock) (this.getType() == Material.CHEST ? Blocks.CHEST : Blocks.TRAPPED_CHEST);
52-
MenuProvider nms = blockChest.getMenuProvider(this.data, world.getHandle(), this.getPosition(), true);
49+
ChestBlock block = this.data.getBlock() instanceof ChestBlock chestBlock ? chestBlock : (ChestBlock) Blocks.CHEST;
50+
MenuProvider provider = block.getMenuProvider(this.data, world.getHandle(), this.getPosition(), true);
5351

54-
if (nms instanceof ChestBlock.DoubleInventory) {
55-
inventory = new CraftInventoryDoubleChest((ChestBlock.DoubleInventory) nms);
52+
if (provider instanceof ChestBlock.DoubleInventory) {
53+
inventory = new CraftInventoryDoubleChest((ChestBlock.DoubleInventory) provider);
5654
}
5755
return inventory;
5856
}

0 commit comments

Comments
 (0)