use of net.minecraft.world.storage.loot.functions.LootFunction in project MinecraftForge by MinecraftForge.
the class LootTablesDebug method lootLoad.
@SubscribeEvent
public void lootLoad(LootTableLoadEvent event) {
if (!event.getName().equals(LootTableList.CHESTS_SPAWN_BONUS_CHEST))
return;
// Remove axes and replace with chestpeice, First vanilla entry is always called "main"
//Note: This CAN NPE if another mod removes things
LootPool main = event.getTable().getPool("main");
main.removeEntry("minecraft:wooden_axe");
main.removeEntry("minecraft:stone_axe");
main.addEntry(new LootEntryItem(Items.DIAMOND_CHESTPLATE, 1, 0, new LootFunction[0], new LootCondition[0], MODID + ":diamond_chestplate"));
// Get rid of all building mats. Which is pool #3, index starts at 0, but 0 is named "main"
event.getTable().removePool("pool3");
}
use of net.minecraft.world.storage.loot.functions.LootFunction in project ConvenientAdditions by Necr0.
the class ModLoot method onLootTableLoad.
@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent event) {
ResourceLocation n = event.getName();
if (n.equals(LootTableList.CHESTS_END_CITY_TREASURE)) {
if (ModConfigTools.mobCatcher_loot)
event.getTable().getPool("main").addEntry(new LootEntryItem(ModItems.itemMobCatcherMega, 1, 3, new LootFunction[0], new LootCondition[0], ModConstants.Mod.MODID + ":megaMCD"));
} else if (n.equals(LootTableList.CHESTS_STRONGHOLD_CORRIDOR)) {
if (ModConfigTools.mobCatcher_loot)
event.getTable().getPool("main").addEntry(new LootEntryItem(ModItems.itemMobCatcherHyper, 1, 3, new LootFunction[0], new LootCondition[0], ModConstants.Mod.MODID + ":hyperMCD"));
} else if (n.equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) {
if (ModConfigTools.mobCatcher_loot) {
event.getTable().getPool("main").addEntry(new LootEntryItem(ModItems.itemMobCatcherSuper, 1, 3, new LootFunction[0], new LootCondition[0], ModConstants.Mod.MODID + ":superMCD"));
event.getTable().getPool("main").addEntry(new LootEntryItem(ModItems.itemMobCatcherRegular, 3, -2, new LootFunction[0], new LootCondition[0], ModConstants.Mod.MODID + ":regularMCD"));
}
}
}
use of net.minecraft.world.storage.loot.functions.LootFunction in project EnderIO by SleepyTrousers.
the class LootManager method onLootTableLoad.
@SubscribeEvent
public void onLootTableLoad(@Nonnull LootTableLoadEvent evt) {
LootTable table = evt.getTable();
LootPool lp = new LootPool(new LootEntry[0], NO_CONDITIONS, new RandomValueRange(1, 3), new RandomValueRange(0, 0), EnderIO.MOD_NAME);
if (evt.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) {
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));
} else if (evt.getName().equals(LootTableList.CHESTS_ABANDONED_MINESHAFT)) {
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));
} else if (evt.getName().equals(LootTableList.CHESTS_NETHER_BRIDGE)) {
lp.addEntry(createDarkSteelLootEntry(ModObject.itemDarkSteelBoots.getItemNN(), 0.1F));
lp.addEntry(createLootEntry(Material.GEAR_IRON.getStack(), 1, 2, 0.5F));
lp.addEntry(createLootCapacitor(0.15F));
} else if (evt.getName().equals(LootTableList.CHESTS_IGLOO_CHEST)) {
final CapturedMob polarBear = CapturedMob.create(new ResourceLocation("minecraft", "polar_bear"));
if (polarBear != null) {
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));
lp.addEntry(createLootCapacitor(0.05F));
} else if (evt.getName().equals(LootTableList.CHESTS_JUNGLE_TEMPLE_DISPENSER)) {
ItemStack bucket = Fluids.FIRE_WATER.getBucket();
lp.addEntry(new LootEntryItem(bucket.getItem(), 1, 1, new LootFunction[] { setCount(1, 1), setMetadata(bucket.getMetadata()), setNBT(bucket) }, new LootCondition[] { new RandomChance(.05F) }, bucket.getItem().getUnlocalizedName() + ":" + bucket.getMetadata()));
} else if (evt.getName().equals(LootTableList.CHESTS_VILLAGE_BLACKSMITH)) {
lp.addEntry(createLootEntry(Alloy.ELECTRICAL_STEEL.getStackIngot(), 2, 6, 0.20F));
lp.addEntry(createLootEntry(Alloy.REDSTONE_ALLOY.getStackIngot(), 3, 6, 0.35F));
lp.addEntry(createLootEntry(Alloy.DARK_STEEL.getStackIngot(), 3, 6, 0.35F));
lp.addEntry(createLootEntry(Alloy.PULSATING_IRON.getStackIngot(), 1, 2, 0.3F));
lp.addEntry(createLootEntry(Alloy.VIBRANT_ALLOY.getStackIngot(), 1, 2, 0.2F));
lp.addEntry(createLootEntry(Material.GEAR_WOOD.getStack(), 1, 2, 0.5F));
lp.addEntry(createLootEntry(Material.GEAR_STONE.getStack(), 1, 2, 0.4F));
lp.addEntry(createLootEntry(Material.GEAR_IRON.getStack(), 1, 2, 0.25F));
lp.addEntry(createLootEntry(Material.GEAR_ENERGIZED.getStack(), 1, 2, 0.125F));
lp.addEntry(createLootEntry(Material.GEAR_VIBRANT.getStack(), 1, 2, 0.0625F));
lp.addEntry(createDarkSteelLootEntry(ModObject.itemDarkSteelSword.getItemNN(), 1, 1, 0.25F));
lp.addEntry(createDarkSteelLootEntry(ModObject.itemDarkSteelBoots.getItemNN(), 1, 1, 0.25F));
lp.addEntry(createLootCapacitor(0.1F));
} else if (evt.getName().equals(LootTableList.CHESTS_DESERT_PYRAMID)) {
lp.addEntry(createDarkSteelLootEntry(ModObject.itemDarkSteelSword.getItemNN(), 0.2F));
lp.addEntry(createLootEntry(Material.GEAR_VIBRANT.getStack(), 1, 2, 0.0625F));
lp.addEntry(createLootEntry(itemTravelStaff.getItemNN(), 0.1F));
lp.addEntry(createLootCapacitor(25));
} else if (evt.getName().equals(LootTableList.CHESTS_JUNGLE_TEMPLE)) {
lp.addEntry(createDarkSteelLootEntry(ModObject.itemDarkSteelSword.getItemNN(), 1, 1, 0.25F));
lp.addEntry(createLootEntry(itemTravelStaff.getItemNN(), 1, 1, 0.1F));
lp.addEntry(createLootCapacitor(0.25F));
lp.addEntry(createLootCapacitor(0.25F));
} else if (evt.getName().equals(LootTableList.CHESTS_WOODLAND_MANSION)) {
lp.addEntry(createDarkSteelLootEntry(ModObject.itemDarkSteelBow.getItemNN(), 1, 1, 0.25F));
lp.addEntry(createDarkSteelLootEntry(ModObject.itemDarkSteelAxe.getItemNN(), 1, 1, 0.25F));
lp.addEntry(createLootEntry(Material.GEAR_STONE.getStack(), 1, 2, 0.4F));
lp.addEntry(createLootCapacitor(0.25F));
lp.addEntry(createLootEntry(itemTravelStaff.getItemNN(), 1, 1, 0.1F));
} else if (evt.getName().equals(LootTableList.CHESTS_END_CITY_TREASURE)) {
final CapturedMob shulker = CapturedMob.create(new ResourceLocation("minecraft", "shulker"));
if (shulker != null) {
lp.addEntry(new LootEntryItem(ModObject.itemSoulVial.getItemNN(), 1, 1, new LootFunction[] { setCount(1, 1), new SetNBT(NO_CONDITIONS, shulker.toNbt(null)) }, new LootCondition[] { new RandomChance(.2F) }, "ShulkerSoulVial"));
}
lp.addEntry(createLootEntry(ModObject.itemSoulVial.getItemNN(), 1, 3, 0.5F));
lp.addEntry(createLootEntry(Material.GEAR_ENERGIZED.getStack(), 1, 2, 0.125F));
lp.addEntry(createLootEntry(Material.GEAR_VIBRANT.getStack(), 1, 2, 0.125F));
lp.addEntry(createLootCapacitor(0.05F));
lp.addEntry(createDarkSteelLootEntry(ModObject.itemDarkSteelBow.getItemNN(), 1, 1, 0.25F));
} else {
return;
}
if (table.isFrozen()) {
throw new RuntimeException("Some other mod (a list of suspects is printed in the log file) put a frozen loot table into the load event for loot table '" + evt.getName() + "'. This is a bug in that other mod. Ender IO is the victim here. Don't blame the victim!");
}
table.addPool(lp);
}
use of net.minecraft.world.storage.loot.functions.LootFunction in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class ChestGen method loadLoot.
@SubscribeEvent
public void loadLoot(LootTableLoadEvent event) {
NBTTagCompound MythrilCrystal = new NBTTagCompound();
MythrilCrystal.setString("material", Strings.SM_MythrilCrystal);
MythrilCrystal.setString("rank", Strings.SM_Rank_S);
LootFunction[] setMythrilCrystal = new LootFunction[] { new SetNBT(new LootCondition[0], MythrilCrystal), new SetCount(new LootCondition[0], new RandomValueRange(1, 5)) };
NBTTagCompound MythrilGem = new NBTTagCompound();
MythrilGem.setString("material", Strings.SM_MythrilGem);
MythrilGem.setString("rank", Strings.SM_Rank_A);
LootFunction[] setMythrilGem = new LootFunction[] { new SetNBT(new LootCondition[0], MythrilGem), new SetCount(new LootCondition[0], new RandomValueRange(1, 5)) };
NBTTagCompound MythrilStone = new NBTTagCompound();
MythrilStone.setString("material", Strings.SM_MythrilStone);
MythrilStone.setString("rank", Strings.SM_Rank_B);
LootFunction[] setMythrilStone = new LootFunction[] { new SetNBT(new LootCondition[0], MythrilStone), new SetCount(new LootCondition[0], new RandomValueRange(1, 5)) };
NBTTagCompound MythrilShard = new NBTTagCompound();
MythrilShard.setString("material", Strings.SM_MythrilShard);
MythrilShard.setString("rank", Strings.SM_Rank_C);
LootFunction[] setMythrilShard = new LootFunction[] { new SetNBT(new LootCondition[0], MythrilShard), new SetCount(new LootCondition[0], new RandomValueRange(1, 5)) };
NBTTagCompound Orichalcum = new NBTTagCompound();
Orichalcum.setString("material", Strings.SM_Orichalcum);
Orichalcum.setString("rank", Strings.SM_Rank_A);
LootFunction[] setOrichalcum = new LootFunction[] { new SetNBT(new LootCondition[0], Orichalcum), new SetCount(new LootCondition[0], new RandomValueRange(1, 5)) };
NBTTagCompound OrichalcumPlus = new NBTTagCompound();
OrichalcumPlus.setString("material", Strings.SM_OrichalcumPlus);
OrichalcumPlus.setString("rank", Strings.SM_Rank_S);
LootFunction[] setOrichalcumPlus = new LootFunction[] { new SetNBT(new LootCondition[0], OrichalcumPlus), new SetCount(new LootCondition[0], new RandomValueRange(1, 5)) };
NBTTagCompound LostIllusion = new NBTTagCompound();
LostIllusion.setString("material", Strings.SM_LostIllusion);
LostIllusion.setString("rank", Strings.SM_Rank_S);
LootFunction[] setLostIllusion = new LootFunction[] { new SetNBT(new LootCondition[0], LostIllusion), new SetCount(new LootCondition[0], new RandomValueRange(1, 5)) };
NBTTagCompound ManifestIllusion = new NBTTagCompound();
ManifestIllusion.setString("material", Strings.SM_ManifestIllusion);
ManifestIllusion.setString("rank", Strings.SM_Rank_A);
LootFunction[] setManifestIllusion = new LootFunction[] { new SetNBT(new LootCondition[0], ManifestIllusion), new SetCount(new LootCondition[0], new RandomValueRange(1, 5)) };
if (event.getName().getResourcePath().contains("chests")) {
LootFunction[] setSingleStack = { new SetCount(new LootCondition[0], new RandomValueRange(1, 1)) };
LootEntry[] materialEntries = { new LootEntryItem(ModItems.SynthesisMaterial, 5, 0, setMythrilCrystal, new LootCondition[0], Reference.MODID + ":" + ModItems.SynthesisMaterial.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.SynthesisMaterial, 10, 0, setMythrilGem, new LootCondition[0], Reference.MODID + ":" + ModItems.SynthesisMaterial.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.SynthesisMaterial, 20, 0, setMythrilStone, new LootCondition[0], Reference.MODID + ":" + ModItems.SynthesisMaterial.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.SynthesisMaterial, 30, 0, setMythrilShard, new LootCondition[0], Reference.MODID + ":" + ModItems.SynthesisMaterial.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.SynthesisMaterial, 10, 0, setOrichalcum, new LootCondition[0], Reference.MODID + ":" + ModItems.SynthesisMaterial.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.SynthesisMaterial, 5, 0, setOrichalcumPlus, new LootCondition[0], Reference.MODID + ":" + ModItems.SynthesisMaterial.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.SynthesisMaterial, 5, 0, setLostIllusion, new LootCondition[0], Reference.MODID + ":" + ModItems.SynthesisMaterial.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.SynthesisMaterial, 10, 0, setManifestIllusion, new LootCondition[0], Reference.MODID + ":" + ModItems.SynthesisMaterial.getUnlocalizedName().substring(5)) };
LootEntry[] musicDiscEntries = { new LootEntryItem(ModItems.Disc_Birth_by_Sleep_A_Link_to_the_Future, 5, 0, setSingleStack, new LootCondition[0], Reference.MODID + ":" + ModItems.Disc_Birth_by_Sleep_A_Link_to_the_Future.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.Disc_Darkness_of_the_Unknown, 5, 0, setSingleStack, new LootCondition[0], Reference.MODID + ":" + ModItems.Disc_Darkness_of_the_Unknown.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.Disc_Dearly_Beloved_Symphony_Version, 5, 0, setSingleStack, new LootCondition[0], Reference.MODID + ":" + ModItems.Disc_Dearly_Beloved_Symphony_Version.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.Disc_Dream_Drop_Distance_The_Next_Awakening, 5, 0, setSingleStack, new LootCondition[0], Reference.MODID + ":" + ModItems.Disc_Dream_Drop_Distance_The_Next_Awakening.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.Disc_Hikari_KINGDOM_Instrumental_Version, 5, 0, setSingleStack, new LootCondition[0], Reference.MODID + ":" + ModItems.Disc_Hikari_KINGDOM_Instrumental_Version.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.Disc_L_Oscurita_Dell_Ignoto, 5, 0, setSingleStack, new LootCondition[0], Reference.MODID + ":" + ModItems.Disc_L_Oscurita_Dell_Ignoto.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.Disc_Musique_pour_la_tristesse_de_Xion, 5, 0, setSingleStack, new LootCondition[0], Reference.MODID + ":" + ModItems.Disc_Musique_pour_la_tristesse_de_Xion.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.Disc_No_More_Bugs_Bug_Version, 5, 0, setSingleStack, new LootCondition[0], Reference.MODID + ":" + ModItems.Disc_No_More_Bugs_Bug_Version.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.Disc_Organization_XIII, 5, 0, setSingleStack, new LootCondition[0], Reference.MODID + ":" + ModItems.Disc_Organization_XIII.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.Disc_Sanctuary, 5, 0, setSingleStack, new LootCondition[0], Reference.MODID + ":" + ModItems.Disc_Sanctuary.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.Disc_Simple_And_Clean_PLANITb_Remix, 5, 0, setSingleStack, new LootCondition[0], Reference.MODID + ":" + ModItems.Disc_Simple_And_Clean_PLANITb_Remix.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.Disc_Sinister_Sundown, 5, 0, setSingleStack, new LootCondition[0], Reference.MODID + ":" + ModItems.Disc_Sinister_Sundown.getUnlocalizedName().substring(5)), new LootEntryItem(ModItems.Disc_The_13th_Anthology, 5, 0, setSingleStack, new LootCondition[0], Reference.MODID + ":" + ModItems.Disc_The_13th_Anthology.getUnlocalizedName().substring(5)) };
String name = event.getName().getResourcePath();
switch(name) {
case "spawn_bonus_chest":
event.getTable().getPool("main").addEntry(new LootEntryItem(ModItems.Chain_KingdomKey, 5, 10, setSingleStack, new LootCondition[0], Reference.MODID + ":" + ModItems.Chain_KingdomKey.getUnlocalizedName().substring(5)));
break;
case "simple_dungeon":
LootPool musicDiscPool = new LootPool(musicDiscEntries, new LootCondition[0], new RandomValueRange(1, 2), new RandomValueRange(0), "kk_loot_music_discs");
event.getTable().addPool(musicDiscPool);
break;
case "end_city_treasure":
LootEntry[] endCityEntries = { new LootEntryItem(ModItems.LevelUpMagicThunder, 30, 1, new LootFunction[0], new LootCondition[0], Reference.MODID + ":" + ModItems.LevelUpMagicThunder.getUnlocalizedName().substring(5)), new LootEntryEmpty(70, 1, new LootCondition[0], Reference.MODID + ":" + "end_city_empty") };
LootPool endCityPool = new LootPool(endCityEntries, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0), "kk_end_city");
event.getTable().addPool(endCityPool);
break;
case "igloo_chest":
LootEntry[] iglooEntries = { new LootEntryItem(ModItems.LevelUpMagicBlizzard, 30, 1, new LootFunction[0], new LootCondition[0], Reference.MODID + ":" + ModItems.LevelUpMagicBlizzard.getUnlocalizedName().substring(5)), new LootEntryEmpty(70, 1, new LootCondition[0], Reference.MODID + ":" + "igloo_empty") };
LootPool iglooPool = new LootPool(iglooEntries, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0), "kk_igloo");
event.getTable().addPool(iglooPool);
break;
case "nether_bridge":
LootEntry[] netherFortressEntries = { new LootEntryItem(ModItems.LevelUpMagicFire, 30, 1, new LootFunction[0], new LootCondition[0], Reference.MODID + ":" + ModItems.LevelUpMagicFire.getUnlocalizedName().substring(5)), new LootEntryEmpty(70, 1, new LootCondition[0], Reference.MODID + ":" + "nether_fortress_empty") };
LootPool netherFortressPool = new LootPool(netherFortressEntries, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0), "kk_nether_fortress");
event.getTable().addPool(netherFortressPool);
break;
}
try {
LootPool main = event.getTable().getPool("main");
LootEntry[] recipeEntry = { new LootEntryItem(ModItems.Recipe, 30, 1, new LootFunction[0], new LootCondition[0], Reference.MODID + ":" + ModItems.Recipe.getUnlocalizedName().substring(5)), new LootEntryEmpty(70, 1, new LootCondition[0], Reference.MODID + ":" + "recipes_empty") };
main.addEntry(recipeEntry[0]);
main.addEntry(recipeEntry[1]);
} catch (NullPointerException e) {
LootEntry[] recipeEntry = { new LootEntryItem(ModItems.Recipe, 30, 1, new LootFunction[0], new LootCondition[0], Reference.MODID + ":" + ModItems.Recipe.getUnlocalizedName().substring(5)), new LootEntryEmpty(70, 1, new LootCondition[0], Reference.MODID + ":" + "recipes_empty") };
LootPool main = new LootPool(recipeEntry, new LootCondition[0], new RandomValueRange(1, 2), new RandomValueRange(0, 0), "kk_recipes");
}
LootPool materialPool = new LootPool(materialEntries, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0), "kk_loot_rare_materials");
event.getTable().addPool(materialPool);
}
}
use of net.minecraft.world.storage.loot.functions.LootFunction in project Adventurers-Toolbox by the-realest-stu.
the class LootTableHandler method lootTableLoad.
@SubscribeEvent
public static void lootTableLoad(LootTableLoadEvent event) {
if (Config.ENABLE_SCHEMATICS) {
if (!Config.DUNGEON_SCHEMATICS.isEmpty() && event.getName().toString().equals("minecraft:chests/simple_dungeon")) {
LootEntry[] entries = new LootEntry[Config.DUNGEON_SCHEMATICS.size()];
for (int i = 0; i < entries.length; i++) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString(ItemSchematic.type_tag, Config.DUNGEON_SCHEMATICS.get(i));
entries[i] = new LootEntryItem(ModItems.schematic, 1, 0, new LootFunction[] { new SetNBT(new LootCondition[0], nbt) }, new LootCondition[0], Config.DUNGEON_SCHEMATICS.get(i));
}
LootPool pool = new LootPool(entries, new LootCondition[0], new RandomValueRange(0, Math.min(3, entries.length)), new RandomValueRange(0), "schematics");
event.getTable().addPool(pool);
}
if (!Config.BLACKSMITH_SCHEMATICS.isEmpty() && event.getName().toString().equals("minecraft:chests/village_blacksmith")) {
LootEntry[] entries = new LootEntry[Config.BLACKSMITH_SCHEMATICS.size()];
for (int i = 0; i < entries.length; i++) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString(ItemSchematic.type_tag, Config.BLACKSMITH_SCHEMATICS.get(i));
entries[i] = new LootEntryItem(ModItems.schematic, 1, 0, new LootFunction[] { new SetNBT(new LootCondition[0], nbt) }, new LootCondition[0], Config.BLACKSMITH_SCHEMATICS.get(i));
}
LootPool pool = new LootPool(entries, new LootCondition[0], new RandomValueRange(0, Math.min(3, entries.length)), new RandomValueRange(0), "schematics");
event.getTable().addPool(pool);
}
if (!Config.BONUS_CHEST_SCHEMATICS.isEmpty() && event.getName().toString().equals("minecraft:chests/spawn_bonus_chest")) {
LootEntry[] entries = new LootEntry[Config.BONUS_CHEST_SCHEMATICS.size()];
for (int i = 0; i < entries.length; i++) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString(ItemSchematic.type_tag, Config.BONUS_CHEST_SCHEMATICS.get(i));
entries[i] = new LootEntryItem(ModItems.schematic, 1, 0, new LootFunction[] { new SetNBT(new LootCondition[0], nbt) }, new LootCondition[0], Config.BONUS_CHEST_SCHEMATICS.get(i));
}
LootPool pool = new LootPool(entries, new LootCondition[0], new RandomValueRange(0, Math.min(3, entries.length)), new RandomValueRange(0), "schematics");
event.getTable().addPool(pool);
}
}
}
Aggregations