I tried 2nd way and looks like it works fine. So, is this code okay in performance?
@Override
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) {
if (!player.isSneaking()) {
RayTraceResult rayTrace = rayTrace(player.getEntityWorld(), player, false);
switch (rayTrace.sideHit.getAxis()) {
case X:
break;
case Y:
break;
case Z:
break;
}
}
return super.onBlockStartBreak(itemstack, pos, player);
}
And do I have to check the side to run it on the server only?