@SubscribeEvent public void lootLoad(LootTableLoadEvent evt) { String prefix = "minecraft:chests/"; String name = evt.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": evt.getTable().addPool(getInjectPool(file)); break; default: break; } } }
@SubscribeEvent public void onLootTableLoad(LootTableLoadEvent event) { if(SPAGHETTI_LOCATIONS.contains(event.getName().toString())) { event.getTable().addPool(pool); } } }
@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" ) ); } ); } }
@SubscribeEvent public static void lootLoad(LootTableLoadEvent evt) { String name = evt.getName().toString(); if (name.startsWith(CHESTS_PREFIX) && CHEST_TABLES.contains(name.substring(CHESTS_PREFIX.length()))) { String file = name.substring("minecraft:".length()); evt.getTable().addPool(getInjectPool(file)); } }
@SubscribeEvent public void onLootLoad(LootTableLoadEvent event) { 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 "stronghold_corridor": case "stronghold_library": event.getTable().addPool(getInjectPool(file)); injected++; break; default: break; } } }
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 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 lootLoad(LootTableLoadEvent event) { if (!event.getName().getNamespace().equals("minecraft") && !event.getName().equals(Constants.VILLAGE_NATURALIST_LOOT_KEY)) { return; } Set<String> lootPoolNames = ModuleManager.getLootPoolNames(); for (String lootTableFile : ModuleManager.getLootTableFiles()) { ResourceLocation resourceLocation = new ResourceLocation(Constants.MOD_ID, event.getName().getPath() + "/" + lootTableFile); URL url = EventHandlerCore.class.getResource("/assets/" + resourceLocation.getNamespace() + "/loot_tables/" + resourceLocation.getPath() + ".json"); if (url != null) { LootTable forestryChestAdditions = event.getLootTableManager().getLootTableFromLocation(resourceLocation); if (forestryChestAdditions != LootTable.EMPTY_LOOT_TABLE) { for (String poolName : lootPoolNames) { LootPool pool = forestryChestAdditions.getPool(poolName); if (pool != null) { event.getTable().addPool(pool); } } } } } }
table.addPool(Loot.pool("gracilaria").rolls(1, 1).chance(0.1F).entry(gracilaria).build()); } else if (name == LootTableList.CHESTS_VILLAGE_BLACKSMITH || name == LootTableList.CHESTS_NETHER_BRIDGE || name == LootTableList.CHESTS_SIMPLE_DUNGEON || name == LootTableList.CHESTS_STRONGHOLD_CORRIDOR table.addPool(Loot.pool("fossils").rolls(1, 2).entries(plantFossil, twig, amber, skull).build()); table.addPool(Loot.pool("records").rolls(0, 2).entries(records).build()); LootEntry amber = Loot.entry(ItemHandler.AMBER).data(0, 1).count(0, 3).build(); LootEntry wool = Loot.entry(Blocks.WOOL).data(0, 15).count(0, 64).build(); table.addPool(Loot.pool("items").rolls(5, 6).entries(amber, wool).build()); } else if (name.getResourcePath().equals(Loot.VISITOR_LABORATORY.getResourcePath())) { LootEntry softTissue = Loot.entry(ItemHandler.SOFT_TISSUE).count(0, 3).function(DINOSAUR_DATA).build(); LootEntry amber = Loot.entry(ItemHandler.AMBER).data(0, 1).count(0, 5).build(); LootEntry dna = Loot.entry(ItemHandler.DNA).function(DINOSAUR_DATA).function(RANDOM_DNA).build(); table.addPool(Loot.pool("items").rolls(3, 4).entries(dna, softTissue, plantSoftTissue, amber).build()); } else if (name.getResourcePath().equals(Loot.VISITOR_DINING_HALL.getResourcePath())) { LootEntry amber = Loot.entry(ItemHandler.AMBER).weight(2).count(0, 1).data(0, 1).build(); LootEntry actionFigure = Loot.entry(ItemHandler.DISPLAY_BLOCK_ITEM).function(DINOSAUR_DATA).weight(1) .build(); table.addPool(Loot.pool("items").rolls(8, 11).entries(amber, tooth, actionFigure).build()); } else if (name.getResourcePath().equals(Loot.VISITOR_KITCHEN.getResourcePath())) { LootEntry waterBottle = Loot.entry(Items.POTIONITEM).count(0, 1).function(POTION_DATA).build(); table.addPool(Loot.pool("items").rolls(3, 4).entries(waterBottle).build()); } else if (name.getResourcePath().equals(Loot.FOSSIL_DIGSITE_LOOT.getResourcePath())) { ArrayList<LootEntry> fossilParts = new ArrayList<LootEntry>();
@SubscribeEvent public void onLootTableLoad(LootTableLoadEvent event) { LootPool main = event.getTable().getPool(LOOTPOOLNAME); if (main == null) { //create my own. EX: mobs that have no drops (bats) also have empty loot table, so i have to inject an entry in the table before I fill it event.getTable().addPool(new LootPool(new LootEntry[0], new LootCondition[0], new RandomValueRange(1F, 2F), new RandomValueRange(1F, 1F), LOOTPOOLNAME)); main = event.getTable().getPool(LOOTPOOLNAME); if (main == null) { ModCyclic.logger.error("could not insert Loot Pool for table :" + event.getName().toString()); return; } } if (enableChestLoot) { onLootChestTableLoad(main, event); } }
table.addPool(lp);
if(pool == null){ pool = new LootPool(new LootEntry[0], noCondition, new RandomValueRange(5, 10), new RandomValueRange(0), "main"); event.getTable().addPool(pool);