mojira.dev
MC-296938

Hoppers should check for a non-empty entity inventory before failing to pull

Tested Versions: 1.21.5

Reproduction Steps:

  1. Place a horizontal hopper chain with a comparator on the first hopper and rail on top.

  2. Place rails leading to the first hopper.

  3. Spawn minecarts with hoppers with items inside and push them onto the hopper.

  4. When the first minecart runs out of items, you will see that the comparator will sometimes flicker.

This indicates that there is a break in the loop and that sometimes the hopper will not suck in items.

Expected Result:

The hopper will pull in items continuously regardless of the number of hopper minecarts on the rail on top.

Actual Result:

The hopper will not pull items sometimes.

Edit

The code below shows how Minecraft deals with entity inventories:

private static Inventory getEntityInventoryAt(World world, double x, double y, double z) {
    List<Entity> list = world.getOtherEntities((Entity)null, new Box(x - 0.5, y - 0.5, z - 0.5, x + 0.5, y + 0.5, z + 0.5), EntityPredicates.VALID_INVENTORIES);
    return !list.isEmpty() ? (Inventory)list.get(world.random.nextInt(list.size())) : null;
}

As seen, it gets a random item from that list, and when that happens to be an empty minecart, it pulls nothing.

I think this should be mostly intended behaviour, however, if the inventory is empty while there are other inventories that are not then I think it should find a random inventory that does.

Linked issues

Attachments

Comments 1

I’ve read it before and theres nothing about multiple containers above it.

It might be because it checks a random container, i.e. one of the hopper minecarts and if its empty it fails, but it should check all of it before setting cooldown/failing.

amww

(Unassigned)

Unconfirmed

(Unassigned)

1.21.5

Retrieved