package noppes.npcs.api.entity; import net.minecraft.entity.Entity; /** * Base interface for all energy projectile entities (Orb, Beam, Disc, Laser, Slicer). *
* Extends {@link IEnergyAbility} for shared display, lightning, owner, and charging methods. *
* Fire methods — launch from current position (no repositioning): *
* 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: {@code fireAt()}, {@code fireDirection()}, and {@code fireFrom()} * automatically sync motion when called on an already-spawned projectile, * so you do not need to call {@code 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
*
*/
void syncClient();
// ==================== FIRE / LAUNCH ====================
/**
* 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 {@code createOrb}/{@code 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 * {@link #fireFrom(IEntityLivingBase, IEntity)} instead. * * @param target the entity to fire toward (can be null for untargeted launch) */ void fireAt(IEntity target); /** * 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. * * @param x target X coordinate * @param y target Y coordinate * @param z target Z coordinate */ void fireAt(double x, double y, double z); /** * Spawns the projectile and launches it in the specified yaw/pitch direction. *
* The projectile fires from its current position — no look-vector repositioning occurs. * * @param yaw horizontal angle in degrees (0 = south, 90 = west, like Minecraft yaw) * @param pitch vertical angle in degrees (negative = up, positive = down) */ void fireDirection(float yaw, float pitch); /** * Sets the owner, positions the projectile at the caster's eye level, and launches it * using the entity's full launch sequence ({@code startMoving}/{@code 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 {@code createOrb}/etc. is * overridden. *
* Use {@link #fireAt(IEntity)} or {@link #fireAt(double, double, double)} instead if you * want to launch from a specific custom position. * * @param caster the entity to fire from */ void fireFrom(IEntityLivingBase caster); /** * 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 * {@code createOrb}/etc. is overridden. *
* Use {@link #fireAt(IEntity)} instead if you want to launch from a specific custom position. * * @param caster the entity to fire from * @param target the entity to fire toward */ void fireFrom(IEntityLivingBase caster, IEntity target); }