Search in sources :

Example 1 with LootEntryItem

use of net.minecraft.world.storage.loot.LootEntryItem in project MinecraftForge by MinecraftForge.

the class LootTablesDebug method lootLoad.

@SubscribeEvent
public void lootLoad(LootTableLoadEvent event) {
    if (!event.getName().equals(LootTableList.CHESTS_SPAWN_BONUS_CHEST))
        return;
    // Remove axes and replace with chestpeice, First vanilla entry is always called "main"
    //Note: This CAN NPE if another mod removes things
    LootPool main = event.getTable().getPool("main");
    main.removeEntry("minecraft:wooden_axe");
    main.removeEntry("minecraft:stone_axe");
    main.addEntry(new LootEntryItem(Items.DIAMOND_CHESTPLATE, 1, 0, new LootFunction[0], new LootCondition[0], MODID + ":diamond_chestplate"));
    // Get rid of all building mats. Which is pool #3, index starts at 0, but 0 is named "main"
    event.getTable().removePool("pool3");
}
Also used : LootEntryItem(net.minecraft.world.storage.loot.LootEntryItem) LootFunction(net.minecraft.world.storage.loot.functions.LootFunction) LootPool(net.minecraft.world.storage.loot.LootPool) LootCondition(net.minecraft.world.storage.loot.conditions.LootCondition) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with LootEntryItem

use of net.minecraft.world.storage.loot.LootEntryItem in project ConvenientAdditions by Necr0.

the class ModLoot method onLootTableLoad.

@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent event) {
    ResourceLocation n = event.getName();
    if (n.equals(LootTableList.CHESTS_END_CITY_TREASURE)) {
        if (ModConfigTools.mobCatcher_loot)
            event.getTable().getPool("main").addEntry(new LootEntryItem(ModItems.itemMobCatcherMega, 1, 3, new LootFunction[0], new LootCondition[0], ModConstants.Mod.MODID + ":megaMCD"));
    } else if (n.equals(LootTableList.CHESTS_STRONGHOLD_CORRIDOR)) {
        if (ModConfigTools.mobCatcher_loot)
            event.getTable().getPool("main").addEntry(new LootEntryItem(ModItems.itemMobCatcherHyper, 1, 3, new LootFunction[0], new LootCondition[0], ModConstants.Mod.MODID + ":hyperMCD"));
    } else if (n.equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) {
        if (ModConfigTools.mobCatcher_loot) {
            event.getTable().getPool("main").addEntry(new LootEntryItem(ModItems.itemMobCatcherSuper, 1, 3, new LootFunction[0], new LootCondition[0], ModConstants.Mod.MODID + ":superMCD"));
            event.getTable().getPool("main").addEntry(new LootEntryItem(ModItems.itemMobCatcherRegular, 3, -2, new LootFunction[0], new LootCondition[0], ModConstants.Mod.MODID + ":regularMCD"));
        }
    }
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) LootEntryItem(net.minecraft.world.storage.loot.LootEntryItem) LootFunction(net.minecraft.world.storage.loot.functions.LootFunction) LootCondition(net.minecraft.world.storage.loot.conditions.LootCondition) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

LootEntryItem (net.minecraft.world.storage.loot.LootEntryItem)2 LootCondition (net.minecraft.world.storage.loot.conditions.LootCondition)2 LootFunction (net.minecraft.world.storage.loot.functions.LootFunction)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 ResourceLocation (net.minecraft.util.ResourceLocation)1 LootPool (net.minecraft.world.storage.loot.LootPool)1