1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00

1.21.5-pre2

This commit is contained in:
mat 2025-03-16 22:01:54 +00:00
parent 60d6ff4cfe
commit acb1c4b147
14 changed files with 101 additions and 189 deletions

42
Cargo.lock generated
View file

@ -209,7 +209,7 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]] [[package]]
name = "azalea" name = "azalea"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"azalea-auth", "azalea-auth",
@ -249,7 +249,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-auth" name = "azalea-auth"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"azalea-buf", "azalea-buf",
"azalea-crypto", "azalea-crypto",
@ -269,7 +269,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-block" name = "azalea-block"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"azalea-block-macros", "azalea-block-macros",
"azalea-buf", "azalea-buf",
@ -278,7 +278,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-block-macros" name = "azalea-block-macros"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -287,7 +287,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-brigadier" name = "azalea-brigadier"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"azalea-buf", "azalea-buf",
"azalea-chat", "azalea-chat",
@ -298,7 +298,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-buf" name = "azalea-buf"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"azalea-buf-macros", "azalea-buf-macros",
"byteorder", "byteorder",
@ -311,7 +311,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-buf-macros" name = "azalea-buf-macros"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -320,7 +320,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-chat" name = "azalea-chat"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"azalea-buf", "azalea-buf",
"azalea-language", "azalea-language",
@ -333,7 +333,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-client" name = "azalea-client"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"azalea-auth", "azalea-auth",
@ -368,7 +368,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-core" name = "azalea-core"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"azalea-buf", "azalea-buf",
"azalea-chat", "azalea-chat",
@ -384,7 +384,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-crypto" name = "azalea-crypto"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"aes", "aes",
"azalea-buf", "azalea-buf",
@ -401,7 +401,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-entity" name = "azalea-entity"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"azalea-block", "azalea-block",
"azalea-buf", "azalea-buf",
@ -424,7 +424,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-inventory" name = "azalea-inventory"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"azalea-buf", "azalea-buf",
"azalea-chat", "azalea-chat",
@ -439,7 +439,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-inventory-macros" name = "azalea-inventory-macros"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -448,7 +448,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-language" name = "azalea-language"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"compact_str", "compact_str",
"serde", "serde",
@ -457,7 +457,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-physics" name = "azalea-physics"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"azalea-block", "azalea-block",
"azalea-core", "azalea-core",
@ -475,7 +475,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-protocol" name = "azalea-protocol"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-recursion", "async-recursion",
@ -510,7 +510,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-protocol-macros" name = "azalea-protocol-macros"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -519,7 +519,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-registry" name = "azalea-registry"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"azalea-buf", "azalea-buf",
"azalea-registry-macros", "azalea-registry-macros",
@ -529,7 +529,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-registry-macros" name = "azalea-registry-macros"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"quote", "quote",
"syn", "syn",
@ -537,7 +537,7 @@ dependencies = [
[[package]] [[package]]
name = "azalea-world" name = "azalea-world"
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
dependencies = [ dependencies = [
"azalea-block", "azalea-block",
"azalea-buf", "azalea-buf",

View file

@ -22,7 +22,7 @@ resolver = "2"
# --- Workspace Settings --- # --- Workspace Settings ---
[workspace.package] [workspace.package]
version = "0.11.0+mc25w09b" version = "0.11.0+mc1.21.5-pre2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
repository = "https://github.com/azalea-rs/azalea" repository = "https://github.com/azalea-rs/azalea"

View file

@ -10,7 +10,7 @@ A collection of Rust crates for making Minecraft bots, clients, and tools.
<!-- The line below is automatically read and updated by the migrate script, so don't change it manually. --> <!-- The line below is automatically read and updated by the migrate script, so don't change it manually. -->
_Currently supported Minecraft version: `25w09b`._ _Currently supported Minecraft version: `1.21.5-pre2`._
> [!WARNING] > [!WARNING]
> Azalea is still unfinished, though most crates are in a useable state > Azalea is still unfinished, though most crates are in a useable state

View file

@ -4,7 +4,6 @@
use std::{ use std::{
io::Cursor, io::Cursor,
ops::Deref,
time::{Duration, Instant}, time::{Duration, Instant},
}; };
@ -15,7 +14,6 @@ use azalea_protocol::packets::game::{
}; };
use bevy_app::{App, Plugin, Update}; use bevy_app::{App, Plugin, Update};
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use simdnbt::owned::BaseNbt;
use tracing::{error, trace}; use tracing::{error, trace};
use super::packet::game::handle_outgoing_packets; use super::packet::game::handle_outgoing_packets;
@ -98,10 +96,7 @@ pub fn handle_receive_chunk_events(
} }
} }
let heightmaps_nbt = &event.packet.chunk_data.heightmaps; let heightmaps = &event.packet.chunk_data.heightmaps;
// necessary to make the unwrap_or work
let empty_nbt = BaseNbt::default();
let heightmaps = heightmaps_nbt.unwrap_or(&empty_nbt).deref();
if let Err(e) = partial_instance.chunks.replace_with_packet_data( if let Err(e) = partial_instance.chunks.replace_with_packet_data(
&pos, &pos,

View file

@ -22,7 +22,7 @@ use azalea_world::{Chunk, Instance, MinecraftEntityId, Section};
use bevy_app::App; use bevy_app::App;
use bevy_ecs::{prelude::*, schedule::ExecutorKind}; use bevy_ecs::{prelude::*, schedule::ExecutorKind};
use parking_lot::{Mutex, RwLock}; use parking_lot::{Mutex, RwLock};
use simdnbt::owned::{Nbt, NbtCompound, NbtTag}; use simdnbt::owned::{NbtCompound, NbtTag};
use tokio::task::JoinHandle; use tokio::task::JoinHandle;
use tokio::{sync::mpsc, time::sleep}; use tokio::{sync::mpsc, time::sleep};
use uuid::Uuid; use uuid::Uuid;
@ -294,7 +294,7 @@ pub fn make_basic_empty_chunk(
x: pos.x, x: pos.x,
z: pos.z, z: pos.z,
chunk_data: ClientboundLevelChunkPacketData { chunk_data: ClientboundLevelChunkPacketData {
heightmaps: Nbt::None, heightmaps: Default::default(),
data: Arc::new(chunk_bytes.into()), data: Arc::new(chunk_bytes.into()),
block_entities: vec![], block_entities: vec![],
}, },

View file

@ -2211,6 +2211,7 @@
"block.minecraft.test_instance_block": "Test Instance Block", "block.minecraft.test_instance_block": "Test Instance Block",
"block.minecraft.tinted_glass": "Tinted Glass", "block.minecraft.tinted_glass": "Tinted Glass",
"block.minecraft.tnt": "TNT", "block.minecraft.tnt": "TNT",
"block.minecraft.tnt.disabled": "TNT explosions are disabled",
"block.minecraft.torch": "Torch", "block.minecraft.torch": "Torch",
"block.minecraft.torchflower": "Torchflower", "block.minecraft.torchflower": "Torchflower",
"block.minecraft.torchflower_crop": "Torchflower Crop", "block.minecraft.torchflower_crop": "Torchflower Crop",
@ -3680,6 +3681,7 @@
"gamerule.spawnRadius": "Respawn location radius", "gamerule.spawnRadius": "Respawn location radius",
"gamerule.spawnRadius.description": "Controls the size of the area around the spawn point that players can spawn in.", "gamerule.spawnRadius.description": "Controls the size of the area around the spawn point that players can spawn in.",
"gamerule.spectatorsGenerateChunks": "Allow spectators to generate terrain", "gamerule.spectatorsGenerateChunks": "Allow spectators to generate terrain",
"gamerule.tntExplodes": "Allow TNT to be activated and to explode",
"gamerule.tntExplosionDropDecay": "In TNT explosions, some blocks won't drop their loot", "gamerule.tntExplosionDropDecay": "In TNT explosions, some blocks won't drop their loot",
"gamerule.tntExplosionDropDecay.description": "Some of the drops from blocks destroyed by explosions caused by TNT are lost in the explosion.", "gamerule.tntExplosionDropDecay.description": "Some of the drops from blocks destroyed by explosions caused by TNT are lost in the explosion.",
"gamerule.universalAnger": "Universal anger", "gamerule.universalAnger": "Universal anger",
@ -5212,6 +5214,7 @@
"mount.onboard": "Press %1$s to Dismount", "mount.onboard": "Press %1$s to Dismount",
"multiplayer.applyingPack": "Applying resource pack", "multiplayer.applyingPack": "Applying resource pack",
"multiplayer.disconnect.authservers_down": "Authentication servers are down. Please try again later, sorry!", "multiplayer.disconnect.authservers_down": "Authentication servers are down. Please try again later, sorry!",
"multiplayer.disconnect.bad_chat_index": "Received missed or reordered chat message from server",
"multiplayer.disconnect.banned": "You are banned from this server", "multiplayer.disconnect.banned": "You are banned from this server",
"multiplayer.disconnect.banned_ip.expiration": "\nYour ban will be removed on %s", "multiplayer.disconnect.banned_ip.expiration": "\nYour ban will be removed on %s",
"multiplayer.disconnect.banned_ip.reason": "Your IP address is banned from this server.\nReason: %s", "multiplayer.disconnect.banned_ip.reason": "Your IP address is banned from this server.\nReason: %s",
@ -5926,12 +5929,17 @@
"snbt.parser.expected_hex_numeral": "Expected a hexadecimal number", "snbt.parser.expected_hex_numeral": "Expected a hexadecimal number",
"snbt.parser.expected_integer_type": "Expected an integer number", "snbt.parser.expected_integer_type": "Expected an integer number",
"snbt.parser.expected_non_negative_number": "Expected a non-negative number", "snbt.parser.expected_non_negative_number": "Expected a non-negative number",
"snbt.parser.expected_number_or_boolean": "Expected a number or a boolean",
"snbt.parser.expected_string_uuid": "Expected a string representing a valid UUID",
"snbt.parser.expected_unquoted_string": "Expected a valid unquoted string", "snbt.parser.expected_unquoted_string": "Expected a valid unquoted string",
"snbt.parser.infinity_not_allowed": "Non-finite numbers are not allowed",
"snbt.parser.invalid_array_element_type": "Invalid array element type", "snbt.parser.invalid_array_element_type": "Invalid array element type",
"snbt.parser.invalid_character_name": "Invalid Unicode character name", "snbt.parser.invalid_character_name": "Invalid Unicode character name",
"snbt.parser.invalid_codepoint": "Invalid Unicode character value: %s",
"snbt.parser.invalid_string_contents": "Invalid string contents", "snbt.parser.invalid_string_contents": "Invalid string contents",
"snbt.parser.invalid_unquoted_start": "Unquoted strings can't start with digits 0-9, + or -", "snbt.parser.invalid_unquoted_start": "Unquoted strings can't start with digits 0-9, + or -",
"snbt.parser.leading_zero_not_allowed": "Decimal numbers can't start with 0", "snbt.parser.leading_zero_not_allowed": "Decimal numbers can't start with 0",
"snbt.parser.no_such_operation": "No such operation: %s",
"snbt.parser.number_parse_failure": "Failed to parse number: %s", "snbt.parser.number_parse_failure": "Failed to parse number: %s",
"snbt.parser.undescore_not_allowed": "Underscore characters are not allowed at the start or end of a number", "snbt.parser.undescore_not_allowed": "Underscore characters are not allowed at the start or end of a number",
"soundCategory.ambient": "Ambient/Environment", "soundCategory.ambient": "Ambient/Environment",

View file

@ -2,6 +2,7 @@ use std::sync::Arc;
use azalea_buf::AzBuf; use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::heightmap::HeightmapKind;
use simdnbt::owned::Nbt; use simdnbt::owned::Nbt;
use super::c_light_update::ClientboundLightUpdatePacketData; use super::c_light_update::ClientboundLightUpdatePacketData;
@ -17,7 +18,7 @@ pub struct ClientboundLevelChunkWithLight {
#[derive(Clone, Debug, AzBuf)] #[derive(Clone, Debug, AzBuf)]
pub struct ClientboundLevelChunkPacketData { pub struct ClientboundLevelChunkPacketData {
pub heightmaps: Nbt, pub heightmaps: Vec<(HeightmapKind, Box<[u64]>)>,
/// The raw chunk sections. /// The raw chunk sections.
/// ///
/// We can't parse the data in azalea-protocol because it depends on context /// We can't parse the data in azalea-protocol because it depends on context

View file

@ -11,8 +11,8 @@ use azalea_buf::{AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
use crate::read::ReadPacketError; use crate::read::ReadPacketError;
pub const PROTOCOL_VERSION: i32 = 1073742061; pub const PROTOCOL_VERSION: i32 = 1073742064;
pub const VERSION_NAME: &str = "25w09b"; pub const VERSION_NAME: &str = "1.21.5-pre2";
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ConnectionProtocol { pub enum ConnectionProtocol {

View file

@ -942,6 +942,7 @@ pub static ENDERMAN_HOLDABLE: LazyLock<HashSet<Block>> = LazyLock::new(|| {
Block::WarpedFungus, Block::WarpedFungus,
Block::WarpedNylium, Block::WarpedNylium,
Block::WarpedRoots, Block::WarpedRoots,
Block::CactusFlower,
Block::Dandelion, Block::Dandelion,
Block::OpenEyeblossom, Block::OpenEyeblossom,
Block::Poppy, Block::Poppy,
@ -1726,71 +1727,39 @@ pub static MANGROVE_ROOTS_CAN_GROW_THROUGH: LazyLock<HashSet<Block>> = LazyLock:
pub static MINEABLE_AXE: LazyLock<HashSet<Block>> = LazyLock::new(|| { pub static MINEABLE_AXE: LazyLock<HashSet<Block>> = LazyLock::new(|| {
HashSet::from_iter(vec![ HashSet::from_iter(vec![
Block::NoteBlock, Block::NoteBlock,
Block::AttachedMelonStem,
Block::AttachedPumpkinStem,
Block::Azalea,
Block::Bamboo, Block::Bamboo,
Block::Barrel, Block::Barrel,
Block::BeeNest, Block::BeeNest,
Block::Beehive, Block::Beehive,
Block::Beetroots,
Block::BigDripleafStem, Block::BigDripleafStem,
Block::BigDripleaf, Block::BigDripleaf,
Block::Bookshelf, Block::Bookshelf,
Block::BrownMushroomBlock, Block::BrownMushroomBlock,
Block::BrownMushroom,
Block::Campfire, Block::Campfire,
Block::Carrots,
Block::CartographyTable, Block::CartographyTable,
Block::CarvedPumpkin, Block::CarvedPumpkin,
Block::CaveVinesPlant,
Block::CaveVines,
Block::Chest, Block::Chest,
Block::ChorusFlower, Block::ChorusFlower,
Block::ChorusPlant, Block::ChorusPlant,
Block::Cocoa, Block::Cocoa,
Block::Composter, Block::Composter,
Block::CraftingTable, Block::CraftingTable,
Block::CrimsonFungus,
Block::DaylightDetector, Block::DaylightDetector,
Block::DeadBush,
Block::Fern,
Block::FletchingTable, Block::FletchingTable,
Block::GlowLichen, Block::GlowLichen,
Block::ShortGrass,
Block::HangingRoots,
Block::JackOLantern, Block::JackOLantern,
Block::Jukebox, Block::Jukebox,
Block::Ladder, Block::Ladder,
Block::LargeFern,
Block::Lectern, Block::Lectern,
Block::LilyPad,
Block::Loom, Block::Loom,
Block::MelonStem,
Block::Melon, Block::Melon,
Block::MushroomStem, Block::MushroomStem,
Block::NetherWart,
Block::Potatoes,
Block::PumpkinStem,
Block::Pumpkin, Block::Pumpkin,
Block::RedMushroomBlock, Block::RedMushroomBlock,
Block::RedMushroom,
Block::Scaffolding,
Block::SmallDripleaf,
Block::SmithingTable, Block::SmithingTable,
Block::SoulCampfire, Block::SoulCampfire,
Block::SporeBlossom,
Block::SugarCane,
Block::SweetBerryBush,
Block::TallGrass,
Block::TrappedChest, Block::TrappedChest,
Block::TwistingVinesPlant,
Block::TwistingVines,
Block::Vine, Block::Vine,
Block::WarpedFungus,
Block::WeepingVinesPlant,
Block::WeepingVines,
Block::Wheat,
Block::MangroveRoots, Block::MangroveRoots,
Block::BambooMosaic, Block::BambooMosaic,
Block::BambooMosaicSlab, Block::BambooMosaicSlab,
@ -1853,17 +1822,6 @@ pub static MINEABLE_AXE: LazyLock<HashSet<Block>> = LazyLock::new(|| {
Block::MangrovePlanks, Block::MangrovePlanks,
Block::BambooPlanks, Block::BambooPlanks,
Block::CherryPlanks, Block::CherryPlanks,
Block::OakSapling,
Block::SpruceSapling,
Block::BirchSapling,
Block::JungleSapling,
Block::AcaciaSapling,
Block::DarkOakSapling,
Block::PaleOakSapling,
Block::Azalea,
Block::FloweringAzalea,
Block::MangrovePropagule,
Block::CherrySapling,
Block::OakButton, Block::OakButton,
Block::SpruceButton, Block::SpruceButton,
Block::BirchButton, Block::BirchButton,
@ -2054,16 +2012,6 @@ pub static MINEABLE_HOE: LazyLock<HashSet<Block>> = LazyLock::new(|| {
Block::Shroomlight, Block::Shroomlight,
Block::Sponge, Block::Sponge,
Block::WetSponge, Block::WetSponge,
Block::JungleLeaves,
Block::OakLeaves,
Block::SpruceLeaves,
Block::PaleOakLeaves,
Block::DarkOakLeaves,
Block::AcaciaLeaves,
Block::BirchLeaves,
Block::AzaleaLeaves,
Block::FloweringAzaleaLeaves,
Block::MangroveLeaves,
Block::SculkSensor, Block::SculkSensor,
Block::CalibratedSculkSensor, Block::CalibratedSculkSensor,
Block::MossBlock, Block::MossBlock,
@ -2074,7 +2022,16 @@ pub static MINEABLE_HOE: LazyLock<HashSet<Block>> = LazyLock::new(|| {
Block::SculkCatalyst, Block::SculkCatalyst,
Block::SculkVein, Block::SculkVein,
Block::SculkShrieker, Block::SculkShrieker,
Block::PinkPetals, Block::JungleLeaves,
Block::OakLeaves,
Block::SpruceLeaves,
Block::PaleOakLeaves,
Block::DarkOakLeaves,
Block::AcaciaLeaves,
Block::BirchLeaves,
Block::AzaleaLeaves,
Block::FloweringAzaleaLeaves,
Block::MangroveLeaves,
Block::CherryLeaves, Block::CherryLeaves,
]) ])
}); });
@ -3606,49 +3563,15 @@ pub static STRIDER_WARM_BLOCKS: LazyLock<HashSet<Block>> =
LazyLock::new(|| HashSet::from_iter(vec![Block::Lava])); LazyLock::new(|| HashSet::from_iter(vec![Block::Lava]));
pub static SWORD_EFFICIENT: LazyLock<HashSet<Block>> = LazyLock::new(|| { pub static SWORD_EFFICIENT: LazyLock<HashSet<Block>> = LazyLock::new(|| {
HashSet::from_iter(vec![ HashSet::from_iter(vec![
Block::ShortGrass,
Block::Fern,
Block::DeadBush,
Block::Vine, Block::Vine,
Block::GlowLichen, Block::GlowLichen,
Block::Sunflower,
Block::Lilac,
Block::RoseBush,
Block::Peony,
Block::TallGrass,
Block::LargeFern,
Block::HangingRoots,
Block::PitcherPlant,
Block::BrownMushroom,
Block::RedMushroom,
Block::SugarCane,
Block::Pumpkin, Block::Pumpkin,
Block::CarvedPumpkin, Block::CarvedPumpkin,
Block::JackOLantern, Block::JackOLantern,
Block::Melon, Block::Melon,
Block::AttachedPumpkinStem,
Block::AttachedMelonStem,
Block::LilyPad,
Block::Cocoa, Block::Cocoa,
Block::PitcherCrop,
Block::SweetBerryBush,
Block::CaveVines,
Block::CaveVinesPlant,
Block::SporeBlossom,
Block::PinkPetals,
Block::BigDripleaf, Block::BigDripleaf,
Block::BigDripleafStem, Block::BigDripleafStem,
Block::SmallDripleaf,
Block::NetherWart,
Block::WarpedFungus,
Block::WarpedRoots,
Block::NetherSprouts,
Block::CrimsonFungus,
Block::WeepingVines,
Block::WeepingVinesPlant,
Block::TwistingVines,
Block::TwistingVinesPlant,
Block::CrimsonRoots,
Block::ChorusPlant, Block::ChorusPlant,
Block::ChorusFlower, Block::ChorusFlower,
Block::JungleLeaves, Block::JungleLeaves,
@ -3662,25 +3585,6 @@ pub static SWORD_EFFICIENT: LazyLock<HashSet<Block>> = LazyLock::new(|| {
Block::FloweringAzaleaLeaves, Block::FloweringAzaleaLeaves,
Block::MangroveLeaves, Block::MangroveLeaves,
Block::CherryLeaves, Block::CherryLeaves,
Block::OakSapling,
Block::SpruceSapling,
Block::BirchSapling,
Block::JungleSapling,
Block::AcaciaSapling,
Block::DarkOakSapling,
Block::PaleOakSapling,
Block::Azalea,
Block::FloweringAzalea,
Block::MangrovePropagule,
Block::CherrySapling,
Block::Beetroots,
Block::Carrots,
Block::Potatoes,
Block::Wheat,
Block::MelonStem,
Block::PumpkinStem,
Block::TorchflowerCrop,
Block::PitcherCrop,
]) ])
}); });
pub static SWORD_INSTANTLY_MINES: LazyLock<HashSet<Block>> = pub static SWORD_INSTANTLY_MINES: LazyLock<HashSet<Block>> =

View file

@ -991,6 +991,40 @@ pub static FISHES: LazyLock<HashSet<Item>> = LazyLock::new(|| {
Item::TropicalFish, Item::TropicalFish,
]) ])
}); });
pub static FLOWERS: LazyLock<HashSet<Item>> = LazyLock::new(|| {
HashSet::from_iter(vec![
Item::Sunflower,
Item::Lilac,
Item::Peony,
Item::RoseBush,
Item::PitcherPlant,
Item::FloweringAzaleaLeaves,
Item::FloweringAzalea,
Item::MangrovePropagule,
Item::CherryLeaves,
Item::PinkPetals,
Item::Wildflowers,
Item::ChorusFlower,
Item::SporeBlossom,
Item::CactusFlower,
Item::Dandelion,
Item::OpenEyeblossom,
Item::Poppy,
Item::BlueOrchid,
Item::Allium,
Item::AzureBluet,
Item::RedTulip,
Item::OrangeTulip,
Item::WhiteTulip,
Item::PinkTulip,
Item::OxeyeDaisy,
Item::Cornflower,
Item::LilyOfTheValley,
Item::WitherRose,
Item::Torchflower,
Item::ClosedEyeblossom,
])
});
pub static FOOT_ARMOR: LazyLock<HashSet<Item>> = LazyLock::new(|| { pub static FOOT_ARMOR: LazyLock<HashSet<Item>> = LazyLock::new(|| {
HashSet::from_iter(vec![ HashSet::from_iter(vec![
Item::LeatherBoots, Item::LeatherBoots,

View file

@ -1,5 +1,4 @@
use std::collections::hash_map::Entry; use std::collections::hash_map::Entry;
use std::str::FromStr;
use std::{ use std::{
collections::HashMap, collections::HashMap,
fmt::Debug, fmt::Debug,
@ -13,7 +12,6 @@ use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError};
use azalea_core::position::{BlockPos, ChunkBlockPos, ChunkPos, ChunkSectionBlockPos}; use azalea_core::position::{BlockPos, ChunkBlockPos, ChunkPos, ChunkSectionBlockPos};
use nohash_hasher::IntMap; use nohash_hasher::IntMap;
use parking_lot::RwLock; use parking_lot::RwLock;
use simdnbt::owned::NbtCompound;
use tracing::{debug, trace, warn}; use tracing::{debug, trace, warn};
use crate::heightmap::Heightmap; use crate::heightmap::Heightmap;
@ -177,7 +175,7 @@ impl PartialChunkStorage {
&mut self, &mut self,
pos: &ChunkPos, pos: &ChunkPos,
data: &mut Cursor<&[u8]>, data: &mut Cursor<&[u8]>,
heightmaps: &NbtCompound, heightmaps: &[(HeightmapKind, Box<[u64]>)],
chunk_storage: &mut ChunkStorage, chunk_storage: &mut ChunkStorage,
) -> Result<(), BufReadError> { ) -> Result<(), BufReadError> {
debug!("Replacing chunk at {:?}", pos); debug!("Replacing chunk at {:?}", pos);
@ -333,7 +331,7 @@ impl Chunk {
buf: &mut Cursor<&[u8]>, buf: &mut Cursor<&[u8]>,
dimension_height: u32, dimension_height: u32,
min_y: i32, min_y: i32,
heightmaps_nbt: &NbtCompound, heightmaps_data: &[(HeightmapKind, Box<[u64]>)],
) -> Result<Self, BufReadError> { ) -> Result<Self, BufReadError> {
let section_count = dimension_height / SECTION_HEIGHT; let section_count = dimension_height / SECTION_HEIGHT;
let mut sections = Vec::with_capacity(section_count as usize); let mut sections = Vec::with_capacity(section_count as usize);
@ -344,18 +342,10 @@ impl Chunk {
let sections = sections.into_boxed_slice(); let sections = sections.into_boxed_slice();
let mut heightmaps = HashMap::new(); let mut heightmaps = HashMap::new();
for (name, heightmap) in heightmaps_nbt.iter() { for (kind, data) in heightmaps_data {
let Ok(kind) = HeightmapKind::from_str(&name.to_str()) else {
warn!("Unknown heightmap kind: {name}");
continue;
};
let Some(data) = heightmap.long_array() else {
warn!("Heightmap {name} is not a long array");
continue;
};
let data: Box<[u64]> = data.iter().map(|x| *x as u64).collect(); let data: Box<[u64]> = data.iter().map(|x| *x as u64).collect();
let heightmap = Heightmap::new(kind, dimension_height, min_y, data); let heightmap = Heightmap::new(*kind, dimension_height, min_y, data);
heightmaps.insert(kind, heightmap); heightmaps.insert(*kind, heightmap);
} }
Ok(Chunk { Ok(Chunk {
@ -449,7 +439,7 @@ impl AzaleaRead for Section {
let block_count = u16::azalea_read(buf)?; let block_count = u16::azalea_read(buf)?;
// this is commented out because the vanilla server is wrong // this is commented out because the vanilla server is wrong
// ^ this comment was written ages ago. needs more investigation. // TODO: ^ this comment was written ages ago. needs more investigation.
// assert!( // assert!(
// block_count <= 16 * 16 * 16, // block_count <= 16 * 16 * 16,
// "A section has more blocks than what should be possible. This is a bug!" // "A section has more blocks than what should be possible. This is a bug!"

View file

@ -1,6 +1,7 @@
use std::{fmt::Display, str::FromStr}; use std::{fmt::Display, str::FromStr};
use azalea_block::BlockState; use azalea_block::BlockState;
use azalea_buf::AzBuf;
use azalea_core::{math, position::ChunkBlockPos}; use azalea_core::{math, position::ChunkBlockPos};
use azalea_registry::tags::blocks::LEAVES; use azalea_registry::tags::blocks::LEAVES;
@ -8,7 +9,7 @@ use crate::{BitStorage, Section, chunk_storage::get_block_state_from_sections};
// (wg stands for worldgen) // (wg stands for worldgen)
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)] #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, AzBuf)]
pub enum HeightmapKind { pub enum HeightmapKind {
WorldSurfaceWg, WorldSurfaceWg,
WorldSurface, WorldSurface,

View file

@ -2,7 +2,6 @@ use std::io::{Cursor, Write};
use azalea_block::block_state::BlockStateIntegerRepr; use azalea_block::block_state::BlockStateIntegerRepr;
use azalea_buf::{AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; use azalea_buf::{AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
use azalea_core::math;
use tracing::warn; use tracing::warn;
use crate::BitStorage; use crate::BitStorage;
@ -45,37 +44,15 @@ impl PalettedContainer {
buf: &mut Cursor<&[u8]>, buf: &mut Cursor<&[u8]>,
container_type: &'static PalettedContainerKind, container_type: &'static PalettedContainerKind,
) -> Result<Self, BufReadError> { ) -> Result<Self, BufReadError> {
let server_bits_per_entry = u8::azalea_read(buf)?; let bits_per_entry = u8::azalea_read(buf)?;
let palette_type = PaletteKind::from_bits_and_type(server_bits_per_entry, container_type); let palette_type = PaletteKind::from_bits_and_type(bits_per_entry, container_type);
let palette = palette_type.read(buf)?; let palette = palette_type.read(buf)?;
let size = container_type.size(); let size = container_type.size();
let data = Box::<[u64]>::azalea_read(buf)?;
// we can only trust the bits per entry that we're sent if there's enough data
// that it'd be global. if it's not global, then we have to calculate it
// ourselves.
// this almost never matters, except on some custom servers like hypixel limbo
// TODO: this is incorrect. we should be getting the log2 of the max blockstate
// or biome instead of data.len(). this code might be causing wrong data to be
// read. ¯\_(ツ)_/¯
let calculated_bits_per_entry = math::ceil_log2(data.len() as u32) as u8;
let calculated_bits_per_entry_palette_kind =
PaletteKind::from_bits_and_type(calculated_bits_per_entry, container_type);
let bits_per_entry = if calculated_bits_per_entry_palette_kind == PaletteKind::Global {
server_bits_per_entry
} else {
calculated_bits_per_entry
};
debug_assert!(
bits_per_entry != 0 || data.is_empty(),
"Bits per entry is 0 but data is not empty."
);
let mut storage = match BitStorage::new( let mut storage = match BitStorage::new(
bits_per_entry.into(), bits_per_entry as usize,
size, size,
if data.is_empty() { if bits_per_entry == 0 {
Some(Box::new([])) Some(Box::new([]))
} else { } else {
// we're going to update the data after creating the bitstorage // we're going to update the data after creating the bitstorage
@ -90,9 +67,11 @@ impl PalettedContainer {
)); ));
} }
}; };
// minecraft does this to allow the data to have extra padding bits. most
// servers don't use this, but it's notably used by hypixel. // now read the data
storage.data = data; for i in 0..storage.data.len() {
storage.data[i] = u64::azalea_read(buf)?;
}
Ok(PalettedContainer { Ok(PalettedContainer {
bits_per_entry, bits_per_entry,

View file

@ -49,7 +49,7 @@ new_block_states_report = lib.extract.get_block_states_report(new_version_id)
new_registries = lib.extract.get_registries_report(new_version_id) new_registries = lib.extract.get_registries_report(new_version_id)
new_ordered_blocks = lib.code.blocks.get_ordered_blocks(new_registries) new_ordered_blocks = lib.code.blocks.get_ordered_blocks(new_registries)
lib.code.blocks.generate_blocks( lib.code.blocks.generate_blocks(
new_block_states_report, new_pixlyzer_block_datas, new_ordered_blocks) new_block_states_report, new_pixlyzer_block_datas, new_ordered_blocks, new_burger_data)
lib.code.shapes.generate_block_shapes( lib.code.shapes.generate_block_shapes(
new_pixlyzer_block_datas, new_shape_datas['shapes'], new_shape_datas['aabbs'], new_block_states_report) new_pixlyzer_block_datas, new_shape_datas['shapes'], new_shape_datas['aabbs'], new_block_states_report)