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
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
//! Applying the switches, once per frame, through JNI.
//!
//! Every module here changes only the client's own state — the kind of thing a
//! client can do anywhere, whether or not it owns the server. Nothing reaches
//! for the integrated server: no editing world time, no server-side health, no
//! teleports the server is told to accept, because none of that exists to a
//! client connected to someone else's world.
//!
//! A server can of course disagree with what we do, and for flight or noclip it
//! will. Where a module has variants, they differ in exactly that: how far the
//! position stream we produce is from something a vanilla client could have
//! sent.
use std::time::Instant;
use jni_sys::jobject;
use crate::jni::Jni;
use crate::mc::{Mc, TargetKind, World};
use crate::state::{AimMode, Config, FlyMode, GameState, SpeedMode, Target};
/// Values a module replaced, so switching it off restores the game's own.
pub struct Saved {
may_fly: Option<bool>,
fly_speed: Option<f32>,
walk_speed: Option<f32>,
no_physics: Option<bool>,
prev_on_ground: bool,
prev_hurt_time: i32,
last_step: Instant,
last_swing: Instant,
last_aura: Instant,
last_trigger: Instant,
freecam_origin: Option<(f64, f64, f64)>,
entity_reach: Option<f64>,
block_reach: Option<f64>,
step_height: Option<f64>,
gamma: Option<f64>,
fov: Option<i32>,
bob_view: Option<bool>,
}
impl Default for Saved {
fn default() -> Self {
Self {
may_fly: None,
fly_speed: None,
walk_speed: None,
no_physics: None,
prev_on_ground: false,
prev_hurt_time: 0,
last_step: Instant::now(),
last_swing: Instant::now(),
last_aura: Instant::now(),
last_trigger: Instant::now(),
freecam_origin: None,
entity_reach: None,
block_reach: None,
step_height: None,
gamma: None,
fov: None,
bob_view: None,
}
}
}
pub fn apply(
j: &Jni,
mc: &Mc,
world: Option<&World>,
cfg: &Config,
saved: &mut Saved,
) -> GameState {
let mut st = GameState::default();
let Some(instance) = mc.instance(j) else {
return st;
};
st.screen_open = mc.screen_open(j, instance);
st.single_player = mc.single_player(j, instance);
let Some(player) = mc.player(j, instance) else {
return st;
};
st.in_world = true;
// ---- read ------------------------------------------------------------
if let Some(p) = mc.position(j, player) {
st.pos = p;
st.eye = (p.0, p.1 + 1.62, p.2);
}
let (yaw, pitch) = mc.rotation(j, player);
st.yaw = yaw;
st.pitch = pitch;
st.on_ground = mc.on_ground(j, player);
st.health = mc.health(j, player).unwrap_or(0.0);
st.sprinting = mc.is_sprinting(j, player);
let hurt_time = mc.hurt_time(j, player);
let abilities = mc.abilities(j, player);
let m = &cfg.movement;
// ---- flight ----------------------------------------------------------
let vanilla_fly = m.fly && m.fly_mode == FlyMode::Vanilla;
if let Some(ab) = abilities {
if vanilla_fly {
if saved.may_fly.is_none() {
saved.may_fly = Some(mc.may_fly(j, ab));
}
if !mc.may_fly(j, ab) {
mc.set_may_fly(j, ab, true);
}
if !mc.flying(j, ab) {
mc.set_flying(j, ab, true);
}
if saved.fly_speed.is_none() {
saved.fly_speed = Some(mc.fly_speed(j, ab));
}
if (mc.fly_speed(j, ab) - m.fly_speed).abs() > f32::EPSILON {
mc.set_fly_speed(j, ab, m.fly_speed);
}
} else {
if let Some(prev) = saved.may_fly.take() {
mc.set_flying(j, ab, false);
mc.set_may_fly(j, ab, prev);
}
if let Some(prev) = saved.fly_speed.take() {
mc.set_fly_speed(j, ab, prev);
}
}
// ---- speed -------------------------------------------------------
if m.speed && m.speed_mode == SpeedMode::Abilities {
if saved.walk_speed.is_none() {
saved.walk_speed = Some(mc.walk_speed(j, ab));
}
if (mc.walk_speed(j, ab) - m.speed_value).abs() > f32::EPSILON {
mc.set_walk_speed(j, ab, m.speed_value);
}
} else if let Some(prev) = saved.walk_speed.take() {
mc.set_walk_speed(j, ab, prev);
}
}
if m.fly && !st.screen_open {
match m.fly_mode {
FlyMode::Vanilla => {}
FlyMode::Glide => {
// Cancel gravity only: horizontal control stays vanilla, and
// the position stream keeps looking like ordinary movement.
if let Some((dx, _, dz)) = mc.delta_movement(j, player) {
mc.set_delta_movement(j, player, dx, 0.0, dz);
}
}
FlyMode::Smooth => {
// Drive velocity along the way you are looking, accelerating
// rather than snapping, so every step stays a plausible size.
if let Some((dx, dy, dz)) = mc.delta_movement(j, player) {
let speed = m.fly_speed as f64;
let (sy, cy) = ((yaw.to_radians()) as f64).sin_cos();
let want_x = -sy * speed;
let want_z = cy * speed;
let blend = 0.35;
mc.set_delta_movement(
j,
player,
dx + (want_x - dx) * blend,
dy * 0.6,
dz + (want_z - dz) * blend,
);
}
}
FlyMode::Teleport => {
if saved.last_step.elapsed().as_secs_f32() >= m.fly_step_interval {
saved.last_step = Instant::now();
let step = m.fly_step as f64;
let (sy, cy) = ((yaw.to_radians()) as f64).sin_cos();
let (sp, cp) = ((pitch.to_radians()) as f64).sin_cos();
let (x, y, z) = st.pos;
mc.set_pos(
j,
player,
x - sy * cp * step,
y - sp * step,
z + cy * cp * step,
);
}
}
}
}
// ---- velocity speed --------------------------------------------------
if m.speed && m.speed_mode == SpeedMode::Velocity && !st.screen_open {
if let Some((dx, dy, dz)) = mc.delta_movement(j, player) {
let horizontal = (dx * dx + dz * dz).sqrt();
// Only push while you are already moving, so standing still does
// not slide you across the ground.
if horizontal > 0.02 {
let scale = 1.0 + m.speed_value as f64;
mc.set_delta_movement(j, player, dx * scale, dy, dz * scale);
}
}
}
// ---- jetpack ---------------------------------------------------------
if m.jetpack && mc.jumping(j, player) && !st.screen_open {
if let Some((dx, _, dz)) = mc.delta_movement(j, player) {
mc.set_delta_movement(j, player, dx, m.jetpack_power as f64, dz);
}
}
// ---- auto sprint -----------------------------------------------------
// Held every frame: the game clears the flag whenever you stop, so a
// one-shot write would last a single tick.
if m.sprint && !st.screen_open && !st.sprinting {
mc.set_sprinting(j, player, true);
}
// ---- noclip ----------------------------------------------------------
if m.noclip || m.freecam {
if saved.no_physics.is_none() {
saved.no_physics = Some(false);
}
mc.set_no_physics(j, player, true);
} else if let Some(prev) = saved.no_physics.take() {
mc.set_no_physics(j, player, prev);
}
// ---- freecam ---------------------------------------------------------
// Without control of the packets we send, the honest version of this is a
// ghost: collision off, and your body put back where it started when you
// switch it off.
if m.freecam {
if saved.freecam_origin.is_none() {
saved.freecam_origin = Some(st.pos);
}
} else if let Some((x, y, z)) = saved.freecam_origin.take() {
mc.set_pos(j, player, x, y, z);
}
// ---- jesus -----------------------------------------------------------
// Buoyancy pulls you under; holding a small upward velocity while touching
// water keeps you on the surface instead.
if m.jesus && !st.screen_open && world.map(|w| w.in_water(j, player)).unwrap_or(false) {
if let Some((dx, _, dz)) = mc.delta_movement(j, player) {
mc.set_delta_movement(j, player, dx, 0.08, dz);
}
}
// ---- spider ----------------------------------------------------------
// Walking into a wall normally stops you flat; a steady climb turns it
// into a ladder.
if m.spider && !st.screen_open && world.map(|w| w.hitting_wall(j, player)).unwrap_or(false) {
if let Some((dx, _, dz)) = mc.delta_movement(j, player) {
mc.set_delta_movement(j, player, dx, m.spider_power as f64, dz);
}
}
// ---- jump power ------------------------------------------------------
// The frame you leave the ground is the one carrying the jump impulse.
if m.jump_power && saved.prev_on_ground && !st.on_ground {
if let Some((dx, dy, dz)) = mc.delta_movement(j, player) {
if dy > 0.05 {
mc.set_delta_movement(j, player, dx, dy * m.jump_multiplier as f64, dz);
}
}
}
// ---- no fall ---------------------------------------------------------
if m.no_fall {
if mc.fall_distance(j, player) > 0.0 {
mc.set_fall_distance(j, player, 0.0);
}
}
// ---- anti knockback --------------------------------------------------
// A hit shows up as hurtTime jumping to its maximum; that same tick the
// server's velocity has already been applied, so scale it back down.
let c = &cfg.combat;
if c.anti_knockback && hurt_time > saved.prev_hurt_time {
if let Some((dx, dy, dz)) = mc.delta_movement(j, player) {
mc.set_delta_movement(
j,
player,
dx * c.kb_horizontal as f64,
dy * c.kb_vertical as f64,
dz * c.kb_horizontal as f64,
);
}
}
// ---- no hurt camera --------------------------------------------------
// After the knockback check, which needs the real value.
if cfg.visuals.no_hurt_cam && hurt_time > 0 {
mc.set_hurt_time(j, player, 0);
}
// ---- auto clicker ----------------------------------------------------
if c.auto_clicker && !st.screen_open {
let interval = 1.0 / c.click_cps.max(0.5);
// Jitter the gap so the rhythm is not machine-perfect.
let jitter = 1.0 + c.click_jitter * pseudo_random(saved.last_swing);
if saved.last_swing.elapsed().as_secs_f32() >= interval * jitter {
saved.last_swing = Instant::now();
mc.start_attack(j, instance);
}
}
// ---- everything that needs the world ---------------------------------
if let Some(w) = world {
// The camera, not the player: in third person they are not the same
// place, and ESP has to project from where the view actually is.
if let Some((pos, yaw, pitch)) = w.camera(j, mc, instance) {
st.camera = pos;
st.camera_yaw = yaw;
st.camera_pitch = pitch;
} else {
st.camera = st.eye;
st.camera_yaw = st.yaw;
st.camera_pitch = st.pitch;
}
st.fov = w.fov(j, instance).unwrap_or(70.0);
attributes(j, w, player, cfg, saved);
visuals(j, mc, w, instance, cfg, saved);
let aura = &cfg.combat;
let want_scan = aura.kill_aura || aura.aimbot || esp_wanted(cfg);
if want_scan {
let best = scan(j, mc, w, instance, player, cfg, &mut st);
combat(j, mc, w, instance, player, cfg, saved, &mut st, best);
}
trigger_bot(j, mc, w, instance, player, cfg, saved);
}
saved.prev_on_ground = st.on_ground;
saved.prev_hurt_time = hurt_time;
st
}
fn esp_wanted(cfg: &Config) -> bool {
let e = &cfg.esp;
e.players || e.mobs || e.animals || e.items || e.containers
}
/// Walk the level's entities once, filling in ESP targets and picking the best
/// thing to hit. Returns that candidate, still a live reference for this frame.
fn scan(
j: &Jni,
mc: &Mc,
w: &World,
instance: jobject,
player: jobject,
cfg: &Config,
st: &mut GameState,
) -> Option<jobject> {
let Some(level) = mc.level(j, instance) else {
return None;
};
let Some(iterator) = w.entity_iterator(j, level) else {
return None;
};
let eye = st.eye;
let esp_range = cfg.esp.distance as f64;
let aura_range = cfg.combat.aura_range as f64;
let mut best: Option<jobject> = None;
let mut best_distance = f64::MAX;
// A hard cap: a busy world can hold thousands of entities and this runs
// every frame.
for _ in 0..4096 {
let Some(entity) = w.iter_next(j, iterator) else {
break;
};
if j.same_object(entity, player) || !w.is_alive(j, entity) {
j.delete_local(entity);
continue;
}
let kind = w.classify(j, entity);
let Some((min, max)) = w.bounding_box(j, entity) else {
j.delete_local(entity);
continue;
};
let centre = (
(min.0 + max.0) / 2.0,
(min.1 + max.1) / 2.0,
(min.2 + max.2) / 2.0,
);
let distance = distance_between(eye, centre);
if aura_wanted(cfg, kind) && distance <= aura_range && distance < best_distance {
if let Some(previous) = best.replace(entity) {
j.delete_local(previous);
}
best_distance = distance;
// Kept alive for the attack below; do not delete it here.
}
if esp_shows(cfg, kind) && distance <= esp_range {
let living = w.is_living(j, entity);
st.targets.push(Target {
min,
max,
health: if living { mc.health(j, entity).unwrap_or(0.0) } else { 0.0 },
max_health: if living { w.max_health(j, entity) } else { 0.0 },
distance: distance as f32,
kind,
name: if cfg.esp.nametags {
w.name(j, entity).unwrap_or_default()
} else {
String::new()
},
});
}
if best.map(|b| !j.same_object(b, entity)).unwrap_or(true) {
j.delete_local(entity);
}
}
j.delete_local(iterator);
best
}
fn aura_wanted(cfg: &Config, kind: TargetKind) -> bool {
let c = &cfg.combat;
if !c.kill_aura && !c.aimbot {
return false;
}
match kind {
TargetKind::Player => c.aura_players,
TargetKind::Mob => c.aura_mobs,
TargetKind::Animal => c.aura_animals,
_ => false,
}
}
fn esp_shows(cfg: &Config, kind: TargetKind) -> bool {
let e = &cfg.esp;
match kind {
TargetKind::Player => e.players,
TargetKind::Mob => e.mobs,
TargetKind::Animal => e.animals,
TargetKind::Item => e.items,
TargetKind::Other => false,
}
}
fn distance_between(a: (f64, f64, f64), b: (f64, f64, f64)) -> f64 {
let (dx, dy, dz) = (b.0 - a.0, b.1 - a.1, b.2 - a.2);
(dx * dx + dy * dy + dz * dz).sqrt()
}
/// Yaw and pitch that point from `from` at `to`, in Minecraft's convention.
fn look_at(from: (f64, f64, f64), to: (f64, f64, f64)) -> (f32, f32) {
let (dx, dy, dz) = (to.0 - from.0, to.1 - from.1, to.2 - from.2);
let horizontal = (dx * dx + dz * dz).sqrt();
let yaw = dz.atan2(dx).to_degrees() - 90.0;
let pitch = -dy.atan2(horizontal).to_degrees();
(yaw as f32, pitch as f32)
}
/// Shortest signed way round from one angle to another.
fn angle_delta(from: f32, to: f32) -> f32 {
let mut d = (to - from) % 360.0;
if d > 180.0 {
d -= 360.0;
}
if d < -180.0 {
d += 360.0;
}
d
}
#[allow(clippy::too_many_arguments)]
fn combat(
j: &Jni,
mc: &Mc,
w: &World,
instance: jobject,
player: jobject,
cfg: &Config,
saved: &mut Saved,
st: &mut GameState,
best: Option<jobject>,
) {
let c = &cfg.combat;
let Some(target) = best else {
return;
};
let Some((min, max)) = w.bounding_box(j, target) else {
return;
};
let centre = (
(min.0 + max.0) / 2.0,
(min.1 + max.1) / 2.0,
(min.2 + max.2) / 2.0,
);
let (want_yaw, want_pitch) = look_at(st.eye, centre);
// ---- aimbot ----------------------------------------------------------
if c.aimbot {
let within_fov = angle_delta(st.yaw, want_yaw).abs() <= c.aim_fov / 2.0;
if within_fov {
// Step a fraction of the way each frame rather than snapping: a
// camera that teleports onto a target is the single most obvious
// thing a cheat can do.
let blend = c.aim_speed.clamp(0.02, 1.0);
let yaw = st.yaw + angle_delta(st.yaw, want_yaw) * blend;
let pitch = st.pitch + (want_pitch - st.pitch) * blend;
if c.aim_mode == AimMode::Camera {
mc.set_rotation(j, player, yaw, pitch);
st.yaw = yaw;
st.pitch = pitch;
}
// Silent aim is handled at the swing below: the view is left alone
// and only the attack is aimed.
}
}
// ---- kill aura -------------------------------------------------------
if c.kill_aura {
let interval = 1.0 / c.aura_cps.max(0.5);
if saved.last_aura.elapsed().as_secs_f32() >= interval {
saved.last_aura = Instant::now();
if c.criticals && st.on_ground {
// A hit only counts as critical while falling, so leave the
// ground a moment before the swing lands.
if let Some((dx, _, dz)) = mc.delta_movement(j, player) {
mc.set_delta_movement(j, player, dx, 0.1, dz);
}
}
let restore = if c.aimbot && c.aim_mode == AimMode::Silent {
let previous = (st.yaw, st.pitch);
mc.set_rotation(j, player, want_yaw, want_pitch);
Some(previous)
} else {
None
};
if let Some(game_mode) = mc.game_mode(j, instance) {
w.attack(j, game_mode, player, target);
}
if let Some((yaw, pitch)) = restore {
mc.set_rotation(j, player, yaw, pitch);
}
}
}
j.delete_local(target);
}
/// Swing when the crosshair is already on something — no aiming, no target
/// selection, which is why it is the least conspicuous of the three.
fn trigger_bot(
j: &Jni,
mc: &Mc,
w: &World,
instance: jobject,
player: jobject,
cfg: &Config,
saved: &mut Saved,
) {
let c = &cfg.combat;
if !c.trigger_bot {
return;
}
if saved.last_trigger.elapsed().as_secs_f32() < c.trigger_delay.max(0.05) {
return;
}
let Some(target) = w.crosshair_entity(j, instance) else {
return;
};
saved.last_trigger = Instant::now();
if let Some(game_mode) = mc.game_mode(j, instance) {
w.attack(j, game_mode, player, target);
}
j.delete_local(target);
}
/// Reach and step height are attributes, so they are set once and restored
/// when the module goes off.
fn attributes(j: &Jni, w: &World, player: jobject, cfg: &Config, saved: &mut Saved) {
let c = &cfg.combat;
if c.reach {
if saved.entity_reach.is_none() {
saved.entity_reach = w.attribute_base(j, player, w.holder_entity_reach);
saved.block_reach = w.attribute_base(j, player, w.holder_block_reach);
}
let want = c.reach_distance as f64;
w.set_attribute_base(j, player, w.holder_entity_reach, want);
w.set_attribute_base(j, player, w.holder_block_reach, want);
} else {
if let Some(v) = saved.entity_reach.take() {
w.set_attribute_base(j, player, w.holder_entity_reach, v);
}
if let Some(v) = saved.block_reach.take() {
w.set_attribute_base(j, player, w.holder_block_reach, v);
}
}
let m = &cfg.movement;
if m.step {
if saved.step_height.is_none() {
saved.step_height = w.attribute_base(j, player, w.holder_step_height);
}
w.set_attribute_base(j, player, w.holder_step_height, m.step_height as f64);
} else if let Some(v) = saved.step_height.take() {
w.set_attribute_base(j, player, w.holder_step_height, v);
}
}
fn visuals(
j: &Jni,
mc: &Mc,
w: &World,
instance: jobject,
cfg: &Config,
saved: &mut Saved,
) {
let v = &cfg.visuals;
if v.no_weather {
if let Some(level) = mc.level(j, instance) {
w.set_weather(j, level, 0.0);
}
}
if v.no_bob {
if saved.bob_view.is_none() {
saved.bob_view = w.bob_view(j, instance);
}
w.set_bob_view(j, instance, false);
} else if let Some(b) = saved.bob_view.take() {
w.set_bob_view(j, instance, b);
}
if v.fullbright {
if saved.gamma.is_none() {
saved.gamma = w.gamma(j, instance);
}
// The option is clamped in the UI but not on the way in.
w.set_gamma(j, instance, 15.0);
} else if let Some(g) = saved.gamma.take() {
w.set_gamma(j, instance, g);
}
if v.fov {
if saved.fov.is_none() {
saved.fov = w.fov(j, instance).map(|f| f as i32);
}
w.set_fov(j, instance, v.fov_value as i32);
} else if let Some(f) = saved.fov.take() {
w.set_fov(j, instance, f);
}
}
/// Cheap deterministic jitter in [-0.5, 0.5] — enough to break up a perfectly
/// even click interval without pulling in a random number generator.
fn pseudo_random(seed: Instant) -> f32 {
let n = seed.elapsed().subsec_nanos();
((n.wrapping_mul(2654435761) >> 8) as f32 / u32::MAX as f32) - 0.5
}
/// Put everything back — used when the client unloads.
pub fn restore(j: &Jni, mc: &Mc, world: Option<&World>, saved: &mut Saved) {
let Some(instance) = mc.instance(j) else {
return;
};
let Some(player) = mc.player(j, instance) else {
return;
};
if let Some(ab) = mc.abilities(j, player) {
if let Some(prev) = saved.may_fly.take() {
mc.set_flying(j, ab, false);
mc.set_may_fly(j, ab, prev);
}
if let Some(prev) = saved.fly_speed.take() {
mc.set_fly_speed(j, ab, prev);
}
if let Some(prev) = saved.walk_speed.take() {
mc.set_walk_speed(j, ab, prev);
}
}
if let Some(prev) = saved.no_physics.take() {
mc.set_no_physics(j, player, prev);
}
if let Some((x, y, z)) = saved.freecam_origin.take() {
mc.set_pos(j, player, x, y, z);
}
if let Some(w) = world {
if let Some(v) = saved.entity_reach.take() {
w.set_attribute_base(j, player, w.holder_entity_reach, v);
}
if let Some(v) = saved.block_reach.take() {
w.set_attribute_base(j, player, w.holder_block_reach, v);
}
if let Some(v) = saved.step_height.take() {
w.set_attribute_base(j, player, w.holder_step_height, v);
}
if let Some(g) = saved.gamma.take() {
w.set_gamma(j, instance, g);
}
if let Some(f) = saved.fov.take() {
w.set_fov(j, instance, f);
}
if let Some(b) = saved.bob_view.take() {
w.set_bob_view(j, instance, b);
}
}
}