Record Class PartialDetectionLogic
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.replacement.detection.PartialDetectionLogic
- All Implemented Interfaces:
SpawnDetectionLogic
public record PartialDetectionLogic(net.minecraft.core.HolderSet<net.minecraft.world.entity.EntityType<?>> types, float chance)
extends Record
implements SpawnDetectionLogic
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<PartialDetectionLogic> -
Constructor Summary
ConstructorsConstructorDescriptionPartialDetectionLogic(net.minecraft.core.HolderSet<net.minecraft.world.entity.EntityType<?>> types, float chance) Creates an instance of aPartialDetectionLogicrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfloatchance()Returns the value of thechancerecord component.com.mojang.serialization.MapCodec<? extends SpawnDetectionLogic> codec()Gets the codec for this detection logicfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanshouldReplaceSpawn(net.neoforged.neoforge.event.entity.EntityJoinLevelEvent event) Checks if the spawn should be replacedfinal StringtoString()Returns a string representation of this record class.net.minecraft.core.HolderSet<net.minecraft.world.entity.EntityType<?>> types()Returns the value of thetypesrecord component.
-
Field Details
-
CODEC
-
-
Constructor Details
-
PartialDetectionLogic
public PartialDetectionLogic(net.minecraft.core.HolderSet<net.minecraft.world.entity.EntityType<?>> types, float chance) Creates an instance of aPartialDetectionLogicrecord class.- Parameters:
types- the value for thetypesrecord componentchance- the value for thechancerecord component
-
-
Method Details
-
shouldReplaceSpawn
public boolean shouldReplaceSpawn(net.neoforged.neoforge.event.entity.EntityJoinLevelEvent event) Description copied from interface:SpawnDetectionLogicChecks if the spawn should be replaced- Specified by:
shouldReplaceSpawnin interfaceSpawnDetectionLogic- Parameters:
event- The spawn event
-
codec
Description copied from interface:SpawnDetectionLogicGets the codec for this detection logic- Specified by:
codecin interfaceSpawnDetectionLogic- Returns:
- The codec
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
types
public net.minecraft.core.HolderSet<net.minecraft.world.entity.EntityType<?>> types()Returns the value of thetypesrecord component.- Returns:
- the value of the
typesrecord component
-
chance
public float chance()Returns the value of thechancerecord component.- Returns:
- the value of the
chancerecord component
-