添加LAV的副武器

This commit is contained in:
Atsuihsio 2025-01-17 18:35:58 +08:00
parent fcedc7f052
commit 2faca5317d
11 changed files with 289 additions and 69 deletions

View file

@ -2,6 +2,7 @@ package com.atsuishio.superbwarfare.client.overlay;
import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity; import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
import com.atsuishio.superbwarfare.entity.vehicle.MultiWeaponVehicleEntity;
import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.tools.SeekTool; import com.atsuishio.superbwarfare.tools.SeekTool;
@ -32,6 +33,7 @@ import java.text.DecimalFormat;
import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit; import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
import static com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay.*; import static com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay.*;
import static com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity.COAX_HEAT;
import static com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity.HEAT; import static com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity.HEAT;
@Mod.EventBusSubscriber(value = Dist.CLIENT) @Mod.EventBusSubscriber(value = Dist.CLIENT)
@ -53,7 +55,7 @@ public class LandArmorHudOverlay {
Vec3 cameraPos = camera.getPosition(); Vec3 cameraPos = camera.getPosition();
if (player == null) return; if (player == null) return;
if (player.getVehicle() instanceof Lav150Entity lav150 && lav150.isDriver(player)) { if (player.getVehicle() instanceof Lav150Entity lav150 && lav150.isDriver(player) && player.getVehicle() instanceof MultiWeaponVehicleEntity multiWeaponVehicle) {
poseStack.pushPose(); poseStack.pushPose();
poseStack.translate(-8 * ClientEventHandler.turnRot[1], -8 * ClientEventHandler.turnRot[0], 0); poseStack.translate(-8 * ClientEventHandler.turnRot[1], -8 * ClientEventHandler.turnRot[0], 0);
@ -137,8 +139,14 @@ public class LandArmorHudOverlay {
//武器名称 //武器名称
if (player.getVehicle() instanceof Lav150Entity lav) { if (player.getVehicle() instanceof Lav150Entity lav) {
if (multiWeaponVehicle.getWeaponType() == 0) {
double heat = 1 - lav.getEntityData().get(HEAT) / 100.0F; double heat = 1 - lav.getEntityData().get(HEAT) / 100.0F;
guiGraphics.drawString(mc.font, Component.literal("20MM CANNON " + (player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())) ? "" : lav.getAmmoCount(player))), w / 2 - 33, h - 65, Mth.hsvToRgb((float) heat / 3.745318352059925F, 1.0F, 1.0F), false); guiGraphics.drawString(mc.font, Component.literal("20MM CANNON " + (player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())) ? "" : lav.getAmmoCount(player))), w / 2 - 33, h - 65, Mth.hsvToRgb((float) heat / 3.745318352059925F, 1.0F, 1.0F), false);
} else {
double heat = 1 - lav.getEntityData().get(COAX_HEAT) / 100.0F;
guiGraphics.drawString(mc.font, Component.literal("7.62MM COAX " + (player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())) ? "" : lav.getAmmoCount(player))), w / 2 - 33, h - 65, Mth.hsvToRgb((float) heat / 3.745318352059925F, 1.0F, 1.0F), false);
}
} }
//血量 //血量

View file

@ -67,10 +67,13 @@ public class Lav150Renderer extends GeoEntityRenderer<Lav150Entity> {
if (name.equals("barrel")) { if (name.equals("barrel")) {
bone.setRotX(-Mth.lerp(partialTick, animatable.turretXRotO, animatable.getTurretXRot()) * Mth.DEG_TO_RAD); bone.setRotX(-Mth.lerp(partialTick, animatable.turretXRotO, animatable.getTurretXRot()) * Mth.DEG_TO_RAD);
} }
if (name.equals("flare")) {
bone.setRotZ((float) (0.5 * (Math.random() - 0.5)));
}
if (name.equals("flare2")) {
bone.setRotZ((float) (0.5 * (Math.random() - 0.5)));
}
// if (name.equals("flare")) {
// bone.setRotZ((float) (0.5 * (Math.random() - 0.5)));
// }
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, red, green, blue, alpha); super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, red, green, blue, alpha);
} }

View file

@ -526,7 +526,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
.headShot(2f) .headShot(2f)
.zoom(false); .zoom(false);
projectileRight.heBullet(true, 3); projectileRight.heBullet(true, 2);
projectileRight.bypassArmorRate(0.2f); projectileRight.bypassArmorRate(0.2f);
projectileRight.setPos(worldPositionRight.x, worldPositionRight.y, worldPositionRight.z); projectileRight.setPos(worldPositionRight.x, worldPositionRight.y, worldPositionRight.z);
projectileRight.shoot(player, this.getLookAngle().x, this.getLookAngle().y + 0.018, this.getLookAngle().z, 20, projectileRight.shoot(player, this.getLookAngle().x, this.getLookAngle().y + 0.018, this.getLookAngle().z, 20,

View file

@ -3,6 +3,7 @@ package com.atsuishio.superbwarfare.entity.vehicle;
import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig; import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
import com.atsuishio.superbwarfare.entity.projectile.SmallCannonShellEntity; import com.atsuishio.superbwarfare.entity.projectile.SmallCannonShellEntity;
import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.init.*;
import com.atsuishio.superbwarfare.network.ModVariables; import com.atsuishio.superbwarfare.network.ModVariables;
@ -62,12 +63,15 @@ import java.util.List;
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle; import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IChargeEntity, IArmedVehicleEntity { public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IChargeEntity, IArmedVehicleEntity, MultiWeaponVehicleEntity {
public static final EntityDataAccessor<Integer> FIRE_ANIM = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT); public static final EntityDataAccessor<Integer> FIRE_ANIM = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.FLOAT);
public static final EntityDataAccessor<Integer> HEAT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT); public static final EntityDataAccessor<Integer> HEAT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
public static final EntityDataAccessor<Integer> COAX_HEAT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT); public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
public static final EntityDataAccessor<Integer> LOADED_COAX_AMMO = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
public static final EntityDataAccessor<Integer> WEAPON_TYPE = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
public static final float MAX_HEALTH = VehicleConfig.LAV_150_HP.get(); public static final float MAX_HEALTH = VehicleConfig.LAV_150_HP.get();
public static final int MAX_ENERGY = VehicleConfig.LAV_150_MAX_ENERGY.get(); public static final int MAX_ENERGY = VehicleConfig.LAV_150_MAX_ENERGY.get();
@ -84,6 +88,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
public float leftWheelRotO; public float leftWheelRotO;
public float rightWheelRotO; public float rightWheelRotO;
public boolean cannotFire; public boolean cannotFire;
public boolean cannotFireCoax;
public Lav150Entity(PlayMessages.SpawnEntity packet, Level world) { public Lav150Entity(PlayMessages.SpawnEntity packet, Level world) {
this(ModEntities.LAV_150.get(), world); this(ModEntities.LAV_150.get(), world);
@ -101,16 +106,21 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
this.entityData.define(FIRE_ANIM, 0); this.entityData.define(FIRE_ANIM, 0);
this.entityData.define(DELTA_ROT, 0f); this.entityData.define(DELTA_ROT, 0f);
this.entityData.define(HEAT, 0); this.entityData.define(HEAT, 0);
this.entityData.define(COAX_HEAT, 0);
this.entityData.define(WEAPON_TYPE, 0);
this.entityData.define(LOADED_COAX_AMMO, 0);
} }
@Override @Override
public void addAdditionalSaveData(CompoundTag compound) { public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound); super.addAdditionalSaveData(compound);
compound.putInt("LoadedCoaxAmmo", this.entityData.get(LOADED_COAX_AMMO));
} }
@Override @Override
public void readAdditionalSaveData(CompoundTag compound) { public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound); super.readAdditionalSaveData(compound);
this.entityData.set(LOADED_COAX_AMMO, compound.getInt("LoadedCoaxAmmo"));
} }
@Override @Override
@ -194,10 +204,38 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
cannotFire = false; cannotFire = false;
} }
if (this.level() instanceof ServerLevel) { if (this.entityData.get(COAX_HEAT) > 0) {
this.entityData.set(AMMO, this.getItemStacks().stream().filter(stack -> stack.is(ModItems.HEAVY_AMMO.get())).mapToInt(ItemStack::getCount).sum()); this.entityData.set(COAX_HEAT, this.entityData.get(COAX_HEAT) - 1);
} }
if (this.entityData.get(COAX_HEAT) < 40) {
cannotFireCoax = false;
}
if (this.level() instanceof ServerLevel) {
Player player = (Player) this.getFirstPassenger();
if (player != null) {
if ((this.getItemStacks().stream().filter(stack -> stack.is(ModItems.RIFLE_AMMO_BOX.get())).mapToInt(ItemStack::getCount).sum() > 0 && this.getEntityData().get(LOADED_COAX_AMMO) < 500)) {
this.entityData.set(LOADED_COAX_AMMO, this.getEntityData().get(LOADED_COAX_AMMO) + 30);
this.getItemStacks().stream().filter(stack -> stack.is(ModItems.RIFLE_AMMO_BOX.get())).findFirst().ifPresent(stack -> stack.shrink(1));
}
if ((this.getItemStacks().stream().filter(stack -> stack.is(ModItems.RIFLE_AMMO.get())).mapToInt(ItemStack::getCount).sum() > 0 && this.getEntityData().get(LOADED_COAX_AMMO) < 500)) {
this.entityData.set(LOADED_COAX_AMMO, this.getEntityData().get(LOADED_COAX_AMMO) + 5);
this.getItemStacks().stream().filter(stack -> stack.is(ModItems.RIFLE_AMMO.get())).findFirst().ifPresent(stack -> stack.shrink(1));
}
}
if (this.getEntityData().get(WEAPON_TYPE) == 0) {
this.entityData.set(AMMO, this.getItemStacks().stream().filter(stack -> stack.is(ModItems.HEAVY_AMMO.get())).mapToInt(ItemStack::getCount).sum());
} else {
this.entityData.set(AMMO, this.getEntityData().get(LOADED_COAX_AMMO));
}
}
// if (this.level() instanceof ServerLevel) {
// this.entityData.set(AMMO, this.getItemStacks().stream().filter(stack -> stack.is(ModItems.HEAVY_AMMO.get())).mapToInt(ItemStack::getCount).sum());
// }
Entity driver = this.getFirstPassenger(); Entity driver = this.getFirstPassenger();
if (driver instanceof Player player) { if (driver instanceof Player player) {
if (this.entityData.get(HEAT) > 100) { if (this.entityData.get(HEAT) > 100) {
@ -206,6 +244,12 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
SoundTool.playLocalSound(serverPlayer, ModSounds.MINIGUN_OVERHEAT.get(), 1f, 1f); SoundTool.playLocalSound(serverPlayer, ModSounds.MINIGUN_OVERHEAT.get(), 1f, 1f);
} }
} }
if (this.entityData.get(COAX_HEAT) > 100) {
cannotFireCoax = true;
if (!player.level().isClientSide() && player instanceof ServerPlayer serverPlayer) {
SoundTool.playLocalSound(serverPlayer, ModSounds.MINIGUN_OVERHEAT.get(), 1f, 1f);
}
}
} }
double fluidFloat; double fluidFloat;
@ -271,10 +315,9 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
@Override @Override
public void vehicleShoot(Player player) { public void vehicleShoot(Player player) {
if (this.cannotFire) return;
Matrix4f transform = getBarrelTransform(); Matrix4f transform = getBarrelTransform();
if (entityData.get(WEAPON_TYPE) == 0) {
if (this.cannotFire) return;
float x = -0.0234375f; float x = -0.0234375f;
float y = 0f; float y = 0f;
float z = 4f; float z = 4f;
@ -314,6 +357,44 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
this.entityData.set(HEAT, this.entityData.get(HEAT) + 7); this.entityData.set(HEAT, this.entityData.get(HEAT) + 7);
this.entityData.set(FIRE_ANIM, 3); this.entityData.set(FIRE_ANIM, 3);
this.getItemStacks().stream().filter(stack -> stack.is(ModItems.HEAVY_AMMO.get())).findFirst().ifPresent(stack -> stack.shrink(1)); this.getItemStacks().stream().filter(stack -> stack.is(ModItems.HEAVY_AMMO.get())).findFirst().ifPresent(stack -> stack.shrink(1));
} else if (entityData.get(WEAPON_TYPE) == 1) {
if (this.cannotFireCoax) return;
float x = 0.3f;
float y = 0.08f;
float z = 0.7f;
Vector4f worldPosition = transformPosition(transform, x, y, z);
if (this.entityData.get(LOADED_COAX_AMMO) > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()))) {
ProjectileEntity projectileRight = new ProjectileEntity(player.level())
.shooter(player)
.damage(9.5f)
.headShot(2f)
.zoom(false);
projectileRight.bypassArmorRate(0.2f);
projectileRight.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
projectileRight.shoot(player, getBarrelVector(1).x, getBarrelVector(1).y + 0.002f, getBarrelVector(1).z, 36,
0.25f);
this.level().addFreshEntity(projectileRight);
if (!player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()))) {
this.entityData.set(LOADED_COAX_AMMO, this.getEntityData().get(LOADED_COAX_AMMO) - 1);
}
}
this.entityData.set(COAX_HEAT, this.entityData.get(COAX_HEAT) + 3);
this.entityData.set(FIRE_ANIM, 2);
if (!player.level().isClientSide) {
if (player instanceof ServerPlayer serverPlayer) {
serverPlayer.playSound(ModSounds.M_60_FIRE_3P.get(), 3, 1);
serverPlayer.playSound(ModSounds.M_60_FAR.get(), 6, 1);
serverPlayer.playSound(ModSounds.M_60_VERYFAR.get(), 12, 1);
}
}
}
} }
public final Vec3 getBarrelVector(float pPartialTicks) { public final Vec3 getBarrelVector(float pPartialTicks) {
@ -367,11 +448,11 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
} }
if (forwardInputDown) { if (forwardInputDown) {
this.entityData.set(POWER, this.entityData.get(POWER) + 0.006f); this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.015f, 0.2f));
} }
if (backInputDown) { if (backInputDown) {
this.entityData.set(POWER, this.entityData.get(POWER) - 0.008f); this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.01f, -0.2f));
} }
if (rightInputDown) { if (rightInputDown) {
@ -564,10 +645,14 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
} }
private PlayState firePredicate(AnimationState<Lav150Entity> event) { private PlayState firePredicate(AnimationState<Lav150Entity> event) {
if (this.entityData.get(FIRE_ANIM) > 1) { if (this.entityData.get(FIRE_ANIM) > 1 && entityData.get(WEAPON_TYPE) == 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.lav.fire")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.lav.fire"));
} }
if (this.entityData.get(FIRE_ANIM) > 0 && entityData.get(WEAPON_TYPE) == 1) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.lav.fire2"));
}
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.lav.idle")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.lav.idle"));
} }
@ -608,13 +693,22 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
@Override @Override
public int mainGunRpm() { public int mainGunRpm() {
if (entityData.get(WEAPON_TYPE) == 0) {
return 300;
} else if (entityData.get(WEAPON_TYPE) == 1) {
return 600;
}
return 300; return 300;
} }
@Override @Override
public boolean canShoot(Player player) { public boolean canShoot(Player player) {
return (this.entityData.get(AMMO) > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()))) if (entityData.get(WEAPON_TYPE) == 0) {
&& !cannotFire; return (this.entityData.get(AMMO) > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()))) && !cannotFire;
} else if (entityData.get(WEAPON_TYPE) == 1) {
return (this.entityData.get(LOADED_COAX_AMMO) > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()))) && !cannotFireCoax;
}
return false;
} }
@Override @Override
@ -636,4 +730,20 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
public int zoomFov() { public int zoomFov() {
return 3; return 3;
} }
@Override
public void changeWeapon() {
if (entityData.get(WEAPON_TYPE) == 0) {
this.level().playSound(null, this, ModSounds.INTO_MISSILE.get(), this.getSoundSource(), 1, 1);
entityData.set(WEAPON_TYPE, 1);
} else if (entityData.get(WEAPON_TYPE) == 1) {
entityData.set(WEAPON_TYPE, 0);
this.level().playSound(null, this, ModSounds.INTO_CANNON.get(), this.getSoundSource(), 1, 1);
}
}
@Override
public int getWeaponType() {
return entityData.get(WEAPON_TYPE);
}
} }

View file

@ -4,10 +4,7 @@ import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.client.ClickHandler; import com.atsuishio.superbwarfare.client.ClickHandler;
import com.atsuishio.superbwarfare.config.client.DisplayConfig; import com.atsuishio.superbwarfare.config.client.DisplayConfig;
import com.atsuishio.superbwarfare.entity.DroneEntity; import com.atsuishio.superbwarfare.entity.DroneEntity;
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity; import com.atsuishio.superbwarfare.entity.vehicle.*;
import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity;
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
import com.atsuishio.superbwarfare.entity.vehicle.SpeedboatEntity;
import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.init.*;
import com.atsuishio.superbwarfare.item.gun.GunItem; import com.atsuishio.superbwarfare.item.gun.GunItem;
import com.atsuishio.superbwarfare.network.ModVariables; import com.atsuishio.superbwarfare.network.ModVariables;
@ -62,7 +59,7 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier; import java.util.function.Supplier;
import static com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity.WEAPON_TYPE; import static com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity.COAX_HEAT;
import static com.atsuishio.superbwarfare.entity.vehicle.SpeedboatEntity.HEAT; import static com.atsuishio.superbwarfare.entity.vehicle.SpeedboatEntity.HEAT;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT)
@ -682,19 +679,28 @@ public class ClientEventHandler {
player.playSound(ModSounds.M_2_FIRE_1P.get(), 1f, pitch); player.playSound(ModSounds.M_2_FIRE_1P.get(), 1f, pitch);
player.playSound(ModSounds.SHELL_CASING_50CAL.get(), 0.3f, 1); player.playSound(ModSounds.SHELL_CASING_50CAL.get(), 0.3f, 1);
} }
if (iVehicle instanceof MultiWeaponVehicleEntity multiWeaponVehicle) {
if (iVehicle instanceof Ah6Entity ah6Entity) { if (iVehicle instanceof Ah6Entity ah6Entity) {
float pitch = ah6Entity.heat <= 60 ? 1 : (float) (1 - 0.011 * java.lang.Math.abs(60 - ah6Entity.heat)); float pitch = ah6Entity.heat <= 60 ? 1 : (float) (1 - 0.011 * java.lang.Math.abs(60 - ah6Entity.heat));
if (ah6Entity.getEntityData().get(WEAPON_TYPE) == 0) { if (multiWeaponVehicle.getWeaponType() == 0) {
ah6Entity.heat += 5; ah6Entity.heat += 5;
player.playSound(ModSounds.HELICOPTER_CANNON_FIRE_1P.get(), 1f, pitch); player.playSound(ModSounds.HELICOPTER_CANNON_FIRE_1P.get(), 1f, pitch);
} else if (ah6Entity.getEntityData().get(WEAPON_TYPE) == 1) { } else if (multiWeaponVehicle.getWeaponType() == 1) {
player.playSound(ModSounds.HELICOPTER_ROCKET_FIRE_1P.get(), 1f, 1); player.playSound(ModSounds.HELICOPTER_ROCKET_FIRE_1P.get(), 1f, 1);
} }
} }
if (iVehicle instanceof Lav150Entity lav150) { if (iVehicle instanceof Lav150Entity lav150) {
if (multiWeaponVehicle.getWeaponType() == 0) {
float pitch = lav150.getEntityData().get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * java.lang.Math.abs(60 - lav150.getEntityData().get(HEAT))); float pitch = lav150.getEntityData().get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * java.lang.Math.abs(60 - lav150.getEntityData().get(HEAT)));
player.playSound(ModSounds.LAV_CANNON_FIRE_1P.get(), 1f, pitch); player.playSound(ModSounds.LAV_CANNON_FIRE_1P.get(), 1f, pitch);
player.playSound(ModSounds.SHELL_CASING_50CAL.get(), 0.3f, 1); player.playSound(ModSounds.SHELL_CASING_50CAL.get(), 0.3f, 1);
} else if (multiWeaponVehicle.getWeaponType() == 1) {
float pitch = lav150.getEntityData().get(COAX_HEAT) <= 60 ? 1 : (float) (1 - 0.011 * java.lang.Math.abs(60 - lav150.getEntityData().get(COAX_HEAT)));
player.playSound(ModSounds.COAX_FIRE_1P.get(), 1f, pitch);
}
}
} }
} }

View file

@ -402,5 +402,6 @@ public class ModSounds {
public static final RegistryObject<SoundEvent> LAV_CANNON_VERYFAR = REGISTRY.register("lav_cannon_veryfar", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("lav_veryfar"))); public static final RegistryObject<SoundEvent> LAV_CANNON_VERYFAR = REGISTRY.register("lav_cannon_veryfar", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("lav_veryfar")));
public static final RegistryObject<SoundEvent> LAV_ENGINE = REGISTRY.register("lav_engine", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("lav_engine"))); public static final RegistryObject<SoundEvent> LAV_ENGINE = REGISTRY.register("lav_engine", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("lav_engine")));
public static final RegistryObject<SoundEvent> LAV_ENGINE_1P = REGISTRY.register("lav_engine_1p", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("lav_engine_1p"))); public static final RegistryObject<SoundEvent> LAV_ENGINE_1P = REGISTRY.register("lav_engine_1p", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("lav_engine_1p")));
public static final RegistryObject<SoundEvent> COAX_FIRE_1P = REGISTRY.register("coax_fire_1p", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("coax_fire_1p")));
} }

View file

@ -1,6 +1,17 @@
{ {
"format_version": "1.8.0", "format_version": "1.8.0",
"animations": { "animations": {
"animation.lav.idle": {
"animation_length": 0.25,
"bones": {
"flare": {
"scale": 0
},
"flare2": {
"scale": 0
}
}
},
"animation.lav.fire": { "animation.lav.fire": {
"animation_length": 0.4, "animation_length": 0.4,
"bones": { "bones": {
@ -29,14 +40,27 @@
"0.0917": [0, 0, 0], "0.0917": [0, 0, 0],
"0.15": [0, 0, 0] "0.15": [0, 0, 0]
} }
},
"flare2": {
"scale": 0
} }
} }
}, },
"animation.lav.idle": { "animation.lav.fire2": {
"animation_length": 0.25, "animation_length": 0.4,
"bones": { "bones": {
"flare": { "flare": {
"scale": 0 "scale": 0
},
"flare2": {
"scale": {
"0.0": [0, 0, 0],
"0.0083": [8, 8, 8],
"0.05": [11, 11, 11],
"0.075": [1, 1, 1],
"0.0917": [0, 0, 0],
"0.15": [0, 0, 0]
}
} }
} }
} }

View file

@ -3003,7 +3003,23 @@
{ {
"name": "barrel", "name": "barrel",
"parent": "cannon", "parent": "cannon",
"pivot": [0.375, 43.8072, -13.2] "pivot": [0.375, 43.8072, -13.2],
"cubes": [
{
"origin": [4.13625, 43.11845, -22.40424],
"size": [1.1275, 1.1275, 9.54],
"pivot": [4.825, 43.8072, -21.13424],
"rotation": [0, 0, -45],
"uv": {
"north": {"uv": [69, 98], "uv_size": [-1, 1]},
"east": {"uv": [283, 87], "uv_size": [-18, 1]},
"south": {"uv": [70, 121], "uv_size": [-1, 1]},
"west": {"uv": [27, 135], "uv_size": [-18, 1]},
"up": {"uv": [143, 266], "uv_size": [-1, 18]},
"down": {"uv": [174, 284], "uv_size": [-1, -18]}
}
}
]
}, },
{ {
"name": "flare", "name": "flare",
@ -3352,6 +3368,51 @@
} }
] ]
}, },
{
"name": "flare2",
"parent": "barrel",
"pivot": [4.825, 43.61482, -24.2707],
"cubes": [
{
"origin": [4.54891, 43.33874, -24.29418],
"size": [0.55217, 0.55217, 0],
"uv": {
"north": {"uv": [512, 0], "uv_size": [-128, 128]},
"south": {"uv": [384, 0], "uv_size": [128, 128]}
}
},
{
"origin": [4.13051, 43.38427, -24.59305],
"size": [1.38897, 0.46109, 0],
"pivot": [4.825, 43.61482, -24.59304],
"rotation": [0, -90, -60],
"uv": {
"north": {"uv": [512, 0], "uv_size": [-103, 128]},
"south": {"uv": [409, 0], "uv_size": [103, 128]}
}
},
{
"origin": [4.13051, 43.38427, -24.59305],
"size": [1.38897, 0.46109, 0],
"pivot": [4.825, 43.61482, -24.59304],
"rotation": [0, -90, -120],
"uv": {
"north": {"uv": [512, 0], "uv_size": [-103, 128]},
"south": {"uv": [409, 0], "uv_size": [103, 128]}
}
},
{
"origin": [4.13051, 43.38427, -24.59305],
"size": [1.38897, 0.46109, 0],
"pivot": [4.825, 43.61482, -24.59304],
"rotation": [0, -90, 0],
"uv": {
"north": {"uv": [512, 0], "uv_size": [-103, 128]},
"south": {"uv": [409, 0], "uv_size": [103, 128]}
}
}
]
},
{ {
"name": "main", "name": "main",
"parent": "root", "parent": "root",

View file

@ -2750,5 +2750,12 @@
"name": "superbwarfare:lav/lav_engine_1p" "name": "superbwarfare:lav/lav_engine_1p"
} }
] ]
},
"coax_fire_1p": {
"sounds": [
{
"name": "superbwarfare:lav/coax_fire_1p"
}
]
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB