mojira.dev
MC-10366

Renamed minecarts still drop a minecart item in creative mode

The bug

Renamed minecarts still drop a minecart item in creative mode. Expected behavior would be not to drop a minecart.

How to reproduce

  1. Rename a minecart

  2. Punch it
    → ❌ It still drops its item on creative

Code analysis

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

Related issues

Attachments

Comments

migrated
[media][media]
kumasasa

Confirmed.

julian mazer

This Happens To all minecarts

Roadsguy

I would think this is a good feature if the minecart keeps its name data when placed, and drops itself as a named item when you break it, but if not, then it's got to be a bug.

marcono1234

Confirmed for 14w21b

Unnamed minecarts with command blocks don't drop something

PancakeMan77

Can someone update the title to include creative? It's confusing otherwise. If you were in survival, it would make sense. I know that you are in creative, but it was initially confusing.

[Mod] redstonehelper

Done, thanks.

PancakeMan77

Confirmed for 15w35c. I also want to note, that when done with a minecart command block, it will drop a minecart named "@".

Anon Ymus

That's MC-41893.

[Mod] redstonehelper

I resolved MC-41893 as a duplicate of this ticket since they're the same (command block minecarts are named minecarts too!).

Steven W.d.V.

Confirmed for 15w39c

Steven W.d.V.

Confirmed in 15w40b

Steven W.d.V.

Still present in 15w41b

Steven W.d.V.

Confirmed for 15w42a

Steven W.d.V.

Confirmed for 15w43b and 15w43c

Steven W.d.V.

Confirmed for 15w44a and 15w44b

Steven W.d.V.

Confirmed for 15w45a

Steven W.d.V.

Confirmed for 15w47a and 15w47c

Steven W.d.V.

Confirmed for 15w51b

Steven W.d.V.

Confirmed for 16w05b

Immaterialise

Confirmed for 1.9-pre1

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.

This behaviour could be changed by modifying the public boolean attackEntityFrom(DamageSource source, float amount) method of the net.minecraft.entity.item.EntityMinecart class. However as this is done on purpose this bug might be "Works as Intended".

/**
* Called when the entity is attacked.
*/
public boolean attackEntityFrom(DamageSource source, float amount)
{
if (!this.worldObj.isRemote && !this.isDead)
{
    if (this.func_180431_b(source))
    {
        return false;
    }
    else
    {
        this.setRollingDirection(-this.getRollingDirection());
        this.setRollingAmplitude(10);
        this.setBeenAttacked();
        this.setDamage(this.getDamage() + amount * 10.0F);
        boolean var3 = source.getEntity() instanceof EntityPlayer && ((EntityPlayer)source.getEntity()).capabilities.isCreativeMode;

        if (var3 || this.getDamage() > 40.0F)
        {
            if (this.riddenByEntity != null)
            {
                this.riddenByEntity.mountEntity((Entity)null);
            }
            
            // Changed this
            //if (var3 && !this.hasCustomName())
            if (var3)
            {
                this.setDead();
            }
            else
            {
                this.killMinecart(source);
            }
        }

        return true;
    }
}
else
{
    return true;
}
Steven W.d.V.

Confirmed for 1.9-pre2

JUE13

Confirmed for 17w17a

Steven W.d.V.

Confirmed for 1.13-pre5

Kraif

Confirmed for 1.13.1.

muzikbike

Affects 18w47b

muzikbike

Affects 18w48a

muzikbike

Affects 18w48b, can I request ownership of the ticket?

muzikbike

Affects 18w49a

muzikbike

Affects 18w50a

Asteraoth

Changed the reporter to @unknown.

Желязко Юрий Алеексевич

I have the same =)

pulpetti

In 1.16.2 Pre-3

julian mazer

muzikbike

(Unassigned)

Confirmed

Minecart

CustomName, item-renaming

Snapshot 13w09a, Snapshot 13w10b, Minecraft 1.5, Minecraft 1.5.1, Minecraft 1.5.2, ..., 1.16.2 Pre-release 1, 1.16.2 Pre-release 3, 1.16.2, 1.16.3 Release Candidate 1, 1.16.3

Retrieved