Commit 532d6779 by Jonathan Thomas

Added Vex support to look controls, and made Ghast stop further back from player

parent ce7ba7b6
Pipeline #11975 passed with stage
in 20 seconds
package com.owlmaddie.controls;
import net.minecraft.entity.mob.FlyingEntity;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.mob.SlimeEntity;
import net.minecraft.entity.boss.dragon.EnderDragonEntity;
import net.minecraft.entity.mob.*;
import net.minecraft.entity.passive.SquidEntity;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.math.MathHelper;
......@@ -18,8 +17,10 @@ public class LookControls {
handleSlimeLook((SlimeEntity) entity, player);
} else if (entity instanceof SquidEntity) {
handleSquidLook((SquidEntity) entity, player);
} else if (entity instanceof FlyingEntity) {
handleFlyingEntity((FlyingEntity) entity, player);
} else if (entity instanceof GhastEntity) {
handleFlyingEntity(entity, player, 10F);
} else if (entity instanceof FlyingEntity || entity instanceof VexEntity) {
handleFlyingEntity(entity, player, 4F);
} else {
// Make the entity look at the player
entity.getLookControl().lookAt(player, 10.0F, (float)entity.getMaxLookPitchChange());
......@@ -48,7 +49,7 @@ public class LookControls {
}
// Ghast, Phantom, etc...
private static void handleFlyingEntity(FlyingEntity flyingEntity, ServerPlayerEntity player) {
private static void handleFlyingEntity(MobEntity flyingEntity, ServerPlayerEntity player, float stopDistance) {
Vec3d playerPosition = player.getPos();
Vec3d flyingPosition = flyingEntity.getPos();
Vec3d toPlayer = playerPosition.subtract(flyingPosition).normalize();
......@@ -68,7 +69,7 @@ public class LookControls {
);
double distanceToPlayer = flyingEntity.getPos().distanceTo(player.getPos());
if (distanceToPlayer < 9F) {
if (distanceToPlayer < stopDistance) {
// Stop motion when close
flyingEntity.setVelocity(0, 0, 0);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment