@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; } } } }
@SubscribeEvent public static void onLootTableLoad(LootTableLoadEvent event) { ResourceLocation tableName = event.getName(); LootPool pool = null; int bandage = 0, plaster = 0, morphine = 0; if (tableName.equals(LootTableList.CHESTS_SPAWN_BONUS_CHEST)) { pool = event.getTable().getPool("main"); bandage = 8; plaster = 16; morphine = 4; } else if (tableName.equals(LootTableList.CHESTS_STRONGHOLD_CORRIDOR) || tableName.equals(LootTableList.CHESTS_STRONGHOLD_CROSSING) || tableName.equals(LootTableList.CHESTS_ABANDONED_MINESHAFT)) { pool = event.getTable().getPool("main"); bandage = 20; plaster = 24; morphine = 8; } if (pool != null) { pool.addEntry(new LootEntryItem(FirstAidItems.BANDAGE, bandage, 0, new SetCount[]{new SetCount(new LootCondition[0], new RandomValueRange(1, 3))}, new LootCondition[0], FirstAid.MODID + "bandage")); pool.addEntry(new LootEntryItem(FirstAidItems.PLASTER, plaster, 0, new SetCount[]{new SetCount(new LootCondition[0], new RandomValueRange(1, 5))}, new LootCondition[0], FirstAid.MODID + "plaster")); pool.addEntry(new LootEntryItem(FirstAidItems.MORPHINE, morphine, 0, new SetCount[]{new SetCount(new LootCondition[0], new RandomValueRange(1, 2))}, new LootCondition[0], FirstAid.MODID + "morphine")); } }
@SubscribeEvent public void onLootLoad(LootTableLoadEvent event) { if (Config.enhancementBookLootLocationList.contains(event.getName())) { String lootPoolId = LootHelper.VANILLA_LOOT_POOL_ID; LootHelper.createPoolIfNotExists(event.getTable(), lootPoolId); final LootPool lootPool = event.getTable().getPool(lootPoolId); lootPool.addEntry(customLootEnhancementBook); } //TODO Rework this to only be caught in cold biomes /*if(event.getName() == LootTableList.GAMEPLAY_FISHING_FISH){ String lootPoolId = LootHelper.VANILLA_LOOT_POOL_ID; LootHelper.createPoolIfNotExists(event.getTable(), lootPoolId); final LootPool lootPool = event.getTable().getPool(lootPoolId); lootPool.addEntry(customLootWhiteFish); }*/ }
@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); } }
@SubscribeEvent public void onLootTableLoad(LootTableLoadEvent event) { if (event.getName() == ModLootTables.common_chest) { event.setTable(new CustomLootTable(new LootPool[] { event.getTable().getPool("main") })); } if (event.getName() == ModLootTables.uncommon_chest) { event.setTable(new CustomLootTable(new LootPool[] { event.getTable().getPool("main") })); } if (event.getName() == ModLootTables.rare_chest) { event.setTable(new CustomLootTable(new LootPool[] { event.getTable().getPool("main") })); } if (event.getName() == ModLootTables.legendary_chest) { event.setTable(new CustomLootTable(new LootPool[] { event.getTable().getPool("main") })); } if (event.getName() == ModLootTables.exotic_chest) { event.setTable(new CustomLootTable(new LootPool[] { event.getTable().getPool("main") })); } changeVanillaTables(event); }
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 static void lootLoaded(LootTableLoadEvent event) { if (event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) { LootTable customTable = event.getLootTableManager().getLootTableFromLocation(new ResourceLocation(BetterThanWeagles.MODID, "custom/simple_dungeon_chest")); LootPool customPool = customTable.getPool("weagles"); event.getTable().addPool(customPool); } }
@SubscribeEvent public void addTables(LootTableLoadEvent event){ String name = event.getName().toString(); if(Randores.getConfigObj().getModules().isDungeonLoot()) { if (is(name, chests)) { event.getTable().addPool(new LootPool(new LootEntry[] {new RandoresLootEntry(1, 2, true, 10, 20, new LootCondition[0], "randores_flexible_loot_entry")}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "randores_flexible_pool")); } else if (name.contains("end_city_treasure")) { event.getTable().addPool(new LootPool(new LootEntry[] {new RandoresLootEntry(1, 5, true, 20, 50, new LootCondition[0], "randores_flexible_loot_entry")}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "randores_flexible_pool")); } else if (name.contains("spawn_bonus_chest")) { event.getTable().addPool(new LootPool(new LootEntry[] {new RandoresLootEntry(1, 1, false, 0, 0, new LootCondition[0], "randores_flexible_loot_entry")}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "randores_flexible_pool")); } } }
@SubscribeEvent public void onLootTablesLoaded(LootTableLoadEvent event) { if ((event.getName().equals(LootTableList.CHESTS_ABANDONED_MINESHAFT)) || (event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) || (event.getName().equals(LootTableList.CHESTS_DESERT_PYRAMID)) || (event.getName().equals(LootTableList.CHESTS_NETHER_BRIDGE)) || (event.getName().equals(LootTableList.CHESTS_STRONGHOLD_LIBRARY)) || (event.getName().equals(LootTableList.CHESTS_END_CITY_TREASURE))) { LootPool mainPool = event.getTable().getPool("main"); if (mainPool != null) { if (event.getName().equals(LootTableList.CHESTS_ABANDONED_MINESHAFT) || event.getName().equals(LootTableList.CHESTS_NETHER_BRIDGE) || event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) { mainPool.addEntry(new LootEntryItem(ModItems.FRIENDER_PEARL, 10, 0, new LootFunction[] {}, new LootCondition[0], ModGlobals.MODID + ":friender_pearl_loot")); } } } }
private static void replaceCookedWithCharred(LootPool targetPool, Item targetItem, ItemStack replacementStack, int minCount, int maxCount) { List<LootFunction> charredFunctions = Lists.newArrayList(); if(replacementStack.getItemDamage() != 0) charredFunctions.add(LootUtil.createSetMetadata(replacementStack.getItemDamage())); if(replacementStack.getTagCompound() != null) charredFunctions.add(LootUtil.createSetNBT(replacementStack.getTagCompound())); charredFunctions.add(LootUtil.createCountFunction(minCount, maxCount)); charredFunctions.add(LootUtil.createLootingFunc(0, 1)); LootCondition notOnFire = new EntityHasProperty(new EntityProperty[] {new EntityOnFire(false)}, EntityTarget.THIS); LootCondition onFire = new EntityHasProperty(new EntityProperty[] {new EntityOnFire(true)}, EntityTarget.THIS); targetPool.removeEntry(targetItem.getRegistryName().toString()); targetPool.addEntry(new LootEntryItem(targetItem, 1, 1, new LootFunction[] {LootUtil.createCountFunction(1, 3), LootUtil.createLootingFunc(0, 1)}, new LootCondition[] {notOnFire}, targetItem.getRegistryName().toString())); targetPool.addEntry(new LootEntryItem(replacementStack.getItem(), 1, 1, charredFunctions.toArray(new LootFunction[charredFunctions.size()]), new LootCondition[] {onFire}, ModMain.MODID + ":charred_+" + targetItem.getRegistryName().getResourcePath().toString())); }
private void removeSmeltFunction(LootPool pool, Item targetItem, Item replacement, int minCount, int maxCount) { LootCondition notOnFire = new EntityHasProperty(new EntityProperty[] {new EntityOnFire(false)}, EntityTarget.THIS); LootCondition onFire = new EntityHasProperty(new EntityProperty[] {new EntityOnFire(true)}, EntityTarget.THIS); pool.removeEntry(targetItem.getRegistryName().toString()); pool.addEntry(new LootEntryItem(targetItem, 1, 1, new LootFunction[] {LootUtil.createCountFunction(1, 3), LootUtil.createLootingFunc(0, 1)}, new LootCondition[] {notOnFire}, targetItem.getRegistryName().toString())); pool.addEntry(new LootEntryItem(replacement, 1, 1, new LootFunction[] {LootUtil.createCountFunction(1, 3), LootUtil.createLootingFunc(0, 1)}, new LootCondition[] {onFire}, replacement.getRegistryName().toString())); }
@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); } }
/** * Converts a LootTable to a list of possible drops, only looks for Item and metadata. * @param table the loot table to get items from * @return a LinkedList of the stacks in the loot table */ public static List<ItemStack> tableToItemStacks(LootTable table){ List<ItemStack> stacks = new LinkedList<>(); for(LootPool p:getPools(table)){ for(LootEntry entry:getEntries(p)){ if(entry instanceof LootEntryItem){ LootEntryItem ei = (LootEntryItem)entry; Item item = getItem(ei); LootFunction[] functs = getFunctions(ei); boolean metaSet = false; for(LootFunction func:functs){ if(func instanceof SetMetadata){ metaSet=true; RandomValueRange range = (RandomValueRange)ReflectionHelper.getPrivateValue(SetMetadata.class, (SetMetadata)func, "metaRange","field_186573_b"); int meta = MathHelper.floor(range.getMin()); stacks.add(new ItemStack(item,1,meta)); } } if(!metaSet)stacks.add(new ItemStack(item)); } /* won't bother with this case for now else if(entry instanceof LootEntryTable){ //restart with that table ResourceLocation location = (ResourceLocation) ReflectionHelper.getPrivateValue(LootEntryTable.class, (LootEntryTable)entry, "table","field_186371_a"); } */ } } return stacks; }
@SubscribeEvent public static void addLoot(LootTableLoadEvent event) { if(event.getName().equals(LootTableList.GAMEPLAY_FISHING_FISH)) { //Add fishable fish LootPool pool = event.getTable().getPool("main"); for(Map.Entry<Item, Integer> entry : MHItems.FISHABLE.entrySet()) addLoot(pool, entry.getKey(), entry.getValue()); } }
@SubscribeEvent public static void onLootTableLoad(LootTableLoadEvent e) { final ResourceLocation rl = e.getName(); if (rl.equals(LootTableList.CHESTS_VILLAGE_BLACKSMITH) || rl.equals(LootTableList.CHESTS_ABANDONED_MINESHAFT) || rl.equals(LootTableList.CHESTS_JUNGLE_TEMPLE)) { final LootTable lt = e.getTable(); LootPool lp = lt.getPool("pool0"); if (lp == null) lp = lt.getPool("main"); if (lp != null) { lp.addEntry(new LootEntryItem(MCFluxResources.UPCHIP, 20, 0, new LootFunction[0], new LootCondition[0], "mcflux:loot/upchip")); } } }
@SubscribeEvent public void onLootTablesLoaded (LootTableLoadEvent event) { // Checks to see if the loot table being loaded is the basic dungeon chest. if (event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) { // Gets pool2 from the loot table. This pool is where common loot like zombie flesh // bones and string goes. final LootPool pool2 = event.getTable().getPool("pool2"); // Makes sure the pool has not been deleted. if (pool2 != null) { // Adds cookies to the loot pool. Has a weight of 10 and spawns in stacks of 1 // to 5. pool2.addEntry(new LootEntryItem(Items.COOKIE, 10, 0, new LootFunction[] { new SetCount(new LootCondition[0], new RandomValueRange(1, 5)) }, new LootCondition[0], "tutorial:cookie")); // Adds Lime Green Dye to the loot pool. Has a weight of 10. pool2.addEntry(new LootEntryItem(Items.DYE, 10, 0, new LootFunction[] { new SetDamage(new LootCondition[0], new RandomValueRange(10, 10)) }, new LootCondition[0], "tutorial:dyes")); } } // Checks to see if the loot table being loaded is for the mob we are looking for if (event.getName().equals(LootTableList.ENTITIES_PIG)) { // Gets main from the loot table. This pool is where the basic drops like porkchop are. final LootPool main = event.getTable().getPool("main"); // Makes sure that the main pool actually exists. It can be deleted by other mods. if (main != null) { // Adds a carrot to the pool. Carrots will now drop just as often as pork chops. main.addEntry(new LootEntryItem(Items.CARROT, 1, 0, new LootFunction[0], new LootCondition[0], "tutorial:carrot")); // Adds an apple to the loot pool. This entry is only used if the pig was killed by a player. main.addEntry(new LootEntryItem(Items.APPLE, 1, 0, new LootFunction[0], new LootCondition[] { new KilledByPlayer(false)}, "tutorial:player")); } } }
@SubscribeEvent(priority= EventPriority.NORMAL) public void onLootLoad(LootTableLoadEvent event){ if(event.getName().getResourceDomain().equals("minecraft") == false) return; // loot table from another mod (too fancy for ALT) String categoryAndEntry = event.getName().getResourcePath(); // e.g. "chests/abandoned_mineshaft" if(categoryAndEntry.contains("/") == false) return; // not valid // category is "chests" or "entities" String category = categoryAndEntry.substring(0,categoryAndEntry.indexOf('/')); // entry is the name of the loot table (e.g. "abandoned_mineshaft") String entry = categoryAndEntry.substring(categoryAndEntry.indexOf('/')+1,categoryAndEntry.length()); final Map<String, Map<String, List<LootPool>>> additional_loot = AdditionalLootTables.getAdditionalLootTables(); if(additional_loot.containsKey(category) && additional_loot.get(category).containsKey(entry)){ List<LootPool> pools = additional_loot.get(category).get(entry); if(pools == null || pools.isEmpty()) return; // nothing to add if(event.getTable() == null) { // table was removed by another mod FMLLog.info("%s: creating new loot table %s", MODID, event.getName()); event.setTable(new LootTable(pools.toArray(new LootPool[pools.size()]))); } else { // table exists, add pools to it FMLLog.info("%s: adding more loot to loot table %s", MODID, event.getName()); for (LootPool pool : pools) { event.getTable().addPool(pool); } } } }
@SubscribeEvent public void onLootTableLoad (LootTableLoadEvent event) { if (allowDungeonLoot && event.getName().equals(LootTableList.CHESTS_NETHER_BRIDGE)) { final LootPool main = event.getTable().getPool("main"); if (main != null) { main.addEntry(new LootEntryItem(itemRing, weight, 0, new LootFunction[] { new SetDamage(new LootCondition[0], new RandomValueRange(0, ItemRing.varients.length - 1)) }, new LootCondition[0], "darkutils:nether_rings")); } } }
@SubscribeEvent public void onLootTableLoad (LootTableLoadEvent event) { final LootTable table = event.getTable(); if (skeletonDropDust && event.getName().equals(LootTableList.ENTITIES_WITHER_SKELETON)) { final LootPool pool1 = table.getPool("pool1"); if (pool1 != null) { pool1.addEntry(new LootEntryItem(itemMaterial, dustDropWeight, 0, new LootFunction[0], new LootCondition[0], DarkUtils.MOD_ID + ":wither_dust")); } } }
@SubscribeEvent public static 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); pool.addEntry(getEntry(MOD_ID + "_" + name.replace(FISHING, ""), name, getVanillaQuality(entry), getVanillaWeight(entry))); } } } }
private void onLootChestTableLoad(LootPool main, LootTableLoadEvent event) { if (event.getName() == LootTableList.CHESTS_SPAWN_BONUS_CHEST) { fillBonusChest(main); } else if (event.getName() == LootTableList.CHESTS_IGLOO_CHEST) { fillIglooChest(main); } else if (event.getName() == LootTableList.CHESTS_END_CITY_TREASURE) { fillEndCityChest(main); } else if (chests.contains(event.getName())) { // every other pool fillGenericChest(main); } }
private void fillPoolFromMap(LootPool main, Map<Item, Integer> map) { synchronized (map) { for (Map.Entry<Item, Integer> entry : map.entrySet()) { addLoot(main, entry.getKey(), entry.getValue()); } } }
@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 CustomLootTable(LootPool[] poolsIn) { super(poolsIn); }
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"); }
@SubscribeEvent public void onLootTableLoad(LootTableLoadEvent e) { Worldgen.addLoot(e.getTable(), e.getName()); if (BBConfig.moreBones) { if(e.getName().equals(LootTableList.ENTITIES_SKELETON)) { LootPool pool1 = e.getTable().getPool("pool1"); pool1.removeEntry("minecraft:bone"); pool1.addEntry(new LootEntryItem(Items.BONE, 1, 1, new LootFunction[] {LootUtil.createCountFunction(1, 3), LootUtil.createLootingFunc(0, 1)}, LootUtil.NO_CONDITIONS, Items.BONE.getRegistryName().toString())); } } if (BBConfig.flamingAnimalsDropCharredMeat) { if(e.getName().equals(LootTableList.ENTITIES_COW)) { replaceCookedWithCharred(e.getTable().getPool("pool1"), Items.BEEF, new ItemStack(RegisterItems.charredMeat, 1, ItemCharredMeat.META_MEAT), 1, 3); } else if(e.getName().equals(LootTableList.ENTITIES_PIG)) { replaceCookedWithCharred(e.getTable().getPool("main"), Items.PORKCHOP, new ItemStack(RegisterItems.charredMeat, 1, ItemCharredMeat.META_MEAT), 1, 3); } else if(e.getName().equals(LootTableList.ENTITIES_CHICKEN)) { replaceCookedWithCharred(e.getTable().getPool("pool1"), Items.CHICKEN, new ItemStack(RegisterItems.charredMeat, 1, ItemCharredMeat.META_CHICKEN), 1, 1); } else if(e.getName().equals(LootTableList.ENTITIES_SHEEP)) { replaceCookedWithCharred(e.getTable().getPool("main"), Items.MUTTON, new ItemStack(RegisterItems.charredMeat, 1, ItemCharredMeat.META_MUTTON), 1, 2); } else if(e.getName().equals(LootTableList.ENTITIES_RABBIT)) { replaceCookedWithCharred(e.getTable().getPool("pool1"), Items.RABBIT, new ItemStack(RegisterItems.charredMeat, 1, ItemCharredMeat.META_RABBIT), 0, 1); } } else { if(e.getName().equals(LootTableList.ENTITIES_COW)) { removeSmeltFunction(e.getTable().getPool("pool1"), Items.BEEF, Items.COOKED_BEEF, 1, 3); } else if(e.getName().equals(LootTableList.ENTITIES_PIG)) { removeSmeltFunction(e.getTable().getPool("main"), Items.PORKCHOP, Items.COOKED_PORKCHOP, 1, 3); } else if(e.getName().equals(LootTableList.ENTITIES_CHICKEN)) { removeSmeltFunction(e.getTable().getPool("pool1"), Items.CHICKEN, Items.COOKED_CHICKEN, 1, 1); } else if(e.getName().equals(LootTableList.ENTITIES_SHEEP)) { removeSmeltFunction(e.getTable().getPool("main"), Items.MUTTON, Items.COOKED_MUTTON, 1, 2); } else if(e.getName().equals(LootTableList.ENTITIES_RABBIT)) { removeSmeltFunction(e.getTable().getPool("pool1"), Items.RABBIT, Items.COOKED_RABBIT, 0, 1); } } if(e.getName().equals(LootTableList.ENTITIES_SPIDER) || e.getName().equals(LootTableList.ENTITIES_CAVE_SPIDER)) { if (!BBConfig.spidersDropString) { e.getTable().getPool("main").removeEntry("minecraft:string"); } e.getTable().getPool("main").addEntry(new LootEntryItem(RegisterItems.silk, 1, 1, new LootFunction[] {LootUtil.createCountFunction(2, 4), LootUtil.createLootingFunc(0, 1)}, LootUtil.NO_CONDITIONS, RegisterItems.silk.getRegistryName().toString())); } }
public static List<LootPool> getPools(LootTable table) { return ReflectionHelper.getPrivateValue(LootTable.class, table, "pools", "field_186466_c"); }
public static List<LootEntry> getEntries(LootPool pool) { return ReflectionHelper.getPrivateValue(LootPool.class, pool, "lootEntries", "field_186453_a"); }
public 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 addLoot(LootPool pool, Item item, int weight) { pool.addEntry(new LootEntryItem(item, weight, 0, new LootFunction[0], new LootCondition[0], Reference.MOD_ID + item.getUnlocalizedName())); }
private void fillEndCityChest(LootPool main) { fillPoolFromMap(main, LootTableRegistry.endCityChest); }
private void fillGenericChest(LootPool main) { fillPoolFromMap(main, LootTableRegistry.genericChest); }
private void fillIglooChest(LootPool main) { fillPoolFromMap(main, LootTableRegistry.iglooChest); }
private void fillBonusChest(LootPool main) { fillPoolFromMap(main, LootTableRegistry.bonusChest); }
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.getUnlocalizedName())); } }
@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 LootPool createPool(ResourceLocation injectionEntry) { return new LootPool(new LootEntry[] { loadEntry(injectionEntry) }, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0, 1), "openmods_inject_pool"); }