Fix DBC Flying Issue with Abilities

This commit is contained in:
Kam committed 2026-02-19 03:12:59 -05:00
1 parent 6fdf9daf24
commit 1e45d96253
6 files changed
+42 -25

No files matched your search

@@ -57,6 +57,7 @@ public abstract class AbstractDataAbilities {
* Position lock state
*/
protected boolean positionLocked = false;
protected boolean wasFlyingAtLock = false;
protected double lockedPosX = 0;
protected double lockedPosY = 0;
protected double lockedPosZ = 0;
@@ -530,6 +531,13 @@ public abstract class AbstractDataAbilities {
lockedPosY = entity.posY;
lockedPosZ = entity.posZ;
positionLocked = true;
// Record flight state at lock time so airborne players stay at their height
// even if their flight system deactivates during input suppression
wasFlyingAtLock = entity instanceof net.minecraft.entity.player.EntityPlayer
&& AbilityController.Instance != null
&& AbilityController.Instance.isPlayerFlying((net.minecraft.entity.player.EntityPlayer) entity);
onPositionLockChanged(true);
}
@@ -538,9 +546,17 @@ public abstract class AbstractDataAbilities {
*/
protected void releaseLockedPosition() {
positionLocked = false;
wasFlyingAtLock = false;
onPositionLockChanged(false);
}
/**
* Whether the entity was flying when the position lock was captured.
*/
public boolean wasFlyingAtLock() {
return wasFlyingAtLock;
}
/**
* Hook for subclass to react to position lock state changes (e.g., NPC sets data watcher flag).
*/