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.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.boolean
isInstance
(IVariable<?> variable) If the given variable is created by this handler.boolean
isInstance
(IVariableFacade variableFacade) If the given facade is created by this handler.<O extends IOperator>
Oregister
(O operator) Register a new operator.void
registerSerializer
(IOperatorSerializer serializer) Register an operator serializer.net.minecraft.nbt.Tag
serialize
(ValueDeseralizationContext valueDeseralizationContext, IOperator value) Serialize the given operator.void
setVariableFacade
(ValueDeseralizationContext valueDeseralizationContext, net.minecraft.nbt.CompoundTag tag, IOperatorVariableFacade variableFacade) Set the variable facade for the given tag.
-
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
public net.minecraft.nbt.Tag serialize(ValueDeseralizationContext valueDeseralizationContext, IOperator value) Description copied from interface:IOperatorRegistry
Serialize the given operator.- Specified by:
serialize
in interfaceIOperatorRegistry
- Parameters:
valueDeseralizationContext
-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
- Parameters:
valueDeseralizationContext
-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>
- Parameters:
valueDeseralizationContext
-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(ValueDeseralizationContext valueDeseralizationContext, 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:
valueDeseralizationContext
-tag
- The tag that is used to write variable facade information to.variableFacade
- The facade to write.
-
isInstance
Description copied from interface:IVariableFacadeHandler
If the given facade is created by this handler.- Specified by:
isInstance
in interfaceIVariableFacadeHandler<IOperatorVariableFacade>
- Parameters:
variableFacade
- A facade.- Returns:
- If it is an instance.
-
isInstance
Description copied from interface:IVariableFacadeHandler
If the given variable is created by this handler.- Specified by:
isInstance
in interfaceIVariableFacadeHandler<IOperatorVariableFacade>
- Parameters:
variable
- A variable.- Returns:
- If it is an instance.
-
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.
-