Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vidal committed 2026-02-14 15:01:24 -03:00
commit 7009bddc20
52 files changed
+1759 -446

No files matched your search

@@ -130,6 +130,12 @@ public abstract class Ability implements IAbility {
protected transient boolean previewMode = false;
protected transient PreviewEntityHandler previewEntityHandler;
// ═══════════════════════════════════════════════════════════════════
// GUI CONTEXT (client-side only, not saved)
// ═══════════════════════════════════════════════════════════════════
protected transient boolean npcInlineEdit = false;
// ═══════════════════════════════════════════════════════════════════
// ABSTRACT METHODS
// ═══════════════════════════════════════════════════════════════════
@@ -1175,61 +1181,37 @@ public abstract class Ability implements IAbility {
maxRange = nbt.getFloat("maxRange");
cooldownTicks = nbt.getInteger("cooldown");
windUpTicks = nbt.getInteger("windUp");
syncWindupWithAnimation = !nbt.hasKey("syncWindup") || nbt.getBoolean("syncWindup");
syncWindupWithAnimation = nbt.getBoolean("syncWindup");
dazedTicks = nbt.getInteger("recovery");
interruptible = nbt.getBoolean("interruptible");
lockMovement = LockMovementType.fromOrdinal(nbt.getInteger("lockMovement"));
if (nbt.hasKey("rotationMode")) {
// Current format
rotationMode = RotationMode.fromOrdinal(nbt.getInteger("rotationMode"));
rotationPhase = LockMovementType.fromOrdinal(nbt.getInteger("rotationPhase"));
} else if (nbt.hasKey("lockType")) {
// Legacy format migration: lockType was LockType enum (0=MOVEMENT, 1=ROTATION, 2=BOTH)
int oldLockType = nbt.getInteger("lockType");
if (oldLockType == 0) {
// MOVEMENT only: movement locked, rotation was free
rotationMode = RotationMode.FREE;
} else if (oldLockType == 1) {
// ROTATION only: rotation locked same timing as old lockMovement, movement was free
rotationMode = RotationMode.LOCKED;
rotationPhase = lockMovement;
lockMovement = LockMovementType.NO;
} else {
// BOTH: both locked same timing
rotationMode = RotationMode.LOCKED;
rotationPhase = lockMovement;
}
} else {
rotationMode = RotationMode.FREE;
rotationPhase = LockMovementType.WINDUP_AND_ACTIVE;
}
rotationMode = RotationMode.fromOrdinal(nbt.getInteger("rotationMode"));
rotationPhase = LockMovementType.fromOrdinal(nbt.getInteger("rotationPhase"));
windUpColor = nbt.getInteger("windUpColor");
activeColor = nbt.getInteger("activeColor");
windUpSound = nbt.getString("windUpSound");
activeSound = nbt.getString("activeSound");
windUpAnimationId = nbt.hasKey("windUpAnimationId") ? nbt.getInteger("windUpAnimationId") : -1;
activeAnimationId = nbt.hasKey("activeAnimationId") ? nbt.getInteger("activeAnimationId") : -1;
windUpAnimationId = nbt.getInteger("windUpAnimationId");
activeAnimationId = nbt.getInteger("activeAnimationId");
windUpAnimationName = nbt.getString("windUpAnimationName");
activeAnimationName = nbt.getString("activeAnimationName");
showTelegraph = !nbt.hasKey("showTelegraph") || nbt.getBoolean("showTelegraph");
if (nbt.hasKey("telegraphType")) {
try {
telegraphType = TelegraphType.valueOf(nbt.getString("telegraphType"));
} catch (Exception e) {
telegraphType = TelegraphType.CIRCLE;
}
showTelegraph = nbt.getBoolean("showTelegraph");
try {
telegraphType = TelegraphType.valueOf(nbt.getString("telegraphType"));
} catch (Exception e) {
telegraphType = TelegraphType.CIRCLE;
}
telegraphHeightOffset = nbt.hasKey("telegraphHeightOffset") ? nbt.getFloat("telegraphHeightOffset") : 0.1f;
telegraphHeightOffset = nbt.getFloat("telegraphHeightOffset");
customData = nbt.getCompoundTag("customData");
allowedBy = nbt.hasKey("allowedBy") ? UserType.fromOrdinal(nbt.getInteger("allowedBy")) : UserType.BOTH;
ignoreCooldown = nbt.hasKey("ignoreCooldown") && nbt.getBoolean("ignoreCooldown");
allowedBy = UserType.fromOrdinal(nbt.getInteger("allowedBy"));
ignoreCooldown = nbt.getBoolean("ignoreCooldown");
// Burst
burstEnabled = nbt.hasKey("burstEnabled") && nbt.getBoolean("burstEnabled");
burstAmount = nbt.hasKey("burstAmount") ? nbt.getInteger("burstAmount") : 0;
burstDelay = nbt.hasKey("burstDelay") ? nbt.getInteger("burstDelay") : 0;
burstReplayAnimations = !nbt.hasKey("burstReplayAnimations") || nbt.getBoolean("burstReplayAnimations");
burstOverlap = nbt.hasKey("burstOverlap") && nbt.getBoolean("burstOverlap");
burstEnabled = nbt.getBoolean("burstEnabled");
burstAmount = nbt.getInteger("burstAmount");
burstDelay = nbt.getInteger("burstDelay");
burstReplayAnimations = nbt.getBoolean("burstReplayAnimations");
burstOverlap = nbt.getBoolean("burstOverlap");
// Conditions
conditions.clear();
@@ -1282,6 +1264,14 @@ public abstract class Ability implements IAbility {
return false;
}
public boolean isNpcInlineEdit() {
return npcInlineEdit;
}
public void setNpcInlineEdit(boolean npcInlineEdit) {
this.npcInlineEdit = npcInlineEdit;
}
public int getWeight() {
return weight;
}
@@ -2,67 +2,24 @@ package kamkeel.npcs.controllers.data.ability;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import noppes.npcs.constants.EnumPotionType;
/**
* Represents a configurable potion effect that can be applied by abilities.
* Provides a unified system for managing debuffs like slowness, weakness, poison, etc.
* Uses the unified EnumPotionType enum shared across melee, ranged, and ability systems.
*/
public class AbilityEffect {
public enum EffectType {
NONE("gui.none", -1),
SLOWNESS("potion.moveSlowdown", Potion.moveSlowdown.id),
WEAKNESS("potion.weakness", Potion.weakness.id),
POISON("potion.poison", Potion.poison.id),
WITHER("potion.wither", Potion.wither.id),
BLINDNESS("potion.blindness", Potion.blindness.id),
NAUSEA("potion.confusion", Potion.confusion.id),
HUNGER("potion.hunger", Potion.hunger.id),
MINING_FATIGUE("potion.digSlowDown", Potion.digSlowdown.id),
BURN("ability.effect.burn", -1);
private final String langKey;
private final int potionId;
EffectType(String langKey, int potionId) {
this.langKey = langKey;
this.potionId = potionId;
}
public String getLangKey() {
return langKey;
}
public int getPotionId() {
return potionId;
}
public static String[] getLangKeys() {
EffectType[] types = values();
String[] keys = new String[types.length];
for (int i = 0; i < types.length; i++) keys[i] = types[i].langKey;
return keys;
}
public static EffectType fromOrdinal(int ordinal) {
EffectType[] values = values();
if (ordinal >= 0 && ordinal < values.length) {
return values[ordinal];
}
return NONE;
}
}
private EffectType type = EffectType.NONE;
private EnumPotionType type = EnumPotionType.None;
private int manualPotionId = 0;
private int durationTicks = 60;
private int amplifier = 0; // 0-10
public AbilityEffect() {
}
public AbilityEffect(EffectType type, int durationTicks, int amplifier) {
public AbilityEffect(EnumPotionType type, int durationTicks, int amplifier) {
this.type = type;
this.durationTicks = Math.max(1, durationTicks);
this.amplifier = Math.max(0, Math.min(10, amplifier));
@@ -72,25 +29,27 @@ public class AbilityEffect {
* Creates a copy of this effect.
*/
public AbilityEffect copy() {
return new AbilityEffect(type, durationTicks, amplifier);
AbilityEffect copy = new AbilityEffect(type, durationTicks, amplifier);
copy.manualPotionId = this.manualPotionId;
return copy;
}
/**
* Applies this effect to the given entity.
* Does nothing if type is NONE.
* Does nothing if type is None. Validates potion IDs before applying.
*/
public void apply(EntityLivingBase entity) {
if (entity == null || type == EffectType.NONE) {
if (entity == null || type == EnumPotionType.None) {
return;
}
if (type == EffectType.BURN) {
if (type == EnumPotionType.Fire) {
entity.setFire(Math.max(1, durationTicks / 20));
return;
}
int potionId = type.getPotionId();
if (potionId >= 0) {
int potionId = type.getResolvedPotionId(manualPotionId);
if (EnumPotionType.isValidPotionId(potionId)) {
entity.addPotionEffect(new PotionEffect(potionId, durationTicks, amplifier));
}
}
@@ -100,9 +59,12 @@ public class AbilityEffect {
*/
public NBTTagCompound writeNBT() {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("type", type.ordinal());
nbt.setInteger("potionType", type.ordinal());
nbt.setInteger("duration", durationTicks);
nbt.setInteger("amplifier", amplifier);
if (type == EnumPotionType.Manual) {
nbt.setInteger("manualPotionId", manualPotionId);
}
return nbt;
}
@@ -110,9 +72,12 @@ public class AbilityEffect {
* Reads this effect from NBT.
*/
public void readNBT(NBTTagCompound nbt) {
this.type = EffectType.fromOrdinal(nbt.getInteger("type"));
this.durationTicks = nbt.hasKey("duration") ? nbt.getInteger("duration") : 60;
this.amplifier = nbt.hasKey("amplifier") ? nbt.getInteger("amplifier") : 0;
this.type = EnumPotionType.fromOrdinal(nbt.getInteger("potionType"));
this.durationTicks = nbt.getInteger("duration");
this.amplifier = nbt.getInteger("amplifier");
if (type == EnumPotionType.Manual) {
this.manualPotionId = nbt.getInteger("manualPotionId");
}
}
/**
@@ -126,12 +91,20 @@ public class AbilityEffect {
// Getters & Setters
public EffectType getType() {
public EnumPotionType getType() {
return type;
}
public void setType(EffectType type) {
this.type = type != null ? type : EffectType.NONE;
public void setType(EnumPotionType type) {
this.type = type != null ? type : EnumPotionType.None;
}
public int getManualPotionId() {
return manualPotionId;
}
public void setManualPotionId(int manualPotionId) {
this.manualPotionId = Math.max(0, manualPotionId);
}
public int getDurationTicks() {
@@ -151,9 +124,9 @@ public class AbilityEffect {
}
/**
* Returns true if this effect is configured (not NONE).
* Returns true if this effect is configured (not None).
*/
public boolean isValid() {
return type != EffectType.NONE;
return type != EnumPotionType.None;
}
}
@@ -91,10 +91,10 @@ public class EnergyAnchorData implements IEnergyAnchorData {
}
public void readNBT(NBTTagCompound nbt) {
this.anchorPoint = nbt.hasKey("anchorPoint") ? AnchorPoint.fromOrdinal(nbt.getInteger("anchorPoint")) : AnchorPoint.FRONT;
this.anchorOffsetX = nbt.hasKey("anchorOffsetX") ? nbt.getFloat("anchorOffsetX") : 0;
this.anchorOffsetY = nbt.hasKey("anchorOffsetY") ? nbt.getFloat("anchorOffsetY") : 0;
this.anchorOffsetZ = nbt.hasKey("anchorOffsetZ") ? nbt.getFloat("anchorOffsetZ") : 0;
this.anchorPoint = AnchorPoint.fromOrdinal(nbt.getInteger("anchorPoint"));
this.anchorOffsetX = nbt.getFloat("anchorOffsetX");
this.anchorOffsetY = nbt.getFloat("anchorOffsetY");
this.anchorOffsetZ = nbt.getFloat("anchorOffsetZ");
}
public EnergyAnchorData copy() {
@@ -97,12 +97,12 @@ public class EnergyCombatData implements IEnergyCombatData {
}
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;
damage = nbt.getFloat("damage");
knockback = nbt.getFloat("knockback");
knockbackUp = nbt.getFloat("knockbackUp");
explosive = nbt.getBoolean("explosive");
explosionRadius = nbt.getFloat("explosionRadius");
explosionDamageFalloff = nbt.getFloat("explosionDamageFalloff");
}
public EnergyCombatData copy() {
@@ -102,12 +102,12 @@ public class EnergyDisplayData implements IEnergyDisplayData {
}
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;
rotationSpeed = nbt.hasKey("rotationSpeed") ? nbt.getFloat("rotationSpeed") : 4.0f;
innerColor = nbt.getInteger("innerColor");
outerColor = nbt.getInteger("outerColor");
outerColorEnabled = nbt.getBoolean("outerColorEnabled");
outerColorWidth = nbt.getFloat("outerColorWidth");
outerColorAlpha = nbt.getFloat("outerColorAlpha");
rotationSpeed = nbt.getFloat("rotationSpeed");
}
public EnergyDisplayData copy() {
@@ -71,10 +71,10 @@ public class EnergyHomingData implements IEnergyHomingData {
}
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;
speed = nbt.getFloat("speed");
homing = nbt.getBoolean("homing");
homingStrength = nbt.getFloat("homingStrength");
homingRange = nbt.getFloat("homingRange");
}
public EnergyHomingData copy() {
@@ -44,8 +44,8 @@ public class EnergyLifespanData implements IEnergyLifespanData {
}
public void readNBT(NBTTagCompound nbt) {
maxDistance = nbt.hasKey("maxDistance") ? nbt.getFloat("maxDistance") : 30.0f;
maxLifetime = nbt.hasKey("maxLifetime") ? nbt.getInteger("maxLifetime") : 200;
maxDistance = nbt.getFloat("maxDistance");
maxLifetime = nbt.getInteger("maxLifetime");
}
public EnergyLifespanData copy() {
@@ -71,10 +71,10 @@ public class EnergyLightningData implements IEnergyLightningData {
}
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;
lightningEffect = nbt.getBoolean("lightningEffect");
lightningDensity = nbt.getFloat("lightningDensity");
lightningRadius = nbt.getFloat("lightningRadius");
lightningFadeTime = nbt.getInteger("lightningFadeTime");
}
public EnergyLightningData copy() {
@@ -184,7 +184,7 @@ public class EnergyTrajectoryData implements IEnergyTrajectoryData {
}
public void readNBT(NBTTagCompound nbt) {
this.currentPath = nbt.hasKey("currentPath") ? nbt.getInteger("currentPath") : 0;
this.currentPath = nbt.getInteger("currentPath");
int i = 0;
while (nbt.hasKey("Path_" + i, Constants.NBT.TAG_COMPOUND)) {
@@ -275,8 +275,8 @@ public class EnergyTrajectoryData implements IEnergyTrajectoryData {
}
public void readNBT(NBTTagCompound nbt) {
this.delayTicks = nbt.hasKey("delay") ? nbt.getInteger("delay") : 0;
this.concluded = nbt.hasKey("concluded") && nbt.getBoolean("concluded");
this.delayTicks = nbt.getInteger("delay");
this.concluded = nbt.getBoolean("concluded");
double x = nbt.getDouble("X");
double y = nbt.getDouble("Y");
@@ -44,8 +44,8 @@ public class ProjectileData {
anchor.readNBT(nbt);
colorOverride = nbt.getBoolean("colorOverride");
if (colorOverride) {
innerColor = nbt.hasKey("overrideInnerColor") ? nbt.getInteger("overrideInnerColor") : 0xFFFFFF;
outerColor = nbt.hasKey("overrideOuterColor") ? nbt.getInteger("overrideOuterColor") : 0x8888FF;
innerColor = nbt.getInteger("overrideInnerColor");
outerColor = nbt.getInteger("overrideOuterColor");
}
}
@@ -12,6 +12,7 @@ import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.constants.EnumPotionType;
import java.util.ArrayList;
import java.util.HashMap;
@@ -26,7 +27,7 @@ import java.util.Map;
public class AbilityFieldBuilder extends GuiFieldBuilder {
// Effects list metadata: widgetId -> [effectIndex, action]
// action: 0=type, 1=duration(text), 2=amp, 3=delete, 4=add
// action: 0=type, 1=duration(text), 2=amp, 3=delete, 4=add, 5=manualId(text)
private final Map<Integer, int[]> effectWidgetMeta = new HashMap<>();
public AbilityFieldBuilder(GuiNPCInterface parent, FontRenderer fontRenderer) {
@@ -57,15 +58,15 @@ public class AbilityFieldBuilder extends GuiFieldBuilder {
List<AbilityEffect> effects = (List<AbilityEffect>) def.getValue();
if (effects == null) effects = new ArrayList<>();
String[] typeNames = AbilityEffect.EffectType.getLangKeys();
String[] typeNames = EnumPotionType.getLangKeysNoNone();
String[] ampValues = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
for (int e = 0; e < effects.size() && e < 5; e++) {
AbilityEffect effect = effects.get(e);
// Type selector button
int typeIdx = effect.getType().ordinal();
GuiNpcButton typeBtn = new GuiNpcButton(widgetId, colLLabel, y, 100, 20, typeNames, typeIdx);
// Type selector button (index offset by -1 since None is excluded)
int typeIdx = effect.getType().ordinal() - 1;
GuiNpcButton typeBtn = new GuiNpcButton(widgetId, colLLabel, y, 100, 20, typeNames, Math.max(0, typeIdx));
sw.addButton(typeBtn);
buttonFieldMap.put(widgetId, def);
effectWidgetMeta.put(widgetId, new int[]{e, 0});
@@ -81,12 +82,16 @@ public class AbilityFieldBuilder extends GuiFieldBuilder {
effectWidgetMeta.put(widgetId, new int[]{e, 1});
widgetId++;
// Amplifier selector (0-10)
GuiNpcButton ampBtn = new GuiNpcButton(widgetId, colLLabel + 158, y, 40, 20, ampValues, effect.getAmplifier());
sw.addButton(ampBtn);
buttonFieldMap.put(widgetId, def);
effectWidgetMeta.put(widgetId, new int[]{e, 2});
widgetId++;
if (effect.getType() != EnumPotionType.Fire) {
// Amplifier selector (0-10) — not applicable to Fire
GuiNpcButton ampBtn = new GuiNpcButton(widgetId, colLLabel + 158, y, 40, 20, ampValues, effect.getAmplifier());
sw.addButton(ampBtn);
buttonFieldMap.put(widgetId, def);
effectWidgetMeta.put(widgetId, new int[]{e, 2});
widgetId++;
} else {
widgetId++; // keep widgetId in sync
}
// Delete button
GuiNpcButton delBtn = new GuiNpcButton(clearId, colLLabel + 202, y, 20, 20, "X");
@@ -96,6 +101,20 @@ public class AbilityFieldBuilder extends GuiFieldBuilder {
clearId++;
y += rowHeight;
// Manual potion ID field (shown on next row when type is Manual)
if (effect.getType() == EnumPotionType.Manual) {
sw.addLabel(new GuiNpcLabel(labelId++, "effect.potionid", colLLabel, y + 5, 0xFFFFFF));
GuiNpcTextField idField = new GuiNpcTextField(widgetId, parent, fontRenderer,
colLLabel + 80, y, 50, 20, String.valueOf(effect.getManualPotionId()));
idField.setIntegersOnly();
idField.setMinMaxDefault(0, Integer.MAX_VALUE, 0);
sw.addTextField(idField);
textFieldMap.put(widgetId, def);
effectWidgetMeta.put(widgetId, new int[]{e, 5});
widgetId++;
y += rowHeight;
}
}
// Add button (if < 5 effects)
@@ -133,7 +152,7 @@ public class AbilityFieldBuilder extends GuiFieldBuilder {
switch (action) {
case 0: // Type changed
if (effectIdx < effects.size()) {
effects.get(effectIdx).setType(AbilityEffect.EffectType.fromOrdinal(((GuiNpcButton) button).getValue()));
effects.get(effectIdx).setType(EnumPotionType.fromIndexNoNone(((GuiNpcButton) button).getValue()));
}
return true;
case 2: // Amp changed
@@ -148,7 +167,7 @@ public class AbilityFieldBuilder extends GuiFieldBuilder {
return true;
case 4: // Add
if (effects.size() < 5) {
effects.add(new AbilityEffect(AbilityEffect.EffectType.SLOWNESS, 60, 0));
effects.add(new AbilityEffect(EnumPotionType.Slowness, 60, 0));
}
return true;
}
@@ -162,12 +181,16 @@ public class AbilityFieldBuilder extends GuiFieldBuilder {
@SuppressWarnings("unchecked")
public boolean handleTextFieldEvent(int textFieldId, GuiNpcTextField field) {
int[] meta = effectWidgetMeta.get(textFieldId);
if (meta != null && meta[1] == 1) { // duration field
if (meta != null) {
FieldDef def = textFieldMap.get(textFieldId);
if (def != null && def.getType() == FieldType.EFFECTS_LIST) {
List<AbilityEffect> effects = (List<AbilityEffect>) def.getValue();
if (effects != null && meta[0] < effects.size()) {
effects.get(meta[0]).setDurationTicks(field.getInteger());
if (meta[1] == 1) { // duration field
effects.get(meta[0]).setDurationTicks(field.getInteger());
} else if (meta[1] == 5) { // manual potion ID field
effects.get(meta[0]).setManualPotionId(field.getInteger());
}
}
return true;
}
@@ -356,13 +356,13 @@ public class AbilityBeam extends Ability implements IAbilityEnergyBeam {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
this.beamWidth = nbt.hasKey("beamWidth") ? nbt.getFloat("beamWidth") : 0.4f;
this.headSize = nbt.hasKey("headSize") ? nbt.getFloat("headSize") : 0.6f;
this.beamWidth = nbt.getFloat("beamWidth");
this.headSize = nbt.getFloat("headSize");
int count = nbt.hasKey("projectileCount") ? nbt.getInteger("projectileCount") : 1;
int count = nbt.getInteger("projectileCount");
initProjectiles(count);
this.fireDelay = nbt.hasKey("fireDelay") ? nbt.getInteger("fireDelay") : 0;
this.fireDelay = nbt.getInteger("fireDelay");
combatData.readNBT(nbt);
homingData.readNBT(nbt);
@@ -258,7 +258,32 @@ public class AbilityCharge extends Ability implements IAbilityCharge {
double nextX = chargeDirection.xCoord * chargeSpeed;
double nextZ = chargeDirection.zCoord * chargeSpeed;
AxisAlignedBB nextBox = caster.boundingBox.copy().offset(nextX, 0, nextZ);
return !caster.worldObj.getCollidingBoundingBoxes(caster, nextBox).isEmpty();
double stepThreshold = nextBox.minY + Math.max(caster.stepHeight, 0.5);
int x1 = (int) Math.floor(nextBox.minX);
int x2 = (int) Math.floor(nextBox.maxX + 1.0);
int y1 = (int) Math.floor(nextBox.minY) - 1;
int y2 = (int) Math.floor(nextBox.maxY + 1.0);
int z1 = (int) Math.floor(nextBox.minZ);
int z2 = (int) Math.floor(nextBox.maxZ + 1.0);
java.util.ArrayList<AxisAlignedBB> collisionBoxes = new java.util.ArrayList<>();
for (int bx = x1; bx < x2; bx++) {
for (int bz = z1; bz < z2; bz++) {
for (int by = y1; by < y2; by++) {
net.minecraft.block.Block block = caster.worldObj.getBlock(bx, by, bz);
if (!block.getMaterial().blocksMovement()) continue;
collisionBoxes.clear();
block.addCollisionBoxesToList(caster.worldObj, bx, by, bz, nextBox, collisionBoxes, caster);
for (AxisAlignedBB box : collisionBoxes) {
if (box.maxY > stepThreshold) {
return true;
}
}
}
}
}
return false;
}
@Override
@@ -334,16 +359,10 @@ public class AbilityCharge extends Ability implements IAbilityCharge {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
this.chargeSpeed = nbt.hasKey("chargeSpeed") ? nbt.getFloat("chargeSpeed") : 0.8f;
this.damage = nbt.hasKey("damage") ? nbt.getFloat("damage") : 8.0f;
this.knockback = nbt.hasKey("knockback") ? nbt.getFloat("knockback") : 3.0f;
if (nbt.hasKey("hitWidth")) {
this.hitWidth = nbt.getFloat("hitWidth");
} else if (nbt.hasKey("hitRadius")) {
this.hitWidth = nbt.getFloat("hitRadius");
} else {
this.hitWidth = 1.5f;
}
this.chargeSpeed = nbt.getFloat("chargeSpeed");
this.damage = nbt.getFloat("damage");
this.knockback = nbt.getFloat("knockback");
this.hitWidth = nbt.getFloat("hitWidth");
}
// Getters & Setters
@@ -326,19 +326,19 @@ public class AbilityCutter extends Ability implements IAbilityCutter {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
this.arcAngle = nbt.hasKey("arcAngle") ? nbt.getFloat("arcAngle") : 90.0f;
this.range = nbt.hasKey("range") ? nbt.getFloat("range") : 6.0f;
this.damage = nbt.hasKey("damage") ? nbt.getFloat("damage") : 7.0f;
this.knockback = nbt.hasKey("knockback") ? nbt.getFloat("knockback") : 1.5f;
this.arcAngle = nbt.getFloat("arcAngle");
this.range = nbt.getFloat("range");
this.damage = nbt.getFloat("damage");
this.knockback = nbt.getFloat("knockback");
try {
this.sweepMode = SweepMode.valueOf(nbt.getString("sweepMode"));
} catch (Exception e) {
this.sweepMode = SweepMode.SWIPE;
}
this.sweepSpeed = nbt.hasKey("sweepSpeed") ? nbt.getFloat("sweepSpeed") : 6.0f;
this.spinDurationTicks = nbt.hasKey("spinDurationTicks") ? nbt.getInteger("spinDurationTicks") : 60;
this.piercing = !nbt.hasKey("piercing") || nbt.getBoolean("piercing");
this.innerRadius = nbt.hasKey("innerRadius") ? nbt.getFloat("innerRadius") : 0.0f;
this.sweepSpeed = nbt.getFloat("sweepSpeed");
this.spinDurationTicks = nbt.getInteger("spinDurationTicks");
this.piercing = nbt.getBoolean("piercing");
this.innerRadius = nbt.getFloat("innerRadius");
}
// Getters & Setters
@@ -257,7 +257,33 @@ public class AbilityDash extends Ability implements IAbilityDash {
if (dashDirection == null) return true;
double nextX = dashDirection.xCoord * dashSpeed;
double nextZ = dashDirection.zCoord * dashSpeed;
return !caster.worldObj.getCollidingBoundingBoxes(caster, caster.boundingBox.copy().offset(nextX, 0, nextZ)).isEmpty();
AxisAlignedBB nextBox = caster.boundingBox.copy().offset(nextX, 0, nextZ);
double stepThreshold = nextBox.minY + Math.max(caster.stepHeight, 0.5);
int x1 = (int) Math.floor(nextBox.minX);
int x2 = (int) Math.floor(nextBox.maxX + 1.0);
int y1 = (int) Math.floor(nextBox.minY) - 1;
int y2 = (int) Math.floor(nextBox.maxY + 1.0);
int z1 = (int) Math.floor(nextBox.minZ);
int z2 = (int) Math.floor(nextBox.maxZ + 1.0);
java.util.ArrayList<AxisAlignedBB> collisionBoxes = new java.util.ArrayList<>();
for (int bx = x1; bx < x2; bx++) {
for (int bz = z1; bz < z2; bz++) {
for (int by = y1; by < y2; by++) {
net.minecraft.block.Block block = caster.worldObj.getBlock(bx, by, bz);
if (!block.getMaterial().blocksMovement()) continue;
collisionBoxes.clear();
block.addCollisionBoxesToList(caster.worldObj, bx, by, bz, nextBox, collisionBoxes, caster);
for (AxisAlignedBB box : collisionBoxes) {
if (box.maxY > stepThreshold) {
return true;
}
}
}
}
}
return false;
}
@Override
@@ -284,8 +310,8 @@ public class AbilityDash extends Ability implements IAbilityDash {
} catch (Exception e) {
this.dashMode = DashMode.DEFENSIVE;
}
this.dashDistance = nbt.hasKey("dashDistance") ? nbt.getFloat("dashDistance") : 4.0f;
this.dashSpeed = nbt.hasKey("dashSpeed") ? nbt.getFloat("dashSpeed") : 0.5f;
this.dashDistance = nbt.getFloat("dashDistance");
this.dashSpeed = nbt.getFloat("dashSpeed");
}
// Getters & Setters
@@ -368,16 +368,16 @@ public class AbilityDisc extends Ability implements IAbilityDisc {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
this.discRadius = nbt.hasKey("discRadius") ? nbt.getFloat("discRadius") : 1.0f;
this.discThickness = nbt.hasKey("discThickness") ? nbt.getFloat("discThickness") : 0.2f;
this.vertical = nbt.hasKey("vertical") && nbt.getBoolean("vertical");
this.boomerang = nbt.hasKey("boomerang") && nbt.getBoolean("boomerang");
this.boomerangDelay = nbt.hasKey("boomerangDelay") ? nbt.getInteger("boomerangDelay") : 40;
this.discRadius = nbt.getFloat("discRadius");
this.discThickness = nbt.getFloat("discThickness");
this.vertical = nbt.getBoolean("vertical");
this.boomerang = nbt.getBoolean("boomerang");
this.boomerangDelay = nbt.getInteger("boomerangDelay");
int count = nbt.hasKey("projectileCount") ? nbt.getInteger("projectileCount") : 1;
int count = nbt.getInteger("projectileCount");
initProjectiles(count);
this.fireDelay = nbt.hasKey("fireDelay") ? nbt.getInteger("fireDelay") : 0;
this.fireDelay = nbt.getInteger("fireDelay");
// Shared combat/movement data
combatData.readNBT(nbt);
@@ -238,27 +238,19 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
this.durationTicks = nbt.hasKey("durationTicks") ? nbt.getInteger("durationTicks") : 60;
this.damageReduction = nbt.hasKey("damageReduction") ? nbt.getFloat("damageReduction") : 0.5f;
this.canCounter = nbt.hasKey("canCounter") && nbt.getBoolean("canCounter");
this.counterWindow = nbt.hasKey("counterWindow") ? nbt.getInteger("counterWindow") : 10;
this.durationTicks = nbt.getInteger("durationTicks");
this.damageReduction = nbt.getFloat("damageReduction");
this.canCounter = nbt.getBoolean("canCounter");
this.counterWindow = nbt.getInteger("counterWindow");
try {
this.counterType = CounterType.valueOf(nbt.getString("counterType"));
} catch (Exception e) {
this.counterType = CounterType.FLAT;
}
if (nbt.hasKey("counterValue")) {
this.counterValue = nbt.getFloat("counterValue");
} else if (nbt.hasKey("counterDamage")) {
this.counterValue = nbt.getFloat("counterDamage");
} else {
this.counterValue = 6.0f;
}
this.counterSound = nbt.hasKey("counterSound") ? nbt.getString("counterSound") : "random.wood_click";
this.counterAnimationId = nbt.hasKey("counterAnimationId") ? nbt.getInteger("counterAnimationId") : -1;
this.counterAnimationName = nbt.hasKey("counterAnimationName") ?
nbt.getString("counterAnimationName") :
"Ability_Guard_Counter";
this.counterValue = nbt.getFloat("counterValue");
this.counterSound = nbt.getString("counterSound");
this.counterAnimationId = nbt.getInteger("counterAnimationId");
this.counterAnimationName = nbt.getString("counterAnimationName");
}
// Getters & Setters
@@ -115,11 +115,11 @@ public class AbilityHazard extends AbilityZone implements IAbilityHazard {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
readZoneNBT(nbt, 300);
this.radius = nbt.hasKey("radius") ? nbt.getFloat("radius") : 2.0f;
this.damagePerSecond = nbt.hasKey("damagePerSecond") ? nbt.getFloat("damagePerSecond") : 1.0f;
this.damageInterval = nbt.hasKey("damageInterval") ? nbt.getInteger("damageInterval") : 20;
this.ignoreInvulnFrames = nbt.hasKey("ignoreInvulnFrames") && nbt.getBoolean("ignoreInvulnFrames");
this.affectsCaster = nbt.hasKey("affectsCaster") && nbt.getBoolean("affectsCaster");
this.radius = nbt.getFloat("radius");
this.damagePerSecond = nbt.getFloat("damagePerSecond");
this.damageInterval = nbt.getInteger("damageInterval");
this.ignoreInvulnFrames = nbt.getBoolean("ignoreInvulnFrames");
this.affectsCaster = nbt.getBoolean("affectsCaster");
}
// ═══════════════════════════════════════════════════════════════════
@@ -227,13 +227,13 @@ public class AbilityHeal extends Ability implements IAbilityHeal {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
this.durationTicks = nbt.hasKey("durationTicks") ? nbt.getInteger("durationTicks") : 60;
this.healAmount = nbt.hasKey("healAmount") ? nbt.getFloat("healAmount") : 10.0f;
this.healPercent = nbt.hasKey("healPercent") ? nbt.getFloat("healPercent") : 0.0f;
this.healSelf = !nbt.hasKey("healSelf") || nbt.getBoolean("healSelf");
this.healAllies = nbt.hasKey("healAllies") && nbt.getBoolean("healAllies");
this.healRadius = nbt.hasKey("healRadius") ? nbt.getFloat("healRadius") : 0.0f;
this.instantHeal = !nbt.hasKey("instantHeal") || nbt.getBoolean("instantHeal");
this.durationTicks = nbt.getInteger("durationTicks");
this.healAmount = nbt.getFloat("healAmount");
this.healPercent = nbt.getFloat("healPercent");
this.healSelf = nbt.getBoolean("healSelf");
this.healAllies = nbt.getBoolean("healAllies");
this.healRadius = nbt.getFloat("healRadius");
this.instantHeal = nbt.getBoolean("instantHeal");
}
// Getters & Setters
@@ -135,10 +135,10 @@ public class AbilityHeavyHit extends Ability implements IAbilityHeavyHit {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
this.damage = nbt.hasKey("damage") ? nbt.getFloat("damage") : 8.0f;
this.knockback = nbt.hasKey("knockback") ? nbt.getFloat("knockback") : 2.0f;
this.hitLength = nbt.hasKey("hitLength") ? nbt.getFloat("hitLength") : 4.0f;
this.hitWidth = nbt.hasKey("hitWidth") ? nbt.getFloat("hitWidth") : 3.0f;
this.damage = nbt.getFloat("damage");
this.knockback = nbt.getFloat("knockback");
this.hitLength = nbt.getFloat("hitLength");
this.hitWidth = nbt.getFloat("hitWidth");
}
// Getters & Setters
@@ -190,9 +190,9 @@ public class AbilityLaserShot extends Ability implements IAbilityLaserShot {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
this.laserWidth = nbt.hasKey("laserWidth") ? nbt.getFloat("laserWidth") : 0.3f;
this.expansionSpeed = nbt.hasKey("expansionSpeed") ? nbt.getFloat("expansionSpeed") : 3.0f;
this.lingerTicks = nbt.hasKey("lingerTicks") ? nbt.getInteger("lingerTicks") : 8;
this.laserWidth = nbt.getFloat("laserWidth");
this.expansionSpeed = nbt.getFloat("expansionSpeed");
this.lingerTicks = nbt.getInteger("lingerTicks");
anchorData.readNBT(nbt);
colorData.readNBT(nbt);
combatData.readNBT(nbt);
@@ -364,12 +364,12 @@ public class AbilityOrb extends Ability implements IAbilityOrb {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
this.orbSize = nbt.hasKey("orbSize") ? nbt.getFloat("orbSize") : 1.0f;
this.orbSize = nbt.getFloat("orbSize");
int count = nbt.hasKey("projectileCount") ? nbt.getInteger("projectileCount") : 1;
int count = nbt.getInteger("projectileCount");
initProjectiles(count);
this.fireDelay = nbt.hasKey("fireDelay") ? nbt.getInteger("fireDelay") : 0;
this.fireDelay = nbt.getInteger("fireDelay");
// Shared combat/movement data
combatData.readNBT(nbt);
@@ -273,14 +273,14 @@ public class AbilityProjectile extends Ability implements IAbilityProjectile {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
this.damage = nbt.hasKey("damage") ? nbt.getFloat("damage") : 6.0f;
this.speed = nbt.hasKey("speed") ? nbt.getFloat("speed") : 1.5f;
this.knockback = nbt.hasKey("knockback") ? nbt.getFloat("knockback") : 0.5f;
this.projectileType = nbt.hasKey("projectileType") ? nbt.getString("projectileType") : "fireball";
this.explosive = nbt.hasKey("explosive") && nbt.getBoolean("explosive");
this.explosionRadius = nbt.hasKey("explosionRadius") ? nbt.getFloat("explosionRadius") : 0.0f;
this.homing = nbt.hasKey("homing") && nbt.getBoolean("homing");
this.homingStrength = nbt.hasKey("homingStrength") ? nbt.getFloat("homingStrength") : 0.1f;
this.damage = nbt.getFloat("damage");
this.speed = nbt.getFloat("speed");
this.knockback = nbt.getFloat("knockback");
this.projectileType = nbt.getString("projectileType");
this.explosive = nbt.getBoolean("explosive");
this.explosionRadius = nbt.getFloat("explosionRadius");
this.homing = nbt.getBoolean("homing");
this.homingStrength = nbt.getFloat("homingStrength");
}
// Getters & Setters
@@ -127,10 +127,10 @@ public class AbilityShockwave extends Ability implements IAbilityShockwave {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
this.pushRadius = nbt.hasKey("pushRadius") ? nbt.getFloat("pushRadius") : 8.0f;
this.pushStrength = nbt.hasKey("pushStrength") ? nbt.getFloat("pushStrength") : 1.5f;
this.damage = nbt.hasKey("damage") ? nbt.getFloat("damage") : 8.0f;
this.maxTargets = nbt.hasKey("maxTargets") ? nbt.getInteger("maxTargets") : 10;
this.pushRadius = nbt.getFloat("pushRadius");
this.pushStrength = nbt.getFloat("pushStrength");
this.damage = nbt.getFloat("damage");
this.maxTargets = nbt.getInteger("maxTargets");
}
// Getters & Setters
@@ -86,10 +86,20 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
@Override
public void onWindUpTick(EntityLivingBase caster, EntityLivingBase target, World world, int tick) {
if (isPlayerCaster(caster)) {
// Player: slam will launch from current position, no target tracking needed
targetX = caster.posX;
targetY = caster.posY;
targetZ = caster.posZ;
// Player: update target along look direction during windup
if (targetingMode == TargetingMode.AOE_SELF) {
targetX = caster.posX;
targetY = caster.posY;
targetZ = caster.posZ;
} else {
float yawRad = (float) Math.toRadians(caster.rotationYaw);
double dirX = -Math.sin(yawRad);
double dirZ = Math.cos(yawRad);
double launchDist = Math.max(4.0, maxRange * 0.5);
targetX = caster.posX + dirX * launchDist;
targetY = caster.posY;
targetZ = caster.posZ + dirZ * launchDist;
}
} else {
// NPC: update target position during windup for telegraph tracking
if (targetingMode == TargetingMode.AOE_SELF) {
@@ -139,18 +149,22 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
}
/**
* Player slam: Launch straight up. Player controls horizontal movement via WASD.
* Player slam: Launch in look direction using same ballistic arc as NPC slam.
* AOE damage triggers wherever the player lands.
*/
private void executePlayerSlam(EntityLivingBase caster) {
targetX = caster.posX;
targetY = caster.posY;
targetZ = caster.posZ;
// Calculate target position along player's look direction (horizontal only)
float yawRad = (float) Math.toRadians(caster.rotationYaw);
double dirX = -Math.sin(yawRad);
double dirZ = Math.cos(yawRad);
double vy = calculateLaunchVelocity(Math.max(1.0, leapHeight));
caster.motionY = vy;
hasLaunched = true;
caster.velocityChanged = true;
double launchDist = Math.max(4.0, maxRange * 0.5);
targetX = caster.posX + dirX * launchDist;
targetY = caster.posY;
targetZ = caster.posZ + dirZ * launchDist;
launchTowardTarget(caster);
}
/**
@@ -283,11 +297,12 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
caster.fallDistance = 0;
}
// Check for landing
if (caster.onGround && airTicks > 3) {
// Landed!
onLanding(caster, world);
return;
// Check for landing: hit the ground or hit a wall mid-flight
if (airTicks > 3) {
if (caster.onGround || caster.isCollidedHorizontally) {
onLanding(caster, world);
return;
}
}
// Timeout protection - force landing after max air time
@@ -296,14 +311,18 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
return;
}
// NPC: face toward target destination while in air
// Player: free look — player controls their own camera
if (!isPreview() && !isPlayerCaster(caster)) {
// Face toward target destination while in air (both NPC and Player)
if (!isPreview()) {
double dx = targetX - caster.posX;
double dz = targetZ - caster.posZ;
float targetYaw = (float) (Math.atan2(-dx, dz) * 180.0D / Math.PI);
caster.rotationYaw = targetYaw;
caster.rotationYawHead = targetYaw;
if (dx * dx + dz * dz > 0.25) {
float targetYaw = (float) (Math.atan2(-dx, dz) * 180.0D / Math.PI);
caster.rotationYaw = targetYaw;
caster.rotationYawHead = targetYaw;
if (isPlayerCaster(caster)) {
caster.velocityChanged = true;
}
}
}
}
@@ -490,11 +509,11 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
damage = nbt.hasKey("damage") ? nbt.getFloat("damage") : 10.0f;
radius = nbt.hasKey("radius") ? nbt.getFloat("radius") : 5.0f;
knockbackStrength = nbt.hasKey("knockback") ? nbt.getFloat("knockback") : 1.5f;
leapSpeed = nbt.hasKey("leapSpeed") ? nbt.getFloat("leapSpeed") : 1.0f;
leapHeight = nbt.hasKey("leapHeight") ? nbt.getFloat("leapHeight") : 4.0f;
damage = nbt.getFloat("damage");
radius = nbt.getFloat("radius");
knockbackStrength = nbt.getFloat("knockback");
leapSpeed = nbt.getFloat("leapSpeed");
leapHeight = nbt.getFloat("leapHeight");
}
// Getters & Setters
@@ -172,15 +172,15 @@ public class AbilitySweeper extends Ability implements IAbilitySweeper {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
this.beamLength = nbt.hasKey("beamLength") ? nbt.getFloat("beamLength") : 10.0f;
this.beamWidth = nbt.hasKey("beamWidth") ? nbt.getFloat("beamWidth") : 0.3f;
this.beamHeight = nbt.hasKey("beamHeight") ? nbt.getFloat("beamHeight") : 0.5f;
this.damage = nbt.hasKey("damage") ? nbt.getFloat("damage") : 5.0f;
this.damageInterval = nbt.hasKey("damageInterval") ? nbt.getInteger("damageInterval") : 5;
this.piercing = !nbt.hasKey("piercing") || nbt.getBoolean("piercing");
this.sweepSpeed = nbt.hasKey("sweepSpeed") ? nbt.getFloat("sweepSpeed") : 3.0f;
this.numberOfRotations = nbt.hasKey("numberOfRotations") ? nbt.getInteger("numberOfRotations") : 2;
this.lockOnTarget = nbt.hasKey("lockOnTarget") && nbt.getBoolean("lockOnTarget");
this.beamLength = nbt.getFloat("beamLength");
this.beamWidth = nbt.getFloat("beamWidth");
this.beamHeight = nbt.getFloat("beamHeight");
this.damage = nbt.getFloat("damage");
this.damageInterval = nbt.getInteger("damageInterval");
this.piercing = nbt.getBoolean("piercing");
this.sweepSpeed = nbt.getFloat("sweepSpeed");
this.numberOfRotations = nbt.getInteger("numberOfRotations");
this.lockOnTarget = nbt.getBoolean("lockOnTarget");
colorData.readNBT(nbt);
}
@@ -430,24 +430,20 @@ public class AbilityTeleport extends Ability implements IAbilityTeleport {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
if (nbt.hasKey("mode")) {
try {
this.mode = TeleportMode.valueOf(nbt.getString("mode"));
} catch (Exception e) {
this.mode = TeleportMode.BLINK;
}
} else {
try {
this.mode = TeleportMode.valueOf(nbt.getString("mode"));
} catch (Exception e) {
this.mode = TeleportMode.BLINK;
}
this.blinkCount = nbt.hasKey("blinkCount") ? nbt.getInteger("blinkCount") : 3;
this.blinkDelayTicks = nbt.hasKey("blinkDelayTicks") ? nbt.getInteger("blinkDelayTicks") : 10;
this.blinkRadius = nbt.hasKey("blinkRadius") ? nbt.getFloat("blinkRadius") : 8.0f;
this.behindDistance = nbt.hasKey("behindDistance") ? nbt.getFloat("behindDistance") : 2.0f;
this.requireLineOfSight = !nbt.hasKey("requireLineOfSight") || nbt.getBoolean("requireLineOfSight");
this.damageAtStart = nbt.hasKey("damageAtStart") && nbt.getBoolean("damageAtStart");
this.damageAtEnd = nbt.hasKey("damageAtEnd") && nbt.getBoolean("damageAtEnd");
this.damage = nbt.hasKey("damage") ? nbt.getFloat("damage") : 5.0f;
this.damageRadius = nbt.hasKey("damageRadius") ? nbt.getFloat("damageRadius") : 2.0f;
this.blinkCount = nbt.getInteger("blinkCount");
this.blinkDelayTicks = nbt.getInteger("blinkDelayTicks");
this.blinkRadius = nbt.getFloat("blinkRadius");
this.behindDistance = nbt.getFloat("behindDistance");
this.requireLineOfSight = nbt.getBoolean("requireLineOfSight");
this.damageAtStart = nbt.getBoolean("damageAtStart");
this.damageAtEnd = nbt.getBoolean("damageAtEnd");
this.damage = nbt.getFloat("damage");
this.damageRadius = nbt.getFloat("damageRadius");
}
// Getters & Setters
@@ -119,14 +119,14 @@ public class AbilityTrap extends AbilityZone implements IAbilityTrap {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
readZoneNBT(nbt, 300);
this.triggerRadius = nbt.hasKey("triggerRadius") ? nbt.getFloat("triggerRadius") : 2.0f;
this.armTime = nbt.hasKey("armTime") ? nbt.getInteger("armTime") : 20;
this.maxTriggers = nbt.hasKey("maxTriggers") ? nbt.getInteger("maxTriggers") : 1;
this.triggerCooldown = nbt.hasKey("triggerCooldown") ? nbt.getInteger("triggerCooldown") : 20;
this.damage = nbt.hasKey("damage") ? nbt.getFloat("damage") : 6.0f;
this.damageRadius = nbt.hasKey("damageRadius") ? nbt.getFloat("damageRadius") : 0.0f;
this.knockback = nbt.hasKey("knockback") ? nbt.getFloat("knockback") : 0.5f;
this.visible = !nbt.hasKey("visible") || nbt.getBoolean("visible");
this.triggerRadius = nbt.getFloat("triggerRadius");
this.armTime = nbt.getInteger("armTime");
this.maxTriggers = nbt.getInteger("maxTriggers");
this.triggerCooldown = nbt.getInteger("triggerCooldown");
this.damage = nbt.getFloat("damage");
this.damageRadius = nbt.getFloat("damageRadius");
this.knockback = nbt.getFloat("knockback");
this.visible = nbt.getBoolean("visible");
}
// ═══════════════════════════════════════════════════════════════════
@@ -236,14 +236,14 @@ public class AbilityVortex extends Ability implements IAbilityVortex {
@Override
public void readTypeNBT(NBTTagCompound nbt) {
this.pullRadius = nbt.hasKey("pullRadius") ? nbt.getFloat("pullRadius") : 8.0f;
this.pullStrength = nbt.hasKey("pullStrength") ? nbt.getFloat("pullStrength") : 0.8f;
this.damage = nbt.hasKey("damage") ? nbt.getFloat("damage") : 0.0f;
this.knockback = nbt.hasKey("knockback") ? nbt.getFloat("knockback") : 0.0f;
this.aoe = nbt.hasKey("aoe") && nbt.getBoolean("aoe");
this.maxTargets = nbt.hasKey("maxTargets") ? nbt.getInteger("maxTargets") : 5;
this.damageOnPull = nbt.hasKey("damageOnPull") && nbt.getBoolean("damageOnPull");
this.pullDamage = nbt.hasKey("pullDamage") ? nbt.getFloat("pullDamage") : 0.0f;
this.pullRadius = nbt.getFloat("pullRadius");
this.pullStrength = nbt.getFloat("pullStrength");
this.damage = nbt.getFloat("damage");
this.knockback = nbt.getFloat("knockback");
this.aoe = nbt.getBoolean("aoe");
this.maxTargets = nbt.getInteger("maxTargets");
this.damageOnPull = nbt.getBoolean("damageOnPull");
this.pullDamage = nbt.getFloat("pullDamage");
}
// Getters & Setters
@@ -15,6 +15,7 @@ import kamkeel.npcs.entity.EntityAbilityZone.ParticleMotion;
import kamkeel.npcs.entity.EntityAbilityZone.ZoneShape;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.constants.EnumPotionType;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
@@ -255,7 +256,7 @@ public abstract class AbilityZone extends Ability {
particleMotion = 1; particleGlow = true; particleDir = "mc:mobSpell";
colorData.innerColor = 0x44DD44; colorData.outerColor = 0x116611;
windUpColor = 0x6044DD44; activeColor = 0xC044FF44;
effects.add(new AbilityEffect(AbilityEffect.EffectType.POISON, 100, 0));
effects.add(new AbilityEffect(EnumPotionType.Poison, 100, 0));
break;
case "INFERNO":
groundFill = true; groundAlpha = 0.35f; rings = true; ringCount = 3;
@@ -264,7 +265,7 @@ public abstract class AbilityZone extends Ability {
particleMotion = 0; particleGlow = true; particleDir = "mc:flame";
colorData.innerColor = 0xFF6611; colorData.outerColor = 0xCC2200;
windUpColor = 0x60FF6611; activeColor = 0xC0FF4400;
effects.add(new AbilityEffect(AbilityEffect.EffectType.BURN, 60, 0));
effects.add(new AbilityEffect(EnumPotionType.Fire, 60, 0));
break;
case "ARCANE":
groundFill = true; groundAlpha = 0.20f; rings = true; ringCount = 1;
@@ -273,7 +274,7 @@ public abstract class AbilityZone extends Ability {
particleMotion = 1; particleGlow = true; particleDir = "mc:portal";
colorData.innerColor = 0xAA44FF; colorData.outerColor = 0x6622BB;
windUpColor = 0x60AA44FF; activeColor = 0xC0CC66FF;
effects.add(new AbilityEffect(AbilityEffect.EffectType.WEAKNESS, 100, 0));
effects.add(new AbilityEffect(EnumPotionType.Weakness, 100, 0));
break;
case "ELECTRIC":
groundFill = true; groundAlpha = 0.15f; rings = false; ringCount = 1;
@@ -282,7 +283,7 @@ public abstract class AbilityZone extends Ability {
particleMotion = 2; particleGlow = true; particleDir = "mc:enchantmenttable";
colorData.innerColor = 0x4488FF; colorData.outerColor = 0x2244BB;
windUpColor = 0x604488FF; activeColor = 0xC066AAFF;
effects.add(new AbilityEffect(AbilityEffect.EffectType.MINING_FATIGUE, 80, 1));
effects.add(new AbilityEffect(EnumPotionType.MiningFatigue, 80, 1));
break;
case "FROST":
groundFill = true; groundAlpha = 0.25f; rings = true; ringCount = 3;
@@ -291,7 +292,7 @@ public abstract class AbilityZone extends Ability {
particleMotion = 1; particleGlow = true; particleDir = "mc:snowshovel";
colorData.innerColor = 0x88CCFF; colorData.outerColor = 0x4488CC;
windUpColor = 0x6088CCFF; activeColor = 0xC0AADDFF;
effects.add(new AbilityEffect(AbilityEffect.EffectType.SLOWNESS, 100, 1));
effects.add(new AbilityEffect(EnumPotionType.Slowness, 100, 1));
break;
case "DEFAULT":
groundFill = true; groundAlpha = 0.25f; rings = true; ringCount = 3;
@@ -354,37 +355,33 @@ public abstract class AbilityZone extends Ability {
}
protected void readZoneNBT(NBTTagCompound nbt, int defaultDuration) {
this.durationTicks = nbt.hasKey("durationTicks") ? nbt.getInteger("durationTicks") : defaultDuration;
if (nbt.hasKey("zoneShape")) {
try { this.zoneShape = ZoneShape.valueOf(nbt.getString("zoneShape")); }
catch (Exception e) { this.zoneShape = ZoneShape.CIRCLE; }
} else {
this.zoneShape = ZoneShape.CIRCLE;
}
this.spawnRadius = nbt.hasKey("spawnRadius") ? nbt.getFloat("spawnRadius") : 10.0f;
this.zoneCount = nbt.hasKey("zoneCount") ? nbt.getInteger("zoneCount") : 3;
this.zoneHeight = nbt.hasKey("zoneHeight") ? nbt.getFloat("zoneHeight") : 2.0f;
this.particleDensity = nbt.hasKey("particleDensity") ? nbt.getFloat("particleDensity") : 1.0f;
this.particleScale = nbt.hasKey("particleScale") ? nbt.getFloat("particleScale") : 1.0f;
this.animSpeed = nbt.hasKey("animSpeed") ? nbt.getFloat("animSpeed") : 1.0f;
this.lightningDensity = nbt.hasKey("lightningDensity") ? nbt.getFloat("lightningDensity") : 1.0f;
this.durationTicks = nbt.getInteger("durationTicks");
try { this.zoneShape = ZoneShape.valueOf(nbt.getString("zoneShape")); }
catch (Exception e) { this.zoneShape = ZoneShape.CIRCLE; }
this.spawnRadius = nbt.getFloat("spawnRadius");
this.zoneCount = nbt.getInteger("zoneCount");
this.zoneHeight = nbt.getFloat("zoneHeight");
this.particleDensity = nbt.getFloat("particleDensity");
this.particleScale = nbt.getFloat("particleScale");
this.animSpeed = nbt.getFloat("animSpeed");
this.lightningDensity = nbt.getFloat("lightningDensity");
colorData.readNBT(nbt);
// Visual layer fields
this.groundFill = !nbt.hasKey("groundFill") || nbt.getBoolean("groundFill");
this.groundAlpha = nbt.hasKey("groundAlpha") ? nbt.getFloat("groundAlpha") : 0.25f;
this.rings = !nbt.hasKey("rings") || nbt.getBoolean("rings");
this.ringCount = nbt.hasKey("ringCount") ? nbt.getInteger("ringCount") : 3;
this.border = !nbt.hasKey("border") || nbt.getBoolean("border");
this.borderSpeed = nbt.hasKey("borderSpeed") ? nbt.getFloat("borderSpeed") : 1.0f;
this.accents = !nbt.hasKey("accents") || nbt.getBoolean("accents");
this.accentStyle = nbt.hasKey("accentStyle") ? nbt.getInteger("accentStyle") : 0;
this.lightning = nbt.hasKey("lightning") && nbt.getBoolean("lightning");
this.particles = !nbt.hasKey("particles") || nbt.getBoolean("particles");
this.particleMotion = nbt.hasKey("particleMotion") ? nbt.getInteger("particleMotion") : 0;
this.particleDir = nbt.hasKey("particleDir") ? nbt.getString("particleDir") : "";
this.particleSize = nbt.hasKey("particleSize") ? nbt.getInteger("particleSize") : 32;
this.particleGlow = !nbt.hasKey("particleGlow") || nbt.getBoolean("particleGlow");
this.groundFill = nbt.getBoolean("groundFill");
this.groundAlpha = nbt.getFloat("groundAlpha");
this.rings = nbt.getBoolean("rings");
this.ringCount = nbt.getInteger("ringCount");
this.border = nbt.getBoolean("border");
this.borderSpeed = nbt.getFloat("borderSpeed");
this.accents = nbt.getBoolean("accents");
this.accentStyle = nbt.getInteger("accentStyle");
this.lightning = nbt.getBoolean("lightning");
this.particles = nbt.getBoolean("particles");
this.particleMotion = nbt.getInteger("particleMotion");
this.particleDir = nbt.getString("particleDir");
this.particleSize = nbt.getInteger("particleSize");
this.particleGlow = nbt.getBoolean("particleGlow");
}
// ═════════════════════════════════════════════════════════════════
@@ -274,6 +274,9 @@ public class EntityAbilityBeam extends EntityAbilityProjectile {
setCharging(false);
// For player casters, snap to look vector for crosshair-aligned launch
snapToPlayerLookVector();
// Origin (tail) stays at the charged position - where the orb was
// This is the same for both anchored and non-anchored modes
startX = posX;
@@ -226,6 +226,9 @@ public class EntityAbilityDisc extends EntityAbilityProjectile {
setCharging(false);
// For player casters, snap to look vector for crosshair-aligned launch
snapToPlayerLookVector();
// Update start position to current position
startX = posX;
startY = posY;
@@ -200,6 +200,9 @@ public class EntityAbilityOrb extends EntityAbilityProjectile {
setCharging(false);
// For player casters, snap to look vector for crosshair-aligned launch
snapToPlayerLookVector();
// Update start position to current position
startX = posX;
startY = posY;
@@ -17,6 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import noppes.npcs.NpcDamageSource;
import noppes.npcs.api.entity.IEnergyProjectile;
@@ -428,6 +429,32 @@ public abstract class EntityAbilityProjectile extends Entity implements IEnergyP
}
}
// ==================== LAUNCH HELPERS ====================
/**
* For player casters, snap the projectile to a position along the player's look vector.
* This ensures projectiles launch aligned with the crosshair rather than from the hand anchor.
* Only affects player casters; NPC projectiles launch from their anchor position as configured.
* Should be called in startMoving/startFiring BEFORE setting startX/Y/Z.
*/
protected void snapToPlayerLookVector() {
Entity owner = getOwnerEntity();
if (!(owner instanceof EntityPlayer)) return;
Vec3 look = owner.getLookVec();
double eyeY = owner.posY + owner.getEyeHeight();
float frontDist = Math.max(0.5f, size * 0.5f);
double newX = owner.posX + look.xCoord * frontDist;
double newY = eyeY + look.yCoord * frontDist;
double newZ = owner.posZ + look.zCoord * frontDist;
setPosition(newX, newY, newZ);
prevPosX = newX;
prevPosY = newY;
prevPosZ = newZ;
}
// ==================== ENTITY HELPERS ====================
public Entity getOwnerEntity() {
@@ -26,6 +26,7 @@ import kamkeel.npcs.network.packets.data.SoundManagementPacket;
import kamkeel.npcs.network.packets.data.SwingPlayerArmPacket;
import kamkeel.npcs.network.packets.data.UpdateAnimationsPacket;
import kamkeel.npcs.network.packets.data.VillagerListPacket;
import kamkeel.npcs.network.packets.data.ability.PlayerAbilityStatePacket;
import kamkeel.npcs.network.packets.data.ability.PlayerAbilitySyncPacket;
import kamkeel.npcs.network.packets.data.telegraph.TelegraphRemovePacket;
import kamkeel.npcs.network.packets.data.telegraph.TelegraphSpawnPacket;
@@ -588,6 +589,7 @@ public class PacketHandler {
DATA_PACKET.registerPacket(new TelegraphSpawnPacket());
DATA_PACKET.registerPacket(new TelegraphRemovePacket());
DATA_PACKET.registerPacket(new PlayerAbilitySyncPacket());
DATA_PACKET.registerPacket(new PlayerAbilityStatePacket());
}
public void registerPlayerPackets() {
@@ -63,6 +63,7 @@ public enum EnumDataPacket {
TELEGRAPH_SPAWN,
TELEGRAPH_REMOVE,
PLAYER_ABILITY_SYNC,
PLAYER_ABILITY_STATE,
// Auction System
AUCTION_DATA,
@@ -0,0 +1,84 @@
package kamkeel.npcs.network.packets.data.ability;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import kamkeel.npcs.network.AbstractPacket;
import kamkeel.npcs.network.PacketChannel;
import kamkeel.npcs.network.PacketHandler;
import kamkeel.npcs.network.enums.EnumDataPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import noppes.npcs.client.ClientAbilityState;
import java.io.IOException;
/**
* Lightweight packet syncing ability lock state from server to client.
* Sent every tick during ability execution when flags change, and once when ability ends.
*
* Flags byte layout:
* bit 0: movement locked (suppress WASD, zero motion)
* bit 1: rotation locked (freeze yaw/pitch)
* bit 2: has ability movement (ability controls motion — suppress WASD but don't zero)
* bit 3: position locked (freeze position)
*/
public final class PlayerAbilityStatePacket extends AbstractPacket {
public static final String packetName = "Data|PlayerAbilityState";
public static final byte FLAG_MOVEMENT_LOCKED = 1;
public static final byte FLAG_ROTATION_LOCKED = 2;
public static final byte FLAG_HAS_ABILITY_MOVEMENT = 4;
public static final byte FLAG_POSITION_LOCKED = 8;
private byte flags;
private float lockedYaw;
private float lockedPitch;
public PlayerAbilityStatePacket() {
}
public PlayerAbilityStatePacket(byte flags, float lockedYaw, float lockedPitch) {
this.flags = flags;
this.lockedYaw = lockedYaw;
this.lockedPitch = lockedPitch;
}
@Override
public Enum getType() {
return EnumDataPacket.PLAYER_ABILITY_STATE;
}
@Override
public PacketChannel getChannel() {
return PacketHandler.DATA_PACKET;
}
@Override
public void sendData(ByteBuf out) throws IOException {
out.writeByte(flags);
if ((flags & FLAG_ROTATION_LOCKED) != 0) {
out.writeFloat(lockedYaw);
out.writeFloat(lockedPitch);
}
}
@SideOnly(Side.CLIENT)
@Override
public void receiveData(ByteBuf in, EntityPlayer player) throws IOException {
byte flags = in.readByte();
float yaw = 0, pitch = 0;
if ((flags & FLAG_ROTATION_LOCKED) != 0) {
yaw = in.readFloat();
pitch = in.readFloat();
}
ClientAbilityState.update(flags, yaw, pitch);
}
/**
* Send the current ability state to the player's client.
*/
public static void sendToPlayer(EntityPlayerMP player, byte flags, float lockedYaw, float lockedPitch) {
PacketHandler.Instance.sendToPlayer(new PlayerAbilityStatePacket(flags, lockedYaw, lockedPitch), player);
}
}
@@ -2,6 +2,7 @@ package kamkeel.npcs.util;
import kamkeel.npcs.controllers.data.ability.AnchorPoint;
import kamkeel.npcs.controllers.data.ability.data.EnergyAnchorData;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.Vec3;
import noppes.npcs.constants.EnumAnimationPart;
@@ -18,6 +19,12 @@ import noppes.npcs.entity.data.ModelScalePart;
*/
public class AnchorPointHelper {
// Y offset correction for the local client player.
// EntityPlayerSP.posY is at feet, but the renderer adds yOffset (1.62) visually,
// so anchor positions computed from posY appear ~1.6 blocks too high for the local player.
// Remote players and NPCs don't have this discrepancy.
private static final float CLIENT_PLAYER_Y_OFFSET = -1.6F;
// Default biped model constants (in model units, 1 unit = 1/16 block)
private static final float MODEL_SCALE = 1f / 16f;
@@ -68,7 +75,7 @@ public class AnchorPointHelper {
float anchorZ = anchorData.anchorOffsetZ;
double x = entity.posX;
double y = entity.posY;
double y = entity.posY + getClientPlayerYCorrection(entity);
double z = entity.posZ;
float headYaw = (float) Math.toRadians(entity.rotationYawHead);
@@ -127,6 +134,18 @@ public class AnchorPointHelper {
return 1f;
}
/**
* Returns Y offset correction for the local client player.
* On the client, EntityPlayerSP.posY is at feet level but the renderer adds yOffset (1.62),
* causing anchor positions to appear ~1.6 blocks too high. This matches DBC's correction.
*/
private static double getClientPlayerYCorrection(EntityLivingBase entity) {
if (entity.worldObj.isRemote && entity instanceof EntityPlayerSP) {
return CLIENT_PLAYER_Y_OFFSET;
}
return 0.0;
}
// Default arm scale (no scaling)
private static final ModelScalePart DEFAULT_ARM_SCALE = new ModelScalePart();
@@ -251,7 +270,7 @@ public class AnchorPointHelper {
// Final world position
double worldX = entity.posX + worldOffsetX;
double worldY = entity.posY + shoulderHeight - blockY;
double worldY = entity.posY + getClientPlayerYCorrection(entity) + shoulderHeight - blockY;
double worldZ = entity.posZ + worldOffsetZ;
// Rotate offsets relative to entity's body yaw
@@ -324,7 +343,7 @@ public class AnchorPointHelper {
double armLengthOffset = armScale.scaleY * 0.3 * scale;
double x = entity.posX + lateralX + forwardX;
double y = entity.posY + entity.height * FALLBACK_ARM_HEIGHT + armLengthOffset;
double y = entity.posY + getClientPlayerYCorrection(entity) + entity.height * FALLBACK_ARM_HEIGHT + armLengthOffset;
double z = entity.posZ + lateralZ + forwardZ;
// Rotate offsets relative to entity's body yaw
+13 -3
View File
@@ -20,6 +20,7 @@ public class DataStats {
public EnumPotionType potionType = EnumPotionType.None;
public int potionDuration = 5; //20 = 1 second
public int potionAmp = 0;
public int potionManualId = 0;
public double maxHealth = 20;
public int respawnTime = 20;
@@ -45,6 +46,7 @@ public class DataStats {
public boolean pPhysics = true, pXlr8 = false, pGlows = false, pExplode = false;
public boolean pRender3D = false, pSpin = false, pStick = false, pBurnItem = false;
public EnumPotionType pEffect = EnumPotionType.None;
public int pManualId = 0;
public EnumParticleType pTrail = EnumParticleType.None;
public ScriptParticle pCustom = new ScriptParticle("");
public int pEffAmp = 0;
@@ -88,6 +90,8 @@ public class DataStats {
compound.setInteger("PotionEffect", potionType.ordinal());
compound.setInteger("PotionDuration", potionDuration);
compound.setInteger("PotionAmp", potionAmp);
if (potionType == EnumPotionType.Manual)
compound.setInteger("PotionManualId", potionManualId);
compound.setInteger("MaxFiringRange", rangedRange);
compound.setInteger("FireRate", fireRate);
@@ -122,6 +126,8 @@ public class DataStats {
compound.setTag("pCustom", pCustom.writeToNBT());
if (pEffect == EnumPotionType.Fire)
compound.setBoolean("pBurnItem", pBurnItem);
if (pEffect == EnumPotionType.Manual)
compound.setInteger("pManualId", pManualId);
compound.setBoolean("ImmuneToFire", immuneToFire);
compound.setBoolean("PotionImmune", potionImmune);
@@ -145,7 +151,7 @@ public class DataStats {
aggroRange = compound.getInteger("AggroRange");
respawnTime = compound.getInteger("RespawnTime");
spawnCycle = compound.getInteger("SpawnCycle");
creatureType = EnumCreatureAttribute.values()[compound.getInteger("CreatureType") % EnumPotionType.values().length];
creatureType = EnumCreatureAttribute.values()[compound.getInteger("CreatureType") % EnumCreatureAttribute.values().length];
ignoreCobweb = compound.getBoolean("IgnoreCobweb");
healthRegen = compound.getFloat("HealthRegen");
combatRegen = compound.getFloat("CombatRegen");
@@ -155,9 +161,11 @@ public class DataStats {
swingWarmUp = ValueUtil.clamp(compound.getInteger("SwingWarmup"), 0, 1000);
attackRange = compound.getInteger("AttackRange");
knockback = compound.getInteger("KnockBack");
potionType = EnumPotionType.values()[compound.getInteger("PotionEffect") % EnumPotionType.values().length];
potionType = EnumPotionType.fromOrdinal(compound.getInteger("PotionEffect"));
potionDuration = compound.getInteger("PotionDuration");
potionAmp = compound.getInteger("PotionAmp");
if (potionType == EnumPotionType.Manual)
potionManualId = compound.getInteger("PotionManualId");
rangedRange = compound.getInteger("MaxFiringRange");
fireRate = compound.getInteger("FireRate");
@@ -180,7 +188,7 @@ public class DataStats {
pRender3D = compound.getBoolean("pRender3D");
pSpin = compound.getBoolean("pSpin");
pStick = compound.getBoolean("pStick");
pEffect = EnumPotionType.values()[compound.getInteger("pEffect") % EnumPotionType.values().length];
pEffect = EnumPotionType.fromOrdinal(compound.getInteger("pEffect"));
pTrail = EnumParticleType.values()[compound.getInteger("pTrail") % EnumParticleType.values().length];
pEffAmp = compound.getInteger("pEffAmp");
fireSound = compound.getString("FiringSound");
@@ -195,6 +203,8 @@ public class DataStats {
pCustom = ScriptParticle.fromNBT(compound.getCompoundTag("pCustom"));
if (pEffect == EnumPotionType.Fire)
pBurnItem = compound.getBoolean("pBurnItem");
if (pEffect == EnumPotionType.Manual)
pManualId = compound.getInteger("pManualId");
immuneToFire = compound.getBoolean("ImmuneToFire");
potionImmune = compound.getBoolean("PotionImmune");
@@ -8,6 +8,7 @@ import cpw.mods.fml.relauncher.Side;
import kamkeel.npcs.addon.DBCAddon;
import kamkeel.npcs.controllers.AttributeController;
import kamkeel.npcs.controllers.SyncController;
import kamkeel.npcs.controllers.data.ability.Ability;
import kamkeel.npcs.util.AttributeAttackUtil;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@@ -100,9 +101,14 @@ public class ScriptPlayerEventHandler {
playerData.abilityData.tick(player);
// Lock player movement during ability phases that require it
// Skip zeroing if the ability has its own movement (Charge/Dash/Slam)
if (playerData.abilityData.isMovementLocked()) {
player.motionX = 0;
player.motionZ = 0;
Ability current = playerData.abilityData.getCurrentAbility();
if (current == null || !current.hasAbilityMovement()) {
player.motionX = 0;
player.motionZ = 0;
player.velocityChanged = true;
}
}
if (playerData.updateClient) {
@@ -0,0 +1,59 @@
package noppes.npcs.client;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import kamkeel.npcs.network.packets.data.ability.PlayerAbilityStatePacket;
/**
* Client-side state holder for player ability lock flags.
* Updated by {@link PlayerAbilityStatePacket} from the server.
* Read by {@link ClientTickHandler} to suppress WASD input and enforce rotation.
*/
@SideOnly(Side.CLIENT)
public class ClientAbilityState {
public static boolean movementLocked = false;
public static boolean rotationLocked = false;
public static boolean hasAbilityMovement = false;
public static boolean positionLocked = false;
public static float lockedYaw = 0;
public static float lockedPitch = 0;
/**
* Update state from a received packet.
*/
public static void update(byte flags, float yaw, float pitch) {
movementLocked = (flags & PlayerAbilityStatePacket.FLAG_MOVEMENT_LOCKED) != 0;
rotationLocked = (flags & PlayerAbilityStatePacket.FLAG_ROTATION_LOCKED) != 0;
hasAbilityMovement = (flags & PlayerAbilityStatePacket.FLAG_HAS_ABILITY_MOVEMENT) != 0;
positionLocked = (flags & PlayerAbilityStatePacket.FLAG_POSITION_LOCKED) != 0;
lockedYaw = yaw;
lockedPitch = pitch;
}
/**
* Whether player WASD movement input should be suppressed.
* True when movement/position is locked or ability has its own movement.
*/
public static boolean shouldSuppressMovementInput() {
return movementLocked || hasAbilityMovement || positionLocked;
}
/**
* Whether player camera rotation should be locked.
*/
public static boolean shouldLockRotation() {
return rotationLocked;
}
/**
* Reset all state. Called on world change / disconnect.
*/
public static void reset() {
movementLocked = false;
rotationLocked = false;
hasAbilityMovement = false;
positionLocked = false;
lockedYaw = 0;
lockedPitch = 0;
}
}
@@ -56,6 +56,7 @@ public class ClientTickHandler {
if ((this.prevWorld == null || mc.theWorld == null) && this.prevWorld != mc.theWorld) {
if (mc.theWorld == null) {
ClientCacheHandler.clearCache();
ClientAbilityState.reset();
}
this.prevWorld = mc.theWorld;
}
@@ -72,6 +73,19 @@ public class ClientTickHandler {
lastSpecialKeyDown = specialKeyDown;
}
// Suppress player input during ability-controlled phases
if (ClientAbilityState.shouldSuppressMovementInput()) {
mc.thePlayer.movementInput.moveForward = 0;
mc.thePlayer.movementInput.moveStrafe = 0;
mc.thePlayer.movementInput.jump = false;
}
if (ClientAbilityState.shouldLockRotation()) {
mc.thePlayer.rotationYaw = ClientAbilityState.lockedYaw;
mc.thePlayer.rotationPitch = ClientAbilityState.lockedPitch;
mc.thePlayer.prevRotationYaw = ClientAbilityState.lockedYaw;
mc.thePlayer.prevRotationPitch = ClientAbilityState.lockedPitch;
}
if (player.ridingEntity instanceof EntityNPCInterface) {
EntityNPCInterface mount = (EntityNPCInterface) player.ridingEntity;
if (mount.advanced.role == EnumRoleType.Mount && mount.roleInterface instanceof RoleMount) {
@@ -12,7 +12,6 @@ import noppes.npcs.constants.EnumPotionType;
public class SubGuiNpcMeleeProperties extends SubGuiInterface implements ITextfieldListener {
private DataStats stats;
private String[] potionNames = new String[]{"gui.none", "tile.fire.name", "potion.poison", "potion.hunger", "potion.weakness", "potion.moveSlowdown", "potion.confusion", "potion.blindness", "potion.wither"};
public SubGuiNpcMeleeProperties(DataStats stats) {
this.stats = stats;
@@ -42,18 +41,28 @@ public class SubGuiNpcMeleeProperties extends SubGuiInterface implements ITextfi
getTextField(4).integersOnly = true;
getTextField(4).setMinMaxDefault(0, Integer.MAX_VALUE, 0);
addLabel(new GuiNpcLabel(5, "stats.meleeeffect", guiLeft + 5, guiTop + 135));
addButton(new GuiButtonBiDirectional(5, guiLeft + 85, guiTop + 130, 100, 20, potionNames, stats.potionType.ordinal()));
addButton(new GuiButtonBiDirectional(5, guiLeft + 85, guiTop + 130, 100, 20, EnumPotionType.getLangKeys(), stats.potionType.ordinal()));
if (stats.potionType == EnumPotionType.Manual) {
addLabel(new GuiNpcLabel(8, "effect.potionid", guiLeft + 198, guiTop + 119));
addTextField(new GuiNpcTextField(8, this, fontRendererObj, guiLeft + 200, guiTop + 132, 40, 18, stats.potionManualId + ""));
getTextField(8).integersOnly = true;
getTextField(8).setMinMaxDefault(0, Integer.MAX_VALUE, 0);
}
int y = guiTop + 160;
if (stats.potionType != EnumPotionType.None) {
addLabel(new GuiNpcLabel(6, "gui.time", guiLeft + 5, guiTop + 165));
addTextField(new GuiNpcTextField(6, this, fontRendererObj, guiLeft + 85, guiTop + 160, 40, 18, stats.potionDuration + ""));
addLabel(new GuiNpcLabel(6, "gui.time", guiLeft + 5, y + 5));
addTextField(new GuiNpcTextField(6, this, fontRendererObj, guiLeft + 85, y, 40, 18, stats.potionDuration + ""));
getTextField(6).integersOnly = true;
getTextField(6).setMinMaxDefault(1, Integer.MAX_VALUE, 5);
if (stats.potionType != EnumPotionType.Fire) {
addLabel(new GuiNpcLabel(7, "stats.amplify", guiLeft + 5, guiTop + 195));
addButton(new GuiButtonBiDirectional(7, guiLeft + 85, guiTop + 190, 52, 20, new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, stats.potionAmp));
y += 30;
addLabel(new GuiNpcLabel(7, "stats.amplify", guiLeft + 5, y + 5));
addButton(new GuiButtonBiDirectional(7, guiLeft + 85, y, 52, 20, new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, stats.potionAmp));
}
}
addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done"));
addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + ySize - 26, 60, 20, "gui.done"));
}
public void unFocused(GuiNpcTextField textfield) {
@@ -67,13 +76,15 @@ public class SubGuiNpcMeleeProperties extends SubGuiInterface implements ITextfi
stats.knockback = textfield.getInteger();
} else if (textfield.id == 6) {
stats.potionDuration = textfield.getInteger();
} else if (textfield.id == 8) {
stats.potionManualId = textfield.getInteger();
}
}
protected void actionPerformed(GuiButton guibutton) {
GuiNpcButton button = (GuiNpcButton) guibutton;
if (button.id == 5) {
stats.potionType = EnumPotionType.values()[button.getValue()];
stats.potionType = EnumPotionType.fromOrdinal(button.getValue());
initGui();
}
if (button.id == 7) {
@@ -15,7 +15,6 @@ import noppes.npcs.constants.EnumPotionType;
public class SubGuiNpcProjectiles extends SubGuiInterface implements ITextfieldListener, ISubGuiListener {
private DataStats stats;
private String[] potionNames = new String[]{"gui.none", "tile.fire.name", "potion.poison", "potion.hunger", "potion.weakness", "potion.moveSlowdown", "potion.confusion", "potion.blindness", "potion.wither"};
private String[] trailNames = new String[]{"gui.none", "trail.smoke", "trail.portal", "trail.redstone",
"trail.lightning", "trail.largesmoke", "trail.magic", "trail.enchant", "trail.crit",
"trail.explode", "trail.music", "trail.flame", "trail.lava", "trail.splash",
@@ -76,22 +75,29 @@ public class SubGuiNpcProjectiles extends SubGuiInterface implements ITextfieldL
}
addLabel(new GuiNpcLabel(7, "stats.rangedeffect", guiLeft + 210, y + 5));
addButton(new GuiButtonBiDirectional(4, guiLeft + 280, y, 100, 20, potionNames, stats.pEffect.ordinal()));
addButton(new GuiButtonBiDirectional(4, guiLeft + 280, y, 100, 20, EnumPotionType.getLangKeys(), stats.pEffect.ordinal()));
if (stats.pEffect != EnumPotionType.None) {
int internalY = y + 30;
if (stats.pEffect == EnumPotionType.Manual) {
addLabel(new GuiNpcLabel(110, "effect.potionid", guiLeft + 210, internalY + 5));
addTextField(new GuiNpcTextField(11, this, fontRendererObj, guiLeft + 330, internalY, 52, 20, stats.pManualId + ""));
getTextField(11).integersOnly = true;
getTextField(11).setMinMaxDefault(0, Integer.MAX_VALUE, 0);
internalY += 30;
}
addLabel(new GuiNpcLabel(50, "gui.time", guiLeft + 210, internalY + 5));
addTextField(new GuiNpcTextField(5, this, fontRendererObj, guiLeft + 330, internalY, 52, 20, stats.pDur + ""));
getTextField(5).integersOnly = true;
getTextField(5).setMinMaxDefault(1, Integer.MAX_VALUE, 5);
if (stats.pEffect != EnumPotionType.Fire) {
internalY += 30;
addLabel(new GuiNpcLabel(70, "stats.amplify", guiLeft + 210, internalY + 5));
addButton(new GuiButtonBiDirectional(10, guiLeft + 280, internalY, 52, 20, new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, stats.pEffAmp));
} else {
if (stats.pEffect == EnumPotionType.Fire) {
internalY += 30;
addLabel(new GuiNpcLabel(100, "stats.burnItem", guiLeft + 210, internalY + 5));
addButton(new GuiNpcButtonYesNo(100, guiLeft + 330, internalY, 52, 20, stats.pBurnItem));
} else {
internalY += 30;
addLabel(new GuiNpcLabel(70, "stats.amplify", guiLeft + 210, internalY + 5));
addButton(new GuiButtonBiDirectional(10, guiLeft + 280, internalY, 52, 20, new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, stats.pEffAmp));
}
}
@@ -126,6 +132,8 @@ public class SubGuiNpcProjectiles extends SubGuiInterface implements ITextfieldL
stats.pSpeed = textfield.getInteger();
} else if (textfield.id == 5) {
stats.pDur = textfield.getInteger();
} else if (textfield.id == 11) {
stats.pManualId = textfield.getInteger();
}
}
@@ -146,7 +154,7 @@ public class SubGuiNpcProjectiles extends SubGuiInterface implements ITextfieldL
stats.pArea = button.getValue();
}
if (button.id == 4) {
stats.pEffect = EnumPotionType.values()[button.getValue()];
stats.pEffect = EnumPotionType.fromOrdinal(button.getValue());
initGui();
}
if (button.id == 5) {
@@ -254,6 +254,7 @@ public class GuiNPCAbilities extends GuiNPCInterface2 implements IScrollData, IC
} else {
Ability ability = slot.getAbility();
if (ability != null) {
ability.setNpcInlineEdit(true);
setSubGui(ability.createConfigGui(this));
}
}
@@ -303,6 +304,7 @@ public class GuiNPCAbilities extends GuiNPCInterface2 implements IScrollData, IC
Ability abilityToSave = npcSlots.get(selectedAbilityIndex).getAbility();
if (abilityToSave != null) {
if (abilityToSave.getName() == null || abilityToSave.getName().isEmpty()) {
abilityToSave.setNpcInlineEdit(true);
setSubGui(abilityToSave.createConfigGui(this));
} else {
setSubGui(new SubGuiAbilitySaveConfirm(abilityToSave, null, existingPresetNames));
@@ -632,6 +634,7 @@ public class GuiNPCAbilities extends GuiNPCInterface2 implements IScrollData, IC
setSubGui(new SubGuiAbilityEditMode());
} else {
if (ability != null) {
ability.setNpcInlineEdit(true);
setSubGui(ability.createConfigGui(this));
}
}
@@ -690,6 +693,7 @@ public class GuiNPCAbilities extends GuiNPCInterface2 implements IScrollData, IC
Ability ability = slot.getAbility();
if (ability != null) {
ability.setId(UUID.randomUUID().toString());
ability.setNpcInlineEdit(true);
setSubGui(ability.createConfigGui(this));
}
updateNpcAbilitiesList();
@@ -440,8 +440,7 @@ public abstract class GuiNPCInterface extends GuiScreen {
int bottomHeight = 0;
int bottomTextureV = 0;
if (ySize < bgTextureHeight) {
// Keep bottom border from texture bottom (last 6 pixels of actual content)
bottomHeight = 6;
bottomHeight = -1;
topHeight = ySize - bottomHeight;
bottomTextureV = bgTextureHeight - bottomHeight;
}
@@ -1,5 +1,83 @@
package noppes.npcs.constants;
import net.minecraft.potion.Potion;
public enum EnumPotionType {
None, Fire, Poison, Hunger, Weakness, Slowness, Nausea, Blindness, Wither;
None("gui.none", -1),
Fire("tile.fire.name", -1),
Poison("potion.poison", Potion.poison.id),
Hunger("potion.hunger", Potion.hunger.id),
Weakness("potion.weakness", Potion.weakness.id),
Slowness("potion.moveSlowdown", Potion.moveSlowdown.id),
Nausea("potion.confusion", Potion.confusion.id),
Blindness("potion.blindness", Potion.blindness.id),
Wither("potion.wither", Potion.wither.id),
MiningFatigue("potion.digSlowDown", Potion.digSlowdown.id),
Manual("effect.manual", -1);
private final String langKey;
private final int potionId;
EnumPotionType(String langKey, int potionId) {
this.langKey = langKey;
this.potionId = potionId;
}
public String getLangKey() {
return langKey;
}
public int getPotionId() {
return potionId;
}
/**
* Returns the actual potion ID to apply.
* For Manual type, returns the provided manualId.
* For all others, returns the mapped potionId.
*/
public int getResolvedPotionId(int manualId) {
if (this == Manual) return manualId;
return potionId;
}
public static String[] getLangKeys() {
EnumPotionType[] types = values();
String[] keys = new String[types.length];
for (int i = 0; i < types.length; i++) keys[i] = types[i].langKey;
return keys;
}
/**
* Returns lang keys excluding None. For use in effect lists where None is not a valid choice.
*/
public static String[] getLangKeysNoNone() {
EnumPotionType[] types = values();
String[] keys = new String[types.length - 1];
for (int i = 1; i < types.length; i++) keys[i - 1] = types[i].langKey;
return keys;
}
/**
* Maps a 0-based index (excluding None) back to the corresponding EnumPotionType.
* Index 0 = Fire, 1 = Poison, etc.
*/
public static EnumPotionType fromIndexNoNone(int index) {
return fromOrdinal(index + 1);
}
public static EnumPotionType fromOrdinal(int ordinal) {
EnumPotionType[] values = values();
if (ordinal >= 0 && ordinal < values.length) {
return values[ordinal];
}
return None;
}
/**
* Checks if the given potion ID is valid and registered in the Minecraft potion registry.
*/
public static boolean isValidPotionId(int id) {
return id >= 0 && id < Potion.potionTypes.length && Potion.potionTypes[id] != null;
}
}
@@ -19,6 +19,7 @@ import noppes.npcs.api.ability.IPlayerAbilityData;
import noppes.npcs.controllers.AnimationController;
import noppes.npcs.controllers.data.Animation;
import kamkeel.npcs.network.packets.data.ability.PlayerAbilityStatePacket;
import kamkeel.npcs.network.packets.data.ability.PlayerAbilitySyncPacket;
import java.util.ArrayList;
@@ -77,6 +78,26 @@ public class PlayerAbilityData implements IPlayerAbilityData {
*/
private transient EntityLivingBase currentTarget;
/**
* Rotation lock state - freezes player yaw/pitch during ability phases.
*/
private transient boolean rotationLocked = false;
private transient float lockedYaw = 0;
private transient float lockedPitch = 0;
/**
* Position lock state - freezes player position during ability phases.
*/
private transient boolean positionLocked = false;
private transient double lockedPosX = 0;
private transient double lockedPosY = 0;
private transient double lockedPosZ = 0;
/**
* Last synced state flags byte for change detection (avoids spamming packets).
*/
private transient byte lastSyncedFlags = 0;
// ═══════════════════════════════════════════════════════════════════
// CONSTRUCTOR
// ═══════════════════════════════════════════════════════════════════
@@ -100,6 +121,20 @@ public class PlayerAbilityData implements IPlayerAbilityData {
if (currentAbility != null && currentAbility.isExecuting()) {
tickCurrentAbility(player);
// Apply rotation and position locks after ability tick
applyRotationControl(player);
applyPositionLock(player);
// Sync lock state to client (only sends when flags change)
syncAbilityStateIfNeeded(player);
} else {
// Safety: release orphaned locks if no ability is executing
if (rotationLocked || positionLocked) {
releaseRotationControl();
releaseLockedPosition();
syncAbilityStateClear(player);
}
}
}
@@ -114,17 +149,47 @@ public class PlayerAbilityData implements IPlayerAbilityData {
switch (currentAbility.getPhase()) {
case WINDUP:
if (phaseChanged && oldPhase == AbilityPhase.BURST_DELAY) {
// Burst replay: re-enter windup - set up locks
if (currentAbility.isRotationLockedDuringWindup()) {
captureLockedRotation(player);
}
if (currentAbility.isMovementLockedDuringWindup() && !currentAbility.hasAbilityMovement()) {
captureLockedPosition(player);
}
spawnTelegraph(currentAbility, player, null);
playAbilitySound(player, currentAbility.getWindUpSound());
playAbilityAnimation(currentAbility.getWindUpAnimation());
}
currentAbility.onWindUpTick(player, currentTarget, player.worldObj, currentAbility.getCurrentTick());
break;
case ACTIVE:
if (phaseChanged && oldPhase == AbilityPhase.WINDUP) {
if (phaseChanged && (oldPhase == AbilityPhase.WINDUP || oldPhase == AbilityPhase.BURST_DELAY)) {
// Just entered ACTIVE phase - lock all telegraph positions
for (TelegraphInstance telegraph : currentAbility.getTelegraphInstances()) {
telegraph.lockPosition();
}
removeTelegraph(currentAbility, player);
// Handle rotation control transition from WINDUP to ACTIVE
if (currentAbility.isRotationLockedDuringActive()) {
if (!rotationLocked) {
captureLockedRotation(player);
}
} else if (rotationLocked) {
releaseRotationControl();
}
// Handle position lock transition from WINDUP to ACTIVE
if (currentAbility.isMovementLockedDuringActive() && !currentAbility.hasAbilityMovement()) {
if (!positionLocked) {
captureLockedPosition(player);
}
} else if (positionLocked) {
releaseLockedPosition();
}
// Play active sound and animation
playAbilitySound(player, currentAbility.getActiveSound());
playAbilityAnimation(currentAbility.getActiveAnimation());
@@ -143,6 +208,18 @@ public class PlayerAbilityData implements IPlayerAbilityData {
handleAbilityCompletion(player);
return;
}
// Release locks during burst delay
if (currentAbility.getPhase() == AbilityPhase.BURST_DELAY) {
if (rotationLocked) releaseRotationControl();
if (positionLocked) releaseLockedPosition();
}
break;
case BURST_DELAY:
// Free movement and rotation during burst delay
if (rotationLocked) releaseRotationControl();
if (positionLocked) releaseLockedPosition();
break;
case DAZED:
@@ -163,6 +240,10 @@ public class PlayerAbilityData implements IPlayerAbilityData {
currentAbility.onComplete(player, currentTarget);
// Release all locks
releaseRotationControl();
releaseLockedPosition();
// Apply universal cooldown (using base cooldownTicks only, not min/max random)
if (!currentAbility.isIgnoreCooldown()) {
cooldownEndTime = player.worldObj.getTotalWorldTime() + currentAbility.getCooldownTicks();
@@ -174,6 +255,9 @@ public class PlayerAbilityData implements IPlayerAbilityData {
currentAbility = null;
currentAbilityKey = null;
currentTarget = null;
// Send cleared state to client
syncAbilityStateClear(player);
}
// ═══════════════════════════════════════════════════════════════════
@@ -231,9 +315,21 @@ public class PlayerAbilityData implements IPlayerAbilityData {
if (ability.getPhase() == AbilityPhase.ACTIVE) {
// Windup was 0 — skip telegraph/windup and go straight to active
if (ability.isRotationLockedDuringActive()) {
captureLockedRotation(player);
}
if (ability.isMovementLockedDuringActive() && !ability.hasAbilityMovement()) {
captureLockedPosition(player);
}
executeImmediate(ability, player);
} else {
// Normal windup flow
if (ability.isRotationLockedDuringWindup()) {
captureLockedRotation(player);
}
if (ability.isMovementLockedDuringWindup() && !ability.hasAbilityMovement()) {
captureLockedPosition(player);
}
spawnTelegraph(ability, player, null);
playAbilitySound(player, ability.getWindUpSound());
playAbilityAnimation(ability.getWindUpAnimation());
@@ -412,9 +508,12 @@ public class PlayerAbilityData implements IPlayerAbilityData {
if (currentAbility != null && currentAbility.isExecuting()) {
currentAbility.interrupt();
stopAbilityAnimation();
releaseRotationControl();
releaseLockedPosition();
currentAbility = null;
currentAbilityKey = null;
currentTarget = null;
syncAbilityStateClear(playerData.player);
}
}
@@ -493,6 +592,129 @@ public class PlayerAbilityData implements IPlayerAbilityData {
&& currentAbility.isMovementLockedForCurrentPhase();
}
// ═══════════════════════════════════════════════════════════════════
// ROTATION CONTROL
// ═══════════════════════════════════════════════════════════════════
/**
* Capture current rotation values to lock player's look direction.
*/
private void captureLockedRotation(EntityPlayer player) {
lockedYaw = player.rotationYaw;
lockedPitch = player.rotationPitch;
rotationLocked = true;
}
/**
* Release rotation lock.
*/
private void releaseRotationControl() {
rotationLocked = false;
}
/**
* Apply rotation control on the server side.
* Enforces locked rotation values on the player entity.
*/
private void applyRotationControl(EntityPlayer player) {
if (!rotationLocked || currentAbility == null) return;
if (currentAbility.isRotationLockedForCurrentPhase()) {
player.rotationYaw = lockedYaw;
player.rotationPitch = lockedPitch;
player.prevRotationYaw = lockedYaw;
player.prevRotationPitch = lockedPitch;
if (player instanceof EntityPlayerMP) {
player.rotationYawHead = lockedYaw;
}
}
}
// ═══════════════════════════════════════════════════════════════════
// POSITION LOCKING
// ═══════════════════════════════════════════════════════════════════
/**
* Capture current position to lock player in place.
*/
private void captureLockedPosition(EntityPlayer player) {
lockedPosX = player.posX;
lockedPosY = player.posY;
lockedPosZ = player.posZ;
positionLocked = true;
}
/**
* Release position lock.
*/
private void releaseLockedPosition() {
positionLocked = false;
}
/**
* Apply position lock on the server side.
* Snaps player back to locked position and zeroes motion.
*/
private void applyPositionLock(EntityPlayer player) {
if (!positionLocked) return;
player.setPosition(lockedPosX, lockedPosY, lockedPosZ);
player.prevPosX = lockedPosX;
player.prevPosY = lockedPosY;
player.prevPosZ = lockedPosZ;
player.motionX = 0;
player.motionZ = 0;
}
// ═══════════════════════════════════════════════════════════════════
// ABILITY STATE SYNC
// ═══════════════════════════════════════════════════════════════════
/**
* Build the current ability state flags byte.
*/
private byte getAbilityStateFlags() {
byte flags = 0;
if (currentAbility == null || !currentAbility.isExecuting()) return flags;
if (currentAbility.isMovementLockedForCurrentPhase()) {
flags |= PlayerAbilityStatePacket.FLAG_MOVEMENT_LOCKED;
}
if (rotationLocked && currentAbility.isRotationLockedForCurrentPhase()) {
flags |= PlayerAbilityStatePacket.FLAG_ROTATION_LOCKED;
}
if (currentAbility.hasAbilityMovement() && currentAbility.getPhase() == AbilityPhase.ACTIVE) {
flags |= PlayerAbilityStatePacket.FLAG_HAS_ABILITY_MOVEMENT;
}
if (positionLocked) {
flags |= PlayerAbilityStatePacket.FLAG_POSITION_LOCKED;
}
return flags;
}
/**
* Send ability state to client if flags changed since last sync.
*/
private void syncAbilityStateIfNeeded(EntityPlayer player) {
if (!(player instanceof EntityPlayerMP)) return;
byte flags = getAbilityStateFlags();
if (flags != lastSyncedFlags) {
lastSyncedFlags = flags;
PlayerAbilityStatePacket.sendToPlayer((EntityPlayerMP) player, flags, lockedYaw, lockedPitch);
}
}
/**
* Send cleared (all-zero) state to client. Called on ability completion/interrupt.
*/
private void syncAbilityStateClear(EntityPlayer player) {
if (!(player instanceof EntityPlayerMP)) return;
if (lastSyncedFlags != 0) {
lastSyncedFlags = 0;
PlayerAbilityStatePacket.sendToPlayer((EntityPlayerMP) player, (byte) 0, 0, 0);
}
}
// ═══════════════════════════════════════════════════════════════════
// TELEGRAPH
// ═══════════════════════════════════════════════════════════════════
@@ -384,11 +384,13 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
}
}
if (stats.potionType != EnumPotionType.None) {
if (stats.potionType != EnumPotionType.Fire)
((EntityLivingBase) receiver).addPotionEffect(new PotionEffect(this.getPotionEffect(stats.potionType), stats.potionDuration * 20, stats.potionAmp));
else
receiver.setFire(stats.potionDuration);
if (stats.potionType == EnumPotionType.Fire) {
receiver.setFire(stats.potionDuration);
} else if (stats.potionType != EnumPotionType.None) {
int potionId = stats.potionType.getResolvedPotionId(stats.potionManualId);
if (EnumPotionType.isValidPotionId(potionId)) {
((EntityLivingBase) receiver).addPotionEffect(new PotionEffect(potionId, stats.potionDuration * 20, stats.potionAmp));
}
}
return didAttack;
}
@@ -1043,29 +1045,6 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
return weight;
}
/*
* Used for getting the applied potion effect from dataStats.
*/
private int getPotionEffect(EnumPotionType p) {
switch (p) {
case Poison:
return Potion.poison.id;
case Hunger:
return Potion.hunger.id;
case Weakness:
return Potion.weakness.id;
case Slowness:
return Potion.moveSlowdown.id;
case Nausea:
return Potion.confusion.id;
case Blindness:
return Potion.blindness.id;
case Wither:
return Potion.wither.id;
default:
return 0;
}
}
@Override
public void setAir(int air) {
@@ -94,6 +94,7 @@ public class EntityProjectile extends EntityThrowable {
public boolean destroyTerrain = true;
public int explosiveRadius = 0;
public EnumPotionType effect = EnumPotionType.None;
public int manualPotionId = 0;
public boolean burnItem = true;
public int duration = 5;
public int amplify = 0;
@@ -508,12 +509,12 @@ public class EntityProjectile extends EntityThrowable {
}
}
if (this.effect != EnumPotionType.None && entityliving != null) {
if (this.effect != EnumPotionType.Fire) {
int p = this.getPotionEffect(effect);
entityliving.addPotionEffect(new PotionEffect(p, this.duration * 20, this.amplify));
} else {
movingobjectposition.entityHit.setFire(duration);
if (this.effect == EnumPotionType.Fire && entityliving != null) {
movingobjectposition.entityHit.setFire(duration);
} else if (this.effect != EnumPotionType.None && entityliving != null) {
int potionId = this.effect.getResolvedPotionId(this.manualPotionId);
if (EnumPotionType.isValidPotionId(potionId)) {
entityliving.addPotionEffect(new PotionEffect(potionId, this.duration * 20, this.amplify));
}
}
} else if (this.hasGravity() && (this.isArrow() || this.sticksToWalls())) {
@@ -637,21 +638,23 @@ public class EntityProjectile extends EntityThrowable {
d1 = 1.0D;
}
int i = this.getPotionEffect(effect);
int potionId = this.effect.getResolvedPotionId(this.manualPotionId);
if (Potion.potionTypes[i].isInstant()) {
Potion.potionTypes[i].affectEntity(this.getThrower(), entitylivingbase, this.amplify, d1);
} else {
int j = (int) (d1 * (double) this.duration + 0.5D);
if (EnumPotionType.isValidPotionId(potionId)) {
if (Potion.potionTypes[potionId].isInstant()) {
Potion.potionTypes[potionId].affectEntity(this.getThrower(), entitylivingbase, this.amplify, d1);
} else {
int j = (int) (d1 * (double) this.duration + 0.5D);
if (j > 20) {
entitylivingbase.addPotionEffect(new PotionEffect(i, j, this.amplify));
if (j > 20) {
entitylivingbase.addPotionEffect(new PotionEffect(potionId, j, this.amplify));
}
}
}
}
}
}
this.worldObj.playAuxSFX(2002, (int) Math.round(this.posX), (int) Math.round(this.posY), (int) Math.round(this.posZ), this.getPotionColor(this.effect));
this.worldObj.playAuxSFX(2002, (int) Math.round(this.posX), (int) Math.round(this.posY), (int) Math.round(this.posZ), this.getPotionColor());
}
}
@@ -693,6 +696,8 @@ public class EntityProjectile extends EntityThrowable {
par1NBTTagCompound.setBoolean("explosive", explosive);
par1NBTTagCompound.setInteger("accuracy", accuracy);
par1NBTTagCompound.setInteger("PotionEffect", effect.ordinal());
if (effect == EnumPotionType.Manual)
par1NBTTagCompound.setInteger("PotionManualId", manualPotionId);
par1NBTTagCompound.setString("trail", this.dataWatcher.getWatchableObjectString(22));
par1NBTTagCompound.setByte("Render3D", this.dataWatcher.getWatchableObjectByte(28));
par1NBTTagCompound.setByte("Spins", this.dataWatcher.getWatchableObjectByte(29));
@@ -723,7 +728,9 @@ public class EntityProjectile extends EntityThrowable {
this.accelerate = par1NBTTagCompound.getBoolean("accelerate");
this.explosive = par1NBTTagCompound.getBoolean("explosive");
this.accuracy = par1NBTTagCompound.getInteger("accuracy");
this.effect = EnumPotionType.values()[par1NBTTagCompound.getInteger("PotionEffect") % EnumPotionType.values().length];
this.effect = EnumPotionType.fromOrdinal(par1NBTTagCompound.getInteger("PotionEffect"));
if (effect == EnumPotionType.Manual)
this.manualPotionId = par1NBTTagCompound.getInteger("PotionManualId");
this.dataWatcher.updateObject(22, par1NBTTagCompound.getString("trail"));
this.dataWatcher.updateObject(23, Integer.valueOf(par1NBTTagCompound.getInteger("size")));
this.dataWatcher.updateObject(24, Byte.valueOf((byte) (par1NBTTagCompound.getBoolean("glows") ? 1 : 0)));
@@ -774,46 +781,12 @@ public class EntityProjectile extends EntityThrowable {
return this.thrower;
}
private int getPotionEffect(EnumPotionType p) {
switch (p) {
case Poison:
return Potion.poison.id;
case Hunger:
return Potion.hunger.id;
case Weakness:
return Potion.weakness.id;
case Slowness:
return Potion.moveSlowdown.id;
case Nausea:
return Potion.confusion.id;
case Blindness:
return Potion.blindness.id;
case Wither:
return Potion.wither.id;
default:
return 0;
}
}
private int getPotionColor(EnumPotionType p) {
switch (p) {
case Poison:
return 32660;
case Hunger:
return 32660;
case Weakness:
return 32696;
case Slowness:
return 32698;
case Nausea:
return 32732;
case Blindness:
return Potion.blindness.id;
case Wither:
return 32732;
default:
return 0;
private int getPotionColor() {
int potionId = this.effect.getResolvedPotionId(this.manualPotionId);
if (EnumPotionType.isValidPotionId(potionId)) {
return Potion.potionTypes[potionId].getLiquidColor();
}
return 0;
}
public void getStatProperties(DataStats stats) {
@@ -823,6 +796,7 @@ public class EntityProjectile extends EntityThrowable {
this.explosive = stats.pExplode;
this.explosiveRadius = stats.pArea;
this.effect = stats.pEffect;
this.manualPotionId = stats.pManualId;
this.burnItem = stats.pBurnItem;
this.duration = stats.pDur;
this.amplify = stats.pEffAmp;
@@ -0,0 +1,770 @@
{
"Loop": 11,
"Speed": 1.0f,
"Frames": [
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 2.0f,
"FrameParts": [
{
"Pivot2": 3.0f,
"Part": "LEFT_ARM",
"Rotation1": -18.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -18.0f
},
{
"Pivot2": 0.0f,
"Part": "LEFT_LEG",
"Rotation1": 6.0f,
"Rotation0": 12.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": 3.0f,
"Part": "RIGHT_ARM",
"Rotation1": 18.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 18.0f
},
{
"Pivot2": 3.0f,
"Part": "BODY",
"Rotation1": 0.0f,
"Rotation0": -12.0f,
"Pivot0": 0.0f,
"Pivot1": 1.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 3.0f,
"Part": "HEAD",
"Rotation1": 0.0f,
"Rotation0": -25.0f,
"Pivot0": 0.0f,
"Pivot1": 1.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_LEG",
"Rotation1": -12.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
}
],
"Smooth": 0b,
"Duration": 4
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 2.0f,
"FrameParts": [
{
"Pivot2": -1.0f,
"Part": "LEFT_ARM",
"Rotation1": -6.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -12.0f
},
{
"Pivot2": 0.0f,
"Part": "LEFT_LEG",
"Rotation1": -6.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": -1.0f,
"Part": "RIGHT_ARM",
"Rotation1": -6.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
},
{
"Pivot2": -1.0f,
"Part": "BODY",
"Rotation1": 0.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -1.0f,
"Part": "HEAD",
"Rotation1": 0.0f,
"Rotation0": 25.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_LEG",
"Rotation1": -12.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
}
],
"Smooth": 0b,
"Duration": 20
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 0.5f,
"FrameParts": [
{
"Pivot2": -1.0f,
"Part": "LEFT_ARM",
"Rotation1": -6.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -12.0f
},
{
"Pivot2": 0.0f,
"Part": "LEFT_LEG",
"Rotation1": -6.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": -1.0f,
"Part": "RIGHT_ARM",
"Rotation1": -6.0f,
"Rotation0": -145.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
},
{
"Pivot2": -1.0f,
"Part": "BODY",
"Rotation1": 0.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -1.0f,
"Part": "HEAD",
"Rotation1": 0.0f,
"Rotation0": 31.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_LEG",
"Rotation1": -12.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
}
],
"Smooth": 0b,
"Duration": 8
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 1.0f,
"FrameParts": [
{
"Pivot2": -1.0f,
"Part": "LEFT_ARM",
"Rotation1": -6.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -12.0f
},
{
"Pivot2": 0.0f,
"Part": "LEFT_LEG",
"Rotation1": -6.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": -1.0f,
"Part": "RIGHT_ARM",
"Rotation1": -6.0f,
"Rotation0": -145.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
},
{
"Pivot2": -1.0f,
"Part": "BODY",
"Rotation1": 0.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -1.0f,
"Part": "HEAD",
"Rotation1": 0.0f,
"Rotation0": 31.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_LEG",
"Rotation1": -12.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
}
],
"Smooth": 0b,
"Duration": 3
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 3.0f,
"FrameParts": [
{
"Pivot2": -1.0f,
"Part": "LEFT_ARM",
"Rotation1": -6.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -12.0f
},
{
"Pivot2": 0.0f,
"Part": "LEFT_LEG",
"Rotation1": -6.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": -1.0f,
"Part": "RIGHT_ARM",
"Rotation1": -6.0f,
"Rotation0": -145.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
},
{
"Pivot2": -1.0f,
"Part": "BODY",
"Rotation1": 0.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -1.0f,
"Part": "HEAD",
"Rotation1": -18.0f,
"Rotation0": 31.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_LEG",
"Rotation1": -12.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
}
],
"Smooth": 0b,
"Duration": 3
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 3.0f,
"FrameParts": [
{
"Pivot2": -1.0f,
"Part": "LEFT_ARM",
"Rotation1": -6.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -12.0f
},
{
"Pivot2": 0.0f,
"Part": "LEFT_LEG",
"Rotation1": -6.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": -1.0f,
"Part": "RIGHT_ARM",
"Rotation1": -6.0f,
"Rotation0": -145.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
},
{
"Pivot2": -1.0f,
"Part": "BODY",
"Rotation1": 0.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -1.0f,
"Part": "HEAD",
"Rotation1": 18.0f,
"Rotation0": 31.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_LEG",
"Rotation1": -12.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
}
],
"Smooth": 0b,
"Duration": 3
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 3.0f,
"FrameParts": [
{
"Pivot2": -1.0f,
"Part": "LEFT_ARM",
"Rotation1": -6.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -12.0f
},
{
"Pivot2": 0.0f,
"Part": "LEFT_LEG",
"Rotation1": -6.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": -1.0f,
"Part": "RIGHT_ARM",
"Rotation1": -6.0f,
"Rotation0": -145.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
},
{
"Pivot2": -1.0f,
"Part": "BODY",
"Rotation1": 0.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -1.0f,
"Part": "HEAD",
"Rotation1": -18.0f,
"Rotation0": 31.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_LEG",
"Rotation1": -12.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
}
],
"Smooth": 0b,
"Duration": 3
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 3.0f,
"FrameParts": [
{
"Pivot2": -1.0f,
"Part": "LEFT_ARM",
"Rotation1": -6.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -12.0f
},
{
"Pivot2": 0.0f,
"Part": "LEFT_LEG",
"Rotation1": -6.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": -1.0f,
"Part": "RIGHT_ARM",
"Rotation1": -6.0f,
"Rotation0": -145.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
},
{
"Pivot2": -1.0f,
"Part": "BODY",
"Rotation1": 0.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -1.0f,
"Part": "HEAD",
"Rotation1": 18.0f,
"Rotation0": 31.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_LEG",
"Rotation1": -12.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
}
],
"Smooth": 0b,
"Duration": 3
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 3.0f,
"FrameParts": [
{
"Pivot2": -1.0f,
"Part": "LEFT_ARM",
"Rotation1": -6.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -12.0f
},
{
"Pivot2": 0.0f,
"Part": "LEFT_LEG",
"Rotation1": -6.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": -1.0f,
"Part": "RIGHT_ARM",
"Rotation1": -6.0f,
"Rotation0": -145.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
},
{
"Pivot2": -1.0f,
"Part": "BODY",
"Rotation1": 0.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -1.0f,
"Part": "HEAD",
"Rotation1": -18.0f,
"Rotation0": 31.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_LEG",
"Rotation1": -12.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
}
],
"Smooth": 0b,
"Duration": 3
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 3.0f,
"FrameParts": [
{
"Pivot2": -1.0f,
"Part": "LEFT_ARM",
"Rotation1": -6.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -12.0f
},
{
"Pivot2": 0.0f,
"Part": "LEFT_LEG",
"Rotation1": -6.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": -1.0f,
"Part": "RIGHT_ARM",
"Rotation1": -6.0f,
"Rotation0": -145.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
},
{
"Pivot2": -1.0f,
"Part": "BODY",
"Rotation1": 0.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -1.0f,
"Part": "HEAD",
"Rotation1": 18.0f,
"Rotation0": 31.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_LEG",
"Rotation1": -12.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
}
],
"Smooth": 0b,
"Duration": 3
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 3.0f,
"FrameParts": [
{
"Pivot2": -1.0f,
"Part": "LEFT_ARM",
"Rotation1": -6.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -12.0f
},
{
"Pivot2": 0.0f,
"Part": "LEFT_LEG",
"Rotation1": -6.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": -1.0f,
"Part": "RIGHT_ARM",
"Rotation1": -6.0f,
"Rotation0": -145.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
},
{
"Pivot2": -1.0f,
"Part": "BODY",
"Rotation1": 0.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -1.0f,
"Part": "HEAD",
"Rotation1": -18.0f,
"Rotation0": 31.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_LEG",
"Rotation1": -12.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
}
],
"Smooth": 0b,
"Duration": 3
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 3.0f,
"FrameParts": [
{
"Pivot2": -1.0f,
"Part": "LEFT_ARM",
"Rotation1": -6.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -12.0f
},
{
"Pivot2": 0.0f,
"Part": "LEFT_LEG",
"Rotation1": -6.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": -1.0f,
"Part": "RIGHT_ARM",
"Rotation1": -6.0f,
"Rotation0": -145.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
},
{
"Pivot2": -1.0f,
"Part": "BODY",
"Rotation1": 0.0f,
"Rotation0": 6.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -1.0f,
"Part": "HEAD",
"Rotation1": 0.0f,
"Rotation0": 31.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_LEG",
"Rotation1": -12.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 6.0f
}
],
"Smooth": 0b,
"Duration": 3
}
],
"CurrentFrameTime": 0,
"CurrentFrame": 11,
"Smooth": 0b,
"ID": 100,
"WhileAttacking": 1b,
"WhileWalking": 1b,
"Name": "Ability_Generic_Dazed",
"WhileStanding": 1b
}
@@ -2007,6 +2007,8 @@ condition.hover.threshold=Health percentage threshold (1-99%)
effect.hover.type=Potion effect type to apply to targets
effect.hover.duration=Effect duration in ticks (20 ticks = 1 second)
effect.hover.amplifier=Effect strength level (higher = stronger)
effect.manual=Manual
effect.potionid=Potion ID
# =========================================
# Auction House