Record Class BattleEndCause
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.battles.BattleEndCause
- Record Components:
id
- The id of the causeabnormal
- 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
If you want to end a battle for your own reasoning you should register your own
You should avoid using the
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 Summary
Modifier and TypeFieldDescriptionstatic final BattleEndCause
static final BattleEndCause
static final BattleEndCause
static final BattleEndCause
static final BattleEndCause
static final BattleEndCause
Deprecated.static final BattleEndCause
static final BattleEndCause
static final BattleEndCause
static final BattleEndCause
static final BattleEndCause
static final BattleEndCause
static final BattleEndCause
-
Constructor Summary
ConstructorDescriptionBattleEndCause
(net.minecraft.resources.ResourceLocation id, boolean abnormal) Creates an instance of aBattleEndCause
record class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
abnormal()
Returns the value of theabnormal
record component.static BattleEndCause
Creates a new abnormal battle end cause with the given key and value.static BattleEndCause
abnormal
(net.minecraft.resources.ResourceLocation id) Creates a new abnormal battle end cause with the given id.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.net.minecraft.resources.ResourceLocation
id()
Returns the value of theid
record component.static BattleEndCause
Creates a new normal battle end cause with the given key and value.static BattleEndCause
normal
(net.minecraft.resources.ResourceLocation id) Creates a new normal battle end cause with the given id.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
FORFEIT
-
FLEE
-
NORMAL
-
POKE_BALL_CAPTURE
-
ENTITY_DEATH
-
ENTITY_DESPAWN
-
PLAYER_LOGIN
-
PLAYER_QUIT
-
BATTLE_ERROR
-
COMMAND
-
PLAYER_EDITING_PARTY
-
TOO_FAR_FROM_BATTLE
-
FORCE
Deprecated.
-
-
Constructor Details
-
Method Details
-
normal
Creates a new normal battle end cause with the given key and value.- Parameters:
key
- The namespacevalue
- The path- Returns:
- A new normal battle end cause
-
normal
Creates a new normal battle end cause with the given id.- Parameters:
id
- The id- Returns:
- A new normal battle end cause
-
abnormal
Creates a new abnormal battle end cause with the given key and value.- Parameters:
key
- The namespacevalue
- The path- Returns:
- A new abnormal battle end cause
-
abnormal
Creates a new abnormal battle end cause with the given id.- Parameters:
id
- The id- Returns:
- The new abnormal battle end cause
-
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 '=='. -
id
public net.minecraft.resources.ResourceLocation id()Returns the value of theid
record component.- Returns:
- the value of the
id
record component
-
abnormal
public boolean abnormal()Returns the value of theabnormal
record component.- Returns:
- the value of the
abnormal
record component
-