Fire_Blaim Posted April 19, 2023 Posted April 19, 2023 Hi all, I am creating a mod that adds an item that, when the player right-clicks on it, launches a music that follows the player and I confess that I am completely lost even if I tried to model myself on the operation of minecarts but I don't understand anything... Could someone help me? Thank you in advance and I hope I won't be a nuisance to everyone Quote
ChampionAsh5357 Posted April 20, 2023 Posted April 20, 2023 You use an AbstractTickableSoundInstance that keeps track of the entity on the client. Then, you just adjust the volume of the sound in the #tick method depending on some activation function you specified. Stop the sound once the entity is removed from the game. Quote
Fire_Blaim Posted April 20, 2023 Author Posted April 20, 2023 Okay, thanks for your help, but how do you synchronize everything when there is multiplayer ? I guess you have to use packets but it's not very clear to me... Quote
warjort Posted April 20, 2023 Posted April 20, 2023 Yes. As I said in your other (duplicate) question on this topic. Quote Using a custom SoundInstance usually means taking greater control over how your sound plays than using SoundEvents. e.g. using Minecraft.getInstance().getSoundManager().play(...) a concrete example would be the ElytraOnPlayerSoundInstance usage in the LocalPlayer class. which if you look at that example is handled by monitoring changes to the data sent from the server. Quote Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
Fire_Blaim Posted April 20, 2023 Author Posted April 20, 2023 39 minutes ago, warjort said: Yes. As I said in your other (duplicate) question on this topic. which if you look at that example is handled by monitoring changes to the data sent from the server. Sorry I was stupid and forgot the other post. But anyway, I'll do my research and test and get back to you if I come up with anything.... Quote
Recommended Posts
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.