添加过热条HUD配置

This commit is contained in:
17146 2025-07-14 18:39:13 +08:00 committed by Light_Quanta
parent dc7d7501c0
commit b0c767dd47
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
5 changed files with 55 additions and 2 deletions

View file

@ -3,6 +3,7 @@ package com.atsuishio.superbwarfare.client.overlay;
import com.atsuishio.superbwarfare.Mod; import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.client.ClickHandler; import com.atsuishio.superbwarfare.client.ClickHandler;
import com.atsuishio.superbwarfare.client.RenderHelper; import com.atsuishio.superbwarfare.client.RenderHelper;
import com.atsuishio.superbwarfare.config.client.DisplayConfig;
import com.atsuishio.superbwarfare.data.gun.GunData; import com.atsuishio.superbwarfare.data.gun.GunData;
import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity;
import com.atsuishio.superbwarfare.item.gun.GunItem; import com.atsuishio.superbwarfare.item.gun.GunItem;
@ -35,6 +36,8 @@ public class HeatBarOverlay implements LayeredDraw.Layer {
@Override @Override
public void render(@NotNull GuiGraphics guiGraphics, @NotNull DeltaTracker deltaTracker) { public void render(@NotNull GuiGraphics guiGraphics, @NotNull DeltaTracker deltaTracker) {
if (!DisplayConfig.ENABLE_HEAT_BAR_HUD.get()) return;
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
Player player = mc.player; Player player = mc.player;
if (player == null) return; if (player == null) return;
@ -77,8 +80,8 @@ public class HeatBarOverlay implements LayeredDraw.Layer {
int i = (screenWidth - width) / 2; int i = (screenWidth - width) / 2;
int j = (screenHeight - height) / 2; int j = (screenHeight - height) / 2;
float posX = i + 64 + timer.lerp(0, 5, currentTime); float posX = i + 64 + DisplayConfig.HEAT_BAR_HUD_X_OFFSET.get() + timer.lerp(0, 5, currentTime);
float posY = j + 6; float posY = j + 6 + DisplayConfig.HEAT_BAR_HUD_Y_OFFSET.get();
float alpha = timer.lerp(1, 0, currentTime); float alpha = timer.lerp(1, 0, currentTime);
RenderSystem.setShaderColor(1, 1, 1, alpha); RenderSystem.setShaderColor(1, 1, 1, alpha);

View file

@ -39,6 +39,32 @@ public class DisplayClothConfig {
.build() .build()
); );
category.addEntry(entryBuilder
.startBooleanToggle(Component.translatable("config.superbwarfare.client.display.enable_heat_bar_hud"), DisplayConfig.ENABLE_HEAT_BAR_HUD.get())
.setDefaultValue(true)
.setSaveConsumer(save(DisplayConfig.ENABLE_HEAT_BAR_HUD))
.setTooltip(Component.translatable("config.superbwarfare.client.display.enable_heat_bar_hud.des"))
.build()
);
category.addEntry(entryBuilder
.startIntSlider(Component.translatable("config.superbwarfare.client.display.heat_bar_hud_x_offset"), DisplayConfig.HEAT_BAR_HUD_X_OFFSET.get(),
-1000, 1000)
.setDefaultValue(0)
.setSaveConsumer(save(DisplayConfig.HEAT_BAR_HUD_X_OFFSET))
.setTooltip(Component.translatable("config.superbwarfare.client.display.heat_bar_hud_x_offset.des"))
.build()
);
category.addEntry(entryBuilder
.startIntSlider(Component.translatable("config.superbwarfare.client.display.heat_bar_hud_y_offset"), DisplayConfig.HEAT_BAR_HUD_Y_OFFSET.get(),
-1000, 1000)
.setDefaultValue(0)
.setSaveConsumer(save(DisplayConfig.HEAT_BAR_HUD_Y_OFFSET))
.setTooltip(Component.translatable("config.superbwarfare.client.display.heat_bar_hud_y_offset.des"))
.build()
);
category.addEntry(entryBuilder category.addEntry(entryBuilder
.startBooleanToggle(Component.translatable("config.superbwarfare.client.display.kill_indication"), DisplayConfig.KILL_INDICATION.get()) .startBooleanToggle(Component.translatable("config.superbwarfare.client.display.kill_indication"), DisplayConfig.KILL_INDICATION.get())
.setDefaultValue(true) .setDefaultValue(true)

View file

@ -7,6 +7,9 @@ public class DisplayConfig {
public static ModConfigSpec.BooleanValue ENABLE_GUN_LOD; public static ModConfigSpec.BooleanValue ENABLE_GUN_LOD;
public static ModConfigSpec.IntValue WEAPON_HUD_X_OFFSET; public static ModConfigSpec.IntValue WEAPON_HUD_X_OFFSET;
public static ModConfigSpec.IntValue WEAPON_HUD_Y_OFFSET; public static ModConfigSpec.IntValue WEAPON_HUD_Y_OFFSET;
public static ModConfigSpec.BooleanValue ENABLE_HEAT_BAR_HUD;
public static ModConfigSpec.IntValue HEAT_BAR_HUD_X_OFFSET;
public static ModConfigSpec.IntValue HEAT_BAR_HUD_Y_OFFSET;
public static ModConfigSpec.BooleanValue KILL_INDICATION; public static ModConfigSpec.BooleanValue KILL_INDICATION;
public static ModConfigSpec.BooleanValue AMMO_HUD; public static ModConfigSpec.BooleanValue AMMO_HUD;
public static ModConfigSpec.BooleanValue VEHICLE_INFO; public static ModConfigSpec.BooleanValue VEHICLE_INFO;
@ -32,6 +35,15 @@ public class DisplayConfig {
builder.comment("The y offset of weapon hud"); builder.comment("The y offset of weapon hud");
WEAPON_HUD_Y_OFFSET = builder.defineInRange("weapon_hud_y_offset", 0, -1000, 1000); WEAPON_HUD_Y_OFFSET = builder.defineInRange("weapon_hud_y_offset", 0, -1000, 1000);
builder.comment("Set true to enable heat bar hud");
ENABLE_HEAT_BAR_HUD = builder.define("enable_heat_bar_hud", true);
builder.comment("The x offset of heat bar hud");
HEAT_BAR_HUD_X_OFFSET = builder.defineInRange("heat_bar_hud_x_offset", 0, -1000, 1000);
builder.comment("The y offset of heat bar hud");
HEAT_BAR_HUD_Y_OFFSET = builder.defineInRange("heat_bar_hud_y_offset", 0, -1000, 1000);
builder.comment("Set true if you want to show kill indication while killing an entity"); builder.comment("Set true if you want to show kill indication while killing an entity");
KILL_INDICATION = builder.define("kill_indication", true); KILL_INDICATION = builder.define("kill_indication", true);

View file

@ -659,6 +659,12 @@
"config.superbwarfare.client.display.weapon_hud_y_offset.des": "The vertical offset of weapon HUD", "config.superbwarfare.client.display.weapon_hud_y_offset.des": "The vertical offset of weapon HUD",
"config.superbwarfare.client.display.vehicle_info": "Vehicle Info", "config.superbwarfare.client.display.vehicle_info": "Vehicle Info",
"config.superbwarfare.client.display.vehicle_info.des": "Whether to display vehicle info when aiming at a vehicle", "config.superbwarfare.client.display.vehicle_info.des": "Whether to display vehicle info when aiming at a vehicle",
"config.superbwarfare.client.display.enable_heat_bar_hud": "Enable Heat Bar HUD",
"config.superbwarfare.client.display.enable_heat_bar_hud.des": "Whether to display heat bar HUD",
"config.superbwarfare.client.display.heat_bar_hud_x_offset": "Heat Bar HUD X Offset",
"config.superbwarfare.client.display.heat_bar_hud_x_offset.des": "The horizontal offset of heat bar HUD",
"config.superbwarfare.client.display.heat_bar_hud_y_offset": "Heat Bar HUD Y Offset",
"config.superbwarfare.client.display.heat_bar_hud_y_offset.des": "The vertical offset of heat bar HUD",
"config.superbwarfare.client.control": "Control Config", "config.superbwarfare.client.control": "Control Config",
"config.superbwarfare.client.control.invert_aircraft_control": "Invert Aircraft Control", "config.superbwarfare.client.control.invert_aircraft_control": "Invert Aircraft Control",
"config.superbwarfare.client.control.invert_aircraft_control.des": "Set TRUE to invert aircraft control", "config.superbwarfare.client.control.invert_aircraft_control.des": "Set TRUE to invert aircraft control",

View file

@ -658,6 +658,12 @@
"config.superbwarfare.client.display.weapon_hud_y_offset.des": "武器HUD位置的竖直方向偏移量", "config.superbwarfare.client.display.weapon_hud_y_offset.des": "武器HUD位置的竖直方向偏移量",
"config.superbwarfare.client.display.vehicle_info": "载具信息显示", "config.superbwarfare.client.display.vehicle_info": "载具信息显示",
"config.superbwarfare.client.display.vehicle_info.des": "是否在看向载具的时候,显示该载具的信息", "config.superbwarfare.client.display.vehicle_info.des": "是否在看向载具的时候,显示该载具的信息",
"config.superbwarfare.client.display.enable_heat_bar_hud": "启用过热条HUD",
"config.superbwarfare.client.display.enable_heat_bar_hud.des": "是否在准星旁边显示过热条HUD",
"config.superbwarfare.client.display.heat_bar_hud_x_offset": "过热条HUD水平偏移",
"config.superbwarfare.client.display.heat_bar_hud_x_offset.des": "过热条HUD位置的水平方向偏移量",
"config.superbwarfare.client.display.heat_bar_hud_y_offset": "过热条HUD竖直偏移",
"config.superbwarfare.client.display.heat_bar_hud_y_offset.des": "过热条HUD位置的竖直方向偏移量",
"config.superbwarfare.client.control": "控制配置", "config.superbwarfare.client.control": "控制配置",
"config.superbwarfare.client.control.invert_aircraft_control": "飞行器鼠标反转", "config.superbwarfare.client.control.invert_aircraft_control": "飞行器鼠标反转",
"config.superbwarfare.client.control.invert_aircraft_control.des": "开启飞行器鼠标反转", "config.superbwarfare.client.control.invert_aircraft_control.des": "开启飞行器鼠标反转",