Kalma Posted September 30, 2020 Share Posted September 30, 2020 Hi there! I'm trying to inject my own loot tables within the vanilla chests ones, so there is a chance that a player can find one of those items and blocks. I am doing that in two separate mods. The weird thing is: if I run each mod separately, the loot_tables work fine, and you can find the items or blocks in vanilla chests. But if I run the game with both mods, the common loot tables fail! (in one of the mods I inject my own table in all chests tables, while in the other mod I just inject the tables on some specific chests tables... it is in those tables "common" which fails when running both at the same time!). Totally lost here (it would be easier if it ALWAYS fail!). Here is my event handler: public class onLooTableLoadListener { @SubscribeEvent public void onLootTablesLoad(final LootTableLoadEvent event) { // Test: /loot give @p loot minecraft:chests/end_city_treasure if (event.getName().equals(new ResourceLocation("minecraft", "chests/buried_treasure")) || event.getName().equals(new ResourceLocation("minecraft", "chests/underwater_ruin_big")) || event.getName().equals(new ResourceLocation("minecraft", "chests/pillager_outpost")) || event.getName().equals(new ResourceLocation("minecraft", "chests/end_city_treasure")) || event.getName().equals(new ResourceLocation("minecraft", "chests/stronghold_library")) ) { event.getTable().addPool(LootPool.builder().addEntry(TableLootEntry.builder(new ResourceLocation(MODID, "chests/time_sword"))).build()); } } } The handler on the other mod: public class onLooTableLoadListener { @SubscribeEvent public void onLootTablesLoad(final LootTableLoadEvent event) { String prefix = "minecraft:chests/"; String name = event.getName().toString(); if (name.startsWith(prefix)) { event.getTable().addPool(LootPool.builder().addEntry(TableLootEntry.builder(new ResourceLocation(Refs.MODID, "chests/lazy_builder"))).build()); } } } The loot table .json file (I have tried many many different combinations, adding and removing fields... they all with the same result): { "pools": [{ "rolls": 1, "entries": [ { "type": "item", "name": "simpleclock:time_sword", "weight": 50, "functions": [ { "function": "minecraft:set_count", "count": { "min": 1.0, "max": 1.0, "type": "minecraft:uniform" } } ] } ] }] } And the second loot table .json file { "pools": [{ "rolls": 1, "entries": [ { "type": "minecraft:item", "name": "lazybuilder:start_block", "weight": 30, "functions": [ { "function": "minecraft:set_count", "count": { "min": 1.0, "max": 1.0, "type": "minecraft:uniform" } } ] }, { "type": "minecraft:item", "name": "lazybuilder:mid_block", "weight": 30, "functions": [ { "function": "minecraft:set_count", "count": { "min": 1.0, "max": 1.0, "type": "minecraft:uniform" } } ] }, { "type": "minecraft:item", "name": "lazybuilder:end_block", "weight": 30, "functions": [ { "function": "minecraft:set_count", "count": { "min": 1.0, "max": 1.0, "type": "minecraft:uniform" } } ] }, { "type": "minecraft:item", "name": "lazybuilder:copy_paste_block", "weight": 10, "functions": [ { "function": "minecraft:set_count", "count": { "min": 1.0, "max": 1.0, "type": "minecraft:uniform" } } ] } ] }] } Link to comment Share on other sites More sharing options...
Draco18s Posted September 30, 2020 Share Posted September 30, 2020 16 minutes ago, Kalma said: public void onLootTablesLoad(final LootTableLoadEvent event) { Do not use this, use GlobalLootModifiers. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given. Link to comment Share on other sites More sharing options...
Kalma Posted September 30, 2020 Author Share Posted September 30, 2020 Totally different approach... I will give it a try (will need some extra-time though). Thanks for your prompt reply!!! Link to comment Share on other sites More sharing options...
Kalma Posted October 7, 2020 Author Share Posted October 7, 2020 Sorry to reopen this thread... and sorry again because I forgot something crucial in my previous post: I am using Forge 1.14.4. I finally got the time to attempt this other method, but my IDE (Eclipse) is not able to find LootModifier class (nor even trying to import it from here: net.minecraftforge.common.loot.LootModifier) In addition to that, I am not sure how to inject my custom pools to the existing chests loot_tables using this method. The documentation here: https://mcforge.readthedocs.io/en/1.14.x/items/globallootmodifiers/#global-loot-modifiers. explains how to create independent loot_tables, but not how to inject them... anyone knows where to investigate more in detail? Thx!!! Link to comment Share on other sites More sharing options...
Recommended Posts