int xp = ForgeHooks.onBlockBreakEvent(world, ((EntityPlayerMP) player).interactionManager.getGameType(), (EntityPlayerMP) player, pos); if(xp == -1) { return;
public static void removeBlockWithDrops(EntityPlayer player, ItemStack stack, World world, BlockPos pos, Predicate<IBlockState> filter, boolean dispose, boolean particles) { if(!world.isBlockLoaded(pos)) return; IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); if(!world.isRemote && filter.test(state) && !block.isAir(state, world, pos) && state.getPlayerRelativeBlockHardness(player, world, pos) > 0 && block.canHarvestBlock(player.world, pos, player)) { int exp = ForgeHooks.onBlockBreakEvent(world, ((EntityPlayerMP) player).interactionManager.getGameType(), (EntityPlayerMP) player, pos); if(exp == -1) return; if(!player.capabilities.isCreativeMode) { TileEntity tile = world.getTileEntity(pos); if(block.removedByPlayer(state, world, pos, player, true)) { block.onPlayerDestroy(world, pos, state); if(!dispose || !ItemElementiumPick.isDisposable(block)) { block.harvestBlock(world, player, pos, state, tile, stack); block.dropXpOnBlockBreak(world, pos, exp); } } damageItem(stack, 1, player, 80); } else world.setBlockToAir(pos); if(particles && ConfigHandler.blockBreakParticles && ConfigHandler.blockBreakParticlesTool) world.playEvent(2001, pos, Block.getStateId(state)); } }
public static boolean hasBreakPermission(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EntityPlayerMP player) { return hasEditPermission(pos, player) && !(ForgeHooks.onBlockBreakEvent(world, player.interactionManager.getGameType(), player, pos) == -1); }
public static boolean hasBreakPermission(EntityPlayerMP player, BlockPos pos) { return hasEditPermission(player, pos) && ForgeHooks.onBlockBreakEvent(player.getEntityWorld(), player.interactionManager.getGameType(), player, pos) != -1; }
&& referenceHardness >= notBedrock(blockstate.getBlockHardness(world, target)) && (isToolEffective(blockstate, item) || ForgeHooks.canHarvestBlock(block, player, world, target))) { final int exp = ForgeHooks.onBlockBreakEvent(world, gameType, player, target); if (exp != -1 && block.canHarvestBlock(world, target, player)) { if (block.removedByPlayer(blockstate, world, target, player, true)) {
int expToDrop = ForgeHooks.onBlockBreakEvent(world, playerMp.interactionManager.getGameType(), (EntityPlayerMP) player, pos); if (expToDrop >= 0) {
int xp = ForgeHooks.onBlockBreakEvent(world, ((EntityPlayerMP) player).interactionManager.getGameType(), (EntityPlayerMP) player, pos); if (xp == -1) return false;
xpToDrop = ForgeHooks.onBlockBreakEvent(world, playerMP.interactionManager.getGameType(), playerMP, pos); if (xpToDrop == -1) { return false;
int xpGivenOnDrop = ForgeHooks.onBlockBreakEvent(world, ((EntityPlayerMP) player).interactionManager.getGameType(), (EntityPlayerMP) player, posCurrent); if (xpGivenOnDrop >= 0) { if (blockCurrent.removedByPlayer(bsCurrent, world, posCurrent, player, true)) {
xpToDrop = ForgeHooks.onBlockBreakEvent(world, playerMP.interactionManager.getGameType(), playerMP, pos); if (xpToDrop == -1) { return false;