Update to Minecraft 1.11 (Fixes #63)

This commit is contained in:
Techcable 2016-12-09 07:32:02 -07:00 committed by Matthew Collins
parent 40f146ac65
commit 6fcf121241
2 changed files with 13 additions and 9 deletions

View File

@ -34,7 +34,7 @@ use flate2;
use time; use time;
use shared::Position; use shared::Position;
pub const SUPPORTED_PROTOCOL: i32 = 210; pub const SUPPORTED_PROTOCOL: i32 = 315;
/// Helper macro for defining packets /// Helper macro for defining packets
@ -200,7 +200,9 @@ impl <T> Serializable for Option<T> where T : Serializable {
impl Serializable for String { impl Serializable for String {
fn read_from<R: io::Read>(buf: &mut R) -> Result<String, Error> { fn read_from<R: io::Read>(buf: &mut R) -> Result<String, Error> {
let len = try!(VarInt::read_from(buf)).0; let len = VarInt::read_from(buf)?.0;
debug_assert!(len >= 0, "Negative string length: {}", len);
debug_assert!(len <= 65536, "String length too big: {}", len);
let mut ret = String::new(); let mut ret = String::new();
try!(buf.take(len as u64).read_to_string(&mut ret)); try!(buf.take(len as u64).read_to_string(&mut ret));
Result::Ok(ret) Result::Ok(ret)

View File

@ -231,9 +231,9 @@ state_packets!(
field location: Position =, field location: Position =,
field face: VarInt =, field face: VarInt =,
field hand: VarInt =, field hand: VarInt =,
field cursor_x: u8 =, field cursor_x: f32 =,
field cursor_y: u8 =, field cursor_y: f32 =,
field cursor_z: u8 =, field cursor_z: f32 =,
} }
/// UseItem is sent when the client tries to use an item. /// UseItem is sent when the client tries to use an item.
packet UseItem { packet UseItem {
@ -281,7 +281,7 @@ state_packets!(
packet SpawnMob { packet SpawnMob {
field entity_id: VarInt =, field entity_id: VarInt =,
field uuid: UUID =, field uuid: UUID =,
field ty: u8 =, field ty: VarInt =,
field x: f64 =, field x: f64 =,
field y: f64 =, field y: f64 =,
field z: f64 =, field z: f64 =,
@ -780,9 +780,10 @@ state_packets!(
field action: VarInt =, field action: VarInt =,
field title: Option<format::Component> = when(|p: &Title| p.action.0 == 0), field title: Option<format::Component> = when(|p: &Title| p.action.0 == 0),
field sub_title: Option<format::Component> = when(|p: &Title| p.action.0 == 1), field sub_title: Option<format::Component> = when(|p: &Title| p.action.0 == 1),
field fade_in: Option<i32> = when(|p: &Title| p.action.0 == 2), field action_bar_text: Option<String> = when(|p: &Title| p.action.0 == 2),
field fade_stay: Option<i32> = when(|p: &Title| p.action.0 == 2), field fade_in: Option<i32> = when(|p: &Title| p.action.0 == 3),
field fade_out: Option<i32> = when(|p: &Title| p.action.0 == 2), field fade_stay: Option<i32> = when(|p: &Title| p.action.0 == 3),
field fade_out: Option<i32> = when(|p: &Title| p.action.0 == 3),
} }
/// SoundEffect plays the named sound at the target location. /// SoundEffect plays the named sound at the target location.
packet SoundEffect { packet SoundEffect {
@ -804,6 +805,7 @@ state_packets!(
packet CollectItem { packet CollectItem {
field collected_entity_id: VarInt =, field collected_entity_id: VarInt =,
field collector_entity_id: VarInt =, field collector_entity_id: VarInt =,
field number_of_items: VarInt =,
} }
/// EntityTeleport teleports the entity to the target location. This is /// EntityTeleport teleports the entity to the target location. This is
/// sent if the entity moves further than EntityMove allows. /// sent if the entity moves further than EntityMove allows.