Skip to content

Commit

Permalink
Change sound loading, and some initial work on EZ-biome music
Browse files Browse the repository at this point in the history
  • Loading branch information
kd8lvt committed Jun 22, 2024
1 parent cd72e3e commit e273203
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 18 deletions.
4 changes: 1 addition & 3 deletions src/main/java/com/kd8lvt/exclusionzone/ExclusionZone.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class ExclusionZone implements ModInitializer {
public static MinecraftServer Server = null;
public static final boolean muttering_debug = false;
public static final ToxicBuildupTracker toxTracker = new ToxicBuildupTracker();

@Override
public void onInitialize() {
// This code runs as soon as Minecraft is in a mod-load-ready state.
Expand All @@ -49,7 +48,6 @@ public void onInitialize() {
ModPotions.register();
LOGGER.info("[ExclusionZone] Registrering Entities...");
ModEntities.register();

ResourceManagerHelper.get(ResourceType.SERVER_DATA).registerReloadListener(new SimpleSynchronousResourceReloadListener() {
@Override
public Identifier getFabricId() {
Expand All @@ -71,7 +69,7 @@ public void reload(ResourceManager manager) {

ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> toxTracker.remove(handler.getPlayer()));

ServerTickEvents.END_SERVER_TICK.register(server -> toxTracker.onTick(server));
ServerTickEvents.END_SERVER_TICK.register(toxTracker::onTick);
}

public static void runCommand(String cmd) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public ActionResult useOnBlock(ItemUsageContext context) {
if (!Objects.requireNonNull(context.getPlayer()).isSneaking()) return super.useOnBlock(context);
if (((BeaconBlockEntity) Objects.requireNonNull(w.getBlockEntity(context.getBlockPos()))).getBeamSegments().isEmpty()) return super.useOnBlock(context);

w.playSoundAtBlockCenter(context.getBlockPos().up(), ModSounds.CARO_INVICTUS_MUSIC_EVENT, SoundCategory.MASTER,1.0f,1.0f,true);
w.playSoundAtBlockCenter(context.getBlockPos().up(), ModSounds.CARO_INVICTUS_MUSIC, SoundCategory.MASTER,1.0f,1.0f,true);

if (w.isClient) return super.useOnBlock(context);
ServerWorld world = (ServerWorld)w;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class BoyDoll extends Doll {
public BoyDoll() {
super(ModSounds.DOLL_SQUEAK_EVENT,ModSounds.DOLL_CHICKEN_EVENT,0.2, "rubber chicken");
super(ModSounds.DOLL_SQUEAK,ModSounds.DOLL_CHICKEN,0.2, "rubber chicken");
this.tt.addAll(Text.of("Research Notes").getWithStyle(Style.EMPTY.withColor(TextColor.parse("gray").getOrThrow())));
this.tt.addAll(Text.of("A discarded children's toy.").getWithStyle(Style.EMPTY.withColor(TextColor.parse("gray").getOrThrow())));
this.tt.addAll(Text.of("Judging from the colors, this one appears to be a boy.").getWithStyle(Style.EMPTY.withColor(TextColor.parse("gray").getOrThrow())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class GirlDoll extends Doll {
public GirlDoll() {
super(ModSounds.DOLL_SQUEAK_EVENT,ModSounds.DOLL_CHICKEN_EVENT,0.2);
super(ModSounds.DOLL_SQUEAK,ModSounds.DOLL_CHICKEN,0.2);
this.tt.addAll(Text.of("Research Notes").getWithStyle(Style.EMPTY.withColor(TextColor.parse("gray").getOrThrow())));
this.tt.addAll(Text.of("A discarded children's toy.").getWithStyle(Style.EMPTY.withColor(TextColor.parse("gray").getOrThrow())));
this.tt.addAll(Text.of("Judging from the colors, this one appears to be a girl.").getWithStyle(Style.EMPTY.withColor(TextColor.parse("gray").getOrThrow())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class VillagerDoll extends Doll {
public VillagerDoll() {
super(ModSounds.DOLL_SQUEAK_EVENT,ModSounds.DOLL_CHICKEN_EVENT,0.2);
super(ModSounds.DOLL_SQUEAK,ModSounds.DOLL_CHICKEN,0.2);
this.tt.addAll(Text.of("Research Notes").getWithStyle(Style.EMPTY.withColor(TextColor.parse("gray").getOrThrow())));
this.tt.addAll(Text.of("A discarded children's toy.").getWithStyle(Style.EMPTY.withColor(TextColor.parse("gray").getOrThrow())));
this.tt.addAll(Text.of("This one has a suspiciously villager-like nose!.").getWithStyle(Style.EMPTY.withColor(TextColor.parse("gray").getOrThrow())));
Expand Down
29 changes: 19 additions & 10 deletions src/main/java/com/kd8lvt/exclusionzone/init/ModSounds.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,27 @@
import net.minecraft.util.Identifier;

public class ModSounds {
public static final Identifier DOLL_SQUEAK = ExclusionZone.id("item.doll.squeak");
public static SoundEvent DOLL_SQUEAK_EVENT = SoundEvent.of(DOLL_SQUEAK);
public static SoundEvent DOLL_SQUEAK;
public static SoundEvent DOLL_CHICKEN;
public static SoundEvent CARO_INVICTUS_MUSIC;
public static SoundEvent EZ_DRONE_TS_SLOWED;
public static SoundEvent EZ_DRONE_TS_SLOWED_GEIGER;
public static SoundEvent EZ_DRONE_TS_SLOWED_VOICES;

public static final Identifier DOLL_CHICKEN = ExclusionZone.id("item.doll.chicken");
public static SoundEvent DOLL_CHICKEN_EVENT = SoundEvent.of(DOLL_CHICKEN);

public static final Identifier CARO_INVICTUS_MUSIC = ExclusionZone.id("mob.caro_invictus.music");
public static SoundEvent CARO_INVICTUS_MUSIC_EVENT = SoundEvent.of(CARO_INVICTUS_MUSIC);
public static void register() {
Registry.register(Registries.SOUND_EVENT,DOLL_SQUEAK,DOLL_SQUEAK_EVENT);
Registry.register(Registries.SOUND_EVENT,DOLL_CHICKEN,DOLL_CHICKEN_EVENT);
Registry.register(Registries.SOUND_EVENT,CARO_INVICTUS_MUSIC,CARO_INVICTUS_MUSIC_EVENT);
DOLL_SQUEAK = register("item.doll.squeak");
DOLL_CHICKEN = register("item.doll.chicken");
CARO_INVICTUS_MUSIC = register("mob.caro_invictus.music");
EZ_DRONE_TS_SLOWED = register("music.drones.throat_singing_slowed"); //Sound Effect modified from https://pixabay.com/sound-effects/?utm_source=link-attribution&utm_medium=referral&utm_campaign=music&utm_content=86848
EZ_DRONE_TS_SLOWED_GEIGER = register("music.drones.throat_singing_slowed_geiger"); //Sound Effect from https://pixabay.com/sound-effects/?utm_source=link-attribution&utm_medium=referral&utm_campaign=music&utm_content=86848 and https://pixabay.com/sound-effects/?utm_source=link-attribution&utm_medium=referral&utm_campaign=music&utm_content=62113
EZ_DRONE_TS_SLOWED_VOICES = register("music.drones.throat_singing_slowed_whispers"); //Sound Effect from https://pixabay.com/sound-effects/?utm_source=link-attribution&utm_medium=referral&utm_campaign=music&utm_content=86848 and https://pixabay.com/sound-effects/?utm_source=link-attribution&utm_medium=referral&utm_campaign=music&utm_content=94457
}

public static SoundEvent register(String id) {
Identifier identifier = ExclusionZone.id(id);
SoundEvent soundEvent = SoundEvent.of(identifier);
Registry.register(Registries.SOUND_EVENT,identifier,soundEvent);
return soundEvent;
}

public static float randPitch() {
Expand Down
Binary file modified src/main/resources/assets/exclusionzone/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion src/main/resources/assets/exclusionzone/sounds.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,22 @@
},
"mob.caro_invictus.music": {
"sounds": [
"exclusionzone:mob/caro_invictus/music"
{"name": "exclusionzone:mob/caro_invictus/music", "stream": true, "category": "music"}
]
},
"music.drones.throat_singing_slowed": {
"sounds": [
{"name":"exclusionzone:music/drones/throat_singing_slowed", "stream": true, "category": "music"}
]
},
"music.drones.throat_singing_slowed_geiger": {
"sounds": [
{"name":"exclusionzone:music/drones/throat_singing_slowed_geiger", "stream": true, "category": "music"}
]
},
"music.drones.throat_singing_slowed_whispers": {
"sounds": [
{"name":"exclusionzone:music/drones/throat_singing_slowed_whispers", "stream": true, "category": "music"}
]
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
}
}
},
"music": {
"sound": [
{"sound_id": "exclusionzone:music.drones.throat_singing_slowed","min_delay": 0,"max_delay": 1,"replace_current_music": true},
{"sound_id": "exclusionzone:music.drones.throat_singing_slowed_geiger","min_delay": 0,"max_delay": 1,"replace_current_music": true},
{"sound_id": "exclusionzone:music.drones.throat_singing_slowed_whispers","min_delay": 0,"max_delay": 1,"replace_current_music": true}
]
},
"carvers": {
"air": [],
"liquid": []
Expand Down

0 comments on commit e273203

Please sign in to comment.