Class NbtPathExpressionParseHandlerBooleanLogicalAdapter
java.lang.Object
org.cyclops.cyclopscore.nbt.path.parse.NbtPathExpressionParseHandlerBooleanLogicalAdapter
- All Implemented Interfaces:
INbtPathExpressionParseHandler
- Direct Known Subclasses:
NbtPathExpressionParseHandlerBooleanLogicalAnd,NbtPathExpressionParseHandlerBooleanLogicalOr
public abstract class NbtPathExpressionParseHandlerBooleanLogicalAdapter
extends Object
implements INbtPathExpressionParseHandler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classNested classes/interfaces inherited from interface org.cyclops.cyclopscore.nbt.path.parse.INbtPathExpressionParseHandler
INbtPathExpressionParseHandler.HandleResult -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptionstatic intfindExpressionEnd(String expression, int start) Find the end position of an expression, stopping at logical operators or closing parenthesis.protected abstract booleangetLogicalValue(boolean left, Supplier<Boolean> right) handlePrefixOf(String nbtPathExpression, int pos) Try to create an expression from the given position in the given expression.static booleanisTruthy(net.minecraft.nbt.Tag tag) Determine if a tag is truthy.
-
Constructor Details
-
NbtPathExpressionParseHandlerBooleanLogicalAdapter
-
-
Method Details
-
getLogicalValue
-
isTruthy
public static boolean isTruthy(net.minecraft.nbt.Tag tag) Determine if a tag is truthy. ByteTag with value 1 is true, 0 is false. Any other non-null tag is considered true. This follows the same logic asINbtPathExpression.test(Tag).- Parameters:
tag- The tag to check- Returns:
- true if the tag is truthy, false otherwise
-
findExpressionEnd
Find the end position of an expression, stopping at logical operators or closing parenthesis. This method is shared by logical operator handlers to identify expression boundaries.- Parameters:
expression- The full expression stringstart- The starting position to search from- Returns:
- The position where the expression ends
-
handlePrefixOf
@Nullable public INbtPathExpressionParseHandler.HandleResult handlePrefixOf(String nbtPathExpression, int pos) Description copied from interface:INbtPathExpressionParseHandlerTry to create an expression from the given position in the given expression.- Specified by:
handlePrefixOfin interfaceINbtPathExpressionParseHandler- Parameters:
nbtPathExpression- A string representation of an NBT path expression.pos- The position in the string to start from.- Returns:
- The handler result.
-