Posted December 14, 20204 yr Hello, after spending lots of time investigating why attenuation distance does not work, I figured out that it only works when the sound is played on client. Is this intentional? Edited December 14, 20204 yr by poopoodice
December 14, 20204 yr Author I've simplified my problem into a smaller area: https://bitbucket.org/poopoodice/ava/src/1.16.x/src/main/java/poopoodice/ava/items/miscs/TestItem.java @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity player, Hand handIn) { if (worldIn.isRemote()) player.world.playSound(player, 0, 1, 0, AVASounds.GENERIC_GRENADE_EXPLODE, SoundCategory.PLAYERS, 1.0F, 1.0F); if (!worldIn.isRemote()) player.world.playSound(null, 0, 0, 0, AVASounds.GENERIC_GRENADE_EXPLODE, SoundCategory.PLAYERS, 1.0F, 1.0F); worldIn.playSound(player, 0, 0, 0, AVASounds.GENERIC_GRENADE_EXPLODE, SoundCategory.PLAYERS, 1.0F, 1.0F); return super.onItemRightClick(worldIn, player, handIn); } My test result: 1. The first World#playSound -> result in the attenuation distance is applied (can be heard from 16+ blocks away) 2. The second World#playSound -> result in the attenuation distance is not applied (cannot be heard from 16+ blocks away) 3. The third World#playSound -> result in the attenuation distance is applied It seems like playing sound on server world will only send to the players that are within the radius of max(16.0F, volume * 16.0F), and for other vanilla sounds that uses greater attenuation distance for example ravager's roar, it is played on both sides which will work. If I can only play the sound on server while the attenuation effect to be applied, the only way I can think of is send packets to all players, is that necessary or is there an alternative way of doing it? Edit: Sending Customs packets works. Edited December 14, 20204 yr by poopoodice
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.