修复螺旋桨转速错误和HUD信息显示错误
This commit is contained in:
parent
1b9572c878
commit
859346998a
3 changed files with 6 additions and 6 deletions
|
@ -100,14 +100,14 @@ public class HelicopterHudOverlay {
|
||||||
float power = iHelicopterEntity.getPower();
|
float power = iHelicopterEntity.getPower();
|
||||||
lerpPower = Mth.lerp(0.001f * event.getPartialTick(), lerpPower, power);
|
lerpPower = Mth.lerp(0.001f * event.getPartialTick(), lerpPower, power);
|
||||||
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/heli_power.png"), (float) w / 2 + 130f, ((float) h / 2 - 64 + 124 - power * 980), 0, 0, 4, power * 980, 4, power * 980);
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/heli_power.png"), (float) w / 2 + 130f, ((float) h / 2 - 64 + 124 - power * 980), 0, 0, 4, power * 980, 4, power * 980);
|
||||||
lerpVy = (float) Mth.lerp(0.021f * event.getPartialTick(), lerpVy, mobileVehicle.getDeltaMovement().y() + 0.06f);
|
lerpVy = (float) Mth.lerp(0.021f * event.getPartialTick(), lerpVy, mobileVehicle.getDeltaMovement().y());
|
||||||
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/heli_vy_move.png"), (float) w / 2 + 138, ((float) h / 2 - 3 - Math.max(lerpVy * 20, -24) * 2.5f), 0, 0, 8, 8, 8, 8);
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/heli_vy_move.png"), (float) w / 2 + 138, ((float) h / 2 - 3 - Math.max(lerpVy * 20, -24) * 2.5f), 0, 0, 8, 8, 8, 8);
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(lerpVy * 20) + "m/s"),
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(lerpVy * 20) + "m/s"),
|
||||||
w / 2 + 146, (int) (h / 2 - 3 - Math.max(lerpVy * 20, -24) * 2.5), (((lerpVy < -20 || lerpVy * 20 < -5 || (lerpVy * 20 < -1 && length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y + 0.06, mobileVehicle.getDeltaMovement().z) * 72 > 100)) && height < 36) || (length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y + 0.06, mobileVehicle.getDeltaMovement().z) * 72 > 40 && blockInWay < 72) ? -65536 : 0x66FF00), false);
|
w / 2 + 146, (int) (h / 2 - 3 - Math.max(lerpVy * 20, -24) * 2.5), (((lerpVy < -20 || lerpVy * 20 < -5 || (lerpVy * 20 < -1 && length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y + 0.06, mobileVehicle.getDeltaMovement().z) * 72 > 100)) && height < 36) || (length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y + 0.06, mobileVehicle.getDeltaMovement().z) * 72 > 40 && blockInWay < 72) ? -65536 : 0x66FF00), false);
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(mobileVehicle.getY())),
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(mobileVehicle.getY())),
|
||||||
w / 2 + 104, h / 2, 0x66FF00, false);
|
w / 2 + 104, h / 2, 0x66FF00, false);
|
||||||
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/speed_frame.png"), (float) w / 2 - 144, (float) h / 2 - 6, 0, 0, 50, 18, 50, 18);
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/speed_frame.png"), (float) w / 2 - 144, (float) h / 2 - 6, 0, 0, 50, 18, 50, 18);
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y + 0.06, mobileVehicle.getDeltaMovement().z) * 72) + "KM/H"),
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y, mobileVehicle.getDeltaMovement().z) * 72) + "KM/H"),
|
||||||
w / 2 - 140, h / 2, 0x66FF00, false);
|
w / 2 - 140, h / 2, 0x66FF00, false);
|
||||||
|
|
||||||
if (lerpVy * 20 < -20) {
|
if (lerpVy * 20 < -20) {
|
||||||
|
|
|
@ -161,7 +161,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.onGround()) {
|
if (this.onGround()) {
|
||||||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.8, 0.95, 0.8));
|
this.setDeltaMovement(this.getDeltaMovement().multiply(0.8, 1, 0.8));
|
||||||
this.setZRot(this.roll * 0.9f);
|
this.setZRot(this.roll * 0.9f);
|
||||||
this.setXRot(this.getXRot() * 0.9f);
|
this.setXRot(this.getXRot() * 0.9f);
|
||||||
} else {
|
} else {
|
||||||
|
@ -241,7 +241,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
}
|
}
|
||||||
|
|
||||||
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * 0.95f);
|
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * 0.95f);
|
||||||
this.entityData.set(PROPELLER_ROT, Mth.lerp(0.0001f, this.entityData.get(POWER), this.entityData.get(POWER)));
|
this.entityData.set(PROPELLER_ROT, Mth.lerp(0.08f, this.entityData.get(PROPELLER_ROT), this.entityData.get(POWER)));
|
||||||
this.setPropellerRot(this.getPropellerRot() + 30 * this.entityData.get(PROPELLER_ROT));
|
this.setPropellerRot(this.getPropellerRot() + 30 * this.entityData.get(PROPELLER_ROT));
|
||||||
this.entityData.set(PROPELLER_ROT, this.entityData.get(PROPELLER_ROT) * 0.9995f);
|
this.entityData.set(PROPELLER_ROT, this.entityData.get(PROPELLER_ROT) * 0.9995f);
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.joml.Math;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.entity.vehicle.MobileVehicleEntity.POWER;
|
import static com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity.PROPELLER_ROT;
|
||||||
|
|
||||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT)
|
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT)
|
||||||
public class ClientSoundHandler {
|
public class ClientSoundHandler {
|
||||||
|
@ -45,7 +45,7 @@ public class ClientSoundHandler {
|
||||||
float distanceReduce;
|
float distanceReduce;
|
||||||
if (e instanceof Ah6Entity ah6Entity) {
|
if (e instanceof Ah6Entity ah6Entity) {
|
||||||
distanceReduce = (float) (1 - distance / 64);
|
distanceReduce = (float) (1 - distance / 64);
|
||||||
player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), 5 * (mobileVehicle.getEntityData().get(POWER) - 0.012f) * distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.1f + 1.0f), false);
|
player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), 5 * (mobileVehicle.getEntityData().get(PROPELLER_ROT) - 0.012f) * distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.1f + 1.0f), false);
|
||||||
// player.displayClientMessage(Component.literal("Angle:" + engineSoundPos), true);
|
// player.displayClientMessage(Component.literal("Angle:" + engineSoundPos), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue