Music command doesn't work

Started by Rasul2003 on

Topic category: Help with modding (Java Edition)

Last seen on 19:48, 31. Oct 2020
Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Music command doesn't work

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.

https://cdn.discordapp.com/attachments/539150063130378240/636659246322155520/unknown.png

Last seen on 08:03, 9. Dec 2019
Joined Feb 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you forgot to set the…
Wed, 10/23/2019 - 22:08

you forgot to set the Variable to something like a random number

Last seen on 19:48, 31. Oct 2020
Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
But i don't want it to be…
Thu, 10/24/2019 - 17:51

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?

Last seen on 20:25, 8. May 2020
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The problem is that you are…
Fri, 10/25/2019 - 11:41

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.

Last seen on 19:48, 31. Oct 2020
Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you so much i…
Fri, 10/25/2019 - 13:10

Thank you so much i understand now!