Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-10025

Burn time indicator of a Furnace not working correctly after reloading the world

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.4.7, Snapshot 13w07a, Minecraft 1.5, Snapshot 13w11a, Minecraft 1.5.1, Minecraft 1.5.2, Minecraft 1.6.1, Minecraft 1.6.2, Minecraft 13w36a, Minecraft 13w36b, Minecraft 1.7.4, Minecraft 1.7.10, Minecraft 1.10.2, Minecraft 16w35a, Minecraft 16w36a, Minecraft 16w38a, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 17w43a, Minecraft 17w43b, Minecraft 17w48a, Minecraft 17w50a, Minecraft 18w01a, Minecraft 18w03b, Minecraft 18w06a, Minecraft 18w09a, Minecraft 18w10d, Minecraft 18w20c, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 19w14a, Minecraft 1.14.3, 1.14.4, 19w39a, 1.15 Pre-release 6, 1.15.1, 20w07a, 1.16, 1.16.1, 1.16.2, 1.16.3 Release Candidate 1, 1.16.3, 1.16.4 Pre-release 1, 1.16.4 Pre-release 2, 1.16.4, 20w45a, 20w46a, 20w48a, 20w49a, 20w51a, 21w03a, 1.16.5, 21w05a, 21w05b, 21w06a, 21w14a, 21w15a, 21w16a, 21w17a, 21w18a, 21w19a, 21w20a, 1.17 Pre-release 1, 1.17 Pre-release 4, 1.17, 1.17.1 Pre-release 1, 1.17.1
    • Fix Version/s: None
    • Confirmation Status:
      Confirmed
    • Category:
      Networking
    • Mojang Priority:
      Low

      Description

      The bug

      When you start a furnace burning and then swap out what's in the fuel slot and save and quit, the next time you load the burn time indicator will glitch. The reason for this is that the NBT file for furnaces does not store the max fuel burn time and instead dynamically gets it from the fuel slot, which may no longer contain the same item as was used to initially fuel the furnace. This can be seen in the code snippet attached.

      To reproduce

      1. Start furnace burning with a fuel other than a stick.
      2. Allow the burn time to visibly decrease.
      3. Swap the fuel with something that burns shorter than the original fuel.
      4. Save and quit.
      5. Reload the save.
      6. Open the furnace.
      7. The burn time indicator will have increased.

      With particularly large differences (lava bucket to stick), the progress bar may wrap around the top of the screen and display twice (see 2016-09-19_14.59.18.png).

      Fix

      Rather than attempting to guess the total burn time of the original item, it should be saved too:

      TileEntityFurnace
          public void readFromNBT(NBTTagCompound compound)
          {
              super.readFromNBT(compound);
              this.furnaceItemStacks = NonNullList.<ItemStack>withSize(this.getSizeInventory(), ItemStack.EMPTY);
              ItemStackHelper.loadAllItems(compound, this.furnaceItemStacks);
              this.furnaceBurnTime = compound.getShort("BurnTime");
              this.cookTime = compound.getShort("CookTime");
              this.totalCookTime = compound.getShort("CookTimeTotal");
              //this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks.get(1));
              this.currentItemBurnTime = compound.getShort("BurnTimeTotal"); // added
      
              if (compound.hasKey("CustomName", 8))
              {
                  this.furnaceCustomName = compound.getString("CustomName");
              }
          }
      
          public NBTTagCompound writeToNBT(NBTTagCompound compound)
          {
              super.writeToNBT(compound);
              compound.setShort("BurnTime", (short)this.furnaceBurnTime);
              compound.setShort("CookTime", (short)this.cookTime);
              compound.setShort("CookTimeTotal", (short)this.totalCookTime);
              compound.setShort("BurnTimeTotal", (short)this.currentItemBurnTime); // added
              ItemStackHelper.saveAllItems(compound, this.furnaceItemStacks);
      
              if (this.hasCustomName())
              {
                  compound.setString("CustomName", this.furnaceCustomName);
              }
      
              return compound;
          }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              dimitriye98 Dimitriye Danilovic
              Votes:
              29 Vote for this issue
              Watchers:
              17 Start watching this issue

                Dates

                Created:
                Updated:
                CHK: