ArsMagica2
ArsMagica2 copied to clipboard
Dig spell should call BlockEvent.BreakEvent
https://github.com/LatvianModder/FTBUtilities/issues/489
From reading the source, it looks like the currently posted source code does in fact call BreakEvent: https://github.com/Mithion/ArsMagica2/blob/master/src/main/java/am2/spell/components/Dig.java#L87
Is this implemented incorrectly or has this issue not been updated?
The source hasn't changed in quite some time as far as i can tell from the history of that file. The correct event is called (though i don't know if the implementation is correct) and should be sent to the event bus, it just seems nobody gets notified about it. The next event you get is the BlockEvent.HarvestDropsEvent. I tried to debug by subscribing to every event there is and step by step ignoring certain events. The only event i get before that is am2.api.event.SpellCastEvent$Pre.
Would be really nice if someone could take an indepth look at this because running (public) servers with Ars Magica 2 containing modpacks is quite dangerous like this (ex. griefing).
Looking at the code again, I think I may have figured it out.
per this post The if statement if (!world.isRemote)
will always return false since it is essentially !true
. This means that the BreakEvent in the line below is NOT actually fired since that whole code block is never fired. instead the method just jumps down to return true;
I think the check should be something like @SideOnly
instead...
I don't have an environment setup to test this and issue a pull request at the moment. If someone's able please remove the if
statement on the line above the BreakEvent call I linked above and the block brackets around the code inside it, and test whether that fixes the problem.
Should probably also look around the code further to make sure the Post block break event is also firing correctly, but that would be another issue.