Files
MinecraftForge/src/main/java/net/minecraftforge/event/LootTableLoadEvent.java
T

49 lines
1.7 KiB
Java
Raw Normal View History

/*
* Copyright (c) Forge Development LLC and contributors
* SPDX-License-Identifier: LGPL-2.1-only
*/
2016-05-09 14:15:59 -07:00
package net.minecraftforge.event;
2021-07-17 00:08:49 -05:00
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.storage.loot.LootTable;
2023-04-01 20:45:29 -05:00
import net.minecraftforge.common.MinecraftForge;
2025-06-18 02:34:13 -07:00
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
import net.minecraftforge.eventbus.api.event.MutableEvent;
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
2023-04-01 20:45:29 -05:00
import net.minecraftforge.fml.LogicalSide;
2016-05-09 14:15:59 -07:00
/**
2023-04-01 20:45:29 -05:00
* 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.
2016-05-09 14:15:59 -07:00
*
2023-04-01 20:45:29 -05:00
* <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>
2016-05-09 14:15:59 -07:00
*
2023-04-01 20:45:29 -05:00
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
* only on the {@linkplain LogicalSide#SERVER logical server}.</p>
2016-05-09 14:15:59 -07:00
*/
2025-06-18 02:34:13 -07:00
public final class LootTableLoadEvent extends MutableEvent implements Cancellable {
public static final CancellableEventBus<LootTableLoadEvent> BUS = CancellableEventBus.create(LootTableLoadEvent.class);
2016-05-09 14:15:59 -07:00
private final ResourceLocation name;
private LootTable table;
2025-06-18 02:34:13 -07:00
public LootTableLoadEvent(ResourceLocation name, LootTable table) {
2016-05-09 14:15:59 -07:00
this.name = name;
this.table = table;
}
2025-06-18 02:34:13 -07:00
public ResourceLocation getName() {
2016-05-09 14:15:59 -07:00
return this.name;
}
2025-06-18 02:34:13 -07:00
public LootTable getTable() {
2016-05-09 14:15:59 -07:00
return this.table;
}
2025-06-18 02:34:13 -07:00
public void setTable(LootTable table) {
2016-05-09 14:15:59 -07:00
this.table = table;
}
}