[PR #2250] [MERGED] Hopper minecarts take from the container above, one item per tick #4143

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

📋 Pull Request Information

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

Base: main ← Head: fix/hopper-minecart-pickup


📝 Commits (2)

  • 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

📊 Changes

2 files changed (+114 additions, -86 deletions)

View changed files

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

📄 Description

What and why

A hopper minecart never pulled items out of a chest or other container above it, and it swallowed every dropped item over it in a single tick. Now each tick it does what vanilla does: if there is a container in the block above, it takes one item from it (through the container's bottom face, so furnaces and brewing stands only give what a hopper may take) and then looks at item entities only if that took nothing. With no container there, it adds item entities until one is taken whole, using the vanilla suck box over the cart, then the cart's own box widened by 0.25. A disabled cart (powered activator rail) still does nothing.

This reuses the block hopper's container code in machines.rs: that function is split into a container half and an item-entity half, and the cart calls the same two halves. The block hopper's behaviour is unchanged. The cart's slots are edited under the placeholder key its menu already uses (the open menu's copy when it is open).

Vanilla reference

  • MinecartHopper.tick / tryConsumeItems / suckInItems: container first, then item entities in the cart box inflated by (0.25, 0, 0.25); getLevelY is getY() + 0.5 and isGridAligned is false.
  • HopperBlockEntity.suckInItems: the container at getLevelY() + 1, one item per tick via tryTakeInItemFromSlot on the DOWN face, else getItemsAtAndAbove with Hopper.SUCK_AABB.
  • HopperBlockEntity.addItem(Container, ItemEntity): an entity counts only when its whole stack fits.

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/2250 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/hopper-minecart-pickup` --- ### 📝 Commits (2) - [`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 ### 📊 Changes **2 files changed** (+114 additions, -86 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/machines.rs` (+112 -40) 📝 `crates/horizon-client/src/game/minecarts.rs` (+2 -46) </details> ### 📄 Description ## What and why A hopper minecart never pulled items out of a chest or other container above it, and it swallowed every dropped item over it in a single tick. Now each tick it does what vanilla does: if there is a container in the block above, it takes one item from it (through the container's bottom face, so furnaces and brewing stands only give what a hopper may take) and then looks at item entities only if that took nothing. With no container there, it adds item entities until one is taken whole, using the vanilla suck box over the cart, then the cart's own box widened by 0.25. A disabled cart (powered activator rail) still does nothing. This reuses the block hopper's container code in `machines.rs`: that function is split into a container half and an item-entity half, and the cart calls the same two halves. The block hopper's behaviour is unchanged. The cart's slots are edited under the placeholder key its menu already uses (the open menu's copy when it is open). ## Vanilla reference - `MinecartHopper.tick` / `tryConsumeItems` / `suckInItems`: container first, then item entities in the cart box inflated by (0.25, 0, 0.25); `getLevelY` is `getY() + 0.5` and `isGridAligned` is false. - `HopperBlockEntity.suckInItems`: the container at `getLevelY() + 1`, one item per tick via `tryTakeInItemFromSlot` on the `DOWN` face, else `getItemsAtAndAbove` with `Hopper.SUCK_AABB`. - `HopperBlockEntity.addItem(Container, ItemEntity)`: an entity counts only when its whole stack fits. ## 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:14:59 +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#4143
No description provided.