From a98b85e278e722a9513282ff93c8b06b7f061048 Mon Sep 17 00:00:00 2001 From: Atsuishio <842960157@qq.com> Date: Sat, 10 May 2025 22:11:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0A10=E7=9A=84=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/server/ExplosionConfig.java | 32 ++++++++++++++- .../config/server/VehicleConfig.java | 41 +++++++++++++++++++ .../entity/projectile/Agm65Entity.java | 16 +++----- .../entity/projectile/Mk82Entity.java | 11 ++--- .../entity/vehicle/A10Entity.java | 40 +++++++++--------- .../entity/vehicle/weapon/Agm65Weapon.java | 19 +-------- .../entity/vehicle/weapon/Mk82Weapon.java | 14 +------ .../superbwarfare/recipe/a10_crafting.json | 38 +++++++++++++++++ 8 files changed, 140 insertions(+), 71 deletions(-) create mode 100644 src/main/resources/data/superbwarfare/recipe/a10_crafting.json diff --git a/src/main/java/com/atsuishio/superbwarfare/config/server/ExplosionConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/server/ExplosionConfig.java index 61e20bb0e..588b526cf 100644 --- a/src/main/java/com/atsuishio/superbwarfare/config/server/ExplosionConfig.java +++ b/src/main/java/com/atsuishio/superbwarfare/config/server/ExplosionConfig.java @@ -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(); } } 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 3c990167c..eec35fd2a 100644 --- a/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java +++ b/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java @@ -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(); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Agm65Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Agm65Entity.java index 09ad445b2..a58d47bbe 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Agm65Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Agm65Entity.java @@ -53,9 +53,6 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D public static final EntityDataAccessor HEALTH = SynchedEntityData.defineId(Agm65Entity.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor 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 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(); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Mk82Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Mk82Entity.java index e0f45d0da..9f2809c2c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Mk82Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Mk82Entity.java @@ -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 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 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 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(); } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/A10Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/A10Entity.java index a7fdd0269..12c4c39e9 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/A10Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/A10Entity.java @@ -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 diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/weapon/Agm65Weapon.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/weapon/Agm65Weapon.java index 3b1e7563f..f78f719ca 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/weapon/Agm65Weapon.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/weapon/Agm65Weapon.java @@ -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()); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/weapon/Mk82Weapon.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/weapon/Mk82Weapon.java index a4e542562..be736bc12 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/weapon/Mk82Weapon.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/weapon/Mk82Weapon.java @@ -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()); } } diff --git a/src/main/resources/data/superbwarfare/recipe/a10_crafting.json b/src/main/resources/data/superbwarfare/recipe/a10_crafting.json new file mode 100644 index 000000000..7fed82631 --- /dev/null +++ b/src/main/resources/data/superbwarfare/recipe/a10_crafting.json @@ -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" + } + } + } +} \ No newline at end of file