diff --git a/src/main/java/com/redlimerl/ghostrunner/mixin/ClientPlayerEntityMixin.java b/src/main/java/com/redlimerl/ghostrunner/mixin/ClientPlayerEntityMixin.java index 2354b59..e0d5fd3 100644 --- a/src/main/java/com/redlimerl/ghostrunner/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/com/redlimerl/ghostrunner/mixin/ClientPlayerEntityMixin.java @@ -33,10 +33,6 @@ private void onTick(CallbackInfo ci) { if (InGameTimer.INSTANCE.getStatus() == TimerStatus.RUNNING) { GhostInfo.INSTANCE.update(new PlayerLog(this)); ReplayGhost.tickGhost(); - if (!GhostRunner.IS_USE_F3 && client.options.debugEnabled) { - GhostRunner.IS_USE_F3 = true; - GhostInfo.INSTANCE.getGhostData().setUseF3(true); - } if (world.getDifficulty().getId() < GhostRunner.MINIMUM_DIFFICULTY.getId()) { GhostRunner.MINIMUM_DIFFICULTY = world.getDifficulty(); GhostInfo.INSTANCE.getGhostData().setDifficulty(GhostRunner.MINIMUM_DIFFICULTY); diff --git a/src/main/java/com/redlimerl/ghostrunner/mixin/KeyboardMixin.java b/src/main/java/com/redlimerl/ghostrunner/mixin/KeyboardMixin.java new file mode 100644 index 0000000..0de093d --- /dev/null +++ b/src/main/java/com/redlimerl/ghostrunner/mixin/KeyboardMixin.java @@ -0,0 +1,27 @@ +package com.redlimerl.ghostrunner.mixin; + +import com.redlimerl.ghostrunner.GhostRunner; +import com.redlimerl.ghostrunner.record.GhostInfo; +import net.minecraft.client.Keyboard; +import net.minecraft.client.MinecraftClient; +import org.spongepowered.asm.mixin.Final; +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; + +@Mixin(Keyboard.class) +public class KeyboardMixin { + + @Shadow private boolean switchF3State; + + @Shadow @Final private MinecraftClient client; + + @Inject(at = @At("RETURN"), method = "onKey") + public void onKey(long window, int key, int scancode, int i, int j, CallbackInfo ci) { + if (!GhostRunner.IS_USE_F3 && (switchF3State || client.options.debugEnabled)) { + GhostRunner.IS_USE_F3 = true; + } + } +} diff --git a/src/main/java/com/redlimerl/ghostrunner/mixin/screen/CreateWorldScreenMixin.java b/src/main/java/com/redlimerl/ghostrunner/mixin/screen/CreateWorldScreenMixin.java index 27a3b2d..e3b2e4b 100644 --- a/src/main/java/com/redlimerl/ghostrunner/mixin/screen/CreateWorldScreenMixin.java +++ b/src/main/java/com/redlimerl/ghostrunner/mixin/screen/CreateWorldScreenMixin.java @@ -67,7 +67,8 @@ private void tick(CallbackInfo ci) { @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/world/MoreOptionsDialog;render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V")) private void injected(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { - drawStringWithShadow(matrices, this.textRenderer, I18n.translate("ghostrunner.world.is_fsg.description"), this.width / 2 + 5, 172, -6250336); + if (SpeedRunOptions.getOption(SpeedRunOptions.TIMER_CATEGORY) == RunCategory.ANY) + drawStringWithShadow(matrices, this.textRenderer, I18n.translate("ghostrunner.world.is_fsg.description"), this.width / 2 + 5, 172, -6250336); } @Override diff --git a/src/main/java/com/redlimerl/ghostrunner/record/GhostInfo.java b/src/main/java/com/redlimerl/ghostrunner/record/GhostInfo.java index 12247a7..f4c57b0 100644 --- a/src/main/java/com/redlimerl/ghostrunner/record/GhostInfo.java +++ b/src/main/java/com/redlimerl/ghostrunner/record/GhostInfo.java @@ -128,6 +128,7 @@ public void save() { ghostData.setInGameTime(inGameTimer.getInGameTime()); ghostData.setGhostCategory(inGameTimer.getCategory()); ghostData.updateCreatedDate(); + ghostData.setUseF3(GhostRunner.IS_USE_F3); ghostData.setGhostName(ghostData.getDefaultName()); String playData = Crypto.encrypt(this.toDataString(), ghostData.getKey()); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 067c62c..cc85947 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -28,6 +28,6 @@ "depends": { "fabricloader": ">=0.11.3", "minecraft": "1.16.1", - "speedrunigt": ">=1.7" + "speedrunigt": ">=1.8" } } diff --git a/src/main/resources/ghostrunner.mixins.json b/src/main/resources/ghostrunner.mixins.json index 8bb9946..918291c 100644 --- a/src/main/resources/ghostrunner.mixins.json +++ b/src/main/resources/ghostrunner.mixins.json @@ -6,6 +6,7 @@ "mixins": [ "ClientAdvancementManagerMixin", "ClientPlayerEntityMixin", + "KeyboardMixin", "LivingEntityRendererMixin", "MinecraftClientMixin", "screen.CreateWorldScreenMixin",