Search in sources :

Example 1 with EntityMyAquaticPet

use of de.Keyle.MyPet.compat.v1_17_R1.entity.EntityMyAquaticPet in project MyPet by xXKeyleXx.

the class VanillaNavigation method tick.

@Override
public void tick() {
    // This switches between movesets enabling the pet to move naturally on land and water
    EntityMyPet petEntity = (EntityMyPet) this.entityMyPet;
    if (petEntity.isInWaterOrBubble() && this.entityMyPet instanceof EntityMyAquaticPet && !(petEntity.getMoveControl() instanceof MyPetAquaticMoveControl)) {
        petEntity.switchMovement(new MyPetAquaticMoveControl(petEntity));
    } else if (!petEntity.isInWaterOrBubble() && petEntity.getMoveControl() instanceof MyPetAquaticMoveControl) {
        petEntity.switchMovement(new MoveControl(petEntity));
    }
    nav.tick();
}
Also used : EntityMyPet(de.Keyle.MyPet.compat.v1_18_R1.entity.EntityMyPet) MyPetAquaticMoveControl(de.Keyle.MyPet.compat.v1_18_R1.entity.ai.movement.MyPetAquaticMoveControl) EntityMyAquaticPet(de.Keyle.MyPet.compat.v1_18_R1.entity.EntityMyAquaticPet) MoveControl(net.minecraft.world.entity.ai.control.MoveControl) MyPetAquaticMoveControl(de.Keyle.MyPet.compat.v1_18_R1.entity.ai.movement.MyPetAquaticMoveControl)

Example 2 with EntityMyAquaticPet

use of de.Keyle.MyPet.compat.v1_17_R1.entity.EntityMyAquaticPet in project MyPet by xXKeyleXx.

the class VanillaNavigation method tick.

@Override
public void tick() {
    // This switches between movesets enabling the pet to move naturally on land and water
    EntityMyPet petEntity = (EntityMyPet) this.entityMyPet;
    if (petEntity.isInWaterOrBubble() && this.entityMyPet instanceof EntityMyAquaticPet && !(petEntity.getMoveControl() instanceof MyPetAquaticMoveControl)) {
        petEntity.switchMovement(new MyPetAquaticMoveControl(petEntity));
    } else if (!petEntity.isInWaterOrBubble() && petEntity.getMoveControl() instanceof MyPetAquaticMoveControl) {
        petEntity.switchMovement(new MoveControl(petEntity));
    }
    nav.tick();
}
Also used : EntityMyPet(de.Keyle.MyPet.compat.v1_17_R1.entity.EntityMyPet) MyPetAquaticMoveControl(de.Keyle.MyPet.compat.v1_17_R1.entity.ai.movement.MyPetAquaticMoveControl) EntityMyAquaticPet(de.Keyle.MyPet.compat.v1_17_R1.entity.EntityMyAquaticPet) MoveControl(net.minecraft.world.entity.ai.control.MoveControl) MyPetAquaticMoveControl(de.Keyle.MyPet.compat.v1_17_R1.entity.ai.movement.MyPetAquaticMoveControl)

Aggregations

MoveControl (net.minecraft.world.entity.ai.control.MoveControl)2 EntityMyAquaticPet (de.Keyle.MyPet.compat.v1_17_R1.entity.EntityMyAquaticPet)1 EntityMyPet (de.Keyle.MyPet.compat.v1_17_R1.entity.EntityMyPet)1 MyPetAquaticMoveControl (de.Keyle.MyPet.compat.v1_17_R1.entity.ai.movement.MyPetAquaticMoveControl)1 EntityMyAquaticPet (de.Keyle.MyPet.compat.v1_18_R1.entity.EntityMyAquaticPet)1 EntityMyPet (de.Keyle.MyPet.compat.v1_18_R1.entity.EntityMyPet)1 MyPetAquaticMoveControl (de.Keyle.MyPet.compat.v1_18_R1.entity.ai.movement.MyPetAquaticMoveControl)1