diff --git a/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java index 8425359c6..0f34f4b0c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java +++ b/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java @@ -35,6 +35,8 @@ public class VehicleConfig { public static ForgeConfigSpec.IntValue MLE1934_HE_EXPLOSION_DAMAGE; public static ForgeConfigSpec.IntValue MLE1934_HE_EXPLOSION_RADIUS; + public static ForgeConfigSpec.IntValue HEAVY_MACHINE_GUN_DAMAGE; + public static ForgeConfigSpec.IntValue ANNIHILATOR_HP; public static ForgeConfigSpec.IntValue ANNIHILATOR_SHOOT_COST; public static ForgeConfigSpec.IntValue ANNIHILATOR_MAX_ENERGY; @@ -42,7 +44,6 @@ public class VehicleConfig { public static ForgeConfigSpec.IntValue SPEEDBOAT_HP; public static ForgeConfigSpec.IntValue SPEEDBOAT_ENERGY_COST; public static ForgeConfigSpec.IntValue SPEEDBOAT_MAX_ENERGY; - public static ForgeConfigSpec.IntValue SPEEDBOAT_GUN_DAMAGE; public static ForgeConfigSpec.IntValue AH_6_HP; public static ForgeConfigSpec.IntValue AH_6_MIN_ENERGY_COST; @@ -150,6 +151,13 @@ public class VehicleConfig { builder.pop(); + builder.push("HeavyMachineGun"); + + builder.comment("The gun damage of 12.7mm HMG"); + HEAVY_MACHINE_GUN_DAMAGE = builder.defineInRange("heavy_machine_gun_damage", 25, 1, 10000000); + + builder.pop(); + builder.push("annihilator"); builder.comment("The HealthPoint of Annihilator"); @@ -174,9 +182,6 @@ public class VehicleConfig { builder.comment("The max energy storage of Speedboat"); SPEEDBOAT_MAX_ENERGY = builder.defineInRange("speedboat_max_energy", 1000000, 0, 2147483647); - builder.comment("The gun damage of Speedboat"); - SPEEDBOAT_GUN_DAMAGE = builder.defineInRange("speedboat_gun_damage", 25, 1, 10000000); - builder.pop(); builder.push("ah_6"); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java index ce697481d..052098446 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java @@ -90,7 +90,7 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo return new VehicleWeapon[][]{ new VehicleWeapon[]{ new ProjectileWeapon() - .damage(VehicleConfig.SPEEDBOAT_GUN_DAMAGE.get()) + .damage(VehicleConfig.HEAVY_MACHINE_GUN_DAMAGE.get()) .headShot(2) .zoom(false) .icon(ModUtils.loc("textures/screens/vehicle_weapon/gun_12_7mm.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 b88e5e3f7..03d4bbdf5 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java @@ -14,11 +14,13 @@ import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.network.message.ShakeClientMessage; import com.atsuishio.superbwarfare.tools.*; import com.mojang.math.Axis; +import net.minecraft.ChatFormatting; import net.minecraft.client.CameraType; import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.protocol.game.ClientboundStopSoundPacket; @@ -77,6 +79,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti public static final float MAX_HEALTH = 500; public static final int MAX_ENERGY = 5000000; + public static final int SHOOT_COST = 10000; private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); public float turretYRot; @@ -140,7 +143,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti new VehicleWeapon[]{ // 机枪 new ProjectileWeapon() - .damage(VehicleConfig.SPEEDBOAT_GUN_DAMAGE.get()) + .damage(VehicleConfig.HEAVY_MACHINE_GUN_DAMAGE.get()) .headShot(2) .zoom(false) .bypassArmorRate(0.4f) @@ -355,8 +358,13 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti @Override public void vehicleShoot(Player player, int type) { if (reloadCoolDown == 0 && type == 0) { - Matrix4f transform = getBarrelTransform(); + if (!this.canConsume(SHOOT_COST)) { + player.displayClientMessage(Component.translatable("tips.superbwarfare.annihilator.energy_not_enough").withStyle(ChatFormatting.RED), true); + return; + } + + Matrix4f transform = getBarrelTransform(); Vector4f worldPosition = transformPosition(transform, 0, 0, 0); var cannonShell = (CannonShellWeapon) getWeapon(0);