修改配置类名,添加直升机配置

This commit is contained in:
Atsuihsio 2025-01-07 02:05:03 +08:00
parent 34259e35d3
commit 432421d8a2
11 changed files with 149 additions and 86 deletions

View file

@ -1,7 +1,7 @@
package com.atsuishio.superbwarfare.client.model.entity;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.CannonConfig;
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.entity.vehicle.AnnihilatorEntity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -72,7 +72,7 @@ public class AnnihilatorModel extends GeoModel<AnnihilatorEntity> {
CoreGeoBone ledRed5 = getAnimationProcessor().getBone("ledred5");
float coolDown = animatable.getEntityData().get(COOL_DOWN);
boolean cantShoot = animatable.getEnergy() < CannonConfig.ANNIHILATOR_SHOOT_COST.get();
boolean cantShoot = animatable.getEnergy() < VehicleConfig.ANNIHILATOR_SHOOT_COST.get();
ledGreen.setHidden(coolDown > 80 || cantShoot);
ledGreen2.setHidden(coolDown > 60 || cantShoot);

View file

@ -135,6 +135,15 @@ public class HelicopterHudOverlay {
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("TERRAIN TERRAIN"),
w / 2 - 42, h / 2 + 24, -65536, false);
}
if (mobileVehicle.getEnergy() < 0.02 * mobileVehicle.getMaxEnergy()) {
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal( "NO POWER!"),
w / 2 - 144, h / 2 + 14, -65536, false);
} else if (mobileVehicle.getEnergy() < 0.2 * mobileVehicle.getMaxEnergy()) {
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal( "LOW POWER"),
w / 2 - 144, h / 2 + 14, 0xFF6B00, false);
}
}
Matrix4f transform = getVehicleTransform(mobileVehicle);

View file

@ -1,9 +1,9 @@
package com.atsuishio.superbwarfare.config;
import com.atsuishio.superbwarfare.config.server.CannonConfig;
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
import com.atsuishio.superbwarfare.config.server.SpawnConfig;
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import net.minecraftforge.common.ForgeConfigSpec;
public class ServerConfig {
@ -14,7 +14,7 @@ public class ServerConfig {
SpawnConfig.init(builder);
ExplosionDestroyConfig.init(builder);
ExplosionConfig.init(builder);
CannonConfig.init(builder);
VehicleConfig.init(builder);
return builder.build();
}

View file

@ -2,7 +2,7 @@ package com.atsuishio.superbwarfare.config.server;
import net.minecraftforge.common.ForgeConfigSpec;
public class CannonConfig {
public class VehicleConfig {
public static ForgeConfigSpec.IntValue MK42_HP;
public static ForgeConfigSpec.IntValue MK42_AP_DAMAGE;
@ -29,11 +29,20 @@ public class CannonConfig {
public static ForgeConfigSpec.IntValue SPEEDBOAT_MAX_ENERGY;
public static ForgeConfigSpec.IntValue SPEEDBOAT_GUN_DAMAGE;
public static ForgeConfigSpec.IntValue AH_6_HP;
public static ForgeConfigSpec.IntValue AH_6_MIN_ENERGY_COST;
public static ForgeConfigSpec.IntValue AH_6_MAX_ENERGY_COST;
public static ForgeConfigSpec.IntValue AH_6_MAX_ENERGY;
public static ForgeConfigSpec.IntValue AH_6_CANNON_DAMAGE;
public static ForgeConfigSpec.IntValue AH_6_ROCKET_DAMAGE;
public static ForgeConfigSpec.IntValue AH_6_ROCKET_EXPLOSION_DAMAGE;
public static ForgeConfigSpec.IntValue AH_6_ROCKET_EXPLOSION_RADIUS;
public static void init(ForgeConfigSpec.Builder builder) {
builder.push("mk_42");
builder.comment("The HealthPoint of MK-42");
MK42_HP = builder.defineInRange("mk_42_hp", 500, 1, 10000000);
MK42_HP = builder.defineInRange("mk_42_hp", 700, 1, 10000000);
builder.comment("The AP shell damage of MK-42");
MK42_AP_DAMAGE = builder.defineInRange("mk_42_ap_damage", 300, 1, 10000000);
@ -58,7 +67,7 @@ public class CannonConfig {
builder.push("mle_1934");
builder.comment("The HealthPoint of MLE-1934");
MLE1934_HP = builder.defineInRange("mle_1934_hp", 600, 1, 10000000);
MLE1934_HP = builder.defineInRange("mle_1934_hp", 800, 1, 10000000);
builder.comment("The AP shell damage of MLE-1934");
MLE1934_AP_DAMAGE = builder.defineInRange("mle_1934_ap_damage", 350, 1, 10000000);
@ -96,18 +105,46 @@ public class CannonConfig {
builder.push("speedboat");
builder.comment("The HealthPoint of Speedboat");
SPEEDBOAT_HP = builder.defineInRange("speedboat_hp", 300, 1, 10000000);
SPEEDBOAT_HP = builder.defineInRange("speedboat_hp", 500, 1, 10000000);
builder.comment("The energy cost of Speedboat per control tick");
SPEEDBOAT_ENERGY_COST = builder.defineInRange("speedboat_energy_cost", 1, 0, 2147483647);
builder.comment("The energy cost of Speedboat per tick");
SPEEDBOAT_ENERGY_COST = builder.defineInRange("speedboat_energy_cost", 16, 0, 2147483647);
builder.comment("The max energy storage of Speedboat");
SPEEDBOAT_MAX_ENERGY = builder.defineInRange("speedboat_max_energy", 100000, 0, 2147483647);
SPEEDBOAT_MAX_ENERGY = builder.defineInRange("speedboat_max_energy", 1000000, 0, 2147483647);
builder.comment("The gun damage of Speedboat");
SPEEDBOAT_GUN_DAMAGE = builder.defineInRange("speedboat_gun_damage", 45, 1, 10000000);
builder.pop();
builder.push("ah_6");
builder.comment("The HealthPoint of AH-6");
AH_6_HP = builder.defineInRange("ah_6_hp", 500, 1, 10000000);
builder.comment("The min energy cost of AH-6 per tick");
AH_6_MIN_ENERGY_COST = builder.defineInRange("ah_6_min_energy_cost", 64, 0, 2147483647);
builder.comment("The max energy cost of AH-6 per tick");
AH_6_MAX_ENERGY_COST = builder.defineInRange("ah_6_max_energy_cost", 128, 0, 2147483647);
builder.comment("The max energy storage of AH-6");
AH_6_MAX_ENERGY = builder.defineInRange("ah_6_max_energy", 4000000, 0, 2147483647);
builder.comment("The cannon damage of AH-6");
AH_6_CANNON_DAMAGE = builder.defineInRange("ah_6_cannon_damage", 15, 1, 10000000);
builder.comment("The rocket damage of AH-6");
AH_6_ROCKET_DAMAGE = builder.defineInRange("ah_6_rocket_damage", 75, 1, 10000000);
builder.comment("The rocket explosion damage of AH-6");
AH_6_ROCKET_EXPLOSION_DAMAGE = builder.defineInRange("ah_6_rocket_explosion_damage", 50, 1, 10000000);
builder.comment("The rocket explosion radius of AH-6");
AH_6_ROCKET_EXPLOSION_RADIUS = builder.defineInRange("ah_6_rocket_explosion_radius", 5, 1, 10000000);
builder.pop();
}
}

View file

@ -2,6 +2,7 @@ package com.atsuishio.superbwarfare.entity.vehicle;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.entity.projectile.HeliRocketEntity;
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
import com.atsuishio.superbwarfare.init.*;
@ -58,8 +59,8 @@ import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHelicopterEntity, MultiWeaponVehicleEntity {
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
public static final float MAX_HEALTH = 500;
public static final int MAX_ENERGY = 4000000;
public static final float MAX_HEALTH = VehicleConfig.AH_6_HP.get();
public static final int MAX_ENERGY = VehicleConfig.AH_6_MAX_ENERGY.get();
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.FLOAT);
public static final EntityDataAccessor<Float> PROPELLER_ROT = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.FLOAT);
public static final EntityDataAccessor<Integer> WEAPON_TYPE = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.INT);
@ -147,7 +148,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
if (player != null) {
if ((this.getItemStacks().stream().filter(stack -> stack.is(ModItems.ROCKET_70.get())).mapToInt(ItemStack::getCount).sum() > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()))) && reloadCoolDown == 0 && this.getEntityData().get(LOADED_ROCKET) < 14) {
this.entityData.set(LOADED_ROCKET, this.getEntityData().get(LOADED_ROCKET) + 1);
reloadCoolDown = 30;
reloadCoolDown = 25;
if (!player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()))) {
this.getItemStacks().stream().filter(stack -> stack.is(ModItems.ROCKET_70.get())).findFirst().ifPresent(stack -> stack.shrink(1));
}
@ -193,52 +194,57 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
this.setZRot(this.roll * 0.8f);
this.setXRot(this.getXRot() * 0.8f);
this.entityData.set(POWER, this.entityData.get(POWER) * 0.98f);
} else if (passenger instanceof Player player) {
// if (level().isClientSide && this.getEnergy() > 0) {
// level().playLocalSound(this.getX(), this.getY() + this.getBbHeight() * 0.5, this.getZ(), this.getEngineSound(), this.getSoundSource(), Math.min((this.forwardInputDown || this.backInputDown ? 7.5f : 5f) * 2 * Mth.abs(this.entityData.get(POWER)), 0.25f), (random.nextFloat() * 0.1f + 1f), false);
// }
} else if (passenger instanceof Player) {
diffY = Math.clamp(-90f, 90f, Mth.wrapDegrees(passenger.getYHeadRot() - this.getYRot()));
diffX = Math.clamp(-60f, 60f, Mth.wrapDegrees(passenger.getXRot() - this.getXRot()));
if (rightInputDown) {
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) - 0.25f);
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) - 2.5f * this.entityData.get(PROPELLER_ROT));
} else if (this.leftInputDown) {
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) + 0.25f);
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) + 2.5f * this.entityData.get(PROPELLER_ROT));
}
this.setYRot(this.getYRot() + Mth.clamp((this.onGround() ? 0.1f : 2f) * diffY * this.entityData.get(POWER) - 0.5f * this.entityData.get(DELTA_ROT), -8f, 8f));
this.setXRot(Mth.clamp(this.getXRot() + (this.onGround() ? 0 : 1.4f) * diffX * this.entityData.get(POWER), -80, 80));
this.setZRot(Mth.clamp(this.getRoll() - this.entityData.get(DELTA_ROT) + (this.onGround() ? 0 : 0.2f) * diffY * this.entityData.get(POWER), -80, 80));
this.setYRot(this.getYRot() + Mth.clamp((this.onGround() ? 0.1f : 2f) * diffY * this.entityData.get(PROPELLER_ROT) - 0.5f * this.entityData.get(DELTA_ROT), -8f, 8f));
this.setXRot(Mth.clamp(this.getXRot() + (this.onGround() ? 0 : 1.4f) * diffX * this.entityData.get(PROPELLER_ROT), -80, 80));
this.setZRot(Mth.clamp(this.getRoll() - this.entityData.get(DELTA_ROT) + (this.onGround() ? 0 : 0.2f) * diffY * this.entityData.get(PROPELLER_ROT), -80, 80));
}
if (this.level() instanceof ServerLevel) {
boolean up = this.upInputDown || this.forwardInputDown;
boolean down = this.downInputDown || this.backInputDown;
if (this.getEnergy() > 0) {
boolean up = this.upInputDown || this.forwardInputDown;
boolean down = this.downInputDown || this.backInputDown;
if (!engineStart && up) {
engineStart = true;
this.level().playSound(null, this, ModSounds.HELICOPTER_ENGINE_START.get(), this.getSoundSource(), 3, 1);
}
if (up && engineStartOver) {
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.002f, 0.12f));
}
if (down && engineStartOver) {
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0015f, this.onGround() ? 0 : 0.0375f));
}
if (engineStart && !engineStartOver) {
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.0012f, 0.045f));
}
if (!(up || down) && engineStartOver) {
if (this.getDeltaMovement().y() + 0.06 < 0) {
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.0002f, 0.12f));
} else {
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - (this.onGround() ? 0.00005f : 0.0006f), 0));
if (!engineStart && up) {
engineStart = true;
this.level().playSound(null, this, ModSounds.HELICOPTER_ENGINE_START.get(), this.getSoundSource(), 3, 1);
}
if (up && engineStartOver) {
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.002f, 0.12f));
}
if (down && engineStartOver) {
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0015f, this.onGround() ? 0 : 0.0375f));
}
if (engineStart && !engineStartOver) {
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.0012f, 0.045f));
}
if (!(up || down) && engineStartOver) {
if (this.getDeltaMovement().y() < 0) {
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.0002f, 0.12f));
} else {
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - (this.onGround() ? 0.00005f : 0.0002f), 0));
}
}
} else {
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0001f, 0));
this.forwardInputDown = false;
this.backInputDown = false;
engineStart = false;
engineStartOver = false;
}
}
@ -247,12 +253,16 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
this.setPropellerRot(this.getPropellerRot() + 30 * this.entityData.get(PROPELLER_ROT));
this.entityData.set(PROPELLER_ROT, this.entityData.get(PROPELLER_ROT) * 0.9995f);
setDeltaMovement(getDeltaMovement().add(0.0f, Math.min(Math.sin((90 - this.getXRot()) * Mth.DEG_TO_RAD), Math.sin((90 + this.getRoll()) * Mth.DEG_TO_RAD)) * this.entityData.get(POWER), 0.0f));
if (engineStart) {
this.extraEnergy((int)(VehicleConfig.AH_6_MIN_ENERGY_COST.get() + this.entityData.get(POWER) * ((VehicleConfig.AH_6_MAX_ENERGY_COST.get() - VehicleConfig.AH_6_MIN_ENERGY_COST.get()) / 0.12)));
}
Vector3f direction = getRightDirection().mul(Math.cos((this.getRoll() + 90) * Mth.DEG_TO_RAD) * this.entityData.get(POWER));
setDeltaMovement(getDeltaMovement().add(0.0f, Math.min(Math.sin((90 - this.getXRot()) * Mth.DEG_TO_RAD), Math.sin((90 + this.getRoll()) * Mth.DEG_TO_RAD)) * this.entityData.get(PROPELLER_ROT), 0.0f));
Vector3f direction = getRightDirection().mul(Math.cos((this.getRoll() + 90) * Mth.DEG_TO_RAD) * this.entityData.get(PROPELLER_ROT));
setDeltaMovement(getDeltaMovement().add(new Vec3(direction.x, direction.y, direction.z).scale(0.85)));
Vector3f directionZ = getForwardDirection().mul(-Math.cos((this.getXRot() + 90) * Mth.DEG_TO_RAD) * this.entityData.get(POWER));
Vector3f directionZ = getForwardDirection().mul(-Math.cos((this.getXRot() + 90) * Mth.DEG_TO_RAD) * this.entityData.get(PROPELLER_ROT));
setDeltaMovement(getDeltaMovement().add(new Vec3(directionZ.x, directionZ.y, directionZ.z).scale(0.35)));
if (this.entityData.get(POWER) > 0.04f) {
@ -414,7 +424,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
Vector4f worldPositionLeft;
if (entityData.get(WEAPON_TYPE) == 0) {
x = 1.1f;
x = 1.4f;
y = 0.62f;
z = 0.8f;
@ -424,7 +434,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
if (this.entityData.get(AMMO) > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()))) {
ProjectileEntity projectileRight = new ProjectileEntity(player.level())
.shooter(player)
.damage(15)
.damage(VehicleConfig.AH_6_CANNON_DAMAGE.get())
.headShot(2f)
.zoom(false);
@ -443,7 +453,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
if (this.entityData.get(AMMO) > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()))) {
ProjectileEntity projectileLeft = new ProjectileEntity(player.level())
.shooter(player)
.damage(15)
.damage(VehicleConfig.AH_6_CANNON_DAMAGE.get())
.headShot(2f)
.zoom(false);
@ -486,9 +496,9 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
if (fireIndex == 0) {
HeliRocketEntity heliRocketEntityRight = new HeliRocketEntity(player, player.level(),
140,
50,
5);
VehicleConfig.AH_6_ROCKET_DAMAGE.get(),
VehicleConfig.AH_6_ROCKET_EXPLOSION_DAMAGE.get(),
VehicleConfig.AH_6_ROCKET_EXPLOSION_RADIUS.get());
heliRocketEntityRight.setPos(worldPositionRight.x, worldPositionRight.y, worldPositionRight.z);
heliRocketEntityRight.shoot(this.getLookAngle().x, this.getLookAngle().y + 0.0125, this.getLookAngle().z, 5, 0.25f);
@ -496,9 +506,9 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
fireIndex = 1;
} else if (fireIndex == 1) {
HeliRocketEntity heliRocketEntityLeft = new HeliRocketEntity(player, player.level(),
140,
50,
5);
VehicleConfig.AH_6_ROCKET_DAMAGE.get(),
VehicleConfig.AH_6_ROCKET_EXPLOSION_DAMAGE.get(),
VehicleConfig.AH_6_ROCKET_EXPLOSION_RADIUS.get());
heliRocketEntityLeft.setPos(worldPositionLeft.x, worldPositionLeft.y, worldPositionLeft.z);
heliRocketEntityLeft.shoot(this.getLookAngle().x, this.getLookAngle().y + 0.0125, this.getLookAngle().z, 5, 0.25f);

View file

@ -1,8 +1,8 @@
package com.atsuishio.superbwarfare.entity.vehicle;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.CannonConfig;
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.init.ModDamageTypes;
import com.atsuishio.superbwarfare.init.ModEntities;
import com.atsuishio.superbwarfare.init.ModParticleTypes;
@ -62,9 +62,9 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
public static final EntityDataAccessor<Float> OFFSET_ANGLE = SynchedEntityData.defineId(AnnihilatorEntity.class, EntityDataSerializers.FLOAT);
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
public static final float MAX_HEALTH = CannonConfig.ANNIHILATOR_HP.get();
public static final int MAX_ENERGY = CannonConfig.ANNIHILATOR_MAX_ENERGY.get();
public static final int SHOOT_COST = CannonConfig.ANNIHILATOR_SHOOT_COST.get();
public static final float MAX_HEALTH = VehicleConfig.ANNIHILATOR_HP.get();
public static final int MAX_ENERGY = VehicleConfig.ANNIHILATOR_MAX_ENERGY.get();
public static final int SHOOT_COST = VehicleConfig.ANNIHILATOR_SHOOT_COST.get();
public Vec3 barrelLookAt;
public AnnihilatorEntity(PlayMessages.SpawnEntity packet, Level world) {

View file

@ -67,6 +67,9 @@ public class ContainerMobileEntity extends MobileVehicleEntity implements HasCus
public void baseTick() {
super.baseTick();
pickUpItem();
// TODO 载具储存空间有电池时消耗电池能量给载具充电
// ItemStack cell = this.getItemStacks().forEach());
this.refreshDimensions();
}

View file

@ -1,8 +1,8 @@
package com.atsuishio.superbwarfare.entity.vehicle;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.CannonConfig;
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity;
import com.atsuishio.superbwarfare.init.*;
import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem;
@ -49,7 +49,7 @@ import java.util.Comparator;
public class Mk42Entity extends VehicleEntity implements GeoEntity, ICannonEntity {
public static final EntityDataAccessor<Integer> COOL_DOWN = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.INT);
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
public static final float MAX_HEALTH = CannonConfig.MK42_HP.get();
public static final float MAX_HEALTH = VehicleConfig.MK42_HP.get();
public Mk42Entity(PlayMessages.SpawnEntity packet, Level world) {
this(ModEntities.MK_42.get(), world);
@ -209,18 +209,18 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, ICannonEntit
int durability = 0;
if (stack.is(ModItems.HE_5_INCHES.get())) {
hitDamage = CannonConfig.MK42_HE_DAMAGE.get();
explosionRadius = CannonConfig.MK42_HE_EXPLOSION_RADIUS.get();
explosionDamage = CannonConfig.MK42_HE_EXPLOSION_DAMAGE.get();
hitDamage = VehicleConfig.MK42_HE_DAMAGE.get();
explosionRadius = VehicleConfig.MK42_HE_EXPLOSION_RADIUS.get();
explosionDamage = VehicleConfig.MK42_HE_EXPLOSION_DAMAGE.get();
fireProbability = 0.18F;
fireTime = 2;
durability = 1;
}
if (stack.is(ModItems.AP_5_INCHES.get())) {
hitDamage = CannonConfig.MK42_AP_DAMAGE.get();
explosionRadius = CannonConfig.MK42_AP_EXPLOSION_RADIUS.get();
explosionDamage = CannonConfig.MK42_AP_EXPLOSION_DAMAGE.get();
hitDamage = VehicleConfig.MK42_AP_DAMAGE.get();
explosionRadius = VehicleConfig.MK42_AP_EXPLOSION_RADIUS.get();
explosionDamage = VehicleConfig.MK42_AP_EXPLOSION_DAMAGE.get();
fireProbability = 0;
fireTime = 0;
durability = 60;

View file

@ -1,8 +1,8 @@
package com.atsuishio.superbwarfare.entity.vehicle;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.CannonConfig;
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity;
import com.atsuishio.superbwarfare.init.*;
import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem;
@ -52,7 +52,7 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, ICannonEn
public static final EntityDataAccessor<Integer> COOL_DOWN = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.INT);
public static final EntityDataAccessor<Integer> TYPE = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.INT);
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
public static final float MAX_HEALTH = CannonConfig.MLE1934_HP.get();
public static final float MAX_HEALTH = VehicleConfig.MLE1934_HP.get();
public Mle1934Entity(PlayMessages.SpawnEntity packet, Level world) {
this(ModEntities.MLE_1934.get(), world);
@ -225,9 +225,9 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, ICannonEn
boolean salvoShoot = false;
if (stack.is(ModItems.HE_5_INCHES.get())) {
hitDamage = CannonConfig.MLE1934_HE_DAMAGE.get();
explosionRadius = CannonConfig.MLE1934_HE_EXPLOSION_RADIUS.get();
explosionDamage = CannonConfig.MLE1934_HE_EXPLOSION_DAMAGE.get();
hitDamage = VehicleConfig.MLE1934_HE_DAMAGE.get();
explosionRadius = VehicleConfig.MLE1934_HE_EXPLOSION_RADIUS.get();
explosionDamage = VehicleConfig.MLE1934_HE_EXPLOSION_DAMAGE.get();
fireProbability = 0.24F;
fireTime = 5;
durability = 1;
@ -235,9 +235,9 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, ICannonEn
}
if (stack.is(ModItems.AP_5_INCHES.get())) {
hitDamage = CannonConfig.MLE1934_AP_DAMAGE.get();
explosionRadius = CannonConfig.MLE1934_AP_EXPLOSION_RADIUS.get();
explosionDamage = CannonConfig.MLE1934_AP_EXPLOSION_DAMAGE.get();
hitDamage = VehicleConfig.MLE1934_AP_DAMAGE.get();
explosionRadius = VehicleConfig.MLE1934_AP_EXPLOSION_RADIUS.get();
explosionDamage = VehicleConfig.MLE1934_AP_EXPLOSION_DAMAGE.get();
fireProbability = 0;
fireTime = 0;
durability = 70;

View file

@ -75,8 +75,12 @@ public class MobileVehicleEntity extends EnergyVehicleEntity {
super.move(movementType, movement);
if (lastTickSpeed < 0.3 || collisionCoolDown > 0) return;
if ((verticalCollision) && Mth.abs((float) lastTickVerticalSpeed) > 0.6) {
this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, this.getFirstPassenger() == null ? this : this.getFirstPassenger()), (float) (240 * ((Mth.abs((float) lastTickVerticalSpeed) - 0.6) * (lastTickSpeed - 0.4) * (lastTickSpeed - 0.4))));
if ((verticalCollision)) {
if (this instanceof IHelicopterEntity) {
this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, this.getFirstPassenger() == null ? this : this.getFirstPassenger()), (float) (100 * ((lastTickSpeed - 0.3) * (lastTickSpeed - 0.3))));
} else if (Mth.abs((float) lastTickVerticalSpeed) > 0.6) {
this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, this.getFirstPassenger() == null ? this : this.getFirstPassenger()), (float) (240 * ((Mth.abs((float) lastTickVerticalSpeed) - 0.6) * (lastTickSpeed - 0.4) * (lastTickSpeed - 0.4))));
}
this.bounceVertical(Direction.getNearest(this.getDeltaMovement().x(), this.getDeltaMovement().y(), this.getDeltaMovement().z()).getOpposite());
if (!this.level().isClientSide) {
this.level().playSound(null, this, ModSounds.VEHICLE_STRIKE.get(), this.getSoundSource(), 1, 1);

View file

@ -1,8 +1,8 @@
package com.atsuishio.superbwarfare.entity.vehicle;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.CannonConfig;
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
import com.atsuishio.superbwarfare.init.*;
import com.atsuishio.superbwarfare.network.ModVariables;
@ -61,8 +61,8 @@ public class SpeedboatEntity extends ContainerMobileEntity implements GeoEntity,
public static final EntityDataAccessor<Integer> HEAT = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.INT);
public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(SpeedboatEntity.class, EntityDataSerializers.INT);
public static final float MAX_HEALTH = CannonConfig.SPEEDBOAT_HP.get();
public static final int MAX_ENERGY = CannonConfig.SPEEDBOAT_MAX_ENERGY.get();
public static final float MAX_HEALTH = VehicleConfig.SPEEDBOAT_HP.get();
public static final int MAX_ENERGY = VehicleConfig.SPEEDBOAT_MAX_ENERGY.get();
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
public float turretYRot;
@ -223,7 +223,7 @@ public class SpeedboatEntity extends ContainerMobileEntity implements GeoEntity,
ProjectileEntity projectile = new ProjectileEntity(player.level())
.shooter(player)
.damage(CannonConfig.SPEEDBOAT_GUN_DAMAGE.get())
.damage(VehicleConfig.SPEEDBOAT_GUN_DAMAGE.get())
.headShot(2f)
.zoom(false);
@ -304,7 +304,7 @@ public class SpeedboatEntity extends ContainerMobileEntity implements GeoEntity,
}
if (this.forwardInputDown || this.backInputDown) {
this.extraEnergy(CannonConfig.SPEEDBOAT_ENERGY_COST.get());
this.extraEnergy(VehicleConfig.SPEEDBOAT_ENERGY_COST.get());
}
if (level().isClientSide) {