network: 1.20.2

fixes and changed client settings + test
This commit is contained in:
Bixilon 2023-09-22 16:23:05 +02:00
parent 45a5566cae
commit ba1ac19288
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
8 changed files with 88 additions and 14 deletions

View File

@ -0,0 +1,19 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
*
* 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 <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.data.registries.versions.registries.pixlyzer
import org.testng.annotations.Test
@Test(groups = ["pixlyzer"], dependsOnGroups = ["version"], priority = Int.MAX_VALUE, timeOut = 15000L)
class `1_20_2` : PixLyzerLoadingTest("1.20.2")

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 Moritz Zwerger
*
* 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.
*
@ -19,6 +19,7 @@ import de.bixilon.minosoft.data.language.LanguageUtil
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
import de.bixilon.minosoft.protocol.packets.c2s.play.SettingsC2SP
import de.bixilon.minosoft.protocol.protocol.ProtocolStates
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_1_20_2_PRE1
class ClientSettingsManager(
private val connection: PlayConnection,
@ -64,10 +65,15 @@ class ClientSettingsManager(
sendClientSettings()
}
private fun canSendSettings(): Boolean {
if (connection.network.state == ProtocolStates.PLAY) return true
if (connection.version > V_1_20_2_PRE1 && connection.network.state == ProtocolStates.CONFIGURATION) return true
return false
}
fun sendClientSettings() {
if (connection.network.state != ProtocolStates.PLAY) {
return
}
if (!canSendSettings()) return
connection.sendPacket(SettingsC2SP(
locale = language,
chatColors = connection.profiles.gui.chat.chatColors,

View File

@ -39,6 +39,7 @@ class SuccessS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
connection.network.state = ProtocolStates.CONFIGURATION
connection.network.receive = true
connection.sendBrand()
connection.settingsManager.sendClientSettings()
} else {
connection.network.state = ProtocolStates.PLAY
}

View File

@ -30,7 +30,7 @@ import de.bixilon.minosoft.protocol.network.connection.play.PlayConnectionStates
import de.bixilon.minosoft.protocol.network.connection.play.channel.vanila.BrandHandler.sendBrand
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_1_20_2_PRE2
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_1_20_2_PRE1
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_20W27A
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_23W31A
import de.bixilon.minosoft.protocol.protocol.buffers.play.PlayInByteBuffer
@ -140,7 +140,7 @@ class InitializeS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
if (buffer.versionId >= ProtocolVersions.V_19W36A) {
respawnScreen = buffer.readBoolean()
}
if (buffer.versionId >= V_1_20_2_PRE2) {
if (buffer.versionId >= V_1_20_2_PRE1) {
buffer.readBoolean() // limited crafting
}
if (buffer.versionId >= V_23W31A) {
@ -187,7 +187,9 @@ class InitializeS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
}
connection.world.border.reset()
connection.settingsManager.sendClientSettings()
if (connection.version < V_1_20_2_PRE1) {
connection.settingsManager.sendClientSettings()
}
if (!connection.version.hasConfigurationState) {
connection.sendBrand()
}

View File

@ -14,7 +14,13 @@ package de.bixilon.minosoft.protocol.protocol
@Suppress("UNUSED")
object ProtocolVersions {
const val V_1_20_2_PRE2 = 909
const val V_1_20_2 = 915
const val V_1_20_2_RC2 = 914
const val V_1_20_2_RC1 = 913
const val V_1_20_2_PRE4 = 912
const val V_1_20_2_PRE3 = 911
const val V_1_20_2_PRE2 = 910
const val V_1_20_2_PRE1 = 909
const val V_23W35A = 908
const val V_23W33A = 907
const val V_23W32A = 906

View File

@ -14,10 +14,10 @@
package de.bixilon.minosoft.protocol.protocol
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_13W41B
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_1_20_1
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_1_20_2
object VersionSupport {
const val MINIMUM_VERSION = V_13W41B
const val LATEST_VERSION = V_1_20_1
const val LATEST_RELEASE = V_1_20_1
const val LATEST_VERSION = V_1_20_2
const val LATEST_RELEASE = V_1_20_2
}

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,54 @@
{
"915": {
"name": "1.20.2",
"protocol_id": 764,
"packets": 910,
"type": "release"
},
"914": {
"name": "1.20.2-rc2",
"protocol_id": 1073741977,
"packets": 910
},
"913": {
"name": "1.20.2-rc1",
"protocol_id": 1073741976,
"packets": 910
},
"912": {
"name": "1.20.2-pre4",
"protocol_id": 1073741975,
"packets": 910
},
"911": {
"name": "1.20.2-pre3",
"protocol_id": 1073741974,
"packets": 910
},
"910": {
"name": "1.20.2-pre2",
"protocol_id": 1073741973,
"packets": {
"c2s": {
"play": ["confirm_teleport", "block_nbt", "difficulty", "message_acknowledgement", "command", "signed_chat_message", "session_data", "next_chunk_batch", "client_action", "settings", "command_suggestions", "reconfigure", "container_button", "container_click", "close_container", "channel", "book", "entity_nbt", "entity_interact", "generate_structure", "heartbeat", "lock_difficulty", "position", "position_rotation", "rotation", "ground_change", "move_vehicle", "steer_boat", "item_pick", "ping", "crafting_recipe", "toggle_fly", "player_action", "entity_action", "vehicle_input", "pong", "displayed_recipe", "recipe_book", "anvil_item_name", "resourcepack", "advancement_tab", "trade", "beacon_effect", "hotbar_slot", "command_block", "minecart_command_block", "item_stack_create", "jigsaw_block", "structure_block", "sign_text", "swing_arm", "entity_spectate", "block_interact", "use_item"],
"configuration": ["settings", "channel", "ready", "heartbeat", "pong", "resourcepack"]
},
"s2c": {
"play": ["bundle", "entity_object_spawn", "entity_experience_orb", "entity_animation", "statistics", "block_break", "block_break_animation", "block_data", "block_action", "block", "bossbar", "difficulty", "chunk_batch_done", "chunk_batch_start", "chunk_biome", "clear_title", "command_suggestions", "commands", "close_container", "container_items", "container_properties", "container_item", "item_cooldown", "chat_suggestions", "channel", "entity_damage", "hide_message", "kick", "unsigned_chat_message", "entity_event", "explosion", "unload_chunk", "game_event", "open_entity_container", "damage_tilt", "initialize_world_border", "heartbeat", "chunk", "world_event", "particle", "chunk_light", "initialize", "map", "villager_trades", "relative_move", "movement_rotation", "rotation", "move_vehicle", "book", "open_container", "sign_editor", "ping", "pong", "crafting_recipe", "player_abilities", "signed_chat_message", "end_combat_event", "enter_combat_event", "kill_combat_event", "tab_list_remove", "tab_list", "player_face", "position_rotation", "unlock_recipes", "entity_destroy", "entity_remove_effect", "resourcepack", "respawn", "head_rotation", "blocks", "advancement_tab", "play_status", "hotbar_text", "center_world_border", "interpolate_world_border", "size_world_border", "warn_time_world_border", "warn_blocks_world_border", "camera", "hotbar_slot", "chunk_center", "view_distance", "compass_position", "objective_position", "entity_data", "entity_attach", "velocity", "entity_equipment", "experience", "health", "objective", "entity_passenger", "teams", "scoreboard_score", "simulation_distance", "subtitle", "time", "title_text", "title_times", "entity_sound", "sound_event", "reconfigure", "stop_sound", "chat_message", "tab_list_text", "nbt_response", "entity_collect", "teleport", "advancements", "entity_attributes", "entity_effect", "recipes", "tags"],
"configuration": ["channel", "kick", "ready", "heartbeat", "ping", "registries", "resourcepack", "features", "tags"]
}
}
},
"909": {
"name": "1.20.2-pre1",
"protocol_id": 1073741972,
"packets": {
"c2s": {
"play": ["confirm_teleport", "block_nbt", "difficulty", "message_acknowledgement", "command", "signed_chat_message", "session_data", "next_chunk_batch", "client_action", "settings", "command_suggestions", "reconfigure", "container_button", "container_click", "close_container", "channel", "book", "entity_nbt", "entity_interact", "generate_structure", "heartbeat", "lock_difficulty", "position", "position_rotation", "rotation", "ground_change", "move_vehicle", "steer_boat", "item_pick", "crafting_recipe", "toggle_fly", "player_action", "entity_action", "vehicle_input", "pong", "displayed_recipe", "recipe_book", "anvil_item_name", "resourcepack", "advancement_tab", "trade", "beacon_effect", "hotbar_slot", "command_block", "minecart_command_block", "item_stack_create", "jigsaw_block", "structure_block", "sign_text", "swing_arm", "entity_spectate", "block_interact", "use_item"],
"play": ["confirm_teleport", "block_nbt", "difficulty", "message_acknowledgement", "command", "signed_chat_message", "session_data", "next_chunk_batch", "client_action", "settings", "command_suggestions", "reconfigure", "container_button", "container_click", "close_container", "channel", "book", "entity_nbt", "entity_interact", "generate_structure", "heartbeat", "lock_difficulty", "position", "position_rotation", "rotation", "ground_change", "move_vehicle", "steer_boat", "item_pick", "ping", "crafting_recipe", "toggle_fly", "player_action", "entity_action", "vehicle_input", "pong", "displayed_recipe", "recipe_book", "anvil_item_name", "resourcepack", "advancement_tab", "trade", "beacon_effect", "hotbar_slot", "command_block", "minecart_command_block", "item_stack_create", "jigsaw_block", "structure_block", "sign_text", "swing_arm", "entity_spectate", "block_interact", "use_item"],
"configuration": ["settings", "channel", "ready", "heartbeat", "pong", "resourcepack"]
},
"s2c": {
"play": ["bundle", "entity_object_spawn", "entity_experience_orb", "entity_player", "entity_animation", "statistics", "block_break", "block_break_animation", "block_data", "block_action", "block", "bossbar", "difficulty", "chunk_batch_done", "chunk_batch_start", "chunk_biome", "clear_title", "command_suggestions", "commands", "close_container", "container_items", "container_properties", "container_item", "item_cooldown", "chat_suggestions", "channel", "entity_damage", "hide_message", "kick", "unsigned_chat_message", "entity_event", "explosion", "unload_chunk", "game_event", "open_entity_container", "damage_tilt", "initialize_world_border", "heartbeat", "chunk", "world_event", "particle", "chunk_light", "initialize", "map", "villager_trades", "relative_move", "movement_rotation", "rotation", "move_vehicle", "book", "open_container", "sign_editor", "ping", "crafting_recipe", "player_abilities", "signed_chat_message", "end_combat_event", "enter_combat_event", "kill_combat_event", "tab_list_remove", "tab_list", "player_face", "position_rotation", "unlock_recipes", "entity_destroy", "entity_remove_effect", "resourcepack", "respawn", "head_rotation", "blocks", "advancement_tab", "play_status", "hotbar_text", "center_world_border", "interpolate_world_border", "size_world_border", "warn_time_world_border", "warn_blocks_world_border", "camera", "hotbar_slot", "chunk_center", "view_distance", "compass_position", "objective_position", "entity_data", "entity_attach", "velocity", "entity_equipment", "experience", "health", "objective", "entity_passenger", "teams", "scoreboard_score", "simulation_distance", "subtitle", "time", "title_text", "title_times", "entity_sound", "sound_event", "reconfigure", "stop_sound", "chat_message", "tab_list_text", "nbt_response", "entity_collect", "teleport", "advancements", "entity_attributes", "entity_effect", "recipes", "tags"],
"play": ["bundle", "entity_object_spawn", "entity_experience_orb", "entity_player", "entity_animation", "statistics", "block_break", "block_break_animation", "block_data", "block_action", "block", "bossbar", "difficulty", "chunk_batch_done", "chunk_batch_start", "chunk_biome", "clear_title", "command_suggestions", "commands", "close_container", "container_items", "container_properties", "container_item", "item_cooldown", "chat_suggestions", "channel", "entity_damage", "hide_message", "kick", "unsigned_chat_message", "entity_event", "explosion", "unload_chunk", "game_event", "open_entity_container", "damage_tilt", "initialize_world_border", "heartbeat", "chunk", "world_event", "particle", "chunk_light", "initialize", "map", "villager_trades", "relative_move", "movement_rotation", "rotation", "move_vehicle", "book", "open_container", "sign_editor", "ping", "pong", "crafting_recipe", "player_abilities", "signed_chat_message", "end_combat_event", "enter_combat_event", "kill_combat_event", "tab_list_remove", "tab_list", "player_face", "position_rotation", "unlock_recipes", "entity_destroy", "entity_remove_effect", "resourcepack", "respawn", "head_rotation", "blocks", "advancement_tab", "play_status", "hotbar_text", "center_world_border", "interpolate_world_border", "size_world_border", "warn_time_world_border", "warn_blocks_world_border", "camera", "hotbar_slot", "chunk_center", "view_distance", "compass_position", "objective_position", "entity_data", "entity_attach", "velocity", "entity_equipment", "experience", "health", "objective", "entity_passenger", "teams", "scoreboard_score", "simulation_distance", "subtitle", "time", "title_text", "title_times", "entity_sound", "sound_event", "reconfigure", "stop_sound", "chat_message", "tab_list_text", "nbt_response", "entity_collect", "teleport", "advancements", "entity_attributes", "entity_effect", "recipes", "tags"],
"configuration": ["channel", "kick", "ready", "heartbeat", "ping", "registries", "resourcepack", "features", "tags"]
}
}