Posted May 7, 20196 yr I am not entirely sure if this is a bug, but I am currently using PlaceActivated to replace a block with the block the player right clicked with. I am trying to play the place sound, however when using playSound on the player and/or the world, the sound plays much higher pitched than placing the same block on the ground.Am I doing something wrong? Here's my code for the PlaceActivated event: @Override public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { ItemStack itemstack = player.getHeldItemMainhand(); Item item = itemstack.getItem(); if (item == Items.AIR || item == Registry.iblk_blueprint) return false; Block block = Block.getBlockFromItem(item); if (block == Blocks.AIR || block == Registry.blk_blueprint) return false; worldIn.setBlockState(pos, block.getDefaultState()); if (!player.isCreative()) itemstack.setCount(itemstack.getCount() - 1); SoundType sound = block.getDefaultState().getSoundType(worldIn, pos, player); worldIn.playSound(null, pos, sound.getPlaceSound(), SoundCategory.BLOCKS, sound.getVolume(), sound.getPitch()); return true; } Edited May 8, 20196 yr by FireController1847 I am on my journey of making a remake of matmos, as explained here.
May 7, 20196 yr By default the placement sound is played at 80% pitch in all methods it is referenced by (aka it goes like sound.getPitch() * 0.8F). You are playing it at 100%
May 8, 20196 yr Author On 5/7/2019 at 12:03 PM, V0idWa1k3r said: By default the placement sound is played at 80% pitch in all methods it is referenced by (aka it goes like sound.getPitch() * 0.8F). You are playing it at 100% Awesome, thank you! I am on my journey of making a remake of matmos, as explained here.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.