3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-03 14:50:19 +01:00

Fixed armorstand passenger yOffset (#2976)

Dieser Commit ist enthalten in:
Xamyr 2022-06-18 03:15:31 +01:00 committet von GitHub
Ursprung 71c489b462
Commit fef0401add
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 13 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -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);
} }

Datei anzeigen

@ -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);
} }