{{Infobox item entity
|renewable = No
|stackable = No
|size = Height: 0.7 blocks<br>Width: 0.98 blocks
|image = Minecart with Command Block.gif
|image2 = Minecart with Command Block BE.gif
|invimage1 = Minecart with Command Block
|networkid =
|drops = {{drop|Item|Minecart|1}}
|healt h= {{hp|6}}
|rarity =
* Epic {{only|java|short=1}}
* Common {{only|bedrock|short=1}}
}}

A '''minecart with command block''' is an impulse{{only|java|short=y}} or repeating{{only|bedrock|education|short=y}} [[command block]] inside a [[minecart]].

== Obtaining ==

The minecart with command block is obtainable only using the [[command]] {{cmd|give @s command_block_minecart}}, as it does not appear in the creative inventory{{only|BE}} and has no [[crafting]] recipe. It can also be summoned using the command {{cmd|summon command_block_minecart}}. It can be broken like any other minecart, but only the minecart is retained, while the command block is lost.

Unlike most [[minecart]] types, command block minecarts can't be crafted with a [[minecart]] and a [[command block]].

== Usage ==
{{main|Command Block}}
The minecart with command block combines the functionalities of both minecarts and command blocks. Although the minecart visually contains an impulse command block, it functions more similarly to a repeating command block,  executing the command once every four game [[tick]]s (unlike a repeating command block that repeats every 1 game tick) when on an active [[activator rail]]. When it passes over a [[detector rail]] with a [[comparator]] connected next to it, it outputs the command block's success count value.

The command is executed at the [[coordinates]] of the minecart, which can of course move, allowing for command execution relative to an entity without the {{cmd|execute}} command.

== Sounds ==
{{Edition|Java}}:<br>
Minecarts with command blocks use the Friendly Creatures sound category for [[Sound#Entity-dependent categories|entity-dependent sound events]].<ref group="sound" name="rollsource">{{bug|MC-42132}}</ref>

{{SoundTable
| type = java
| {{SoundLine
| sound =Minecart rolling.ogg
|subtitle=Minecart rolls
|source=Friendly Creatures <ref group=sound name=rollsource/>
|overridesource=1
|description=While a minecart with command block is moving
|id=entity.minecart.riding
|translationkey=subtitles.entity.minecart.riding
|volume=0.0-0.35 <ref group=sound>Relates linearly with horizontal velocity (max 0.5)</ref>
|pitch=0.0-1.0 <ref group=sound>Will increase by 0.0025 per tick if the minecart's horizontal velocity is more than 0.01</ref>
| distance = 16
}}
}}

{{Edition|Bedrock}}:
{{SoundTable
| type = bedrock
| {{SoundLine
| sound =Minecart rolling.ogg
|source=neutral
| description = While a minecart with command block is moving
| id = minecart.base
}}
}}

== Data values ==
=== ID ===
{{edition|java}}:
{{ID table
|edition=java
|firstcolumnname=Item
|showforms=y
|generatetranslationkeys=y
|displayname=Minecart with Command Block
|spritetype=item
|nameid=command_block_minecart
|form=item
|foot=1}}
{{ID table
|edition=java
|firstcolumnname=Entity
|generatetranslationkeys=y
|displayname=Minecart with Command Block
|spritetype=entity
|nameid=command_block_minecart
|foot=1}}

{{edition|bedrock}}:
{{ID table
|edition=bedrock
|firstcolumnname=Item
|shownumericids=y
|showforms=y
|notshowbeitemforms=y
|generatetranslationkeys=y
|displayname=Minecart with Command Block
|spritetype=item
|nameid=command_block_minecart
|id=563
|form=item
|foot=1}}
{{ID table
|edition=bedrock
|firstcolumnname=Entity
|shownumericids=y
|generatetranslationkeys=y
|displayname=Minecart with Command Block
|spritename=minecart-with-repeating-command-block
|spritetype=entity
|nameid=command_block_minecart
|id=100
|foot=1}}

=== Entity data ===
Minecarts with command blocks have entity data associated with them that contain various properties of the entity. 

{{el|java}}:
{{main|Entity format}}
{{/ED}}

{{el|bedrock}}:
: See [[Bedrock Edition level format/Entity format]].

== History ==
{{HistoryTable
|{{HistoryLine|java}}
|{{HistoryLine||1.7.2|dev=13w39a|[[File:Minecart with Command Block JE1.png|32px]] [[File:Minecart with Command Block (item) JE1 BE2.png|32px]] Added minecart with command block.}}
|{{HistoryLine||1.9|dev=15w34a|[[File:Minecart with Command Block JE2.png|32px]] The texture of the [[command block]] in the [[minecart]] has been removed due to the new texture and types for the command block.}}
|{{HistoryLine|||dev=15w35a|[[File:Minecart with Command Block JE3.png|32px]] The texture of the command block has been changed.}}
|{{HistoryLine||1.11|dev=16w32a|The [[entity]] ID has been changed from <code>MinecartCommandBlock</code> to <code>commandblock_minecart</code>.}}
|{{HistoryLine||1.13|dev=17w47a|Prior to [[1.13/Flattening|''The Flattening'']], this [[item]]'s numeral ID was 422.}}
|{{HistoryLine|||dev=pre5|The entity ID has been changed to <code>command_block_minecart</code>.}}
|{{HistoryLine||1.14|dev=18w43a|[[File:Minecart with Command Block JE4.png|32px]] [[File:Minecart with Command Block (item) JE2 BE3.png|32px]] The textures of the minecart with command block has been changed.}}
|{{HistoryLine||1.17|dev=21w20a|Minecart with command block [[Rarity|rarity color]] was changed from common to epic.}}
|{{HistoryLine||1.19.3|dev=22w44a|Minecart with command block is now available in the creative inventory, but only if cheats are enabled.}}
|{{HistoryLine|||dev=22w45a|Moved the minecart with command block behind the Operator Utilities tab in the creative inventory. The tab is only available if cheats are enabled and the "Operator Items Tab" option in the controls menu is turned on.}}

|{{HistoryLine|pocket}}
|{{HistoryLine||1.0.5|dev=alpha 1.0.5.0|[[File:Minecart with Command Block BE1.png|32px]] [[File:Minecart with Command Block (item) BE1.png|32px]] Added minecart with command block. The [[minecart]] has a [[repeating command block]] in it, instead of an impulse command block.}}
|{{HistoryLine||1.1.0|dev=alpha 1.1.0.0|The entity ID has been changed from <code>minecartcommandblock</code> to <code>command_block_minecart</code>.}}
|{{HistoryLine|bedrock}}
|{{HistoryLine||1.10.0|dev=beta 1.10.0.3|[[File:Minecart with Command Block BE2.png|32px]] [[File:Minecart with Command Block (item) JE2 BE3.png|32px]] The texture of the minecart with command block has been changed. Also the item texture has been changed to match {{el|je}}'s.<ref>{{bug|MCPE-42990}}</ref>}}
|{{HistoryLine|console}}
|{{HistoryLine||xbox=?|xbone=?|ps3=?|psvita=?|ps4=?|wiiu=?|switch=?|Added minecart with command blocks. This only exists as an item, as placing it will result in a normal minecart being placed. The command block in the minecart cannot be modified via NBT editing and it has an unused tooltip stating "Used to execute commands on the move!".}}
}}

== Issues ==

{{issue list}}

== Gallery ==
=== Screenshots ===
<gallery>
File:Minecart with command block 13w39b.png|A minecart with command block in [[1.16.4]].
File:Red bucket with air.png|A minecart command block testing the block in the red area with [[air]].
</gallery>

== References ==
{{Reflist}}

== Navigation ==
{{Navbox items|Creative}}
{{Navbox entities|Other}}

[[Category:Vehicles]]

[[de:Befehlsblocklore]]
[[fr:Wagonnet à bloc de commande]]
[[it:Carrello da miniera]]
[[ja:コマンドブロック付きのトロッコ]]
[[nl:Mijnkar met opdrachtblok]]
[[pl:Wagonik z blokiem poleceń]]
[[pt:Carrinho de mina com bloco de comando]]
[[ru:Вагонетка с командным блоком]]
[[uk:Вагонетка з командним блоком]]
[[zh:命令方块矿车]]
