Gets the name of this thing. This method has slightly different behavior depending on the interface (for <a href="https://github.com/ModCoderPack/MCPBot-Issues/issues/14">technical reasons</a> the same method is used for both IWorldNameable and ICommandSender):
<dl>
<dt>{@link net.minecraft.inventory.INameable#getName() INameable.getName()}</dt>
<dd>Returns the name of this inventory. If this {@linkplain net.minecraft.inventory#hasCustomName() has a custom name} then this <em>should</em> be a direct string; otherwise it <em>should</em> be a valid translation string.</dd>
<dd>However, note that <strong>the translation string may be invalid</strong>, as is the case for {@link net.minecraft.tileentity.TileEntityBanner TileEntityBanner} (always returns nonexistent translation code <code>banner</code> without a custom name), {@link net.minecraft.block.BlockAnvil.Anvil BlockAnvil$Anvil} (always returns <code>anvil</code>), {@link net.minecraft.block.BlockWorkbench.InterfaceCraftingTable BlockWorkbench$InterfaceCraftingTable} (always returns <code>crafting_table</code>), {@link net.minecraft.inventory.InventoryCraftResult InventoryCraftResult} (always returns <code>Result</code>) and the {@link net.minecraft.entity.item.EntityMinecart EntityMinecart} family (uses the entity definition). This is not an exaustive list.</dd>
<dd>In general, this method should be safe to use on tile entities that implement IInventory.</dd>
<dt>{@link net.minecraft.command.ICommandSender#getName() ICommandSender.getName()} and {@link net.minecraft.entity.Entity#getName() Entity.getName()}</dt>
<dd>Returns a valid, displayable name (which may be localized). For most entities, this is the translated version of its translation string (obtained via {@link net.minecraft.entity.EntityList#getEntityString EntityList.getEntityString}).</dd>
<dd>If this entity has a custom name set, this will return that name.</dd>
<dd>For some entities, this will attempt to translate a nonexistent translation string; see <a href="https://bugs.mojang.com/browse/MC-68446">MC-68446</a>. For {@linkplain net.minecraft.entity.player.EntityPlayer#getName() players} this returns the player's name. For {@linkplain net.minecraft.entity.passive.EntityOcelot ocelots} this may return the translation of <code>entity.Cat.name</code> if it is tamed. For {@linkplain net.minecraft.entity.item.EntityItem#getName() item entities}, this will attempt to return the name of the item in that item entity. In all cases other than players, the custom name will overrule this.</dd>
<dd>For non-entity command senders, this will return some arbitrary name, such as "Rcon" or "Server".</dd>
</dl>
The first change:
IWorldNameable→INameable. This has no relation to worlds, and is used for e.g. inventories (IInventory), which don't even have a reference to the world (excluding block entities). More specifically, this applies to:EntityMinecart(likely this inheritance is leftover from the days when there was a single minecart class so thatEntityMinecartContainer(chests and hoppers) could be named — however,IWorldNameabledidn't exist in 1.5 when this change was done so that's odd)TileEntityBannerfor its (useless) custom nameIInteractionObjectfor inventory titles (this interface is something I'll want to clean up later)IInventoryfor inventory titles (also to clean up)Another name that I thought of might be
INamableInventory, but due to banners and some of the other stuff that seems like a bad name to me (plusinterface IInventory extends INameableInventoryseems like a horrible idea).This should also be repackaged into
net.minecraft.inventoryornet.minecraft.tileentity(or perhaps somewhere else).That change looks nice and innocuous. Unfortunately, I'd also like to request some cleanup for the methods. This is actually a pain, because of #14 —
func_70005_c_is bothIWorldNameable.getName()andICommandSender.getName()... which means that it's alsoEntity.getName(). Same deal with the other methods in ICommandSender. (Maybe the_on the end of the method's SRG id/obf name signifies that, I'm not 100% sure). Oh, and these methods are awful and inconsistent.Anyways, here are some proposed javadocs which I'd like feedback on (both the source and a formatted version; note that the links in the formatted version do not go anywhere and are just provided to show where valid links will be):
func_70005_c_:IWorldNameable.getName(),ICommandSender.getName(),Entity.getName():func_145818_k_:IWorldNameable.hasCustomName(),Entity.hasCustomName()func_145748_c_:IWorldNameable.getDisplayName(),ICommandSender.getDisplayName(),Entity.getDisplayName():This maybe could use a rename, but I don't know what it should be named — something like
getNameComponent.Note that to find declarations of these methods, it's easiest to use
findallm, for instancefindallm func_70005_c_orfindallm ^Entity\.func_70005_c_