Botania (Fabric/Quilt)

Botania (Fabric/Quilt)

6M Downloads

[Possible Bug/Compat Issue] Botania resulting in LootJS scripts rolling entity loot modifiers twice

Cicopath opened this issue ยท 4 comments

commented

Mod Loader

Fabric

Minecraft Version

1.20.1

Botania version

1.20.1-446

Modloader version

Fabric Loader 0.16.3 + API 0.92.2+1.20.1

Modpack info

Custom (not on CurseForge yet)

The latest.log file

N/A

Issue description

When using LootJS's .addEntityLootModifier, whether it's vanilla or modded, the entity loot modifier will roll twice, therefore doubling the dropped loot added by the modifier when the defined conditions are met.

Steps to reproduce

  1. Install Botania and LootJS 1.20.1-2.12.0 + dependencies
  2. Create a LootJS script using .addEntityLootModifier()
  3. Kill an entity defined in .addEntityLootModifier(); the loot drops added by the modifier should appear doubled, which should not happen

Other information

I did not test this on a minimal instance.

I tested this issue briefly with the following LootJS script after hearing about it:

LootJS.modifiers((event) => {
	event
        .addEntityLootModifier("bosses_of_mass_destruction:void_blossom")
        .killedByPlayer()
		.playerPredicate((player) => player.getLuck() >= 4)
        .addLoot("simplyswords:bramblethorn")
})

When the conditions were met, two Bramblethorns dropped rather than just one, which was not supposed to happen. Using .addLootTableModifier instead only resulted in one roll when the entity died and conditions were met, as intended.

In the LootJS Discord, the potential cause was determined to be something related with Botania, specifically the Elementium Axe. Comment from one of the LootJS developers:
image

commented

Botania injects a separate loot table for whenever certain mobs are killed via Elementium Axe. This injection is as generic as possible, being evaluated for every mob death. The loot table itself will always be the same, botania:elementium_axe_beheading, and it is responsible for checking relevant conditions, such as whether it was a player kills and the player used the appropriate weapon.

Can LootJS recognize the loot table being applied? If so, that's the preferred way to exclude it injecting into this one.

commented

Just tested with just Botania and LootJS + dependencies and JEI/EMI, and the drops still double.

@LLytho could you chime in to respond to the Wormbo's question? I suspect you know way more about the technicals lol

commented

LootJS has a way to create dynamic drops when a specific entity dies. This will always check against the entity or an entity tag. Botania triggers the loot table for the Elementium Axe when an entity dies no matter what the player holds, which then leads to the double invoke from LootJS.

The issue will not occur when the user creates a LootJS modifier for a specific loot table (addLootTableModifier) instead of an entity type (addEntityLootModifier).

Botania injects a separate loot table for whenever certain mobs are killed via Elementium Axe.
This injection is as generic as possible, being evaluated for every mob death.

I don't think the injection should happen this way. In my opinion for loot table injection the best solution is to add a loot pool for each entity loot table instead of having one loot table which handles everything and is always triggered for every mob.

Can LootJS recognize the loot table being applied? If so, that's the preferred way to exclude it injecting into this one.

It knows which loot table is rolled but I'm not a huge fan of excluding something because of such behavior. It's not clearly visible for the user.