Posted August 24, 20178 yr Hello, i created radio for my mod and i want to have music playing all the time. I created class extended from MovingSound(As well as MovingSoundMinecart): public class RepeatSound extends MovingSound { public RepeatSound(TileRadio radio) { super(new ResourceLocation("modid", "radio_sound_1")); this.repeat = true; this.volume = 1.0F; this.xPosF = radio.xCoord; this.yPosF = radio.yCoord; this.zPosF = radio.zCoord; } @Override public void update() {} } In sounds: { "radio_sound_1": { "category": "music", "sounds": [ { "name": "modid:radio_sound_1", "stream": true } ] } } In TileRadio @Override public void updateEntity() { if (play) { play = false; Minecraft.getMinecraft().getSoundHandler().playSound(new RepeatSound(this)); } } And it's not working, there is a small period of 1 second, and sometimes does not work. How to fix it? The fact that I used the same code on 1.7.10 and 1.11.2, and still all the same.
August 24, 20178 yr Minecraft sound handling can be confusing because decision code for the server and "rendering" code for the client are partly mixed together with similarly named methods. Take some time to trace both the execution and data flows with an eye toward logical client-server separation. Then look for a client-side vanilla classes with "continuous" in their names (I hope they haven't changed too much since I used them in 1.10). Finally, look up other threads about changes to Minecraft sounds in 1.12. I think there's some info on sound in 1.12 in the Forge docs area too. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
August 24, 20178 yr Author 4 minutes ago, jeffryfisher said: Minecraft sound handling can be confusing because decision code for the server and "rendering" code for the client are partly mixed together with similarly named methods. Take some time to trace both the execution and data flows with an eye toward logical client-server separation. Then look for a client-side vanilla classes with "continuous" in their names (I hope they haven't changed too much since I used them in 1.10). Finally, look up other threads about changes to Minecraft sounds in 1.12. I think there's some info on sound in 1.12 in the Forge docs area too. Currently working with 1.11.2 I found a mod Siren Mod, it does what I need, and most interestingly, the code is identical to mine, it's very strange:\
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.