mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-25 15:44:30 +00:00
Another MEGA COMMIT to Core Structure
This commit is contained in:
1 parent
cb6e1ca386
commit
3a8b75f152
79 files changed
+4557
-96
No files matched your search
@@ -18,6 +18,7 @@ import noppes.npcs.api.handler.ITelegraphHandler;
|
||||
import noppes.npcs.scripted.ScriptTelegraph;
|
||||
import noppes.npcs.scripted.ScriptTelegraphInstance;
|
||||
import noppes.npcs.util.NBTJsonUtil;
|
||||
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
@@ -252,7 +253,7 @@ public class TelegraphController implements ITelegraphHandler {
|
||||
if (!file.isFile() || !file.getName().endsWith(".json")) continue;
|
||||
try {
|
||||
Telegraph telegraph = new Telegraph();
|
||||
telegraph.readNBT(NBTJsonUtil.LoadFile(file));
|
||||
telegraph.readNBT(new MC1710NBTCompound(NBTJsonUtil.LoadFile(file)));
|
||||
String name = file.getName().substring(0, file.getName().length() - 5);
|
||||
telegraph.setId(name);
|
||||
savedTelegraphs.put(name, telegraph);
|
||||
@@ -274,7 +275,7 @@ public class TelegraphController implements ITelegraphHandler {
|
||||
File file = new File(dir, name + ".json_new");
|
||||
File file2 = new File(dir, name + ".json");
|
||||
|
||||
NBTJsonUtil.SaveFile(file, telegraph.writeNBT());
|
||||
NBTJsonUtil.SaveFile(file, ((MC1710NBTCompound) telegraph.writeNBT()).getMCTag());
|
||||
if (file2.exists()) {
|
||||
file2.delete();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import kamkeel.npcs.controllers.data.ability.enums.AnchorPoint;
|
||||
import kamkeel.npcs.controllers.data.ability.data.energy.EnergyAnchorData;
|
||||
import kamkeel.npcs.controllers.data.ability.data.energy.EnergyDisplayData;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
|
||||
|
||||
/**
|
||||
* Per-projectile data: anchor point + optional color override.
|
||||
@@ -36,7 +37,7 @@ public class ProjectileData {
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
anchor.writeNBT(nbt);
|
||||
anchor.writeNBT(new MC1710NBTCompound(nbt));
|
||||
nbt.setBoolean("colorOverride", colorOverride);
|
||||
if (colorOverride) {
|
||||
nbt.setInteger("overrideInnerColor", innerColor);
|
||||
@@ -45,7 +46,7 @@ public class ProjectileData {
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
anchor.readNBT(nbt);
|
||||
anchor.readNBT(new MC1710NBTCompound(nbt));
|
||||
colorOverride = nbt.getBoolean("colorOverride");
|
||||
if (colorOverride) {
|
||||
innerColor = nbt.getInteger("overrideInnerColor");
|
||||
|
||||
-118
@@ -1,118 +0,0 @@
|
||||
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||
|
||||
import kamkeel.npcs.controllers.data.ability.enums.AnchorPoint;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.ability.data.IEnergyAnchorData;
|
||||
|
||||
public class EnergyAnchorData implements IEnergyAnchorData {
|
||||
public AnchorPoint anchorPoint = AnchorPoint.FRONT;
|
||||
public float anchorOffsetX = 0;
|
||||
public float anchorOffsetY = 0;
|
||||
public float anchorOffsetZ = 0;
|
||||
public boolean launchFromAnchor = false;
|
||||
|
||||
public EnergyAnchorData() {
|
||||
}
|
||||
|
||||
public EnergyAnchorData(AnchorPoint anchorPoint) {
|
||||
this.anchorPoint = anchorPoint;
|
||||
}
|
||||
|
||||
public EnergyAnchorData(AnchorPoint anchorPoint, float anchorOffsetX, float anchorOffsetY, float anchorOffsetZ) {
|
||||
this.anchorPoint = anchorPoint;
|
||||
this.anchorOffsetX = anchorOffsetX;
|
||||
this.anchorOffsetY = anchorOffsetY;
|
||||
this.anchorOffsetZ = anchorOffsetZ;
|
||||
}
|
||||
|
||||
public EnergyAnchorData(int anchorPoint) {
|
||||
this.anchorPoint = AnchorPoint.fromOrdinal(anchorPoint);
|
||||
}
|
||||
|
||||
public EnergyAnchorData(int anchorPoint, float anchorOffsetX, float anchorOffsetY, float anchorOffsetZ) {
|
||||
this.anchorPoint = AnchorPoint.fromOrdinal(anchorPoint);
|
||||
this.anchorOffsetX = anchorOffsetX;
|
||||
this.anchorOffsetY = anchorOffsetY;
|
||||
this.anchorOffsetZ = anchorOffsetZ;
|
||||
}
|
||||
|
||||
public AnchorPoint getAnchorPoint() {
|
||||
return anchorPoint;
|
||||
}
|
||||
|
||||
public void setAnchorPoint(AnchorPoint anchorPoint) {
|
||||
this.anchorPoint = anchorPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAnchor() {
|
||||
return anchorPoint.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnchor(int anchor) {
|
||||
this.anchorPoint = AnchorPoint.fromOrdinal(anchor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAnchorOffsetX() {
|
||||
return anchorOffsetX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnchorOffsetX(float anchorOffsetX) {
|
||||
this.anchorOffsetX = anchorOffsetX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAnchorOffsetY() {
|
||||
return anchorOffsetY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnchorOffsetY(float anchorOffsetY) {
|
||||
this.anchorOffsetY = anchorOffsetY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAnchorOffsetZ() {
|
||||
return anchorOffsetZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnchorOffsetZ(float anchorOffsetZ) {
|
||||
this.anchorOffsetZ = anchorOffsetZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getLaunchFromAnchor() {
|
||||
return launchFromAnchor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLaunchFromAnchor(boolean launchFromAnchor) {
|
||||
this.launchFromAnchor = launchFromAnchor;
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
nbt.setInteger("anchorPoint", anchorPoint.ordinal());
|
||||
nbt.setFloat("anchorOffsetX", anchorOffsetX);
|
||||
nbt.setFloat("anchorOffsetY", anchorOffsetY);
|
||||
nbt.setFloat("anchorOffsetZ", anchorOffsetZ);
|
||||
nbt.setBoolean("launchFromAnchor", launchFromAnchor);
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
this.anchorPoint = AnchorPoint.fromOrdinal(nbt.getInteger("anchorPoint"));
|
||||
this.anchorOffsetX = nbt.getFloat("anchorOffsetX");
|
||||
this.anchorOffsetY = nbt.getFloat("anchorOffsetY");
|
||||
this.anchorOffsetZ = nbt.getFloat("anchorOffsetZ");
|
||||
this.launchFromAnchor = nbt.getBoolean("launchFromAnchor");
|
||||
}
|
||||
|
||||
public EnergyAnchorData copy() {
|
||||
EnergyAnchorData copy = new EnergyAnchorData(anchorPoint, anchorOffsetX, anchorOffsetY, anchorOffsetZ);
|
||||
copy.launchFromAnchor = this.launchFromAnchor;
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
-234
@@ -1,234 +0,0 @@
|
||||
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Groups barrier properties shared by energy barrier abilities (Dome, Wall, Shield).
|
||||
* Handles health/durability, duration, and per-projectile-type damage multipliers.
|
||||
*
|
||||
* Properties:
|
||||
* - Solid: Hard wall — entities cannot pass through the barrier boundary (either direction)
|
||||
* - Knockback: Repulsion field — entities near the surface get pushed away
|
||||
* - Absorbing: Caster's incoming damage is redirected to the barrier
|
||||
* - Allows Melee: Barrier can be hit by melee attacks (punching)
|
||||
*/
|
||||
public class EnergyBarrierData {
|
||||
|
||||
public float maxHealth = 100.0f;
|
||||
public boolean useHealth = true;
|
||||
public int durationTicks = 200;
|
||||
public boolean useDuration = true;
|
||||
public float defaultMultiplier = 1.0f;
|
||||
|
||||
// Solid: entities cannot pass through the barrier boundary
|
||||
public boolean solid = false;
|
||||
|
||||
// Knockback: repulsion field pushing entities away from surface
|
||||
public boolean knockbackEnabled = false;
|
||||
public float knockbackStrength = 1.0f;
|
||||
|
||||
// Absorbing: caster's damage is redirected to the barrier
|
||||
public boolean absorbing = false;
|
||||
// Absorb radius: max distance from barrier's current position for absorption to work
|
||||
// -1 = no radius limit (absorb regardless of distance)
|
||||
// 0 = use barrier's own extent as the radius (dome radius, panel half-size, etc.)
|
||||
// positive = owner must be within this many blocks of the barrier entity
|
||||
public float absorbRadius = 0.0f;
|
||||
|
||||
// Melee: barrier can be hit by melee attacks
|
||||
public boolean meleeEnabled = false;
|
||||
public float meleeDamageMultiplier = 1.0f;
|
||||
|
||||
// Reflection: rebound projectiles that fail to break the barrier
|
||||
public boolean reflect = false;
|
||||
public float reflectStrengthPct = 25.0f;
|
||||
public boolean targetOwner = false;
|
||||
|
||||
/**
|
||||
* Per-projectile-type damage multipliers.
|
||||
* Key is the ability typeId (e.g., "ability.cnpc.orb", "ability.cnpc.beam").
|
||||
* Value is the multiplier applied to damage dealt to this barrier.
|
||||
*/
|
||||
private Map<String, Float> damageMultipliers = new HashMap<>();
|
||||
|
||||
public EnergyBarrierData() {
|
||||
}
|
||||
|
||||
public EnergyBarrierData(float maxHealth, boolean useHealth, int durationTicks, boolean useDuration) {
|
||||
this.maxHealth = maxHealth;
|
||||
this.useHealth = useHealth;
|
||||
this.durationTicks = durationTicks;
|
||||
this.useDuration = useDuration;
|
||||
}
|
||||
|
||||
// ==================== MULTIPLIER METHODS ====================
|
||||
|
||||
public float getMultiplier(String abilityTypeId) {
|
||||
Float mult = damageMultipliers.get(abilityTypeId);
|
||||
return mult != null ? mult : defaultMultiplier;
|
||||
}
|
||||
|
||||
public void setMultiplier(String abilityTypeId, float multiplier) {
|
||||
damageMultipliers.put(abilityTypeId, multiplier);
|
||||
}
|
||||
|
||||
public void removeMultiplier(String abilityTypeId) {
|
||||
damageMultipliers.remove(abilityTypeId);
|
||||
}
|
||||
|
||||
public Map<String, Float> getDamageMultipliers() {
|
||||
return damageMultipliers;
|
||||
}
|
||||
|
||||
public void setDamageMultipliers(Map<String, Float> multipliers) {
|
||||
this.damageMultipliers = multipliers != null ? multipliers : new HashMap<>();
|
||||
}
|
||||
|
||||
// ==================== GETTERS & SETTERS ====================
|
||||
|
||||
public float getMaxHealth() {
|
||||
return maxHealth;
|
||||
}
|
||||
|
||||
public void setMaxHealth(float maxHealth) {
|
||||
this.maxHealth = Math.max(1.0f, maxHealth);
|
||||
}
|
||||
|
||||
public boolean isUseHealth() {
|
||||
return useHealth;
|
||||
}
|
||||
|
||||
public void setUseHealth(boolean useHealth) {
|
||||
this.useHealth = useHealth;
|
||||
}
|
||||
|
||||
public int getDurationTicks() {
|
||||
return durationTicks;
|
||||
}
|
||||
|
||||
public void setDurationTicks(int durationTicks) {
|
||||
this.durationTicks = Math.max(1, durationTicks);
|
||||
}
|
||||
|
||||
public boolean isUseDuration() {
|
||||
return useDuration;
|
||||
}
|
||||
|
||||
public void setUseDuration(boolean useDuration) {
|
||||
this.useDuration = useDuration;
|
||||
}
|
||||
|
||||
public float getDefaultMultiplier() {
|
||||
return defaultMultiplier;
|
||||
}
|
||||
|
||||
public void setDefaultMultiplier(float defaultMultiplier) {
|
||||
this.defaultMultiplier = defaultMultiplier;
|
||||
}
|
||||
|
||||
public boolean isReflect() {
|
||||
return reflect;
|
||||
}
|
||||
|
||||
public void setReflect(boolean reflect) {
|
||||
this.reflect = reflect;
|
||||
}
|
||||
|
||||
public float getReflectStrengthPct() {
|
||||
return reflectStrengthPct;
|
||||
}
|
||||
|
||||
public void setReflectStrengthPct(float reflectStrengthPct) {
|
||||
this.reflectStrengthPct = Math.max(0.0f, Math.min(100.0f, reflectStrengthPct));
|
||||
}
|
||||
|
||||
public boolean isTargetOwner() {
|
||||
return targetOwner;
|
||||
}
|
||||
|
||||
public void setTargetOwner(boolean targetOwner) {
|
||||
this.targetOwner = targetOwner;
|
||||
}
|
||||
|
||||
public float getAbsorbRadius() {
|
||||
return absorbRadius;
|
||||
}
|
||||
|
||||
public void setAbsorbRadius(float absorbRadius) {
|
||||
this.absorbRadius = absorbRadius;
|
||||
}
|
||||
|
||||
// ==================== NBT ====================
|
||||
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
nbt.setFloat("barrierMaxHealth", maxHealth);
|
||||
nbt.setBoolean("barrierUseHealth", useHealth);
|
||||
nbt.setInteger("barrierDuration", durationTicks);
|
||||
nbt.setBoolean("barrierUseDuration", useDuration);
|
||||
nbt.setFloat("barrierDefaultMult", defaultMultiplier);
|
||||
nbt.setBoolean("barrierSolid", solid);
|
||||
nbt.setBoolean("barrierKnockback", knockbackEnabled);
|
||||
nbt.setFloat("barrierKnockbackStr", knockbackStrength);
|
||||
nbt.setBoolean("barrierAbsorbing", absorbing);
|
||||
nbt.setFloat("barrierAbsorbRadius", absorbRadius);
|
||||
nbt.setBoolean("barrierMelee", meleeEnabled);
|
||||
nbt.setFloat("barrierMeleeMult", meleeDamageMultiplier);
|
||||
nbt.setBoolean("barrierReflect", reflect);
|
||||
nbt.setFloat("barrierReflectStrPct", reflectStrengthPct);
|
||||
nbt.setBoolean("barrierTargetOwner", targetOwner);
|
||||
|
||||
NBTTagCompound multNbt = new NBTTagCompound();
|
||||
for (Map.Entry<String, Float> entry : damageMultipliers.entrySet()) {
|
||||
multNbt.setFloat(entry.getKey(), entry.getValue());
|
||||
}
|
||||
nbt.setTag("barrierMultipliers", multNbt);
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
maxHealth = nbt.hasKey("barrierMaxHealth") ? nbt.getFloat("barrierMaxHealth") : 100.0f;
|
||||
useHealth = !nbt.hasKey("barrierUseHealth") || nbt.getBoolean("barrierUseHealth");
|
||||
durationTicks = nbt.hasKey("barrierDuration") ? nbt.getInteger("barrierDuration") : 200;
|
||||
useDuration = !nbt.hasKey("barrierUseDuration") || nbt.getBoolean("barrierUseDuration");
|
||||
defaultMultiplier = nbt.hasKey("barrierDefaultMult") ? nbt.getFloat("barrierDefaultMult") : 1.0f;
|
||||
solid = nbt.hasKey("barrierSolid") && nbt.getBoolean("barrierSolid");
|
||||
knockbackEnabled = nbt.hasKey("barrierKnockback") && nbt.getBoolean("barrierKnockback");
|
||||
knockbackStrength = nbt.hasKey("barrierKnockbackStr") ? nbt.getFloat("barrierKnockbackStr") : 1.0f;
|
||||
absorbing = nbt.hasKey("barrierAbsorbing") && nbt.getBoolean("barrierAbsorbing");
|
||||
absorbRadius = nbt.hasKey("barrierAbsorbRadius") ? nbt.getFloat("barrierAbsorbRadius") : 0.0f;
|
||||
meleeEnabled = nbt.hasKey("barrierMelee") && nbt.getBoolean("barrierMelee");
|
||||
meleeDamageMultiplier = nbt.hasKey("barrierMeleeMult") ? nbt.getFloat("barrierMeleeMult") : 1.0f;
|
||||
reflect = nbt.hasKey("barrierReflect") && nbt.getBoolean("barrierReflect");
|
||||
setReflectStrengthPct(nbt.hasKey("barrierReflectStrPct") ? nbt.getFloat("barrierReflectStrPct") : 25.0f);
|
||||
targetOwner = nbt.hasKey("barrierTargetOwner") && nbt.getBoolean("barrierTargetOwner");
|
||||
|
||||
damageMultipliers.clear();
|
||||
if (nbt.hasKey("barrierMultipliers")) {
|
||||
NBTTagCompound multNbt = nbt.getCompoundTag("barrierMultipliers");
|
||||
@SuppressWarnings("unchecked")
|
||||
java.util.Set<String> keys = multNbt.func_150296_c();
|
||||
for (String key : keys) {
|
||||
damageMultipliers.put(key, multNbt.getFloat(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EnergyBarrierData copy() {
|
||||
EnergyBarrierData copy = new EnergyBarrierData(maxHealth, useHealth, durationTicks, useDuration);
|
||||
copy.defaultMultiplier = defaultMultiplier;
|
||||
copy.solid = solid;
|
||||
copy.knockbackEnabled = knockbackEnabled;
|
||||
copy.knockbackStrength = knockbackStrength;
|
||||
copy.absorbing = absorbing;
|
||||
copy.absorbRadius = absorbRadius;
|
||||
copy.meleeEnabled = meleeEnabled;
|
||||
copy.meleeDamageMultiplier = meleeDamageMultiplier;
|
||||
copy.reflect = reflect;
|
||||
copy.reflectStrengthPct = reflectStrengthPct;
|
||||
copy.targetOwner = targetOwner;
|
||||
copy.damageMultipliers = new HashMap<>(damageMultipliers);
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
-83
@@ -1,83 +0,0 @@
|
||||
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class EnergyChargingData {
|
||||
|
||||
public int chargeDuration = 60;
|
||||
public int chargeDelay = 0;
|
||||
public int maxCharge = 100;
|
||||
public boolean hasCharge = true;
|
||||
public boolean chargeWindUpSync = true;
|
||||
|
||||
public EnergyChargingData() {
|
||||
}
|
||||
|
||||
public EnergyChargingData(int chargeDuration, int chargeDelay, int maxCharge, boolean hasCharge, boolean chargeWindUpSync) {
|
||||
this.chargeDuration = chargeDuration;
|
||||
this.chargeDelay = chargeDelay;
|
||||
this.maxCharge = maxCharge;
|
||||
this.hasCharge = hasCharge;
|
||||
this.chargeWindUpSync = chargeWindUpSync;
|
||||
}
|
||||
|
||||
public boolean hasCharge() {
|
||||
return hasCharge;
|
||||
}
|
||||
|
||||
public void setHasCharge(boolean hasCharge) {
|
||||
this.hasCharge = hasCharge;
|
||||
}
|
||||
|
||||
public boolean isChargeWindUpSync() {
|
||||
return chargeWindUpSync;
|
||||
}
|
||||
|
||||
public void setChargeWindUpSync(boolean chargeWindUpSync) {
|
||||
this.chargeWindUpSync = chargeWindUpSync;
|
||||
}
|
||||
|
||||
public int getChargeDuration() {
|
||||
return chargeDuration;
|
||||
}
|
||||
|
||||
public void setChargeDuration(int chargeDuration) {
|
||||
this.chargeDuration = chargeDuration;
|
||||
}
|
||||
|
||||
public int getChargeDelay() {
|
||||
return chargeDelay;
|
||||
}
|
||||
|
||||
public void setChargeDelay(int chargeDelay) {
|
||||
this.chargeDelay = chargeDelay;
|
||||
}
|
||||
|
||||
public int getMaxCharge() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
public void setMaxCharge(int maxCharge) {
|
||||
this.maxCharge = Math.max(0, maxCharge);
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
nbt.setInteger("chargeDuration", chargeDuration);
|
||||
nbt.setInteger("chargeDelay", chargeDelay);
|
||||
nbt.setInteger("maxCharge", maxCharge);
|
||||
nbt.setBoolean("hasCharge", hasCharge);
|
||||
nbt.setBoolean("chargeWindUpSync", chargeWindUpSync);
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
chargeDuration = nbt.hasKey("chargeDuration") ? nbt.getInteger("chargeDuration") : 60;
|
||||
chargeDelay = nbt.hasKey("chargeDelay") ? nbt.getInteger("chargeDelay") : 0;
|
||||
maxCharge = nbt.hasKey("maxCharge") ? nbt.getInteger("maxCharge") : 100;
|
||||
hasCharge = !nbt.hasKey("hasCharge") || nbt.getBoolean("hasCharge");
|
||||
chargeWindUpSync = !nbt.hasKey("chargeWindUpSync") || nbt.getBoolean("chargeWindUpSync");
|
||||
}
|
||||
|
||||
public EnergyChargingData copy() {
|
||||
return new EnergyChargingData(chargeDuration, chargeDelay, maxCharge, hasCharge, chargeWindUpSync);
|
||||
}
|
||||
}
|
||||
-176
@@ -1,176 +0,0 @@
|
||||
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||
|
||||
import kamkeel.npcs.controllers.data.ability.enums.HitType;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.ability.data.IEnergyCombatData;
|
||||
|
||||
/**
|
||||
* Groups combat properties shared by energy projectile abilities.
|
||||
* Used as a parameter object for entity constructors and ability configuration.
|
||||
*/
|
||||
public class EnergyCombatData implements IEnergyCombatData {
|
||||
public static final float MAX_EXPLOSION_RADIUS = 15.0f;
|
||||
public static final int DEFAULT_MAX_HITS = 5;
|
||||
public static final int MAX_HITS = 200;
|
||||
|
||||
public float damage = 7.0f;
|
||||
public float knockback = 1.0f;
|
||||
public float knockbackUp = 0.1f;
|
||||
public boolean explosive = false;
|
||||
public float explosionRadius = 3.0f;
|
||||
public float explosionDamageFalloff = 0.5f;
|
||||
public HitType hitType = HitType.SINGLE;
|
||||
public int multiHitDelayTicks = 5;
|
||||
public int maxHits = DEFAULT_MAX_HITS;
|
||||
|
||||
public EnergyCombatData() {
|
||||
}
|
||||
|
||||
public EnergyCombatData(float damage, float knockback, float knockbackUp,
|
||||
boolean explosive, float explosionRadius, float explosionDamageFalloff,
|
||||
HitType hitType, int multiHitDelay) {
|
||||
this(damage, knockback, knockbackUp, explosive, explosionRadius, explosionDamageFalloff, hitType, multiHitDelay, DEFAULT_MAX_HITS);
|
||||
}
|
||||
|
||||
public EnergyCombatData(float damage, float knockback, float knockbackUp,
|
||||
boolean explosive, float explosionRadius, float explosionDamageFalloff,
|
||||
HitType hitType, int multiHitDelay, int maxHits) {
|
||||
this.damage = damage;
|
||||
this.knockback = knockback;
|
||||
this.knockbackUp = knockbackUp;
|
||||
this.explosive = explosive;
|
||||
this.explosionRadius = clampExplosionRadius(explosionRadius);
|
||||
this.explosionDamageFalloff = explosionDamageFalloff;
|
||||
this.hitType = hitType;
|
||||
this.multiHitDelayTicks = multiHitDelay;
|
||||
this.maxHits = clampMaxHits(maxHits);
|
||||
}
|
||||
|
||||
public EnergyCombatData(float damage, float knockback, float knockbackUp,
|
||||
boolean explosive, float explosionRadius, float explosionDamageFalloff) {
|
||||
this.damage = damage;
|
||||
this.knockback = knockback;
|
||||
this.knockbackUp = knockbackUp;
|
||||
this.explosive = explosive;
|
||||
this.explosionRadius = clampExplosionRadius(explosionRadius);
|
||||
this.explosionDamageFalloff = explosionDamageFalloff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamage() {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDamage(float damage) {
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getKnockback() {
|
||||
return knockback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setKnockback(float knockback) {
|
||||
this.knockback = knockback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getKnockbackUp() {
|
||||
return knockbackUp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setKnockbackUp(float knockbackUp) {
|
||||
this.knockbackUp = knockbackUp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExplosive() {
|
||||
return explosive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExplosive(boolean explosive) {
|
||||
this.explosive = explosive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExplosionRadius() {
|
||||
return explosionRadius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExplosionRadius(float explosionRadius) {
|
||||
this.explosionRadius = clampExplosionRadius(explosionRadius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExplosionDamageFalloff() {
|
||||
return explosionDamageFalloff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExplosionDamageFalloff(float explosionDamageFalloff) {
|
||||
this.explosionDamageFalloff = explosionDamageFalloff;
|
||||
}
|
||||
|
||||
public int getMaxHits() {
|
||||
return maxHits;
|
||||
}
|
||||
|
||||
public void setMaxHits(int maxHits) {
|
||||
this.maxHits = clampMaxHits(maxHits);
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
nbt.setFloat("damage", damage);
|
||||
nbt.setFloat("knockback", knockback);
|
||||
nbt.setFloat("knockbackUp", knockbackUp);
|
||||
nbt.setBoolean("explosive", explosive);
|
||||
nbt.setFloat("explosionRadius", explosionRadius);
|
||||
nbt.setFloat("explosionDamageFalloff", explosionDamageFalloff);
|
||||
nbt.setInteger("hitType", hitType.ordinal());
|
||||
nbt.setInteger("multiHitDelayTicks", multiHitDelayTicks);
|
||||
nbt.setInteger("maxHits", maxHits);
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
damage = nbt.hasKey("damage") ? nbt.getFloat("damage") : 7.0f;
|
||||
knockback = nbt.hasKey("knockback") ? nbt.getFloat("knockback") : 1.0f;
|
||||
knockbackUp = nbt.hasKey("knockbackUp") ? nbt.getFloat("knockbackUp") : 0.1f;
|
||||
explosive = nbt.hasKey("explosive") && nbt.getBoolean("explosive");
|
||||
explosionRadius = nbt.hasKey("explosionRadius") ? nbt.getFloat("explosionRadius") : 3.0f;
|
||||
explosionDamageFalloff = nbt.hasKey("explosionDamageFalloff") ? nbt.getFloat("explosionDamageFalloff") : 0.5f;
|
||||
hitType = HitType.fromOrdinal(nbt.hasKey("hitType") ? nbt.getInteger("hitType") : 0);
|
||||
multiHitDelayTicks = nbt.hasKey("multiHitDelayTicks") ? nbt.getInteger("multiHitDelayTicks") : 5;
|
||||
maxHits = nbt.hasKey("maxHits") ? nbt.getInteger("maxHits") : DEFAULT_MAX_HITS;
|
||||
|
||||
// Sanitize
|
||||
if (Float.isNaN(damage) || Float.isInfinite(damage)) damage = 7.0f;
|
||||
if (Float.isNaN(knockback) || Float.isInfinite(knockback) || knockback < 0) knockback = 1.0f;
|
||||
if (Float.isNaN(explosionRadius) || Float.isInfinite(explosionRadius) || explosionRadius < 0) explosionRadius = 3.0f;
|
||||
explosionRadius = clampExplosionRadius(explosionRadius);
|
||||
if (multiHitDelayTicks < 1) multiHitDelayTicks = 1;
|
||||
maxHits = clampMaxHits(maxHits);
|
||||
}
|
||||
|
||||
private static float clampExplosionRadius(float explosionRadius) {
|
||||
if (Float.isNaN(explosionRadius) || Float.isInfinite(explosionRadius)) return 0.0f;
|
||||
return Math.max(0.0f, Math.min(MAX_EXPLOSION_RADIUS, explosionRadius));
|
||||
}
|
||||
|
||||
private static int clampMaxHits(int maxHits) {
|
||||
return Math.max(1, Math.min(MAX_HITS, maxHits));
|
||||
}
|
||||
|
||||
public EnergyCombatData copy() {
|
||||
EnergyCombatData copy = new EnergyCombatData(damage, knockback, knockbackUp,
|
||||
explosive, explosionRadius, explosionDamageFalloff);
|
||||
copy.hitType = hitType;
|
||||
copy.multiHitDelayTicks = multiHitDelayTicks;
|
||||
copy.maxHits = maxHits;
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
-137
@@ -1,137 +0,0 @@
|
||||
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.ability.data.IEnergyDisplayData;
|
||||
|
||||
/**
|
||||
* Groups visual color properties shared by all energy abilities.
|
||||
* Used as a parameter object for entity constructors and ability configuration.
|
||||
*/
|
||||
public class EnergyDisplayData implements IEnergyDisplayData {
|
||||
public int innerColor = 0xFFFFFF;
|
||||
public int outerColor = 0x8888FF;
|
||||
public boolean outerColorEnabled = true;
|
||||
public float outerColorWidth = 0.4f;
|
||||
public float outerColorAlpha = 0.5f;
|
||||
public float innerAlpha = 1.0f;
|
||||
public float rotationSpeed = 4.0f;
|
||||
|
||||
public EnergyDisplayData() {
|
||||
}
|
||||
|
||||
public EnergyDisplayData(int innerColor, int outerColor) {
|
||||
this.innerColor = innerColor;
|
||||
this.outerColor = outerColor;
|
||||
}
|
||||
|
||||
public EnergyDisplayData(int innerColor, int outerColor, boolean outerColorEnabled,
|
||||
float outerColorWidth, float outerColorAlpha, float rotationSpeed) {
|
||||
this.innerColor = innerColor;
|
||||
this.outerColor = outerColor;
|
||||
this.outerColorEnabled = outerColorEnabled;
|
||||
this.outerColorWidth = outerColorWidth;
|
||||
this.outerColorAlpha = outerColorAlpha;
|
||||
this.rotationSpeed = rotationSpeed;
|
||||
}
|
||||
|
||||
public EnergyDisplayData(int innerColor, int outerColor, boolean outerColorEnabled,
|
||||
float outerColorWidth, float outerColorAlpha, float innerAlpha, float rotationSpeed) {
|
||||
this(innerColor, outerColor, outerColorEnabled, outerColorWidth, outerColorAlpha, rotationSpeed);
|
||||
this.innerAlpha = innerAlpha;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInnerColor() {
|
||||
return innerColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInnerColor(int innerColor) {
|
||||
this.innerColor = innerColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOuterColor() {
|
||||
return outerColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOuterColor(int outerColor) {
|
||||
this.outerColor = outerColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOuterColorEnabled() {
|
||||
return outerColorEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOuterColorEnabled(boolean outerColorEnabled) {
|
||||
this.outerColorEnabled = outerColorEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getOuterColorWidth() {
|
||||
return outerColorWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOuterColorWidth(float outerColorWidth) {
|
||||
this.outerColorWidth = outerColorWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getOuterColorAlpha() {
|
||||
return outerColorAlpha;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOuterColorAlpha(float outerColorAlpha) {
|
||||
this.outerColorAlpha = outerColorAlpha;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getInnerAlpha() {
|
||||
return innerAlpha;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInnerAlpha(float innerAlpha) {
|
||||
this.innerAlpha = innerAlpha;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRotationSpeed() {
|
||||
return rotationSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationSpeed(float rotationSpeed) {
|
||||
this.rotationSpeed = rotationSpeed;
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
nbt.setInteger("innerColor", innerColor);
|
||||
nbt.setInteger("outerColor", outerColor);
|
||||
nbt.setBoolean("outerColorEnabled", outerColorEnabled);
|
||||
nbt.setFloat("outerColorWidth", outerColorWidth);
|
||||
nbt.setFloat("outerColorAlpha", outerColorAlpha);
|
||||
nbt.setFloat("innerAlpha", innerAlpha);
|
||||
nbt.setFloat("rotationSpeed", rotationSpeed);
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
innerColor = nbt.hasKey("innerColor") ? nbt.getInteger("innerColor") : 0xFFFFFF;
|
||||
outerColor = nbt.hasKey("outerColor") ? nbt.getInteger("outerColor") : 0x8888FF;
|
||||
outerColorEnabled = !nbt.hasKey("outerColorEnabled") || nbt.getBoolean("outerColorEnabled");
|
||||
outerColorWidth = nbt.hasKey("outerColorWidth") ? nbt.getFloat("outerColorWidth") : 0.4f;
|
||||
outerColorAlpha = nbt.hasKey("outerColorAlpha") ? nbt.getFloat("outerColorAlpha") : 0.5f;
|
||||
innerAlpha = nbt.hasKey("innerAlpha") ? nbt.getFloat("innerAlpha") : 1.0f;
|
||||
rotationSpeed = nbt.hasKey("rotationSpeed") ? nbt.getFloat("rotationSpeed") : 4.0f;
|
||||
}
|
||||
|
||||
public EnergyDisplayData copy() {
|
||||
EnergyDisplayData copy = new EnergyDisplayData(innerColor, outerColor, outerColorEnabled, outerColorWidth, outerColorAlpha, innerAlpha, rotationSpeed);
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.ability.data.IEnergyHomingData;
|
||||
|
||||
|
||||
/**
|
||||
* Groups homing/movement properties for energy projectile abilities.
|
||||
* Used by Orb, Disc, and Beam (not Laser or Sweeper).
|
||||
*/
|
||||
public class EnergyHomingData implements IEnergyHomingData {
|
||||
public float speed = 0.5f;
|
||||
public boolean homing = true;
|
||||
public float homingStrength = 0.15f;
|
||||
public float homingRange = 20.0f;
|
||||
|
||||
public EnergyHomingData() {
|
||||
}
|
||||
|
||||
public EnergyHomingData(float speed, boolean homing, float homingStrength, float homingRange) {
|
||||
this.speed = speed;
|
||||
this.homing = homing;
|
||||
this.homingStrength = homingStrength;
|
||||
this.homingRange = homingRange;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpeed(float speed) {
|
||||
this.speed = Math.max(0.01f, speed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHoming() {
|
||||
return homing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHoming(boolean homing) {
|
||||
this.homing = homing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHomingStrength() {
|
||||
return homingStrength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHomingStrength(float homingStrength) {
|
||||
this.homingStrength = homingStrength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHomingRange() {
|
||||
return homingRange;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHomingRange(float homingRange) {
|
||||
this.homingRange = homingRange;
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
nbt.setFloat("speed", speed);
|
||||
nbt.setBoolean("homing", homing);
|
||||
nbt.setFloat("homingStrength", homingStrength);
|
||||
nbt.setFloat("homingRange", homingRange);
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
speed = nbt.hasKey("speed") ? nbt.getFloat("speed") : 0.5f;
|
||||
homing = !nbt.hasKey("homing") || nbt.getBoolean("homing");
|
||||
homingStrength = nbt.hasKey("homingStrength") ? nbt.getFloat("homingStrength") : 0.15f;
|
||||
homingRange = nbt.hasKey("homingRange") ? nbt.getFloat("homingRange") : 20.0f;
|
||||
|
||||
// Sanitize speed to prevent stuck projectiles
|
||||
if (Float.isNaN(speed) || Float.isInfinite(speed) || speed <= 0) speed = 0.5f;
|
||||
}
|
||||
|
||||
public EnergyHomingData copy() {
|
||||
return new EnergyHomingData(speed, homing, homingStrength, homingRange);
|
||||
}
|
||||
}
|
||||
-59
@@ -1,59 +0,0 @@
|
||||
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.ability.data.IEnergyLifespanData;
|
||||
|
||||
/**
|
||||
* Groups lifespan/range properties for energy projectile abilities.
|
||||
* Used as a parameter object for entity constructors and ability configuration.
|
||||
*/
|
||||
public class EnergyLifespanData implements IEnergyLifespanData {
|
||||
public float maxDistance = 150.0f;
|
||||
public int maxLifetime = 200;
|
||||
|
||||
public EnergyLifespanData() {
|
||||
}
|
||||
|
||||
public EnergyLifespanData(float maxDistance, int maxLifetime) {
|
||||
this.maxDistance = maxDistance;
|
||||
this.maxLifetime = maxLifetime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxDistance() {
|
||||
return maxDistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxDistance(float maxDistance) {
|
||||
this.maxDistance = Float.isNaN(maxDistance) || maxDistance <= 0 ? 150.0f : maxDistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLifetime() {
|
||||
return maxLifetime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxLifetime(int maxLifetime) {
|
||||
this.maxLifetime = maxLifetime <= 0 ? 200 : maxLifetime;
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
nbt.setFloat("maxDistance", maxDistance);
|
||||
nbt.setInteger("maxLifetime", maxLifetime);
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
maxDistance = nbt.getFloat("maxDistance");
|
||||
maxLifetime = nbt.getInteger("maxLifetime");
|
||||
|
||||
// Sanitize: ensure minimum values so entities don't die instantly or live forever
|
||||
if (Float.isNaN(maxDistance) || Float.isInfinite(maxDistance) || maxDistance <= 0) maxDistance = 150.0f;
|
||||
if (maxLifetime <= 0) maxLifetime = 200;
|
||||
}
|
||||
|
||||
public EnergyLifespanData copy() {
|
||||
return new EnergyLifespanData(maxDistance, maxLifetime);
|
||||
}
|
||||
}
|
||||
-85
@@ -1,85 +0,0 @@
|
||||
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.ability.data.IEnergyLightningData;
|
||||
|
||||
/**
|
||||
* Groups lightning visual effect properties for energy abilities.
|
||||
* Used as a parameter object for entity constructors and ability configuration.
|
||||
*/
|
||||
public class EnergyLightningData implements IEnergyLightningData {
|
||||
public boolean lightningEffect = false;
|
||||
public float lightningDensity = 0.15f;
|
||||
public float lightningRadius = 0.5f;
|
||||
public int lightningFadeTime = 6;
|
||||
|
||||
public EnergyLightningData() {
|
||||
}
|
||||
|
||||
public EnergyLightningData(boolean lightningEffect, float lightningDensity,
|
||||
float lightningRadius, int lightningFadeTime) {
|
||||
this.lightningEffect = lightningEffect;
|
||||
this.lightningDensity = lightningDensity;
|
||||
this.lightningRadius = lightningRadius;
|
||||
this.lightningFadeTime = lightningFadeTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLightningEffect() {
|
||||
return lightningEffect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLightningEffect(boolean lightningEffect) {
|
||||
this.lightningEffect = lightningEffect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLightningDensity() {
|
||||
return lightningDensity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLightningDensity(float lightningDensity) {
|
||||
this.lightningDensity = lightningDensity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLightningRadius() {
|
||||
return lightningRadius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLightningRadius(float lightningRadius) {
|
||||
this.lightningRadius = lightningRadius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightningFadeTime() {
|
||||
return lightningFadeTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLightningFadeTime(int lightningFadeTime) {
|
||||
this.lightningFadeTime = Math.max(1, lightningFadeTime);
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
nbt.setBoolean("lightningEffect", lightningEffect);
|
||||
nbt.setFloat("lightningDensity", lightningDensity);
|
||||
nbt.setFloat("lightningRadius", lightningRadius);
|
||||
nbt.setInteger("lightningFadeTime", lightningFadeTime);
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
lightningEffect = nbt.hasKey("lightningEffect") && nbt.getBoolean("lightningEffect");
|
||||
lightningDensity = nbt.hasKey("lightningDensity") ? nbt.getFloat("lightningDensity") : 0.15f;
|
||||
lightningRadius = nbt.hasKey("lightningRadius") ? nbt.getFloat("lightningRadius") : 0.5f;
|
||||
lightningFadeTime = nbt.hasKey("lightningFadeTime") ? nbt.getInteger("lightningFadeTime") : 6;
|
||||
if (lightningFadeTime <= 0) lightningFadeTime = 1;
|
||||
}
|
||||
|
||||
public EnergyLightningData copy() {
|
||||
return new EnergyLightningData(lightningEffect, lightningDensity, lightningRadius, lightningFadeTime);
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Groups panel-specific properties for energy wall/shield abilities.
|
||||
* Handles dimensions, positioning, and launch behavior.
|
||||
*/
|
||||
public class EnergyPanelData {
|
||||
public float panelWidth = 3.0f;
|
||||
public float panelHeight = 3.0f;
|
||||
public float heightOffset = 0.0f;
|
||||
public float offsetX = 0.0f;
|
||||
public float offsetZ = 0.0f;
|
||||
|
||||
// Launch properties (Wall only)
|
||||
public boolean launching = false;
|
||||
public float launchSpeed = 0.5f;
|
||||
public float launchDamage = 8.0f;
|
||||
public float launchKnockback = 2.0f;
|
||||
|
||||
public EnergyPanelData() {
|
||||
}
|
||||
|
||||
public EnergyPanelData(float panelWidth, float panelHeight, float heightOffset) {
|
||||
this.panelWidth = panelWidth;
|
||||
this.panelHeight = panelHeight;
|
||||
this.heightOffset = heightOffset;
|
||||
}
|
||||
|
||||
// ==================== GETTERS & SETTERS ====================
|
||||
|
||||
public float getPanelWidth() {
|
||||
return panelWidth;
|
||||
}
|
||||
|
||||
public void setPanelWidth(float panelWidth) {
|
||||
this.panelWidth = Math.max(0.5f, panelWidth);
|
||||
}
|
||||
|
||||
public float getPanelHeight() {
|
||||
return panelHeight;
|
||||
}
|
||||
|
||||
public void setPanelHeight(float panelHeight) {
|
||||
this.panelHeight = Math.max(0.5f, panelHeight);
|
||||
}
|
||||
|
||||
public float getHeightOffset() {
|
||||
return heightOffset;
|
||||
}
|
||||
|
||||
public void setHeightOffset(float heightOffset) {
|
||||
this.heightOffset = heightOffset;
|
||||
}
|
||||
|
||||
public boolean isLaunching() {
|
||||
return launching;
|
||||
}
|
||||
|
||||
public void setLaunching(boolean launching) {
|
||||
this.launching = launching;
|
||||
}
|
||||
|
||||
public float getLaunchSpeed() {
|
||||
return launchSpeed;
|
||||
}
|
||||
|
||||
public void setLaunchSpeed(float launchSpeed) {
|
||||
this.launchSpeed = Math.max(0.1f, launchSpeed);
|
||||
}
|
||||
|
||||
public float getLaunchDamage() {
|
||||
return launchDamage;
|
||||
}
|
||||
|
||||
public void setLaunchDamage(float launchDamage) {
|
||||
this.launchDamage = Math.max(0, launchDamage);
|
||||
}
|
||||
|
||||
public float getLaunchKnockback() {
|
||||
return launchKnockback;
|
||||
}
|
||||
|
||||
public void setLaunchKnockback(float launchKnockback) {
|
||||
this.launchKnockback = Math.max(0, launchKnockback);
|
||||
}
|
||||
|
||||
// ==================== NBT ====================
|
||||
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
nbt.setFloat("panelWidth", panelWidth);
|
||||
nbt.setFloat("panelHeight", panelHeight);
|
||||
nbt.setFloat("panelHeightOffset", heightOffset);
|
||||
nbt.setFloat("panelOffsetX", offsetX);
|
||||
nbt.setFloat("panelOffsetZ", offsetZ);
|
||||
nbt.setBoolean("panelLaunching", launching);
|
||||
nbt.setFloat("panelLaunchSpeed", launchSpeed);
|
||||
nbt.setFloat("panelLaunchDamage", launchDamage);
|
||||
nbt.setFloat("panelLaunchKnockback", launchKnockback);
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
panelWidth = nbt.hasKey("panelWidth") ? nbt.getFloat("panelWidth") : 3.0f;
|
||||
panelHeight = nbt.hasKey("panelHeight") ? nbt.getFloat("panelHeight") : 3.0f;
|
||||
heightOffset = nbt.hasKey("panelHeightOffset") ? nbt.getFloat("panelHeightOffset") : 0.0f;
|
||||
offsetX = nbt.hasKey("panelOffsetX") ? nbt.getFloat("panelOffsetX") : 0.0f;
|
||||
offsetZ = nbt.hasKey("panelOffsetZ") ? nbt.getFloat("panelOffsetZ") : 0.0f;
|
||||
launching = nbt.hasKey("panelLaunching") && nbt.getBoolean("panelLaunching");
|
||||
launchSpeed = nbt.hasKey("panelLaunchSpeed") ? nbt.getFloat("panelLaunchSpeed") : 0.5f;
|
||||
launchDamage = nbt.hasKey("panelLaunchDamage") ? nbt.getFloat("panelLaunchDamage") : 8.0f;
|
||||
launchKnockback = nbt.hasKey("panelLaunchKnockback") ? nbt.getFloat("panelLaunchKnockback") : 2.0f;
|
||||
}
|
||||
|
||||
public EnergyPanelData copy() {
|
||||
EnergyPanelData copy = new EnergyPanelData(panelWidth, panelHeight, heightOffset);
|
||||
copy.offsetX = offsetX;
|
||||
copy.offsetZ = offsetZ;
|
||||
copy.launching = launching;
|
||||
copy.launchSpeed = launchSpeed;
|
||||
copy.launchDamage = launchDamage;
|
||||
copy.launchKnockback = launchKnockback;
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.client.gui.SubGuiZonePresetSelector;
|
||||
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import noppes.npcs.constants.EnumPotionType;
|
||||
|
||||
@@ -381,7 +382,7 @@ public abstract class AbilityZone extends Ability {
|
||||
nbt.setFloat("particleScale", particleScale);
|
||||
nbt.setFloat("animSpeed", animSpeed);
|
||||
nbt.setFloat("lightningDensity", lightningDensity);
|
||||
colorData.writeNBT(nbt);
|
||||
colorData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
|
||||
nbt.setBoolean("groundFill", groundFill);
|
||||
nbt.setFloat("groundAlpha", groundAlpha);
|
||||
@@ -413,7 +414,7 @@ public abstract class AbilityZone extends Ability {
|
||||
this.particleScale = nbt.getFloat("particleScale");
|
||||
this.animSpeed = nbt.getFloat("animSpeed");
|
||||
this.lightningDensity = nbt.getFloat("lightningDensity");
|
||||
colorData.readNBT(nbt);
|
||||
colorData.readNBT(new MC1710NBTCompound(nbt));
|
||||
|
||||
this.groundFill = nbt.getBoolean("groundFill");
|
||||
this.groundAlpha = nbt.getFloat("groundAlpha");
|
||||
|
||||
@@ -11,6 +11,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import noppes.npcs.controllers.data.MagicData;
|
||||
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -176,7 +177,7 @@ public abstract class AbilityBarrier extends AbilityEnergy {
|
||||
public final void writeTypeNBT(NBTTagCompound nbt) {
|
||||
writeBarrierTypeNBT(nbt);
|
||||
writeEnergyNBT(nbt);
|
||||
barrierData.writeNBT(nbt);
|
||||
barrierData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
nbt.setFloat("barrierOffsetX", offsetX);
|
||||
nbt.setFloat("barrierOffsetY", offsetY);
|
||||
nbt.setFloat("barrierOffsetZ", offsetZ);
|
||||
@@ -189,7 +190,7 @@ public abstract class AbilityBarrier extends AbilityEnergy {
|
||||
offsetZ = nbt.hasKey("barrierOffsetZ") ? nbt.getFloat("barrierOffsetZ") : 0.0f;
|
||||
readBarrierTypeNBT(nbt);
|
||||
readEnergyNBT(nbt);
|
||||
barrierData.readNBT(nbt);
|
||||
barrierData.readNBT(new MC1710NBTCompound(nbt));
|
||||
}
|
||||
|
||||
// ==================== API GETTERS & SETTERS ====================
|
||||
|
||||
@@ -7,6 +7,7 @@ import kamkeel.npcs.controllers.data.ability.data.energy.EnergyDisplayData;
|
||||
import kamkeel.npcs.controllers.data.ability.data.energy.EnergyLightningData;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -119,13 +120,13 @@ public abstract class AbilityEnergy extends Ability {
|
||||
// ==================== NBT HELPERS ====================
|
||||
|
||||
protected void writeEnergyNBT(NBTTagCompound nbt) {
|
||||
displayData.writeNBT(nbt);
|
||||
lightningData.writeNBT(nbt);
|
||||
displayData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
lightningData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
}
|
||||
|
||||
protected void readEnergyNBT(NBTTagCompound nbt) {
|
||||
displayData.readNBT(nbt);
|
||||
lightningData.readNBT(nbt);
|
||||
displayData.readNBT(new MC1710NBTCompound(nbt));
|
||||
lightningData.readNBT(new MC1710NBTCompound(nbt));
|
||||
}
|
||||
|
||||
// ==================== GUI HELPERS ====================
|
||||
|
||||
+7
-6
@@ -26,6 +26,7 @@ import net.minecraft.util.Vec3;
|
||||
import noppes.npcs.api.ability.type.IAbilityEnergyProjectile;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import noppes.npcs.controllers.data.MagicData;
|
||||
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -583,9 +584,9 @@ public abstract class AbilityEnergyProjectile<E extends EntityEnergyProjectile>
|
||||
|
||||
// Shared data classes
|
||||
writeEnergyNBT(nbt);
|
||||
combatData.writeNBT(nbt);
|
||||
homingData.writeNBT(nbt);
|
||||
lifespanData.writeNBT(nbt);
|
||||
combatData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
homingData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
lifespanData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
|
||||
// Per-projectile data
|
||||
for (int i = 0; i < projectileCount; i++) {
|
||||
@@ -607,9 +608,9 @@ public abstract class AbilityEnergyProjectile<E extends EntityEnergyProjectile>
|
||||
|
||||
// Shared data classes
|
||||
readEnergyNBT(nbt);
|
||||
combatData.readNBT(nbt);
|
||||
homingData.readNBT(nbt);
|
||||
lifespanData.readNBT(nbt);
|
||||
combatData.readNBT(new MC1710NBTCompound(nbt));
|
||||
homingData.readNBT(new MC1710NBTCompound(nbt));
|
||||
lifespanData.readNBT(new MC1710NBTCompound(nbt));
|
||||
|
||||
// Per-projectile data
|
||||
for (int i = 0; i < projectileCount; i++) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import kamkeel.npcs.entity.EntityEnergyPanel;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -141,12 +142,12 @@ public class AbilityWall extends AbilityBarrier {
|
||||
|
||||
@Override
|
||||
protected void writeBarrierTypeNBT(NBTTagCompound nbt) {
|
||||
panelData.writeNBT(nbt);
|
||||
panelData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readBarrierTypeNBT(NBTTagCompound nbt) {
|
||||
panelData.readNBT(nbt);
|
||||
panelData.readNBT(new MC1710NBTCompound(nbt));
|
||||
// Migrate legacy heightOffset → base class offsetY
|
||||
if (!nbt.hasKey("barrierOffsetY") && panelData.heightOffset != 0.0f) {
|
||||
offsetY = panelData.heightOffset;
|
||||
|
||||
@@ -1,320 +0,0 @@
|
||||
package kamkeel.npcs.controllers.data.telegraph;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Telegraph configuration - defines a visual warning shape.
|
||||
* Telegraphs warn players about incoming attacks or mark areas of effect.
|
||||
*/
|
||||
public class Telegraph {
|
||||
|
||||
// Identity
|
||||
private String id = "";
|
||||
private TelegraphType type = TelegraphType.CIRCLE;
|
||||
|
||||
// Shape parameters
|
||||
private float radius = 3.0f;
|
||||
private float innerRadius = 0.0f;
|
||||
private float length = 5.0f;
|
||||
private float width = 2.0f;
|
||||
private float angle = 45.0f;
|
||||
|
||||
// Timing
|
||||
private int durationTicks = 40;
|
||||
|
||||
// Visuals
|
||||
private int color = 0x80FF0000; // Semi-transparent red
|
||||
private int warningColor = 0xC0FF0000; // More opaque red
|
||||
private int warningStartTick = 10;
|
||||
private boolean animated = true;
|
||||
private float heightOffset = 0.1f;
|
||||
private int groundSearchRange = 3;
|
||||
|
||||
// Positioning
|
||||
private boolean atTarget = true;
|
||||
private boolean followsTarget = false;
|
||||
private boolean followsCaster = false;
|
||||
private float offsetForward = 0.0f;
|
||||
|
||||
public Telegraph() {
|
||||
}
|
||||
|
||||
public Telegraph(String id, TelegraphType type) {
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Telegraph(Telegraph other) {
|
||||
this.id = other.id;
|
||||
this.type = other.type;
|
||||
this.radius = other.radius;
|
||||
this.innerRadius = other.innerRadius;
|
||||
this.length = other.length;
|
||||
this.width = other.width;
|
||||
this.angle = other.angle;
|
||||
this.durationTicks = other.durationTicks;
|
||||
this.color = other.color;
|
||||
this.warningColor = other.warningColor;
|
||||
this.warningStartTick = other.warningStartTick;
|
||||
this.animated = other.animated;
|
||||
this.heightOffset = other.heightOffset;
|
||||
this.groundSearchRange = other.groundSearchRange;
|
||||
this.atTarget = other.atTarget;
|
||||
this.followsTarget = other.followsTarget;
|
||||
this.followsCaster = other.followsCaster;
|
||||
this.offsetForward = other.offsetForward;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// NBT SERIALIZATION
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
public NBTTagCompound writeNBT() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("id", id);
|
||||
nbt.setString("type", type.name());
|
||||
nbt.setFloat("radius", radius);
|
||||
nbt.setFloat("innerRadius", innerRadius);
|
||||
nbt.setFloat("length", length);
|
||||
nbt.setFloat("width", width);
|
||||
nbt.setFloat("angle", angle);
|
||||
nbt.setInteger("durationTicks", durationTicks);
|
||||
nbt.setInteger("color", color);
|
||||
nbt.setInteger("warningColor", warningColor);
|
||||
nbt.setInteger("warningStartTick", warningStartTick);
|
||||
nbt.setBoolean("animated", animated);
|
||||
nbt.setFloat("heightOffset", heightOffset);
|
||||
nbt.setInteger("groundSearchRange", groundSearchRange);
|
||||
nbt.setBoolean("atTarget", atTarget);
|
||||
nbt.setBoolean("followsTarget", followsTarget);
|
||||
nbt.setBoolean("followsCaster", followsCaster);
|
||||
nbt.setFloat("offsetForward", offsetForward);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
this.id = nbt.getString("id");
|
||||
if (nbt.hasKey("type")) {
|
||||
try {
|
||||
this.type = TelegraphType.valueOf(nbt.getString("type"));
|
||||
} catch (Exception e) {
|
||||
this.type = TelegraphType.CIRCLE;
|
||||
}
|
||||
}
|
||||
this.radius = nbt.getFloat("radius");
|
||||
this.innerRadius = nbt.getFloat("innerRadius");
|
||||
this.length = nbt.getFloat("length");
|
||||
this.width = nbt.getFloat("width");
|
||||
this.angle = nbt.getFloat("angle");
|
||||
this.durationTicks = nbt.getInteger("durationTicks");
|
||||
this.color = nbt.getInteger("color");
|
||||
this.warningColor = nbt.getInteger("warningColor");
|
||||
this.warningStartTick = nbt.getInteger("warningStartTick");
|
||||
this.animated = nbt.getBoolean("animated");
|
||||
this.heightOffset = nbt.getFloat("heightOffset");
|
||||
if (nbt.hasKey("groundSearchRange")) {
|
||||
this.groundSearchRange = nbt.getInteger("groundSearchRange");
|
||||
}
|
||||
this.atTarget = nbt.getBoolean("atTarget");
|
||||
this.followsTarget = nbt.getBoolean("followsTarget");
|
||||
this.followsCaster = nbt.getBoolean("followsCaster");
|
||||
this.offsetForward = nbt.getFloat("offsetForward");
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// FACTORY METHODS
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
public static Telegraph circle(float radius) {
|
||||
Telegraph t = new Telegraph("", TelegraphType.CIRCLE);
|
||||
t.radius = radius;
|
||||
return t;
|
||||
}
|
||||
|
||||
public static Telegraph ring(float outerRadius, float innerRadius) {
|
||||
Telegraph t = new Telegraph("", TelegraphType.RING);
|
||||
t.radius = outerRadius;
|
||||
t.innerRadius = innerRadius;
|
||||
return t;
|
||||
}
|
||||
|
||||
public static Telegraph line(float length, float width) {
|
||||
Telegraph t = new Telegraph("", TelegraphType.LINE);
|
||||
t.length = length;
|
||||
t.width = width;
|
||||
return t;
|
||||
}
|
||||
|
||||
public static Telegraph cone(float length, float angle) {
|
||||
Telegraph t = new Telegraph("", TelegraphType.CONE);
|
||||
t.length = length;
|
||||
t.angle = angle;
|
||||
return t;
|
||||
}
|
||||
|
||||
public static Telegraph cone(float length, float angle, float innerRadius) {
|
||||
Telegraph t = new Telegraph("", TelegraphType.CONE);
|
||||
t.length = length;
|
||||
t.angle = angle;
|
||||
t.innerRadius = innerRadius;
|
||||
return t;
|
||||
}
|
||||
|
||||
public static Telegraph point() {
|
||||
return new Telegraph("", TelegraphType.POINT);
|
||||
}
|
||||
|
||||
public static Telegraph square(float radius) {
|
||||
Telegraph t = new Telegraph("", TelegraphType.SQUARE);
|
||||
t.radius = radius;
|
||||
return t;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// GETTERS & SETTERS
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public TelegraphType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(TelegraphType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public float getRadius() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
public void setRadius(float radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
public float getInnerRadius() {
|
||||
return innerRadius;
|
||||
}
|
||||
|
||||
public void setInnerRadius(float innerRadius) {
|
||||
this.innerRadius = innerRadius;
|
||||
}
|
||||
|
||||
public float getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public void setLength(float length) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public float getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(float width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public float getAngle() {
|
||||
return angle;
|
||||
}
|
||||
|
||||
public void setAngle(float angle) {
|
||||
this.angle = angle;
|
||||
}
|
||||
|
||||
public int getDurationTicks() {
|
||||
return durationTicks;
|
||||
}
|
||||
|
||||
public void setDurationTicks(int durationTicks) {
|
||||
this.durationTicks = durationTicks;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public int getWarningColor() {
|
||||
return warningColor;
|
||||
}
|
||||
|
||||
public void setWarningColor(int warningColor) {
|
||||
this.warningColor = warningColor;
|
||||
}
|
||||
|
||||
public int getWarningStartTick() {
|
||||
return warningStartTick;
|
||||
}
|
||||
|
||||
public void setWarningStartTick(int warningStartTick) {
|
||||
this.warningStartTick = warningStartTick;
|
||||
}
|
||||
|
||||
public boolean isAnimated() {
|
||||
return animated;
|
||||
}
|
||||
|
||||
public void setAnimated(boolean animated) {
|
||||
this.animated = animated;
|
||||
}
|
||||
|
||||
public float getHeightOffset() {
|
||||
return heightOffset;
|
||||
}
|
||||
|
||||
public void setHeightOffset(float heightOffset) {
|
||||
this.heightOffset = heightOffset;
|
||||
}
|
||||
|
||||
public int getGroundSearchRange() {
|
||||
return groundSearchRange;
|
||||
}
|
||||
|
||||
public void setGroundSearchRange(int groundSearchRange) {
|
||||
this.groundSearchRange = groundSearchRange;
|
||||
}
|
||||
|
||||
public boolean isAtTarget() {
|
||||
return atTarget;
|
||||
}
|
||||
|
||||
public void setAtTarget(boolean atTarget) {
|
||||
this.atTarget = atTarget;
|
||||
}
|
||||
|
||||
public boolean isFollowsTarget() {
|
||||
return followsTarget;
|
||||
}
|
||||
|
||||
public void setFollowsTarget(boolean followsTarget) {
|
||||
this.followsTarget = followsTarget;
|
||||
}
|
||||
|
||||
public boolean isFollowsCaster() {
|
||||
return followsCaster;
|
||||
}
|
||||
|
||||
public void setFollowsCaster(boolean followsCaster) {
|
||||
this.followsCaster = followsCaster;
|
||||
}
|
||||
|
||||
public float getOffsetForward() {
|
||||
return offsetForward;
|
||||
}
|
||||
|
||||
public void setOffsetForward(float offsetForward) {
|
||||
this.offsetForward = offsetForward;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -214,7 +215,7 @@ public class TelegraphInstance {
|
||||
nbt.setString("instanceId", instanceId);
|
||||
|
||||
if (telegraph != null) {
|
||||
nbt.setTag("telegraph", telegraph.writeNBT());
|
||||
nbt.setTag("telegraph", ((MC1710NBTCompound) telegraph.writeNBT()).getMCTag());
|
||||
}
|
||||
|
||||
nbt.setDouble("x", x);
|
||||
@@ -240,7 +241,7 @@ public class TelegraphInstance {
|
||||
|
||||
if (nbt.hasKey("telegraph")) {
|
||||
this.telegraph = new Telegraph();
|
||||
this.telegraph.readNBT(nbt.getCompoundTag("telegraph"));
|
||||
this.telegraph.readNBT(new MC1710NBTCompound(nbt.getCompoundTag("telegraph")));
|
||||
}
|
||||
|
||||
this.x = nbt.getDouble("x");
|
||||
|
||||
@@ -354,8 +354,8 @@ public abstract class EntityEnergyAbility extends Entity implements IEntityAddit
|
||||
protected void writeEnergyBaseNBT(NBTTagCompound nbt) {
|
||||
nbt.setInteger("OwnerId", ownerEntityId);
|
||||
nbt.setBoolean("IgnoreIFrames", ignoreIFrames);
|
||||
displayData.writeNBT(nbt);
|
||||
lightningData.writeNBT(nbt);
|
||||
displayData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
lightningData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
if (customDamageData != null) {
|
||||
nbt.setTag("CustomDamageData", customDamageData);
|
||||
}
|
||||
@@ -369,8 +369,8 @@ public abstract class EntityEnergyAbility extends Entity implements IEntityAddit
|
||||
protected void readEnergyBaseNBT(NBTTagCompound nbt) {
|
||||
this.ownerEntityId = nbt.getInteger("OwnerId");
|
||||
this.ignoreIFrames = nbt.getBoolean("IgnoreIFrames");
|
||||
displayData.readNBT(nbt);
|
||||
lightningData.readNBT(nbt);
|
||||
displayData.readNBT(new MC1710NBTCompound(nbt));
|
||||
lightningData.readNBT(new MC1710NBTCompound(nbt));
|
||||
if (nbt.hasKey("CustomDamageData")) {
|
||||
this.customDamageData = nbt.getCompoundTag("CustomDamageData");
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.controllers.data.MagicData;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
@@ -869,7 +870,7 @@ public abstract class EntityEnergyBarrier extends EntityEnergyAbility {
|
||||
nbt.setBoolean("Charging", charging);
|
||||
nbt.setInteger("ChargeTick", chargeTick);
|
||||
nbt.setInteger("ChargeDuration", chargeDuration);
|
||||
barrierData.writeNBT(nbt);
|
||||
barrierData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -885,7 +886,7 @@ public abstract class EntityEnergyBarrier extends EntityEnergyAbility {
|
||||
this.chargeTick = nbt.getInteger("ChargeTick");
|
||||
this.chargeDuration = nbt.getInteger("ChargeDuration");
|
||||
this.dataWatcher.updateObject(DW_CHARGING, (byte) (charging ? 1 : 0));
|
||||
barrierData.readNBT(nbt);
|
||||
barrierData.readNBT(new MC1710NBTCompound(nbt));
|
||||
}
|
||||
|
||||
// ==================== DEBUG LOGGING ====================
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.NpcDamageSource;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -738,7 +739,7 @@ public class EntityEnergyPanel extends EntityEnergyBarrier {
|
||||
nbt.setInteger("PanelMode", mode.ordinal());
|
||||
nbt.setFloat("TargetPanelWidth", targetPanelWidth);
|
||||
nbt.setFloat("TargetPanelHeight", targetPanelHeight);
|
||||
panelData.writeNBT(nbt);
|
||||
panelData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -748,7 +749,7 @@ public class EntityEnergyPanel extends EntityEnergyBarrier {
|
||||
int modeOrdinal = nbt.getInteger("PanelMode");
|
||||
this.mode = (modeOrdinal >= 0 && modeOrdinal < PanelMode.values().length)
|
||||
? PanelMode.values()[modeOrdinal] : PanelMode.PLACED;
|
||||
panelData.readNBT(nbt);
|
||||
panelData.readNBT(new MC1710NBTCompound(nbt));
|
||||
panelData.panelWidth = sanitize(panelData.panelWidth, 3.0f, MAX_ENTITY_SIZE);
|
||||
panelData.panelHeight = sanitize(panelData.panelHeight, 3.0f, MAX_ENTITY_SIZE);
|
||||
this.targetPanelWidth = sanitize(nbt.hasKey("TargetPanelWidth") ? nbt.getFloat("TargetPanelWidth") : panelData.panelWidth, 3.0f, MAX_ENTITY_SIZE);
|
||||
|
||||
@@ -47,6 +47,7 @@ import noppes.npcs.controllers.data.Party;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
@@ -2478,10 +2479,10 @@ public abstract class EntityEnergyProjectile extends EntityEnergyAbility {
|
||||
this.renderCurrentSize = this.size;
|
||||
this.prevRenderSize = this.size;
|
||||
|
||||
anchorData.readNBT(nbt);
|
||||
combatData.readNBT(nbt);
|
||||
homingData.readNBT(nbt);
|
||||
lifespanData.readNBT(nbt);
|
||||
anchorData.readNBT(new MC1710NBTCompound(nbt));
|
||||
combatData.readNBT(new MC1710NBTCompound(nbt));
|
||||
homingData.readNBT(new MC1710NBTCompound(nbt));
|
||||
lifespanData.readNBT(new MC1710NBTCompound(nbt));
|
||||
syncProjectileColorWatchers();
|
||||
}
|
||||
|
||||
@@ -2513,10 +2514,10 @@ public abstract class EntityEnergyProjectile extends EntityEnergyAbility {
|
||||
nbt.setDouble("MotionY", motionY);
|
||||
nbt.setDouble("MotionZ", motionZ);
|
||||
|
||||
anchorData.writeNBT(nbt);
|
||||
combatData.writeNBT(nbt);
|
||||
homingData.writeNBT(nbt);
|
||||
lifespanData.writeNBT(nbt);
|
||||
anchorData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
combatData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
homingData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
lifespanData.writeNBT(new MC1710NBTCompound(nbt));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package kamkeel.npcs.wrapper.platform;
|
||||
|
||||
import kamkeel.npcs.platform.entity.IPlatformDamageSource;
|
||||
import kamkeel.npcs.platform.entity.IPlatformEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
||||
/**
|
||||
* MC 1.7.10 implementation of {@link IPlatformDamageSource}.
|
||||
* Wraps a raw {@link DamageSource} instance.
|
||||
*/
|
||||
public class MC1710PlatformDamageSource implements IPlatformDamageSource {
|
||||
|
||||
private final DamageSource source;
|
||||
|
||||
public MC1710PlatformDamageSource(DamageSource source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return source.getDamageType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPlatformEntity getSourceEntity() {
|
||||
if (source.getEntity() == null) return null;
|
||||
return new MC1710PlatformEntity(source.getEntity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getHandle() {
|
||||
return source;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package kamkeel.npcs.wrapper.platform;
|
||||
|
||||
import kamkeel.npcs.platform.entity.IPlatformEntity;
|
||||
import kamkeel.npcs.platform.entity.IPlatformWorld;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* MC 1.7.10 implementation of {@link IPlatformEntity}.
|
||||
* Wraps a raw {@link Entity} instance.
|
||||
*/
|
||||
public class MC1710PlatformEntity implements IPlatformEntity {
|
||||
|
||||
protected final Entity entity;
|
||||
|
||||
public MC1710PlatformEntity(Entity entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEntityId() {
|
||||
return entity.getEntityId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueID() {
|
||||
return entity.getUniqueID().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getX() {
|
||||
return entity.posX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getY() {
|
||||
return entity.posY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getZ() {
|
||||
return entity.posZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getYaw() {
|
||||
return entity.rotationYaw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPitch() {
|
||||
return entity.rotationPitch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(double x, double y, double z) {
|
||||
entity.setPosition(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
return !entity.isDead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPlatformWorld getWorld() {
|
||||
return new MC1710PlatformWorld(entity.worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getHandle() {
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package kamkeel.npcs.wrapper.platform;
|
||||
|
||||
import kamkeel.npcs.platform.entity.IPlatformDamageSource;
|
||||
import kamkeel.npcs.platform.entity.IPlatformLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
||||
/**
|
||||
* MC 1.7.10 implementation of {@link IPlatformLiving}.
|
||||
* Wraps a raw {@link EntityLivingBase} instance.
|
||||
*/
|
||||
public class MC1710PlatformLiving extends MC1710PlatformEntity implements IPlatformLiving {
|
||||
|
||||
protected final EntityLivingBase living;
|
||||
|
||||
public MC1710PlatformLiving(EntityLivingBase living) {
|
||||
super(living);
|
||||
this.living = living;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHealth() {
|
||||
return living.getHealth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHealth(float hp) {
|
||||
living.setHealth(hp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxHealth() {
|
||||
return living.getMaxHealth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damage(float amount, IPlatformDamageSource source) {
|
||||
DamageSource mcSource = source != null ? (DamageSource) source.getHandle() : DamageSource.generic;
|
||||
living.attackEntityFrom(mcSource, amount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package kamkeel.npcs.wrapper.platform;
|
||||
|
||||
import kamkeel.npcs.platform.entity.IPlatformPlayer;
|
||||
import kamkeel.npcs.platform.entity.IPlatformStack;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
/**
|
||||
* MC 1.7.10 implementation of {@link IPlatformPlayer}.
|
||||
* Wraps a raw {@link EntityPlayerMP} instance.
|
||||
*/
|
||||
public class MC1710PlatformPlayer extends MC1710PlatformLiving implements IPlatformPlayer {
|
||||
|
||||
private final EntityPlayerMP player;
|
||||
|
||||
public MC1710PlatformPlayer(EntityPlayerMP player) {
|
||||
super(player);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return player.getCommandSenderName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueID() {
|
||||
return player.getUniqueID().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp() {
|
||||
return player.mcServer.getConfigurationManager()
|
||||
.func_152596_g(player.getGameProfile());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String text) {
|
||||
player.addChatMessage(new ChatComponentText(text));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPlatformStack getHeldItem() {
|
||||
if (player.getHeldItem() == null) return null;
|
||||
return new MC1710PlatformStack(player.getHeldItem());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package kamkeel.npcs.wrapper.platform;
|
||||
|
||||
import kamkeel.npcs.platform.entity.IPlatformStack;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.platform.nbt.INBTCompound;
|
||||
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
|
||||
|
||||
/**
|
||||
* MC 1.7.10 implementation of {@link IPlatformStack}.
|
||||
* Wraps a raw {@link ItemStack} instance.
|
||||
*/
|
||||
public class MC1710PlatformStack implements IPlatformStack {
|
||||
|
||||
private final ItemStack stack;
|
||||
|
||||
public MC1710PlatformStack(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemId() {
|
||||
if (stack == null || stack.getItem() == null) return "minecraft:air";
|
||||
return Item.itemRegistry.getNameForObject(stack.getItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return stack != null ? stack.stackSize : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCount(int count) {
|
||||
if (stack != null) stack.stackSize = count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamage() {
|
||||
return stack != null ? stack.getItemDamage() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDamage(int dmg) {
|
||||
if (stack != null) stack.setItemDamage(dmg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public INBTCompound getTag() {
|
||||
if (stack == null || stack.stackTagCompound == null) return null;
|
||||
return new MC1710NBTCompound(stack.stackTagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTag(INBTCompound tag) {
|
||||
if (stack != null) {
|
||||
stack.stackTagCompound = tag != null ? ((MC1710NBTCompound) tag).getMCTag() : null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return stack == null || stack.getItem() == null || stack.stackSize <= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPlatformStack copy() {
|
||||
if (stack == null) return new MC1710PlatformStack(null);
|
||||
return new MC1710PlatformStack(stack.copy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getHandle() {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package kamkeel.npcs.wrapper.platform;
|
||||
|
||||
import kamkeel.npcs.platform.entity.IPlatformEntity;
|
||||
import kamkeel.npcs.platform.entity.IPlatformWorld;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* MC 1.7.10 implementation of {@link IPlatformWorld}.
|
||||
* Wraps a raw {@link World} instance.
|
||||
*/
|
||||
public class MC1710PlatformWorld implements IPlatformWorld {
|
||||
|
||||
private final World world;
|
||||
|
||||
public MC1710PlatformWorld(World world) {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDimensionId() {
|
||||
return world.provider.dimensionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClient() {
|
||||
return world.isRemote;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPlatformEntity getEntityById(int id) {
|
||||
Entity entity = world.getEntityByID(id);
|
||||
if (entity == null) return null;
|
||||
return new MC1710PlatformEntity(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getHandle() {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
public PlayerItemGiverData itemgiverData = new PlayerItemGiverData(this);
|
||||
public PlayerMailData mailData = new PlayerMailData(this);
|
||||
public AnimationData animationData = new AnimationData(this);
|
||||
public PlayerEffectData effectData = new PlayerEffectData(this);
|
||||
public PlayerEffectData effectData = new PlayerEffectData();
|
||||
public DataTimers timers = new DataTimers(this);
|
||||
public DataSkinOverlays skinOverlays = new DataSkinOverlays(this);
|
||||
public MagicData magicData = new MagicData();
|
||||
@@ -151,7 +151,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
timers.readFromNBT(data);
|
||||
skinOverlays.readFromNBT(data);
|
||||
animationData.readFromNBT(data);
|
||||
effectData.readFromNBT(data);
|
||||
effectData.readFromNBT(new MC1710NBTCompound(data));
|
||||
magicData.readToNBT(new MC1710NBTCompound(data));
|
||||
tradeData.readFromNBT(data);
|
||||
abilityData.readFromNBT(data);
|
||||
@@ -196,7 +196,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
timers.writeToNBT(compound);
|
||||
skinOverlays.writeToNBT(compound);
|
||||
animationData.writeToNBT(compound);
|
||||
effectData.writeToNBT(compound);
|
||||
effectData.writeToNBT(new MC1710NBTCompound(compound));
|
||||
magicData.writeToNBT(new MC1710NBTCompound(compound));
|
||||
tradeData.writeToNBT(compound);
|
||||
abilityData.writeToNBT(compound);
|
||||
@@ -233,12 +233,12 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
|
||||
public NBTTagCompound getPlayerEffects() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
effectData.writeToNBT(compound);
|
||||
effectData.writeToNBT(new MC1710NBTCompound(compound));
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void setPlayerEffects(NBTTagCompound data) {
|
||||
effectData.readFromNBT(data);
|
||||
effectData.readFromNBT(new MC1710NBTCompound(data));
|
||||
}
|
||||
|
||||
public NBTTagCompound getSyncNBTFull() {
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class PlayerEffectData {
|
||||
private final PlayerData parent;
|
||||
private ConcurrentHashMap<EffectKey, PlayerEffect> effects = new ConcurrentHashMap<>();
|
||||
|
||||
public PlayerEffectData(PlayerData playerData) {
|
||||
this.parent = playerData;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (Map.Entry<EffectKey, PlayerEffect> entry : effects.entrySet()) {
|
||||
NBTTagCompound effectCompound = new NBTTagCompound();
|
||||
effectCompound.setInteger("id", entry.getKey().getId());
|
||||
effectCompound.setInteger("index", entry.getKey().getIndex());
|
||||
effectCompound.setInteger("duration", entry.getValue().duration);
|
||||
effectCompound.setByte("level", entry.getValue().level);
|
||||
list.appendTag(effectCompound);
|
||||
}
|
||||
compound.setTag("Effects", list);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
HashSet<EffectKey> newKeys = new HashSet<>();
|
||||
if (compound.hasKey("Effects")) {
|
||||
NBTTagList list = compound.getTagList("Effects", 10);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound effectCompound = list.getCompoundTagAt(i);
|
||||
int id = effectCompound.getInteger("id");
|
||||
int index = effectCompound.getInteger("index");
|
||||
int duration = effectCompound.getInteger("duration");
|
||||
byte level = effectCompound.getByte("level");
|
||||
EffectKey key = new EffectKey(id, index);
|
||||
newKeys.add(key);
|
||||
PlayerEffect effect = effects.get(key);
|
||||
if (effect != null) {
|
||||
effect.duration = duration;
|
||||
effect.level = level;
|
||||
} else {
|
||||
effect = new PlayerEffect(id, duration, level, index);
|
||||
effects.put(key, effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
Iterator<EffectKey> it = effects.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
EffectKey key = it.next();
|
||||
if (!newKeys.contains(key)) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<EffectKey, PlayerEffect> getEffects() {
|
||||
return effects;
|
||||
}
|
||||
|
||||
public void setEffects(ConcurrentHashMap<EffectKey, PlayerEffect> effects) {
|
||||
this.effects = effects;
|
||||
}
|
||||
|
||||
public PlayerEffect getPlayerEffect(int id, int index) {
|
||||
return effects.get(new EffectKey(id, index));
|
||||
}
|
||||
|
||||
public PlayerEffect getPlayerEffect(int id) {
|
||||
return getPlayerEffect(id, 0);
|
||||
}
|
||||
|
||||
public boolean hasPlayerEffect(int id, int index) {
|
||||
return effects.containsKey(new EffectKey(id, index));
|
||||
}
|
||||
|
||||
public boolean hasPlayerEffect(int id) {
|
||||
return hasPlayerEffect(id, 0);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,21 @@
|
||||
package noppes.npcs.wrapper;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.platform.PlatformService;
|
||||
import kamkeel.npcs.platform.entity.*;
|
||||
import noppes.npcs.platform.nbt.INBTCompound;
|
||||
import noppes.npcs.platform.nbt.INBTList;
|
||||
import noppes.npcs.platform.nbt.NBTFactory;
|
||||
import noppes.npcs.wrapper.nbt.MC1710NBTFactory;
|
||||
import noppes.npcs.wrapper.nbt.MC1710NBTIO;
|
||||
import kamkeel.npcs.wrapper.platform.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -91,4 +100,50 @@ public class MC1710PlatformService implements PlatformService {
|
||||
public void logDebug(String message) {
|
||||
System.out.println("[CustomNPC+ DEBUG] " + message);
|
||||
}
|
||||
|
||||
// --- Entity Wrapping ---
|
||||
|
||||
@Override
|
||||
public IPlatformPlayer wrapPlayer(Object mcPlayer) {
|
||||
return new MC1710PlatformPlayer((EntityPlayerMP) mcPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPlatformEntity wrapEntity(Object mcEntity) {
|
||||
return new MC1710PlatformEntity((Entity) mcEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPlatformLiving wrapLiving(Object mcLiving) {
|
||||
return new MC1710PlatformLiving((EntityLivingBase) mcLiving);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPlatformStack wrapStack(Object mcStack) {
|
||||
return new MC1710PlatformStack((ItemStack) mcStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPlatformWorld wrapWorld(Object mcWorld) {
|
||||
return new MC1710PlatformWorld((World) mcWorld);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPlatformDamageSource wrapDamageSource(Object mcSource) {
|
||||
return new MC1710PlatformDamageSource((DamageSource) mcSource);
|
||||
}
|
||||
|
||||
// --- Scheduling ---
|
||||
|
||||
@Override
|
||||
public void runOnMainThread(Runnable task) {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
if (server != null) {
|
||||
// 1.7.10 doesn't have addScheduledTask — just run directly if on main thread
|
||||
// or queue via the server's next tick
|
||||
task.run();
|
||||
} else {
|
||||
task.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user