|
1 | 1 | --- a/net/minecraft/world/level/block/ChestBlock.java |
2 | 2 | +++ b/net/minecraft/world/level/block/ChestBlock.java |
| 3 | +@@ -90,10 +_,27 @@ |
| 4 | + return Optional.empty(); |
| 5 | + } |
| 6 | + }; |
| 7 | +- public static final DoubleBlockCombiner.Combiner<ChestBlockEntity, Optional<MenuProvider>> MENU_PROVIDER_COMBINER = new DoubleBlockCombiner.Combiner<ChestBlockEntity, Optional<MenuProvider>>() { |
| 8 | ++ public static final DoubleBlockCombiner.Combiner<ChestBlockEntity, Optional<MenuProvider>> MENU_PROVIDER_COMBINER = new DoubleChestCombiner(); |
| 9 | ++ |
| 10 | ++ public static class DoubleChestCombiner implements DoubleBlockCombiner.Combiner<ChestBlockEntity, Optional<MenuProvider>> { |
| 11 | + public Optional<MenuProvider> acceptDouble(ChestBlockEntity first, ChestBlockEntity second) { |
| 12 | +- final Container container = new CompoundContainer(first, second); |
| 13 | +- return Optional.of(new MenuProvider() { |
| 14 | ++ final CompoundContainer container = new CompoundContainer(first, second); |
| 15 | ++ return Optional.of(new Dummy.DoubleInventory(first, second, container)); |
| 16 | ++ } |
| 17 | ++ |
| 18 | ++ public static class Dummy { |
| 19 | ++ public static class DoubleInventory implements MenuProvider { |
| 20 | ++ |
| 21 | ++ private final ChestBlockEntity first; |
| 22 | ++ private final ChestBlockEntity second; |
| 23 | ++ public final CompoundContainer container; |
| 24 | ++ |
| 25 | ++ public DoubleInventory(ChestBlockEntity first, ChestBlockEntity second, CompoundContainer container) { |
| 26 | ++ this.first = first; |
| 27 | ++ this.second = second; |
| 28 | ++ this.container = container; |
| 29 | ++ } |
| 30 | ++ // CraftBukkit end |
| 31 | + @Override |
| 32 | + public @Nullable AbstractContainerMenu createMenu(int containerId, Inventory inventory, Player player) { |
| 33 | + if (first.canOpen(player) && second.canOpen(player)) { |
| 34 | +@@ -117,7 +_,7 @@ |
| 35 | + return second.hasCustomName() ? second.getDisplayName() : Component.translatable("container.chestDouble"); |
| 36 | + } |
| 37 | + } |
| 38 | +- }); |
| 39 | ++ }; |
| 40 | + } |
| 41 | + |
| 42 | + public Optional<MenuProvider> acceptSingle(ChestBlockEntity single) { |
3 | 43 | @@ -364,7 +_,8 @@ |
4 | 44 |
|
5 | 45 | @Override |
|
0 commit comments