Update CraftBukkit to Minecraft 1.7.2
This commit is contained in:
@@ -12,13 +12,13 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
|
||||
private ItemStack[] items = new ItemStack[27]; // CraftBukkit - 36 -> 27
|
||||
public boolean a;
|
||||
public TileEntityChest b;
|
||||
public TileEntityChest c;
|
||||
public TileEntityChest d;
|
||||
public TileEntityChest e;
|
||||
public float f;
|
||||
public float g;
|
||||
public int h;
|
||||
public TileEntityChest i;
|
||||
public TileEntityChest j;
|
||||
public TileEntityChest k;
|
||||
public TileEntityChest l;
|
||||
public float m;
|
||||
public float n;
|
||||
public int o;
|
||||
private int ticks;
|
||||
private int r = -1;
|
||||
private String s;
|
||||
@@ -101,11 +101,11 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
this.update();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.c() ? this.s : "container.chest";
|
||||
public String getInventoryName() {
|
||||
return this.k_() ? this.s : "container.chest";
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
public boolean k_() {
|
||||
return this.s != null && this.s.length() > 0;
|
||||
}
|
||||
|
||||
@@ -115,15 +115,15 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
NBTTagList nbttaglist = nbttagcompound.getList("Items");
|
||||
NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);
|
||||
|
||||
this.items = new ItemStack[this.getSize()];
|
||||
if (nbttagcompound.hasKey("CustomName")) {
|
||||
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
|
||||
this.s = nbttagcompound.getString("CustomName");
|
||||
}
|
||||
|
||||
for (int i = 0; i < nbttaglist.size(); ++i) {
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
|
||||
int j = nbttagcompound1.getByte("Slot") & 255;
|
||||
|
||||
if (j >= 0 && j < this.items.length) {
|
||||
@@ -147,7 +147,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
nbttagcompound.set("Items", nbttaglist);
|
||||
if (this.c()) {
|
||||
if (this.k_()) {
|
||||
nbttagcompound.setString("CustomName", this.s);
|
||||
}
|
||||
}
|
||||
@@ -161,8 +161,8 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
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 i() {
|
||||
super.i();
|
||||
public void u() {
|
||||
super.u();
|
||||
this.a = false;
|
||||
}
|
||||
|
||||
@@ -172,87 +172,87 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
} else if (this.a) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
if (this.e != tileentitychest) {
|
||||
if (this.l != tileentitychest) {
|
||||
this.a = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (this.d != tileentitychest) {
|
||||
if (this.k != tileentitychest) {
|
||||
this.a = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (this.b != tileentitychest) {
|
||||
if (this.i != tileentitychest) {
|
||||
this.a = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (this.c != tileentitychest) {
|
||||
if (this.j != tileentitychest) {
|
||||
this.a = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void j() {
|
||||
public void i() {
|
||||
if (!this.a) {
|
||||
this.a = true;
|
||||
this.b = null;
|
||||
this.c = null;
|
||||
this.d = null;
|
||||
this.e = null;
|
||||
this.i = null;
|
||||
this.j = null;
|
||||
this.k = null;
|
||||
this.l = null;
|
||||
if (this.a(this.x - 1, this.y, this.z)) {
|
||||
this.d = (TileEntityChest) this.world.getTileEntity(this.x - 1, this.y, this.z);
|
||||
this.k = (TileEntityChest) this.world.getTileEntity(this.x - 1, this.y, this.z);
|
||||
}
|
||||
|
||||
if (this.a(this.x + 1, this.y, this.z)) {
|
||||
this.c = (TileEntityChest) this.world.getTileEntity(this.x + 1, this.y, this.z);
|
||||
this.j = (TileEntityChest) this.world.getTileEntity(this.x + 1, this.y, this.z);
|
||||
}
|
||||
|
||||
if (this.a(this.x, this.y, this.z - 1)) {
|
||||
this.b = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z - 1);
|
||||
this.i = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z - 1);
|
||||
}
|
||||
|
||||
if (this.a(this.x, this.y, this.z + 1)) {
|
||||
this.e = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z + 1);
|
||||
this.l = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z + 1);
|
||||
}
|
||||
|
||||
if (this.b != null) {
|
||||
this.b.a(this, 0);
|
||||
if (this.i != null) {
|
||||
this.i.a(this, 0);
|
||||
}
|
||||
|
||||
if (this.e != null) {
|
||||
this.e.a(this, 2);
|
||||
if (this.l != null) {
|
||||
this.l.a(this, 2);
|
||||
}
|
||||
|
||||
if (this.c != null) {
|
||||
this.c.a(this, 1);
|
||||
if (this.j != null) {
|
||||
this.j.a(this, 1);
|
||||
}
|
||||
|
||||
if (this.d != null) {
|
||||
this.d.a(this, 3);
|
||||
if (this.k != null) {
|
||||
this.k.a(this, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean a(int i, int j, int k) {
|
||||
Block block = Block.byId[this.world.getTypeId(i, j, k)];
|
||||
Block block = this.world.getType(i, j, k);
|
||||
|
||||
return block != null && block instanceof BlockChest ? ((BlockChest) block).a == this.l() : false;
|
||||
return block instanceof BlockChest && ((BlockChest) block).a == this.j();
|
||||
}
|
||||
|
||||
public void h() {
|
||||
super.h();
|
||||
if (this.world == null) return; // CraftBukkit
|
||||
this.j();
|
||||
this.i();
|
||||
++this.ticks;
|
||||
float f;
|
||||
|
||||
if (!this.world.isStatic && this.h != 0 && (this.ticks + this.x + this.y + this.z) % 200 == 0) {
|
||||
this.h = 0;
|
||||
if (!this.world.isStatic && this.o != 0 && (this.ticks + this.x + this.y + this.z) % 200 == 0) {
|
||||
this.o = 0;
|
||||
f = 5.0F;
|
||||
List list = this.world.a(EntityHuman.class, AxisAlignedBB.a().a((double) ((float) this.x - f), (double) ((float) this.y - f), (double) ((float) this.z - f), (double) ((float) (this.x + 1) + f), (double) ((float) (this.y + 1) + f), (double) ((float) (this.z + 1) + f)));
|
||||
Iterator iterator = list.iterator();
|
||||
@@ -264,90 +264,90 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
IInventory iinventory = ((ContainerChest) entityhuman.activeContainer).e();
|
||||
|
||||
if (iinventory == this || iinventory instanceof InventoryLargeChest && ((InventoryLargeChest) iinventory).a((IInventory) this)) {
|
||||
++this.h;
|
||||
++this.o;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.g = this.f;
|
||||
this.n = this.m;
|
||||
f = 0.1F;
|
||||
double d0;
|
||||
|
||||
if (this.h > 0 && this.f == 0.0F && this.b == null && this.d == null) {
|
||||
if (this.o > 0 && this.m == 0.0F && this.i == null && this.k == null) {
|
||||
double d1 = (double) this.x + 0.5D;
|
||||
|
||||
d0 = (double) this.z + 0.5D;
|
||||
if (this.e != null) {
|
||||
if (this.l != null) {
|
||||
d0 += 0.5D;
|
||||
}
|
||||
|
||||
if (this.c != null) {
|
||||
if (this.j != null) {
|
||||
d1 += 0.5D;
|
||||
}
|
||||
|
||||
this.world.makeSound(d1, (double) this.y + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
|
||||
}
|
||||
|
||||
if (this.h == 0 && this.f > 0.0F || this.h > 0 && this.f < 1.0F) {
|
||||
float f1 = this.f;
|
||||
if (this.o == 0 && this.m > 0.0F || this.o > 0 && this.m < 1.0F) {
|
||||
float f1 = this.m;
|
||||
|
||||
if (this.h > 0) {
|
||||
this.f += f;
|
||||
if (this.o > 0) {
|
||||
this.m += f;
|
||||
} else {
|
||||
this.f -= f;
|
||||
this.m -= f;
|
||||
}
|
||||
|
||||
if (this.f > 1.0F) {
|
||||
this.f = 1.0F;
|
||||
if (this.m > 1.0F) {
|
||||
this.m = 1.0F;
|
||||
}
|
||||
|
||||
float f2 = 0.5F;
|
||||
|
||||
if (this.f < f2 && f1 >= f2 && this.b == null && this.d == null) {
|
||||
if (this.m < f2 && f1 >= f2 && this.i == null && this.k == null) {
|
||||
d0 = (double) this.x + 0.5D;
|
||||
double d2 = (double) this.z + 0.5D;
|
||||
|
||||
if (this.e != null) {
|
||||
if (this.l != null) {
|
||||
d2 += 0.5D;
|
||||
}
|
||||
|
||||
if (this.c != null) {
|
||||
if (this.j != null) {
|
||||
d0 += 0.5D;
|
||||
}
|
||||
|
||||
this.world.makeSound(d0, (double) this.y + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
|
||||
}
|
||||
|
||||
if (this.f < 0.0F) {
|
||||
this.f = 0.0F;
|
||||
if (this.m < 0.0F) {
|
||||
this.m = 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b(int i, int j) {
|
||||
public boolean c(int i, int j) {
|
||||
if (i == 1) {
|
||||
this.h = j;
|
||||
this.o = j;
|
||||
return true;
|
||||
} else {
|
||||
return super.b(i, j);
|
||||
return super.c(i, j);
|
||||
}
|
||||
}
|
||||
|
||||
public void startOpen() {
|
||||
if (this.h < 0) {
|
||||
this.h = 0;
|
||||
if (this.o < 0) {
|
||||
this.o = 0;
|
||||
}
|
||||
|
||||
int oldPower = Math.max(0, Math.min(15, this.h)); // CraftBukkit - Get power before new viewer is added
|
||||
int oldPower = Math.max(0, Math.min(15, this.o)); // CraftBukkit - Get power before new viewer is added
|
||||
|
||||
++this.h;
|
||||
++this.o;
|
||||
if (this.world == null) return; // CraftBukkit
|
||||
this.world.playNote(this.x, this.y, this.z, this.q().id, 1, this.h);
|
||||
this.world.playNote(this.x, this.y, this.z, this.q(), 1, this.o);
|
||||
|
||||
// CraftBukkit start - Call redstone event
|
||||
if (this.q().id == Block.TRAPPED_CHEST.id) {
|
||||
int newPower = Math.max(0, Math.min(15, this.h));
|
||||
if (this.q() == Blocks.TRAPPED_CHEST) {
|
||||
int newPower = Math.max(0, Math.min(15, this.o));
|
||||
|
||||
if (oldPower != newPower) {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, this.x, this.y, this.z, oldPower, newPower);
|
||||
@@ -355,21 +355,21 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
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);
|
||||
this.world.applyPhysics(this.x, this.y, this.z, this.q());
|
||||
this.world.applyPhysics(this.x, this.y - 1, this.z, this.q());
|
||||
}
|
||||
|
||||
public void g() {
|
||||
if (this.q() != null && this.q() instanceof BlockChest) {
|
||||
int oldPower = Math.max(0, Math.min(15, this.h)); // CraftBukkit - Get power before new viewer is added
|
||||
public void l_() {
|
||||
if (this.q() instanceof BlockChest) {
|
||||
int oldPower = Math.max(0, Math.min(15, this.o)); // CraftBukkit - Get power before new viewer is added
|
||||
|
||||
--this.h;
|
||||
--this.o;
|
||||
if (this.world == null) return; // CraftBukkit
|
||||
this.world.playNote(this.x, this.y, this.z, this.q().id, 1, this.h);
|
||||
this.world.playNote(this.x, this.y, this.z, this.q(), 1, this.o);
|
||||
|
||||
// CraftBukkit start - Call redstone event
|
||||
if (this.q().id == Block.TRAPPED_CHEST.id) {
|
||||
int newPower = Math.max(0, Math.min(15, this.h));
|
||||
if (this.q() == Blocks.TRAPPED_CHEST) {
|
||||
int newPower = Math.max(0, Math.min(15, this.o));
|
||||
|
||||
if (oldPower != newPower) {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, this.x, this.y, this.z, oldPower, newPower);
|
||||
@@ -377,8 +377,8 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
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);
|
||||
this.world.applyPhysics(this.x, this.y, this.z, this.q());
|
||||
this.world.applyPhysics(this.x, this.y - 1, this.z, this.q());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,13 +386,13 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void w_() {
|
||||
super.w_();
|
||||
public void s() {
|
||||
super.s();
|
||||
this.u();
|
||||
this.i();
|
||||
this.j();
|
||||
}
|
||||
|
||||
public int l() {
|
||||
public int j() {
|
||||
if (this.r == -1) {
|
||||
if (this.world == null || !(this.q() instanceof BlockChest)) {
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user