Posted February 6, 20214 yr Hello again. I've been for some time trying to add fishing to loot tables and it seems it is now possible with GLM using the new loot_table_id condition. However, I've run into a hurdle. I'm adding fish and therefore want to add loot to this loot table: loot_tables/gameplay/fishing/fish.json. But when I do this the fish is not possible to get from fishing or using "/loot give @p fish minecraft:gameplay/fishing ~ ~ ~ ". Only when I use this command can I get my fish: "/loot give @p fish minecraft:gameplay/fishing/fish ~ ~ ~". I've tried debugging it and it seems like the doApply does not get fired when I'm fishing even though I'm modifying that loot table. Loot table class: https://github.com/Phrille/Vanilla-Boom/blob/master/src/main/java/phrille/vanillaboom/loot/LootTableHandler.java Loot modifier json: https://github.com/Phrille/Vanilla-Boom/blob/master/src/main/resources/data/vanillaboom/loot_modifiers/fish.json Fish loot table (referenced in the loot modifier json): https://github.com/Phrille/Vanilla-Boom/blob/master/src/main/resources/data/vanillaboom/loot_tables/gameplay/fishing/fish.json My mod for futher awesomeness: http://www.minecraftforum.net/topic/1714396-the-decopack-collection-v010-wip-made-a-signature-new-snapshot-1-screenshots-are-up-small-snapshot-1-is-out-for-147/#entry21250399
February 6, 20214 yr Author Yes but when something is fished it calls the fishing loot table which in turn calls fish.json in which I add my loot. How would I otherwise go about adding this? Because if I modify fishing.json more than one fish will added to the loot table. My mod for futher awesomeness: http://www.minecraftforum.net/topic/1714396-the-decopack-collection-v010-wip-made-a-signature-new-snapshot-1-screenshots-are-up-small-snapshot-1-is-out-for-147/#entry21250399
February 7, 20214 yr Author Would I need reflection to do this? My mod for futher awesomeness: http://www.minecraftforum.net/topic/1714396-the-decopack-collection-v010-wip-made-a-signature-new-snapshot-1-screenshots-are-up-small-snapshot-1-is-out-for-147/#entry21250399
February 7, 20214 yr Author Alright then I'll try this out My mod for futher awesomeness: http://www.minecraftforum.net/topic/1714396-the-decopack-collection-v010-wip-made-a-signature-new-snapshot-1-screenshots-are-up-small-snapshot-1-is-out-for-147/#entry21250399
February 8, 20214 yr Author Is this the way to do it? Because this isn't working for me yet. This extends my previous LootModifier which handles the serialization. public static class FishLootModifier extends LootTableDropModifier { public FishLootModifier(ILootCondition[] conditions, TableLootEntry lootTable, Item[] overwrite) { super(conditions, lootTable, overwrite); } @Nonnull @Override protected List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext context) { try { Field field = context.getClass().getField("lootTables"); //Just for testing purposes, change to obfuscated name later field.setAccessible(true); Set<LootTable> set = (Set<LootTable>) field.get(context); if (set.size() == 1) { return super.doApply(generatedLoot, context); //Adds my table to the list } } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException("Could not add access lootTables", e); } return generatedLoot; } } My mod for futher awesomeness: http://www.minecraftforum.net/topic/1714396-the-decopack-collection-v010-wip-made-a-signature-new-snapshot-1-screenshots-are-up-small-snapshot-1-is-out-for-147/#entry21250399
February 8, 20214 yr Author Ah yes of course, I fixed that error but now my fish doesn't show up at all, just the vanilla fish. My mod for futher awesomeness: http://www.minecraftforum.net/topic/1714396-the-decopack-collection-v010-wip-made-a-signature-new-snapshot-1-screenshots-are-up-small-snapshot-1-is-out-for-147/#entry21250399
February 8, 20214 yr Author Still no luck I'm afraid, now I'm back to the same problem where both the vanilla fish and my fish is added at the same time... Updated my git repo for reference: https://github.com/Phrille/Vanilla-Boom/blob/master/src/main/java/phrille/vanillaboom/loot/LootTableHandler.java My mod for futher awesomeness: http://www.minecraftforum.net/topic/1714396-the-decopack-collection-v010-wip-made-a-signature-new-snapshot-1-screenshots-are-up-small-snapshot-1-is-out-for-147/#entry21250399
February 8, 20214 yr Author What I'm trying to achieve is adding a new fish and then when fishing, either my fish or a vanilla one get fished up. I can't add it to gamplay/fishing/fish.json since like you said: "nested" loot tables will not be affected by GLM. So how do I go about adding a fish to a vanilla loot table without using LootTableLoadEvent that will allow a random fish (vanilla or modded) to be captured. And not wto fish at the same time. My mod for futher awesomeness: http://www.minecraftforum.net/topic/1714396-the-decopack-collection-v010-wip-made-a-signature-new-snapshot-1-screenshots-are-up-small-snapshot-1-is-out-for-147/#entry21250399
February 8, 20214 yr Author Ah of course, I took this route and it seems to be working fine now: https://github.com/Phrille/Vanilla-Boom/blob/master/src/main/java/phrille/vanillaboom/loot/LootTableHandler.java My mod for futher awesomeness: http://www.minecraftforum.net/topic/1714396-the-decopack-collection-v010-wip-made-a-signature-new-snapshot-1-screenshots-are-up-small-snapshot-1-is-out-for-147/#entry21250399
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.