Update to minecraft 1.10.2
This commit is contained in:
parent
862cf97331
commit
49b1ae1dbc
|
@ -22,6 +22,20 @@ pub enum Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Component {
|
impl Component {
|
||||||
|
|
||||||
|
pub fn from_string(str: &str) -> Self {
|
||||||
|
let mut component;
|
||||||
|
match serde_json::from_str::<serde_json::Value>(str) {
|
||||||
|
Ok(value) => component = Component::from_value(&value),
|
||||||
|
// Sometimes mojang sends a literal string, so we should interpret it literally
|
||||||
|
Err(_) => {
|
||||||
|
component = Component::Text(TextComponent::new(str));
|
||||||
|
convert_legacy(&mut component);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
pub fn from_value(v: &serde_json::Value) -> Self {
|
pub fn from_value(v: &serde_json::Value) -> Self {
|
||||||
let mut modifier = Modifier::from_value(v);
|
let mut modifier = Modifier::from_value(v);
|
||||||
if let Some(val) = v.as_string() {
|
if let Some(val) = v.as_string() {
|
||||||
|
|
|
@ -20,7 +20,7 @@ use super::protocol::Serializable;
|
||||||
use super::protocol;
|
use super::protocol;
|
||||||
use byteorder::{BigEndian, WriteBytesExt, ReadBytesExt};
|
use byteorder::{BigEndian, WriteBytesExt, ReadBytesExt};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum Tag {
|
pub enum Tag {
|
||||||
End,
|
End,
|
||||||
Byte(i8),
|
Byte(i8),
|
||||||
|
@ -36,7 +36,7 @@ pub enum Tag {
|
||||||
IntArray(Vec<i32>),
|
IntArray(Vec<i32>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct NamedTag(pub String, pub Tag);
|
pub struct NamedTag(pub String, pub Tag);
|
||||||
|
|
||||||
impl Tag {
|
impl Tag {
|
||||||
|
|
Loading…
Reference in New Issue