Record Class BattleEndCause

java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.battles.BattleEndCause
Record Components:
id - The id of the cause
abnormal - Whether the cause is abnormal or not (i.e. not a normal battle end, such as a forfeit or flee)

public record BattleEndCause(net.minecraft.resources.ResourceLocation id, boolean abnormal) extends Record
A class representing the cause of a battle ending.
Previously all "abnormal" battle ends were referred to via the FORCE constant, but this has been deprecated as it is not descriptive of the actual cause of the battle ending.
If you want to end a battle for your own reasoning you should register your own BattleEndCause using the {@link com.pixelmonmod.pixelmon.init.registry.PixelmonRegistry#battleEndCause)} registry.
You should avoid using the FORCE constant as it is not descriptive and will likely cause conflicts with other sidemods.
  • Field Details

  • Constructor Details

    • BattleEndCause

      public BattleEndCause(net.minecraft.resources.ResourceLocation id, boolean abnormal)
      Creates an instance of a BattleEndCause record class.
      Parameters:
      id - the value for the id record component
      abnormal - the value for the abnormal record component
  • Method Details

    • normal

      public static BattleEndCause normal(String key, String value)
      Creates a new normal battle end cause with the given key and value.
      Parameters:
      key - The namespace
      value - The path
      Returns:
      A new normal battle end cause
    • normal

      public static BattleEndCause normal(net.minecraft.resources.ResourceLocation id)
      Creates a new normal battle end cause with the given id.
      Parameters:
      id - The id
      Returns:
      A new normal battle end cause
    • abnormal

      public static BattleEndCause abnormal(String key, String value)
      Creates a new abnormal battle end cause with the given key and value.
      Parameters:
      key - The namespace
      value - The path
      Returns:
      A new abnormal battle end cause
    • abnormal

      public static BattleEndCause abnormal(net.minecraft.resources.ResourceLocation id)
      Creates a new abnormal battle end cause with the given id.
      Parameters:
      id - The id
      Returns:
      The new abnormal battle end cause
    • 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.
    • id

      public net.minecraft.resources.ResourceLocation id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • abnormal

      public boolean abnormal()
      Returns the value of the abnormal record component.
      Returns:
      the value of the abnormal record component