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

New storage based loot table does not work properly until restarting the game

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 24w12a
    • None
    • Plausible
    • Data Packs, Loot tables
    • Normal
    • Platform

      The Bug

      When changing a loot table to use a set_count function where the count value is based on storage, you will get the same loot result as before changing the loot table until restarting the game.

      Steps to reproduce

      1. Copy the vanilla data/minecraft/loot_tables/blocks/diamond_ore.json
      2. Add a set count function like this
        {
        	"function": "set_count",
        	"add": false,
        	"count": 2
        }
        
      3. Do a /reload
        You will get 2 diamonds when mining the diamond ore
      4. Change the function to something like this
        {
        	"function": "set_count",
        	"add": false,
        	"count": {
        		"type": "minecraft:storage",
        		"storage": "neun:ore_counts",
        		"path": "diamonds"
        	}
        }
        
      5. Do /data modify storage neun:ore_counts diamonds set value 3
      6. Do /reload
        You will still get 2 diamonds when mining the diamond ore
      7. Change count to hardcoded 5 and /reload
        You will get 5 diamonds when mining the diamond ore
      8. Change count back to storage based and /reload
        You will still get 5 diamonds when mining the diamond ore
      9. Close and reopen the world
        You will still get 5 diamonds when mining the diamond ore
      10. Close and reopen the game
        You will now get 3 diamonds when mining the diamond ore
      11. Do /data modify storage neun:ore_counts diamonds set value 20
        You will now get 20 diamonds when mining the diamond ore

      Expected Behavior

      The loot table should base its diamond count on the storage after /reload

      Observed Behavior

      You need to close and reopen the game to get the desired behavior.

      Attachment

      I attached the datapack I used for testing. Since you need to update it to reproduce, I still recommend you create your own, but you can use it as a basis.

            Unassigned Unassigned
            Schortan [Mod] NeunEinser
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              CHK: