mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-22 15:56:18 +00:00
65 lines
1.9 KiB
Diff
65 lines
1.9 KiB
Diff
--- a/net/minecraft/world/level/block/entity/TileEntityChest.java
|
|
+++ b/net/minecraft/world/level/block/entity/TileEntityChest.java
|
|
@@ -24,6 +24,12 @@
|
|
import net.minecraft.world.level.block.state.IBlockData;
|
|
import net.minecraft.world.level.block.state.properties.BlockPropertyChestType;
|
|
|
|
+// CraftBukkit start
|
|
+import java.util.List;
|
|
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
|
+import org.bukkit.entity.HumanEntity;
|
|
+// CraftBukkit end
|
|
+
|
|
public class TileEntityChest extends TileEntityLootable implements LidBlockEntity {
|
|
|
|
private static final int EVENT_SET_OPEN_COUNT = 1;
|
|
@@ -31,6 +37,36 @@
|
|
public final ContainerOpenersCounter openersCounter;
|
|
private final ChestLidController chestLidController;
|
|
|
|
+ // CraftBukkit start - add fields and methods
|
|
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
|
+ private int maxStack = MAX_STACK;
|
|
+
|
|
+ public List<ItemStack> getContents() {
|
|
+ return this.items;
|
|
+ }
|
|
+
|
|
+ public void onOpen(CraftHumanEntity who) {
|
|
+ transaction.add(who);
|
|
+ }
|
|
+
|
|
+ public void onClose(CraftHumanEntity who) {
|
|
+ transaction.remove(who);
|
|
+ }
|
|
+
|
|
+ public List<HumanEntity> getViewers() {
|
|
+ return transaction;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getMaxStackSize() {
|
|
+ return maxStack;
|
|
+ }
|
|
+
|
|
+ public void setMaxStackSize(int size) {
|
|
+ maxStack = size;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
protected TileEntityChest(TileEntityTypes<?> tileentitytypes, BlockPosition blockposition, IBlockData iblockdata) {
|
|
super(tileentitytypes, blockposition, iblockdata);
|
|
this.items = NonNullList.withSize(27, ItemStack.EMPTY);
|
|
@@ -199,4 +235,11 @@
|
|
|
|
world.blockEvent(blockposition, block, 1, j);
|
|
}
|
|
+
|
|
+ // CraftBukkit start
|
|
+ @Override
|
|
+ public boolean onlyOpCanSetNbt() {
|
|
+ return true;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|