Applied Energistics 2

Applied Energistics 2

137M Downloads

[Bug] Wrenching AE cables and parts doesn't correctly fire the PlayerInteractEvent

XFactHD opened this issue ยท 3 comments

commented

While trying to write a small mod to fix the issue of AE cables and parts being wrenchable in areas protected by bukkit plugins i found out that wrenching an AE part or cable does only fire the PlayerInteractEvent on the client. Before destroying the cable or removing the part, you should either fire the PlayerInteractEvent on the server or, even better, do a check if the player would be allowed to break a block at that position.

AE version used: rv3 beta 5

commented

When the wrench interacts with the parts, does it fire the ItemRightClickEvent (or whatever it is called)?

commented

There are no blocks done by a wrench. It just interacts with the block, ranging from fetching public information over GUI interaction to part interactions.

As long as forge does not provide meaningful events for these kinds, there is no way we can support it correctly. (Read as forge needs native multiparts)

See the other issues about it for more information.

commented

I just looked through the AE2 source code again and I have an idea how this may be fixable by AE2 itself: In onItemUseFirst, the ItemWrench checks via Platform.hasPermissions( DimensionalCoord, EntityPlayer ) if the world provider allows it to break the block. This could probably be fixed if hasPermission also checked if someone wants to hinder the wrench from destroying the cable either via ForgeHooks.onBlockBreakEvent() (which would need a GameType) or via ForgeEventFactory.doPlayerHarvestCheck() (hasPermission has all needed params to get the needed params for that method).