Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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%

  • 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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.