Posted March 1, 20205 yr Hi, I am trying to add new loot to chests. I started with the bonus spawn chest : Spoiler @Mod.EventBusSubscriber(modid = ThelastofcraftMod.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE) public class LootTablesSetup { @SubscribeEvent public void onLootTablesLoaded(LootTableLoadEvent event) { if (event.getName().equals(LootTables.CHESTS_SPAWN_BONUS_CHEST)) { LootTable table = event.getLootTableManager().getLootTableFromLocation(LootTables.CHESTS_SPAWN_BONUS_CHEST); table.addPool(LootPool.builder().name("TLOC_tool") .addEntry(ItemLootEntry.builder(Registration.MODTOOL.get()).weight(20).acceptFunction(SetCount.builder(ConstantRange.of(1)))) .addEntry(ItemLootEntry.builder(Registration.SIGHT.get()).weight(15).acceptFunction(SetCount.builder(BinomialRange.of(1, 0.3F)))) .build()); table.addPool(LootPool.builder().name("TLOC_misc") .rolls(RandomValueRange.of(20.0F, 30.0F)) .addEntry(ItemLootEntry.builder(Registration.WEAPONPART.get()).weight(15)) .addEntry(ItemLootEntry.builder(Registration.BULLET_ITEM.get()).weight(20)) .build()); table.addPool(LootPool.builder().name("TLOC_gun") .rolls(ConstantRange.of(1)) .addEntry(ItemLootEntry.builder(Registration.SHOTGUN.get()).weight(5)) .addEntry(ItemLootEntry.builder(Registration.RIFLE.get()).weight(5)) .addEntry(ItemLootEntry.builder(Registration.REVOLVER.get()).weight(15)) .addEntry(ItemLootEntry.builder(Registration.PISTOL.get()).weight(10)) .addEntry(ItemLootEntry.builder(Items.AIR).weight(3)) .build()); table.addPool(LootPool.builder().name("TLOC_throwable") .rolls(RandomValueRange.of(1.0F, 3.0F)) .addEntry(ItemLootEntry.builder(Registration.MOLOTOV_ITEM.get()).weight(20)) .addEntry(ItemLootEntry.builder(Registration.NAILBOMB_ITEM.get()).weight(15)) .build()); } } } Is this the right way to do it ? I suppose not since it doesn't work.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.