Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
CreatureChat
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Public
CreatureChat
Commits
7e75e9e2
Commit
7e75e9e2
authored
Apr 09, 2024
by
Jonathan Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small refactor of LookControls naming. Verified the code also supports MagmaCubeEntity instances
parent
3ba6c909
Pipeline
#11968
passed with stage
in 28 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
FollowPlayerGoal.java
src/main/java/com/owlmaddie/goals/FollowPlayerGoal.java
+1
-1
LookControls.java
src/main/java/com/owlmaddie/goals/LookControls.java
+2
-2
TalkPlayerGoal.java
src/main/java/com/owlmaddie/goals/TalkPlayerGoal.java
+1
-1
No files found.
src/main/java/com/owlmaddie/goals/FollowPlayerGoal.java
View file @
7e75e9e2
...
...
@@ -49,7 +49,7 @@ public class FollowPlayerGoal extends Goal {
// Check if the entity is further away than 4 blocks (16 when squared)
if
(
squaredDistanceToPlayer
>
16
)
{
// 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
);
}
else
if
(
squaredDistanceToPlayer
<
9
)
{
// Entity is closer than 3 blocks, stop moving to maintain distance
...
...
src/main/java/com/owlmaddie/goals/
EntityLook
.java
→
src/main/java/com/owlmaddie/goals/
LookControls
.java
View file @
7e75e9e2
...
...
@@ -6,10 +6,10 @@ import net.minecraft.server.network.ServerPlayerEntity;
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).
*/
public
class
EntityLook
{
public
class
LookControls
{
public
static
void
LookAtEntity
(
ServerPlayerEntity
player
,
MobEntity
entity
)
{
// Make the entity look at the player without moving towards them
...
...
src/main/java/com/owlmaddie/goals/TalkPlayerGoal.java
View file @
7e75e9e2
...
...
@@ -50,7 +50,7 @@ public class TalkPlayerGoal extends Goal {
@Override
public
void
tick
()
{
// 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
this
.
navigation
.
stop
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment