-
Notifications
You must be signed in to change notification settings - Fork 0
26.2 Architecture and Mixins
π 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.
| Architecture Infobox | Technical Parameters |
|---|---|
| Root Package | net.instantgratification.magnet |
| Mixin Configuration | src/main/resources/magnet.mixins.json |
| Access Widener | src/main/resources/magnet.accesswidener |
| Compatibility Level | JAVA_25 |
| Total Mixin Classes |
2 (MixinEntity, PlayerMixin) |
net.instantgratification.magnet/
βββ IMagnetEntity.java # Entity interface for NoClip & magnetization flags
βββ IMagnetPlayer.java # Player interface for toggle state & getters/setters
βββ MagnetCommand.java # Brigadier command trees (/magnet toggle, /magnet debug)
βββ MagnetDebugLogger.java # Thread-safe persistent file logging to disk
βββ MagnetManager.java # Entity scanning & spatial execution loop
βββ MagnetMod.java # Server/Universal mod entrypoint & network receivers
βββ MagnetModClient.java # Client mod initializer, keybind & overlay toast
βββ MagnetMovement.java # Trajectory vector math, lerp velocity & particles
βββ MagnetTogglePayload.java # Network packet record & StreamCodec composite
βββ SecondaryVisionCheck.java # Granular block raycasting (Flora, Block Entities, Glass)
βββ config/
β βββ MagnetConfig.java # JSON configuration storage & POJO fields
β βββ ModMenuIntegration.java # Reflection-safe ModMenu API entrypoint
β βββ YaclScreenHelper.java # YetAnotherConfigLib v3 GUI builder
βββ mixin/
β βββ MixinEntity.java # Injects NoClip and gravity cancellation into Entity
β βββ PlayerMixin.java # Injects NBT persistence & instant pickup into Player
βββ registry/
β βββ ModGameRules.java # DynamicGameRuleManager registrations
βββ util/
βββ ModVersionGuard.java # Runtime Knot ClassLoader sanity check
Targets net.minecraft.world.entity.Entity and implements IMagnetEntity.
| Injected Method | Injection Target Point | Action & Behavior |
|---|---|---|
ig_magnet$decrementNoClipTicks |
@Inject(method = "tick", at = @At("HEAD")) |
Decrements noClipTicks countdown by 1 per tick when active. |
ig_magnet$preventPushOut |
@Inject(method = "moveTowardsClosestSpace", at = @At("HEAD"), cancellable = true) |
Cancels vanilla push-out velocity if noClipTicks > 0 on server. |
ig_magnet$forceNoClipOnMove |
@Inject(method = "move", at = @At("HEAD")) |
Caches originalNoPhysics and forces entity.noPhysics = true if noClipTicks > 0. |
ig_magnet$restoreNoPhysicsAfterMove |
@Inject(method = "move", at = @At("RETURN")) |
Restores entity.noPhysics = originalNoPhysics after move completes. |
ig_magnet$conditionalCancelGravity |
@Inject(method = "applyGravity", at = @At("HEAD"), cancellable = true) |
Cancels gravity downward acceleration only when item is inside a solid block. |
Targets net.minecraft.world.entity.player.Player and implements IMagnetPlayer.
| Injected Method | Injection Target Point | Action & Behavior |
|---|---|---|
ig_magnet$addAdditionalSaveData |
@Inject(method = "addAdditionalSaveData", at = @At("TAIL")) |
Serializes boolean ig_magnet_enabled to player NBT via ValueOutput. |
ig_magnet$readAdditionalSaveData |
@Inject(method = "readAdditionalSaveData", at = @At("TAIL")) |
Deserializes ig_magnet_enabled from player NBT via ValueInput.getBooleanOr(). |
ig_magnet$tick |
@Inject(method = "tick", at = @At("HEAD")) |
Invokes MagnetManager.tick(player) on the server each game tick. |
ig_magnet$expandPickupArea |
@ModifyVariable(method = "aiStep", at = @At("STORE"), ordinal = 0) |
Expands pickup bounding box (pickupArea.inflate(range)) when ig:magnet_instant is true. |
To protect server and world saves from loading on broken, unreleased, or incompatible Minecraft game versions:
public final class ModVersionGuard {
public static void checkClass(String modName, String requiredClassName) {
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
// Verifies target class existence before mod initialization continues...
}
}Called in MagnetMod.onInitialize():
ModVersionGuard.checkClass("Magnet", "net.minecraft.world.entity.item.ItemEntity");
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