Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/nms-patches/BlockChest.patch

77 Zeilen
3.9 KiB
Diff

--- a/net/minecraft/server/BlockChest.java
+++ b/net/minecraft/server/BlockChest.java
2019-12-10 23:00:00 +01:00
@@ -35,24 +35,7 @@
public Optional<ITileInventory> a(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) {
final InventoryLargeChest inventorylargechest = new InventoryLargeChest(tileentitychest, tileentitychest1);
2019-12-10 23:00:00 +01:00
- return Optional.of(new ITileInventory() {
- @Nullable
- @Override
- public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {
- if (tileentitychest.e(entityhuman) && tileentitychest1.e(entityhuman)) {
- tileentitychest.d(playerinventory.player);
- tileentitychest1.d(playerinventory.player);
- return ContainerChest.b(i, playerinventory, inventorylargechest);
- } else {
- return null;
- }
- }
-
- @Override
- public IChatBaseComponent getScoreboardDisplayName() {
2019-06-21 12:00:00 +02:00
- return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getScoreboardDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getScoreboardDisplayName() : new ChatMessage("container.chestDouble", new Object[0])));
- }
2019-12-10 23:00:00 +01:00
- });
+ return Optional.of(new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest)); // CraftBukkit
}
2019-12-10 23:00:00 +01:00
public Optional<ITileInventory> a(TileEntityChest tileentitychest) {
@@ -65,6 +48,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.e(entityhuman) && tileentitychest1.e(entityhuman)) {
+ tileentitychest.d(playerinventory.player);
+ tileentitychest1.d(playerinventory.player);
+ return ContainerChest.b(i, playerinventory, inventorylargechest);
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public IChatBaseComponent getScoreboardDisplayName() {
2019-06-21 12:00:00 +02:00
+ return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getScoreboardDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getScoreboardDisplayName() : new ChatMessage("container.chestDouble", new Object[0])));
+ }
+ };
+ // CraftBukkit end
+
2019-12-10 23:00:00 +01:00
protected BlockChest(Block.Info block_info, Supplier<TileEntityTypes<? extends TileEntityChest>> supplier) {
super(block_info, supplier);
this.p((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.blockStateList.getBlockData()).set(BlockChest.FACING, EnumDirection.NORTH)).set(BlockChest.c, BlockPropertyChestType.SINGLE)).set(BlockChest.d, false));
@@ -217,7 +232,7 @@
}
public DoubleBlockFinder.Result<? extends TileEntityChest> a(IBlockData iblockdata, World world, BlockPosition blockposition, boolean flag) {
- BiPredicate bipredicate;
+ BiPredicate<GeneratorAccess, BlockPosition> bipredicate; // CraftBukkit - decompile error
if (flag) {
bipredicate = (generatoraccess, blockposition1) -> {