Skip to content

Commit

Permalink
explicitly start credits music
Browse files Browse the repository at this point in the history
  • Loading branch information
sisby-folk committed Nov 30, 2024
1 parent 163d718 commit 8ec6f5b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ authors=ModFest
contributors=Prospector, Sisby folk, acikek
license=MIT
# Mod Version
baseVersion=0.5.2
baseVersion=0.5.3
# Branch Metadata
branch=1.21
tagBranch=1.21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.GridWidget;
import net.minecraft.client.gui.widget.Widget;
import net.minecraft.sound.MusicType;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.modfest.ballotbox.BallotBox;
Expand Down Expand Up @@ -49,8 +50,9 @@ private static Widget replaceReportBugs(GridWidget.Adder instance, Widget widget
private Widget replacePlayerReporting(GridWidget.Adder instance, Widget widget, Operation<Widget> original) {
if (!BallotBox.CONFIG.replace_reporting_credits.value()) return original.call(instance, widget);
return instance.add(ButtonWidget.builder(Text.of(BallotBox.CONFIG.credits_text.value()), b -> {
MinecraftClient.getInstance().getMusicTracker().stop();
MinecraftClient.getInstance().setScreen(new CreditsScreen(false, () -> MinecraftClient.getInstance().setScreen((GameMenuScreen) (Object) this)));
MinecraftClient.getInstance().getMusicTracker().stop();
MinecraftClient.getInstance().getMusicTracker().play(MusicType.CREDITS);
}).width(98).build());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.sound.MusicType;
import net.minecraft.text.Text;
import net.modfest.ballotbox.BallotBox;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -23,8 +24,9 @@ protected TitleScreenMixin(Text title) {
private Element replaceRealms(TitleScreen instance, Element element, Operation<Element> original, int y, int spacingY) {
if (!BallotBox.CONFIG.replace_realms_credits.value()) return original.call(instance, element);
return addDrawableChild(ButtonWidget.builder(Text.of(BallotBox.CONFIG.credits_text.value()), b -> {
MinecraftClient.getInstance().getMusicTracker().stop();
MinecraftClient.getInstance().setScreen(new CreditsScreen(false, () -> MinecraftClient.getInstance().setScreen((TitleScreen) (Object) this)));
MinecraftClient.getInstance().getMusicTracker().stop();
MinecraftClient.getInstance().getMusicTracker().play(MusicType.CREDITS);
})
.dimensions(this.width / 2 - 100, y + spacingY * 2, 200, 20)
.build()
Expand Down

0 comments on commit 8ec6f5b

Please sign in to comment.