Ejemplo n.º 1
0
  public void handleTransaction(Packet106Transaction par1Packet106Transaction) {
    Short short1 = (Short) field_72586_s.lookup(playerEntity.craftingInventory.windowId);

    if (short1 != null
        && par1Packet106Transaction.shortWindowId == short1.shortValue()
        && playerEntity.craftingInventory.windowId == par1Packet106Transaction.windowId
        && !playerEntity.craftingInventory.isPlayerNotUsingContainer(playerEntity)) {
      playerEntity.craftingInventory.setPlayerIsPresent(playerEntity, true);
    }
  }
Ejemplo n.º 2
0
  public void handleWindowClick(Packet102WindowClick par1Packet102WindowClick) {
    if (playerEntity.craftingInventory.windowId == par1Packet102WindowClick.window_Id
        && playerEntity.craftingInventory.isPlayerNotUsingContainer(playerEntity)) {
      ItemStack itemstack =
          playerEntity.craftingInventory.slotClick(
              par1Packet102WindowClick.inventorySlot,
              par1Packet102WindowClick.mouseClick,
              par1Packet102WindowClick.holdingShift,
              playerEntity);

      if (ItemStack.areItemStacksEqual(par1Packet102WindowClick.itemStack, itemstack)) {
        playerEntity.serverForThisPlayer.sendPacketToPlayer(
            new Packet106Transaction(
                par1Packet102WindowClick.window_Id, par1Packet102WindowClick.action, true));
        playerEntity.playerInventoryBeingManipulated = true;
        playerEntity.craftingInventory.updateCraftingResults();
        playerEntity.sendInventoryToPlayer();
        playerEntity.playerInventoryBeingManipulated = false;
      } else {
        field_72586_s.addKey(
            playerEntity.craftingInventory.windowId,
            Short.valueOf(par1Packet102WindowClick.action));
        playerEntity.serverForThisPlayer.sendPacketToPlayer(
            new Packet106Transaction(
                par1Packet102WindowClick.window_Id, par1Packet102WindowClick.action, false));
        playerEntity.craftingInventory.setPlayerIsPresent(playerEntity, false);
        ArrayList arraylist = new ArrayList();

        for (int i = 0; i < playerEntity.craftingInventory.inventorySlots.size(); i++) {
          arraylist.add(((Slot) playerEntity.craftingInventory.inventorySlots.get(i)).getStack());
        }

        playerEntity.sendContainerAndContentsToPlayer(playerEntity.craftingInventory, arraylist);
      }
    }
  }