mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 19:15:32 +00:00
Add LootTableManager to the LootTableLoadEvent (#3717)
This commit is contained in:
1 parent
b99aa9bca4
commit
be2d814155
6 files changed
+220
-7
No files matched your search
@@ -0,0 +1,32 @@
|
||||
package net.minecraftforge.test;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.storage.loot.LootTable;
|
||||
import net.minecraft.world.storage.loot.LootTableList;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.LootTableLoadEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod(modid = LootTableLoadEventTest.MODID, name = "LootTableLoadEventTest", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class LootTableLoadEventTest {
|
||||
public static final String MODID = "loottable_load_event_test";
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLootTableLoadEvent(LootTableLoadEvent event)
|
||||
{
|
||||
if (LootTableList.CHESTS_SPAWN_BONUS_CHEST.equals(event.getName())) {
|
||||
ResourceLocation loc = new ResourceLocation(MODID,"chests/custom_spawn_bonus_chest");
|
||||
LootTable customLootTable = event.getLootTableManager().getLootTableFromLocation(loc);
|
||||
event.setTable(customLootTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user