neoforged/NeoForge

LootTableLoadEvent does not have registry access

Opened this issue · 1 comments

Minecraft Version: 1.21.1

NeoForge Version: 21.1.9

Description of issue:

The LootTableLoadEvent appears to be missing some API changes that were made around other loot-table-adjacent things in 1.20.5; in particular:

  • getName() returns a ResourceLocation and there's no method that returns the New Hotness ResourceKey<LootTable> used elsewhere.
    • This is mostly cosmetic, but it's an inconsistency with other API changes,
  • There doesn't appear to be any way to access a HolderLookup.Provider from this event, which is required to access various registries -- for example, if you want to add an enchantment condition check you need some way to access the enchantment registry.
    • Since this event is fired during deserialization, there is not yet any server OR client, so CommonHooks.resolveLookup always fails.
    • The codec (or rather the RegistryOps) should have access to the registry lookups, but it needs to be passed into the event.

Oh how did I miss this during #1529 , I'll look into this when I get a chance