Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.20.5 #127

Merged
merged 16 commits into from
Apr 23, 2024
Merged
Prev Previous commit
Next Next commit
update to 24w03a i think
  • Loading branch information
mat-1 committed Mar 6, 2024
commit 8bd1e9379e53d293164bae1cc1abfcaee46d84f3
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A collection of Rust crates for making Minecraft bots, clients, and tools.

<!-- The line below is automatically read and updated by the migrate script, so don't change it manually. -->

_Currently supported Minecraft version: `23w51b`._
_Currently supported Minecraft version: `24w03a`._

> [!WARNING]
> Azalea is still very unfinished, though most crates are in a somewhat useable state
Expand Down
8 changes: 4 additions & 4 deletions azalea-entity/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2065,7 +2065,7 @@ impl Default for DolphinMetadataBundle {
aggressive: Aggressive(false),
},
},
treasure_pos: TreasurePos(BlockPos::new(0, 0, 0)),
treasure_pos: TreasurePos(Default::default()),
got_fish: GotFish(false),
moistness_level: MoistnessLevel(2400),
}
Expand Down Expand Up @@ -3093,7 +3093,7 @@ impl Default for FallingBlockMetadataBundle {
pose: Pose::default(),
ticks_frozen: TicksFrozen(0),
},
start_pos: StartPos(BlockPos::new(0, 0, 0)),
start_pos: StartPos(Default::default()),
}
}
}
Expand Down Expand Up @@ -8683,10 +8683,10 @@ impl Default for TurtleMetadataBundle {
abstract_ageable_baby: AbstractAgeableBaby(false),
},
},
home_pos: HomePos(BlockPos::new(0, 0, 0)),
home_pos: HomePos(Default::default()),
has_egg: HasEgg(false),
laying_egg: LayingEgg(false),
travel_pos: TravelPos(BlockPos::new(0, 0, 0)),
travel_pos: TravelPos(Default::default()),
going_home: GoingHome(false),
travelling: Travelling(false),
}
Expand Down
29 changes: 20 additions & 9 deletions azalea-language/src/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@
"argument.scoreboardDisplaySlot.invalid": "Unknown display slot '%s'",
"argument.scoreHolder.empty": "No relevant score holders could be found",
"argument.style.invalid": "Invalid style: %s",
"argument.time.invalid_tick_count": "Tick count must be non-negative",
"argument.time.invalid_tick_count": "The tick count must be non-negative",
"argument.time.invalid_unit": "Invalid unit",
"argument.time.tick_count_too_low": "Tick count must not be less than %s, found %s",
"argument.time.tick_count_too_low": "The tick count must not be less than %s, found %s",
"argument.uuid.invalid": "Invalid UUID",
"arguments.block.tag.unknown": "Unknown block tag '%s'",
"arguments.function.tag.unknown": "Unknown function tag '%s'",
Expand Down Expand Up @@ -404,6 +404,8 @@
"attribute.name.generic.scale": "Scale",
"attribute.name.generic.step_height": "Step Height",
"attribute.name.horse.jump_strength": "Horse Jump Strength",
"attribute.name.player.block_interaction_range": "Block Interaction Range",
"attribute.name.player.entity_interaction_range": "Entity Interaction Range",
"attribute.name.zombie.spawn_reinforcements": "Zombie Reinforcements",
"biome.minecraft.badlands": "Badlands",
"biome.minecraft.bamboo_jungle": "Bamboo Jungle",
Expand Down Expand Up @@ -2617,6 +2619,7 @@
"commands.setblock.failed": "Could not set the block",
"commands.setblock.success": "Changed the block at %s, %s, %s",
"commands.setidletimeout.success": "The player idle timeout is now %s minute(s)",
"commands.setworldspawn.failure.not_overworld": "Can only set the world spawn for overworld",
"commands.setworldspawn.success": "Set the world spawn point to %s, %s, %s [%s]",
"commands.spawnpoint.success.multiple": "Set spawn point to %s, %s, %s [%s] in %s for %s players",
"commands.spawnpoint.success.single": "Set spawn point to %s, %s, %s [%s] in %s for %s",
Expand Down Expand Up @@ -2693,14 +2696,14 @@
"commands.tick.rate.success": "Set the target tick rate to %s per second",
"commands.tick.sprint.report": "Sprint completed with %s ticks per second, or %s ms per tick",
"commands.tick.sprint.stop.fail": "No tick sprint in progress",
"commands.tick.sprint.stop.success": "A tick sprint interrupted",
"commands.tick.sprint.stop.success": "Interrupted the current tick sprint",
"commands.tick.status.frozen": "The game is frozen",
"commands.tick.status.lagging": "The game is running, but can't keep up with the target tick rate",
"commands.tick.status.running": "The game runs normally",
"commands.tick.status.running": "The game is running normally",
"commands.tick.status.sprinting": "The game is sprinting",
"commands.tick.step.fail": "Unable to step the game - the game must be frozen first",
"commands.tick.step.stop.fail": "No tick step in progress",
"commands.tick.step.stop.success": "A tick step interrupted",
"commands.tick.step.stop.success": "Interrupted the current tick step",
"commands.tick.step.success": "Stepping %s tick(s)",
"commands.time.query": "The time is %s",
"commands.time.set": "Set the time to %s",
Expand Down Expand Up @@ -2761,10 +2764,12 @@
"connect.connecting": "Connecting to the server...",
"connect.encrypting": "Encrypting...",
"connect.failed": "Failed to connect to the server",
"connect.failed.transfer": "Connection failed while transferring to the server",
"connect.joining": "Joining world...",
"connect.negotiating": "Negotiating...",
"connect.reconfiging": "Reconfiguring...",
"connect.reconfiguring": "Reconfiguring...",
"connect.transferring": "Transferring to new server...",
"container.barrel": "Barrel",
"container.beacon": "Beacon",
"container.blast_furnace": "Blast Furnace",
Expand Down Expand Up @@ -3101,6 +3106,7 @@
"disconnect.quitting": "Quitting",
"disconnect.spam": "Kicked for spamming",
"disconnect.timeout": "Timed out",
"disconnect.transfer": "Transferred to another server",
"disconnect.unknownHost": "Unknown host",
"download.pack.failed": "%s out of %s packs failed to download",
"download.pack.progress.bytes": "Progress: %s (total size unknown)",
Expand Down Expand Up @@ -3188,6 +3194,7 @@
"enchantment.minecraft.smite": "Smite",
"enchantment.minecraft.soul_speed": "Soul Speed",
"enchantment.minecraft.sweeping": "Sweeping Edge",
"enchantment.minecraft.sweeping_edge": "Sweeping Edge",
"enchantment.minecraft.swift_sneak": "Swift Sneak",
"enchantment.minecraft.thorns": "Thorns",
"enchantment.minecraft.unbreaking": "Unbreaking",
Expand Down Expand Up @@ -3481,7 +3488,10 @@
"gamerule.showDeathMessages": "Show death messages",
"gamerule.snowAccumulationHeight": "Snow accumulation height",
"gamerule.snowAccumulationHeight.description": "When it snows, layers of snow form on the ground up to at most this number of layers.",
"gamerule.spawnChunkRadius": "Spawn chunk radius",
"gamerule.spawnChunkRadius.description": "Amount of chunks that stay loaded around the overworld spawn position.",
"gamerule.spawnRadius": "Respawn location radius",
"gamerule.spawnRadius.description": "Controls the size of the area around the spawn point that players can spawn in.",
"gamerule.spectatorsGenerateChunks": "Allow spectators to generate terrain",
"gamerule.tntExplosionDropDecay": "In TNT explosions, some blocks won't drop their loot",
"gamerule.tntExplosionDropDecay.description": "Some of the drops from blocks destroyed by explosions caused by TNT are lost in the explosion.",
Expand Down Expand Up @@ -4891,6 +4901,7 @@
"multiplayer.disconnect.server_shutdown": "Server closed",
"multiplayer.disconnect.slow_login": "Took too long to log in",
"multiplayer.disconnect.too_many_pending_chats": "Too many unacknowledged chat messages",
"multiplayer.disconnect.transfers_disabled": "Server does not accept transfers",
"multiplayer.disconnect.unexpected_query_response": "Unexpected custom data from client",
"multiplayer.disconnect.unsigned_chat": "Received chat packet with missing or invalid signature.",
"multiplayer.disconnect.unverified_username": "Failed to verify username!",
Expand Down Expand Up @@ -5783,13 +5794,13 @@
"subtitles.entity.allay.item_taken": "Allay allays",
"subtitles.entity.allay.item_thrown": "Allay tosses",
"subtitles.entity.armadillo.ambient": "Armadillo grunts",
"subtitles.entity.armadillo.brush": "Armadillo brushes",
"subtitles.entity.armadillo.brush": "Scute is brushed off",
"subtitles.entity.armadillo.death": "Armadillo dies",
"subtitles.entity.armadillo.eat": "Armadillo eats",
"subtitles.entity.armadillo.hurt": "Armadillo hurts",
"subtitles.entity.armadillo.land": "Armadillo lands",
"subtitles.entity.armadillo.roll": "Armadillo rolls up",
"subtitles.entity.armadillo.scute_drop": "Scute drops",
"subtitles.entity.armadillo.scute_drop": "Armadillo sheds scute",
"subtitles.entity.armadillo.unroll": "Armadillo unrolls",
"subtitles.entity.armor_stand.fall": "Something fell",
"subtitles.entity.arrow.hit": "Arrow hits",
Expand Down Expand Up @@ -6373,8 +6384,8 @@
"subtitles.item.armor.equip_leather": "Leather armor rustles",
"subtitles.item.armor.equip_netherite": "Netherite armor clanks",
"subtitles.item.armor.equip_turtle": "Turtle Shell thunks",
"subtitles.item.armor.equip_wolf": "Wolf armor straps",
"subtitles.item.armor.unequip_wolf": "Wolf armor slips off",
"subtitles.item.armor.equip_wolf": "Wolf Armor is fastened",
"subtitles.item.armor.unequip_wolf": "Wolf Armor snips away",
"subtitles.item.axe.scrape": "Axe scrapes",
"subtitles.item.axe.strip": "Axe strips",
"subtitles.item.axe.wax_off": "Wax off",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundConfigurationPacket;
use azalea_buf::McBuf;

#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)]
pub struct ClientboundCookieRequestPacket {
pub key: ResourceLocation,
}
24 changes: 10 additions & 14 deletions azalea-protocol/src/packets/configuration/mod.rs
Original file line number Diff line number Diff line change
@@ -1,41 +1,37 @@
pub mod serverbound_cookie_response_packet;
pub mod clientbound_cookie_request_packet;
pub mod serverbound_client_information_packet;
pub mod serverbound_custom_payload_packet;
pub mod serverbound_keep_alive_packet;
pub mod serverbound_pong_packet;
pub mod serverbound_resource_pack_packet;
pub mod clientbound_custom_payload_packet;
pub mod clientbound_disconnect_packet;
pub mod clientbound_finish_configuration_packet;
pub mod clientbound_keep_alive_packet;
pub mod clientbound_ping_packet;
pub mod clientbound_registry_data_packet;
pub mod clientbound_resource_pack_pop_packet;
pub mod clientbound_resource_pack_push_packet;
pub mod clientbound_update_enabled_features_packet;
pub mod clientbound_update_tags_packet;
pub mod serverbound_client_information_packet;
pub mod serverbound_custom_payload_packet;
pub mod serverbound_finish_configuration_packet;
pub mod serverbound_keep_alive_packet;
pub mod serverbound_pong_packet;
pub mod serverbound_resource_pack_packet;
use azalea_protocol_macros::declare_state_packets;

declare_state_packets!(
ConfigurationPacket,
Serverbound => {
0x00: serverbound_client_information_packet::ServerboundClientInformationPacket,
0x01: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket,
0x02: serverbound_finish_configuration_packet::ServerboundFinishConfigurationPacket,
0x01: serverbound_cookie_response_packet::ServerboundCookieResponsePacket,
0x03: serverbound_keep_alive_packet::ServerboundKeepAlivePacket,
0x04: serverbound_pong_packet::ServerboundPongPacket,
0x05: serverbound_resource_pack_packet::ServerboundResourcePackPacket,
},
Clientbound => {
0x00: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket,
0x00: clientbound_cookie_request_packet::ClientboundCookieRequestPacket,
0x01: clientbound_disconnect_packet::ClientboundDisconnectPacket,
0x02: clientbound_finish_configuration_packet::ClientboundFinishConfigurationPacket,
0x03: clientbound_keep_alive_packet::ClientboundKeepAlivePacket,
0x04: clientbound_ping_packet::ClientboundPingPacket,
0x05: clientbound_registry_data_packet::ClientboundRegistryDataPacket,
0x06: clientbound_resource_pack_pop_packet::ClientboundResourcePackPopPacket,
0x07: clientbound_resource_pack_push_packet::ClientboundResourcePackPushPacket,
0x08: clientbound_update_enabled_features_packet::ClientboundUpdateEnabledFeaturesPacket,
0x09: clientbound_update_tags_packet::ClientboundUpdateTagsPacket,
}
);
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ServerboundConfigurationPacket;
use azalea_buf::McBuf;

#[derive(Clone, Debug, McBuf, ServerboundConfigurationPacket)]
pub struct ServerboundCookieResponsePacket {
pub key: ResourceLocation,
pub payload: Option<(u32, Vec<u8>)>,
}
71 changes: 23 additions & 48 deletions azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs
Original file line number Diff line number Diff line change
@@ -1,52 +1,27 @@
use azalea_buf::McBuf;
use azalea_core::{position::Vec3, resource_location::ResourceLocation};
use azalea_entity::{metadata::apply_default_metadata, EntityBundle};
use azalea_protocol_macros::ClientboundGamePacket;
use uuid::Uuid;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_buf::McBuf;

#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundAddEntityPacket {
/// The id of the entity.
#[var]
pub id: u32,
pub uuid: Uuid,
pub entity_type: azalea_registry::EntityKind,
pub position: Vec3,
pub x_rot: i8,
pub y_rot: i8,
pub y_head_rot: i8,
#[var]
pub data: i32,
pub x_vel: i16,
pub y_vel: i16,
pub z_vel: i16,
}

// impl From<&ClientboundAddEntityPacket> for EntityData {
// fn from(p: &ClientboundAddEntityPacket) -> Self {
// Self::new(
// p.uuid,
// Vec3 {
// x: p.x,
// y: p.y,
// z: p.z,
// },
// // default metadata for the entity type
// EntityMetadata::from(p.entity_type),
// )
// }
// }

impl ClientboundAddEntityPacket {
/// Make the entity into a bundle that can be inserted into the ECS. You
/// must apply the metadata after inserting the bundle with
/// [`Self::apply_metadata`].
pub fn as_entity_bundle(&self, world_name: ResourceLocation) -> EntityBundle {
EntityBundle::new(self.uuid, self.position, self.entity_type, world_name)
}

/// Apply the default metadata for the given entity.
pub fn apply_metadata(&self, entity: &mut bevy_ecs::system::EntityCommands) {
apply_default_metadata(entity, self.entity_type);
}
}
#[var]
pub id: u32,
pub uuid: Uuid,
pub x: f64,
pub y: f64,
pub z: f64,
#[var]
pub x_rot: i32,
#[var]
pub y_rot: i32,
#[var]
pub y_head_rot: i32,
#[var]
pub data: u32,
#[var]
pub xa: i32,
#[var]
pub ya: i32,
#[var]
pub za: i32,
}
20 changes: 2 additions & 18 deletions azalea-protocol/src/packets/game/clientbound_award_stats_packet.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
use azalea_buf::McBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use std::collections::HashMap;
use azalea_buf::McBuf;

#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundAwardStatsPacket {
#[var]
pub stats: HashMap<Stat, i32>,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, McBuf)]
pub enum Stat {
Mined(azalea_registry::Block),
Crafted(azalea_registry::Item),
Used(azalea_registry::Item),
Broken(azalea_registry::Item),
PickedUp(azalea_registry::Item),
Dropped(azalea_registry::Item),
Killed(azalea_registry::EntityKind),
KilledBy(azalea_registry::EntityKind),
Custom(azalea_registry::CustomStat),
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
use azalea_buf::McBuf;
use azalea_core::position::BlockPos;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_buf::McBuf;

#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundBlockDestructionPacket {
/// The ID of the entity breaking the block.
#[var]
pub id: u32,
pub pos: BlockPos,
/// 0–9 to set it, any other value to remove it.
pub progress: u8,
}
#[var]
pub id: u32,
pub pos: u64, // TODO: Does BlockPos::asLong, may not be implemented
pub progress: u8,
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
use azalea_buf::McBuf;
use azalea_core::position::BlockPos;
use azalea_protocol_macros::ClientboundGamePacket;
use simdnbt::owned::Nbt;
use azalea_buf::McBuf;

#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundBlockEntityDataPacket {
pub pos: BlockPos,
pub block_entity_type: azalea_registry::BlockEntityKind,
pub tag: Nbt,
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use azalea_buf::McBuf;
use azalea_core::position::BlockPos;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_registry::Block;
use azalea_buf::McBuf;

#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundBlockEventPacket {
pub pos: BlockPos,
pub action_id: u8,
pub action_parameter: u8,
pub block: Block,
}
pub pos: u64, // TODO: Does BlockPos::asLong, may not be implemented
#[var]
pub b0: u32,
#[var]
pub b1: u32,
}
Loading