Electromagnet

Electromagnet

alaindustrial:electromagnet
ItemsLVImplementeditemenergymagnetpickupconvenience

Summary

The Electromagnet is an EU/FE-rechargeable convenience item: it sits in any inventory slot (hotbar / main / off-hand) and automatically draws loose dropped items (ItemEntity) toward the player — ore drops in a mine, scattered pieces after an explosion, unclaimed drops. This is tier 1: a spherical radius of 5 blocks (up, down and sideways); each item actually pulled costs 2 EU/FE (magnetEuPerItem). An idle scan, with nothing in range, is free. Pickup stays vanilla: every tick the magnet sets each item's velocity straight at the player (a seek, so items fly in from any direction — a drop below rises to you), and the player collects the item once it arrives. When flat the magnet simply goes quiet (like a drained Electric Drill mining at hand speed) until recharged. It charges wherever the mod's whole powered family does — the Battery Box charge slot and a worn Energy Pack. Toggle (shift-right-click): the magnet can be switched off so you can carry it in your inventory next to farms, sorters and pipes without hoovering their items. A freshly crafted magnet is on.

Energy

Its own EU/FE buffer, off the grid. Charged in the Battery Box slot and by a worn pack; spends charge per pulled item.

FieldValue
Roleconvenience item with an EU/FE buffer: a consumer at a charger
Buffer5,000 EU/FE (magnetBuffer)
ChargingBattery Box slot / worn pack, ≤ 32 EU/FE/tick (magnetInputRate, capped by the LV ceiling)
Draw2 EU/FE per item pulled each scan tick (magnetEuPerItem); an idle scan is free
Passive drainnone (only for actual pulling)
Component(Long, persistent + networkSynchronized) — the shared component of every powered item in the mod

The draw is taken server-side only (in 26.2 inventoryTick is called only on a ServerLevel). A creative/spectating owner pays nothing (the shared ItemEnergy.spend rule, — the magnet still pulls.

Inventory

Not applicable — the magnet has no internal item storage (stacks to 1). It holds only EU/FE charge and the on/off flag (, absent = on).

Block properties

Not applicable (item).

Recipes

Crafted on a workbench in the shape of a horseshoe magnet: an iron horseshoe body, a copper coil core at the centre (the electromagnet's winding), and an electronic circuit below (control). The top corners are the poles: redstone (power) on the left, lapis lazuli (magnetic "charge") on the right.

R L
ICI
IEI

Recipe: — shaped 3×3, category: equipment: top row: redstone (minecraft:redstone), empty, lapis lazuli (minecraft:lapis_lazuli); middle row: iron (minecraft:iron_ingot) — copper coil — iron; bottom row: iron — electronic circuit — iron. Repair — not applicable: the magnet has no durability; "repair" is charging EU/FE (see Energy).

Behaviour

Pulling (seek): every tick (magnetScanIntervalTicks = 1) the magnet gathers ItemEntity in a spherical radius and sets each item's velocity straight at the player's body centre at blocks/tick. Setting (not adding) the velocity overrides gravity and friction, so a drop below the player rises to it and one above sinks — the pickup itself is vanilla playerTouch once the item arrives. Tariff: each item pulled costs 2 EU/FE per tick while it flies in. If the buffer can't afford it the magnet stalls; at 0 EU/FE it doesn't pull at all. At most 64 items are handled per pass (a guard against mass-drop lag). What it will NOT pull: items on their pickup delay (hasPickUpDelay) — both a fresh player Q-drop (so it doesn't instantly suck back what was just thrown) and "never pick up" items (setNeverPickUp, delay 32767); items sitting in lava (so they aren't dragged through the fire); items out of range. Item frames / displays are untouched (the filter is strictly the ItemEntity class). Seek speed is capped at SEEK_SPEED (0.55 blocks/tick): fast enough for items to visibly fly in, but under the vanilla pickup window so they don't tunnel through the player. Works from any slot: the magnet ticks in the hotbar, main inventory and off-hand (in 26.2 the off-hand ticks through the equipment path) — carry it anywhere, not only in hand. Toggle (shift-right-click): a shift-right-click flips on/off. State lives in the magnet_enabled component (absent = on; disabling writes false, re-enabling removes the component, so an on magnet is byte-identical to a fresh one). Toggling plays a metallic click (copper_bulb on/off — an electrical sound, not a cloth one) and posts an action-bar line. A disabled magnet pulls nothing and spends no EU/FE. Readout: the bar under the icon shows charge (yellow, LV colour). The tooltip shows short lines: a flavour line, status (green "Active" / grey "Disabled"), the charge X / Y EU/FE, and a radius/tariff line. Drop/death/relog: charge and the on/off flag are stored on the item and survive. In creative: no charge is spent (the shared powered-family rule,, but pulling works.

Progression

An LV-tier convenience item: it solves the classic tech-mod pain "walking a mine — loot comes to me". Available after the Battery Box and copper coil / circuit: without LV infrastructure the magnet can be neither crafted nor charged. Filters (tag whitelist/blacklist), suppressor zones and radius tier scaling (LV/MV/HV) are future work.

Compatibility

Viewers: JEI, REI, EMI (as an ordinary item). The magnet charges from third-party energy mods (like the Electric Drill, it exposes its loader's item energy capability (Team Reborn Energy on Fabric, FE capability on NeoForge), so a foreign charger tops it up alongside the Battery Box. The capability accepts only. Known limitations (deferred to post-MVP): PreventRemoteMovement — the magnet does not yet honour this convention (the NBT "do not pull" flag on items in other mods' pipes/conveyors): on Fabric vanilla has no per-entity persistent store, so a loader abstraction is needed. target-UUID reservation — the magnet does not check an item's target field (a drop reserved to a specific player). This is a technical constraint: in vanilla 26.2 ItemEntity has a private target field and setTarget(...), but no public getTarget (that is a NeoForge addition), so it cannot be read cross-loader from common/ without a loader-specific accessor / access widener. The practical harm is small: vanilla playerTouch still prevents another player from collecting a reserved item — the magnet can only drag it. Partly covered by respecting the pickup delay. A full guard is future polish (paired with PreventRemoteMovement). Drain on an unreachable item — the tariff is charged per item nudged each scan tick, so an item the magnet pulls but that can't arrive/be collected (behind a 1-block wall, or when the player's inventory is full) costs ~0.4 EU/FE/tick until it despawns (5 min). This is accepted MVP behaviour (as in most magnet mods): a cheap drain, self-limited by despawn. A line-of-sight check is deliberately NOT added — it would break the desired "loot in a hole/behind a wall comes to me" case.

Balance

ParameterValueConfig key
EU/FE buffer5,000magnetBuffer
Draw per item2 EU/FE/tickmagnetEuPerItem
EU/FE intake32 EU/FE/tickmagnetInputRate
Radius (tier 1)5 blocksmagnetRange
Scan interval1 tickmagnetScanIntervalTicks
Seek speed0.55 blocks/tick— (SEEK_SPEED constant)
Per-pass cap64 items— (MAX_ITEMS_PER_SCAN constant)

5,000 EU/FE at 2 EU/FE/item·tick is hundreds of picked-up items per charge: a cheap, LV consumable.

Related

Electric Drill — the EU/FE-consumable precedent; a typical mine companion. Energy Pack — charges the magnet in the inventory on the move. Battery Box — charging the magnet (charge slot). Copper Coil, Electronic Circuit — crafting components.

Crafting

Shaped Crafting
Redstone
Lapis Lazuli
Iron Ingot
Copper Coil
Iron Ingot
Iron Ingot
Electronic Circuit
Iron Ingot
Crafting Table
Electromagnet
Electromagnet