Derive Clone, PartialEq, Eq, and Hash where appropriate.
This is really useful for anyone who wishes to use the steven_protocol crate and write tests that compare packets to expected values.
This commit is contained in:
parent
00e7a3d1bc
commit
9a8d3572eb
|
@ -15,7 +15,7 @@
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum Component {
|
pub enum Component {
|
||||||
Text(TextComponent),
|
Text(TextComponent),
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ impl Default for Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub struct Modifier {
|
pub struct Modifier {
|
||||||
pub extra: Option<Vec<Component>>,
|
pub extra: Option<Vec<Component>>,
|
||||||
pub bold: Option<bool>,
|
pub bold: Option<bool>,
|
||||||
|
@ -159,7 +159,7 @@ impl Modifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct TextComponent {
|
pub struct TextComponent {
|
||||||
pub text: String,
|
pub text: String,
|
||||||
pub modifier: Modifier,
|
pub modifier: Modifier,
|
||||||
|
@ -199,7 +199,7 @@ impl fmt::Display for TextComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub enum Color {
|
pub enum Color {
|
||||||
Black,
|
Black,
|
||||||
DarkBlue,
|
DarkBlue,
|
||||||
|
|
|
@ -17,7 +17,7 @@ use crate::protocol::{self, Serializable};
|
||||||
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
|
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub struct Stack {
|
pub struct Stack {
|
||||||
pub id: isize,
|
pub id: isize,
|
||||||
pub count: isize,
|
pub count: isize,
|
||||||
|
|
|
@ -20,7 +20,7 @@ use super::protocol;
|
||||||
use super::protocol::Serializable;
|
use super::protocol::Serializable;
|
||||||
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
|
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum Tag {
|
pub enum Tag {
|
||||||
End,
|
End,
|
||||||
Byte(i8),
|
Byte(i8),
|
||||||
|
@ -37,7 +37,7 @@ pub enum Tag {
|
||||||
LongArray(Vec<i64>),
|
LongArray(Vec<i64>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub struct NamedTag(pub String, pub Tag);
|
pub struct NamedTag(pub String, pub Tag);
|
||||||
|
|
||||||
impl Tag {
|
impl Tag {
|
||||||
|
|
|
@ -5,7 +5,7 @@ use std::io;
|
||||||
|
|
||||||
use super::{Error, LenPrefixed, Serializable, VarInt};
|
use super::{Error, LenPrefixed, Serializable, VarInt};
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||||
pub enum Phase {
|
pub enum Phase {
|
||||||
// Client handshake states (written)
|
// Client handshake states (written)
|
||||||
Start,
|
Start,
|
||||||
|
@ -44,7 +44,7 @@ impl Serializable for Phase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||||
pub struct ForgeMod {
|
pub struct ForgeMod {
|
||||||
pub modid: String,
|
pub modid: String,
|
||||||
pub version: String,
|
pub version: String,
|
||||||
|
@ -64,7 +64,7 @@ impl Serializable for ForgeMod {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct ModIdMapping {
|
pub struct ModIdMapping {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub id: VarInt,
|
pub id: VarInt,
|
||||||
|
@ -87,7 +87,7 @@ impl Serializable for ModIdMapping {
|
||||||
pub static BLOCK_NAMESPACE: &str = "\u{1}";
|
pub static BLOCK_NAMESPACE: &str = "\u{1}";
|
||||||
pub static ITEM_NAMESPACE: &str = "\u{2}";
|
pub static ITEM_NAMESPACE: &str = "\u{2}";
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum FmlHs {
|
pub enum FmlHs {
|
||||||
ServerHello {
|
ServerHello {
|
||||||
fml_protocol_version: i8,
|
fml_protocol_version: i8,
|
||||||
|
@ -196,7 +196,7 @@ pub mod fml2 {
|
||||||
// https://wiki.vg/Minecraft_Forge_Handshake#FML2_protocol_.281.13_-_Current.29
|
// https://wiki.vg/Minecraft_Forge_Handshake#FML2_protocol_.281.13_-_Current.29
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[derive(Clone, Default, Debug)]
|
#[derive(Clone, Default, Debug, PartialEq, Eq)]
|
||||||
pub struct Channel {
|
pub struct Channel {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub version: String,
|
pub version: String,
|
||||||
|
@ -216,7 +216,7 @@ pub mod fml2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default, Debug)]
|
#[derive(Clone, Default, Debug, PartialEq, Eq)]
|
||||||
pub struct Registry {
|
pub struct Registry {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub marker: String,
|
pub marker: String,
|
||||||
|
@ -236,7 +236,7 @@ pub mod fml2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum FmlHandshake {
|
pub enum FmlHandshake {
|
||||||
ModList {
|
ModList {
|
||||||
mod_names: LenPrefixed<VarInt, String>,
|
mod_names: LenPrefixed<VarInt, String>,
|
||||||
|
|
|
@ -75,7 +75,7 @@ macro_rules! state_packets {
|
||||||
use crate::protocol::*;
|
use crate::protocol::*;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum Packet {
|
pub enum Packet {
|
||||||
$(
|
$(
|
||||||
$(
|
$(
|
||||||
|
@ -107,7 +107,7 @@ macro_rules! state_packets {
|
||||||
}
|
}
|
||||||
|
|
||||||
$(
|
$(
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug, Clone, PartialEq)]
|
||||||
$(#[$attr])* pub struct $name {
|
$(#[$attr])* pub struct $name {
|
||||||
$($(#[$fattr])* pub $field: $field_type),+,
|
$($(#[$fattr])* pub $field: $field_type),+,
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ impl Serializable for f64 {
|
||||||
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
|
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
|
||||||
pub struct UUID(u64, u64);
|
pub struct UUID(u64, u64);
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct UUIDParseError;
|
pub struct UUIDParseError;
|
||||||
impl std::error::Error for UUIDParseError {}
|
impl std::error::Error for UUIDParseError {}
|
||||||
|
|
||||||
|
@ -469,6 +469,7 @@ impl Serializable for UUID {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, PartialEq, Eq)]
|
||||||
pub struct Biomes3D {
|
pub struct Biomes3D {
|
||||||
pub data: [i32; 1024],
|
pub data: [i32; 1024],
|
||||||
}
|
}
|
||||||
|
@ -511,6 +512,7 @@ pub trait Lengthable: Serializable + Copy + Default {
|
||||||
fn from_len(_: usize) -> Self;
|
fn from_len(_: usize) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, PartialEq, Eq)]
|
||||||
pub struct LenPrefixed<L: Lengthable, V> {
|
pub struct LenPrefixed<L: Lengthable, V> {
|
||||||
len: L,
|
len: L,
|
||||||
pub data: Vec<V>,
|
pub data: Vec<V>,
|
||||||
|
@ -566,6 +568,7 @@ impl<L: Lengthable, V: fmt::Debug> fmt::Debug for LenPrefixed<L, V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optimization
|
// Optimization
|
||||||
|
#[derive(Clone, PartialEq, Eq)]
|
||||||
pub struct LenPrefixedBytes<L: Lengthable> {
|
pub struct LenPrefixedBytes<L: Lengthable> {
|
||||||
len: L,
|
len: L,
|
||||||
pub data: Vec<u8>,
|
pub data: Vec<u8>,
|
||||||
|
@ -662,7 +665,7 @@ impl Lengthable for i32 {
|
||||||
use num_traits::cast::{cast, NumCast};
|
use num_traits::cast::{cast, NumCast};
|
||||||
/// `FixedPoint5` has the 5 least-significant bits for the fractional
|
/// `FixedPoint5` has the 5 least-significant bits for the fractional
|
||||||
/// part, upper for integer part: https://wiki.vg/Data_types#Fixed-point_numbers
|
/// part, upper for integer part: https://wiki.vg/Data_types#Fixed-point_numbers
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||||
pub struct FixedPoint5<T>(T);
|
pub struct FixedPoint5<T>(T);
|
||||||
|
|
||||||
impl<T: Serializable> Serializable for FixedPoint5<T> {
|
impl<T: Serializable> Serializable for FixedPoint5<T> {
|
||||||
|
@ -708,7 +711,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `FixedPoint12` is like `FixedPoint5` but the fractional part is 12-bit
|
/// `FixedPoint12` is like `FixedPoint5` but the fractional part is 12-bit
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||||
pub struct FixedPoint12<T>(T);
|
pub struct FixedPoint12<T>(T);
|
||||||
|
|
||||||
impl<T: Serializable> Serializable for FixedPoint12<T> {
|
impl<T: Serializable> Serializable for FixedPoint12<T> {
|
||||||
|
@ -755,7 +758,7 @@ where
|
||||||
|
|
||||||
/// `VarInt` have a variable size (between 1 and 5 bytes) when encoded based
|
/// `VarInt` have a variable size (between 1 and 5 bytes) when encoded based
|
||||||
/// on the size of the number
|
/// on the size of the number
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
pub struct VarInt(pub i32);
|
pub struct VarInt(pub i32);
|
||||||
|
|
||||||
impl Lengthable for VarInt {
|
impl Lengthable for VarInt {
|
||||||
|
@ -818,7 +821,7 @@ impl fmt::Debug for VarInt {
|
||||||
|
|
||||||
/// `VarShort` have a variable size (2 or 3 bytes) and are backwards-compatible
|
/// `VarShort` have a variable size (2 or 3 bytes) and are backwards-compatible
|
||||||
/// with vanilla shorts, used for Forge custom payloads
|
/// with vanilla shorts, used for Forge custom payloads
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||||
pub struct VarShort(pub i32);
|
pub struct VarShort(pub i32);
|
||||||
|
|
||||||
impl Lengthable for VarShort {
|
impl Lengthable for VarShort {
|
||||||
|
@ -881,7 +884,7 @@ impl fmt::Debug for VarShort {
|
||||||
|
|
||||||
/// `VarLong` have a variable size (between 1 and 10 bytes) when encoded based
|
/// `VarLong` have a variable size (between 1 and 10 bytes) when encoded based
|
||||||
/// on the size of the number
|
/// on the size of the number
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||||
pub struct VarLong(pub i64);
|
pub struct VarLong(pub i64);
|
||||||
|
|
||||||
impl Lengthable for VarLong {
|
impl Lengthable for VarLong {
|
||||||
|
@ -963,7 +966,7 @@ impl Serializable for Position {
|
||||||
|
|
||||||
/// Direction is used to define whether packets are going to the
|
/// Direction is used to define whether packets are going to the
|
||||||
/// server or the client.
|
/// server or the client.
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub enum Direction {
|
pub enum Direction {
|
||||||
Serverbound,
|
Serverbound,
|
||||||
Clientbound,
|
Clientbound,
|
||||||
|
@ -1436,7 +1439,7 @@ pub fn try_parse_packet(ibuf: Vec<u8>, protocol_version: i32) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct Status {
|
pub struct Status {
|
||||||
pub version: StatusVersion,
|
pub version: StatusVersion,
|
||||||
pub players: StatusPlayers,
|
pub players: StatusPlayers,
|
||||||
|
@ -1446,20 +1449,20 @@ pub struct Status {
|
||||||
pub fml_network_version: Option<i64>,
|
pub fml_network_version: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct StatusVersion {
|
pub struct StatusVersion {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub protocol: i32,
|
pub protocol: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct StatusPlayers {
|
pub struct StatusPlayers {
|
||||||
pub max: i32,
|
pub max: i32,
|
||||||
pub online: i32,
|
pub online: i32,
|
||||||
pub sample: Vec<StatusPlayer>,
|
pub sample: Vec<StatusPlayer>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct StatusPlayer {
|
pub struct StatusPlayer {
|
||||||
name: String,
|
name: String,
|
||||||
id: String,
|
id: String,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use sha1::{self, Digest};
|
use sha1::{self, Digest};
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Profile {
|
pub struct Profile {
|
||||||
pub username: String,
|
pub username: String,
|
||||||
pub id: String,
|
pub id: String,
|
||||||
|
|
|
@ -2415,7 +2415,7 @@ state_packets!(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub struct SpawnProperty {
|
pub struct SpawnProperty {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub value: String,
|
pub value: String,
|
||||||
|
@ -2438,7 +2438,7 @@ impl Serializable for SpawnProperty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub struct Statistic {
|
pub struct Statistic {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub value: VarInt,
|
pub value: VarInt,
|
||||||
|
@ -2458,7 +2458,7 @@ impl Serializable for Statistic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub struct BlockChangeRecord {
|
pub struct BlockChangeRecord {
|
||||||
pub xz: u8,
|
pub xz: u8,
|
||||||
pub y: u8,
|
pub y: u8,
|
||||||
|
@ -2481,7 +2481,7 @@ impl Serializable for BlockChangeRecord {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub struct ChunkMeta {
|
pub struct ChunkMeta {
|
||||||
pub x: i32,
|
pub x: i32,
|
||||||
pub z: i32,
|
pub z: i32,
|
||||||
|
@ -2504,7 +2504,7 @@ impl Serializable for ChunkMeta {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub struct ExplosionRecord {
|
pub struct ExplosionRecord {
|
||||||
pub x: i8,
|
pub x: i8,
|
||||||
pub y: i8,
|
pub y: i8,
|
||||||
|
@ -2527,7 +2527,7 @@ impl Serializable for ExplosionRecord {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct MapIcon {
|
pub struct MapIcon {
|
||||||
pub direction_type: i8,
|
pub direction_type: i8,
|
||||||
pub x: i8,
|
pub x: i8,
|
||||||
|
@ -2560,7 +2560,7 @@ impl Default for MapIcon {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq)]
|
||||||
pub struct Advancement {
|
pub struct Advancement {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub parent_id: Option<String>,
|
pub parent_id: Option<String>,
|
||||||
|
@ -2613,7 +2613,7 @@ impl Serializable for Advancement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq)]
|
||||||
pub struct AdvancementDisplay {
|
pub struct AdvancementDisplay {
|
||||||
pub title: String,
|
pub title: String,
|
||||||
pub description: String,
|
pub description: String,
|
||||||
|
@ -2666,7 +2666,7 @@ impl Serializable for AdvancementDisplay {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub struct AdvancementProgress {
|
pub struct AdvancementProgress {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub criteria: LenPrefixed<VarInt, CriterionProgress>,
|
pub criteria: LenPrefixed<VarInt, CriterionProgress>,
|
||||||
|
@ -2686,7 +2686,7 @@ impl Serializable for AdvancementProgress {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub struct CriterionProgress {
|
pub struct CriterionProgress {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub date_of_achieving: Option<i64>,
|
pub date_of_achieving: Option<i64>,
|
||||||
|
@ -2714,7 +2714,7 @@ impl Serializable for CriterionProgress {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq)]
|
||||||
pub struct EntityEquipment {
|
pub struct EntityEquipment {
|
||||||
pub slot: u8,
|
pub slot: u8,
|
||||||
pub item: Option<item::Stack>,
|
pub item: Option<item::Stack>,
|
||||||
|
@ -2735,7 +2735,7 @@ impl Serializable for EntityEquipment {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Top-bit terminated array of EntityEquipment
|
// Top-bit terminated array of EntityEquipment
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq)]
|
||||||
pub struct EntityEquipments {
|
pub struct EntityEquipments {
|
||||||
pub equipments: Vec<EntityEquipment>,
|
pub equipments: Vec<EntityEquipment>,
|
||||||
}
|
}
|
||||||
|
@ -2765,7 +2765,7 @@ impl Serializable for EntityEquipments {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq)]
|
||||||
pub struct EntityProperty {
|
pub struct EntityProperty {
|
||||||
pub key: String,
|
pub key: String,
|
||||||
pub value: f64,
|
pub value: f64,
|
||||||
|
@ -2788,7 +2788,7 @@ impl Serializable for EntityProperty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq)]
|
||||||
pub struct EntityProperty_i16 {
|
pub struct EntityProperty_i16 {
|
||||||
pub key: String,
|
pub key: String,
|
||||||
pub value: f64,
|
pub value: f64,
|
||||||
|
@ -2811,7 +2811,7 @@ impl Serializable for EntityProperty_i16 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq)]
|
||||||
pub struct PropertyModifier {
|
pub struct PropertyModifier {
|
||||||
pub uuid: UUID,
|
pub uuid: UUID,
|
||||||
pub amount: f64,
|
pub amount: f64,
|
||||||
|
@ -2834,7 +2834,7 @@ impl Serializable for PropertyModifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub struct PlayerInfoData {
|
pub struct PlayerInfoData {
|
||||||
pub action: VarInt,
|
pub action: VarInt,
|
||||||
pub players: Vec<PlayerDetail>,
|
pub players: Vec<PlayerDetail>,
|
||||||
|
@ -2920,7 +2920,7 @@ impl Default for PlayerInfoData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum PlayerDetail {
|
pub enum PlayerDetail {
|
||||||
Add {
|
Add {
|
||||||
uuid: UUID,
|
uuid: UUID,
|
||||||
|
@ -2947,7 +2947,7 @@ pub enum PlayerDetail {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct PlayerProperty {
|
pub struct PlayerProperty {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub value: String,
|
pub value: String,
|
||||||
|
@ -2957,7 +2957,7 @@ pub struct PlayerProperty {
|
||||||
use crate::item;
|
use crate::item;
|
||||||
type RecipeIngredient = LenPrefixed<VarInt, Option<item::Stack>>;
|
type RecipeIngredient = LenPrefixed<VarInt, Option<item::Stack>>;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum RecipeData {
|
pub enum RecipeData {
|
||||||
Shapeless {
|
Shapeless {
|
||||||
group: String,
|
group: String,
|
||||||
|
@ -3031,7 +3031,7 @@ impl Default for RecipeData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq)]
|
||||||
pub struct Recipe {
|
pub struct Recipe {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub ty: String,
|
pub ty: String,
|
||||||
|
@ -3153,7 +3153,7 @@ impl Serializable for Recipe {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub struct Tags {
|
pub struct Tags {
|
||||||
pub tag_name: String,
|
pub tag_name: String,
|
||||||
pub entries: LenPrefixed<VarInt, VarInt>,
|
pub entries: LenPrefixed<VarInt, VarInt>,
|
||||||
|
@ -3172,7 +3172,7 @@ impl Serializable for Tags {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub struct TagsGroup {
|
pub struct TagsGroup {
|
||||||
pub tag_type: String,
|
pub tag_type: String,
|
||||||
pub tags: LenPrefixed<VarInt, Tags>,
|
pub tags: LenPrefixed<VarInt, Tags>,
|
||||||
|
@ -3191,7 +3191,7 @@ impl Serializable for TagsGroup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq)]
|
||||||
pub struct Trade {
|
pub struct Trade {
|
||||||
pub input_item_1: Option<nbt::NamedTag>,
|
pub input_item_1: Option<nbt::NamedTag>,
|
||||||
pub output_item: Option<nbt::NamedTag>,
|
pub output_item: Option<nbt::NamedTag>,
|
||||||
|
@ -3234,7 +3234,7 @@ impl Serializable for Trade {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone, PartialEq)]
|
||||||
pub struct CommandNode {
|
pub struct CommandNode {
|
||||||
pub flags: u8,
|
pub flags: u8,
|
||||||
pub children: LenPrefixed<VarInt, VarInt>,
|
pub children: LenPrefixed<VarInt, VarInt>,
|
||||||
|
@ -3245,14 +3245,14 @@ pub struct CommandNode {
|
||||||
pub suggestions_type: Option<String>,
|
pub suggestions_type: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||||
enum CommandNodeType {
|
enum CommandNodeType {
|
||||||
Root,
|
Root,
|
||||||
Literal,
|
Literal,
|
||||||
Argument,
|
Argument,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum CommandProperty {
|
pub enum CommandProperty {
|
||||||
Bool,
|
Bool,
|
||||||
Double {
|
Double {
|
||||||
|
@ -3484,7 +3484,7 @@ impl Serializable for CommandNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default, PartialEq)]
|
||||||
pub struct NumberedSlot {
|
pub struct NumberedSlot {
|
||||||
pub slot_number: i16,
|
pub slot_number: i16,
|
||||||
pub slot_data: Option<item::Stack>,
|
pub slot_data: Option<item::Stack>,
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Set {
|
pub struct Set {
|
||||||
data: Vec<u64>,
|
data: Vec<u64>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ use std::fmt;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||||
pub struct MetadataKey<T: MetaValue> {
|
pub struct MetadataKey<T: MetaValue> {
|
||||||
index: i32,
|
index: i32,
|
||||||
ty: PhantomData<T>,
|
ty: PhantomData<T>,
|
||||||
|
@ -39,6 +40,7 @@ impl<T: MetaValue> MetadataKey<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, PartialEq)]
|
||||||
pub struct Metadata {
|
pub struct Metadata {
|
||||||
map: HashMap<i32, Value>,
|
map: HashMap<i32, Value>,
|
||||||
}
|
}
|
||||||
|
@ -491,7 +493,7 @@ impl Default for Metadata {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum Value {
|
pub enum Value {
|
||||||
Byte(i8),
|
Byte(i8),
|
||||||
Short(i16),
|
Short(i16),
|
||||||
|
@ -516,7 +518,7 @@ pub enum Value {
|
||||||
Pose(PoseData),
|
Pose(PoseData),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum ParticleData {
|
pub enum ParticleData {
|
||||||
AmbientEntityEffect,
|
AmbientEntityEffect,
|
||||||
AngryVillager,
|
AngryVillager,
|
||||||
|
@ -655,7 +657,7 @@ impl Serializable for ParticleData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub struct VillagerData {
|
pub struct VillagerData {
|
||||||
villager_type: protocol::VarInt,
|
villager_type: protocol::VarInt,
|
||||||
|
@ -680,7 +682,7 @@ impl Serializable for VillagerData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum PoseData {
|
pub enum PoseData {
|
||||||
Standing,
|
Standing,
|
||||||
FallFlying,
|
FallFlying,
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub mod bit;
|
||||||
pub mod hash;
|
pub mod hash;
|
||||||
pub mod nibble;
|
pub mod nibble;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub enum Gamemode {
|
pub enum Gamemode {
|
||||||
Survival = 0,
|
Survival = 0,
|
||||||
Creative = 1,
|
Creative = 1,
|
||||||
|
|
|
@ -393,7 +393,7 @@ fn flood_fill(snapshot: &world::Snapshot, visited: &mut Set, x: i32, y: i32, z:
|
||||||
touched
|
touched
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Default)]
|
#[derive(Clone, Copy, Default, PartialEq, Eq)]
|
||||||
pub struct CullInfo(u64);
|
pub struct CullInfo(u64);
|
||||||
|
|
||||||
impl CullInfo {
|
impl CullInfo {
|
||||||
|
|
Loading…
Reference in New Issue