mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-27 21:29:14 +01:00
Player NPC swimming
This commit is contained in:
parent
0ba4270a40
commit
3ff0b651c1
@ -139,9 +139,9 @@ public class CitizensHumanNPC extends CitizensNPC implements Equipable {
|
||||
super.update();
|
||||
if (isSpawned() && getBukkitEntity().getLocation().getChunk().isLoaded()) {
|
||||
mcEntity.move(0, -0.2, 0);
|
||||
NMS.trySwim(getHandle());
|
||||
// gravity! also works around an entity.onGround not updating issue
|
||||
// (onGround is normally updated by the client)
|
||||
NMS.trySwim(mcEntity, 0.16F);
|
||||
}
|
||||
}
|
||||
}
|
@ -204,8 +204,13 @@ public class NMS {
|
||||
}
|
||||
|
||||
public static void trySwim(EntityLiving handle) {
|
||||
if ((handle.H() || handle.J()) && Math.random() < 0.8F)
|
||||
handle.motY += 0.04;
|
||||
trySwim(handle, 0.04F);
|
||||
}
|
||||
|
||||
public static void trySwim(EntityLiving handle, float power) {
|
||||
if ((handle.I() || handle.J()) && Math.random() < 0.8F) {
|
||||
handle.motY += power;
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateAI(EntityLiving entity) {
|
||||
|
Loading…
Reference in New Issue
Block a user