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);
}
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);
}
}
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());
}
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;
}
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;
}
Aggregations