Skip to content

Commit

Permalink
SoundHelper seems to be working?
Browse files Browse the repository at this point in the history
  • Loading branch information
floral-qua-floral committed Dec 29, 2024
1 parent 0c73aeb commit 81036ee
Show file tree
Hide file tree
Showing 8 changed files with 632 additions and 43 deletions.
567 changes: 566 additions & 1 deletion content/src/client/resources/assets/mario_qua_mario/sounds.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,28 @@
import net.minecraft.util.Identifier;

public class MarioContentSFX {

public static final SoundEvent DUCK = makeActionSound("duck");
public static final SoundEvent GROUND_POUND_FLIP = makeActionSound("ground_pound_flip");
public static final SoundEvent UNDUCK = makeActionSound("unduck");

public static final SoundEvent FLIP = makeMovementSound("flip");
public static final SoundEvent MARIO_JUMP = makeMovementSound("mario_jump");
public static final SoundEvent LUIGI_JUMP = makeMovementSound("luigi_jump");

public static final SoundEvent FIREBALL = makePowerUpSound("fireball");
public static final SoundEvent FIREBALL_ENEMY = makePowerUpSound("fireball_enemy");
public static final SoundEvent FIREBALL_WALL = makePowerUpSound("fireball_wall");

public static final SoundEvent HEAVY = makeStompSound("heavy");
public static final SoundEvent KICK = makeStompSound("kick");
public static final SoundEvent SPIN = makeStompSound("spin");
public static final SoundEvent STOMP = makeStompSound("stomp");
public static final SoundEvent YOSHI = makeStompSound("yoshi");

private static SoundEvent makeMovementSound(String name) {
return makeAndRegisterSound("sfx.movement." + name);
}
private static SoundEvent makePowerSound(String name) {
private static SoundEvent makePowerUpSound(String name) {
return makeAndRegisterSound("sfx.power_up." + name);
}
private static SoundEvent makeStompSound(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.fqf.mario_qua_mario.registries.actions.ParsedActionHelper;
import com.fqf.mario_qua_mario.registries.power_granting.ParsedCharacter;
import com.fqf.mario_qua_mario.registries.power_granting.ParsedPowerUp;
import com.fqf.mario_qua_mario.util.MarioModSFX;
import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder;
import net.fabricmc.fabric.api.event.registry.RegistryAttribute;
import net.fabricmc.loader.api.FabricLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;

public class MarioModSFX {
public static SoundEvent BUMP = makeMovementSound("bump");
public class MarioSFX {
public static final SoundEvent BUMP = makeMovementSound("bump");
public static final SoundEvent SKID = makeMovementSound("skid");
public static final SoundEvent SKID_ICE = makeMovementSound("skid_ice");
public static final SoundEvent SKID_SAND = makeMovementSound("skid_sand");
public static final SoundEvent SKID_SNOW = makeMovementSound("skid_snow");
public static final SoundEvent SKID_WALL = makeMovementSound("skid_wall");

public static final SoundEvent EMPOWER = makePowerUpSound("empower");
public static final SoundEvent REVERT = makePowerUpSound("revert");

private static SoundEvent makeMovementSound(String name) {
return makeAndRegisterSound("sfx.movement." + name);
}
private static SoundEvent makePowerSound(String name) {
private static SoundEvent makePowerUpSound(String name) {
return makeAndRegisterSound("sfx.power_up." + name);
}
private static SoundEvent makeStompSound(String name) {
Expand Down
2 changes: 1 addition & 1 deletion soundhelper/Sound Helper/Input/MarioContentSfxClass.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $INSERT CODE HERE$
private static SoundEvent makeMovementSound(String name) {
return makeAndRegisterSound("sfx.movement." + name);
}
private static SoundEvent makePowerSound(String name) {
private static SoundEvent makePowerUpSound(String name) {
return makeAndRegisterSound("sfx.power_up." + name);
}
private static SoundEvent makeStompSound(String name) {
Expand Down
4 changes: 2 additions & 2 deletions soundhelper/Sound Helper/Input/MarioModSFXClass.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import net.minecraft.registry.Registry;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;

public class MarioModSFX {
public class MarioSFX {
$INSERT CODE HERE$

private static SoundEvent makeMovementSound(String name) {
return makeAndRegisterSound("sfx.movement." + name);
}
private static SoundEvent makePowerSound(String name) {
private static SoundEvent makePowerUpSound(String name) {
return makeAndRegisterSound("sfx.power_up." + name);
}
private static SoundEvent makeStompSound(String name) {
Expand Down
30 changes: 15 additions & 15 deletions soundhelper/Sound Helper/Output/content/MarioTestSFX.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;

public class MarioContentSFX {
public static final SoundEvent DUCK = makeActionSound("duck")
public static final SoundEvent GROUND_POUND_FLIP = makeActionSound("ground_pound_flip")
public static final SoundEvent UNDUCK = makeActionSound("unduck")
public static final SoundEvent DUCK = makeActionSound("duck");
public static final SoundEvent GROUND_POUND_FLIP = makeActionSound("ground_pound_flip");
public static final SoundEvent UNDUCK = makeActionSound("unduck");

public static final SoundEvent FLIP = makeMovementSound("flip")
public static final SoundEvent MARIO_JUMP = makeMovementSound("mario_jump")
public static final SoundEvent LUIGI_JUMP = makeMovementSound("luigi_jump")
public static final SoundEvent FLIP = makeMovementSound("flip");
public static final SoundEvent MARIO_JUMP = makeMovementSound("mario_jump");
public static final SoundEvent LUIGI_JUMP = makeMovementSound("luigi_jump");

public static final SoundEvent FIREBALL = makePowerUpSound("fireball")
public static final SoundEvent FIREBALL_ENEMY = makePowerUpSound("fireball_enemy")
public static final SoundEvent FIREBALL_WALL = makePowerUpSound("fireball_wall")
public static final SoundEvent FIREBALL = makePowerUpSound("fireball");
public static final SoundEvent FIREBALL_ENEMY = makePowerUpSound("fireball_enemy");
public static final SoundEvent FIREBALL_WALL = makePowerUpSound("fireball_wall");

public static final SoundEvent HEAVY = makeStompSound("heavy")
public static final SoundEvent KICK = makeStompSound("kick")
public static final SoundEvent SPIN = makeStompSound("spin")
public static final SoundEvent STOMP = makeStompSound("stomp")
public static final SoundEvent YOSHI = makeStompSound("yoshi")
public static final SoundEvent HEAVY = makeStompSound("heavy");
public static final SoundEvent KICK = makeStompSound("kick");
public static final SoundEvent SPIN = makeStompSound("spin");
public static final SoundEvent STOMP = makeStompSound("stomp");
public static final SoundEvent YOSHI = makeStompSound("yoshi");

private static SoundEvent makeMovementSound(String name) {
return makeAndRegisterSound("sfx.movement." + name);
}
private static SoundEvent makePowerSound(String name) {
private static SoundEvent makePowerUpSound(String name) {
return makeAndRegisterSound("sfx.power_up." + name);
}
private static SoundEvent makeStompSound(String name) {
Expand Down
37 changes: 19 additions & 18 deletions soundhelper/Sound Helper/SoundHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def save_subtitles(input_file, output_directory, sounds):

print(f"File saved successfully to: {output_directory}")

def make_sounds_dot_json_and_java_file(sounds_dot_json_location, input_java_file, java_file, sound_files_location):
def make_sounds_dot_json_and_java_file(sounds_dot_json_location, do_voices, input_java_file, java_file, sound_files_location):
print(f"Making sounds.json at {sounds_dot_json_location}")

sounds_dot_json = {}
Expand All @@ -140,17 +140,18 @@ def make_sounds_dot_json_and_java_file(sounds_dot_json_location, input_java_file

java_lines.append("\n")

for character in os.listdir(f"{sound_files_location}voices"):
for voiceline in os.listdir(f"{sound_files_location}voices/{character}"):
voiceline_sound_files = []
for sfx in os.listdir(f"{sound_files_location}voices/{character}/{voiceline}"):
sfx_name = sfx[:-4]
voiceline_sound_files.append(f"mario_qua_mario:voices/{character}/{voiceline}/{sfx_name}")
if do_voices:
for character in os.listdir(f"{sound_files_location}voices"):
for voiceline in os.listdir(f"{sound_files_location}voices/{character}"):
voiceline_sound_files = []
for sfx in os.listdir(f"{sound_files_location}voices/{character}/{voiceline}"):
sfx_name = sfx[:-4]
voiceline_sound_files.append(f"mario_qua_mario:voices/{character}/{voiceline}/{sfx_name}")

sounds_dot_json[f"voice.{character}.{voiceline}"] = {
"subtitle": f"subtitles.mario_qua_mario.voice_{character}_{voiceline}",
"sounds": voiceline_sound_files
}
sounds_dot_json[f"voice.{character}.{voiceline}"] = {
"subtitle": f"subtitles.mario_qua_mario.voice_{character}_{voiceline}",
"sounds": voiceline_sound_files
}

print(f"Made sounds.json: {sounds_dot_json}")
with open(f"{sounds_dot_json_location}sounds.json", 'w', encoding='utf-8') as file:
Expand All @@ -176,7 +177,7 @@ def add_sound_to_json(sounds_dot_json, sfx_category, original_name, sfx_name, ja
java_category = sfx_category
if java_category == "power_up": java_category = "PowerUp"
else: java_category = java_category.capitalize()
java_lines.append(f'\tpublic static final SoundEvent {sfx_name.upper()} = make{java_category}Sound("{sfx_name}")\n')
java_lines.append(f'\tpublic static final SoundEvent {sfx_name.upper()} = make{java_category}Sound("{sfx_name}");\n')

def handle_sound_set(
include_voicelines,
Expand All @@ -191,20 +192,20 @@ def handle_sound_set(
):
if output_java_file == "": output_java_file = input_java_file
if audio_destination == "": audio_destination = sounds_dot_json_destination + "sounds"
if old_lang_file == "": old_lang_file = sounds_dot_json_destination + "lang/"
if old_lang_file == "": old_lang_file = sounds_dot_json_destination + "lang/en_us.json"
if subtitle_destination == "": subtitle_destination = sounds_dot_json_destination + "lang/"

subtitles = make_subtitles(include_voicelines, audio_destination, subtitle_script)
save_subtitles(old_lang_file, subtitle_destination, subtitles)
make_sounds_dot_json_and_java_file(sounds_dot_json_destination, input_java_file, output_java_file, audio_destination + "/")
make_sounds_dot_json_and_java_file(sounds_dot_json_destination, include_voicelines, input_java_file, output_java_file, audio_destination + "/")

def get_sounds_dot_json_location(module):
return f"../../{module}/src/client/resources/assets/mario_qua_mario/"
def get_java_file_location(module):
return f"../../{module}/src/main/java/com/fqf/mario_qua_mario/util/Mario{module}SFX.java"
def get_java_file_location(module, addend):
return f"../../{module}/src/main/java/com/fqf/mario_qua_mario/util/Mario{addend}SFX.java"

if __name__ == "__main__":
handle_sound_set(True, content_subtitles, "Output/content/", "Input/MarioContentSfxClass.txt", "Output/content/MarioTestSFX.java.txt",
old_lang_file = "Input/testInput.json")
handle_sound_set(True, content_subtitles, get_sounds_dot_json_location("content"), "Input/MarioContentSfxClass.txt", get_java_file_location("Content"))
handle_sound_set(False, mod_subtitles, get_sounds_dot_json_location("mod"), "Input/MarioModSfxClass.txt", get_java_file_location(""))
handle_sound_set(True, content_subtitles, get_sounds_dot_json_location("content"), "Input/MarioContentSfxClass.txt", get_java_file_location("content", "Content"))
handle_sound_set(False, mod_subtitles, get_sounds_dot_json_location("mod"), "Input/MarioModSfxClass.txt", get_java_file_location("mod", ""))

0 comments on commit 81036ee

Please sign in to comment.