Record Class Random
java.lang.Object
java.lang.Record
net.minecraft.world.level.levelgen.structure.pools.alias.Random
- All Implemented Interfaces:
PoolAliasBinding
record Random(ResourceKey<StructureTemplatePool> alias, SimpleWeightedRandomList<ResourceKey<StructureTemplatePool>> targets)
extends Record
implements PoolAliasBinding
-
Field Summary
Modifier and TypeFieldDescriptionprivate final ResourceKey<StructureTemplatePool>
The field for thealias
record component.(package private) static com.mojang.serialization.Codec<Random>
private final SimpleWeightedRandomList<ResourceKey<StructureTemplatePool>>
The field for thetargets
record component. -
Constructor Summary
ConstructorDescriptionRandom
(ResourceKey<StructureTemplatePool> alias, SimpleWeightedRandomList<ResourceKey<StructureTemplatePool>> targets) Creates an instance of aRandom
record class. -
Method Summary
Modifier and TypeMethodDescriptionalias()
Returns the value of thealias
record component.com.mojang.serialization.Codec<Random>
codec()
final boolean
Indicates whether some other object is "equal to" this one.void
forEachResolved
(RandomSource p_307661_, BiConsumer<ResourceKey<StructureTemplatePool>, ResourceKey<StructureTemplatePool>> p_307635_) final int
hashCode()
Returns a hash code value for this object.targets()
Returns the value of thetargets
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
alias
The field for thealias
record component. -
targets
The field for thetargets
record component. -
CODEC
-
-
Constructor Details
-
Random
Random(ResourceKey<StructureTemplatePool> alias, SimpleWeightedRandomList<ResourceKey<StructureTemplatePool>> targets) Creates an instance of aRandom
record class.- Parameters:
alias
- the value for thealias
record componenttargets
- the value for thetargets
record component
-
-
Method Details
-
forEachResolved
public void forEachResolved(RandomSource p_307661_, BiConsumer<ResourceKey<StructureTemplatePool>, ResourceKey<StructureTemplatePool>> p_307635_) - Specified by:
forEachResolved
in interfacePoolAliasBinding
-
allTargets
- Specified by:
allTargets
in interfacePoolAliasBinding
-
codec
- Specified by:
codec
in interfacePoolAliasBinding
-
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)
. -
alias
Returns the value of thealias
record component.- Returns:
- the value of the
alias
record component
-
targets
Returns the value of thetargets
record component.- Returns:
- the value of the
targets
record component
-