21w08a (aka the great splittening)

This commit is contained in:
KennyTV 2021-02-24 22:28:39 +01:00
parent 37004d8c4f
commit 0a41d36220
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
16 changed files with 22667 additions and 22472 deletions

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.3.0-21w07a</version>
<version>3.3.0-21w08a</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.3.0-21w07a</version>
<version>3.3.0-21w08a</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.3.0-21w07a</version>
<version>3.3.0-21w08a</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.3.0-21w07a</version>
<version>3.3.0-21w08a</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -54,7 +54,7 @@ public class ProtocolVersion {
public static final ProtocolVersion v1_16_2 = register(751, "1.16.2");
public static final ProtocolVersion v1_16_3 = register(753, "1.16.3");
public static final ProtocolVersion v1_16_4 = register(754, "1.16.4/5", new VersionRange("1.16", 4, 5));
public static final ProtocolVersion v1_17 = register(755, 15, "1.17");
public static final ProtocolVersion v1_17 = register(755, 16, "1.17");
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
public static ProtocolVersion register(int version, String name) {

View File

@ -20,81 +20,91 @@ public enum ClientboundPackets1_17 implements ClientboundPacketType {
BOSSBAR, // 0x0D
SERVER_DIFFICULTY, // 0x0E
CHAT_MESSAGE, // 0x0F
TAB_COMPLETE, // 0x10
DECLARE_COMMANDS, // 0x11
WINDOW_CONFIRMATION, // 0x12
CLOSE_WINDOW, // 0x13
WINDOW_ITEMS, // 0x14
WINDOW_PROPERTY, // 0x15
SET_SLOT, // 0x16
COOLDOWN, // 0x17
PLUGIN_MESSAGE, // 0x18
NAMED_SOUND, // 0x19
DISCONNECT, // 0x1A
ENTITY_STATUS, // 0x1B
EXPLOSION, // 0x1C
UNLOAD_CHUNK, // 0x1D
GAME_EVENT, // 0x1E
OPEN_HORSE_WINDOW, // 0x1F
KEEP_ALIVE, // 0x20
CHUNK_DATA, // 0x21
EFFECT, // 0x22
SPAWN_PARTICLE, // 0x23
UPDATE_LIGHT, // 0x24
JOIN_GAME, // 0x25
MAP_DATA, // 0x26
TRADE_LIST, // 0x27
ENTITY_POSITION, // 0x28
ENTITY_POSITION_AND_ROTATION, // 0x29
ENTITY_ROTATION, // 0x2A
ENTITY_MOVEMENT, // 0x2B
VEHICLE_MOVE, // 0x2C
OPEN_BOOK, // 0x2D
OPEN_WINDOW, // 0x2E
OPEN_SIGN_EDITOR, // 0x2F
CRAFT_RECIPE_RESPONSE, // 0x30
PLAYER_ABILITIES, // 0x31
COMBAT_EVENT, // 0x32
PLAYER_INFO, // 0x33
FACE_PLAYER, // 0x34
PLAYER_POSITION, // 0x35
UNLOCK_RECIPES, // 0x36
DESTROY_ENTITIES, // 0x37
REMOVE_ENTITY_EFFECT, // 0x38
RESOURCE_PACK, // 0x39
RESPAWN, // 0x3A
ENTITY_HEAD_LOOK, // 0x3B
MULTI_BLOCK_CHANGE, // 0x3C
SELECT_ADVANCEMENTS_TAB, // 0x3D
WORLD_BORDER, // 0x3E
CAMERA, // 0x3F
HELD_ITEM_CHANGE, // 0x40
UPDATE_VIEW_POSITION, // 0x41
UPDATE_VIEW_DISTANCE, // 0x42
SPAWN_POSITION, // 0x43
DISPLAY_SCOREBOARD, // 0x44
ENTITY_METADATA, // 0x45
ATTACH_ENTITY, // 0x46
ENTITY_VELOCITY, // 0x47
ENTITY_EQUIPMENT, // 0x48
SET_EXPERIENCE, // 0x49
UPDATE_HEALTH, // 0x4A
SCOREBOARD_OBJECTIVE, // 0x4B
SET_PASSENGERS, // 0x4C
TEAMS, // 0x4D
UPDATE_SCORE, // 0x4E
TIME_UPDATE, // 0x4F
TITLE, // 0x50
ENTITY_SOUND, // 0x51
SOUND, // 0x52
STOP_SOUND, // 0x53
TAB_LIST, // 0x54
NBT_QUERY, // 0x55
COLLECT_ITEM, // 0x56
ENTITY_TELEPORT, // 0x57
ADVANCEMENTS, // 0x58
ENTITY_PROPERTIES, // 0x59
ENTITY_EFFECT, // 0x5A
DECLARE_RECIPES, // 0x5B
TAGS, // 0x5C
CLEAR_TITLES, // 0x10
TAB_COMPLETE, // 0x11
DECLARE_COMMANDS, // 0x12
WINDOW_CONFIRMATION, // 0x13
CLOSE_WINDOW, // 0x14
WINDOW_ITEMS, // 0x15
WINDOW_PROPERTY, // 0x16
SET_SLOT, // 0x17
COOLDOWN, // 0x18
PLUGIN_MESSAGE, // 0x19
NAMED_SOUND, // 0x1A
DISCONNECT, // 0x1B
ENTITY_STATUS, // 0x1C
EXPLOSION, // 0x1D
UNLOAD_CHUNK, // 0x1E
GAME_EVENT, // 0x1F
OPEN_HORSE_WINDOW, // 0x20
WORLD_BORDER_INIT, // 0x21
KEEP_ALIVE, // 0x22
CHUNK_DATA, // 0x23
EFFECT, // 0x24
SPAWN_PARTICLE, // 0x25
UPDATE_LIGHT, // 0x26
JOIN_GAME, // 0x27
MAP_DATA, // 0x28
TRADE_LIST, // 0x29
ENTITY_POSITION, // 0x2A
ENTITY_POSITION_AND_ROTATION, // 0x2B
ENTITY_ROTATION, // 0x2C
VEHICLE_MOVE, // 0x2D
OPEN_BOOK, // 0x2E
OPEN_WINDOW, // 0x2F
OPEN_SIGN_EDITOR, // 0x30
CRAFT_RECIPE_RESPONSE, // 0x31
PLAYER_ABILITIES, // 0x32
COMBAT_END, // 0x33
COMBAT_ENTER, // 0x34
COMBAT_KILL, // 0x35
PLAYER_INFO, // 0x36
FACE_PLAYER, // 0x37
PLAYER_POSITION, // 0x38
UNLOCK_RECIPES, // 0x39
DESTROY_ENTITIES, // 0x3A
REMOVE_ENTITY_EFFECT, // 0x3B
RESOURCE_PACK, // 0x3C
RESPAWN, // 0x3D
ENTITY_HEAD_LOOK, // 0x3E
MULTI_BLOCK_CHANGE, // 0x3F
SELECT_ADVANCEMENTS_TAB, // 0x40
ACTIONBAR, // 0x41
WORLD_BORDER_CENTER, // 0x42
WORLD_BORDER_LERP_SIZE, // 0x43
WORLD_BORDER_SIZE, // 0x44
WORLD_BORDER_WARNING_DELAY, // 0x45
WORLD_BORDER_WARNING_DISTANCE, // 0x46
CAMERA, // 0x47
HELD_ITEM_CHANGE, // 0x48
UPDATE_VIEW_POSITION, // 0x49
UPDATE_VIEW_DISTANCE, // 0x4A
SPAWN_POSITION, // 0x4B
DISPLAY_SCOREBOARD, // 0x4C
ENTITY_METADATA, // 0x4D
ATTACH_ENTITY, // 0x4E
ENTITY_VELOCITY, // 0x4F
ENTITY_EQUIPMENT, // 0x50
SET_EXPERIENCE, // 0x51
UPDATE_HEALTH, // 0x52
SCOREBOARD_OBJECTIVE, // 0x53
SET_PASSENGERS, // 0x54
TEAMS, // 0x55
UPDATE_SCORE, // 0x56
TITLE_SUBTITLE, // 0x57
TIME_UPDATE, // 0x58
TITLE_TIMES, // 0x59
TITLE_TEXT, // 0x5A
ENTITY_SOUND, // 0x5B
SOUND, // 0x5C
STOP_SOUND, // 0x5D
TAB_LIST, // 0x5E
NBT_QUERY, // 0x5F
COLLECT_ITEM, // 0x60
ENTITY_TELEPORT, // 0x61
ADVANCEMENTS, // 0x62
ENTITY_PROPERTIES, // 0x63
ENTITY_EFFECT, // 0x64
DECLARE_RECIPES, // 0x65
TAGS, // 0x66
}

View File

@ -3,6 +3,7 @@ package us.myles.ViaVersion.protocols.protocol1_17to1_16_4;
import org.jetbrains.annotations.Nullable;
import us.myles.ViaVersion.api.data.MappingData;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
import us.myles.ViaVersion.api.protocol.Protocol;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.rewriters.RegistryType;
@ -106,6 +107,67 @@ public class Protocol1_17To1_16_4 extends Protocol<ClientboundPackets1_16_2, Cli
}
});
registerOutgoing(ClientboundPackets1_16_2.TITLE, null, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
// Title packet actions have been split into individual packets (the content hasn't changed)
int type = wrapper.read(Type.VAR_INT);
ClientboundPacketType packetType;
switch (type) {
case 0:
packetType = ClientboundPackets1_17.TITLE_TEXT;
break;
case 1:
packetType = ClientboundPackets1_17.TITLE_SUBTITLE;
break;
case 2:
packetType = ClientboundPackets1_17.ACTIONBAR;
break;
case 3:
packetType = ClientboundPackets1_17.TITLE_TIMES;
break;
case 4:
packetType = ClientboundPackets1_17.CLEAR_TITLES;
wrapper.write(Type.BOOLEAN, false); // Reset times
break;
case 5:
packetType = ClientboundPackets1_17.CLEAR_TITLES;
wrapper.write(Type.BOOLEAN, true); // Reset times
break;
default:
throw new IllegalArgumentException("Invalid title type received: " + type);
}
wrapper.setId(packetType.ordinal());
});
}
});
registerOutgoing(ClientboundPackets1_16_2.EXPLOSION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.FLOAT); // X
map(Type.FLOAT); // Y
map(Type.FLOAT); // Z
handler(wrapper -> {
// Collection length is now a var int
wrapper.write(Type.VAR_INT, wrapper.read(Type.INT));
});
}
});
registerOutgoing(ClientboundPackets1_16_2.SPAWN_POSITION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION1_14);
handler(wrapper -> {
// Angle (which Mojang just forgot to write to the buffer, lol)
wrapper.write(Type.FLOAT, 0f);
});
}
});
registerIncoming(ServerboundPackets1_16_2.CLIENT_SETTINGS, new PacketRemapper() {
@Override
public void registerMap() {
@ -125,10 +187,12 @@ public class Protocol1_17To1_16_4 extends Protocol<ClientboundPackets1_16_2, Cli
@Override
protected void onMappingDataLoaded() {
tagRewriter.addEmptyTags(RegistryType.ITEM, "minecraft:candles", "minecraft:ignored_by_piglin_babies", "minecraft:piglin_food", "minecraft:freeze_immune_wearables",
"minecraft:axolotl_tempt_items", "minecraft:occludes_vibration_signals");
"minecraft:axolotl_tempt_items", "minecraft:occludes_vibration_signals",
"minecraft:diamond_ores", "minecraft:iron_ores", "minecraft:lapis_ores", "minecraft:redstone_ores");
tagRewriter.addEmptyTags(RegistryType.BLOCK, "minecraft:crystal_sound_blocks", "minecraft:candle_cakes", "minecraft:candles",
"minecraft:snow_step_sound_blocks", "minecraft:inside_step_sound_blocks", "minecraft:occludes_vibration_signals", "minecraft:dripstone_replaceable_blocks",
"azalea_log_replaceable", "cave_vines", "lush_plants_replaceable");
"minecraft:azalea_log_replaceable", "minecraft:cave_vines", "minecraft:lush_plants_replaceable", "minecraft:deepslate_ore_replaceables",
"minecraft:diamond_ores", "minecraft:iron_ores", "minecraft:lapis_ores", "minecraft:redstone_ores", "minecraft:stone_ore_replaceables");
tagRewriter.addEmptyTags(RegistryType.ENTITY, "minecraft:powder_snow_walkable_mobs", "minecraft:axolotl_always_hostiles", "minecraft:axolotl_tempted_hostiles");
tagRewriter.addTag(RegistryType.BLOCK, "minecraft:cauldrons", 261);

View File

@ -1,11 +1,13 @@
package us.myles.ViaVersion.protocols.protocol1_17to1_16_4.packets;
import us.myles.ViaVersion.api.entities.Entity1_17Types;
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.api.type.types.version.Types1_14;
import us.myles.ViaVersion.api.type.types.version.Types1_17;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.metadata.MetadataRewriter1_17To1_16_4;
@ -19,6 +21,17 @@ public class EntityPackets {
metadataRewriter.registerMetadataRewriter(ClientboundPackets1_16_2.ENTITY_METADATA, Types1_14.METADATA_LIST, Types1_17.METADATA_LIST);
metadataRewriter.registerEntityDestroy(ClientboundPackets1_16_2.DESTROY_ENTITIES);
protocol.registerOutgoing(ClientboundPackets1_16_2.ENTITY_PROPERTIES, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Entity id
handler(wrapper -> {
// Collection length is now a var int
wrapper.write(Type.VAR_INT, wrapper.read(Type.INT));
});
}
});
protocol.registerOutgoing(ClientboundPackets1_16_2.PLAYER_POSITION, new PacketRemapper() {
@Override
public void registerMap() {
@ -35,5 +48,34 @@ public class EntityPackets {
});
}
});
protocol.registerOutgoing(ClientboundPackets1_16_2.COMBAT_EVENT, null, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
// Combat packet actions have been split into individual packets (the content hasn't changed)
int type = wrapper.read(Type.VAR_INT);
ClientboundPacketType packetType;
switch (type) {
case 0:
packetType = ClientboundPackets1_17.COMBAT_ENTER;
break;
case 1:
packetType = ClientboundPackets1_17.COMBAT_END;
break;
case 2:
packetType = ClientboundPackets1_17.COMBAT_KILL;
break;
default:
throw new IllegalArgumentException("Invalid combat type received: " + type);
}
wrapper.setId(packetType.ordinal());
});
}
});
// The parent class of the other entity move packets that is never actually used has finally been removed from the id list
protocol.cancelOutgoing(ClientboundPackets1_16_2.ENTITY_MOVEMENT);
}
}

View File

@ -10,11 +10,13 @@ import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.entities.Entity1_17Types;
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.rewriters.BlockRewriter;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.types.Chunk1_16_2Type;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.storage.BiomeStorage;
import us.myles.ViaVersion.protocols.protocol1_17to1_16_4.storage.EntityTracker1_17;
@ -34,6 +36,41 @@ public class WorldPackets {
blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_16_2.MULTI_BLOCK_CHANGE);
blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_16_2.ACKNOWLEDGE_PLAYER_DIGGING);
protocol.registerOutgoing(ClientboundPackets1_16_2.WORLD_BORDER, null, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
// Border packet actions have been split into individual packets (the content hasn't changed)
int type = wrapper.read(Type.VAR_INT);
ClientboundPacketType packetType;
switch (type) {
case 0:
packetType = ClientboundPackets1_17.WORLD_BORDER_SIZE;
break;
case 1:
packetType = ClientboundPackets1_17.WORLD_BORDER_LERP_SIZE;
break;
case 2:
packetType = ClientboundPackets1_17.WORLD_BORDER_CENTER;
break;
case 3:
packetType = ClientboundPackets1_17.WORLD_BORDER_INIT;
break;
case 4:
packetType = ClientboundPackets1_17.WORLD_BORDER_WARNING_DELAY;
break;
case 5:
packetType = ClientboundPackets1_17.WORLD_BORDER_WARNING_DISTANCE;
break;
default:
throw new IllegalArgumentException("Invalid world border type received: " + type);
}
wrapper.setId(packetType.ordinal());
});
}
});
protocol.registerOutgoing(ClientboundPackets1_16_2.UPDATE_LIGHT, new PacketRemapper() {
@Override
public void registerMap() {

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.3.0-21w07a</version>
<version>3.3.0-21w08a</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.3.0-21w07a</version>
<version>3.3.0-21w08a</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>viaversion-jar</name>

View File

@ -6,7 +6,7 @@
<groupId>us.myles</groupId>
<artifactId>viaversion-parent</artifactId>
<version>3.3.0-21w07a</version>
<version>3.3.0-21w08a</version>
<packaging>pom</packaging>
<name>viaversion-parent</name>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.3.0-21w07a</version>
<version>3.3.0-21w08a</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.3.0-21w07a</version>
<version>3.3.0-21w08a</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>3.3.0-21w07a</version>
<version>3.3.0-21w08a</version>
</parent>
<modelVersion>4.0.0</modelVersion>