Add energy projectile types and events: implement IEnergyOrb, IEnergyBeam, IEnergyDisc, and IEnergyLaser interfaces, along with their respective script handlers and event hooks

This commit is contained in:
Kam committed 2026-02-16 01:03:05 -05:00
1 parent 66fff09d20
commit efa8721d36
10 files changed
+402 -5

No files matched your search

@@ -4,6 +4,7 @@ import net.minecraft.entity.EntityCreature;
import noppes.npcs.api.IPos;
import noppes.npcs.api.ITimers;
import noppes.npcs.api.ability.IDataAbilities;
import noppes.npcs.api.entity.IEnergyProjectile;
import noppes.npcs.api.entity.data.IModelData;
import noppes.npcs.api.handler.IActionManager;
import noppes.npcs.api.handler.IOverlayHandler;
@@ -1515,4 +1516,10 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T>,
* @return Ability data
*/
IDataAbilities getAbilityData();
/**
* Returns all active energy projectiles fired by this NPC.
* @return Array of active energy projectiles, empty array if none
*/
IEnergyProjectile[] getActiveEnergyProjectiles();
}
@@ -0,0 +1,23 @@
package noppes.npcs.api.entity;
import net.minecraft.entity.Entity;
/**
* Represents an energy beam projectile - a directional beam with a trailing path.
*/
public interface IEnergyBeam<T extends Entity> extends IEnergyProjectile<T> {
float getBeamWidth();
void setBeamWidth(float width);
float getHeadSize();
void setHeadSize(float size);
boolean isAttachedToOwner();
void setAttachedToOwner(boolean attached);
boolean shouldRenderTailOrb();
}
@@ -0,0 +1,31 @@
package noppes.npcs.api.entity;
import net.minecraft.entity.Entity;
/**
* Represents an energy disc projectile - a flat spinning disc with optional boomerang behavior.
*/
public interface IEnergyDisc<T extends Entity> extends IEnergyProjectile<T> {
float getDiscRadius();
void setDiscRadius(float radius);
float getDiscThickness();
void setDiscThickness(float thickness);
boolean isVertical();
void setVertical(boolean vertical);
boolean isBoomerang();
void setBoomerang(boolean boomerang);
int getBoomerangDelay();
void setBoomerangDelay(int ticks);
boolean isReturning();
}
@@ -0,0 +1,45 @@
package noppes.npcs.api.entity;
import net.minecraft.entity.Entity;
/**
* Represents an energy laser projectile - a fast expanding piercing line.
*/
public interface IEnergyLaser<T extends Entity> extends IEnergyProjectile<T> {
float getLaserWidth();
void setLaserWidth(float width);
float getExpansionSpeed();
void setExpansionSpeed(float speed);
int getLingerTicks();
void setLingerTicks(int ticks);
float getCurrentLength();
boolean isFullyExtended();
double getDirX();
double getDirY();
double getDirZ();
void setDirection(double x, double y, double z);
double getEndX();
double getEndY();
double getEndZ();
float getLingerAlpha();
boolean isLockVerticalDirection();
void setLockVerticalDirection(boolean lock);
}
@@ -0,0 +1,10 @@
package noppes.npcs.api.entity;
import net.minecraft.entity.Entity;
/**
* Represents an energy orb projectile - a spherical homing energy ball.
* Orbs use the base IEnergyProjectile properties with no additional methods.
*/
public interface IEnergyOrb<T extends Entity> extends IEnergyProjectile<T> {
}
@@ -1,35 +1,61 @@
package noppes.npcs.api.entity;
import net.minecraft.entity.Entity;
/**
* Represents an energy projectile entity (Orb, Beam, Disc, Laser).
* Extends IEntity so scripts have full access to both entity and energy-specific methods.
*/
public interface IEnergyProjectile<T extends Entity> extends IEntity<T> {
// ==================== OWNER & TARGET ====================
public interface IEnergyProjectile {
int getOwnerEntityId();
IEntity getOwner();
void setOwner(IEntity owner);
int getTargetEntityId();
IEntity getTarget();
void setTarget(IEntity target);
// ==================== SIZE ====================
float getSize();
double getMotionX();
void setSize(float size);
double getMotionY();
double getMotionZ();
// ==================== DISPLAY ====================
int getInnerColor();
void setInnerColor(int color);
int getOuterColor();
void setOuterColor(int color);
boolean isOuterColorEnabled();
void setOuterColorEnabled(boolean enabled);
float getOuterColorWidth();
void setOuterColorWidth(float width);
float getOuterColorAlpha();
void setOuterColorAlpha(float alpha);
float getRotationSpeed();
void setRotationSpeed(float speed);
// ==================== INTERPOLATION (READ-ONLY) ====================
float getInterpolatedRotationX(float partialTicks);
float getInterpolatedRotationY(float partialTicks);
@@ -38,38 +64,80 @@ public interface IEnergyProjectile {
float getInterpolatedSize(float partialTicks);
// ==================== LIGHTNING ====================
boolean hasLightningEffect();
void setLightningEffect(boolean enabled);
float getLightningDensity();
void setLightningDensity(float density);
float getLightningRadius();
void setLightningRadius(float radius);
int getLightningFadeTime();
void setLightningFadeTime(int ticks);
// ==================== LIFESPAN ====================
float getMaxDistance();
void setMaxDistance(float distance);
int getMaxLifetime();
void setMaxLifetime(int ticks);
// ==================== COMBAT ====================
float getDamage();
void setDamage(float damage);
float getKnockback();
void setKnockback(float knockback);
float getKnockbackUp();
void setKnockbackUp(float knockbackUp);
boolean isExplosive();
void setExplosive(boolean explosive);
float getExplosionRadius();
void setExplosionRadius(float radius);
float getExplosionDamageFalloff();
void setExplosionDamageFalloff(float falloff);
// ==================== MOVEMENT ====================
float getSpeed();
void setSpeed(float speed);
boolean isHoming();
void setHoming(boolean homing);
float getHomingStrength();
void setHomingStrength(float strength);
float getHomingRange();
void setHomingRange(float range);
// ==================== ANCHOR ====================
int getAnchor();
float getAnchorOffsetX();
@@ -78,9 +146,54 @@ public interface IEnergyProjectile {
float getAnchorOffsetZ();
// ==================== POSITION ====================
double getStartX();
double getStartY();
double getStartZ();
// ==================== STATE ====================
boolean hasHit();
boolean isCharging();
float getChargeProgress();
/**
* Returns the energy projectile sub-type.
* 0=Orb, 1=Beam, 2=Disc, 3=Laser
*/
int getEnergyType();
// ==================== FIRE / LAUNCH ====================
/**
* Spawns the projectile in the world (if not yet spawned) and starts it moving toward the target entity.
*/
void fire(IEntity target);
/**
* Spawns the projectile in the world (if not yet spawned) and starts it moving toward the specified coordinates.
*/
void fire(double x, double y, double z);
/**
* Spawns the projectile in the world (if not yet spawned) and starts it moving in the specified direction.
*/
void fire(float yaw, float pitch);
/**
* Sets the owner, positions the projectile at the caster's eye level, and fires in the caster's look direction.
* Convenience method similar to how fireKiAttack works.
*/
void fire(IEntityLivingBase caster);
/**
* Sets the owner, positions the projectile at the caster's eye level, and fires toward the target entity.
*/
void fire(IEntityLivingBase caster, IEntity target);
}
+7
View File
@@ -9,6 +9,7 @@ import noppes.npcs.api.IPos;
import noppes.npcs.api.IScreenSize;
import noppes.npcs.api.ITimers;
import noppes.npcs.api.IWorld;
import noppes.npcs.api.entity.IEnergyProjectile;
import noppes.npcs.api.gui.ICustomGui;
import noppes.npcs.api.handler.IActionManager;
import noppes.npcs.api.handler.IOverlayHandler;
@@ -752,4 +753,10 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>,
* @return The formatted balance string
*/
String getFormattedCurrencyBalance();
/**
* Returns all active energy projectiles fired by this player.
* @return Array of active energy projectiles, empty array if none
*/
IEnergyProjectile[] getActiveEnergyProjectiles();
}