wip 22w17a

This commit is contained in:
Bixilon 2022-04-27 21:53:43 +02:00
parent 8a00410527
commit afa273c206
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
8 changed files with 63 additions and 3 deletions

View File

@ -28,9 +28,20 @@ class Goat(connection: PlayConnection, entityType: EntityType, data: EntityData,
val isScreaming: Boolean
get() = data.getBoolean(SCREAMING_DATA, false)
@get:SynchronizedEntityData
val hasLeftHorn: Boolean
get() = data.getBoolean(LEFT_HORN_DATA, false)
@get:SynchronizedEntityData
val hasRightHorn: Boolean
get() = data.getBoolean(RIGHT_HORN_DATA, false)
companion object : EntityFactory<Goat> {
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("goat")
private val SCREAMING_DATA = EntityDataField("GOAT_IS_SCREAMING")
private val LEFT_HORN_DATA = EntityDataField("LEFT_HORN")
private val RIGHT_HORN_DATA = EntityDataField("RIGHT_HORN")
override fun build(connection: PlayConnection, entityType: EntityType, data: EntityData, position: Vec3d, rotation: EntityRotation): Goat {
return Goat(connection, entityType, data, position, rotation)

View File

@ -79,7 +79,7 @@ class ArmorStand(connection: PlayConnection, entityType: EntityType, data: Entit
private val LEFT_ARM_ROTATION_DATA = EntityDataField("ARMOR_STAND_LEFT_ARM_ROTATION")
private val RIGHT_ARM_ROTATION_DATA = EntityDataField("ARMOR_STAND_RIGHT_ARM_ROTATION")
private val LEFT_LEG_ROTATION_DATA = EntityDataField("ARMOR_STAND_LEFT_LEG_ROTATION", "ARMOR_STAND_LEFT_LAG_ROTATION")
private val RIGHT_LEG_ROTATION_DATA = EntityDataField("ARMOR_STAND_LEFT_LEG_ROTATION", "ARMOR_STAND_RIGHT_LAG_ROTATION")
private val RIGHT_LEG_ROTATION_DATA = EntityDataField("ARMOR_STAND_RIGHT_LEG_ROTATION", "ARMOR_STAND_RIGHT_LAG_ROTATION")
override fun build(connection: PlayConnection, entityType: EntityType, data: EntityData, position: Vec3d, rotation: EntityRotation): ArmorStand {
return ArmorStand(connection, entityType, data, position, rotation)

View File

@ -0,0 +1,27 @@
/*
* Minosoft
* Copyright (C) 2020-2022 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
import de.bixilon.kutil.json.JsonObject
class MessagePublicKey(
val expiresAt: Long,
val keyString: String,
val signate: String,
) {
fun toNbt(): JsonObject {
TODO()
}
}

View File

@ -13,10 +13,12 @@
package de.bixilon.minosoft.protocol.packets.c2s.login
import de.bixilon.minosoft.data.player.LocalPlayerEntity
import de.bixilon.minosoft.protocol.MessagePublicKey
import de.bixilon.minosoft.protocol.packets.c2s.PlayC2SPacket
import de.bixilon.minosoft.protocol.packets.factory.LoadPacket
import de.bixilon.minosoft.protocol.protocol.PlayOutByteBuffer
import de.bixilon.minosoft.protocol.protocol.ProtocolStates
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions
import de.bixilon.minosoft.util.logging.Log
import de.bixilon.minosoft.util.logging.LogLevels
import de.bixilon.minosoft.util.logging.LogMessageType
@ -24,15 +26,19 @@ import de.bixilon.minosoft.util.logging.LogMessageType
@LoadPacket(state = ProtocolStates.LOGIN)
class StartC2SP(
val username: String,
val publicKey: MessagePublicKey? = null,
) : PlayC2SPacket {
constructor(player: LocalPlayerEntity) : this(player.name)
override fun write(buffer: PlayOutByteBuffer) {
buffer.writeString(username)
if (buffer.versionId >= ProtocolVersions.V_22W17A) {
buffer.writeOptional(publicKey) { buffer.writeNBT(it.toNbt()) }
}
}
override fun log(reducedLog: Boolean) {
Log.log(LogMessageType.NETWORK_PACKETS_OUT, LogLevels.VERBOSE) { "Login start (username=$username)" }
Log.log(LogMessageType.NETWORK_PACKETS_OUT, LogLevels.VERBOSE) { "Login start (username=$username, publicKey=$publicKey)" }
}
}

View File

@ -312,4 +312,9 @@ open class OutByteBuffer() {
writer(entry)
}
}
fun <T> writeOptional(value: T?, writer: (T) -> Unit) {
writeBoolean(value != null)
value?.let(writer)
}
}

View File

@ -14,6 +14,7 @@ package de.bixilon.minosoft.protocol.protocol
@Suppress("UNUSED")
object ProtocolVersions {
const val V_22W17A = 838
const val V_22W16B = 837
const val V_22W16A = 836
const val V_22W15A = 835

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,14 @@
{
"838": {
"name": "22w17a",
"protocol_id": 1073741906,
"packets": {
"c2s": ["confirm_teleport", "block_nbt", "difficulty", "chat_message", "client_action", "settings", "chat_suggestions", "container_button", "container_click", "close_container", "plugin", "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": [
"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", "chat_suggestions", "commands", "close_container", "container_items", "container_properties", "container_item", "item_cooldown", "plugin", "named_sound", "kick", "entity_status", "explosion", "unload_chunk", "game_event", "open_horse_container", "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", "player_face", "position_rotation", "unlock_recipes", "entity_destroy", "entity_remove_effect", "resourcepack", "respawn", "head_rotation", "blocks", "advancement_tab", "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", "entity_effect", "recipes", "tags"
]
}
},
"837": {
"name": "22w16b",
"protocol_id": 1073741905,