1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00
This commit is contained in:
mat 2023-03-14 18:12:46 -05:00
commit f8c143725e
33 changed files with 13181 additions and 11503 deletions

View file

@ -9,7 +9,7 @@ A collection of Rust crates for making Minecraft bots, clients, and tools.
</p>
<!-- The line below is automatically read and updated by the migrate script, so don't change it manually. -->
*Currently supported Minecraft version: `1.19.3`.*
*Currently supported Minecraft version: `1.19.4`.*
## ⚠️ Azalea is still very unfinished, though most crates are in a somewhat useable state
@ -45,5 +45,11 @@ Also it's named Azalea because it sounds like a cool word and this is a cool lib
## Stretch goals
- Server implementation. (if you're interested in making this then please contact me, I'd love for it to be a thing. [@mat:matdoes.dev](https://matrix.to/#/@mat:matdoes.dev) / mat#1592)
- Having branches for several popular Minecraft versions.
- Server implementation.
## Branches
There are several branches in the Azalea repository that target older Minecraft versions. It is not guaranteed that they will be up-to-date with the latest version of Azalea. If you'd like to update them or add more, please open a PR.
- [1.19.3](https://github.com/mat-1/azalea/tree/1.19.3)
- [1.19.2](https://github.com/mat-1/azalea/tree/1.19.2)

View file

@ -25,6 +25,10 @@ make_block_states! {
_0,
_1,
},
"stage" => CherrySaplingStage {
_0,
_1,
},
"stage" => DarkOakSaplingStage {
_0,
_1,
@ -78,6 +82,12 @@ make_block_states! {
_14,
_15,
},
"dusted" => SuspiciousSandDusted {
_0,
_1,
_2,
_3,
},
"axis" => Axis {
X,
Y,
@ -129,6 +139,15 @@ make_block_states! {
_6,
_7,
},
"distance" => CherryLeavesDistance {
_1,
_2,
_3,
_4,
_5,
_6,
_7,
},
"distance" => DarkOakLeavesDistance {
_1,
_2,
@ -433,6 +452,24 @@ make_block_states! {
_14,
_15,
},
"rotation" => CherrySignRotation {
_0,
_1,
_2,
_3,
_4,
_5,
_6,
_7,
_8,
_9,
_10,
_11,
_12,
_13,
_14,
_15,
},
"rotation" => JungleSignRotation {
_0,
_1,
@ -595,6 +632,24 @@ make_block_states! {
_14,
_15,
},
"rotation" => CherryHangingSignRotation {
_0,
_1,
_2,
_3,
_4,
_5,
_6,
_7,
_8,
_9,
_10,
_11,
_12,
_13,
_14,
_15,
},
"rotation" => JungleHangingSignRotation {
_0,
_1,
@ -1379,6 +1434,11 @@ make_block_states! {
_4,
_5,
},
"age" => TorchflowerCropAge {
_0,
_1,
_2,
},
"age" => BeetrootsAge {
_0,
_1,
@ -1809,6 +1869,12 @@ make_block_states! {
_25,
},
"berries" => bool,
"flower_amount" => PinkPetalsAmount {
_1,
_2,
_3,
_4,
},
"tilt" => Tilt {
None,
Unstable,
@ -1844,6 +1910,7 @@ make_block_states! {
birch_planks => BlockBehavior::default(), {},
jungle_planks => BlockBehavior::default(), {},
acacia_planks => BlockBehavior::default(), {},
cherry_planks => BlockBehavior::default(), {},
dark_oak_planks => BlockBehavior::default(), {},
mangrove_planks => BlockBehavior::default(), {},
bamboo_planks => BlockBehavior::default(), {},
@ -1863,6 +1930,9 @@ make_block_states! {
acacia_sapling => BlockBehavior::default(), {
stage: AcaciaSaplingStage::_0,
},
cherry_sapling => BlockBehavior::default(), {
stage: CherrySaplingStage::_0,
},
dark_oak_sapling => BlockBehavior::default(), {
stage: DarkOakSaplingStage::_0,
},
@ -1880,6 +1950,9 @@ make_block_states! {
level: LavaLevel::_0,
},
sand => BlockBehavior::default(), {},
suspicious_sand => BlockBehavior::default(), {
dusted: SuspiciousSandDusted::_0,
},
red_sand => BlockBehavior::default(), {},
gravel => BlockBehavior::default(), {},
gold_ore => BlockBehavior::default(), {},
@ -1904,6 +1977,9 @@ make_block_states! {
acacia_log => BlockBehavior::default(), {
axis: Axis::Y,
},
cherry_log => BlockBehavior::default(), {
axis: Axis::Y,
},
dark_oak_log => BlockBehavior::default(), {
axis: Axis::Y,
},
@ -1931,6 +2007,9 @@ make_block_states! {
stripped_acacia_log => BlockBehavior::default(), {
axis: Axis::Y,
},
stripped_cherry_log => BlockBehavior::default(), {
axis: Axis::Y,
},
stripped_dark_oak_log => BlockBehavior::default(), {
axis: Axis::Y,
},
@ -1958,6 +2037,9 @@ make_block_states! {
acacia_wood => BlockBehavior::default(), {
axis: Axis::Y,
},
cherry_wood => BlockBehavior::default(), {
axis: Axis::Y,
},
dark_oak_wood => BlockBehavior::default(), {
axis: Axis::Y,
},
@ -1979,6 +2061,9 @@ make_block_states! {
stripped_acacia_wood => BlockBehavior::default(), {
axis: Axis::Y,
},
stripped_cherry_wood => BlockBehavior::default(), {
axis: Axis::Y,
},
stripped_dark_oak_wood => BlockBehavior::default(), {
axis: Axis::Y,
},
@ -2010,6 +2095,11 @@ make_block_states! {
persistent: false,
waterlogged: false,
},
cherry_leaves => BlockBehavior::default(), {
distance: CherryLeavesDistance::_7,
persistent: false,
waterlogged: false,
},
dark_oak_leaves => BlockBehavior::default(), {
distance: DarkOakLeavesDistance::_7,
persistent: false,
@ -2180,6 +2270,7 @@ make_block_states! {
facing: FacingCubic::North,
},
dandelion => BlockBehavior::default(), {},
torchflower => BlockBehavior::default(), {},
poppy => BlockBehavior::default(), {},
blue_orchid => BlockBehavior::default(), {},
allium => BlockBehavior::default(), {},
@ -2274,6 +2365,10 @@ make_block_states! {
rotation: AcaciaSignRotation::_0,
waterlogged: false,
},
cherry_sign => BlockBehavior::default(), {
rotation: CherrySignRotation::_0,
waterlogged: false,
},
jungle_sign => BlockBehavior::default(), {
rotation: JungleSignRotation::_0,
waterlogged: false,
@ -2327,6 +2422,10 @@ make_block_states! {
facing: FacingCardinal::North,
waterlogged: false,
},
cherry_wall_sign => BlockBehavior::default(), {
facing: FacingCardinal::North,
waterlogged: false,
},
jungle_wall_sign => BlockBehavior::default(), {
facing: FacingCardinal::North,
waterlogged: false,
@ -2363,6 +2462,11 @@ make_block_states! {
rotation: AcaciaHangingSignRotation::_0,
waterlogged: false,
},
cherry_hanging_sign => BlockBehavior::default(), {
attached: false,
rotation: CherryHangingSignRotation::_0,
waterlogged: false,
},
jungle_hanging_sign => BlockBehavior::default(), {
attached: false,
rotation: JungleHangingSignRotation::_0,
@ -2409,6 +2513,10 @@ make_block_states! {
facing: FacingCardinal::North,
waterlogged: false,
},
cherry_wall_hanging_sign => BlockBehavior::default(), {
facing: FacingCardinal::North,
waterlogged: false,
},
jungle_wall_hanging_sign => BlockBehavior::default(), {
facing: FacingCardinal::North,
waterlogged: false,
@ -2463,6 +2571,9 @@ make_block_states! {
acacia_pressure_plate => BlockBehavior::default(), {
powered: false,
},
cherry_pressure_plate => BlockBehavior::default(), {
powered: false,
},
dark_oak_pressure_plate => BlockBehavior::default(), {
powered: false,
},
@ -2596,6 +2707,13 @@ make_block_states! {
powered: false,
waterlogged: false,
},
cherry_trapdoor => BlockBehavior::default(), {
facing: FacingCardinal::North,
half: TopBottom::Bottom,
open: false,
powered: false,
waterlogged: false,
},
dark_oak_trapdoor => BlockBehavior::default(), {
facing: FacingCardinal::North,
half: TopBottom::Bottom,
@ -2840,11 +2958,13 @@ make_block_states! {
west: WestWall::None,
},
flower_pot => BlockBehavior::default(), {},
potted_torchflower => BlockBehavior::default(), {},
potted_oak_sapling => BlockBehavior::default(), {},
potted_spruce_sapling => BlockBehavior::default(), {},
potted_birch_sapling => BlockBehavior::default(), {},
potted_jungle_sapling => BlockBehavior::default(), {},
potted_acacia_sapling => BlockBehavior::default(), {},
potted_cherry_sapling => BlockBehavior::default(), {},
potted_dark_oak_sapling => BlockBehavior::default(), {},
potted_mangrove_propagule => BlockBehavior::default(), {},
potted_fern => BlockBehavior::default(), {},
@ -2896,6 +3016,11 @@ make_block_states! {
facing: FacingCardinal::North,
powered: false,
},
cherry_button => BlockBehavior::default(), {
face: Face::Wall,
facing: FacingCardinal::North,
powered: false,
},
dark_oak_button => BlockBehavior::default(), {
face: Face::Wall,
facing: FacingCardinal::North,
@ -3142,6 +3267,12 @@ make_block_states! {
shape: StairShape::Straight,
waterlogged: false,
},
cherry_stairs => BlockBehavior::default(), {
facing: FacingCardinal::North,
half: TopBottom::Bottom,
shape: StairShape::Straight,
waterlogged: false,
},
dark_oak_stairs => BlockBehavior::default(), {
facing: FacingCardinal::North,
half: TopBottom::Bottom,
@ -3378,6 +3509,10 @@ make_block_states! {
kind: Type::Bottom,
waterlogged: false,
},
cherry_slab => BlockBehavior::default(), {
kind: Type::Bottom,
waterlogged: false,
},
dark_oak_slab => BlockBehavior::default(), {
kind: Type::Bottom,
waterlogged: false,
@ -3478,6 +3613,12 @@ make_block_states! {
open: false,
powered: false,
},
cherry_fence_gate => BlockBehavior::default(), {
facing: FacingCardinal::North,
in_wall: false,
open: false,
powered: false,
},
dark_oak_fence_gate => BlockBehavior::default(), {
facing: FacingCardinal::North,
in_wall: false,
@ -3524,6 +3665,13 @@ make_block_states! {
waterlogged: false,
west: false,
},
cherry_fence => BlockBehavior::default(), {
east: false,
north: false,
south: false,
waterlogged: false,
west: false,
},
dark_oak_fence => BlockBehavior::default(), {
east: false,
north: false,
@ -3573,6 +3721,13 @@ make_block_states! {
open: false,
powered: false,
},
cherry_door => BlockBehavior::default(), {
facing: FacingCardinal::North,
half: Half::Lower,
hinge: Hinge::Left,
open: false,
powered: false,
},
dark_oak_door => BlockBehavior::default(), {
facing: FacingCardinal::North,
half: Half::Lower,
@ -3619,6 +3774,9 @@ make_block_states! {
waterlogged: false,
},
end_stone_bricks => BlockBehavior::default(), {},
torchflower_crop => BlockBehavior::default(), {
age: TorchflowerCropAge::_0,
},
beetroots => BlockBehavior::default(), {
age: BeetrootsAge::_0,
},
@ -4773,6 +4931,10 @@ make_block_states! {
azalea => BlockBehavior::default(), {},
flowering_azalea => BlockBehavior::default(), {},
moss_carpet => BlockBehavior::default(), {},
pink_petals => BlockBehavior::default(), {
facing: FacingCardinal::North,
flower_amount: PinkPetalsAmount::_1,
},
moss_block => BlockBehavior::default(), {},
big_dripleaf => BlockBehavior::default(), {
facing: FacingCardinal::North,
@ -4895,5 +5057,9 @@ make_block_states! {
},
frogspawn => BlockBehavior::default(), {},
reinforced_deepslate => BlockBehavior::default(), {},
decorated_pot => BlockBehavior::default(), {
facing: FacingCardinal::North,
waterlogged: false,
},
}
}

View file

@ -489,6 +489,10 @@ fn process_packet_events(ecs: &mut World) {
partial_world.chunks.view_center = ChunkPos::new(p.x, p.z);
}
ClientboundGamePacket::ChunksBiomes(_) => {}
ClientboundGamePacket::LightUpdate(_p) => {
// debug!("Got light update packet {:?}", p);
}
ClientboundGamePacket::LevelChunkWithLight(p) => {
debug!("Got chunk with light packet {} {}", p.x, p.z);
let pos = ChunkPos::new(p.x, p.z);
@ -536,9 +540,6 @@ fn process_packet_events(ecs: &mut World) {
error!("Couldn't set chunk data: {}", e);
}
}
ClientboundGamePacket::LightUpdate(_p) => {
// debug!("Got light update packet {:?}", p);
}
ClientboundGamePacket::AddEntity(p) => {
debug!("Got add entity packet {:?}", p);
@ -1023,6 +1024,7 @@ fn process_packet_events(ecs: &mut World) {
system_state.apply(ecs);
}
ClientboundGamePacket::SelectAdvancementsTab(_) => {}
ClientboundGamePacket::SetActionBarText(_) => {}
ClientboundGamePacket::SetBorderCenter(_) => {}
@ -1047,6 +1049,9 @@ fn process_packet_events(ecs: &mut World) {
ClientboundGamePacket::TakeItemEntity(_) => {}
ClientboundGamePacket::DisguisedChat(_) => {}
ClientboundGamePacket::UpdateEnabledFeatures(_) => {}
ClientboundGamePacket::Bundle(_) => {}
ClientboundGamePacket::DamageEvent(_) => {}
ClientboundGamePacket::HurtAnimation(_) => {}
}
}
}

View file

@ -169,7 +169,7 @@ impl BlockPos {
/// Chunk coordinates are used to represent where a chunk is in the world. You
/// can convert the x and z to block coordinates by multiplying them by 16.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, McBuf)]
pub struct ChunkPos {
pub x: i32,
pub z: i32,

View file

@ -137,11 +137,17 @@ declare_menus! {
ShulkerBox {
contents: 27,
},
Smithing {
LegacySmithing {
input: 1,
additional: 1,
result: 1,
},
Smithing {
template: 1,
base: 1,
additional: 1,
result: 1,
},
Smoker {
ingredient: 1,
fuel: 1,

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -49,7 +49,6 @@ const PROXY_PLAYERS: Players = Players {
sample: Vec::new(),
};
const PROXY_PREVIEWS_CHAT: Option<bool> = Some(false);
const PROXY_SECURE_CHAT: Option<bool> = Some(false);
#[tokio::main]
@ -108,7 +107,6 @@ async fn handle_connection(stream: TcpStream) -> anyhow::Result<()> {
favicon: PROXY_FAVICON.clone(),
players: PROXY_PLAYERS.clone(),
version: PROXY_VERSION.clone(),
previews_chat: PROXY_PREVIEWS_CHAT,
enforces_secure_chat: PROXY_SECURE_CHAT,
}
.get(),

View file

@ -0,0 +1,5 @@
use azalea_buf::McBuf;
use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundBundlePacket {}

View file

@ -1,7 +1,14 @@
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_buf::McBuf;
use azalea_core::ChunkPos;
use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundChunksBiomesPacket {
pub chunk_biome_data: todo!(),
}
pub chunk_biome_data: Vec<ChunkBiomeData>,
}
#[derive(Clone, Debug, McBuf)]
pub struct ChunkBiomeData {
pub pos: ChunkPos,
pub buffer: Vec<u8>,
}

View file

@ -1,13 +1,10 @@
use azalea_buf::BufReadError;
use azalea_buf::McBuf;
use azalea_buf::McBufVarReadable;
use azalea_buf::{McBufReadable, McBufVarWritable, McBufWritable};
use azalea_core::FixedBitSet;
use azalea_core::ResourceLocation;
use azalea_buf::{
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
};
use azalea_core::{FixedBitSet, ResourceLocation};
use azalea_protocol_macros::ClientboundGamePacket;
use log::warn;
use std::io::Cursor;
use std::io::Write;
use std::io::{Cursor, Write};
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundCommandsPacket {
@ -137,13 +134,14 @@ pub enum BrigadierParser {
FloatRange,
Dimension,
GameMode,
Time,
Time { min: i32 },
ResourceOrTag { registry_key: ResourceLocation },
ResourceOrTagKey { registry_key: ResourceLocation },
Resource { registry_key: ResourceLocation },
ResourceKey { registry_key: ResourceLocation },
TemplateMirror,
TemplateRotation,
Heightmap,
Uuid,
}

View file

@ -0,0 +1,28 @@
use azalea_buf::McBuf;
use azalea_core::ResourceLocation;
use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundCustomSoundPacket {
pub name: ResourceLocation,
pub source: SoundSource,
pub x: i32,
pub y: i32,
pub z: i32,
pub volume: f32,
pub pitch: f32,
}
#[derive(McBuf, Clone, Copy, Debug)]
pub enum SoundSource {
Master = 0,
Music = 1,
Records = 2,
Weather = 3,
Blocks = 4,
Hostile = 5,
Neutral = 6,
Players = 7,
Ambient = 8,
Voice = 9,
}

View file

@ -0,0 +1,30 @@
use std::io::{Cursor, Write};
use azalea_buf::{McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
use azalea_core::Vec3;
use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundDamageEventPacket {
#[var]
pub entity_id: u32,
#[var]
pub source_type_id: u32,
pub source_cause_id: OptionalEntityId,
pub source_direct_id: OptionalEntityId,
pub source_position: Option<Vec3>,
}
#[derive(Clone, Debug)]
pub struct OptionalEntityId(pub u32);
impl McBufReadable for OptionalEntityId {
fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, azalea_buf::BufReadError> {
Ok(OptionalEntityId(u32::var_read_from(buf)? - 1))
}
}
impl McBufWritable for OptionalEntityId {
fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
(self.0 + 1).var_write_into(buf)?;
Ok(())
}
}

View file

@ -0,0 +1,9 @@
use azalea_buf::McBuf;
use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundHurtAnimationPacket {
#[var]
pub id: u32,
pub yaw: f32,
}

View file

@ -95,10 +95,16 @@ pub mod registry {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))]
pub struct RegistryRoot {
#[cfg(feature = "strict_registry")]
#[serde(rename = "minecraft:trim_material")]
pub trim_material: RegistryType<TrimMaterialElement>,
#[cfg(not(feature = "strict_registry"))]
#[serde(rename = "minecraft:trim_material")]
pub trim_material: Tag,
#[cfg(feature = "strict_registry")]
#[serde(rename = "minecraft:chat_type")]
pub chat_type: RegistryType<ChatTypeElement>,
#[cfg(not(feature = "strict_registry"))]
#[serde(rename = "minecraft:chat_type")]
pub chat_type: Tag,
@ -109,10 +115,23 @@ pub mod registry {
#[cfg(feature = "strict_registry")]
#[serde(rename = "minecraft:worldgen/biome")]
pub world_type: RegistryType<WorldTypeElement>,
#[cfg(not(feature = "strict_registry"))]
#[serde(rename = "minecraft:worldgen/biome")]
pub world_type: Tag,
#[cfg(feature = "strict_registry")]
#[serde(rename = "minecraft:trim_pattern")]
pub trim_pattern: RegistryType<TrimPatternElement>,
#[cfg(not(feature = "strict_registry"))]
#[serde(rename = "minecraft:trim_pattern")]
pub trim_pattern: Tag,
#[cfg(feature = "strict_registry")]
#[serde(rename = "minecraft:damage_type")]
pub damage_type: RegistryType<DamageTypeElement>,
#[cfg(not(feature = "strict_registry"))]
#[serde(rename = "minecraft:damage_type")]
pub damage_type: Tag,
}
/// A collection of values for a certain type of registry data.
@ -133,6 +152,18 @@ pub mod registry {
pub element: T,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))]
pub struct TrimMaterialElement {
pub asset_name: String,
pub ingredient: ResourceLocation,
pub item_model_index: f32,
pub override_armor_materials: HashMap<String, String>,
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
}
/// Data about a kind of chat message
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))]
@ -259,12 +290,13 @@ pub mod registry {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))]
pub struct WorldTypeElement {
#[serde(with = "Convert")]
pub has_precipitation: bool,
pub temperature: f32,
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub temperature_modifier: Option<String>,
pub downfall: f32,
pub precipitation: BiomePrecipitation,
pub effects: BiomeEffects,
}
@ -309,7 +341,7 @@ pub mod registry {
pub additions_sound: Option<AdditionsSound>,
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub ambient_sound: Option<SoundId>,
pub ambient_sound: Option<ResourceLocation>,
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub particle: Option<BiomeParticle>,
@ -325,7 +357,7 @@ pub mod registry {
pub replace_current_music: bool,
pub max_delay: u32,
pub min_delay: u32,
pub sound: SoundId,
pub sound: azalea_registry::SoundEvent,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -334,21 +366,14 @@ pub mod registry {
pub tick_delay: u32,
pub block_search_extent: u32,
pub offset: f32,
pub sound: SoundId,
pub sound: azalea_registry::SoundEvent,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))]
pub struct AdditionsSound {
pub tick_chance: f32,
pub sound: SoundId,
}
/// The ID of a sound.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))]
pub struct SoundId {
pub sound_id: azalea_registry::SoundEvent,
pub sound: azalea_registry::SoundEvent,
}
/// Biome particles.
@ -361,6 +386,27 @@ pub mod registry {
pub options: HashMap<String, String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))]
pub struct TrimPatternElement {
#[serde(flatten)]
pub pattern: HashMap<String, String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "strict_registry", serde(deny_unknown_fields))]
pub struct DamageTypeElement {
pub message_id: String,
pub scaling: String,
pub exhaustion: f32,
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub effects: Option<String>,
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub death_message_type: Option<String>,
}
// Using a trait because you can't implement methods for
// types you don't own, in this case Option<bool> and bool.
trait Convert: Sized {
@ -443,12 +489,15 @@ mod tests {
// This is just for testing.
let registry = RegistryHolder {
root: RegistryRoot {
trim_material: Tag::End,
chat_type: Tag::End,
dimension_type: RegistryType::<DimensionTypeElement> {
kind: ResourceLocation::new("minecraft:dimension_type"),
value: Vec::new(),
},
world_type: Tag::End,
trim_pattern: Tag::End,
damage_type: Tag::End,
},
};

View file

@ -1,8 +1,8 @@
use azalea_buf::{BufReadError, McBuf};
use azalea_buf::{McBufReadable, McBufWritable};
use std::io::{Cursor, Write};
use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable};
use azalea_core::FixedBitSet;
use azalea_protocol_macros::ClientboundGamePacket;
use std::io::{Cursor, Write};
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundPlayerPositionPacket {
@ -11,16 +11,13 @@ pub struct ClientboundPlayerPositionPacket {
pub z: f64,
pub y_rot: f32,
pub x_rot: f32,
pub relative_arguments: RelativeArguments,
/// Client should confirm this packet with Teleport Confirm containing the
/// same Teleport ID.
pub relative_arguments: RelativeMovements,
#[var]
pub id: u32,
pub dismount_vehicle: bool,
}
#[derive(Debug, Clone)]
pub struct RelativeArguments {
pub struct RelativeMovements {
pub x: bool,
pub y: bool,
pub z: bool,
@ -28,10 +25,10 @@ pub struct RelativeArguments {
pub x_rot: bool,
}
impl McBufReadable for RelativeArguments {
impl McBufReadable for RelativeMovements {
fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
let set = FixedBitSet::<5>::read_from(buf)?;
Ok(RelativeArguments {
Ok(RelativeMovements {
x: set.index(0),
y: set.index(1),
z: set.index(2),
@ -41,7 +38,7 @@ impl McBufReadable for RelativeArguments {
}
}
impl McBufWritable for RelativeArguments {
impl McBufWritable for RelativeMovements {
fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
let mut set = FixedBitSet::<5>::new();
if self.x {

View file

@ -4,7 +4,7 @@ use azalea_protocol_macros::ClientboundGamePacket;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundServerDataPacket {
pub motd: Option<FormattedText>,
pub icon_base64: Option<String>,
pub motd: FormattedText,
pub icon_bytes: Option<Vec<u8>>,
pub enforces_secure_chat: bool,
}

View file

@ -4,7 +4,10 @@ use azalea_buf::{
use azalea_core::ResourceLocation;
use azalea_inventory::ItemSlot;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_registry::RecipeSerializer;
use std::io::{Cursor, Write};
use std::str::FromStr;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundUpdateRecipesPacket {
@ -34,6 +37,7 @@ pub struct ShapedRecipe {
pub category: CraftingBookCategory,
pub ingredients: Vec<Ingredient>,
pub result: ItemSlot,
pub show_notification: bool,
}
#[derive(Clone, Debug, Copy, McBuf)]
@ -69,6 +73,7 @@ impl McBufReadable for ShapedRecipe {
ingredients.push(Ingredient::read_from(buf)?);
}
let result = ItemSlot::read_from(buf)?;
let show_notification = bool::read_from(buf)?;
Ok(ShapedRecipe {
width,
@ -77,6 +82,7 @@ impl McBufReadable for ShapedRecipe {
category,
ingredients,
result,
show_notification,
})
}
}
@ -109,10 +115,25 @@ pub struct SimpleRecipe {
pub category: CraftingBookCategory,
}
#[derive(Clone, Debug, McBuf)]
pub struct SmithingTransformRecipe {
pub template: Ingredient,
pub base: Ingredient,
pub addition: Ingredient,
pub result: ItemSlot,
}
#[derive(Clone, Debug, McBuf)]
pub struct SmithingTrimRecipe {
pub template: Ingredient,
pub base: Ingredient,
pub addition: Ingredient,
}
#[derive(Clone, Debug, McBuf)]
pub enum RecipeData {
CraftingShapeless(ShapelessRecipe),
CraftingShaped(ShapedRecipe),
CraftingShapeless(ShapelessRecipe),
CraftingSpecialArmorDye(SimpleRecipe),
CraftingSpecialBookCloning(SimpleRecipe),
CraftingSpecialMapCloning(SimpleRecipe),
@ -123,7 +144,6 @@ pub enum RecipeData {
CraftingSpecialRepairItem(SimpleRecipe),
CraftingSpecialTippedArrow(SimpleRecipe),
CraftingSpecialBannerDuplicate(SimpleRecipe),
CraftingSpecialBannerAddPattern(SimpleRecipe),
CraftingSpecialShieldDecoration(SimpleRecipe),
CraftingSpecialShulkerBoxColoring(SimpleRecipe),
CraftingSpecialSuspiciousStew(SimpleRecipe),
@ -133,6 +153,9 @@ pub enum RecipeData {
CampfireCooking(CookingRecipe),
Stonecutting(StoneCutterRecipe),
Smithing(SmithingRecipe),
SmithingTransform(SmithingTransformRecipe),
SmithingTrim(SmithingTrimRecipe),
CraftingDecoratedPot(SimpleRecipe),
}
#[derive(Clone, Debug, McBuf)]
@ -142,48 +165,55 @@ pub struct Ingredient {
impl McBufWritable for Recipe {
fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
let resource_location = match &self.data {
RecipeData::CraftingShapeless(_) => "minecraft:crafting_shapeless",
RecipeData::CraftingShaped(_) => "minecraft:crafting_shaped",
RecipeData::CraftingSpecialArmorDye(_) => "minecraft:crafting_special_armordye",
RecipeData::CraftingSpecialBookCloning(_) => "minecraft:crafting_special_bookcloning",
RecipeData::CraftingSpecialMapCloning(_) => "minecraft:crafting_special_mapcloning",
RecipeData::CraftingSpecialMapExtending(_) => "minecraft:crafting_special_mapextending",
let recipe_serializer = match &self.data {
RecipeData::CraftingShapeless(_) => RecipeSerializer::CraftingShapeless,
RecipeData::CraftingShaped(_) => RecipeSerializer::CraftingShaped,
RecipeData::CraftingSpecialArmorDye(_) => RecipeSerializer::CraftingSpecialArmordye,
RecipeData::CraftingSpecialBookCloning(_) => {
RecipeSerializer::CraftingSpecialBookcloning
}
RecipeData::CraftingSpecialMapCloning(_) => RecipeSerializer::CraftingSpecialMapcloning,
RecipeData::CraftingSpecialMapExtending(_) => {
RecipeSerializer::CraftingSpecialMapextending
}
RecipeData::CraftingSpecialFireworkRocket(_) => {
"minecraft:crafting_special_firework_rocket"
RecipeSerializer::CraftingSpecialFireworkRocket
}
RecipeData::CraftingSpecialFireworkStar(_) => {
"minecraft:crafting_special_firework_star"
RecipeSerializer::CraftingSpecialFireworkStar
}
RecipeData::CraftingSpecialFireworkStarFade(_) => {
"minecraft:crafting_special_firework_star_fade"
RecipeSerializer::CraftingSpecialFireworkStarFade
}
RecipeData::CraftingSpecialRepairItem(_) => RecipeSerializer::CraftingSpecialRepairitem,
RecipeData::CraftingSpecialTippedArrow(_) => {
RecipeSerializer::CraftingSpecialTippedarrow
}
RecipeData::CraftingSpecialRepairItem(_) => "minecraft:crafting_special_repairitem",
RecipeData::CraftingSpecialTippedArrow(_) => "minecraft:crafting_special_tippedarrow",
RecipeData::CraftingSpecialBannerDuplicate(_) => {
"minecraft:crafting_special_bannerduplicate"
}
RecipeData::CraftingSpecialBannerAddPattern(_) => {
"minecraft:crafting_special_banneraddpattern"
RecipeSerializer::CraftingSpecialBannerduplicate
}
RecipeData::CraftingSpecialShieldDecoration(_) => {
"minecraft:crafting_special_shielddecoration"
RecipeSerializer::CraftingSpecialShielddecoration
}
RecipeData::CraftingSpecialShulkerBoxColoring(_) => {
"minecraft:crafting_special_shulkerboxcoloring"
RecipeSerializer::CraftingSpecialShulkerboxcoloring
}
RecipeData::CraftingSpecialSuspiciousStew(_) => {
"minecraft:crafting_special_suspiciousstew"
RecipeSerializer::CraftingSpecialSuspiciousstew
}
RecipeData::Smelting(_) => "minecraft:smelting",
RecipeData::Blasting(_) => "minecraft:blasting",
RecipeData::Smoking(_) => "minecraft:smoking",
RecipeData::CampfireCooking(_) => "minecraft:campfire_cooking",
RecipeData::Stonecutting(_) => "minecraft:stonecutting",
RecipeData::Smithing(_) => "minecraft:smithing",
RecipeData::Smelting(_) => RecipeSerializer::Smelting,
RecipeData::Blasting(_) => RecipeSerializer::Blasting,
RecipeData::Smoking(_) => RecipeSerializer::Smoking,
RecipeData::CampfireCooking(_) => RecipeSerializer::CampfireCooking,
RecipeData::Stonecutting(_) => RecipeSerializer::Stonecutting,
RecipeData::Smithing(_) => RecipeSerializer::Smithing,
RecipeData::SmithingTransform(_) => RecipeSerializer::SmithingTransform,
RecipeData::SmithingTrim(_) => RecipeSerializer::SmithingTrim,
RecipeData::CraftingDecoratedPot(_) => RecipeSerializer::CraftingDecoratedPot,
};
ResourceLocation::new(resource_location).write_into(buf)?;
let resource_location = ResourceLocation::new(&recipe_serializer.to_string());
resource_location.write_into(buf)?;
self.identifier.write_into(buf)?;
self.data.write_without_id(buf)?;
Ok(())
@ -192,74 +222,79 @@ impl McBufWritable for Recipe {
impl McBufReadable for Recipe {
fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
let recipe_type = ResourceLocation::read_from(buf)?;
let recipe_serializer_name = ResourceLocation::read_from(buf)?;
let Ok(recipe_serializer) =
RecipeSerializer::from_str(&recipe_serializer_name.to_string()) else {
return Err(BufReadError::UnexpectedStringEnumVariant { id: recipe_serializer_name.to_string() });
};
let identifier = ResourceLocation::read_from(buf)?;
// rust doesn't let us match ResourceLocation so we have to do a big
// if-else chain :(
let data = match recipe_type.to_string().as_str() {
"minecraft:crafting_shapeless" => {
RecipeData::CraftingShapeless(ShapelessRecipe::read_from(buf)?)
}
"minecraft:crafting_shaped" => {
let data = match recipe_serializer {
RecipeSerializer::CraftingShaped => {
RecipeData::CraftingShaped(ShapedRecipe::read_from(buf)?)
}
"minecraft:crafting_special_armordye" => {
RecipeSerializer::CraftingShapeless => {
RecipeData::CraftingShapeless(ShapelessRecipe::read_from(buf)?)
}
RecipeSerializer::CraftingSpecialArmordye => {
RecipeData::CraftingSpecialArmorDye(SimpleRecipe::read_from(buf)?)
}
"minecraft:crafting_special_bookcloning" => {
RecipeSerializer::CraftingSpecialBookcloning => {
RecipeData::CraftingSpecialBookCloning(SimpleRecipe::read_from(buf)?)
}
"minecraft:crafting_special_mapcloning" => {
RecipeSerializer::CraftingSpecialMapcloning => {
RecipeData::CraftingSpecialMapCloning(SimpleRecipe::read_from(buf)?)
}
"minecraft:crafting_special_mapextending" => {
RecipeSerializer::CraftingSpecialMapextending => {
RecipeData::CraftingSpecialMapExtending(SimpleRecipe::read_from(buf)?)
}
"minecraft:crafting_special_firework_rocket" => {
RecipeSerializer::CraftingSpecialFireworkRocket => {
RecipeData::CraftingSpecialFireworkRocket(SimpleRecipe::read_from(buf)?)
}
"minecraft:crafting_special_firework_star" => {
RecipeSerializer::CraftingSpecialFireworkStar => {
RecipeData::CraftingSpecialFireworkStar(SimpleRecipe::read_from(buf)?)
}
"minecraft:crafting_special_firework_star_fade" => {
RecipeSerializer::CraftingSpecialFireworkStarFade => {
RecipeData::CraftingSpecialFireworkStarFade(SimpleRecipe::read_from(buf)?)
}
"minecraft:crafting_special_repairitem" => {
RecipeSerializer::CraftingSpecialRepairitem => {
RecipeData::CraftingSpecialRepairItem(SimpleRecipe::read_from(buf)?)
}
"minecraft:crafting_special_tippedarrow" => {
RecipeSerializer::CraftingSpecialTippedarrow => {
RecipeData::CraftingSpecialTippedArrow(SimpleRecipe::read_from(buf)?)
}
"minecraft:crafting_special_bannerduplicate" => {
RecipeSerializer::CraftingSpecialBannerduplicate => {
RecipeData::CraftingSpecialBannerDuplicate(SimpleRecipe::read_from(buf)?)
}
"minecraft:crafting_special_banneraddpattern" => {
RecipeData::CraftingSpecialBannerAddPattern(SimpleRecipe::read_from(buf)?)
}
"minecraft:crafting_special_shielddecoration" => {
RecipeSerializer::CraftingSpecialShielddecoration => {
RecipeData::CraftingSpecialShieldDecoration(SimpleRecipe::read_from(buf)?)
}
"minecraft:crafting_special_shulkerboxcoloring" => {
RecipeSerializer::CraftingSpecialShulkerboxcoloring => {
RecipeData::CraftingSpecialShulkerBoxColoring(SimpleRecipe::read_from(buf)?)
}
"minecraft:crafting_special_suspiciousstew" => {
RecipeSerializer::CraftingSpecialSuspiciousstew => {
RecipeData::CraftingSpecialSuspiciousStew(SimpleRecipe::read_from(buf)?)
}
"minecraft:smelting" => RecipeData::Smelting(CookingRecipe::read_from(buf)?),
"minecraft:blasting" => RecipeData::Blasting(CookingRecipe::read_from(buf)?),
"minecraft:smoking" => RecipeData::Smoking(CookingRecipe::read_from(buf)?),
"minecraft:campfire_cooking" => {
RecipeSerializer::Smelting => RecipeData::Smelting(CookingRecipe::read_from(buf)?),
RecipeSerializer::Blasting => RecipeData::Blasting(CookingRecipe::read_from(buf)?),
RecipeSerializer::Smoking => RecipeData::Smoking(CookingRecipe::read_from(buf)?),
RecipeSerializer::CampfireCooking => {
RecipeData::CampfireCooking(CookingRecipe::read_from(buf)?)
}
"minecraft:stonecutting" => {
RecipeSerializer::Stonecutting => {
RecipeData::Stonecutting(StoneCutterRecipe::read_from(buf)?)
}
"minecraft:smithing" => RecipeData::Smithing(SmithingRecipe::read_from(buf)?),
_ => {
return Err(BufReadError::UnexpectedStringEnumVariant {
id: recipe_type.to_string(),
});
RecipeSerializer::Smithing => RecipeData::Smithing(SmithingRecipe::read_from(buf)?),
RecipeSerializer::SmithingTransform => {
RecipeData::SmithingTransform(SmithingTransformRecipe::read_from(buf)?)
}
RecipeSerializer::SmithingTrim => {
RecipeData::SmithingTrim(SmithingTrimRecipe::read_from(buf)?)
}
RecipeSerializer::CraftingDecoratedPot => {
RecipeData::CraftingDecoratedPot(SimpleRecipe::read_from(buf)?)
}
};

View file

@ -9,7 +9,9 @@ pub mod clientbound_block_entity_data_packet;
pub mod clientbound_block_event_packet;
pub mod clientbound_block_update_packet;
pub mod clientbound_boss_event_packet;
pub mod clientbound_bundle_packet;
pub mod clientbound_change_difficulty_packet;
pub mod clientbound_chunks_biomes_packet;
pub mod clientbound_command_suggestions_packet;
pub mod clientbound_commands_packet;
pub mod clientbound_container_close_packet;
@ -19,6 +21,7 @@ pub mod clientbound_container_set_slot_packet;
pub mod clientbound_cooldown_packet;
pub mod clientbound_custom_chat_completions_packet;
pub mod clientbound_custom_payload_packet;
pub mod clientbound_damage_event_packet;
pub mod clientbound_delete_chat_packet;
pub mod clientbound_disconnect_packet;
pub mod clientbound_disguised_chat_packet;
@ -27,6 +30,7 @@ pub mod clientbound_explode_packet;
pub mod clientbound_forget_level_chunk_packet;
pub mod clientbound_game_event_packet;
pub mod clientbound_horse_screen_open_packet;
pub mod clientbound_hurt_animation_packet;
pub mod clientbound_initialize_border_packet;
pub mod clientbound_keep_alive_packet;
pub mod clientbound_level_chunk_with_light_packet;
@ -167,33 +171,33 @@ declare_state_packets!(
0x03: serverbound_chat_ack_packet::ServerboundChatAckPacket,
0x04: serverbound_chat_command_packet::ServerboundChatCommandPacket,
0x05: serverbound_chat_packet::ServerboundChatPacket,
0x06: serverbound_client_command_packet::ServerboundClientCommandPacket,
0x07: serverbound_client_information_packet::ServerboundClientInformationPacket,
0x08: serverbound_command_suggestion_packet::ServerboundCommandSuggestionPacket,
0x09: serverbound_container_button_click_packet::ServerboundContainerButtonClickPacket,
0x0a: serverbound_container_click_packet::ServerboundContainerClickPacket,
0x0b: serverbound_container_close_packet::ServerboundContainerClosePacket,
0x0c: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket,
0x0d: serverbound_edit_book_packet::ServerboundEditBookPacket,
0x0e: serverbound_entity_tag_query::ServerboundEntityTagQuery,
0x0f: serverbound_interact_packet::ServerboundInteractPacket,
0x10: serverbound_jigsaw_generate_packet::ServerboundJigsawGeneratePacket,
0x11: serverbound_keep_alive_packet::ServerboundKeepAlivePacket,
0x12: serverbound_lock_difficulty_packet::ServerboundLockDifficultyPacket,
0x13: serverbound_move_player_pos_packet::ServerboundMovePlayerPosPacket,
0x14: serverbound_move_player_pos_rot_packet::ServerboundMovePlayerPosRotPacket,
0x15: serverbound_move_player_rot_packet::ServerboundMovePlayerRotPacket,
0x16: serverbound_move_player_status_only_packet::ServerboundMovePlayerStatusOnlyPacket,
0x17: serverbound_move_vehicle_packet::ServerboundMoveVehiclePacket,
0x18: serverbound_paddle_boat_packet::ServerboundPaddleBoatPacket,
0x19: serverbound_pick_item_packet::ServerboundPickItemPacket,
0x1a: serverbound_place_recipe_packet::ServerboundPlaceRecipePacket,
0x1b: serverbound_player_abilities_packet::ServerboundPlayerAbilitiesPacket,
0x1c: serverbound_player_action_packet::ServerboundPlayerActionPacket,
0x1d: serverbound_player_command_packet::ServerboundPlayerCommandPacket,
0x1e: serverbound_player_input_packet::ServerboundPlayerInputPacket,
0x1f: serverbound_pong_packet::ServerboundPongPacket,
0x20: serverbound_chat_session_update_packet::ServerboundChatSessionUpdatePacket,
0x06: serverbound_chat_session_update_packet::ServerboundChatSessionUpdatePacket,
0x07: serverbound_client_command_packet::ServerboundClientCommandPacket,
0x08: serverbound_client_information_packet::ServerboundClientInformationPacket,
0x09: serverbound_command_suggestion_packet::ServerboundCommandSuggestionPacket,
0x0a: serverbound_container_button_click_packet::ServerboundContainerButtonClickPacket,
0x0b: serverbound_container_click_packet::ServerboundContainerClickPacket,
0x0c: serverbound_container_close_packet::ServerboundContainerClosePacket,
0x0d: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket,
0x0e: serverbound_edit_book_packet::ServerboundEditBookPacket,
0x0f: serverbound_entity_tag_query::ServerboundEntityTagQuery,
0x10: serverbound_interact_packet::ServerboundInteractPacket,
0x11: serverbound_jigsaw_generate_packet::ServerboundJigsawGeneratePacket,
0x12: serverbound_keep_alive_packet::ServerboundKeepAlivePacket,
0x13: serverbound_lock_difficulty_packet::ServerboundLockDifficultyPacket,
0x14: serverbound_move_player_pos_packet::ServerboundMovePlayerPosPacket,
0x15: serverbound_move_player_pos_rot_packet::ServerboundMovePlayerPosRotPacket,
0x16: serverbound_move_player_rot_packet::ServerboundMovePlayerRotPacket,
0x17: serverbound_move_player_status_only_packet::ServerboundMovePlayerStatusOnlyPacket,
0x18: serverbound_move_vehicle_packet::ServerboundMoveVehiclePacket,
0x19: serverbound_paddle_boat_packet::ServerboundPaddleBoatPacket,
0x1a: serverbound_pick_item_packet::ServerboundPickItemPacket,
0x1b: serverbound_place_recipe_packet::ServerboundPlaceRecipePacket,
0x1c: serverbound_player_abilities_packet::ServerboundPlayerAbilitiesPacket,
0x1d: serverbound_player_action_packet::ServerboundPlayerActionPacket,
0x1e: serverbound_player_command_packet::ServerboundPlayerCommandPacket,
0x1f: serverbound_player_input_packet::ServerboundPlayerInputPacket,
0x20: serverbound_pong_packet::ServerboundPongPacket,
0x21: serverbound_recipe_book_change_settings_packet::ServerboundRecipeBookChangeSettingsPacket,
0x22: serverbound_recipe_book_seen_recipe_packet::ServerboundRecipeBookSeenRecipePacket,
0x23: serverbound_rename_item_packet::ServerboundRenameItemPacket,
@ -214,111 +218,115 @@ declare_state_packets!(
0x32: serverbound_use_item_packet::ServerboundUseItemPacket,
},
Clientbound => {
0x00: clientbound_add_entity_packet::ClientboundAddEntityPacket,
0x01: clientbound_add_experience_orb_packet::ClientboundAddExperienceOrbPacket,
0x02: clientbound_add_player_packet::ClientboundAddPlayerPacket,
0x03: clientbound_animate_packet::ClientboundAnimatePacket,
0x04: clientbound_award_stats_packet::ClientboundAwardStatsPacket,
0x05: clientbound_block_changed_ack_packet::ClientboundBlockChangedAckPacket,
0x06: clientbound_block_destruction_packet::ClientboundBlockDestructionPacket,
0x07: clientbound_block_entity_data_packet::ClientboundBlockEntityDataPacket,
0x08: clientbound_block_event_packet::ClientboundBlockEventPacket,
0x09: clientbound_block_update_packet::ClientboundBlockUpdatePacket,
0x0a: clientbound_boss_event_packet::ClientboundBossEventPacket,
0x0b: clientbound_change_difficulty_packet::ClientboundChangeDifficultyPacket,
0x0d: clientbound_command_suggestions_packet::ClientboundCommandSuggestionsPacket,
0x0e: clientbound_commands_packet::ClientboundCommandsPacket,
0x0f: clientbound_container_close_packet::ClientboundContainerClosePacket,
0x10: clientbound_container_set_content_packet::ClientboundContainerSetContentPacket,
0x11: clientbound_container_set_data_packet::ClientboundContainerSetDataPacket,
0x12: clientbound_container_set_slot_packet::ClientboundContainerSetSlotPacket,
0x13: clientbound_cooldown_packet::ClientboundCooldownPacket,
0x14: clientbound_custom_chat_completions_packet::ClientboundCustomChatCompletionsPacket,
0x15: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket,
0x16: clientbound_delete_chat_packet::ClientboundDeleteChatPacket,
0x17: clientbound_disconnect_packet::ClientboundDisconnectPacket,
0x18: clientbound_disguised_chat_packet::ClientboundDisguisedChatPacket,
0x19: clientbound_entity_event_packet::ClientboundEntityEventPacket,
0x1a: clientbound_explode_packet::ClientboundExplodePacket,
0x1b: clientbound_forget_level_chunk_packet::ClientboundForgetLevelChunkPacket,
0x1c: clientbound_game_event_packet::ClientboundGameEventPacket,
0x1d: clientbound_horse_screen_open_packet::ClientboundHorseScreenOpenPacket,
0x1e: clientbound_initialize_border_packet::ClientboundInitializeBorderPacket,
0x1f: clientbound_keep_alive_packet::ClientboundKeepAlivePacket,
0x20: clientbound_level_chunk_with_light_packet::ClientboundLevelChunkWithLightPacket,
0x21: clientbound_level_event_packet::ClientboundLevelEventPacket,
0x22: clientbound_level_particles_packet::ClientboundLevelParticlesPacket,
0x23: clientbound_light_update_packet::ClientboundLightUpdatePacket,
0x24: clientbound_login_packet::ClientboundLoginPacket,
0x25: clientbound_map_item_data_packet::ClientboundMapItemDataPacket,
0x26: clientbound_merchant_offers_packet::ClientboundMerchantOffersPacket,
0x27: clientbound_move_entity_pos_packet::ClientboundMoveEntityPosPacket,
0x28: clientbound_move_entity_pos_rot_packet::ClientboundMoveEntityPosRotPacket,
0x29: clientbound_move_entity_rot_packet::ClientboundMoveEntityRotPacket,
0x2a: clientbound_move_vehicle_packet::ClientboundMoveVehiclePacket,
0x2b: clientbound_open_book_packet::ClientboundOpenBookPacket,
0x2c: clientbound_open_screen_packet::ClientboundOpenScreenPacket,
0x2d: clientbound_open_sign_editor_packet::ClientboundOpenSignEditorPacket,
0x2e: clientbound_ping_packet::ClientboundPingPacket,
0x2f: clientbound_place_ghost_recipe_packet::ClientboundPlaceGhostRecipePacket,
0x30: clientbound_player_abilities_packet::ClientboundPlayerAbilitiesPacket,
0x31: clientbound_player_chat_packet::ClientboundPlayerChatPacket,
0x32: clientbound_player_combat_end_packet::ClientboundPlayerCombatEndPacket,
0x33: clientbound_player_combat_enter_packet::ClientboundPlayerCombatEnterPacket,
0x34: clientbound_player_combat_kill_packet::ClientboundPlayerCombatKillPacket,
0x35: clientbound_player_info_remove_packet::ClientboundPlayerInfoRemovePacket,
0x36: clientbound_player_info_update_packet::ClientboundPlayerInfoUpdatePacket,
0x37: clientbound_player_look_at_packet::ClientboundPlayerLookAtPacket,
0x38: clientbound_player_position_packet::ClientboundPlayerPositionPacket,
0x39: clientbound_recipe_packet::ClientboundRecipePacket,
0x3a: clientbound_remove_entities_packet::ClientboundRemoveEntitiesPacket,
0x3b: clientbound_remove_mob_effect_packet::ClientboundRemoveMobEffectPacket,
0x3c: clientbound_resource_pack_packet::ClientboundResourcePackPacket,
0x3d: clientbound_respawn_packet::ClientboundRespawnPacket,
0x3e: clientbound_rotate_head_packet::ClientboundRotateHeadPacket,
0x3f: clientbound_section_blocks_update_packet::ClientboundSectionBlocksUpdatePacket,
0x40: clientbound_select_advancements_tab_packet::ClientboundSelectAdvancementsTabPacket,
0x41: clientbound_server_data_packet::ClientboundServerDataPacket,
0x42: clientbound_set_action_bar_text_packet::ClientboundSetActionBarTextPacket,
0x43: clientbound_set_border_center_packet::ClientboundSetBorderCenterPacket,
0x44: clientbound_set_border_lerp_size_packet::ClientboundSetBorderLerpSizePacket,
0x45: clientbound_set_border_size_packet::ClientboundSetBorderSizePacket,
0x46: clientbound_set_border_warning_delay_packet::ClientboundSetBorderWarningDelayPacket,
0x47: clientbound_set_border_warning_distance_packet::ClientboundSetBorderWarningDistancePacket,
0x48: clientbound_set_camera_packet::ClientboundSetCameraPacket,
0x49: clientbound_set_carried_item_packet::ClientboundSetCarriedItemPacket,
0x4a: clientbound_set_chunk_cache_center_packet::ClientboundSetChunkCacheCenterPacket,
0x4b: clientbound_set_chunk_cache_radius_packet::ClientboundSetChunkCacheRadiusPacket,
0x4c: clientbound_set_default_spawn_position_packet::ClientboundSetDefaultSpawnPositionPacket,
0x4d: clientbound_set_display_objective_packet::ClientboundSetDisplayObjectivePacket,
0x4e: clientbound_set_entity_data_packet::ClientboundSetEntityDataPacket,
0x4f: clientbound_set_entity_link_packet::ClientboundSetEntityLinkPacket,
0x50: clientbound_set_entity_motion_packet::ClientboundSetEntityMotionPacket,
0x51: clientbound_set_equipment_packet::ClientboundSetEquipmentPacket,
0x52: clientbound_set_experience_packet::ClientboundSetExperiencePacket,
0x53: clientbound_set_health_packet::ClientboundSetHealthPacket,
0x54: clientbound_set_objective_packet::ClientboundSetObjectivePacket,
0x55: clientbound_set_passengers_packet::ClientboundSetPassengersPacket,
0x56: clientbound_set_player_team_packet::ClientboundSetPlayerTeamPacket,
0x57: clientbound_set_score_packet::ClientboundSetScorePacket,
0x58: clientbound_set_simulation_distance_packet::ClientboundSetSimulationDistancePacket,
0x59: clientbound_set_subtitle_text_packet::ClientboundSetSubtitleTextPacket,
0x5a: clientbound_set_time_packet::ClientboundSetTimePacket,
0x5b: clientbound_set_title_text_packet::ClientboundSetTitleTextPacket,
0x5c: clientbound_set_titles_animation_packet::ClientboundSetTitlesAnimationPacket,
0x5d: clientbound_sound_entity_packet::ClientboundSoundEntityPacket,
0x5e: clientbound_sound_packet::ClientboundSoundPacket,
0x5f: clientbound_stop_sound_packet::ClientboundStopSoundPacket,
0x60: clientbound_system_chat_packet::ClientboundSystemChatPacket,
0x61: clientbound_tab_list_packet::ClientboundTabListPacket,
0x62: clientbound_tag_query_packet::ClientboundTagQueryPacket,
0x63: clientbound_take_item_entity_packet::ClientboundTakeItemEntityPacket,
0x64: clientbound_teleport_entity_packet::ClientboundTeleportEntityPacket,
0x65: clientbound_update_advancements_packet::ClientboundUpdateAdvancementsPacket,
0x66: clientbound_update_attributes_packet::ClientboundUpdateAttributesPacket,
0x67: clientbound_update_enabled_features_packet::ClientboundUpdateEnabledFeaturesPacket,
0x68: clientbound_update_mob_effect_packet::ClientboundUpdateMobEffectPacket,
0x69: clientbound_update_recipes_packet::ClientboundUpdateRecipesPacket,
0x6a: clientbound_update_tags_packet::ClientboundUpdateTagsPacket,
0x00: clientbound_bundle_packet::ClientboundBundlePacket,
0x01: clientbound_add_entity_packet::ClientboundAddEntityPacket,
0x02: clientbound_add_experience_orb_packet::ClientboundAddExperienceOrbPacket,
0x03: clientbound_add_player_packet::ClientboundAddPlayerPacket,
0x04: clientbound_animate_packet::ClientboundAnimatePacket,
0x05: clientbound_award_stats_packet::ClientboundAwardStatsPacket,
0x06: clientbound_block_changed_ack_packet::ClientboundBlockChangedAckPacket,
0x07: clientbound_block_destruction_packet::ClientboundBlockDestructionPacket,
0x08: clientbound_block_entity_data_packet::ClientboundBlockEntityDataPacket,
0x09: clientbound_block_event_packet::ClientboundBlockEventPacket,
0x0a: clientbound_block_update_packet::ClientboundBlockUpdatePacket,
0x0b: clientbound_boss_event_packet::ClientboundBossEventPacket,
0x0c: clientbound_change_difficulty_packet::ClientboundChangeDifficultyPacket,
0x0d: clientbound_chunks_biomes_packet::ClientboundChunksBiomesPacket,
0x0f: clientbound_command_suggestions_packet::ClientboundCommandSuggestionsPacket,
0x10: clientbound_commands_packet::ClientboundCommandsPacket,
0x11: clientbound_container_close_packet::ClientboundContainerClosePacket,
0x12: clientbound_container_set_content_packet::ClientboundContainerSetContentPacket,
0x13: clientbound_container_set_data_packet::ClientboundContainerSetDataPacket,
0x14: clientbound_container_set_slot_packet::ClientboundContainerSetSlotPacket,
0x15: clientbound_cooldown_packet::ClientboundCooldownPacket,
0x16: clientbound_custom_chat_completions_packet::ClientboundCustomChatCompletionsPacket,
0x17: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket,
0x18: clientbound_damage_event_packet::ClientboundDamageEventPacket,
0x19: clientbound_delete_chat_packet::ClientboundDeleteChatPacket,
0x1a: clientbound_disconnect_packet::ClientboundDisconnectPacket,
0x1b: clientbound_disguised_chat_packet::ClientboundDisguisedChatPacket,
0x1c: clientbound_entity_event_packet::ClientboundEntityEventPacket,
0x1d: clientbound_explode_packet::ClientboundExplodePacket,
0x1e: clientbound_forget_level_chunk_packet::ClientboundForgetLevelChunkPacket,
0x1f: clientbound_game_event_packet::ClientboundGameEventPacket,
0x20: clientbound_horse_screen_open_packet::ClientboundHorseScreenOpenPacket,
0x21: clientbound_hurt_animation_packet::ClientboundHurtAnimationPacket,
0x22: clientbound_initialize_border_packet::ClientboundInitializeBorderPacket,
0x23: clientbound_keep_alive_packet::ClientboundKeepAlivePacket,
0x24: clientbound_level_chunk_with_light_packet::ClientboundLevelChunkWithLightPacket,
0x25: clientbound_level_event_packet::ClientboundLevelEventPacket,
0x26: clientbound_level_particles_packet::ClientboundLevelParticlesPacket,
0x27: clientbound_light_update_packet::ClientboundLightUpdatePacket,
0x28: clientbound_login_packet::ClientboundLoginPacket,
0x29: clientbound_map_item_data_packet::ClientboundMapItemDataPacket,
0x2a: clientbound_merchant_offers_packet::ClientboundMerchantOffersPacket,
0x2b: clientbound_move_entity_pos_packet::ClientboundMoveEntityPosPacket,
0x2c: clientbound_move_entity_pos_rot_packet::ClientboundMoveEntityPosRotPacket,
0x2d: clientbound_move_entity_rot_packet::ClientboundMoveEntityRotPacket,
0x2e: clientbound_move_vehicle_packet::ClientboundMoveVehiclePacket,
0x2f: clientbound_open_book_packet::ClientboundOpenBookPacket,
0x30: clientbound_open_screen_packet::ClientboundOpenScreenPacket,
0x31: clientbound_open_sign_editor_packet::ClientboundOpenSignEditorPacket,
0x32: clientbound_ping_packet::ClientboundPingPacket,
0x33: clientbound_place_ghost_recipe_packet::ClientboundPlaceGhostRecipePacket,
0x34: clientbound_player_abilities_packet::ClientboundPlayerAbilitiesPacket,
0x35: clientbound_player_chat_packet::ClientboundPlayerChatPacket,
0x36: clientbound_player_combat_end_packet::ClientboundPlayerCombatEndPacket,
0x37: clientbound_player_combat_enter_packet::ClientboundPlayerCombatEnterPacket,
0x38: clientbound_player_combat_kill_packet::ClientboundPlayerCombatKillPacket,
0x39: clientbound_player_info_remove_packet::ClientboundPlayerInfoRemovePacket,
0x3a: clientbound_player_info_update_packet::ClientboundPlayerInfoUpdatePacket,
0x3b: clientbound_player_look_at_packet::ClientboundPlayerLookAtPacket,
0x3c: clientbound_player_position_packet::ClientboundPlayerPositionPacket,
0x3d: clientbound_recipe_packet::ClientboundRecipePacket,
0x3e: clientbound_remove_entities_packet::ClientboundRemoveEntitiesPacket,
0x3f: clientbound_remove_mob_effect_packet::ClientboundRemoveMobEffectPacket,
0x40: clientbound_resource_pack_packet::ClientboundResourcePackPacket,
0x41: clientbound_respawn_packet::ClientboundRespawnPacket,
0x42: clientbound_rotate_head_packet::ClientboundRotateHeadPacket,
0x43: clientbound_section_blocks_update_packet::ClientboundSectionBlocksUpdatePacket,
0x44: clientbound_select_advancements_tab_packet::ClientboundSelectAdvancementsTabPacket,
0x45: clientbound_server_data_packet::ClientboundServerDataPacket,
0x46: clientbound_set_action_bar_text_packet::ClientboundSetActionBarTextPacket,
0x47: clientbound_set_border_center_packet::ClientboundSetBorderCenterPacket,
0x48: clientbound_set_border_lerp_size_packet::ClientboundSetBorderLerpSizePacket,
0x49: clientbound_set_border_size_packet::ClientboundSetBorderSizePacket,
0x4a: clientbound_set_border_warning_delay_packet::ClientboundSetBorderWarningDelayPacket,
0x4b: clientbound_set_border_warning_distance_packet::ClientboundSetBorderWarningDistancePacket,
0x4c: clientbound_set_camera_packet::ClientboundSetCameraPacket,
0x4d: clientbound_set_carried_item_packet::ClientboundSetCarriedItemPacket,
0x4e: clientbound_set_chunk_cache_center_packet::ClientboundSetChunkCacheCenterPacket,
0x4f: clientbound_set_chunk_cache_radius_packet::ClientboundSetChunkCacheRadiusPacket,
0x50: clientbound_set_default_spawn_position_packet::ClientboundSetDefaultSpawnPositionPacket,
0x51: clientbound_set_display_objective_packet::ClientboundSetDisplayObjectivePacket,
0x52: clientbound_set_entity_data_packet::ClientboundSetEntityDataPacket,
0x53: clientbound_set_entity_link_packet::ClientboundSetEntityLinkPacket,
0x54: clientbound_set_entity_motion_packet::ClientboundSetEntityMotionPacket,
0x55: clientbound_set_equipment_packet::ClientboundSetEquipmentPacket,
0x56: clientbound_set_experience_packet::ClientboundSetExperiencePacket,
0x57: clientbound_set_health_packet::ClientboundSetHealthPacket,
0x58: clientbound_set_objective_packet::ClientboundSetObjectivePacket,
0x59: clientbound_set_passengers_packet::ClientboundSetPassengersPacket,
0x5a: clientbound_set_player_team_packet::ClientboundSetPlayerTeamPacket,
0x5b: clientbound_set_score_packet::ClientboundSetScorePacket,
0x5c: clientbound_set_simulation_distance_packet::ClientboundSetSimulationDistancePacket,
0x5d: clientbound_set_subtitle_text_packet::ClientboundSetSubtitleTextPacket,
0x5e: clientbound_set_time_packet::ClientboundSetTimePacket,
0x5f: clientbound_set_title_text_packet::ClientboundSetTitleTextPacket,
0x60: clientbound_set_titles_animation_packet::ClientboundSetTitlesAnimationPacket,
0x61: clientbound_sound_entity_packet::ClientboundSoundEntityPacket,
0x62: clientbound_sound_packet::ClientboundSoundPacket,
0x63: clientbound_stop_sound_packet::ClientboundStopSoundPacket,
0x64: clientbound_system_chat_packet::ClientboundSystemChatPacket,
0x65: clientbound_tab_list_packet::ClientboundTabListPacket,
0x66: clientbound_tag_query_packet::ClientboundTagQueryPacket,
0x67: clientbound_take_item_entity_packet::ClientboundTakeItemEntityPacket,
0x68: clientbound_teleport_entity_packet::ClientboundTeleportEntityPacket,
0x69: clientbound_update_advancements_packet::ClientboundUpdateAdvancementsPacket,
0x6a: clientbound_update_attributes_packet::ClientboundUpdateAttributesPacket,
0x6b: clientbound_update_enabled_features_packet::ClientboundUpdateEnabledFeaturesPacket,
0x6c: clientbound_update_mob_effect_packet::ClientboundUpdateMobEffectPacket,
0x6d: clientbound_update_recipes_packet::ClientboundUpdateRecipesPacket,
0x6e: clientbound_update_tags_packet::ClientboundUpdateTagsPacket,
}
);

View file

@ -10,7 +10,7 @@ use std::io::{Cursor, Write};
// TODO: rename the packet files to just like clientbound_add_entity instead of
// clientbound_add_entity_packet
pub const PROTOCOL_VERSION: u32 = 761;
pub const PROTOCOL_VERSION: u32 = 762;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ConnectionProtocol {

View file

@ -36,10 +36,6 @@ pub struct ClientboundStatusResponsePacket {
pub version: Version,
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "previewsChat")]
pub previews_chat: Option<bool>,
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "enforcesSecureChat")]
pub enforces_secure_chat: Option<bool>,
}

View file

@ -257,29 +257,3 @@ where
Ok(packet)
}
#[cfg(test)]
mod tests {
use super::*;
use crate::packets::game::ClientboundGamePacket;
use std::io::Cursor;
#[test]
fn test_read_packet() {
let mut buf: Cursor<&[u8]> = Cursor::new(&[
56, 64, 85, 58, 141, 138, 71, 146, 193, 64, 88, 0, 0, 0, 0, 0, 0, 64, 60, 224, 105, 34,
119, 8, 228, 67, 50, 51, 68, 194, 177, 230, 101, 0, 17, 0,
]);
let packet = packet_decoder::<ClientboundGamePacket>(&mut buf).unwrap();
match &packet {
ClientboundGamePacket::PlayerPosition(p) => {
assert_eq!(p.id, 17);
assert_eq!(p.x, 84.91488892545296);
assert_eq!(p.y, 96.0);
assert_eq!(p.z, 28.876604227124417);
assert_eq!(p.dismount_vehicle, false);
}
_ => panic!("Wrong packet type"),
}
}
}

View file

@ -164,6 +164,7 @@ enum Block {
BirchPlanks => "minecraft:birch_planks",
JunglePlanks => "minecraft:jungle_planks",
AcaciaPlanks => "minecraft:acacia_planks",
CherryPlanks => "minecraft:cherry_planks",
DarkOakPlanks => "minecraft:dark_oak_planks",
MangrovePlanks => "minecraft:mangrove_planks",
BambooPlanks => "minecraft:bamboo_planks",
@ -173,12 +174,14 @@ enum Block {
BirchSapling => "minecraft:birch_sapling",
JungleSapling => "minecraft:jungle_sapling",
AcaciaSapling => "minecraft:acacia_sapling",
CherrySapling => "minecraft:cherry_sapling",
DarkOakSapling => "minecraft:dark_oak_sapling",
MangrovePropagule => "minecraft:mangrove_propagule",
Bedrock => "minecraft:bedrock",
Water => "minecraft:water",
Lava => "minecraft:lava",
Sand => "minecraft:sand",
SuspiciousSand => "minecraft:suspicious_sand",
RedSand => "minecraft:red_sand",
Gravel => "minecraft:gravel",
GoldOre => "minecraft:gold_ore",
@ -193,6 +196,7 @@ enum Block {
BirchLog => "minecraft:birch_log",
JungleLog => "minecraft:jungle_log",
AcaciaLog => "minecraft:acacia_log",
CherryLog => "minecraft:cherry_log",
DarkOakLog => "minecraft:dark_oak_log",
MangroveLog => "minecraft:mangrove_log",
MangroveRoots => "minecraft:mangrove_roots",
@ -202,6 +206,7 @@ enum Block {
StrippedBirchLog => "minecraft:stripped_birch_log",
StrippedJungleLog => "minecraft:stripped_jungle_log",
StrippedAcaciaLog => "minecraft:stripped_acacia_log",
StrippedCherryLog => "minecraft:stripped_cherry_log",
StrippedDarkOakLog => "minecraft:stripped_dark_oak_log",
StrippedOakLog => "minecraft:stripped_oak_log",
StrippedMangroveLog => "minecraft:stripped_mangrove_log",
@ -211,6 +216,7 @@ enum Block {
BirchWood => "minecraft:birch_wood",
JungleWood => "minecraft:jungle_wood",
AcaciaWood => "minecraft:acacia_wood",
CherryWood => "minecraft:cherry_wood",
DarkOakWood => "minecraft:dark_oak_wood",
MangroveWood => "minecraft:mangrove_wood",
StrippedOakWood => "minecraft:stripped_oak_wood",
@ -218,6 +224,7 @@ enum Block {
StrippedBirchWood => "minecraft:stripped_birch_wood",
StrippedJungleWood => "minecraft:stripped_jungle_wood",
StrippedAcaciaWood => "minecraft:stripped_acacia_wood",
StrippedCherryWood => "minecraft:stripped_cherry_wood",
StrippedDarkOakWood => "minecraft:stripped_dark_oak_wood",
StrippedMangroveWood => "minecraft:stripped_mangrove_wood",
OakLeaves => "minecraft:oak_leaves",
@ -225,6 +232,7 @@ enum Block {
BirchLeaves => "minecraft:birch_leaves",
JungleLeaves => "minecraft:jungle_leaves",
AcaciaLeaves => "minecraft:acacia_leaves",
CherryLeaves => "minecraft:cherry_leaves",
DarkOakLeaves => "minecraft:dark_oak_leaves",
MangroveLeaves => "minecraft:mangrove_leaves",
AzaleaLeaves => "minecraft:azalea_leaves",
@ -285,6 +293,7 @@ enum Block {
BlackWool => "minecraft:black_wool",
MovingPiston => "minecraft:moving_piston",
Dandelion => "minecraft:dandelion",
Torchflower => "minecraft:torchflower",
Poppy => "minecraft:poppy",
BlueOrchid => "minecraft:blue_orchid",
Allium => "minecraft:allium",
@ -326,6 +335,7 @@ enum Block {
SpruceSign => "minecraft:spruce_sign",
BirchSign => "minecraft:birch_sign",
AcaciaSign => "minecraft:acacia_sign",
CherrySign => "minecraft:cherry_sign",
JungleSign => "minecraft:jungle_sign",
DarkOakSign => "minecraft:dark_oak_sign",
MangroveSign => "minecraft:mangrove_sign",
@ -338,6 +348,7 @@ enum Block {
SpruceWallSign => "minecraft:spruce_wall_sign",
BirchWallSign => "minecraft:birch_wall_sign",
AcaciaWallSign => "minecraft:acacia_wall_sign",
CherryWallSign => "minecraft:cherry_wall_sign",
JungleWallSign => "minecraft:jungle_wall_sign",
DarkOakWallSign => "minecraft:dark_oak_wall_sign",
MangroveWallSign => "minecraft:mangrove_wall_sign",
@ -346,6 +357,7 @@ enum Block {
SpruceHangingSign => "minecraft:spruce_hanging_sign",
BirchHangingSign => "minecraft:birch_hanging_sign",
AcaciaHangingSign => "minecraft:acacia_hanging_sign",
CherryHangingSign => "minecraft:cherry_hanging_sign",
JungleHangingSign => "minecraft:jungle_hanging_sign",
DarkOakHangingSign => "minecraft:dark_oak_hanging_sign",
CrimsonHangingSign => "minecraft:crimson_hanging_sign",
@ -356,6 +368,7 @@ enum Block {
SpruceWallHangingSign => "minecraft:spruce_wall_hanging_sign",
BirchWallHangingSign => "minecraft:birch_wall_hanging_sign",
AcaciaWallHangingSign => "minecraft:acacia_wall_hanging_sign",
CherryWallHangingSign => "minecraft:cherry_wall_hanging_sign",
JungleWallHangingSign => "minecraft:jungle_wall_hanging_sign",
DarkOakWallHangingSign => "minecraft:dark_oak_wall_hanging_sign",
MangroveWallHangingSign => "minecraft:mangrove_wall_hanging_sign",
@ -370,6 +383,7 @@ enum Block {
BirchPressurePlate => "minecraft:birch_pressure_plate",
JunglePressurePlate => "minecraft:jungle_pressure_plate",
AcaciaPressurePlate => "minecraft:acacia_pressure_plate",
CherryPressurePlate => "minecraft:cherry_pressure_plate",
DarkOakPressurePlate => "minecraft:dark_oak_pressure_plate",
MangrovePressurePlate => "minecraft:mangrove_pressure_plate",
BambooPressurePlate => "minecraft:bamboo_pressure_plate",
@ -421,6 +435,7 @@ enum Block {
BirchTrapdoor => "minecraft:birch_trapdoor",
JungleTrapdoor => "minecraft:jungle_trapdoor",
AcaciaTrapdoor => "minecraft:acacia_trapdoor",
CherryTrapdoor => "minecraft:cherry_trapdoor",
DarkOakTrapdoor => "minecraft:dark_oak_trapdoor",
MangroveTrapdoor => "minecraft:mangrove_trapdoor",
BambooTrapdoor => "minecraft:bamboo_trapdoor",
@ -486,11 +501,13 @@ enum Block {
CobblestoneWall => "minecraft:cobblestone_wall",
MossyCobblestoneWall => "minecraft:mossy_cobblestone_wall",
FlowerPot => "minecraft:flower_pot",
PottedTorchflower => "minecraft:potted_torchflower",
PottedOakSapling => "minecraft:potted_oak_sapling",
PottedSpruceSapling => "minecraft:potted_spruce_sapling",
PottedBirchSapling => "minecraft:potted_birch_sapling",
PottedJungleSapling => "minecraft:potted_jungle_sapling",
PottedAcaciaSapling => "minecraft:potted_acacia_sapling",
PottedCherrySapling => "minecraft:potted_cherry_sapling",
PottedDarkOakSapling => "minecraft:potted_dark_oak_sapling",
PottedMangrovePropagule => "minecraft:potted_mangrove_propagule",
PottedFern => "minecraft:potted_fern",
@ -518,6 +535,7 @@ enum Block {
BirchButton => "minecraft:birch_button",
JungleButton => "minecraft:jungle_button",
AcaciaButton => "minecraft:acacia_button",
CherryButton => "minecraft:cherry_button",
DarkOakButton => "minecraft:dark_oak_button",
MangroveButton => "minecraft:mangrove_button",
BambooButton => "minecraft:bamboo_button",
@ -585,6 +603,7 @@ enum Block {
RedStainedGlassPane => "minecraft:red_stained_glass_pane",
BlackStainedGlassPane => "minecraft:black_stained_glass_pane",
AcaciaStairs => "minecraft:acacia_stairs",
CherryStairs => "minecraft:cherry_stairs",
DarkOakStairs => "minecraft:dark_oak_stairs",
MangroveStairs => "minecraft:mangrove_stairs",
BambooStairs => "minecraft:bamboo_stairs",
@ -670,6 +689,7 @@ enum Block {
BirchSlab => "minecraft:birch_slab",
JungleSlab => "minecraft:jungle_slab",
AcaciaSlab => "minecraft:acacia_slab",
CherrySlab => "minecraft:cherry_slab",
DarkOakSlab => "minecraft:dark_oak_slab",
MangroveSlab => "minecraft:mangrove_slab",
BambooSlab => "minecraft:bamboo_slab",
@ -696,6 +716,7 @@ enum Block {
BirchFenceGate => "minecraft:birch_fence_gate",
JungleFenceGate => "minecraft:jungle_fence_gate",
AcaciaFenceGate => "minecraft:acacia_fence_gate",
CherryFenceGate => "minecraft:cherry_fence_gate",
DarkOakFenceGate => "minecraft:dark_oak_fence_gate",
MangroveFenceGate => "minecraft:mangrove_fence_gate",
BambooFenceGate => "minecraft:bamboo_fence_gate",
@ -703,6 +724,7 @@ enum Block {
BirchFence => "minecraft:birch_fence",
JungleFence => "minecraft:jungle_fence",
AcaciaFence => "minecraft:acacia_fence",
CherryFence => "minecraft:cherry_fence",
DarkOakFence => "minecraft:dark_oak_fence",
MangroveFence => "minecraft:mangrove_fence",
BambooFence => "minecraft:bamboo_fence",
@ -710,6 +732,7 @@ enum Block {
BirchDoor => "minecraft:birch_door",
JungleDoor => "minecraft:jungle_door",
AcaciaDoor => "minecraft:acacia_door",
CherryDoor => "minecraft:cherry_door",
DarkOakDoor => "minecraft:dark_oak_door",
MangroveDoor => "minecraft:mangrove_door",
BambooDoor => "minecraft:bamboo_door",
@ -720,6 +743,7 @@ enum Block {
PurpurPillar => "minecraft:purpur_pillar",
PurpurStairs => "minecraft:purpur_stairs",
EndStoneBricks => "minecraft:end_stone_bricks",
TorchflowerCrop => "minecraft:torchflower_crop",
Beetroots => "minecraft:beetroots",
DirtPath => "minecraft:dirt_path",
EndGateway => "minecraft:end_gateway",
@ -1079,6 +1103,7 @@ enum Block {
Azalea => "minecraft:azalea",
FloweringAzalea => "minecraft:flowering_azalea",
MossCarpet => "minecraft:moss_carpet",
PinkPetals => "minecraft:pink_petals",
MossBlock => "minecraft:moss_block",
BigDripleaf => "minecraft:big_dripleaf",
BigDripleafStem => "minecraft:big_dripleaf_stem",
@ -1118,6 +1143,7 @@ enum Block {
PearlescentFroglight => "minecraft:pearlescent_froglight",
Frogspawn => "minecraft:frogspawn",
ReinforcedDeepslate => "minecraft:reinforced_deepslate",
DecoratedPot => "minecraft:decorated_pot",
}
}
@ -1164,6 +1190,8 @@ enum BlockEntityKind {
SculkCatalyst => "minecraft:sculk_catalyst",
SculkShrieker => "minecraft:sculk_shrieker",
ChiseledBookshelf => "minecraft:chiseled_bookshelf",
SuspiciousSand => "minecraft:suspicious_sand",
DecoratedPot => "minecraft:decorated_pot",
}
}
@ -1267,6 +1295,7 @@ enum CommandArgumentKind {
ResourceKey => "minecraft:resource_key",
TemplateMirror => "minecraft:template_mirror",
TemplateRotation => "minecraft:template_rotation",
Heightmap => "minecraft:heightmap",
Uuid => "minecraft:uuid",
}
}
@ -1406,32 +1435,39 @@ enum EntityKind {
Bat => "minecraft:bat",
Bee => "minecraft:bee",
Blaze => "minecraft:blaze",
BlockDisplay => "minecraft:block_display",
Boat => "minecraft:boat",
ChestBoat => "minecraft:chest_boat",
Cat => "minecraft:cat",
Camel => "minecraft:camel",
Cat => "minecraft:cat",
CaveSpider => "minecraft:cave_spider",
ChestBoat => "minecraft:chest_boat",
ChestMinecart => "minecraft:chest_minecart",
Chicken => "minecraft:chicken",
Cod => "minecraft:cod",
CommandBlockMinecart => "minecraft:command_block_minecart",
Cow => "minecraft:cow",
Creeper => "minecraft:creeper",
Dolphin => "minecraft:dolphin",
Donkey => "minecraft:donkey",
DragonFireball => "minecraft:dragon_fireball",
Drowned => "minecraft:drowned",
Egg => "minecraft:egg",
ElderGuardian => "minecraft:elder_guardian",
EndCrystal => "minecraft:end_crystal",
EnderDragon => "minecraft:ender_dragon",
EnderPearl => "minecraft:ender_pearl",
Enderman => "minecraft:enderman",
Endermite => "minecraft:endermite",
Evoker => "minecraft:evoker",
EvokerFangs => "minecraft:evoker_fangs",
ExperienceBottle => "minecraft:experience_bottle",
ExperienceOrb => "minecraft:experience_orb",
EyeOfEnder => "minecraft:eye_of_ender",
FallingBlock => "minecraft:falling_block",
FireworkRocket => "minecraft:firework_rocket",
Fox => "minecraft:fox",
Frog => "minecraft:frog",
FurnaceMinecart => "minecraft:furnace_minecart",
Ghast => "minecraft:ghast",
Giant => "minecraft:giant",
GlowItemFrame => "minecraft:glow_item_frame",
@ -1439,11 +1475,14 @@ enum EntityKind {
Goat => "minecraft:goat",
Guardian => "minecraft:guardian",
Hoglin => "minecraft:hoglin",
HopperMinecart => "minecraft:hopper_minecart",
Horse => "minecraft:horse",
Husk => "minecraft:husk",
Illusioner => "minecraft:illusioner",
Interaction => "minecraft:interaction",
IronGolem => "minecraft:iron_golem",
Item => "minecraft:item",
ItemDisplay => "minecraft:item_display",
ItemFrame => "minecraft:item_frame",
Fireball => "minecraft:fireball",
LeashKnot => "minecraft:leash_knot",
@ -1453,14 +1492,8 @@ enum EntityKind {
MagmaCube => "minecraft:magma_cube",
Marker => "minecraft:marker",
Minecart => "minecraft:minecart",
ChestMinecart => "minecraft:chest_minecart",
CommandBlockMinecart => "minecraft:command_block_minecart",
FurnaceMinecart => "minecraft:furnace_minecart",
HopperMinecart => "minecraft:hopper_minecart",
SpawnerMinecart => "minecraft:spawner_minecart",
TntMinecart => "minecraft:tnt_minecart",
Mule => "minecraft:mule",
Mooshroom => "minecraft:mooshroom",
Mule => "minecraft:mule",
Ocelot => "minecraft:ocelot",
Painting => "minecraft:painting",
Panda => "minecraft:panda",
@ -1471,7 +1504,7 @@ enum EntityKind {
PiglinBrute => "minecraft:piglin_brute",
Pillager => "minecraft:pillager",
PolarBear => "minecraft:polar_bear",
Tnt => "minecraft:tnt",
Potion => "minecraft:potion",
Pufferfish => "minecraft:pufferfish",
Rabbit => "minecraft:rabbit",
Ravager => "minecraft:ravager",
@ -1484,20 +1517,21 @@ enum EntityKind {
SkeletonHorse => "minecraft:skeleton_horse",
Slime => "minecraft:slime",
SmallFireball => "minecraft:small_fireball",
Sniffer => "minecraft:sniffer",
SnowGolem => "minecraft:snow_golem",
Snowball => "minecraft:snowball",
SpawnerMinecart => "minecraft:spawner_minecart",
SpectralArrow => "minecraft:spectral_arrow",
Spider => "minecraft:spider",
Squid => "minecraft:squid",
Stray => "minecraft:stray",
Strider => "minecraft:strider",
Tadpole => "minecraft:tadpole",
Egg => "minecraft:egg",
EnderPearl => "minecraft:ender_pearl",
ExperienceBottle => "minecraft:experience_bottle",
Potion => "minecraft:potion",
Trident => "minecraft:trident",
TextDisplay => "minecraft:text_display",
Tnt => "minecraft:tnt",
TntMinecart => "minecraft:tnt_minecart",
TraderLlama => "minecraft:trader_llama",
Trident => "minecraft:trident",
TropicalFish => "minecraft:tropical_fish",
Turtle => "minecraft:turtle",
Vex => "minecraft:vex",
@ -1566,7 +1600,9 @@ enum GameEvent {
ElytraGlide => "minecraft:elytra_glide",
EntityDamage => "minecraft:entity_damage",
EntityDie => "minecraft:entity_die",
EntityDismount => "minecraft:entity_dismount",
EntityInteract => "minecraft:entity_interact",
EntityMount => "minecraft:entity_mount",
EntityPlace => "minecraft:entity_place",
EntityRoar => "minecraft:entity_roar",
EntityShake => "minecraft:entity_shake",
@ -1663,6 +1699,7 @@ enum Item {
BirchPlanks => "minecraft:birch_planks",
JunglePlanks => "minecraft:jungle_planks",
AcaciaPlanks => "minecraft:acacia_planks",
CherryPlanks => "minecraft:cherry_planks",
DarkOakPlanks => "minecraft:dark_oak_planks",
MangrovePlanks => "minecraft:mangrove_planks",
BambooPlanks => "minecraft:bamboo_planks",
@ -1674,10 +1711,12 @@ enum Item {
BirchSapling => "minecraft:birch_sapling",
JungleSapling => "minecraft:jungle_sapling",
AcaciaSapling => "minecraft:acacia_sapling",
CherrySapling => "minecraft:cherry_sapling",
DarkOakSapling => "minecraft:dark_oak_sapling",
MangrovePropagule => "minecraft:mangrove_propagule",
Bedrock => "minecraft:bedrock",
Sand => "minecraft:sand",
SuspiciousSand => "minecraft:suspicious_sand",
RedSand => "minecraft:red_sand",
Gravel => "minecraft:gravel",
CoalOre => "minecraft:coal_ore",
@ -1746,6 +1785,7 @@ enum Item {
BirchLog => "minecraft:birch_log",
JungleLog => "minecraft:jungle_log",
AcaciaLog => "minecraft:acacia_log",
CherryLog => "minecraft:cherry_log",
DarkOakLog => "minecraft:dark_oak_log",
MangroveLog => "minecraft:mangrove_log",
MangroveRoots => "minecraft:mangrove_roots",
@ -1758,6 +1798,7 @@ enum Item {
StrippedBirchLog => "minecraft:stripped_birch_log",
StrippedJungleLog => "minecraft:stripped_jungle_log",
StrippedAcaciaLog => "minecraft:stripped_acacia_log",
StrippedCherryLog => "minecraft:stripped_cherry_log",
StrippedDarkOakLog => "minecraft:stripped_dark_oak_log",
StrippedMangroveLog => "minecraft:stripped_mangrove_log",
StrippedCrimsonStem => "minecraft:stripped_crimson_stem",
@ -1767,6 +1808,7 @@ enum Item {
StrippedBirchWood => "minecraft:stripped_birch_wood",
StrippedJungleWood => "minecraft:stripped_jungle_wood",
StrippedAcaciaWood => "minecraft:stripped_acacia_wood",
StrippedCherryWood => "minecraft:stripped_cherry_wood",
StrippedDarkOakWood => "minecraft:stripped_dark_oak_wood",
StrippedMangroveWood => "minecraft:stripped_mangrove_wood",
StrippedCrimsonHyphae => "minecraft:stripped_crimson_hyphae",
@ -1777,6 +1819,7 @@ enum Item {
BirchWood => "minecraft:birch_wood",
JungleWood => "minecraft:jungle_wood",
AcaciaWood => "minecraft:acacia_wood",
CherryWood => "minecraft:cherry_wood",
DarkOakWood => "minecraft:dark_oak_wood",
MangroveWood => "minecraft:mangrove_wood",
CrimsonHyphae => "minecraft:crimson_hyphae",
@ -1786,6 +1829,7 @@ enum Item {
BirchLeaves => "minecraft:birch_leaves",
JungleLeaves => "minecraft:jungle_leaves",
AcaciaLeaves => "minecraft:acacia_leaves",
CherryLeaves => "minecraft:cherry_leaves",
DarkOakLeaves => "minecraft:dark_oak_leaves",
MangroveLeaves => "minecraft:mangrove_leaves",
AzaleaLeaves => "minecraft:azalea_leaves",
@ -1835,6 +1879,7 @@ enum Item {
Cornflower => "minecraft:cornflower",
LilyOfTheValley => "minecraft:lily_of_the_valley",
WitherRose => "minecraft:wither_rose",
Torchflower => "minecraft:torchflower",
SporeBlossom => "minecraft:spore_blossom",
BrownMushroom => "minecraft:brown_mushroom",
RedMushroom => "minecraft:red_mushroom",
@ -1848,6 +1893,7 @@ enum Item {
SugarCane => "minecraft:sugar_cane",
Kelp => "minecraft:kelp",
MossCarpet => "minecraft:moss_carpet",
PinkPetals => "minecraft:pink_petals",
MossBlock => "minecraft:moss_block",
HangingRoots => "minecraft:hanging_roots",
BigDripleaf => "minecraft:big_dripleaf",
@ -1858,6 +1904,7 @@ enum Item {
BirchSlab => "minecraft:birch_slab",
JungleSlab => "minecraft:jungle_slab",
AcaciaSlab => "minecraft:acacia_slab",
CherrySlab => "minecraft:cherry_slab",
DarkOakSlab => "minecraft:dark_oak_slab",
MangroveSlab => "minecraft:mangrove_slab",
BambooSlab => "minecraft:bamboo_slab",
@ -1888,6 +1935,7 @@ enum Item {
Bricks => "minecraft:bricks",
Bookshelf => "minecraft:bookshelf",
ChiseledBookshelf => "minecraft:chiseled_bookshelf",
DecoratedPot => "minecraft:decorated_pot",
MossyCobblestone => "minecraft:mossy_cobblestone",
Obsidian => "minecraft:obsidian",
Torch => "minecraft:torch",
@ -1915,6 +1963,7 @@ enum Item {
BirchFence => "minecraft:birch_fence",
JungleFence => "minecraft:jungle_fence",
AcaciaFence => "minecraft:acacia_fence",
CherryFence => "minecraft:cherry_fence",
DarkOakFence => "minecraft:dark_oak_fence",
MangroveFence => "minecraft:mangrove_fence",
BambooFence => "minecraft:bamboo_fence",
@ -1986,6 +2035,7 @@ enum Item {
BirchStairs => "minecraft:birch_stairs",
JungleStairs => "minecraft:jungle_stairs",
AcaciaStairs => "minecraft:acacia_stairs",
CherryStairs => "minecraft:cherry_stairs",
DarkOakStairs => "minecraft:dark_oak_stairs",
MangroveStairs => "minecraft:mangrove_stairs",
BambooStairs => "minecraft:bamboo_stairs",
@ -2284,6 +2334,7 @@ enum Item {
BirchButton => "minecraft:birch_button",
JungleButton => "minecraft:jungle_button",
AcaciaButton => "minecraft:acacia_button",
CherryButton => "minecraft:cherry_button",
DarkOakButton => "minecraft:dark_oak_button",
MangroveButton => "minecraft:mangrove_button",
BambooButton => "minecraft:bamboo_button",
@ -2298,6 +2349,7 @@ enum Item {
BirchPressurePlate => "minecraft:birch_pressure_plate",
JunglePressurePlate => "minecraft:jungle_pressure_plate",
AcaciaPressurePlate => "minecraft:acacia_pressure_plate",
CherryPressurePlate => "minecraft:cherry_pressure_plate",
DarkOakPressurePlate => "minecraft:dark_oak_pressure_plate",
MangrovePressurePlate => "minecraft:mangrove_pressure_plate",
BambooPressurePlate => "minecraft:bamboo_pressure_plate",
@ -2309,6 +2361,7 @@ enum Item {
BirchDoor => "minecraft:birch_door",
JungleDoor => "minecraft:jungle_door",
AcaciaDoor => "minecraft:acacia_door",
CherryDoor => "minecraft:cherry_door",
DarkOakDoor => "minecraft:dark_oak_door",
MangroveDoor => "minecraft:mangrove_door",
BambooDoor => "minecraft:bamboo_door",
@ -2320,6 +2373,7 @@ enum Item {
BirchTrapdoor => "minecraft:birch_trapdoor",
JungleTrapdoor => "minecraft:jungle_trapdoor",
AcaciaTrapdoor => "minecraft:acacia_trapdoor",
CherryTrapdoor => "minecraft:cherry_trapdoor",
DarkOakTrapdoor => "minecraft:dark_oak_trapdoor",
MangroveTrapdoor => "minecraft:mangrove_trapdoor",
BambooTrapdoor => "minecraft:bamboo_trapdoor",
@ -2330,6 +2384,7 @@ enum Item {
BirchFenceGate => "minecraft:birch_fence_gate",
JungleFenceGate => "minecraft:jungle_fence_gate",
AcaciaFenceGate => "minecraft:acacia_fence_gate",
CherryFenceGate => "minecraft:cherry_fence_gate",
DarkOakFenceGate => "minecraft:dark_oak_fence_gate",
MangroveFenceGate => "minecraft:mangrove_fence_gate",
BambooFenceGate => "minecraft:bamboo_fence_gate",
@ -2358,6 +2413,8 @@ enum Item {
JungleChestBoat => "minecraft:jungle_chest_boat",
AcaciaBoat => "minecraft:acacia_boat",
AcaciaChestBoat => "minecraft:acacia_chest_boat",
CherryBoat => "minecraft:cherry_boat",
CherryChestBoat => "minecraft:cherry_chest_boat",
DarkOakBoat => "minecraft:dark_oak_boat",
DarkOakChestBoat => "minecraft:dark_oak_chest_boat",
MangroveBoat => "minecraft:mangrove_boat",
@ -2461,6 +2518,7 @@ enum Item {
BirchSign => "minecraft:birch_sign",
JungleSign => "minecraft:jungle_sign",
AcaciaSign => "minecraft:acacia_sign",
CherrySign => "minecraft:cherry_sign",
DarkOakSign => "minecraft:dark_oak_sign",
MangroveSign => "minecraft:mangrove_sign",
BambooSign => "minecraft:bamboo_sign",
@ -2471,6 +2529,7 @@ enum Item {
BirchHangingSign => "minecraft:birch_hanging_sign",
JungleHangingSign => "minecraft:jungle_hanging_sign",
AcaciaHangingSign => "minecraft:acacia_hanging_sign",
CherryHangingSign => "minecraft:cherry_hanging_sign",
DarkOakHangingSign => "minecraft:dark_oak_hanging_sign",
MangroveHangingSign => "minecraft:mangrove_hanging_sign",
BambooHangingSign => "minecraft:bamboo_hanging_sign",
@ -2628,6 +2687,7 @@ enum Item {
SkeletonSpawnEgg => "minecraft:skeleton_spawn_egg",
SkeletonHorseSpawnEgg => "minecraft:skeleton_horse_spawn_egg",
SlimeSpawnEgg => "minecraft:slime_spawn_egg",
SnifferSpawnEgg => "minecraft:sniffer_spawn_egg",
SnowGolemSpawnEgg => "minecraft:snow_golem_spawn_egg",
SpiderSpawnEgg => "minecraft:spider_spawn_egg",
SquidSpawnEgg => "minecraft:squid_spawn_egg",
@ -2713,6 +2773,7 @@ enum Item {
EndCrystal => "minecraft:end_crystal",
ChorusFruit => "minecraft:chorus_fruit",
PoppedChorusFruit => "minecraft:popped_chorus_fruit",
TorchflowerSeeds => "minecraft:torchflower_seeds",
Beetroot => "minecraft:beetroot",
BeetrootSeeds => "minecraft:beetroot_seeds",
BeetrootSoup => "minecraft:beetroot_soup",
@ -2821,6 +2882,23 @@ enum Item {
PearlescentFroglight => "minecraft:pearlescent_froglight",
Frogspawn => "minecraft:frogspawn",
EchoShard => "minecraft:echo_shard",
Brush => "minecraft:brush",
NetheriteUpgradeSmithingTemplate => "minecraft:netherite_upgrade_smithing_template",
SentryArmorTrimSmithingTemplate => "minecraft:sentry_armor_trim_smithing_template",
DuneArmorTrimSmithingTemplate => "minecraft:dune_armor_trim_smithing_template",
CoastArmorTrimSmithingTemplate => "minecraft:coast_armor_trim_smithing_template",
WildArmorTrimSmithingTemplate => "minecraft:wild_armor_trim_smithing_template",
WardArmorTrimSmithingTemplate => "minecraft:ward_armor_trim_smithing_template",
EyeArmorTrimSmithingTemplate => "minecraft:eye_armor_trim_smithing_template",
VexArmorTrimSmithingTemplate => "minecraft:vex_armor_trim_smithing_template",
TideArmorTrimSmithingTemplate => "minecraft:tide_armor_trim_smithing_template",
SnoutArmorTrimSmithingTemplate => "minecraft:snout_armor_trim_smithing_template",
RibArmorTrimSmithingTemplate => "minecraft:rib_armor_trim_smithing_template",
SpireArmorTrimSmithingTemplate => "minecraft:spire_armor_trim_smithing_template",
PotteryShardArcher => "minecraft:pottery_shard_archer",
PotteryShardPrize => "minecraft:pottery_shard_prize",
PotteryShardArmsUp => "minecraft:pottery_shard_arms_up",
PotteryShardSkull => "minecraft:pottery_shard_skull",
}
}
@ -3007,6 +3085,10 @@ enum MemoryModuleKind {
LikedNoteblock => "minecraft:liked_noteblock",
LikedNoteblockCooldownTicks => "minecraft:liked_noteblock_cooldown_ticks",
ItemPickupCooldownTicks => "minecraft:item_pickup_cooldown_ticks",
SnifferExploredPositions => "minecraft:sniffer_explored_positions",
SnifferSniffingTarget => "minecraft:sniffer_sniffing_target",
SnifferDigging => "minecraft:sniffer_digging",
SnifferHappy => "minecraft:sniffer_happy",
}
}
@ -3032,6 +3114,7 @@ enum MenuKind {
Loom => "minecraft:loom",
Merchant => "minecraft:merchant",
ShulkerBox => "minecraft:shulker_box",
LegacySmithing => "minecraft:legacy_smithing",
Smithing => "minecraft:smithing",
Smoker => "minecraft:smoker",
CartographyTable => "minecraft:cartography_table",
@ -3143,6 +3226,9 @@ enum ParticleKind {
Firework => "minecraft:firework",
Fishing => "minecraft:fishing",
Flame => "minecraft:flame",
DrippingCherryLeaves => "minecraft:dripping_cherry_leaves",
FallingCherryLeaves => "minecraft:falling_cherry_leaves",
LandingCherryLeaves => "minecraft:landing_cherry_leaves",
SculkSoul => "minecraft:sculk_soul",
SculkCharge => "minecraft:sculk_charge",
SculkChargePop => "minecraft:sculk_charge_pop",
@ -3321,6 +3407,9 @@ enum RecipeSerializer {
CampfireCooking => "minecraft:campfire_cooking",
Stonecutting => "minecraft:stonecutting",
Smithing => "minecraft:smithing",
SmithingTransform => "minecraft:smithing_transform",
SmithingTrim => "minecraft:smithing_trim",
CraftingDecoratedPot => "minecraft:crafting_decorated_pot",
}
}
@ -3551,6 +3640,8 @@ enum SoundEvent {
ItemBottleFill => "minecraft:item.bottle.fill",
ItemBottleFillDragonbreath => "minecraft:item.bottle.fill_dragonbreath",
BlockBrewingStandBrew => "minecraft:block.brewing_stand.brew",
ItemBrushBrushing => "minecraft:item.brush.brushing",
ItemBrushBrushSandCompleted => "minecraft:item.brush.brush_sand_completed",
BlockBubbleColumnBubblePop => "minecraft:block.bubble_column.bubble_pop",
BlockBubbleColumnUpwardsAmbient => "minecraft:block.bubble_column.upwards_ambient",
BlockBubbleColumnUpwardsInside => "minecraft:block.bubble_column.upwards_inside",
@ -3616,6 +3707,36 @@ enum SoundEvent {
BlockChainHit => "minecraft:block.chain.hit",
BlockChainPlace => "minecraft:block.chain.place",
BlockChainStep => "minecraft:block.chain.step",
BlockCherryWoodBreak => "minecraft:block.cherry_wood.break",
BlockCherryWoodFall => "minecraft:block.cherry_wood.fall",
BlockCherryWoodHit => "minecraft:block.cherry_wood.hit",
BlockCherryWoodPlace => "minecraft:block.cherry_wood.place",
BlockCherryWoodStep => "minecraft:block.cherry_wood.step",
BlockCherrySaplingBreak => "minecraft:block.cherry_sapling.break",
BlockCherrySaplingFall => "minecraft:block.cherry_sapling.fall",
BlockCherrySaplingHit => "minecraft:block.cherry_sapling.hit",
BlockCherrySaplingPlace => "minecraft:block.cherry_sapling.place",
BlockCherrySaplingStep => "minecraft:block.cherry_sapling.step",
BlockCherryLeavesBreak => "minecraft:block.cherry_leaves.break",
BlockCherryLeavesFall => "minecraft:block.cherry_leaves.fall",
BlockCherryLeavesHit => "minecraft:block.cherry_leaves.hit",
BlockCherryLeavesPlace => "minecraft:block.cherry_leaves.place",
BlockCherryLeavesStep => "minecraft:block.cherry_leaves.step",
BlockCherryWoodHangingSignStep => "minecraft:block.cherry_wood_hanging_sign.step",
BlockCherryWoodHangingSignBreak => "minecraft:block.cherry_wood_hanging_sign.break",
BlockCherryWoodHangingSignFall => "minecraft:block.cherry_wood_hanging_sign.fall",
BlockCherryWoodHangingSignHit => "minecraft:block.cherry_wood_hanging_sign.hit",
BlockCherryWoodHangingSignPlace => "minecraft:block.cherry_wood_hanging_sign.place",
BlockCherryWoodDoorClose => "minecraft:block.cherry_wood_door.close",
BlockCherryWoodDoorOpen => "minecraft:block.cherry_wood_door.open",
BlockCherryWoodTrapdoorClose => "minecraft:block.cherry_wood_trapdoor.close",
BlockCherryWoodTrapdoorOpen => "minecraft:block.cherry_wood_trapdoor.open",
BlockCherryWoodButtonClickOff => "minecraft:block.cherry_wood_button.click_off",
BlockCherryWoodButtonClickOn => "minecraft:block.cherry_wood_button.click_on",
BlockCherryWoodPressurePlateClickOff => "minecraft:block.cherry_wood_pressure_plate.click_off",
BlockCherryWoodPressurePlateClickOn => "minecraft:block.cherry_wood_pressure_plate.click_on",
BlockCherryWoodFenceGateClose => "minecraft:block.cherry_wood_fence_gate.close",
BlockCherryWoodFenceGateOpen => "minecraft:block.cherry_wood_fence_gate.open",
BlockChestClose => "minecraft:block.chest.close",
BlockChestLocked => "minecraft:block.chest.locked",
BlockChestOpen => "minecraft:block.chest.open",
@ -3678,6 +3799,12 @@ enum SoundEvent {
ItemCrossbowQuickCharge2 => "minecraft:item.crossbow.quick_charge_2",
ItemCrossbowQuickCharge3 => "minecraft:item.crossbow.quick_charge_3",
ItemCrossbowShoot => "minecraft:item.crossbow.shoot",
BlockDecoratedPotBreak => "minecraft:block.decorated_pot.break",
BlockDecoratedPotFall => "minecraft:block.decorated_pot.fall",
BlockDecoratedPotHit => "minecraft:block.decorated_pot.hit",
BlockDecoratedPotStep => "minecraft:block.decorated_pot.step",
BlockDecoratedPotPlace => "minecraft:block.decorated_pot.place",
BlockDecoratedPotShatter => "minecraft:block.decorated_pot.shatter",
BlockDeepslateBricksBreak => "minecraft:block.deepslate_bricks.break",
BlockDeepslateBricksFall => "minecraft:block.deepslate_bricks.fall",
BlockDeepslateBricksHit => "minecraft:block.deepslate_bricks.hit",
@ -3820,6 +3947,11 @@ enum SoundEvent {
EntityFoxSniff => "minecraft:entity.fox.sniff",
EntityFoxSpit => "minecraft:entity.fox.spit",
EntityFoxTeleport => "minecraft:entity.fox.teleport",
BlockSuspiciousSandBreak => "minecraft:block.suspicious_sand.break",
BlockSuspiciousSandStep => "minecraft:block.suspicious_sand.step",
BlockSuspiciousSandPlace => "minecraft:block.suspicious_sand.place",
BlockSuspiciousSandHit => "minecraft:block.suspicious_sand.hit",
BlockSuspiciousSandFall => "minecraft:block.suspicious_sand.fall",
BlockFroglightBreak => "minecraft:block.froglight.break",
BlockFroglightFall => "minecraft:block.froglight.fall",
BlockFroglightHit => "minecraft:block.froglight.hit",
@ -4086,6 +4218,11 @@ enum SoundEvent {
BlockMossCarpetHit => "minecraft:block.moss_carpet.hit",
BlockMossCarpetPlace => "minecraft:block.moss_carpet.place",
BlockMossCarpetStep => "minecraft:block.moss_carpet.step",
BlockPinkPetalsBreak => "minecraft:block.pink_petals.break",
BlockPinkPetalsFall => "minecraft:block.pink_petals.fall",
BlockPinkPetalsHit => "minecraft:block.pink_petals.hit",
BlockPinkPetalsPlace => "minecraft:block.pink_petals.place",
BlockPinkPetalsStep => "minecraft:block.pink_petals.step",
BlockMossBreak => "minecraft:block.moss.break",
BlockMossFall => "minecraft:block.moss.fall",
BlockMossHit => "minecraft:block.moss.hit",
@ -4144,6 +4281,7 @@ enum SoundEvent {
MusicOverworldJungleAndForest => "minecraft:music.overworld.jungle_and_forest",
MusicOverworldOldGrowthTaiga => "minecraft:music.overworld.old_growth_taiga",
MusicOverworldMeadow => "minecraft:music.overworld.meadow",
MusicOverworldCherryGrove => "minecraft:music.overworld.cherry_grove",
MusicNetherNetherWastes => "minecraft:music.nether.nether_wastes",
MusicOverworldFrozenPeaks => "minecraft:music.overworld.frozen_peaks",
MusicOverworldSnowySlopes => "minecraft:music.overworld.snowy_slopes",
@ -4173,6 +4311,7 @@ enum SoundEvent {
BlockNetherWoodPressurePlateClickOn => "minecraft:block.nether_wood_pressure_plate.click_on",
BlockNetherWoodFenceGateClose => "minecraft:block.nether_wood_fence_gate.close",
BlockNetherWoodFenceGateOpen => "minecraft:block.nether_wood_fence_gate.open",
IntentionallyEmpty => "minecraft:intentionally_empty",
BlockPackedMudBreak => "minecraft:block.packed_mud.break",
BlockPackedMudFall => "minecraft:block.packed_mud.fall",
BlockPackedMudHit => "minecraft:block.packed_mud.hit",
@ -4545,6 +4684,18 @@ enum SoundEvent {
EntitySlimeSquishSmall => "minecraft:entity.slime.squish_small",
BlockSmithingTableUse => "minecraft:block.smithing_table.use",
BlockSmokerSmoke => "minecraft:block.smoker.smoke",
EntitySnifferStep => "minecraft:entity.sniffer.step",
EntitySnifferEat => "minecraft:entity.sniffer.eat",
EntitySnifferIdle => "minecraft:entity.sniffer.idle",
EntitySnifferHurt => "minecraft:entity.sniffer.hurt",
EntitySnifferDeath => "minecraft:entity.sniffer.death",
EntitySnifferDropSeed => "minecraft:entity.sniffer.drop_seed",
EntitySnifferScenting => "minecraft:entity.sniffer.scenting",
EntitySnifferSniffing => "minecraft:entity.sniffer.sniffing",
EntitySnifferSearching => "minecraft:entity.sniffer.searching",
EntitySnifferDigging => "minecraft:entity.sniffer.digging",
EntitySnifferDiggingStop => "minecraft:entity.sniffer.digging_stop",
EntitySnifferHappy => "minecraft:entity.sniffer.happy",
EntitySnowballThrow => "minecraft:entity.snowball.throw",
BlockSnowBreak => "minecraft:block.snow.break",
BlockSnowFall => "minecraft:block.snow.fall",
@ -4734,14 +4885,14 @@ enum SoundEvent {
BlockWoodenDoorOpen => "minecraft:block.wooden_door.open",
BlockWoodenTrapdoorClose => "minecraft:block.wooden_trapdoor.close",
BlockWoodenTrapdoorOpen => "minecraft:block.wooden_trapdoor.open",
BlockWoodBreak => "minecraft:block.wood.break",
BlockWoodenButtonClickOff => "minecraft:block.wooden_button.click_off",
BlockWoodenButtonClickOn => "minecraft:block.wooden_button.click_on",
BlockWoodenPressurePlateClickOff => "minecraft:block.wooden_pressure_plate.click_off",
BlockWoodenPressurePlateClickOn => "minecraft:block.wooden_pressure_plate.click_on",
BlockWoodBreak => "minecraft:block.wood.break",
BlockWoodFall => "minecraft:block.wood.fall",
BlockWoodHit => "minecraft:block.wood.hit",
BlockWoodPlace => "minecraft:block.wood.place",
BlockWoodenPressurePlateClickOff => "minecraft:block.wooden_pressure_plate.click_off",
BlockWoodenPressurePlateClickOn => "minecraft:block.wooden_pressure_plate.click_on",
BlockWoodStep => "minecraft:block.wood.step",
BlockWoolBreak => "minecraft:block.wool.break",
BlockWoolFall => "minecraft:block.wool.fall",
@ -4985,6 +5136,7 @@ enum WorldgenFoliagePlacerKind {
MegaPineFoliagePlacer => "minecraft:mega_pine_foliage_placer",
DarkOakFoliagePlacer => "minecraft:dark_oak_foliage_placer",
RandomSpreadFoliagePlacer => "minecraft:random_spread_foliage_placer",
CherryFoliagePlacer => "minecraft:cherry_foliage_placer",
}
}
@ -5174,5 +5326,17 @@ enum WorldgenTrunkPlacerKind {
FancyTrunkPlacer => "minecraft:fancy_trunk_placer",
BendingTrunkPlacer => "minecraft:bending_trunk_placer",
UpwardsBranchingTrunkPlacer => "minecraft:upwards_branching_trunk_placer",
CherryTrunkPlacer => "minecraft:cherry_trunk_placer",
}
}
registry! {
enum DecoratedPotPatterns {
PotteryPatternArcher => "minecraft:pottery_pattern_archer",
PotteryPatternPrize => "minecraft:pottery_pattern_prize",
PotteryPatternArmsUp => "minecraft:pottery_pattern_arms_up",
PotteryPatternSkull => "minecraft:pottery_pattern_skull",
DecoratedPotSide => "minecraft:decorated_pot_side",
DecoratedPotBase => "minecraft:decorated_pot_base",
}
}

View file

@ -1,11 +1,10 @@
//! Define some types needed for entity metadata.
use azalea_block::BlockState;
use azalea_buf::{
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
};
use azalea_chat::FormattedText;
use azalea_core::{BlockPos, Direction, GlobalPos, Particle};
use azalea_core::{BlockPos, Direction, GlobalPos, Particle, Vec3};
use azalea_inventory::ItemSlot;
use bevy_ecs::component::Component;
use derive_more::Deref;
@ -51,6 +50,8 @@ impl McBufWritable for EntityMetadataItems {
}
}
// Note: This enum is partially generated and parsed by
// codegen/lib/code/entity.py
#[derive(Clone, Debug, EnumAsInner, McBuf)]
pub enum EntityDataValue {
Byte(u8),
@ -67,9 +68,9 @@ pub enum EntityDataValue {
OptionalBlockPos(Option<BlockPos>),
Direction(Direction),
OptionalUuid(Option<Uuid>),
// 0 for absent (implies air); otherwise, a block state ID as per the global palette
// this is a varint
BlockState(BlockState),
BlockState(azalea_block::BlockState),
/// If this is air, that means it's absent,
OptionalBlockState(azalea_block::BlockState),
CompoundTag(azalea_nbt::Tag),
Particle(Particle),
VillagerData(VillagerData),
@ -80,11 +81,22 @@ pub enum EntityDataValue {
FrogVariant(azalea_registry::FrogVariant),
OptionalGlobalPos(Option<GlobalPos>),
PaintingVariant(azalea_registry::PaintingVariant),
SnifferState(SnifferState),
Vector3(Vec3),
Quaternion(Quaternion),
}
#[derive(Clone, Debug)]
pub struct OptionalUnsignedInt(pub Option<u32>);
#[derive(Clone, Debug, McBuf)]
pub struct Quaternion {
pub x: f32,
pub y: f32,
pub z: f32,
pub w: f32,
}
impl McBufReadable for OptionalUnsignedInt {
fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
let val = u32::var_read_from(buf)?;
@ -161,3 +173,15 @@ impl TryFrom<EntityMetadataItems> for Vec<EntityDataValue> {
Ok(data)
}
}
#[derive(Debug, Copy, Clone, McBuf, Default)]
pub enum SnifferState {
#[default]
Idling,
FeelingHappy,
Scenting,
Sniffing,
Searching,
Digging,
Rising,
}

File diff suppressed because it is too large Load diff

View file

@ -9,9 +9,9 @@ version_id = lib.code.version.get_version_id()
mappings = lib.download.get_mappings_for_version(version_id)
burger_data = lib.extract.get_burger_data_for_version(version_id)
burger_entity_data = burger_data[0]['entities']['entity']
burger_entities_data = burger_data[0]['entities']
lib.code.entity.generate_entity_metadata(burger_entity_data, mappings)
lib.code.entity.generate_entity_metadata(burger_entities_data, mappings)
lib.code.utils.fmt()

View file

@ -1,4 +1,6 @@
from lib.utils import to_camel_case, to_snake_case, get_dir_location, upper_first_letter
from lib.code.packet import burger_instruction_to_code
from lib.code.utils import burger_type_to_rust_type
from lib.mappings import Mappings
from typing import Optional
import re
@ -6,35 +8,91 @@ import re
METADATA_RS_DIR = get_dir_location(
'../azalea-world/src/entity/metadata.rs')
DATA_RS_DIR = get_dir_location(
'../azalea-world/src/entity/data.rs')
def generate_entity_metadata(burger_entity_data: dict, mappings: Mappings):
# TODO: auto generate this and use it for generating the EntityDataValue enum
metadata_types = [
{'name': 'Byte', 'type': 'u8'},
{'name': 'Int', 'type': 'i32', 'var': True},
{'name': 'Long', 'type': 'i64'},
{'name': 'Float', 'type': 'f32'},
{'name': 'String', 'type': 'String'},
{'name': 'FormattedText', 'type': 'FormattedText'},
{'name': 'OptionalFormattedText', 'type': 'Option<FormattedText>'},
{'name': 'ItemStack', 'type': 'ItemSlot'},
{'name': 'Boolean', 'type': 'bool'},
{'name': 'Rotations', 'type': 'Rotations'},
{'name': 'BlockPos', 'type': 'BlockPos'},
{'name': 'OptionalBlockPos', 'type': 'Option<BlockPos>'},
{'name': 'Direction', 'type': 'Direction'},
{'name': 'OptionalUuid', 'type': 'Option<Uuid>'},
{'name': 'BlockState', 'type': 'BlockState'},
{'name': 'CompoundTag', 'type': 'azalea_nbt::Tag'},
{'name': 'Particle', 'type': 'Particle'},
{'name': 'VillagerData', 'type': 'VillagerData'},
{'name': 'OptionalUnsignedInt', 'type': 'OptionalUnsignedInt'},
{'name': 'Pose', 'type': 'Pose'},
{'name': 'CatVariant', 'type': 'azalea_registry::CatVariant'},
{'name': 'FrogVariant', 'type': 'azalea_registry::FrogVariant'},
{'name': 'GlobalPos', 'type': 'GlobalPos'},
{'name': 'PaintingVariant', 'type': 'azalea_registry::PaintingVariant'}
]
def generate_metadata_names(burger_dataserializers: dict, mappings: Mappings):
serializer_names: list[Optional[str]] = [None] * len(burger_dataserializers)
for burger_serializer in burger_dataserializers.values():
print(burger_serializer)
# burger gives us the wrong class, so we do this instead
data_serializers_class = mappings.get_class_from_deobfuscated_name('net.minecraft.network.syncher.EntityDataSerializers')
mojmap_name = mappings.get_field(data_serializers_class, burger_serializer['field']).lower()
if mojmap_name == 'component':
mojmap_name = 'formatted_text'
elif mojmap_name == 'optional_component':
mojmap_name = 'optional_formatted_text'
serializer_names[burger_serializer['id']] = upper_first_letter(to_camel_case(mojmap_name))
return serializer_names
def parse_metadata_types_from_code():
with open(DATA_RS_DIR, 'r') as f:
lines = f.read().splitlines()
data = []
in_enum = False
for line in lines:
if line == 'pub enum EntityDataValue {':
in_enum = True
elif line == '}':
in_enum = False
elif in_enum:
line = line.strip()
if line.startswith('//'): continue
name, type = line.rstrip('),').split('(')
is_var = False
if type.startswith('#[var] '):
is_var = True
type = type[len('#[var] '):]
data.append({
'name': name,
'type': type,
'var': is_var
})
print(data)
return data
def generate_entity_metadata(burger_entities_data: dict, mappings: Mappings):
burger_entity_metadata = burger_entities_data['entity']
new_metadata_names = generate_metadata_names(burger_entities_data['dataserializers'], mappings)
parsed_metadata_types = parse_metadata_types_from_code()
parsed_metadata_names = []
for t in parsed_metadata_types:
parsed_metadata_names.append(t['name'])
with open(DATA_RS_DIR, 'r') as f:
lines = f.read().splitlines()
# add the metadata names that weren't there before to the end of the enum.
# this technically might cause them to be in the wrong order but i decided
# making it correct while preserving comments was too annoying so i didn't
added_metadata_names = []
for n in new_metadata_names:
if n not in parsed_metadata_names:
added_metadata_names.append(n)
if added_metadata_names != []:
in_enum = False
for i, line in enumerate(list(lines)):
if line == 'pub enum EntityDataValue {':
in_enum = True
elif in_enum and line == '}':
in_enum = False
for n in added_metadata_names:
lines.insert(i, f'{n}(TODO),')
i += 1
print(lines)
with open(DATA_RS_DIR, 'w') as f:
f.write('\n'.join(lines))
print('Expected metadata types:\n' + '\n'.join(new_metadata_names))
print('Updated metadata types in azalea-world/src/entity/data.rs, go make sure they\'re correct and then press enter')
input()
metadata_types = parse_metadata_types_from_code()
code = []
code.append('''#![allow(clippy::single_match)]
@ -42,10 +100,12 @@ def generate_entity_metadata(burger_entity_data: dict, mappings: Mappings):
// This file is generated from codegen/lib/code/entity.py.
// Don't change it manually!
use super::{EntityDataItem, EntityDataValue, OptionalUnsignedInt, Pose, Rotations, VillagerData};
use azalea_block::BlockState;
use super::{
EntityDataItem, EntityDataValue, OptionalUnsignedInt, Pose, Quaternion, Rotations,
SnifferState, VillagerData
};
use azalea_chat::FormattedText;
use azalea_core::{BlockPos, Direction, Particle};
use azalea_core::{BlockPos, Direction, Particle, Vec3};
use azalea_inventory::ItemSlot;
use bevy_ecs::{bundle::Bundle, component::Component};
use derive_more::{Deref, DerefMut};
@ -75,9 +135,9 @@ impl From<EntityDataValue> for UpdateMetadataError {
# build the duplicate_field_names set
previous_field_names = set()
duplicate_field_names = set()
for entity_id in burger_entity_data.keys():
for entity_id in burger_entity_metadata.keys():
field_name_map[entity_id] = {}
for field_name_or_bitfield in get_entity_metadata_names(entity_id, burger_entity_data, mappings).values():
for field_name_or_bitfield in get_entity_metadata_names(entity_id, burger_entity_metadata, mappings).values():
if isinstance(field_name_or_bitfield, str):
if field_name_or_bitfield in previous_field_names:
duplicate_field_names.add(field_name_or_bitfield)
@ -100,8 +160,8 @@ impl From<EntityDataValue> for UpdateMetadataError {
raise Exception(f'{name} should only exist once')
# and now figure out what to rename them to
for entity_id in burger_entity_data.keys():
for index, field_name_or_bitfield in get_entity_metadata_names(entity_id, burger_entity_data, mappings).items():
for entity_id in burger_entity_metadata.keys():
for index, field_name_or_bitfield in get_entity_metadata_names(entity_id, burger_entity_metadata, mappings).items():
if isinstance(field_name_or_bitfield, str):
new_field_name = field_name_or_bitfield
if new_field_name == 'type':
@ -130,14 +190,14 @@ impl From<EntityDataValue> for UpdateMetadataError {
return field_name_map[entity_ids_for_all_field_names_or_bitfields[index]][name]
return name
parents = get_entity_parents(entity_id, burger_entity_data)
parents = get_entity_parents(entity_id, burger_entity_metadata)
for parent_id in list(reversed(parents)):
for index, name_or_bitfield in get_entity_metadata_names(parent_id, burger_entity_data, mappings).items():
for index, name_or_bitfield in get_entity_metadata_names(parent_id, burger_entity_metadata, mappings).items():
assert index == len(all_field_names_or_bitfields)
all_field_names_or_bitfields.append(name_or_bitfield)
entity_ids_for_all_field_names_or_bitfields.append(parent_id)
entity_metadatas.extend(get_entity_metadata(
parent_id, burger_entity_data))
parent_id, burger_entity_metadata))
parent_id = parents[1] if len(parents) > 1 else None
# now add all the fields/component structs
@ -265,7 +325,7 @@ impl From<EntityDataValue> for UpdateMetadataError {
if parent_struct_name:
code.append(
f' parent: {parent_struct_name}MetadataBundle,')
for index, name_or_bitfield in get_entity_metadata_names(entity_id, burger_entity_data, mappings).items():
for index, name_or_bitfield in get_entity_metadata_names(entity_id, burger_entity_metadata, mappings).items():
if isinstance(name_or_bitfield, str):
name_or_bitfield = maybe_rename_field(
name_or_bitfield, index)
@ -311,7 +371,7 @@ impl From<EntityDataValue> for UpdateMetadataError {
# if it has a parent, put it (do recursion)
# parent: AbstractCreatureBundle { ... },
this_entity_parent_ids = get_entity_parents(
this_entity_id, burger_entity_data)
this_entity_id, burger_entity_metadata)
this_entity_parent_id = this_entity_parent_ids[1] if len(
this_entity_parent_ids) > 1 else None
if this_entity_parent_id:
@ -323,7 +383,7 @@ impl From<EntityDataValue> for UpdateMetadataError {
code.append(
' },')
for index, name_or_bitfield in get_entity_metadata_names(this_entity_id, burger_entity_data, mappings).items():
for index, name_or_bitfield in get_entity_metadata_names(this_entity_id, burger_entity_metadata, mappings).items():
default = next(filter(lambda i: i['index'] == index, entity_metadatas)).get(
'default', 'Default::default()')
if isinstance(name_or_bitfield, str):
@ -368,11 +428,21 @@ impl From<EntityDataValue> for UpdateMetadataError {
elif type_name == 'ItemStack':
default = f'ItemSlot::Present({default})' if default != 'Empty' else 'ItemSlot::Empty'
elif type_name == 'BlockState':
default = f'{default}' if default != 'Empty' else 'BlockState::AIR'
default = f'{default}' if default != 'Empty' else 'azalea_block::BlockState::AIR'
elif type_name == 'OptionalBlockState':
default = f'{default}' if default != 'Empty' else 'azalea_block::BlockState::AIR'
elif type_name == 'OptionalFormattedText':
default = f'Some({default})' if default != 'Empty' else 'None'
elif type_name == 'CompoundTag':
default = f'azalea_nbt::Tag::Compound({default})' if default != 'Empty' else 'azalea_nbt::Tag::Compound(Default::default())'
elif type_name == 'Quaternion':
default = f'Quaternion {{ x: {float(default["x"])}, y: {float(default["y"])}, z: {float(default["z"])}, w: {float(default["w"])} }}'
elif type_name == 'Vector3':
default = f'Vec3 {{ x: {float(default["x"])}, y: {float(default["y"])}, z: {float(default["z"])} }}'
elif type_name == 'Byte':
# in 1.19.4 TextOpacity is a -1 by default
if default < 0:
default += 128
if name in single_use_imported_types:
code.append(f' {name}: {default},')
else:
@ -396,7 +466,7 @@ impl From<EntityDataValue> for UpdateMetadataError {
code.append('')
# parent_field_name = None
for entity_id in burger_entity_data:
for entity_id in burger_entity_metadata:
new_entity(entity_id)
# and now make the main apply_metadata
@ -420,7 +490,7 @@ impl From<EntityDataValue> for UpdateMetadataError {
items: Vec<EntityDataItem>,
) -> Result<(), UpdateMetadataError> {{
match entity_kind {{''')
for entity_id in burger_entity_data:
for entity_id in burger_entity_metadata:
if entity_id.startswith('~'):
# not actually an entity
continue
@ -447,7 +517,7 @@ impl From<EntityDataValue> for UpdateMetadataError {
code.append(
'pub fn apply_default_metadata(entity: &mut bevy_ecs::system::EntityCommands, kind: azalea_registry::EntityKind) {')
code.append(' match kind {')
for entity_id in burger_entity_data:
for entity_id in burger_entity_metadata:
if entity_id.startswith('~'):
# not actually an entity
continue
@ -465,22 +535,22 @@ impl From<EntityDataValue> for UpdateMetadataError {
f.write('\n'.join(code))
def get_entity_parents(entity_id: str, burger_entity_data: dict):
def get_entity_parents(entity_id: str, burger_entity_metadata: dict):
parents = []
while entity_id:
parents.append(entity_id)
entity_id = get_entity_parent(entity_id, burger_entity_data)
entity_id = get_entity_parent(entity_id, burger_entity_metadata)
return parents
def get_entity_parent(entity_id: str, burger_entity_data: dict):
entity_metadata = burger_entity_data[entity_id]['metadata']
def get_entity_parent(entity_id: str, burger_entity_metadata: dict):
entity_metadata = burger_entity_metadata[entity_id]['metadata']
first_metadata = entity_metadata[0]
return first_metadata.get('entity')
def get_entity_metadata(entity_id: str, burger_entity_data: dict):
entity_metadata = burger_entity_data[entity_id]['metadata']
def get_entity_metadata(entity_id: str, burger_entity_metadata: dict):
entity_metadata = burger_entity_metadata[entity_id]['metadata']
entity_useful_metadata = []
for metadata_item in entity_metadata:
if 'data' in metadata_item:
@ -495,8 +565,8 @@ def get_entity_metadata(entity_id: str, burger_entity_data: dict):
# returns a dict of {index: (name or bitfield)}
def get_entity_metadata_names(entity_id: str, burger_entity_data: dict, mappings: Mappings):
entity_metadata = burger_entity_data[entity_id]['metadata']
def get_entity_metadata_names(entity_id: str, burger_entity_metadata: dict, mappings: Mappings):
entity_metadata = burger_entity_metadata[entity_id]['metadata']
mapped_metadata_names = {}
for metadata_item in entity_metadata:

View file

@ -222,7 +222,7 @@ def get_packets(direction: str, state: str):
return packet_ids, packet_class_names
def burger_instruction_to_code(instructions: list[dict], index: int, generated_packet_code: list[str], mappings: Mappings, obfuscated_class_name: str, uses: set, extra_code: list[str]) -> Optional[int]:
def burger_instruction_to_code(instructions: list[dict], index: int, generated_packet_code: list[str], mappings: Mappings, obfuscated_class_name: str, uses: set, extra_code: list[str], known_variable_types={}) -> Optional[int]:
'''
Generate a field for an instruction, returns the number of instructions to skip (if any).
'''
@ -237,12 +237,14 @@ def burger_instruction_to_code(instructions: list[dict], index: int, generated_p
field_type_rs = None
field_comment = None
print('instruction', instruction)
# iterators
if instruction['operation'] == 'write' and instruction['field'].endswith('.size()') and next_instruction and next_instruction['type'] == 'Iterator' and next_next_instruction and next_next_instruction['operation'] == 'loop':
field_obfuscated_name = instruction['field'].split('.')[
obfuscated_field_name = instruction['field'].split('.')[
0]
field_name = mappings.get_field(
obfuscated_class_name, field_obfuscated_name)
obfuscated_class_name, obfuscated_field_name)
# figure out what kind of iterator it is
loop_instructions = next_next_instruction['instructions']
@ -282,10 +284,21 @@ def burger_instruction_to_code(instructions: list[dict], index: int, generated_p
# Option<T>
elif instruction['operation'] == 'write' and (instruction['field'].endswith('.isPresent()') or instruction['field'].endswith(' != null')) and next_instruction and (next_instruction.get('condition', '').endswith('.isPresent()') or next_instruction.get('condition', '').endswith(' != null')):
field_obfuscated_name = instruction['field'].split('.')[
print('ok is option')
obfuscated_field_name = instruction['field'].split('.')[
0].split(' ')[0]
if obfuscated_field_name in known_variable_types:
# just use the known name since it's not gonna be in the mappings
obfuscated_field_name = known_variable_types[obfuscated_field_name]
field_name = mappings.get_field(
obfuscated_class_name, field_obfuscated_name)
obfuscated_class_name, obfuscated_field_name)
if field_name is None: field_name = obfuscated_field_name.split('/')[-1]
if '<' in field_name:
field_name = 'value'
condition_instructions = next_instruction['instructions']
condition_types_rs = []
@ -312,23 +325,34 @@ def burger_instruction_to_code(instructions: list[dict], index: int, generated_p
field_type_rs, is_var, instruction_uses, instruction_extra_code = burger_type_to_rust_type(
field_type, field_name, instruction, mappings, obfuscated_class_name)
if '.' in obfuscated_field_name or ' ' in obfuscated_field_name or '(' in obfuscated_field_name:
if obfuscated_field_name in known_variable_types:
# just use the known name since it's not gonna be in the mappings
field_name = obfuscated_field_name
elif '.' in obfuscated_field_name or ' ' in obfuscated_field_name or '(' in obfuscated_field_name:
field_type_rs2, obfuscated_field_name, field_comment = burger_field_to_type(
obfuscated_field_name, mappings, obfuscated_class_name)
obfuscated_field_name, mappings, obfuscated_class_name, known_variable_types)
if not field_type_rs2:
generated_packet_code.append(f'// TODO: {instruction}')
return
if obfuscated_field_name in known_variable_types:
# just use the known name since it's not gonna be in the mappings
obfuscated_field_name = known_variable_types[obfuscated_field_name]
print('got obfuscated_field_name', obfuscated_field_name)
# try to get the field name again with the new stuff we know
field_name = mappings.get_field(
obfuscated_class_name, obfuscated_field_name) or mappings.get_field(
obfuscated_class_name.split('$')[0], obfuscated_field_name)
if field_name is None:
field_name = obfuscated_field_name.split('/')[-1]
uses.update(instruction_uses)
extra_code.extend(instruction_extra_code)
if not field_name:
generated_packet_code.append(
f'// TODO: unknown field {instruction}')
return
return skip
if is_var:
generated_packet_code.append('#[var]')
@ -340,7 +364,7 @@ def burger_instruction_to_code(instructions: list[dict], index: int, generated_p
return skip
def burger_field_to_type(field, mappings: Mappings, obfuscated_class_name: str) -> tuple[Optional[str], str, Optional[str]]:
def burger_field_to_type(field, mappings: Mappings, obfuscated_class_name: str, known_variable_types={}) -> tuple[Optional[str], str, Optional[str]]:
'''
Returns field_type_rs, obfuscated_field_name, field_comment
'''
@ -353,9 +377,12 @@ def burger_field_to_type(field, mappings: Mappings, obfuscated_class_name: str)
print('field', field)
obfuscated_first = field.split('.')[0]
obfuscated_second = field.split('.')[1].split('(')[0]
first = mappings.get_field(obfuscated_class_name, obfuscated_first)
first_type = mappings.get_field_type(
obfuscated_class_name, obfuscated_first)
# first = mappings.get_field(obfuscated_class_name, obfuscated_first)
if obfuscated_first in known_variable_types:
first_type = known_variable_types[obfuscated_first]
else:
first_type = mappings.get_field_type(
obfuscated_class_name, obfuscated_first)
first_obfuscated_class_name: Optional[str] = mappings.get_class_from_deobfuscated_name(
first_type)
if first_obfuscated_class_name:
@ -368,6 +395,8 @@ def burger_field_to_type(field, mappings: Mappings, obfuscated_class_name: str)
else:
second = obfuscated_second
first_type_short = first_type.split('.')[-1]
if second in {'byteValue'}:
return (first_type_short, obfuscated_first, None)
return (first_type_short, obfuscated_first, f'TODO: Does {first_type_short}::{second}, may not be implemented')
return None, field, None

View file

@ -97,8 +97,12 @@ def burger_type_to_rust_type(burger_type, field_name: Optional[str] = None, inst
print('hm', enum_name)
else:
enum_name = mappings.get_field_type(
obfuscated_class_name, enum_field)
try:
enum_name = mappings.get_field_type(
obfuscated_class_name, enum_field)
except:
enum_name = mappings.get_class(obfuscated_class_name)
print(f'failed getting {obfuscated_class_name}.{enum_field} but continuing with {enum_name} anyways')
print('enum_name', enum_name)
enum_obfuscated_name = mappings.get_class_from_deobfuscated_name(
enum_name)

View file

@ -177,7 +177,11 @@ def clear_version_cache():
if os.path.exists(get_dir_location(f'downloads/{file}')):
os.remove(get_dir_location(f'downloads/{file}'))
os.system(
f'cd {get_dir_location("downloads/Burger")} && git pull')
os.system(
f'cd {get_dir_location("downloads/pixlyzer")} && git pull')
burger_path = get_dir_location("downloads/Burger")
if os.path.exists(burger_path):
os.system(
f'cd {burger_path} && git pull')
pixlyzer_path = get_dir_location('downloads/pixlyzer')
if os.path.exists(pixlyzer_path):
os.system(
f'cd {pixlyzer_path} && git pull')

View file

@ -117,7 +117,7 @@ def get_pixlyzer_data(version_id: str, category: str):
# TODO: right now this False is hard-coded, it should retry with this
# enabled if # initially getting the data fails
if False or (os.path.exists(target_dir) and not os.path.exists(f'{target_dir}/{category}.min.json')):
if True or (os.path.exists(target_dir) and not os.path.exists(f'{target_dir}/{category}.min.json')):
print('Downloading', category, 'from pixlyzer-data.')
data = requests.get(f'https://gitlab.com/Bixilon/pixlyzer-data/-/raw/master/version/{version_id}/{category}.min.json?inline=false').text
try:
@ -219,6 +219,8 @@ def get_pixlyzer_data(version_id: str, category: str):
pom_xml = open(f'{pixlyzer_dir}/pom.xml', 'r').read()
pom_xml = re.sub(
'<dependencies>.*?</dependencies>', f'<dependencies>{pom_xml_dependencies}</dependencies>', pom_xml, flags=re.DOTALL)
pom_xml = re.sub(
'<minecraft\.version>.*?</minecraft\.version>', f'<minecraft.version>{version_id}</minecraft.version>', pom_xml, flags=re.DOTALL)
open(f'{pixlyzer_dir}/pom.xml', 'w').write(pom_xml)
# compile

View file

@ -68,6 +68,13 @@ class Mappings:
return self.fields.get(obfuscated_class_name, {}).get(obfuscated_field_name)
def get_class(self, obfuscated_class_name):
if '<' in obfuscated_class_name:
first_part, args = obfuscated_class_name.split('<')
args = args.rstrip('>').strip(';').split(';')
print(args)
assert len(args) == 1
arg = self.get_class(args[0][1:])
return f'{first_part}<{arg}>'
return self.classes[obfuscated_class_name]
def get_method(self, obfuscated_class_name, obfuscated_method_name, obfuscated_signature):

View file

@ -6,6 +6,7 @@ import lib.code.version
import lib.code.blocks
import lib.code.packet
import lib.code.shapes
import lib.code.entity
import lib.code.utils
import lib.download
import lib.extract
@ -134,6 +135,10 @@ print('Generating registries...')
registries = lib.extract.get_registries_report(new_version_id)
lib.code.registry.generate_registries(registries)
print('Generating entity metadata...')
burger_entities_data = new_burger_data[0]['entities']
lib.code.entity.generate_entity_metadata(burger_entities_data, new_mappings)
print('Finishing touches, setting version in README and formatting code...')
lib.code.version.set_version_id(new_version_id)