ghast-client 0.5.6

Headless Minecraft Java Edition client for the ghast library: connection, login, fixed 50 ms tick loop and a version-agnostic bot API (1.8.9, 1.12.2, 1.16.5, 26.1, 26.2 and 26.3)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
//! The expected flight of a projectile the player throws or shoots
//! ([`crate::TickContext::predict_throw`]): the launch of the item (`shootFromRotation` and its
//! per-version forms, without the random spread) and then the projectile's own ticks as the
//! server runs them, both from the version's oracle-proven physics
//! (`ghast_physics::<version>::{launch, projectile}`), until the first block hit.
//!
//! What it does not know: entities in the way (the server's hit decides), the spread (each
//! axis of the launch direction varies by up to [`ThrowPrediction::max_spread`] times the
//! power), and where the server's copy of the player is when it differs from the last sent
//! pose. The world is read through [`WorldView`]: unloaded columns are empty, as on a vanilla
//! client, and the world border is not modelled.

use crate::common::{Face, Vec3};
use crate::sim::WorldView;
use crate::version::GameVersion;
use ghast_protocol::BlockPos;

/// What the player throws or shoots.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum Throw {
    /// A snowball.
    Snowball,
    /// An egg.
    Egg,
    /// An ender pearl.
    EnderPearl,
    /// A splash potion.
    SplashPotion,
    /// A lingering potion (1.9+).
    LingeringPotion,
    /// A bottle o' enchanting.
    ExperienceBottle,
    /// A wind charge (26.x).
    WindCharge,
    /// A trident (1.13+).
    Trident,
    /// An arrow from a bow drawn for `ticks_held` ticks (no shot below a tenth of the power).
    Bow {
        /// Ticks the bow was drawn.
        ticks_held: i32,
    },
    /// An arrow from a charged crossbow (26.x).
    CrossbowArrow,
}

/// The block a predicted flight hits first.
#[derive(Clone, Copy, Debug, PartialEq)]
#[non_exhaustive]
pub struct ThrowHit {
    /// The block.
    pub block: BlockPos,
    /// The face hit.
    pub face: Face,
    /// The exact point.
    pub point: Vec3,
    /// The tick of the hit, counted from 1 (the projectile's first tick).
    pub tick: u32,
}

/// A predicted flight.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct ThrowPrediction {
    /// Where the projectile starts and where it is after each of its ticks (the last entry is
    /// the hit tick's: a thrown item stops at the hit point, an arrow sticks just before it).
    pub path: Vec<Vec3>,
    /// The motion right after the launch.
    pub velocity: Vec3,
    /// The first block hit within the ticks run (`None`: none).
    pub hit: Option<ThrowHit>,
    /// The largest change the launch's random spread makes to one axis of the launch motion.
    pub max_spread: f64,
}

/// The shooter as the server knows it.
#[derive(Clone, Copy, Debug)]
pub(crate) struct Shooter {
    /// Feet.
    pub pos: Vec3,
    /// Eye height above the feet.
    pub eye_height: f64,
    pub yaw: f32,
    pub pitch: f32,
    /// Its motion (added to the launch; the vertical part only when it is in the air; 1.8 adds
    /// none, so a 1.8-only build reads neither field).
    #[cfg_attr(
        not(any(
            feature = "v1_12_2",
            feature = "v1_16_5",
            feature = "v26_1",
            feature = "v26_2",
            feature = "v26_3"
        )),
        allow(dead_code)
    )]
    pub motion: Vec3,
    #[cfg_attr(
        not(any(
            feature = "v1_12_2",
            feature = "v1_16_5",
            feature = "v26_1",
            feature = "v26_2",
            feature = "v26_3"
        )),
        allow(dead_code)
    )]
    pub on_ground: bool,
}

/// The block states of a [`WorldView`] as a version's physics reads them.
struct Raw<'a, S> {
    world: &'a dyn WorldView,
    decode: fn(Option<u32>) -> S,
}

impl<S: Copy> ghast_physics::BlockView for Raw<'_, S> {
    type State = S;
    fn block(&self, x: i32, y: i32, z: i32) -> S {
        (self.decode)(self.world.raw_block(x, y, z))
    }
    fn is_chunk_loaded(&self, chunk_x: i32, chunk_z: i32) -> bool {
        self.world.is_column_loaded(chunk_x, chunk_z)
    }
}

fn face(d: ghast_physics::pick::Direction) -> Face {
    use ghast_physics::pick::Direction;
    match d {
        Direction::Down => Face::Down,
        Direction::Up => Face::Up,
        Direction::North => Face::North,
        Direction::South => Face::South,
        Direction::West => Face::West,
        Direction::East => Face::East,
    }
}

fn v3(a: [f64; 3]) -> Vec3 {
    Vec3::new(a[0], a[1], a[2])
}

/// Runs `tick` (one server tick of the projectile: its block hit and position, or `None` once
/// removed) up to `max_ticks` times from `start`.
fn fly(
    start: [f64; 3],
    vel: [f64; 3],
    max_spread: f64,
    max_ticks: u32,
    mut tick: impl FnMut() -> Option<(Option<([i32; 3], Face, [f64; 3])>, [f64; 3])>,
) -> ThrowPrediction {
    let mut path = vec![v3(start)];
    let mut hit = None;
    for t in 1..=max_ticks {
        let Some((h, pos)) = tick() else { break };
        path.push(v3(pos));
        if let Some((b, face, p)) = h {
            hit = Some(ThrowHit {
                block: BlockPos::new(b[0], b[1], b[2]),
                face,
                point: v3(p),
                tick: t,
            });
            break;
        }
    }
    ThrowPrediction {
        path,
        velocity: v3(vel),
        hit,
        max_spread,
    }
}

/// The expected flight of `throw` from `shooter` in `world` for `version` (`None`: the version
/// has no such item, or the bow was not drawn long enough).
pub(crate) fn predict(
    world: &dyn WorldView,
    version: GameVersion,
    throw: Throw,
    shooter: &Shooter,
    max_ticks: u32,
) -> Option<ThrowPrediction> {
    match version.instance() {
        #[cfg(feature = "v1_8")]
        GameVersion::V1_8_9 => v1_8(world, throw, shooter, max_ticks),
        #[cfg(feature = "v1_12_2")]
        GameVersion::V1_12_2 => v1_12(world, throw, shooter, max_ticks),
        #[cfg(feature = "v1_16_5")]
        GameVersion::V1_16_5 => v1_16_5(world, throw, shooter, max_ticks),
        #[cfg(feature = "v26_1")]
        GameVersion::V26_1 => {
            modern::<ghast_physics::modern::V26_1>(world, throw, shooter, max_ticks, |r| {
                r.and_then(|id| ghast_data::v26_1::BlockState::from_id(id as u16))
                    .unwrap_or(ghast_data::v26_1::Block::VOID_AIR.default_state())
            })
        }
        #[cfg(feature = "v26_2")]
        GameVersion::V26_2 => {
            modern::<ghast_physics::modern::V26_2>(world, throw, shooter, max_ticks, |r| {
                r.and_then(|id| ghast_data::v26_2::BlockState::from_id(id as u16))
                    .unwrap_or(ghast_data::v26_2::Block::VOID_AIR.default_state())
            })
        }
        #[cfg(feature = "v26_3")]
        GameVersion::V26_3 => {
            modern::<ghast_physics::modern::V26_3>(world, throw, shooter, max_ticks, |r| {
                r.and_then(|id| ghast_data::v26_3::BlockState::from_id(id as u16))
                    .unwrap_or(ghast_data::v26_3::Block::VOID_AIR.default_state())
            })
        }
        _ => {
            let _ = (world, throw, shooter, max_ticks);
            None
        }
    }
}

#[cfg(any(feature = "v26_1", feature = "v26_2", feature = "v26_3"))]
fn modern<R: ghast_physics::modern::Rules>(
    world: &dyn WorldView,
    throw: Throw,
    s: &Shooter,
    max_ticks: u32,
    decode: fn(Option<u32>) -> R::State,
) -> Option<ThrowPrediction> {
    use ghast_physics::modern::launch::{self, LaunchSpec, Noise};
    use ghast_physics::modern::projectile::{self as p, Projectile, ProjectileKind as K};
    let (kind, spec) = match throw {
        Throw::Snowball => (K::Snowball, LaunchSpec::THROWN),
        Throw::Egg => (K::Egg, LaunchSpec::THROWN),
        Throw::EnderPearl => (K::EnderPearl, LaunchSpec::THROWN),
        Throw::SplashPotion => (K::SplashPotion, LaunchSpec::POTION),
        Throw::LingeringPotion => (K::LingeringPotion, LaunchSpec::POTION),
        Throw::ExperienceBottle => (K::ExperienceBottle, LaunchSpec::EXPERIENCE_BOTTLE),
        Throw::WindCharge => (K::WindCharge, LaunchSpec::WIND_CHARGE),
        Throw::Trident => (K::Trident, LaunchSpec::TRIDENT),
        Throw::Bow { ticks_held } => (K::Arrow, LaunchSpec::bow(ticks_held)?),
        Throw::CrossbowArrow => (K::Arrow, LaunchSpec::CROSSBOW_ARROW),
    };
    let eye_y = s.pos.y + s.eye_height;
    // Every kind starts 0.1 below the eyes, the wind charge at them.
    let y = if kind == K::WindCharge {
        eye_y
    } else {
        eye_y - f64::from(0.1f32)
    };
    let start = [s.pos.x, y, s.pos.z];
    let l = launch::shoot(
        s.yaw,
        s.pitch,
        &spec,
        Noise::NONE,
        [s.motion.x, s.motion.y, s.motion.z],
        s.on_ground,
    );
    let w = Raw { world, decode };
    let mut pr = Projectile::new(kind, start, l.vel).with_rotation(l.yaw, l.pitch);
    Some(fly(
        start,
        l.vel,
        launch::max_spread(&spec),
        max_ticks,
        || {
            if pr.removed() {
                return None;
            }
            let h = p::tick_projectile::<R, _>(&mut pr, p::Side::Server, &w);
            Some((h.map(|h| (h.pos, face(h.face), h.location)), pr.pos()))
        },
    ))
}

#[cfg(feature = "v1_16_5")]
fn v1_16_5(
    world: &dyn WorldView,
    throw: Throw,
    s: &Shooter,
    max_ticks: u32,
) -> Option<ThrowPrediction> {
    use ghast_data::v1_16_5::BlockState;
    use ghast_physics::v1_16_5::launch::{self, LaunchSpec, Noise};
    use ghast_physics::v1_16_5::projectile::{self as p, Projectile, ProjectileKind as K};
    let (kind, spec) = match throw {
        Throw::Snowball => (K::Snowball, LaunchSpec::THROWN),
        Throw::Egg => (K::Egg, LaunchSpec::THROWN),
        Throw::EnderPearl => (K::EnderPearl, LaunchSpec::THROWN),
        Throw::SplashPotion => (K::SplashPotion, LaunchSpec::POTION),
        Throw::LingeringPotion => (K::LingeringPotion, LaunchSpec::POTION),
        Throw::ExperienceBottle => (K::ExperienceBottle, LaunchSpec::EXPERIENCE_BOTTLE),
        Throw::Trident => (K::Trident, LaunchSpec::TRIDENT),
        Throw::Bow { ticks_held } => (K::Arrow, LaunchSpec::bow(ticks_held)?),
        Throw::WindCharge | Throw::CrossbowArrow => return None,
    };
    let start = [s.pos.x, launch::launch_y(s.pos.y + s.eye_height), s.pos.z];
    let l = launch::shoot(
        s.yaw,
        s.pitch,
        &spec,
        Noise::NONE,
        [s.motion.x, s.motion.y, s.motion.z],
        s.on_ground,
    );
    let w = Raw {
        world,
        decode: |r| {
            r.and_then(|id| BlockState::from_id(id as u16))
                .unwrap_or(BlockState::AIR)
        },
    };
    let mut pr = Projectile::new(kind, start, l.vel).with_rotation(l.yaw, l.pitch);
    let spread = f64::from(spec.power) * launch::SPREAD * f64::from(spec.uncertainty);
    Some(fly(start, l.vel, spread, max_ticks, || {
        if pr.removed() {
            return None;
        }
        let h = p::tick_projectile(&mut pr, p::Side::Server, &w);
        Some((h.map(|h| (h.pos, face(h.face), h.location)), pr.pos()))
    }))
}

#[cfg(feature = "v1_12_2")]
fn v1_12(
    world: &dyn WorldView,
    throw: Throw,
    s: &Shooter,
    max_ticks: u32,
) -> Option<ThrowPrediction> {
    use ghast_data::v1_12::BlockState;
    use ghast_physics::v1_12::launch::{self, LaunchSpec, Noise};
    use ghast_physics::v1_12::projectile::{self as p, Projectile, ProjectileKind as K};
    let (kind, spec) = match throw {
        Throw::Snowball => (K::Snowball, LaunchSpec::THROWN),
        Throw::Egg => (K::Egg, LaunchSpec::THROWN),
        Throw::EnderPearl => (K::EnderPearl, LaunchSpec::THROWN),
        Throw::SplashPotion => (K::SplashPotion, LaunchSpec::POTION),
        Throw::LingeringPotion => (K::LingeringPotion, LaunchSpec::POTION),
        Throw::ExperienceBottle => (K::ExperienceBottle, LaunchSpec::EXPERIENCE_BOTTLE),
        Throw::Bow { ticks_held } => (K::Arrow, LaunchSpec::bow(ticks_held)?),
        Throw::WindCharge | Throw::Trident | Throw::CrossbowArrow => return None,
    };
    let start = [s.pos.x, launch::launch_y(s.pos.y + s.eye_height), s.pos.z];
    let motion = [s.motion.x, s.motion.y, s.motion.z];
    let l = if kind == K::Arrow {
        launch::shoot_arrow(s.yaw, s.pitch, &spec, Noise::NONE, motion, s.on_ground)
    } else {
        launch::shoot(s.yaw, s.pitch, &spec, Noise::NONE, motion, s.on_ground)
    };
    let w = Raw {
        world,
        decode: |r| {
            r.and_then(|id| BlockState::from_raw(id as u16))
                .unwrap_or(BlockState::AIR)
        },
    };
    let mut pr = Projectile::new(kind, start, l.vel).with_rotation(l.yaw, l.pitch);
    let spread = f64::from(spec.power) * launch::SPREAD * f64::from(spec.uncertainty);
    Some(fly(start, l.vel, spread, max_ticks, || {
        if pr.removed() {
            return None;
        }
        let h = p::tick_projectile(&mut pr, p::Side::Server, &w);
        Some((h.map(|h| (h.pos, face(h.face), h.location)), pr.pos()))
    }))
}

#[cfg(feature = "v1_8")]
fn v1_8(
    world: &dyn WorldView,
    throw: Throw,
    s: &Shooter,
    max_ticks: u32,
) -> Option<ThrowPrediction> {
    use ghast_data::v1_8::BlockState;
    use ghast_physics::v1_8::launch::{self, LaunchSpec, Noise, Shooter as From};
    use ghast_physics::v1_8::projectile::{self as p, Projectile, ProjectileKind as K};
    let (kind, spec, from) = match throw {
        Throw::Snowball => (K::Snowball, LaunchSpec::THROWN, From::Thrown),
        Throw::Egg => (K::Egg, LaunchSpec::THROWN, From::Thrown),
        Throw::EnderPearl => (K::EnderPearl, LaunchSpec::THROWN, From::Thrown),
        Throw::SplashPotion => (K::SplashPotion, LaunchSpec::POTION, From::Thrown),
        Throw::ExperienceBottle => (
            K::ExperienceBottle,
            LaunchSpec::EXPERIENCE_BOTTLE,
            From::Thrown,
        ),
        Throw::Bow { ticks_held } => (K::Arrow, LaunchSpec::bow(ticks_held)?, From::Arrow),
        _ => return None,
    };
    // 1.8 starts beside the eyes (0.16 to the side) and adds no shooter motion.
    let l = launch::shoot(
        from,
        s.yaw,
        s.pitch,
        [s.pos.x, s.pos.y, s.pos.z],
        s.eye_height as f32,
        &spec,
        Noise::NONE,
    );
    let w = Raw {
        world,
        decode: |r| {
            r.and_then(|id| BlockState::from_raw(id as u16))
                .unwrap_or(BlockState::AIR)
        },
    };
    let mut pr = Projectile::new(kind, l.pos, l.vel).with_rotation(l.yaw, l.pitch);
    let spread = f64::from(spec.power) * launch::SPREAD * f64::from(spec.uncertainty);
    Some(fly(l.pos, l.vel, spread, max_ticks, || {
        if pr.removed() {
            return None;
        }
        let h = p::tick_projectile(&mut pr, p::Side::Server, &w);
        Some((h.map(|h| (h.pos, face(h.face), h.location)), pr.pos()))
    }))
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::sim::Sim;

    /// A player at (8.5, 64, 8.5) on the stone layer y 63 of a 3×3 column world.
    fn shooter(yaw: f32, pitch: f32) -> Shooter {
        Shooter {
            pos: Vec3::new(8.5, 64.0, 8.5),
            eye_height: f64::from(1.62f32),
            yaw,
            pitch,
            motion: Vec3::new(0.0, 0.0, 0.0),
            on_ground: true,
        }
    }

    fn check(
        mut sim: impl Sim,
        version: GameVersion,
        chunk: Option<fn(i32, i32) -> ghast_protocol::RawPacket>,
    ) {
        for x in -1..=1 {
            for z in -1..=5 {
                if let Some(chunk) = chunk {
                    sim.world_packet(&chunk(x, z)).unwrap();
                }
            }
        }
        let w: &dyn WorldView = &sim;
        // A snowball thrown level lands on the floor ahead (+Z at yaw 0), nearer than an arrow
        // from a full bow.
        let s = predict(w, version, Throw::Snowball, &shooter(0.0, 0.0), 100).unwrap();
        let hit = s
            .hit
            .unwrap_or_else(|| panic!("{version:?} {:?} {:?}", s.path, w.raw_block(8, 63, 12)));
        assert_eq!(
            (hit.block.y, hit.face),
            (63, Face::Up),
            "{version:?} {hit:?}"
        );
        assert!(
            hit.block.z > 9 && (hit.point.x - 8.5).abs() < 0.3,
            "{version:?} {hit:?}"
        );
        assert_eq!(s.path.len(), hit.tick as usize + 1);
        assert!(
            s.path[0].y > 65.0 && s.path[0].y < 65.6,
            "{version:?} {:?}",
            s.path[0]
        );
        assert!(s.max_spread > 0.0);
        let a = predict(
            w,
            version,
            Throw::Bow { ticks_held: 20 },
            &shooter(0.0, 0.0),
            100,
        )
        .unwrap()
        .hit
        .unwrap();
        assert!(a.block.z > hit.block.z, "{version:?} {a:?} {hit:?}");
        // Thrown up: the path rises, then falls back near the start.
        let up = predict(w, version, Throw::EnderPearl, &shooter(0.0, -90.0), 200).unwrap();
        let top = up.path.iter().map(|p| p.y).fold(f64::MIN, f64::max);
        assert!(top > 70.0, "{version:?} {top}");
        assert_eq!(up.hit.unwrap().block.y, 63);
        // An undrawn bow shoots nothing.
        assert_eq!(
            predict(
                w,
                version,
                Throw::Bow { ticks_held: 1 },
                &shooter(0.0, 0.0),
                10
            ),
            None
        );
    }

    #[cfg(feature = "v1_8")]
    #[test]
    fn throws_on_1_8() {
        check(
            crate::sim::Sim18::new(),
            GameVersion::V1_8_9,
            Some(crate::sim::test_chunks::v1_8),
        );
        let w = crate::sim::Sim18::new();
        assert_eq!(
            predict(
                &w,
                GameVersion::V1_8_9,
                Throw::Trident,
                &shooter(0.0, 0.0),
                5
            ),
            None
        );
    }

    #[cfg(feature = "v1_12_2")]
    #[test]
    fn throws_on_1_12() {
        check(
            crate::sim::Sim12::new(),
            GameVersion::V1_12_2,
            Some(crate::sim::test_chunks::v1_12_2),
        );
    }

    #[cfg(feature = "v1_16_5")]
    #[test]
    fn throws_on_1_16_5() {
        // The 1.16.5 test chunks are empty: the stone floor comes as block changes.
        let mut sim = crate::sim::Sim16::new();
        for x in -1..=1 {
            for z in -1..=5 {
                sim.world_packet(&crate::sim::test_chunks::v1_16_5(x, z))
                    .unwrap();
            }
        }
        for x in 0..16 {
            for z in -16..96 {
                let p = ghast_protocol::v1_16_5::play::clientbound::BlockChange {
                    location: BlockPos::new(x, 63, z),
                    r#type: 1, // stone
                };
                sim.world_packet(&ghast_protocol::RawPacket::from_packet(&p).unwrap())
                    .unwrap();
            }
        }
        check(sim, GameVersion::V1_16_5, None);
    }

    #[cfg(feature = "v26_1")]
    #[test]
    fn throws_on_26_1() {
        check(
            crate::sim::Sim26::test_overworld(),
            GameVersion::V26_1,
            Some(crate::sim::test_chunks::v26_1),
        );
    }

    #[cfg(feature = "v26_2")]
    #[test]
    fn throws_on_26_2() {
        check(
            crate::sim::Sim262::test_overworld(),
            GameVersion::V26_2,
            Some(crate::sim::test_chunks::v26_2),
        );
    }

    #[cfg(feature = "v26_3")]
    #[test]
    fn throws_on_26_3() {
        check(
            crate::sim::Sim263::test_overworld(),
            GameVersion::V26_3,
            Some(crate::sim::test_chunks::v26_3),
        );
        // The launch is the physics' own (`shootFromRotation` without spread).
        let mut sim = crate::sim::Sim263::test_overworld();
        sim.world_packet(&crate::sim::test_chunks::v26_3(0, 0))
            .unwrap();
        let s = predict(
            &sim,
            GameVersion::V26_3,
            Throw::Trident,
            &shooter(10.0, -5.0),
            60,
        )
        .unwrap();
        use ghast_physics::modern::launch::{self, LaunchSpec, Noise};
        let l = launch::shoot(
            10.0,
            -5.0,
            &LaunchSpec::TRIDENT,
            Noise::NONE,
            [0.0; 3],
            true,
        );
        assert_eq!(s.velocity, v3(l.vel));
    }
}