mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-24 03:25:13 +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();
|
super.update();
|
||||||
if (isSpawned() && getBukkitEntity().getLocation().getChunk().isLoaded()) {
|
if (isSpawned() && getBukkitEntity().getLocation().getChunk().isLoaded()) {
|
||||||
mcEntity.move(0, -0.2, 0);
|
mcEntity.move(0, -0.2, 0);
|
||||||
NMS.trySwim(getHandle());
|
|
||||||
// gravity! also works around an entity.onGround not updating issue
|
// gravity! also works around an entity.onGround not updating issue
|
||||||
// (onGround is normally updated by the client)
|
// (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) {
|
public static void trySwim(EntityLiving handle) {
|
||||||
if ((handle.H() || handle.J()) && Math.random() < 0.8F)
|
trySwim(handle, 0.04F);
|
||||||
handle.motY += 0.04;
|
}
|
||||||
|
|
||||||
|
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) {
|
public static void updateAI(EntityLiving entity) {
|
||||||
|
Loading…
Reference in New Issue
Block a user