2026-02-17 14:32:13 -05:00
|
|
|
package noppes.npcs.scripted.entity;
|
|
|
|
|
|
2026-03-01 03:00:17 -05:00
|
|
|
import kamkeel.npcs.entity.EntityEnergyBarrier;
|
|
|
|
|
import kamkeel.npcs.entity.EntityEnergyDome;
|
2026-02-17 14:32:13 -05:00
|
|
|
import noppes.npcs.api.entity.IEnergyBarrier;
|
|
|
|
|
import noppes.npcs.scripted.constants.EntityType;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Base script wrapper for energy barrier entities (Dome, Panel).
|
2026-03-01 03:00:17 -05:00
|
|
|
* All shared methods delegate directly to EntityEnergyBarrier base.
|
2026-02-17 14:32:13 -05:00
|
|
|
*/
|
2026-03-01 03:00:17 -05:00
|
|
|
public class ScriptEnergyBarrier<T extends EntityEnergyBarrier> extends ScriptEnergyAbility<T> implements IEnergyBarrier {
|
2026-02-17 14:32:13 -05:00
|
|
|
|
|
|
|
|
public ScriptEnergyBarrier(T entity) {
|
|
|
|
|
super(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getType() {
|
|
|
|
|
return EntityType.ENERGY_BARRIER;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean typeOf(int type) {
|
|
|
|
|
return type == EntityType.ENERGY_BARRIER || super.typeOf(type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==================== HEALTH ====================
|
|
|
|
|
|
|
|
|
|
public float getCurrentHealth() {
|
|
|
|
|
return entity.getCurrentHealth();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setCurrentHealth(float health) {
|
|
|
|
|
entity.setCurrentHealth(health);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getHealthPercent() {
|
|
|
|
|
return entity.getHealthPercent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getMaxHealth() {
|
|
|
|
|
return entity.getBarrierData().maxHealth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setMaxHealth(float maxHealth) {
|
|
|
|
|
entity.getBarrierData().setMaxHealth(maxHealth);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isUseHealth() {
|
|
|
|
|
return entity.getBarrierData().useHealth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setUseHealth(boolean useHealth) {
|
|
|
|
|
entity.getBarrierData().useHealth = useHealth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==================== DURATION ====================
|
|
|
|
|
|
|
|
|
|
public int getDuration() {
|
|
|
|
|
return entity.getBarrierData().durationTicks;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setDuration(int ticks) {
|
|
|
|
|
entity.getBarrierData().setDurationTicks(ticks);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isUseDuration() {
|
|
|
|
|
return entity.getBarrierData().useDuration;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setUseDuration(boolean useDuration) {
|
|
|
|
|
entity.getBarrierData().useDuration = useDuration;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==================== STATE (BARRIER-SPECIFIC) ====================
|
|
|
|
|
|
|
|
|
|
public int getTicksAlive() {
|
|
|
|
|
return entity.getTicksAlive();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==================== BARRIER ====================
|
|
|
|
|
|
2026-02-18 05:13:51 -05:00
|
|
|
public float getDefaultMultiplier() {
|
|
|
|
|
return entity.getBarrierData().defaultMultiplier;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setDefaultMultiplier(float multiplier) {
|
|
|
|
|
entity.getBarrierData().defaultMultiplier = multiplier;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-21 01:09:39 -05:00
|
|
|
public boolean isSolid() {
|
|
|
|
|
return entity.getBarrierData().solid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setSolid(boolean solid) {
|
|
|
|
|
entity.getBarrierData().solid = solid;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-18 05:13:51 -05:00
|
|
|
public boolean isKnockbackEnabled() {
|
|
|
|
|
return entity.getBarrierData().knockbackEnabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setKnockbackEnabled(boolean enabled) {
|
|
|
|
|
entity.getBarrierData().knockbackEnabled = enabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getKnockbackStrength() {
|
|
|
|
|
return entity.getBarrierData().knockbackStrength;
|
|
|
|
|
}
|
2026-02-17 14:32:13 -05:00
|
|
|
|
2026-02-18 05:13:51 -05:00
|
|
|
public void setKnockbackStrength(float strength) {
|
|
|
|
|
entity.getBarrierData().knockbackStrength = strength;
|
|
|
|
|
}
|
2026-02-17 14:32:13 -05:00
|
|
|
|
2026-02-21 01:09:39 -05:00
|
|
|
public boolean isAbsorbing() {
|
|
|
|
|
return entity.getBarrierData().absorbing;
|
2026-02-18 05:13:51 -05:00
|
|
|
}
|
2026-02-17 14:32:13 -05:00
|
|
|
|
2026-02-21 01:09:39 -05:00
|
|
|
public void setAbsorbing(boolean absorbing) {
|
|
|
|
|
entity.getBarrierData().absorbing = absorbing;
|
2026-02-18 05:13:51 -05:00
|
|
|
}
|
2026-02-17 14:32:13 -05:00
|
|
|
|
2026-03-09 17:26:55 -04:00
|
|
|
public float getAbsorbRadius() {
|
|
|
|
|
return entity.getBarrierData().absorbRadius;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setAbsorbRadius(float radius) {
|
|
|
|
|
entity.getBarrierData().absorbRadius = radius;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-23 00:17:34 -05:00
|
|
|
public boolean isReflect() {
|
|
|
|
|
return entity.getBarrierData().reflect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setReflect(boolean reflect) {
|
|
|
|
|
entity.getBarrierData().reflect = reflect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getReflectStrengthPct() {
|
|
|
|
|
return entity.getBarrierData().reflectStrengthPct;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setReflectStrengthPct(float strengthPct) {
|
|
|
|
|
entity.getBarrierData().setReflectStrengthPct(strengthPct);
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-17 14:32:13 -05:00
|
|
|
public int getBarrierType() {
|
2026-03-01 03:00:17 -05:00
|
|
|
return entity instanceof EntityEnergyDome ? 0 : 1;
|
2026-02-17 14:32:13 -05:00
|
|
|
}
|
2026-03-08 22:49:34 -04:00
|
|
|
|
|
|
|
|
// ==================== SYNC ====================
|
|
|
|
|
|
|
|
|
|
public void syncClient() {
|
|
|
|
|
if (entity.addedToChunk) {
|
|
|
|
|
entity.sendClientSync();
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-02-17 14:32:13 -05:00
|
|
|
}
|