Don't show custom names on display entities (#4309)

* Ensure that a custom text display entity name doesn't show up - it doesn't show on Java, and if we show it, the text display contents aren't shown.

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

Co-authored-by: Konicai <71294714+Konicai@users.noreply.github.com>

---------

Co-authored-by: Konicai <71294714+Konicai@users.noreply.github.com>
This commit is contained in:
chris 2023-11-23 09:51:57 +01:00 committed by GitHub
parent 119fbc86bc
commit 3292718e69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,6 +34,7 @@ import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.text.MessageTranslator;
import java.util.Optional;
import java.util.UUID;
// Note: 1.19.4 requires that the billboard is set to something in order to show, on Java Edition
@ -56,6 +57,12 @@ public class TextDisplayEntity extends Entity {
// On JE: Hiding the display name still shows the display entity text.
}
@Override
public void setDisplayName(EntityMetadata<Optional<Component>, ?> entityMetadata) {
// This would usually set EntityDataTypes.NAME, but we are instead using NAME for the text display.
// On JE: custom name does not override text display.
}
public void setText(EntityMetadata<Component, ?> entityMetadata) {
this.dirtyMetadata.put(EntityDataTypes.NAME, MessageTranslator.convertMessage(entityMetadata.getValue()));
}