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 everyone,

 

  I am trying to do a packet for a bukkit server, but i cant send it on the vanilla ... I followed the Wiki tutorial about making Packet.

Mine is supposed to send a String when entering a World Guard region, but i need to try if it works before start modding Bukkit, so in a onItemUse, i wrote this:

PacketRegionHandler pack = new PacketRegionHandler(MessagesPacket.messageVille);
    	Packet250CustomPayload packet = pack;
    	PacketDispatcher.sendPacketToPlayer(packet, (Player)par2EntityPlayer);

but i have an error where its underlined. I cant cast a PacketRegionHandler to a Packet250CustomPayload, so how am i supposed to do?

 

Thanks,

i dont understand you are trying to make a packet for mcpc bukkit or normal bukkit?, because the normal bukkit dont have the Packet250CustomPayload.

Its a forge packet, and you need a packet handler to use him.

I dont know if this will work..

 

 

PacketRegionHandler pack = new PacketRegionHandler(MessagesPacket.messageVille);

    Packet250CustomPayload packet = (Packet250CustomPayload )pack;

    PacketDispatcher.sendPacketToPlayer(packet, (Player)par2EntityPlayer);

 

 

if that dont work(im not good with bukkit and packet stuff), you can try

 

 

Iterator iterator = MinecraftServer.getServer().configManager.playerEntities.iterator();

 

while (iterator.hasNext())

{

        Object obj = iterator.next();

        if ((obj instanceof EntityPlayer) && !((EntityPlayerMP)obj).username.isEmpty())

        {

                EntityPlayerMP pmp = (EntityPlayerMP)obj;

                pmp.addChatMessage(string here);

        }

}

 

 

as far i know entityplayer its entityhuman in bukkit (just change), but if you will make a version of this mod for vannila just use packet handler, there is some tutorials on the wiki, also a lot of things are obfuscated on bukkit, so the best way its do directly for bukkit and ask for help in the bukkit forums.

  • Author

Now, i'm trying to make it in SP / SMP, and then i will do it with MCPC

I cant send it from vanilla server

And i cant cast the PacketHandler in any other kind of packet

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.