private static void addTable(@Nonnull LootPool pool, @Nonnull ResourceLocation resourceLocation) { pool.addEntry(new LootEntryTable(resourceLocation, 1, 1, NO_CONDITIONS, resourceLocation.toString())); }
private void addLoot(LootPool main, Item item, int rando) { if (item != null) {//shortcut fix bc of new module config system that can delete items main.addEntry(new LootEntryItem(item, rando, 0, new LootFunction[0], new LootCondition[0], Const.MODRES + item.getTranslationKey())); } }
@SubscribeEvent public void onLootTableLoad(LootTableLoadEvent event) { ResourceLocation res = event.getName(); if(tablesToEdit.contains(res)) { if(customPools.containsKey(res)) customPools.get(res); event.getTable().getPool("main").addEntry(new LootEntryItem(Items.FILLED_MAP, rarity, quality, new LootFunction[] { new SetAsTreasureFunction() }, new LootCondition[0], "quark:treasure_map")); } }
@SubscribeEvent public void onLootLoading(LootTableLoadEvent event) { if (event.getName().toString().equals("minecraft:gameplay/fishing")) { LootPool pool = event.getTable().getPool("main"); if (pool != null) { for (String name : LOOT_TABLES) { LootEntry entry = pool.getEntry("minecraft:" + name); if (entry != null) { pool.addEntry(getEntry(MODID + "_" + name.replace(FISHING, ""), name, getVanillaQuality(entry), getVanillaWeight(entry))); } } } } }
@SubscribeEvent public void onChestGenerated(LootTableLoadEvent event) { if (event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) { final LootPool pool1 = event.getTable().getPool("pool1"); if (pool1 != null) { pool1.addEntry(new LootEntryItem(ModItems.manuscript, 10, 5, new LootFunction[0], new LootCondition[0], "iceandfire:manuscript")); } } }
@SubscribeEvent public void onWorldLoad(LootTableLoadEvent event) { LootPool mainPool = event.getTable().getPool("main"); if(mainPool != null && lootEntryItems.containsKey(event.getName())) { ArrayList<LootEntryItem> entryItems = lootEntryItems.get(event.getName()); for(LootEntryItem entry : entryItems) { mainPool.addEntry(entry); } } if(mainPool != null && rollVals.containsKey(event.getName())) { RandomValueRange rangeAdd = rollVals.get(event.getName()); RandomValueRange range = mainPool.getRolls(); mainPool.setRolls(new RandomValueRange(range.getMin() + rangeAdd.getMin(), range.getMax() + rangeAdd.getMax())); } }
@SubscribeEvent public void onLootTableLoad(LootTableLoadEvent event) { LootFunction[] funcs = new LootFunction[] { new SetMetadata(new LootCondition[0], new RandomValueRange(0, enableRainbowRuneChests ? 16 : 15)) }; if(event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) event.getTable().getPool("main").addEntry(new LootEntryItem(rune, dungeonWeight, itemQuality, funcs, new LootCondition[0], "quark:rune")); else if(event.getName().equals(LootTableList.CHESTS_NETHER_BRIDGE)) event.getTable().getPool("main").addEntry(new LootEntryItem(rune, netherFortressWeight, itemQuality, funcs, new LootCondition[0], "quark:rune")); else if(event.getName().equals(LootTableList.CHESTS_JUNGLE_TEMPLE)) event.getTable().getPool("main").addEntry(new LootEntryItem(rune, jungleTempleWeight, itemQuality, funcs, new LootCondition[0], "quark:rune")); else if(event.getName().equals(LootTableList.CHESTS_DESERT_PYRAMID)) event.getTable().getPool("main").addEntry(new LootEntryItem(rune, desertTempleWeight, itemQuality, funcs, new LootCondition[0], "quark:rune")); }
lp.addEntry(createLootEntry(Alloy.DARK_STEEL.getStackIngot(), 1, 3, 0.25F)); lp.addEntry(createLootEntry(itemConduitProbe.getItemNN(), 0.10F)); lp.addEntry(createLootEntry(Items.QUARTZ, 3, 16, 0.25F)); lp.addEntry(createLootEntry(Items.NETHER_WART, 1, 4, 0.20F)); lp.addEntry(createLootEntry(Items.ENDER_PEARL, 1, 2, 0.30F)); lp.addEntry(createDarkSteelLootEntry(ModObject.itemDarkSteelSword.getItemNN(), 0.1F)); lp.addEntry(createDarkSteelLootEntry(ModObject.itemDarkSteelBoots.getItemNN(), 0.1F)); lp.addEntry(createLootEntry(Material.GEAR_WOOD.getStack(), 1, 2, 0.5F)); lp.addEntry(createLootCapacitor(0.15F)); lp.addEntry(createLootCapacitor(0.15F)); lp.addEntry(createLootCapacitor(0.15F)); lp.addEntry(createLootEntry(Alloy.DARK_STEEL.getStackIngot(), 1, 3, 0.05F)); lp.addEntry(createLootEntry(Items.ENDER_PEARL, 1, 2, 0.10F)); lp.addEntry(createDarkSteelLootEntry(ModObject.itemDarkSteelSword.getItemNN(), 0.2F)); lp.addEntry(createLootEntry(Material.GEAR_WOOD.getStack(), 1, 2, 0.5F)); lp.addEntry(createLootCapacitor(0.15F)); lp.addEntry(createLootCapacitor(0.05F)); lp.addEntry(createLootEntry(ModObject.blockExitRail.getItemNN(), 1, 2, 0.15F)); lp.addEntry(createDarkSteelLootEntry(ModObject.itemDarkSteelBoots.getItemNN(), 0.1F)); lp.addEntry(createLootEntry(Material.GEAR_IRON.getStack(), 1, 2, 0.5F)); lp.addEntry(createLootCapacitor(0.15F)); lp.addEntry( new LootEntryItem(ModObject.itemSoulVial.getItemNN(), 1, 1, new LootFunction[] { setCount(1, 1), new SetNBT(NO_CONDITIONS, polarBear.toNbt(null)) }, new LootCondition[] { new RandomChance(.2F) }, "PolarBearSoulVial")); lp.addEntry(createLootEntry(ModObject.itemSoulVial.getItemNN(), 1, 3, 0.5F));
@SubscribeEvent public void onLootTableLoad(LootTableLoadEvent event) { if(event.getName().equals(LootTableList.CHESTS_STRONGHOLD_LIBRARY)) event.getTable().getPool("main").addEntry(new LootEntryItem(ancient_tome, libraryWeight, itemQuality, new LootFunction[] { new EnchantTomeFunction() }, new LootCondition[0], "quark:ancient_tome")); else if(event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) event.getTable().getPool("main").addEntry(new LootEntryItem(ancient_tome, dungeonWeight, itemQuality, new LootFunction[] { new EnchantTomeFunction() }, new LootCondition[0], "quark:ancient_tome")); }
@SubscribeEvent public void onTableLoaded (LootTableLoadEvent event) { for (final LootBuilder builder : this.helper.getLootTableEntries().get(event.getName())) { final LootPool pool = event.getTable().getPool(builder.getPool()); if (pool != null) { pool.addEntry(builder.build()); } else { Constants.LOG.info("The mod {} tried to add loot to {} but the pool was not found. {}", this.helper.getModid(), event.getName(), builder.toString()); } } }
public static void handleLootTableMod(LootTableLoadEvent event) { final List<CustomLootPool> customLootPools = getCustomLootPools(event.getName()); for (CustomLootPool customLootPool : customLootPools) { final String lootPoolId = customLootPool.isSeperateLootPool() ? SEPARATE_LOOT_POOL_ID : VANILLA_LOOT_POOL_ID; createPoolIfNotExists(event.getTable(), lootPoolId); final LootPool lootPool = event.getTable().getPool(lootPoolId); for (LootEntry entry : customLootPool.getLootEntries()) { lootPool.addEntry(entry); } } }
LootFunction jamDamage = new SetMetadata(noCondition, new RandomValueRange(0, TheJams.values().length-1)); LootFunction jamAmount = new SetCount(noCondition, new RandomValueRange(3, 5)); pool.addEntry(new LootEntryItem(InitItems.itemJams, 2, 0, new LootFunction[]{jamDamage, jamAmount}, noCondition, ActuallyAdditions.MODID+":jams")); pool.addEntry(new LootEntryItem(Items.GLASS_BOTTLE, 1, 0, new LootFunction[]{glassAmount}, noCondition, ActuallyAdditions.MODID+":bottles")); pool.addEntry(new LootEntryItem(Items.BOOK, 50, 0, new LootFunction[0], noCondition, ActuallyAdditions.MODID+":book")); pool.addEntry(new LootEntryItem(Items.BONE, 100, 0, new LootFunction[]{bonesAmount}, noCondition, ActuallyAdditions.MODID+":bones")); pool.addEntry(new LootEntryItem(aiots[i], 30-i*5, 0, new LootFunction[]{damage}, noCondition, ActuallyAdditions.MODID+":aiot"+i)); for(int i = 0; i < armor.length; i++){ LootFunction damage = new SetDamage(noCondition, new RandomValueRange(0F, 0.75F)); pool.addEntry(new LootEntryItem(armor[i], 50, 0, new LootFunction[]{damage}, noCondition, ActuallyAdditions.MODID+":armor"+i)); pool.addEntry(new LootEntryItem(Item.getItemFromBlock(InitBlocks.blockMisc), 60, 0, new LootFunction[]{woodCaseAmount, woodCaseDamage}, noCondition, ActuallyAdditions.MODID+":woodenCase")); pool.addEntry(new LootEntryItem(Item.getItemFromBlock(InitBlocks.blockMisc), 40, 0, new LootFunction[]{ironCaseAmount, ironCaseDamage}, noCondition, ActuallyAdditions.MODID+":ironCase")); pool.addEntry(new LootEntryItem(InitItems.itemCrystal, 20, 0, functions, noCondition, ActuallyAdditions.MODID+":crystalItems")); pool.addEntry(new LootEntryItem(Item.getItemFromBlock(InitBlocks.blockCrystal), 3, 0, functions, noCondition, ActuallyAdditions.MODID+":crystalBlocks")); pool.addEntry(new LootEntryItem(InitItems.itemMisc, 5, 0, new LootFunction[]{damage}, noCondition, ActuallyAdditions.MODID+":drillCore")); LootFunction damage = new SetMetadata(noCondition, new RandomValueRange(TheMiscItems.QUARTZ.ordinal())); LootFunction amount = new SetCount(noCondition, new RandomValueRange(1, 5)); pool.addEntry(new LootEntryItem(InitItems.itemMisc, 20, 0, new LootFunction[]{damage, amount}, noCondition, ActuallyAdditions.MODID+":quartz"));
if (main != null) main.addEntry(new LootEntryItem(TANItems.canteen, 10, 0, new LootFunction[0], new LootCondition[0], "toughasnails:canteen"));