mirror of
https://github.com/KAMKEEL/CustomNPC-Plus-API.git
synced 2026-11-16 06:04:45 +00:00
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:
1 parent
66fff09d20
commit
efa8721d36
10 files changed
+402
-5
No files matched your search
@@ -1,6 +1,10 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.api.entity.IEnergyBeam;
|
||||
import noppes.npcs.api.entity.IEnergyDisc;
|
||||
import noppes.npcs.api.entity.IEnergyLaser;
|
||||
import noppes.npcs.api.entity.IEnergyOrb;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.ISound;
|
||||
@@ -445,5 +449,47 @@ public interface IWorld {
|
||||
*/
|
||||
int getDimensionID();
|
||||
|
||||
/**
|
||||
* Creates an energy orb projectile. Not spawned until fire() is called.
|
||||
* @param owner The entity that owns this projectile
|
||||
* @param x Spawn X position
|
||||
* @param y Spawn Y position
|
||||
* @param z Spawn Z position
|
||||
* @param size Orb size
|
||||
*/
|
||||
IEnergyOrb createEnergyOrb(IEntity owner, double x, double y, double z, float size);
|
||||
|
||||
/**
|
||||
* Creates an energy beam projectile. Not spawned until fire() is called.
|
||||
* @param owner The entity that owns this projectile
|
||||
* @param x Spawn X position
|
||||
* @param y Spawn Y position
|
||||
* @param z Spawn Z position
|
||||
* @param beamWidth Width of the beam
|
||||
* @param headSize Size of the beam head
|
||||
*/
|
||||
IEnergyBeam createEnergyBeam(IEntity owner, double x, double y, double z, float beamWidth, float headSize);
|
||||
|
||||
/**
|
||||
* Creates an energy disc projectile. Not spawned until fire() is called.
|
||||
* @param owner The entity that owns this projectile
|
||||
* @param x Spawn X position
|
||||
* @param y Spawn Y position
|
||||
* @param z Spawn Z position
|
||||
* @param radius Disc radius
|
||||
* @param thickness Disc thickness
|
||||
*/
|
||||
IEnergyDisc createEnergyDisc(IEntity owner, double x, double y, double z, float radius, float thickness);
|
||||
|
||||
/**
|
||||
* Creates an energy laser projectile. Not spawned until fire() is called.
|
||||
* @param owner The entity that owns this projectile
|
||||
* @param x Spawn X position
|
||||
* @param y Spawn Y position
|
||||
* @param z Spawn Z position
|
||||
* @param laserWidth Width of the laser
|
||||
*/
|
||||
IEnergyLaser createEnergyLaser(IEntity owner, double x, double y, double z, float laserWidth);
|
||||
|
||||
void broadcast(String message);
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.IBlock;
|
||||
import noppes.npcs.api.entity.IEnergyProjectile;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
|
||||
public interface IEnergyProjectileEvent extends ICustomNPCsEvent {
|
||||
|
||||
IEnergyProjectile getProjectile();
|
||||
|
||||
IEntity getOwner();
|
||||
|
||||
/**
|
||||
* @hookName energyProjectileFired
|
||||
*/
|
||||
interface FiredEvent extends IEnergyProjectileEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* @hookName energyProjectileTick
|
||||
*/
|
||||
interface UpdateEvent extends IEnergyProjectileEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* @hookName energyProjectileEntityImpact
|
||||
*/
|
||||
interface EntityImpactEvent extends IEnergyProjectileEvent {
|
||||
IEntity getTarget();
|
||||
|
||||
float getDamage();
|
||||
|
||||
void setDamage(float damage);
|
||||
}
|
||||
|
||||
/**
|
||||
* @hookName energyProjectileBlockImpact
|
||||
*/
|
||||
interface BlockImpactEvent extends IEnergyProjectileEvent {
|
||||
IBlock getBlock();
|
||||
}
|
||||
|
||||
/**
|
||||
* @hookName energyProjectileExpired
|
||||
*/
|
||||
interface ExpiredEvent extends IEnergyProjectileEvent {
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import noppes.npcs.api.IDamageSource;
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||
|
||||
@@ -20,9 +21,75 @@ public interface IPlayerAbilityEvent extends IPlayerEvent {
|
||||
*/
|
||||
IEntityLivingBase getTarget();
|
||||
|
||||
/**
|
||||
* Fired when a player's ability starts executing (enters WINDUP phase).
|
||||
* Canceling prevents the ability from starting.
|
||||
*
|
||||
* @hookName abilityStart
|
||||
*/
|
||||
@Cancelable
|
||||
interface StartEvent extends IPlayerAbilityEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player's ability enters the ACTIVE phase and performs its effect.
|
||||
* Canceling prevents the ability effect from occurring.
|
||||
*
|
||||
* @hookName abilityExecute
|
||||
*/
|
||||
@Cancelable
|
||||
interface ExecuteEvent extends IPlayerAbilityEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player's ability is interrupted by damage.
|
||||
*
|
||||
* @hookName abilityInterrupt
|
||||
*/
|
||||
interface InterruptEvent extends IPlayerAbilityEvent {
|
||||
/**
|
||||
* Get the damage source that caused the interruption, or null if not damage-triggered.
|
||||
*/
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/**
|
||||
* Get the amount of damage that caused the interruption.
|
||||
*/
|
||||
float getDamage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player's ability completes its full execution cycle.
|
||||
*
|
||||
* @hookName abilityComplete
|
||||
*/
|
||||
interface CompleteEvent extends IPlayerAbilityEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired every tick while a player's ability is executing.
|
||||
* Provides the current phase and tick count.
|
||||
*
|
||||
* @hookName abilityTick
|
||||
*/
|
||||
interface TickEvent extends IPlayerAbilityEvent {
|
||||
/**
|
||||
* Get the current phase of the ability.
|
||||
* 0 = IDLE, 1 = WINDUP, 2 = ACTIVE, 3 = RECOVERY
|
||||
*/
|
||||
int getAbilityPhase();
|
||||
|
||||
/**
|
||||
* Get the current tick count within the phase.
|
||||
*/
|
||||
int getTick();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player's ability hits an entity with damage.
|
||||
* Canceling this event prevents the damage from being applied.
|
||||
*
|
||||
* @hookName abilityHit
|
||||
*/
|
||||
@Cancelable
|
||||
interface HitEvent extends IPlayerAbilityEvent {
|
||||
|
||||
Reference in new issue
Block a user