check the block's type when firing the event

This commit is contained in:
xsun2001 2017-08-08 08:56:04 +08:00
parent 11bc4b60a2
commit 563d902ff9
2 changed files with 9 additions and 3 deletions

View File

@ -107,8 +107,12 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
if( ForgeEventFactory.onItemUseStart( player, is, 1 ) <= 0 )
return true;
if( ForgeEventFactory.onPlayerInteract( player, PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, x, y, z, side, world ).isCanceled() )
return true;
Block blk = world.getBlock( x, y, z );
if( blk != null )
if( ForgeEventFactory.onPlayerInteract( player,
blk.isAir( world, x, y, z ) ? PlayerInteractEvent.Action.RIGHT_CLICK_AIR : PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK,
x, y, z, side, world ).isCanceled() )
return true;
final MovingObjectPosition mop = new MovingObjectPosition( x, y, z, side, Vec3.createVectorHelper( hitX, hitY, hitZ ) );
final TileEntity te = world.getTileEntity( x, y, z );

View File

@ -60,7 +60,9 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWren
final Block b = world.getBlock( x, y, z );
if( b != null && ForgeEventFactory.onPlayerInteract( player, PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, x, y, z, side, world ).isCanceled() )
if( b != null && ForgeEventFactory.onPlayerInteract( player,
b.isAir( world, x, y, z ) ? PlayerInteractEvent.Action.RIGHT_CLICK_AIR : PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK,
x, y, z, side, world ).isCanceled() )
return true;
if( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) )