3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-19 14:30:16 +01:00
Dieser Commit ist enthalten in:
Nassim Jahnke 2023-10-12 01:13:19 +10:00
Ursprung d8007dc73c
Commit 26dad99265
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
5 geänderte Dateien mit 18 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -85,7 +85,7 @@ public class ProtocolVersion {
public static final ProtocolVersion v1_19_4 = register(762, "1.19.4");
public static final ProtocolVersion v1_20 = register(763, "1.20/1.20.1", new VersionRange("1.20", 0, 1));
public static final ProtocolVersion v1_20_2 = register(764, "1.20.2");
public static final ProtocolVersion v1_20_3 = register(765, 154, "1.20.3");
public static final ProtocolVersion v1_20_3 = register(765, 156, "1.20.3");
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
public static ProtocolVersion register(int version, String name) {

Datei anzeigen

@ -37,6 +37,8 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.data.MappingData;
import com.viaversion.viaversion.api.data.MappingDataBase;
import com.viaversion.viaversion.api.minecraft.entities.Entity1_19_4Types;
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
@ -53,7 +55,7 @@ import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.Clientbou
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundConfigurationPackets1_20_2;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPackets1_20_2;
import com.viaversion.viaversion.protocols.protocol1_20_3to1_20_2.rewriter.EntityPacketRewriter1_20_3;
import com.viaversion.viaversion.util.GsonUtil;
import com.viaversion.viaversion.rewriter.SoundRewriter;
import java.util.BitSet;
import java.util.Map;
import java.util.UUID;
@ -61,6 +63,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPackets1_20_2, ClientboundPackets1_20_2, ServerboundPackets1_20_2, ServerboundPackets1_20_2> {
public static final MappingData MAPPINGS = new MappingDataBase("1.20.2", "1.20.3");
private final EntityPacketRewriter1_20_3 entityRewriter = new EntityPacketRewriter1_20_3(this);
public Protocol1_20_3To1_20_2() {
@ -71,6 +74,10 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
protected void registerPackets() {
super.registerPackets();
final SoundRewriter<ClientboundPackets1_20_2> soundRewriter = new SoundRewriter<>(this);
soundRewriter.register1_19_3Sound(ClientboundPackets1_20_2.SOUND);
soundRewriter.registerEntitySound(ClientboundPackets1_20_2.ENTITY_SOUND);
// Components are now (mostly) written as nbt instead of json strings
registerClientbound(ClientboundPackets1_20_2.ADVANCEMENTS, wrapper -> {
wrapper.passthrough(Type.BOOLEAN); // Reset/clear
@ -271,14 +278,10 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
}
}
public static @Nullable Tag jsonComponentToTag(@Nullable JsonElement component) {
component = GsonUtil.getGson().fromJson("[{\"text\": \"A\", \"color\": \"red\"}, \"B\", 1, [\"a\"]]", JsonArray.class);
Via.getPlatform().getLogger().info("Converting: " + component);
public static @Nullable Tag jsonComponentToTag(@Nullable final JsonElement component) {
try {
// This mostly works:tm:
final Tag tag = convertToTag(component);
Via.getPlatform().getLogger().info("To: " + tag);
return tag;
return convertToTag(component);
} catch (final Exception e) {
Via.getPlatform().getLogger().severe("Error converting component: " + component);
e.printStackTrace();
@ -320,6 +323,7 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
} else if (number instanceof Float) {
return new FloatTag(number.floatValue());
}
return new StringTag(primitive.getAsString()); // ???
}
throw new IllegalArgumentException("Unhandled json type " + element.getClass().getSimpleName() + " with value " + element.getAsString());
}
@ -459,6 +463,11 @@ public final class Protocol1_20_3To1_20_2 extends AbstractProtocol<ClientboundPa
addEntityTracker(connection, new EntityTrackerBase(connection, Entity1_19_4Types.PLAYER));
}
@Override
public MappingData getMappingData() {
return MAPPINGS;
}
@Override
protected ServerboundPacketType serverboundFinishConfigurationPacket() {
return ServerboundConfigurationPackets1_20_2.FINISH_CONFIGURATION;

Datei anzeigen

@ -1,5 +1,5 @@
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
projectVersion=4.9.0-23w40a-SNAPSHOT
projectVersion=4.9.0-23w41a-SNAPSHOT
# Smile emoji
mcVersions=1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10, 1.9.4, 1.9.3, 1.9.2, 1.9.1, 1.9, 1.8.9