Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-26 16:12:43 +01:00
fix display name
Dieser Commit ist enthalten in:
Ursprung
96b05bcd4f
Commit
dd454d56f3
@ -30,6 +30,7 @@ import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_9;
|
||||
import us.myles.ViaVersion.exception.CancelException;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -51,6 +52,9 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Rewrit
|
||||
@Getter(AccessLevel.PROTECTED)
|
||||
@Setter(AccessLevel.PROTECTED)
|
||||
private int displayNameIndex = 2;
|
||||
@Getter(AccessLevel.PROTECTED)
|
||||
@Setter(AccessLevel.PROTECTED)
|
||||
private boolean isDisplayNameJson = false;
|
||||
|
||||
protected AbstractEntityType getEntityType(UserConnection connection, int id) {
|
||||
return getEntityTracker(connection).getEntityType(id);
|
||||
@ -149,7 +153,11 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Rewrit
|
||||
if (entData.getMobName() != null &&
|
||||
(data.getValue() == null || ((String) data.getValue()).isEmpty()) &&
|
||||
data.getMetaType().getTypeID() == getDisplayNameMetaType().getTypeID()) {
|
||||
data.setValue(entData.getMobName());
|
||||
String mobName = entData.getMobName();
|
||||
if (isDisplayNameJson) {
|
||||
mobName = ChatRewriter.legacyTextToJson(mobName);
|
||||
}
|
||||
data.setValue(mobName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -288,6 +288,9 @@ public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
|
||||
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
setDisplayNameJson(true);
|
||||
setDisplayNameMetaType(MetaType1_13_2.OptChat);
|
||||
|
||||
regEntType(EntityType1_14.EntityType.CAT, EntityType1_14.EntityType.OCELOT).mobName("Cat").spawnMetadata(e -> {
|
||||
// e.add(new Metadata(13, MetaType1_13_2.Byte, (byte) 0x4)); // Tamed cat
|
||||
});
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren