载具在水面上会自动回正,微调汤姆操控,调整二次灾变上弹时间点
This commit is contained in:
parent
92c8838613
commit
986a385478
3 changed files with 74 additions and 63 deletions
|
@ -47,6 +47,7 @@ import javax.annotation.ParametersAreNonnullByDefault;
|
|||
public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
||||
public static final EntityDataAccessor<Boolean> MELON = SynchedEntityData.defineId(Tom6Entity.class, EntityDataSerializers.BOOLEAN);
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
private float yRotSync;
|
||||
|
||||
|
||||
public Tom6Entity(EntityType<Tom6Entity> type, Level world) {
|
||||
|
@ -182,10 +183,15 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
|||
|
||||
float addY = Mth.clamp(Math.min((this.onGround() ? 1.5f : 0.9f) * (float) Math.max(getDeltaMovement().length() - 0.06, 0.1), 0.9f) * diffY - 0.5f * this.entityData.get(DELTA_ROT), -3 * (roll + 1), 3 * (roll + 1));
|
||||
float addX = Mth.clamp(Math.min((float) Math.max(getDeltaMovement().length() - 0.1, 0.01), 0.9f) * diffX, -4, 4);
|
||||
float addZ = this.entityData.get(DELTA_ROT) + (this.onGround() ? 0 : 0.01f) * diffY * (float) getDeltaMovement().length();
|
||||
|
||||
this.setYRot(this.getYRot() + addY);
|
||||
float i = getXRot() / 90;
|
||||
|
||||
yRotSync = addY * (1 - Mth.abs(i)) + addZ * i;
|
||||
|
||||
this.setYRot(this.getYRot() + yRotSync);
|
||||
this.setXRot(Mth.clamp(this.getXRot() + addX, onGround() ? -12 : -120, onGround() ? 3 : 120));
|
||||
this.setZRot(this.getRoll() - this.entityData.get(DELTA_ROT) + (this.onGround() ? 0 : 0.01f) * diffY * (float) getDeltaMovement().length());
|
||||
this.setZRot(this.getRoll() - addZ * (1 - Mth.abs(i)));
|
||||
|
||||
// 空格投掷西瓜炸弹
|
||||
if (upInputDown && !onGround() && entityData.get(MELON)) {
|
||||
|
@ -268,10 +274,12 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
|||
}
|
||||
|
||||
public void copyEntityData(Entity entity) {
|
||||
float i = getXRot() / 90;
|
||||
|
||||
float f = Mth.wrapDegrees(entity.getYRot() - getYRot());
|
||||
float g = Mth.clamp(f, -105.0f, 105.0f);
|
||||
entity.yRotO += g - f;
|
||||
entity.setYRot(entity.getYRot() + g - f);
|
||||
entity.setYRot(entity.getYRot() + g - f + yRotSync * Mth.abs(i));
|
||||
entity.setYHeadRot(entity.getYRot());
|
||||
entity.setYBodyRot(getYRot());
|
||||
}
|
||||
|
|
|
@ -288,8 +288,7 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
|
|||
|
||||
// 地形适应测试
|
||||
public void terrainCompat(float w, float l) {
|
||||
if (!onGround()) return;
|
||||
|
||||
if (onGround()) {
|
||||
Matrix4f transform = this.getWheelsTransform(1);
|
||||
|
||||
// 点位
|
||||
|
@ -364,11 +363,15 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
|
|||
double z1 = getXRotFromVector(v2);
|
||||
double z2 = getXRotFromVector(v3);
|
||||
|
||||
float diffX = Math.clamp(-90f, 90f, Mth.wrapDegrees((float) (-(x1 + x2)) - this.getXRot()));
|
||||
this.setXRot(Mth.clamp(this.getXRot() + 0.075f * diffX, -90f, 90f));
|
||||
float diffX = Math.clamp(-90f, 90f, Mth.wrapDegrees((float) (-(x1 + x2)) - getXRot()));
|
||||
setXRot(Mth.clamp(getXRot() + 0.075f * diffX, -90f, 90f));
|
||||
|
||||
float diffZ = Math.clamp(-90f, 90f, Mth.wrapDegrees((float) (-(z1 + z2)) - this.getRoll()));
|
||||
this.setZRot(Mth.clamp(this.getRoll() + 0.15f * diffZ, -90f, 90f));
|
||||
float diffZ = Math.clamp(-90f, 90f, Mth.wrapDegrees((float) (-(z1 + z2)) - getRoll()));
|
||||
setZRot(Mth.clamp(getRoll() + 0.15f * diffZ, -90f, 90f));
|
||||
} else if (isInWater()) {
|
||||
setXRot(getXRot() * 0.9f);
|
||||
setZRot(getRoll() * 0.9f);
|
||||
}
|
||||
}
|
||||
|
||||
public Matrix4f getWheelsTransform(float ticks) {
|
||||
|
|
|
@ -502,7 +502,7 @@ public class GunEventHandler {
|
|||
singleLoad(player, data);
|
||||
}
|
||||
|
||||
if (stack.getItem() == ModItems.SECONDARY_CATACLYSM.get() && reload.iterativeLoadTimer.get() == 16) {
|
||||
if (stack.getItem() == ModItems.SECONDARY_CATACLYSM.get() && reload.iterativeLoadTimer.get() == 1) {
|
||||
singleLoad(player, data);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue