@SubscribeEvent public void breakSpeed(BreakSpeed event) { ItemStack stack = event.entityPlayer.getCurrentEquippedItem(); if (stack != null && !event.entityPlayer.isSneaking() && canHarvestBlock(event.entityPlayer, event.block, event.block, event.metadata, event.x, event.y, event.z)) { if (ToolUpgrade.THREExONE.isOn(stack)) { event.newSpeed *= Config.speedMult3x1; } if (ToolUpgrade.THREExTHREE.isOn(stack)) { event.newSpeed *= Config.speedMult3x3; } } }
@SubscribeEvent public void onPlayerBreaking(BreakSpeed event) { if (event.entityPlayer.getCurrentEquippedItem() != null) { ItemStack stack = event.entityPlayer.getCurrentEquippedItem(); if (stack.getItem() instanceof ItemTaintPickaxe) { World world = event.entityPlayer.worldObj; int x = event.x; int y = event.y; int z = event.z; float hardness = world.getBlock(x, y, z).getBlockHardness(world, x, y, z); if (hardness == 0.0F) event.newSpeed = 0.0F; else if (hardness < 5.0F) event.newSpeed = 0.1F; else if (hardness < 20.0F) event.newSpeed = hardness / 2.0F; else event.newSpeed = 5.0F + hardness; } } }
@SubscribeEvent public void onBreakSpeed(BreakSpeed event) { if (event.block instanceof IBlockCustom) { BlockType type = ((IBlockCustom) event.block).getType(event.metadata); if (type.toolType.isEmpty()) { return; } ItemStack held = event.entityPlayer.getHeldItem(); if (held != null && !held.getItem().getToolClasses(held).contains(type.toolType)) { event.newSpeed = ForgeHooks.canHarvestBlock(event.block, event.entityPlayer, event.metadata) ? 0.3f : 1; } } }
@SubscribeEvent public void changeBreakSpeed(BreakSpeed speed) { if(speed.entityPlayer.getExtendedProperties(ExtendedPlayerProperties.PROP_NAME) != null && ConfigHelper.powersEnabled) { ExtendedPlayerProperties props = (ExtendedPlayerProperties) speed.entityPlayer.getExtendedProperties(ExtendedPlayerProperties.PROP_NAME); if(props.getAbilityUsageAmount() > 0 && props.getPowersEnabled()) { speed.newSpeed = speed.originalSpeed * 2; if(random.nextInt(149) == 1) { props.decreaseAbilityUsage(); } } else { speed.newSpeed = speed.originalSpeed; } } }
@SubscribeEvent public void breakSpeed(BreakSpeed event) { if (event.entityPlayer != null) { DarklightPlayer abilities = DarklightPlayer.get(event.entityPlayer); if (abilities != null) { LogHelper.info("Found player with ability trying to break block"); if (abilities.isDark || abilities.isLight) { event.newSpeed = abilities.breakRate; } } else { LogHelper.info("Player tried break, but has no abilities"); } } }
@ForgeSubscribe public void onBreaking(BreakSpeed event) { if( event.entity instanceof EntityPlayer ) { EntityPlayer player = (EntityPlayer)event.entity; if( player.isInWater() ) { ItemStack chest = player.getCurrentItemOrArmor(3); if( chest != null ) { float speed1 = event.originalSpeed; if( chest.itemID == OceanicMain.wetsuitBody.itemID ) { event.newSpeed = speed1+(speed1*2F);//0.5F); } if( chest.itemID == OceanicMain.divingSuitBody.itemID ) { event.newSpeed = speed1*4F;//2F; } } } } }
@SubscribeEvent public void onBreakSpeed(BreakSpeed event) { if (event.getState().getBlock() == this) { ItemStack held = event.getEntityPlayer().getHeldItemMainhand(); if (held.isEmpty() || held.getItem().getHarvestLevel(held, "pickaxe", event.getEntityPlayer(), event.getState()) == -1) { event.setNewSpeed(event.getNewSpeed() + 2); } IConduitBundle te = (IConduitBundle) event.getEntity().world.getTileEntity(NullHelper.notnullF(event.getPos(), "BreakSpeed#getPos")); if (te != null && te.getFacadeType().isHardened()) { if (!YetaUtil.isSolidFacadeRendered(te, event.getEntityPlayer())) { event.setNewSpeed(event.getNewSpeed() * 6); } else { event.setNewSpeed(event.getNewSpeed() * 2); } } } }
@SubscribeEvent public void fistingSpeed(BreakSpeed event) { ItemStack powerfist = BaublesApi.getBaublesHandler(event.getEntityPlayer()).getStackInSlot(6); if (powerfist == null || (powerfist != null && powerfist.getItem() != this)) return; ItemStack mininghand = event.getEntityPlayer().getHeldItemMainhand(); if (mininghand != null) return; if (event.getNewSpeed() < 8.0F) event.setNewSpeed(8.0F); }
@SubscribeEvent public void onPlayerStrVsBlock(BreakSpeed event) { PlayerAether playerAether = PlayerAether.get(event.getEntityPlayer()); if (playerAether != null) { event.setNewSpeed(playerAether.getCurrentPlayerStrVsBlock(event.getOriginalSpeed())); } }
public static boolean breakSpeed(BreakSpeed event) { try { float f = getWorldHandlerForDim(event.getEntityPlayer().world.provider.getDimension()).breakSpeed(event.getPos(), event.getEntityPlayer(), event.getOriginalSpeed()); if (f < 0) return true; event.setNewSpeed(f); } catch (Exception e) { } return false; }
@Override public void onEvent(BreakSpeed event) { if (!(event.getEntityPlayer() instanceof EntityPlayerMP)) return; ServerPlayerSettings settings = getPlayerSettings((EntityPlayerMP) event.getEntityPlayer()); event.setNewSpeed(settings.breakspeed > 0 ? settings.breakspeed : event.getOriginalSpeed()); }
@SubscribeEvent public void onBreakSpeed(BreakSpeed event) { EntityPlayer player = event.getEntityPlayer(); if (player != null) { Block block = event.getState().getBlock(); int meta = block.getMetaFromState(event.getState()); if (ProgressionEvents.isEventCancelled(event.getEntityPlayer(), ActionType.BREAKBLOCKWITH, event.getEntityPlayer().getHeldItemMainhand(), ActionType.BREAKBLOCK, BlockActionHelper.getStackFromBlockData(block, meta))) { event.setNewSpeed(0F); } } }
@SubscribeEvent public void onBreakSpeed(BreakSpeed event) { // player is trying to break a block final ImperiumPlayer playerImperium = ImperiumPlayer.get(event.entityPlayer); if (event.block == Blocks.log) checkAbortTree(event, playerImperium); else if (event.block == Blocks.log2) checkAbortTree(event, playerImperium); }
public void checkAbortTree(final BreakSpeed event, final ImperiumPlayer playerImperium) { if (!PlayerData.hasAbility(playerImperium, PlayerAbilities.CANPUNCHWOOD)) { if (!playerImperium.eventListDone.toString().contains("WOODPUNCH")) { playerImperium.addInstantEvent(TutorialEvents.WOODPUNCH); playerImperium.syncToServer("events"); } if(event.isCancelable()) { // not sure if needed but doesn't hurt event.entityPlayer.swingProgressInt = 0; event.setCanceled(true); } } }
@SubscribeEvent public void onBreakSpeed(BreakSpeed parEvent) { if (parEvent.state.getBlock() instanceof BlockCrops) { ItemStack playerItem = parEvent.entityPlayer.getCurrentEquippedItem(); if (playerItem != null && playerItem.getItem() == _Sickle.sickle) { if (!isFullGrownCrop(parEvent.entity.worldObj, parEvent.pos, parEvent.state)) { parEvent.newSpeed = 0F; } } } }
@ForgeSubscribe public void breakSpeed(BreakSpeed e) { World world = e.entityPlayer.worldObj; if (world.provider.dimensionId == 4 && (e.block.blockID == 116 || e.block.blockID == 117)) { e.setCanceled(true); } }
@SubscribeEvent public void getSpeed(BreakSpeed event) { ItemStack stack = event.entityPlayer.getHeldItem(); float newSpeed = 1; if(stack != null && stack.getItem() instanceof ItemTool) { newSpeed = ItemTool.getDigSpeed(event.entityPlayer, stack, event.block, event.metadata); if (event.entityPlayer.isPotionActive(Potion.digSpeed)) { newSpeed *= 1.0F + (float)(event.entityPlayer.getActivePotionEffect(Potion.digSpeed).getAmplifier() + 1) * 0.2F; } if (event.entityPlayer.isPotionActive(Potion.digSlowdown)) { newSpeed *= 1.0F - (float)(event.entityPlayer.getActivePotionEffect(Potion.digSlowdown).getAmplifier() + 1) * 0.2F; } if (event.entityPlayer.isInsideOfMaterial(Material.water) && !EnchantmentHelper.getAquaAffinityModifier(event.entityPlayer)) { newSpeed /= 5.0F; } if (!event.entityPlayer.onGround) { newSpeed /= 5.0F; } if(ItemTool.getItemDamage(stack) >= ItemTool.getTool(stack).durabilityFactor*ItemTool.getMaterial(stack).durability) { newSpeed = 1; }else{ ArrayList<EnchantmentModifier> modifiers = CraftMaterial.getModifiers(stack); for (int i = 0; i < modifiers.size(); i++) { newSpeed = modifiers.get(i).getMiningSpeedLate(event.entityPlayer, stack, ItemTool.getTool(stack).isToolEffective(stack, event.block), event.block, newSpeed); } } event.newSpeed = newSpeed; } }
@SubscribeEvent public void breakSpeed(BreakSpeed event) { boolean cancel = WorldHandler.breakSpeed(event); if (cancel) event.setCanceled(true); }