Search in sources :

Example 1 with LootEntryTable

use of net.minecraft.world.storage.loot.LootEntryTable in project Gaspunk by Ladysnake.

the class ModItems method onLootTableLoad.

@SubscribeEvent
public static void onLootTableLoad(LootTableLoadEvent event) {
    if (event.getName().toString().equals("minecraft:chests/nether_bridge")) {
        ResourceLocation loc = new ResourceLocation(GasPunk.MOD_ID, "inject/nether_bridge");
        LootEntry entry = new LootEntryTable(loc, 1, 1, new LootCondition[0], "gaspunk_sulfur_entry");
        LootPool pool = new LootPool(new LootEntry[] { entry }, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "gaspunk_sulfur_pool");
        event.getTable().addPool(pool);
    }
}
Also used : LootEntry(net.minecraft.world.storage.loot.LootEntry) RandomValueRange(net.minecraft.world.storage.loot.RandomValueRange) ResourceLocation(net.minecraft.util.ResourceLocation) LootPool(net.minecraft.world.storage.loot.LootPool) LootEntryTable(net.minecraft.world.storage.loot.LootEntryTable) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with LootEntryTable

use of net.minecraft.world.storage.loot.LootEntryTable in project pnc-repressurized by TeamPneumatic.

the class EventHandlerPneumaticCraft method onLootTableLoad.

@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent event) {
    if (ConfigHandler.general.enableDungeonLoot) {
        String prefix = "minecraft:chests/";
        String name = event.getName().toString();
        if (name.startsWith(prefix)) {
            String file = name.substring(name.indexOf(prefix) + prefix.length());
            switch(file) {
                case "abandoned_mineshaft":
                case "desert_pyramid":
                case "jungle_temple":
                case "simple_dungeon":
                case "spawn_bonus_chest":
                case "stronghold_corridor":
                case "village_blacksmith":
                    LootEntry entry = new LootEntryTable(RL("inject/simple_dungeon_loot"), 1, 0, new LootCondition[0], "pneumaticcraft_inject_entry");
                    LootPool pool = new LootPool(new LootEntry[] { entry }, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "pneumaticcraft_inject_pool");
                    event.getTable().addPool(pool);
                    break;
                default:
                    break;
            }
        }
    }
}
Also used : LootEntry(net.minecraft.world.storage.loot.LootEntry) RandomValueRange(net.minecraft.world.storage.loot.RandomValueRange) LootPool(net.minecraft.world.storage.loot.LootPool) LootEntryTable(net.minecraft.world.storage.loot.LootEntryTable) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

LootEntry (net.minecraft.world.storage.loot.LootEntry)2 LootEntryTable (net.minecraft.world.storage.loot.LootEntryTable)2 LootPool (net.minecraft.world.storage.loot.LootPool)2 RandomValueRange (net.minecraft.world.storage.loot.RandomValueRange)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 ResourceLocation (net.minecraft.util.ResourceLocation)1