3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-28 00:50:13 +01:00

Fix entity attributes length prefix (#2136)

Dieser Commit ist enthalten in:
DaPorkchop_ 2020-10-14 15:40:39 +02:00 committet von GitHub
Ursprung 71341a9381
Commit 54b6d1c21c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -211,6 +211,7 @@ public class EntityPackets {
handler(wrapper -> { handler(wrapper -> {
wrapper.passthrough(Type.VAR_INT); wrapper.passthrough(Type.VAR_INT);
int size = wrapper.passthrough(Type.INT); int size = wrapper.passthrough(Type.INT);
int actualSize = size;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
// Attributes have been renamed and are now namespaced identifiers // Attributes have been renamed and are now namespaced identifiers
String key = wrapper.read(Type.STRING); String key = wrapper.read(Type.STRING);
@ -218,7 +219,10 @@ public class EntityPackets {
if (attributeIdentifier == null) { if (attributeIdentifier == null) {
attributeIdentifier = "minecraft:" + key; attributeIdentifier = "minecraft:" + key;
if (!us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData.isValid1_13Channel(attributeIdentifier)) { if (!us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData.isValid1_13Channel(attributeIdentifier)) {
Via.getPlatform().getLogger().warning("Invalid attribute: " + key); if (!Via.getConfig().isSuppressConversionWarnings()) {
Via.getPlatform().getLogger().warning("Invalid attribute: " + key);
}
actualSize--;
wrapper.read(Type.DOUBLE); wrapper.read(Type.DOUBLE);
int modifierSize = wrapper.read(Type.VAR_INT); int modifierSize = wrapper.read(Type.VAR_INT);
for (int j = 0; j < modifierSize; j++) { for (int j = 0; j < modifierSize; j++) {
@ -240,6 +244,9 @@ public class EntityPackets {
wrapper.passthrough(Type.BYTE); wrapper.passthrough(Type.BYTE);
} }
} }
if (size != actualSize) {
wrapper.set(Type.INT, 0, actualSize);
}
}); });
} }
}); });