mojira.dev
MC-32701

Command block minecarts lose their name after re-log

The bug

Minecarts with command block don't output their default or customized name after re-log.

Reproduction steps

  1. Rename a command block minecart item

    /give @s command_block_minecart{display:{Name:"\"test\""}}
  2. Place it on a powered activator rail

  3. Enter a command, e.g.

    /say message

    ✔ It prints "[test] message" in chat

  4. Reopen the world
    ❌ It prints "[@] message" in chat

Code analysis

Code analysis by @unknown can be found in this comment.

Related issues

Attachments

Comments

migrated
[media][media][media]
migrated

Confirmed.

migrated

Still a concern in 1.7.4/5 and 1.8

kumasasa

Maybe the renaming is associated with the minecart but not with the command block...

marcono1234

Confirmed for 14w21b
Maybe relates somehow to: MC-56132

marcono1234

Confirmed for

  • 1.9-pre2

MC-54777 is a duplicate of this report.

marcono1234

Please link to this comment in the description

The following is based on decompiled version of Minecraft 1.8 using MCP. All method and class names are the names used in the decompiled version.

The reason why this happens is that objects of the net.minecraft.entity.EntityMinecartCommandBlock.EntityMinecartCommandBlock class have a net.minecraft.command.server.CommandBlockLogic object to be able to run commands. All entities have the CustomName tag however this class has a CustomName tag as well that is used for the name of the command block that is displayed when a command is executed. When a command_block_minecart item is placed on a rail, only its CustomName that all entities use is set, however not its CustomName used for commands. Once the entity is saved, the CustomName used for commands overrides the CustomName that all entities use. As the first one (that is used for commands) was never set to the custom name, it saves the default name "@".

wobst.michael

This has been fixed partly. It now outputs its name, but defaults back to @ after re-login.

migrated

seems fixed

marcono1234

No, this issue still occurs in 20w21a

migrated

Affects 1.16.1

pulpetti

Affects 1.16.1 and 20w29a

pulpetti

In 1.16.2 Pre-3

Avoma

Can confirm in 20w51a.

Avoma

Can confirm in 21w03a.

Avoma

Can confirm in 21w05b.

Avoma

Can confirm in 21w06a.

Avoma

Can confirm in 21w07a. Video attached.

migrated

Affects 21w18a

migrated

Affects 1.17

Avoma

Can confirm in 1.17.1.

migrated

Affects 21w40a

Avoma

Can confirm in 1.18.1.

Avoma

Can confirm in 1.18.2 and 22w18a.

Avoma

Can confirm in 1.19 and 22w24a.

migrated

Cannot reproduce in 1.21.2 Pre-Release 3
Tested with experimental minecart improvements datapack enabled.

migrated

(Unassigned)

Confirmed

Platform

Low

Entities, Minecart

command_block_minecart

Minecraft 13w39a, Minecraft 13w39b, Minecraft 1.7.4, Minecraft 14w05b, Minecraft 14w06b, ..., 1.19, 22w24a, 23w41a, 1.20.3 Release Candidate 1, 1.20.4

Retrieved