Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

  • 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.

  • 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;
        }
    }

 

  • 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

  • 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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.