Skip to content

Commit

Permalink
Remove PlayerEntitySenses workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Sep 2, 2013
1 parent 24dcbf2 commit c99825e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 53 deletions.
17 changes: 2 additions & 15 deletions src/main/java/net/citizensnpcs/npc/entity/EntityHumanNPC.java
Expand Up @@ -17,7 +17,6 @@
import net.citizensnpcs.util.nms.PlayerControllerJump;
import net.citizensnpcs.util.nms.PlayerControllerLook;
import net.citizensnpcs.util.nms.PlayerControllerMove;
import net.citizensnpcs.util.nms.PlayerEntitySenses;
import net.citizensnpcs.util.nms.PlayerNavigation;
import net.minecraft.server.v1_6_R2.AttributeInstance;
import net.minecraft.server.v1_6_R2.Connection;
Expand All @@ -39,7 +38,6 @@
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_6_R2.CraftServer;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
Expand All @@ -49,14 +47,12 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
private PlayerControllerJump controllerJump;
private PlayerControllerLook controllerLook;
private PlayerControllerMove controllerMove;
private PlayerEntitySenses entitySenses;
private boolean gravity = true;
private int jumpTicks = 0;
private PlayerNavigation navigation;
private final CitizensNPC npc;
private final Location packetLocationCache = new Location(null, 0, 0, 0);
private int packetUpdateCount;
private int sensesUpdateCount = 0;
private int useListName = -1;

public EntityHumanNPC(MinecraftServer minecraftServer, World world, String string,
Expand All @@ -75,8 +71,9 @@ public void collide(net.minecraft.server.v1_6_R2.Entity entity) {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
if (npc != null)
if (npc != null) {
Util.callCollisionEvent(npc, entity.getBukkitEntity());
}
}

@Override
Expand Down Expand Up @@ -153,7 +150,6 @@ public boolean a() {
controllerJump = new PlayerControllerJump(this);
controllerLook = new PlayerControllerLook(this);
controllerMove = new PlayerControllerMove(this);
entitySenses = new PlayerEntitySenses(this);
navigation = new PlayerNavigation(this, world);
}

Expand Down Expand Up @@ -235,10 +231,6 @@ public void setTargetLook(Entity target, float yawOffset, float renderOffset) {
}

public void updateAI() {
if (++sensesUpdateCount == 5) {
sensesUpdateCount = 0;
entitySenses.a();
}
controllerMove.c();
controllerLook.a();
controllerJump.b();
Expand Down Expand Up @@ -298,11 +290,6 @@ public NPC getNPC() {
return npc;
}

@Override
public boolean hasLineOfSight(org.bukkit.entity.Entity other) {
return getHandle().entitySenses.canSee(((CraftEntity) other).getHandle());
}

@Override
public boolean hasMetadata(String metadataKey) {
return cserver.getEntityMetadata().hasMetadata(this, metadataKey);
Expand Down
38 changes: 0 additions & 38 deletions src/main/java/net/citizensnpcs/util/nms/PlayerEntitySenses.java

This file was deleted.

0 comments on commit c99825e

Please sign in to comment.