-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00562fc
commit fbbbb63
Showing
7 changed files
with
70 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletions
18
src/client/java/symbolics/division/modfest_credits/mixin/CreditsScreenMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
package symbolics.division.modfest_credits.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import net.minecraft.client.gui.screen.CreditsScreen; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.registry.entry.RegistryEntry; | ||
import net.minecraft.sound.MusicSound; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import symbolics.division.modfest_credits.Modfest_credits; | ||
|
||
@Mixin(CreditsScreen.class) | ||
public class CreditsScreenMixin { | ||
private Identifier CREDITS_TEXT_LOCATION; | ||
|
||
// @WrapOperation( | ||
// method = "init", | ||
// at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/CreditsScreen;CREDITS_TEXT_LOCATION:Lnet/minecraft/util/Identifier;") | ||
// ) | ||
// public Identifier injectCredits(Operation<Identifier> original) { | ||
// return Identifier.of("mf121", "texts/credits.json"); | ||
// } | ||
@WrapMethod(method = "getMusic") | ||
private MusicSound wrapGetMusic(Operation<MusicSound> orig) { | ||
return new MusicSound(new RegistryEntry.Direct<>(Modfest_credits.CREDITS_MUSIC), 20, 600, true); | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
src/client/java/symbolics/division/modfest_credits/mixin/GameMenuScreenMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package symbolics.division.modfest_credits.mixin; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.gui.screen.CreditsScreen; | ||
import net.minecraft.client.gui.screen.GameMenuScreen; | ||
import net.minecraft.client.gui.screen.Screen; | ||
import net.minecraft.client.gui.screen.TitleScreen; | ||
import net.minecraft.client.gui.screen.option.CreditsAndAttributionScreen; | ||
import net.minecraft.client.gui.screen.option.OptionsScreen; | ||
import net.minecraft.client.gui.widget.ButtonWidget; | ||
import net.minecraft.client.gui.widget.GridWidget; | ||
import net.minecraft.text.Text; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import java.util.function.Supplier; | ||
|
||
@Mixin(TitleScreen.class) | ||
public abstract class GameMenuScreenMixin extends Screen { | ||
protected GameMenuScreenMixin(Text title) { | ||
super(title); | ||
} | ||
|
||
|
||
@Inject( | ||
method = "init", | ||
at = @At("HEAD") | ||
) | ||
private void initWidgets(CallbackInfo ci) { | ||
int l = this.height / 4 + 48; | ||
this.addDrawableChild(ButtonWidget.builder(Text.translatable("credits_and_attribution.button.credits"), (button) -> { | ||
this.client.setScreen( | ||
new CreditsScreen(false, () -> { | ||
MinecraftClient.getInstance().setScreen((TitleScreen)(Object)this); | ||
}) | ||
); | ||
}).dimensions(this.width / 2 - 100, l + 72 + 12 + 20 + 12, 98 * 2, 20).build()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"credits_music": { | ||
"subtitle": "subtitles.mf_credits.credits_music", | ||
"sounds": [ | ||
"modfest_credits:credits_music" | ||
] | ||
} | ||
} |
Binary file not shown.