Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 04:20:08 +01:00
SPIGOT-4741: InventoryHolder no longer returns DoubleChest
Dieser Commit ist enthalten in:
Ursprung
ed20842bcf
Commit
724ec10f33
67
nms-patches/BlockChest.patch
Normale Datei
67
nms-patches/BlockChest.patch
Normale Datei
@ -0,0 +1,67 @@
|
|||||||
|
--- a/net/minecraft/server/BlockChest.java
|
||||||
|
+++ b/net/minecraft/server/BlockChest.java
|
||||||
|
@@ -30,24 +30,7 @@
|
||||||
|
public ITileInventory b(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) {
|
||||||
|
final InventoryLargeChest inventorylargechest = new InventoryLargeChest(tileentitychest, tileentitychest1);
|
||||||
|
|
||||||
|
- return 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() {
|
||||||
|
- return new ChatMessage("container.chestDouble", new Object[0]);
|
||||||
|
- }
|
||||||
|
- };
|
||||||
|
+ return new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest); // CraftBukkit
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@@ -56,6 +39,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() {
|
||||||
|
+ return new ChatMessage("container.chestDouble", new Object[0]);
|
||||||
|
+ }
|
||||||
|
+ };
|
||||||
|
+ // CraftBukkit end
|
||||||
|
+
|
||||||
|
protected BlockChest(Block.Info block_info) {
|
||||||
|
super(block_info);
|
||||||
|
this.o((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.blockStateList.getBlockData()).set(BlockChest.FACING, EnumDirection.NORTH)).set(BlockChest.b, BlockPropertyChestType.SINGLE)).set(BlockChest.c, false));
|
@ -50,8 +50,8 @@ public class CraftChest extends CraftLootable<TileEntityChest> implements Chest
|
|||||||
BlockChest blockChest = (BlockChest) (this.getType() == Material.CHEST ? Blocks.CHEST : Blocks.TRAPPED_CHEST);
|
BlockChest blockChest = (BlockChest) (this.getType() == Material.CHEST ? Blocks.CHEST : Blocks.TRAPPED_CHEST);
|
||||||
ITileInventory nms = blockChest.getInventory(data, world.getHandle(), this.getPosition());
|
ITileInventory nms = blockChest.getInventory(data, world.getHandle(), this.getPosition());
|
||||||
|
|
||||||
if (nms instanceof InventoryLargeChest) {
|
if (nms instanceof BlockChest.DoubleInventory) {
|
||||||
inventory = new CraftInventoryDoubleChest((InventoryLargeChest) nms);
|
inventory = new CraftInventoryDoubleChest(((BlockChest.DoubleInventory) nms).inventorylargechest);
|
||||||
}
|
}
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren