Updated controllable for 1.21.3

This commit is contained in:
fullwall 2024-10-28 19:57:36 +08:00
parent 0b978f6322
commit 1579aa0e9e
21 changed files with 143 additions and 73 deletions

View File

@ -13,6 +13,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.PacketType.Play.Server;
@ -36,6 +37,7 @@ import com.comphenix.protocol.wrappers.WrappedGameProfile;
import com.comphenix.protocol.wrappers.WrappedSignedProperty;
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
@ -59,9 +61,9 @@ import net.citizensnpcs.util.SkinProperty;
import net.citizensnpcs.util.Util;
public class ProtocolLibListener implements Listener {
private ProtocolManager manager;
private final ProtocolManager manager;
private final Map<UUID, MirrorTrait> mirrorTraits = Maps.newConcurrentMap();
private Citizens plugin;
private final Citizens plugin;
private final Map<Integer, RotationTrait> rotationTraits = Maps.newConcurrentMap();
public ProtocolLibListener(Citizens plugin) {
@ -93,9 +95,27 @@ public class ProtocolLibListener implements Listener {
@Override
public void onPacketSending(PacketEvent event) {
NPC npc = getNPCFromPacket(event);
if (npc == null || !npc.hasTrait(Equipment.class))
if (npc == null)
return;
MirrorTrait mirror = npc.getTraitNullable(MirrorTrait.class);
if (mirror != null && mirror.isMirroringEquipment() && mirror.isMirroring(event.getPlayer())) {
StructureModifier<List<Pair<EnumWrappers.ItemSlot, ItemStack>>> modifier = event.getPacket()
.getLists(BukkitConverters.getPairConverter(EnumWrappers.getItemSlotConverter(),
BukkitConverters.getItemStackConverter()));
List<Pair<EnumWrappers.ItemSlot, ItemStack>> equipment = Lists.newArrayList();
PlayerInventory pi = event.getPlayer().getInventory();
equipment.add(new Pair<>(ItemSlot.CHEST, pi.getChestplate()));
equipment.add(new Pair<>(ItemSlot.FEET, pi.getBoots()));
equipment.add(new Pair<>(ItemSlot.HEAD, pi.getHelmet()));
equipment.add(new Pair<>(ItemSlot.LEGS, pi.getLeggings()));
equipment.add(new Pair<>(ItemSlot.MAINHAND, pi.getItemInHand()));
equipment.add(new Pair<>(ItemSlot.OFFHAND, pi.getItemInOffHand()));
modifier.write(0, equipment);
return;
}
Equipment trait = npc.getTraitNullable(Equipment.class);
if (trait == null)
return;
Equipment trait = npc.getOrAddTrait(Equipment.class);
PacketContainer packet = event.getPacket();
StructureModifier<List<Pair<EnumWrappers.ItemSlot, ItemStack>>> modifier = packet
.getLists(BukkitConverters.getPairConverter(EnumWrappers.getItemSlotConverter(),
@ -120,6 +140,7 @@ public class ProtocolLibListener implements Listener {
}
});
manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.HIGHEST, Server.ENTITY_METADATA) {
@Override
public void onPacketSending(PacketEvent event) {
NPC npc = getNPCFromPacket(event);

View File

@ -1934,20 +1934,21 @@ public class NPCCommands {
@Command(
aliases = { "npc" },
modifiers = { "mirror" },
usage = "mirror --name [true|false]",
usage = "mirror --name [true|false] --equipment [true|false]",
desc = "",
min = 1,
max = 1,
permission = "citizens.npc.mirror")
@Requirements(selected = true, ownership = true)
public void mirror(CommandContext args, CommandSender sender, NPC npc, @Flag("name") Boolean name)
throws CommandException {
public void mirror(CommandContext args, CommandSender sender, NPC npc, @Flag("name") Boolean name,
@Flag("equipment") Boolean equipment) throws CommandException {
if (((Citizens) CitizensAPI.getPlugin()).getProtocolLibListener() == null)
throw new CommandException("ProtocolLib must be enabled to use this feature");
MirrorTrait trait = npc.getOrAddTrait(MirrorTrait.class);
if (name != null) {
trait.setEnabled(true);
trait.setMirrorEquipment(equipment);
trait.setMirrorName(name);
Messaging.sendTr(sender, name ? Messages.MIRROR_NAME_SET : Messages.MIRROR_NAME_UNSET, npc.getName());
} else {
@ -2852,8 +2853,9 @@ public class NPCCommands {
@Command(
aliases = { "npc" },
usage = "setequipment [slot] [item]",
usage = "setequipment (-c(osmetic)) [slot] [item]",
desc = "",
flags = "c",
modifiers = { "setequipment" },
min = 2,
max = 3,
@ -2868,9 +2870,14 @@ public class NPCCommands {
throw new ServerCommandException();
item = ((Player) sender).getItemInHand().clone();
}
if (args.hasFlag('c')) {
npc.getOrAddTrait(Equipment.class).setCosmetic(slot, item);
Messaging.sendTr(sender, Messages.COSMETIC_EQUIPMENT_SET, slot, item);
} else {
npc.getOrAddTrait(Equipment.class).set(slot, item);
Messaging.sendTr(sender, Messages.EQUIPMENT_SET, slot, item);
}
}
@Command(
aliases = { "npc" },

View File

@ -38,6 +38,7 @@ public class Controllable extends Trait {
private BuiltInControls controls;
@Persist
private boolean enabled = true;
private ControllableInput input;
@Persist("owner_required")
private boolean ownerRequired;
@ -128,9 +129,24 @@ public class Controllable extends Trait {
if (!enabled || !npc.isSpawned())
return;
List<Entity> passengers = NMS.getPassengers(npc.getEntity());
if (passengers.size() == 0 || !(passengers.get(0) instanceof Player) || npc.getNavigator().isNavigating())
if (npc.getNavigator().isNavigating() || passengers.size() == 0 || !(passengers.get(0) instanceof Player))
return;
controller.run((Player) passengers.get(0));
Player player = (Player) passengers.get(0);
input = new ControllableInput();
if (SUPPORTS_PLAYER_INPUT_EVENT) {
input.forward = player.getCurrentInput().isForward() ? 1 : player.getCurrentInput().isBackward() ? -1 : 0;
input.horizontal = player.getCurrentInput().isLeft() ? 1 : player.getCurrentInput().isRight() ? -1 : 0;
input.jump = player.getCurrentInput().isJump();
input.sneak = player.getCurrentInput().isSneak();
input.sprint = player.getCurrentInput().isSprint();
} else {
input.forward = NMS.getForwardBackwardMovement(player);
input.horizontal = NMS.getXZMovement(player);
input.jump = NMS.shouldJump(player);
input.sneak = NMS.isSneaking(player);
input.sprint = player.isSprinting();
}
controller.run(player, input);
}
public void setControls(BuiltInControls controls) {
@ -173,6 +189,14 @@ public class Controllable extends Trait {
}
}
private static class ControllableInput {
double forward;
double horizontal;
boolean jump;
boolean sneak;
boolean sprint;
}
public static class GroundController implements MovementController {
private int jumpTicks = 0;
private final NPC npc;
@ -196,15 +220,15 @@ public class Controllable extends Trait {
}
@Override
public void run(Player rider) {
public void run(Player rider, ControllableInput input) {
boolean onGround = NMS.isOnGround(npc.getEntity());
float impulse = npc.getNavigator().getDefaultParameters()
float speedMod = npc.getNavigator().getDefaultParameters()
.modifiedSpeed(onGround ? GROUND_SPEED : AIR_SPEED);
if (!Util.isHorse(npc.getEntity().getType())) {
speed = updateHorizontalSpeed(npc.getEntity(), rider, speed, impulse,
speed = updateSpeed(npc.getEntity(), NMS.getYaw(rider), input, speed, speedMod,
Setting.MAX_CONTROLLABLE_GROUND_SPEED.asDouble());
}
if (onGround && jumpTicks <= 0 && NMS.shouldJump(rider)) {
if (onGround && jumpTicks <= 0 && input.jump) {
npc.getEntity().setVelocity(npc.getEntity().getVelocity().setY(JUMP_VELOCITY));
jumpTicks = 10;
}
@ -239,12 +263,12 @@ public class Controllable extends Trait {
}
@Override
public void run(Player rider) {
public void run(Player rider, ControllableInput input) {
boolean onGround = NMS.isOnGround(npc.getEntity());
float impulse = npc.getNavigator().getDefaultParameters()
float speedMod = npc.getNavigator().getDefaultParameters()
.modifiedSpeed(onGround ? GROUND_SPEED : AIR_SPEED);
if (!Util.isHorse(npc.getEntity().getType())) {
speed = updateHorizontalSpeed(npc.getEntity(), rider, speed, impulse,
speed = updateSpeed(npc.getEntity(), NMS.getYaw(rider), input, speed, speedMod,
Setting.MAX_CONTROLLABLE_GROUND_SPEED.asDouble());
}
setMountedYaw(npc.getEntity());
@ -278,7 +302,7 @@ public class Controllable extends Trait {
}
@Override
public void run(Player rider) {
public void run(Player rider, ControllableInput input) {
if (paused) {
npc.getEntity().setVelocity(npc.getEntity().getVelocity().setY(0.001));
return;
@ -297,7 +321,7 @@ public class Controllable extends Trait {
void rightClickEntity(NPCRightClickEvent event);
void run(Player rider);
void run(Player rider, ControllableInput input);
}
public static class PlayerInputAirController implements MovementController {
@ -325,15 +349,14 @@ public class Controllable extends Trait {
}
@Override
public void run(Player rider) {
public void run(Player rider, ControllableInput input) {
if (paused) {
npc.getEntity().setVelocity(npc.getEntity().getVelocity().setY(0.001F));
return;
}
speed = updateHorizontalSpeed(npc.getEntity(), rider, speed, 1F,
speed = updateSpeed(npc.getEntity(), NMS.getYaw(rider), input, speed, 1F,
Setting.MAX_CONTROLLABLE_FLIGHT_SPEED.asDouble());
boolean shouldJump = NMS.shouldJump(rider);
if (shouldJump) {
if (input.jump) {
npc.getEntity().setVelocity(npc.getEntity().getVelocity().setY(0.25F));
}
npc.getEntity().setVelocity(npc.getEntity().getVelocity().multiply(new Vector(1, 0.98, 1)));
@ -376,25 +399,19 @@ public class Controllable extends Trait {
NMS.look(entity, loc.getYaw(), loc.getPitch());
}
private static double updateHorizontalSpeed(Entity handle, Entity passenger, double speed, float speedMod,
private static double updateSpeed(Entity handle, double yaw, ControllableInput input, double speed, float speedMod,
double maxSpeed) {
yaw = Math.toRadians(yaw);
Vector vel = handle.getVelocity();
double oldSpeed = Math.sqrt(vel.getX() * vel.getX() + vel.getZ() * vel.getZ());
double horizontal = NMS.getHorizontalMovement(passenger);
if (Math.abs(Math.abs(horizontal) - 0.98) > 0.02)
return speed;
double yaw = passenger.getLocation().getYaw();
if (horizontal > 0.0D) {
double dXcos = -Math.sin(yaw * Math.PI / 180.0F);
double dXsin = Math.cos(yaw * Math.PI / 180.0F);
vel = vel.setX(dXcos * speed * speedMod).setZ(dXsin * speed * speedMod);
double nxsin = -Math.sin(yaw);
double xcos = Math.cos(yaw);
if (input.forward > 0) {
vel = vel.setX(nxsin * speed * speedMod).setZ(xcos * speed * speedMod);
}
vel = vel.add(new Vector(
passenger.getVelocity().getX() * speedMod * Setting.CONTROLLABLE_GROUND_DIRECTION_MODIFIER.asDouble(),
0D,
passenger.getVelocity().getZ() * speedMod * Setting.CONTROLLABLE_GROUND_DIRECTION_MODIFIER.asDouble()))
.multiply(0.98);
vel.add(new Vector(Math.sin(yaw + Math.PI / 2), 0D, -Math.cos(yaw + Math.PI / 2))
.multiply(speedMod * Setting.CONTROLLABLE_GROUND_DIRECTION_MODIFIER.asDouble() * input.horizontal));
vel.multiply(0.98);
double newSpeed = Math.sqrt(vel.getX() * vel.getX() + vel.getZ() * vel.getZ());
if (newSpeed > maxSpeed) {
@ -409,4 +426,14 @@ public class Controllable extends Trait {
return (float) Math.max(0, speed - speed / 50.0D);
}
}
private static boolean SUPPORTS_PLAYER_INPUT_EVENT = true;
static {
try {
Class.forName("org.bukkit.event.player.PlayerInputEvent");
} catch (ClassNotFoundException e) {
SUPPORTS_PLAYER_INPUT_EVENT = false;
}
}
}

View File

@ -13,6 +13,8 @@ public class MirrorTrait extends Trait {
@Persist
private volatile boolean enabled;
@Persist
private volatile boolean mirrorEquipment;
@Persist
private volatile boolean mirrorName;
public MirrorTrait() {
@ -27,6 +29,10 @@ public class MirrorTrait extends Trait {
return enabled;
}
public boolean isMirroringEquipment() {
return mirrorEquipment;
}
public boolean mirrorName() {
return mirrorName;
}
@ -39,6 +45,10 @@ public class MirrorTrait extends Trait {
}
}
public void setMirrorEquipment(boolean mirrorEquipment) {
this.mirrorEquipment = mirrorEquipment;
}
public void setMirrorName(boolean mirror) {
mirrorName = mirror;
}

View File

@ -528,8 +528,8 @@ public class NMS {
return BRIDGE.getHeadYaw(entity);
}
public static float getHorizontalMovement(org.bukkit.entity.Entity bukkitEntity) {
return BRIDGE.getHorizontalMovement(bukkitEntity);
public static float getForwardBackwardMovement(org.bukkit.entity.Entity bukkitEntity) {
return BRIDGE.getForwardBackwardMovement(bukkitEntity);
}
public static float getJumpPower(NPC npc, float original) {
@ -674,8 +674,8 @@ public class NMS {
return BRIDGE.getVehicle(entity);
}
public static float getVerticalMovement(org.bukkit.entity.Entity bukkitEntity) {
return BRIDGE.getVerticalMovement(bukkitEntity);
public static float getXZMovement(org.bukkit.entity.Entity bukkitEntity) {
return BRIDGE.getXZMovement(bukkitEntity);
}
public static Collection<Player> getViewingPlayers(org.bukkit.entity.Entity entity) {

View File

@ -99,7 +99,7 @@ public interface NMSBridge {
public float getHeadYaw(Entity entity);
public float getHorizontalMovement(Entity entity);
public float getForwardBackwardMovement(Entity entity);
public EntityPacketTracker getPacketTracker(Entity entity);
@ -129,7 +129,7 @@ public interface NMSBridge {
public Entity getVehicle(Entity entity);
public float getVerticalMovement(Entity entity);
public float getXZMovement(Entity entity);
public default Collection<Player> getViewingPlayers(Entity entity) {
return entity.getTrackedBy();
@ -150,6 +150,10 @@ public interface NMSBridge {
public boolean isSolid(Block in);
public default boolean isSprinting(Entity entity) {
return entity instanceof Player ? ((Player) entity).isSprinting() : false;
}
public boolean isValid(Entity entity);
public void load(CommandManager commands);

View File

@ -492,6 +492,7 @@
"citizens.commands.npc.select.already-selected" : "You already have that NPC selected. ",
"citizens.commands.npc.select.description" : "Select a NPC with the given ID or name",
"citizens.commands.npc.select.help" : "",
"citizens.commands.npc.setequipment.cosmetic-set" : "Set [[{0}]] (cosmetic) to [[{1}]].",
"citizens.commands.npc.setequipment.description" : "Sets equipment via commands",
"citizens.commands.npc.setequipment.help" : "",
"citizens.commands.npc.setequipment.set" : "Set [[{0}]] to [[{1}]].",

View File

@ -482,7 +482,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
@ -681,7 +681,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getVerticalMovement(org.bukkit.entity.Entity entity) {
public float getXZMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);

View File

@ -502,7 +502,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
@ -717,7 +717,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getVerticalMovement(org.bukkit.entity.Entity entity) {
public float getXZMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);

View File

@ -503,7 +503,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
@ -719,7 +719,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getVerticalMovement(org.bukkit.entity.Entity entity) {
public float getXZMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);

View File

@ -532,7 +532,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
@ -748,7 +748,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getVerticalMovement(org.bukkit.entity.Entity entity) {
public float getXZMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);

View File

@ -574,7 +574,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
@ -799,7 +799,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getVerticalMovement(org.bukkit.entity.Entity entity) {
public float getXZMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);

View File

@ -589,7 +589,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
@ -814,7 +814,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getVerticalMovement(org.bukkit.entity.Entity entity) {
public float getXZMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);

View File

@ -604,7 +604,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
@ -837,7 +837,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getVerticalMovement(org.bukkit.entity.Entity entity) {
public float getXZMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);

View File

@ -615,7 +615,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity);
@ -839,7 +839,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getVerticalMovement(org.bukkit.entity.Entity entity) {
public float getXZMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity);

View File

@ -621,7 +621,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity);
@ -846,7 +846,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getVerticalMovement(org.bukkit.entity.Entity entity) {
public float getXZMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity);

View File

@ -665,7 +665,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity);
@ -895,7 +895,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getVerticalMovement(org.bukkit.entity.Entity entity) {
public float getXZMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity);

View File

@ -693,7 +693,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity);
@ -924,7 +924,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getVerticalMovement(org.bukkit.entity.Entity entity) {
public float getXZMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity);

View File

@ -9,7 +9,7 @@
<artifactId>citizens-v1_21_R2</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<craftbukkit.version>1.21.2-R0.1-SNAPSHOT</craftbukkit.version>
<craftbukkit.version>1.21.3-R0.1-SNAPSHOT</craftbukkit.version>
</properties>
<dependencies>

View File

@ -681,7 +681,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity);
@ -912,7 +912,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getVerticalMovement(org.bukkit.entity.Entity entity) {
public float getXZMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity);

View File

@ -436,7 +436,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getHorizontalMovement(org.bukkit.entity.Entity entity) {
public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);
@ -625,7 +625,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public float getVerticalMovement(org.bukkit.entity.Entity entity) {
public float getXZMovement(org.bukkit.entity.Entity entity) {
if (!entity.getType().isAlive())
return Float.NaN;
EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);