Falling block movement

This commit is contained in:
fullwall 2014-01-10 20:45:42 +08:00
parent d74ce4ae81
commit 993d2fe017

View File

@ -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 {