New LootTable interaction system and event.

Modders can now modify and reference internal elements of a loot table by name.
Editing can ONLY be done in the event and any external editing will cause a exception to be thrown.
See this gist for more information: https://gist.github.com/LexManos/77c983d67b9ad27010428478b66d50fd
This commit is contained in:
LexManos committed 2016-05-09 14:15:59 -07:00
1 parent babd54bb87
commit aaa146c10d
14 files changed
+627

No files matched your search

@@ -0,0 +1,43 @@
package net.minecraftforge.event;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootTable;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* 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;
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;
}
}