Skip to content

Dispenser Minecart

Aqu1tain edited this page Apr 24, 2026 · 1 revision

Dispenser Minecart

A new minecart entity that holds a 9-slot inventory and fires items when triggered by a powered activator rail.

Crafting

Shapeless recipe: 1 Minecart + 1 Dispenser = 1 Dispenser Minecart.

Placement

Right-click a rail with the Dispenser Minecart item. The cart is placed facing the default direction for that rail. When placed by a player, standard face-away orientation applies (like the Furnace Minecart).

Inventory

The cart has 9 slots, same layout as a vanilla dispenser. Right-click the cart to open a Dispenser UI.

Facing

The cart has a Flipped boolean that inverts the fire direction.

  • Default: fires in the cart's yaw-forward direction.
  • Flipped: fires in the opposite direction.

To toggle: shift-right-click the cart.

Useful for bi-directional rail setups where you want the same cart orientation but firing to a different side.

Firing

The cart does not fire on its own. Firing is triggered by the vanilla activateMinecart hook, which fires when the cart rolls over a powered activator rail.

On activation (and only when the rail is powered):

  1. If the cart's internal fire cooldown is 0: pick one random non-empty slot (reservoir sampling, unbiased), remove 1 item, spawn it as a dropped ItemEntity at the cart's position offset in the (possibly flipped) yaw direction, and set the cooldown to 8 ticks.
  2. If the cooldown is above 0: the rail trigger is ignored this tick. Cooldown decrements each tick.

The item is thrown as a loose ItemEntity, not processed through vanilla dispenser behaviours. So:

  • Buckets will not auto-place liquids.
  • TNT will not auto-prime.
  • Mob spawn eggs will not spawn a mob.

This is a deliberate simplification from a full block dispenser. If a more complete implementation is needed later, it can be added without changing the existing firing contract (position, cooldown, slot selection).

Save Data

The cart persists:

  • Inventory contents (via the vanilla container entity save path).
  • Flipped boolean.
  • Current fire cooldown.

All three restore on world reload.

Trains

Dispenser minecarts can be attached as trailers in a Trains.

Render

Uses the vanilla minecart renderer with a Dispenser block displayed inside the cart (via getDefaultDisplayBlockState). The display block is static and does not rotate to show the "firing" side.

Clone this wiki locally