3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-20 06:50:08 +01:00

Fix LazilyParsedNumber conversion ViaVersion/ViaVersion#3546 (#3550)

Dieser Commit ist enthalten in:
David Lüdtke 2023-12-06 09:50:33 +01:00 committet von GitHub
Ursprung d5326fad95
Commit d44d89099b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -35,6 +35,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive; import com.google.gson.JsonPrimitive;
import com.google.gson.internal.LazilyParsedNumber;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.data.MappingData; import com.viaversion.viaversion.api.data.MappingData;
@ -418,8 +419,10 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
return new DoubleTag(number.doubleValue()); return new DoubleTag(number.doubleValue());
} else if (number instanceof Float) { } else if (number instanceof Float) {
return new FloatTag(number.floatValue()); return new FloatTag(number.floatValue());
} else if (number instanceof LazilyParsedNumber) {
return new IntTag(number.intValue());
} }
return new StringTag(primitive.getAsString()); // ??? return new IntTag(number.intValue()); // ???
} }
throw new IllegalArgumentException("Unhandled json type " + element.getClass().getSimpleName() + " with value " + element.getAsString()); throw new IllegalArgumentException("Unhandled json type " + element.getClass().getSimpleName() + " with value " + element.getAsString());
} }