diff --git a/common/src/main/java/whocraft/tardis_refined/client/screen/selections/HumSelectionScreen.java b/common/src/main/java/whocraft/tardis_refined/client/screen/selections/HumSelectionScreen.java index e5b6c349b..df074f1b8 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/screen/selections/HumSelectionScreen.java +++ b/common/src/main/java/whocraft/tardis_refined/client/screen/selections/HumSelectionScreen.java @@ -1,6 +1,7 @@ package whocraft.tardis_refined.client.screen.selections; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.brigadier.StringReader; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.ObjectSelectionList; @@ -14,8 +15,8 @@ import whocraft.tardis_refined.common.hum.TardisHums; import whocraft.tardis_refined.common.network.messages.hums.ChangeHumMessage; import whocraft.tardis_refined.common.util.MiscHelper; - -import java.io.StringReader; +import java.util.Collection; +import java.util.Comparator; public class HumSelectionScreen extends SelectionScreen { private HumEntry currentHumEntry; @@ -105,10 +106,13 @@ public Component getSelectedDisplayName() { @Override public ObjectSelectionList createSelectionList() { int leftPos = this.width / 2 - 75; - GenericMonitorSelectionList selectionList = new GenericMonitorSelectionList<>(this.minecraft, 100, 80, leftPos, this.topPos + 30, this.topPos + this.imageHeight - 60, 12); + GenericMonitorSelectionList selectionList = new GenericMonitorSelectionList<>(this.minecraft, 150, 80, leftPos, this.topPos + 30, this.topPos + this.imageHeight - 60, 12); selectionList.setRenderBackground(false); - for (HumEntry humEntry : TardisHums.getRegistry().values()) { + Collection knownHums = TardisHums.getRegistry().values(); + knownHums = knownHums.stream().sorted(Comparator.comparing(HumEntry::getName)).toList(); + + for (HumEntry humEntry : knownHums) { Component name = Component.literal(MiscHelper.getCleanName(humEntry.getIdentifier().getPath())); // Check for if the tellraw name is incomplete, or fails to pass. diff --git a/common/src/main/java/whocraft/tardis_refined/client/sounds/LoopingHumSound.java b/common/src/main/java/whocraft/tardis_refined/client/sounds/LoopingHumSound.java index 369ad27b9..1f1d6f62c 100644 --- a/common/src/main/java/whocraft/tardis_refined/client/sounds/LoopingHumSound.java +++ b/common/src/main/java/whocraft/tardis_refined/client/sounds/LoopingHumSound.java @@ -7,6 +7,7 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; import org.jetbrains.annotations.NotNull; +import whocraft.tardis_refined.constants.NbtConstants; import whocraft.tardis_refined.registry.TRDimensionTypes; public class LoopingHumSound extends LoopingSound{ @@ -26,6 +27,13 @@ public void tick() { super.tick(); volume = 0.10F; LocalPlayer player = Minecraft.getInstance().player; + + if(soundEvent.getLocation().getNamespace().contains(NbtConstants.MINECRAFT)){ + volume = 1f; + } else { + volume = 0.10F; + } + if(player != null){ setLocation(player.position()); diff --git a/common/src/main/java/whocraft/tardis_refined/common/hum/TardisHums.java b/common/src/main/java/whocraft/tardis_refined/common/hum/TardisHums.java index 06c1fc8ec..eb35aa5bc 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/hum/TardisHums.java +++ b/common/src/main/java/whocraft/tardis_refined/common/hum/TardisHums.java @@ -1,15 +1,16 @@ package whocraft.tardis_refined.common.hum; +import net.minecraft.core.Holder; import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import whocraft.tardis_refined.TardisRefined; import whocraft.tardis_refined.client.sounds.QuickSimpleSound; import whocraft.tardis_refined.common.util.CodecJsonReloadListener; import whocraft.tardis_refined.registry.TRSoundRegistry; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; +import java.util.*; public class TardisHums { @@ -21,7 +22,52 @@ public class TardisHums { public static final HumEntry CAVE = new HumEntry(new ResourceLocation(TardisRefined.MODID, "cave"), TRSoundRegistry.HUM_CAVE.getId(), new ArrayList<>()); public static final HumEntry TOYOTA = new HumEntry(new ResourceLocation(TardisRefined.MODID, "toyota"), TRSoundRegistry.HUM_TOYOTA.getId(), new ArrayList<>()); public static final HumEntry CLASSIC = new HumEntry(new ResourceLocation(TardisRefined.MODID, "classic"), TRSoundRegistry.HUM_CLASSIC.getId(), new ArrayList<>()); - public static final HumEntry HUM_1996 = new HumEntry(new ResourceLocation(TardisRefined.MODID, "hum_1996"), TRSoundRegistry.HUM_1996.getId(), new ArrayList<>()); + public static final HumEntry VICTORIAN = new HumEntry(new ResourceLocation(TardisRefined.MODID, "victorian"), TRSoundRegistry.HUM_VICTORIAN.getId(), new ArrayList<>()); + + public static final HumEntry BASALT_DELTAS = new HumEntry( + new ResourceLocation(TardisRefined.MODID, "basalt_deltas"), + SoundEvents.AMBIENT_BASALT_DELTAS_LOOP.value().getLocation(), + createSoundList(SoundEvents.AMBIENT_BASALT_DELTAS_ADDITIONS.value(), SoundEvents.AMBIENT_BASALT_DELTAS_MOOD.value()) + ); + + public static final HumEntry CRIMSON_FOREST = new HumEntry( + new ResourceLocation(TardisRefined.MODID, "crimson_forest"), + SoundEvents.AMBIENT_CRIMSON_FOREST_LOOP.value().getLocation(), + createSoundList(SoundEvents.AMBIENT_CRIMSON_FOREST_ADDITIONS.value(), SoundEvents.AMBIENT_CRIMSON_FOREST_MOOD.value()) + ); + + public static final HumEntry NETHER_WASTES = new HumEntry( + new ResourceLocation(TardisRefined.MODID, "nether_wastes"), + SoundEvents.AMBIENT_NETHER_WASTES_LOOP.value().getLocation(), + createSoundList(SoundEvents.AMBIENT_NETHER_WASTES_ADDITIONS.value(), SoundEvents.AMBIENT_NETHER_WASTES_MOOD.value()) + ); + + public static final HumEntry UNDER_WATER = new HumEntry( + new ResourceLocation(TardisRefined.MODID, "under_water"), + SoundEvents.AMBIENT_UNDERWATER_LOOP.getLocation(), + createSoundList(SoundEvents.AMBIENT_UNDERWATER_LOOP_ADDITIONS, SoundEvents.AMBIENT_UNDERWATER_LOOP_ADDITIONS_RARE, SoundEvents.AMBIENT_UNDERWATER_LOOP_ADDITIONS_ULTRA_RARE) + ); + + + public static final HumEntry SOUL_SAND_VALLEY = new HumEntry( + new ResourceLocation(TardisRefined.MODID, "soul_sand_valley"), + SoundEvents.AMBIENT_SOUL_SAND_VALLEY_LOOP.value().getLocation(), + createSoundList(SoundEvents.AMBIENT_SOUL_SAND_VALLEY_ADDITIONS.value(), SoundEvents.AMBIENT_SOUL_SAND_VALLEY_MOOD.value()) + ); + + public static final HumEntry WARPED_FOREST = new HumEntry( + new ResourceLocation(TardisRefined.MODID, "warped_forest"), + SoundEvents.AMBIENT_WARPED_FOREST_LOOP.value().getLocation(), + createSoundList(SoundEvents.AMBIENT_WARPED_FOREST_ADDITIONS.value(), SoundEvents.AMBIENT_WARPED_FOREST_MOOD.value()) + ); + + private static List createSoundList(SoundEvent... sounds) { + ArrayList soundList = new ArrayList<>(); + for (SoundEvent sound : sounds) { + soundList.add(sound.getLocation()); + } + return soundList; + } /** * A factory method to create the instance of our reload listener. @@ -55,7 +101,7 @@ public static Map registerDefaultHums() { addDefaultHum(getDefaultHum()); addDefaultHum(CAVE); addDefaultHum(TOYOTA); - addDefaultHum(HUM_1996); + addDefaultHum(VICTORIAN); addDefaultHum(CLASSIC); return DEFAULT_HUMS; } @@ -72,7 +118,7 @@ private static HumEntry addDefaultHum(HumEntry hum) { public static HumEntry getDefaultHum() { ArrayList arrayList = new ArrayList(); arrayList.add(new ResourceLocation(TardisRefined.MODID, "interior_creaks")); - return new HumEntry(new ResourceLocation(TardisRefined.MODID, "coral_hum"), TRSoundRegistry.HUM_CORAL.getId(), arrayList); + return new HumEntry(new ResourceLocation(TardisRefined.MODID, "coral"), TRSoundRegistry.HUM_CORAL.getId(), arrayList); } public static Map getDefaultHums() { diff --git a/common/src/main/java/whocraft/tardis_refined/constants/NbtConstants.java b/common/src/main/java/whocraft/tardis_refined/constants/NbtConstants.java index 17c602cc6..ba0ee085d 100644 --- a/common/src/main/java/whocraft/tardis_refined/constants/NbtConstants.java +++ b/common/src/main/java/whocraft/tardis_refined/constants/NbtConstants.java @@ -85,6 +85,7 @@ public class NbtConstants { public static final String FUEL = "fuel"; public static final String MAXIMUM_FUEL = "MaximumFuel"; public static final String IS_PASSIVELY_REFUELING = "is_passively_refueling"; + public static final CharSequence MINECRAFT = "minecraft"; public static TardisNavLocation getTardisNavLocation(CompoundTag tag, String prefix, TardisLevelOperator operator) { BlockPos position = NbtUtils.readBlockPos(tag.getCompound(prefix + NbtConstants.LOCATION_POSITION)); diff --git a/common/src/main/java/whocraft/tardis_refined/registry/TRSoundRegistry.java b/common/src/main/java/whocraft/tardis_refined/registry/TRSoundRegistry.java index 7f44ea3fe..1b02aca35 100644 --- a/common/src/main/java/whocraft/tardis_refined/registry/TRSoundRegistry.java +++ b/common/src/main/java/whocraft/tardis_refined/registry/TRSoundRegistry.java @@ -36,7 +36,7 @@ public class TRSoundRegistry { public static final RegistrySupplier HUM_CAVE = setUpSound("hum_cave"); public static final RegistrySupplier HUM_TOYOTA = setUpSound("hum_toyota"); public static final RegistrySupplier HUM_CLASSIC = setUpSound("hum_classic"); - public static final RegistrySupplier HUM_1996 = setUpSound("hum_1996"); + public static final RegistrySupplier HUM_VICTORIAN = setUpSound("victorian"); // Screwdriver diff --git a/common/src/main/resources/assets/tardis_refined/sounds/tardis/interior_hums/hum1996.ogg b/common/src/main/resources/assets/tardis_refined/sounds/tardis/interior_hums/humvictorian.ogg similarity index 100% rename from common/src/main/resources/assets/tardis_refined/sounds/tardis/interior_hums/hum1996.ogg rename to common/src/main/resources/assets/tardis_refined/sounds/tardis/interior_hums/humvictorian.ogg diff --git a/forge/src/main/java/whocraft/tardis_refined/common/data/HumProvider.java b/forge/src/main/java/whocraft/tardis_refined/common/data/HumProvider.java index 1f78a37bd..bf3352906 100644 --- a/forge/src/main/java/whocraft/tardis_refined/common/data/HumProvider.java +++ b/forge/src/main/java/whocraft/tardis_refined/common/data/HumProvider.java @@ -46,10 +46,16 @@ public CompletableFuture run(CachedOutput arg) { TardisHums.registerDefaultHums(); data.putAll(TardisHums.getDefaultHums()); addHum(TardisHums.getDefaultHum()); - addHum(TardisHums.HUM_1996); + addHum(TardisHums.VICTORIAN); addHum(TardisHums.TOYOTA); addHum(TardisHums.CLASSIC); addHum(TardisHums.CAVE); + addHum(TardisHums.CRIMSON_FOREST); + addHum(TardisHums.BASALT_DELTAS); + addHum(TardisHums.NETHER_WASTES); + addHum(TardisHums.SOUL_SAND_VALLEY); + addHum(TardisHums.WARPED_FOREST); + addHum(TardisHums.UNDER_WATER); } this.addHums(); diff --git a/forge/src/main/java/whocraft/tardis_refined/common/data/SoundProvider.java b/forge/src/main/java/whocraft/tardis_refined/common/data/SoundProvider.java index 9490aea8f..34f245e7f 100644 --- a/forge/src/main/java/whocraft/tardis_refined/common/data/SoundProvider.java +++ b/forge/src/main/java/whocraft/tardis_refined/common/data/SoundProvider.java @@ -33,7 +33,7 @@ public void registerSounds() { add(TRSoundRegistry.BULKHEAD_LOCKED.get(), basicSound("bulkhead_locked", new ResourceLocation(TardisRefined.MODID, "blocks/bulkhead_locked"))); add(TRSoundRegistry.HUM_CORAL.get(), basicSound("hum_coral", new ResourceLocation(TardisRefined.MODID, "tardis/interior_hums/humcoral"))); add(TRSoundRegistry.HUM_CAVE.get(), basicSound("hum_cave", new ResourceLocation(TardisRefined.MODID, "tardis/interior_hums/cave"))); - add(TRSoundRegistry.HUM_1996.get(), basicSound("hum_1996", new ResourceLocation(TardisRefined.MODID, "tardis/interior_hums/hum1996"))); + add(TRSoundRegistry.HUM_VICTORIAN.get(), basicSound("hum_victorian", new ResourceLocation(TardisRefined.MODID, "tardis/interior_hums/humvictorian"))); add(TRSoundRegistry.HUM_CLASSIC.get(), basicSound("hum_classic", new ResourceLocation(TardisRefined.MODID, "tardis/interior_hums/humclassic"))); add(TRSoundRegistry.HUM_TOYOTA.get(), basicSound("hum_toyota", new ResourceLocation(TardisRefined.MODID, "tardis/interior_hums/humtoyota"))); add(TRSoundRegistry.INTERIOR_CREAKS.get(), basicSound("interior_creaks", new ResourceLocation(TardisRefined.MODID, "tardis/ambience/interior_creaks_1"), new ResourceLocation(TardisRefined.MODID, "tardis/ambience/interior_creaks_2"), new ResourceLocation(TardisRefined.MODID, "tardis/ambience/interior_creaks_3")));