mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-04 23:48:27 +01:00
Assuming this works
This commit is contained in:
parent
3ff0b651c1
commit
dd5dd1878c
@ -138,10 +138,12 @@ public class CitizensHumanNPC extends CitizensNPC implements Equipable {
|
|||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
super.update();
|
||||||
if (isSpawned() && getBukkitEntity().getLocation().getChunk().isLoaded()) {
|
if (isSpawned() && getBukkitEntity().getLocation().getChunk().isLoaded()) {
|
||||||
mcEntity.move(0, -0.2, 0);
|
if (NMS.inWater(mcEntity)) {
|
||||||
|
mcEntity.motY += 0.08F;
|
||||||
|
} else
|
||||||
|
mcEntity.move(0, -0.2, 0);
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -208,7 +208,7 @@ public class NMS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void trySwim(EntityLiving handle, float power) {
|
public static void trySwim(EntityLiving handle, float power) {
|
||||||
if ((handle.I() || handle.J()) && Math.random() < 0.8F) {
|
if (inWater(handle) && Math.random() < 0.8F) {
|
||||||
handle.motY += power;
|
handle.motY += power;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -276,4 +276,8 @@ public class NMS {
|
|||||||
Messaging.logTr(Messages.ERROR_GETTING_ID_MAPPING, e.getMessage());
|
Messaging.logTr(Messages.ERROR_GETTING_ID_MAPPING, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean inWater(EntityLiving mcEntity) {
|
||||||
|
return mcEntity.I() || mcEntity.J();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user