Fix Anchor Point Helper issue on NPCs

This commit is contained in:
Kam committed 2026-02-03 14:06:30 -05:00
1 parent 87d511c38e
commit ead3c5944c
3 files changed
+5 -8

No files matched your search

@@ -53,7 +53,7 @@ public class AbilityLaserShot extends Ability implements IAbilityLaserShot {
this.minRange = 3.0f;
this.cooldownTicks = 0;
this.windUpTicks = 15;
this.lockMovement = LockMovementType.WINDUP;
this.lockMovement = LockMovementType.WINDUP_AND_ACTIVE;
this.telegraphType = TelegraphType.LINE;
this.showTelegraph = true;
// Default built-in animations
@@ -460,13 +460,11 @@ public class EntityAbilityBeam extends EntityAbilityProjectile {
);
}
// Offset downward by half headSize to center
double centeredY = pos.yCoord - headSize * 0.5;
setPosition(pos.xCoord, centeredY, pos.zCoord);
setPosition(pos.xCoord, pos.yCoord, pos.zCoord);
// Also update origin for when firing starts
startX = pos.xCoord;
startY = centeredY;
startY = pos.yCoord;
startZ = pos.zCoord;
}
@@ -229,9 +229,8 @@ public class AnchorPointHelper {
double blockZ = modelZ * MODEL_SCALE * scale;
// Apply body yaw rotation
// Renderer uses glRotate(180 - yaw), so: cos(180-yaw) = -cos(yaw), sin(180-yaw) = sin(yaw)
// Y-axis rotation: x' = x*cos + z*sin, z' = -x*sin + z*cos
// Substituting: x' = -x*cos(yaw) + z*sin(yaw), z' = -x*sin(yaw) - z*cos(yaw)
// Renderer applies glRotatef(180 - yaw) then glScalef(-1, -1, 1).
// Combined transform: x' = mx*cos(yaw) + mz*sin(yaw), z' = mx*sin(yaw) - mz*cos(yaw)
float bodyYaw = (float) Math.toRadians(entity.renderYawOffset);
double cosYaw = Math.cos(bodyYaw);
double sinYaw = Math.sin(bodyYaw);