Formations (Structure Library)

Formations (Structure Library)

15M Downloads

[Bug] ChiseledBookshelfProcessor does not respect Enchantment.isDiscoverable()

murphy-slaw opened this issue ยท 1 comments

commented

Version Info

  • Minecraft, 1.20.1
  • Formations, 1.0.3-fabric-mc1.20.2

What mod loader are you using?:
Fabric
Description of the Bug

When adding enchanted books to Chiseled Bookshelves, the processor selects a random enchantment from the entire enchantment registry, including enchantments which have isDiscoverable or isTreasure set to false. These enchantments don't generate in loot tables and should not be randomly generated.

Steps to Reproduce
Find a Witch Tower or other structure with chiseled bookshelves. Sometimes there will be modded or vanilla enchantments which should not be randomly selected (Like Soul Speed or Swift Sneak) included in the shelf contents.

Enchantment enchantment = BuiltInRegistries.ENCHANTMENT.getRandom(random).get().value();

commented

The chiseled bookshelf processor now matches the behaviour of vanilla when enchanting a book, thus enchantments for which isDiscoverable or isTreasure is false will no longer appear.
The change is available in Formations 1.0.4.
Thank you for reporting the issue!