SoraZodia / Survival-Tweaks

More mechanics for Minecraft
5 stars 3 forks source link

[Bug] Block interaction at wrong place. #14

Closed HellFirePvP closed 6 years ago

HellFirePvP commented 6 years ago

https://github.com/SoraZodia/Survival-Tweaks/blob/master/src/main/java/sorazodia/survival/mechanics/PlayerActionEvent.java#L130

Actually call the block interaction at the proper position it's happening at instead of 0 -1 0. It's terrible practice as the blockposition passed in has to be the position where the interaction happened at as per javadoc. So mods that rely on that fact experience crashes (like https://github.com/HellFirePvP/AstralSorcery/issues/425). Please correct this on your end.

Edit: You also get the specific parameters directly from the event. so PLEASE pass them in correctly instead of making up stuff. And onBlockActivated is not meant for querying/testing as it already fires the interaction code obviously. So it already does an interaction. Which, in case the case you're testing for fails, you cause 2 interactions with the targeted block. So you might cause massive problems since you're essentially - for the case on my issue - triggering the rightclick twice. So one rightclick then causes my players' buckets being emptied and the result transferred into the tank, the next one withdraws it again. So there are other ways to query what you want. This is not the correct way.

SoraZodia commented 6 years ago

Should be fixed now.

The code was made in 1.7.10 where there was not a lot of options (or none that I knew of) to check for block interactions. Although I'm not sure what the heck I was thinking when I updated...

SoraZodia commented 6 years ago

Should actually be fixed this time.

I couldn't find other ways to do the query and ended up stopping the block from activating after my mod called onBlockActivated. If there's other ways, let me know cause I don't really like how it's done right now as well.