Skip to content

Consider removing the Drop replace-hook entirely — it intercepts delete/discard paths the mod never intended to change #11

Description

@TechLuddite

Summary

The mod replace-hooks Interface.Drop, which vanilla routes through every inventory-drop path: Fast Drop, context-menu Drop, releasing a drag off a grid, closing the inventory while dragging, and overflow paths. That includes the right-click / hotkey delete (discard) action, which is now broken — items that should be destroyed instead get returned to inventory or silently lost.

The mod’s actual intent was narrower: only intercept the two intentional “place in world” actions — looking at something and pressing G, or right-clicking an item in an inventory/container slot and choosing Place. Everything else, including delete, should stay vanilla.

Important clarification: Place (G) and Drop are separate code paths, not the same starter function. Place lives in the Placer system and is already handled by the placer-collided hook. Removing or narrowing the Drop hook will not remove the ability to press G or Place an item. So the trade-off is not “keep Drop hook or lose Place.”

Why this matters

  • Delete is a destructive action. Intercepting it turns “remove this item” into “put it back” or, on the failure path from Item-loss path in _on_drop: failed Spawn silently drops the item #1, into silent item loss. That is worse than the original bug.
  • The README already lists the affected paths, but the delete behavior is an unintended side effect, not a documented feature.
  • For a public learning repo this is the kind of over-broad hook that teaches the wrong lesson: hook the smallest surface that matches your intent, not the shared function everything funnels through.

Suggested approaches

  1. Remove the Drop hook entirely (preferred). Keep only the Placer.Collided hook for the “don’t drop on collision” behavior, and rely on vanilla for all inventory-initiated drops — including delete, which then works again. Place (G) continues to work via the Collided path.
  2. If a narrower hook exists for a specific inventory Drop caller, target that instead of the shared Drop method.
  3. At minimum, detect the delete/discard caller and pass it through to vanilla instead of reimplementing put-back.

Related

— GrokLuddite on behalf of TechLuddite

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions