mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-10 17:52:02 -07:00
Update for 1.4_00_01 -- if you bypassed Bukkit, you will most likely break.
This commit is contained in:
@@ -2,40 +2,40 @@ package net.minecraft.server;
|
||||
|
||||
public class TileEntityChest extends TileEntity implements IInventory {
|
||||
|
||||
private ItemStack[] a = new ItemStack[27]; // CraftBukkit
|
||||
private ItemStack[] items = new ItemStack[27]; // CraftBukkit
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
return a;
|
||||
return items;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public TileEntityChest() {}
|
||||
|
||||
public int q_() {
|
||||
public int getSize() {
|
||||
return 27;
|
||||
}
|
||||
|
||||
public ItemStack c_(int i) {
|
||||
return this.a[i];
|
||||
public ItemStack getItem(int i) {
|
||||
return this.items[i];
|
||||
}
|
||||
|
||||
public ItemStack a(int i, int j) {
|
||||
if (this.a[i] != null) {
|
||||
if (this.items[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
if (this.a[i].count <= j) {
|
||||
itemstack = this.a[i];
|
||||
this.a[i] = null;
|
||||
this.i();
|
||||
if (this.items[i].count <= j) {
|
||||
itemstack = this.items[i];
|
||||
this.items[i] = null;
|
||||
this.update();
|
||||
return itemstack;
|
||||
} else {
|
||||
itemstack = this.a[i].a(j);
|
||||
if (this.a[i].count == 0) {
|
||||
this.a[i] = null;
|
||||
itemstack = this.items[i].a(j);
|
||||
if (this.items[i].count == 0) {
|
||||
this.items[i] = null;
|
||||
}
|
||||
|
||||
this.i();
|
||||
this.update();
|
||||
return itemstack;
|
||||
}
|
||||
} else {
|
||||
@@ -43,16 +43,16 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
this.a[i] = itemstack;
|
||||
if (itemstack != null && itemstack.count > this.r_()) {
|
||||
itemstack.count = this.r_();
|
||||
public void setItem(int i, ItemStack itemstack) {
|
||||
this.items[i] = itemstack;
|
||||
if (itemstack != null && itemstack.count > this.getMaxStackSize()) {
|
||||
itemstack.count = this.getMaxStackSize();
|
||||
}
|
||||
|
||||
this.i();
|
||||
this.update();
|
||||
}
|
||||
|
||||
public String c() {
|
||||
public String getName() {
|
||||
return "Chest";
|
||||
}
|
||||
|
||||
@@ -60,14 +60,14 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
super.a(nbttagcompound);
|
||||
NBTTagList nbttaglist = nbttagcompound.l("Items");
|
||||
|
||||
this.a = new ItemStack[this.q_()];
|
||||
this.items = new ItemStack[this.getSize()];
|
||||
|
||||
for (int i = 0; i < nbttaglist.c(); ++i) {
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
|
||||
int j = nbttagcompound1.c("Slot") & 255;
|
||||
|
||||
if (j >= 0 && j < this.a.length) {
|
||||
this.a[j] = new ItemStack(nbttagcompound1);
|
||||
if (j >= 0 && j < this.items.length) {
|
||||
this.items[j] = new ItemStack(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,12 +76,12 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
super.b(nbttagcompound);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.a.length; ++i) {
|
||||
if (this.a[i] != null) {
|
||||
for (int i = 0; i < this.items.length; ++i) {
|
||||
if (this.items[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
nbttagcompound1.a("Slot", (byte) i);
|
||||
this.a[i].a(nbttagcompound1);
|
||||
this.items[i].a(nbttagcompound1);
|
||||
nbttaglist.a((NBTBase) nbttagcompound1);
|
||||
}
|
||||
}
|
||||
@@ -89,11 +89,11 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
nbttagcompound.a("Items", (NBTBase) nbttaglist);
|
||||
}
|
||||
|
||||
public int r_() {
|
||||
public int getMaxStackSize() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
return this.d.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D;
|
||||
return this.world.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user