Advertisement
Guest User

code block

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