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

Map of fuel times is created anew every time an item is placed in a furnace, instead of being cached

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 1.15.2, 1.16.1, 20w29a, 20w30a, 1.16.2 Pre-release 1, 1.16.2, 1.16.4 Pre-release 1, 1.16.4, 20w46a, 20w48a, 20w49a, 21w03a
    • Fix Version/s: None
    • Labels:
      None
    • Confirmation Status:
      Community Consensus
    • Category:
      Performance

      Description

      Yes, every time.

      Names used are based on the Yarn mappings for the game.

      // AbstractFurnaceBlockEntity
      public static Map<Item, Integer> createFuelTimeMap() {
        Map<Item, Integer> map = Maps.newLinkedHashMap();
        addFuel(map, Items.LAVA_BUCKET, 20000);
        addFuel(map, Blocks.COAL_BLOCK, 16000);
        addFuel(map, Items.BLAZE_ROD, 2400);
        //...etc
        return map;
      }
      
      protected int getFuelTime(ItemStack stack) {
         if (stack.isEmpty()) {
            return 0;
         }
      
         return createFuelTimeMap().getOrDefault(stack.getItem(), 0);
      }
      
      public static boolean canUseAsFuel(ItemStack stack) {
         return createFuelTimeMap().containsKey(stack.getItem());
      }

      Possible fix: make fuel/burn times part of datapacks and remove that map entirely. That will make it easier to customise for players, map makers, and modders, and would ensure the values are correctly available when they're actually needed.

       

      I've seen a few people in the Fabric discord playing around with the idea of a recipe type for furnace, blast furnace, and smoker fuels. #justsaiyan

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              awr_* Sollace
              Votes:
              11 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                CHK: