Development Assistance WASD Chicken Follows Direction But Doesn't Move

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

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

    BurnerDiamond

    I have my custom chicken which follows the the direction but doesn't move when I push the keys.

    Any help?

    Here is the CustomChicken Class.

    It's set to have no pathfinders at all, except this one.

    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;
    import java.util.List;
    
    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());
    
            List goalB = (List) Utils.getPrivateField("b", PathfinderGoalSelector.class, goalSelector);
            goalB.clear();
            List goalC = (List) Utils.getPrivateField("c", PathfinderGoalSelector.class, goalSelector);
            goalC.clear();
            List targetB = (List) Utils.getPrivateField("b", PathfinderGoalSelector.class, targetSelector);
            targetB.clear();
            List targetC = (List) Utils.getPrivateField("c", PathfinderGoalSelector.class, targetSelector);
            targetC.clear();
    
    
        }
    }
    Any help?
     
  2. Well, it's been a while since I've used custom nms entities, but I thought when you clear an entity's goal selectors, you also remove their ability to walk, so you might need to clear the goals but add some too
     
  3. Offline

    timtower Administrator Administrator Moderator

    Moved to Bukkit alternatives
     
  4. Offline

    BurnerDiamond

    Why is this in the alternatives?

    It's all bukkit related isn't it and I'm requesting help with a plugin? Therefore develop,met?
     
  5. Offline

    mrCookieSlime

    It is Spigot related, not Bukkit.
    Bukkit 1.8 was developed by the Spigot Team and is therefore considered an Alternative
     
  6. Offline

    BurnerDiamond

    Completely forgot I was using spigot my bad.
     
Thread Status:
Not open for further replies.

Share This Page