Started by
leifio
on
Topic category: Help with Minecraft modding (Java Edition)
I am trying to add these goggles and when they're active I want them to have a looping ambient sound. Problem is I'm not great with block code and every iteration I have tried to make ends up waiting then playing it every second causing it to pile, I get why it does this but I don't know how to make the loop activate, wait for a certain amount of time, then activate again.
I've tried complex code and bare bones and both end up either not working or end up waiting then constantly looping. Help please.
Edited by leifio on Thu, 07/11/2024 - 04:39
You set up a variable for time. (The left side tab under Resources) Name it and choose NUMBER and GLOBAL_MAP.
Then make this code inside the Update Tick (or Entity Tick Update)
https://ibb.co/KW8z6XR
You have to know the length of the sound in ticks (20 ticks per 1 second)
Also, to stop the sound doubling/echoing for other sounds you can add this:
https://ibb.co/6J7rtv1
Although your exact code didn't work, I just put a wait for 380 ticks (the duration of my sound) then made it add 1 to global time. Thank you for the base though!
Am I able to see the code for that? Need help with making sure sounds dont repeat themselves