aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKevin <92656833+kevinthegreat1@users.noreply.github.com>2024-01-11 04:24:01 +0800
committerGitHub <noreply@github.com>2024-01-10 15:24:01 -0500
commit2d7127c3e486785b9f087e97a567de8ee5780650 (patch)
tree8980fcbc1011167df1d38352fe0a3fd707881c6c /src
parentdb778f5f2b92c9697c9df38a8e056392c70252ed (diff)
downloadSkyblocker-2d7127c3e486785b9f087e97a567de8ee5780650.tar.gz
Skyblocker-2d7127c3e486785b9f087e97a567de8ee5780650.tar.bz2
Skyblocker-2d7127c3e486785b9f087e97a567de8ee5780650.zip
Add tips (#481)
* Add tips * Add some tips
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/hysky/skyblocker/SkyblockerMod.java1
-rw-r--r--src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java3
-rw-r--r--src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java7
-rw-r--r--src/main/java/de/hysky/skyblocker/events/DungeonEvents.java1
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/Tips.java103
-rw-r--r--src/main/resources/assets/skyblocker/lang/en_us.json26
6 files changed, 140 insertions, 1 deletions
diff --git a/src/main/java/de/hysky/skyblocker/SkyblockerMod.java b/src/main/java/de/hysky/skyblocker/SkyblockerMod.java
index 75dbdcce..f2359265 100644
--- a/src/main/java/de/hysky/skyblocker/SkyblockerMod.java
+++ b/src/main/java/de/hysky/skyblocker/SkyblockerMod.java
@@ -81,6 +81,7 @@ public class SkyblockerMod implements ClientModInitializer {
ClientTickEvents.END_CLIENT_TICK.register(this::tick);
Utils.init();
SkyblockerConfigManager.init();
+ Tips.init();
NEURepoManager.init();
ItemRepository.init();
HotbarSlotLock.init();
diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java
index a2c82215..f8eb4e55 100644
--- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java
+++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java
@@ -150,6 +150,9 @@ public class SkyblockerConfig {
public static class General {
@SerialEntry
+ public boolean enableTips = true;
+
+ @SerialEntry
public boolean acceptReparty = true;
@SerialEntry
diff --git a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java
index 4d962b88..3b9cbe60 100644
--- a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java
+++ b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java
@@ -21,6 +21,13 @@ public class GeneralCategory {
//Ungrouped Options
.option(Option.<Boolean>createBuilder()
+ .name(Text.translatable("text.autoconfig.skyblocker.option.general.enableTips"))
+ .binding(defaults.general.enableTips,
+ () -> config.general.enableTips,
+ newValue -> config.general.enableTips = newValue)
+ .controller(ConfigUtils::createBooleanController)
+ .build())
+ .option(Option.<Boolean>createBuilder()
.name(Text.translatable("text.autoconfig.skyblocker.option.general.acceptReparty"))
.binding(defaults.general.acceptReparty,
() -> config.general.acceptReparty,
diff --git a/src/main/java/de/hysky/skyblocker/events/DungeonEvents.java b/src/main/java/de/hysky/skyblocker/events/DungeonEvents.java
index bf7ba2b2..9efa3607 100644
--- a/src/main/java/de/hysky/skyblocker/events/DungeonEvents.java
+++ b/src/main/java/de/hysky/skyblocker/events/DungeonEvents.java
@@ -7,7 +7,6 @@ import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
public class DungeonEvents {
- // TODO Some rooms such as creeper beam and water board does not get matched
public static final Event<RoomMatched> PUZZLE_MATCHED = EventFactory.createArrayBacked(RoomMatched.class, callbacks -> room -> {
for (RoomMatched callback : callbacks) {
callback.onRoomMatched(room);
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/Tips.java b/src/main/java/de/hysky/skyblocker/skyblock/Tips.java
new file mode 100644
index 00000000..0d3c2a37
--- /dev/null
+++ b/src/main/java/de/hysky/skyblocker/skyblock/Tips.java
@@ -0,0 +1,103 @@
+package de.hysky.skyblocker.skyblock;
+
+import com.mojang.brigadier.Command;
+import com.mojang.brigadier.CommandDispatcher;
+import com.mojang.brigadier.context.CommandContext;
+import de.hysky.skyblocker.SkyblockerMod;
+import de.hysky.skyblocker.config.SkyblockerConfigManager;
+import de.hysky.skyblocker.events.SkyblockEvents;
+import de.hysky.skyblocker.utils.Constants;
+import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
+import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.command.CommandRegistryAccess;
+import net.minecraft.text.ClickEvent;
+import net.minecraft.text.Text;
+
+import java.util.List;
+import java.util.Random;
+import java.util.function.Supplier;
+
+import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;
+
+public class Tips {
+ private static final Random RANDOM = new Random();
+ private static final List<Supplier<Text>> TIPS = List.of(
+ getTipFactory("skyblocker.tips.customItemNames", ClickEvent.Action.SUGGEST_COMMAND, "/skyblocker custom renameItem"),
+ getTipFactory("skyblocker.tips.customArmorDyeColors", ClickEvent.Action.SUGGEST_COMMAND, "/skyblocker custom dyeColor"),
+ getTipFactory("skyblocker.tips.customArmorTrims", ClickEvent.Action.SUGGEST_COMMAND, "/skyblocker custom armorTrim"),
+ getTipFactory("skyblocker.tips.fancyTabExtraInfo"),
+ getTipFactory("skyblocker.tips.helpCommand", ClickEvent.Action.SUGGEST_COMMAND, "/skyblocker help"),
+ getTipFactory("skyblocker.tips.discordRichPresence", ClickEvent.Action.SUGGEST_COMMAND, "/skyblocker config"),
+ getTipFactory("skyblocker.tips.customDungeonSecretWaypoints", ClickEvent.Action.SUGGEST_COMMAND, "/skyblocker dungeons secrets addWaypoint"),
+ getTipFactory("skyblocker.tips.shortcuts", ClickEvent.Action.SUGGEST_COMMAND, "/skyblocker shortcuts"),
+ getTipFactory("skyblocker.tips.gallery", ClickEvent.Action.OPEN_URL, "https://hysky.de/skyblocker/gallery"),
+ getTipFactory("skyblocker.tips.itemRarityBackground", ClickEvent.Action.SUGGEST_COMMAND, "/skyblocker config"),
+ getTipFactory("skyblocker.tips.modMenuUpdate"),
+ getTipFactory("skyblocker.tips.issues", ClickEvent.Action.OPEN_URL, "https://github.com/SkyblockerMod/Skyblocker"),
+ getTipFactory("skyblocker.tips.beta", ClickEvent.Action.OPEN_URL, "https://github.com/SkyblockerMod/Skyblocker/actions"),
+ getTipFactory("skyblocker.tips.discord", ClickEvent.Action.OPEN_URL, "https://discord.gg/aNNJHQykck"),
+ getTipFactory("skyblocker.tips.flameOverlay", ClickEvent.Action.SUGGEST_COMMAND, "/skyblocker config"),
+ getTipFactory("skyblocker.tips.wikiLookup", ClickEvent.Action.SUGGEST_COMMAND, "/skyblocker config"),
+ getTipFactory("skyblocker.tips.fairySoulsEnigmaSoulsRelics", ClickEvent.Action.SUGGEST_COMMAND, "/skyblocker fairySouls"),
+ getTipFactory("skyblocker.tips.quickNav", ClickEvent.Action.SUGGEST_COMMAND, "/skyblocker config")
+ );
+
+ private static Supplier<Text> getTipFactory(String key) {
+ return () -> Text.translatable(key);
+ }
+
+ private static Supplier<Text> getTipFactory(String key, ClickEvent.Action clickAction, String value) {
+ return () -> Text.translatable(key).styled(style -> style.withClickEvent(new ClickEvent(clickAction, value)));
+ }
+
+ public static void init() {
+ ClientCommandRegistrationCallback.EVENT.register(Tips::registerTipsCommand);
+ SkyblockEvents.JOIN.register(Tips::sendNextTip);
+ }
+
+ private static void registerTipsCommand(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
+ dispatcher.register(literal(SkyblockerMod.NAMESPACE).then(literal("tips")
+ .then(literal("enable").executes(Tips::enableTips))
+ .then(literal("disable").executes(Tips::disableTips))
+ .then(literal("next").executes(Tips::nextTip))
+ ));
+ }
+
+ private static void sendNextTip() {
+ MinecraftClient client = MinecraftClient.getInstance();
+ if (client.player != null && SkyblockerConfigManager.get().general.enableTips) {
+ client.player.sendMessage(nextTip(), false);
+ }
+ }
+
+ private static int enableTips(CommandContext<FabricClientCommandSource> context) {
+ SkyblockerConfigManager.get().general.enableTips = true;
+ SkyblockerConfigManager.save();
+ context.getSource().sendFeedback(Constants.PREFIX.get().append(Text.translatable("skyblocker.tips.enabled")).append(" ").append(Text.translatable("skyblocker.tips.clickDisable").styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/skyblocker tips disable")))));
+ return Command.SINGLE_SUCCESS;
+ }
+
+ private static int disableTips(CommandContext<FabricClientCommandSource> context) {
+ SkyblockerConfigManager.get().general.enableTips = false;
+ SkyblockerConfigManager.save();
+ context.getSource().sendFeedback(Constants.PREFIX.get().append(Text.translatable("skyblocker.tips.disabled")).append(" ").append(Text.translatable("skyblocker.tips.clickEnable").styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/skyblocker tips enable")))));
+ return Command.SINGLE_SUCCESS;
+ }
+
+ private static int nextTip(CommandContext<FabricClientCommandSource> context) {
+ context.getSource().sendFeedback(nextTip());
+ return Command.SINGLE_SUCCESS;
+ }
+
+ private static Text nextTip() {
+ return Constants.PREFIX.get().append(Text.translatable("skyblocker.tips.tip", nextTipInternal()))
+ .append(Text.translatable("skyblocker.tips.clickNextTip").styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/skyblocker tips next"))))
+ .append(" ")
+ .append(Text.translatable("skyblocker.tips.clickDisable").styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/skyblocker tips disable"))));
+ }
+
+ private static Text nextTipInternal() {
+ return TIPS.get(RANDOM.nextInt(TIPS.size())).get();
+ }
+}
diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json
index e2d092fb..a1475770 100644
--- a/src/main/resources/assets/skyblocker/lang/en_us.json
+++ b/src/main/resources/assets/skyblocker/lang/en_us.json
@@ -14,6 +14,7 @@
"text.autoconfig.skyblocker.title": "Skyblocker Settings",
"text.autoconfig.skyblocker.category.general": "General",
+ "text.autoconfig.skyblocker.option.general.enableTips": "Enable Tips",
"text.autoconfig.skyblocker.option.general.bars": "Health, Mana, Defence & XP Bars",
"text.autoconfig.skyblocker.option.general.bars.enableBars": "Enable Bars",
"text.autoconfig.skyblocker.option.general.bars.barpositions": "Configure Bar Positions",
@@ -388,5 +389,30 @@
"skyblocker.itemProtection.noItemUuid": "§cYou must be holding an item that has a uuid in order to protect it!",
"skyblocker.itemProtection.unableToProtect": "§cUnable to protect this item :( (Are you in skyblock?, are you holding an item?)",
+ "skyblocker.tips.enabled": "§aEnabled Tips.",
+ "skyblocker.tips.disabled": "§cDisabled Tips.",
+ "skyblocker.tips.clickEnable": "§a[Click to Enable Tips]",
+ "skyblocker.tips.clickDisable": "§c[Click to Disable Tips]",
+ "skyblocker.tips.clickNextTip": "§a[Click for Next Tip]",
+ "skyblocker.tips.tip": "§aTip: %s\n",
+ "skyblocker.tips.customItemNames": "Customize the names of your items with /skyblocker custom renameItem",
+ "skyblocker.tips.customArmorDyeColors": "Apply a custom dye color to your leather armour with /skyblocker custom dyeColor",
+ "skyblocker.tips.customArmorTrims": "You can set custom armor trims on your armor using /skyblocker custom armorTrim.",
+ "skyblocker.tips.fancyTabExtraInfo": "Did you know you can see extra info on our fancy tab menu when holding N or M?\n",
+ "skyblocker.tips.helpCommand": "Use command /skyblocker help and you might find some more nifty features!",
+ "skyblocker.tips.discordRichPresence": "Use Discord Rich Presence to show your friends how loaded you are!",
+ "skyblocker.tips.customDungeonSecretWaypoints": "You can add custom secret waypoints to any dungeon room with /skyblocker dungeons secrets addWaypoint.",
+ "skyblocker.tips.shortcuts": "Use /skyblocker shortcuts to create and edit command and message shortcuts.",
+ "skyblocker.tips.gallery": "Check out https://hysky.de/skyblocker/gallery for pictures of the mod's features in action!",
+ "skyblocker.tips.itemRarityBackground": "See an item's rarity easily with Item Rarity Backgrounds in the config's Item Info Display section.",
+ "skyblocker.tips.modMenuUpdate": "ModMenu will let you know if there's an update available for Skyblocker for your game version.",
+ "skyblocker.tips.issues": "Submit bug reports and feature requests to https://github.com/SkyblockerMod/Skyblocker.",
+ "skyblocker.tips.beta": "We often have beta versions available from GitHub Actions that contain new and experimental features.",
+ "skyblocker.tips.discord": "Join our discord at https://discord.gg/aNNJHQykck to keep up with the latest news about Skyblocker!",
+ "skyblocker.tips.flameOverlay": "Find that the flame overlay takes up too much screen space? Check out the config to make it smaller",
+ "skyblocker.tips.wikiLookup": "Press F4 while hovering over an item to open its wiki page in your web browser.",
+ "skyblocker.tips.fairySoulsEnigmaSoulsRelics": "Don't know where to find Fairy Souls, Enigma Souls, or Relics? Enable the helpers to aid your exploration, they'll remember which souls you've already found.",
+ "skyblocker.tips.quickNav": "You can customize the QuickNav buttons in the config.",
+
"emi.category.skyblocker.skyblock": "Skyblock"
} \ No newline at end of file