Update CraftBukkit to Minecraft 1.3.1

This commit is contained in:
feildmaster
2012-07-29 02:33:13 -05:00
committed by Travis Watkins
parent 08e2923bd4
commit a43d621c01
240 changed files with 10763 additions and 9150 deletions

View File

@@ -8,7 +8,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerChest extends Container {
public IInventory container; // CraftBukkit - private->public
private int b;
private int f;
// CraftBukkit start
private CraftInventoryView bukkitEntity = null;
private PlayerInventory player;
@@ -17,6 +17,7 @@ public class ContainerChest extends Container {
if (bukkitEntity != null) {
return bukkitEntity;
}
CraftInventory inventory;
if (this.container instanceof PlayerInventory) {
inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryPlayer((PlayerInventory) this.container);
@@ -25,6 +26,7 @@ public class ContainerChest extends Container {
} else {
inventory = new CraftInventory(this.container);
}
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity;
}
@@ -32,9 +34,9 @@ public class ContainerChest extends Container {
public ContainerChest(IInventory iinventory, IInventory iinventory1) {
this.container = iinventory1;
this.b = iinventory1.getSize() / 9;
iinventory1.f();
int i = (this.b - 4) * 18;
this.f = iinventory1.getSize() / 9;
iinventory1.startOpen();
int i = (this.f - 4) * 18;
// CraftBukkit start - save player
// TODO: Should we check to make sure it really is an InventoryPlayer?
this.player = (PlayerInventory)iinventory;
@@ -43,7 +45,7 @@ public class ContainerChest extends Container {
int j;
int k;
for (j = 0; j < this.b; ++j) {
for (j = 0; j < this.f; ++j) {
for (k = 0; k < 9; ++k) {
this.a(new Slot(iinventory1, k + j * 9, 8 + k * 18, 18 + j * 18));
}
@@ -60,31 +62,31 @@ public class ContainerChest extends Container {
}
}
public boolean b(EntityHuman entityhuman) {
public boolean c(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.container.a(entityhuman);
}
public ItemStack a(int i) {
public ItemStack b(int i) {
ItemStack itemstack = null;
Slot slot = (Slot) this.e.get(i);
Slot slot = (Slot) this.b.get(i);
if (slot != null && slot.c()) {
if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
if (i < this.b * 9) {
if (!this.a(itemstack1, this.b * 9, this.e.size(), true)) {
if (i < this.f * 9) {
if (!this.a(itemstack1, this.f * 9, this.b.size(), true)) {
return null;
}
} else if (!this.a(itemstack1, 0, this.b * 9, false)) {
} else if (!this.a(itemstack1, 0, this.f * 9, false)) {
return null;
}
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
slot.d();
slot.e();
}
}
@@ -93,6 +95,6 @@ public class ContainerChest extends Container {
public void a(EntityHuman entityhuman) {
super.a(entityhuman);
this.container.g();
this.container.f();
}
}