Commit 7e75e9e2 by Jonathan Thomas

Small refactor of LookControls naming. Verified the code also supports MagmaCubeEntity instances

parent 3ba6c909
Pipeline #11968 passed with stage
in 28 seconds
...@@ -49,7 +49,7 @@ public class FollowPlayerGoal extends Goal { ...@@ -49,7 +49,7 @@ public class FollowPlayerGoal extends Goal {
// Check if the entity is further away than 4 blocks (16 when squared) // Check if the entity is further away than 4 blocks (16 when squared)
if (squaredDistanceToPlayer > 16) { if (squaredDistanceToPlayer > 16) {
// Entity is more than 4 blocks away, look at the player and start moving towards them // Entity is more than 4 blocks away, look at the player and start moving towards them
EntityLook.LookAtEntity(this.targetPlayer, this.entity); LookControls.LookAtEntity(this.targetPlayer, this.entity);
this.navigation.startMovingTo(this.targetPlayer, this.speed); this.navigation.startMovingTo(this.targetPlayer, this.speed);
} else if (squaredDistanceToPlayer < 9) { } else if (squaredDistanceToPlayer < 9) {
// Entity is closer than 3 blocks, stop moving to maintain distance // Entity is closer than 3 blocks, stop moving to maintain distance
......
...@@ -6,10 +6,10 @@ import net.minecraft.server.network.ServerPlayerEntity; ...@@ -6,10 +6,10 @@ import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
/** /**
* The {@code EntityLook} class allows an entity to look at the player, with some custom fixes * The {@code LookControls} class allows an entity to look at the player, with some custom fixes
* for certain mobs that refuse to use the normal LookControls (i.e. Slime). * for certain mobs that refuse to use the normal LookControls (i.e. Slime).
*/ */
public class EntityLook { public class LookControls {
public static void LookAtEntity(ServerPlayerEntity player, MobEntity entity) { public static void LookAtEntity(ServerPlayerEntity player, MobEntity entity) {
// Make the entity look at the player without moving towards them // Make the entity look at the player without moving towards them
......
...@@ -50,7 +50,7 @@ public class TalkPlayerGoal extends Goal { ...@@ -50,7 +50,7 @@ public class TalkPlayerGoal extends Goal {
@Override @Override
public void tick() { public void tick() {
// Make the entity look at the player without moving towards them // Make the entity look at the player without moving towards them
EntityLook.LookAtEntity(this.targetPlayer, this.entity); LookControls.LookAtEntity(this.targetPlayer, this.entity);
// Continuously stop the entity's navigation to ensure it remains stationary // Continuously stop the entity's navigation to ensure it remains stationary
this.navigation.stop(); this.navigation.stop();
} }
......
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