Better API Handling for Scripting Energy Utilitizes / Damage Handling

This commit is contained in:
Kam committed 2026-03-03 02:02:12 -05:00
1 parent 465075c631
commit b3dc23a23e
3 files changed
+218

No files matched your search

@@ -0,0 +1,66 @@
package noppes.npcs.api;
import noppes.npcs.api.entity.*;
/**
* Central controller for creating energy entities and routing energy damage.
* Access via API.getEnergyController().
*
* All factory methods create entities that are NOT spawned in the world.
* Configure the entity, then call fire() (projectiles) or spawn() (zones/sweepers/panels)
* to place it in the world.
*/
public interface IEnergyController {
// ==================== PROJECTILE CREATION ====================
/**
* Create an energy orb projectile. Not spawned until fire() is called.
*/
IEnergyOrb createOrb(IWorld world, IEntity owner, double x, double y, double z, float size);
/**
* Create an energy beam projectile. Not spawned until fire() is called.
*/
IEnergyBeam createBeam(IWorld world, IEntity owner, double x, double y, double z, float beamWidth, float headSize);
/**
* Create an energy disc projectile. Not spawned until fire() is called.
*/
IEnergyDisc createDisc(IWorld world, IEntity owner, double x, double y, double z, float radius, float thickness);
/**
* Create an energy laser projectile. Not spawned until fire() is called.
*/
IEnergyLaser createLaser(IWorld world, IEntity owner, double x, double y, double z, float laserWidth);
// ==================== ZONE CREATION ====================
/**
* Create a hazard zone entity with defaults. Not spawned until spawn() is called.
* Hazards deal continuous damage to entities within the zone.
*/
IEnergyZone createHazard(IWorld world, IEntity owner, double x, double y, double z);
/**
* Create a trap zone entity with defaults. Not spawned until spawn() is called.
* Traps trigger when entities enter and deal burst damage.
*/
IEnergyZone createTrap(IWorld world, IEntity owner, double x, double y, double z);
// ==================== SWEEPER CREATION ====================
/**
* Create a sweeper entity with defaults. Not spawned until spawn() is called.
* Sweepers rotate a beam that damages entities in its path.
*/
IEnergySweeper createSweeper(IWorld world, IEntity owner, double x, double y, double z);
// ==================== PANEL CREATION ====================
/**
* Create a panel entity with defaults. Not spawned until spawn() is called.
* Panels are flat energy barriers that can deal damage on contact.
*/
IEnergyPanel createPanel(IWorld world, IEntity owner, double x, double y, double z);
}
@@ -0,0 +1,49 @@
package noppes.npcs.api.entity;
import net.minecraft.entity.Entity;
/**
* Entity-level interface for sweeper beam entities.
* Created via IEnergyController.createSweeper().
* Configure properties, then call spawn() to place in the world.
*/
public interface IEnergySweeper<T extends Entity> extends IEnergyAbility<T> {
// ==================== BEAM DIMENSIONS ====================
float getBeamLength();
void setBeamLength(float length);
float getBeamWidth();
void setBeamWidth(float width);
float getBeamHeight();
void setBeamHeight(float height);
// ==================== ROTATION ====================
float getSweepSpeed();
void setSweepSpeed(float degreesPerTick);
int getNumberOfRotations();
void setNumberOfRotations(int rotations);
boolean isLockOnTarget();
void setLockOnTarget(boolean lock);
// ==================== DAMAGE ====================
float getDamage();
void setDamage(float damage);
int getDamageInterval();
void setDamageInterval(int ticks);
boolean isPiercing();
void setPiercing(boolean piercing);
// ==================== SPAWNING ====================
/** Spawn this sweeper entity into the world. */
void spawn();
}
@@ -0,0 +1,103 @@
package noppes.npcs.api.entity;
import net.minecraft.entity.Entity;
/**
* Entity-level interface for zone entities (Hazard and Trap).
* Created via IEnergyController.createHazard() or createTrap().
* Configure properties, then call spawn() to place in the world.
*/
public interface IEnergyZone<T extends Entity> extends IEntity<T> {
// ==================== ZONE TYPE ====================
/** @return Zone type: 0=Trap, 1=Hazard */
int getZoneType();
// ==================== COMMON ZONE PROPERTIES ====================
/** @return Zone shape: 0=Circle, 1=Square */
int getZoneShape();
void setZoneShape(int shape);
float getRadius();
void setRadius(float radius);
float getZoneHeight();
void setZoneHeight(float height);
int getDuration();
void setDuration(int ticks);
// ==================== COLORS ====================
int getInnerColor();
void setInnerColor(int color);
int getOuterColor();
void setOuterColor(int color);
boolean isOuterColorEnabled();
void setOuterColorEnabled(boolean enabled);
// ==================== VISUALS ====================
float getParticleDensity();
void setParticleDensity(float density);
float getParticleScale();
void setParticleScale(float scale);
float getAnimSpeed();
void setAnimSpeed(float speed);
boolean isIgnoreIFrames();
void setIgnoreIFrames(boolean ignore);
// ==================== HAZARD-SPECIFIC ====================
float getDamagePerSecond();
void setDamagePerSecond(float dps);
int getDamageInterval();
void setDamageInterval(int ticks);
boolean isAffectsCaster();
void setAffectsCaster(boolean affects);
// ==================== TRAP-SPECIFIC ====================
float getTriggerRadius();
void setTriggerRadius(float radius);
int getArmTime();
void setArmTime(int ticks);
int getMaxTriggers();
void setMaxTriggers(int max);
int getTriggerCooldown();
void setTriggerCooldown(int ticks);
float getDamage();
void setDamage(float damage);
float getKnockback();
void setKnockback(float knockback);
boolean isVisible();
void setVisible(boolean visible);
// ==================== CUSTOM DAMAGE DATA ====================
/** Get custom damage data for addon handler routing (e.g. DBC damage stats). */
noppes.npcs.api.INbt getDamageData();
/** Set custom damage data for addon handler routing. */
void setDamageData(noppes.npcs.api.INbt data);
// ==================== SPAWNING ====================
/** Spawn this zone entity into the world. */
void spawn();
}