aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/kotlin/features/debug/SoundVisualizer.kt65
-rw-r--r--src/main/kotlin/features/garden/HideComposterNoises.kt32
-rw-r--r--src/main/kotlin/gui/config/ManagedConfig.kt1
-rw-r--r--translations/en_us.json5
4 files changed, 103 insertions, 0 deletions
diff --git a/src/main/kotlin/features/debug/SoundVisualizer.kt b/src/main/kotlin/features/debug/SoundVisualizer.kt
new file mode 100644
index 0000000..cc14122
--- /dev/null
+++ b/src/main/kotlin/features/debug/SoundVisualizer.kt
@@ -0,0 +1,65 @@
+package moe.nea.firmament.features.debug
+
+import net.minecraft.text.Text
+import moe.nea.firmament.annotations.Subscribe
+import moe.nea.firmament.commands.thenExecute
+import moe.nea.firmament.commands.thenLiteral
+import moe.nea.firmament.events.CommandEvent
+import moe.nea.firmament.events.SoundReceiveEvent
+import moe.nea.firmament.events.WorldReadyEvent
+import moe.nea.firmament.events.WorldRenderLastEvent
+import moe.nea.firmament.util.red
+import moe.nea.firmament.util.render.RenderInWorldContext
+
+object SoundVisualizer {
+
+ var showSounds = false
+
+ var sounds = mutableListOf<SoundReceiveEvent>()
+
+
+ @Subscribe
+ fun onSubCommand(event: CommandEvent.SubCommand) {
+ event.subcommand("dev") {
+ thenLiteral("sounds") {
+ thenExecute {
+ showSounds = !showSounds
+ if (!showSounds) {
+ sounds.clear()
+ }
+ }
+ }
+ }
+ }
+
+ @Subscribe
+ fun onWorldSwap(event: WorldReadyEvent) {
+ sounds.clear()
+ }
+
+ @Subscribe
+ fun onRender(event: WorldRenderLastEvent) {
+ RenderInWorldContext.renderInWorld(event) {
+ sounds.forEach { event ->
+ withFacingThePlayer(event.position) {
+ text(
+ Text.literal(event.sound.value().id.toString()).also {
+ if (event.cancelled)
+ it.red()
+ },
+ verticalAlign = RenderInWorldContext.VerticalAlign.CENTER,
+ )
+ }
+ }
+ }
+ }
+
+ @Subscribe
+ fun onSoundReceive(event: SoundReceiveEvent) {
+ if (!showSounds) return
+ if (sounds.size > 1000) {
+ sounds.subList(0, 200).clear()
+ }
+ sounds.add(event)
+ }
+}
diff --git a/src/main/kotlin/features/garden/HideComposterNoises.kt b/src/main/kotlin/features/garden/HideComposterNoises.kt
new file mode 100644
index 0000000..69207a9
--- /dev/null
+++ b/src/main/kotlin/features/garden/HideComposterNoises.kt
@@ -0,0 +1,32 @@
+package moe.nea.firmament.features.garden
+
+import net.minecraft.entity.passive.WolfSoundVariants
+import net.minecraft.sound.SoundEvent
+import net.minecraft.sound.SoundEvents
+import moe.nea.firmament.annotations.Subscribe
+import moe.nea.firmament.events.SoundReceiveEvent
+import moe.nea.firmament.gui.config.ManagedConfig
+import moe.nea.firmament.util.SBData
+import moe.nea.firmament.util.SkyBlockIsland
+
+object HideComposterNoises {
+ object TConfig : ManagedConfig("composter", Category.GARDEN) {
+ val hideComposterNoises by toggle("no-more-noises") { false }
+ }
+
+ val composterSoundEvents: List<SoundEvent> = listOf(
+ SoundEvents.BLOCK_PISTON_EXTEND,
+ SoundEvents.BLOCK_WATER_AMBIENT,
+ SoundEvents.ENTITY_CHICKEN_EGG,
+ SoundEvents.WOLF_SOUNDS[WolfSoundVariants.Type.CLASSIC]!!.growlSound().value(),
+ )
+
+ @Subscribe
+ fun onNoise(event: SoundReceiveEvent) {
+ if (!TConfig.hideComposterNoises) return
+ if (SBData.skyblockLocation == SkyBlockIsland.GARDEN) {
+ if (event.sound.value() in composterSoundEvents)
+ event.cancel()
+ }
+ }
+}
diff --git a/src/main/kotlin/gui/config/ManagedConfig.kt b/src/main/kotlin/gui/config/ManagedConfig.kt
index 7ddda9e..5a41f43 100644
--- a/src/main/kotlin/gui/config/ManagedConfig.kt
+++ b/src/main/kotlin/gui/config/ManagedConfig.kt
@@ -39,6 +39,7 @@ abstract class ManagedConfig(
CHAT,
INVENTORY,
MINING,
+ GARDEN,
EVENTS,
INTEGRATIONS,
META,
diff --git a/translations/en_us.json b/translations/en_us.json
index 2f392de..5e970f1 100644
--- a/translations/en_us.json
+++ b/translations/en_us.json
@@ -35,6 +35,8 @@
"firmament.config.category.dev.description": "Settings for texture pack devs and programmers",
"firmament.config.category.events": "Events",
"firmament.config.category.events.description": "Settings for temporary or repeating events",
+ "firmament.config.category.garden": "Garden",
+ "firmament.config.category.garden.description": "Features for the No. 1 Macro Free Island on SkyBlock",
"firmament.config.category.integrations": "Integrations & Textures",
"firmament.config.category.integrations.description": "Integrations with other mods, as well as texture packs",
"firmament.config.category.inventory": "Inventory",
@@ -67,6 +69,9 @@
"firmament.config.compatibility.explosion-enabled.description": "Redirect explosion particles to be rendered by enhanced explosions.",
"firmament.config.compatibility.explosion-power": "Enhanced Explosion Power",
"firmament.config.compatibility.explosion-power.description": "Choose how big explosions will be rendered by enhanced explosions",
+ "firmament.config.composter": "Composter",
+ "firmament.config.composter.no-more-noises": "Mute Composter",
+ "firmament.config.composter.no-more-noises.description": "Muffle all noises and sounds made by the composter",
"firmament.config.configconfig": "Firmaments Config",
"firmament.config.configconfig.enable-moulconfig": "Use MoulConfig",
"firmament.config.configconfig.enable-moulconfig.description": "Uses the MoulConfig config UI. Turn off to fall back to the built in config.",