Record Class BlockStateComponent
java.lang.Object
java.lang.Record
dev.latvian.mods.kubejs.recipe.component.BlockStateComponent
- All Implemented Interfaces:
RecipeComponent<net.minecraft.world.level.block.state.BlockState>
public record BlockStateComponent(RecipeComponentType<?> type, boolean preferObjectForm, boolean allowEmpty)
extends Record
implements RecipeComponent<net.minecraft.world.level.block.state.BlockState>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RecipeComponentType<net.minecraft.world.level.block.state.BlockState> static final RecipeComponentType<net.minecraft.world.level.block.state.BlockState> static final RecipeComponentType<net.minecraft.world.level.block.state.BlockState> static final RecipeComponentType<net.minecraft.world.level.block.state.BlockState> static final dev.latvian.mods.rhino.type.TypeInfo -
Constructor Summary
ConstructorsConstructorDescriptionBlockStateComponent(RecipeComponentType<?> type, boolean preferObjectForm, boolean allowEmpty) Creates an instance of aBlockStateComponentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of theallowEmptyrecord component.voidbuildUniqueId(UniqueIdBuilder builder, net.minecraft.world.level.block.state.BlockState value) com.mojang.serialization.Codec<net.minecraft.world.level.block.state.BlockState> codec()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisEmpty(net.minecraft.world.level.block.state.BlockState value) Shallow empty check functionbooleanmatches(RecipeMatchContext cx, net.minecraft.world.level.block.state.BlockState value, ReplacementMatchInfo match) booleanReturns the value of thepreferObjectFormrecord component.toString()Returns a string representation of this record class.toString(OpsContainer ops, net.minecraft.world.level.block.state.BlockState value) type()Returns the value of thetyperecord component.dev.latvian.mods.rhino.type.TypeInfotypeInfo()Defines a description for how this component may be constructed.net.minecraft.world.level.block.state.BlockStatewrap(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
asConditionalList, asConditionalListOrSelf, asList, asListOrSelf, asMap, asPatternKey, createBuilder, hasPriority, inputKey, isIgnored, key, or, orSelf, otherKey, outputKey, readFromJson, replace, spread, validate, withCodec, writeToJson
-
Field Details
-
TYPE_INFO
public static final dev.latvian.mods.rhino.type.TypeInfo TYPE_INFO -
BLOCK
-
BLOCK_STRING
public static final RecipeComponentType<net.minecraft.world.level.block.state.BlockState> BLOCK_STRING -
OPTIONAL_BLOCK
public static final RecipeComponentType<net.minecraft.world.level.block.state.BlockState> OPTIONAL_BLOCK -
OPTIONAL_BLOCK_STRING
public static final RecipeComponentType<net.minecraft.world.level.block.state.BlockState> OPTIONAL_BLOCK_STRING
-
-
Constructor Details
-
BlockStateComponent
public BlockStateComponent(RecipeComponentType<?> type, boolean preferObjectForm, boolean allowEmpty) Creates an instance of aBlockStateComponentrecord class.- Parameters:
type- the value for thetyperecord componentpreferObjectForm- the value for thepreferObjectFormrecord componentallowEmpty- the value for theallowEmptyrecord component
-
-
Method Details
-
codec
public com.mojang.serialization.Codec<net.minecraft.world.level.block.state.BlockState> codec()- Specified by:
codecin interfaceRecipeComponent<net.minecraft.world.level.block.state.BlockState>
-
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<net.minecraft.world.level.block.state.BlockState>- Returns:
- A description of how this component may be constructed
-
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<net.minecraft.world.level.block.state.BlockState>- Parameters:
cx- Script contextfrom- An object to be converted to a value for this component- Returns:
- The value read from the input
-
matches
public boolean matches(RecipeMatchContext cx, net.minecraft.world.level.block.state.BlockState value, ReplacementMatchInfo match) - Specified by:
matchesin interfaceRecipeComponent<net.minecraft.world.level.block.state.BlockState>- Parameters:
cx- Script contextvalue- The value to checkmatch- The replacement match to check against- Returns:
- true if the given value matches the given replacement match.
-
isEmpty
public boolean isEmpty(net.minecraft.world.level.block.state.BlockState value) Description copied from interface:RecipeComponentShallow empty check function- Specified by:
isEmptyin interfaceRecipeComponent<net.minecraft.world.level.block.state.BlockState>
-
buildUniqueId
public void buildUniqueId(UniqueIdBuilder builder, net.minecraft.world.level.block.state.BlockState value) - Specified by:
buildUniqueIdin interfaceRecipeComponent<net.minecraft.world.level.block.state.BlockState>
-
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. -
toString
- Specified by:
toStringin interfaceRecipeComponent<net.minecraft.world.level.block.state.BlockState>
-
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<net.minecraft.world.level.block.state.BlockState>- Returns:
- the value of the
typerecord component
-
preferObjectForm
public boolean preferObjectForm()Returns the value of thepreferObjectFormrecord component.- Returns:
- the value of the
preferObjectFormrecord component
-
allowEmpty
public boolean allowEmpty()Returns the value of theallowEmptyrecord component.- Specified by:
allowEmptyin interfaceRecipeComponent<net.minecraft.world.level.block.state.BlockState>- Returns:
- the value of the
allowEmptyrecord component
-