Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-25 07:40:08 +01:00
Fix ancient client error caused by empty meta for < 1.11
Since modern versions don't immediately send metadata in spawn packets and 1.10 clients and lower have a slight oversight in the meta getting, every mob/player spawn spammed the client console with an error. Even though it is a harmless error, I figured people would like their client console not to get spammed anymore.
Dieser Commit ist enthalten in:
Ursprung
27b4933262
Commit
f341fc132c
@ -134,23 +134,25 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<Protocol1_10To1_11>
|
|||||||
handler(getTrackerHandler(Type.UNSIGNED_BYTE, 0));
|
handler(getTrackerHandler(Type.UNSIGNED_BYTE, 0));
|
||||||
|
|
||||||
// Rewrite entity type / metadata
|
// Rewrite entity type / metadata
|
||||||
handler(new PacketHandler() {
|
handler(wrapper -> {
|
||||||
@Override
|
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
EntityType type = tracker(wrapper.user()).entityType(entityId);
|
||||||
int entityId = wrapper.get(Type.VAR_INT, 0);
|
|
||||||
EntityType type = tracker(wrapper.user()).entityType(entityId);
|
|
||||||
|
|
||||||
List<Metadata> list = wrapper.get(Types1_9.METADATA_LIST, 0);
|
List<Metadata> list = wrapper.get(Types1_9.METADATA_LIST, 0);
|
||||||
handleMetadata(wrapper.get(Type.VAR_INT, 0), list, wrapper.user());
|
handleMetadata(wrapper.get(Type.VAR_INT, 0), list, wrapper.user());
|
||||||
|
|
||||||
EntityData entityData = entityDataForType(type);
|
EntityData entityData = entityDataForType(type);
|
||||||
if (entityData != null) {
|
if (entityData != null) {
|
||||||
wrapper.set(Type.UNSIGNED_BYTE, 0, (short) entityData.replacementId());
|
wrapper.set(Type.UNSIGNED_BYTE, 0, (short) entityData.replacementId());
|
||||||
if (entityData.hasBaseMeta()) {
|
if (entityData.hasBaseMeta()) {
|
||||||
entityData.defaultMeta().createMeta(new WrappedMetadata(list));
|
entityData.defaultMeta().createMeta(new WrappedMetadata(list));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sub 1.11 clients will error if the list is empty
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
list.add(new Metadata(0, MetaType1_9.Byte, (byte) 0));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -172,6 +174,13 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<Protocol1_10To1_11>
|
|||||||
map(Types1_9.METADATA_LIST); // 7 - Metadata list
|
map(Types1_9.METADATA_LIST); // 7 - Metadata list
|
||||||
|
|
||||||
handler(getTrackerAndMetaHandler(Types1_9.METADATA_LIST, Entity1_11Types.EntityType.PLAYER));
|
handler(getTrackerAndMetaHandler(Types1_9.METADATA_LIST, Entity1_11Types.EntityType.PLAYER));
|
||||||
|
handler(wrapper -> {
|
||||||
|
// Sub 1.11 clients will cry if the list is empty
|
||||||
|
List<Metadata> metadata = wrapper.get(Types1_9.METADATA_LIST, 0);
|
||||||
|
if (metadata.isEmpty()) {
|
||||||
|
metadata.add(new Metadata(0, MetaType1_9.Byte, (byte) 0));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren