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"); }
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"); }
@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 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" ) ); } ); } }
public LootPool createDefaultLootPool() { return new LootPool(lootEntries, new LootCondition[] {}, new RandomValueRange(1), new RandomValueRange(0), LootHandler.VANILLA_LOOT_POOL_ID); } }
public static void addRolls(ResourceLocation tableLocation, int minAdd, int maxAdd) { rollVals.put(tableLocation, new RandomValueRange(minAdd, maxAdd)); }
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); } }
private LootPool getInjectPool(String entryName) { return new LootPool(new LootEntry[]{getInjectEntry(entryName, 1)}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "vampirism_inject_pool"); } }
private @Nonnull static SetCount setCount(int min, int max) { return new SetCount(NO_CONDITIONS, new RandomValueRange(min, min)); }
private @Nonnull static SetMetadata setMetadata(int meta) { return new SetMetadata(NO_CONDITIONS, new RandomValueRange(meta)); }
private static LootPool getInjectPool(String entryName) { return new LootPool(new LootEntry[] {getInjectEntry(entryName)}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), AncientWarfareCore.MOD_ID + "_inject_pool"); }
private @Nonnull static SetMetadata setMetadata(int metaMin, int metaMax) { return new SetMetadata(NO_CONDITIONS, new RandomValueRange(metaMin, metaMax)); }
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)); }
private @Nonnull static SetDamage setDamage(Item item, int damage) { return new SetDamage(NO_CONDITIONS, new RandomValueRange(damage > 0 ? damage : 1, damage > 0 ? damage : item.getMaxDamage())); }
public EntryBuilder data(int min, int max) { return this.function(new SetMetadata(new LootCondition[0], new RandomValueRange(min, max))); }
public EntryBuilder count(int min, int max) { return this.function(new SetCount(new LootCondition[0], new RandomValueRange(min, max))); }
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); } }
@SubscribeEvent public void dungeonLootLoad(LootTableLoadEvent event) { if (event.getName().toString().equals("minecraft:chests/simple_dungeon")) { LootTableList.register(new ResourceLocation("matteroverdrive:inject/simple_dungeon")); LootEntry entry = new LootEntryTable(new ResourceLocation("matteroverdrive:inject/simple_dungeon"), 100, 1, new LootCondition[]{}, "Blue_Pill"); LootPool pool = new LootPool(new LootEntry[]{entry}, new LootCondition[]{}, new RandomValueRange(0, 10), new RandomValueRange(0, 10), "Blue_Pill"); //event.getTable().addPool(pool); } }
@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")); }