[PR #2640] [MERGED] Let block hoppers move items into and out of minecart containers #4497

Closed
opened 2026-11-03 04:17:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2640
Author: @kacpherek
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: fix/hopper-entity-containers


📝 Commits (3)

  • dd3697b Hopper minecarts take from the container above, one item per tick
  • b281081 Keep a hopper minecart's items in sync with a leftover menu copy
  • 0c9bdde Let block hoppers move items into and out of minecart containers

📊 Changes

2 files changed (+229 additions, -92 deletions)

View changed files

📝 crates/horizon-client/src/game/machines.rs (+227 -46)
📝 crates/horizon-client/src/game/minecarts.rs (+2 -46)

📄 Description

What and why

A block hopper only knew about block containers. A hopper pointing at a chest or hopper minecart on a rail did not fill it, and a hopper under a chest minecart did not empty it. Now, when there is no block container in front of the hopper (or above it), the hopper looks for a container entity there: a chest minecart, a hopper minecart or a chest boat. It moves one item per move, the same as it does for blocks. If several carts or boats are in the cell, one is picked at random.

The vehicle's slots are edited under the placeholder key its menu already uses (the open menu's copy when it is open), then handed back to the vehicle, so an open cart menu and the saved cart stay in sync. A hopper minecart pulling from the block above also takes from a container entity there now, since it shares the same code.

This builds on #2250, which splits the hopper code into a container half and an item half. Please merge #2250 first.

Vanilla reference

  • HopperBlockEntity.getContainerAt: falls back to getEntityContainer when there is no block container, used by ejectItems (in front) and getSourceContainerOrHandler (above, for suckInItems).
  • HopperBlockEntity.getEntityContainer: alive entities whose box meets a 1x1x1 box around the point, chosen at random (EntitySelector.CONTAINER_ENTITY_SELECTOR).

Self-check

cargo check -p horizon-client passes.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/2640 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/hopper-entity-containers` --- ### 📝 Commits (3) - [`dd3697b`](https://github.com/horizon-rust/horizon/commit/dd3697bb4d0f6acd161fc18aaa7eeab3bafbfea5) Hopper minecarts take from the container above, one item per tick - [`b281081`](https://github.com/horizon-rust/horizon/commit/b28108128d23ac61783b160a922f00b320133d98) Keep a hopper minecart's items in sync with a leftover menu copy - [`0c9bdde`](https://github.com/horizon-rust/horizon/commit/0c9bddecda77f837232ff424c9924af62bc42421) Let block hoppers move items into and out of minecart containers ### 📊 Changes **2 files changed** (+229 additions, -92 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/machines.rs` (+227 -46) 📝 `crates/horizon-client/src/game/minecarts.rs` (+2 -46) </details> ### 📄 Description ## What and why A block hopper only knew about block containers. A hopper pointing at a chest or hopper minecart on a rail did not fill it, and a hopper under a chest minecart did not empty it. Now, when there is no block container in front of the hopper (or above it), the hopper looks for a container entity there: a chest minecart, a hopper minecart or a chest boat. It moves one item per move, the same as it does for blocks. If several carts or boats are in the cell, one is picked at random. The vehicle's slots are edited under the placeholder key its menu already uses (the open menu's copy when it is open), then handed back to the vehicle, so an open cart menu and the saved cart stay in sync. A hopper minecart pulling from the block above also takes from a container entity there now, since it shares the same code. This builds on #2250, which splits the hopper code into a container half and an item half. Please merge #2250 first. ## Vanilla reference - `HopperBlockEntity.getContainerAt`: falls back to `getEntityContainer` when there is no block container, used by `ejectItems` (in front) and `getSourceContainerOrHandler` (above, for `suckInItems`). - `HopperBlockEntity.getEntityContainer`: alive entities whose box meets a 1x1x1 box around the point, chosen at random (`EntitySelector.CONTAINER_ENTITY_SELECTOR`). ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:17:35 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4497
No description provided.