Giter Site home page Giter Site logo

Comments (8)

A248 avatar A248 commented on August 10, 2024

This issue should probably get the question label.

from protocolize.

Exceptionflug avatar Exceptionflug commented on August 10, 2024

Hey thank you for using Protocolize!

To your question number one:

You can simply add support for custom packets at your own. There are simple things you need:

  1. A map containing every protocol id and the packet's according packet id from that version. Example click here.
  2. A class extending the de.exceptionflug.protocolize.api.protocol.AbstractPacket class. For example click here.
  3. Documentation about the packet layout for all supported protocol versions. For sign change this would be the link for the 1.14.4 protocol: https://wiki.vg/Protocol#Update_Sign
    You can find documentation for older protocol versions right here: https://wiki.vg/Protocol_version_numbers
  4. In the class you have to override the read(ByteBuf buf, Direction direction, int protocolVersion) and write(ByteBuf buf, Direction direction, int protocolVersion) methods. Take a look at other protocolize pre-implemented packets like BlockPlacement.
  5. Register the packet using ProtocolAPI.getPacketRegistration().registerPacket(Protocol protocol, Direction direction, Class<? extends AbstractPacket> clazz, Map<Integer, Integer> protocolIdMapping);. For example click here.
    That's all. Now you can use your own implemented packet like the others.

To your second question:

This is not possible since this requires experimental features to be enabled which I don't recommend. Protocolize is not able to track the spigot inventory contents when those experimental features are disabled. The only recommended way is the way stated above. Otherwise you could have accessed the PlayerInventory using InventoryManager.getInventory(UUID uuid); and get the item from the held item slot.

Another thing I have to mention: Please don't use AbstractPacket.setCancelSend(boolean cancelSend); anymore. Please cancel the event itself instead :)

For further questions I am ready to help :)

from protocolize.

Exceptionflug avatar Exceptionflug commented on August 10, 2024

Implementing SignUpdate at next update v1.5.0

from protocolize.

Exceptionflug avatar Exceptionflug commented on August 10, 2024

In fbdd5a2 you will find an implementation of SignUpdate coming to the next major protocolize release supporting 1.15 next week.

from protocolize.

A248 avatar A248 commented on August 10, 2024

Thank you! I honestly didn't expect this feature to be added so quickly.

You certainly know much more than I do about packets. I doubt I could implement a sign-change packet myself. However, I'm glad you are able and willing :)

from protocolize.

Exceptionflug avatar Exceptionflug commented on August 10, 2024

No problem. You can use an early version of v1.5.0 by cloning and building the 1.15 branch. Artifact is deployed to maven repo.

from protocolize.

A248 avatar A248 commented on August 10, 2024

Don't worry, I was competent enough to figure that out myself using maven dependency resolution.

from protocolize.

A248 avatar A248 commented on August 10, 2024

SignUpdate packet now added to master branch courtesy of Exceptionflug. https://github.com/Exceptionflug/protocolize/blob/master/protocolize-world/src/main/java/de/exceptionflug/protocolize/world/packet/SignUpdate.java

from protocolize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.