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 9626137c3..6a76a4df6 100644 --- a/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java +++ b/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java @@ -94,6 +94,8 @@ public class VehicleConfig { public static ModConfigSpec.IntValue YX_100_HE_CANNON_DAMAGE; public static ModConfigSpec.IntValue YX_100_HE_CANNON_EXPLOSION_DAMAGE; public static ModConfigSpec.DoubleValue YX_100_HE_CANNON_EXPLOSION_RADIUS; + public static ModConfigSpec.IntValue YX_100_SWARM_EXPLOSION_DAMAGE; + public static ModConfigSpec.DoubleValue YX_100_SWARM_EXPLOSION_RADIUS; public static ModConfigSpec.IntValue PRISM_TANK_HP; public static ModConfigSpec.IntValue PRISM_TANK_MAX_ENERGY; @@ -376,6 +378,12 @@ public class VehicleConfig { builder.comment("The cannon explosion radius of Yx_100"); YX_100_HE_CANNON_EXPLOSION_RADIUS = builder.defineInRange("yx_100_he_cannon_explosion_radius", 10d, 1d, 10000000d); + builder.comment("The swarm drone explosion damage of Yx_100"); + YX_100_SWARM_EXPLOSION_DAMAGE = builder.defineInRange("yx_100_swarm_drone_explosion_damage", 80, 1, 10000000); + + builder.comment("The swarm drone explosion radius of Yx_100"); + YX_100_SWARM_EXPLOSION_RADIUS = builder.defineInRange("yx_100_swarm_drone_explosion_radius", 5d, 1d, 10000000d); + builder.pop(); builder.push("prism_tank"); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SwarmDroneEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SwarmDroneEntity.java index cca650308..89700450b 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SwarmDroneEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SwarmDroneEntity.java @@ -50,8 +50,8 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti public static final EntityDataAccessor HEALTH = SynchedEntityData.defineId(SwarmDroneEntity.class, EntityDataSerializers.FLOAT); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - private float explosionDamage = 125f; - private float explosionRadius = 6f; + private float explosionDamage = 80f; + private float explosionRadius = 5f; private float randomFloat; private int guide_type = 0; @@ -171,8 +171,7 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti return; } if (this.level() instanceof ServerLevel) { - causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), - this, this.explosionDamage, this.explosionRadius); + causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius); } } @@ -180,8 +179,7 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti public void onHitBlock(@NotNull BlockHitResult blockHitResult) { super.onHitBlock(blockHitResult); if (this.level() instanceof ServerLevel) { - causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), - this, this.explosionDamage, this.explosionRadius); + causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius); } } @@ -222,8 +220,7 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti if (dis < 0.5) { if (this.level() instanceof ServerLevel) { - causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), - this, this.explosionDamage, this.explosionRadius); + causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius); } this.discard(); } @@ -231,16 +228,14 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti if (this.tickCount > 300 || this.isInWater()) { if (this.level() instanceof ServerLevel) { - causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), - this, this.explosionDamage, this.explosionRadius); + causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius); } this.discard(); } if (this.entityData.get(HEALTH) <= 0) { if (this.level() instanceof ServerLevel) { - causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), - this, this.explosionDamage, this.explosionRadius); + causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius); } this.discard(); } @@ -250,7 +245,7 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti protected void updateRotation() { } - public void causeMissileExplode(@Nullable DamageSource source, Entity target, float damage, float radius) { + public void causeMissileExplode(@Nullable DamageSource source, float damage, float radius) { if (this.getOwner() instanceof LivingEntity living) { if (!living.level().isClientSide() && living instanceof ServerPlayer player) { living.level().playSound(null, living.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1); @@ -260,7 +255,7 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti } CustomExplosion explosion = new CustomExplosion(level(), this, source, damage, - target.getX(), target.getEyeY(), target.getZ(), radius, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1.25f); + this.getX(), this.getY(), this.getZ(), radius, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1.25f); explosion.explode(); EventHooks.onExplosionStart(level(), explosion); explosion.finalizeExplosion(false); 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 5c0535159..bb9e9ab51 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java @@ -144,8 +144,8 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti new VehicleWeapon[]{ // 蜂群无人机 new SwarmDroneWeapon() - .explosionDamage(125) - .explosionRadius(6) + .explosionDamage(VehicleConfig.YX_100_SWARM_EXPLOSION_DAMAGE.get()) + .explosionRadius(VehicleConfig.YX_100_SWARM_EXPLOSION_RADIUS.get().floatValue()) .sound(ModSounds.INTO_MISSILE.get()), } }; diff --git a/src/main/java/com/atsuishio/superbwarfare/tools/CustomExplosion.java b/src/main/java/com/atsuishio/superbwarfare/tools/CustomExplosion.java index 31205aeb5..a8ea84b33 100644 --- a/src/main/java/com/atsuishio/superbwarfare/tools/CustomExplosion.java +++ b/src/main/java/com/atsuishio/superbwarfare/tools/CustomExplosion.java @@ -189,6 +189,7 @@ public class CustomExplosion extends Explosion { } else { entity.hurt(this.damageSource, (float) damageFinal); } + entity.invulnerableTime = 1; if (fireTime > 0) { entity.setRemainingFireTicks(fireTime);