Skip to content

Colossal Chests 2, Phase 7: Magnet wall - #226

Open
rubensworks wants to merge 1 commit into
feature/1.21-lts-v2from
feature/1.21-lts-v2-phase7d-magnet
Open

rubensworks wants to merge 1 commit into
feature/1.21-lts-v2from
feature/1.21-lts-v2-phase7d-magnet

Conversation

@rubensworks

Copy link
Copy Markdown
Member

The Magnet wall, as its own PR (one feature per PR). It is independent of the Redstone wall PR (#225); whichever merges second needs a small merge of WallType, the lang file and the pickaxe tag, which I'll do.

Summary

  • A functional wall that pulls dropped items around it into its chest, ticking on the server.
  • Range: items within the radius of the wall, 8 blocks by default.
  • Pulling: items move towards the wall, floating up to walls above them. They are inserted as soon as they touch the chest, on any face: an item pulled from the side lands against the chest's side, not on the wall.
  • Inserting: the same automated insert as a hopper into the core, so a voiding slot destroys overflow like it would for a hopper.
  • Left alone:
    • items with a pickup delay, such as ones a player just threw, so players can still drop items next to the chest; once the delay is over, they are pulled in;
    • items the chest can't take, so they don't pile up against the wall.
  • Config (server, category magnet): magnetEnabled (default true) and magnetRadius (default 8, 1 to 32).
  • No GUI, no item access for automation, mines with a pickaxe, shows its icon while sneaking like other functional walls.
  • Placeholder textures (the Interface frame with a red and blue magnet) until Phase 9.

Design deviations

None. The design says "pulls items in a radius from that block. On by default; radius and toggle in config." The pickup delay and "only what fits" rules are my additions; tell me if you'd rather pull everything.

Validation

Acceptance criterion Covered by
Items above the chest and to its side are pulled in; an item that can never be picked up stays; no item access Game test testMagnetWallPullsItems
Items that don't fit are not pulled: they fall straight down and stay Game test testMagnetWallLeavesWhatDoesNotFit

The side case was found by the first test: items pressed against another face of the chest got stuck until inserts happened on contact with the whole chest.

Totals: 290 unit tests; game tests Fabric 75, Forge 73, NeoForge 73, all passing.

In-game (clientdevbridge): script and screenshots in clientdevbridge-screenshots/phase7d-magnet. On NeoForge, an iron 3x3 with a Magnet wall on top:

  • 64 cobblestone thrown with the drop key landed in front of the chest, then was pulled in after its pickup delay;
  • an oak log broken 3 blocks away dropped into the chest;
  • no item entities were left;
  • the wall's icon while sneaking.

Not checked in-game on Fabric or Forge.

Known issues

  • Cost: each Magnet wall looks for items in its radius every tick. That's cheap for a few walls, but many Magnet walls with a large radius add up.
  • Coveralls: may drop slightly.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RSz5r6eowhjNuANBjZE2v6


Generated by Claude Code

A functional wall that pulls dropped items around it into its chest.
Items are pulled towards the wall and inserted when they touch the
chest, through the same automated insert as a hopper. Items with a
pickup delay, such as ones a player just threw, and items the chest
can not take are left alone. On by default, with the radius (default
8) and a toggle in the server config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RSz5r6eowhjNuANBjZE2v6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants