Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.92 KB | None | 0 0
  1. public class TileEntityAirCompressor extends kp
  2.   implements ij
  3. {
  4.   private gm[] h = new gm[3];
  5.   public int a = 0;
  6.   public int b = 0;
  7.   public int c = 0;
  8.  
  9.   public int a() {
  10.     return this.h.length;
  11.   }
  12.  
  13.   public gm c_(int paramInt) {
  14.     return this.h[paramInt];
  15.   }
  16.  
  17.   public gm a(int paramInt1, int paramInt2) {
  18.     if (this.h[paramInt1] != null) {
  19.       if (this.h[paramInt1].a <= paramInt2) {
  20.         gm localgm = this.h[paramInt1];
  21.         this.h[paramInt1] = null;
  22.         return localgm;
  23.       }
  24.       gm localgm = this.h[paramInt1].a(paramInt2);
  25.       if (this.h[paramInt1].a == 0) this.h[paramInt1] = null;
  26.       return localgm;
  27.     }
  28.  
  29.     return null;
  30.   }
  31.  
  32.   public void a(int paramInt, gm paramgm) {
  33.     this.h[paramInt] = paramgm;
  34.     if ((paramgm != null) && (paramgm.a > d())) paramgm.a = d();
  35.   }
  36.  
  37.   public String c()
  38.   {
  39.     return "Air Compressor";
  40.   }
  41.  
  42.   public void a(jw paramjw) {
  43.     super.a(paramjw);
  44.     nn localnn = paramjw.l("Items");
  45.     this.h = new gm[a()];
  46.     for (int i = 0; i < localnn.c(); i++) {
  47.       jw localjw = (jw)localnn.a(i);
  48.       int j = localjw.c("Slot");
  49.       if ((j >= 0) && (j < this.h.length)) {
  50.         this.h[j] = new gm(localjw);
  51.       }
  52.     }
  53.     this.a = paramjw.d("BurnTime");
  54.     this.c = paramjw.d("CookTime");
  55.     this.b = a(this.h[1]);
  56.   }
  57.  
  58.   public void b(jw paramjw) {
  59.     super.b(paramjw);
  60.     paramjw.a("BurnTime", (short)this.a);
  61.     paramjw.a("CookTime", (short)this.c);
  62.     nn localnn = new nn();
  63.  
  64.     for (int i = 0; i < this.h.length; i++) {
  65.       if (this.h[i] != null) {
  66.         jw localjw = new jw();
  67.         localjw.a("Slot", (byte)i);
  68.         this.h[i].a(localjw);
  69.         localnn.a(localjw);
  70.       }
  71.     }
  72.     paramjw.a("Items", localnn);
  73.   }
  74.  
  75.   public int d() {
  76.     return 64;
  77.   }
  78.  
  79.   public int b(int paramInt) {
  80.     return this.c * paramInt / 200;
  81.   }
  82.  
  83.   public int c(int paramInt) {
  84.     if (this.b == 0) this.b = 200;
  85.     return this.a * paramInt / this.b;
  86.   }
  87.  
  88.   public boolean b() {
  89.     return this.a > 0;
  90.   }
  91.  
  92.   public void m_() {
  93.     int i = this.a > 0 ? 1 : 0;
  94.     int j = 0;
  95.     if (this.a > 0) {
  96.       this.a -= 1;
  97.     }
  98.  
  99.     if (!this.d.z) {
  100.       if ((this.a == 0) && (i())) {
  101.         this.b = (this.a = a(this.h[1]));
  102.         if (this.a > 0) {
  103.           j = 1;
  104.           if (this.h[1] != null) {
  105.             if (this.h[1].a().i())
  106.               this.h[1] = new gm(this.h[1].a().h());
  107.             else {
  108.               this.h[1].a -= 1;
  109.             }
  110.             if (this.h[1].a == 0) this.h[1] = null;
  111.           }
  112.         }
  113.       }
  114.  
  115.       if ((b()) && (i())) {
  116.         this.c += 1;
  117.         if (this.c == 200) {
  118.           this.c = 0;
  119.           g();
  120.           j = 1;
  121.         }
  122.       } else {
  123.         this.c = 0;
  124.       }
  125.  
  126.       if (i != (this.a > 0 ? 1 : 0)) {
  127.         j = 1;
  128.         ny.a(this.a > 0, this.d, this.e, this.f, this.g);
  129.       }
  130.     }
  131.  
  132.     if (j != 0) r_();
  133.   }
  134.  
  135.   private boolean i()
  136.   {
  137.     if (this.h[0] == null) return false;
  138.     gm localgm = AirCompressorRecipes.a().a(this.h[0].a().ba);
  139.     if (localgm == null) return false;
  140.     if (this.h[2] == null) return true;
  141.     if (!this.h[2].a(localgm)) return false;
  142.     if ((this.h[2].a < d()) && (this.h[2].a < this.h[2].c())) return true;
  143.     return this.h[2].a < localgm.c();
  144.   }
  145.  
  146.   public void g() {
  147.     if (!i()) return;
  148.  
  149.     gm localgm = AirCompressorRecipes.a().a(this.h[0].a().ba);
  150.     if (this.h[2] == null)
  151.       this.h[2] = localgm.k();
  152.     else if (this.h[2].c == localgm.c) this.h[2].a += 1;
  153.  
  154.     this.h[0].a -= 1;
  155.     if (this.h[0].a <= 0) this.h[0] = null;
  156.   }
  157.  
  158.   private int a(gm paramgm)
  159.   {
  160.     if (paramgm == null) return 0;
  161.     int i = paramgm.a().ba;
  162.  
  163.     return i != 331 ? 0 : 20000;
  164.   }
  165.  
  166.   public boolean a_(eu parameu) {
  167.     if (this.d.b(this.e, this.f, this.g) != this) return false;
  168.     return parameu.e(this.e + 0.5D, this.f + 0.5D, this.g + 0.5D) <= 64.0D;
  169.   }
  170. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement