Skip to content

Commit c3e19b7

Browse files
authored
Don't drop alwaysShowNametag entity data in hologram emulation 1.8->1.7 (#600)
1 parent 561829d commit c3e19b7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

common/src/main/java/com/viaversion/viarewind/protocol/v1_8to1_7_6_10/data/VirtualHologramEntity.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class VirtualHologramEntity {
4848
private float headYaw;
4949
private boolean small = false;
5050
private boolean marker = false;
51+
private boolean showNametag = false;
5152

5253
public VirtualHologramEntity(final UserConnection user, final int entityId) {
5354
this.user = user;
@@ -98,6 +99,7 @@ public void syncState(final EntityPacketRewriter1_8 entityRewriter, final List<E
9899
// Filter armor stand data to calculate emulation
99100
byte flags = 0;
100101
byte armorStandFlags = 0;
102+
byte nameTagFlags = 0;
101103
for (EntityData entityData : entityDataTracker) {
102104
if (entityData.id() == 0 && entityData.dataType() == EntityDataTypes1_8.BYTE) {
103105
flags = ((Number) entityData.getValue()).byteValue();
@@ -106,11 +108,14 @@ public void syncState(final EntityPacketRewriter1_8 entityRewriter, final List<E
106108
if (name != null && name.isEmpty()) name = null;
107109
} else if (entityData.id() == 10 && entityData.dataType() == EntityDataTypes1_8.BYTE) {
108110
armorStandFlags = ((Number) entityData.getValue()).byteValue();
111+
} else if (entityData.id() == 3 && entityData.dataType() == EntityDataTypes1_8.BYTE) {
112+
nameTagFlags = ((Number) entityData.getValue()).byteValue();
109113
}
110114
}
111115
final boolean invisible = (flags & 0x20) != 0;
112116
small = (armorStandFlags & 0x01) != 0;
113117
marker = (armorStandFlags & 0x10) != 0;
118+
showNametag = (nameTagFlags & 0x01) != 0;
114119

115120
State prevState = currentState;
116121
if (invisible && name != null) {
@@ -253,7 +258,7 @@ private void writeHologramMeta(PacketWrapper wrapper) {
253258
final List<EntityData> entityDataList = new ArrayList<>();
254259
entityDataList.add(new EntityData(EntityDataIndex1_7_6_10.ABSTRACT_AGEABLE_AGE.getIndex(), EntityDataTypes1_7_6_10.INT, -1700000));
255260
entityDataList.add(new EntityData(EntityDataIndex1_7_6_10.LIVING_ENTITY_BASE_NAME_TAG.getIndex(), EntityDataTypes1_7_6_10.STRING, name));
256-
entityDataList.add(new EntityData(EntityDataIndex1_7_6_10.LIVING_ENTITY_BASE_NAME_TAG_VISIBILITY.getIndex(), EntityDataTypes1_7_6_10.BYTE, (byte) 1));
261+
entityDataList.add(new EntityData(EntityDataIndex1_7_6_10.LIVING_ENTITY_BASE_NAME_TAG_VISIBILITY.getIndex(), EntityDataTypes1_7_6_10.BYTE, (byte) (showNametag ? 1 : 0)));
257262

258263
wrapper.write(RewindTypes.ENTITY_DATA_LIST1_7, entityDataList);
259264
}

0 commit comments

Comments
 (0)