Advertisement
Guest User

update()

a guest
Aug 17th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.29 KB | None | 0 0
  1. public void update()
  2.     {
  3.         boolean flag = this.isBurning();
  4.         boolean flag1 = false;
  5.  
  6.         if (this.isBurning())
  7.         {
  8.             --this.furnaceBurnTime;
  9.         }
  10.  
  11.         if (!this.world.isRemote)
  12.         {
  13.             ItemStack itemstack = this.furnaceItemStacks.get(1);
  14.  
  15.             if (this.isBurning() || !itemstack.isEmpty() && !((ItemStack)this.furnaceItemStacks.get(0)).isEmpty())
  16.             {
  17.                 if (!this.isBurning() && this.canSmelt())
  18.                 {
  19.                     this.furnaceBurnTime = getItemBurnTime(itemstack);
  20.                     this.currentItemBurnTime = this.furnaceBurnTime;
  21.  
  22.                     if (this.isBurning())
  23.                     {
  24.                         flag1 = true;
  25.  
  26.                         if (!itemstack.isEmpty())
  27.                         {
  28.                             Item item = itemstack.getItem();
  29.                             itemstack.shrink(1);
  30.  
  31.                             if (itemstack.isEmpty())
  32.                             {
  33.                                 ItemStack item1 = item.getContainerItem(itemstack);
  34.                                 this.furnaceItemStacks.set(1, item1);
  35.                             }
  36.                         }
  37.                     }
  38.                 }
  39.  
  40.                 if (this.isBurning() && this.canSmelt())
  41.                 {
  42.                     ++this.cookTime;
  43.  
  44.                     if (this.cookTime == this.totalCookTime)
  45.                     {
  46.                         this.cookTime = 0;
  47.                         this.totalCookTime = this.getCookTime(this.furnaceItemStacks.get(0));
  48.                         this.smeltItem();
  49.                         flag1 = true;
  50.                     }
  51.                 }
  52.                 else
  53.                 {
  54.                     this.cookTime = 0;
  55.                 }
  56.             }
  57.             else if (!this.isBurning() && this.cookTime > 0)
  58.             {
  59.                 this.cookTime = MathHelper.clamp(this.cookTime - 2, 0, this.totalCookTime);
  60.             }
  61.  
  62.             if (flag != this.isBurning())
  63.             {
  64.                 flag1 = true;
  65.                 SilverFurnace.setState(this.isBurning(), this.world, this.pos);
  66.             }
  67.         }
  68.  
  69.         if (flag1)
  70.         {
  71.             this.markDirty();
  72.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement