From f8cc30d7f267fc31d7379bab110653ce7eb5cd46 Mon Sep 17 00:00:00 2001 From: fullwall Date: Thu, 28 Nov 2024 19:44:16 +0800 Subject: [PATCH] Use speedModifier in a few more places --- main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java | 8 +++++--- .../java/net/citizensnpcs/npc/CitizensTraitFactory.java | 4 ++-- .../npc/ai/StraightLineNavigationStrategy.java | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java b/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java index bfa40ff5b..3edd54858 100644 --- a/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java +++ b/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java @@ -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); } } diff --git a/main/src/main/java/net/citizensnpcs/npc/CitizensTraitFactory.java b/main/src/main/java/net/citizensnpcs/npc/CitizensTraitFactory.java index 1cb5fb7f4..e3fe0c3d4 100644 --- a/main/src/main/java/net/citizensnpcs/npc/CitizensTraitFactory.java +++ b/main/src/main/java/net/citizensnpcs/npc/CitizensTraitFactory.java @@ -20,7 +20,7 @@ import net.citizensnpcs.api.trait.trait.Inventory; import net.citizensnpcs.api.trait.trait.MobType; import net.citizensnpcs.api.trait.trait.Owner; import net.citizensnpcs.api.trait.trait.PlayerFilter; -import net.citizensnpcs.api.trait.trait.Spawned; +import net.citizensnpcs.api.trait.trait.Spawned; import net.citizensnpcs.trait.Age; import net.citizensnpcs.trait.Anchors; import net.citizensnpcs.trait.ArmorStandTrait; @@ -106,7 +106,7 @@ public class CitizensTraitFactory implements TraitFactory { registerTrait(TraitInfo.create(ItemFrameTrait.class)); registerTrait(TraitInfo.create(LookClose.class).optInToStats()); registerTrait(TraitInfo.create(PaintingTrait.class)); - registerTrait(TraitInfo.create(MirrorTrait.class).optInToStats()); + registerTrait(TraitInfo.create(MirrorTrait.class).optInToStats()); registerTrait(TraitInfo.create(MountTrait.class)); registerTrait(TraitInfo.create(MobType.class).asDefaultTrait()); registerTrait(TraitInfo.create(OcelotModifiers.class)); diff --git a/main/src/main/java/net/citizensnpcs/npc/ai/StraightLineNavigationStrategy.java b/main/src/main/java/net/citizensnpcs/npc/ai/StraightLineNavigationStrategy.java index 5e434b4bc..da89c1cdb 100644 --- a/main/src/main/java/net/citizensnpcs/npc/ai/StraightLineNavigationStrategy.java +++ b/main/src/main/java/net/citizensnpcs/npc/ai/StraightLineNavigationStrategy.java @@ -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();