WASD Chicken Delay with moving

Discussion in 'Plugin Help/Development/Requests' started by BurnerDiamond, May 4, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    BurnerDiamond

    I currently have a custom chicken which I control with WASD, but there's a small bug I can't fix, whenever the mob spawns it takes anywhere between 2-30 seconds for the chicken to move.

    My question is, is there any way to "refresh" my custom chicken? Or maybe fix the delay?

    Thank you

    BurnerDiamond
     
  2. Offline

    mine-care

  3. Offline

    BurnerDiamond

    Sure, here you go:

    Code:
    package me.mounts.mounts;
    
    /**
    * Created by its on 02/05/15.
    */
    
    import net.minecraft.server.v1_8_R2.*;
    import org.bukkit.craftbukkit.v1_8_R2.CraftWorld;
    
    import java.lang.reflect.Field;
    
    public class CustomChicken extends EntityChicken {
    
    
        @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;
                }
                Field jump = null;
                try {
                    jump = EntityLiving.class.getDeclaredField("aY");
                } catch (NoSuchFieldException e1) {
                    jump.setAccessible(true);
                    if (jump != null) {
                        try {
                            if (!jump.getBoolean(this.passenger)) {
                            } else {
                                double jumpHeight = 0.5D;
                                this.motY = jumpHeight;
                            }
                        } catch (IllegalAccessException e) {
                            e.printStackTrace();
                        }
                        this.S = 1.0F;
                        this.aM = this.bI() * 0.1F;
                        if (!this.world.isClientSide) {
                            this.k((float) this.getAttributeInstance(GenericAttributes.d).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);
                    }
    
                }
            }
        }
    
        public CustomChicken(org.bukkit.World world){
    
            super(((CraftWorld) world).getHandle());
    
    
        }
    
    
    }
    Also, the jump field doesn't work.

    Any help?
     
  4. Moved to Bukkit Alternates.
     
  5. Offline

    BurnerDiamond

  6. Offline

    BurnerDiamond

    BUMP! @mine-care
     
Thread Status:
Not open for further replies.

Share This Page