--- a/net/minecraft/world/level/block/BlockChest.java +++ b/net/minecraft/world/level/block/BlockChest.java @@ -88,24 +88,7 @@ public Optional a(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) { final InventoryLargeChest inventorylargechest = new InventoryLargeChest(tileentitychest, tileentitychest1); - return Optional.of(new ITileInventory() { - @Nullable - @Override - public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) { - if (tileentitychest.d(entityhuman) && tileentitychest1.d(entityhuman)) { - tileentitychest.e(playerinventory.player); - tileentitychest1.e(playerinventory.player); - return ContainerChest.b(i, playerinventory, (IInventory) inventorylargechest); - } else { - return null; - } - } - - @Override - public IChatBaseComponent getScoreboardDisplayName() { - return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getScoreboardDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getScoreboardDisplayName() : new ChatMessage("container.chestDouble"))); - } - }); + return Optional.of(new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest)); // CraftBukkit } public Optional a(TileEntityChest tileentitychest) { @@ -118,6 +101,38 @@ } }; + // CraftBukkit start + public static class DoubleInventory implements ITileInventory { + + private final TileEntityChest tileentitychest; + private final TileEntityChest tileentitychest1; + public final InventoryLargeChest inventorylargechest; + + public DoubleInventory(TileEntityChest tileentitychest, TileEntityChest tileentitychest1, InventoryLargeChest inventorylargechest) { + this.tileentitychest = tileentitychest; + this.tileentitychest1 = tileentitychest1; + this.inventorylargechest = inventorylargechest; + } + + @Nullable + @Override + public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) { + if (tileentitychest.d(entityhuman) && tileentitychest1.d(entityhuman)) { + tileentitychest.e(playerinventory.player); + tileentitychest1.e(playerinventory.player); + return ContainerChest.b(i, playerinventory, (IInventory) inventorylargechest); + } else { + return null; + } + } + + @Override + public IChatBaseComponent getScoreboardDisplayName() { + return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getScoreboardDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getScoreboardDisplayName() : new ChatMessage("container.chestDouble"))); + } + }; + // CraftBukkit end + protected BlockChest(BlockBase.Info blockbase_info, Supplier> supplier) { super(blockbase_info, supplier); this.k((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.stateDefinition.getBlockData()).set(BlockChest.FACING, EnumDirection.NORTH)).set(BlockChest.TYPE, BlockPropertyChestType.SINGLE)).set(BlockChest.WATERLOGGED, false)); @@ -276,7 +291,7 @@ @Override public DoubleBlockFinder.Result a(IBlockData iblockdata, World world, BlockPosition blockposition, boolean flag) { - BiPredicate bipredicate; + BiPredicate bipredicate; // CraftBukkit - decompile error if (flag) { bipredicate = (generatoraccess, blockposition1) -> { @@ -292,7 +307,14 @@ @Nullable @Override public ITileInventory getInventory(IBlockData iblockdata, World world, BlockPosition blockposition) { - return (ITileInventory) ((Optional) this.a(iblockdata, world, blockposition, false).apply(BlockChest.MENU_PROVIDER_COMBINER)).orElse((Object) null); + // CraftBukkit start + return getInventory(iblockdata, world, blockposition, false); + } + + @Nullable + public ITileInventory getInventory(IBlockData iblockdata, World world, BlockPosition blockposition, boolean ignoreObstructions) { + return (ITileInventory) ((Optional) this.a(iblockdata, world, blockposition, ignoreObstructions).apply(BlockChest.MENU_PROVIDER_COMBINER)).orElse((Object) null); + // CraftBukkit end } public static DoubleBlockFinder.Combiner a(final LidBlockEntity lidblockentity) {