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 SummaryNested Classes
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<SpawnData>private final Optional<SpawnData.CustomSpawnRules>The field for thecustomSpawnRulesrecord component.static final Stringprivate final CompoundTagThe field for theentityToSpawnrecord component.static final com.mojang.serialization.Codec<SimpleWeightedRandomList<SpawnData>>
- 
Constructor SummaryConstructorsConstructorDescriptionSpawnData(CompoundTag entityToSpawn, Optional<SpawnData.CustomSpawnRules> customSpawnRules) Creates an instance of aSpawnDatarecord class.
- 
Method SummaryModifier and TypeMethodDescriptionReturns the value of thecustomSpawnRulesrecord component.Returns the value of theentityToSpawnrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
- 
Field Details- 
entityToSpawnThe field for theentityToSpawnrecord component.
- 
customSpawnRulesThe field for thecustomSpawnRulesrecord component.
- 
ENTITY_TAG- See Also:
 
- 
CODEC
- 
LIST_CODEC
 
- 
- 
Constructor Details- 
SpawnDatapublic SpawnData()
- 
SpawnDataCreates an instance of aSpawnDatarecord class.- Parameters:
- entityToSpawn- the value for the- entityToSpawnrecord component
- customSpawnRules- the value for the- customSpawnRulesrecord component
 
 
- 
- 
Method Details- 
getEntityToSpawn
- 
getCustomSpawnRules
- 
toStringReturns 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.
- 
hashCodepublic 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.
- 
equalsIndicates 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).
- 
entityToSpawnReturns the value of theentityToSpawnrecord component.- Returns:
- the value of the entityToSpawnrecord component
 
- 
customSpawnRulesReturns the value of thecustomSpawnRulesrecord component.- Returns:
- the value of the customSpawnRulesrecord component
 
 
-