How to use TinyProtocol ?

Discussion in 'Spigot Plugin Development' started by Feeps, Feb 8, 2018.

  1. Hi,

    How to use TinyProtocol ?
    I tried to use TinyProtocol but I do not really understand ... I looked for tutorials but I found nothing :/
    The Example Code on Github doesn't work !
    I don't want to use ProtocolLib. I just want a class to put on the plugin ;à

    I know enough the java language
    Can someone help me on this ?
    Thanks in advance ;)
     
  2. No sorry, it's that: here
     
  3. This is development support, .. you seem to be asking support for a plugin.
    Or maybe i just don't understand: what are you trying to code, which code doesn't work that you've made?
     
  4. How can I send/receive packets with TinyProtocol ?
    Sry for my bad english :(
     
  5. Bump ? ;) ...
     
  6. You sent us the protocollib example code, where is your own code ?
     
  7. I don't have my own code ;/. I search an example code to inspire me and understand TinyProtocol :à
    The example code on Github doesn't work ;/ I can't inspire me with that...
     
    #8 Feeps, Feb 9, 2018
    Last edited: Feb 9, 2018
  8. why it does not work ?
    your server version ?
     
  9. 1.12.2: In this version it's not a String but ParticleEnum or EnumParticle... Something like that...
    Code (Java):
    private FieldAccessor<String> particleName = Reflection.getField(particleClass, String.class, 0);
    The example code in GitHub is not updated for the newer version of Minecraft

    EDIT: It's EnumParticle
    Code (Java):
    package net.minecraft.server.v1_12_R1;

    import java.io.IOException;

    public class PacketPlayOutWorldParticles implements Packet<PacketListenerPlayOut> {
        private EnumParticle a;
        private float b;
        private float c;
        private float d;
        private float e;
        private float f;
        private float g;
        private float h;
        private int i;
        private boolean j;
        private int[] k;

        public PacketPlayOutWorldParticles() {
        }

        public PacketPlayOutWorldParticles(EnumParticle var1, boolean var2, float var3, float var4, float var5, float var6, float var7, float var8, float var9, int var10, int... var11) {
            this.a = var1;
            this.j = var2;
            this.b = var3;
            this.c = var4;
            this.d = var5;
            this.e = var6;
            this.f = var7;
            this.g = var8;
            this.h = var9;
            this.i = var10;
            this.k = var11;
        }

        public void a(PacketDataSerializer var1) throws IOException {
            this.a = EnumParticle.a(var1.readInt());
            if (this.a == null) {
                this.a = EnumParticle.BARRIER;
            }

            this.j = var1.readBoolean();
            this.b = var1.readFloat();
            this.c = var1.readFloat();
            this.d = var1.readFloat();
            this.e = var1.readFloat();
            this.f = var1.readFloat();
            this.g = var1.readFloat();
            this.h = var1.readFloat();
            this.i = var1.readInt();
            int var2 = this.a.d();
            this.k = new int[var2];

            for(int var3 = 0; var3 < var2; ++var3) {
                this.k[var3] = var1.g();
            }

        }

        public void b(PacketDataSerializer var1) throws IOException {
            var1.writeInt(this.a.c());
            var1.writeBoolean(this.j);
            var1.writeFloat(this.b);
            var1.writeFloat(this.c);
            var1.writeFloat(this.d);
            var1.writeFloat(this.e);
            var1.writeFloat(this.f);
            var1.writeFloat(this.g);
            var1.writeFloat(this.h);
            var1.writeInt(this.i);
            int var2 = this.a.d();

            for(int var3 = 0; var3 < var2; ++var3) {
                var1.d(this.k[var3]);
            }

        }

        public void a(PacketListenerPlayOut var1) {
            var1.a(this);
        }
    }
     
     
    #10 Feeps, Feb 9, 2018
    Last edited: Feb 9, 2018
  10. You do not know how to use réflection ?
    Do You really need the particule packet ?
    Why do you Want’ to use tinyprotocol
     
    #12 coco_gigpn, Feb 9, 2018
    Last edited: Feb 9, 2018
  11. I want to use TinyProtocol because it's not an API and just a class in the jar file.
    I know the reflection.
    I don't really need particle packet. I'm just new on the packets.
     
  12. I understand that, but why do you listen packet?
    No you don't
    Just remove the particle packet and check if tiny protocol is working
     
  13. ?

    I think TinyProtocol work (There is no error) but I don't have any idea how can I listen/send packets...
     
  14. Then rather do something ala this:
    Code (Java):
    private Class<?> enumParticleClass = Reflection.getMinecraftClass("EnumParticle");
    private FieldAccessor<? /* EnumParticle */> particleName = Reflection.getField(particleClass, enumParticleClass, 0);
     
  15. what packets do you want to listen ?
     
  16. When an armorstand (fake entity) is typed
     
  17. Wrong translation I think you mean when an amorstand is hit by a player.
    So you do not know what packet you have to listen...
    This is PacketPlayInUseEntity
     

Share This Page