Class LootTableLoadEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.LootTableLoadEvent
All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent

public class LootTableLoadEvent extends net.neoforged.bus.api.Event implements net.neoforged.bus.api.ICancellableEvent
Fired when a LootTable is loaded from JSON. Can be used to modify the loot table, cancel loading it, or outright replace it. This event is currently fired for all loot tables coming from vanilla, mods, and user datapacks. This event is fired whenever server resources are loaded or reloaded.

This event is cancellable, and does not

invalid reference
have a result
. If the event is cancelled, the loot table will be made empty.

This event is fired on the main Forge event bus, only on the logical server.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private @Nullable net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>
     
    private final net.minecraft.resources.ResourceLocation
     
    private final net.minecraft.core.HolderLookup.Provider
     
    private net.minecraft.world.level.storage.loot.LootTable
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    LootTableLoadEvent(net.minecraft.core.HolderLookup.Provider registries, net.minecraft.resources.ResourceLocation name, net.minecraft.world.level.storage.loot.LootTable table)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>
     
    net.minecraft.resources.ResourceLocation
     
    net.minecraft.core.HolderLookup.Provider
    Returns a lookup provider that can be used to access registries.
    net.minecraft.world.level.storage.loot.LootTable
     
    void
    setTable(net.minecraft.world.level.storage.loot.LootTable table)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.neoforged.bus.api.ICancellableEvent

    isCanceled, setCanceled
  • Field Details

    • registries

      private final net.minecraft.core.HolderLookup.Provider registries
    • name

      private final net.minecraft.resources.ResourceLocation name
    • table

      private net.minecraft.world.level.storage.loot.LootTable table
    • key

      @Nullable private @Nullable net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable> key
  • Constructor Details

    • LootTableLoadEvent

      @Internal public LootTableLoadEvent(net.minecraft.core.HolderLookup.Provider registries, net.minecraft.resources.ResourceLocation name, net.minecraft.world.level.storage.loot.LootTable table)
  • Method Details

    • getRegistries

      public net.minecraft.core.HolderLookup.Provider getRegistries()
      Returns a lookup provider that can be used to access registries.
      Returns:
      a lookup provider that can be used to access registries
    • getName

      public net.minecraft.resources.ResourceLocation getName()
    • getKey

      public net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable> getKey()
    • getTable

      public net.minecraft.world.level.storage.loot.LootTable getTable()
    • setTable

      public void setTable(net.minecraft.world.level.storage.loot.LootTable table)