Search in sources :

Example 1 with Float

use of de.Keyle.MyPet.compat.v1_9_R1.entity.ai.movement.Float in project MyPet by xXKeyleXx.

the class EntityMyPet method setPathfinder.

public void setPathfinder() {
    petPathfinderSelector.addGoal("Float", new Float(this));
    petPathfinderSelector.addGoal("Sit", sitPathfinder);
    petPathfinderSelector.addGoal("Sprint", new Sprint(this, 0.25F));
    petPathfinderSelector.addGoal("RangedTarget", new RangedAttack(this, -0.1F, 12.0F));
    petPathfinderSelector.addGoal("MeleeAttack", new MeleeAttack(this, 0.1F, 1.5, 20));
    petPathfinderSelector.addGoal("Control", new Control(this, 0.1F));
    petPathfinderSelector.addGoal("FollowOwner", new FollowOwner(this, Configuration.Misc.MYPET_FOLLOW_START_DISTANCE, 2.0F, 16F));
    petPathfinderSelector.addGoal("LookAtPlayer", new LookAtPlayer(this, 8.0F));
    petPathfinderSelector.addGoal("RandomLockaround", new RandomLookaround(this));
    petTargetSelector.addGoal("OwnerHurtByTarget", new OwnerHurtByTarget(this));
    petTargetSelector.addGoal("OwnerHurtTarget", new OwnerHurtTarget(this));
    petTargetSelector.addGoal("HurtByTarget", new HurtByTarget(this));
    petTargetSelector.addGoal("ControlTarget", new ControlTarget(this, 1));
    petTargetSelector.addGoal("AggressiveTarget", new BehaviorAggressiveTarget(this, 15));
    petTargetSelector.addGoal("FarmTarget", new BehaviorFarmTarget(this, 15));
    petTargetSelector.addGoal("DuelTarget", new BehaviorDuelTarget(this, 5));
}
Also used : RangedAttack(de.Keyle.MyPet.compat.v1_7_R4.entity.ai.attack.RangedAttack) MeleeAttack(de.Keyle.MyPet.compat.v1_7_R4.entity.ai.attack.MeleeAttack) Float(de.Keyle.MyPet.compat.v1_7_R4.entity.ai.movement.Float)

Example 2 with Float

use of de.Keyle.MyPet.compat.v1_9_R1.entity.ai.movement.Float in project MyPet by xXKeyleXx.

the class EntityMyPet method setPathfinder.

public void setPathfinder() {
    petPathfinderSelector.addGoal("Float", new Float(this));
    petPathfinderSelector.addGoal("Sit", sitPathfinder);
    petPathfinderSelector.addGoal("Sprint", new Sprint(this, 0.25F));
    petPathfinderSelector.addGoal("RangedTarget", new RangedAttack(this, -0.1F, 12.0F));
    petPathfinderSelector.addGoal("MeleeAttack", new MeleeAttack(this, 0.1F, 1.5, 20));
    petPathfinderSelector.addGoal("Control", new Control(this, 0.1F));
    petPathfinderSelector.addGoal("FollowOwner", new FollowOwner(this, Configuration.Misc.MYPET_FOLLOW_START_DISTANCE, 2.0F, 16F));
    petPathfinderSelector.addGoal("LookAtPlayer", new LookAtPlayer(this, 8.0F));
    petPathfinderSelector.addGoal("RandomLockaround", new RandomLookaround(this));
    petTargetSelector.addGoal("OwnerHurtByTarget", new OwnerHurtByTarget(this));
    petTargetSelector.addGoal("OwnerHurtTarget", new OwnerHurtTarget(this));
    petTargetSelector.addGoal("HurtByTarget", new HurtByTarget(this));
    petTargetSelector.addGoal("ControlTarget", new ControlTarget(this, 1));
    petTargetSelector.addGoal("AggressiveTarget", new BehaviorAggressiveTarget(this, 15));
    petTargetSelector.addGoal("FarmTarget", new BehaviorFarmTarget(this, 15));
    petTargetSelector.addGoal("DuelTarget", new BehaviorDuelTarget(this, 5));
}
Also used : RangedAttack(de.Keyle.MyPet.compat.v1_8_R2.entity.ai.attack.RangedAttack) MeleeAttack(de.Keyle.MyPet.compat.v1_8_R2.entity.ai.attack.MeleeAttack) Float(de.Keyle.MyPet.compat.v1_8_R2.entity.ai.movement.Float)

Example 3 with Float

use of de.Keyle.MyPet.compat.v1_9_R1.entity.ai.movement.Float in project MyPet by xXKeyleXx.

the class EntityMyPet method setPathfinder.

public void setPathfinder() {
    petPathfinderSelector.addGoal("Float", new Float(this));
    petPathfinderSelector.addGoal("Sit", sitPathfinder);
    petPathfinderSelector.addGoal("Sprint", new Sprint(this, 0.25F));
    petPathfinderSelector.addGoal("RangedTarget", new RangedAttack(this, -0.1F, 12.0F));
    petPathfinderSelector.addGoal("MeleeAttack", new MeleeAttack(this, 0.1F, 1.5, 20));
    petPathfinderSelector.addGoal("Control", new Control(this, 0.1F));
    petPathfinderSelector.addGoal("FollowOwner", new FollowOwner(this, Configuration.Misc.MYPET_FOLLOW_START_DISTANCE, 2.0F, 16F));
    petPathfinderSelector.addGoal("LookAtPlayer", new LookAtPlayer(this, 8.0F));
    petPathfinderSelector.addGoal("RandomLockaround", new RandomLookaround(this));
    petTargetSelector.addGoal("OwnerHurtByTarget", new OwnerHurtByTarget(this));
    petTargetSelector.addGoal("OwnerHurtTarget", new OwnerHurtTarget(this));
    petTargetSelector.addGoal("HurtByTarget", new HurtByTarget(this));
    petTargetSelector.addGoal("ControlTarget", new ControlTarget(this, 1));
    petTargetSelector.addGoal("AggressiveTarget", new BehaviorAggressiveTarget(this, 15));
    petTargetSelector.addGoal("FarmTarget", new BehaviorFarmTarget(this, 15));
    petTargetSelector.addGoal("DuelTarget", new BehaviorDuelTarget(this, 5));
}
Also used : RangedAttack(de.Keyle.MyPet.compat.v1_9_R1.entity.ai.attack.RangedAttack) MeleeAttack(de.Keyle.MyPet.compat.v1_9_R1.entity.ai.attack.MeleeAttack) Float(de.Keyle.MyPet.compat.v1_9_R1.entity.ai.movement.Float)

Example 4 with Float

use of de.Keyle.MyPet.compat.v1_9_R1.entity.ai.movement.Float in project MyPet by xXKeyleXx.

the class EntityMyPet method g.

public void g(float motionSideways, float motionForward) {
    if (!hasRider || !this.isVehicle()) {
        super.g(motionSideways, motionForward);
        return;
    }
    if (this.onGround && this.isFlying) {
        isFlying = false;
        this.fallDistance = 0;
    }
    EntityLiving passenger = (EntityLiving) this.bt();
    if (rideSkill == null) {
        passenger.stopRiding();
        return;
    }
    // apply pitch & yaw
    this.lastYaw = (this.yaw = passenger.yaw);
    this.pitch = passenger.pitch * 0.5F;
    setYawPitch(this.yaw, this.pitch);
    this.aI = (this.aG = this.yaw);
    // get motion from passenger (player)
    motionSideways = passenger.bd * 0.5F;
    motionForward = passenger.be;
    // backwards is slower
    if (motionForward <= 0.0F) {
        motionForward *= 0.25F;
    }
    // sideways is slower too but not as slow as backwards
    motionSideways *= 0.85F;
    float speed = 0.22222F * (1F + (rideSkill.getSpeedPercent() / 100F));
    double jumpHeight = Util.clamp(rideSkill.getJumpHeight(), 0, 10);
    if (Configuration.HungerSystem.USE_HUNGER_SYSTEM && Configuration.HungerSystem.AFFECT_RIDE_SPEED) {
        double factor = Math.log10(myPet.getSaturation()) / 2;
        speed *= factor;
        jumpHeight *= factor;
    }
    // apply motion
    ride(motionSideways, motionForward, speed);
    // throw player move event
    if (Configuration.Misc.THROW_PLAYER_MOVE_EVENT_WHILE_RIDING && !(this instanceof EntityMyHorse)) {
        double delta = Math.pow(this.locX - this.lastX, 2.0D) + Math.pow(this.locY - this.lastY, 2.0D) + Math.pow(this.locZ - this.lastZ, 2.0D);
        float deltaAngle = Math.abs(this.yaw - lastYaw) + Math.abs(this.pitch - lastPitch);
        if (delta > 0.00390625D || deltaAngle > 10.0F) {
            Location to = getBukkitEntity().getLocation();
            Location from = new Location(world.getWorld(), this.lastX, this.lastY, this.lastZ, this.lastYaw, this.lastPitch);
            if (from.getX() != Double.MAX_VALUE) {
                Location oldTo = to.clone();
                PlayerMoveEvent event = new PlayerMoveEvent((Player) passenger.getBukkitEntity(), from, to);
                Bukkit.getPluginManager().callEvent(event);
                if (event.isCancelled()) {
                    passenger.getBukkitEntity().teleport(from);
                    return;
                }
                if ((!oldTo.equals(event.getTo())) && (!event.isCancelled())) {
                    passenger.getBukkitEntity().teleport(event.getTo(), PlayerTeleportEvent.TeleportCause.UNKNOWN);
                    return;
                }
            }
        }
    }
    if (jump != null && this.isVehicle()) {
        boolean doJump = false;
        if (this instanceof IJumpable) {
            if (this.jumpPower > 0.0F) {
                doJump = true;
                this.jumpPower = 0.0F;
            }
        } else {
            if (jump != null) {
                try {
                    doJump = jump.getBoolean(passenger);
                } catch (IllegalAccessException ignored) {
                }
            }
        }
        if (doJump) {
            if (onGround) {
                String jumpHeightString = JumpHelper.JUMP_FORMAT.format(jumpHeight);
                Double jumpVelocity = JumpHelper.JUMP_MAP.get(jumpHeightString);
                jumpVelocity = jumpVelocity == null ? 0.44161199999510264 : jumpVelocity;
                if (this instanceof IJumpable) {
                    getAttributeInstance(EntityHorse.attributeJumpStrength).setValue(jumpVelocity);
                }
                this.motY = jumpVelocity;
            }
        }
    }
    if (Configuration.HungerSystem.USE_HUNGER_SYSTEM && Configuration.Skilltree.Skill.Ride.HUNGER_PER_METER > 0) {
        double dX = locX - lastX;
        double dY = Math.max(0, locY - lastY);
        double dZ = locZ - lastZ;
        if (dX != 0 || dY != 0 || dZ != 0) {
            double distance = Math.sqrt(dX * dX + dY * dY + dZ * dZ);
            myPet.decreaseSaturation(Configuration.Skilltree.Skill.Ride.HUNGER_PER_METER * distance);
            double factor = Math.log10(myPet.getSaturation()) / 2;
            getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue((0.22222F * (1F + (rideSkill.getSpeedPercent() / 100F))) * factor);
        }
    }
}
Also used : EntityMyHorse(de.Keyle.MyPet.compat.v1_9_R1.entity.types.EntityMyHorse) PlayerMoveEvent(org.bukkit.event.player.PlayerMoveEvent) Location(org.bukkit.Location)

Example 5 with Float

use of de.Keyle.MyPet.compat.v1_9_R1.entity.ai.movement.Float in project MyPet by xXKeyleXx.

the class EntityMyPet method setPathfinder.

public void setPathfinder() {
    petPathfinderSelector.addGoal("Float", new Float(this));
    petPathfinderSelector.addGoal("Sit", sitPathfinder);
    petPathfinderSelector.addGoal("Sprint", new Sprint(this, 0.25F));
    petPathfinderSelector.addGoal("RangedTarget", new RangedAttack(this, -0.1F, 12.0F));
    petPathfinderSelector.addGoal("MeleeAttack", new MeleeAttack(this, 0.1F, 1.5, 20));
    petPathfinderSelector.addGoal("Control", new Control(this, 0.1F));
    petPathfinderSelector.addGoal("FollowOwner", new FollowOwner(this, Configuration.Misc.MYPET_FOLLOW_START_DISTANCE, 2.0F, 16F));
    petPathfinderSelector.addGoal("LookAtPlayer", new LookAtPlayer(this, 8.0F));
    petPathfinderSelector.addGoal("RandomLockaround", new RandomLookaround(this));
    petTargetSelector.addGoal("OwnerHurtByTarget", new OwnerHurtByTarget(this));
    petTargetSelector.addGoal("OwnerHurtTarget", new OwnerHurtTarget(this));
    petTargetSelector.addGoal("HurtByTarget", new HurtByTarget(this));
    petTargetSelector.addGoal("ControlTarget", new ControlTarget(this, 1));
    petTargetSelector.addGoal("AggressiveTarget", new BehaviorAggressiveTarget(this, 15));
    petTargetSelector.addGoal("FarmTarget", new BehaviorFarmTarget(this, 15));
    petTargetSelector.addGoal("DuelTarget", new BehaviorDuelTarget(this, 5));
}
Also used : RangedAttack(de.Keyle.MyPet.compat.v1_10_R1.entity.ai.attack.RangedAttack) MeleeAttack(de.Keyle.MyPet.compat.v1_10_R1.entity.ai.attack.MeleeAttack) Float(de.Keyle.MyPet.compat.v1_10_R1.entity.ai.movement.Float)

Aggregations

MeleeAttack (de.Keyle.MyPet.compat.v1_10_R1.entity.ai.attack.MeleeAttack)1 RangedAttack (de.Keyle.MyPet.compat.v1_10_R1.entity.ai.attack.RangedAttack)1 Float (de.Keyle.MyPet.compat.v1_10_R1.entity.ai.movement.Float)1 MeleeAttack (de.Keyle.MyPet.compat.v1_11_R1.entity.ai.attack.MeleeAttack)1 RangedAttack (de.Keyle.MyPet.compat.v1_11_R1.entity.ai.attack.RangedAttack)1 Float (de.Keyle.MyPet.compat.v1_11_R1.entity.ai.movement.Float)1 MeleeAttack (de.Keyle.MyPet.compat.v1_12_R1.entity.ai.attack.MeleeAttack)1 RangedAttack (de.Keyle.MyPet.compat.v1_12_R1.entity.ai.attack.RangedAttack)1 Float (de.Keyle.MyPet.compat.v1_12_R1.entity.ai.movement.Float)1 MeleeAttack (de.Keyle.MyPet.compat.v1_16_R1.entity.ai.attack.MeleeAttack)1 RangedAttack (de.Keyle.MyPet.compat.v1_16_R1.entity.ai.attack.RangedAttack)1 Float (de.Keyle.MyPet.compat.v1_16_R1.entity.ai.movement.Float)1 MeleeAttack (de.Keyle.MyPet.compat.v1_16_R3.entity.ai.attack.MeleeAttack)1 RangedAttack (de.Keyle.MyPet.compat.v1_16_R3.entity.ai.attack.RangedAttack)1 Float (de.Keyle.MyPet.compat.v1_16_R3.entity.ai.movement.Float)1 MeleeAttack (de.Keyle.MyPet.compat.v1_7_R4.entity.ai.attack.MeleeAttack)1 RangedAttack (de.Keyle.MyPet.compat.v1_7_R4.entity.ai.attack.RangedAttack)1 Float (de.Keyle.MyPet.compat.v1_7_R4.entity.ai.movement.Float)1 MeleeAttack (de.Keyle.MyPet.compat.v1_8_R1.entity.ai.attack.MeleeAttack)1 RangedAttack (de.Keyle.MyPet.compat.v1_8_R1.entity.ai.attack.RangedAttack)1