mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
A full rewrite and redesign of the library that offers much better performance, new features and fixes all previous design flaws See the migration guide here: https://gist.github.com/PaintNinja/ad82c224aecee25efac1ea3e2cf19b91 Co-authored-by: Paint_Ninja <PaintNinja@users.noreply.github.com>
50 lines
1.7 KiB
Java
50 lines
1.7 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.bus.CancellableEventBus;
|
|
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
|
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
|
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>
|
|
*/
|
|
public final class LootTableLoadEvent extends MutableEvent implements Cancellable {
|
|
public static final CancellableEventBus<LootTableLoadEvent> BUS = CancellableEventBus.create(LootTableLoadEvent.class);
|
|
|
|
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;
|
|
}
|
|
}
|