How do you add item drops to existing trees?


#1

I’m new to modding, and I really want to mod for this game. For the mod idea I have, I want to add drops to trees that already exist in the game. I looked in the json for the small juniper tree, and I think I need to add a resource somewhere under the resource_loot_table object. I can’t really figure that json out though. I get that the resource property details the wood it drops, but why are the seeds it drops under the “pelt” object? I read somewhere on this forum that the “none” loot table entry is used to make sure the seeds are not dropped all of the time, but does that mean that seeds will be dropped less often if I add an item there? I don’t really want to influence the existing drops. How do I avoid doing that?
And lastly, I know that if you want to modify the game in a neat way, you need to use mixins to add to existing json, rather than edit it directly. But from the first line of the small juniper tree json, it seems like this is already a mixin. Can you write a mixin for a mixin? Or do you need to mix into the original file?


#2

The format of loot tables is described in some detail in loot_table.lua.

why are the seeds it drops under the “pelt” object?

The naming is probably a copy-paste oversight. The keys in that list are just unique identifiers within the list. It doesn’t matter what they are.

I read somewhere on this forum that the “none” loot table entry is used to make sure the seeds are not dropped all of the time, but does that mean that seeds will be dropped less often if I add an item there? I don’t really want to influence the existing drops. How do I avoid doing that?

Add a separate entry directly under entries. That won’t affect other entries.

And lastly, I know that if you want to modify the game in a neat way, you need to use mixins to add to existing json, rather than edit it directly. But from the first line of the small juniper tree json, it seems like this is already a mixin. Can you write a mixin for a mixin? Or do you need to mix into the original file?

You can mixinto any URI. See Mixintos and overrides.


#3

Thank you very much for the tips and references. I learned a lot, and I got it working.