mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-04 08:33:49 +01:00
Falling block movement
This commit is contained in:
parent
d74ce4ae81
commit
993d2fe017
@ -2,6 +2,7 @@ package net.citizensnpcs.npc.entity.nonliving;
|
|||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCPushEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
|
import net.citizensnpcs.api.util.Messaging;
|
||||||
import net.citizensnpcs.npc.AbstractEntityController;
|
import net.citizensnpcs.npc.AbstractEntityController;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
@ -112,10 +113,19 @@ public class FallingBlockController extends AbstractEntityController {
|
|||||||
public void h() {
|
public void h() {
|
||||||
if (npc != null) {
|
if (npc != null) {
|
||||||
npc.update();
|
npc.update();
|
||||||
|
if (Math.abs(motX) > EPSILON || Math.abs(motY) > EPSILON || Math.abs(motZ) > EPSILON) {
|
||||||
|
motX *= 0.98;
|
||||||
|
motY *= 0.98;
|
||||||
|
motZ *= 0.98;
|
||||||
|
move(motX, motY, motZ);
|
||||||
|
Messaging.log(motX, motY, motZ);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
super.h();
|
super.h();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final double EPSILON = 0.001;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class FallingBlockNPC extends CraftFallingSand implements NPCHolder {
|
public static class FallingBlockNPC extends CraftFallingSand implements NPCHolder {
|
||||||
|
Loading…
Reference in New Issue
Block a user