network: 23w07a

This commit is contained in:
Bixilon 2023-02-18 15:43:33 +01:00
parent 8608421bad
commit f3c5d015c6
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
11 changed files with 301 additions and 7 deletions

View File

@ -52,6 +52,8 @@ enum class EntityDataTypes(val type: EntityDataType<*>) {
CAT_VARIANT(VariantsEntityDataType.CatVariantType),
FROG_VARIANT(VariantsEntityDataType.FrogVariantType),
SNIFFER_STATE(SnifferStateEntityDataType),
;
companion object : ValuesEnum<EntityDataTypes> {

View File

@ -0,0 +1,24 @@
/*
* 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.entities.data.types
import de.bixilon.minosoft.data.entities.entities.animal.Sniffer
import de.bixilon.minosoft.protocol.protocol.buffers.play.PlayInByteBuffer
object SnifferStateEntityDataType : EntityDataType<Sniffer.States> {
override fun read(buffer: PlayInByteBuffer): Sniffer.States {
return Sniffer.States[buffer.readVarInt()]
}
}

View File

@ -0,0 +1,37 @@
/*
* 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.entities.entities
import de.bixilon.kotlinglm.vec3.Vec3d
import de.bixilon.minosoft.data.entities.EntityRotation
import de.bixilon.minosoft.data.entities.data.EntityData
import de.bixilon.minosoft.data.entities.data.EntityDataField
import de.bixilon.minosoft.data.registries.entities.EntityFactory
import de.bixilon.minosoft.data.registries.entities.EntityType
import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
class InteractionEntity(connection: PlayConnection, entityType: EntityType, data: EntityData, position: Vec3d, rotation: EntityRotation) : Entity(connection, entityType, data, position, rotation) {
companion object : EntityFactory<InteractionEntity> {
override val identifier: ResourceLocation = minecraft("interaction")
private val WIDTH = EntityDataField("WIDTH")
private val HEIGHT = EntityDataField("HEIGHT")
private val RESPONSE = EntityDataField("RESPONSE")
override fun build(connection: PlayConnection, entityType: EntityType, data: EntityData, position: Vec3d, rotation: EntityRotation): InteractionEntity {
return InteractionEntity(connection, entityType, data, position, rotation)
}
}
}

View File

@ -0,0 +1,55 @@
/*
* 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.entities.entities.animal
import de.bixilon.kotlinglm.vec3.Vec3d
import de.bixilon.kutil.enums.EnumUtil
import de.bixilon.kutil.enums.ValuesEnum
import de.bixilon.minosoft.data.entities.EntityRotation
import de.bixilon.minosoft.data.entities.data.EntityData
import de.bixilon.minosoft.data.entities.data.EntityDataField
import de.bixilon.minosoft.data.registries.entities.EntityFactory
import de.bixilon.minosoft.data.registries.entities.EntityType
import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
class Sniffer(connection: PlayConnection, entityType: EntityType, data: EntityData, position: Vec3d, rotation: EntityRotation) : Animal(connection, entityType, data, position, rotation) {
enum class States {
IDLE,
HAPPY,
SCENTING,
SNIFFING,
SEARCHING,
DIGGING,
RISING,
;
companion object : ValuesEnum<States> {
override val VALUES: Array<States> = values()
override val NAME_MAP: Map<String, States> = EnumUtil.getEnumValues(VALUES)
}
}
companion object : EntityFactory<Sniffer> {
override val identifier: ResourceLocation = minecraft("sniffer")
private val STATE = EntityDataField("STATE")
private val FINISH_DIG_TIME = EntityDataField("FINISH_DIG_TIME")
override fun build(connection: PlayConnection, entityType: EntityType, data: EntityData, position: Vec3d, rotation: EntityRotation): Sniffer {
return Sniffer(connection, entityType, data, position, rotation)
}
}
}

View File

@ -132,6 +132,10 @@ enum class BlockProperties {
BOOK_SLOT_OCCUPIED_3("slot_3_occupied", BooleanBlockPropertiesSerializer),
BOOK_SLOT_OCCUPIED_4("slot_4_occupied", BooleanBlockPropertiesSerializer),
BOOK_SLOT_OCCUPIED_5("slot_5_occupied", BooleanBlockPropertiesSerializer),
DUSTED("dusted", IntBlockPropertiesSerializer),
FLOWER_AMOUNT("flower_amount", IntBlockPropertiesSerializer),
;
val group: String

View File

@ -179,6 +179,9 @@ object DefaultEntityFactories : DefaultFactory<EntityFactory<*>>(
BlockDisplayEntity,
ItemDisplayEntity,
TextDisplayEntity,
InteractionEntity,
Sniffer,
) {
fun buildEntity(resourceLocation: ResourceLocation, connection: PlayConnection, position: Vec3d, rotation: EntityRotation, data: EntityData?, versionId: Int): Entity? {

View File

@ -23,8 +23,8 @@ import de.bixilon.minosoft.util.logging.LogMessageType
@LoadPacket
class PlayStatusS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
val motd = buffer.readOptional { buffer.readChatComponent() }
val favicon = buffer.readOptional { buffer.readString().toFavicon() }
val motd = if (buffer.versionId >= ProtocolVersions.V_22W07A) buffer.readChatComponent() else buffer.readOptional { buffer.readChatComponent() }
val favicon = if (buffer.versionId >= ProtocolVersions.V_22W07A) buffer.readOptional { buffer.readByteArray() } else buffer.readOptional { buffer.readString().toFavicon() }
val previewsChat = if (buffer.versionId < ProtocolVersions.V_22W42A) buffer.readBoolean() else false
val forcesSecureChat = if (buffer.versionId >= ProtocolVersions.V_1_19_1_RC2) buffer.readBoolean() else null

View File

@ -14,6 +14,7 @@ package de.bixilon.minosoft.protocol.protocol
@Suppress("UNUSED")
object ProtocolVersions {
const val V_23W07A = 879
const val V_23W06A = 878
const val V_23W05A = 877
const val V_23W04A = 876

View File

@ -15,10 +15,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_19_3
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_23W06A
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_23W07A
object VersionSupport {
const val MINIMUM_VERSION = V_13W41B
const val LATEST_VERSION = V_23W06A
const val LATEST_VERSION = V_23W07A
const val LATEST_RELEASE = V_1_19_3
}

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,178 @@
{
"879": {
"name": "23w07a",
"protocol_id": 1073741943,
"packets": 878
},
"878": {
"name": "23w06a",
"protocol_id": 1073741942,
"packets": {
"c2s": ["confirm_teleport", "block_nbt", "difficulty", "message_acknowledgement", "command", "signed_chat_message", "session_data", "client_action", "settings", "command_suggestions", "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", "steer_vehicle", "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"],
"s2c": ["bundle", "entity_object_spawn", "entity_experience_orb", "entity_player", "entity_animation", "statistics", "block_break", "block_break_animation", "block_data", "block_action", "block", "bossbar", "difficulty", "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_status", "explosion", "unload_chunk", "game_event", "open_horse_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", "stop_sound", "chat_message", "tab_list_text", "nbt_response", "entity_collect", "teleport", "advancements", "entity_attributes", "features", "entity_effect", "recipes", "tags"]
"c2s": [
"confirm_teleport",
"block_nbt",
"difficulty",
"message_acknowledgement",
"command",
"signed_chat_message",
"session_data",
"client_action",
"settings",
"command_suggestions",
"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",
"steer_vehicle",
"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"
],
"s2c": [
"bundle",
"entity_object_spawn",
"entity_experience_orb",
"entity_player",
"entity_animation",
"statistics",
"block_break",
"block_break_animation",
"block_data",
"block_action",
"block",
"bossbar",
"difficulty",
"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_status",
"explosion",
"unload_chunk",
"game_event",
"open_horse_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",
"stop_sound",
"chat_message",
"tab_list_text",
"nbt_response",
"entity_collect",
"teleport",
"advancements",
"entity_attributes",
"features",
"entity_effect",
"recipes",
"tags"
]
}
},
"877": {