Record Class RandomChancePlacement
java.lang.Object
java.lang.Record
net.minecraft.world.level.levelgen.placement.RandomChancePlacement
- All Implemented Interfaces:
PlacementFilter, PlacementModifier
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final floatThe field for thechancerecord component.static final com.mojang.serialization.MapCodec<RandomChancePlacement> -
Constructor Summary
ConstructorsConstructorDescriptionRandomChancePlacement(float chance) Creates an instance of aRandomChancePlacementrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfloatchance()Returns the value of thechancerecord component.com.mojang.serialization.MapCodec<RandomChancePlacement> codec()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanshouldPlace(PlacementContext context, RandomSource random, BlockPos origin) final StringtoString()Returns a string representation of this record class.Methods inherited from interface PlacementFilter
modify
-
Field Details
-
chance
private final float chanceThe field for thechancerecord component. -
CODEC
-
-
Constructor Details
-
RandomChancePlacement
public RandomChancePlacement(float chance) Creates an instance of aRandomChancePlacementrecord class.- Parameters:
chance- the value for thechancerecord component
-
-
Method Details
-
codec
- Specified by:
codecin interfacePlacementFilter- Specified by:
codecin interfacePlacementModifier
-
shouldPlace
- Specified by:
shouldPlacein interfacePlacementFilter
-
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 with thecomparemethod from their corresponding wrapper classes. -
chance
public float chance()Returns the value of thechancerecord component.- Returns:
- the value of the
chancerecord component
-