mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 08:00:02 +03:00
68 lines
2.1 KiB
Diff
68 lines
2.1 KiB
Diff
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityDispenser.java
|
|
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityDispenser.java
|
|
@@ -14,12 +14,46 @@
|
|
import net.minecraft.util.datafix.DataFixer;
|
|
import net.minecraft.util.datafix.FixTypes;
|
|
import net.minecraft.util.datafix.walkers.ItemStackDataLists;
|
|
+import luohuayu.CatServer.tileentity.CBTileEntityLockableLoot;
|
|
+import java.util.List;
|
|
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
|
+import org.bukkit.entity.HumanEntity;
|
|
|
|
-public class TileEntityDispenser extends TileEntityLockableLoot implements IInventory
|
|
+//CraftBukkit start
|
|
+import java.util.List;
|
|
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
|
+import org.bukkit.entity.HumanEntity;
|
|
+// CraftBukkit end
|
|
+
|
|
+public class TileEntityDispenser extends CBTileEntityLockableLoot implements IInventory
|
|
{
|
|
private static final Random RNG = new Random();
|
|
private ItemStack[] stacks = new ItemStack[9];
|
|
protected String customName;
|
|
+ // CraftBukkit start - add fields and methods
|
|
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
|
+ private int maxStack = MAX_STACK;
|
|
+
|
|
+ public ItemStack[] getContents() {
|
|
+ return this.stacks;
|
|
+ }
|
|
+
|
|
+ public void onOpen(CraftHumanEntity who) {
|
|
+ transaction.add(who);
|
|
+ }
|
|
+
|
|
+ public void onClose(CraftHumanEntity who) {
|
|
+ transaction.remove(who);
|
|
+ }
|
|
+
|
|
+ public List<HumanEntity> getViewers() {
|
|
+ return transaction;
|
|
+ }
|
|
+
|
|
+ public void setMaxStackSize(int size) {
|
|
+ maxStack = size;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
|
|
public int getSizeInventory()
|
|
{
|
|
@@ -64,6 +98,7 @@
|
|
{
|
|
if (this.stacks[k] != null && RNG.nextInt(j++) == 0)
|
|
{
|
|
+ if (this.stacks[k].stackSize == 0) continue; // CraftBukkit
|
|
i = k;
|
|
}
|
|
}
|
|
@@ -177,7 +212,7 @@
|
|
|
|
public int getInventoryStackLimit()
|
|
{
|
|
- return 64;
|
|
+ return maxStack; // CraftBukkit
|
|
}
|
|
|
|
public boolean isUseableByPlayer(EntityPlayer player)
|