public void handleCustomPayload(Packet250CustomPayload par1Packet250CustomPayload) { if ("MC|BEdit".equals(par1Packet250CustomPayload.channel)) { try { DataInputStream datainputstream = new DataInputStream(new ByteArrayInputStream(par1Packet250CustomPayload.data)); ItemStack itemstack = Packet.readItemStack(datainputstream); if (!ItemWritableBook.validBookTagPages(itemstack.getTagCompound())) { throw new IOException("Invalid book tag!"); } ItemStack itemstack2 = playerEntity.inventory.getCurrentItem(); if (itemstack != null && itemstack.itemID == Item.writableBook.shiftedIndex && itemstack.itemID == itemstack2.itemID) { itemstack2.setTagCompound(itemstack.getTagCompound()); } } catch (Exception exception) { exception.printStackTrace(); } } else if ("MC|BSign".equals(par1Packet250CustomPayload.channel)) { try { DataInputStream datainputstream1 = new DataInputStream(new ByteArrayInputStream(par1Packet250CustomPayload.data)); ItemStack itemstack1 = Packet.readItemStack(datainputstream1); if (!ItemEditableBook.validBookTagContents(itemstack1.getTagCompound())) { throw new IOException("Invalid book tag!"); } ItemStack itemstack3 = playerEntity.inventory.getCurrentItem(); if (itemstack1 != null && itemstack1.itemID == Item.writtenBook.shiftedIndex && itemstack3.itemID == Item.writableBook.shiftedIndex) { itemstack3.setTagCompound(itemstack1.getTagCompound()); itemstack3.itemID = Item.writtenBook.shiftedIndex; } } catch (Exception exception1) { exception1.printStackTrace(); } } else if ("MC|TrSel".equals(par1Packet250CustomPayload.channel)) { try { DataInputStream datainputstream2 = new DataInputStream(new ByteArrayInputStream(par1Packet250CustomPayload.data)); int i = datainputstream2.readInt(); Container container = playerEntity.craftingInventory; if (container instanceof ContainerMerchant) { ((ContainerMerchant) container).setCurrentRecipeIndex(i); } } catch (Exception exception2) { exception2.printStackTrace(); } } else { ModLoader.serverCustomPayload(this, par1Packet250CustomPayload); } }