Skip to content

Introduction to the script

null-version-nova edited this page Nov 21, 2023 · 1 revision

The script that controls the functionality of this mod is located in .minecraft/musicscript as musicscript.py. It will not be generated automatically, you will have to create it yourself.

def change_dimension(data):
    if data["dimension"] == "minecraft:the_end":
        return "stop; delay 200; play minecraft:music.the_end"
    elif data["dimension"] == "minecraft:overworld":
        return "stop; delay 200"
    else:
        return "stop; delay 200"


def water_submersion(data):
    if data["is_in_water"]:
        return "stop; play minecraft:music.under_water"
    else:
        return "stop; delay 200"


def play_song(data):
    return "play minecraft:music.game"

Here's an example to get started with. This script is loaded every time you enter a world, which means that you can edit it, reload the world, and it will be updated. I'll add a command to make that easier soonish.

The functions represent events that the game calls under certain conditions. Each of these functions returns a string containing commands for the sound manager. This essentially allows you to control how music plays in Minecraft.

Clone this wiki locally