Help with 1.13 WASD Entity control

Discussion in 'Plugin Development' started by lgplay, Nov 16, 2019.

Thread Status:
Not open for further replies.
  1. Hi, I need help with riding entities in 1.13, I wrote the method I have pasted below in 1.8.8 and it worked, but now the methods and variable names have being changed and it doesn't work anymore can someone help me making it workagain?

    Code:
    @Override
        public void g(float f, float f1) {
            if (this.passenger != null && this.passenger instanceof EntityHuman) {
                this.lastYaw = this.yaw = this.passenger.yaw;
                this.pitch = this.passenger.pitch * 0.5F;
                this.setYawPitch(this.yaw, this.pitch);
                this.aK = this.aI = this.yaw;
                f = ((EntityLiving) this.passenger).aZ * 0.5F;
                f1 = ((EntityLiving) this.passenger).ba;
    
                if (f1 <= 0.0F) {
                    f1 *= 0.25F;
                }
                try {
                    if (FIELD_JUMP.getBoolean(this.passenger) && this.onGround) {
                        this.motY += 1F;
                        this.ai = true;
                        if (f1 > 0.0F) {
                            float f2 = MathHelper.sin(this.yaw * 3.141593F / 180.0F);
                            float f3 = MathHelper.cos(this.yaw * 3.141593F / 180.0F);
    
                            this.motX += -0.4F * f2 * ((EntityInsentient) this).br();
                            this.motZ += 0.4F * f3 * ((EntityInsentient) this).br();
                        }
                    }
                } catch (IllegalArgumentException | IllegalAccessException e) {
                    e.printStackTrace();
                }
    
                this.S = 1.0F;
                this.aM = this.bI() * 0.1F;
                if (!this.world.isClientSide) {
                    this.k((float) this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
                    super.g(f, f1);
                }
    
                this.aA = this.aB;
                double d0 = this.locX - this.lastX;
                double d1 = this.locZ - this.lastZ;
                float f4 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F;
                if (f4 > 1.0F) {
                    f4 = 1.0F;
                }
    
                this.aB += (f4 - this.aB) * 0.4F;
                this.aC += this.aB;
            } else {
                this.S = 0.5F;
                this.aM = 0.02F;
                super.g(f, f1);
            }
        }
     
  2. Offline

    robertlit

    If you really have written this (which I am sure you haven't) you would be able to make this work in newer versions too.
    You can't post a not working copy-pasted code, and expect someone to fix it for you..
    For NMS/craftbukkit code, you will have to find out what the obfuscated methods are used for and do it on your own.
     
    Last edited: Nov 19, 2019
  3. Offline

    Zombie_Striker

    @lgplay
    Did you build your server with BuildTools? If so, the builder should contain a /craftbukkit/src/ folder, which contains the decompiled code for all classes. Go there, and look for the entity horse class and look for a method *which has the paramaters "float, float" *.
     
  4. I now found out about the protocolLib on Steering Event, do someone here know how I can use this to control a mob?

    There is no such method in the horse class anymore, do you know a another way to do this?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Dec 3, 2019
  5. Offline

    Zombie_Striker

    @lgplay
    Okay, look at the code and look for methods that change the Y value for the velocity/location of the horse. The names should be visible and unobfusticated, so it should be pretty easy to see which methods control movement.
     
Thread Status:
Not open for further replies.

Share This Page