Class CommandTreeCleaner
java.lang.Object
net.neoforged.neoforge.network.filters.CommandTreeCleaner
-
Field Summary
FieldsModifier and TypeFieldDescriptionReconstructs the command nodes from information contained in theClientboundCommandsPacket.private static final Predicate<SharedSuggestionProvider> We use this as a node requirement marker to restore the original bitmask entry for restricted commands. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <S> com.mojang.brigadier.tree.RootCommandNode<S> cleanArgumentTypes(com.mojang.brigadier.tree.RootCommandNode<S> root, Predicate<com.mojang.brigadier.arguments.ArgumentType<?>> argumentTypeFilter) Cleans the command tree starting at the given root node from any argument types that do not match the given predicate.private static <S> com.mojang.brigadier.tree.CommandNode<S> cloneNode(com.mojang.brigadier.tree.CommandNode<S> node, Predicate<com.mojang.brigadier.tree.CommandNode<?>> nodeFilter, Map<com.mojang.brigadier.tree.CommandNode<S>, com.mojang.brigadier.tree.CommandNode<S>> newNodes) private static <S> com.mojang.brigadier.tree.CommandNode<S> processCommandNode(com.mojang.brigadier.tree.CommandNode<S> node, Predicate<com.mojang.brigadier.tree.CommandNode<?>> nodeFilter, Map<com.mojang.brigadier.tree.CommandNode<S>, com.mojang.brigadier.tree.CommandNode<S>> newNodes)
-
Field Details
-
RESTRICTED
We use this as a node requirement marker to restore the original bitmask entry for restricted commands. -
COMMAND_NODE_BUILDER
public static final ClientboundCommandsPacket.NodeBuilder<SharedSuggestionProvider> COMMAND_NODE_BUILDERReconstructs the command nodes from information contained in theClientboundCommandsPacket. The Vanilla version of this lives in the client source set and uses the client-side suggestion provider. -
COMMAND_NODE_INSPECTOR
public static final ClientboundCommandsPacket.NodeInspector<SharedSuggestionProvider> COMMAND_NODE_INSPECTOR
-
-
Constructor Details
-
CommandTreeCleaner
CommandTreeCleaner()
-
-
Method Details
-
cleanArgumentTypes
public static <S> com.mojang.brigadier.tree.RootCommandNode<S> cleanArgumentTypes(com.mojang.brigadier.tree.RootCommandNode<S> root, Predicate<com.mojang.brigadier.arguments.ArgumentType<?>> argumentTypeFilter) Cleans the command tree starting at the given root node from any argument types that do not match the given predicate. AnyArgumentCommandNodes that have an unmatched argument type will be stripped from the tree.- Returns:
- A new command tree, stripped of any unmatched argument types
-
processCommandNode
-
cloneNode
-