re-add the null check and the permission check

This commit is contained in:
xsun2001 2018-06-16 23:50:50 +08:00
parent a2e11b1a3a
commit 761fddaa55
1 changed files with 8 additions and 1 deletions

View File

@ -238,7 +238,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature,
@Override
public boolean onBlockActivated( final World w, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX, final float hitY, final float hitZ )
{
if( player != null )
if( player != null && player.inventory.getCurrentItem() != null)
{
final ItemStack heldItem = player.inventory.getCurrentItem();
if( Platform.isWrench( player, heldItem, x, y, z ) && player.isSneaking() )
@ -262,6 +262,13 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature,
return false;
}
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent( x, y, z, w, this, 0, player );
MinecraftForge.EVENT_BUS.post( event );
if( event.isCanceled() )
{
return false;
}
final ItemStack[] itemDropCandidates = Platform.getBlockDrops( w, x, y, z );
final ItemStack op = new ItemStack( this );