aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/tests/simulation/move_and_despawn_entity.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-12-22 21:43:54 -1400
committermat <git@matdoes.dev>2025-12-22 21:43:54 -1400
commit82e3d46ca319badcbc584cf902aeebcbd30948b9 (patch)
tree4afb8c6135caacbdf9f1f04d451cb2bae1c488b6 /azalea-client/tests/simulation/move_and_despawn_entity.rs
parent0429a81d706da7c45600d357f9f9a14cef6113b4 (diff)
downloadazalea-drasl-82e3d46ca319badcbc584cf902aeebcbd30948b9.tar.xz
run azalea-client integration tests as one binary
per https://corrode.dev/blog/tips-for-faster-rust-compile-times/\#combine-all-integration-tests-into-a-single-binary <3
Diffstat (limited to 'azalea-client/tests/simulation/move_and_despawn_entity.rs')
-rw-r--r--azalea-client/tests/simulation/move_and_despawn_entity.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/azalea-client/tests/simulation/move_and_despawn_entity.rs b/azalea-client/tests/simulation/move_and_despawn_entity.rs
new file mode 100644
index 00000000..6c334a47
--- /dev/null
+++ b/azalea-client/tests/simulation/move_and_despawn_entity.rs
@@ -0,0 +1,40 @@
+use azalea_client::test_utils::prelude::*;
+use azalea_core::position::{ChunkPos, Vec3};
+use azalea_protocol::{
+ common::movements::{PositionMoveRotation, RelativeMovements},
+ packets::{
+ ConnectionProtocol,
+ game::{ClientboundRemoveEntities, ClientboundTeleportEntity},
+ },
+};
+use azalea_registry::builtin::EntityKind;
+use azalea_world::MinecraftEntityId;
+
+#[test]
+fn test_move_and_despawn_entity() {
+ let _lock = init();
+
+ let mut simulation = Simulation::new(ConnectionProtocol::Game);
+ simulation.receive_packet(default_login_packet());
+
+ simulation.receive_packet(make_basic_empty_chunk(ChunkPos::new(0, 0), (384 + 64) / 16));
+ simulation.tick();
+
+ simulation.receive_packet(make_basic_add_entity(EntityKind::Cow, 123, (0.5, 64., 0.5)));
+ simulation.tick();
+
+ simulation.receive_packet(ClientboundTeleportEntity {
+ id: MinecraftEntityId(123),
+ change: PositionMoveRotation {
+ pos: Vec3::new(16., 0., 0.),
+ delta: Vec3::ZERO,
+ look_direction: Default::default(),
+ },
+ relative: RelativeMovements::all_relative(),
+ on_ground: true,
+ });
+ simulation.receive_packet(ClientboundRemoveEntities {
+ entity_ids: vec![MinecraftEntityId(123)],
+ });
+ simulation.tick();
+}