Package net.minecraft.world.level
Record Class SpawnData
java.lang.Object
java.lang.Record
net.minecraft.world.level.SpawnData
public record SpawnData(CompoundTag entityToSpawn, Optional<SpawnData.CustomSpawnRules> customSpawnRules)
extends Record
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<SpawnData>
private final Optional<SpawnData.CustomSpawnRules>
The field for thecustomSpawnRules
record component.static final String
private final CompoundTag
The field for theentityToSpawn
record component.static final com.mojang.serialization.Codec<SimpleWeightedRandomList<SpawnData>>
-
Constructor Summary
ConstructorDescriptionSpawnData
(CompoundTag entityToSpawn, Optional<SpawnData.CustomSpawnRules> customSpawnRules) Creates an instance of aSpawnData
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecustomSpawnRules
record component.Returns the value of theentityToSpawn
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
entityToSpawn
The field for theentityToSpawn
record component. -
customSpawnRules
The field for thecustomSpawnRules
record component. -
ENTITY_TAG
- See Also:
-
CODEC
-
LIST_CODEC
-
-
Constructor Details
-
SpawnData
public SpawnData() -
SpawnData
Creates an instance of aSpawnData
record class.- Parameters:
entityToSpawn
- the value for theentityToSpawn
record componentcustomSpawnRules
- the value for thecustomSpawnRules
record component
-
-
Method Details
-
getEntityToSpawn
-
getCustomSpawnRules
-
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)
. -
entityToSpawn
Returns the value of theentityToSpawn
record component.- Returns:
- the value of the
entityToSpawn
record component
-
customSpawnRules
Returns the value of thecustomSpawnRules
record component.- Returns:
- the value of the
customSpawnRules
record component
-