Skip to content

26.2 API and Addon Integration

Rifa edited this page Aug 22, 2026 · 1 revision

πŸ”Œ API & Addon Integration (MC 26.2)

πŸ“Œ 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.

API Infobox Technical Parameters
Player Interface net.instantgratification.magnet.IMagnetPlayer
Entity Interface net.instantgratification.magnet.IMagnetEntity
Core Movement Facade net.instantgratification.magnet.MagnetMovement
GameRule API net.dasik.social.api.gamerule.DynamicGameRuleManager
Vision API net.dasik.social.api.vision.PlayerVisionTracker

πŸ“– Inter-Mod Developer Integration

Third-party mods, server utilities, and Instant Gratification addons can interface directly with Magnet, Let me get that! to query player magnet states, trigger programmatic pulls, or bypass obstacles.


πŸ§‘β€πŸ’» Player State Interface (IMagnetPlayer)

Cast any Player or ServerPlayer instance to IMagnetPlayer to query or modify magnet preferences:

package net.instantgratification.magnet;

public interface IMagnetPlayer {
    boolean ig_magnet$isMagnetEnabled();
    void ig_magnet$setMagnetEnabled(boolean enabled);
    boolean ig_magnet$toggleMagnet();
}

Example Usage:

// Check if player has magnet active
if (((IMagnetPlayer) player).ig_magnet$isMagnetEnabled()) {
    // Custom addon logic...
}

// Programmatically disable magnet (e.g. while sitting on a throne or in a minigame)
((IMagnetPlayer) player).ig_magnet$setMagnetEnabled(false);

πŸ“¦ Entity Magnetization Interface (IMagnetEntity)

Cast any Entity instance (such as custom mob drops, projectiles, or XP orbs) to IMagnetEntity:

package net.instantgratification.magnet;

public interface IMagnetEntity {
    void ig_magnet$setMagnetNoClip();
    boolean ig_magnet$isMagnetNoClip();
    void ig_magnet$setMagnetized();
    boolean ig_magnet$isMagnetized();
}

Example Usage:

// Grant custom entity temporary 2-tick phase shifting
((IMagnetEntity) customItem).ig_magnet$setMagnetNoClip();

πŸš€ Static Movement Facade (MagnetMovement.pull)

Addon mods can manually pull entities toward any player using the built-in physics and line-of-sight engine:

public static void pull(Entity entity, Player player, boolean shouldSpawnParticles);
// Pull target entity to player with particle trails
MagnetMovement.pull(specialDrop, player, true);

πŸ”— Related Wiki Documentation

Clone this wiki locally