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 aPartialDetectionLogic
record class. -
Method Summary
Modifier and TypeMethodDescriptionfloat
chance()
Returns the value of thechance
record component.com.mojang.serialization.MapCodec
<? extends SpawnDetectionLogic> codec()
Gets the codec for this detection logicfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
shouldReplaceSpawn
(net.neoforged.neoforge.event.entity.EntityJoinLevelEvent event) Checks if the spawn should be replacedfinal String
toString()
Returns a string representation of this record class.net.minecraft.core.HolderSet
<net.minecraft.world.entity.EntityType<?>> types()
Returns the value of thetypes
record 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 aPartialDetectionLogic
record class.- Parameters:
types
- the value for thetypes
record componentchance
- the value for thechance
record component
-
-
Method Details
-
shouldReplaceSpawn
public boolean shouldReplaceSpawn(net.neoforged.neoforge.event.entity.EntityJoinLevelEvent event) Description copied from interface:SpawnDetectionLogic
Checks if the spawn should be replaced- Specified by:
shouldReplaceSpawn
in interfaceSpawnDetectionLogic
- Parameters:
event
- The spawn event
-
codec
Description copied from interface:SpawnDetectionLogic
Gets the codec for this detection logic- Specified by:
codec
in 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 thetypes
record component.- Returns:
- the value of the
types
record component
-
chance
public float chance()Returns the value of thechance
record component.- Returns:
- the value of the
chance
record component
-