diff options
| author | mat <git@matdoes.dev> | 2025-02-02 21:15:45 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-02-02 21:15:45 +0000 |
| commit | b08d3d55d7351eff6e27a09d732078c038539958 (patch) | |
| tree | 3d511170be7d46bff418296245f62ebd18065453 /azalea-registry/src/data.rs | |
| parent | cdb68dfb702f442135dadedc53ce29b1cc2b9c14 (diff) | |
| download | azalea-drasl-b08d3d55d7351eff6e27a09d732078c038539958.tar.xz | |
start implementing data driven registries
Diffstat (limited to 'azalea-registry/src/data.rs')
| -rw-r--r-- | azalea-registry/src/data.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/azalea-registry/src/data.rs b/azalea-registry/src/data.rs new file mode 100644 index 00000000..c80889d6 --- /dev/null +++ b/azalea-registry/src/data.rs @@ -0,0 +1,24 @@ +use azalea_buf::AzBuf; + +/// A registry which has its values decided by the server in the +/// `ClientboundRegistryData` packet. +/// +/// These can be resolved into their actual values with +/// `ResolvableDataRegistry` from azalea-core. +pub trait DataRegistry { + const NAME: &'static str; + + fn protocol_id(&self) -> u32; +} + +#[derive(Debug, Clone, Copy, AzBuf, PartialEq, Eq, Hash)] +pub struct Enchantment { + #[var] + id: u32, +} +impl DataRegistry for Enchantment { + const NAME: &'static str = "enchantment"; + fn protocol_id(&self) -> u32 { + self.id + } +} |
