Paper/src/main/java/net/minecraft/server/InventoryCraftResult.java
Celtic Minstrel 5c8fd4995f [Bleeding] Implemented Inventory.{get,set}MaxStackSize(). Addresses BUKKIT-1076
- Custom inventories also respect this setting now.
2012-03-15 22:44:10 -04:00

92 Zeilen
2.0 KiB
Java

package net.minecraft.server;
// CraftBukkit start
import java.util.ArrayList;
import java.util.List;
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.entity.HumanEntity;
import org.bukkit.inventory.InventoryHolder;
// CraftBukkit end
public class InventoryCraftResult implements IInventory {
private ItemStack[] items = new ItemStack[1];
// CraftBukkit start
private int maxStack = MAX_STACK;
public ItemStack[] getContents() {
return this.items;
}
public InventoryHolder getOwner() {
return null; // Result slots don't get an owner
}
// Don't need a transaction; the InventoryCrafting keeps track of it for us
public void onOpen(CraftHumanEntity who) {}
public void onClose(CraftHumanEntity who) {}
public List<HumanEntity> getViewers() {
return new ArrayList<HumanEntity>();
}
public void setMaxStackSize(int size) {
maxStack = size;
}
// CraftBukkit end
public InventoryCraftResult() {}
public int getSize() {
return 1;
}
public ItemStack getItem(int i) {
return this.items[i];
}
public String getName() {
return "Result";
}
public ItemStack splitStack(int i, int j) {
if (this.items[i] != null) {
ItemStack itemstack = this.items[i];
this.items[i] = null;
return itemstack;
} else {
return null;
}
}
public ItemStack splitWithoutUpdate(int i) {
if (this.items[i] != null) {
ItemStack itemstack = this.items[i];
this.items[i] = null;
return itemstack;
} else {
return null;
}
}
public void setItem(int i, ItemStack itemstack) {
this.items[i] = itemstack;
}
public int getMaxStackSize() {
return maxStack; // CraftBukkit
}
public void update() {}
public boolean a(EntityHuman entityhuman) {
return true;
}
public void f() {}
public void g() {}
}