Search in sources :

Example 1 with EntityNavigation

use of net.minecraft.entity.ai.pathing.EntityNavigation in project roadrunner by MaxNeedsSnacks.

the class ServerWorldMixin method stopListeningOnEntityUnload.

@Redirect(// forge replaces this with their own method
method = "removeEntityComplete", remap = false, at = @At(value = "INVOKE", target = "Ljava/util/Set;remove(Ljava/lang/Object;)Z"))
private boolean stopListeningOnEntityUnload(Set<EntityNavigation> set, Object navigation) {
    EntityNavigation entityNavigation = (EntityNavigation) navigation;
    ((EntityNavigationExtended) entityNavigation).setRegisteredToWorld(false);
    this.activeEntityNavigations.remove(entityNavigation);
    return set.remove(entityNavigation);
}
Also used : EntityNavigation(net.minecraft.entity.ai.pathing.EntityNavigation) EntityNavigationExtended(me.jellysquid.mods.lithium.common.entity.EntityNavigationExtended) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Example 2 with EntityNavigation

use of net.minecraft.entity.ai.pathing.EntityNavigation in project Sprout by Toadstool-Studios.

the class FindWaterGoal method start.

@Override
public void start() {
    super.start();
    if (targetPosition != null) {
        EntityNavigation nav = elephant.getNavigation();
        nav.startMovingTo(targetPosition.getX() + 0.5, targetPosition.getY() + 0.75, targetPosition.getZ() + 0.5, 0.3);
    }
}
Also used : EntityNavigation(net.minecraft.entity.ai.pathing.EntityNavigation)

Example 3 with EntityNavigation

use of net.minecraft.entity.ai.pathing.EntityNavigation in project friends-and-foes by Faboslav.

the class GlareFlyToDarkSpotGoal method tick.

@Override
public void tick() {
    this.runTicks++;
    EntityNavigation navigation = this.glare.getNavigation();
    double distanceToDarkSpot = this.glare.getPos().squaredDistanceTo(this.darkSpot.getX(), this.darkSpot.getY(), this.darkSpot.getZ());
    this.currentPath = navigation.findPathTo(this.darkSpot.getX(), this.darkSpot.getY(), this.darkSpot.getZ(), 0);
    if (this.currentPath != null) {
        this.glare.getNavigation().startMovingAlong(this.currentPath, this.glare.getMovementSpeed());
    }
    if (distanceToDarkSpot >= 1.0D) {
        if (this.glare.isGrumpy()) {
            this.glare.setGrumpy(false);
        }
        return;
    }
    LivingEntity owner = this.glare.getOwner();
    if (owner == null) {
        return;
    }
    this.grumpyTicks++;
    if (!this.glare.isGrumpy()) {
        this.glare.setGrumpy(true);
    }
    if (grumpyTicks == 10) {
        this.glare.playGrumpinessSound();
    }
    if (grumpyTicks % 5 == 0) {
        this.glare.playRustleSound();
    }
    if (grumpyTicks % 10 == 0) {
        this.glare.spawnParticles(new BlockStateParticleEffect(ParticleTypes.BLOCK, Blocks.AZALEA.getDefaultState()), 7);
    }
    this.glare.getLookControl().lookAt(owner.getPos());
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) EntityNavigation(net.minecraft.entity.ai.pathing.EntityNavigation) BlockStateParticleEffect(net.minecraft.particle.BlockStateParticleEffect)

Example 4 with EntityNavigation

use of net.minecraft.entity.ai.pathing.EntityNavigation in project LittleMaidReBirth-Fabric by SistrScarlet.

the class FixedMoveControl method canWalkable.

protected boolean canWalkable(int x, int y, int z) {
    EntityNavigation nav = this.entity.getNavigation();
    PathNodeMaker pathNode = nav.getNodeMaker();
    return pathNode.getDefaultNodeType(this.entity.world, x, y, z) == PathNodeType.WALKABLE;
}
Also used : EntityNavigation(net.minecraft.entity.ai.pathing.EntityNavigation) PathNodeMaker(net.minecraft.entity.ai.pathing.PathNodeMaker)

Example 5 with EntityNavigation

use of net.minecraft.entity.ai.pathing.EntityNavigation in project roadrunner by MaxNeedsSnacks.

the class ServerWorldMixin method startListeningOnEntityLoad.

@Redirect(method = "loadEntityUnchecked", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/mob/MobEntity;getNavigation()Lnet/minecraft/entity/ai/pathing/EntityNavigation;"))
private EntityNavigation startListeningOnEntityLoad(MobEntity mobEntity) {
    EntityNavigation navigation = mobEntity.getNavigation();
    ((EntityNavigationExtended) navigation).setRegisteredToWorld(true);
    if (navigation.getCurrentPath() != null) {
        this.activeEntityNavigations.add(navigation);
    }
    return navigation;
}
Also used : EntityNavigation(net.minecraft.entity.ai.pathing.EntityNavigation) EntityNavigationExtended(me.jellysquid.mods.lithium.common.entity.EntityNavigationExtended) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Aggregations

EntityNavigation (net.minecraft.entity.ai.pathing.EntityNavigation)10 Redirect (org.spongepowered.asm.mixin.injection.Redirect)4 ServerWorldExtended (me.jellysquid.mods.lithium.common.world.ServerWorldExtended)3 EntityNavigationExtended (me.jellysquid.mods.lithium.common.entity.EntityNavigationExtended)2 NavigatingEntity (me.jellysquid.mods.lithium.common.entity.NavigatingEntity)2 MobEntity (net.minecraft.entity.mob.MobEntity)2 LivingEntity (net.minecraft.entity.LivingEntity)1 LongJumpTask (net.minecraft.entity.ai.brain.task.LongJumpTask)1 PathNodeMaker (net.minecraft.entity.ai.pathing.PathNodeMaker)1 BlockStateParticleEffect (net.minecraft.particle.BlockStateParticleEffect)1 BlockPos (net.minecraft.util.math.BlockPos)1 Vec3d (net.minecraft.util.math.Vec3d)1 Overwrite (org.spongepowered.asm.mixin.Overwrite)1