check the block's type when firing the event
This commit is contained in:
parent
11bc4b60a2
commit
563d902ff9
2 changed files with 9 additions and 3 deletions
|
@ -107,7 +107,11 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||||
if( ForgeEventFactory.onItemUseStart( player, is, 1 ) <= 0 )
|
if( ForgeEventFactory.onItemUseStart( player, is, 1 ) <= 0 )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( ForgeEventFactory.onPlayerInteract( player, PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, x, y, z, side, world ).isCanceled() )
|
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;
|
return true;
|
||||||
|
|
||||||
final MovingObjectPosition mop = new MovingObjectPosition( x, y, z, side, Vec3.createVectorHelper( hitX, hitY, hitZ ) );
|
final MovingObjectPosition mop = new MovingObjectPosition( x, y, z, side, Vec3.createVectorHelper( hitX, hitY, hitZ ) );
|
||||||
|
|
|
@ -60,7 +60,9 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWren
|
||||||
|
|
||||||
final Block b = world.getBlock( x, y, z );
|
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;
|
return true;
|
||||||
|
|
||||||
if( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) )
|
if( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) )
|
||||||
|
|
Loading…
Reference in a new issue