Description

The bug

When breaking a minecart (any type) in survival a renamed minecart item is created. In previous versions a renamed minecart was only dropped if the minecart was renamed before.
Additionally some minecart types have no translation and are displayed as: entity. + Entity type + .name
Full list:entity.MinecartRideable.nameentity.MinecartFurnace.nameentity.MinecartTNT.nameMinecart with ChestMinecart with Hopper

How to reproduce

Place any type of minecart and break it in Survival mode.

The reason

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

The reason why this happens is because in previous versions the class net.minecraft.entity.item.EntityMinecart had an extra field for the custom name that would be used for dropping the item (this required a lot of methods to be overridden). In 1.9 minecarts do not have this extra field anymore. The problem is that the method net.minecraft.entity.item.EntityMinecart.killMinecart(DamageSource) uses the method net.minecraft.entity.Entity.getName() to test whether or not the minecart has a custom name. This method will always return a string because this method is used for displaying for example the entity name in the chat. Instead the method of the minecart should test if it has a custom name.