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
532d6779
Commit
532d6779
authored
Apr 11, 2024
by
Jonathan Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Vex support to look controls, and made Ghast stop further back from player
parent
ce7ba7b6
Pipeline
#11975
passed with stage
in 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
LookControls.java
src/main/java/com/owlmaddie/controls/LookControls.java
+8
-7
No files found.
src/main/java/com/owlmaddie/controls/LookControls.java
View file @
532d6779
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
,
10
F
);
}
else
if
(
entity
instanceof
FlyingEntity
||
entity
instanceof
VexEntity
)
{
handleFlyingEntity
(
entity
,
player
,
4
F
);
}
else
{
// Make the entity look at the player
entity
.
getLookControl
().
lookAt
(
player
,
10.0
F
,
(
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
<
9
F
)
{
if
(
distanceToPlayer
<
stopDistance
)
{
// Stop motion when close
flyingEntity
.
setVelocity
(
0
,
0
,
0
);
}
...
...
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