Class OperatorBase
java.lang.Object
org.cyclops.integrateddynamics.core.evaluate.operator.OperatorBase
- All Implemented Interfaces:
IOperator
- Direct Known Subclasses:
CastOperator
,CombinedOperator
,CompositionalOperator
,GeneralOperator
,ParseOperator
,PositionedOperator
,PredicateOperator
A basic abstract implementation of an operator.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static class
-
Constructor Summary
ModifierConstructorDescriptionprotected
OperatorBase
(String symbol, String operatorName, String interactName, String globalInteractNamePrefix, boolean alsoPrefixLocalScope, IValueType[] inputTypes, IValueType outputType, OperatorBase.IFunction function, IConfigRenderPattern renderPattern) -
Method Summary
Modifier and TypeMethodDescriptionstatic IValueType[]
constructInputVariables
(int length, IValueType defaultType) Evaluate the given input values for this operator.getConditionalOutputType
(IVariable[] input) Get the output value type depending on the active input of the operator.protected OperatorBase.IFunction
net.minecraft.network.chat.MutableComponent
protected String
getModId()
protected String
int
net.minecraft.resources.ResourceLocation
protected String
protected String
protected abstract String
void
loadTooltip
(List<net.minecraft.network.chat.Component> lines, boolean appendOptionalInfo) Add tooltip lines for this aspect when hovered in a gui.Materialize this operator so that it can exist without any external references.boolean
toString()
net.minecraft.network.chat.MutableComponent
validateTypes
(IValueType[] input) Check the given input value types for this operator.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.cyclops.integrateddynamics.api.evaluate.operator.IOperator
getGlobalInteractName, getScopedInteractName
-
Constructor Details
-
OperatorBase
protected OperatorBase(String symbol, String operatorName, String interactName, String globalInteractNamePrefix, boolean alsoPrefixLocalScope, IValueType[] inputTypes, IValueType outputType, OperatorBase.IFunction function, @Nullable IConfigRenderPattern renderPattern)
-
-
Method Details
-
constructInputVariables
-
getUnlocalizedType
-
getFunction
-
getUniqueName
public net.minecraft.resources.ResourceLocation getUniqueName()- Specified by:
getUniqueName
in interfaceIOperator
- Returns:
- The unique name for this operator, only used for internal storage.
-
getInteractName
- Specified by:
getInteractName
in interfaceIOperator
- Returns:
- The unique interact name for this operator, when interacting with this operator using external contexts, such as Integrated Scripting.
-
getGlobalInteractNamePrefix
- Specified by:
getGlobalInteractNamePrefix
in interfaceIOperator
- Returns:
- Override for the default global interact name prefix.
-
shouldAlsoPrefixLocalScope
public boolean shouldAlsoPrefixLocalScope()- Specified by:
shouldAlsoPrefixLocalScope
in interfaceIOperator
- Returns:
- If the global interact name prefix should also be used for local scopes.
-
getTranslationKey
- Specified by:
getTranslationKey
in interfaceIOperator
- Returns:
- The unique unlocalized name for this operator.
-
getUnlocalizedCategoryName
- Specified by:
getUnlocalizedCategoryName
in interfaceIOperator
- Returns:
- The unique unlocalized category name for this operator.
-
getLocalizedNameFull
public net.minecraft.network.chat.MutableComponent getLocalizedNameFull()- Specified by:
getLocalizedNameFull
in interfaceIOperator
- Returns:
- The localized full name for this operator, includes category name
-
getUnlocalizedPrefix
-
getUnlocalizedCategoryPrefix
-
getOperatorName
-
getSymbol
-
loadTooltip
public void loadTooltip(List<net.minecraft.network.chat.Component> lines, boolean appendOptionalInfo) Description copied from interface:IOperator
Add tooltip lines for this aspect when hovered in a gui.- Specified by:
loadTooltip
in interfaceIOperator
- Parameters:
lines
- The list to add lines to.appendOptionalInfo
- If shift-to-show info should be added.
-
getInputTypes
- Specified by:
getInputTypes
in interfaceIOperator
- Returns:
- The ordered types of values that are used as input for this operator.
-
getOutputType
- Specified by:
getOutputType
in interfaceIOperator
- Returns:
- The type of value that is achieved when this operator is executed.
-
getConditionalOutputType
Description copied from interface:IOperator
Get the output value type depending on the active input of the operator.- Specified by:
getConditionalOutputType
in interfaceIOperator
- Parameters:
input
- The input that would be given during evaluation.- Returns:
- The type of value that is achieved when this operator is executed.
-
evaluate
Description copied from interface:IOperator
Evaluate the given input values for this operator.- Specified by:
evaluate
in interfaceIOperator
- Parameters:
input
- The ordered input values.- Returns:
- The output value.
- Throws:
EvaluationException
- When something went wrong while evaluating.
-
getRequiredInputLength
public int getRequiredInputLength()- Specified by:
getRequiredInputLength
in interfaceIOperator
- Returns:
- The required input length.
-
validateTypes
Description copied from interface:IOperator
Check the given input value types for this operator.- Specified by:
validateTypes
in interfaceIOperator
- Parameters:
input
- The ordered input value types.- Returns:
- An error or null if valid.
-
toString
-
getModId
-
getRenderPattern
- Specified by:
getRenderPattern
in interfaceIOperator
- Returns:
- The render pattern for this operator inside the logic programmer.
-
materialize
Description copied from interface:IOperator
Materialize this operator so that it can exist without any external references.- Specified by:
materialize
in interfaceIOperator
- Returns:
- The materialized operator.
- Throws:
EvaluationException
- if materialization fails because of a variable evaluation.
-