[PR #4754] [MERGED] Command block minecart: edit screen, SetCommandMinecart, activator rail command, NBT #5828

Closed
opened 2026-11-03 05:15:16 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4754
Author: @levzzz5154
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @levzzz5154

Base: main ← Head: parity/H-cmdcart


📝 Commits (1)

  • 973eead Command block minecart: editor, SetCommandMinecart, activator rail command, entity data, NBT

📊 Changes

12 files changed (+487 additions, -48 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+3 -3)
📝 crates/horizon-client/src/game/command_blocks.rs (+99 -28)
➕ crates/horizon-client/src/game/command_minecarts.rs (+200 -0)
📝 crates/horizon-client/src/game/commands.rs (+12 -0)
📝 crates/horizon-client/src/game/commands/execute.rs (+4 -0)
📝 crates/horizon-client/src/game/lan_actions.rs (+1 -0)
📝 crates/horizon-client/src/game/lan_entities.rs (+19 -8)
📝 crates/horizon-client/src/game/minecarts.rs (+101 -9)
📝 crates/horizon-client/src/game/remote.rs (+6 -0)
📝 crates/horizon-client/src/game/remote_objects.rs (+14 -0)
📝 crates/horizon-client/src/game/sign_edit.rs (+1 -0)
📝 crates/horizon-protocol/src/packets/play.rs (+27 -0)

📄 Description

🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally.

Part of #3518
Part of #3520

Rows:

  • MinecartCommandBlockEditScreen.populateAndSendPacket: a game master's use of a command block minecart opens the shared command edit screen (no mode buttons, previous output at y 150) and Done sends the new SetCommandMinecart packet (MinecartCommandBlock.interact, LocalPlayer.openMinecartCommandBlock).
  • ServerGamePacketListenerImpl.handleSetCommandMinecart: the server handler checks game master permission (advMode.notAllowed), sets the command, output tracking and last output, calls onUpdated only while command blocks work, and sends the advMode.setCommand.success/disabled note.

Also, to make the cart work end to end:

  • MinecartCommandBlock.activateMinecart: a powered activator rail runs the cart's BaseCommandBlock.performCommand every 4 ticks (ACTIVATION_DELAY), as the cart at game master level; output goes to its last output (new cart field on the command Source).
  • Entity data DATA_ID_COMMAND_NAME / DATA_ID_LAST_OUTPUT (13, 14) are sent to clients and read by the client's cart copy (onSyncedDataUpdated); they follow the command block only at onUpdated.
  • Cart NBT saves and loads Command, SuccessCount, TrackOutput, LastOutput, UpdateLastExecution, LastExecution.
  • DetectorRailBlock.getAnalogOutputSignal reads the cart's success count instead of 0.

Vanilla followed: MinecartCommandBlock, BaseCommandBlock, ServerboundSetCommandMinecartPacket, MinecartCommandBlockEditScreen, AbstractCommandBlockEditScreen, ServerGamePacketListenerImpl.handleSetCommandMinecart, DetectorRailBlock.getAnalogOutputSignal.

Does not touch the container-opening code of #4667 (only the CommandBlock arm of interact_cart).

Tests: packet encoding, cart NBT round trip, edit screen layout. fmt and clippy -D warnings pass for horizon-client and horizon-protocol. Parity harnesses not run locally (CI).

🤖 Generated with Claude Code


🔄 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/4754 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `parity/H-cmdcart` --- ### 📝 Commits (1) - [`973eead`](https://github.com/horizon-rust/horizon/commit/973eeadcfda63005096beaa404d3b0215d21ebc8) Command block minecart: editor, SetCommandMinecart, activator rail command, entity data, NBT ### 📊 Changes **12 files changed** (+487 additions, -48 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+3 -3) 📝 `crates/horizon-client/src/game/command_blocks.rs` (+99 -28) ➕ `crates/horizon-client/src/game/command_minecarts.rs` (+200 -0) 📝 `crates/horizon-client/src/game/commands.rs` (+12 -0) 📝 `crates/horizon-client/src/game/commands/execute.rs` (+4 -0) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+1 -0) 📝 `crates/horizon-client/src/game/lan_entities.rs` (+19 -8) 📝 `crates/horizon-client/src/game/minecarts.rs` (+101 -9) 📝 `crates/horizon-client/src/game/remote.rs` (+6 -0) 📝 `crates/horizon-client/src/game/remote_objects.rs` (+14 -0) 📝 `crates/horizon-client/src/game/sign_edit.rs` (+1 -0) 📝 `crates/horizon-protocol/src/packets/play.rs` (+27 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally. Part of #3518 Part of #3520 Rows: - `MinecartCommandBlockEditScreen.populateAndSendPacket`: a game master's use of a command block minecart opens the shared command edit screen (no mode buttons, previous output at y 150) and Done sends the new `SetCommandMinecart` packet (`MinecartCommandBlock.interact`, `LocalPlayer.openMinecartCommandBlock`). - `ServerGamePacketListenerImpl.handleSetCommandMinecart`: the server handler checks game master permission (`advMode.notAllowed`), sets the command, output tracking and last output, calls `onUpdated` only while command blocks work, and sends the `advMode.setCommand.success`/`disabled` note. Also, to make the cart work end to end: - `MinecartCommandBlock.activateMinecart`: a powered activator rail runs the cart's `BaseCommandBlock.performCommand` every 4 ticks (`ACTIVATION_DELAY`), as the cart at game master level; output goes to its last output (new `cart` field on the command `Source`). - Entity data `DATA_ID_COMMAND_NAME` / `DATA_ID_LAST_OUTPUT` (13, 14) are sent to clients and read by the client's cart copy (`onSyncedDataUpdated`); they follow the command block only at `onUpdated`. - Cart NBT saves and loads `Command`, `SuccessCount`, `TrackOutput`, `LastOutput`, `UpdateLastExecution`, `LastExecution`. - `DetectorRailBlock.getAnalogOutputSignal` reads the cart's success count instead of 0. Vanilla followed: `MinecartCommandBlock`, `BaseCommandBlock`, `ServerboundSetCommandMinecartPacket`, `MinecartCommandBlockEditScreen`, `AbstractCommandBlockEditScreen`, `ServerGamePacketListenerImpl.handleSetCommandMinecart`, `DetectorRailBlock.getAnalogOutputSignal`. Does not touch the container-opening code of #4667 (only the `CommandBlock` arm of `interact_cart`). Tests: packet encoding, cart NBT round trip, edit screen layout. fmt and clippy -D warnings pass for horizon-client and horizon-protocol. Parity harnesses not run locally (CI). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:15:16 +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#5828
No description provided.