2011-01-14 20:44:11 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
public class Slot {
|
|
|
|
|
2011-05-14 16:29:42 +02:00
|
|
|
public final int index; // CraftBukkit - private -> public
|
2011-09-15 02:23:52 +02:00
|
|
|
public final IInventory inventory;
|
|
|
|
public int d;
|
2011-11-20 09:01:14 +01:00
|
|
|
public int e;
|
2012-07-29 09:33:13 +02:00
|
|
|
public int f;
|
2011-01-14 20:44:11 +01:00
|
|
|
|
|
|
|
public Slot(IInventory iinventory, int i, int j, int k) {
|
2011-04-20 19:05:14 +02:00
|
|
|
this.inventory = iinventory;
|
|
|
|
this.index = i;
|
2012-07-29 09:33:13 +02:00
|
|
|
this.e = j;
|
|
|
|
this.f = k;
|
2011-01-14 20:44:11 +01:00
|
|
|
}
|
|
|
|
|
2012-03-01 11:49:23 +01:00
|
|
|
public void a(ItemStack itemstack, ItemStack itemstack1) {
|
|
|
|
if (itemstack != null && itemstack1 != null) {
|
|
|
|
if (itemstack.id == itemstack1.id) {
|
|
|
|
int i = itemstack1.count - itemstack.count;
|
|
|
|
|
|
|
|
if (i > 0) {
|
|
|
|
this.a(itemstack, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void a(ItemStack itemstack, int i) {}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
protected void c(ItemStack itemstack) {}
|
2012-03-01 11:49:23 +01:00
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
public void b(ItemStack itemstack) {
|
|
|
|
this.e();
|
2011-01-14 20:44:11 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
public boolean isAllowed(ItemStack itemstack) {
|
2011-01-14 20:44:11 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
public ItemStack getItem() {
|
|
|
|
return this.inventory.getItem(this.index);
|
2011-01-14 20:44:11 +01:00
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
public boolean d() {
|
2011-04-20 22:47:26 +02:00
|
|
|
return this.getItem() != null;
|
|
|
|
}
|
|
|
|
|
2012-02-29 22:31:04 +01:00
|
|
|
public void set(ItemStack itemstack) {
|
2011-04-20 19:05:14 +02:00
|
|
|
this.inventory.setItem(this.index, itemstack);
|
2012-07-29 09:33:13 +02:00
|
|
|
this.e();
|
2011-01-14 20:44:11 +01:00
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
public void e() {
|
2011-04-20 19:05:14 +02:00
|
|
|
this.inventory.update();
|
2011-01-14 20:44:11 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
public int a() {
|
2011-04-20 19:05:14 +02:00
|
|
|
return this.inventory.getMaxStackSize();
|
2011-01-14 20:44:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public ItemStack a(int i) {
|
2011-06-27 00:25:01 +02:00
|
|
|
return this.inventory.splitStack(this.index, i);
|
2011-01-14 20:44:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean a(IInventory iinventory, int i) {
|
2011-04-20 19:05:14 +02:00
|
|
|
return iinventory == this.inventory && i == this.index;
|
2011-01-14 20:44:11 +01:00
|
|
|
}
|
|
|
|
}
|