Fix interaction height on 1.19.4

This commit is contained in:
fullwall 2024-07-20 18:13:17 +08:00
parent 219e016ee7
commit 3370fdde5d
6 changed files with 9 additions and 9 deletions

View File

@ -636,7 +636,7 @@ public class HologramTrait extends Trait {
public void onSeenByPlayer(NPC npc, Player player) {
if (lastOffset == null)
return;
NMS.linkTextInteraction(player, hologram.getEntity(), npc.getEntity(), lastOffset.y);
NMS.positionInteractionText(player, hologram.getEntity(), npc.getEntity(), lastOffset.y);
}
@Override

View File

@ -689,8 +689,8 @@ public class NMS {
return BRIDGE.isValid(entity);
}
public static void linkTextInteraction(Player player, Entity interaction, Entity mount, double height) {
BRIDGE.linkTextInteraction(player, interaction, mount, height);
public static void positionInteractionText(Player player, Entity interaction, Entity mount, double height) {
BRIDGE.positionInteractionText(player, interaction, mount, height);
}
public static void load(CommandManager commands) {

View File

@ -150,7 +150,7 @@ public interface NMSBridge {
public boolean isValid(Entity entity);
public default void linkTextInteraction(Player player, Entity interaction, Entity mount, double height) {
public default void positionInteractionText(Player player, Entity interaction, Entity mount, double height) {
}
public void load(CommandManager commands);

View File

@ -720,7 +720,7 @@ public class NMSImpl implements NMSBridge {
@Override
public float getRidingHeightOffset(org.bukkit.entity.Entity entity, org.bukkit.entity.Entity mount) {
return (float) (getHandle(mount).getPassengersRidingOffset() - 0.5D);
return (float) (getHandle(mount).getPassengersRidingOffset());
}
@Override
@ -935,9 +935,9 @@ public class NMSImpl implements NMSBridge {
}
@Override
public void linkTextInteraction(org.bukkit.entity.Player player, org.bukkit.entity.Entity entity,
public void positionInteractionText(org.bukkit.entity.Player player, org.bukkit.entity.Entity entity,
org.bukkit.entity.Entity mount, double offset) {
offset += -0.9 + getHandle(mount).getPassengersRidingOffset();
offset += getRidingHeightOffset(entity, mount) + 0.5;
sendPacket(player,
new ClientboundBundlePacket(List.of(
new ClientboundSetEntityDataPacket(entity.getEntityId(),

View File

@ -912,7 +912,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public void linkTextInteraction(org.bukkit.entity.Player player, org.bukkit.entity.Entity entity,
public void positionInteractionText(org.bukkit.entity.Player player, org.bukkit.entity.Entity entity,
org.bukkit.entity.Entity mount, double offset) {
offset += getRidingHeightOffset(entity, mount);
sendPacket(player,

View File

@ -891,7 +891,7 @@ public class NMSImpl implements NMSBridge {
}
@Override
public void linkTextInteraction(org.bukkit.entity.Player player, org.bukkit.entity.Entity entity,
public void positionInteractionText(org.bukkit.entity.Player player, org.bukkit.entity.Entity entity,
org.bukkit.entity.Entity mount, double offset) {
offset += getRidingHeightOffset(entity, mount);
sendPacket(player,