@Override public void draw(int i, int j) { TextRadarComponent.players.clear(); inOrder.clear(); super.draw(i, j); for (Object o : Resilience.getInstance().getInvoker().getEntityList()) { if ((Entity) o instanceof EntityOtherPlayerMP) { EntityOtherPlayerMP otherPlayer; otherPlayer = (EntityOtherPlayerMP) o; if (!Resilience.getInstance() .getInvoker() .getPlayerName(otherPlayer) .equalsIgnoreCase(Resilience.getInstance().getInvoker().getSessionUsername())) { inOrder.add( new TextRadarComponent( Resilience.getInstance() .getInvoker() .stripControlCodes( Resilience.getInstance().getInvoker().getPlayerName(otherPlayer)), (int) Resilience.getInstance() .getInvoker() .getDistanceToEntity( otherPlayer, Resilience.getInstance().getWrapper().getPlayer()), getX() + 3, getY() + count, FriendManager.isFriend(otherPlayer.func_145748_c_().getUnformattedText()), this)); } } } Collections.sort(inOrder); for (TextRadarComponent rad : inOrder) { TextRadarComponent.players.add( new TextRadarComponent( rad.getName(), (int) rad.getBlocksAway(), getX() + 3, count + getY() + 4, FriendManager.isFriend(rad.getName()), this)); count += 15; } if (inOrder.size() != 0 && isExtended()) { Utils.drawRect( getX(), getY() + 17, getX1(), getY() + (15 * inOrder.size() + 20.5F), 0x99040404); } for (TextRadarComponent radar1 : TextRadarComponent.players) { if (isExtended()) { radar1.draw(i, j); } } count = 16; }
public static boolean entityOtherPlayerIsItemInUseHook( EntityOtherPlayerMP player, boolean isItemInUse) { ItemStack mainhand = player.getCurrentEquippedItem(); if (!isItemInUse && player.isEating() && mainhand != null) { // ItemStack itemstack = player.inventory.mainInventory[player.inventory.currentItem]; player.setItemInUse( mainhand, Item.itemsList[mainhand.itemID].getMaxItemUseDuration(mainhand)); return true; } else if (isItemInUse && !player.isEating()) { player.clearItemInUse(); return false; } else { return isItemInUse; } }
@Override public void execute(String[] args) throws Error { if (args.length != 2) syntaxError(); if (!mc.thePlayer.capabilities.isCreativeMode) error("Creative mode only."); // find item ItemStack item = null; for (Object entity : mc.theWorld.loadedEntityList) if (entity instanceof EntityOtherPlayerMP) { EntityOtherPlayerMP player = (EntityOtherPlayerMP) entity; if (player.getName().equalsIgnoreCase(args[0])) { switch (args[1].toLowerCase()) { case "hand": item = player.inventory.getCurrentItem(); break; case "head": item = player.inventory.armorItemInSlot(3); break; case "chest": item = player.inventory.armorItemInSlot(2); break; case "legs": item = player.inventory.armorItemInSlot(1); break; case "feet": item = player.inventory.armorItemInSlot(0); break; default: syntaxError(); break; } break; } } if (item == null) error("Player \"" + args[0] + "\" could not be found."); // copy item for (int i = 0; i < 9; i++) if (mc.thePlayer.inventory.getStackInSlot(i) == null) { mc.thePlayer.sendQueue.addToSendQueue(new C10PacketCreativeInventoryAction(36 + i, item)); wurst.chat.message("Item copied."); return; } error("Please clear a slot in your hotbar."); }