Skip to content

Commit b6bfebc

Browse files
authored
Add viewstash suggestions (SkyblockerMod#1067)
1 parent c0526d5 commit b6bfebc

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

Diff for: src/main/java/de/hysky/skyblocker/mixins/CommandTreeS2CPacketMixin.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.mojang.brigadier.tree.LiteralCommandNode;
66

77
import de.hysky.skyblocker.skyblock.SackItemAutocomplete;
8+
import de.hysky.skyblocker.skyblock.ViewstashAutocomplete;
89
import de.hysky.skyblocker.skyblock.WarpAutocomplete;
910
import de.hysky.skyblocker.utils.Utils;
1011
import net.minecraft.command.CommandSource;
@@ -20,7 +21,7 @@ public CommandNode<? extends CommandSource> modifyCommandSuggestions(CommandNode
2021
case String s when s.equals("warp") && WarpAutocomplete.commandNode != null -> WarpAutocomplete.commandNode;
2122
case String s when s.equals("getfromsacks") && SackItemAutocomplete.longCommandNode != null -> SackItemAutocomplete.longCommandNode;
2223
case String s when s.equals("gfs") && SackItemAutocomplete.shortCommandNode != null -> SackItemAutocomplete.shortCommandNode;
23-
24+
case String s when s.equals("viewstash") -> ViewstashAutocomplete.getCommandNode();
2425
default -> original;
2526
};
2627
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package de.hysky.skyblocker.skyblock;
2+
3+
import com.mojang.brigadier.arguments.StringArgumentType;
4+
import com.mojang.brigadier.tree.LiteralCommandNode;
5+
import de.hysky.skyblocker.utils.Utils;
6+
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
7+
import net.minecraft.command.CommandSource;
8+
9+
import java.util.stream.Stream;
10+
11+
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument;
12+
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;
13+
14+
public class ViewstashAutocomplete {
15+
public static LiteralCommandNode<FabricClientCommandSource> getCommandNode() {
16+
return literal("viewstash")
17+
.requires(fabricClientCommandSource -> Utils.isOnSkyblock())
18+
.then(argument("stash", StringArgumentType.word())
19+
.suggests((context, builder) -> CommandSource.suggestMatching(Stream.of("material", "item"), builder))
20+
).build();
21+
}
22+
}

0 commit comments

Comments
 (0)