Skip to content

Commit

Permalink
Add shortcuts config
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinthegreat1 committed Dec 31, 2023
1 parent 3d278d7 commit d9ae50c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ Helpful features for Hypixel Skyblock ([Fabric](https://fabricmc.net/) 1.17+)
- /sbm reparty: show current state (on or off)
- /sbm reparty [true|false]: turn reparty on or off

### Shortcuts Commands

- /sbm shortcuts: show current state (on or off)
- /sbm shortcuts [true|false]: turn shortcuts on or off

### Visit

- /v [Player] -> /visit [Player]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.kevinthegreat.skyblockmod.mixins;

import com.kevinthegreat.skyblockmod.SkyblockMod;
import com.kevinthegreat.skyblockmod.option.SkyblockModOptions;
import net.minecraft.client.gui.screen.ChatScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -16,7 +17,7 @@ public abstract class ChatScreenMixin {
),
at = @At(value = "LOAD", ordinal = 0), argsOnly = true)
private String skyblockmod_modifyMessage(String message) {
if (message.startsWith("/")) {
if (SkyblockMod.skyblockMod.options.shortcuts.getValue() && message.startsWith("/")) {
message = SkyblockMod.skyblockMod.message.commands.getOrDefault(message, message);
String[] messageArgs = message.split(" ");
for (int i = 0; i < messageArgs.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ public class SkyblockModOptions {
public final SimpleOption<Boolean> mythologicalRitual = SimpleOption.ofBoolean("skyblockmod:mythologicalRitual", true);
public final SimpleOption<Boolean> quiver = SimpleOption.ofBoolean("skyblockmod:quiver", true);
public final SimpleOption<Boolean> reparty = SimpleOption.ofBoolean("skyblockmod:reparty", true);
public final SimpleOption<Boolean> shortcuts = SimpleOption.ofBoolean("skyblockmod:shortcuts", true);
@SuppressWarnings("SuspiciousNameCombination")
public final List<List<Pair<String, SimpleOption<?>>>> optionsList = List.of(List.of(new Pair<>("dungeonMap", dungeonMap), new Pair<>("dungeonMap.scale", dungeonMapScale), new Pair<>("dungeonMap.offset.x", dungeonMapX), new Pair<>("dungeonMap.offset.y", dungeonMapY), new Pair<>("dungeonScore.270", dungeonScore270), new Pair<>("dungeonScore.270.text", dungeonScore270Text), new Pair<>("dungeonScore.300", dungeonScore300), new Pair<>("dungeonScore.300.text", dungeonScore300Text), new Pair<>("experiments.chronomatron", experimentChronomatron), new Pair<>("experiments.superpairs", experimentSuperpairs), new Pair<>("experiments.ultrasequencer", experimentUltrasequencer), new Pair<>("fairySouls", fairySouls), new Pair<>("fishing", fishing), new Pair<>("lividColor", lividColor), new Pair<>("lividColor.text", lividColorText), new Pair<>("mythologicalRitual", mythologicalRitual), new Pair<>("quiver", quiver), new Pair<>("reparty", reparty)));
public final List<List<Pair<String, SimpleOption<?>>>> optionsList = List.of(List.of(new Pair<>("dungeonMap", dungeonMap), new Pair<>("dungeonMap.scale", dungeonMapScale), new Pair<>("dungeonMap.offset.x", dungeonMapX), new Pair<>("dungeonMap.offset.y", dungeonMapY), new Pair<>("dungeonScore.270", dungeonScore270), new Pair<>("dungeonScore.270.text", dungeonScore270Text), new Pair<>("dungeonScore.300", dungeonScore300), new Pair<>("dungeonScore.300.text", dungeonScore300Text), new Pair<>("experiments.chronomatron", experimentChronomatron), new Pair<>("experiments.superpairs", experimentSuperpairs), new Pair<>("experiments.ultrasequencer", experimentUltrasequencer), new Pair<>("fairySouls", fairySouls), new Pair<>("fishing", fishing), new Pair<>("lividColor", lividColor), new Pair<>("lividColor.text", lividColorText), new Pair<>("mythologicalRitual", mythologicalRitual), new Pair<>("quiver", quiver), new Pair<>("reparty", reparty), new Pair<>("shortcuts", shortcuts)));

public static Text getGenericValueText(Text prefix, double value) {
return GameOptions.getGenericValueText(prefix, Text.literal(String.format("%.2f", value)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ protected void init() {
addOptionButton(options.fishing);
addOptionButton(options.mythologicalRitual);
addOptionButton(options.quiver);
addOptionButton(options.shortcuts);
addGridWidget();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,15 @@ public void registerCommands(CommandDispatcher<FabricClientCommandSource> dispat
options.reparty.setValue(BoolArgumentType.getBool(context, "value"));
context.getSource().sendFeedback(Text.translatable("skyblockmod:reparty").append(turnOnOrOff(options.reparty.getValue())));
return 1;
})))
.then(literal("shortcuts").executes(context -> {
context.getSource().sendFeedback(Text.translatable("skyblockmod:shortcuts").append(queryOnOrOff(options.shortcuts.getValue())));
return 1;
})
.then(argument("value", BoolArgumentType.bool()).executes(context -> {
options.shortcuts.setValue(BoolArgumentType.getBool(context, "value"));
context.getSource().sendFeedback(Text.translatable("skyblockmod:shortcuts").append(turnOnOrOff(options.shortcuts.getValue())));
return 1;
}))));
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/assets/skyblockmod/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@
"skyblockmod:quiver.10Left": "You only have 10 Arrows left in your Quiver!",
"skyblockmod:quiver.empty": "You don't have any more Arrows left in your Quiver!",
"skyblockmod:reparty": "Reparty",
"skyblockmod:reparty.repartying": "Repartying..."
"skyblockmod:reparty.repartying": "Repartying...",
"skyblockmod:shortcuts": "Shortcuts"
}

0 comments on commit d9ae50c

Please sign in to comment.