添加A10的配置项

This commit is contained in:
Atsuishio 2025-05-10 22:11:03 +08:00 committed by Light_Quanta
parent 709f36a812
commit a98b85e278
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
8 changed files with 140 additions and 71 deletions

View file

@ -32,6 +32,13 @@ public class ExplosionConfig {
public static ModConfigSpec.IntValue WIRE_GUIDE_MISSILE_DAMAGE;
public static ModConfigSpec.IntValue WIRE_GUIDE_MISSILE_EXPLOSION_DAMAGE;
public static ModConfigSpec.IntValue WIRE_GUIDE_MISSILE_EXPLOSION_RADIUS;
public static ModConfigSpec.IntValue AGM_65_DAMAGE;
public static ModConfigSpec.IntValue AGM_65_EXPLOSION_DAMAGE;
public static ModConfigSpec.DoubleValue AGM_65_EXPLOSION_RADIUS;
public static ModConfigSpec.IntValue MK_82_EXPLOSION_DAMAGE;
public static ModConfigSpec.DoubleValue MK_82_EXPLOSION_RADIUS;
public static void init(ModConfigSpec.Builder builder) {
builder.push("explosion");
@ -115,7 +122,7 @@ public class ExplosionConfig {
builder.comment("The explosion damage of wire guide missile");
WIRE_GUIDE_MISSILE_EXPLOSION_DAMAGE = builder.defineInRange("wire_guide_missile_explosion_damage", 60, 1, Integer.MAX_VALUE);
builder.comment("The explosion radius of wre guide missile");
builder.comment("The explosion radius of wire guide missile");
WIRE_GUIDE_MISSILE_EXPLOSION_RADIUS = builder.defineInRange("wire_guide_missile_explosion_radius", 6, 1, Integer.MAX_VALUE);
builder.pop();
@ -130,6 +137,29 @@ public class ExplosionConfig {
builder.pop();
builder.push("AGM-65");
builder.comment("The damage of AGM-65");
AGM_65_DAMAGE = builder.defineInRange("agm_65_damage", 1100, 1, Integer.MAX_VALUE);
builder.comment("The explosion damage of AGM-65");
AGM_65_EXPLOSION_DAMAGE = builder.defineInRange("agm_65_explosion_damage", 150, 1, Integer.MAX_VALUE);
builder.comment("The explosion radius of AGM-65");
AGM_65_EXPLOSION_RADIUS = builder.defineInRange("agm_65_explosion_radius", 9d, 1, Integer.MAX_VALUE);
builder.pop();
builder.push("MK-82");
builder.comment("The explosion damage of MK-82");
MK_82_EXPLOSION_DAMAGE = builder.defineInRange("mk_82_explosion_damage", 650, 1, Integer.MAX_VALUE);
builder.comment("The explosion radius of MK-82");
MK_82_EXPLOSION_RADIUS = builder.defineInRange("mk_82_explosion_radius", 11d, 1, Integer.MAX_VALUE);
builder.pop();
builder.pop();
}
}

View file

@ -118,6 +118,16 @@ public class VehicleConfig {
public static ModConfigSpec.IntValue HPJ11_SHOOT_COST;
public static ModConfigSpec.IntValue HPJ11_SEEK_COST;
public static ModConfigSpec.IntValue A_10_HP;
public static ModConfigSpec.IntValue A_10_MAX_ENERGY_COST;
public static ModConfigSpec.IntValue A_10_MAX_ENERGY;
public static ModConfigSpec.IntValue A_10_CANNON_DAMAGE;
public static ModConfigSpec.IntValue A_10_CANNON_EXPLOSION_DAMAGE;
public static ModConfigSpec.DoubleValue A_10_CANNON_EXPLOSION_RADIUS;
public static ModConfigSpec.IntValue A_10_ROCKET_DAMAGE;
public static ModConfigSpec.IntValue A_10_ROCKET_EXPLOSION_DAMAGE;
public static ModConfigSpec.DoubleValue A_10_ROCKET_EXPLOSION_RADIUS;
public static void init(ModConfigSpec.Builder builder) {
builder.push("vehicle");
@ -462,6 +472,37 @@ public class VehicleConfig {
builder.pop();
builder.push("A-10");
builder.comment("The health of A-10");
A_10_HP = builder.defineInRange("A_10_hp", 350, 1, 10000000);
builder.comment("The max energy cost of A-10 per tick");
A_10_MAX_ENERGY_COST = builder.defineInRange("A_10_max_energy_cost", 256, 0, 2147483647);
builder.comment("The max energy storage of A-10");
A_10_MAX_ENERGY = builder.defineInRange("A_10_max_energy", 10000000, 0, 2147483647);
builder.comment("The cannon damage of A-10");
A_10_CANNON_DAMAGE = builder.defineInRange("A_10_cannon_damage", 30, 1, 10000000);
builder.comment("The cannon explosion damage of A-10");
A_10_CANNON_EXPLOSION_DAMAGE = builder.defineInRange("A_10_cannon_explosion_damage", 10, 1, 10000000);
builder.comment("The cannon explosion damage of A-10");
A_10_CANNON_EXPLOSION_RADIUS = builder.defineInRange("A_10_cannon_explosion_damage", 4d, 1, 10000000);
builder.comment("The rocket damage of A-10");
A_10_ROCKET_DAMAGE = builder.defineInRange("A_10_rocket_damage", 90, 1, 10000000);
builder.comment("The rocket explosion damage of A-10");
A_10_ROCKET_EXPLOSION_DAMAGE = builder.defineInRange("A_10_rocket_explosion_damage", 50, 1, 10000000);
builder.comment("The rocket explosion radius of A-10");
A_10_ROCKET_EXPLOSION_RADIUS = builder.defineInRange("A_10_rocket_explosion_radius", 6d, 1, 10000000);
builder.pop();
builder.pop();
}
}

View file

@ -53,9 +53,6 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(Agm65Entity.class, EntityDataSerializers.FLOAT);
public static final EntityDataAccessor<String> TARGET_UUID = SynchedEntityData.defineId(Agm65Entity.class, EntityDataSerializers.STRING);
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
private float damage = 1100.0f;
private float explosion_damage = 150f;
private float explosion_radius = 9f;
private boolean distracted = false;
public Agm65Entity(EntityType<? extends Agm65Entity> type, Level world) {
@ -63,11 +60,8 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
this.noCulling = true;
}
public Agm65Entity(LivingEntity entity, Level level, float damage, float explosion_damage, float explosion_radius) {
public Agm65Entity(LivingEntity entity, Level level) {
super(ModEntities.AGM_65.get(), entity, level);
this.damage = damage;
this.explosion_damage = explosion_damage;
this.explosion_radius = explosion_radius;
}
public void setTargetUuid(String uuid) {
@ -146,7 +140,7 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
}
}
entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), this.damage);
entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), ExplosionConfig.AGM_65_DAMAGE.get());
if (entity instanceof LivingEntity) {
entity.invulnerableTime = 0;
@ -232,7 +226,7 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
if (this.level() instanceof ServerLevel) {
ProjectileTool.causeCustomExplode(this,
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
this, this.explosion_damage, this.explosion_radius, 1);
this, ExplosionConfig.AGM_65_EXPLOSION_DAMAGE.get(), ExplosionConfig.AGM_65_EXPLOSION_RADIUS.get().floatValue(), 1);
}
this.discard();
}
@ -247,11 +241,11 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(),
this,
this.getOwner()),
explosion_damage,
ExplosionConfig.AGM_65_EXPLOSION_DAMAGE.get(),
this.getX(),
this.getEyeY(),
this.getZ(),
explosion_radius,
ExplosionConfig.AGM_65_EXPLOSION_RADIUS.get().floatValue(),
ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP, true).
setDamageMultiplier(1);
explosion.explode();

View file

@ -1,5 +1,6 @@
package com.atsuishio.superbwarfare.entity.projectile;
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
import com.atsuishio.superbwarfare.entity.LoudlyEntity;
import com.atsuishio.superbwarfare.init.ModEntities;
import com.atsuishio.superbwarfare.init.ModItems;
@ -29,18 +30,14 @@ import software.bernie.geckolib.util.GeckoLibUtil;
public class Mk82Entity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity, LoudlyEntity, AerialBombEntity {
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(Mk82Entity.class, EntityDataSerializers.FLOAT);
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
private float explosion_damage = 650f;
private float explosion_radius = 11f;
public Mk82Entity(EntityType<? extends Mk82Entity> type, Level world) {
super(type, world);
this.noCulling = true;
}
public Mk82Entity(LivingEntity entity, Level level, float explosion_damage, float explosion_radius) {
public Mk82Entity(LivingEntity entity, Level level) {
super(ModEntities.MK_82.get(), entity, level);
this.explosion_damage = explosion_damage;
this.explosion_radius = explosion_radius;
}
public Mk82Entity(EntityType<? extends ThrowableItemProjectile> pEntityType, double pX, double pY, double pZ, Level pLevel) {
@ -109,7 +106,7 @@ public class Mk82Entity extends FastThrowableProjectile implements GeoEntity, De
@Override
public void onHitBlock(@NotNull BlockHitResult blockHitResult) {
super.onHitBlock(blockHitResult);
ProjectileTool.causeCustomExplode(this, explosion_damage, explosion_radius, 1.2f);
ProjectileTool.causeCustomExplode(this, ExplosionConfig.MK_82_EXPLOSION_DAMAGE.get(), ExplosionConfig.MK_82_EXPLOSION_RADIUS.get().floatValue(), 1.2f);
this.discard();
}
@ -121,7 +118,7 @@ public class Mk82Entity extends FastThrowableProjectile implements GeoEntity, De
if (tickCount > 600 || this.entityData.get(HEALTH) <= 0) {
if (!this.level().isClientSide) {
ProjectileTool.causeCustomExplode(this, explosion_damage, explosion_radius, 1.2f);
ProjectileTool.causeCustomExplode(this, ExplosionConfig.MK_82_EXPLOSION_DAMAGE.get(), ExplosionConfig.MK_82_EXPLOSION_RADIUS.get().floatValue(), 1.2f);
}
this.discard();
}

View file

@ -90,24 +90,19 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
return new VehicleWeapon[][]{
new VehicleWeapon[]{
new SmallCannonShellWeapon()
.damage(25)
.explosionDamage(10)
.explosionRadius(4)
.damage(VehicleConfig.A_10_CANNON_DAMAGE.get())
.explosionDamage(VehicleConfig.A_10_CANNON_EXPLOSION_DAMAGE.get())
.explosionRadius(VehicleConfig.A_10_CANNON_EXPLOSION_RADIUS.get().floatValue())
.sound(ModSounds.INTO_CANNON.get())
.icon(Mod.loc("textures/screens/vehicle_weapon/cannon_30mm.png")),
new HeliRocketWeapon()
.damage(100)
.explosionDamage(50)
.explosionRadius(6)
.damage(VehicleConfig.A_10_ROCKET_DAMAGE.get())
.explosionDamage(VehicleConfig.A_10_ROCKET_EXPLOSION_DAMAGE.get())
.explosionRadius(VehicleConfig.A_10_ROCKET_EXPLOSION_RADIUS.get().floatValue())
.sound(ModSounds.INTO_MISSILE.get()),
new Mk82Weapon()
.explosionDamage(650)
.explosionRadius(11)
.sound(ModSounds.INTO_MISSILE.get()),
new Agm65Weapon()
.damage(1100)
.explosionDamage(150)
.explosionRadius(9)
.sound(ModSounds.INTO_MISSILE.get()),
}
};
@ -365,13 +360,14 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
}
} else if (passenger instanceof Player player) {
if (forwardInputDown && getEnergy() > 0) {
this.consumeEnergy(VehicleConfig.TOM_6_ENERGY_COST.get());
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.002f, 1f));
}
if (getEnergy() > 0) {
if (forwardInputDown) {
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.002f, 1f));
}
if (backInputDown) {
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.002f, onGround() ? -0.04f : 0.05f));
if (backInputDown) {
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.002f, onGround() ? -0.04f : 0.05f));
}
}
if (!onGround()) {
@ -441,10 +437,12 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
this.entityData.set(POWER, this.entityData.get(POWER) * 0.99f);
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * 0.95f);
if (getEnergy() > 0) {
this.consumeEnergy((int) Mth.abs(this.entityData.get(POWER)) * VehicleConfig.A_10_MAX_ENERGY_COST.get());
}
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale(Math.max((90 + this.getXRot()) / 90, 0.8) * 0.4 * this.entityData.get(POWER))));
double flapAngle = (getFlap1LRot() + getFlap1RRot()) / 2;
setDeltaMovement(getDeltaMovement().add(0.0f, Mth.clamp(Math.sin((onGround() ? 23 + flapAngle : -(getXRot() - 23) + flapAngle) * Mth.DEG_TO_RAD) * Math.sin((90 - this.getXRot()) * Mth.DEG_TO_RAD) * getDeltaMovement().dot(getViewVector(1)) * 0.063, -0.04, 0.065), 0.0f));
}
@ -626,12 +624,12 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
@Override
public float getMaxHealth() {
return 300;
return VehicleConfig.A_10_HP.get();
}
@Override
public int getMaxEnergy() {
return 5000000;
return VehicleConfig.A_10_MAX_ENERGY.get();
}
@Override

View file

@ -5,28 +5,11 @@ import com.atsuishio.superbwarfare.entity.projectile.Agm65Entity;
import net.minecraft.world.entity.LivingEntity;
public class Agm65Weapon extends VehicleWeapon {
public float damage = 1100, explosionDamage = 150, explosionRadius = 9;
public Agm65Weapon() {
this.icon = Mod.loc("textures/screens/vehicle_weapon/agm_65.png");
}
public Agm65Weapon damage(float damage) {
this.damage = damage;
return this;
}
public Agm65Weapon explosionDamage(float explosionDamage) {
this.explosionDamage = explosionDamage;
return this;
}
public Agm65Weapon explosionRadius(float explosionRadius) {
this.explosionRadius = explosionRadius;
return this;
}
public Agm65Entity create(LivingEntity entity) {
return new Agm65Entity(entity, entity.level(), damage, explosionDamage, explosionRadius);
return new Agm65Entity(entity, entity.level());
}
}

View file

@ -5,23 +5,11 @@ import com.atsuishio.superbwarfare.entity.projectile.Mk82Entity;
import net.minecraft.world.entity.LivingEntity;
public class Mk82Weapon extends VehicleWeapon {
public float explosionDamage = 650, explosionRadius = 11;
public Mk82Weapon() {
this.icon = Mod.loc("textures/screens/vehicle_weapon/mk_82.png");
}
public Mk82Weapon explosionDamage(float explosionDamage) {
this.explosionDamage = explosionDamage;
return this;
}
public Mk82Weapon explosionRadius(float explosionRadius) {
this.explosionRadius = explosionRadius;
return this;
}
public Mk82Entity create(LivingEntity entity) {
return new Mk82Entity(entity, entity.level(), explosionDamage, explosionRadius);
return new Mk82Entity(entity, entity.level());
}
}

View file

@ -0,0 +1,38 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"pattern": [
"dad",
"ece",
"fbf"
],
"key": {
"a": {
"item": "superbwarfare:medium_armament_module"
},
"b": {
"tag": "superbwarfare:storage_blocks/steel"
},
"c": {
"item": "superbwarfare:heavy_armament_module"
},
"d": {
"item": "superbwarfare:large_propeller"
},
"e": {
"item": "superbwarfare:large_motor"
},
"f": {
"item": "superbwarfare:medium_battery_pack"
}
},
"result": {
"id": "superbwarfare:container",
"components": {
"minecraft:block_entity_data": {
"id": "superbwarfare:container",
"EntityType": "superbwarfare:a_10a"
}
}
}
}