Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

  • 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;
}
}

  • 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;
}
}

I have the same problem. Can anyone post the final code please?

_         

___ ___| |__  _ __ 

/ __/ __| '_ \| '_ \

\__ \__ \ | | | | | |

|___/___/_| |_|_| |_|

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.