mojira.dev
MC-269964

Ominous item spawners are missing an NBT load for spawn_item_after_ticks

The minecraft:ominous_item_spawner entity introduced in 24w13a doesn't load the spawn_item_after_ticks field when being read from NBT. This means that they instantly drop their contents when reloaded, and they cannot be summoned.

The code in OminousItemSpawner#readAdditionalSaveData appears to have a typo when reading the field (it calls the method, but does not store it back into the field on the entity):

protected void readAdditionalSaveData(CompoundTag lvt1) {
        ItemStack lvt2 = lvt1.contains("item", 10) ? ItemStack.parse(this.registryAccess(), lvt1.getCompound("item")).orElse(ItemStack.EMPTY) : ItemStack.EMPTY;
        this.setItem(lvt2);
        lvt1.getLong("spawn_item_after_ticks");
}

Comments 2

This bug has effects on vanilla gameplay. If you activate an ominous trial spawner and wait for an item spawner to appear, quitting and re-entering the world causes the item spawner to immediately drop its contents.

Note that you can summon the entity with commands, but it will always drop its contents immediately regardless of the value of spawn_item_after_ticks.

can confirm. The following command should summon an ominous item spawner that takes 2000 ticks to spawn the arrow, but instead spawns it immediately:

/summon minecraft:ominous_item_spawner ~ ~4 ~ {item: {id:"minecraft:arrow"} , spawn_item_after_ticks: 2000L}

katietheqt

(Unassigned)

1215343

Confirmed

Expansion B

Important

Entities, Save Data

24w13a, 24w14a, 1.20.5 Release Candidate 2

24w21a

Retrieved