Finally fix all registries
This commit is contained in:
1 parent
d444f68093
commit
2fd3585af7
12 files changed
+146
-252
No files matched your search
@@ -92,11 +92,11 @@ impl<'a> ClientPacket for CKnownPacks<'a> {
|
||||
|
||||
pub struct CRegistryData<'a> {
|
||||
registry_id: &'a str,
|
||||
entries: &'a [Entry<'a>],
|
||||
entries: &'a [RegistryEntry],
|
||||
}
|
||||
|
||||
impl<'a> CRegistryData<'a> {
|
||||
pub fn new(registry_id: &'a str, entries: &'a [Entry]) -> Self {
|
||||
pub fn new(registry_id: &'a str, entries: &'a [RegistryEntry]) -> Self {
|
||||
Self {
|
||||
registry_id,
|
||||
entries,
|
||||
@@ -104,10 +104,9 @@ impl<'a> CRegistryData<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Entry<'a> {
|
||||
pub entry_id: &'a str,
|
||||
pub has_data: bool,
|
||||
pub data: &'a [u8],
|
||||
pub struct RegistryEntry {
|
||||
pub entry_id: String,
|
||||
pub data: Vec<u8>,
|
||||
}
|
||||
|
||||
impl<'a> ClientPacket for CRegistryData<'a> {
|
||||
@@ -115,10 +114,10 @@ impl<'a> ClientPacket for CRegistryData<'a> {
|
||||
|
||||
fn write(&self, bytebuf: &mut ByteBuffer) {
|
||||
bytebuf.put_string(self.registry_id);
|
||||
bytebuf.put_list::<Entry>(self.entries, |p, v| {
|
||||
p.put_string(v.entry_id);
|
||||
p.put_bool(v.has_data);
|
||||
p.put_slice(v.data);
|
||||
bytebuf.put_list::<RegistryEntry>(self.entries, |p, v| {
|
||||
p.put_string(&v.entry_id);
|
||||
p.put_bool(!v.data.is_empty());
|
||||
p.put_slice(&v.data);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ pub struct CLogin {
|
||||
entity_id: i32,
|
||||
is_hardcore: bool,
|
||||
dimension_count: VarInt,
|
||||
dimension_names: Vec<String>,
|
||||
dimension_names: String,
|
||||
max_players: VarInt,
|
||||
view_distance: VarInt,
|
||||
simulated_distance: VarInt,
|
||||
@@ -94,7 +94,7 @@ impl CLogin {
|
||||
entity_id: i32,
|
||||
is_hardcore: bool,
|
||||
dimension_count: VarInt,
|
||||
dimension_names: Vec<String>,
|
||||
dimension_names: String,
|
||||
max_players: VarInt,
|
||||
view_distance: VarInt,
|
||||
simulated_distance: VarInt,
|
||||
@@ -148,7 +148,7 @@ impl ClientPacket for CLogin {
|
||||
bytebuf.put_i32(self.entity_id);
|
||||
bytebuf.put_bool(self.is_hardcore);
|
||||
bytebuf.put_var_int(self.dimension_count);
|
||||
bytebuf.put_string_array(self.dimension_names.as_slice());
|
||||
bytebuf.put_string(&self.dimension_names);
|
||||
bytebuf.put_var_int(self.max_players);
|
||||
bytebuf.put_var_int(self.view_distance);
|
||||
bytebuf.put_var_int(self.simulated_distance);
|
||||
|
||||
Reference in new issue
Block a user