mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fixed armorstand passenger yOffset (#2976)
This commit is contained in:
parent
71c489b462
commit
fef0401add
2 changed files with 13 additions and 0 deletions
|
@ -51,6 +51,7 @@ public class ArmorStandEntity extends LivingEntity {
|
||||||
@Getter
|
@Getter
|
||||||
private boolean isMarker = false;
|
private boolean isMarker = false;
|
||||||
private boolean isInvisible = false;
|
private boolean isInvisible = false;
|
||||||
|
@Getter
|
||||||
private boolean isSmall = false;
|
private boolean isSmall = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,6 +75,7 @@ public class ArmorStandEntity extends LivingEntity {
|
||||||
* - No armor, no name: false
|
* - No armor, no name: false
|
||||||
* - No armor, yes name: true
|
* - No armor, yes name: true
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
private boolean positionRequiresOffset = false;
|
private boolean positionRequiresOffset = false;
|
||||||
/**
|
/**
|
||||||
* Whether we should update the position of this armor stand after metadata updates.
|
* 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;
|
this.positionRequiresOffset = newValue;
|
||||||
if (positionRequiresOffset) {
|
if (positionRequiresOffset) {
|
||||||
this.position = applyOffsetToPosition(position);
|
this.position = applyOffsetToPosition(position);
|
||||||
|
// Update the passenger offset as armorstand is moving up by roughly 2 blocks
|
||||||
|
updatePassengerOffsets();
|
||||||
} else {
|
} else {
|
||||||
this.position = removeOffsetFromPosition(position);
|
this.position = removeOffsetFromPosition(position);
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,6 +187,15 @@ public final class EntityUtils {
|
||||||
case MINECART, HOPPER_MINECART, TNT_MINECART, CHEST_MINECART, FURNACE_MINECART, SPAWNER_MINECART,
|
case MINECART, HOPPER_MINECART, TNT_MINECART, CHEST_MINECART, FURNACE_MINECART, SPAWNER_MINECART,
|
||||||
COMMAND_BLOCK_MINECART, BOAT, CHEST_BOAT -> yOffset -= mount.getDefinition().height() * 0.5f;
|
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);
|
Vector3f offset = Vector3f.from(xOffset, yOffset, zOffset);
|
||||||
passenger.setRiderSeatPosition(offset);
|
passenger.setRiderSeatPosition(offset);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue