Overhaul registry loading

Registry data is now loaded dynamically for automatic future-proofing, ending the need for manual struct updates. Access to specific values now requires explicit data lookups.
This commit is contained in:
Alexander Medvedev 2025-11-18 19:00:18 +01:00
parent 2c26124a90
commit 0ce5471761
19 changed files with 9609 additions and 9680 deletions

105
Cargo.lock generated
View File

@ -125,9 +125,9 @@ checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
[[package]]
name = "async-compression"
version = "0.4.32"
version = "0.4.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a89bce6054c720275ac2432fbba080a66a2106a44a1b804553930ca6909f4e0"
checksum = "93c1f86859c1af3d514fa19e8323147ff10ea98684e6c7b307912509f50e67b2"
dependencies = [
"compression-codecs",
"compression-core",
@ -285,9 +285,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
version = "1.10.1"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
[[package]]
name = "cast"
@ -297,9 +297,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
[[package]]
name = "cc"
version = "1.2.44"
version = "1.2.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37521ac7aabe3d13122dc382493e20c9416f299d2ccd5b3a5340a2570cdeb0f3"
checksum = "35900b6c8d709fb1d854671ae27aeaa9eec2f8b01b364e1619a40da3e6fe2afe"
dependencies = [
"find-msvc-tools",
"shlex",
@ -405,9 +405,9 @@ dependencies = [
[[package]]
name = "compression-codecs"
version = "0.4.31"
version = "0.4.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef8a506ec4b81c460798f572caead636d57d3d7e940f998160f52bd254bf2d23"
checksum = "680dc087785c5230f8e8843e2e57ac7c1c90488b6a91b88caa265410568f441b"
dependencies = [
"compression-core",
"flate2",
@ -415,9 +415,9 @@ dependencies = [
[[package]]
name = "compression-core"
version = "0.4.29"
version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e47641d3deaf41fb1538ac1f54735925e275eaf3bf4d55c81b137fba797e5cbb"
checksum = "3a9b614a5787ef0c8802a55766480563cb3a93b435898c422ed2a359cf811582"
[[package]]
name = "console-api"
@ -535,15 +535,14 @@ checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
[[package]]
name = "crc-fast"
version = "1.6.0"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ddc2d09feefeee8bd78101665bd8645637828fa9317f9f292496dbbd8c65ff3"
checksum = "a2f7c8d397a6353ef0c1d6217ab91b3ddb5431daf57fd013f506b967dcf44458"
dependencies = [
"crc",
"digest 0.10.7",
"rand",
"regex",
"rustversion",
"spin",
]
[[package]]
@ -958,7 +957,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@ -1587,9 +1586,9 @@ checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
[[package]]
name = "libloading"
version = "0.8.9"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60"
dependencies = [
"cfg-if",
"windows-link",
@ -2166,7 +2165,7 @@ dependencies = [
[[package]]
name = "pumpkin"
version = "0.1.0-dev+1.21.9"
version = "0.1.0-dev+1.21.10"
dependencies = [
"async-trait",
"base64 0.22.1",
@ -2212,7 +2211,7 @@ dependencies = [
[[package]]
name = "pumpkin-api-macros"
version = "0.1.0-dev+1.21.9"
version = "0.1.0-dev+1.21.10"
dependencies = [
"proc-macro-error2",
"proc-macro2",
@ -2222,7 +2221,7 @@ dependencies = [
[[package]]
name = "pumpkin-config"
version = "0.1.0-dev+1.21.9"
version = "0.1.0-dev+1.21.10"
dependencies = [
"log",
"pumpkin-util",
@ -2233,7 +2232,7 @@ dependencies = [
[[package]]
name = "pumpkin-data"
version = "0.1.0-dev+1.21.9"
version = "0.1.0-dev+1.21.10"
dependencies = [
"crc-fast",
"heck",
@ -2251,7 +2250,7 @@ dependencies = [
[[package]]
name = "pumpkin-inventory"
version = "0.1.0-dev+1.21.9"
version = "0.1.0-dev+1.21.10"
dependencies = [
"async-trait",
"crossbeam-utils",
@ -2266,7 +2265,7 @@ dependencies = [
[[package]]
name = "pumpkin-macros"
version = "0.1.0-dev+1.21.9"
version = "0.1.0-dev+1.21.10"
dependencies = [
"heck",
"proc-macro-error2",
@ -2277,7 +2276,7 @@ dependencies = [
[[package]]
name = "pumpkin-nbt"
version = "0.1.0-dev+1.21.9"
version = "0.1.0-dev+1.21.10"
dependencies = [
"bytes",
"cesu8",
@ -2289,7 +2288,7 @@ dependencies = [
[[package]]
name = "pumpkin-protocol"
version = "0.1.0-dev+1.21.9"
version = "0.1.0-dev+1.21.10"
dependencies = [
"aes",
"async-compression",
@ -2311,7 +2310,7 @@ dependencies = [
[[package]]
name = "pumpkin-registry"
version = "0.1.0-dev+1.21.9"
version = "0.1.0-dev+1.21.10"
dependencies = [
"indexmap",
"pumpkin-protocol",
@ -2322,7 +2321,7 @@ dependencies = [
[[package]]
name = "pumpkin-util"
version = "0.1.0-dev+1.21.9"
version = "0.1.0-dev+1.21.10"
dependencies = [
"base64 0.22.1",
"bytes",
@ -2346,7 +2345,7 @@ dependencies = [
[[package]]
name = "pumpkin-world"
version = "0.1.0-dev+1.21.9"
version = "0.1.0-dev+1.21.10"
dependencies = [
"async-trait",
"bitflags",
@ -2391,9 +2390,9 @@ dependencies = [
[[package]]
name = "quote"
version = "1.0.41"
version = "1.0.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
dependencies = [
"proc-macro2",
]
@ -2581,14 +2580,14 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
name = "rustls"
version = "0.23.34"
version = "0.23.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a9586e9ee2b4f8fab52a0048ca7334d7024eef48e2cb9407e3497bb7cab7fa7"
checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f"
dependencies = [
"log",
"once_cell",
@ -2599,15 +2598,6 @@ dependencies = [
"zeroize",
]
[[package]]
name = "rustls-pemfile"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50"
dependencies = [
"rustls-pki-types",
]
[[package]]
name = "rustls-pki-types"
version = "1.13.0"
@ -2651,9 +2641,9 @@ dependencies = [
[[package]]
name = "ruzstd"
version = "0.8.1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3640bec8aad418d7d03c72ea2de10d5c646a598f9883c7babc160d91e3c1b26c"
checksum = "e5ff0cc5e135c8870a775d3320910cd9b564ec036b4dc0b8741629020be63f01"
dependencies = [
"twox-hash 2.1.2",
]
@ -2931,6 +2921,12 @@ dependencies = [
"windows-sys 0.60.2",
]
[[package]]
name = "spin"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591"
[[package]]
name = "spki"
version = "0.7.3"
@ -2971,9 +2967,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "syn"
version = "2.0.108"
version = "2.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917"
checksum = "2f17c7e013e88258aa9543dcbe81aca68a667a9ac37cd69c9fbc07858bfe0e2f"
dependencies = [
"proc-macro2",
"quote",
@ -3018,7 +3014,7 @@ dependencies = [
"fastrand",
"once_cell",
"rustix",
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@ -3169,9 +3165,9 @@ dependencies = [
[[package]]
name = "tokio-util"
version = "0.7.16"
version = "0.7.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5"
checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594"
dependencies = [
"bytes",
"futures-core",
@ -3398,9 +3394,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "ureq"
version = "3.1.2"
version = "3.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99ba1025f18a4a3fc3e9b48c868e9beb4f24f4b4b1a325bada26bd4119f46537"
checksum = "d39cb1dbab692d82a977c0392ffac19e188bd9186a9f32806f0aaa859d75585a"
dependencies = [
"base64 0.22.1",
"cookie_store",
@ -3408,7 +3404,6 @@ dependencies = [
"log",
"percent-encoding",
"rustls",
"rustls-pemfile",
"rustls-pki-types",
"serde",
"serde_json",
@ -3565,9 +3560,9 @@ dependencies = [
[[package]]
name = "webpki-roots"
version = "1.0.3"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32b130c0d2d49f8b6889abc456e795e82525204f27c42cf767cf0d7734e089b8"
checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e"
dependencies = [
"rustls-pki-types",
]
@ -3594,7 +3589,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]

View File

@ -14,7 +14,7 @@ members = [
]
[workspace.package]
version = "0.1.0-dev+1.21.9"
version = "0.1.0-dev+1.21.10"
edition = "2024"
[profile.release]
@ -44,7 +44,7 @@ tokio = { version = "1.48", features = [
thiserror = "2.0"
bytes = "1.10"
bytes = "1.11"
# Concurrency/Parallelism and Synchronization
futures = { version = "0.3", default-features = false, features = ["executor"] }

View File

@ -5,7 +5,7 @@
![CI](https://github.com/Snowiiii/Pumpkin/actions/workflows/rust.yml/badge.svg)
[![Discord](https://img.shields.io/discord/1268592337445978193.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/wT8XjrjKkf)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![Current version)](https://img.shields.io/badge/current_version-1.21.9-blue)
![Current version)](https://img.shields.io/badge/current_version-1.21.10-blue)
</div>

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@ pumpkin-util = { path = "../pumpkin-util" }
pumpkin-nbt = { path = "../pumpkin-nbt" }
serde.workspace = true
crc-fast = "1.6.0"
crc-fast = "1.8.0"
[build-dependencies]
pumpkin-util = { path = "../pumpkin-util" }

View File

@ -170,22 +170,19 @@ impl<'de, R: Read + Seek> de::Deserializer<'de> for &mut Deserializer<R> {
}
}
fn deserialize_u16<V: Visitor<'de>>(self, _visitor: V) -> Result<V::Value> {
Err(Error::UnsupportedType(
"u16; NBT only supports signed values".to_string(),
))
fn deserialize_u16<V: Visitor<'de>>(self, visitor: V) -> Result<V::Value> {
let value = self.input.get_i16_be()?;
visitor.visit_i16::<Error>(value)
}
fn deserialize_u32<V: Visitor<'de>>(self, _visitor: V) -> Result<V::Value> {
Err(Error::UnsupportedType(
"u32; NBT only supports signed values".to_string(),
))
fn deserialize_u32<V: Visitor<'de>>(self, visitor: V) -> Result<V::Value> {
let value = self.input.get_i32_be()?;
visitor.visit_i32::<Error>(value)
}
fn deserialize_u64<V: Visitor<'de>>(self, _visitor: V) -> Result<V::Value> {
Err(Error::UnsupportedType(
"u64; NBT only supports signed values".to_string(),
))
fn deserialize_u64<V: Visitor<'de>>(self, visitor: V) -> Result<V::Value> {
let value = self.input.get_i64_be()?;
visitor.visit_i64::<Error>(value)
}
fn deserialize_bool<V: Visitor<'de>>(self, visitor: V) -> Result<V::Value> {

View File

@ -213,22 +213,16 @@ impl<W: Write> ser::Serializer for &mut Serializer<W> {
}
}
fn serialize_u16(self, _v: u16) -> Result<()> {
Err(Error::UnsupportedType(
"u16; NBT only supports signed values".to_string(),
))
fn serialize_u16(self, v: u16) -> Result<()> {
self.serialize_i16(v as i16)
}
fn serialize_u32(self, _v: u32) -> Result<()> {
Err(Error::UnsupportedType(
"u32; NBT only supports signed values".to_string(),
))
fn serialize_u32(self, v: u32) -> Result<()> {
self.serialize_i32(v as i32)
}
fn serialize_u64(self, _v: u64) -> Result<()> {
Err(Error::UnsupportedType(
"u64; NBT only supports signed values".to_string(),
))
fn serialize_u64(self, v: u64) -> Result<()> {
self.serialize_i64(v as i64)
}
fn serialize_f32(self, v: f32) -> Result<()> {

View File

@ -27,7 +27,7 @@ aes = "0.8"
cfb8 = "0.8"
# compression
async-compression = { version = "0.4.32", features = ["tokio", "zlib"] }
async-compression = { version = "0.4.33", features = ["tokio", "zlib"] }
take_mut = "0.2.2"
bitflags = "2.10.0"

View File

@ -1,45 +1,15 @@
use std::sync::LazyLock;
use banner_pattern::BannerPattern;
use biome::Biome;
use cat::CatVariant;
use chat_type::{ChatType, Decoration};
use chicken::ChickenVariant;
use cow::CowVariant;
use damage_type::DamageType;
use dimension::Dimension;
use enchantment::Enchantment;
use frog::FrogVariant;
mod jukebox_song;
use indexmap::IndexMap;
use instrument::Instrument;
use jukebox_song::JukeboxSong;
use paint::Painting;
use pig::PigVariant;
use pumpkin_protocol::java::client::config::RegistryEntry;
use pumpkin_util::include_json_static;
use pumpkin_util::resource_location::ResourceLocation;
use serde::{Deserialize, Serialize};
use trim_material::TrimMaterial;
use trim_pattern::TrimPattern;
use wolf::{WolfSoundVariant, WolfVariant};
use serde_json::Value;
mod banner_pattern;
mod biome;
mod cat;
mod chat_type;
mod chicken;
mod cow;
mod damage_type;
mod dimension;
mod enchantment;
mod frog;
mod instrument;
mod jukebox_song;
mod paint;
mod pig;
mod trim_material;
mod trim_pattern;
mod wolf;
use crate::jukebox_song::JukeboxSong;
pub static SYNCED_REGISTRIES: LazyLock<SyncedRegistry> =
LazyLock::new(|| include_json_static!("../../assets/synced_registries.json", SyncedRegistry));
@ -51,28 +21,31 @@ pub struct Registry {
#[derive(Serialize, Deserialize)]
pub struct SyncedRegistry {
#[serde(rename = "worldgen/biome")]
biome: IndexMap<String, Biome>,
chat_type: IndexMap<String, ChatType>,
trim_pattern: IndexMap<String, TrimPattern>,
trim_material: IndexMap<String, TrimMaterial>,
wolf_variant: IndexMap<String, WolfVariant>,
painting_variant: IndexMap<String, Painting>,
dimension_type: IndexMap<String, Dimension>,
damage_type: IndexMap<String, DamageType>,
cat_variant: IndexMap<String, CatVariant>,
chicken_variant: IndexMap<String, ChickenVariant>,
cow_variant: IndexMap<String, CowVariant>,
frog_variant: IndexMap<String, FrogVariant>,
pig_variant: IndexMap<String, PigVariant>,
wolf_sound_variant: IndexMap<String, WolfSoundVariant>,
banner_pattern: IndexMap<String, BannerPattern>,
enchantment: IndexMap<String, Enchantment>,
pub jukebox_song: IndexMap<String, JukeboxSong>,
instrument: IndexMap<String, Instrument>,
#[serde(flatten)]
pub registries: IndexMap<String, IndexMap<String, Value>>,
}
// Probably not optimal
impl SyncedRegistry {
pub fn get_jukebox_song(&self, song_key: &str) -> Option<JukeboxSong> {
let jukebox_registry = self
.registries
.get("minecraft:jukebox_song")
.or_else(|| self.registries.get("jukebox_song"))?;
let song_value = jukebox_registry.get(song_key)?;
serde_json::from_value(song_value.clone()).ok()
}
pub fn get_jukebox_song_index(&self, song_key: &str) -> Option<usize> {
let jukebox_registry = self
.registries
.get("minecraft:jukebox_song")
.or_else(|| self.registries.get("jukebox_song"))?;
jukebox_registry.get_index_of(song_key)
}
}
// TODO: remove in favor of numerical registry ids for `minecraft:dimension_type`
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum VanillaDimensionType {
Overworld,
@ -104,188 +77,61 @@ impl VanillaDimensionType {
impl Registry {
pub fn get_synced() -> Vec<Self> {
let registry_entries = SYNCED_REGISTRIES
.biome
.iter()
.map(|(name, _nbt)| RegistryEntry::none(name))
.collect();
let biome = Registry {
registry_id: ResourceLocation::vanilla("worldgen/biome"),
registry_entries,
};
let mut synced_registries = Vec::new();
let mut registry_entries: Vec<RegistryEntry> = SYNCED_REGISTRIES
.chat_type
.iter()
.map(|(name, _nbt)| RegistryEntry::none(name))
.collect();
for (registry_key, entries) in &SYNCED_REGISTRIES.registries {
let registry_id = if registry_key.contains(':') {
ResourceLocation::from(registry_key)
} else {
ResourceLocation::vanilla(registry_key)
};
// Custom RAW registry type that removes the vanilla sender name. Allows custom formatting.
registry_entries.push(RegistryEntry::from_nbt_custom(
"raw",
&ChatType {
chat: Decoration {
translation_key: "%s".to_string(),
parameters: vec!["content".to_string()],
style: None,
},
narration: Decoration {
translation_key: "%s says %s".to_string(),
parameters: vec!["sender".to_string(), "content".to_string()],
style: None,
},
let mut registry_entries: Vec<RegistryEntry> = entries
.iter()
.map(|(entry_name, entry_data)| RegistryEntry::from_nbt(entry_name, entry_data))
.collect();
// 3. Special Handling: Chat Type "raw" injection
// We check if this specific loop iteration is for "chat_type"
if registry_id.path == "chat_type" {
registry_entries.push(RegistryEntry::from_nbt_custom(
"raw",
&Self::get_raw_chat_type_struct(),
));
}
synced_registries.push(Registry {
registry_id,
registry_entries,
});
}
// let jukebox_entries = SYNCED_REGISTRIES
// .jukebox_song
// .keys()
// .map(|name| RegistryEntry::none(name))
// .collect();
// synced_registries.push(Registry {
// registry_id: ResourceLocation::vanilla("jukebox_song"),
// registry_entries: jukebox_entries,
// });
synced_registries
}
fn get_raw_chat_type_struct() -> impl Serialize {
serde_json::json!({
"chat": {
"translation_key": "%s",
"parameters": ["content"],
"style": null
},
));
let chat_type = Registry {
registry_id: ResourceLocation::vanilla("chat_type"),
registry_entries,
};
let registry_entries = SYNCED_REGISTRIES
.wolf_variant
.iter()
.map(|(name, _nbt)| RegistryEntry::none(name))
.collect();
let wolf_variant = Registry {
registry_id: ResourceLocation::vanilla("wolf_variant"),
registry_entries,
};
let registry_entries = SYNCED_REGISTRIES
.cat_variant
.iter()
.map(|(name, _nbt)| RegistryEntry::none(name))
.collect();
let cat_variant = Registry {
registry_id: ResourceLocation::vanilla("cat_variant"),
registry_entries,
};
let registry_entries = SYNCED_REGISTRIES
.chicken_variant
.iter()
.map(|(name, _nbt)| RegistryEntry::none(name))
.collect();
let chicken_variant = Registry {
registry_id: ResourceLocation::vanilla("chicken_variant"),
registry_entries,
};
let registry_entries = SYNCED_REGISTRIES
.cow_variant
.iter()
.map(|(name, _nbt)| RegistryEntry::none(name))
.collect();
let cow_variant = Registry {
registry_id: ResourceLocation::vanilla("cow_variant"),
registry_entries,
};
let registry_entries = SYNCED_REGISTRIES
.frog_variant
.iter()
.map(|(name, _nbt)| RegistryEntry::none(name))
.collect();
let frog_variant = Registry {
registry_id: ResourceLocation::vanilla("frog_variant"),
registry_entries,
};
let registry_entries = SYNCED_REGISTRIES
.pig_variant
.iter()
.map(|(name, _nbt)| RegistryEntry::none(name))
.collect();
let pig_variant = Registry {
registry_id: ResourceLocation::vanilla("pig_variant"),
registry_entries,
};
let registry_entries = SYNCED_REGISTRIES
.wolf_sound_variant
.iter()
.map(|(name, _nbt)| RegistryEntry::none(name))
.collect();
let wolf_sound_variant = Registry {
registry_id: ResourceLocation::vanilla("wolf_sound_variant"),
registry_entries,
};
let registry_entries = SYNCED_REGISTRIES
.painting_variant
.iter()
.map(|(name, _nbt)| RegistryEntry::none(name))
.collect();
let painting_variant = Registry {
registry_id: ResourceLocation::vanilla("painting_variant"),
registry_entries,
};
let registry_entries = SYNCED_REGISTRIES
.dimension_type
.iter()
.map(|(name, _nbt)| RegistryEntry::none(name))
.collect();
let dimension_type = Registry {
registry_id: ResourceLocation::vanilla("dimension_type"),
registry_entries,
};
let registry_entries = SYNCED_REGISTRIES
.damage_type
.iter()
.map(|(name, _nbt)| RegistryEntry::none(name))
.collect();
let damage_type = Registry {
registry_id: ResourceLocation::vanilla("damage_type"),
registry_entries,
};
let registry_entries = SYNCED_REGISTRIES
.banner_pattern
.iter()
.map(|(name, _nbt)| RegistryEntry::none(name))
.collect();
let banner_pattern = Registry {
registry_id: ResourceLocation::vanilla("banner_pattern"),
registry_entries,
};
let registry_entries = SYNCED_REGISTRIES
.jukebox_song
.iter()
.map(|(name, _nbt)| RegistryEntry::none(name))
.collect();
let jukebox_song = Registry {
registry_id: ResourceLocation::vanilla("jukebox_song"),
registry_entries,
};
let registry_entries = SYNCED_REGISTRIES
.enchantment
.iter()
.map(|(name, _nbt)| RegistryEntry::none(name))
.collect();
let enchantment = Registry {
registry_id: ResourceLocation::vanilla("enchantment"),
registry_entries,
};
vec![
cat_variant,
chicken_variant,
cow_variant,
frog_variant,
pig_variant,
biome,
chat_type,
// trim_pattern,
// trim_material,
wolf_variant,
painting_variant,
wolf_sound_variant,
dimension_type,
damage_type,
banner_pattern,
enchantment,
jukebox_song,
// instrument,
]
"narration": {
"translation_key": "%s says %s",
"parameters": ["sender", "content"],
"style": null
}
})
}
}

View File

@ -12,6 +12,14 @@ impl ResourceLocation {
/// The maximum number of bytes for a [`ResourceLocation`] is the same as for a normal [`String`].
pub const MAX_SIZE: NonZeroUsize = NonZeroUsize::new(i16::MAX as usize).unwrap();
pub fn from(location: &str) -> Self {
let names = location.split_once(":").unwrap_or_default();
Self {
namespace: names.0.to_string(),
path: names.1.to_string(),
}
}
pub fn vanilla(path: &str) -> Self {
Self {
namespace: "minecraft".to_string(),

View File

@ -35,7 +35,7 @@ num-traits = "0.2"
# Compression
flate2 = "1.1"
lz4-java-wrc = "0.2.0"
ruzstd = "0.8.1"
ruzstd = "0.8.2"
itertools = "0.14.0"
enum_dispatch = "0.3"
@ -44,7 +44,7 @@ derive-getters = "0.5.0"
thread_local = "1.1.9"
lru = "0.16.2"
tokio-util = { version = "0.7.16", features = ["rt"] }
tokio-util = { version = "0.7.17", features = ["rt"] }
rand = "0.9.2"
num_cpus = "1.17.0"
slotmap = "1.0.7"

View File

@ -37,8 +37,8 @@ pub const CHUNK_COUNT: usize = REGION_SIZE * REGION_SIZE;
/// The number of bytes in a sector (4 KiB)
const SECTOR_BYTES: usize = 4096;
// 1.21.9
pub const WORLD_DATA_VERSION: i32 = 4554;
// 1.21.10
pub const WORLD_DATA_VERSION: i32 = 4556;
#[derive(Clone, Default)]
pub struct AnvilChunkFormat;

View File

@ -23,7 +23,7 @@ pub mod world_info;
pub type BlockId = u16;
pub type BlockStateId = u16;
pub const CURRENT_MC_VERSION: &str = "1.21.9";
pub const CURRENT_MC_VERSION: &str = "1.21.10";
pub const CURRENT_BEDROCK_MC_VERSION: &str = "1.21.111";
#[macro_export]

View File

@ -13,7 +13,7 @@ pub mod anvil;
// Constraint: disk biome palette serialization changed in 1.21.5
pub const MINIMUM_SUPPORTED_WORLD_DATA_VERSION: i32 = 4435; // 1.21.9
pub const MAXIMUM_SUPPORTED_WORLD_DATA_VERSION: i32 = 4554; // 1.21.9
pub const MAXIMUM_SUPPORTED_WORLD_DATA_VERSION: i32 = 4556; // 1.21.10
pub const MINIMUM_SUPPORTED_LEVEL_VERSION: i32 = 19132; // 1.21.9
pub const MAXIMUM_SUPPORTED_LEVEL_VERSION: i32 = 19133; // 1.21.9

View File

@ -54,7 +54,7 @@ rsa = { version = "=0.10.0-rc.9", features = ["sha1"] }
rsa-der = "0.3"
# authentication
ureq = { version = "3.1.2", features = [
ureq = { version = "3.1.4", features = [
"json",
] }
@ -73,11 +73,11 @@ simplelog = { version = "0.12.2", features = ["ansi_term"] }
time = "0.3"
# plugins
libloading = "0.8"
libloading = "0.9"
rustc-hash = "2.1.1"
# Task handling
tokio-util = { version = "0.7.16", features = ["rt"] }
tokio-util = { version = "0.7.17", features = ["rt"] }
# Memory profiling
dhat = { version = "0.3.3", optional = true }

View File

@ -71,12 +71,12 @@ impl BlockBehaviour for JukeboxBlock {
return BlockActionResult::Pass;
};
let Some(jukebox_song) = SYNCED_REGISTRIES.jukebox_song.get_index_of(song) else {
let Some(jukebox_song) = SYNCED_REGISTRIES.get_jukebox_song_index(song) else {
log::error!("Jukebox playable song not registered!");
return BlockActionResult::Pass;
};
//TODO: Update block nbt
// TODO: Update block nbt
self.set_record(true, args.block, args.position, world)
.await;

View File

@ -99,7 +99,7 @@ use pumpkin_world::chunk_system::ChunkLoading;
const MAX_CACHED_SIGNATURES: u8 = 128; // Vanilla: 128
const MAX_PREVIOUS_MESSAGES: u8 = 20; // Vanilla: 20
pub const DATA_VERSION: i32 = 4554; // 1.21.9
pub const DATA_VERSION: i32 = 4556; // 1.21.10
enum BatchState {
Initial,

View File

@ -9,10 +9,12 @@ use core::str;
use pumpkin_config::{BASIC_CONFIG, advanced_config};
use pumpkin_protocol::{
ConnectionState,
java::client::config::{CFinishConfig, CRegistryData},
java::server::config::{
ResourcePackResponseResult, SClientInformationConfig, SConfigCookieResponse,
SConfigResourcePack, SKnownPacks, SPluginMessage,
java::{
client::config::{CFinishConfig, CRegistryData, CUpdateTags},
server::config::{
ResourcePackResponseResult, SClientInformationConfig, SConfigCookieResponse,
SConfigResourcePack, SKnownPacks, SPluginMessage,
},
},
};
use pumpkin_util::{Hand, text::TextComponent};
@ -153,6 +155,16 @@ impl JavaClient {
))
.await;
}
self.send_packet_now(&CUpdateTags::new(&[
pumpkin_data::tag::RegistryKey::Block,
pumpkin_data::tag::RegistryKey::Fluid,
pumpkin_data::tag::RegistryKey::Enchantment,
pumpkin_data::tag::RegistryKey::WorldgenBiome,
pumpkin_data::tag::RegistryKey::Item,
pumpkin_data::tag::RegistryKey::EntityType,
pumpkin_data::tag::RegistryKey::Dialog,
]))
.await;
// We are done with configuring
log::debug!("Finished config");

View File

@ -4,7 +4,7 @@ use pumpkin_config::{BASIC_CONFIG, advanced_config};
use pumpkin_protocol::{
ConnectionState, KnownPack, Label, Link, LinkType,
java::client::{
config::{CConfigAddResourcePack, CConfigServerLinks, CKnownPacks, CUpdateTags},
config::{CConfigAddResourcePack, CConfigServerLinks, CKnownPacks},
login::{CLoginSuccess, CSetCompression},
},
java::server::login::{
@ -343,19 +343,6 @@ impl JavaClient {
self.send_packet_now(&CConfigServerLinks::new(&LINKS)).await;
}
// Send tags.
// TODO: Is this the right place to send them?
self.send_packet_now(&CUpdateTags::new(&[
pumpkin_data::tag::RegistryKey::Block,
pumpkin_data::tag::RegistryKey::Fluid,
pumpkin_data::tag::RegistryKey::Enchantment,
pumpkin_data::tag::RegistryKey::WorldgenBiome,
pumpkin_data::tag::RegistryKey::Item,
pumpkin_data::tag::RegistryKey::EntityType,
]))
.await;
let resource_config = &advanced_config().resource_pack;
if resource_config.enabled {
let uuid = Uuid::new_v3(&uuid::Uuid::NAMESPACE_DNS, resource_config.url.as_bytes());
@ -384,7 +371,7 @@ impl JavaClient {
self.send_packet_now(&CKnownPacks::new(&[KnownPack {
namespace: "minecraft",
id: "core",
version: "1.21.9",
version: "1.21.10",
}]))
.await;
}