mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 16:34:46 +00:00
Create Barrier Abilities + Heavy Refactoring
This commit is contained in:
1 parent
d1f2c9695c
commit
c07e9e7006
53 files changed
+1890
-1460
No files matched your search
@@ -0,0 +1,99 @@
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import kamkeel.npcs.entity.EntityEnergyBarrier;
|
||||
import kamkeel.npcs.entity.EntityEnergyDome;
|
||||
import noppes.npcs.api.entity.IEnergyBarrier;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
|
||||
/**
|
||||
* Base script wrapper for energy barrier entities (Dome, Panel).
|
||||
* All shared methods delegate directly to EntityEnergyBarrier base.
|
||||
*/
|
||||
public class ScriptEnergyBarrier<T extends EntityEnergyBarrier> extends ScriptEnergyAbility<T> implements IEnergyBarrier {
|
||||
|
||||
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 ====================
|
||||
|
||||
public float getDefaultMultiplier() { return entity.getBarrierData().defaultMultiplier; }
|
||||
public void setDefaultMultiplier(float multiplier) { entity.getBarrierData().defaultMultiplier = multiplier; }
|
||||
|
||||
public boolean isKnockbackEnabled() { return entity.getBarrierData().knockbackEnabled; }
|
||||
public void setKnockbackEnabled(boolean enabled) { entity.getBarrierData().knockbackEnabled = enabled; }
|
||||
|
||||
public float getKnockbackStrength() { return entity.getBarrierData().knockbackStrength; }
|
||||
public void setKnockbackStrength(float strength) { entity.getBarrierData().knockbackStrength = strength; }
|
||||
|
||||
public int getKnockbackTarget() { return entity.getBarrierData().knockbackTarget; }
|
||||
public void setKnockbackTarget(int target) { entity.getBarrierData().knockbackTarget = target; }
|
||||
|
||||
public int getBarrierType() {
|
||||
return entity instanceof EntityEnergyDome ? 0 : 1;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user