Record Class ConstantOutput
java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.structure.processor.rule.ConstantOutput
- Record Components:
state- The constantBlockStateto output when the parentOverhauledRulematches.
- All Implemented Interfaces:
RuleOutput
public record ConstantOutput(net.minecraft.world.level.block.state.BlockState state)
extends Record
implements RuleOutput
A
RuleOutput implementation that always returns a single fixed BlockState.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ConstantOutput> TheMapCodecfor serializing and deserializing aConstantOutputfrom JSON. -
Constructor Summary
ConstructorsConstructorDescriptionConstantOutput(net.minecraft.world.level.block.state.BlockState state) Creates an instance of aConstantOutputrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.net.minecraft.world.level.block.state.BlockStategetOutput(net.minecraft.util.RandomSource random, net.minecraft.core.BlockPos localPos, net.minecraft.core.BlockPos absolutePos, net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings settings) Returns the constantstate.Retrieves the unique string identifier for this output type.final inthashCode()Returns a hash code value for this object.net.minecraft.world.level.block.state.BlockStatestate()Returns the value of thestaterecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
TheMapCodecfor serializing and deserializing aConstantOutputfrom JSON.
-
-
Constructor Details
-
ConstantOutput
public ConstantOutput(net.minecraft.world.level.block.state.BlockState state) Creates an instance of aConstantOutputrecord class.- Parameters:
state- the value for thestaterecord component
-
-
Method Details
-
getTypeId
Retrieves the unique string identifier for this output type.- Specified by:
getTypeIdin interfaceRuleOutput- Returns:
- The type identifier
"constant".
-
getOutput
public net.minecraft.world.level.block.state.BlockState getOutput(net.minecraft.util.RandomSource random, net.minecraft.core.BlockPos localPos, net.minecraft.core.BlockPos absolutePos, net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings settings) Returns the constantstate.- Specified by:
getOutputin interfaceRuleOutput- Parameters:
random- The per-block random source (unused).localPos- The unrotated template-local block position (unused).absolutePos- The world-space block position (unused).settings- The structure placement settings (unused).- Returns:
- The fixed
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. -
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. All components in this record class are compared withObjects::equals(Object,Object). -
state
public net.minecraft.world.level.block.state.BlockState state()Returns the value of thestaterecord component.- Returns:
- the value of the
staterecord component
-