Skip to content

Commit

Permalink
Merge pull request #451 from AzureAaron/extended-character-limit
Browse files Browse the repository at this point in the history
Increase shortcuts character limit & Reset griffin burrows on world change
  • Loading branch information
Aaron committed Dec 15, 2023
2 parents 8a763c8 + 1801371 commit aaa011f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ private ShortcutEntry(ShortcutCategoryEntry category, String targetString) {
this.category = category;
target = new TextFieldWidget(MinecraftClient.getInstance().textRenderer, width / 2 - 160, 5, 150, 20, category.targetName);
replacement = new TextFieldWidget(MinecraftClient.getInstance().textRenderer, width / 2 + 10, 5, 150, 20, category.replacementName);
target.setMaxLength(48);
replacement.setMaxLength(48);
target.setText(targetString);
replacement.setText(category.shortcutsMap.getOrDefault(targetString, ""));
children = List.of(target, replacement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import de.hysky.skyblocker.utils.waypoint.Waypoint;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
import net.fabricmc.fabric.api.event.player.AttackBlockCallback;
Expand Down Expand Up @@ -58,9 +59,10 @@ public static void init() {
UseBlockCallback.EVENT.register(MythologicalRitual::onUseBlock);
UseItemCallback.EVENT.register(MythologicalRitual::onUseItem);
ClientReceiveMessageEvents.GAME.register(MythologicalRitual::onChatMessage);
ClientPlayConnectionEvents.JOIN.register((handler, sender, client) -> reset());
ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> dispatcher.register(literal(SkyblockerMod.NAMESPACE).then(literal("diana")
.then(literal("clearGriffinBurrows").executes(context -> {
griffinBurrows.clear();
reset();
return Command.SINGLE_SUCCESS;
}))
.then(literal("clearGriffinBurrow")
Expand Down Expand Up @@ -189,6 +191,16 @@ public static void onChatMessage(Text message, boolean overlay) {
private static boolean isActive() {
return SkyblockerConfigManager.get().general.mythologicalRitual.enableMythologicalRitualHelper && Utils.getLocationRaw().equals("hub");
}

private static void reset() {
griffinBurrows.clear();
lastDugBurrowPos = null;
previousBurrow = new GriffinBurrow(BlockPos.ORIGIN);

// Put a root burrow so echo detection works without a previous burrow
previousBurrow.confirmed = TriState.DEFAULT;
griffinBurrows.put(BlockPos.ORIGIN, previousBurrow);
}

private static class GriffinBurrow extends Waypoint {
private int critParticle;
Expand Down

0 comments on commit aaa011f

Please sign in to comment.