Guest User

updateEntity()

a guest
Aug 2nd, 2015
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.64 KB | None | 0 0
  1. public void updateEntity()
  2.     {
  3.         // updates side values
  4.         this.updateMachineSideValues();
  5.         this.updateCondenserValues();
  6.  
  7.         // update block
  8.         if (worldObj.isRemote)
  9.         {
  10.             this.updateBlock();
  11.         }
  12.  
  13.         // sets the flags
  14.         boolean flag = this.condenserBurnTime > 0;
  15.         boolean flag1 = false;
  16.  
  17.         // updates the fuel burn time
  18.         if (this.condenserBurnTime > 0)
  19.         {
  20.             this.condenserBurnTime -= Double.parseDouble(FormatDecimals.hunds.format(this.cookTick * this.getSpeed()));
  21.             this.condenserBurnTime = Double.parseDouble(FormatDecimals.hunds.format(this.condenserBurnTime));
  22.         }
  23.         else
  24.         {
  25.             this.condenserBurnTime = 0;
  26.         }
  27.  
  28.         // When on server...
  29.         if (!this.worldObj.isRemote)
  30.         {
  31.             // If it can condense...
  32.             if (this.canSmelt())
  33.             {
  34.                 // And it is not burning...
  35.                 if (!this.isBurning())
  36.                 {
  37.                     // sets the fuel burn time start
  38.                     this.currentItemBurnTime = this.condenserBurnTime = GlobalValues.getBurnTime(this.itemslots[1]) * this.getSpeed();
  39.  
  40.                     if (this.isBurning())
  41.                     {
  42.                         flag1 = true;
  43.  
  44.                         if (this.itemslots[1] != null)
  45.                         {
  46.                             // subtracts 1 from the fuel
  47.                             this.setInventorySlotContents(1, new ItemStack(this.itemslots[1].getItem(), this.itemslots[1].stackSize - 1, this.itemslots[1].getItemDamage()));
  48.  
  49.                             // sets the fuel to null if stacksize returns 0.
  50.                             if (this.itemslots[1].stackSize == 0)
  51.                             {
  52.                                 this.itemslots[1] = null;
  53.                             }
  54.                         }
  55.  
  56.                     }
  57.                 }
  58.  
  59.                 // And it is burning...
  60.                 if (this.isBurning())
  61.                 {
  62.                     // Updates the smelt progress time
  63.                     if (this.condenserCookTime < GlobalValues.getSmeltTime(itemslots[0], RecipesCarbonCondenser.InputSize(itemslots[0])) * this.getSpeed())
  64.                     {
  65.                         this.condenserCookTime += Double.parseDouble(FormatDecimals.hunds.format(this.cookTick * this.getSpeed()));
  66.                         this.condenserCookTime = Double.parseDouble(FormatDecimals.hunds.format(this.condenserCookTime));
  67.                     }
  68.  
  69.                     // If the cook time goes past the smelt time, reset time to
  70.                     // 0 and smelt item.
  71.                     if (this.condenserCookTime >= GlobalValues.getSmeltTime(itemslots[0], RecipesCarbonCondenser.InputSize(itemslots[0])) * this.getSpeed())
  72.                     {
  73.                         this.condenserCookTime = 0;
  74.                         this.smeltItem();
  75.                         flag1 = true;
  76.                     }
  77.                 }
  78.             }
  79.  
  80.             // while burning, update block to look burning.
  81.             if (flag != this.condenserBurnTime > 0)
  82.             {
  83.                 flag1 = true;
  84.                 CarbonCondenser.updateBlockState(this.condenserBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
  85.             }
  86.         }
  87.  
  88.         if (this.getStackInSlot(0) == null)
  89.         {
  90.             this.condenserCookTime = 0;
  91.         }
  92.  
  93.         if (flag1)
  94.         {
  95.             this.markDirty();
  96.         }
  97.     }
Advertisement
Add Comment
Please, Sign In to add comment