boolean used = false;
if (stack != null && stack.getItem() instanceof IToolCrowbar) {
IToolCrowbar crowbar = (IToolCrowbar) stack.getItem();
if (entity instanceof EntityMinecart) {
EntityMinecart cart = (EntityMinecart) entity;
if (crowbar.canLink(thePlayer, stack, cart)) {
boolean linkable = cart instanceof ILinkableCart;
if (!linkable || (linkable && ((ILinkableCart) cart).isLinkable()))
if (linkMap.containsKey(thePlayer)) {
ILinkageManager lm = LinkageManager.instance();
EntityMinecart last = linkMap.remove(thePlayer);
if (lm.areLinked(cart, last)) {
lm.breakLink(cart, last);
used = true;
ChatPlugin.sendLocalizedChat(thePlayer, "railcraft.gui.link.broken");
LinkageManager.printDebug("Reason For Broken Link: User removed link.");