添加激光防御塔冷却配置项
This commit is contained in:
parent
875148aa0e
commit
8e728df3d5
2 changed files with 6 additions and 3 deletions
|
@ -40,6 +40,7 @@ public class VehicleConfig {
|
||||||
public static ForgeConfigSpec.IntValue ANNIHILATOR_MAX_ENERGY;
|
public static ForgeConfigSpec.IntValue ANNIHILATOR_MAX_ENERGY;
|
||||||
|
|
||||||
public static ForgeConfigSpec.IntValue LASER_TOWER_HP;
|
public static ForgeConfigSpec.IntValue LASER_TOWER_HP;
|
||||||
|
public static ForgeConfigSpec.IntValue LASER_TOWER_COOLDOWN;
|
||||||
public static ForgeConfigSpec.IntValue LASER_TOWER_DAMAGE;
|
public static ForgeConfigSpec.IntValue LASER_TOWER_DAMAGE;
|
||||||
public static ForgeConfigSpec.IntValue LASER_TOWER_SHOOT_COST;
|
public static ForgeConfigSpec.IntValue LASER_TOWER_SHOOT_COST;
|
||||||
public static ForgeConfigSpec.IntValue LASER_TOWER_MAX_ENERGY;
|
public static ForgeConfigSpec.IntValue LASER_TOWER_MAX_ENERGY;
|
||||||
|
@ -198,6 +199,9 @@ public class VehicleConfig {
|
||||||
builder.comment("The damage of Laser Tower");
|
builder.comment("The damage of Laser Tower");
|
||||||
LASER_TOWER_DAMAGE = builder.defineInRange("laser_tower_damage", 15, 1, 10000000);
|
LASER_TOWER_DAMAGE = builder.defineInRange("laser_tower_damage", 15, 1, 10000000);
|
||||||
|
|
||||||
|
builder.comment("The cooldown time(ticks) of Laser Tower");
|
||||||
|
LASER_TOWER_COOLDOWN = builder.defineInRange("laser_tower_cooldown", 40, 15, 10000000);
|
||||||
|
|
||||||
builder.comment("The energy cost of Laser Tower per shoot");
|
builder.comment("The energy cost of Laser Tower per shoot");
|
||||||
LASER_TOWER_SHOOT_COST = builder.defineInRange("laser_tower_shoot_cost", 5000, 0, 2147483647);
|
LASER_TOWER_SHOOT_COST = builder.defineInRange("laser_tower_shoot_cost", 5000, 0, 2147483647);
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,7 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
}
|
}
|
||||||
|
|
||||||
public void autoAim() {
|
public void autoAim() {
|
||||||
if (this.getEnergy() <= 0 || !entityData.get(ACTIVE) || this.entityData.get(COOL_DOWN) > 30) {
|
if (this.getEnergy() <= 0 || !entityData.get(ACTIVE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,8 +296,7 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.entityData.get(COOL_DOWN) == 0 && VectorTool.calculateAngle(getViewVector(1), targetVec) < 1 && checkNoClip(target)) {
|
if (this.entityData.get(COOL_DOWN) == 0 && VectorTool.calculateAngle(getViewVector(1), targetVec) < 1 && checkNoClip(target)) {
|
||||||
|
this.entityData.set(COOL_DOWN, VehicleConfig.LASER_TOWER_COOLDOWN.get());
|
||||||
this.entityData.set(COOL_DOWN, 40);
|
|
||||||
|
|
||||||
if (level() instanceof ServerLevel serverLevel) {
|
if (level() instanceof ServerLevel serverLevel) {
|
||||||
this.level().playSound(this, getOnPos(), ModSounds.LASER_TOWER_SHOOT.get(), SoundSource.PLAYERS, 2, random.nextFloat() * 0.1f + 1);
|
this.level().playSound(this, getOnPos(), ModSounds.LASER_TOWER_SHOOT.get(), SoundSource.PLAYERS, 2, random.nextFloat() * 0.1f + 1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue