Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ und [The Rettington Companion](https://modrinth.com/mod/the-rettington-companion
- Die Nachricht, dass man keine Bandage vergeben kann, wird nur noch in der ActionBar angezeigt, da der Chat durch diese Nachrichten
zugespammt wird
- Beim Öffnen von Schatzkisten können die Delfine deaktiviert werden
- Der "Malle, I love you" Sound kann nun optional deaktiviert werden

### Auto

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class MiscellaneousOptions {
private boolean autoCollectChestsFromTrashCans = false;
private boolean highlightCorpses = false; // feature rejected by UnicaCity team
private boolean hideDolphins = false;
private boolean blockMalleSound = false;

@Getter
@AllArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public class MiscellaneousOptionsScreen extends OptionsScreen {
private static final Component HIGHLIGHT_CORPSES_TOOLTIP = translatable("ucutils.options.highlight_corpses.tooltip").append(NEW_LINE).append(translatable("ucutils.feature_disabled").withColor(RED));
private static final Component HIDE_DOLPHINS_NAME = translatable("ucutils.options.hide_dolphins.name");
private static final Component HIDE_DOLPHINS_TOOLTIP = translatable("ucutils.options.hide_dolphins.tooltip");
private static final Component BLOCK_MALLE_SOUND_NAME = translatable("ucutils.options.block_malle_sound.name");
private static final Component BLOCK_MALLE_SOUND_TOOLTIP = translatable("ucutils.options.block_malle_sound.tooltip");

public MiscellaneousOptionsScreen(Screen parent) {
super(parent, TEXT_MISCELLANEOUS);
Expand All @@ -47,6 +49,7 @@ public void initBody() {

LinearLayout directionalLayoutWidget3 = directionalLayoutWidget.addChild(horizontal().spacing(8));
renderService.addToggleButton(directionalLayoutWidget3, HIDE_DOLPHINS_NAME, HIDE_DOLPHINS_TOOLTIP, (options, value) -> options.miscellaneous().hideDolphins(value), options -> options.miscellaneous().hideDolphins(), 150);
renderService.addToggleButton(directionalLayoutWidget3, BLOCK_MALLE_SOUND_NAME, BLOCK_MALLE_SOUND_TOOLTIP, (options, value) -> options.miscellaneous().blockMalleSound(value), options -> options.miscellaneous().blockMalleSound(), 150);

directionalLayoutWidget.visitWidgets(this::addRenderableWidget);
}
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/de/rettichlp/ucutils/mixin/SoundManagerMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package de.rettichlp.ucutils.mixin;

import net.minecraft.client.resources.sounds.SoundInstance;
import net.minecraft.client.sounds.SoundEngine;
import net.minecraft.client.sounds.SoundManager;
import net.minecraft.resources.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import static de.rettichlp.ucutils.UCUtils.configuration;
import static net.minecraft.client.sounds.SoundEngine.PlayResult.NOT_STARTED;
import static net.minecraft.resources.Identifier.fromNamespaceAndPath;

@Mixin(SoundManager.class)
public abstract class SoundManagerMixin {

@Unique
private static final Identifier MALLE_SOUND_IDENTIFIER = fromNamespaceAndPath("ucmusic", "music.malle_i_love_you");

@Inject(method = "play", at = @At("HEAD"), cancellable = true)
private void ucutils$playHead(SoundInstance instance, CallbackInfoReturnable<SoundEngine.PlayResult> cir) {
if (configuration.getOptions().miscellaneous().blockMalleSound() && MALLE_SOUND_IDENTIFIER.equals(instance.getIdentifier())) {
cir.setReturnValue(NOT_STARTED);
}
}
}
2 changes: 2 additions & 0 deletions src/main/resources/assets/ucutils/lang/de_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
"ucutils.options.highlight_corpses.tooltip": "Lässt Leichen in der Farbe ihrer Fraktion leuchten",
"ucutils.options.hide_dolphins.name": "Verstecke Delfine",
"ucutils.options.hide_dolphins.tooltip": "Verhindert das Spawnen von Delfinen während des öffnens einer Schatzkiste",
"ucutils.options.block_malle_sound.name": "Malle-Sound blockieren",
"ucutils.options.block_malle_sound.tooltip": "Verhindert das Abspielen des \"Malle, I love you\"-Sounds",
"ucutils.options.check_unicacity_server.name": "UnicaCity Check",
"ucutils.options.check_unicacity_server.tooltip": "Überprüft ob du auf UnicaCity spielst. Wenn aktiviert sind bestimmte Funktionen nur auf UnicaCity aktiviert um Probleme mit anderen Servern zu vermeiden.",
"ucutils.options.faction_chat_color.name": "Farbe des Fraktionschats",
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/ucutils/lang/en_gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
"ucutils.options.highlight_corpses.tooltip": "Makes corpses glow in their faction's colour",
"ucutils.options.hide_dolphins.name": "Hide dolphins",
"ucutils.options.hide_dolphins.tooltip": "Prevents dolphins from spawning while opening a treasure chest",
"ucutils.options.block_malle_sound.name": "Block Malle sound",
"ucutils.options.block_malle_sound.tooltip": "Prevents the \"Malle, I love you\" sound from playing",
"ucutils.options.check_unicacity_server.name": "Check for UnicaCity",
"ucutils.options.check_unicacity_server.tooltip": "Checks if you are playing on the UnicaCity server. If enabled, certain features will only be available on the UnicaCity server to prevent issues on other servers.",
"ucutils.options.faction_chat_color.name": "Faction chat color",
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/ucutils/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
"ucutils.options.highlight_corpses.tooltip": "Makes corpses glow in their faction's color",
"ucutils.options.hide_dolphins.name": "Hide dolphins",
"ucutils.options.hide_dolphins.tooltip": "Prevents dolphins from spawning while opening a treasure chest",
"ucutils.options.block_malle_sound.name": "Block Malle sound",
"ucutils.options.block_malle_sound.tooltip": "Prevents the \"Malle, I love you\" sound from playing",
"ucutils.options.check_unicacity_server.name": "Check for UnicaCity",
"ucutils.options.check_unicacity_server.tooltip": "Checks if you are playing on the UnicaCity server. If enabled, certain features will only be available on the UnicaCity server to prevent issues on other servers.",
"ucutils.options.faction_chat_color.name": "Faction chat color",
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/ucutils.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"KeyboardHandlerMixin",
"LocalPlayerMixin",
"PauseScreenMixin",
"PlayerTabOverlayMixin"
"PlayerTabOverlayMixin",
"SoundManagerMixin"
]
}