3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-20 06:50:08 +01:00
Dieser Commit ist enthalten in:
Nassim Jahnke 2022-07-15 16:26:58 +02:00
Ursprung 2262681351
Commit 57ef90e851
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
9 geänderte Dateien mit 263 neuen und 15 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,43 @@
/*
* 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;
import java.util.UUID;
public final class PlayerMessageSignature {
private final UUID uuid;
private final byte[] signatureBytes;
public PlayerMessageSignature(final UUID uuid, final byte[] signatureBytes) {
this.uuid = uuid;
this.signatureBytes = signatureBytes;
}
public UUID uuid() {
return uuid;
}
public byte[] signatureBytes() {
return signatureBytes;
}
}

Datei anzeigen

@ -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_2 = register(758, "1.18.2");
public static final ProtocolVersion v1_19 = register(759, "1.19");
public static final ProtocolVersion v1_19_1 = register(760, 97, "1.19.1");
public static final ProtocolVersion v1_19_1 = register(760, 98, "1.19.1");
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
public static ProtocolVersion register(int version, String name) {

Datei anzeigen

@ -28,6 +28,7 @@ import com.google.gson.JsonElement;
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord;
import com.viaversion.viaversion.api.minecraft.EulerAngle;
import com.viaversion.viaversion.api.minecraft.GlobalPosition;
import com.viaversion.viaversion.api.minecraft.PlayerMessageSignature;
import com.viaversion.viaversion.api.minecraft.Position;
import com.viaversion.viaversion.api.minecraft.ProfileKey;
import com.viaversion.viaversion.api.minecraft.Vector;
@ -69,8 +70,10 @@ 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.OptionalComponentType;
import com.viaversion.viaversion.api.type.types.minecraft.OptionalGlobalPositionType;
import com.viaversion.viaversion.api.type.types.minecraft.OptionalPlayerMessageSignatureType;
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.PlayerMessageSignatureType;
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.ProfileKeyType;
@ -176,6 +179,10 @@ public abstract class Type<T> implements ByteBufReader<T>, ByteBufWriter<T> {
public static final Type<ProfileKey> PROFILE_KEY = new ProfileKeyType();
public static final Type<ProfileKey> OPTIONAL_PROFILE_KEY = new OptionalProfileKeyType();
public static final Type<PlayerMessageSignature> PLAYER_MESSAGE_SIGNATURE = new PlayerMessageSignatureType();
public static final Type<PlayerMessageSignature> OPTIONAL_PLAYER_MESSAGE_SIGNATURE = new OptionalPlayerMessageSignatureType();
public static final Type<PlayerMessageSignature[]> PLAYER_MESSAGE_SIGNATURE_ARRAY = new ArrayType<>(PLAYER_MESSAGE_SIGNATURE);
/* 1.13 Flat Item (no data) */
public static final Type<Item> FLAT_ITEM = new FlatItemType();
public static final Type<Item> FLAT_VAR_INT_ITEM = new FlatVarIntItemType();

Datei anzeigen

@ -0,0 +1,34 @@
/*
* 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.PlayerMessageSignature;
import com.viaversion.viaversion.api.type.OptionalType;
import com.viaversion.viaversion.api.type.Type;
public class OptionalPlayerMessageSignatureType extends OptionalType<PlayerMessageSignature> {
public OptionalPlayerMessageSignatureType() {
super(Type.PLAYER_MESSAGE_SIGNATURE);
}
}

Datei anzeigen

@ -0,0 +1,45 @@
/*
* 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.PlayerMessageSignature;
import com.viaversion.viaversion.api.type.Type;
import io.netty.buffer.ByteBuf;
public class PlayerMessageSignatureType extends Type<PlayerMessageSignature> {
public PlayerMessageSignatureType() {
super(PlayerMessageSignature.class);
}
@Override
public PlayerMessageSignature read(final ByteBuf buffer) throws Exception {
return new PlayerMessageSignature(Type.UUID.read(buffer), Type.BYTE_ARRAY_PRIMITIVE.read(buffer));
}
@Override
public void write(final ByteBuf buffer, final PlayerMessageSignature value) throws Exception {
Type.UUID.write(buffer, value.uuid());
Type.BYTE_ARRAY_PRIMITIVE.write(buffer, value.signatureBytes());
}
}

Datei anzeigen

@ -71,8 +71,8 @@ public enum ClientboundPackets1_19_1 implements ClientboundPacketType {
PING, // 0x2F
CRAFT_RECIPE_RESPONSE, // 0x30
PLAYER_ABILITIES, // 0x31
PLAYER_CHAT, // 0x32
PLAYER_CHAT_HEADER, // 0x33
PLAYER_CHAT_HEADER, // 0x32
PLAYER_CHAT, // 0x33
COMBAT_END, // 0x34
COMBAT_ENTER, // 0x35
COMBAT_KILL, // 0x36

Datei anzeigen

@ -30,7 +30,7 @@ import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ServerboundPacke
import java.io.IOException;
public final class Protocol1_19_1To1_19 extends AbstractProtocol<ClientboundPackets1_19, ClientboundPackets1_19_1, ServerboundPackets1_19, ServerboundPackets1_19> {
public final class Protocol1_19_1To1_19 extends AbstractProtocol<ClientboundPackets1_19, ClientboundPackets1_19_1, ServerboundPackets1_19, ServerboundPackets1_19_1> {
private static final String CHAT_REGISTRY_SNBT = "{\n" +
" \"minecraft:chat_type\": {\n" +
@ -70,7 +70,7 @@ public final class Protocol1_19_1To1_19 extends AbstractProtocol<ClientboundPack
}
public Protocol1_19_1To1_19() {
super(ClientboundPackets1_19.class, ClientboundPackets1_19_1.class, ServerboundPackets1_19.class, ServerboundPackets1_19.class);
super(ClientboundPackets1_19.class, ClientboundPackets1_19_1.class, ServerboundPackets1_19.class, ServerboundPackets1_19_1.class);
}
@Override
@ -110,15 +110,6 @@ public final class Protocol1_19_1To1_19 extends AbstractProtocol<ClientboundPack
}
});
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
}
});
registerClientbound(ClientboundPackets1_19.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
@ -135,5 +126,48 @@ public final class Protocol1_19_1To1_19 extends AbstractProtocol<ClientboundPack
});
}
});
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
}
});
registerServerbound(ServerboundPackets1_19_1.CHAT_MESSAGE, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // Message
map(Type.LONG); // Timestamp
map(Type.LONG); // Salt
map(Type.BYTE_ARRAY_PRIMITIVE); // Signature
map(Type.BOOLEAN); // Signed preview
read(Type.PLAYER_MESSAGE_SIGNATURE_ARRAY); // Last seen messages
read(Type.OPTIONAL_PLAYER_MESSAGE_SIGNATURE); // Last received message
}
});
registerServerbound(ServerboundPackets1_19_1.CHAT_COMMAND, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.STRING); // Command
map(Type.LONG); // Timestamp
map(Type.LONG); // Salt
handler(wrapper -> {
final int signatures = wrapper.passthrough(Type.VAR_INT);
for (int i = 0; i < signatures; i++) {
wrapper.passthrough(Type.STRING); // Argument name
wrapper.passthrough(Type.BYTE_ARRAY_PRIMITIVE); // Signature
}
});
map(Type.BOOLEAN); // Signed preview
read(Type.PLAYER_MESSAGE_SIGNATURE_ARRAY); // Last seen messages
read(Type.OPTIONAL_PLAYER_MESSAGE_SIGNATURE); // Last received message
}
});
cancelServerbound(ServerboundPackets1_19_1.CHAT_ACK);
}
}

Datei anzeigen

@ -0,0 +1,85 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2022 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viaversion.protocols.protocol1_19_1to1_19;
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
public enum ServerboundPackets1_19_1 implements ServerboundPacketType {
TELEPORT_CONFIRM, // 0x00
QUERY_BLOCK_NBT, // 0x01
SET_DIFFICULTY, // 0x02
CHAT_ACK,
CHAT_COMMAND, // 0x03
CHAT_MESSAGE, // 0x04
CHAT_PREVIEW, // 0x05
CLIENT_STATUS, // 0x06
CLIENT_SETTINGS, // 0x07
TAB_COMPLETE, // 0x08
CLICK_WINDOW_BUTTON, // 0x09
CLICK_WINDOW, // 0x0A
CLOSE_WINDOW, // 0x0B
PLUGIN_MESSAGE, // 0x0C
EDIT_BOOK, // 0x0D
ENTITY_NBT_REQUEST, // 0x0E
INTERACT_ENTITY, // 0x0F
GENERATE_JIGSAW, // 0x10
KEEP_ALIVE, // 0x11
LOCK_DIFFICULTY, // 0x12
PLAYER_POSITION, // 0x13
PLAYER_POSITION_AND_ROTATION, // 0x14
PLAYER_ROTATION, // 0x15
PLAYER_MOVEMENT, // 0x16
VEHICLE_MOVE, // 0x17
STEER_BOAT, // 0x18
PICK_ITEM, // 0x19
CRAFT_RECIPE_REQUEST, // 0x1A
PLAYER_ABILITIES, // 0x1B
PLAYER_DIGGING, // 0x1C
ENTITY_ACTION, // 0x1D
STEER_VEHICLE, // 0x1E
PONG, // 0x1F
RECIPE_BOOK_DATA, // 0x20
SEEN_RECIPE, // 0x21
RENAME_ITEM, // 0x22
RESOURCE_PACK_STATUS, // 0x23
ADVANCEMENT_TAB, // 0x24
SELECT_TRADE, // 0x25
SET_BEACON_EFFECT, // 0x26
HELD_ITEM_CHANGE, // 0x27
UPDATE_COMMAND_BLOCK, // 0x28
UPDATE_COMMAND_BLOCK_MINECART, // 0x29
CREATIVE_INVENTORY_ACTION, // 0x2A
UPDATE_JIGSAW_BLOCK, // 0x2B
UPDATE_STRUCTURE_BLOCK, // 0x2C
UPDATE_SIGN, // 0x2D
ANIMATION, // 0x2E
SPECTATE, // 0x2F
PLAYER_BLOCK_PLACEMENT, // 0x30
USE_ITEM; // 0x31
@Override
public int getId() {
return ordinal();
}
@Override
public String getName() {
return name();
}
}

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.4.0-1.19.1-pre4-SNAPSHOT
projectVersion=4.4.0-1.19.1-pre5-SNAPSHOT
# Gradle properties
org.gradle.daemon=true