2026-02-16 01:03:05 -05:00
|
|
|
package noppes.npcs.scripted.entity;
|
|
|
|
|
|
|
|
|
|
import kamkeel.npcs.entity.EntityAbilityLaser;
|
|
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
|
|
|
import noppes.npcs.api.entity.IEnergyLaser;
|
|
|
|
|
import noppes.npcs.api.entity.IEntity;
|
|
|
|
|
import noppes.npcs.scripted.constants.EntityType;
|
|
|
|
|
|
|
|
|
|
public class ScriptEnergyLaser<T extends EntityAbilityLaser> extends ScriptEnergyProjectile<T> implements IEnergyLaser {
|
|
|
|
|
|
|
|
|
|
public ScriptEnergyLaser(T entity) {
|
|
|
|
|
super(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getType() {
|
|
|
|
|
return EntityType.ENERGY_LASER;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean typeOf(int type) {
|
|
|
|
|
return type == EntityType.ENERGY_LASER || super.typeOf(type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getEnergyType() {
|
|
|
|
|
return 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==================== LASER-SPECIFIC ====================
|
|
|
|
|
|
2026-02-18 05:13:51 -05:00
|
|
|
public float getLaserWidth() {
|
|
|
|
|
return entity.getLaserWidth();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setLaserWidth(float width) {
|
|
|
|
|
entity.setLaserWidth(width);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getExpansionSpeed() {
|
|
|
|
|
return entity.getExpansionSpeed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setExpansionSpeed(float speed) {
|
|
|
|
|
entity.setExpansionSpeed(speed);
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-25 03:52:20 -05:00
|
|
|
public float getMaxLength() {
|
|
|
|
|
return entity.getMaxLength();
|
2026-02-18 05:13:51 -05:00
|
|
|
}
|
|
|
|
|
|
2026-02-25 03:52:20 -05:00
|
|
|
public void setMaxLength(float maxLength) {
|
|
|
|
|
entity.setMaxLength(maxLength);
|
2026-02-18 05:13:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getCurrentLength() {
|
|
|
|
|
return entity.getCurrentLength();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isFullyExtended() {
|
|
|
|
|
return entity.isFullyExtended();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public double getDirX() {
|
|
|
|
|
return entity.getDirX();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public double getDirY() {
|
|
|
|
|
return entity.getDirY();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public double getDirZ() {
|
|
|
|
|
return entity.getDirZ();
|
|
|
|
|
}
|
2026-02-16 01:03:05 -05:00
|
|
|
|
2026-02-18 05:13:51 -05:00
|
|
|
public void setDirection(double x, double y, double z) {
|
|
|
|
|
entity.setDirection(x, y, z);
|
|
|
|
|
}
|
2026-02-16 01:03:05 -05:00
|
|
|
|
2026-02-18 05:13:51 -05:00
|
|
|
public double getEndX() {
|
|
|
|
|
return entity.getEndX();
|
|
|
|
|
}
|
2026-02-16 01:03:05 -05:00
|
|
|
|
2026-02-18 05:13:51 -05:00
|
|
|
public double getEndY() {
|
|
|
|
|
return entity.getEndY();
|
|
|
|
|
}
|
2026-02-16 01:03:05 -05:00
|
|
|
|
2026-02-18 05:13:51 -05:00
|
|
|
public double getEndZ() {
|
|
|
|
|
return entity.getEndZ();
|
|
|
|
|
}
|
2026-02-16 01:03:05 -05:00
|
|
|
|
|
|
|
|
// ==================== FIRE ====================
|
|
|
|
|
|
|
|
|
|
@Override
|
2026-03-03 17:11:12 -05:00
|
|
|
public void fireAt(IEntity target) {
|
2026-02-16 01:03:05 -05:00
|
|
|
ensureSpawned();
|
|
|
|
|
EntityLivingBase mcTarget = null;
|
|
|
|
|
if (target != null && target.getMCEntity() instanceof EntityLivingBase) {
|
|
|
|
|
mcTarget = (EntityLivingBase) target.getMCEntity();
|
|
|
|
|
}
|
|
|
|
|
entity.startMoving(mcTarget);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2026-03-03 17:11:12 -05:00
|
|
|
public void fireAt(double x, double y, double z) {
|
2026-02-16 01:03:05 -05:00
|
|
|
ensureSpawned();
|
|
|
|
|
double dx = x - entity.posX;
|
|
|
|
|
double dy = y - entity.posY;
|
|
|
|
|
double dz = z - entity.posZ;
|
|
|
|
|
double len = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
|
|
|
if (len > 0) {
|
|
|
|
|
entity.setDirection(dx / len, dy / len, dz / len);
|
|
|
|
|
}
|
|
|
|
|
entity.startMoving(null);
|
|
|
|
|
}
|
|
|
|
|
}
|