mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-23 02:25:19 +01:00
1.19.1-pre2
This commit is contained in:
parent
6baae5e4f7
commit
f4aa96a5f8
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2016-2022 ViaVersion and contributors
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
package com.viaversion.viaversion.api.minecraft;
|
||||||
|
|
||||||
|
public final class ProfileKey {
|
||||||
|
private final long expiresAt;
|
||||||
|
private final byte[] publicKey;
|
||||||
|
private final byte[] keySignature;
|
||||||
|
|
||||||
|
public ProfileKey(final long expiresAt, final byte[] publicKey, final byte[] keySignature) {
|
||||||
|
this.expiresAt = expiresAt;
|
||||||
|
this.publicKey = publicKey;
|
||||||
|
this.keySignature = keySignature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long expiresAt() {
|
||||||
|
return expiresAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] publicKey() {
|
||||||
|
return publicKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] keySignature() {
|
||||||
|
return keySignature;
|
||||||
|
}
|
||||||
|
}
|
@ -81,7 +81,7 @@ public class ProtocolVersion {
|
|||||||
public static final ProtocolVersion v1_18 = register(757, "1.18/1.18.1", new VersionRange("1.18", 0, 1));
|
public static final ProtocolVersion v1_18 = register(757, "1.18/1.18.1", new VersionRange("1.18", 0, 1));
|
||||||
public static final ProtocolVersion v1_18_2 = register(758, "1.18.2");
|
public static final ProtocolVersion v1_18_2 = register(758, "1.18.2");
|
||||||
public static final ProtocolVersion v1_19 = register(759, "1.19");
|
public static final ProtocolVersion v1_19 = register(759, "1.19");
|
||||||
public static final ProtocolVersion v1_19_1 = register(760, 94, "1.19.1");
|
public static final ProtocolVersion v1_19_1 = register(760, 95, "1.19.1");
|
||||||
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
|
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
|
||||||
|
|
||||||
public static ProtocolVersion register(int version, String name) {
|
public static ProtocolVersion register(int version, String name) {
|
||||||
|
@ -29,6 +29,7 @@ import com.viaversion.viaversion.api.minecraft.BlockChangeRecord;
|
|||||||
import com.viaversion.viaversion.api.minecraft.EulerAngle;
|
import com.viaversion.viaversion.api.minecraft.EulerAngle;
|
||||||
import com.viaversion.viaversion.api.minecraft.GlobalPosition;
|
import com.viaversion.viaversion.api.minecraft.GlobalPosition;
|
||||||
import com.viaversion.viaversion.api.minecraft.Position;
|
import com.viaversion.viaversion.api.minecraft.Position;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.ProfileKey;
|
||||||
import com.viaversion.viaversion.api.minecraft.Vector;
|
import com.viaversion.viaversion.api.minecraft.Vector;
|
||||||
import com.viaversion.viaversion.api.minecraft.VillagerData;
|
import com.viaversion.viaversion.api.minecraft.VillagerData;
|
||||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||||
@ -68,9 +69,11 @@ import com.viaversion.viaversion.api.type.types.minecraft.OptPositionType;
|
|||||||
import com.viaversion.viaversion.api.type.types.minecraft.OptUUIDType;
|
import com.viaversion.viaversion.api.type.types.minecraft.OptUUIDType;
|
||||||
import com.viaversion.viaversion.api.type.types.minecraft.OptionalComponentType;
|
import com.viaversion.viaversion.api.type.types.minecraft.OptionalComponentType;
|
||||||
import com.viaversion.viaversion.api.type.types.minecraft.OptionalGlobalPositionType;
|
import com.viaversion.viaversion.api.type.types.minecraft.OptionalGlobalPositionType;
|
||||||
|
import com.viaversion.viaversion.api.type.types.minecraft.OptionalProfileKeyType;
|
||||||
import com.viaversion.viaversion.api.type.types.minecraft.OptionalVarIntType;
|
import com.viaversion.viaversion.api.type.types.minecraft.OptionalVarIntType;
|
||||||
import com.viaversion.viaversion.api.type.types.minecraft.Position1_14Type;
|
import com.viaversion.viaversion.api.type.types.minecraft.Position1_14Type;
|
||||||
import com.viaversion.viaversion.api.type.types.minecraft.PositionType;
|
import com.viaversion.viaversion.api.type.types.minecraft.PositionType;
|
||||||
|
import com.viaversion.viaversion.api.type.types.minecraft.ProfileKeyType;
|
||||||
import com.viaversion.viaversion.api.type.types.minecraft.VarLongBlockChangeRecordType;
|
import com.viaversion.viaversion.api.type.types.minecraft.VarLongBlockChangeRecordType;
|
||||||
import com.viaversion.viaversion.api.type.types.minecraft.VectorType;
|
import com.viaversion.viaversion.api.type.types.minecraft.VectorType;
|
||||||
import com.viaversion.viaversion.api.type.types.minecraft.VillagerDataType;
|
import com.viaversion.viaversion.api.type.types.minecraft.VillagerDataType;
|
||||||
@ -169,6 +172,9 @@ public abstract class Type<T> implements ByteBufReader<T>, ByteBufWriter<T> {
|
|||||||
public static final Type<Item> ITEM = new ItemType();
|
public static final Type<Item> ITEM = new ItemType();
|
||||||
public static final Type<Item[]> ITEM_ARRAY = new ItemArrayType();
|
public static final Type<Item[]> ITEM_ARRAY = new ItemArrayType();
|
||||||
|
|
||||||
|
public static final Type<ProfileKey> PROFILE_KEY = new ProfileKeyType();
|
||||||
|
public static final Type<ProfileKey> OPTIONAL_PROFILE_KEY = new OptionalProfileKeyType();
|
||||||
|
|
||||||
/* 1.13 Flat Item (no data) */
|
/* 1.13 Flat Item (no data) */
|
||||||
public static final Type<Item> FLAT_ITEM = new FlatItemType();
|
public static final Type<Item> FLAT_ITEM = new FlatItemType();
|
||||||
public static final Type<Item> FLAT_VAR_INT_ITEM = new FlatVarIntItemType();
|
public static final Type<Item> FLAT_VAR_INT_ITEM = new FlatVarIntItemType();
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2016-2022 ViaVersion and contributors
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
package com.viaversion.viaversion.api.type.types.minecraft;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.minecraft.ProfileKey;
|
||||||
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
|
//TODO generify optional types
|
||||||
|
public class OptionalProfileKeyType extends Type<ProfileKey> {
|
||||||
|
|
||||||
|
public OptionalProfileKeyType() {
|
||||||
|
super(ProfileKey.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable ProfileKey read(final ByteBuf buffer) throws Exception {
|
||||||
|
return buffer.readBoolean() ? Type.PROFILE_KEY.read(buffer) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(final ByteBuf buffer, @Nullable final ProfileKey object) throws Exception {
|
||||||
|
if (object != null) {
|
||||||
|
buffer.writeBoolean(true);
|
||||||
|
Type.PROFILE_KEY.write(buffer, object);
|
||||||
|
} else {
|
||||||
|
buffer.writeBoolean(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||||
|
* Copyright (C) 2016-2022 ViaVersion and contributors
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
package com.viaversion.viaversion.api.type.types.minecraft;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.minecraft.ProfileKey;
|
||||||
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
|
public class ProfileKeyType extends Type<ProfileKey> {
|
||||||
|
|
||||||
|
public ProfileKeyType() {
|
||||||
|
super(ProfileKey.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProfileKey read(final ByteBuf buffer) throws Exception {
|
||||||
|
return new ProfileKey(buffer.readLong(), Type.BYTE_ARRAY_PRIMITIVE.read(buffer), Type.BYTE_ARRAY_PRIMITIVE.read(buffer));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(final ByteBuf buffer, final ProfileKey object) throws Exception {
|
||||||
|
buffer.writeLong(object.expiresAt());
|
||||||
|
Type.BYTE_ARRAY_PRIMITIVE.write(buffer, object.publicKey());
|
||||||
|
Type.BYTE_ARRAY_PRIMITIVE.write(buffer, object.keySignature());
|
||||||
|
}
|
||||||
|
}
|
@ -18,8 +18,36 @@
|
|||||||
package com.viaversion.viaversion.protocols.protocol1_19_1to1_19;
|
package com.viaversion.viaversion.protocols.protocol1_19_1to1_19;
|
||||||
|
|
||||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||||
|
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||||
|
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||||
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
|
import com.viaversion.viaversion.protocols.base.ServerboundLoginPackets;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
|
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ServerboundPackets1_19;
|
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ServerboundPackets1_19;
|
||||||
|
|
||||||
public final class Protocol1_19_1To1_19 extends AbstractProtocol<ClientboundPackets1_19, ClientboundPackets1_19, ServerboundPackets1_19, ServerboundPackets1_19> {
|
public final class Protocol1_19_1To1_19 extends AbstractProtocol<ClientboundPackets1_19, ClientboundPackets1_19, ServerboundPackets1_19, ServerboundPackets1_19> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void registerPackets() {
|
||||||
|
// Skip 1.19 and assume 1.18.2->1.19.1 translation
|
||||||
|
registerClientbound(ClientboundPackets1_19.SYSTEM_CHAT, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.COMPONENT);
|
||||||
|
handler(wrapper -> {
|
||||||
|
wrapper.read(Type.VAR_INT); // Chat type
|
||||||
|
wrapper.write(Type.BOOLEAN, false); // Overlay
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
registerServerbound(State.LOGIN, ServerboundLoginPackets.HELLO.getId(), ServerboundLoginPackets.HELLO.getId(), new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.STRING); // Name
|
||||||
|
map(Type.OPTIONAL_PROFILE_KEY); // Public profile key
|
||||||
|
read(Type.OPTIONAL_UUID); // Profile uuid
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,8 +200,9 @@ public final class Protocol1_19To1_18_2 extends AbstractProtocol<ClientboundPack
|
|||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.COMPONENT); // Message
|
map(Type.COMPONENT); // Message
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
int type = wrapper.read(Type.BYTE);
|
//TODO handle game info
|
||||||
wrapper.write(Type.VAR_INT, type == 0 ? 1 : type);
|
wrapper.read(Type.BYTE);
|
||||||
|
wrapper.write(Type.VAR_INT, 1);
|
||||||
});
|
});
|
||||||
read(Type.UUID); // Sender
|
read(Type.UUID); // Sender
|
||||||
}
|
}
|
||||||
@ -268,13 +269,7 @@ public final class Protocol1_19To1_18_2 extends AbstractProtocol<ClientboundPack
|
|||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.STRING); // Name
|
map(Type.STRING); // Name
|
||||||
handler(wrapper -> {
|
read(Type.OPTIONAL_PROFILE_KEY); // Public profile key
|
||||||
if (wrapper.read(Type.BOOLEAN)) {
|
|
||||||
wrapper.read(Type.LONG); // Timestamp
|
|
||||||
wrapper.read(Type.BYTE_ARRAY_PRIMITIVE); // Key
|
|
||||||
wrapper.read(Type.BYTE_ARRAY_PRIMITIVE); // Signature
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -43,7 +43,11 @@ import com.viaversion.viaversion.rewriter.EntityRewriter;
|
|||||||
import com.viaversion.viaversion.util.Pair;
|
import com.viaversion.viaversion.util.Pair;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public final class EntityPackets extends EntityRewriter<Protocol1_19To1_18_2> {
|
public final class EntityPackets extends EntityRewriter<Protocol1_19To1_18_2> {
|
||||||
|
|
||||||
@ -52,23 +56,26 @@ public final class EntityPackets extends EntityRewriter<Protocol1_19To1_18_2> {
|
|||||||
" \"minecraft:chat_type\": {\n" +
|
" \"minecraft:chat_type\": {\n" +
|
||||||
" \"type\": \"minecraft:chat_type\",\n" +
|
" \"type\": \"minecraft:chat_type\",\n" +
|
||||||
" \"value\": [\n" +
|
" \"value\": [\n" +
|
||||||
" {\n" +
|
" {\n" +
|
||||||
" \"name\": \"minecraft:system\",\n" +
|
" \"name\":\"minecraft:chat\",\n" +
|
||||||
" \"id\": 1,\n" +
|
" \"id\":1,\n" +
|
||||||
" \"element\": {\n" +
|
" \"element\":{\n" +
|
||||||
" \"chat\": {},\n" +
|
" \"chat\":{\n" +
|
||||||
" \"narration\": {\n" +
|
" \"translation_key\":\"chat.type.text\",\n" +
|
||||||
" \"priority\": \"system\"\n" +
|
" \"parameters\":[\n" +
|
||||||
" }\n" +
|
" \"sender\",\n" +
|
||||||
" }\n" +
|
" \"content\"\n" +
|
||||||
" },\n" +
|
" ]\n" +
|
||||||
" {\n" +
|
" },\n" +
|
||||||
" \"name\": \"minecraft:game_info\",\n" +
|
" \"narration\":{\n" +
|
||||||
" \"id\": 2,\n" +
|
" \"translation_key\":\"chat.type.text.narrate\",\n" +
|
||||||
" \"element\": {\n" +
|
" \"parameters\":[\n" +
|
||||||
" \"overlay\": {}\n" +
|
" \"sender\",\n" +
|
||||||
" }\n" +
|
" \"content\"\n" +
|
||||||
" }\n" +
|
" ]\n" +
|
||||||
|
" }\n" +
|
||||||
|
" }\n" +
|
||||||
|
" }" +
|
||||||
" ]\n" +
|
" ]\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
"}";
|
"}";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
|
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
|
||||||
projectVersion=4.3.2-1.19.1-rc1-SNAPSHOT
|
projectVersion=4.3.2-1.19.1-pre2-SNAPSHOT
|
||||||
|
|
||||||
# Gradle properties
|
# Gradle properties
|
||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
|
Loading…
Reference in New Issue
Block a user