Skip to content

Commit

Permalink
tiny mixin optimization
Browse files Browse the repository at this point in the history
thanks to @LlamaLad7
  • Loading branch information
UpcraftLP committed Apr 14, 2024
1 parent ed61b77 commit 8ea2c10
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;

@SuppressWarnings("UnreachableCode")
@Mixin(Entity.class)
public abstract class EntityMixin {

Expand All @@ -18,15 +19,15 @@ public abstract class EntityMixin {

@ModifyExpressionValue(method = "turn", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;clamp(FFF)F", ordinal = 0))
private float icarus$updateLookDirection(float original) {
if(Entity.class.cast(this) instanceof LivingEntity living) {
if(((Object) this) instanceof LivingEntity living) {
return IcarusHelper.hasWings.test(living) ? Mth.wrapDegrees(this.getXRot()) : original;
}
return original;
}

@ModifyExpressionValue(method = "turn", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;clamp(FFF)F", ordinal = 1))
private float icarus$updateLookDirection0(float original) {
if (Entity.class.cast(this) instanceof LivingEntity living) {
if (((Object) this) instanceof LivingEntity living) {
return IcarusHelper.hasWings.test(living) ? Mth.wrapDegrees(this.xRotO) : original;
}
return original;
Expand Down

0 comments on commit 8ea2c10

Please sign in to comment.