添加蜂群的配置
This commit is contained in:
parent
2defaacc9a
commit
fa62ce754d
4 changed files with 20 additions and 16 deletions
|
@ -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");
|
||||
|
|
|
@ -50,8 +50,8 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
|
|||
public static final EntityDataAccessor<Float> 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);
|
||||
|
|
|
@ -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()),
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue