2021-03-16 09:00:00 +11:00
|
|
|
--- a/net/minecraft/world/level/block/BlockChest.java
|
|
|
|
+++ b/net/minecraft/world/level/block/BlockChest.java
|
2024-04-24 01:15:00 +10:00
|
|
|
@@ -90,24 +90,7 @@
|
2021-11-22 09:00:00 +11:00
|
|
|
public Optional<ITileInventory> acceptDouble(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) {
|
2019-04-25 13:57:18 +10:00
|
|
|
final InventoryLargeChest inventorylargechest = new InventoryLargeChest(tileentitychest, tileentitychest1);
|
|
|
|
|
2024-04-24 01:15:00 +10:00
|
|
|
- return Optional.of(new ITileInventory(this) {
|
2019-04-25 13:57:18 +10:00
|
|
|
- @Nullable
|
|
|
|
- @Override
|
|
|
|
- public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {
|
2021-11-22 09:00:00 +11:00
|
|
|
- if (tileentitychest.canOpen(entityhuman) && tileentitychest1.canOpen(entityhuman)) {
|
|
|
|
- tileentitychest.unpackLootTable(playerinventory.player);
|
|
|
|
- tileentitychest1.unpackLootTable(playerinventory.player);
|
|
|
|
- return ContainerChest.sixRows(i, playerinventory, inventorylargechest);
|
2019-04-25 13:57:18 +10:00
|
|
|
- } else {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
2021-11-22 09:00:00 +11:00
|
|
|
- public IChatBaseComponent getDisplayName() {
|
2022-06-08 02:00:00 +10:00
|
|
|
- return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getDisplayName() : IChatBaseComponent.translatable("container.chestDouble")));
|
2019-04-25 13:57:18 +10:00
|
|
|
- }
|
2019-12-11 09:00:00 +11:00
|
|
|
- });
|
2024-04-24 01:15:00 +10:00
|
|
|
+ return Optional.of(new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest)); // CraftBukkit // CraftBukkit - decompile error
|
2019-04-25 13:57:18 +10:00
|
|
|
}
|
|
|
|
|
2021-11-22 09:00:00 +11:00
|
|
|
public Optional<ITileInventory> acceptSingle(TileEntityChest tileentitychest) {
|
2024-04-24 01:15:00 +10:00
|
|
|
@@ -120,6 +103,38 @@
|
2019-04-25 13:57:18 +10:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
+ // 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) {
|
2021-11-22 09:00:00 +11:00
|
|
|
+ if (tileentitychest.canOpen(entityhuman) && tileentitychest1.canOpen(entityhuman)) {
|
|
|
|
+ tileentitychest.unpackLootTable(playerinventory.player);
|
|
|
|
+ tileentitychest1.unpackLootTable(playerinventory.player);
|
|
|
|
+ return ContainerChest.sixRows(i, playerinventory, inventorylargechest);
|
2019-04-25 13:57:18 +10:00
|
|
|
+ } else {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
2021-11-22 09:00:00 +11:00
|
|
|
+ public IChatBaseComponent getDisplayName() {
|
2022-06-08 02:00:00 +10:00
|
|
|
+ return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getDisplayName() : IChatBaseComponent.translatable("container.chestDouble")));
|
2019-04-25 13:57:18 +10:00
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ // CraftBukkit end
|
|
|
|
+
|
2023-12-06 03:40:00 +11:00
|
|
|
@Override
|
|
|
|
public MapCodec<? extends BlockChest> codec() {
|
|
|
|
return BlockChest.CODEC;
|
2024-04-24 01:15:00 +10:00
|
|
|
@@ -263,7 +278,7 @@
|
2019-12-11 09:00:00 +11:00
|
|
|
|
2021-06-11 15:00:00 +10:00
|
|
|
@Override
|
2021-11-22 09:00:00 +11:00
|
|
|
public DoubleBlockFinder.Result<? extends TileEntityChest> combine(IBlockData iblockdata, World world, BlockPosition blockposition, boolean flag) {
|
2019-12-11 09:00:00 +11:00
|
|
|
- BiPredicate bipredicate;
|
|
|
|
+ BiPredicate<GeneratorAccess, BlockPosition> bipredicate; // CraftBukkit - decompile error
|
|
|
|
|
|
|
|
if (flag) {
|
|
|
|
bipredicate = (generatoraccess, blockposition1) -> {
|
2024-04-24 01:15:00 +10:00
|
|
|
@@ -279,7 +294,14 @@
|
2021-10-16 18:48:21 +11:00
|
|
|
@Nullable
|
|
|
|
@Override
|
2024-04-24 01:15:00 +10:00
|
|
|
protected ITileInventory getMenuProvider(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
2021-11-22 09:00:00 +11:00
|
|
|
- return (ITileInventory) ((Optional) this.combine(iblockdata, world, blockposition, false).apply(BlockChest.MENU_PROVIDER_COMBINER)).orElse((Object) null);
|
2021-10-16 18:48:21 +11:00
|
|
|
+ // CraftBukkit start
|
2021-11-22 09:00:00 +11:00
|
|
|
+ return getMenuProvider(iblockdata, world, blockposition, false);
|
2021-10-16 18:48:21 +11:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Nullable
|
2021-11-22 09:00:00 +11:00
|
|
|
+ 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);
|
2021-10-16 18:48:21 +11:00
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
2021-11-22 09:00:00 +11:00
|
|
|
public static DoubleBlockFinder.Combiner<TileEntityChest, Float2FloatFunction> opennessCombiner(final LidBlockEntity lidblockentity) {
|