Moonlight Lib

Moonlight Lib

86M Downloads

Documentation suggestion: Loot table extension example

ehx-v1 opened this issue ยท 4 comments

commented

From what I understand of the Features section in the CurseForge description, it should be possible to use this for extending loot tables, i.e. loading a pre-existing loot table and generating an overwriting loot table that has all the pre-existing content (including all prior modifications) with some additions and/or removals (that even might be loaded from a JSON file of their own). If that's the case, it seems like a fairly common use case that developers would have, and might warrant an example of its own (as none of the listed examples appears to cover that use case).

commented

Moonlight allows you to generate any asset dynamically, for both datapacks and resource packs.

I have a hypothetical way in my head:

  1. Load an existing loot table as JSON, or copy Vanilla's loading steps to fetch a pre-stacked loot table
  2. Add and remove entries to suit your needs
  3. Output the result as a loot table under the same namespace with the same name

These 3 steps could then be fleshed out into example code. That's primarily for hardcoding the loot table changes though, loading them from a JSON structure would just be a Moonlight addon.

commented

Actually my dynamic generation system does not have anything to Parse loot tables. It can generate any file those included and you can feed it s vanilla builder to make a new one but to modify an existing one you can simply load it and string replace what's in there or parse it, likely using some vanilla method. The only relevant step here for this lib is the adding a JSON entry to the dynamic pack and that's documented in the docs and example. The rest, loading existing, parsing, adding entries is all vanilla code. Having said that idk why anybody would need to use this when global loot modifiers exist

commented

hm where did you read that? Which line? I dont recall anything specifically related to loot tales
all features on cf page have javadocs and example classes in the example package

commented

global loot modifiers

Completely forgot about those tbh.