-
Notifications
You must be signed in to change notification settings - Fork 0
26.2 Instant Pickup Mode
π 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.mixin.PlayerMixin |
| Enabling GameRule |
ig:magnet_instant (Default: false) |
| Radius GameRule |
ig:magnet_range (Default: 12, Range: 1..64) |
| Injection Point | @ModifyVariable(method = "aiStep", at = @At("STORE"), ordinal = 0) |
| Target Variable | Player Collection Bounding Box (AABB pickupArea) |
| Inventory Logic | 100% Vanilla Player.touch(ItemEntity) pipeline |
While standard vacuum mode pulls items physically through the air using velocity interpolation, Instant Pickup Mode eliminates travel time entirely. When enabled, dropped items within range are collected into the player's inventory the very microsecond they appear.
Instead of writing risky, crash-prone custom inventory insertion loops, Magnet, Let me get that! implements Instant Pickup by non-destructively expanding the player's native collection bounding box inside vanilla's aiStep() method.
+-----------------------------------------------------------------------------------+
| VANILLA PLAYER aiStep() TICK |
+-----------------------------------------------------------------------------------+
|
v
+---------------------------------------------------+
| PlayerMixin.ig_magnet$expandPickupArea() |
| pickupArea = pickupArea.inflate(range); |
+---------------------------------------------------+
|
v
+-----------------------------------------------------------------------------------+
| VANILLA ItemEntity.playerTouch(Player) EXECUTION |
| - Native Inventory Stacking & Partial Pickups |
| - Vanilla Pickup Animation & Sound Events (item.pickup / entity.experience_orb) |
| - Native Statistics & Advancements Triggers |
| - Full Container Overflow & Remaining Item Retention |
+-----------------------------------------------------------------------------------+
@ModifyVariable(
method = "aiStep",
at = @At(value = "STORE"),
ordinal = 0
)
private AABB ig_magnet$expandPickupArea(AABB pickupArea) {
Player player = (Player) (Object) this;
if (!this.ig_magnet$isMagnetEnabled() || player.isDeadOrDying() || player.isSpectator()) {
return pickupArea;
}
Level level = player.level();
if (!level.isClientSide()) {
if (ModGameRules.getBoolean(level, ModGameRules.MAGNET_ENABLED) && ModGameRules.getBoolean(level, ModGameRules.MAGNET_INSTANT)) {
int range = ModGameRules.getInt(level, ModGameRules.MAGNET_RANGE);
if (range > 0) {
return pickupArea.inflate(range);
}
}
}
return pickupArea;
}-
Safety Gating: If the player is dead/dying (
player.isDeadOrDying()), in spectator mode (player.isSpectator()), or has their personal magnet toggled off (!isMagnetEnabled()), the bounding box is never expanded. -
Server-Side Authority: Pickup logic executes strictly on the logical server (
!level.isClientSide()), eliminating item ghosting and inventory desynchronization. -
No Double-Movement Conflict: When
ig:magnet_instantis true,MagnetMovement.pull()automatically aborts velocity updates so physics and instant collection do not fight for control.
| GameRule | Type | Default | Description |
|---|---|---|---|
ig:magnet_instant |
Boolean | false |
Enables instant teleportation into inventory instead of flight. |
ig:magnet_range |
Integer | 12 |
The radius (in blocks) by which the collection AABB is inflated. |
ig:magnet_enabled |
Boolean | true |
Master toggle for the entire mod. |
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