diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/ChestBlock.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/ChestBlock.java.patch | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/ChestBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/ChestBlock.java.patch new file mode 100644 index 0000000000..2470949692 --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/ChestBlock.java.patch @@ -0,0 +1,78 @@ +--- a/net/minecraft/world/level/block/ChestBlock.java ++++ b/net/minecraft/world/level/block/ChestBlock.java +@@ -85,9 +89,17 @@ + return Optional.empty(); + } + }; +- private static final DoubleBlockCombiner.Combiner<ChestBlockEntity, Optional<MenuProvider>> MENU_PROVIDER_COMBINER = new DoubleBlockCombiner.Combiner<ChestBlockEntity, Optional<MenuProvider>>( +- +- ) { ++ private static final DoubleBlockCombiner.Combiner<ChestBlockEntity, Optional<ITileInventory>> MENU_PROVIDER_COMBINER = new DoubleBlockCombiner.Combiner<ChestBlockEntity, Optional<ITileInventory>>() { ++ public Optional<ITileInventory> acceptDouble(final ChestBlockEntity tileentitychest, final ChestBlockEntity tileentitychest1) { ++ final CompoundContainer inventorylargechest = new CompoundContainer(tileentitychest, tileentitychest1); ++ ++ return Optional.of(new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest)); // CraftBukkit ++ } ++ ++ public Optional<ITileInventory> acceptSingle(ChestBlockEntity tileentitychest) { ++ return Optional.of(tileentitychest); ++ } ++ + @Override + public Optional<MenuProvider> acceptDouble(final ChestBlockEntity first, final ChestBlockEntity second) { + final Container container = new CompoundContainer(first, second); +@@ -104,15 +106,17 @@ + } + } + +- @Override +- public Component getDisplayName() { +- if (first.hasCustomName()) { +- return first.getDisplayName(); +- } else { +- return (Component)(second.hasCustomName() ? second.getDisplayName() : Component.translatable("container.chestDouble")); +- } +- } +- }); ++ // CraftBukkit start ++ public static class DoubleInventory implements ITileInventory { ++ ++ private final ChestBlockEntity tileentitychest; ++ private final ChestBlockEntity tileentitychest1; ++ public final CompoundContainer inventorylargechest; ++ ++ public DoubleInventory(ChestBlockEntity tileentitychest, ChestBlockEntity tileentitychest1, CompoundContainer inventorylargechest) { ++ this.tileentitychest = tileentitychest; ++ this.tileentitychest1 = tileentitychest1; ++ this.inventorylargechest = inventorylargechest; + } + + @Override +@@ -125,6 +136,7 @@ + return Optional.empty(); + } + }; ++ // CraftBukkit end + + @Override + public MapCodec<? extends ChestBlock> codec() { +@@ -298,10 +308,17 @@ + + @Nullable + @Override +- public MenuProvider getMenuProvider(BlockState state, Level level, BlockPos pos) { +- return this.combine(state, level, pos, false).apply(MENU_PROVIDER_COMBINER).orElse(null); ++ public ITileInventory getMenuProvider(IBlockData state, Level level, BlockPos pos) { ++ // CraftBukkit start ++ return getMenuProvider(state, level, pos, false); + } + ++ @Nullable ++ public ITileInventory getMenuProvider(IBlockData iblockdata, Level world, BlockPos blockposition, boolean ignoreObstructions) { ++ return (ITileInventory) ((Optional) this.combine(iblockdata, world, blockposition, ignoreObstructions).apply(ChestBlock.MENU_PROVIDER_COMBINER)).orElse((Object) null); ++ // CraftBukkit end ++ } ++ + public static DoubleBlockCombiner.Combiner<ChestBlockEntity, Float2FloatFunction> opennessCombiner(final LidBlockEntity lid) { + return new DoubleBlockCombiner.Combiner<ChestBlockEntity, Float2FloatFunction>() { + @Override |