public class BattleRules extends java.lang.Object implements IEncodeable, java.lang.Cloneable
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_NUM_POKEMON |
| Constructor and Description |
|---|
BattleRules()
Initializes a set of default rules.
|
BattleRules(BattleType battleType)
Initializes a set of rules with a specified battle type.
|
BattleRules(java.lang.String text)
Initializes a set of rules from an importable string.
|
| Modifier and Type | Method and Description |
|---|---|
BattleRules |
clone() |
void |
decodeInto(net.minecraft.network.PacketBuffer buf)
Imports rules from a byte array.
|
void |
encodeInto(net.minecraft.network.PacketBuffer buf)
Exports the rules as a byte array.
|
java.lang.String |
exportText()
Exports the rules as human-readable text.
|
<T> java.util.Optional<T> |
get(BattleProperty<T> property) |
java.util.List<java.lang.String> |
getClauseIDs()
Gets a sorted list of clauses by their IDs.
|
java.util.List<BattleClause> |
getClauseList()
Gets a sorted list of clauses.
|
<T> T |
getOrDefault(BattleProperty<T> property) |
boolean |
hasClause(BattleClause clause)
Check if the rules have the given clause as a setting
|
boolean |
hasClause(java.lang.String id)
Check if the rules have a clause with a certain ID.
|
java.lang.String |
importText(java.lang.String text)
Imports a set of rules from text.
|
boolean |
isDefault()
Checks if the rules are the default set of battle rules.
|
void |
readFromNBT(net.minecraft.nbt.CompoundNBT nbt)
Reads rules from NBT data.
|
<T> BattleRules |
set(BattleProperty<T> property,
java.lang.Object o) |
void |
setNewClauses(java.util.List<BattleClause> newClauses)
Adds a new set of clauses to the rules.
|
java.lang.String |
validateSingle(Pokemon pokemon)
Checks if the rules allow a Pokémon to be chosen for battle.
|
java.lang.String |
validateTeam(java.util.List<Pokemon> team)
Checks if the rules allow a list of Pokémon to be chosen for battle.
|
void |
writeToNBT(net.minecraft.nbt.CompoundNBT nbt)
Writes rule data to NBT.
|
public static final int MAX_NUM_POKEMON
public BattleRules()
public BattleRules(BattleType battleType)
battleType - The type of battle to use.public BattleRules(java.lang.String text)
text - The string to import battle rules from.public <T> BattleRules set(BattleProperty<T> property, java.lang.Object o)
public <T> java.util.Optional<T> get(BattleProperty<T> property)
public <T> T getOrDefault(BattleProperty<T> property)
public BattleRules clone()
clone in class java.lang.Objectpublic java.lang.String exportText()
public java.lang.String importText(java.lang.String text)
text - The text to import rules from.public void encodeInto(net.minecraft.network.PacketBuffer buf)
encodeInto in interface IEncodeablebuf - The byte buffer to write to.public void decodeInto(net.minecraft.network.PacketBuffer buf)
decodeInto in interface IEncodeablebuf - The byte buffer to read from.public void writeToNBT(net.minecraft.nbt.CompoundNBT nbt)
nbt - The NBT tag to write to.public void readFromNBT(net.minecraft.nbt.CompoundNBT nbt)
nbt - The NBT data to read from.public java.util.List<BattleClause> getClauseList()
public java.util.List<java.lang.String> getClauseIDs()
public boolean hasClause(BattleClause clause)
clause - The clause being checkedpublic boolean hasClause(java.lang.String id)
id - The clause ID to look for.public void setNewClauses(java.util.List<BattleClause> newClauses)
newClauses - The new clauses to add.public boolean isDefault()
public java.lang.String validateSingle(Pokemon pokemon)
pokemon - The Pokémon to check.public java.lang.String validateTeam(java.util.List<Pokemon> team)
team - The Pokémon to check.