Class OperatorRegistry
java.lang.Object
org.cyclops.integrateddynamics.core.evaluate.operator.OperatorRegistry
- All Implemented Interfaces:
org.cyclops.cyclopscore.init.IRegistry
,IOperatorRegistry
,IVariableFacadeHandler<IOperatorVariableFacade>
Registry for
IOperator
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(ValueDeseralizationContext valueDeseralizationContext, net.minecraft.nbt.Tag value) Deserialize the given operator value.deserializeVariablePredicate
(ValueDeseralizationContext valueDeseralizationContext, com.google.gson.JsonObject element, IValueType valueType, ValuePredicate valuePredicate) Deserialize the given JSON element to a variable predicate.static OperatorRegistry
getOperator
(net.minecraft.resources.ResourceLocation uniqueName) Get the operator with the given name.getOperatorsInCategory
(String categoryName) Get the operators in the given category.getOperatorsWithInputTypes
(IValueType... valueTypes) Get the operators with the given input value types in that specific order.getOperatorsWithOutputType
(IValueType valueType) Get the operators with the given output value type.Map<IValueType<?>,
Map<String, IOperator>> net.minecraft.resources.ResourceLocation
getVariableFacade
(ValueDeseralizationContext valueDeseralizationContext, int id, net.minecraft.nbt.CompoundTag tag) Get the variable facade for the given tag.<O extends IOperator>
Oregister
(O operator) Register a new operator.void
registerSerializer
(IOperatorSerializer serializer) Register an operator serializer.net.minecraft.nbt.Tag
Serialize the given operator.void
setVariableFacade
(net.minecraft.nbt.CompoundTag tag, IOperatorVariableFacade variableFacade) Set the variable facade for the given tag.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.cyclops.integrateddynamics.api.item.IVariableFacadeHandler
deserializeVariableFacadePredicate
-
Method Details
-
getInstance
- Returns:
- The unique instance.
-
register
Description copied from interface:IOperatorRegistry
Register a new operator.- Specified by:
register
in interfaceIOperatorRegistry
- Type Parameters:
O
- The operator type.- Parameters:
operator
- The operator.- Returns:
- The registered operator.
-
getOperators
- Specified by:
getOperators
in interfaceIOperatorRegistry
- Returns:
- All registered operators.
-
getOperator
Description copied from interface:IOperatorRegistry
Get the operator with the given name.- Specified by:
getOperator
in interfaceIOperatorRegistry
- Parameters:
uniqueName
- The unique operator name.- Returns:
- The corresponding operator or null.
-
getOperatorsWithInputTypes
Description copied from interface:IOperatorRegistry
Get the operators with the given input value types in that specific order.- Specified by:
getOperatorsWithInputTypes
in interfaceIOperatorRegistry
- Parameters:
valueTypes
- The input value types.- Returns:
- The corresponding operators.
-
getOperatorsWithOutputType
Description copied from interface:IOperatorRegistry
Get the operators with the given output value type.- Specified by:
getOperatorsWithOutputType
in interfaceIOperatorRegistry
- Parameters:
valueType
- The output value type.- Returns:
- The corresponding operators.
-
getOperatorsInCategory
Description copied from interface:IOperatorRegistry
Get the operators in the given category.- Specified by:
getOperatorsInCategory
in interfaceIOperatorRegistry
- Parameters:
categoryName
- The name of the operator category.- Returns:
- The corresponding operators.
-
registerSerializer
Description copied from interface:IOperatorRegistry
Register an operator serializer.- Specified by:
registerSerializer
in interfaceIOperatorRegistry
- Parameters:
serializer
- The operator serializer.
-
serialize
Description copied from interface:IOperatorRegistry
Serialize the given operator.- Specified by:
serialize
in interfaceIOperatorRegistry
- Parameters:
value
- The operator to serialize.- Returns:
- The serialized operator value.
-
deserialize
public IOperator deserialize(ValueDeseralizationContext valueDeseralizationContext, net.minecraft.nbt.Tag value) throws EvaluationException Description copied from interface:IOperatorRegistry
Deserialize the given operator value.- Specified by:
deserialize
in interfaceIOperatorRegistry
value
- The operator value to deserialize.- Returns:
- The deserialized operator.
- Throws:
EvaluationException
- If an error occurs while deserializing.
-
getUniqueName
public net.minecraft.resources.ResourceLocation getUniqueName()- Specified by:
getUniqueName
in interfaceIVariableFacadeHandler<IOperatorVariableFacade>
- Returns:
- The unique name of this type used to identity variables to this handler.
-
getVariableFacade
public IOperatorVariableFacade getVariableFacade(ValueDeseralizationContext valueDeseralizationContext, int id, net.minecraft.nbt.CompoundTag tag) Description copied from interface:IVariableFacadeHandler
Get the variable facade for the given tag.- Specified by:
getVariableFacade
in interfaceIVariableFacadeHandler<IOperatorVariableFacade>
id
- The id that was read and needs to be inserted into the variable facade.tag
- The tag containing information that can be read and used to form a variable facade.- Returns:
- The variable facade
-
setVariableFacade
public void setVariableFacade(net.minecraft.nbt.CompoundTag tag, IOperatorVariableFacade variableFacade) Description copied from interface:IVariableFacadeHandler
Set the variable facade for the given tag.- Specified by:
setVariableFacade
in interfaceIVariableFacadeHandler<IOperatorVariableFacade>
- Parameters:
tag
- The tag that is used to write variable facade information to.variableFacade
- The facade to write.
-
deserializeVariablePredicate
public VariablePredicate deserializeVariablePredicate(ValueDeseralizationContext valueDeseralizationContext, com.google.gson.JsonObject element, @Nullable IValueType valueType, ValuePredicate valuePredicate) Description copied from interface:IVariableFacadeHandler
Deserialize the given JSON element to a variable predicate.- Specified by:
deserializeVariablePredicate
in interfaceIVariableFacadeHandler<IOperatorVariableFacade>
element
- The JSON element.valueType
- The optional value type.valuePredicate
- The value predicate.- Returns:
- The variable predicate.
-
getGlobalInteractOperators
- Specified by:
getGlobalInteractOperators
in interfaceIOperatorRegistry
- Returns:
- Mapping of globally interaction names of operators to their instance.
-
getScopedInteractOperators
- Specified by:
getScopedInteractOperators
in interfaceIOperatorRegistry
- Returns:
- Mapping of value types to locally interaction names of operators to their instance.
-