public interface ISpell
Interface that represents a spell.
-
Field Summary
Fields
static final com.mojang.serialization.Codec<ISpell>
-
Method Summary
net.minecraft.nbt.CompoundTag
float
burnout(net.minecraft.world.entity.LivingEntity caster)
cast(net.minecraft.world.entity.LivingEntity caster,
net.minecraft.world.level.Level level,
int castingTicks,
boolean consume,
boolean awardXp)
byte
void
Sets the current shape group index.
boolean
boolean
boolean
boolean
float
mana(net.minecraft.world.entity.LivingEntity caster)
reagents(net.minecraft.world.entity.LivingEntity caster)
-
Field Details
-
SHAPE_GROUPS_KEY
static final String SHAPE_GROUPS_KEY
- See Also:
-
-
CURRENT_SHAPE_GROUP_KEY
static final String CURRENT_SHAPE_GROUP_KEY
- See Also:
-
-
SPELL_STACK_KEY
static final String SPELL_STACK_KEY
- See Also:
-
-
-
CODEC
static final com.mojang.serialization.Codec<ISpell> CODEC
-
-
Method Details
-
isContinuous
boolean isContinuous()
- Returns:
- Whether the spell is continuous or not.
-
isEmpty
boolean isEmpty()
- Returns:
- Whether the spell is empty or not.
-
isNonNull
boolean isNonNull()
- Returns:
- Whether all parts of the spell are non-null.
-
isValid
boolean isValid()
Validates the spell. This checks for non-emptiness of the spell stack, the shape groups being correct, and correct location of modifiers (if present).
- Returns:
- Whether the spell is valid or not.
-
firstShape
- Parameters:
currentShapeGroup - The shape group to get the shape for.
- Returns:
- The first shape of the given shape group.
-
shapeGroup
- Parameters:
shapeGroup - The shape group index to get the shape group for.
- Returns:
- The shape group by the given shape group index.
-
currentShapeGroup
- Returns:
- The currently selected shape group.
-
currentShapeGroupIndex
byte currentShapeGroupIndex()
- Returns:
- The index of the currently selected shape group.
-
currentShapeGroupIndex
void currentShapeGroupIndex(byte shapeGroup)
Sets the current shape group index.
- Parameters:
shapeGroup - The shape group index to set.
-
cast
SpellCastResult cast(net.minecraft.world.entity.LivingEntity caster,
net.minecraft.world.level.Level level,
int castingTicks,
boolean consume,
boolean awardXp)
Casts the spell.
- Parameters:
caster - The player that casts the spell.
level - The level that the caster is in.
castingTicks - The amount of ticks this spell has been cast already.
consume - Whether to consume the spell result or not.
awardXp - Whether to grant the player magic xp or not.
- Returns:
- A SpellCastResult that represents the spell casting outcome.
-
partsWithModifiers
- Returns:
- An unmodifiable list that represents a part list with their corresponding modifiers.
-
mana
float mana(net.minecraft.world.entity.LivingEntity caster)
- Parameters:
caster - The player that casts this spell.
- Returns:
- The amount of mana this spell costs.
-
burnout
float burnout(net.minecraft.world.entity.LivingEntity caster)
- Parameters:
caster - The player that casts this spell.
- Returns:
- The burnout this spell causes.
-
reagents
List<ItemFilter> reagents(net.minecraft.world.entity.LivingEntity caster)
- Returns:
- The reagents of this spell.
-
parts
- Returns:
- The list of spell parts in this spell.
-
shapeGroups
- Returns:
- The list of shape groups in this spell.
-
additionalData
net.minecraft.nbt.CompoundTag additionalData()
- Returns:
- The nbt data for this spell.
-
spellStack
- Returns:
- The spell stack for this spell.
-
recipe
- Returns:
- The recipe for this spell.
-
affinityShifts
- Returns:
- A map from affinity to double, representing the affinity shift of the spell for each affinity.
-
affinities
- Returns:
- A set of affinities containing the affinities of this spell.
-
primaryAffinity
- Returns:
- The affinity that the given spell has the greatest shift in.