Skip to content

Commit

Permalink
Falling block movement
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jan 10, 2014
1 parent 150d6b3 commit 6583202
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.citizensnpcs.api.event.NPCPushEvent;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.npc.AbstractEntityController;
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder;
Expand Down Expand Up @@ -112,10 +113,19 @@ public NPC getNPC() {
public void h() {
if (npc != null) {
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 {
super.h();
}
}

private static final double EPSILON = 0.001;
}

public static class FallingBlockNPC extends CraftFallingSand implements NPCHolder {
Expand Down

0 comments on commit 6583202

Please sign in to comment.