添加呼吸回血config

This commit is contained in:
17146 2025-03-04 22:23:36 +08:00
parent 429e79a564
commit 10bec3590d
2 changed files with 16 additions and 2 deletions

View file

@ -15,6 +15,9 @@ public class VehicleConfig {
public static final List<? extends String> DEFAULT_COLLISION_ENTITY_BLACKLIST = public static final List<? extends String> DEFAULT_COLLISION_ENTITY_BLACKLIST =
List.of("create:super_glue", "zombieawareness:scent"); List.of("create:super_glue", "zombieawareness:scent");
public static ForgeConfigSpec.IntValue REPAIR_COOLDOWN;
public static ForgeConfigSpec.DoubleValue REPAIR_AMOUNT;
public static ForgeConfigSpec.IntValue MK42_HP; public static ForgeConfigSpec.IntValue MK42_HP;
public static ForgeConfigSpec.IntValue MK42_AP_DAMAGE; public static ForgeConfigSpec.IntValue MK42_AP_DAMAGE;
public static ForgeConfigSpec.IntValue MK42_AP_EXPLOSION_DAMAGE; public static ForgeConfigSpec.IntValue MK42_AP_EXPLOSION_DAMAGE;
@ -83,6 +86,16 @@ public class VehicleConfig {
DEFAULT_COLLISION_ENTITY_BLACKLIST, DEFAULT_COLLISION_ENTITY_BLACKLIST,
e -> e instanceof String); e -> e instanceof String);
builder.push("repair");
builder.comment("The cooldown of vehicle repair. Set a negative value to disable vehicle repair");
REPAIR_COOLDOWN = builder.defineInRange("repair_cooldown", 200, -1, 10000000);
builder.comment("The amount of health restored per tick when a vehicle is self-repairing");
REPAIR_AMOUNT = builder.defineInRange("repair_amount", 0.05d, 0, 10000000);
builder.pop();
builder.push("mk_42"); builder.push("mk_42");
builder.comment("The HealthPoint of MK-42"); builder.comment("The HealthPoint of MK-42");

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.entity.vehicle; package com.atsuishio.superbwarfare.entity.vehicle;
import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier; import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModDamageTypes;
import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModItems;
@ -300,14 +301,14 @@ public class VehicleEntity extends Entity {
* 呼吸回血冷却时长(单位:tick)设为小于0的值以禁用呼吸回血 * 呼吸回血冷却时长(单位:tick)设为小于0的值以禁用呼吸回血
*/ */
public int maxRepairCoolDown() { public int maxRepairCoolDown() {
return 200; return VehicleConfig.REPAIR_COOLDOWN.get();
} }
/** /**
* 呼吸回血回血量 * 呼吸回血回血量
*/ */
public float repairAmount() { public float repairAmount() {
return 0.05F; return VehicleConfig.REPAIR_AMOUNT.get().floatValue();
} }
@Override @Override