mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 17:07:55 -04:00
network: 1.20.3-pre1
Resourcepack changes
This commit is contained in:
parent
694fcd991a
commit
853d7692d1
@ -15,7 +15,7 @@ package de.bixilon.minosoft.modding.event.events
|
||||
import de.bixilon.minosoft.data.text.ChatComponent
|
||||
import de.bixilon.minosoft.modding.event.events.connection.play.PlayConnectionEvent
|
||||
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||
import de.bixilon.minosoft.protocol.packets.s2c.common.ResourcepackS2CP
|
||||
import de.bixilon.minosoft.protocol.packets.s2c.common.resourcepack.ResourcepackS2CP
|
||||
|
||||
class ResourcePackRequestEvent(
|
||||
connection: PlayConnection,
|
||||
|
@ -14,17 +14,23 @@ package de.bixilon.minosoft.protocol.packets.c2s.common
|
||||
|
||||
import de.bixilon.minosoft.protocol.packets.c2s.PlayC2SPacket
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_1_20_3_PRE1
|
||||
import de.bixilon.minosoft.protocol.protocol.buffers.play.PlayOutByteBuffer
|
||||
import de.bixilon.minosoft.util.logging.Log
|
||||
import de.bixilon.minosoft.util.logging.LogLevels
|
||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||
import java.util.*
|
||||
|
||||
class ResourcepackC2SP(
|
||||
val uuid: UUID?,
|
||||
val hash: String,
|
||||
val status: ResourcePackStates,
|
||||
) : PlayC2SPacket {
|
||||
|
||||
override fun write(buffer: PlayOutByteBuffer) {
|
||||
if (buffer.versionId >= V_1_20_3_PRE1) {
|
||||
buffer.writeUUID(uuid!!)
|
||||
}
|
||||
if (buffer.versionId < ProtocolVersions.V_1_10_PRE1) {
|
||||
buffer.writeString(hash)
|
||||
}
|
||||
@ -40,5 +46,9 @@ class ResourcepackC2SP(
|
||||
DECLINED,
|
||||
FAILED_DOWNLOAD,
|
||||
ACCEPTED,
|
||||
INVALID_URL,
|
||||
FAILED_RELOAD,
|
||||
DISCARDED,
|
||||
;
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +60,8 @@ import de.bixilon.minosoft.protocol.packets.c2s.play.recipe.book.RecipeBookState
|
||||
import de.bixilon.minosoft.protocol.packets.c2s.status.PingC2SP
|
||||
import de.bixilon.minosoft.protocol.packets.c2s.status.StatusRequestC2SP
|
||||
import de.bixilon.minosoft.protocol.packets.s2c.common.*
|
||||
import de.bixilon.minosoft.protocol.packets.s2c.common.resourcepack.RemoveResourcepackS2CP
|
||||
import de.bixilon.minosoft.protocol.packets.s2c.common.resourcepack.ResourcepackS2CP
|
||||
import de.bixilon.minosoft.protocol.packets.s2c.configuration.ReadyS2CP
|
||||
import de.bixilon.minosoft.protocol.packets.s2c.configuration.RegistriesS2CP
|
||||
import de.bixilon.minosoft.protocol.packets.s2c.login.ChannelS2CP
|
||||
@ -247,6 +249,7 @@ object DefaultPackets {
|
||||
registerPlay("heartbeat", ::HeartbeatS2CP)
|
||||
registerPlay("kick", ::KickS2CP)
|
||||
registerPlay("ping", ::PingS2CP)
|
||||
registerPlay("remove_resourcepack", ::RemoveResourcepackS2CP)
|
||||
registerPlay("resourcepack", ::ResourcepackS2CP)
|
||||
registerPlay("tags", ::TagsS2CP)
|
||||
|
||||
@ -260,6 +263,7 @@ object DefaultPackets {
|
||||
registerPlay("heartbeat", ::HeartbeatS2CP)
|
||||
registerPlay("kick", ::KickS2CP, threadSafe = false)
|
||||
registerPlay("ping", ::PingS2CP)
|
||||
registerPlay("remove_resourcepack", ::RemoveResourcepackS2CP)
|
||||
registerPlay("resourcepack", ::ResourcepackS2CP)
|
||||
registerPlay("tags", ::TagsS2CP, threadSafe = false)
|
||||
|
||||
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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.protocol.packets.s2c.common.resourcepack
|
||||
|
||||
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
|
||||
import de.bixilon.minosoft.protocol.protocol.buffers.play.PlayInByteBuffer
|
||||
import de.bixilon.minosoft.util.logging.Log
|
||||
import de.bixilon.minosoft.util.logging.LogLevels
|
||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||
|
||||
class RemoveResourcepackS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
|
||||
val uuid = buffer.readOptional { buffer.readUUID() }
|
||||
|
||||
override fun log(reducedLog: Boolean) {
|
||||
Log.log(LogMessageType.NETWORK_IN, level = LogLevels.VERBOSE) { "Remove resourcepack (uuid=$uuid)" }
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
package de.bixilon.minosoft.protocol.packets.s2c.common
|
||||
package de.bixilon.minosoft.protocol.packets.s2c.common.resourcepack
|
||||
|
||||
import de.bixilon.kutil.url.URLUtil.checkWeb
|
||||
import de.bixilon.kutil.url.URLUtil.toURL
|
||||
@ -20,12 +20,14 @@ import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||
import de.bixilon.minosoft.protocol.packets.c2s.common.ResourcepackC2SP
|
||||
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_3_PRE1
|
||||
import de.bixilon.minosoft.protocol.protocol.buffers.play.PlayInByteBuffer
|
||||
import de.bixilon.minosoft.util.logging.Log
|
||||
import de.bixilon.minosoft.util.logging.LogLevels
|
||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||
|
||||
class ResourcepackS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
|
||||
var uuid = if (buffer.versionId > V_1_20_3_PRE1) buffer.readUUID() else null
|
||||
val url: String = buffer.readString().apply { toURL().checkWeb() }
|
||||
val hash: String = buffer.readString()
|
||||
val forced = if (buffer.versionId >= ProtocolVersions.V_20W45A) {
|
||||
@ -48,10 +50,10 @@ class ResourcepackS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
|
||||
if (connection.events.fire(event)) {
|
||||
return
|
||||
}
|
||||
connection.sendPacket(ResourcepackC2SP(hash, ResourcepackC2SP.ResourcePackStates.SUCCESSFULLY)) // ToDo: This fakes it, to not get kicked on most servers
|
||||
connection.network.send(ResourcepackC2SP(uuid, hash, ResourcepackC2SP.ResourcePackStates.SUCCESSFULLY)) // ToDo: This fakes it, to not get kicked on most servers
|
||||
}
|
||||
|
||||
override fun log(reducedLog: Boolean) {
|
||||
Log.log(LogMessageType.NETWORK_IN, level = LogLevels.VERBOSE) { "Resourcepack (url=$url, hash=$hash, forced=$forced, promptText=$promptText)" }
|
||||
Log.log(LogMessageType.NETWORK_IN, level = LogLevels.VERBOSE) { "Resourcepack (uuid=$uuid, url=$url, hash=$hash, forced=$forced, promptText=$promptText)" }
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ package de.bixilon.minosoft.protocol.protocol
|
||||
|
||||
@Suppress("UNUSED")
|
||||
object ProtocolVersions {
|
||||
const val V_1_20_3_PRE1 = 924
|
||||
const val V_23W46A = 923
|
||||
const val V_23W45A = 922
|
||||
const val V_23W44A = 921
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,4 +1,18 @@
|
||||
{
|
||||
"924": {
|
||||
"name": "1.20.3-pre1",
|
||||
"protocol_id": 1073741988,
|
||||
"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", "crafter_slot_lock", "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", "remove_scoreboard_score", "remove_resourcepack", "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", "put_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", "tick_rate", "tick_step", "advancements", "entity_attributes", "entity_effect", "recipes", "tags"],
|
||||
"configuration": ["channel", "kick", "ready", "heartbeat", "ping", "registries", "remove_resourcepack", "resourcepack", "features", "tags"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"923": {
|
||||
"name": "23w46a",
|
||||
"protocol_id": 1073741987,
|
||||
|
Loading…
x
Reference in New Issue
Block a user