Spells use mining level of held item
Laike-Endaril opened this issue ยท 7 comments
Psi version r1.1-70
Block-breaking spells use the mining level of the held item instead of the mining level set in the config file.
While these may be the same thing when using a normal CAD, they are not the same thing when using the exosuit. This allows you to eg. put a digging spell on the exosuit legs, turn it on, and switch held item to a diamond pickaxe. The spell will mine at diamond level regardless of the psi mining level config option. This exploit can become even more exaggerated when other mods are installed.
This was mentioned in #243, but that issue's focus was something slightly different.
Is this intentional? It seems like a bug in my eyes, but I'm not completely sure. If this is confirmed as a bug, I may do a PR fix.
I looked through the code and found the "most correct" place to make the change, made the change, tested, and confirmed it now uses the config option correctly while still calling the appropriate events.
Also, based on the rest of the code in the method, it does look like the behavior in the current release is unintentional, as the armor item is being passed into the method and referenced multiple times. The issue is that a vanilla method is also being called which forcibly references the in-hand item instead.
I'm fairly certain this is unintended...should I make a PR with the fix?
One more question, since the code is related; right now, the normal CADs can literally be used as tools (eg. holding left click on iron ore with a CAD mines the ore normally).
Is this intended? If not, I can throw a change to it into the PR.
Kamefrede is partially incorrect. This is how the logic is meant to work:
If your spellcasting tool can break the block, your spell can.
Otherwise, if your CAD can break the block, your spell can.
Otherwise, your spell cannot break the block.
The CAD being able to be a tool is technically intended, but I would be fine with it being removed.
Interesting, I thought this behaviour was intended.
Was useful since it allowed you have the cad's mining level increase with the tools you make throughout a pack's progression.
Now there's no way to have the mining level of the CAD scale with your progress in a pack since you can only have one mining level set for all CADs regardless of tier.
Although vanilla isn't a great indicator of what to do always, an example of something similar in vanilla is when you shoot an arrow, you can swap to a sword with looting on it, and looting will apply to a kill made by the arrow, and with dual wielding added you can use a bow in the offhand and it'll still use the mainhand's looting enchantment.
This even applies to tnt explosions set off by the player as well, since they count as a player kill.