@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; } } } }
private static void addPool(LootTable table) { LootEntry common = new LootEntryTable(new ResourceLocation("lootslashconquer:chests/common_chest"), 60, 1, new LootCondition[0], "common"); LootEntry uncommon = new LootEntryTable(new ResourceLocation("lootslashconquer:chests/uncommon_chest"), 25, 1, new LootCondition[0], "uncommon"); LootEntry rare = new LootEntryTable(new ResourceLocation("lootslashconquer:chests/rare_chest"), 10, 1, new LootCondition[0], "rare"); LootEntry legendary = new LootEntryTable(new ResourceLocation("lootslashconquer:chests/legendary_chest"), 5, 1, new LootCondition[0], "legendary"); LootEntry exotic = new LootEntryTable(new ResourceLocation("lootslashconquer:chests/exotic_chest"), 2, 1, new LootCondition[0], "exotic"); LootPool pool = new LootPool(new LootEntry[] { common, uncommon, rare, legendary, exotic }, new LootCondition[0], new RandomValueRange(0, 1), new RandomValueRange(0), "loot"); table.addPool(pool); }
@SubscribeEvent public void lootTableLoad(final LootTableLoadEvent event) { if (NemesisConfig.DISCOVERY_ENABLED && isLootTarget(event)) { // TODO improve roll settings String name = LOOT_TABLE.toString(); LootEntry entry = new LootEntryTable(LOOT_TABLE, 1, 0, new LootCondition[0], name); RandomValueRange rolls = new RandomValueRange(0, 1); LootPool pool = new LootPool(new LootEntry[] { entry }, new LootCondition[0], rolls, rolls, name); event.getTable().addPool(pool); } }
@SubscribeEvent public void onLootTableLoad(LootTableLoadEvent event) { String name = event.getName().toString(); if (name.startsWith("minecraft:chests/simple_dungeon") || name.startsWith("minecraft:chests/desert_pyramid") || name.startsWith("minecraft:chests/jungle_temple")) { event.getTable().addPool(new LootPool(new LootEntry[] { new LootEntryTable(new ResourceLocation(Allomancy.MODID, "inject/lerasium"), 1, 0, new LootCondition[0], "allomancy_inject_entry") }, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "allomancy_inject_pool")); } }
public static LootPool getLootPool(ResourceLocation res){ return new LootPool(new LootEntry[]{new LootEntryTable(res, 1, 0, new LootCondition[0], "combined")}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0), "combined"); }
private static LootEntryTable getEntry(String unique, String name, int quality, int weight) { return new LootEntryTable(new ResourceLocation(MOD_ID, name), weight, quality, new LootCondition[0], unique); }
private static LootEntry loadEntry(ResourceLocation injectionEntry) { return new LootEntryTable(injectionEntry, 1, 0, new LootCondition[0], "openmods_inject_entry"); }