添加耐力条config

This commit is contained in:
17146 2025-04-11 02:31:02 +08:00 committed by Light_Quanta
parent 2890904c63
commit fede5d2a4c
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
5 changed files with 13 additions and 4 deletions

View file

@ -41,6 +41,7 @@ public class ClientRenderHandler {
public static void registerOverlays(RegisterGuiLayersEvent event) { public static void registerOverlays(RegisterGuiLayersEvent event) {
event.registerBelowAll(JavelinHudOverlay.ID, new JavelinHudOverlay()); event.registerBelowAll(JavelinHudOverlay.ID, new JavelinHudOverlay());
event.registerBelow(JavelinHudOverlay.ID, VehicleHudOverlay.ID, new VehicleHudOverlay()); event.registerBelow(JavelinHudOverlay.ID, VehicleHudOverlay.ID, new VehicleHudOverlay());
event.registerBelow(StaminaOverlay.ID, StaminaOverlay.ID, new StaminaOverlay());
event.registerBelowAll(KillMessageOverlay.ID, new KillMessageOverlay()); event.registerBelowAll(KillMessageOverlay.ID, new KillMessageOverlay());
event.registerBelowAll(VehicleTeamOverlay.ID, new VehicleTeamOverlay()); event.registerBelowAll(VehicleTeamOverlay.ID, new VehicleTeamOverlay());
event.registerBelowAll(VehicleMgHudOverlay.ID, new VehicleMgHudOverlay()); event.registerBelowAll(VehicleMgHudOverlay.ID, new VehicleMgHudOverlay());
@ -57,8 +58,6 @@ public class ClientRenderHandler {
event.registerBelowAll(HandsomeFrameOverlay.ID, new HandsomeFrameOverlay()); event.registerBelowAll(HandsomeFrameOverlay.ID, new HandsomeFrameOverlay());
event.registerBelowAll(SpyglassRangeOverlay.ID, new SpyglassRangeOverlay()); event.registerBelowAll(SpyglassRangeOverlay.ID, new SpyglassRangeOverlay());
event.registerBelowAll(HelicopterHudOverlay.ID, new HelicopterHudOverlay()); event.registerBelowAll(HelicopterHudOverlay.ID, new HelicopterHudOverlay());
event.registerBelowAll(StaminaOverlay.ID, new StaminaOverlay());
event.registerBelowAll(MortarInfoOverlay.ID, new MortarInfoOverlay()); event.registerBelowAll(MortarInfoOverlay.ID, new MortarInfoOverlay());
} }
} }

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.client.overlay; package com.atsuishio.superbwarfare.client.overlay;
import com.atsuishio.superbwarfare.Mod; import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.config.client.DisplayConfig;
import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity;
import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.init.ModAttachments; import com.atsuishio.superbwarfare.init.ModAttachments;
@ -36,7 +37,7 @@ public class StaminaOverlay implements LayeredDraw.Layer {
return; return;
if (player != null && player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) if (player != null && player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player))
return; return;
if (!shouldRenderCrossHair(player)) return; if (!shouldRender(player)) return;
guiGraphics.pose().pushPose(); guiGraphics.pose().pushPose();
@ -53,7 +54,8 @@ public class StaminaOverlay implements LayeredDraw.Layer {
guiGraphics.pose().popPose(); guiGraphics.pose().popPose();
} }
private static boolean shouldRenderCrossHair(Player player) { private static boolean shouldRender(Player player) {
if (!DisplayConfig.STAMINA_HUD.get()) return false;
if (player == null) return false; if (player == null) return false;
return ClientEventHandler.switchTime > 0; return ClientEventHandler.switchTime > 0;
} }

View file

@ -9,6 +9,7 @@ public class DisplayConfig {
public static ModConfigSpec.BooleanValue FLOAT_CROSS_HAIR; public static ModConfigSpec.BooleanValue FLOAT_CROSS_HAIR;
public static ModConfigSpec.BooleanValue CAMERA_ROTATE; public static ModConfigSpec.BooleanValue CAMERA_ROTATE;
public static ModConfigSpec.BooleanValue ARMOR_PLATE_HUD; public static ModConfigSpec.BooleanValue ARMOR_PLATE_HUD;
public static ModConfigSpec.BooleanValue STAMINA_HUD;
public static void init(ModConfigSpec.Builder builder) { public static void init(ModConfigSpec.Builder builder) {
builder.push("display"); builder.push("display");
@ -28,6 +29,9 @@ public class DisplayConfig {
builder.comment("Set true to enable armor plate hud"); builder.comment("Set true to enable armor plate hud");
ARMOR_PLATE_HUD = builder.define("armor_plate_hud", true); ARMOR_PLATE_HUD = builder.define("armor_plate_hud", true);
builder.comment("Set true to enable stamina hud");
STAMINA_HUD = builder.define("stamina_hud", true);
builder.pop(); builder.pop();
} }
} }

View file

@ -535,6 +535,8 @@
"config.superbwarfare.client.display.camera_rotate.des": "Slightly shaky view when holding a firearm in your hand", "config.superbwarfare.client.display.camera_rotate.des": "Slightly shaky view when holding a firearm in your hand",
"config.superbwarfare.client.display.armor_plate_hud": "Armor Plate HUD", "config.superbwarfare.client.display.armor_plate_hud": "Armor Plate HUD",
"config.superbwarfare.client.display.armor_plate_hud.des": "Display the durability of the bulletproof insert currently equipped on the chest armor in the lower left corner when turned on", "config.superbwarfare.client.display.armor_plate_hud.des": "Display the durability of the bulletproof insert currently equipped on the chest armor in the lower left corner when turned on",
"config.superbwarfare.client.display.stamina_hud": "Stamina HUD",
"config.superbwarfare.client.display.stamina_hud.des": "Display Stamina HUD when tactical sprinting or holding breath",
"config.superbwarfare.client.vehicle": "Control Vehicle", "config.superbwarfare.client.vehicle": "Control Vehicle",
"config.superbwarfare.client.vehicle.invert_aircraft_control": "Invert Aircraft Control", "config.superbwarfare.client.vehicle.invert_aircraft_control": "Invert Aircraft Control",
"config.superbwarfare.client.vehicle.left_click_reload.des": "Set TRUE to invert aircraft control", "config.superbwarfare.client.vehicle.left_click_reload.des": "Set TRUE to invert aircraft control",

View file

@ -535,6 +535,8 @@
"config.superbwarfare.client.display.camera_rotate.des": "手持枪械时,视角会出现轻微的摇晃", "config.superbwarfare.client.display.camera_rotate.des": "手持枪械时,视角会出现轻微的摇晃",
"config.superbwarfare.client.display.armor_plate_hud": "防弹插板信息", "config.superbwarfare.client.display.armor_plate_hud": "防弹插板信息",
"config.superbwarfare.client.display.armor_plate_hud.des": "开启时,在左下角显示当前装备在胸甲上的防弹插板的耐久度", "config.superbwarfare.client.display.armor_plate_hud.des": "开启时,在左下角显示当前装备在胸甲上的防弹插板的耐久度",
"config.superbwarfare.client.display.stamina_hud": "耐力信息",
"config.superbwarfare.client.display.stamina_hud.des": "在战术冲刺或屏息时,显示耐力条",
"config.superbwarfare.client.vehicle": "载具控制", "config.superbwarfare.client.vehicle": "载具控制",
"config.superbwarfare.client.vehicle.invert_aircraft_control": "飞行器鼠标反转", "config.superbwarfare.client.vehicle.invert_aircraft_control": "飞行器鼠标反转",
"config.superbwarfare.client.vehicle.left_click_reload.des": "开启飞行器鼠标反转", "config.superbwarfare.client.vehicle.left_click_reload.des": "开启飞行器鼠标反转",