Fixed LivingEntityMixin

This commit is contained in:
Frank Bauer 2021-06-24 12:50:22 +02:00
parent 8555931932
commit f6cbb15917

View file

@ -99,7 +99,7 @@ public abstract class LivingEntityMixin extends Entity {
this.lastAttacker = source.getEntity();
}
@ModifyArg(method = "hurt", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;knockback(FDD)V"))
@ModifyArg(method = "hurt", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;knockback(DDD)V"))
private float be_increaseKnockback(float value, double x, double z) {
if (lastAttacker != null && lastAttacker instanceof LivingEntity) {
LivingEntity attacker = (LivingEntity) lastAttacker;
@ -144,9 +144,9 @@ public abstract class LivingEntityMixin extends Entity {
Vec3 lookAngle = getLookAngle();
double d = 0.08D;
float rotX = xRot * 0.017453292F;
float rotX = getXRot() * 0.017453292F;
double k = Math.sqrt(lookAngle.x * lookAngle.x + lookAngle.z * lookAngle.z);
double l = Math.sqrt(getHorizontalDistanceSqr(moveDelta));
double l = moveDelta.horizontalDistance();
double lookLen = lookAngle.length();
float n = Mth.cos(rotX);
n = (float) (n * n * Math.min(1.0D, lookLen / 0.4D));
@ -172,7 +172,7 @@ public abstract class LivingEntityMixin extends Entity {
move(MoverType.SELF, moveDelta);
if (!level.isClientSide) {
if (horizontalCollision) {
coef = Math.sqrt(getHorizontalDistanceSqr(moveDelta));
coef = moveDelta.horizontalDistance();
double r = l - coef;
float dmg = (float) (r * 10.0D - 3.0D);
if (dmg > 0.0F) {