Use speedModifier in a few more places

This commit is contained in:
fullwall 2024-11-28 19:44:16 +08:00
parent 2773304f47
commit f8cc30d7f2
3 changed files with 8 additions and 6 deletions

View File

@ -264,7 +264,8 @@ public class CitizensNPC extends AbstractNPC {
if (destination == null) {
NMS.cancelMoveDestination(getEntity());
} else {
NMS.setDestination(getEntity(), destination.getX(), destination.getY(), destination.getZ(), 1);
NMS.setDestination(getEntity(), destination.getX(), destination.getY(), destination.getZ(),
getNavigator().getDefaultParameters().speedModifier());
}
}
@ -398,8 +399,9 @@ public class CitizensNPC extends AbstractNPC {
entity.setRemoveWhenFarAway(false);
if (type == EntityType.PLAYER || Util.isHorse(type)) {
if (SUPPORT_ATTRIBUTES && !hasTrait(AttributeTrait.class) || !getTrait(AttributeTrait.class)
.hasAttribute(Util.getRegistryValue(Registry.ATTRIBUTE, "generic.step_height", "step_height"))) {
if (SUPPORT_ATTRIBUTES && !hasTrait(AttributeTrait.class)
|| !getTrait(AttributeTrait.class).hasAttribute(Util
.getRegistryValue(Registry.ATTRIBUTE, "generic.step_height", "step_height"))) {
NMS.setStepHeight(entity, 1);
}
}

View File

@ -115,7 +115,7 @@ public class StraightLineNavigationStrategy extends AbstractPathStrategy {
}
} else if (npc.getEntity() instanceof LivingEntity) {
NMS.setDestination(npc.getEntity(), destVector.getX(), destVector.getY(), destVector.getZ(),
params.speed());
params.speedModifier());
} else {
Vector dir = destVector.subtract(currLoc.toVector()).normalize().multiply(0.2);
Block in = currLoc.getBlock();