Class ValueTypeBase<V extends IValue>
java.lang.Object
org.cyclops.integrateddynamics.core.evaluate.variable.ValueTypeBase<V>
- All Implemented Interfaces:
IValueType<V>
- Direct Known Subclasses:
ValueObjectTypeBase,ValueTypeBoolean,ValueTypeCategoryBase,ValueTypeDouble,ValueTypeInteger,ValueTypeLong,ValueTypeNbt,ValueTypeOperator,ValueTypeString
Base implementation of a value type.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cyclops.integrateddynamics.api.evaluate.variable.IValueType
IValueType.ValueTypeComparator -
Constructor Summary
ConstructorsConstructorDescriptionValueTypeBase(String typeName, int color, net.minecraft.ChatFormatting colorFormat, Class<V> valueClass) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.network.chat.ComponentcanDeserialize(ValueDeseralizationContext valueDeseralizationContext, net.minecraft.nbt.Tag value) Check if the given value can be deserialized.Attempt to cast the given value to a value of this value type.booleancorrespondsTo(IValueType<?> valueType) Check if the given type corresponds with this type.intnet.minecraft.ChatFormattingprotected StringgetModId()protected Stringnet.minecraft.resources.ResourceLocationprotected StringbooleanbooleanisObject()voidloadTooltip(List<net.minecraft.network.chat.Component> lines, boolean appendOptionalInfo, V value) Add tooltip lines for this aspect when hovered in a gui.materialize(V value) Materialize the given value so that it can exist without any external references.parseString(String value) Parse the given string representation of a value.protected voidtoString()Get the string representation of the given value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.cyclops.integrateddynamics.api.evaluate.variable.IValueType
deserialize, deserializeValuePredicate, getDefault, getVariableItemOverrideModel, renderISTER, serialize, toCompactString
-
Constructor Details
-
ValueTypeBase
-
-
Method Details
-
isCategory
public boolean isCategory()- Specified by:
isCategoryin interfaceIValueType<V extends IValue>- Returns:
- If this type is a category and should be handled accordingly.
-
isObject
public boolean isObject()- Specified by:
isObjectin interfaceIValueType<V extends IValue>- Returns:
- If this type is an object type, otherwise it is a raw type.
-
getUniqueName
public net.minecraft.resources.ResourceLocation getUniqueName()- Specified by:
getUniqueNamein interfaceIValueType<V extends IValue>- Returns:
- The unique name for this value type, only used for internal storage.
-
getUnlocalizedPrefix
-
getTypeNamespace
-
getTranslationKey
- Specified by:
getTranslationKeyin interfaceIValueType<V extends IValue>- Returns:
- The unique name of this type that will also be used for display.
-
getTypeName
- Specified by:
getTypeNamein interfaceIValueType<V extends IValue>- Returns:
- The name of this type without any prefixes.
-
getDisplayColor
public int getDisplayColor()- Specified by:
getDisplayColorin interfaceIValueType<V extends IValue>- Returns:
- The color that is used to identify this value type.
-
getDisplayColorFormat
public net.minecraft.ChatFormatting getDisplayColorFormat()- Specified by:
getDisplayColorFormatin interfaceIValueType<V extends IValue>- Returns:
- The color that is used to identify this value type using MC formatting codes.
-
correspondsTo
Description copied from interface:IValueTypeCheck if the given type corresponds with this type. To check bidirectional, useValueHelpers.correspondsTo(IValueType, IValueType).- Specified by:
correspondsToin interfaceIValueType<V extends IValue>- Parameters:
valueType- The value type to check correspondence with.- Returns:
- If the given value type can be used with this value type.
-
registerModelResourceLocation
protected void registerModelResourceLocation() -
loadTooltip
public void loadTooltip(List<net.minecraft.network.chat.Component> lines, boolean appendOptionalInfo, @Nullable V value) Description copied from interface:IValueTypeAdd tooltip lines for this aspect when hovered in a gui.- Specified by:
loadTooltipin interfaceIValueType<V extends IValue>- Parameters:
lines- The list to add lines to.appendOptionalInfo- If shift-to-show info should be added.value- The value to show the tooltip for.
-
canDeserialize
public net.minecraft.network.chat.Component canDeserialize(ValueDeseralizationContext valueDeseralizationContext, net.minecraft.nbt.Tag value) Description copied from interface:IValueTypeCheck if the given value can be deserialized.- Specified by:
canDeserializein interfaceIValueType<V extends IValue>- Parameters:
valueDeseralizationContext- Getter for blocks.value- The value to deserialize.- Returns:
- An error or null.
-
materialize
Description copied from interface:IValueTypeMaterialize the given value so that it can exist without any external references.- Specified by:
materializein interfaceIValueType<V extends IValue>- Parameters:
value- The value to materialize.- Returns:
- The materialized value.
- Throws:
EvaluationException- if materialization fails because of a variable evaluation.
-
parseString
Description copied from interface:IValueTypeParse the given string representation of a value. This corresponds toIValueType.toString(IValue).- Specified by:
parseStringin interfaceIValueType<V extends IValue>- Parameters:
value- A string representation of a value.- Returns:
- A value.
- Throws:
EvaluationException- If parsing failed.
-
toString
Description copied from interface:IValueTypeGet the string representation of the given value. This is useful for cases when the value needs to be edited in a GUI. This corresponds toIValueType.parseString(String).- Specified by:
toStringin interfaceIValueType<V extends IValue>- Parameters:
value- A value.- Returns:
- A string representation of the given value.
-
toString
-
createLogicProgrammerElement
- Specified by:
createLogicProgrammerElementin interfaceIValueType<V extends IValue>- Returns:
- A new logic programmer element for this value type.
-
getModId
-
cast
Description copied from interface:IValueTypeAttempt to cast the given value to a value of this value type.- Specified by:
castin interfaceIValueType<V extends IValue>- Parameters:
value- A value of unknown type.- Returns:
- The casted value.
- Throws:
EvaluationException- If the incorrect value type was found.
-