mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 05:27:37 +00:00
Add flight checker to prevent abilities from affecting flying players
This commit is contained in:
1 parent
e722279009
commit
21b1571868
3 files changed
+24
-3
No files matched your search
@@ -9,6 +9,7 @@ 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.controllers.data.ability.AbilityController;
|
||||
import kamkeel.npcs.util.AttributeAttackUtil;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -106,7 +107,9 @@ public class ScriptPlayerEventHandler {
|
||||
Ability current = playerData.abilityData.getCurrentAbility();
|
||||
if (current == null || !current.hasAbilityMovement()) {
|
||||
player.motionX = 0;
|
||||
player.motionY = Math.min(player.motionY, 0); // Prevent jumping, allow gravity
|
||||
if (!AbilityController.Instance.isPlayerFlying(player)) {
|
||||
player.motionY = Math.min(player.motionY, 0);
|
||||
}
|
||||
player.motionZ = 0;
|
||||
player.velocityChanged = true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user