2016-06-22 23:49:47 -04:00
|
|
|
/*
|
2022-02-28 13:41:23 -08:00
|
|
|
* Minecraft Forge - Forge Development LLC
|
|
|
|
|
* SPDX-License-Identifier: LGPL-2.1-only
|
2016-06-22 23:49:47 -04:00
|
|
|
*/
|
|
|
|
|
|
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;
|
|
|
|
|
import net.minecraft.world.level.storage.loot.LootTables;
|
2018-06-10 21:12:46 -04:00
|
|
|
import net.minecraftforge.eventbus.api.Cancelable;
|
|
|
|
|
import net.minecraftforge.eventbus.api.Event;
|
2016-05-09 14:15:59 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Event fired when a LootTable json is loaded from json.
|
|
|
|
|
* This event is fired whenever resources are loaded, or when the server starts.
|
|
|
|
|
* This event will NOT be fired for LootTables loaded from the world folder, these are
|
|
|
|
|
* considered configurations files and should not be modified by mods.
|
|
|
|
|
*
|
|
|
|
|
* Canceling the event will make it load a empty loot table.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
@Cancelable
|
|
|
|
|
public class LootTableLoadEvent extends Event
|
|
|
|
|
{
|
|
|
|
|
private final ResourceLocation name;
|
|
|
|
|
private LootTable table;
|
2021-07-17 00:08:49 -05:00
|
|
|
private LootTables lootTableManager;
|
2016-05-09 14:15:59 -07:00
|
|
|
|
2021-07-17 00:08:49 -05:00
|
|
|
public LootTableLoadEvent(ResourceLocation name, LootTable table, LootTables lootTableManager)
|
2016-05-09 14:15:59 -07:00
|
|
|
{
|
|
|
|
|
this.name = name;
|
|
|
|
|
this.table = table;
|
2017-04-08 01:22:49 +02:00
|
|
|
this.lootTableManager = lootTableManager;
|
2016-05-09 14:15:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ResourceLocation getName()
|
|
|
|
|
{
|
|
|
|
|
return this.name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public LootTable getTable()
|
|
|
|
|
{
|
|
|
|
|
return this.table;
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-17 00:08:49 -05:00
|
|
|
public LootTables getLootTableManager()
|
2017-04-08 01:22:49 +02:00
|
|
|
{
|
|
|
|
|
return this.lootTableManager;
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-09 14:15:59 -07:00
|
|
|
public void setTable(LootTable table)
|
|
|
|
|
{
|
|
|
|
|
this.table = table;
|
|
|
|
|
}
|
|
|
|
|
}
|