添加飞机起落架HUD
This commit is contained in:
parent
491361e829
commit
cd1836bc1a
4 changed files with 25 additions and 4 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 |
Loading…
Add table
Reference in a new issue