mojira.dev
MC-306215

Trial Spawner behaves differently if placed in creative or survival

I have created a custom trial spawner called the “ominous spawner”. The nbt data is the following:

"components": {
      "minecraft:block_entity_data": {
        "id": "minecraft:trial_spawner",
        "ejecting_loot_table": "custom:spawners/ominous/trial_chamber/consumables_and_key"
      },
      "minecraft:block_state": {
        "ominous": "true"
      },
      "minecraft:custom_name": {
        "text": "Ominous Trial Spawner",
        "italic": false
      },
      "minecraft:rarity": "epic"
    }

And here is the loot table of consumables_and_key in case you are wondering:

{
  "type": "minecraft:chest",
  "pools": [
    {
      "bonus_rolls": 0.0,
      "entries": [
        {
          "type": "minecraft:item",
          "functions": [
            {
              "add": false,
              "count": 1.0,
              "function": "minecraft:set_count"
            }
          ],
          "name": "minecraft:ominous_trial_key",
          "weight": 30
        },
        {
          "type": "minecraft:item",
          "functions": [
            {
              "add": false,
              "count": {
                "type": "minecraft:uniform",
                "max": 2.0,
                "min": 1.0
              },
              "function": "minecraft:set_count"
            }
          ],
          "name": "minecraft:cooked_beef",
          "weight": 21
        },
        {
          "type": "minecraft:item",
          "functions": [
            {
              "add": false,
              "count": {
                "type": "minecraft:uniform",
                "max": 4.0,
                "min": 2.0
              },
              "function": "minecraft:set_count"
            }
          ],
          "name": "minecraft:baked_potato",
          "weight": 21
        },
        {
          "type": "minecraft:item",
          "functions": [
            {
              "add": false,
              "count": {
                "type": "minecraft:uniform",
                "max": 2.0,
                "min": 1.0
              },
              "function": "minecraft:set_count"
            }
          ],
          "name": "minecraft:golden_carrot",
          "weight": 14
        },
        {
          "type": "minecraft:item",
          "functions": [
            {
              "add": false,
              "count": 1.0,
              "function": "minecraft:set_count"
            },
            {
              "function": "minecraft:set_potion",
              "id": "minecraft:regeneration"
            }
          ],
          "name": "minecraft:potion",
          "weight": 7
        },
        {
          "type": "minecraft:item",
          "functions": [
            {
              "add": false,
              "count": 1.0,
              "function": "minecraft:set_count"
            },
            {
              "function": "minecraft:set_potion",
              "id": "minecraft:strength"
            }
          ],
          "name": "minecraft:potion",
          "weight": 7
        }
      ],
      "rolls": 1.0
    }
  ],
  "random_sequence": "custom:spawners/ominous/trial_chamber/consumables_and_key"
}

You may ignore all the code above, it is just for reference.

The point here is that this trial spawner works when placed in creative but if the same custom spawner is placed in survival then the loot table used goes back to default.

In the following video I placed two spawners which are exactly the same but the only difference is that one is placed in survival and the other in creative. As you can see, the one placed in creative gives golden carrots (an item that is in my custom loot table and does NOT belong to the default trial spawner loot table) while the other one gives a trial key (an item that is not part of my custom loot table).

Environment

vanilla 1.21.11

Attachments

Comments 4

Thank you for helping us improve Minecraft! We saved your files:

[media]
  • Short description of the issue
    Above

  • Steps to reproduce the issue
    Acquire two trial spawners with the same custom loot table, then place one in creative and the other in survival. Proceed to kill all the trial mobs and check the rewards items

  • Expected result
    The reward items must belong to the same custom loot table

  • Actual result
    The reward item from the spawner placed in survival does not belong to the custom loot table while the one placed in creative provides a correspondent item

Hi!
Thank you for your report! 

  • Can you provide a datapack this issue can be reproduced with?

Quick Links
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

Can confirm, datapack has been attached:

[media]

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Steps to Reproduce -

Enable the datapack

Run the following command:

/give @p minecraft:trial_spawner[minecraft:block_entity_data={id:"minecraft:trial_spawner",ejecting_loot_table:"custom:spawners/ominous/trial_chamber/consumables_and_key"},minecraft:block_state={ominous:"true"},minecraft:custom_name='{"text":"Ominous Trial Spawner","italic":false}',minecraft:rarity="epic"]


Place a trial spawner in creative and another in survival then run:

/data get block ~ ~-1 ~ ejecting_loot_table

It should say the following:

  ~ ~ ~ has the following block data: custom:spawners/ominous/trial_chamber/consumables_and_key

which is intended

Stand on top of the trial spawner placed in survival and run the previous command, it will throw the following error:

Found no elements matching ejecting_loot_table


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  • Explanation

    - This indicates that trial spawners placed in Survival mode lose their custom ejecting_loot_table NBT data, reverting to default loot tables, while those placed in Creative mode retain the custom loot table correctly.

Christian Garrett Finot

(Unassigned)

Unconfirmed

(Unassigned)

1.21.11

Retrieved