Skip to content

Commit

Permalink
fixed some text & F3
Browse files Browse the repository at this point in the history
  • Loading branch information
RedLime committed Nov 11, 2021
1 parent 1468ab0 commit b0a381f
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/com/redlimerl/ghostrunner/mixin/KeyboardMixin.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
"depends": {
"fabricloader": ">=0.11.3",
"minecraft": "1.16.1",
"speedrunigt": ">=1.7"
"speedrunigt": ">=1.8"
}
}
1 change: 1 addition & 0 deletions src/main/resources/ghostrunner.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"mixins": [
"ClientAdvancementManagerMixin",
"ClientPlayerEntityMixin",
"KeyboardMixin",
"LivingEntityRendererMixin",
"MinecraftClientMixin",
"screen.CreateWorldScreenMixin",
Expand Down

0 comments on commit b0a381f

Please sign in to comment.