event.getEntityPlayer().swingArm(event.getHand()); else { event.getWorld().playSound(null, event.getPos(), block.getSoundType().getBreakSound(), SoundCategory.BLOCKS, block.getSoundType().getVolume() * 0.4F, block.getSoundType().getPitch() + (float) (Math.random() * 0.2 - 0.1));
public static void playBreakSound(@Nonnull SoundType snd, @Nonnull World world, @Nonnull BlockPos pos) { SoundHelper.playSound(world, pos, new Sound(snd.getBreakSound()), (snd.getVolume() + 1.0F) / 2.0F, snd.getPitch() * 0.8F); }
@Override @SideOnly(Side.CLIENT) public void actionClient(World world, EntityPlayer player) { Block block = Block.getBlockById(blockID); world.playSound(x, y, z, block.getSoundType().getBreakSound(), SoundCategory.BLOCKS, 0.1F + world.rand.nextFloat() * 0.5F, 0.9F + world.rand.nextFloat() * 0.1F, false); ParticleBloodSplash.spawnParticles(world, new BlockPos((int) x, (int) y + 1, (int) z), 3 + world.rand.nextInt(2), 1 + world.rand.nextInt(2)); }
.getSoundHandler() .playSound( new PositionedSoundRecord( block.getSoundType() .getBreakSound(), SoundCategory.BLOCKS, ( block.getSoundType().getVolume() + 1.0F ) / 2.0F, block.getSoundType() .getPitch() * 0.8F, (float) this.x + 0.5F, (float) this.y + 0.5F, (float) this.z + 0.5F ) );
public static void breakSound( final World world, final BlockPos pos, final int extractedState ) { final IBlockState state = ModUtil.getStateById( extractedState ); final Block block = state.getBlock(); world.playSound( pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, DeprecationHelper.getSoundType( block ).getBreakSound(), SoundCategory.BLOCKS, ( DeprecationHelper.getSoundType( block ).getVolume() + 1.0F ) / 16.0F, DeprecationHelper.getSoundType( block ).getPitch() * 0.9F, false ); }
@Override public boolean onWrench(@Nonnull ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, IBlockState state, float hitX, float hitY, float hitZ) { if (player.isSneaking()) { Block disguiseBlock = getDisguiseBlock(); if (disguiseBlock == null) { return false; } if (!player.capabilities.isCreativeMode) { EntityItem entityItem = new EntityItem(world, player.posX, player.posY, player.posZ, new ItemStack(disguiseBlock, 1, getDisguiseMeta())); world.spawnEntity(entityItem); } SoundType sound = disguiseBlock.getSoundType(null, world, pos, player); world.playSound((pos.getX() + 0.5F), (pos.getY() + 0.5F), (pos.getZ() + 0.5F), sound.getBreakSound(), SoundCategory.BLOCKS, (sound.getVolume() + 1F) / 2F, sound.getPitch() * 0.8F, false); setDisguiseBlock(null); markForResync(); } return true; }
@Override public boolean onWrench(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, IBlockState state, float hitX, float hitY, float hitZ) { if (player.isSneaking()) { if (this.disguiseBlock != null) { if (!player.capabilities.isCreativeMode) { EntityItem entityItem = new EntityItem(world, player.posX, player.posY, player.posZ, new ItemStack(disguiseBlock, 1, disguiseMeta)); world.spawnEntity(entityItem); } SoundType sound = disguiseBlock.getSoundType(); world.playSound((double) pos.getX() + 0.5F, (double) (pos.getY() + 0.5F), (double) (pos.getZ() + 0.5F), sound.getBreakSound(), SoundCategory.BLOCKS, (sound.getVolume() + 1.0F) / 2.0F, sound.getPitch() * 0.8F, false); disguiseBlock = null; markDirty(); return true; } } else { if (this.world.isRemote) { RayTraceResult hit = RayTracer.retraceBlock(world, player, pos); // Use ryatracer to get the subpart that was hit. The # corresponds with a forge direction. if (hit == null) { return false; } ConnectPacket packet = new ConnectPacket(pos, hit.subHit); EsteemedInnovation.channel.sendToServer(packet); } } return false; }
@Override public void onPacketData(PacketBufferForestry data, EntityPlayer player) throws IOException { BlockPos pos = data.readBlockPos(); VisualFXType visualFX = VisualFXType.values()[data.readByte()]; SoundFXType soundFX = SoundFXType.values()[data.readByte()]; World world = player.world; IBlockState blockState = NBTUtil.readBlockState(data.readCompoundTag()); Block block = blockState.getBlock(); if (visualFX == VisualFXType.BLOCK_BREAK) { Minecraft.getMinecraft().effectRenderer.addBlockDestroyEffects(pos, blockState); } if (soundFX != SoundFXType.NONE) { SoundType soundType = block.getSoundType(blockState, world, pos, null); if (soundFX == SoundFXType.BLOCK_BREAK) { world.playSound(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, soundType.getBreakSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F, false); } else if (soundFX == SoundFXType.BLOCK_PLACE) { world.playSound(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, soundType.getPlaceSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F, false); } } } }
block.getSoundType(blockState, CompatibilityUtils.getWorld(citizen), blockPos, citizen).getBreakSound(), SoundCategory.BLOCKS, block.getSoundType(blockState, CompatibilityUtils.getWorld(citizen), blockPos, citizen).getVolume(), block.getSoundType(blockState, CompatibilityUtils.getWorld(citizen), blockPos, citizen).getBreakSound(), SoundCategory.BLOCKS, block.getSoundType(blockState, CompatibilityUtils.getWorld(citizen), blockPos, citizen).getVolume(),
if (extending) { getWorld().setBlockState(new BlockPos(x, y, z), getStateFromDirection(direction), 3); getWorld().playSound((EntityPlayer)null, new BlockPos(x, y, z), extension.getSoundType().getBreakSound(), SoundCategory.BLOCKS, (extension.getSoundType().getVolume() + 1.0F) / 2.0F, extension.getSoundType().getPitch() * 0.8F); } else { getWorld().setBlockToAir(new BlockPos(x, y, z));
SoundEvent breakSound = smooshingSoundType.getBreakSound(); world.playSound(null, soundPos, breakSound, SoundCategory.BLOCKS, smooshingSoundType.getVolume(), smooshingSoundType.getPitch());