Skip to content

Commit

Permalink
Begin adding 1.10.2 protocol definition based on #14
Browse files Browse the repository at this point in the history
  • Loading branch information
iceiix committed Dec 1, 2018
1 parent 4bae4d6 commit 8f488d9
Show file tree
Hide file tree
Showing 3 changed files with 172 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/protocol/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,15 @@ state_packets!(
field cursor_y: f32 =,
field cursor_z: f32 =,
}
/// (Integer version, pre-1.11) PlayerBlockPlacement is sent when the client tries to place a block.
packet PlayerBlockPlacementInt {
field location: Position =,
field face: VarInt =,
field hand: VarInt =,
field cursor_x: u8 =,
field cursor_y: u8 =,
field cursor_z: u8 =,
}
/// UseItem is sent when the client tries to use an item.
packet UseItem {
field hand: VarInt =,
Expand Down Expand Up @@ -293,6 +302,24 @@ state_packets!(
field velocity_z: i16 =,
field metadata: types::Metadata =,
}
/// (Integer version, pre-1.11) SpawnMob is used to spawn a living entity into the world when it is in
/// range of the client.
packet SpawnMobInt {
field entity_id: VarInt =,
field uuid: UUID =,
field ty: u8 =,
field x: f64 =,
field y: f64 =,
field z: f64 =,
field yaw: i8 =,
field pitch: i8 =,
field head_pitch: i8 =,
field velocity_x: i16 =,
field velocity_y: i16 =,
field velocity_z: i16 =,
field metadata: types::Metadata =,
}

/// SpawnPainting spawns a painting into the world when it is in range of
/// the client. The title effects the size and the texture of the painting.
packet SpawnPainting {
Expand Down Expand Up @@ -785,6 +812,16 @@ state_packets!(
field fade_stay: Option<i32> = when(|p: &Title| p.action.0 == 3),
field fade_out: Option<i32> = when(|p: &Title| p.action.0 == 3),
}
/// (Shifted version, pre-1.11) Title configures an on-screen title.
packet TitleShifted {
field action: VarInt =,
field title: Option<format::Component> = when(|p: &TitleShifted| p.action.0 == 0),
field sub_title: Option<format::Component> = when(|p: &TitleShifted| p.action.0 == 1),
field fade_in: Option<i32> = when(|p: &TitleShifted| p.action.0 == 2),
field fade_stay: Option<i32> = when(|p: &TitleShifted| p.action.0 == 2),
field fade_out: Option<i32> = when(|p: &TitleShifted| p.action.0 == 2),
}

/// SoundEffect plays the named sound at the target location.
packet SoundEffect {
field name: VarInt =,
Expand All @@ -807,6 +844,12 @@ state_packets!(
field collector_entity_id: VarInt =,
field number_of_items: VarInt =,
}
/// (Uncounted version, pre-1.11) CollectItem causes the collected item to fly towards the collector. This
/// does not destroy the entity.
packet CollectItemUncounted {
field collected_entity_id: VarInt =,
field collector_entity_id: VarInt =,
}
/// EntityTeleport teleports the entity to the target location. This is
/// sent if the entity moves further than EntityMove allows.
packet EntityTeleport {
Expand Down
125 changes: 125 additions & 0 deletions src/protocol/v1_10_2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@

#[allow(non_upper_case_globals)]
pub mod internal_ids {
pub const Handshake: i32 = 0x00;
pub const TeleportConfirm: i32 = 0x00;
pub const TabComplete: i32 = 0x01;
pub const ChatMessage: i32 = 0x02;
pub const ClientStatus: i32 = 0x03;
pub const ClientSettings: i32 = 0x04;
pub const ConfirmTransactionServerbound: i32 = 0x05;
pub const EnchantItem: i32 = 0x06;
pub const ClickWindow: i32 = 0x07;
pub const CloseWindow: i32 = 0x08;
pub const PluginMessageServerbound: i32 = 0x09;
pub const UseEntity: i32 = 0x0a;
pub const KeepAliveServerbound: i32 = 0x0b;
pub const PlayerPosition: i32 = 0x0c;
pub const PlayerPositionLook: i32 = 0x0d;
pub const PlayerLook: i32 = 0x0e;
pub const Player: i32 = 0x0f;
pub const VehicleMove: i32 = 0x10;
pub const SteerBoat: i32 = 0x11;
pub const ClientAbilities: i32 = 0x12;
pub const PlayerDigging: i32 = 0x13;
pub const PlayerAction: i32 = 0x14;
pub const SteerVehicle: i32 = 0x15;
pub const ResourcePackStatus: i32 = 0x16;
pub const HeldItemChange: i32 = 0x17;
pub const CreativeInventoryAction: i32 = 0x18;
pub const SetSign: i32 = 0x19;
pub const ArmSwing: i32 = 0x1a;
pub const SpectateTeleport: i32 = 0x1b;
pub const PlayerBlockPlacement: i32 = -1;
pub const PlayerBlockPlacementInt: i32 = 0x1c;
pub const UseItem: i32 = 0x1d;
pub const SpawnObject: i32 = 0x00;
pub const SpawnExperienceOrb: i32 = 0x01;
pub const SpawnGlobalEntity: i32 = 0x02;
pub const SpawnMob: i32 = -1;
pub const SpawnMobInt: i32 = 0x03;
pub const SpawnPainting: i32 = 0x04;
pub const SpawnPlayer: i32 = 0x05;
pub const Animation: i32 = 0x06;
pub const Statistics: i32 = 0x07;
pub const BlockBreakAnimation: i32 = 0x08;
pub const UpdateBlockEntity: i32 = 0x09;
pub const BlockAction: i32 = 0x0a;
pub const BlockChange: i32 = 0x0b;
pub const BossBar: i32 = 0x0c;
pub const ServerDifficulty: i32 = 0x0d;
pub const TabCompleteReply: i32 = 0x0e;
pub const ServerMessage: i32 = 0x0f;
pub const MultiBlockChange: i32 = 0x10;
pub const ConfirmTransaction: i32 = 0x11;
pub const WindowClose: i32 = 0x12;
pub const WindowOpen: i32 = 0x13;
pub const WindowItems: i32 = 0x14;
pub const WindowProperty: i32 = 0x15;
pub const WindowSetSlot: i32 = 0x16;
pub const SetCooldown: i32 = 0x17;
pub const PluginMessageClientbound: i32 = 0x18;
pub const NamedSoundEffect: i32 = 0x19;
pub const Disconnect: i32 = 0x1a;
pub const EntityAction: i32 = 0x1b;
pub const Explosion: i32 = 0x1c;
pub const ChunkUnload: i32 = 0x1d;
pub const ChangeGameState: i32 = 0x1e;
pub const KeepAliveClientbound: i32 = 0x1f;
pub const ChunkData: i32 = 0x20;
pub const Effect: i32 = 0x21;
pub const Particle: i32 = 0x22;
pub const JoinGame: i32 = 0x23;
pub const Maps: i32 = 0x24;
pub const EntityMove: i32 = 0x25;
pub const EntityLookAndMove: i32 = 0x26;
pub const EntityLook: i32 = 0x27;
pub const Entity: i32 = 0x28;
pub const VehicleTeleport: i32 = 0x29;
pub const SignEditorOpen: i32 = 0x2a;
pub const PlayerAbilities: i32 = 0x2b;
pub const CombatEvent: i32 = 0x2c;
pub const PlayerInfo: i32 = 0x2d;
pub const TeleportPlayer: i32 = 0x2e;
pub const EntityUsedBed: i32 = 0x2f;
pub const EntityDestroy: i32 = 0x30;
pub const EntityRemoveEffect: i32 = 0x31;
pub const ResourcePackSend: i32 = 0x32;
pub const Respawn: i32 = 0x33;
pub const EntityHeadLook: i32 = 0x34;
pub const WorldBorder: i32 = 0x35;
pub const Camera: i32 = 0x36;
pub const SetCurrentHotbarSlot: i32 = 0x37;
pub const ScoreboardDisplay: i32 = 0x38;
pub const EntityMetadata: i32 = 0x39;
pub const EntityAttach: i32 = 0x3a;
pub const EntityVelocity: i32 = 0x3b;
pub const EntityEquipment: i32 = 0x3c;
pub const SetExperience: i32 = 0x3d;
pub const UpdateHealth: i32 = 0x3e;
pub const ScoreboardObjective: i32 = 0x3f;
pub const SetPassengers: i32 = 0x40;
pub const Teams: i32 = 0x41;
pub const UpdateScore: i32 = 0x42;
pub const SpawnPosition: i32 = 0x43;
pub const TimeUpdate: i32 = 0x44;
pub const Title: i32 = -1;
pub const TitleShifted: i32 = 0x45;
pub const SoundEffect: i32 = 0x46;
pub const PlayerListHeaderFooter: i32 = 0x47;
pub const CollectItem: i32 = -1;
pub const CollectItemUncounted: i32 = 0x48;
pub const EntityTeleport: i32 = 0x49;
pub const EntityProperties: i32 = 0x4a;
pub const EntityEffect: i32 = 0x4b;
pub const LoginStart: i32 = 0x00;
pub const EncryptionResponse: i32 = 0x01;
pub const LoginDisconnect: i32 = 0x00;
pub const EncryptionRequest: i32 = 0x01;
pub const LoginSuccess: i32 = 0x02;
pub const SetInitialCompression: i32 = 0x03;
pub const StatusRequest: i32 = 0x00;
pub const StatusPing: i32 = 0x01;
pub const StatusResponse: i32 = 0x00;
pub const StatusPong: i32 = 0x01;
}
4 changes: 4 additions & 0 deletions src/protocol/v1_11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ pub mod internal_ids {
pub const ArmSwing: i32 = 0x1a;
pub const SpectateTeleport: i32 = 0x1b;
pub const PlayerBlockPlacement: i32 = 0x1c;
pub const PlayerBlockPlacementInt: i32 = -1;
pub const UseItem: i32 = 0x1d;
pub const SpawnObject: i32 = 0x00;
pub const SpawnExperienceOrb: i32 = 0x01;
pub const SpawnGlobalEntity: i32 = 0x02;
pub const SpawnMob: i32 = 0x03;
pub const SpawnMobInt: i32 = -1;
pub const SpawnPainting: i32 = 0x04;
pub const SpawnPlayer: i32 = 0x05;
pub const Animation: i32 = 0x06;
Expand Down Expand Up @@ -102,9 +104,11 @@ pub mod internal_ids {
pub const SpawnPosition: i32 = 0x43;
pub const TimeUpdate: i32 = 0x44;
pub const Title: i32 = 0x45;
pub const TitleShifted: i32 = -1;
pub const SoundEffect: i32 = 0x46;
pub const PlayerListHeaderFooter: i32 = 0x47;
pub const CollectItem: i32 = 0x48;
pub const CollectItemUncounted: i32 = -1;
pub const EntityTeleport: i32 = 0x49;
pub const EntityProperties: i32 = 0x4a;
pub const EntityEffect: i32 = 0x4b;
Expand Down

0 comments on commit 8f488d9

Please sign in to comment.