Posted July 22, 20178 yr Hello, i create a custom book (copypast of GuiScreenBook) and i send packet to server, but packet sends after open/close GuiInventory or GuiContainerCreative, not when I'm closing my book. GuiCustomBook. How to fix it? private void sendBookToServer() throws IOException { if (this.bookIsModified && this.bookPages != null) { while (this.bookPages.tagCount() > 1) { String s = this.bookPages.getStringTagAt(this.bookPages.tagCount() - 1); if (!s.isEmpty()) { break; } this.bookPages.removeTag(this.bookPages.tagCount() - 1); } if (this.bookObj.hasTagCompound()) { NBTTagCompound nbttagcompound = this.bookObj.getTagCompound(); nbttagcompound.setTag("pages", this.bookPages); } else { this.bookObj.setTagInfo("pages", this.bookPages); } String title = this.bookTitle; if (title.equals(TITLE_PLACEHOLDER)) title = ""; this.bookObj.setTagInfo("title", new NBTTagString(title)); PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer()); packetbuffer.writeItemStack(this.bookObj); this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|BEdit", packetbuffer)); } } @Override protected void actionPerformed(GuiButton button) throws IOException { boolean updateLines = false; if (button.enabled) { switch (button.id) { case BUTTON_DONE_ID: this.mc.displayGuiScreen(null); this.sendBookToServer(); break; } } }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.