Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TileEntityAirCompressor extends kp
- implements ij
- {
- private gm[] h = new gm[3];
- public int a = 0;
- public int b = 0;
- public int c = 0;
- public int a() {
- return this.h.length;
- }
- public gm c_(int paramInt) {
- return this.h[paramInt];
- }
- public gm a(int paramInt1, int paramInt2) {
- if (this.h[paramInt1] != null) {
- if (this.h[paramInt1].a <= paramInt2) {
- gm localgm = this.h[paramInt1];
- this.h[paramInt1] = null;
- return localgm;
- }
- gm localgm = this.h[paramInt1].a(paramInt2);
- if (this.h[paramInt1].a == 0) this.h[paramInt1] = null;
- return localgm;
- }
- return null;
- }
- public void a(int paramInt, gm paramgm) {
- this.h[paramInt] = paramgm;
- if ((paramgm != null) && (paramgm.a > d())) paramgm.a = d();
- }
- public String c()
- {
- return "Air Compressor";
- }
- public void a(jw paramjw) {
- super.a(paramjw);
- nn localnn = paramjw.l("Items");
- this.h = new gm[a()];
- for (int i = 0; i < localnn.c(); i++) {
- jw localjw = (jw)localnn.a(i);
- int j = localjw.c("Slot");
- if ((j >= 0) && (j < this.h.length)) {
- this.h[j] = new gm(localjw);
- }
- }
- this.a = paramjw.d("BurnTime");
- this.c = paramjw.d("CookTime");
- this.b = a(this.h[1]);
- }
- public void b(jw paramjw) {
- super.b(paramjw);
- paramjw.a("BurnTime", (short)this.a);
- paramjw.a("CookTime", (short)this.c);
- nn localnn = new nn();
- for (int i = 0; i < this.h.length; i++) {
- if (this.h[i] != null) {
- jw localjw = new jw();
- localjw.a("Slot", (byte)i);
- this.h[i].a(localjw);
- localnn.a(localjw);
- }
- }
- paramjw.a("Items", localnn);
- }
- public int d() {
- return 64;
- }
- public int b(int paramInt) {
- return this.c * paramInt / 200;
- }
- public int c(int paramInt) {
- if (this.b == 0) this.b = 200;
- return this.a * paramInt / this.b;
- }
- public boolean b() {
- return this.a > 0;
- }
- public void m_() {
- int i = this.a > 0 ? 1 : 0;
- int j = 0;
- if (this.a > 0) {
- this.a -= 1;
- }
- if (!this.d.z) {
- if ((this.a == 0) && (i())) {
- this.b = (this.a = a(this.h[1]));
- if (this.a > 0) {
- j = 1;
- if (this.h[1] != null) {
- if (this.h[1].a().i())
- this.h[1] = new gm(this.h[1].a().h());
- else {
- this.h[1].a -= 1;
- }
- if (this.h[1].a == 0) this.h[1] = null;
- }
- }
- }
- if ((b()) && (i())) {
- this.c += 1;
- if (this.c == 200) {
- this.c = 0;
- g();
- j = 1;
- }
- } else {
- this.c = 0;
- }
- if (i != (this.a > 0 ? 1 : 0)) {
- j = 1;
- ny.a(this.a > 0, this.d, this.e, this.f, this.g);
- }
- }
- if (j != 0) r_();
- }
- private boolean i()
- {
- if (this.h[0] == null) return false;
- gm localgm = AirCompressorRecipes.a().a(this.h[0].a().ba);
- if (localgm == null) return false;
- if (this.h[2] == null) return true;
- if (!this.h[2].a(localgm)) return false;
- if ((this.h[2].a < d()) && (this.h[2].a < this.h[2].c())) return true;
- return this.h[2].a < localgm.c();
- }
- public void g() {
- if (!i()) return;
- gm localgm = AirCompressorRecipes.a().a(this.h[0].a().ba);
- if (this.h[2] == null)
- this.h[2] = localgm.k();
- else if (this.h[2].c == localgm.c) this.h[2].a += 1;
- this.h[0].a -= 1;
- if (this.h[0].a <= 0) this.h[0] = null;
- }
- private int a(gm paramgm)
- {
- if (paramgm == null) return 0;
- int i = paramgm.a().ba;
- return i != 331 ? 0 : 20000;
- }
- public boolean a_(eu parameu) {
- if (this.d.b(this.e, this.f, this.g) != this) return false;
- return parameu.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