mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 23:29:41 +00:00
Fix DBC Flying Issue with Abilities
This commit is contained in:
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).
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user