Skip to content

Commit

Permalink
Fix some crashing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaider10 committed Oct 19, 2021
1 parent 5a0e7b2 commit 796ca66
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
)
public abstract class EndermanEntity$ChasePlayerGoalMixin {
@Redirect(
method = "tick",
method = "Lnet/minecraft/entity/mob/EndermanEntity$ChasePlayerGoal;tick()V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/LivingEntity;getEyeY()D",
Expand All @@ -29,7 +29,7 @@ private double redirect_tick_getEyeY_0(LivingEntity livingEntity) {
}

@Redirect(
method = "tick",
method = "Lnet/minecraft/entity/mob/EndermanEntity$ChasePlayerGoal;tick()V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/LivingEntity;getX()D",
Expand All @@ -46,7 +46,7 @@ private double redirect_tick_getX_0(LivingEntity livingEntity) {
}

@Redirect(
method = "tick",
method = "Lnet/minecraft/entity/mob/EndermanEntity$ChasePlayerGoal;tick()V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/LivingEntity;getZ()D",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,10 @@ protected PlayerEntityMixin(EntityType<? extends LivingEntity> entityType, World

// Keep world looking direction when changing gravity
if(this.gravitychanger$prevGravityDirection != null) {
if((Object) this instanceof ClientPlayerEntity) {
Vec2f worldAngles = RotationUtil.rotPlayerToWorld(this.getYaw(), this.getPitch(), currentGravityDirection);
Vec2f newViewAngles = RotationUtil.rotWorldToPlayer(worldAngles.x, worldAngles.y, newGravityDirection);
this.setYaw(newViewAngles.x);
this.setPitch(newViewAngles.y);
}
Vec2f worldAngles = RotationUtil.rotPlayerToWorld(this.getYaw(), this.getPitch(), currentGravityDirection);
Vec2f newViewAngles = RotationUtil.rotWorldToPlayer(worldAngles.x, worldAngles.y, newGravityDirection);
this.setYaw(newViewAngles.x);
this.setPitch(newViewAngles.y);
}

// Keep world velocity when changing gravity
Expand Down

0 comments on commit 796ca66

Please sign in to comment.