Files
MinecraftForge/src/main/java/net/minecraftforge/event/LootTableLoadEvent.java
T
Paint_Ninja 504dcad849 Seal most event hierarchies (#10515)
Most events in Forge are not designed to be extended by mod devs but technically allowed it before this PR, leading to a risk of unintentional breaking changes for those that do.

If you need to extend a Forge event, please let us know so that we can explicitly support that and design it with extending in mind. Note that this change does not affect making your own events that directly extend from EventBus' `Event` class.
2025-04-19 13:18:48 +01:00

53 lines
1.5 KiB
Java

/*
* Copyright (c) Forge Development LLC and contributors
* SPDX-License-Identifier: LGPL-2.1-only
*/
package net.minecraftforge.event;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.LogicalSide;
/**
* Fired when a {@link LootTable} is loaded from JSON.
* Loot tables loaded from world save datapacks will not fire this event as they are considered user configuration files.
* This event is fired whenever server resources are loaded or reloaded.
*
* <p>This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
* If the event is cancelled, the loot table will be made empty.</p>
*
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#SERVER logical server}.</p>
*/
@Cancelable
public final class LootTableLoadEvent extends Event
{
private final ResourceLocation name;
private LootTable table;
public LootTableLoadEvent(ResourceLocation name, LootTable table)
{
this.name = name;
this.table = table;
}
public ResourceLocation getName()
{
return this.name;
}
public LootTable getTable()
{
return this.table;
}
public void setTable(LootTable table)
{
this.table = table;
}
}