Record Class TimeComponent
java.lang.Object
java.lang.Record
dev.latvian.mods.kubejs.recipe.component.TimeComponent
- All Implemented Interfaces:
RecipeComponent<TickDuration>
public record TimeComponent(RecipeComponentType<?> type, long scale, com.mojang.serialization.Codec<TickDuration> codec)
extends Record
implements RecipeComponent<TickDuration>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RecipeComponentType<TickDuration> static final RecipeComponentType<TickDuration> static final RecipeComponentType<TickDuration> static final RecipeComponentType<TickDuration> -
Constructor Summary
ConstructorsConstructorDescriptionTimeComponent(RecipeComponentType<?> type, long scale, com.mojang.serialization.Codec<TickDuration> codec) Creates an instance of aTimeComponentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildUniqueId(UniqueIdBuilder builder, TickDuration value) com.mojang.serialization.Codec<TickDuration> codec()Returns the value of thecodecrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanhasPriority(RecipeMatchContext cx, Object from) Declares whether this component should take priority when being considered by e.g.booleanisEmpty(TickDuration value) Shallow empty check functionlongscale()Returns the value of thescalerecord component.toString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.dev.latvian.mods.rhino.type.TypeInfotypeInfo()Defines a description for how this component may be constructed.wrap(RecipeScriptContext cx, Object from) Method to read the value contained within this component from an input object; this may be some arbitrary value passed into aschema'sconstructor(s) or automatically generated builder methods.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.latvian.mods.kubejs.recipe.component.RecipeComponent
allowEmpty, asConditionalList, asConditionalListOrSelf, asList, asListOrSelf, asMap, asPatternKey, createBuilder, inputKey, isIgnored, key, matches, or, orSelf, otherKey, outputKey, readFromJson, replace, spread, toString, validate, withCodec, writeToJson
-
Field Details
-
TICKS
-
SECONDS
-
MINUTES
-
HOURS
-
-
Constructor Details
-
TimeComponent
public TimeComponent(RecipeComponentType<?> type, long scale, com.mojang.serialization.Codec<TickDuration> codec) Creates an instance of aTimeComponentrecord class.- Parameters:
type- the value for thetyperecord componentscale- the value for thescalerecord componentcodec- the value for thecodecrecord component
-
-
Method Details
-
codec
Returns the value of thecodecrecord component.- Specified by:
codecin interfaceRecipeComponent<TickDuration>- Returns:
- the value of the
codecrecord component
-
typeInfo
public dev.latvian.mods.rhino.type.TypeInfo typeInfo()Description copied from interface:RecipeComponentDefines a description for how this component may be constructed. Type descriptions may be comprised of a primitive type such as a string, number or Java class (which may be useful if that that class has an appropriate type wrapper for it already), an array of fixed or dynamic length, a map / object, or a union of multiple types.Type descriptions are used by addons like ProbeJS to provide typing hints.
- Specified by:
typeInfoin interfaceRecipeComponent<TickDuration>- Returns:
- A description of how this component may be constructed
-
hasPriority
Description copied from interface:RecipeComponentDeclares whether this component should take priority when being considered by e.g. anEitherRecipeComponentduring deserialization.- Specified by:
hasPriorityin interfaceRecipeComponent<TickDuration>- Parameters:
cx- Script contextfrom- The object to be deserialized from- Returns:
- Whether this component should take priority
-
wrap
Description copied from interface:RecipeComponentMethod to read the value contained within this component from an input object; this may be some arbitrary value passed into aschema'sconstructor(s) or automatically generated builder methods. By default, it will attempt to type wrap based onRecipeComponent.typeInfo()- Specified by:
wrapin interfaceRecipeComponent<TickDuration>- Parameters:
cx- Script contextfrom- An object to be converted to a value for this component- Returns:
- The value read from the input
-
buildUniqueId
- Specified by:
buildUniqueIdin interfaceRecipeComponent<TickDuration>
-
isEmpty
Description copied from interface:RecipeComponentShallow empty check function- Specified by:
isEmptyin interfaceRecipeComponent<TickDuration>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
type
Returns the value of thetyperecord component.- Specified by:
typein interfaceRecipeComponent<TickDuration>- Returns:
- the value of the
typerecord component
-
scale
public long scale()Returns the value of thescalerecord component.- Returns:
- the value of the
scalerecord component
-