diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java index 2c388ee1f..461a163d6 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java @@ -57,6 +57,7 @@ public class VehicleHudOverlay { private static final ResourceLocation HEALTH_FRAME = ModUtils.loc("textures/screens/armor_value_frame.png"); private static final ResourceLocation DRIVER = ModUtils.loc("textures/screens/driver.png"); private static final ResourceLocation PASSENGER = ModUtils.loc("textures/screens/passenger.png"); + private static final ResourceLocation SELECTED = ModUtils.loc("textures/screens/vehicle_weapon/selected.png"); @SubscribeEvent(priority = EventPriority.HIGH) public static void eventHandler(RenderGuiEvent.Pre event) { @@ -509,8 +510,8 @@ public class VehicleHudOverlay { var weapons = weaponVehicle.getAvailableWeapons(index); if (weapons.isEmpty()) return; - int weaponType = weaponVehicle.getWeaponIndex(index); - if (weaponType == -1) return; + int weaponIndex = weaponVehicle.getWeaponIndex(index); + if (weaponIndex == -1) return; var pose = guiGraphics.pose(); @@ -531,7 +532,16 @@ public class VehicleHudOverlay { pose.pushPose(); + if (weaponIndex != i) { + RenderSystem.setShaderColor(1, 1, 1, 0.5f); + } else { + RenderSystem.setShaderColor(1, 1, 1, 1); + preciseBlit(guiGraphics, SELECTED, w - 95, h - frameIndex * 18 - 16, 100, 0, 0, 8, 8, 8, 8); + } + preciseBlit(guiGraphics, frame, w - 85, h - frameIndex * 18 - 20, 100, 0, 0, 75, 16, 75, 16); + var weapon = weapons.get(i); + preciseBlit(guiGraphics, weapon.icon, w - 85, h - frameIndex * 18 - 20, 100, 0, 0, 75, 16, 75, 16); pose.popPose(); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java index 61f1f922d..c9d696deb 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java @@ -87,7 +87,8 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity .explosionDamage(VehicleConfig.MK42_AP_EXPLOSION_DAMAGE.get()) .explosionRadius(VehicleConfig.MK42_AP_EXPLOSION_RADIUS.get().floatValue()) .durability(60) - .sound(ModSounds.CANNON_RELOAD.get()), + .sound(ModSounds.CANNON_RELOAD.get()) + .icon(ModUtils.loc("textures/screens/vehicle_weapon/ap_shell.png")), new CannonShellWeapon() .hitDamage(VehicleConfig.MK42_HE_DAMAGE.get()) .explosionDamage(VehicleConfig.MK42_HE_EXPLOSION_DAMAGE.get()) @@ -95,7 +96,8 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity .durability(1) .fireProbability(0.18F) .fireTime(2) - .sound(ModSounds.CANNON_RELOAD.get()), + .sound(ModSounds.CANNON_RELOAD.get()) + .icon(ModUtils.loc("textures/screens/vehicle_weapon/he_shell.png")), } }; } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java index df8b6dab5..e1b5ad518 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java @@ -80,7 +80,8 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt .explosionDamage(VehicleConfig.MLE1934_AP_EXPLOSION_DAMAGE.get()) .explosionRadius(VehicleConfig.MLE1934_AP_EXPLOSION_RADIUS.get().floatValue()) .durability(70) - .sound(ModSounds.CANNON_RELOAD.get()), + .sound(ModSounds.CANNON_RELOAD.get()) + .icon(ModUtils.loc("textures/screens/vehicle_weapon/ap_shell.png")), new CannonShellWeapon() .hitDamage(VehicleConfig.MLE1934_HE_DAMAGE.get()) .explosionDamage(VehicleConfig.MLE1934_HE_EXPLOSION_DAMAGE.get()) @@ -88,7 +89,8 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt .durability(1) .fireProbability(0.24F) .fireTime(5) - .sound(ModSounds.CANNON_RELOAD.get()), + .sound(ModSounds.CANNON_RELOAD.get()) + .icon(ModUtils.loc("textures/screens/vehicle_weapon/he_shell.png")), } }; } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java index e9a1a4d08..354f452b8 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java @@ -122,7 +122,8 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti .durability(60) .velocity(40) .sound(ModSounds.INTO_MISSILE.get()) - .ammo(ModItems.AP_5_INCHES.get()), + .ammo(ModItems.AP_5_INCHES.get()) + .icon(ModUtils.loc("textures/screens/vehicle_weapon/ap_shell.png")), // HE new CannonShellWeapon() .hitDamage(100) @@ -133,7 +134,8 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti .durability(1) .velocity(25) .sound(ModSounds.INTO_CANNON.get()) - .ammo(ModItems.HE_5_INCHES.get()), + .ammo(ModItems.HE_5_INCHES.get()) + .icon(ModUtils.loc("textures/screens/vehicle_weapon/he_shell.png")), }, new VehicleWeapon[]{ // 机枪