Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.00 KB | None | 0 0
  1. public class TileEntityMicrowave extends ll
  2.   implements jc
  3. {
  4.   private gz[] microwaveItemStacks = new gz[3];
  5.   public int microwaveBurnTime = 0;
  6.   public int b = 0;
  7.   public int microwaveCookTime = 0;
  8.   public int cookTime = 125;
  9.  
  10.   public int a() {
  11.     return microwaveItemStacks.length;
  12.   }
  13.  
  14.   public gz c_(int paramInt) {
  15.     return microwaveItemStacks[paramInt];
  16.   }
  17.  
  18.   public gz a(int paramInt1, int paramInt2) {
  19.     if (microwaveItemStacks[paramInt1] != null) {
  20.       if (microwaveItemStacks[paramInt1].a <= paramInt2) {
  21.         gz localgz = microwaveItemStacks[paramInt1];
  22.         microwaveItemStacks[paramInt1] = null;
  23.         return localgz;
  24.       }
  25.       gz localgz = microwaveItemStacks[paramInt1].a(paramInt2);
  26.       if (microwaveItemStacks[paramInt1].a == 0) microwaveItemStacks[paramInt1] = null;
  27.       return localgz;
  28.     }
  29.  
  30.     return null;
  31.   }
  32.  
  33.   public void a(int paramInt, gz paramgz) {
  34.     microwaveItemStacks[paramInt] = paramgz;
  35.     if ((paramgz != null) && (paramgz.a > d())) paramgz.a = d();
  36.   }
  37.  
  38.   public String c()
  39.   {
  40.     return "Microwave";
  41.   }
  42.  
  43.   public void a(ks paramks)
  44.   {
  45.     super.a(paramks);
  46.     oo localoo = paramks.l("Items");
  47.     microwaveItemStacks = new gz[a()];
  48.     for (int i = 0; i < localoo.c(); i++) {
  49.       ks localks = (ks)localoo.a(i);
  50.       int j = localks.c("Slot");
  51.       if ((j < 0) || (j >= microwaveItemStacks.length)) continue; microwaveItemStacks[j] = new gz(localks);
  52.     }
  53.  
  54.     microwaveBurnTime = paramks.d("BurnTime");
  55.     microwaveCookTime = paramks.d("CookTime");
  56.     this.b = a(microwaveItemStacks[1]);
  57.   }
  58.  
  59.   public void b(ks paramks) {
  60.     super.b(paramks);
  61.     paramks.a("BurnTime", (short)microwaveBurnTime);
  62.     paramks.a("CookTime", (short)microwaveCookTime);
  63.     oo localoo = new oo();
  64.  
  65.     for (int i = 0; i < microwaveItemStacks.length; i++) {
  66.       if (microwaveItemStacks[i] != null) {
  67.         ks localks = new ks();
  68.         localks.a("Slot", (byte)i);
  69.         microwaveItemStacks[i].a(localks);
  70.         localoo.a(localks);
  71.       }
  72.     }
  73.     paramks.a("Items", localoo);
  74.   }
  75.  
  76.   public int d() {
  77.     return 64;
  78.   }
  79.  
  80.   public int b(int paramInt) {
  81.     return microwaveCookTime * paramInt / cookTime;
  82.   }
  83.  
  84.   public int c(int paramInt) {
  85.     if (this.b == 0) this.b = cookTime;
  86.     return microwaveBurnTime * paramInt / this.b;
  87.   }
  88.  
  89.   public boolean b() {
  90.     return microwaveBurnTime > 0;
  91.   }
  92.  
  93.   public void m_() {
  94.     int i = microwaveBurnTime > 0 ? 1 : 0;
  95.     int j = 0;
  96.     if (microwaveBurnTime > 0) {
  97.       microwaveBurnTime -= 1;
  98.     }
  99.  
  100.     if (!this.d.t) {
  101.       if ((microwaveBurnTime == 0) && (i())) {
  102.         this.b = (microwaveBurnTime = a(microwaveItemStacks[1]));
  103.         if (microwaveBurnTime > 0) {
  104.           j = 1;
  105.           if (microwaveItemStacks[1] != null) {
  106.             if (microwaveItemStacks[1].a().i())
  107.               microwaveItemStacks[1] = new gz(microwaveItemStacks[1].a().h());
  108.             else
  109.               microwaveItemStacks[1].a -= 1;
  110.             if (microwaveItemStacks[1].a == 0) microwaveItemStacks[1] = null;
  111.           }
  112.         }
  113.       }
  114.  
  115.       if ((b()) && (i())) {
  116.         microwaveCookTime += 1;
  117.         if (microwaveCookTime == cookTime) {
  118.           microwaveCookTime = 0;
  119.           g();
  120.           j = 1;
  121.         }
  122.       } else {
  123.         microwaveCookTime = 0;
  124.       }
  125.  
  126.       if (i != (microwaveBurnTime > 0 ? 1 : 0)) {
  127.         j = 1;
  128.         oz.a(microwaveBurnTime > 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 (microwaveItemStacks[0] == null) return false;
  138.     gz localgz = dp.a().a(microwaveItemStacks[0].a().bc);
  139.     if (localgz == null) return false;
  140.     if (microwaveItemStacks[2] == null) return true;
  141.     if (!microwaveItemStacks[2].a(localgz)) return false;
  142.     if ((microwaveItemStacks[2].a < d()) && (microwaveItemStacks[2].a < microwaveItemStacks[2].c())) return true;
  143.     return microwaveItemStacks[2].a < localgz.c();
  144.   }
  145.  
  146.   public void g()
  147.   {
  148.     if (!i()) return;
  149.  
  150.     gz localgz = dp.a().a(microwaveItemStacks[0].a().bc);
  151.     if (microwaveItemStacks[2] == null) microwaveItemStacks[2] = localgz.k();
  152.     else if (microwaveItemStacks[2].c == localgz.c) microwaveItemStacks[2].a += localgz.a;
  153.  
  154.     if (microwaveItemStacks[0].a().i())
  155.       microwaveItemStacks[0] = new gz(microwaveItemStacks[0].a().h());
  156.     else
  157.       microwaveItemStacks[0].a -= 1;
  158.     if (microwaveItemStacks[0].a <= 0) microwaveItemStacks[0] = null;
  159.   }
  160.  
  161.   private int a(gz paramgm)
  162.   {
  163.     if (paramgm == null) return 0;
  164.     int i = paramgm.a().bc;
  165.  
  166.     if (i == qk.bb.bj) return 300;
  167.  
  168.     if (i == mod_PlasticCraft.itemREDSTONE.bc) return 2200;
  169.  
  170.     if (i == mod_PlasticCraft.itemLIGHTSTONEDUST.bc) return 4800;
  171.  
  172.     if (i == mod_PlasticCraft.itemBATTERY.bc) return 25000;
  173.  
  174.     return 0;
  175.   }
  176.  
  177.   public boolean a_(fd paramfd) {
  178.     if (this.d.b(this.e, this.f, this.g) != this) return false;
  179.     return paramfd.e(this.e + 0.5D, this.f + 0.5D, this.g + 0.5D) <= 64.0D;
  180.   }
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement