Posted July 2, 201411 yr Hello I'm trying to send a packet to the server to open a GUI, but the console writes the following: [server thread / ERROR] [FML]: Messages for channel Esoteric for side SERVER were not processed by the embedded channel [agravaine.agravainelib.network.packet.message.PacketOpenGui @ 198c9c7]. They have been dropped. Length: 0 Made from the tutorial http://www.minecraftforge.net/wiki/Netty_Packet_Handling.
July 2, 201411 yr Author Thanks. Not work... Writes the same thing... My packet: public class PacketOpenGui implements IMessage, IMessageHandler<PacketOpenGui, IMessage>{ Object mod; int id; public PacketOpenGui(){} public PacketOpenGui(Object modGui, int guiId){ mod = modGui; id = guiId; } public void fromBytes(ByteBuf buf){} public void toBytes(ByteBuf buf){} public IMessage onMessage(PacketOpenGui message, MessageContext ctx){ Esoteric.logger.info("DUDE"); EntityPlayerMP player = ctx.getServerHandler().playerEntity; player.openGui(mod, id, player.worldObj, (int)player.posX, (int)player.posY, (int)player.posZ); return null; } }
July 2, 201411 yr Author I need to open by pressing the GUI, can give a working version? P.S Azanor makes in one class and it all works [https://github.com/Azanor/Baubles/blob/master/src/main/java/baubles/common/network/PacketOpenBaublesInventory.java].
July 2, 201411 yr Author I have all the same. By the way, now the packet is sent without errors, but still GUI will not open ...
July 3, 201411 yr Author Packet code remained unchanged. Register: packetSender.registerMessage(PacketOpenGui.class, PacketOpenGui.class, 0, Side.SERVER); Sending: @SubscribeEvent public void keyEvent(KeyInputEvent event){ if(key.getIsKeyPressed() && FMLClientHandler.instance().getClient().inGameHasFocus){ Esoteric.logger.info("MEOW"); Esoteric.packetSender.sendToServer(new PacketOpenGui(Esoteric.instance, 2)); } } Gui handler: public class EsotericGuiHandler implements IGuiHandler{ public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z){ TileEntity tileEntity = world.getTileEntity(x, y, z); if(id == 0){ return new ContainerRelic(player.inventory, (TileEntityRelic)tileEntity); } if(id == 1){ return new ContainerCampfire(player.inventory, (TileEntityCampfire)tileEntity); } if(id == 2){ return new ContainerPlayerExtended(player.inventory, !world.isRemote, player); } return null; } public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z){ TileEntity tileEntity = world.getTileEntity(x, y, z); if(id == 0){ return new GuiRelic(player.inventory, (TileEntityRelic)tileEntity); } if(id == 1){ return new GuiCampfire(player.inventory, (TileEntityCampfire)tileEntity); } if(id == 2){ return new GuiPlayerExtended(player); } return null; } }
July 3, 201411 yr I have the same problem. Can anyone post the final code please? _ ___ ___| |__ _ __ / __/ __| '_ \| '_ \ \__ \__ \ | | | | | | |___/___/_| |_|_| |_|
July 3, 201411 yr I'm having a problem with opening GUI with Packets. Don't know what to do. I have some code, but it ain't working _ ___ ___| |__ _ __ / __/ __| '_ \| '_ \ \__ \__ \ | | | | | | |___/___/_| |_|_| |_|
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.