添加蜂群的配置
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_DAMAGE;
|
||||||
public static ModConfigSpec.IntValue YX_100_HE_CANNON_EXPLOSION_DAMAGE;
|
public static ModConfigSpec.IntValue YX_100_HE_CANNON_EXPLOSION_DAMAGE;
|
||||||
public static ModConfigSpec.DoubleValue YX_100_HE_CANNON_EXPLOSION_RADIUS;
|
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_HP;
|
||||||
public static ModConfigSpec.IntValue PRISM_TANK_MAX_ENERGY;
|
public static ModConfigSpec.IntValue PRISM_TANK_MAX_ENERGY;
|
||||||
|
@ -376,6 +378,12 @@ public class VehicleConfig {
|
||||||
builder.comment("The cannon explosion radius of Yx_100");
|
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);
|
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.pop();
|
||||||
|
|
||||||
builder.push("prism_tank");
|
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);
|
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(SwarmDroneEntity.class, EntityDataSerializers.FLOAT);
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
|
||||||
private float explosionDamage = 125f;
|
private float explosionDamage = 80f;
|
||||||
private float explosionRadius = 6f;
|
private float explosionRadius = 5f;
|
||||||
|
|
||||||
private float randomFloat;
|
private float randomFloat;
|
||||||
private int guide_type = 0;
|
private int guide_type = 0;
|
||||||
|
@ -171,8 +171,7 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius);
|
||||||
this, this.explosionDamage, this.explosionRadius);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,8 +179,7 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
|
||||||
public void onHitBlock(@NotNull BlockHitResult blockHitResult) {
|
public void onHitBlock(@NotNull BlockHitResult blockHitResult) {
|
||||||
super.onHitBlock(blockHitResult);
|
super.onHitBlock(blockHitResult);
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius);
|
||||||
this, this.explosionDamage, this.explosionRadius);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,8 +220,7 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
|
||||||
|
|
||||||
if (dis < 0.5) {
|
if (dis < 0.5) {
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius);
|
||||||
this, this.explosionDamage, this.explosionRadius);
|
|
||||||
}
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
@ -231,16 +228,14 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
|
||||||
|
|
||||||
if (this.tickCount > 300 || this.isInWater()) {
|
if (this.tickCount > 300 || this.isInWater()) {
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius);
|
||||||
this, this.explosionDamage, this.explosionRadius);
|
|
||||||
}
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.entityData.get(HEALTH) <= 0) {
|
if (this.entityData.get(HEALTH) <= 0) {
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius);
|
||||||
this, this.explosionDamage, this.explosionRadius);
|
|
||||||
}
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
@ -250,7 +245,7 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
|
||||||
protected void updateRotation() {
|
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 (this.getOwner() instanceof LivingEntity living) {
|
||||||
if (!living.level().isClientSide() && living instanceof ServerPlayer player) {
|
if (!living.level().isClientSide() && living instanceof ServerPlayer player) {
|
||||||
living.level().playSound(null, living.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1);
|
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,
|
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();
|
explosion.explode();
|
||||||
EventHooks.onExplosionStart(level(), explosion);
|
EventHooks.onExplosionStart(level(), explosion);
|
||||||
explosion.finalizeExplosion(false);
|
explosion.finalizeExplosion(false);
|
||||||
|
|
|
@ -144,8 +144,8 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
new VehicleWeapon[]{
|
new VehicleWeapon[]{
|
||||||
// 蜂群无人机
|
// 蜂群无人机
|
||||||
new SwarmDroneWeapon()
|
new SwarmDroneWeapon()
|
||||||
.explosionDamage(125)
|
.explosionDamage(VehicleConfig.YX_100_SWARM_EXPLOSION_DAMAGE.get())
|
||||||
.explosionRadius(6)
|
.explosionRadius(VehicleConfig.YX_100_SWARM_EXPLOSION_RADIUS.get().floatValue())
|
||||||
.sound(ModSounds.INTO_MISSILE.get()),
|
.sound(ModSounds.INTO_MISSILE.get()),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -189,6 +189,7 @@ public class CustomExplosion extends Explosion {
|
||||||
} else {
|
} else {
|
||||||
entity.hurt(this.damageSource, (float) damageFinal);
|
entity.hurt(this.damageSource, (float) damageFinal);
|
||||||
}
|
}
|
||||||
|
entity.invulnerableTime = 1;
|
||||||
|
|
||||||
if (fireTime > 0) {
|
if (fireTime > 0) {
|
||||||
entity.setRemainingFireTicks(fireTime);
|
entity.setRemainingFireTicks(fireTime);
|
||||||
|
|
Loading…
Add table
Reference in a new issue