Jump to content

[1.13.2] [Solved] PlaySound is High Pitched


Recommended Posts

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 by FireController1847

I am on my journey of making a remake of matmos, as explained here.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.