mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
mmm registries
This commit is contained in:
parent
8e3ba097b4
commit
428d0ee0e6
3 changed files with 21 additions and 9 deletions
8
azalea-core/src/registries.rs
Normal file
8
azalea-core/src/registries.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
struct RegistryHolder {}
|
||||||
|
|
||||||
|
fn make_network_codec() -> NetworkCodec {
|
||||||
|
// Codec codec = ResourceLocation.CODEC.xmap(ResourceKey::createRegistryKey, ResourceKey::location);
|
||||||
|
// Codec codec2 = codec.partialDispatch("type", mappedRegistry -> DataResult.success(mappedRegistry.key()), resourceKey -> RegistryHolder.getNetworkCodec(resourceKey).map(codec -> MappedRegistry.networkCodec(resourceKey, Lifecycle.experimental(), codec)));
|
||||||
|
// UnboundedMapCodec unboundedMapCodec = Codec.unboundedMap((Codec)codec, (Codec)codec2);
|
||||||
|
// return RegistryHolder.captureMap(unboundedMapCodec);
|
||||||
|
}
|
|
@ -27,7 +27,7 @@ pub struct ClientboundLoginPacket {
|
||||||
pub game_type: GameType,
|
pub game_type: GameType,
|
||||||
pub previous_game_type: Option<GameType>,
|
pub previous_game_type: Option<GameType>,
|
||||||
pub levels: Vec<ResourceLocation>,
|
pub levels: Vec<ResourceLocation>,
|
||||||
pub registry_holder: azalea_core::registry::RegistryAccess,
|
// pub registry_holder: azalea_core::registry::RegistryAccess,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ClientboundLoginPacket {
|
impl ClientboundLoginPacket {
|
||||||
|
@ -37,7 +37,7 @@ impl ClientboundLoginPacket {
|
||||||
|
|
||||||
pub fn write(&self, buf: &mut Vec<u8>) {
|
pub fn write(&self, buf: &mut Vec<u8>) {
|
||||||
buf.write_int(self.player_id);
|
buf.write_int(self.player_id);
|
||||||
buf.write_bool(self.hardcore);
|
// buf.write_bool(self.hardcore);
|
||||||
// buf.write_byte(self.game_type.
|
// buf.write_byte(self.game_type.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,11 +47,12 @@ impl ClientboundLoginPacket {
|
||||||
let transaction_id = buf.read_varint().await? as u32;
|
let transaction_id = buf.read_varint().await? as u32;
|
||||||
let identifier = ResourceLocation::new(&buf.read_utf().await?)?;
|
let identifier = ResourceLocation::new(&buf.read_utf().await?)?;
|
||||||
let data = buf.read_bytes(1048576).await?;
|
let data = buf.read_bytes(1048576).await?;
|
||||||
Ok(ClientboundLoginPacket {
|
panic!("not implemented");
|
||||||
transaction_id,
|
// Ok(ClientboundLoginPacket {
|
||||||
identifier,
|
// transaction_id,
|
||||||
data,
|
// identifier,
|
||||||
}
|
// data,
|
||||||
.get())
|
// }
|
||||||
|
// .get())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,10 @@ use tokio::io::BufReader;
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum GamePacket
|
pub enum GamePacket
|
||||||
where
|
where
|
||||||
Self: Sized, {}
|
Self: Sized,
|
||||||
|
{
|
||||||
|
ClientboundLoginPacket(clientbound_login_packet::ClientboundLoginPacket),
|
||||||
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl ProtocolPacket for GamePacket {
|
impl ProtocolPacket for GamePacket {
|
||||||
|
|
Loading…
Add table
Reference in a new issue