Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TileEntityMicrowave extends ll
- implements jc
- {
- private gz[] microwaveItemStacks = new gz[3];
- public int microwaveBurnTime = 0;
- public int b = 0;
- public int microwaveCookTime = 0;
- public int cookTime = 125;
- public int a() {
- return microwaveItemStacks.length;
- }
- public gz c_(int paramInt) {
- return microwaveItemStacks[paramInt];
- }
- public gz a(int paramInt1, int paramInt2) {
- if (microwaveItemStacks[paramInt1] != null) {
- if (microwaveItemStacks[paramInt1].a <= paramInt2) {
- gz localgz = microwaveItemStacks[paramInt1];
- microwaveItemStacks[paramInt1] = null;
- return localgz;
- }
- gz localgz = microwaveItemStacks[paramInt1].a(paramInt2);
- if (microwaveItemStacks[paramInt1].a == 0) microwaveItemStacks[paramInt1] = null;
- return localgz;
- }
- return null;
- }
- public void a(int paramInt, gz paramgz) {
- microwaveItemStacks[paramInt] = paramgz;
- if ((paramgz != null) && (paramgz.a > d())) paramgz.a = d();
- }
- public String c()
- {
- return "Microwave";
- }
- public void a(ks paramks)
- {
- super.a(paramks);
- oo localoo = paramks.l("Items");
- microwaveItemStacks = new gz[a()];
- for (int i = 0; i < localoo.c(); i++) {
- ks localks = (ks)localoo.a(i);
- int j = localks.c("Slot");
- if ((j < 0) || (j >= microwaveItemStacks.length)) continue; microwaveItemStacks[j] = new gz(localks);
- }
- microwaveBurnTime = paramks.d("BurnTime");
- microwaveCookTime = paramks.d("CookTime");
- this.b = a(microwaveItemStacks[1]);
- }
- public void b(ks paramks) {
- super.b(paramks);
- paramks.a("BurnTime", (short)microwaveBurnTime);
- paramks.a("CookTime", (short)microwaveCookTime);
- oo localoo = new oo();
- for (int i = 0; i < microwaveItemStacks.length; i++) {
- if (microwaveItemStacks[i] != null) {
- ks localks = new ks();
- localks.a("Slot", (byte)i);
- microwaveItemStacks[i].a(localks);
- localoo.a(localks);
- }
- }
- paramks.a("Items", localoo);
- }
- public int d() {
- return 64;
- }
- public int b(int paramInt) {
- return microwaveCookTime * paramInt / cookTime;
- }
- public int c(int paramInt) {
- if (this.b == 0) this.b = cookTime;
- return microwaveBurnTime * paramInt / this.b;
- }
- public boolean b() {
- return microwaveBurnTime > 0;
- }
- public void m_() {
- int i = microwaveBurnTime > 0 ? 1 : 0;
- int j = 0;
- if (microwaveBurnTime > 0) {
- microwaveBurnTime -= 1;
- }
- if (!this.d.t) {
- if ((microwaveBurnTime == 0) && (i())) {
- this.b = (microwaveBurnTime = a(microwaveItemStacks[1]));
- if (microwaveBurnTime > 0) {
- j = 1;
- if (microwaveItemStacks[1] != null) {
- if (microwaveItemStacks[1].a().i())
- microwaveItemStacks[1] = new gz(microwaveItemStacks[1].a().h());
- else
- microwaveItemStacks[1].a -= 1;
- if (microwaveItemStacks[1].a == 0) microwaveItemStacks[1] = null;
- }
- }
- }
- if ((b()) && (i())) {
- microwaveCookTime += 1;
- if (microwaveCookTime == cookTime) {
- microwaveCookTime = 0;
- g();
- j = 1;
- }
- } else {
- microwaveCookTime = 0;
- }
- if (i != (microwaveBurnTime > 0 ? 1 : 0)) {
- j = 1;
- oz.a(microwaveBurnTime > 0, this.d, this.e, this.f, this.g);
- }
- }
- if (j != 0) r_();
- }
- private boolean i()
- {
- if (microwaveItemStacks[0] == null) return false;
- gz localgz = dp.a().a(microwaveItemStacks[0].a().bc);
- if (localgz == null) return false;
- if (microwaveItemStacks[2] == null) return true;
- if (!microwaveItemStacks[2].a(localgz)) return false;
- if ((microwaveItemStacks[2].a < d()) && (microwaveItemStacks[2].a < microwaveItemStacks[2].c())) return true;
- return microwaveItemStacks[2].a < localgz.c();
- }
- public void g()
- {
- if (!i()) return;
- gz localgz = dp.a().a(microwaveItemStacks[0].a().bc);
- if (microwaveItemStacks[2] == null) microwaveItemStacks[2] = localgz.k();
- else if (microwaveItemStacks[2].c == localgz.c) microwaveItemStacks[2].a += localgz.a;
- if (microwaveItemStacks[0].a().i())
- microwaveItemStacks[0] = new gz(microwaveItemStacks[0].a().h());
- else
- microwaveItemStacks[0].a -= 1;
- if (microwaveItemStacks[0].a <= 0) microwaveItemStacks[0] = null;
- }
- private int a(gz paramgm)
- {
- if (paramgm == null) return 0;
- int i = paramgm.a().bc;
- if (i == qk.bb.bj) return 300;
- if (i == mod_PlasticCraft.itemREDSTONE.bc) return 2200;
- if (i == mod_PlasticCraft.itemLIGHTSTONEDUST.bc) return 4800;
- if (i == mod_PlasticCraft.itemBATTERY.bc) return 25000;
- return 0;
- }
- public boolean a_(fd paramfd) {
- if (this.d.b(this.e, this.f, this.g) != this) return false;
- return paramfd.e(this.e + 0.5D, this.f + 0.5D, this.g + 0.5D) <= 64.0D;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement