Record Class SpawnReplacement
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.replacement.replacement.SpawnReplacement
- Record Components:
detection- The detection logicreplacement- The replacement logic
public record SpawnReplacement(SpawnDetectionLogic detection, SpawnReplacementLogic replacement)
extends Record
Class containing information for spawn replacements
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSpawnReplacement(SpawnDetectionLogic detection, SpawnReplacementLogic replacement) Creates an instance of aSpawnReplacementrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedetectionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanreplace(net.neoforged.neoforge.event.entity.EntityJoinLevelEvent event) Handles replacing the entityReturns the value of thereplacementrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
-
-
Constructor Details
-
SpawnReplacement
Creates an instance of aSpawnReplacementrecord class.- Parameters:
detection- the value for thedetectionrecord componentreplacement- the value for thereplacementrecord component
-
-
Method Details
-
replace
public boolean replace(net.neoforged.neoforge.event.entity.EntityJoinLevelEvent event) Handles replacing the entity- Parameters:
event- The spawn event
-
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). -
detection
Returns the value of thedetectionrecord component.- Returns:
- the value of the
detectionrecord component
-
replacement
Returns the value of thereplacementrecord component.- Returns:
- the value of the
replacementrecord component
-