Fixes #2713: Call super#onBlockActivated() for wrench interaction. (#2728)

This commit is contained in:
yueh 2016-12-31 16:00:45 +01:00 committed by GitHub
parent 8b0637d05d
commit 7c5f777e41
3 changed files with 9 additions and 10 deletions

View file

@ -149,6 +149,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{ {
final TileCraftingTile tg = this.getTileEntity( w, pos ); final TileCraftingTile tg = this.getTileEntity( w, pos );
if( tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive() ) if( tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive() )
{ {
if( Platform.isClient() ) if( Platform.isClient() )
@ -160,7 +161,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
return true; return true;
} }
return false; return super.onBlockActivated( w, pos, state, p, hand, heldItem, side, hitX, hitY, hitZ );
} }
public enum CraftingUnitType public enum CraftingUnitType

View file

@ -107,6 +107,7 @@ public class BlockMolecularAssembler extends AEBaseTileBlock
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_MAC ); Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_MAC );
return true; return true;
} }
return false;
return super.onBlockActivated( w, pos, state, p, hand, heldItem, side, hitX, hitY, hitZ );
} }
} }

View file

@ -47,6 +47,7 @@ import appeng.helpers.ICustomCollision;
import appeng.tile.networking.TileWireless; import appeng.tile.networking.TileWireless;
import appeng.util.Platform; import appeng.util.Platform;
public class BlockWireless extends AEBaseTileBlock implements ICustomCollision public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
{ {
@ -63,7 +64,6 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
} }
} }
public static final PropertyEnum<State> STATE = PropertyEnum.create( "state", State.class ); public static final PropertyEnum<State> STATE = PropertyEnum.create( "state", State.class );
public BlockWireless() public BlockWireless()
@ -113,13 +113,9 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
@Override @Override
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{ {
if( player.isSneaking() )
{
return false;
}
final TileWireless tg = this.getTileEntity( w, pos ); final TileWireless tg = this.getTileEntity( w, pos );
if( tg != null )
if( tg != null && !player.isSneaking() )
{ {
if( Platform.isServer() ) if( Platform.isServer() )
{ {
@ -127,7 +123,8 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
} }
return true; return true;
} }
return false;
return super.onBlockActivated( w, pos, state, player, hand, heldItem, side, hitX, hitY, hitZ );
} }
@Override @Override