From df69047324abc54f5d5b8d069bb69b1061b20cce Mon Sep 17 00:00:00 2001 From: Erik Broes Date: Sat, 29 Jan 2011 22:50:29 +0100 Subject: Port to new mc-dev format. --- .../net/minecraft/server/TileEntityFurnace.java | 198 +++++++++------------ 1 file changed, 89 insertions(+), 109 deletions(-) (limited to 'src/main/java/net/minecraft/server/TileEntityFurnace.java') diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java index 62e51c13..4111ae6f 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java @@ -2,10 +2,10 @@ package net.minecraft.server; public class TileEntityFurnace extends TileEntity implements IInventory { - private ItemStack h[]; - public int e; - public int f; - public int g; + private ItemStack[] h = new ItemStack[3]; + public int e = 0; + public int f = 0; + public int g = 0; // CraftBukkit start public ItemStack[] getContents() { @@ -13,44 +13,41 @@ public class TileEntityFurnace extends TileEntity implements IInventory { } // CraftBukkit end - public TileEntityFurnace() { - h = new ItemStack[3]; - e = 0; - f = 0; - g = 0; - } + public TileEntityFurnace() {} public int h_() { - return h.length; + return this.h.length; } - public ItemStack a(int j) { - return h[j]; + public ItemStack a(int i) { + return this.h[i]; } - public ItemStack b(int j, int k) { - if (h[j] != null) { - if (h[j].a <= k) { - ItemStack itemstack = h[j]; + public ItemStack b(int i, int j) { + if (this.h[i] != null) { + ItemStack itemstack; - h[j] = null; + if (this.h[i].count <= j) { + itemstack = this.h[i]; + this.h[i] = null; return itemstack; - } - ItemStack itemstack1 = h[j].a(k); + } else { + itemstack = this.h[i].a(j); + if (this.h[i].count == 0) { + this.h[i] = null; + } - if (h[j].a == 0) { - h[j] = null; + return itemstack; } - return itemstack1; } else { return null; } } - public void a(int j, ItemStack itemstack) { - h[j] = itemstack; - if (itemstack != null && itemstack.a > c()) { - itemstack.a = c(); + public void a(int i, ItemStack itemstack) { + this.h[i] = itemstack; + if (itemstack != null && itemstack.count > this.c()) { + itemstack.count = this.c(); } } @@ -62,38 +59,39 @@ public class TileEntityFurnace extends TileEntity implements IInventory { super.a(nbttagcompound); NBTTagList nbttaglist = nbttagcompound.k("Items"); - h = new ItemStack[h_()]; - for (int j = 0; j < nbttaglist.b(); j++) { - NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(j); - byte byte0 = nbttagcompound1.b("Slot"); + this.h = new ItemStack[this.h_()]; + + for (int i = 0; i < nbttaglist.b(); ++i) { + NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); + byte b0 = nbttagcompound1.b("Slot"); - if (byte0 >= 0 && byte0 < h.length) { - h[byte0] = new ItemStack(nbttagcompound1); + if (b0 >= 0 && b0 < this.h.length) { + this.h[b0] = new ItemStack(nbttagcompound1); } } - e = ((int) (nbttagcompound.c("BurnTime"))); - g = ((int) (nbttagcompound.c("CookTime"))); - f = a(h[1]); + this.e = nbttagcompound.c("BurnTime"); + this.g = nbttagcompound.c("CookTime"); + this.f = this.a(this.h[1]); } public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.a("BurnTime", (short) e); - nbttagcompound.a("CookTime", (short) g); + nbttagcompound.a("BurnTime", (short) this.e); + nbttagcompound.a("CookTime", (short) this.g); NBTTagList nbttaglist = new NBTTagList(); - for (int j = 0; j < h.length; j++) { - if (h[j] != null) { + for (int i = 0; i < this.h.length; ++i) { + if (this.h[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.a("Slot", (byte) j); - h[j].a(nbttagcompound1); - nbttaglist.a(((NBTBase) (nbttagcompound1))); + nbttagcompound1.a("Slot", (byte) i); + this.h[i].a(nbttagcompound1); + nbttaglist.a((NBTBase) nbttagcompound1); } } - nbttagcompound.a("Items", ((NBTBase) (nbttaglist))); + nbttagcompound.a("Items", (NBTBase) nbttaglist); } public int c() { @@ -101,109 +99,91 @@ public class TileEntityFurnace extends TileEntity implements IInventory { } public boolean e() { - return e > 0; + return this.e > 0; } public void f() { - boolean flag = e > 0; + boolean flag = this.e > 0; boolean flag1 = false; - if (e > 0) { - e--; + if (this.e > 0) { + --this.e; } - if (!a.z) { - if (e == 0 && i()) { - f = e = a(h[1]); - if (e > 0) { + + if (!this.a.isStatic) { + if (this.e == 0 && this.i()) { + this.f = this.e = this.a(this.h[1]); + if (this.e > 0) { flag1 = true; - if (h[1] != null) { - h[1].a--; - if (h[1].a == 0) { - h[1] = null; + if (this.h[1] != null) { + --this.h[1].count; + if (this.h[1].count == 0) { + this.h[1] = null; } } } } - if (e() && i()) { - g++; - if (g == 200) { - g = 0; - h(); + + if (this.e() && this.i()) { + ++this.g; + if (this.g == 200) { + this.g = 0; + this.h(); flag1 = true; } } else { - g = 0; + this.g = 0; } - if (flag != (e > 0)) { + + if (flag != this.e > 0) { flag1 = true; - BlockFurnace.a(e > 0, a, b, c, d); + BlockFurnace.a(this.e > 0, this.a, this.b, this.c, this.d); } } + if (flag1) { - d(); + this.d(); } } private boolean i() { - if (h[0] == null) { + if (this.h[0] == null) { return false; - } - ItemStack itemstack = FurnaceRecipes.a().a(h[0].a().ba); + } else { + ItemStack itemstack = FurnaceRecipes.a().a(this.h[0].a().id); - if (itemstack == null) { - return false; - } - if (h[2] == null) { - return true; + return itemstack == null ? false : (this.h[2] == null ? true : (!this.h[2].a(itemstack) ? false : (this.h[2].count < this.c() && this.h[2].count < this.h[2].b() ? true : this.h[2].count < itemstack.b()))); } - if (!h[2].a(itemstack)) { - return false; - } - if (h[2].a < c() && h[2].a < h[2].b()) { - return true; - } - return h[2].a < itemstack.b(); } public void h() { - if (!i()) { - return; - } - ItemStack itemstack = FurnaceRecipes.a().a(h[0].a().ba); + if (this.i()) { + ItemStack itemstack = FurnaceRecipes.a().a(this.h[0].a().id); - if (h[2] == null) { - h[2] = itemstack.j(); - } else if (h[2].c == itemstack.c) { - h[2].a++; - } - h[0].a--; - if (h[0].a <= 0) { - h[0] = null; + if (this.h[2] == null) { + this.h[2] = itemstack.j(); + } else if (this.h[2].id == itemstack.id) { + ++this.h[2].count; + } + + --this.h[0].count; + if (this.h[0].count <= 0) { + this.h[0] = null; + } } } private int a(ItemStack itemstack) { if (itemstack == null) { return 0; - } - int j = itemstack.a().ba; + } else { + int i = itemstack.a().id; - if (j < 256 && Block.m[j].bt == Material.c) { - return 300; - } - if (j == Item.B.ba) { - return 100; + return i < 256 && Block.byId[i].material == Material.WOOD ? 300 : (i == Item.STICK.id ? 100 : (i == Item.COAL.id ? 1600 : (i == Item.LAVA_BUCKET.id ? 20000 : 0))); } - if (j == Item.k.ba) { - return 1600; - } - return j != Item.aw.ba ? 0 : 20000; } - public boolean a_(EntityPlayer entityplayer) { - if (a.m(b, c, d) != this) { - return false; - } - return entityplayer.d((double) b + 0.5D, (double) c + 0.5D, (double) d + 0.5D) <= 64D; + public boolean a_(EntityHuman entityhuman) { + return this.a.getTileEntity(this.b, this.c, this.d) != this ? false : entityhuman.d((double) this.b + 0.5D, (double) this.c + 0.5D, (double) this.d + 0.5D) <= 64.0D; } -} \ No newline at end of file +} -- cgit v1.2.3