Recipes that consume XP are using more XP than expected
belathus opened this issue · 4 comments
Issue Description:
I made a recipe to convert Rockhounding's goethite and limonite ores to vanilla iron ore, but it is to take 10 levels of experience to do so. In my test, I gave myself 39 levels and crafted goethite into iron ore, and my level dropped to 19. I tried it again, and my level dropped to zero.
I commented out the recipe using limonite (lines 20 to 30) and tried again, and the recipe used 10 levels as expected. I'm thinking that, when crafting the iron ore, it is running both the player.removeXP(10) commands from both the limonite and the goethite recipes.
What happens:
Recipe uses double (20 levels of) experience.
What you expected to happen:
Recipe uses 10 levels of experience.
Script used (Please Pastebin or gist your script, posting an unpasted or ungist'd script will automatically close this issue):
https://github.com/belathus/Wanderlust-Renewed/blob/master/scripts/blocks.zs#L9-L30
Minetweaker.log file (Please Pastebin or gist your file, posting an unpasted or ungist'd file will automatically close this issue):
https://gist.github.com/belathus/78d7947e9a374ff17d7c823cc76622b4
Affected Versions (Do not use "latest"):
- Minecraft: 1.10.2
- Forge: 12.18.3.2185
- Crafttweaker: 3.0.17
Your most recent log file where the issue was present:
https://gist.github.com/belathus/18502e32a132bc524ad40e8c51a3345c
Further testing is needed to confirm this issue. I suspect it may just be a matter of levels -> exp conversion not matching up. For example, when the player is at level 100, 10 levels worth of EXP should not drop you to level 90. It may not even drop you to level 99 depending on the math.
If you are charging a given number of experience levels, then that should drop you the same number of levels no matter how high your current level. That is how the enchanting table and anvil both work. As best I can tell, they handle experience within a level by leaving you at the same fraction between levels as you were before. That is, if you were halfway between levels 35 and 36 when you do a 30-level anvil operation, you will then be halfway between levels 5 and 6.
If you want a recipe to drop you, say, from level 10 to somewhere from level 0-2, but from level 35 to level 33 or 34 (I checked the chart), then you should be charging 160 experience points. Nothing in vanilla works that way, but AFAIK there's no fundamental reason it couldn't.