diff --git a/build.gradle b/build.gradle index d755f69..fb36292 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ //file:noinspection GroovyAssignabilityCheck //file:noinspection GroovyAccessibility plugins { - id 'fabric-loom' version '0.7-SNAPSHOT' + id 'fabric-loom' version '0.12-SNAPSHOT' id 'maven-publish' } @@ -18,12 +18,7 @@ repositories { // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. // See https://docs.gradle.org/current/userguide/declaring_repositories.html // for more information about repositories. - maven { - url "https://www.cursemaven.com" - content { - includeGroup "curse.maven" - } - } + maven { url 'https://jitpack.io' } } configurations { @@ -51,7 +46,7 @@ dependencies { modIncludeImplementation(fabricApi.module("fabric-tool-attribute-api-v1", project.fabric_version)) //modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modImplementation "curse.maven:speedrunigt-538881:3538360" + modImplementation "com.github.RedLime:SpeedRunIGT:${project.minecraft_version}-SNAPSHOT" } processResources { diff --git a/gradle.properties b/gradle.properties index 1579396..e9adae5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ org.gradle.jvmargs=-Xmx1G # Mod Properties - mod_version = 2.2.1+1.16.1 + mod_version = 4.0+1.16.1 maven_group = com.redlimerl archives_base_name = GhostRunner diff --git a/src/main/java/com/redlimerl/ghostrunner/GhostRunner.java b/src/main/java/com/redlimerl/ghostrunner/GhostRunner.java index 9fab4b1..3c97013 100644 --- a/src/main/java/com/redlimerl/ghostrunner/GhostRunner.java +++ b/src/main/java/com/redlimerl/ghostrunner/GhostRunner.java @@ -8,6 +8,7 @@ import com.redlimerl.ghostrunner.gui.screen.APIKeyScreen; import com.redlimerl.ghostrunner.gui.screen.GhostRunnerInfoScreen; import com.redlimerl.ghostrunner.gui.widget.OpacitySliderWidget; +import com.redlimerl.speedrunigt.option.SpeedRunOption; import com.redlimerl.speedrunigt.option.SpeedRunOptions; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; @@ -94,8 +95,8 @@ public void onInitializeClient() { KeyBinding ghostToggleKey = KeyBindingHelper.registerKeyBinding(new KeyBinding("ghostrunner.title.toggle_ghost", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_P, "ghostrunner.title")); ClientTickEvents.END_CLIENT_TICK.register(client -> { while (ghostToggleKey.wasPressed()) { - boolean option = !SpeedRunOptions.getOption(RunnerOptions.TOGGLE_GHOST); - SpeedRunOptions.setOption(RunnerOptions.TOGGLE_GHOST, option); + boolean option = !SpeedRunOption.getOption(RunnerOptions.TOGGLE_GHOST); + SpeedRunOption.setOption(RunnerOptions.TOGGLE_GHOST, option); if (client.player != null) { client.player.sendMessage(new LiteralText("[Ghost Runner] ").formatted(Formatting.BOLD).formatted(Formatting.AQUA) .append(new TranslatableText("ghostrunner.message.toggle_ghost", new TranslatableText("addServer.resourcePack." + (option ? "enabled" : "disabled"))).formatted(Formatting.WHITE)), true); @@ -103,37 +104,7 @@ public void onInitializeClient() { } }); - SpeedRunOptions.addOptionButton(screen -> new OpacitySliderWidget()); - SpeedRunOptions.addOptionButton(screen -> - new ButtonWidget(0, 0, 150, 20, new TranslatableText("ghostrunner.option.toggle_point_notification").append(": ").append(SpeedRunOptions.getOption(RunnerOptions.TOGGLE_CHECKPOINT_MESSAGE) ? ScreenTexts.ON : ScreenTexts.OFF), button -> { - SpeedRunOptions.setOption(RunnerOptions.TOGGLE_CHECKPOINT_MESSAGE, !SpeedRunOptions.getOption(RunnerOptions.TOGGLE_CHECKPOINT_MESSAGE)); - button.setMessage(new TranslatableText("ghostrunner.option.toggle_point_notification").append(": ").append(SpeedRunOptions.getOption(RunnerOptions.TOGGLE_CHECKPOINT_MESSAGE) ? ScreenTexts.ON : ScreenTexts.OFF)); - }) - , new TranslatableText("ghostrunner.option.toggle_point_notification.context")); - SpeedRunOptions.addOptionButton(screen -> - new ButtonWidget(0, 0, 150, 20, new TranslatableText("ghostrunner.option.toggle_fsg_macro_mode").append(": ").append(SpeedRunOptions.getOption(RunnerOptions.TOGGLE_MACRO_FOR_FSG) ? ScreenTexts.ON : ScreenTexts.OFF), button -> { - SpeedRunOptions.setOption(RunnerOptions.TOGGLE_MACRO_FOR_FSG, !SpeedRunOptions.getOption(RunnerOptions.TOGGLE_MACRO_FOR_FSG)); - button.setMessage(new TranslatableText("ghostrunner.option.toggle_fsg_macro_mode").append(": ").append(SpeedRunOptions.getOption(RunnerOptions.TOGGLE_MACRO_FOR_FSG) ? ScreenTexts.ON : ScreenTexts.OFF)); - }) - , new TranslatableText("ghostrunner.option.toggle_fsg_macro_mode.context")); - SpeedRunOptions.addOptionButton(screen -> - new ButtonWidget(0, 0, 150, 20, new TranslatableText("ghostrunner.menu.register_api_key"), button -> { - MinecraftClient client = MinecraftClient.getInstance(); - if (client != null) client.openScreen(new APIKeyScreen(bool -> client.openScreen(screen))); - }) - ); - SpeedRunOptions.addOptionButton(screen -> - new ButtonWidget(0, 0, 150, 20, new TranslatableText("ghostrunner.menu.info"), button -> { - MinecraftClient client = MinecraftClient.getInstance(); - if (client != null) client.openScreen(new GhostRunnerInfoScreen(screen)); - }) - ); - SpeedRunOptions.addOptionButton(screen -> - new ButtonWidget(0, 0, 150, 20, new TranslatableText("options.controls"), button -> { - MinecraftClient client = MinecraftClient.getInstance(); - if (client != null) client.openScreen(new ControlsOptionsScreen(screen, client.options)); - }) - ); + UPDATE_STATUS.check(); } public static void debug(Object obj) { diff --git a/src/main/java/com/redlimerl/ghostrunner/data/UpdateStatus.java b/src/main/java/com/redlimerl/ghostrunner/data/UpdateStatus.java index 814de27..f93635c 100644 --- a/src/main/java/com/redlimerl/ghostrunner/data/UpdateStatus.java +++ b/src/main/java/com/redlimerl/ghostrunner/data/UpdateStatus.java @@ -6,6 +6,7 @@ import com.redlimerl.ghostrunner.GhostRunner; import com.redlimerl.ghostrunner.gui.GenericToast; import com.redlimerl.ghostrunner.util.Utils; +import com.redlimerl.speedrunigt.option.SpeedRunOption; import com.redlimerl.speedrunigt.option.SpeedRunOptions; import net.minecraft.client.MinecraftClient; import net.minecraft.client.resource.language.I18n; @@ -84,7 +85,7 @@ public String getLastVersion() { public void popNotice() { if (!isPopped && status == Status.OUTDATED) { isPopped = true; - if (!SpeedRunOptions.getOption(RunnerOptions.UPDATE_NOTIFICATION)) return; + if (!SpeedRunOption.getOption(RunnerOptions.UPDATE_NOTIFICATION)) return; MinecraftClient client = MinecraftClient.getInstance(); client.getToastManager().add(new GenericToast(I18n.translate("ghostrunner.message.update.found_new_update"), null, new ItemStack(Items.ANVIL))); } diff --git a/src/main/java/com/redlimerl/ghostrunner/gui/screen/APIKeyScreen.java b/src/main/java/com/redlimerl/ghostrunner/gui/screen/APIKeyScreen.java index c0795a0..3afba47 100644 --- a/src/main/java/com/redlimerl/ghostrunner/gui/screen/APIKeyScreen.java +++ b/src/main/java/com/redlimerl/ghostrunner/gui/screen/APIKeyScreen.java @@ -1,6 +1,7 @@ package com.redlimerl.ghostrunner.gui.screen; import com.redlimerl.ghostrunner.data.RunnerOptions; +import com.redlimerl.speedrunigt.option.SpeedRunOption; import com.redlimerl.speedrunigt.option.SpeedRunOptions; import it.unimi.dsi.fastutil.booleans.BooleanConsumer; import net.minecraft.client.gui.screen.Screen; @@ -32,7 +33,7 @@ protected void init() { this.saveButton = addButton(new ButtonWidget(width / 2 - 100, height / 4 + 32, 98, 20, new TranslatableText("selectWorld.edit.save"), (button) -> { - SpeedRunOptions.setOption(RunnerOptions.SPEEDRUN_COM_API_KEY, finalKey); + SpeedRunOption.setOption(RunnerOptions.SPEEDRUN_COM_API_KEY, finalKey); booleanConsumer.accept(true); })); @@ -42,7 +43,7 @@ protected void init() { this.apiKeyTextField = new TextFieldWidget(textRenderer, width / 2 - 100, height / 4 + 9, 200, 20, new LiteralText("API Key...")); this.apiKeyTextField.setMaxLength(30); - this.apiKeyTextField.setText(SpeedRunOptions.getOption(RunnerOptions.SPEEDRUN_COM_API_KEY)); + this.apiKeyTextField.setText(SpeedRunOption.getOption(RunnerOptions.SPEEDRUN_COM_API_KEY)); children.add(this.apiKeyTextField); setInitialFocus(this.apiKeyTextField); } diff --git a/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostEditScreen.java b/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostEditScreen.java index c59c8ea..176aeae 100644 --- a/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostEditScreen.java +++ b/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostEditScreen.java @@ -5,6 +5,7 @@ import com.redlimerl.ghostrunner.record.data.GhostData; import com.redlimerl.ghostrunner.util.Utils; import com.redlimerl.ghostrunner.util.submit.SubmitData; +import com.redlimerl.speedrunigt.option.SpeedRunOption; import com.redlimerl.speedrunigt.option.SpeedRunOptions; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.hud.BackgroundHelper; @@ -72,7 +73,7 @@ protected void init() { this.submitButton = addButton(new ButtonWidget(width / 2 - 100, yPos + 99, 200, 20, ghost.getRecordURL().isEmpty() ? new TranslatableText("ghostrunner.menu.submit_record") : new TranslatableText("ghostrunner.menu.open_speedrun_com"), ghost.getRecordURL().isEmpty() ? (button) -> { - if (SpeedRunOptions.getOption(RunnerOptions.SPEEDRUN_COM_API_KEY).length() < 24) { + if (SpeedRunOption.getOption(RunnerOptions.SPEEDRUN_COM_API_KEY).length() < 24) { client.openScreen(new ConfirmScreen(bool -> client.openScreen(bool ? new APIKeyScreen(bool2 -> client.openScreen(bool2 ? new GhostSubmitScreen(this, ghost) : this)) : this), diff --git a/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostInfoScreen.java b/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostInfoScreen.java index 9efe61a..f4db21c 100644 --- a/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostInfoScreen.java +++ b/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostInfoScreen.java @@ -2,6 +2,7 @@ import com.redlimerl.ghostrunner.record.data.GhostData; import com.redlimerl.speedrunigt.timer.InGameTimer; +import com.redlimerl.speedrunigt.timer.InGameTimerUtils; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.screen.Screen; @@ -53,8 +54,8 @@ public GeneralInfoListWidget(MinecraftClient minecraftClient, GhostInfoScreen in GhostData ghostData = infoScreen.ghostData; addEntry(new Entry(this, "seed", String.valueOf(ghostData.getSeed()))); - addEntry(new Entry(this, "realtime", InGameTimer.timeToStringFormat(ghostData.getRealTimeAttack()))); - addEntry(new Entry(this, "ingametime", InGameTimer.timeToStringFormat(ghostData.getInGameTime()))); + addEntry(new Entry(this, "realtime", InGameTimerUtils.timeToStringFormat(ghostData.getRealTimeAttack()))); + addEntry(new Entry(this, "ingametime", InGameTimerUtils.timeToStringFormat(ghostData.getInGameTime()))); addEntry(new Entry(this, "category", ghostData.getGhostCategory().getText().getString())); addEntry(new Entry(this, "gametype", ghostData.getType().getContext())); addEntry(new Entry(this, "clientversion", ghostData.getClientVersion())); diff --git a/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostListScreen.java b/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostListScreen.java index b05b67b..9da73cd 100644 --- a/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostListScreen.java +++ b/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostListScreen.java @@ -6,7 +6,7 @@ import com.redlimerl.ghostrunner.record.data.GhostData; import com.redlimerl.ghostrunner.util.TarGzUtil; import com.redlimerl.ghostrunner.util.Utils; -import com.redlimerl.speedrunigt.option.SpeedRunOptionScreen; +import com.redlimerl.speedrunigt.gui.screen.SpeedRunOptionScreen; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ScreenTexts; diff --git a/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostRunnerInfoScreen.java b/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostRunnerInfoScreen.java index cdf3270..e70082e 100644 --- a/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostRunnerInfoScreen.java +++ b/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostRunnerInfoScreen.java @@ -5,6 +5,7 @@ import com.redlimerl.ghostrunner.data.RunnerOptions; import com.redlimerl.ghostrunner.data.UpdateStatus; import com.redlimerl.ghostrunner.data.UpdateStatus.Status; +import com.redlimerl.speedrunigt.option.SpeedRunOption; import com.redlimerl.speedrunigt.option.SpeedRunOptions; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ScreenTexts; @@ -38,11 +39,11 @@ protected void init() { addButton(new ButtonWidget(width / 2 - 75, height - 80, 150, 20, new TranslatableText("ghostrunner.menu.open_github_repo"), (ButtonWidget button) -> Util.getOperatingSystem().open("https://github.com/RedLime/GhostRunner/"))); addButton(new ButtonWidget(width / 2 - 100, height - 40, 200, 20, ScreenTexts.BACK, (ButtonWidget button) -> client.openScreen(parent))); - addButton(new CheckboxWidget(20, 20, 20, 20, new TranslatableText("ghostrunner.option.toggle_update_notification"), SpeedRunOptions.getOption(RunnerOptions.UPDATE_NOTIFICATION)) { + addButton(new CheckboxWidget(20, 20, 20, 20, new TranslatableText("ghostrunner.option.toggle_update_notification"), SpeedRunOption.getOption(RunnerOptions.UPDATE_NOTIFICATION)) { @Override public void onPress() { super.onPress(); - SpeedRunOptions.setOption(RunnerOptions.UPDATE_NOTIFICATION, isChecked()); + SpeedRunOption.setOption(RunnerOptions.UPDATE_NOTIFICATION, isChecked()); } }); } diff --git a/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostSubmitScreen.java b/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostSubmitScreen.java index 3a8479e..9bddf32 100644 --- a/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostSubmitScreen.java +++ b/src/main/java/com/redlimerl/ghostrunner/gui/screen/GhostSubmitScreen.java @@ -5,6 +5,7 @@ import com.redlimerl.ghostrunner.util.Utils; import com.redlimerl.ghostrunner.util.submit.SubmitData; import com.redlimerl.speedrunigt.timer.InGameTimer; +import com.redlimerl.speedrunigt.timer.InGameTimerUtils; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ScreenTexts; @@ -98,7 +99,7 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { drawCenteredText(matrices, textRenderer, title, width / 2, 20, 16777215); drawCenteredText(matrices, textRenderer, new TranslatableText("ghostrunner.message.not_need_seed_description"), width / 2, this.submitButton.y - 12, 16777215); drawCenteredText(matrices, textRenderer, new TranslatableText("ghostrunner.ghostdata.title").append(": ") - .append(ghostData.getGhostCategory().getText().getString() + " | " + ghostData.getType().getContext() + " | " + InGameTimer.timeToStringFormat(ghostData.getInGameTime())), + .append(ghostData.getGhostCategory().getText().getString() + " | " + ghostData.getType().getContext() + " | " + InGameTimerUtils.timeToStringFormat(ghostData.getInGameTime())), width / 2, this.submitButton.y - 24, 16777215); drawTextWithShadow(matrices, textRenderer, new TranslatableText("ghostrunner.title.description"), width / 2 - 100, this.descriptionField.y - 10, 16777215); drawTextWithShadow(matrices, textRenderer, new TranslatableText("ghostrunner.title.video_url"), width / 2 - 100, this.videoUrlField.y - 10, 16777215); diff --git a/src/main/java/com/redlimerl/ghostrunner/gui/widget/GhostListWidget.java b/src/main/java/com/redlimerl/ghostrunner/gui/widget/GhostListWidget.java index 005a751..baf5257 100644 --- a/src/main/java/com/redlimerl/ghostrunner/gui/widget/GhostListWidget.java +++ b/src/main/java/com/redlimerl/ghostrunner/gui/widget/GhostListWidget.java @@ -8,6 +8,7 @@ import com.redlimerl.ghostrunner.record.data.GhostType; import com.redlimerl.ghostrunner.util.TarGzUtil; import com.redlimerl.speedrunigt.timer.InGameTimer; +import com.redlimerl.speedrunigt.timer.InGameTimerUtils; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.screen.ConfirmScreen; @@ -156,9 +157,9 @@ public void render(MatrixStack matrices, int index, int y, int x, int entryWidth float xOffset = (float) x; MutableText timeContext = new LiteralText(" IGT: ").formatted(Formatting.GRAY) - .append(new LiteralText(InGameTimer.timeToStringFormat(ghost.getInGameTime())).formatted(Formatting.UNDERLINE).formatted(Formatting.YELLOW)) + .append(new LiteralText(InGameTimerUtils.timeToStringFormat(ghost.getInGameTime())).formatted(Formatting.UNDERLINE).formatted(Formatting.YELLOW)) .append(new LiteralText(" / RTA: ").formatted(Formatting.GRAY)) - .append(new LiteralText(InGameTimer.timeToStringFormat(ghost.getRealTimeAttack())).formatted(Formatting.UNDERLINE).formatted(Formatting.LIGHT_PURPLE)) + .append(new LiteralText(InGameTimerUtils.timeToStringFormat(ghost.getRealTimeAttack())).formatted(Formatting.UNDERLINE).formatted(Formatting.LIGHT_PURPLE)) .append(new LiteralText(" / ").formatted(Formatting.GRAY)) .append(ghost.getGhostCategory().getText().formatted(Formatting.UNDERLINE).formatted(Formatting.AQUA)); MutableText runnerContext = new TranslatableText("ghostrunner.context.by").append(": ") diff --git a/src/main/java/com/redlimerl/ghostrunner/gui/widget/GhostSelectWidget.java b/src/main/java/com/redlimerl/ghostrunner/gui/widget/GhostSelectWidget.java index c18e5e0..68d62c4 100644 --- a/src/main/java/com/redlimerl/ghostrunner/gui/widget/GhostSelectWidget.java +++ b/src/main/java/com/redlimerl/ghostrunner/gui/widget/GhostSelectWidget.java @@ -5,6 +5,7 @@ import com.redlimerl.ghostrunner.record.ReplayGhost; import com.redlimerl.ghostrunner.record.data.GhostData; import com.redlimerl.speedrunigt.timer.InGameTimer; +import com.redlimerl.speedrunigt.timer.InGameTimerUtils; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.Element; import net.minecraft.client.gui.screen.ScreenTexts; @@ -103,7 +104,7 @@ public void render(MatrixStack matrices, int index, int y, int x, int entryWidth ghostName = ghostName.substring(indexCount, 20+indexCount); } - selectWidget.client.textRenderer.draw(matrices, new LiteralText("").append(new LiteralText("[" + InGameTimer.timeToStringFormat(ghostData.getInGameTime()) + "] ") + selectWidget.client.textRenderer.draw(matrices, new LiteralText("").append(new LiteralText("[" + InGameTimerUtils.timeToStringFormat(ghostData.getInGameTime()) + "] ") .formatted(Formatting.GRAY)).append(new LiteralText(ghostName)), (float) (x + 4), (float) (y + 6), GhostSelectScreen.WHITE_COLOR); } diff --git a/src/main/java/com/redlimerl/ghostrunner/gui/widget/OpacitySliderWidget.java b/src/main/java/com/redlimerl/ghostrunner/gui/widget/OpacitySliderWidget.java index b2c8e1d..bf2c7d9 100644 --- a/src/main/java/com/redlimerl/ghostrunner/gui/widget/OpacitySliderWidget.java +++ b/src/main/java/com/redlimerl/ghostrunner/gui/widget/OpacitySliderWidget.java @@ -1,6 +1,7 @@ package com.redlimerl.ghostrunner.gui.widget; import com.redlimerl.ghostrunner.data.RunnerOptions; +import com.redlimerl.speedrunigt.option.SpeedRunOption; import com.redlimerl.speedrunigt.option.SpeedRunOptions; import net.minecraft.client.gui.widget.SliderWidget; import net.minecraft.text.LiteralText; @@ -9,7 +10,7 @@ public class OpacitySliderWidget extends SliderWidget { public OpacitySliderWidget() { - super(0, 0, 150, 20, LiteralText.EMPTY, SpeedRunOptions.getOption(RunnerOptions.GHOST_OPACITY)); + super(0, 0, 150, 20, LiteralText.EMPTY, SpeedRunOption.getOption(RunnerOptions.GHOST_OPACITY)); updateMessage(); } @@ -21,6 +22,6 @@ protected void updateMessage() { @Override protected void applyValue() { - SpeedRunOptions.setOption(RunnerOptions.GHOST_OPACITY, (float) this.value); + SpeedRunOption.setOption(RunnerOptions.GHOST_OPACITY, (float) this.value); } } diff --git a/src/main/java/com/redlimerl/ghostrunner/impl/speedrunigt/OptionButtonsImpl.java b/src/main/java/com/redlimerl/ghostrunner/impl/speedrunigt/OptionButtonsImpl.java new file mode 100644 index 0000000..c79c0d1 --- /dev/null +++ b/src/main/java/com/redlimerl/ghostrunner/impl/speedrunigt/OptionButtonsImpl.java @@ -0,0 +1,79 @@ +package com.redlimerl.ghostrunner.impl.speedrunigt; + +import com.redlimerl.ghostrunner.data.RunnerOptions; +import com.redlimerl.ghostrunner.gui.screen.APIKeyScreen; +import com.redlimerl.ghostrunner.gui.screen.GhostRunnerInfoScreen; +import com.redlimerl.ghostrunner.gui.widget.OpacitySliderWidget; +import com.redlimerl.speedrunigt.api.OptionButtonFactory; +import com.redlimerl.speedrunigt.api.SpeedRunIGTApi; +import com.redlimerl.speedrunigt.option.SpeedRunOption; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.ScreenTexts; +import net.minecraft.client.gui.screen.options.ControlsOptionsScreen; +import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.text.TranslatableText; +import org.spongepowered.include.com.google.common.collect.Lists; + +import java.util.Collection; +import java.util.List; + +public class OptionButtonsImpl implements SpeedRunIGTApi { + + @Override + public Collection createOptionButtons() { + List factoryList = Lists.newArrayList(); + + factoryList.add(screen -> + new OptionButtonFactory.Builder() + .setButtonWidget(new OpacitySliderWidget()) + .setCategory("ghostrunner.title") + ); + + factoryList.add(screen -> + new OptionButtonFactory.Builder() + .setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("ghostrunner.option.toggle_point_notification").append(": ").append(SpeedRunOption.getOption(RunnerOptions.TOGGLE_CHECKPOINT_MESSAGE) ? ScreenTexts.ON : ScreenTexts.OFF), button -> { + SpeedRunOption.setOption(RunnerOptions.TOGGLE_CHECKPOINT_MESSAGE, !SpeedRunOption.getOption(RunnerOptions.TOGGLE_CHECKPOINT_MESSAGE)); + button.setMessage(new TranslatableText("ghostrunner.option.toggle_point_notification").append(": ").append(SpeedRunOption.getOption(RunnerOptions.TOGGLE_CHECKPOINT_MESSAGE) ? ScreenTexts.ON : ScreenTexts.OFF)); + })) + .setCategory("ghostrunner.title") + ); + + factoryList.add(screen -> + new OptionButtonFactory.Builder() + .setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("ghostrunner.option.toggle_fsg_macro_mode").append(": ").append(SpeedRunOption.getOption(RunnerOptions.TOGGLE_MACRO_FOR_FSG) ? ScreenTexts.ON : ScreenTexts.OFF), button -> { + SpeedRunOption.setOption(RunnerOptions.TOGGLE_MACRO_FOR_FSG, !SpeedRunOption.getOption(RunnerOptions.TOGGLE_MACRO_FOR_FSG)); + button.setMessage(new TranslatableText("ghostrunner.option.toggle_fsg_macro_mode").append(": ").append(SpeedRunOption.getOption(RunnerOptions.TOGGLE_MACRO_FOR_FSG) ? ScreenTexts.ON : ScreenTexts.OFF)); + })) + .setCategory("ghostrunner.title") + ); + + factoryList.add(screen -> + new OptionButtonFactory.Builder() + .setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("ghostrunner.menu.register_api_key"), button -> { + MinecraftClient client = MinecraftClient.getInstance(); + if (client != null) client.openScreen(new APIKeyScreen(bool -> client.openScreen(screen))); + })) + .setCategory("ghostrunner.title") + ); + + factoryList.add(screen -> + new OptionButtonFactory.Builder() + .setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("ghostrunner.menu.info"), button -> { + MinecraftClient client = MinecraftClient.getInstance(); + if (client != null) client.openScreen(new GhostRunnerInfoScreen(screen)); + })) + .setCategory("ghostrunner.title") + ); + + factoryList.add(screen -> + new OptionButtonFactory.Builder() + .setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("options.controls"), button -> { + MinecraftClient client = MinecraftClient.getInstance(); + if (client != null) client.openScreen(new ControlsOptionsScreen(screen, client.options)); + })) + .setCategory("ghostrunner.title") + ); + + return factoryList; + } +} diff --git a/src/main/java/com/redlimerl/ghostrunner/mixin/ClientAdvancementManagerMixin.java b/src/main/java/com/redlimerl/ghostrunner/mixin/ClientAdvancementManagerMixin.java index 6f90d55..2c71775 100644 --- a/src/main/java/com/redlimerl/ghostrunner/mixin/ClientAdvancementManagerMixin.java +++ b/src/main/java/com/redlimerl/ghostrunner/mixin/ClientAdvancementManagerMixin.java @@ -21,7 +21,7 @@ public class ClientAdvancementManagerMixin { @ModifyArgs(method = "onAdvancements", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/toast/AdvancementToast;(Lnet/minecraft/advancement/Advancement;)V")) public void advancement(Args args) { Advancement advancement = args.get(0); - if (InGameTimer.getInstance().getStatus() != TimerStatus.NONE && InGameTimer.getInstance().getStatus() != TimerStatus.COMPLETED) { + if (InGameTimer.getInstance().getStatus() != TimerStatus.NONE && InGameTimer.getInstance().isCompleted()) { if (Objects.equals(advancement.getId(), new Identifier("story/enter_the_nether"))) { if (GhostInfo.INSTANCE.setCheckPoint(Timeline.Moment.ENTER_NETHER)) ReplayGhost.sendBestCheckPointMessage(Timeline.Moment.ENTER_NETHER); diff --git a/src/main/java/com/redlimerl/ghostrunner/mixin/LivingEntityRendererMixin.java b/src/main/java/com/redlimerl/ghostrunner/mixin/LivingEntityRendererMixin.java index ac69f95..5a83af7 100644 --- a/src/main/java/com/redlimerl/ghostrunner/mixin/LivingEntityRendererMixin.java +++ b/src/main/java/com/redlimerl/ghostrunner/mixin/LivingEntityRendererMixin.java @@ -3,6 +3,7 @@ import com.redlimerl.ghostrunner.GhostRunner; import com.redlimerl.ghostrunner.data.RunnerOptions; import com.redlimerl.ghostrunner.entity.GhostEntity; +import com.redlimerl.speedrunigt.option.SpeedRunOption; import com.redlimerl.speedrunigt.option.SpeedRunOptions; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.entity.LivingEntityRenderer; @@ -12,14 +13,13 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -@SuppressWarnings("UnresolvedMixinReference") @Mixin(LivingEntityRenderer.class) public class LivingEntityRendererMixin { @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/model/EntityModel;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;IIFFFF)V")) private void injected(EntityModel entityModel, MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) { if (entityModel instanceof GhostEntity.Model) { - if (SpeedRunOptions.getOption(RunnerOptions.TOGGLE_GHOST) && SpeedRunOptions.getOption(RunnerOptions.GHOST_OPACITY) > 0) { - entityModel.render(matrices, vertices, light, overlay, red, green, blue, SpeedRunOptions.getOption(RunnerOptions.GHOST_OPACITY)); + if (SpeedRunOption.getOption(RunnerOptions.TOGGLE_GHOST) && SpeedRunOption.getOption(RunnerOptions.GHOST_OPACITY) > 0) { + entityModel.render(matrices, vertices, light, overlay, red, green, blue, SpeedRunOption.getOption(RunnerOptions.GHOST_OPACITY)); if (!GhostRunner.IS_USE_GHOST) GhostRunner.IS_USE_GHOST = true; } } else { 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 3ec622e..927e435 100644 --- a/src/main/java/com/redlimerl/ghostrunner/mixin/screen/CreateWorldScreenMixin.java +++ b/src/main/java/com/redlimerl/ghostrunner/mixin/screen/CreateWorldScreenMixin.java @@ -3,8 +3,9 @@ import com.redlimerl.ghostrunner.GhostRunner; import com.redlimerl.ghostrunner.data.RunnerOptions; import com.redlimerl.ghostrunner.gui.screen.GhostSelectScreen; +import com.redlimerl.speedrunigt.option.SpeedRunOption; import com.redlimerl.speedrunigt.option.SpeedRunOptions; -import com.redlimerl.speedrunigt.timer.RunCategory; +import com.redlimerl.speedrunigt.timer.category.RunCategories; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ScreenTexts; @@ -64,7 +65,7 @@ private void initButton(CallbackInfo ci) { @Inject(method = "setMoreOptionsOpen(Z)V", at = @At("HEAD")) private void moreOption(boolean b, CallbackInfo ci) { - if (SpeedRunOptions.getOption(SpeedRunOptions.TIMER_CATEGORY) == RunCategory.ANY) { + if (SpeedRunOption.getOption(SpeedRunOptions.TIMER_CATEGORY) == RunCategories.ANY) { this.fsgButton.visible = b; } this.ghostButton.visible = b && GhostRunner.OPTIONAL_LONG.isPresent(); @@ -78,14 +79,14 @@ 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) { - if (SpeedRunOptions.getOption(SpeedRunOptions.TIMER_CATEGORY) == RunCategory.ANY) + if (SpeedRunOption.getOption(SpeedRunOptions.TIMER_CATEGORY) == RunCategories.ANY) drawStringWithShadow(matrices, this.textRenderer, I18n.translate("ghostrunner.world.is_fsg.description"), this.width / 2 + 5, 172, -6250336); } @Override public boolean changeFocus(boolean lookForwards) { boolean result = super.changeFocus(lookForwards); - while ((!SpeedRunOptions.getOption(RunnerOptions.TOGGLE_MACRO_FOR_FSG) && getFocused() == this.fsgButton) || getFocused() == this.ghostButton) { + while ((!SpeedRunOption.getOption(RunnerOptions.TOGGLE_MACRO_FOR_FSG) && getFocused() == this.fsgButton) || getFocused() == this.ghostButton) { result = super.changeFocus(lookForwards); } return result; diff --git a/src/main/java/com/redlimerl/ghostrunner/record/GhostInfo.java b/src/main/java/com/redlimerl/ghostrunner/record/GhostInfo.java index 77744d0..7196d1c 100644 --- a/src/main/java/com/redlimerl/ghostrunner/record/GhostInfo.java +++ b/src/main/java/com/redlimerl/ghostrunner/record/GhostInfo.java @@ -6,9 +6,11 @@ import com.redlimerl.ghostrunner.record.data.GhostData; import com.redlimerl.ghostrunner.record.data.GhostType; import com.redlimerl.ghostrunner.record.data.Timeline; +import com.redlimerl.speedrunigt.option.SpeedRunOption; import com.redlimerl.speedrunigt.option.SpeedRunOptions; import com.redlimerl.speedrunigt.timer.InGameTimer; -import com.redlimerl.speedrunigt.timer.RunCategory; +import com.redlimerl.speedrunigt.timer.InGameTimerUtils; +import com.redlimerl.speedrunigt.timer.category.RunCategories; import net.minecraft.client.MinecraftClient; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; @@ -33,8 +35,8 @@ public class GhostInfo { InGameTimer.onComplete(igt -> { InGameTimer timer = InGameTimer.getInstance(); MinecraftClient.getInstance().getToastManager().add( - new GenericToast("IGT: "+InGameTimer.timeToStringFormat(timer.getInGameTime()), - "RTA: "+InGameTimer.timeToStringFormat(timer.getRealTimeAttack()), new ItemStack(Items.DRAGON_EGG)) + new GenericToast("IGT: "+InGameTimerUtils.timeToStringFormat(timer.getInGameTime()), + "RTA: "+InGameTimerUtils.timeToStringFormat(timer.getRealTimeAttack()), new ItemStack(Items.DRAGON_EGG)) ); MinecraftClient.getInstance().getToastManager().add( new GenericToast("Category : " + timer.getCategory().getText().getString(), @@ -103,7 +105,7 @@ public String toDataString() { public void setup(GeneratorOptions generatorOptions) { this.clear(); currentGhostType = GhostRunner.OPTIONAL_LONG.isPresent() - ? (GhostRunner.IS_FSG && SpeedRunOptions.getOption(SpeedRunOptions.TIMER_CATEGORY) == RunCategory.ANY ? GhostType.FILTERED_SEED : GhostType.SET_SEED) + ? (GhostRunner.IS_FSG && SpeedRunOption.getOption(SpeedRunOptions.TIMER_CATEGORY) == RunCategories.ANY ? GhostType.FILTERED_SEED : GhostType.SET_SEED) : GhostType.RANDOM_SEED; ghostData = GhostData.create(generatorOptions, currentGhostType, GhostRunner.IS_HARDCORE); diff --git a/src/main/java/com/redlimerl/ghostrunner/record/ReplayGhost.java b/src/main/java/com/redlimerl/ghostrunner/record/ReplayGhost.java index 3267198..f1d67f3 100644 --- a/src/main/java/com/redlimerl/ghostrunner/record/ReplayGhost.java +++ b/src/main/java/com/redlimerl/ghostrunner/record/ReplayGhost.java @@ -5,8 +5,10 @@ import com.redlimerl.ghostrunner.entity.GhostEntity; import com.redlimerl.ghostrunner.record.data.Timeline; import com.redlimerl.ghostrunner.util.Utils; +import com.redlimerl.speedrunigt.option.SpeedRunOption; import com.redlimerl.speedrunigt.option.SpeedRunOptions; import com.redlimerl.speedrunigt.timer.InGameTimer; +import com.redlimerl.speedrunigt.timer.InGameTimerUtils; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.util.DefaultSkinHelper; @@ -57,7 +59,7 @@ public static void removeInSelectedGhosts(Long seed, UUID... uuids) { //체크 포인트 메세지 public static void sendBestCheckPointMessage(Timeline.Moment moment) { - if (!SpeedRunOptions.getOption(RunnerOptions.TOGGLE_CHECKPOINT_MESSAGE)) return; + if (!SpeedRunOption.getOption(RunnerOptions.TOGGLE_CHECKPOINT_MESSAGE)) return; long bestTime = 0; for (ReplayGhost replayGhost : ghostList) { @@ -74,15 +76,15 @@ public static void sendBestCheckPointMessage(Timeline.Moment moment) { if (bestTime == 0) { player.sendMessage( new TranslatableText("ghostrunner.message.checkpoint_new") - .append(new LiteralText(" [" + InGameTimer.timeToStringFormat(nowTime) + "]") + .append(new LiteralText(" [" + InGameTimerUtils.timeToStringFormat(nowTime) + "]") .formatted(Formatting.YELLOW)), false ); } else { boolean isFast = bestTime > nowTime; player.sendMessage( new TranslatableText("ghostrunner.message.checkpoint_" + (isFast ? "faster" : "slower") + "_than_ghost") - .append(new LiteralText(" [" + InGameTimer.timeToStringFormat(nowTime)).formatted(Formatting.YELLOW)) - .append(new LiteralText(" (" + (isFast ? "-" : "+") + " " + (InGameTimer.timeToStringFormat(Math.abs(nowTime - bestTime))) + ")") + .append(new LiteralText(" [" + InGameTimerUtils.timeToStringFormat(nowTime)).formatted(Formatting.YELLOW)) + .append(new LiteralText(" (" + (isFast ? "-" : "+") + " " + (InGameTimerUtils.timeToStringFormat(Math.abs(nowTime - bestTime))) + ")") .formatted(isFast ? Formatting.GREEN : Formatting.RED)) .append(new LiteralText("]").formatted(Formatting.YELLOW)), false); } diff --git a/src/main/java/com/redlimerl/ghostrunner/record/data/GhostData.java b/src/main/java/com/redlimerl/ghostrunner/record/data/GhostData.java index 2da22b8..23b5b2f 100644 --- a/src/main/java/com/redlimerl/ghostrunner/record/data/GhostData.java +++ b/src/main/java/com/redlimerl/ghostrunner/record/data/GhostData.java @@ -2,7 +2,9 @@ import com.redlimerl.ghostrunner.util.Utils; import com.redlimerl.speedrunigt.timer.InGameTimer; -import com.redlimerl.speedrunigt.timer.RunCategory; +import com.redlimerl.speedrunigt.timer.InGameTimerUtils; +import com.redlimerl.speedrunigt.timer.category.RunCategories; +import com.redlimerl.speedrunigt.timer.category.RunCategory; import net.minecraft.client.MinecraftClient; import net.minecraft.world.Difficulty; import net.minecraft.world.gen.GeneratorOptions; @@ -83,7 +85,7 @@ public static GhostData create(GeneratorOptions generatorOptions, GhostType ghos false, Difficulty.EASY.getName(), "", - RunCategory.ANY.name(), + InGameTimer.getInstance().getCategory().getID(), generatorOptions.shouldGenerateStructures(), true ); @@ -207,7 +209,7 @@ public String getKey() { } public String getDefaultName() { - return seed + "_" + InGameTimer.timeToStringFormat(inGameTime).replace(':', '.') + "_" + DATE_FORMAT.format(getCreatedDate()); + return seed + "_" + InGameTimerUtils.timeToStringFormat(inGameTime).replace(':', '.') + "_" + DATE_FORMAT.format(getCreatedDate()); } public Path getPath() { @@ -223,11 +225,11 @@ public void setDifficulty(Difficulty difficulty) { } public void setGhostCategory(RunCategory ghostCategory) { - this.ghostCategory = ghostCategory.name(); + this.ghostCategory = ghostCategory.getID(); } public RunCategory getGhostCategory() { - return RunCategory.valueOf(ghostCategory); + return RunCategory.getCategory(ghostCategory); } public boolean isUseF3() { diff --git a/src/main/java/com/redlimerl/ghostrunner/record/data/Timeline.java b/src/main/java/com/redlimerl/ghostrunner/record/data/Timeline.java index b785fc6..285042e 100644 --- a/src/main/java/com/redlimerl/ghostrunner/record/data/Timeline.java +++ b/src/main/java/com/redlimerl/ghostrunner/record/data/Timeline.java @@ -9,6 +9,7 @@ public enum Moment { public Timeline() {} public Timeline(String data) { + if (data.isEmpty()) return; for (String s : data.split("\n")) { String[] d = s.split(":"); timeline.put(Moment.valueOf(d[0]), Long.parseLong(d[1])); diff --git a/src/main/java/com/redlimerl/ghostrunner/util/Utils.java b/src/main/java/com/redlimerl/ghostrunner/util/Utils.java index 2c52cf1..c01e9ef 100644 --- a/src/main/java/com/redlimerl/ghostrunner/util/Utils.java +++ b/src/main/java/com/redlimerl/ghostrunner/util/Utils.java @@ -7,6 +7,7 @@ import com.redlimerl.ghostrunner.data.RunnerOptions; import com.redlimerl.ghostrunner.data.UpdateStatus; import com.redlimerl.ghostrunner.record.ReplayGhost; +import com.redlimerl.speedrunigt.option.SpeedRunOption; import com.redlimerl.speedrunigt.option.SpeedRunOptions; import net.minecraft.client.MinecraftClient; import net.minecraft.client.texture.PlayerSkinProvider; @@ -20,7 +21,7 @@ public class Utils { public static int getUpdateButtonOffset() { - return GhostRunner.UPDATE_STATUS.getStatus() == UpdateStatus.Status.OUTDATED && SpeedRunOptions.getOption(RunnerOptions.UPDATE_NOTIFICATION) ? 20 : 0; + return GhostRunner.UPDATE_STATUS.getStatus() == UpdateStatus.Status.OUTDATED && SpeedRunOption.getOption(RunnerOptions.UPDATE_NOTIFICATION) ? 20 : 0; } public static UUID UUIDFromString(String string) { diff --git a/src/main/java/com/redlimerl/ghostrunner/util/submit/SubmitData.java b/src/main/java/com/redlimerl/ghostrunner/util/submit/SubmitData.java index d99f8af..8ed2e26 100644 --- a/src/main/java/com/redlimerl/ghostrunner/util/submit/SubmitData.java +++ b/src/main/java/com/redlimerl/ghostrunner/util/submit/SubmitData.java @@ -7,8 +7,9 @@ import com.redlimerl.ghostrunner.record.data.GhostType; import com.redlimerl.ghostrunner.util.Utils; import com.redlimerl.ghostrunner.util.submit.category.*; +import com.redlimerl.speedrunigt.option.SpeedRunOption; import com.redlimerl.speedrunigt.option.SpeedRunOptions; -import com.redlimerl.speedrunigt.timer.RunCategory; +import com.redlimerl.speedrunigt.timer.category.RunCategories; import java.io.IOException; import java.io.InputStreamReader; @@ -24,51 +25,51 @@ public abstract class SubmitData { private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); public static SubmitData create(GhostData ghostData, String description, String videoUrl, boolean isGlitchRun) { - if (ghostData.getGhostCategory() == RunCategory.ANY) { + if (ghostData.getGhostCategory() == RunCategories.ANY) { if (ghostData.getType() == GhostType.FILTERED_SEED) return new FilteredSeedSubmit(ghostData, description, videoUrl, isGlitchRun); else return new AnyPercentSubmit(ghostData, description, videoUrl, isGlitchRun); } - if (ghostData.getGhostCategory() == RunCategory.ALL_ADVANCEMENTS) { + if (ghostData.getGhostCategory() == RunCategories.ALL_ADVANCEMENTS) { return new AllAdvancementSubmit(ghostData, description, videoUrl, isGlitchRun); } - if (ghostData.getGhostCategory() == RunCategory.HIGH) { + if (ghostData.getGhostCategory() == RunCategories.HIGH) { return new HighPercentSubmit(ghostData, description, videoUrl, isGlitchRun); } - if (ghostData.getGhostCategory() == RunCategory.KILL_ALL_BOSSES || ghostData.getGhostCategory() == RunCategory.KILL_WITHER || ghostData.getGhostCategory() == RunCategory.KILL_ELDER_GUARDIAN) { + if (ghostData.getGhostCategory() == RunCategories.KILL_ALL_BOSSES || ghostData.getGhostCategory() == RunCategories.KILL_WITHER || ghostData.getGhostCategory() == RunCategories.KILL_ELDER_GUARDIAN) { return new KillBossesSubmit(ghostData, description, videoUrl, isGlitchRun); } - if (ghostData.getGhostCategory() == RunCategory.HOW_DID_WE_GET_HERE) { + if (ghostData.getGhostCategory() == RunCategories.HOW_DID_WE_GET_HERE) { return new HDWGHereSubmit(ghostData, description, videoUrl, isGlitchRun); } - if (ghostData.getGhostCategory() == RunCategory.HERO_OF_VILLAGE) { + if (ghostData.getGhostCategory() == RunCategories.HERO_OF_VILLAGE) { return new HeroVillageSubmit(ghostData, description, videoUrl, isGlitchRun); } - if (ghostData.getGhostCategory() == RunCategory.ARBALISTIC) { + if (ghostData.getGhostCategory() == RunCategories.ARBALISTIC) { return new ArbalisticSubmit(ghostData, description, videoUrl, isGlitchRun); } - if (ghostData.getGhostCategory() == RunCategory.ENTER_NETHER) { + if (ghostData.getGhostCategory() == RunCategories.ENTER_NETHER) { return new EnterNetherSubmit(ghostData, description, videoUrl, isGlitchRun); } - if (ghostData.getGhostCategory() == RunCategory.ALL_SWORDS) { + if (ghostData.getGhostCategory() == RunCategories.ALL_SWORDS) { return new AllSwordsSubmit(ghostData, description, videoUrl, isGlitchRun); } - if (ghostData.getGhostCategory() == RunCategory.ALL_MINERALS) { + if (ghostData.getGhostCategory() == RunCategories.ALL_MINERALS) { return new AllMineralsSubmit(ghostData, description, videoUrl, isGlitchRun); } - if (ghostData.getGhostCategory() == RunCategory.FULL_IA_15_LVL) { + if (ghostData.getGhostCategory() == RunCategories.FULL_IA_15_LVL) { return new FullIA15LevelsSubmit(ghostData, description, videoUrl, isGlitchRun); } - if (ghostData.getGhostCategory() == RunCategory.ALL_WORKSTATIONS) { + if (ghostData.getGhostCategory() == RunCategories.ALL_WORKSTATIONS) { return new AllWorkstationsSubmit(ghostData, description, videoUrl, isGlitchRun); } - if (ghostData.getGhostCategory() == RunCategory.FULL_INV) { + if (ghostData.getGhostCategory() == RunCategories.FULL_INV) { return new FullInventorySubmit(ghostData, description, videoUrl, isGlitchRun); } - if (ghostData.getGhostCategory() == RunCategory.ENTER_END) { + if (ghostData.getGhostCategory() == RunCategories.ENTER_END) { return new EnterEndSubmit(ghostData, description, videoUrl, isGlitchRun); } - if (ghostData.getGhostCategory() == RunCategory.HALF) { + if (ghostData.getGhostCategory() == RunCategories.HALF) { return new HalfPercentSubmit(ghostData, description, videoUrl, isGlitchRun); } return null; @@ -154,7 +155,7 @@ public void updateVariable(SubmitVariable variable) { } public String submit() throws IOException, IllegalStateException, ClassCastException { - String authKey = SpeedRunOptions.getOption(RunnerOptions.SPEEDRUN_COM_API_KEY); + String authKey = SpeedRunOption.getOption(RunnerOptions.SPEEDRUN_COM_API_KEY); URL u = new URL("https://www.speedrun.com/api/v1/runs"); HttpURLConnection c = (HttpURLConnection) u.openConnection(); diff --git a/src/main/java/com/redlimerl/ghostrunner/util/submit/category/KillBossesSubmit.java b/src/main/java/com/redlimerl/ghostrunner/util/submit/category/KillBossesSubmit.java index 8553eca..318dcd5 100644 --- a/src/main/java/com/redlimerl/ghostrunner/util/submit/category/KillBossesSubmit.java +++ b/src/main/java/com/redlimerl/ghostrunner/util/submit/category/KillBossesSubmit.java @@ -3,7 +3,7 @@ import com.redlimerl.ghostrunner.record.data.GhostData; import com.redlimerl.ghostrunner.record.data.GhostType; import com.redlimerl.ghostrunner.util.submit.SubmitVariable; -import com.redlimerl.speedrunigt.timer.RunCategory; +import com.redlimerl.speedrunigt.timer.category.RunCategories; public class KillBossesSubmit extends ExtensionCategorySubmit { @@ -12,9 +12,9 @@ public KillBossesSubmit(GhostData ghostData, String description, String videoUrl //Boss this.updateVariable(new SubmitVariable("dlo31yel", - ghostData.getGhostCategory() == RunCategory.KILL_ALL_BOSSES ? "9qjx48gl" - : ghostData.getGhostCategory() == RunCategory.KILL_WITHER ? "mlnz0odl" - : ghostData.getGhostCategory() == RunCategory.KILL_ELDER_GUARDIAN ? "810wmd5q" : "")); + ghostData.getGhostCategory() == RunCategories.KILL_ALL_BOSSES ? "9qjx48gl" + : ghostData.getGhostCategory() == RunCategories.KILL_WITHER ? "mlnz0odl" + : ghostData.getGhostCategory() == RunCategories.KILL_ELDER_GUARDIAN ? "810wmd5q" : "")); //SS/RS/SSG/RSG if (isGlitchRun()) { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index fcb19be..ce80225 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -19,6 +19,9 @@ "entrypoints": { "client": [ "com.redlimerl.ghostrunner.GhostRunner" + ], + "speedrunigt": [ + "com.redlimerl.ghostrunner.impl.speedrunigt.OptionButtonsImpl" ] }, "mixins": [