添加更多激光塔和轮椅配置项,优化配置项读取
This commit is contained in:
parent
b496608531
commit
875148aa0e
12 changed files with 70 additions and 92 deletions
|
@ -12,8 +12,7 @@ public class VehicleConfig {
|
||||||
|
|
||||||
public static ForgeConfigSpec.ConfigValue<List<? extends String>> COLLISION_ENTITY_WHITELIST;
|
public static ForgeConfigSpec.ConfigValue<List<? extends String>> COLLISION_ENTITY_WHITELIST;
|
||||||
|
|
||||||
public static final List<? extends String> DEFAULT_COLLISION_ENTITY_WHITELIST =
|
public static final List<? extends String> DEFAULT_COLLISION_ENTITY_WHITELIST = List.of();
|
||||||
List.of();
|
|
||||||
|
|
||||||
public static ForgeConfigSpec.IntValue REPAIR_COOLDOWN;
|
public static ForgeConfigSpec.IntValue REPAIR_COOLDOWN;
|
||||||
public static ForgeConfigSpec.DoubleValue REPAIR_AMOUNT;
|
public static ForgeConfigSpec.DoubleValue REPAIR_AMOUNT;
|
||||||
|
@ -41,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_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;
|
||||||
|
|
||||||
|
@ -48,6 +48,11 @@ public class VehicleConfig {
|
||||||
public static ForgeConfigSpec.IntValue SPEEDBOAT_ENERGY_COST;
|
public static ForgeConfigSpec.IntValue SPEEDBOAT_ENERGY_COST;
|
||||||
public static ForgeConfigSpec.IntValue SPEEDBOAT_MAX_ENERGY;
|
public static ForgeConfigSpec.IntValue SPEEDBOAT_MAX_ENERGY;
|
||||||
|
|
||||||
|
public static ForgeConfigSpec.IntValue WHEELCHAIR_HP;
|
||||||
|
public static ForgeConfigSpec.IntValue WHEELCHAIR_JUMP_ENERGY_COST;
|
||||||
|
public static ForgeConfigSpec.IntValue WHEELCHAIR_MOVE_ENERGY_COST;
|
||||||
|
public static ForgeConfigSpec.IntValue WHEELCHAIR_MAX_ENERGY;
|
||||||
|
|
||||||
public static ForgeConfigSpec.IntValue AH_6_HP;
|
public static ForgeConfigSpec.IntValue AH_6_HP;
|
||||||
public static ForgeConfigSpec.IntValue AH_6_MIN_ENERGY_COST;
|
public static ForgeConfigSpec.IntValue AH_6_MIN_ENERGY_COST;
|
||||||
public static ForgeConfigSpec.IntValue AH_6_MAX_ENERGY_COST;
|
public static ForgeConfigSpec.IntValue AH_6_MAX_ENERGY_COST;
|
||||||
|
@ -117,7 +122,7 @@ public class VehicleConfig {
|
||||||
|
|
||||||
builder.push("mk_42");
|
builder.push("mk_42");
|
||||||
|
|
||||||
builder.comment("The HealthPoint of MK-42");
|
builder.comment("The health of MK-42");
|
||||||
MK42_HP = builder.defineInRange("mk_42_hp", 350, 1, 10000000);
|
MK42_HP = builder.defineInRange("mk_42_hp", 350, 1, 10000000);
|
||||||
|
|
||||||
builder.comment("The AP shell damage of MK-42");
|
builder.comment("The AP shell damage of MK-42");
|
||||||
|
@ -142,7 +147,7 @@ public class VehicleConfig {
|
||||||
|
|
||||||
builder.push("mle_1934");
|
builder.push("mle_1934");
|
||||||
|
|
||||||
builder.comment("The HealthPoint of MLE-1934");
|
builder.comment("The health of MLE-1934");
|
||||||
MLE1934_HP = builder.defineInRange("mle_1934_hp", 350, 1, 10000000);
|
MLE1934_HP = builder.defineInRange("mle_1934_hp", 350, 1, 10000000);
|
||||||
|
|
||||||
builder.comment("The AP shell damage of MLE-1934");
|
builder.comment("The AP shell damage of MLE-1934");
|
||||||
|
@ -174,7 +179,7 @@ public class VehicleConfig {
|
||||||
|
|
||||||
builder.push("annihilator");
|
builder.push("annihilator");
|
||||||
|
|
||||||
builder.comment("The HealthPoint of Annihilator");
|
builder.comment("The health of Annihilator");
|
||||||
ANNIHILATOR_HP = builder.defineInRange("annihilator_hp", 1200, 1, 10000000);
|
ANNIHILATOR_HP = builder.defineInRange("annihilator_hp", 1200, 1, 10000000);
|
||||||
|
|
||||||
builder.comment("The energy cost of Annihilator per shoot");
|
builder.comment("The energy cost of Annihilator per shoot");
|
||||||
|
@ -187,20 +192,23 @@ public class VehicleConfig {
|
||||||
|
|
||||||
builder.push("laser_tower");
|
builder.push("laser_tower");
|
||||||
|
|
||||||
builder.comment("The HealthPoint of Laser_Tower");
|
builder.comment("The health of Laser Tower");
|
||||||
LASER_TOWER_HP = builder.defineInRange("laser_tower_hp", 100, 1, 10000000);
|
LASER_TOWER_HP = builder.defineInRange("laser_tower_hp", 100, 1, 10000000);
|
||||||
|
|
||||||
builder.comment("The energy cost of Laser_Tower per shoot");
|
builder.comment("The damage of Laser Tower");
|
||||||
|
LASER_TOWER_DAMAGE = builder.defineInRange("laser_tower_damage", 15, 1, 10000000);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
builder.comment("The max energy storage of Laser_Tower");
|
builder.comment("The max energy storage of Laser Tower");
|
||||||
LASER_TOWER_MAX_ENERGY = builder.defineInRange("laser_tower_max_energy", 500000, 0, 2147483647);
|
LASER_TOWER_MAX_ENERGY = builder.defineInRange("laser_tower_max_energy", 500000, 0, 2147483647);
|
||||||
|
|
||||||
builder.pop();
|
builder.pop();
|
||||||
|
|
||||||
builder.push("speedboat");
|
builder.push("speedboat");
|
||||||
|
|
||||||
builder.comment("The HealthPoint of Speedboat");
|
builder.comment("The health of Speedboat");
|
||||||
SPEEDBOAT_HP = builder.defineInRange("speedboat_hp", 200, 1, 10000000);
|
SPEEDBOAT_HP = builder.defineInRange("speedboat_hp", 200, 1, 10000000);
|
||||||
|
|
||||||
builder.comment("The energy cost of Speedboat per tick");
|
builder.comment("The energy cost of Speedboat per tick");
|
||||||
|
@ -211,9 +219,25 @@ public class VehicleConfig {
|
||||||
|
|
||||||
builder.pop();
|
builder.pop();
|
||||||
|
|
||||||
|
builder.push("wheelchair");
|
||||||
|
|
||||||
|
builder.comment("The health of the wheelchair");
|
||||||
|
WHEELCHAIR_HP = builder.defineInRange("wheelchair_hp", 30, 1, 10000000);
|
||||||
|
|
||||||
|
builder.comment("The jump energy cost of the wheelchair");
|
||||||
|
WHEELCHAIR_JUMP_ENERGY_COST = builder.defineInRange("wheelchair_jump_energy_cost", 400, 0, 2147483647);
|
||||||
|
|
||||||
|
builder.comment("The move energy cost of the wheelchair");
|
||||||
|
WHEELCHAIR_MOVE_ENERGY_COST = builder.defineInRange("wheelchair_move_energy_cost", 1, 0, 2147483647);
|
||||||
|
|
||||||
|
builder.comment("The max energy storage of the wheelchair");
|
||||||
|
WHEELCHAIR_MAX_ENERGY = builder.defineInRange("wheelchair_max_energy", 24000, 0, 2147483647);
|
||||||
|
|
||||||
|
builder.pop();
|
||||||
|
|
||||||
builder.push("ah_6");
|
builder.push("ah_6");
|
||||||
|
|
||||||
builder.comment("The HealthPoint of AH-6");
|
builder.comment("The health of AH-6");
|
||||||
AH_6_HP = builder.defineInRange("ah_6_hp", 250, 1, 10000000);
|
AH_6_HP = builder.defineInRange("ah_6_hp", 250, 1, 10000000);
|
||||||
|
|
||||||
builder.comment("The min energy cost of AH-6 per tick");
|
builder.comment("The min energy cost of AH-6 per tick");
|
||||||
|
@ -241,7 +265,7 @@ public class VehicleConfig {
|
||||||
|
|
||||||
builder.push("lav_150");
|
builder.push("lav_150");
|
||||||
|
|
||||||
builder.comment("The HealthPoint of Lav_150");
|
builder.comment("The health of Lav_150");
|
||||||
LAV_150_HP = builder.defineInRange("lav_150_hp", 250, 1, 10000000);
|
LAV_150_HP = builder.defineInRange("lav_150_hp", 250, 1, 10000000);
|
||||||
|
|
||||||
builder.comment("The energy cost of Lav_150 per tick");
|
builder.comment("The energy cost of Lav_150 per tick");
|
||||||
|
@ -263,7 +287,7 @@ public class VehicleConfig {
|
||||||
|
|
||||||
builder.push("tom_6");
|
builder.push("tom_6");
|
||||||
|
|
||||||
builder.comment("The HealthPoint of Tom_6");
|
builder.comment("The health of Tom_6");
|
||||||
TOM_6_HP = builder.defineInRange("tom_6_hp", 40, 1, 10000000);
|
TOM_6_HP = builder.defineInRange("tom_6_hp", 40, 1, 10000000);
|
||||||
|
|
||||||
builder.comment("The energy cost of Tom_6 per tick");
|
builder.comment("The energy cost of Tom_6 per tick");
|
||||||
|
@ -282,7 +306,7 @@ public class VehicleConfig {
|
||||||
|
|
||||||
builder.push("bmp_2");
|
builder.push("bmp_2");
|
||||||
|
|
||||||
builder.comment("The HealthPoint of Bmp_2");
|
builder.comment("The health of Bmp_2");
|
||||||
BMP_2_HP = builder.defineInRange("bmp_2_hp", 300, 1, 10000000);
|
BMP_2_HP = builder.defineInRange("bmp_2_hp", 300, 1, 10000000);
|
||||||
|
|
||||||
builder.comment("The energy cost of Bmp_2 per tick");
|
builder.comment("The energy cost of Bmp_2 per tick");
|
||||||
|
@ -304,7 +328,7 @@ public class VehicleConfig {
|
||||||
|
|
||||||
builder.push("yx_100");
|
builder.push("yx_100");
|
||||||
|
|
||||||
builder.comment("The HealthPoint of Yx_100");
|
builder.comment("The health of Yx_100");
|
||||||
YX_100_HP = builder.defineInRange("yx_100_hp", 500, 1, 10000000);
|
YX_100_HP = builder.defineInRange("yx_100_hp", 500, 1, 10000000);
|
||||||
|
|
||||||
builder.comment("The energy cost of Yx_100 per tick");
|
builder.comment("The energy cost of Yx_100 per tick");
|
||||||
|
|
|
@ -68,8 +68,6 @@ import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity, HelicopterEntity, WeaponVehicleEntity {
|
public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity, HelicopterEntity, WeaponVehicleEntity {
|
||||||
|
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
public static final float MAX_HEALTH = VehicleConfig.AH_6_HP.get();
|
|
||||||
public static final int MAX_ENERGY = VehicleConfig.AH_6_MAX_ENERGY.get();
|
|
||||||
public static final EntityDataAccessor<Float> PROPELLER_ROT = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> PROPELLER_ROT = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.FLOAT);
|
||||||
public static final EntityDataAccessor<Integer> DECOY_COUNT = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> DECOY_COUNT = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Integer> LOADED_ROCKET = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> LOADED_ROCKET = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.INT);
|
||||||
|
@ -518,12 +516,12 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getMaxHealth() {
|
public float getMaxHealth() {
|
||||||
return MAX_HEALTH;
|
return VehicleConfig.AH_6_HP.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxEnergy() {
|
public int getMaxEnergy() {
|
||||||
return MAX_ENERGY;
|
return VehicleConfig.AH_6_MAX_ENERGY.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -73,9 +73,6 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
public static final EntityDataAccessor<String> SHOOTER_UUID = SynchedEntityData.defineId(AnnihilatorEntity.class, EntityDataSerializers.STRING);
|
public static final EntityDataAccessor<String> SHOOTER_UUID = SynchedEntityData.defineId(AnnihilatorEntity.class, EntityDataSerializers.STRING);
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
|
||||||
public static final float MAX_HEALTH = VehicleConfig.ANNIHILATOR_HP.get();
|
|
||||||
public static final int MAX_ENERGY = VehicleConfig.ANNIHILATOR_MAX_ENERGY.get();
|
|
||||||
public static final int SHOOT_COST = VehicleConfig.ANNIHILATOR_SHOOT_COST.get();
|
|
||||||
public Vec3 barrelLookAt;
|
public Vec3 barrelLookAt;
|
||||||
|
|
||||||
public AnnihilatorEntity(PlayMessages.SpawnEntity packet, Level world) {
|
public AnnihilatorEntity(PlayMessages.SpawnEntity packet, Level world) {
|
||||||
|
@ -448,7 +445,7 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.canConsume(SHOOT_COST)) {
|
if (!this.canConsume(VehicleConfig.ANNIHILATOR_SHOOT_COST.get())) {
|
||||||
player.displayClientMessage(Component.translatable("tips.superbwarfare.annihilator.energy_not_enough").withStyle(ChatFormatting.RED), true);
|
player.displayClientMessage(Component.translatable("tips.superbwarfare.annihilator.energy_not_enough").withStyle(ChatFormatting.RED), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -463,7 +460,7 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
}
|
}
|
||||||
|
|
||||||
this.entityData.set(COOL_DOWN, 100);
|
this.entityData.set(COOL_DOWN, 100);
|
||||||
this.consumeEnergy(SHOOT_COST);
|
this.consumeEnergy(VehicleConfig.ANNIHILATOR_SHOOT_COST.get());
|
||||||
final Vec3 center = new Vec3(this.getX(), this.getEyeY(), this.getZ());
|
final Vec3 center = new Vec3(this.getX(), this.getEyeY(), this.getZ());
|
||||||
for (Entity target : level.getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(20), e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) {
|
for (Entity target : level.getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(20), e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) {
|
||||||
if (target instanceof ServerPlayer serverPlayer) {
|
if (target instanceof ServerPlayer serverPlayer) {
|
||||||
|
@ -581,12 +578,12 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxEnergy() {
|
public int getMaxEnergy() {
|
||||||
return MAX_ENERGY;
|
return VehicleConfig.ANNIHILATOR_MAX_ENERGY.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getMaxHealth() {
|
public float getMaxHealth() {
|
||||||
return MAX_HEALTH;
|
return VehicleConfig.ANNIHILATOR_HP.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -66,9 +66,6 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
public static final EntityDataAccessor<Integer> CANNON_FIRE_TIME = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> CANNON_FIRE_TIME = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Integer> LOADED_MISSILE = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> LOADED_MISSILE = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Integer> MISSILE_COUNT = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> MISSILE_COUNT = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
||||||
|
|
||||||
public static final float MAX_HEALTH = VehicleConfig.BMP_2_HP.get();
|
|
||||||
public static final int MAX_ENERGY = VehicleConfig.BMP_2_MAX_ENERGY.get();
|
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
public int reloadCoolDown;
|
public int reloadCoolDown;
|
||||||
|
|
||||||
|
@ -572,12 +569,12 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxEnergy() {
|
public int getMaxEnergy() {
|
||||||
return MAX_ENERGY;
|
return VehicleConfig.BMP_2_MAX_ENERGY.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getMaxHealth() {
|
public float getMaxHealth() {
|
||||||
return MAX_HEALTH;
|
return VehicleConfig.BMP_2_HP.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -65,10 +65,7 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
public static final EntityDataAccessor<Float> LASER_LENGTH = SynchedEntityData.defineId(LaserTowerEntity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> LASER_LENGTH = SynchedEntityData.defineId(LaserTowerEntity.class, EntityDataSerializers.FLOAT);
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
|
||||||
public static final float MAX_HEALTH = VehicleConfig.LASER_TOWER_HP.get();
|
public int changeTargetTimer = 60;
|
||||||
public static final int MAX_ENERGY = VehicleConfig.LASER_TOWER_MAX_ENERGY.get();
|
|
||||||
public static final int SHOOT_COST = VehicleConfig.LASER_TOWER_SHOOT_COST.get();
|
|
||||||
public int changeTargetTimer = 5000;
|
|
||||||
|
|
||||||
public LaserTowerEntity(PlayMessages.SpawnEntity packet, Level world) {
|
public LaserTowerEntity(PlayMessages.SpawnEntity packet, Level world) {
|
||||||
this(ModEntities.LASER_TOWER.get(), world);
|
this(ModEntities.LASER_TOWER.get(), world);
|
||||||
|
@ -308,7 +305,7 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
sendParticle(serverLevel, ParticleTypes.LAVA, target.getX(), target.getEyeY(), target.getZ(), 4, 0, 0, 0, 0.15, true);
|
sendParticle(serverLevel, ParticleTypes.LAVA, target.getX(), target.getEyeY(), target.getZ(), 4, 0, 0, 0, 0.15, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
target.hurt(ModDamageTypes.causeLaserStaticDamage(this.level().registryAccess(), this, this.getOwner()), (float) 15);
|
target.hurt(ModDamageTypes.causeLaserStaticDamage(this.level().registryAccess(), this, this.getOwner()), VehicleConfig.LASER_TOWER_DAMAGE.get());
|
||||||
target.invulnerableTime = 0;
|
target.invulnerableTime = 0;
|
||||||
entityData.set(LASER_LENGTH, distanceTo(target));
|
entityData.set(LASER_LENGTH, distanceTo(target));
|
||||||
if (Math.random() < 0.25 && target instanceof LivingEntity living) {
|
if (Math.random() < 0.25 && target instanceof LivingEntity living) {
|
||||||
|
@ -317,7 +314,7 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
if (!target.isAlive()) {
|
if (!target.isAlive()) {
|
||||||
entityData.set(TARGET_UUID, "none");
|
entityData.set(TARGET_UUID, "none");
|
||||||
}
|
}
|
||||||
this.consumeEnergy(SHOOT_COST);
|
this.consumeEnergy(VehicleConfig.LASER_TOWER_SHOOT_COST.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -366,11 +363,11 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxEnergy() {
|
public int getMaxEnergy() {
|
||||||
return MAX_ENERGY;
|
return VehicleConfig.LASER_TOWER_MAX_ENERGY.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getMaxHealth() {
|
public float getMaxHealth() {
|
||||||
return MAX_HEALTH;
|
return VehicleConfig.LASER_TOWER_HP.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,6 @@ import java.util.Comparator;
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
|
|
||||||
public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity {
|
public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity {
|
||||||
public static final float MAX_HEALTH = VehicleConfig.LAV_150_HP.get();
|
|
||||||
public static final int MAX_ENERGY = VehicleConfig.LAV_150_MAX_ENERGY.get();
|
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
|
||||||
public Lav150Entity(PlayMessages.SpawnEntity packet, Level world) {
|
public Lav150Entity(PlayMessages.SpawnEntity packet, Level world) {
|
||||||
|
@ -502,12 +500,12 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxEnergy() {
|
public int getMaxEnergy() {
|
||||||
return MAX_ENERGY;
|
return VehicleConfig.LAV_150_MAX_ENERGY.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getMaxHealth() {
|
public float getMaxHealth() {
|
||||||
return MAX_HEALTH;
|
return VehicleConfig.LAV_150_HP.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -58,7 +58,6 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
||||||
|
|
||||||
public static final EntityDataAccessor<Integer> COOL_DOWN = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> COOL_DOWN = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.INT);
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
public static final float MAX_HEALTH = VehicleConfig.MK42_HP.get();
|
|
||||||
public static final EntityDataAccessor<Float> PITCH = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> PITCH = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.FLOAT);
|
||||||
public static final EntityDataAccessor<Float> YAW = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> YAW = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.FLOAT);
|
||||||
|
|
||||||
|
@ -381,7 +380,7 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getMaxHealth() {
|
public float getMaxHealth() {
|
||||||
return MAX_HEALTH;
|
return VehicleConfig.MK42_HP.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -62,7 +62,6 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
||||||
public static final EntityDataAccessor<Float> PITCH = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> PITCH = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.FLOAT);
|
||||||
public static final EntityDataAccessor<Float> YAW = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> YAW = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.FLOAT);
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
public static final float MAX_HEALTH = VehicleConfig.MLE1934_HP.get();
|
|
||||||
|
|
||||||
public Mle1934Entity(PlayMessages.SpawnEntity packet, Level world) {
|
public Mle1934Entity(PlayMessages.SpawnEntity packet, Level world) {
|
||||||
this(ModEntities.MLE_1934.get(), world);
|
this(ModEntities.MLE_1934.get(), world);
|
||||||
|
@ -300,32 +299,8 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
||||||
consumed = InventoryTool.consumeItem(player.getInventory().items, ammo, 2);
|
consumed = InventoryTool.consumeItem(player.getInventory().items, ammo, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
float hitDamage;
|
|
||||||
float explosionRadius;
|
|
||||||
float explosionDamage;
|
|
||||||
float fireProbability;
|
|
||||||
int fireTime;
|
|
||||||
int durability;
|
|
||||||
boolean salvoShoot = consumed == 2;
|
boolean salvoShoot = consumed == 2;
|
||||||
|
|
||||||
if (getWeaponIndex(0) == 1) {
|
|
||||||
// HE
|
|
||||||
hitDamage = VehicleConfig.MLE1934_HE_DAMAGE.get();
|
|
||||||
explosionRadius = VehicleConfig.MLE1934_HE_EXPLOSION_RADIUS.get();
|
|
||||||
explosionDamage = VehicleConfig.MLE1934_HE_EXPLOSION_DAMAGE.get();
|
|
||||||
fireProbability = 0.24F;
|
|
||||||
fireTime = 5;
|
|
||||||
durability = 1;
|
|
||||||
} else {
|
|
||||||
// AP
|
|
||||||
hitDamage = VehicleConfig.MLE1934_AP_DAMAGE.get();
|
|
||||||
explosionRadius = VehicleConfig.MLE1934_AP_EXPLOSION_RADIUS.get();
|
|
||||||
explosionDamage = VehicleConfig.MLE1934_AP_EXPLOSION_DAMAGE.get();
|
|
||||||
fireProbability = 0;
|
|
||||||
fireTime = 0;
|
|
||||||
durability = 70;
|
|
||||||
}
|
|
||||||
|
|
||||||
float yRot = this.getYRot();
|
float yRot = this.getYRot();
|
||||||
if (yRot < 0) {
|
if (yRot < 0) {
|
||||||
yRot += 360;
|
yRot += 360;
|
||||||
|
@ -503,7 +478,7 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getMaxHealth() {
|
public float getMaxHealth() {
|
||||||
return MAX_HEALTH;
|
return VehicleConfig.MLE1934_HP.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -53,8 +53,6 @@ import java.util.Comparator;
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
|
|
||||||
public class SpeedboatEntity extends ContainerMobileVehicleEntity implements GeoEntity, ArmedVehicleEntity, WeaponVehicleEntity, LandArmorEntity {
|
public class SpeedboatEntity extends ContainerMobileVehicleEntity implements GeoEntity, ArmedVehicleEntity, WeaponVehicleEntity, LandArmorEntity {
|
||||||
public static final float MAX_HEALTH = VehicleConfig.SPEEDBOAT_HP.get();
|
|
||||||
public static final int MAX_ENERGY = VehicleConfig.SPEEDBOAT_MAX_ENERGY.get();
|
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
|
||||||
public SpeedboatEntity(PlayMessages.SpawnEntity packet, Level world) {
|
public SpeedboatEntity(PlayMessages.SpawnEntity packet, Level world) {
|
||||||
|
@ -437,12 +435,12 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxEnergy() {
|
public int getMaxEnergy() {
|
||||||
return MAX_ENERGY;
|
return VehicleConfig.SPEEDBOAT_MAX_ENERGY.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getMaxHealth() {
|
public float getMaxHealth() {
|
||||||
return MAX_HEALTH;
|
return VehicleConfig.SPEEDBOAT_HP.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -50,8 +50,6 @@ import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
||||||
public static final EntityDataAccessor<Boolean> MELON = SynchedEntityData.defineId(Tom6Entity.class, EntityDataSerializers.BOOLEAN);
|
public static final EntityDataAccessor<Boolean> MELON = SynchedEntityData.defineId(Tom6Entity.class, EntityDataSerializers.BOOLEAN);
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
public static final float MAX_HEALTH = VehicleConfig.TOM_6_HP.get();
|
|
||||||
public static final int MAX_ENERGY = VehicleConfig.TOM_6_MAX_ENERGY.get();
|
|
||||||
|
|
||||||
public Tom6Entity(PlayMessages.SpawnEntity packet, Level world) {
|
public Tom6Entity(PlayMessages.SpawnEntity packet, Level world) {
|
||||||
this(ModEntities.TOM_6.get(), world);
|
this(ModEntities.TOM_6.get(), world);
|
||||||
|
@ -342,12 +340,12 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getMaxHealth() {
|
public float getMaxHealth() {
|
||||||
return MAX_HEALTH;
|
return VehicleConfig.TOM_6_HP.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxEnergy() {
|
public int getMaxEnergy() {
|
||||||
return MAX_ENERGY;
|
return VehicleConfig.TOM_6_MAX_ENERGY.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.atsuishio.superbwarfare.entity.vehicle;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.MortarEntity;
|
import com.atsuishio.superbwarfare.entity.MortarEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
|
@ -42,8 +43,7 @@ import java.util.List;
|
||||||
public class WheelChairEntity extends MobileVehicleEntity implements GeoEntity {
|
public class WheelChairEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
|
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
public static final float MAX_HEALTH = 30;
|
|
||||||
public static final int MAX_ENERGY = 24000;
|
|
||||||
public int jumpCoolDown;
|
public int jumpCoolDown;
|
||||||
public int handBusyTime;
|
public int handBusyTime;
|
||||||
|
|
||||||
|
@ -185,13 +185,13 @@ public class WheelChairEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
if (passenger instanceof ServerPlayer serverPlayer) {
|
if (passenger instanceof ServerPlayer serverPlayer) {
|
||||||
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.WHEEL_CHAIR_JUMP.get(), SoundSource.PLAYERS, 1, 1);
|
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.WHEEL_CHAIR_JUMP.get(), SoundSource.PLAYERS, 1, 1);
|
||||||
}
|
}
|
||||||
this.consumeEnergy(400);
|
this.consumeEnergy(VehicleConfig.WHEELCHAIR_JUMP_ENERGY_COST.get());
|
||||||
this.setDeltaMovement(this.getDeltaMovement().add(0, 0.6, 0));
|
this.setDeltaMovement(this.getDeltaMovement().add(0, 0.6, 0));
|
||||||
jumpCoolDown = 3;
|
jumpCoolDown = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.forwardInputDown || this.backInputDown) {
|
if (this.forwardInputDown || this.backInputDown) {
|
||||||
this.consumeEnergy(1);
|
this.consumeEnergy(VehicleConfig.WHEELCHAIR_MOVE_ENERGY_COST.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (passenger instanceof Player player && player.level().isClientSide && this.handBusyTime > 0) {
|
if (passenger instanceof Player player && player.level().isClientSide && this.handBusyTime > 0) {
|
||||||
|
@ -275,12 +275,12 @@ public class WheelChairEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getMaxHealth() {
|
public float getMaxHealth() {
|
||||||
return MAX_HEALTH;
|
return VehicleConfig.WHEELCHAIR_HP.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxEnergy() {
|
public int getMaxEnergy() {
|
||||||
return MAX_ENERGY;
|
return VehicleConfig.WHEELCHAIR_MAX_ENERGY.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -71,9 +71,6 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
public static final EntityDataAccessor<Integer> LOADED_AMMO = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> LOADED_AMMO = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Integer> GUN_FIRE_TIME = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> GUN_FIRE_TIME = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
|
||||||
|
|
||||||
public static final float MAX_HEALTH = VehicleConfig.YX_100_HP.get();
|
|
||||||
public static final int MAX_ENERGY = VehicleConfig.YX_100_MAX_ENERGY.get();
|
|
||||||
public static final int SHOOT_COST = VehicleConfig.YX_100_SHOOT_COST.get();
|
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
|
||||||
public Yx100Entity(PlayMessages.SpawnEntity packet, Level world) {
|
public Yx100Entity(PlayMessages.SpawnEntity packet, Level world) {
|
||||||
|
@ -307,7 +304,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
}
|
}
|
||||||
if (reloadCoolDown == 0 && type == 0) {
|
if (reloadCoolDown == 0 && type == 0) {
|
||||||
|
|
||||||
if (!this.canConsume(SHOOT_COST)) {
|
if (!this.canConsume(VehicleConfig.YX_100_SHOOT_COST.get())) {
|
||||||
player.displayClientMessage(Component.translatable("tips.superbwarfare.annihilator.energy_not_enough").withStyle(ChatFormatting.RED), true);
|
player.displayClientMessage(Component.translatable("tips.superbwarfare.annihilator.energy_not_enough").withStyle(ChatFormatting.RED), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -477,7 +474,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.forwardInputDown || this.backInputDown) {
|
if (this.forwardInputDown || this.backInputDown) {
|
||||||
this.consumeEnergy(VehicleConfig.BMP_2_ENERGY_COST.get());
|
this.consumeEnergy(VehicleConfig.YX_100_ENERGY_COST.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.entityData.set(POWER, this.entityData.get(POWER) * (upInputDown ? 0.5f : (rightInputDown || leftInputDown) ? 0.947f : 0.96f));
|
this.entityData.set(POWER, this.entityData.get(POWER) * (upInputDown ? 0.5f : (rightInputDown || leftInputDown) ? 0.947f : 0.96f));
|
||||||
|
@ -672,12 +669,12 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxEnergy() {
|
public int getMaxEnergy() {
|
||||||
return MAX_ENERGY;
|
return VehicleConfig.YX_100_MAX_ENERGY.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getMaxHealth() {
|
public float getMaxHealth() {
|
||||||
return MAX_HEALTH;
|
return VehicleConfig.YX_100_HP.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -695,7 +692,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
@Override
|
@Override
|
||||||
public boolean canShoot(Player player) {
|
public boolean canShoot(Player player) {
|
||||||
return switch (getSeatIndex(player)) {
|
return switch (getSeatIndex(player)) {
|
||||||
case 0 -> this.entityData.get(LOADED_AMMO) > 0 && getEnergy() > SHOOT_COST;
|
case 0 -> this.entityData.get(LOADED_AMMO) > 0 && getEnergy() > VehicleConfig.YX_100_SHOOT_COST.get();
|
||||||
case 1 -> (this.entityData.get(MG_AMMO) > 0 || InventoryTool.hasCreativeAmmoBox(player)) && !cannotFire;
|
case 1 -> (this.entityData.get(MG_AMMO) > 0 || InventoryTool.hasCreativeAmmoBox(player)) && !cannotFire;
|
||||||
default -> false;
|
default -> false;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue