Interface IEnergyProjectile<T extends net.minecraft.entity.Entity>

    • Method Detail

      • setOwner

        void setOwner​(IEntity owner)
        Sets the owner entity (used for homing return, damage attribution, etc.).
        Parameters:
        owner - the entity that owns this projectile
      • getTargetEntityId

        int getTargetEntityId()
        Returns:
        the entity ID of the current homing/tracking target, or -1 if none
      • getTarget

        IEntity getTarget()
        Returns:
        the current homing/tracking target entity, or null if none
      • setTarget

        void setTarget​(IEntity target)
        Sets the homing/tracking target entity. Pass null to clear.
        Parameters:
        target - the entity to home towards
      • getSize

        float getSize()
        Returns:
        the projectile's visual and collision size
      • setSize

        void setSize​(float size)
        Sets the projectile's visual and collision size.
        Parameters:
        size - the projectile size
      • getRotationSpeed

        float getRotationSpeed()
        Returns:
        the visual rotation speed (degrees per tick)
      • setRotationSpeed

        void setRotationSpeed​(float speed)
      • getInterpolatedRotationX

        float getInterpolatedRotationX​(float partialTicks)
      • getInterpolatedRotationY

        float getInterpolatedRotationY​(float partialTicks)
      • getInterpolatedRotationZ

        float getInterpolatedRotationZ​(float partialTicks)
      • getInterpolatedSize

        float getInterpolatedSize​(float partialTicks)
      • getMaxDistance

        float getMaxDistance()
        Returns:
        maximum travel distance before the projectile despawns (0 = unlimited)
      • setMaxDistance

        void setMaxDistance​(float distance)
      • getMaxLifetime

        int getMaxLifetime()
        Returns:
        maximum lifetime in ticks before the projectile despawns (0 = unlimited)
      • setMaxLifetime

        void setMaxLifetime​(int ticks)
      • getDamage

        float getDamage()
        Returns:
        base damage dealt on hit
      • setDamage

        void setDamage​(float damage)
      • getKnockback

        float getKnockback()
        Returns:
        horizontal knockback strength
      • setKnockback

        void setKnockback​(float knockback)
      • getKnockbackUp

        float getKnockbackUp()
        Returns:
        upward knockback strength
      • setKnockbackUp

        void setKnockbackUp​(float knockbackUp)
      • isExplosive

        boolean isExplosive()
        Returns:
        true if the projectile explodes on impact
      • setExplosive

        void setExplosive​(boolean explosive)
      • getExplosionRadius

        float getExplosionRadius()
        Returns:
        explosion radius (only used if isExplosive() is true)
      • setExplosionRadius

        void setExplosionRadius​(float radius)
      • getExplosionDamageFalloff

        float getExplosionDamageFalloff()
        Returns:
        damage falloff multiplier over explosion radius (0 = no falloff, 1 = full falloff)
      • setExplosionDamageFalloff

        void setExplosionDamageFalloff​(float falloff)
      • getHitType

        int getHitType()
        Returns:
        hit behavior type (0 = single hit, 1 = pierce, 2 = multi-hit with delay)
      • setHitType

        void setHitType​(int hitType)
      • getMultiHitDelayTicks

        int getMultiHitDelayTicks()
        Returns:
        ticks between multi-hit damage ticks on the same entity
      • setMultiHitDelayTicks

        void setMultiHitDelayTicks​(int delayTicks)
      • getMaxHits

        int getMaxHits()
        Returns:
        maximum number of entities this projectile can hit (0 = unlimited)
      • setMaxHits

        void setMaxHits​(int maxHits)
      • getSpeed

        float getSpeed()
        Returns:
        travel speed (blocks per tick)
      • setSpeed

        void setSpeed​(float speed)
      • isHoming

        boolean isHoming()
        Returns:
        true if the projectile homes toward its target
      • setHoming

        void setHoming​(boolean homing)
      • getHomingStrength

        float getHomingStrength()
        Returns:
        how aggressively the projectile turns toward its target (higher = tighter turns)
      • setHomingStrength

        void setHomingStrength​(float strength)
      • getHomingRange

        float getHomingRange()
        Returns:
        maximum range at which homing will acquire/track a target
      • setHomingRange

        void setHomingRange​(float range)
      • getAnchor

        int getAnchor()
        Returns:
        anchor point type used during the charge/windup phase
      • getAnchorOffsetX

        float getAnchorOffsetX()
      • getAnchorOffsetY

        float getAnchorOffsetY()
      • getAnchorOffsetZ

        float getAnchorOffsetZ()
      • getStartX

        double getStartX()
        Returns:
        X coordinate where the projectile was launched from
      • getStartY

        double getStartY()
        Returns:
        Y coordinate where the projectile was launched from
      • getStartZ

        double getStartZ()
        Returns:
        Z coordinate where the projectile was launched from
      • hasHit

        boolean hasHit()
        Returns:
        true if the projectile has hit something
      • getEnergyType

        int getEnergyType()
        Returns the energy projectile sub-type.
        Returns:
        0=Orb, 1=Beam, 2=Disc, 3=Laser, 4=Slicer
      • syncClient

        void syncClient()
        Sends all current visual, movement, and position data to tracking clients.

        Call this after making batch changes to properties like size, speed, homing, colors, or type-specific fields (beam width, disc radius, etc.). This avoids sending a separate packet for every setter call.

        Note: fireAt(), fireDirection(), and fireFrom() automatically sync motion when called on an already-spawned projectile, so you do not need to call syncClient() after firing. Use this method when changing properties that affect rendering or movement behavior without re-firing.

        Example:

         orb.setSize(2.0);
         orb.setSpeed(0.5);
         orb.setInnerColor(0xFF0000);
         orb.syncClient(); // one packet for all changes
         
      • fireAt

        void fireAt​(IEntity target)
        Spawns the projectile and launches it from its current position toward the target entity.

        No look-vector repositioning occurs — the projectile fires from exactly where it was placed by createOrb/createBeam/etc. If the target is a living entity, it is also set as the homing target for projectiles with homing enabled.

        To launch from the owner's eye position with look-vector snapping, use fireFrom(IEntityLivingBase, IEntity) instead.

        Parameters:
        target - the entity to fire toward (can be null for untargeted launch)
      • fireAt

        void fireAt​(double x,
                    double y,
                    double z)
        Spawns the projectile and launches it toward the specified world coordinates.

        The projectile fires from its current position — no look-vector repositioning occurs. Motion is calculated as a normalized direction vector scaled by the projectile's speed.

        Parameters:
        x - target X coordinate
        y - target Y coordinate
        z - target Z coordinate
      • fireDirection

        void fireDirection​(float yaw,
                           float pitch)
        Spawns the projectile and launches it in the specified yaw/pitch direction.

        The projectile fires from its current position — no look-vector repositioning occurs.

        Parameters:
        yaw - horizontal angle in degrees (0 = south, 90 = west, like Minecraft yaw)
        pitch - vertical angle in degrees (negative = up, positive = down)
      • fireFrom

        void fireFrom​(IEntityLivingBase caster)
        Sets the owner, positions the projectile at the caster's eye level, and launches it using the entity's full launch sequence (startMoving/startFiring).

        For player-owned projectiles, this snaps the projectile to the owner's look-vector position and fires in the caster's look direction. This is the intended method for "cast from self" behavior. The projectile's position set by createOrb/etc. is overridden.

        Use fireAt(IEntity) or fireAt(double, double, double) instead if you want to launch from a specific custom position.

        Parameters:
        caster - the entity to fire from
      • fireFrom

        void fireFrom​(IEntityLivingBase caster,
                      IEntity target)
        Sets the owner, positions the projectile at the caster's eye level, and launches it toward the target entity using the entity's full launch sequence.

        For player-owned projectiles, this snaps the projectile to the owner's look-vector position before firing toward the target. The projectile's position set by createOrb/etc. is overridden.

        Use fireAt(IEntity) instead if you want to launch from a specific custom position.

        Parameters:
        caster - the entity to fire from
        target - the entity to fire toward