Update CraftBukkit to Minecraft 1.5

This commit is contained in:
Travis Watkins
2013-03-13 17:33:27 -05:00
parent ba6e4c38cf
commit 83d29e461c
246 changed files with 8499 additions and 6759 deletions

View File

@@ -20,6 +20,8 @@ public class TileEntityChest extends TileEntity implements IInventory {
public float g;
public int h;
private int ticks;
private int r = -1;
private String s;
public TileEntityChest() {}
@@ -100,7 +102,15 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
public String getName() {
return "container.chest";
return this.c() ? this.s : "container.chest";
}
public boolean c() {
return this.s != null && this.s.length() > 0;
}
public void a(String s) {
this.s = s;
}
public void a(NBTTagCompound nbttagcompound) {
@@ -108,6 +118,9 @@ public class TileEntityChest extends TileEntity implements IInventory {
NBTTagList nbttaglist = nbttagcompound.getList("Items");
this.items = new ItemStack[this.getSize()];
if (nbttagcompound.hasKey("CustomName")) {
this.s = nbttagcompound.getString("CustomName");
}
for (int i = 0; i < nbttaglist.size(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
@@ -134,19 +147,22 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
nbttagcompound.set("Items", nbttaglist);
if (this.c()) {
nbttagcompound.setString("CustomName", this.s);
}
}
public int getMaxStackSize() {
return maxStack; // CraftBukkit
}
public boolean a_(EntityHuman entityhuman) {
public boolean a(EntityHuman entityhuman) {
if (this.world == null) return true; // CraftBukkit
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
}
public void h() {
super.h();
public void i() {
super.i();
this.a = false;
}
@@ -155,52 +171,52 @@ public class TileEntityChest extends TileEntity implements IInventory {
this.a = false;
} else if (this.a) {
switch (i) {
case 0:
if (this.e != tileentitychest) {
this.a = false;
}
break;
case 0:
if (this.e != tileentitychest) {
this.a = false;
}
break;
case 1:
if (this.d != tileentitychest) {
this.a = false;
}
break;
case 1:
if (this.d != tileentitychest) {
this.a = false;
}
break;
case 2:
if (this.b != tileentitychest) {
this.a = false;
}
break;
case 2:
if (this.b != tileentitychest) {
this.a = false;
}
break;
case 3:
if (this.c != tileentitychest) {
this.a = false;
}
case 3:
if (this.c != tileentitychest) {
this.a = false;
}
}
}
}
public void i() {
public void j() {
if (!this.a) {
this.a = true;
this.b = null;
this.c = null;
this.d = null;
this.e = null;
if (this.world.getTypeId(this.x - 1, this.y, this.z) == Block.CHEST.id) {
if (this.a(this.x - 1, this.y, this.z)) {
this.d = (TileEntityChest) this.world.getTileEntity(this.x - 1, this.y, this.z);
}
if (this.world.getTypeId(this.x + 1, this.y, this.z) == Block.CHEST.id) {
if (this.a(this.x + 1, this.y, this.z)) {
this.c = (TileEntityChest) this.world.getTileEntity(this.x + 1, this.y, this.z);
}
if (this.world.getTypeId(this.x, this.y, this.z - 1) == Block.CHEST.id) {
if (this.a(this.x, this.y, this.z - 1)) {
this.b = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z - 1);
}
if (this.world.getTypeId(this.x, this.y, this.z + 1) == Block.CHEST.id) {
if (this.a(this.x, this.y, this.z + 1)) {
this.e = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z + 1);
}
@@ -209,11 +225,11 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
if (this.e != null) {
this.e.a(this, 1);
this.e.a(this, 2);
}
if (this.c != null) {
this.c.a(this, 2);
this.c.a(this, 1);
}
if (this.d != null) {
@@ -222,10 +238,16 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
}
public void g() {
super.g();
private boolean a(int i, int j, int k) {
Block block = Block.byId[this.world.getTypeId(i, j, k)];
return block != null && block instanceof BlockChest ? ((BlockChest) block).a == this.l() : false;
}
public void h() {
super.h();
if (this.world == null) return; // CraftBukkit
this.i();
this.j();
++this.ticks;
float f;
@@ -239,9 +261,9 @@ public class TileEntityChest extends TileEntity implements IInventory {
EntityHuman entityhuman = (EntityHuman) iterator.next();
if (entityhuman.activeContainer instanceof ContainerChest) {
IInventory iinventory = ((ContainerChest) entityhuman.activeContainer).d();
IInventory iinventory = ((ContainerChest) entityhuman.activeContainer).e();
if (iinventory == this || iinventory instanceof InventoryLargeChest && ((InventoryLargeChest) iinventory).a(this)) {
if (iinventory == this || iinventory instanceof InventoryLargeChest && ((InventoryLargeChest) iinventory).a((IInventory) this)) {
++this.h;
}
}
@@ -303,27 +325,56 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
}
public void b(int i, int j) {
public boolean b(int i, int j) {
if (i == 1) {
this.h = j;
return true;
} else {
return super.b(i, j);
}
}
public void startOpen() {
if (this.h < 0) {
this.h = 0;
}
++this.h;
if (this.world == null) return; // CraftBukkit
this.world.playNote(this.x, this.y, this.z, Block.CHEST.id, 1, this.h);
this.world.playNote(this.x, this.y, this.z, this.q().id, 1, this.h);
this.world.applyPhysics(this.x, this.y, this.z, this.q().id);
this.world.applyPhysics(this.x, this.y - 1, this.z, this.q().id);
}
public void f() {
--this.h;
if (this.world == null) return; // CraftBukkit
this.world.playNote(this.x, this.y, this.z, Block.CHEST.id, 1, this.h);
public void g() {
if (this.q() != null && this.q() instanceof BlockChest) {
--this.h;
if (this.world == null) return; // CraftBukkit
this.world.playNote(this.x, this.y, this.z, this.q().id, 1, this.h);
this.world.applyPhysics(this.x, this.y, this.z, this.q().id);
this.world.applyPhysics(this.x, this.y - 1, this.z, this.q().id);
}
}
public boolean b(int i, ItemStack itemstack) {
return true;
}
public void w_() {
super.w_();
this.h();
this.i();
this.j();
}
public int l() {
if (this.r == -1) {
if (this.world == null || !(this.q() instanceof BlockChest)) {
return 0;
}
this.r = ((BlockChest) this.q()).a;
}
return this.r;
}
}