Discussion in 'Spigot Help' started by Demonkid1112, Jun 26, 2018.

  1. Does anyone have any good tips for learning protocollib, I've already checked out and and some source code, but so far I can't really understand it, like for example on the explosion example in the first link, it uses doubles as the location, but looking at the second link the location uses floats. I'm just having a lot of trouble understanding what information goes where
  2. joehot200


    I would highly recommend that you grab some ProtocolLib usage examples and just mess around with them a bit.

    To get you started, have some random POSITION code:
    Code (Java):

                      new PacketAdapter(this, ListenerPriority.NORMAL,
                              PacketType.Play.Client.POSITION) {
                        public void onPacketReceiving(PacketEvent event) {
                            Player p = event.getPlayer();
                            PacketContainer pa = event.getPacket();
                            double v1 = pa.getDoubles().read(0);
                            double v2 = pa.getDoubles().read(1);
                            double v3 = pa.getDoubles().read(2);
                            Vector location = new Vector(v1, v2, v3);
                            p.sendMessage("You are now at " + location);
    Personally, I wouldn't recommend using to learn ProtocolLib specifically, I would more recommend it to learn the Minecraft networking after you become somewhat-proficient at ProtocolLib, to learn how you can use ProtocolLib better.

    (Just FYI if you test that code... It only fires if you move without moving your head)
    • Agree Agree x 1