3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 00:00:41 +01:00

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>
Dieser Commit ist enthalten in:
chris 2023-11-23 09:51:57 +01:00 committet von GitHub
Ursprung 119fbc86bc
Commit 3292718e69
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -34,6 +34,7 @@ import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.translator.text.MessageTranslator;
import java.util.Optional;
import java.util.UUID; import java.util.UUID;
// Note: 1.19.4 requires that the billboard is set to something in order to show, on Java Edition // 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. // 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) { public void setText(EntityMetadata<Component, ?> entityMetadata) {
this.dirtyMetadata.put(EntityDataTypes.NAME, MessageTranslator.convertMessage(entityMetadata.getValue())); this.dirtyMetadata.put(EntityDataTypes.NAME, MessageTranslator.convertMessage(entityMetadata.getValue()));
} }