Started by
Rasul2003
on
Topic category: Help with Minecraft modding (Java Edition)
Hi so i am working on a music modpack where a item plays music if you right click in air and if music is already playing, it stops the music. The problem is that the music doesn't stop. Every time i right click it just overlaps the song. This is the first time i have used this new type of mcreator so i'm not sure what i'm doing wrong. I also tried to use a custom code snippet with the code Minecraft.getMinecraft().getSoundHandler().stopSounds(); but that didn't work either.
you forgot to set the Variable to something like a random number
But i don't want it to be random, i thought the variable was 0 as default? How could i set it to 0 as a start without constantly setting it to 0?
The problem is that you are using a local variable instead of a number NBT tag.
Disc is always equal to 0 as a local variable is always deleted the moment the procedure ends. An NBT tag on the other hand is stored for the duration of the lifetime of the block/entity/item the NBT tag is on.
Thank you so much i understand now!