mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-09-11 07:08:17 +02:00
Change speed of pathfinder, seems to work better
This commit is contained in:
parent
fe370258db
commit
2517a5629d
@ -114,8 +114,10 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
|||||||
cancelReason = CancelReason.TARGET_MOVED_WORLD;
|
cancelReason = CancelReason.TARGET_MOVED_WORLD;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (cancelReason != null)
|
if (cancelReason != null) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
setPath();
|
setPath();
|
||||||
NMS.look(handle, target);
|
NMS.look(handle, target);
|
||||||
if (aggro && canAttack()) {
|
if (aggro && canAttack()) {
|
||||||
@ -126,8 +128,9 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
|||||||
}
|
}
|
||||||
attackTicks = ATTACK_DELAY_TICKS;
|
attackTicks = ATTACK_DELAY_TICKS;
|
||||||
}
|
}
|
||||||
if (attackTicks > 0)
|
if (attackTicks > 0) {
|
||||||
attackTicks--;
|
attackTicks--;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -155,11 +155,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
// (onGround is normally updated by the client)
|
// (onGround is normally updated by the client)
|
||||||
}
|
}
|
||||||
if (!npc.data().get("removefromplayerlist", Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean())) {
|
if (!npc.data().get("removefromplayerlist", Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean())) {
|
||||||
// h(); TODO
|
i();// TODO
|
||||||
}
|
}
|
||||||
if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON)
|
if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON)
|
||||||
motX = motY = motZ = 0;
|
motX = motY = motZ = 0;
|
||||||
|
|
||||||
if (navigating) {
|
if (navigating) {
|
||||||
if (!NMS.isNavigationFinished(navigation)) {
|
if (!NMS.isNavigationFinished(navigation)) {
|
||||||
NMS.updateNavigation(navigation);
|
NMS.updateNavigation(navigation);
|
||||||
@ -173,6 +172,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
if (noDamageTicks > 0) {
|
if (noDamageTicks > 0) {
|
||||||
--noDamageTicks;
|
--noDamageTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,12 +221,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
|
|
||||||
private void moveOnCurrentHeading() {
|
private void moveOnCurrentHeading() {
|
||||||
NMS.updateAI(this);
|
NMS.updateAI(this);
|
||||||
// taken from EntityLiving update method
|
|
||||||
if (bd) {
|
if (bd) {
|
||||||
/* boolean inLiquid = H() || J();
|
|
||||||
if (inLiquid) {
|
|
||||||
motY += 0.04;
|
|
||||||
} else //(handled elsewhere)*/
|
|
||||||
if (onGround && jumpTicks == 0) {
|
if (onGround && jumpTicks == 0) {
|
||||||
bj();
|
bj();
|
||||||
jumpTicks = 10;
|
jumpTicks = 10;
|
||||||
@ -237,7 +232,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
be *= 0.98F;
|
be *= 0.98F;
|
||||||
bf *= 0.98F;
|
bf *= 0.98F;
|
||||||
bg *= 0.9F;
|
bg *= 0.9F;
|
||||||
|
|
||||||
e(be, bf); // movement method
|
e(be, bf); // movement method
|
||||||
NMS.setHeadYaw(this, yaw);
|
NMS.setHeadYaw(this, yaw);
|
||||||
if (jumpTicks > 0) {
|
if (jumpTicks > 0) {
|
||||||
|
@ -91,8 +91,8 @@ public class NMS {
|
|||||||
if (!success)
|
if (!success)
|
||||||
return;
|
return;
|
||||||
if (knockbackLevel > 0) {
|
if (knockbackLevel > 0) {
|
||||||
target.g(-MathHelper.sin((float) (handle.yaw * Math.PI / 180.0F)) * knockbackLevel * 0.5F, 0.1D,
|
target.g(-Math.sin(handle.yaw * Math.PI / 180.0F) * knockbackLevel * 0.5F, 0.1D,
|
||||||
MathHelper.cos((float) (handle.yaw * Math.PI / 180.0F)) * knockbackLevel * 0.5F);
|
Math.cos(handle.yaw * Math.PI / 180.0F) * knockbackLevel * 0.5F);
|
||||||
handle.motX *= 0.6D;
|
handle.motX *= 0.6D;
|
||||||
handle.motZ *= 0.6D;
|
handle.motZ *= 0.6D;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class PlayerControllerMove {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void c() {
|
public void c() {
|
||||||
this.a.bf = 0F;
|
this.a.bf = 0;
|
||||||
if (this.f) {
|
if (this.f) {
|
||||||
this.f = false;
|
this.f = false;
|
||||||
int i = MathHelper.floor(this.a.boundingBox.b + 0.5D);
|
int i = MathHelper.floor(this.a.boundingBox.b + 0.5D);
|
||||||
@ -60,8 +60,7 @@ public class PlayerControllerMove {
|
|||||||
double d1 = this.d - this.a.locZ;
|
double d1 = this.d - this.a.locZ;
|
||||||
double d2 = this.c - i;
|
double d2 = this.c - i;
|
||||||
double d3 = d0 * d0 + d2 * d2 + d1 * d1;
|
double d3 = d0 * d0 + d2 * d2 + d1 * d1;
|
||||||
|
if (d3 >= 2.500000277905201E-7D) {
|
||||||
if (d3 >= 2.5D) {
|
|
||||||
float f = (float) (Math.atan2(d1, d0) * 180.0D / Math.PI) - 90.0F;
|
float f = (float) (Math.atan2(d1, d0) * 180.0D / Math.PI) - 90.0F;
|
||||||
|
|
||||||
this.a.yaw = this.a(this.a.yaw, f, 30.0F);
|
this.a.yaw = this.a(this.a.yaw, f, 30.0F);
|
||||||
|
@ -36,6 +36,7 @@ public class PlayerNavigation extends Navigation {
|
|||||||
this.a = entityinsentient;
|
this.a = entityinsentient;
|
||||||
this.b = world;
|
this.b = world;
|
||||||
this.e = entityinsentient.getAttributeInstance(GenericAttributes.b);
|
this.e = entityinsentient.getAttributeInstance(GenericAttributes.b);
|
||||||
|
this.e.setValue(24);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -254,7 +255,6 @@ public class PlayerNavigation extends Navigation {
|
|||||||
Vec3D localVec3D = this.c.a(this.a);
|
Vec3D localVec3D = this.c.a(this.a);
|
||||||
if (localVec3D == null)
|
if (localVec3D == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.a.setMoveDestination(localVec3D.c, localVec3D.d, localVec3D.e, this.d);
|
this.a.setMoveDestination(localVec3D.c, localVec3D.d, localVec3D.e, this.d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user