public interface ISpell
Interface that represents a spell.
  • Field Details

  • 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

      Optional<ISpellShape> firstShape(byte currentShapeGroup)
      Parameters:
      currentShapeGroup - The shape group to get the shape for.
      Returns:
      The first shape of the given shape group.
    • shapeGroup

      Optional<ShapeGroup> shapeGroup(byte shapeGroup)
      Parameters:
      shapeGroup - The shape group index to get the shape group for.
      Returns:
      The shape group by the given shape group index.
    • currentShapeGroup

      ShapeGroup 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

      @UnmodifiableView List<com.mojang.datafixers.util.Pair<? extends ISpellPart,List<ISpellModifier>>> 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

      default @UnmodifiableView List<ISpellPart> parts()
      Returns:
      The list of spell parts in this spell.
    • shapeGroups

      @Contract(pure=true) @UnmodifiableView List<ShapeGroup> shapeGroups()
      Returns:
      The list of shape groups in this spell.
    • additionalData

      net.minecraft.nbt.CompoundTag additionalData()
      Returns:
      The nbt data for this spell.
    • spellStack

      SpellStack spellStack()
      Returns:
      The spell stack for this spell.
    • recipe

      Returns:
      The recipe for this spell.
    • affinityShifts

      @UnmodifiableView Map<Affinity,Double> affinityShifts()
      Returns:
      A map from affinity to double, representing the affinity shift of the spell for each affinity.
    • affinities

      Set<Affinity> affinities()
      Returns:
      A set of affinities containing the affinities of this spell.
    • primaryAffinity

      Affinity primaryAffinity()
      Returns:
      The affinity that the given spell has the greatest shift in.