优化代码

This commit is contained in:
17146 2025-05-14 13:52:37 +08:00 committed by Light_Quanta
parent 4e8fae569d
commit 76bb21c602
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959

View file

@ -1,25 +1,3 @@
//@Mixin(Entity.class)
//public class EntityMixin {
// TODO 优化后续逻辑
// @Redirect(method = "turn(DD)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;setXRot(F)V", ordinal = 1))
// public void turn(Entity instance, float pXRot) {
// if (instance instanceof Player player) {
// player.setXRot(player.getXRot());
// while (player.getXRot() > 180F) {
// player.setXRot(player.getXRot() - 360F);
// }
// while (player.getYRot() <= -180F) {
// player.setXRot(player.getXRot() + 360F);
// }
// } else {
// instance.setXRot(Mth.clamp(instance.getXRot(), -90.0F, 90.0F));
// }
// }
//}
package com.atsuishio.superbwarfare.mixins;
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
@ -59,4 +37,20 @@ public class EntityMixin {
MobileVehicleEntity.IGNORE_ENTITY_GROUND_CHECK_STEPPING = false;
}
}
// TODO 优化后续逻辑
// @Redirect(method = "turn(DD)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;setXRot(F)V", ordinal = 1))
// public void turn(Entity instance, float pXRot) {
// if (instance instanceof Player player) {
// player.setXRot(player.getXRot());
// while (player.getXRot() > 180F) {
// player.setXRot(player.getXRot() - 360F);
// }
// while (player.getYRot() <= -180F) {
// player.setXRot(player.getXRot() + 360F);
// }
// } else {
// instance.setXRot(Mth.clamp(instance.getXRot(), -90.0F, 90.0F));
// }
// }
}