diff --git a/minecraft/conn.go b/minecraft/conn.go index ce1cbc39..cc951d67 100644 --- a/minecraft/conn.go +++ b/minecraft/conn.go @@ -1046,6 +1046,7 @@ func (conn *Conn) startGame() { LANBroadcastEnabled: true, PlayerMovementSettings: data.PlayerMovementSettings, WorldGameMode: data.WorldGameMode, + Hardcore: data.Hardcore, ServerAuthoritativeInventory: data.ServerAuthoritativeInventory, PlayerPermissions: data.PlayerPermissions, Experiments: data.Experiments, @@ -1238,6 +1239,7 @@ func (conn *Conn) handleStartGame(pk *packet.StartGame) error { Items: pk.Items, PlayerMovementSettings: pk.PlayerMovementSettings, WorldGameMode: pk.WorldGameMode, + Hardcore: pk.Hardcore, ServerAuthoritativeInventory: pk.ServerAuthoritativeInventory, PlayerPermissions: pk.PlayerPermissions, ChatRestrictionLevel: pk.ChatRestrictionLevel, diff --git a/minecraft/game_data.go b/minecraft/game_data.go index bedc0134..d05222ab 100644 --- a/minecraft/game_data.go +++ b/minecraft/game_data.go @@ -65,6 +65,8 @@ type GameData struct { // WorldGameMode is the game mode that a player gets when it first spawns in the world. It is shown in the // settings and is used if the PlayerGameMode is set to 5. WorldGameMode int32 + // Hardcore is if the world is in hardcore mode. In hardcore mode, the player cannot respawn after dying. + Hardcore bool // GameRules defines game rules currently active with their respective values. The value of these game // rules may be either 'bool', 'int32' or 'float32'. Some game rules are server side only, and don't // necessarily need to be sent to the client. diff --git a/minecraft/protocol/info.go b/minecraft/protocol/info.go index e92e91ee..6925a448 100644 --- a/minecraft/protocol/info.go +++ b/minecraft/protocol/info.go @@ -2,7 +2,7 @@ package protocol const ( // CurrentProtocol is the current protocol version for the version below. - CurrentProtocol = 662 + CurrentProtocol = 671 // CurrentVersion is the current version of Minecraft as supported by the `packet` package. - CurrentVersion = "1.20.70" + CurrentVersion = "1.20.80" ) diff --git a/minecraft/protocol/packet/client_bound_debug_renderer.go b/minecraft/protocol/packet/client_bound_debug_renderer.go index 23e887f7..537b4318 100644 --- a/minecraft/protocol/packet/client_bound_debug_renderer.go +++ b/minecraft/protocol/packet/client_bound_debug_renderer.go @@ -36,7 +36,7 @@ func (*ClientBoundDebugRenderer) ID() uint32 { } func (pk *ClientBoundDebugRenderer) Marshal(io protocol.IO) { - io.Varuint32(&pk.Type) + io.Uint32(&pk.Type) if pk.Type == ClientBoundDebugRendererAddCube { io.String(&pk.Text) io.Vec3(&pk.Position) diff --git a/minecraft/protocol/packet/correct_player_move_prediction.go b/minecraft/protocol/packet/correct_player_move_prediction.go index d9344a7d..8a15cc7e 100644 --- a/minecraft/protocol/packet/correct_player_move_prediction.go +++ b/minecraft/protocol/packet/correct_player_move_prediction.go @@ -14,18 +14,21 @@ const ( // is set to AuthoritativeMovementModeServerWithRewind. The packet is used to correct movement at a specific // point in time. type CorrectPlayerMovePrediction struct { + // PredictionType is the type of prediction that was corrected. It is one of the constants above. + PredictionType byte // Position is the position that the player is supposed to be at the tick written in the field below. // The client will change its current position based on movement after that tick starting from the // Position. Position mgl32.Vec3 // Delta is the change in position compared to what the client sent as its position at that specific tick. Delta mgl32.Vec3 + // Rotation is the rotation of the player at the tick written in the field below. It is only included if + // PredictionType is PredictionTypeVehicle. + Rotation mgl32.Vec2 // OnGround specifies if the player was on the ground at the time of the tick below. OnGround bool // Tick is the tick of the movement which was corrected by this packet. Tick uint64 - // PredictionType is the type of prediction that was corrected. It is one of the constants above. - PredictionType byte } // ID ... @@ -34,9 +37,12 @@ func (*CorrectPlayerMovePrediction) ID() uint32 { } func (pk *CorrectPlayerMovePrediction) Marshal(io protocol.IO) { + io.Uint8(&pk.PredictionType) io.Vec3(&pk.Position) io.Vec3(&pk.Delta) + if pk.PredictionType == PredictionTypeVehicle { + io.Vec2(&pk.Rotation) + } io.Bool(&pk.OnGround) io.Varuint64(&pk.Tick) - io.Uint8(&pk.PredictionType) } diff --git a/minecraft/protocol/packet/player_auth_input.go b/minecraft/protocol/packet/player_auth_input.go index 16d5f055..bfd71aa4 100644 --- a/minecraft/protocol/packet/player_auth_input.go +++ b/minecraft/protocol/packet/player_auth_input.go @@ -107,7 +107,7 @@ type PlayerAuthInput struct { PlayMode uint32 // InteractionModel is a constant representing the interaction model the player is using. It is one of the // constants that may be found above. - InteractionModel int32 + InteractionModel uint32 // GazeDirection is the direction in which the player is gazing, when the PlayMode is PlayModeReality: In // other words, when the player is playing in virtual reality. GazeDirection mgl32.Vec3 @@ -146,7 +146,7 @@ func (pk *PlayerAuthInput) Marshal(io protocol.IO) { io.Varuint64(&pk.InputData) io.Varuint32(&pk.InputMode) io.Varuint32(&pk.PlayMode) - io.Varint32(&pk.InteractionModel) + io.Varuint32(&pk.InteractionModel) if pk.PlayMode == PlayModeReality { io.Vec3(&pk.GazeDirection) } diff --git a/minecraft/protocol/packet/resource_pack_stack.go b/minecraft/protocol/packet/resource_pack_stack.go index d2a6dc7f..bbe3fa11 100644 --- a/minecraft/protocol/packet/resource_pack_stack.go +++ b/minecraft/protocol/packet/resource_pack_stack.go @@ -27,6 +27,9 @@ type ResourcePackStack struct { // ExperimentsPreviouslyToggled specifies if any experiments were previously toggled in this world. It is // probably used for some kind of metrics. ExperimentsPreviouslyToggled bool + // IncludeEditorPacks specifies if vanilla editor packs should be included in the resource pack stack when + // connecting to an editor world. + IncludeEditorPacks bool } // ID ... @@ -41,4 +44,5 @@ func (pk *ResourcePackStack) Marshal(io protocol.IO) { io.String(&pk.BaseGameVersion) protocol.SliceUint32Length(io, &pk.Experiments) io.Bool(&pk.ExperimentsPreviouslyToggled) + io.Bool(&pk.IncludeEditorPacks) } diff --git a/minecraft/protocol/packet/start_game.go b/minecraft/protocol/packet/start_game.go index 61c5d7ba..eeb6d70c 100644 --- a/minecraft/protocol/packet/start_game.go +++ b/minecraft/protocol/packet/start_game.go @@ -68,6 +68,8 @@ type StartGame struct { // WorldGameMode is the game mode that a player gets when it first spawns in the world. It is shown in the // settings and is used if the PlayerGameMode is set to 5. WorldGameMode int32 + // Hardcore is if the world is in hardcore mode. In hardcore mode, the player cannot respawn after dying. + Hardcore bool // Difficulty is the difficulty of the world. It is a value from 0-3, with 0 being peaceful, 1 being easy, // 2 being normal and 3 being hard. Difficulty int32 @@ -265,6 +267,7 @@ func (pk *StartGame) Marshal(io protocol.IO) { io.Varint32(&pk.Dimension) io.Varint32(&pk.Generator) io.Varint32(&pk.WorldGameMode) + io.Bool(&pk.Hardcore) io.Varint32(&pk.Difficulty) io.UBlockPos(&pk.WorldSpawn) io.Bool(&pk.AchievementsDisabled) diff --git a/minecraft/protocol/packet/update_block_synced.go b/minecraft/protocol/packet/update_block_synced.go index 70f9fcb2..863327da 100644 --- a/minecraft/protocol/packet/update_block_synced.go +++ b/minecraft/protocol/packet/update_block_synced.go @@ -28,7 +28,7 @@ type UpdateBlockSynced struct { // entity transitions from. // Note that for both possible values for TransitionType, the EntityUniqueID should point to the falling // block entity involved. - EntityUniqueID int64 + EntityUniqueID uint64 // TransitionType is the type of the transition that happened. It is either BlockToEntityTransition, when // a block placed becomes a falling entity, or EntityToBlockTransition, when a falling entity hits the // ground and becomes a solid block again. @@ -45,6 +45,6 @@ func (pk *UpdateBlockSynced) Marshal(io protocol.IO) { io.Varuint32(&pk.NewBlockRuntimeID) io.Varuint32(&pk.Flags) io.Varuint32(&pk.Layer) - io.Varint64(&pk.EntityUniqueID) + io.Varuint64(&pk.EntityUniqueID) io.Varuint64(&pk.TransitionType) } diff --git a/minecraft/protocol/packet/update_player_game_type.go b/minecraft/protocol/packet/update_player_game_type.go index 12b2f7ae..4fa1a9dd 100644 --- a/minecraft/protocol/packet/update_player_game_type.go +++ b/minecraft/protocol/packet/update_player_game_type.go @@ -14,6 +14,8 @@ type UpdatePlayerGameType struct { // PlayerUniqueID is the entity unique ID of the player that should have its game mode updated. If this // packet is sent to other clients with the player unique ID of another player, nothing happens. PlayerUniqueID int64 + // Tick is the server tick at which the packet was sent. It is used in relation to CorrectPlayerMovePrediction. + Tick uint64 } // ID ... @@ -24,4 +26,5 @@ func (*UpdatePlayerGameType) ID() uint32 { func (pk *UpdatePlayerGameType) Marshal(io protocol.IO) { io.Varint32(&pk.GameType) io.Varint64(&pk.PlayerUniqueID) + io.Varuint64(&pk.Tick) } diff --git a/minecraft/protocol/recipe.go b/minecraft/protocol/recipe.go index ceba5953..762afd4c 100644 --- a/minecraft/protocol/recipe.go +++ b/minecraft/protocol/recipe.go @@ -205,6 +205,9 @@ type ShapedRecipe struct { Block string // Priority ... Priority int32 + // AssumeSymmetry specifies if the recipe is symmetrical. If this is set to true, the recipe will be + // mirrored along the diagonal axis. This means that the recipe will be the same if rotated 180 degrees. + AssumeSymmetry bool // RecipeNetworkID is a unique ID used to identify the recipe over network. Each recipe must have a unique // network ID. Recommended is to just increment a variable for each unique recipe registered. // This field must never be 0. @@ -436,6 +439,7 @@ func marshalShaped(r IO, recipe *ShapedRecipe) { r.UUID(&recipe.UUID) r.String(&recipe.Block) r.Varint32(&recipe.Priority) + r.Bool(&recipe.AssumeSymmetry) r.Varuint32(&recipe.RecipeNetworkID) }