summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/TileEntityDispenser.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft/server/TileEntityDispenser.java')
-rw-r--r--src/main/java/net/minecraft/server/TileEntityDispenser.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/TileEntityDispenser.java b/src/main/java/net/minecraft/server/TileEntityDispenser.java
index faa9635c..842702f5 100644
--- a/src/main/java/net/minecraft/server/TileEntityDispenser.java
+++ b/src/main/java/net/minecraft/server/TileEntityDispenser.java
@@ -46,16 +46,24 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
}
}
- public ItemStack b() {
+ // CraftBukkit start
+ public int findDispenseSlot() {
int i = -1;
int j = 1;
for (int k = 0; k < this.items.length; ++k) {
- if (this.items[k] != null && this.b.nextInt(j) == 0) {
+ if (this.items[k] != null && this.items[k].count != 0 && this.b.nextInt(j) == 0) {
i = k;
++j;
}
}
+
+ return i;
+ }
+
+ public ItemStack b() {
+ int i = findDispenseSlot();
+ // CraftBukkit end
if (i >= 0) {
return this.a(i, 1);