I'm making a "forcefield" for a game called Minecraft. What I commented on is what I need help with.
if (Camb.killaura)
{
nchitDelay++;
for(Object o: mc.theWorld.loadedEntityList){
Entity e = (Entity)o;
if(e != this && e instanceof EntitySkeleton || e instanceof EntityCow && getDistanceToEntity(e) <= killauraRange && mc.thePlayer.canEntityBeSeen(e) &&!Camb.friend.contains(e.getEntityName())){ // checking if the entity is either a skeleton or cow
if(e.isEntityAlive()){
if(nchitDelay >= 8){
if(Camb.auraaimbot){
facetoEntity(e); // facing the skeleton from an infinite distance.
}
if(Camb.criticals){
if(mc.thePlayer.isSprinting()==false){
if(mc.thePlayer.isJumping==false){
if(mc.thePlayer.onGround){
mc.thePlayer.jump();
}
}
}
}
Minecraft.SwitchToSword(mc.thePlayer.inventory.currentItem);
swingItem();
mc.playerController.attackEntity(this, e);
nchitDelay = 0;
break;
}
}
}
}
}
}
So, the idea is if a skeleton or cow enters the distance(4 blocks), then it will face it and attack it. Everything is working, but the player is facing the skeleton from any distance. Not just 4 blocks. How do I fix this?
Thanks