Waystones (Fabric Edition)

Waystones (Fabric Edition)

3M Downloads

XP Costs Are Calculated Incorrectly

Chubblezap opened this issue ยท 0 comments

commented

Minecraft Version

1.20.x

Mod Loader

Fabric

Mod Loader Version

0.14.22

Mod Version

14.0.2

Balm Version

7.1.4

Describe the Issue

After trying to configure the xp costs of the various types of waystones/warp plates, I came to the conclusion that the math involved with max level cost, distance-per-level, and the individual multipliers seems to be wrong.

Specifically, I was trying to make Waystones cost 1 level per 1000 blocks, and Warp Plates cost 1 level per 100 blocks, both capping at 3 levels max.

However, the multiplier on cost seems to be applying after the level cap is applied; i tried to simply multiply Plate costs by 10, which I expected to be divided against the distance-per-level. Instead, setting 2 plates 1000 blocks apart costed 10 levels, while any less costed 0. Waystones were unaffected, being multiplied by 1.

Next, I tried setting distance-per-level to 100, and multiplying Waystone cost by 0.1. This worked for Plates, costing 1 level per 100 blocks distance up to 3. However, this solution caused all Waystones to be free; even at over 1000 blocks, where it should have been 1 level. (1000/100)*0.1 should be 1, after all.

The only conclusion I can reach from this is that multipliers and caps are being applied in the wrong order. The current formula seems to be

COST = max(LEVELCAP, floor(DISTANCE/DISTANCE_PER_LEVEL) ) * MULTIPLIER
where it should be something like
COST = max(LEVELCAP, floor(DISTANCE/DISTANCE_PER_LEVEL * MULTIPLIER) )

taking a look at the code myself, i confirmed this to be the case. Multipliers are being added after level capping instead of during the distance/level calculation, causing them to behave unexpectedly.

Logs

No response

Do you use any performance-enhancing mods (e.g. OptiFine) or custom server distributions (e.g. SpongeForge)?

No response