添加飞机起落架HUD

This commit is contained in:
Atsuishio 2025-05-21 23:41:52 +08:00 committed by Light_Quanta
parent 491361e829
commit cd1836bc1a
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
4 changed files with 25 additions and 4 deletions

View file

@ -64,6 +64,7 @@ public class VehicleHudOverlay implements LayeredDraw.Layer {
private static final ResourceLocation PASSENGER = Mod.loc("textures/screens/passenger.png");
private static final ResourceLocation SELECTED = Mod.loc("textures/screens/vehicle_weapon/selected.png");
private static final ResourceLocation NUMBER = Mod.loc("textures/screens/vehicle_weapon/number.png");
private static final ResourceLocation GEAR = Mod.loc("textures/screens/aircraft/gear.png");
public static final int ANIMATION_TIME = 300;
private static final AnimationTimer[] weaponSlotsTimer = AnimationTimer.createTimers(9, ANIMATION_TIME, AnimationCurves.EASE_OUT_CIRC);
@ -88,8 +89,9 @@ public class VehicleHudOverlay implements LayeredDraw.Layer {
Entity vehicle = player.getVehicle();
PoseStack poseStack = guiGraphics.pose();
poseStack.pushPose();
// 渲染地面武装HUD
renderLandArmorHud(guiGraphics, deltaTracker, w, h);
RenderSystem.disableDepthTest();
RenderSystem.depthMask(false);
@ -98,9 +100,6 @@ public class VehicleHudOverlay implements LayeredDraw.Layer {
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
RenderSystem.setShaderColor(1, 1, 1, 1);
// 渲染地面武装HUD
renderLandArmorHud(guiGraphics, deltaTracker, w, h);
int compatHeight = getArmorPlateCompatHeight(player);
if (vehicle instanceof EnergyVehicleEntity energyVehicleEntity) {
@ -122,6 +121,21 @@ public class VehicleHudOverlay implements LayeredDraw.Layer {
renderPassengerInfo(guiGraphics, pVehicle, w, h);
}
if (vehicle instanceof AircraftEntity aircraftEntity) {
RenderSystem.disableDepthTest();
RenderSystem.depthMask(false);
RenderSystem.enableBlend();
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
RenderSystem.setShaderColor(1, 1, 1, 1);
float angle = aircraftEntity.gearRot(deltaTracker.getGameTimeDeltaPartialTick(true));
poseStack.pushPose();
poseStack.rotateAround(Axis.ZP.rotationDegrees(-90 + angle), 102, h - 20, 0);
preciseBlit(guiGraphics, GEAR, 86, h - 36, 0, 0, 32, 32, 32, 32);
poseStack.popPose();
}
poseStack.popPose();
}

View file

@ -788,6 +788,11 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
}
}
@Override
public Float gearRot(float tickDelta) {
return Mth.lerp(tickDelta, gearRotO, entityData.get(GEAR_ROT));
}
@Override
public void vehicleShoot(Player player, int type) {
Matrix4f transform = getVehicleTransform(1);

View file

@ -7,4 +7,6 @@ public interface AircraftEntity extends AirEntity {
Vec3 shootPos(float tickDelta);
Vec3 shootVec(float tickDelta);
Float gearRot(float tickDelta);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB