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'm having problems with playing my custom SoundEvents, I've tried every version of the playSound method and tried using world.isRemote, but it still won't play. The sound is valid, the sounds.json is valid and the sound plays fine when using the playsound command ingame, what am I missing here?

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

  • Author
Just now, diesieben07 said:

Show your code.

this.world.playSound(this.getMaster(), new BlockPos(this.getMaster().getPosX(), this.getMaster().getPosY(), this.getMaster().getPosZ()), this.getSpawnSound(), this.getSoundCategory(), 1.0f, 1.0f);

getMaster returns the player, it works fine so it's not the issue, getSpawnSound returns the custom SoundEvent.

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

  • Author
24 minutes ago, diesieben07 said:

The way you are using this method (with a non-null player) you must call it on both client and server, with the same player.

Whats the best way to do this? DistExecutor, OnlyIn or World#isRemote?

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

  • Author
1 minute ago, diesieben07 said:

 

I have no idea where you are trying to play this sound from.

From a packet.

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

  • Author
On 4/25/2020 at 6:48 PM, diesieben07 said:

Server to client? Client to server? When is this packet sent?

 

Can you please just explain the details so we don't have to go around in circles for 20 posts? Thank you.

Here's the class on GitHub: https://github.com/Novarch129/JoJo-s-Blocky-Adventure/blob/9cd711da2a15ab17ffcb085798f211284f3fbf3f/src/main/java/com/novarch/jojomod/network/message/SyncStandSummonButton.java.

It's syncing a KeyBind to the server, so it's client to server.

Edited by Novârch

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

  • Author
39 minutes ago, diesieben07 said:

Then you must pass null as the player for it to play it to all players in range.

Still not working, exact code is:

this.world.playSound(null, new BlockPos(this.getMaster().getPosX(), this.getMaster().getPosY(), this.getMaster().getPosZ()), this.getSpawnSound(), this.getSoundCategory(), 1.0f, 1.0f)

 

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

  • Author
9 hours ago, diesieben07 said:

Is the method called?

It is, all the code in the message works.

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

  • Author

Still haven't fixed this, the code used to work perfectly back in 1.12, has something about the method changed?

 

*Edit: For some reason switching to deferred registers made it work.

Edited by Novârch

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

  • Novârch changed the title to [SOLVED] [1.15.2] Help with playing SoundEvents

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.