Skip to content

Commit b248abf

Browse files
Fix: Text display offset <#4439> (#4883)
1 parent ddce101 commit b248abf

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ public final class EntityDefinitions {
327327
TEXT_DISPLAY = EntityDefinition.inherited(TextDisplayEntity::new, displayBase)
328328
.type(EntityType.TEXT_DISPLAY)
329329
.identifier("minecraft:armor_stand")
330+
.offset(-0.5f)
330331
.addTranslator(MetadataType.CHAT, TextDisplayEntity::setText)
331332
.addTranslator(null) // Line width
332333
.addTranslator(null) // Background color

core/src/main/java/org/geysermc/geyser/entity/type/TextDisplayEntity.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,17 @@
3838
// Note: 1.19.4 requires that the billboard is set to something in order to show, on Java Edition
3939
public class TextDisplayEntity extends DisplayBaseEntity {
4040
public TextDisplayEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
41-
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
41+
super(session, entityId, geyserId, uuid, definition, position.add(0, definition.offset(), 0), motion, yaw, pitch, headYaw);
42+
}
43+
44+
@Override
45+
public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, boolean isOnGround) {
46+
super.moveRelative(relX, relY + definition.offset(), relZ, yaw, pitch, isOnGround);
47+
}
48+
49+
@Override
50+
public void moveAbsolute(Vector3f position, float yaw, float pitch, float headYaw, boolean isOnGround, boolean teleported) {
51+
super.moveAbsolute(position.add(Vector3f.from(0, definition.offset(), 0)), yaw, pitch, headYaw, isOnGround, teleported);
4252
}
4353

4454
@Override

0 commit comments

Comments
 (0)