Class Whirlwind


public class Whirlwind extends RaySpell
  • Constructor Details

    • Whirlwind

      public Whirlwind()
  • Method Details

    • onEntityHit

      protected boolean onEntityHit(CastContext ctx, net.minecraft.world.phys.EntityHitResult entityHit, net.minecraft.world.phys.Vec3 origin)
      Description copied from class: RaySpell
      Called when the ray hits an entity. Override this method to perform an action when the ray hits an entity, such as dealing damage or applying a status effect. Return true if the spell should be considered successfully cast when it hits an entity, or false if the spell should not be cast when it hits an entity (e.g. if you want to prevent casting when the ray is blocked by an uncollidable block and ignoreUncollidables is true).
      Specified by:
      onEntityHit in class RaySpell
      Parameters:
      ctx - The cast context of the spell.
      entityHit - The result of the entity hit, containing information about the hit entity and hit position.
      origin - The starting point of the ray.
      Returns:
      true if the spell should be considered successfully cast when it hits an entity, false if the spell should not be cast when it hits an entity.
    • onMiss

      protected boolean onMiss(CastContext ctx, net.minecraft.world.phys.Vec3 origin, net.minecraft.world.phys.Vec3 direction)
      Description copied from class: RaySpell
      Called when the ray does not hit any entities or blocks. Override this method to perform an action when the ray misses, such as spawning particles at the endpoint. Return true if the spell should be considered successfully cast even when it misses, or false if the spell should not be cast when it misses (e.g. if you want to prevent casting when the ray is blocked by an uncollidable block and ignoreUncollidables is true).
      Specified by:
      onMiss in class RaySpell
      Parameters:
      ctx - The cast context of the spell.
      origin - The starting point of the ray.
      direction - The normalized direction vector of the ray.
      Returns:
      true if the spell should be considered successfully cast even when it misses, false if the spell should not be cast when it misses.
    • onBlockHit

      protected boolean onBlockHit(CastContext ctx, net.minecraft.world.phys.BlockHitResult blockHit, net.minecraft.world.phys.Vec3 origin)
      Description copied from class: RaySpell
      Called when the ray hits a block. Override this method to perform an action when the ray hits a block, such as creating an explosion or spawning particles. Return true if the spell should be considered successfully cast when it hits a block, or false if the spell should not be cast when it hits a block (e.g. if you want to prevent casting when the ray is blocked by an uncollidable block and ignoreUncollidables is true).
      Specified by:
      onBlockHit in class RaySpell
      Parameters:
      ctx - The cast context of the spell.
      blockHit - The result of the block hit, containing information about the hit position and block.
      origin - The starting point of the ray.
      Returns:
      true if the spell should be considered successfully cast when it hits a block, false if the spell should not be cast when it hits a block.
    • canCastByEntity

      public boolean canCastByEntity()
      Description copied from class: Spell
      Whether this spell can be cast by an entity source (e.g. a player or a mob). By default, this returns false, as some spells may be designed to only be cast by non-entity sources, but you can override this to return true if your spell is meant to be cast by entities.
      Overrides:
      canCastByEntity in class RaySpell
      Returns:
      true if this spell can be cast by an entity source, false otherwise.
    • canCastByLocation

      public boolean canCastByLocation()
      Description copied from class: Spell
      Whether this spell can be cast by a non-entity source (e.g. a command block or a dispenser). By default, this returns false, as most spells are meant to be cast by entities, but you can override this to return true if your spell is designed to be cast by non-entity sources.
      Overrides:
      canCastByLocation in class RaySpell
      Returns:
      true if this spell can be cast by a non-entity source, false otherwise.
    • properties

      @NotNull protected @NotNull SpellProperties properties()
      Description copied from class: Spell
      This method is where you should set the default properties for your spell when creating a new spell class. This method is called in the constructor of the Spell class, and the properties returned by this method are assigned to the spell's properties field.
      Specified by:
      properties in class Spell
      Returns:
      A SpellProperties object with the default properties for your spell.