PersonTheCat / OreStoneVariants

A powerful utility for generating new blocks when given a foreground and background.
GNU General Public License v3.0
7 stars 8 forks source link

[Bug] Incompatability with lootjs in 1.16 and 1.18 #173

Closed MundM2007 closed 1 year ago

MundM2007 commented 1 year ago

Firstly I want to apologize for opening so many issues and finding problems with your mod. I don't want to be annoying and this is a great mod, with no other mod being able to do the same as this one.

Describe the bug If You try to use lootjs with this mod and just use a simple script like this one, it will not work.

onEvent("lootjs", (event) => {
    event
        .addBlockLootModifier("osv:iron_ore")
        .thenAdd("minecraft:flint");
});

This code does work if replacing the "osv:iron_ore" with "minecraft:gravel" for example. Code Taken from: https://github.com/AlmostReliable/lootjs/wiki/1.16.5-Actions#thenadditems for 1.18 it's slightly different, check: https://github.com/AlmostReliable/lootjs/wiki/1.18.2-Actions#addlootitems

To Reproduce Steps to reproduce the behavior:

  1. Create new modded profile
  2. Install Ore Stone Variants and LootJS
  3. create said script in the kubejs/server_scripts directory
  4. Mine it and notice that id doesn't drop flint additionally
  5. This can also be checked by enabling logging (https://github.com/AlmostReliable/lootjs#-enable-logging-for-loot-modifications) and mining that block, it won't print anything to the server log

Versions:

Log These are probably not needed, but I still added them here: 1.16: latest.log 1.18: latest.log

PersonTheCat commented 1 year ago

Hey, @MundM2007. I don't personally consider this a bug. The reason is that OSV just reuses the loot table from regular iron ore. That's actually configured by the iron ore preset, which can be modified to have the ore point to a new, dedicated loot table. Can you try this again using regular iron ore and confirm that it affects the osv variants?

MundM2007 commented 1 year ago

Yeah then it works. So there is no way to set a loot tables for only one specific stone variant? Because if so then I would rephrase it to "add an option to allow other mods to set loot tables manually" My recommendation for this would be either adding a boolean setting for this or enabling this if the loot section is set to an empty string or json.

PersonTheCat commented 1 year ago

Yeah, I may have to decline the option. The problem is that OSV delegates to another mod's loot table, which is essentially managed by the base game. The alternative is that OSV will manage the loot tables by generating one from the ore preset. You can paste any custom loot tables directly in the loot section of each ore's preset, so there's really no need for any custom modded tables.

If you need this behavior, create a new loot table for each preset and point the preset to it. e.g. loot: my_mod:my_table.

It will be possible to manage all options in the presets per variant, but I haven't decided on a syntax for it yet. That will come sometime in the future.

PersonTheCat commented 1 year ago

If you're interested in the per-variant settings idea, let me know your thoughts.

Here's the syntax I have so far:

// other settings here

overrides: [
  {
    variants: [ stone, granite ]
    set: {
      loot: mod:table
    }
  }
]

Or alternatively, a bit of a hack but definitely easier to write thanks to xjs:

overrides: {
  [ stone, granite ]: {
    loot: mod:table
  }
}
MundM2007 commented 9 months ago

I do think that the way described above is pretty good. What also is needed (apart from loot) is stuff Like map color nad breaking time? You could also Set a Blacklist to apply a specific extra strata rule for everything but specific strataa But I'm actually Just commenting to ask about when I could Hope for this to be realised. (I don't want to pressure you, but would still be great If you can give an estimate)