private LootPool getInjectPool(String entryName) { return new LootPool(new LootEntry[] { getInjectEntry(entryName, 1) }, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "botania_inject_pool"); }
private static void addTable(@Nonnull LootPool pool, @Nonnull ResourceLocation resourceLocation) { pool.addEntry(new LootEntryTable(resourceLocation, 1, 1, NO_CONDITIONS, resourceLocation.toString())); }
if (main != null) main.addEntry(new LootEntryItem(TANItems.canteen, 10, 0, new LootFunction[0], new LootCondition[0], "toughasnails:canteen")); if (main != null) main.removeEntry("minecraft:diamond"); main.removeEntry("minecraft:obsidian"); main.removeEntry("minecraft:diamond_horse_armor"); main.removeEntry("minecraft:golden_horse_armor"); main.removeEntry("minecraft:iron_horse_armor"); main.removeEntry("minecraft:iron_pickaxe"); main.removeEntry("minecraft:iron_axe"); main.removeEntry("minecraft:iron_sword"); main.removeEntry("minecraft:iron_boots"); main.removeEntry("minecraft:iron_chestplate"); main.removeEntry("minecraft:iron_helmet"); main.removeEntry("minecraft:iron_leggings");
LootPool lp = new LootPool(new LootEntry[0], NO_CONDITIONS, new RandomValueRange(1, 3), new RandomValueRange(0, 0), EnderIO.MOD_NAME); 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"));
@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 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))); } } } } }
pool = new LootPool(new LootEntry[0], noCondition, new RandomValueRange(5, 10), new RandomValueRange(0), "main"); event.getTable().addPool(pool); 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()));
public GadgetEvents() { LootEntry entry = new LootEntryItem(TinkerGadgets.spaghetti, 1, 1, new LootFunction[0], new LootCondition[0], "moms_spaghetti"); LootCondition chance = new RandomChance(0.05f); pool = new LootPool(new LootEntry[] {entry}, new LootCondition[] {chance}, new RandomValueRange(1), new RandomValueRange(0), "moms_spaghetti"); }
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) { // wither skellies drop necrotic bones if(event.getName().equals(LootTableList.ENTITIES_WITHER_SKELETON)) { LootCondition[] lootConditions = new LootCondition[0]; LootEntry entry = new LootEntryItem(TinkerCommons.matNecroticBone.getItem(), 1, 0, new LootFunction[]{new SetMetadata(lootConditions, new RandomValueRange(TinkerCommons.matNecroticBone.getMetadata()))}, lootConditions, "necrotic_bone"); event.getTable().addPool(new LootPool(new LootEntry[]{entry}, new LootCondition[]{ new KilledByPlayer(false), new RandomChanceWithLooting(0.07f, 0.05f) }, new RandomValueRange(1), new RandomValueRange(0), "necrotic_bone")); } }
@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 loadLootTable( LootTableLoadEvent event ) { if( event.getName() == LootTableList.CHESTS_ABANDONED_MINESHAFT ) { // TODO 1.9.4 aftermath - All these loot quality, pools and stuff. Figure it out and balance it. final IMaterials materials = AEApi.instance().definitions().materials(); materials.certusQuartzCrystal().maybeStack( 1 ).ifPresent( is -> { event.getTable() .addPool( new LootPool( new LootEntry[] { new LootEntryItem( is.getItem(), 2, 3, new LootFunction[] { new SetMetadata( null, new RandomValueRange( is.getItemDamage() ) ) }, new LootCondition[] { new RandomChance( 1 ) }, "AE2 Crystal_" + is.getItemDamage() ) }, new LootCondition[0], new RandomValueRange( 1, 4 ), new RandomValueRange( 0, 2 ), "AE2 Crystals" ) ); } ); materials.certusQuartzDust().maybeStack( 1 ).ifPresent( is -> { event.getTable() .addPool( new LootPool( new LootEntryItem[] { new LootEntryItem( is.getItem(), 2, 3, new LootFunction[] { new SetMetadata( null, new RandomValueRange( is.getItemDamage() ) ) }, new LootCondition[] { new RandomChance( 1 ) }, "AE2 Dust_" + is.getItemDamage() ) }, new LootCondition[0], new RandomValueRange( 1, 4 ), new RandomValueRange( 0, 2 ), "AE2 DUSTS" ) ); } ); } }
@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")); } } }
public LootPool build() { LootEntry[] entries = this.entries.toArray(new LootEntry[this.entries.size()]); LootCondition[] conditions = this.conditions.toArray(new LootCondition[this.conditions.size()]); return new LootPool(entries, conditions, new RandomValueRange(this.minRolls, this.maxRolls), new RandomValueRange(this.minBonusRolls, this.maxBonusRolls), this.name); } }
@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")); }
public LootPool createDefaultLootPool() { return new LootPool(lootEntries, new LootCondition[] {}, new RandomValueRange(1), new RandomValueRange(0), LootHandler.VANILLA_LOOT_POOL_ID); } }
@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")); }
private static void createPoolIfNotExists(LootTable lootTable, String poolId) { if (poolId.equals(VANILLA_LOOT_POOL_ID) || lootTable.getPool(poolId) != null) return; lootTable.addPool(new LootPool(new LootEntry[] {}, new LootCondition[] {}, new RandomValueRange(1), new RandomValueRange(0), poolId)); }
@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()); } } }
private static void injectTables(@Nonnull LootTableLoadEvent evt) { if (MC_TABLES.contains(evt.getName())) { LootPool lp = new LootPool(new LootEntry[0], NO_CONDITIONS, new RandomValueRange(1, 3), new RandomValueRange(0, 0), EnderIO.MOD_NAME); addTable(lp, eio(evt.getName())); evt.getTable().addPool(lp); } }