Update CraftBukkit to Minecraft 1.5
This commit is contained in:
@@ -12,7 +12,8 @@ import org.bukkit.entity.HumanEntity;
|
||||
public class TileEntityDispenser extends TileEntity implements IInventory {
|
||||
|
||||
private ItemStack[] items = new ItemStack[9];
|
||||
private Random b = new Random();
|
||||
private Random c = new Random();
|
||||
protected String a;
|
||||
|
||||
// CraftBukkit start
|
||||
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||
@@ -83,12 +84,12 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public int i() {
|
||||
public int j() {
|
||||
int i = -1;
|
||||
int j = 1;
|
||||
|
||||
for (int k = 0; k < this.items.length; ++k) {
|
||||
if (this.items[k] != null && this.b.nextInt(j++) == 0) {
|
||||
if (this.items[k] != null && this.c.nextInt(j++) == 0) {
|
||||
if (this.items[k].count == 0) continue; // CraftBukkit
|
||||
i = k;
|
||||
}
|
||||
@@ -109,7 +110,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
|
||||
public int addItem(ItemStack itemstack) {
|
||||
for (int i = 0; i < this.items.length; ++i) {
|
||||
if (this.items[i] == null || this.items[i].id == 0) {
|
||||
this.items[i] = itemstack;
|
||||
this.setItem(i, itemstack);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -118,7 +119,15 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "container.dispenser";
|
||||
return this.c() ? this.a : "container.dispenser";
|
||||
}
|
||||
|
||||
public void a(String s) {
|
||||
this.a = s;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return this.a != null;
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
@@ -135,6 +144,10 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
|
||||
this.items[j] = ItemStack.createStack(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKey("CustomName")) {
|
||||
this.a = nbttagcompound.getString("CustomName");
|
||||
}
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
@@ -152,17 +165,24 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
nbttagcompound.set("Items", nbttaglist);
|
||||
if (this.c()) {
|
||||
nbttagcompound.setString("CustomName", this.a);
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxStackSize() {
|
||||
return maxStack; // CraftBukkit
|
||||
}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
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 startOpen() {}
|
||||
|
||||
public void f() {}
|
||||
public void g() {}
|
||||
|
||||
public boolean b(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user