public void handleBlockItemSwitch(Packet16BlockItemSwitch par1Packet16BlockItemSwitch) {
   if (par1Packet16BlockItemSwitch.id < 0
       || par1Packet16BlockItemSwitch.id >= InventoryPlayer.func_70451_h()) {
     logger.warning(
         (new StringBuilder())
             .append(playerEntity.username)
             .append(" tried to set an invalid carried item")
             .toString());
     return;
   } else {
     playerEntity.inventory.currentItem = par1Packet16BlockItemSwitch.id;
     return;
   }
 }
  /** Handle a creative slot packet. */
  public void handleCreativeSetSlot(Packet107CreativeSetSlot par1Packet107CreativeSetSlot) {
    if (playerEntity.theItemInWorldManager.isCreative()) {
      boolean flag = par1Packet107CreativeSetSlot.slot < 0;
      ItemStack itemstack = par1Packet107CreativeSetSlot.itemStack;
      boolean flag1 =
          par1Packet107CreativeSetSlot.slot >= 1
              && par1Packet107CreativeSetSlot.slot < 36 + InventoryPlayer.func_70451_h();
      boolean flag2 =
          itemstack == null
              || itemstack.itemID < Item.itemsList.length
                  && itemstack.itemID >= 0
                  && Item.itemsList[itemstack.itemID] != null;
      boolean flag3 =
          itemstack == null
              || itemstack.getItemDamage() >= 0
                  && itemstack.getItemDamage() >= 0
                  && itemstack.stackSize <= 64
                  && itemstack.stackSize > 0;

      if (flag1 && flag2 && flag3) {
        if (itemstack == null) {
          playerEntity.inventorySlots.putStackInSlot(par1Packet107CreativeSetSlot.slot, null);
        } else {
          playerEntity.inventorySlots.putStackInSlot(par1Packet107CreativeSetSlot.slot, itemstack);
        }

        playerEntity.inventorySlots.setPlayerIsPresent(playerEntity, true);
      } else if (flag && flag2 && flag3 && creativeItemCreationSpamThresholdTally < 200) {
        creativeItemCreationSpamThresholdTally += 20;
        EntityItem entityitem = playerEntity.dropPlayerItem(itemstack);

        if (entityitem != null) {
          entityitem.func_70288_d();
        }
      }
    }
  }