Skip to content

Commit

Permalink
Only show the test screen if a system property is set
Browse files Browse the repository at this point in the history
  • Loading branch information
SmylerMC committed Sep 17, 2024
1 parent 6343671 commit 5ac5b8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ base {

loom {
log4jConfigs.from file("src/dev/resources/log4j.xml")
runConfigs.configureEach {
property("terramap.debug", "true")
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import static java.lang.System.getProperty;
import static net.smyler.smylib.SmyLib.getGameClient;

@Mixin(Minecraft.class)
public class ShowTestScreenMixin {

@Inject(method = "setScreen(Lnet/minecraft/client/gui/screens/Screen;)V", at = @At("HEAD"), cancellable = true)
private void onSetScreen(Screen screen, CallbackInfo ci) {
if (!"true".equalsIgnoreCase(getProperty("terramap.debug"))) {
return;
}
if (screen instanceof TitleScreen) {
GameClient gameClient = getGameClient();
gameClient.displayScreen(new TestScreen(gameClient.getCurrentScreen()));
Expand Down

0 comments on commit 5ac5b8f

Please sign in to comment.