Upgrade cost isn't incremented by 300
DisplayPort opened this issue · 6 comments
Describe the bug
When going past enchantment level 665 so 666, 667, etc... the cost seems to obtain an extra 1 to the cost instead of around 300. at higher levels this becomes really noticeable, I wrote a simple script to calculate the theoretical enchant limit using items worth 2500, and according to that math it should be 7996 and right now it's 7933 because the cost is 300.xxxxxxxxxxxxx instead of being rounded off.
To Reproduce
Steps to reproduce the behavior:
- /give @p leather_chestplate{Enchantments:[{id:"minecraft:protection",lvl:666}]} 1
- Insert item into the Tool Leveling Table and hover over the Protection enchantment.
- You should see an extra 1 making the Upgrade Cost 2400260
- Doing this with for example protection 5000 highlights the problem even more.
Expected behavior
When filling the Tool Leveling Table with Nether Stars this will give you a total of 2400000 Worth, when you subtract the cost of 1200 from the already applied protection 4 enchantment you should be able to upgrade 7996 times according to this: 2398800 / 300 = 7996.
Screenshots
The upgrade is expected to cost 1500300 to perform meaning there is 3166 unexpected extra cost in this instance.
Additional context
Not a very major bug, just something I noticed when I was messing around with big numbers.
This was actually supposed to be a feature.
I wanted the higher levels to be more expensive than the lower levels.
To archieve this I made the upgrade formula this: (0.0015x^4 + 300x) * modifier
where x is the next level and the modifier can be set through the config.
The thing is, I wanted the effect to have a higher impact than just an extra cost of 3166 at an enchantment level of 5000.
So the next update might even increase this...
well, now I know my main error, I wanted (0.0015 * (x^4) + 300x) * modifier
,
but in the code I made the formula ((0.0015x)^4 + 300x ) * modifier
That's why the cost is always nearly 300 per level
So it isn't supposed to be 300, in that case, I would say that typo is likely the cause of this.
Cool in that case, I guess you know what the problem is. Looking forward to updates on the mod.
Like the idea for the mod allot but having no cap by default seems a bit broken to me 🤣 then again on the other hand it costs 3840479 items worth 2500 to upgrade to level 8000 if the always 300 applied so I guess it isn't too bad.