File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
src/main/java/de/erethon/aether/creature Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 4343import net .minecraft .server .level .ServerLevel ;
4444import net .minecraft .sounds .SoundEvents ;
4545import net .minecraft .sounds .SoundSource ;
46+ import net .minecraft .util .Mth ;
4647import net .minecraft .world .InteractionHand ;
4748import net .minecraft .world .InteractionResult ;
4849import net .minecraft .world .damagesource .DamageSource ;
@@ -156,8 +157,12 @@ public void addToWorld() {
156157 @ Override
157158 public void tick () {
158159 super .tick ();
160+ float headBodyDiff = Mth .wrapDegrees (yHeadRot - yBodyRot );
161+ if (Math .abs (headBodyDiff ) > 30.0f ) {
162+ yBodyRot += headBodyDiff * 0.3f ;
163+ }
159164 getBukkitLivingEntity ().setMaxEnergy (100 );
160- getBukkitLivingEntity ().setEnergy (100 ); // Mobs have infinite energy
165+ getBukkitLivingEntity ().setEnergy (100 );
161166 }
162167
163168 private void logDebug (String message ) {
Original file line number Diff line number Diff line change @@ -116,13 +116,16 @@ public float getPreciseBodyRotation(float partialTick) {
116116 @ Override
117117 public void lookAt (Entity entity , float maxYRotIncrease , float maxXRotIncrease ) {
118118 super .lookAt (entity , maxYRotIncrease , maxXRotIncrease );
119- yBodyRot = Mth .rotateIfNecessary (yBodyRot , yHeadRot , maxYRotIncrease );
119+ yBodyRot = Mth .rotateIfNecessary (yBodyRot , yHeadRot , maxYRotIncrease * 0.5f );
120120 }
121121
122122 @ Override
123123 public void tick () {
124124 super .tick ();
125- // Rotate the NPC
125+ float headBodyDiff = Mth .wrapDegrees (yHeadRot - yBodyRot );
126+ if (Math .abs (headBodyDiff ) > 30.0f ) {
127+ yBodyRot += headBodyDiff * 0.3f ;
128+ }
126129 setYRot (yBodyRot );
127130 }
128131
You can’t perform that action at this time.
0 commit comments