Record Class Grammar<T>
java.lang.Object
java.lang.Record
net.minecraft.util.parsing.packrat.commands.Grammar<T>
- All Implemented Interfaces:
CommandArgumentParser<T>
public record Grammar<T>(Dictionary<com.mojang.brigadier.StringReader> rules, NamedRule<com.mojang.brigadier.StringReader,T> top)
extends Record
implements CommandArgumentParser<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Dictionary<com.mojang.brigadier.StringReader> The field for therulesrecord component.The field for thetoprecord component. -
Constructor Summary
ConstructorsConstructorDescriptionGrammar(Dictionary<com.mojang.brigadier.StringReader> rules, NamedRule<com.mojang.brigadier.StringReader, T> top) Creates an instance of aGrammarrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.parse(ParseState<com.mojang.brigadier.StringReader> pParseState) parseForCommands(com.mojang.brigadier.StringReader pReader) CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> parseForSuggestions(com.mojang.brigadier.suggestion.SuggestionsBuilder pBuilder) Dictionary<com.mojang.brigadier.StringReader> rules()Returns the value of therulesrecord component.top()Returns the value of thetoprecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.util.parsing.packrat.commands.CommandArgumentParser
mapResult, withCodec
-
Field Details
-
rules
The field for therulesrecord component. -
top
The field for thetoprecord component.
-
-
Constructor Details
-
Grammar
public Grammar(Dictionary<com.mojang.brigadier.StringReader> rules, NamedRule<com.mojang.brigadier.StringReader, T> top) Creates an instance of aGrammarrecord class.- Parameters:
rules- the value for therulesrecord componenttop- the value for thetoprecord component
-
-
Method Details
-
parse
-
parseForCommands
public T parseForCommands(com.mojang.brigadier.StringReader pReader) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Specified by:
parseForCommandsin interfaceCommandArgumentParser<T>- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
parseForSuggestions
public CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> parseForSuggestions(com.mojang.brigadier.suggestion.SuggestionsBuilder pBuilder) - Specified by:
parseForSuggestionsin interfaceCommandArgumentParser<T>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
rules
Returns the value of therulesrecord component.- Returns:
- the value of the
rulesrecord component
-
top
Returns the value of thetoprecord component.- Returns:
- the value of the
toprecord component
-