90 lines
4.8 KiB
Diff
90 lines
4.8 KiB
Diff
--- a/net/minecraft/world/level/block/BlockChest.java
|
|
+++ b/net/minecraft/world/level/block/BlockChest.java
|
|
@@ -83,28 +83,11 @@
|
|
return Optional.empty();
|
|
}
|
|
};
|
|
- private static final DoubleBlockFinder.Combiner<TileEntityChest, Optional<ITileInventory>> MENU_PROVIDER_COMBINER = new DoubleBlockFinder.Combiner<TileEntityChest, Optional<ITileInventory>>() {
|
|
+ public static final DoubleBlockFinder.Combiner<TileEntityChest, Optional<ITileInventory>> MENU_PROVIDER_COMBINER = new DoubleBlockFinder.Combiner<TileEntityChest, Optional<ITileInventory>>() { // PAIL private -> public
|
|
public Optional<ITileInventory> acceptDouble(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) {
|
|
- final IInventory iinventory = new InventoryLargeChest(tileentitychest, tileentitychest1);
|
|
-
|
|
- return Optional.of(new ITileInventory() {
|
|
- @Nullable
|
|
- @Override
|
|
- public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {
|
|
- if (tileentitychest.canOpen(entityhuman) && tileentitychest1.canOpen(entityhuman)) {
|
|
- tileentitychest.unpackLootTable(playerinventory.player);
|
|
- tileentitychest1.unpackLootTable(playerinventory.player);
|
|
- return ContainerChest.sixRows(i, playerinventory, iinventory);
|
|
- } else {
|
|
- return null;
|
|
- }
|
|
- }
|
|
+ final InventoryLargeChest iinventory = new InventoryLargeChest(tileentitychest, tileentitychest1); // CraftBukkit
|
|
|
|
- @Override
|
|
- public IChatBaseComponent getDisplayName() {
|
|
- return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getDisplayName() : IChatBaseComponent.translatable("container.chestDouble")));
|
|
- }
|
|
- });
|
|
+ return Optional.of(new DoubleInventory(tileentitychest, tileentitychest1, iinventory)); // CraftBukkit
|
|
}
|
|
|
|
public Optional<ITileInventory> acceptSingle(TileEntityChest tileentitychest) {
|
|
@@ -117,6 +100,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.canOpen(entityhuman) && tileentitychest1.canOpen(entityhuman)) {
|
|
+ tileentitychest.unpackLootTable(playerinventory.player);
|
|
+ tileentitychest1.unpackLootTable(playerinventory.player);
|
|
+ return ContainerChest.sixRows(i, playerinventory, inventorylargechest);
|
|
+ } else {
|
|
+ return null;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public IChatBaseComponent getDisplayName() {
|
|
+ return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getDisplayName() : IChatBaseComponent.translatable("container.chestDouble")));
|
|
+ }
|
|
+ };
|
|
+ // CraftBukkit end
|
|
+
|
|
@Override
|
|
public MapCodec<? extends BlockChest> codec() {
|
|
return BlockChest.CODEC;
|
|
@@ -268,7 +283,14 @@
|
|
@Nullable
|
|
@Override
|
|
protected ITileInventory getMenuProvider(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
|
- return (ITileInventory) ((Optional) this.combine(iblockdata, world, blockposition, false).apply(BlockChest.MENU_PROVIDER_COMBINER)).orElse((Object) null);
|
|
+ // CraftBukkit start
|
|
+ return getMenuProvider(iblockdata, world, blockposition, false);
|
|
+ }
|
|
+
|
|
+ @Nullable
|
|
+ public ITileInventory getMenuProvider(IBlockData iblockdata, World world, BlockPosition blockposition, boolean ignoreObstructions) {
|
|
+ return (ITileInventory) ((Optional) this.combine(iblockdata, world, blockposition, ignoreObstructions).apply(BlockChest.MENU_PROVIDER_COMBINER)).orElse((Object) null);
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
public static DoubleBlockFinder.Combiner<TileEntityChest, Float2FloatFunction> opennessCombiner(final LidBlockEntity lidblockentity) {
|