添加载具乘员显示
This commit is contained in:
parent
6445255922
commit
79d2ef2dff
2 changed files with 33 additions and 12 deletions
|
@ -94,6 +94,10 @@ public class VehicleHudOverlay {
|
||||||
preciseBlit(guiGraphics, HEALTH_FRAME, 20, h - 12 - compatHeight, 100, 0, 0, 60, 6, 60, 6);
|
preciseBlit(guiGraphics, HEALTH_FRAME, 20, h - 12 - compatHeight, 100, 0, 0, 60, 6, 60, 6);
|
||||||
preciseBlit(guiGraphics, HEALTH, 20, h - 12 - compatHeight, 100, 0, 0, (int) (60 * health / maxHealth), 6, 60, 6);
|
preciseBlit(guiGraphics, HEALTH, 20, h - 12 - compatHeight, 100, 0, 0, (int) (60 * health / maxHealth), 6, 60, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderPassengerInfo(guiGraphics, vehicle, w, h);
|
||||||
|
renderWeaponInfo(guiGraphics, vehicle, w, h);
|
||||||
|
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
|
||||||
// if (vehicle instanceof ArmedVehicleEntity iVehicle && iVehicle.getAmmoCount(player) != -1 && iVehicle.isDriver(player)) {
|
// if (vehicle instanceof ArmedVehicleEntity iVehicle && iVehicle.getAmmoCount(player) != -1 && iVehicle.isDriver(player)) {
|
||||||
|
@ -191,8 +195,6 @@ public class VehicleHudOverlay {
|
||||||
&& iLand instanceof MobileVehicleEntity mobileVehicle) {
|
&& iLand instanceof MobileVehicleEntity mobileVehicle) {
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
poseStack.translate(Mth.clamp(-8 * ClientEventHandler.turnRot[1], -10, 10), Mth.clamp(-8 * ClientEventHandler.turnRot[0], -10, 10) - 0.3 * ClientEventHandler.shakeTime + 5 * ClientEventHandler.cameraRoll, 0);
|
poseStack.translate(Mth.clamp(-8 * ClientEventHandler.turnRot[1], -10, 10), Mth.clamp(-8 * ClientEventHandler.turnRot[0], -10, 10) - 0.3 * ClientEventHandler.shakeTime + 5 * ClientEventHandler.cameraRoll, 0);
|
||||||
poseStack.rotateAround(Axis.ZP.rotationDegrees(-0.5f * ClientEventHandler.cameraRoll), w / 2f, h / 2f, 0);
|
poseStack.rotateAround(Axis.ZP.rotationDegrees(-0.5f * ClientEventHandler.cameraRoll), w / 2f, h / 2f, 0);
|
||||||
RenderSystem.disableDepthTest();
|
RenderSystem.disableDepthTest();
|
||||||
|
@ -325,7 +327,6 @@ public class VehicleHudOverlay {
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(FormatTool.format0D(100 * heal)), w / 2 - 165, h / 2 - 46, Mth.hsvToRgb((float) heal / 3.745318352059925F, 1.0F, 1.0F), false);
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(FormatTool.format0D(100 * heal)), w / 2 - 165, h / 2 - 46, Mth.hsvToRgb((float) heal / 3.745318352059925F, 1.0F, 1.0F), false);
|
||||||
|
|
||||||
renderKillIndicator(guiGraphics, w, h);
|
renderKillIndicator(guiGraphics, w, h);
|
||||||
|
|
||||||
} else if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK && !ClientEventHandler.zoomVehicle) {
|
} else if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK && !ClientEventHandler.zoomVehicle) {
|
||||||
Vec3 p = RenderHelper.worldToScreen(new Vec3(Mth.lerp(event.getPartialTick(), player.xo, player.getX()), Mth.lerp(event.getPartialTick(), player.yo + player.getEyeHeight(), player.getEyeY()), Mth.lerp(event.getPartialTick(), player.zo, player.getZ())).add(iLand.getBarrelVec(event.getPartialTick()).scale(192)), cameraPos);
|
Vec3 p = RenderHelper.worldToScreen(new Vec3(Mth.lerp(event.getPartialTick(), player.xo, player.getX()), Mth.lerp(event.getPartialTick(), player.yo + player.getEyeHeight(), player.getEyeY()), Mth.lerp(event.getPartialTick(), player.zo, player.getZ())).add(iLand.getBarrelVec(event.getPartialTick()).scale(192)), cameraPos);
|
||||||
// 第三人称准星
|
// 第三人称准星
|
||||||
|
@ -447,4 +448,25 @@ public class VehicleHudOverlay {
|
||||||
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/kill_mark4.png"), posX2, posY2, 0, 0, 16, 16, 16, 16);
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/kill_mark4.png"), posX2, posY2, 0, 0, 16, 16, 16, 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void renderPassengerInfo(GuiGraphics guiGraphics, Entity entity, int w, int h) {
|
||||||
|
if (!(entity instanceof VehicleEntity vehicle)) return;
|
||||||
|
var passengers = vehicle.getOrderedPassengers();
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
for (int i = passengers.size() - 1; i >= 0; i--) {
|
||||||
|
var passenger = passengers.get(i);
|
||||||
|
|
||||||
|
int y = h / 2 + 80 - index * 12;
|
||||||
|
guiGraphics.drawString(Minecraft.getInstance().font, passenger == null ? "--" : passenger.getName().getString(),
|
||||||
|
22, y, 0x66ff00, true);
|
||||||
|
|
||||||
|
// TODO 替换成正确的载具乘员图标
|
||||||
|
preciseBlit(guiGraphics, index == passengers.size() - 1 ? ENERGY : ARMOR, 10, y + 1, 100, 0, 0, 8, 8, 8, 8);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void renderWeaponInfo(GuiGraphics guiGraphics, Entity vehicle, int w, int h) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,9 +73,10 @@ public class VehicleMgHudOverlay {
|
||||||
int l = (h - j) / 2;
|
int l = (h - j) / 2;
|
||||||
RenderHelper.preciseBlit(guiGraphics, ModUtils.loc("textures/screens/cannon/cannon_crosshair_notzoom.png"), k, l, 0, 0.0F, i, j, i, j);
|
RenderHelper.preciseBlit(guiGraphics, ModUtils.loc("textures/screens/cannon/cannon_crosshair_notzoom.png"), k, l, 0, 0.0F, i, j, i, j);
|
||||||
VehicleHudOverlay.renderKillIndicator(guiGraphics, w, h);
|
VehicleHudOverlay.renderKillIndicator(guiGraphics, w, h);
|
||||||
|
|
||||||
} else if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK && !ClientEventHandler.zoomVehicle) {
|
} else if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK && !ClientEventHandler.zoomVehicle) {
|
||||||
Vec3 p = RenderHelper.worldToScreen(new Vec3(Mth.lerp(event.getPartialTick(), player.xo, player.getX()), Mth.lerp(event.getPartialTick(), player.yo + player.getEyeHeight(), player.getEyeY()), Mth.lerp(event.getPartialTick(), player.zo, player.getZ())).add(iLand.getGunVec(event.getPartialTick()).scale(192)), cameraPos);
|
Vec3 p = RenderHelper.worldToScreen(new Vec3(Mth.lerp(event.getPartialTick(), player.xo, player.getX()), Mth.lerp(event.getPartialTick(), player.yo + player.getEyeHeight(), player.getEyeY()),
|
||||||
|
Mth.lerp(event.getPartialTick(), player.zo, player.getZ())).add(iLand.getGunVec(event.getPartialTick()).scale(192)), cameraPos);
|
||||||
|
|
||||||
// 第三人称准星
|
// 第三人称准星
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
|
@ -91,7 +92,6 @@ public class VehicleMgHudOverlay {
|
||||||
poseStack.translate(x, y, 0);
|
poseStack.translate(x, y, 0);
|
||||||
poseStack.scale(0.75f, 0.75f, 1);
|
poseStack.scale(0.75f, 0.75f, 1);
|
||||||
|
|
||||||
|
|
||||||
// YX-100
|
// YX-100
|
||||||
if (player.getVehicle() instanceof Yx100Entity yx100) {
|
if (player.getVehicle() instanceof Yx100Entity yx100) {
|
||||||
double heat = yx100.getEntityData().get(MACHINE_GUN_HEAT) / 100.0F;
|
double heat = yx100.getEntityData().get(MACHINE_GUN_HEAT) / 100.0F;
|
||||||
|
@ -108,7 +108,6 @@ public class VehicleMgHudOverlay {
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue