-
Notifications
You must be signed in to change notification settings - Fork 0
26.2 Vacuum and Phase Shifting
๐ Repository Source Disclaimer: The documentation in this Wiki reflects the current source code state in the repository, which may include recent unreleased commits or developmental features ahead of public release builds on CurseForge and Modrinth.
| Feature Infobox | Technical Parameters |
|---|---|
| System Class | net.instantgratification.magnet.MagnetMovement |
| Trigger Event | Server Player Tick (PlayerMixin MagnetManager.tick) |
| Default Pull Range |
12 blocks (ig:magnet_range) |
| Default Terminal Speed |
80% ( |
| Default Acceleration |
10% ( |
| Phase Shifting (NoClip) | Enabled (ig:magnet_noclip = true) |
| Target Vector | Player Eye Position (player.getEyePosition()) |
| Ground Offset Boost |
entity.onGround()
|
The core vacuum mechanic in Magnet, Let me get that! scans for dropped ItemEntity instances within the player's configured radius each server tick and pulls them toward the player's eye level using smooth non-linear interpolation.
To prevent items from snagging on cobblestone lip edges, tree canopies, or ore vein crevices, the mod activates Phase Shifting (NoClip), allowing items in flight to pass harmlessly through solid block voxels.
+-------------+ Line-of-Sight OK +----------------------+ Lerp Velocity Applied +------------------+
| Item Entity | -------------------------> | Set NoClip (2 Ticks) | ------------------------------> | Player Eye Pos |
+-------------+ +----------------------+ +------------------+
|
v
[Cancel Wall Pushout]
[Bypass Block Collide]
[Cancel In-Wall Grav]
When pulling an item, the trajectory is computed directly in 3D Euclidean space:
Let $\vec{p}{\text{entity}} = (x_e, y_e, z_e)$ be the item's current position, and $\vec{p}{\text{eye}} = (x_p, y_p + h_{\text{eye}}, z_p)$ be the player's eye position. $$\vec{v}{\text{target}} = \vec{p}{\text{eye}} - \vec{p}{\text{entity}}$$ $$\hat{d} = \frac{\vec{v}{\text{target}}}{|\vec{v}{\text{target}}|} = \frac{\vec{v}{\text{target}}}{\sqrt{\Delta x^2 + \Delta y^2 + \Delta z^2}}$$
The target velocity vector scales unit direction
Velocity is updated using linear interpolation (Vec3.lerp) based on acceleration factor
If the item rests on a block surface (entity.onGround() == true), ground friction is instantly broken to prevent floor dragging:
if (entity.onGround()) {
entity.setOnGround(false);
entity.setPos(entity.position().add(0, 0.05, 0));
}When ig:magnet_noclip is enabled, items are tagged with a 2-tick NoClip window:
-
State Activation:
((IMagnetEntity) entity).ig_magnet$setMagnetNoClip()setsnoClipTicks = 2. -
Move Hijacking (
MixinEntity.java):-
move(MoverType, Vec3):@Inject(at = @At("HEAD"))savesoriginalNoPhysicsand forcesentity.noPhysics = true. -
move(MoverType, Vec3):@Inject(at = @At("RETURN"))restoresentity.noPhysics = originalNoPhysics.
-
-
Pushout Cancellation:
@Inject(method = "moveTowardsClosestSpace", at = @At("HEAD"), cancellable = true)prevents vanilla block pushout code from aggressively ejecting items out of blocks. -
Conditional Gravity Cancellation:
@Inject(method = "applyGravity", at = @At("HEAD"), cancellable = true)cancels downward gravity only when the item is physically intersecting a block voxel (!level.noCollision(...)), preserving natural arc trajectories in open air.
| GameRule | Type | Default | Unit / Range | Description |
|---|---|---|---|---|
ig:magnet_enabled |
Boolean | true |
true/false |
Master toggle for all vacuum logic. |
ig:magnet_range |
Integer | 12 |
1..64 blocks |
Maximum spherical vacuum radius. |
ig:magnet_speed |
Integer | 80 |
1..1000% |
Terminal velocity percentage ( |
ig:magnet_acceleration |
Integer | 10 |
1..1000% |
Pull acceleration percentage ( |
ig:magnet_noclip |
Boolean | true |
true/false |
Enables block phase shifting during pull. |
Magnet, Let me get that! โข Developed by Dasik (Rifaditya) โข Licensed under GNU GPLv3
Documentation reflects active repository source code. Features may precede public releases on CurseForge/Modrinth.
- ๐ 26.2 Overview
- Gameplay Mechanics
- Administration & Config
- Technical & Development
- ๐ 26.1.2 Overview
- Gameplay Mechanics
- Administration & Config
- Technical & Development