PaperMC / PaperMC/Paper

InventoryMoveItemEvent - the system does not verify the other spaces available

Open
#8,806 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

As long as the item that's in the first space doesn't disappear, the system does not verify the other spaces available, bugging all the items in the Item Hopper.
The system which verifies the movement of the item (InventoryMoveItemEvent) can't run and show the other items in the Item Hopper or any inventory.

@EventHandler
public void moveItem(InventoryMoveItemEvent event) {
    itemStack = event.getItem();
    destination = event.getDestination();

    if (destination.getType() == InventoryType.HOPPER) {
        hopper = (Hopper) destination.getLocation().getBlock().getState();
        if(hopper.getCustomName() == null) return;

        String nameHopper = hopper.getCustomName();
        String nameItem = itemStack.getType().getKey().getKey().replaceAll("_"," ").toLowerCase();

        event.setCancelled(true);
        if(nameHopper.equalsIgnoreCase(nameItem)){
            event.setCancelled(false);
        }
    }
}

My github
https://github.com/elderbr/SmartHopper

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing InventoryMoveItemEvent handling for hopper transfers and reproduce the Item Hopper behavior described in the report. Compare movement across the other available spaces or inventories, and consider the issue complete when the event can process subsequent items instead of remaining blocked by the first space.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.