Record Class SpikeFeature
java.lang.Object
java.lang.Record
net.minecraft.world.level.levelgen.feature.SpikeFeature
- All Implemented Interfaces:
Feature
public record SpikeFeature(BlockState state, BlockPredicate canPlaceOn, BlockPredicate canReplace)
extends Record
implements Feature
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BlockPredicateThe field for thecanPlaceOnrecord component.private final BlockPredicateThe field for thecanReplacerecord component.static final com.mojang.serialization.MapCodec<SpikeFeature> private final BlockStateThe field for thestaterecord component.Fields inherited from interface Feature
DIRECT_CODEC, LIST_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionSpikeFeature(BlockState state, BlockPredicate canPlaceOn, BlockPredicate canReplace) Creates an instance of aSpikeFeaturerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecanPlaceOnrecord component.Returns the value of thecanReplacerecord component.com.mojang.serialization.MapCodec<SpikeFeature> codec()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanplace(WorldGenLevel level, ChunkGenerator chunkGenerator, RandomSource random, BlockPos origin) state()Returns the value of thestaterecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface Feature
getSubFeatures, markAboveForPostProcessing, safeSetBlock, setBlock
-
Field Details
-
state
The field for thestaterecord component. -
canPlaceOn
The field for thecanPlaceOnrecord component. -
canReplace
The field for thecanReplacerecord component. -
CODEC
-
-
Constructor Details
-
SpikeFeature
Creates an instance of aSpikeFeaturerecord class.- Parameters:
state- the value for thestaterecord componentcanPlaceOn- the value for thecanPlaceOnrecord componentcanReplace- the value for thecanReplacerecord component
-
-
Method Details
-
codec
-
place
public boolean place(WorldGenLevel level, ChunkGenerator chunkGenerator, RandomSource random, BlockPos origin) -
toString
-
hashCode
-
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
Returns the value of thestaterecord component.- Returns:
- the value of the
staterecord component
-
canPlaceOn
Returns the value of thecanPlaceOnrecord component.- Returns:
- the value of the
canPlaceOnrecord component
-
canReplace
Returns the value of thecanReplacerecord component.- Returns:
- the value of the
canReplacerecord component
-