From fef0401add9afad91a3144e47454a6b091f3e423 Mon Sep 17 00:00:00 2001 From: Xamyr Date: Sat, 18 Jun 2022 03:15:31 +0100 Subject: [PATCH] Fixed armorstand passenger yOffset (#2976) --- .../geyser/entity/type/living/ArmorStandEntity.java | 4 ++++ .../main/java/org/geysermc/geyser/util/EntityUtils.java | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java index 04e4727d0..75b2ad991 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java @@ -51,6 +51,7 @@ public class ArmorStandEntity extends LivingEntity { @Getter private boolean isMarker = false; private boolean isInvisible = false; + @Getter private boolean isSmall = false; /** @@ -74,6 +75,7 @@ public class ArmorStandEntity extends LivingEntity { * - No armor, no name: false * - No armor, yes name: true */ + @Getter private boolean positionRequiresOffset = false; /** * Whether we should update the position of this armor stand after metadata updates. @@ -411,6 +413,8 @@ public class ArmorStandEntity extends LivingEntity { this.positionRequiresOffset = newValue; if (positionRequiresOffset) { this.position = applyOffsetToPosition(position); + // Update the passenger offset as armorstand is moving up by roughly 2 blocks + updatePassengerOffsets(); } else { this.position = removeOffsetFromPosition(position); } diff --git a/core/src/main/java/org/geysermc/geyser/util/EntityUtils.java b/core/src/main/java/org/geysermc/geyser/util/EntityUtils.java index 43ccff5e0..d128989a8 100644 --- a/core/src/main/java/org/geysermc/geyser/util/EntityUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/EntityUtils.java @@ -187,6 +187,15 @@ public final class EntityUtils { case MINECART, HOPPER_MINECART, TNT_MINECART, CHEST_MINECART, FURNACE_MINECART, SPAWNER_MINECART, COMMAND_BLOCK_MINECART, BOAT, CHEST_BOAT -> yOffset -= mount.getDefinition().height() * 0.5f; } + if (passenger.getDefinition().entityType() == EntityType.FALLING_BLOCK) { + yOffset += 0.5f; + } + if (mount.getDefinition().entityType() == EntityType.ARMOR_STAND) { + ArmorStandEntity armorStand = (ArmorStandEntity) mount; + if (armorStand.isPositionRequiresOffset()) { + yOffset -= EntityDefinitions.ARMOR_STAND.height() * (armorStand.isSmall() ? 0.55d : 1d); + } + } Vector3f offset = Vector3f.from(xOffset, yOffset, zOffset); passenger.setRiderSeatPosition(offset); }