修复C4朝北吸附时角度不正确的问题

This commit is contained in:
Light_Quanta 2025-03-21 02:39:17 +08:00
parent d6254b1eca
commit 041cd296e0
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959

View file

@ -40,7 +40,6 @@ import software.bernie.geckolib.util.GeckoLibUtil;
import javax.annotation.Nullable; import javax.annotation.Nullable;
// TODO 修复朝北吸附时角度不正确的问题
public class C4Entity extends Projectile implements GeoEntity { public class C4Entity extends Projectile implements GeoEntity {
protected static final EntityDataAccessor<String> LAST_ATTACKER_UUID = SynchedEntityData.defineId(C4Entity.class, EntityDataSerializers.STRING); protected static final EntityDataAccessor<String> LAST_ATTACKER_UUID = SynchedEntityData.defineId(C4Entity.class, EntityDataSerializers.STRING);
@ -161,7 +160,7 @@ public class C4Entity extends Projectile implements GeoEntity {
} }
Vec3 motion = this.getDeltaMovement(); Vec3 motion = this.getDeltaMovement();
if (this.xRotO == 0.0F && this.yRotO == 0.0F) { if (this.xRotO == 0.0F && this.yRotO == 0.0F && !this.inGround) {
double d0 = motion.horizontalDistance(); double d0 = motion.horizontalDistance();
this.setYRot((float) (Mth.atan2(motion.x, motion.z) * (double) (180F / (float) Math.PI))); this.setYRot((float) (Mth.atan2(motion.x, motion.z) * (double) (180F / (float) Math.PI)));
this.setXRot((float) (Mth.atan2(motion.y, d0) * (double) (180F / (float) Math.PI))); this.setXRot((float) (Mth.atan2(motion.y, d0) * (double) (180F / (float) Math.PI)));