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

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<PartialDetectionLogic>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    PartialDetectionLogic(net.minecraft.core.HolderSet<net.minecraft.world.entity.EntityType<?>> types, float chance)
    Creates an instance of a PartialDetectionLogic record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Returns the value of the chance record component.
    com.mojang.serialization.MapCodec<? extends SpawnDetectionLogic>
    Gets the codec for this detection logic
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    shouldReplaceSpawn(net.neoforged.neoforge.event.entity.EntityJoinLevelEvent event)
    Checks if the spawn should be replaced
    final String
    Returns a string representation of this record class.
    net.minecraft.core.HolderSet<net.minecraft.world.entity.EntityType<?>>
    Returns the value of the types record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • PartialDetectionLogic

      public PartialDetectionLogic(net.minecraft.core.HolderSet<net.minecraft.world.entity.EntityType<?>> types, float chance)
      Creates an instance of a PartialDetectionLogic record class.
      Parameters:
      types - the value for the types record component
      chance - the value for the chance 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 interface SpawnDetectionLogic
      Parameters:
      event - The spawn event
    • codec

      public com.mojang.serialization.MapCodec<? extends SpawnDetectionLogic> codec()
      Description copied from interface: SpawnDetectionLogic
      Gets the codec for this detection logic
      Specified by:
      codec in interface SpawnDetectionLogic
      Returns:
      The codec
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • types

      public net.minecraft.core.HolderSet<net.minecraft.world.entity.EntityType<?>> types()
      Returns the value of the types record component.
      Returns:
      the value of the types record component
    • chance

      public float chance()
      Returns the value of the chance record component.
      Returns:
      the value of the chance record component