提取载具武器音效播放方法
This commit is contained in:
parent
05e4901400
commit
39d012b055
16 changed files with 204 additions and 190 deletions
|
@ -17,6 +17,7 @@ import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||||
import software.bernie.geckolib.cache.object.GeoBone;
|
import software.bernie.geckolib.cache.object.GeoBone;
|
||||||
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
||||||
|
@ -45,7 +46,7 @@ public class PrismTankRenderer extends GeoEntityRenderer<PrismTankEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(PrismTankEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
public void render(PrismTankEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, @NotNull MultiBufferSource bufferIn, int packedLightIn) {
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
poseStack.mulPose(Axis.YP.rotationDegrees(-Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot())));
|
poseStack.mulPose(Axis.YP.rotationDegrees(-Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot())));
|
||||||
poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||||
|
@ -83,7 +84,7 @@ public class PrismTankRenderer extends GeoEntityRenderer<PrismTankEntity> {
|
||||||
bone.setRotY(Mth.lerp(partialTick, animatable.turretYRotO, animatable.getTurretYRot()) * Mth.DEG_TO_RAD);
|
bone.setRotY(Mth.lerp(partialTick, animatable.turretYRotO, animatable.getTurretYRot()) * Mth.DEG_TO_RAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.equals("head") || name.equals("head2")) {
|
if (name.equals("head")) {
|
||||||
Player player = Minecraft.getInstance().player;
|
Player player = Minecraft.getInstance().player;
|
||||||
bone.setHidden(ClientEventHandler.zoomVehicle && animatable.getFirstPassenger() == player);
|
bone.setHidden(ClientEventHandler.zoomVehicle && animatable.getFirstPassenger() == player);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ import net.minecraft.network.syncher.EntityDataSerializers;
|
||||||
import net.minecraft.network.syncher.SynchedEntityData;
|
import net.minecraft.network.syncher.SynchedEntityData;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.damagesource.DamageTypes;
|
import net.minecraft.world.damagesource.DamageTypes;
|
||||||
|
@ -84,12 +83,18 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
.explosionDamage(VehicleConfig.AH_6_CANNON_EXPLOSION_DAMAGE.get().floatValue())
|
.explosionDamage(VehicleConfig.AH_6_CANNON_EXPLOSION_DAMAGE.get().floatValue())
|
||||||
.explosionRadius(VehicleConfig.AH_6_CANNON_EXPLOSION_RADIUS.get().floatValue())
|
.explosionRadius(VehicleConfig.AH_6_CANNON_EXPLOSION_RADIUS.get().floatValue())
|
||||||
.sound(ModSounds.INTO_CANNON.get())
|
.sound(ModSounds.INTO_CANNON.get())
|
||||||
.icon(Mod.loc("textures/screens/vehicle_weapon/cannon_20mm.png")),
|
.icon(Mod.loc("textures/screens/vehicle_weapon/cannon_20mm.png"))
|
||||||
|
.sound1p(ModSounds.HELICOPTER_CANNON_FIRE_1P.get())
|
||||||
|
.sound3p(ModSounds.HELICOPTER_CANNON_FIRE_3P.get())
|
||||||
|
.sound3pFar(ModSounds.HELICOPTER_CANNON_FAR.get())
|
||||||
|
.sound3pVeryFar(ModSounds.HELICOPTER_CANNON_VERYFAR.get()),
|
||||||
new HeliRocketWeapon()
|
new HeliRocketWeapon()
|
||||||
.damage(VehicleConfig.AH_6_ROCKET_DAMAGE.get())
|
.damage(VehicleConfig.AH_6_ROCKET_DAMAGE.get())
|
||||||
.explosionDamage(VehicleConfig.AH_6_ROCKET_EXPLOSION_DAMAGE.get())
|
.explosionDamage(VehicleConfig.AH_6_ROCKET_EXPLOSION_DAMAGE.get())
|
||||||
.explosionRadius(VehicleConfig.AH_6_ROCKET_EXPLOSION_RADIUS.get())
|
.explosionRadius(VehicleConfig.AH_6_ROCKET_EXPLOSION_RADIUS.get())
|
||||||
.sound(ModSounds.INTO_MISSILE.get()),
|
.sound(ModSounds.INTO_MISSILE.get())
|
||||||
|
.sound1p(ModSounds.HELICOPTER_ROCKET_FIRE_1P.get())
|
||||||
|
.sound3p(ModSounds.HELICOPTER_ROCKET_FIRE_3P.get()),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -563,12 +568,9 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
this.entityData.set(HEAT, this.entityData.get(HEAT) + 4);
|
this.entityData.set(HEAT, this.entityData.get(HEAT) + 4);
|
||||||
|
|
||||||
if (!player.level().isClientSide) {
|
if (!player.level().isClientSide) {
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
playShootSound3p(player, 0, 4, 12, 24);
|
||||||
serverPlayer.playSound(ModSounds.HELICOPTER_CANNON_FIRE_3P.get(), 4, 1);
|
|
||||||
serverPlayer.playSound(ModSounds.HELICOPTER_CANNON_FAR.get(), 12, 1);
|
|
||||||
serverPlayer.playSound(ModSounds.HELICOPTER_CANNON_VERYFAR.get(), 24, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (getWeaponIndex(0) == 1 && this.getEntityData().get(LOADED_ROCKET) > 0) {
|
} else if (getWeaponIndex(0) == 1 && this.getEntityData().get(LOADED_ROCKET) > 0) {
|
||||||
x = 1.7f;
|
x = 1.7f;
|
||||||
y = 0.62f - 1.45f;
|
y = 0.62f - 1.45f;
|
||||||
|
@ -591,9 +593,7 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
player.level().addFreshEntity(heliRocketEntity);
|
player.level().addFreshEntity(heliRocketEntity);
|
||||||
|
|
||||||
if (!player.level().isClientSide) {
|
if (!player.level().isClientSide) {
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
playShootSound3p(player, 0, 6, 6, 6);
|
||||||
serverPlayer.playSound(ModSounds.HELICOPTER_ROCKET_FIRE_3P.get(), 6, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.entityData.set(LOADED_ROCKET, this.getEntityData().get(LOADED_ROCKET) - 1);
|
this.entityData.set(LOADED_ROCKET, this.getEntityData().get(LOADED_ROCKET) - 1);
|
||||||
|
@ -631,6 +631,11 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWeaponHeat(Player player) {
|
||||||
|
return entityData.get(HEAT);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getRotX(float tickDelta) {
|
public float getRotX(float tickDelta) {
|
||||||
return this.getPitch(tickDelta);
|
return this.getPitch(tickDelta);
|
||||||
|
|
|
@ -588,6 +588,11 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWeaponHeat(Player player) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getVehicleIcon() {
|
public ResourceLocation getVehicleIcon() {
|
||||||
return Mod.loc("textures/vehicle_icon/annihilator_icon.png");
|
return Mod.loc("textures/vehicle_icon/annihilator_icon.png");
|
||||||
|
|
|
@ -96,18 +96,28 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
.explosionDamage(VehicleConfig.BMP_2_CANNON_EXPLOSION_DAMAGE.get())
|
.explosionDamage(VehicleConfig.BMP_2_CANNON_EXPLOSION_DAMAGE.get())
|
||||||
.explosionRadius(VehicleConfig.BMP_2_CANNON_EXPLOSION_RADIUS.get().floatValue())
|
.explosionRadius(VehicleConfig.BMP_2_CANNON_EXPLOSION_RADIUS.get().floatValue())
|
||||||
.sound(ModSounds.INTO_MISSILE.get())
|
.sound(ModSounds.INTO_MISSILE.get())
|
||||||
.icon(Mod.loc("textures/screens/vehicle_weapon/cannon_30mm.png")),
|
.icon(Mod.loc("textures/screens/vehicle_weapon/cannon_30mm.png"))
|
||||||
|
.sound1p(ModSounds.BMP_CANNON_FIRE_1P.get())
|
||||||
|
.sound3p(ModSounds.BMP_CANNON_FIRE_3P.get())
|
||||||
|
.sound3pFar(ModSounds.LAV_CANNON_FAR.get())
|
||||||
|
.sound3pVeryFar(ModSounds.LAV_CANNON_VERYFAR.get()),
|
||||||
new ProjectileWeapon()
|
new ProjectileWeapon()
|
||||||
.damage(9.5f)
|
.damage(9.5f)
|
||||||
.headShot(2)
|
.headShot(2)
|
||||||
.zoom(false)
|
.zoom(false)
|
||||||
.sound(ModSounds.INTO_CANNON.get())
|
.sound(ModSounds.INTO_CANNON.get())
|
||||||
.icon(Mod.loc("textures/screens/vehicle_weapon/gun_7_62mm.png")),
|
.icon(Mod.loc("textures/screens/vehicle_weapon/gun_7_62mm.png"))
|
||||||
|
.sound1p(ModSounds.COAX_FIRE_1P.get())
|
||||||
|
.sound3p(ModSounds.M_60_FIRE_3P.get())
|
||||||
|
.sound3pFar(ModSounds.M_60_FAR.get())
|
||||||
|
.sound3pVeryFar(ModSounds.M_60_VERYFAR.get()),
|
||||||
new WgMissileWeapon()
|
new WgMissileWeapon()
|
||||||
.damage(ExplosionConfig.WIRE_GUIDE_MISSILE_DAMAGE.get())
|
.damage(ExplosionConfig.WIRE_GUIDE_MISSILE_DAMAGE.get())
|
||||||
.explosionDamage(ExplosionConfig.WIRE_GUIDE_MISSILE_EXPLOSION_DAMAGE.get())
|
.explosionDamage(ExplosionConfig.WIRE_GUIDE_MISSILE_EXPLOSION_DAMAGE.get())
|
||||||
.explosionRadius(ExplosionConfig.WIRE_GUIDE_MISSILE_EXPLOSION_RADIUS.get())
|
.explosionRadius(ExplosionConfig.WIRE_GUIDE_MISSILE_EXPLOSION_RADIUS.get())
|
||||||
.sound(ModSounds.INTO_MISSILE.get()),
|
.sound(ModSounds.INTO_MISSILE.get())
|
||||||
|
.sound1p(ModSounds.BMP_MISSILE_FIRE_1P.get())
|
||||||
|
.sound3p(ModSounds.BMP_MISSILE_FIRE_3P.get()),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -345,14 +355,8 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
|
|
||||||
sendParticle((ServerLevel) this.level(), ParticleTypes.LARGE_SMOKE, worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z, 1, 0.02, 0.02, 0.02, 0, false);
|
sendParticle((ServerLevel) this.level(), ParticleTypes.LARGE_SMOKE, worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z, 1, 0.02, 0.02, 0.02, 0, false);
|
||||||
|
|
||||||
float pitch = this.entityData.get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - this.entityData.get(HEAT)));
|
|
||||||
|
|
||||||
if (!player.level().isClientSide) {
|
if (!player.level().isClientSide) {
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
playShootSound3p(player, 0, 4, 12, 24);
|
||||||
serverPlayer.playSound(ModSounds.BMP_CANNON_FIRE_3P.get(), 4, pitch);
|
|
||||||
serverPlayer.playSound(ModSounds.LAV_CANNON_FAR.get(), 12, pitch);
|
|
||||||
serverPlayer.playSound(ModSounds.LAV_CANNON_VERYFAR.get(), 24, pitch);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Level level = player.level();
|
Level level = player.level();
|
||||||
|
@ -410,11 +414,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
this.entityData.set(FIRE_ANIM, 2);
|
this.entityData.set(FIRE_ANIM, 2);
|
||||||
|
|
||||||
if (!player.level().isClientSide) {
|
if (!player.level().isClientSide) {
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
playShootSound3p(player, 0, 3, 6, 12);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (getWeaponIndex(0) == 2 && this.getEntityData().get(LOADED_MISSILE) > 0) {
|
} else if (getWeaponIndex(0) == 2 && this.getEntityData().get(LOADED_MISSILE) > 0) {
|
||||||
Matrix4f transformT = getBarrelTransform(1);
|
Matrix4f transformT = getBarrelTransform(1);
|
||||||
|
@ -427,9 +427,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
player.level().addFreshEntity(wgMissileEntity);
|
player.level().addFreshEntity(wgMissileEntity);
|
||||||
|
|
||||||
if (!player.level().isClientSide) {
|
if (!player.level().isClientSide) {
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
playShootSound3p(player, 0, 6, 0, 0);
|
||||||
serverPlayer.playSound(ModSounds.BMP_MISSILE_FIRE_3P.get(), 6, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.entityData.set(LOADED_MISSILE, this.getEntityData().get(LOADED_MISSILE) - 1);
|
this.entityData.set(LOADED_MISSILE, this.getEntityData().get(LOADED_MISSILE) - 1);
|
||||||
|
@ -724,6 +722,16 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWeaponHeat(Player player) {
|
||||||
|
if (getWeaponIndex(0) == 0) {
|
||||||
|
return entityData.get(HEAT);
|
||||||
|
} else if (getWeaponIndex(0) == 1) {
|
||||||
|
return entityData.get(COAX_HEAT);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getVehicleIcon() {
|
public ResourceLocation getVehicleIcon() {
|
||||||
return Mod.loc("textures/vehicle_icon/bmp2_icon.png");
|
return Mod.loc("textures/vehicle_icon/bmp2_icon.png");
|
||||||
|
|
|
@ -575,6 +575,10 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWeaponHeat(Player player) {
|
||||||
|
return entityData.get(HEAT);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public Vec3 getBarrelVector(float pPartialTicks) {
|
public Vec3 getBarrelVector(float pPartialTicks) {
|
||||||
if (getFirstPassenger() != null) {
|
if (getFirstPassenger() != null) {
|
||||||
|
|
|
@ -84,13 +84,21 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
.explosionDamage(VehicleConfig.LAV_150_CANNON_EXPLOSION_DAMAGE.get())
|
.explosionDamage(VehicleConfig.LAV_150_CANNON_EXPLOSION_DAMAGE.get())
|
||||||
.explosionRadius(VehicleConfig.LAV_150_CANNON_EXPLOSION_RADIUS.get().floatValue())
|
.explosionRadius(VehicleConfig.LAV_150_CANNON_EXPLOSION_RADIUS.get().floatValue())
|
||||||
.sound(ModSounds.INTO_MISSILE.get())
|
.sound(ModSounds.INTO_MISSILE.get())
|
||||||
.icon(Mod.loc("textures/screens/vehicle_weapon/cannon_20mm.png")),
|
.icon(Mod.loc("textures/screens/vehicle_weapon/cannon_20mm.png"))
|
||||||
|
.sound1p(ModSounds.LAV_CANNON_FIRE_1P.get())
|
||||||
|
.sound3p(ModSounds.LAV_CANNON_FIRE_3P.get())
|
||||||
|
.sound3pFar(ModSounds.LAV_CANNON_FAR.get())
|
||||||
|
.sound3pVeryFar(ModSounds.LAV_CANNON_VERYFAR.get()),
|
||||||
new ProjectileWeapon()
|
new ProjectileWeapon()
|
||||||
.damage(9.5f)
|
.damage(9.5f)
|
||||||
.headShot(2)
|
.headShot(2)
|
||||||
.zoom(false)
|
.zoom(false)
|
||||||
.sound(ModSounds.INTO_CANNON.get())
|
.sound(ModSounds.INTO_CANNON.get())
|
||||||
.icon(Mod.loc("textures/screens/vehicle_weapon/gun_7_62mm.png")),
|
.icon(Mod.loc("textures/screens/vehicle_weapon/gun_7_62mm.png"))
|
||||||
|
.sound1p(ModSounds.COAX_FIRE_1P.get())
|
||||||
|
.sound3p(ModSounds.RPK_FIRE_3P.get())
|
||||||
|
.sound3pFar(ModSounds.RPK_FAR.get())
|
||||||
|
.sound3pVeryFar(ModSounds.RPK_VERYFAR.get()),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -252,14 +260,8 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
|
|
||||||
sendParticle((ServerLevel) this.level(), ParticleTypes.LARGE_SMOKE, worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z, 1, 0.02, 0.02, 0.02, 0, false);
|
sendParticle((ServerLevel) this.level(), ParticleTypes.LARGE_SMOKE, worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z, 1, 0.02, 0.02, 0.02, 0, false);
|
||||||
|
|
||||||
float pitch = this.entityData.get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - this.entityData.get(HEAT)));
|
|
||||||
|
|
||||||
if (!player.level().isClientSide) {
|
if (!player.level().isClientSide) {
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
playShootSound3p(player, 0, 4, 12, 24);
|
||||||
serverPlayer.playSound(ModSounds.LAV_CANNON_FIRE_3P.get(), 4, pitch);
|
|
||||||
serverPlayer.playSound(ModSounds.LAV_CANNON_FAR.get(), 12, pitch);
|
|
||||||
serverPlayer.playSound(ModSounds.LAV_CANNON_VERYFAR.get(), 24, pitch);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Level level = player.level();
|
Level level = player.level();
|
||||||
|
@ -318,11 +320,7 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
this.entityData.set(FIRE_ANIM, 2);
|
this.entityData.set(FIRE_ANIM, 2);
|
||||||
|
|
||||||
if (!player.level().isClientSide) {
|
if (!player.level().isClientSide) {
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
playShootSound3p(player, 0, 3, 6, 12);
|
||||||
serverPlayer.playSound(ModSounds.RPK_FIRE_3P.get(), 3, 1);
|
|
||||||
serverPlayer.playSound(ModSounds.RPK_FAR.get(), 6, 1);
|
|
||||||
serverPlayer.playSound(ModSounds.RPK_VERYFAR.get(), 12, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -591,6 +589,16 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWeaponHeat(Player player) {
|
||||||
|
if (getWeaponIndex(0) == 0) {
|
||||||
|
return entityData.get(HEAT);
|
||||||
|
} else if (getWeaponIndex(0) == 1) {
|
||||||
|
return entityData.get(COAX_HEAT);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getVehicleIcon() {
|
public ResourceLocation getVehicleIcon() {
|
||||||
return Mod.loc("textures/vehicle_icon/lav150_icon.png");
|
return Mod.loc("textures/vehicle_icon/lav150_icon.png");
|
||||||
|
|
|
@ -435,6 +435,11 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWeaponHeat(Player player) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3 getBarrelVector(float pPartialTicks) {
|
public Vec3 getBarrelVector(float pPartialTicks) {
|
||||||
if (getFirstPassenger() != null) {
|
if (getFirstPassenger() != null) {
|
||||||
|
|
|
@ -504,6 +504,11 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWeaponHeat(Player player) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3 getBarrelVector(float pPartialTicks) {
|
public Vec3 getBarrelVector(float pPartialTicks) {
|
||||||
if (getFirstPassenger() != null) {
|
if (getFirstPassenger() != null) {
|
||||||
|
|
|
@ -94,7 +94,9 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
return new VehicleWeapon[][]{
|
return new VehicleWeapon[][]{
|
||||||
new VehicleWeapon[]{
|
new VehicleWeapon[]{
|
||||||
new LaserWeapon()
|
new LaserWeapon()
|
||||||
.sound(ModSounds.INTO_MISSILE.get()),
|
.sound(ModSounds.INTO_MISSILE.get())
|
||||||
|
.sound1p(ModSounds.PRISM_FIRE_1P.get())
|
||||||
|
.sound3p(ModSounds.PRISM_FIRE_3P.get()),
|
||||||
new LaserWeapon()
|
new LaserWeapon()
|
||||||
.sound(ModSounds.INTO_CANNON.get())
|
.sound(ModSounds.INTO_CANNON.get())
|
||||||
}
|
}
|
||||||
|
@ -295,9 +297,7 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
Level level = player.level();
|
Level level = player.level();
|
||||||
if (level instanceof ServerLevel) {
|
if (level instanceof ServerLevel) {
|
||||||
if (!player.level().isClientSide) {
|
if (!player.level().isClientSide) {
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
playShootSound3p(player, 0, 5, 5, 5);
|
||||||
serverPlayer.playSound(ModSounds.PRISM_FIRE_3P.get(), 5, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.entityData.set(HEAT, entityData.get(HEAT) + 55);
|
this.entityData.set(HEAT, entityData.get(HEAT) + 55);
|
||||||
|
@ -336,9 +336,7 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
|
|
||||||
if (level instanceof ServerLevel) {
|
if (level instanceof ServerLevel) {
|
||||||
if (!player.level().isClientSide) {
|
if (!player.level().isClientSide) {
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
playShootSound3p(player, 0, 4, 4, 4);
|
||||||
serverPlayer.playSound(ModSounds.PRISM_FIRE_3P_2.get(), 4, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.entityData.set(HEAT, entityData.get(HEAT) + 2);
|
this.entityData.set(HEAT, entityData.get(HEAT) + 2);
|
||||||
|
@ -771,6 +769,11 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWeaponHeat(Player player) {
|
||||||
|
return entityData.get(HEAT);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getVehicleIcon() {
|
public ResourceLocation getVehicleIcon() {
|
||||||
return Mod.loc("textures/vehicle_icon/prism_tank_icon.png");
|
return Mod.loc("textures/vehicle_icon/prism_tank_icon.png");
|
||||||
|
|
|
@ -66,6 +66,10 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
.headShot(2)
|
.headShot(2)
|
||||||
.zoom(false)
|
.zoom(false)
|
||||||
.icon(Mod.loc("textures/screens/vehicle_weapon/gun_12_7mm.png"))
|
.icon(Mod.loc("textures/screens/vehicle_weapon/gun_12_7mm.png"))
|
||||||
|
.sound1p(ModSounds.M_2_FIRE_1P.get())
|
||||||
|
.sound3p(ModSounds.M_2_FIRE_3P.get())
|
||||||
|
.sound3pFar(ModSounds.M_2_FAR.get())
|
||||||
|
.sound3pVeryFar(ModSounds.M_2_VERYFAR.get())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -215,11 +219,7 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
float pitch = this.entityData.get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - this.entityData.get(HEAT)));
|
float pitch = this.entityData.get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - this.entityData.get(HEAT)));
|
||||||
|
|
||||||
if (!player.level().isClientSide) {
|
if (!player.level().isClientSide) {
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
playShootSound3p(player, 0, 4, 12, 24);
|
||||||
serverPlayer.playSound(ModSounds.M_2_FIRE_3P.get(), 4, pitch);
|
|
||||||
serverPlayer.playSound(ModSounds.M_2_FAR.get(), 12, pitch);
|
|
||||||
serverPlayer.playSound(ModSounds.M_2_VERYFAR.get(), 24, pitch);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Level level = player.level();
|
Level level = player.level();
|
||||||
|
@ -561,6 +561,11 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWeaponHeat(Player player) {
|
||||||
|
return entityData.get(HEAT);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getVehicleIcon() {
|
public ResourceLocation getVehicleIcon() {
|
||||||
return Mod.loc("textures/vehicle_icon/speedboat_icon.png");
|
return Mod.loc("textures/vehicle_icon/speedboat_icon.png");
|
||||||
|
|
|
@ -109,7 +109,11 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
.gravity(0.1f)
|
.gravity(0.1f)
|
||||||
.sound(ModSounds.INTO_MISSILE.get())
|
.sound(ModSounds.INTO_MISSILE.get())
|
||||||
.ammo(ModItems.AP_5_INCHES.get())
|
.ammo(ModItems.AP_5_INCHES.get())
|
||||||
.icon(Mod.loc("textures/screens/vehicle_weapon/ap_shell.png")),
|
.icon(Mod.loc("textures/screens/vehicle_weapon/ap_shell.png"))
|
||||||
|
.sound1p(ModSounds.YX_100_FIRE_1P.get())
|
||||||
|
.sound3p(ModSounds.YX_100_FIRE_3P.get())
|
||||||
|
.sound3pFar(ModSounds.YX_100_FAR.get())
|
||||||
|
.sound3pVeryFar(ModSounds.YX_100_VERYFAR.get()),
|
||||||
// HE
|
// HE
|
||||||
new CannonShellWeapon()
|
new CannonShellWeapon()
|
||||||
.hitDamage(VehicleConfig.YX_100_HE_CANNON_DAMAGE.get())
|
.hitDamage(VehicleConfig.YX_100_HE_CANNON_DAMAGE.get())
|
||||||
|
@ -122,7 +126,11 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
.gravity(0.1f)
|
.gravity(0.1f)
|
||||||
.sound(ModSounds.INTO_CANNON.get())
|
.sound(ModSounds.INTO_CANNON.get())
|
||||||
.ammo(ModItems.HE_5_INCHES.get())
|
.ammo(ModItems.HE_5_INCHES.get())
|
||||||
.icon(Mod.loc("textures/screens/vehicle_weapon/he_shell.png")),
|
.icon(Mod.loc("textures/screens/vehicle_weapon/he_shell.png"))
|
||||||
|
.sound1p(ModSounds.YX_100_FIRE_1P.get())
|
||||||
|
.sound3p(ModSounds.YX_100_FIRE_3P.get())
|
||||||
|
.sound3pFar(ModSounds.YX_100_FAR.get())
|
||||||
|
.sound3pVeryFar(ModSounds.YX_100_VERYFAR.get()),
|
||||||
// 同轴重机枪
|
// 同轴重机枪
|
||||||
new ProjectileWeapon()
|
new ProjectileWeapon()
|
||||||
.damage(VehicleConfig.HEAVY_MACHINE_GUN_DAMAGE.get())
|
.damage(VehicleConfig.HEAVY_MACHINE_GUN_DAMAGE.get())
|
||||||
|
@ -131,7 +139,11 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
.bypassArmorRate(0.4f)
|
.bypassArmorRate(0.4f)
|
||||||
.ammo(ModItems.HEAVY_AMMO.get())
|
.ammo(ModItems.HEAVY_AMMO.get())
|
||||||
.sound(ModSounds.INTO_CANNON.get())
|
.sound(ModSounds.INTO_CANNON.get())
|
||||||
.icon(Mod.loc("textures/screens/vehicle_weapon/gun_12_7mm.png")),
|
.icon(Mod.loc("textures/screens/vehicle_weapon/gun_12_7mm.png"))
|
||||||
|
.sound1p(ModSounds.M_2_FIRE_1P.get())
|
||||||
|
.sound3p(ModSounds.M_2_FIRE_3P.get())
|
||||||
|
.sound3pFar(ModSounds.M_2_FAR.get())
|
||||||
|
.sound3pVeryFar(ModSounds.M_2_VERYFAR.get()),
|
||||||
},
|
},
|
||||||
new VehicleWeapon[]{
|
new VehicleWeapon[]{
|
||||||
// 机枪
|
// 机枪
|
||||||
|
@ -141,7 +153,11 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
.zoom(false)
|
.zoom(false)
|
||||||
.bypassArmorRate(0.4f)
|
.bypassArmorRate(0.4f)
|
||||||
.ammo(ModItems.HEAVY_AMMO.get())
|
.ammo(ModItems.HEAVY_AMMO.get())
|
||||||
.icon(Mod.loc("textures/screens/vehicle_weapon/gun_12_7mm.png")),
|
.icon(Mod.loc("textures/screens/vehicle_weapon/gun_12_7mm.png"))
|
||||||
|
.sound1p(ModSounds.M_2_FIRE_1P.get())
|
||||||
|
.sound3p(ModSounds.M_2_FIRE_3P.get())
|
||||||
|
.sound3pFar(ModSounds.M_2_FAR.get())
|
||||||
|
.sound3pVeryFar(ModSounds.M_2_VERYFAR.get()),
|
||||||
},
|
},
|
||||||
new VehicleWeapon[]{
|
new VehicleWeapon[]{
|
||||||
// 蜂群无人机
|
// 蜂群无人机
|
||||||
|
@ -465,11 +481,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
level().addFreshEntity(entityToSpawn);
|
level().addFreshEntity(entityToSpawn);
|
||||||
|
|
||||||
if (!player.level().isClientSide) {
|
if (!player.level().isClientSide) {
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
playShootSound3p(player, 0, 8, 16, 32);
|
||||||
serverPlayer.playSound(ModSounds.YX_100_FIRE_3P.get(), 8, 1);
|
|
||||||
serverPlayer.playSound(ModSounds.YX_100_FAR.get(), 16, 1);
|
|
||||||
serverPlayer.playSound(ModSounds.YX_100_VERYFAR.get(), 32, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.entityData.set(CANNON_RECOIL_TIME, 40);
|
this.entityData.set(CANNON_RECOIL_TIME, 40);
|
||||||
|
@ -568,14 +580,8 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
this.entityData.set(COAX_HEAT, this.entityData.get(COAX_HEAT) + 4);
|
this.entityData.set(COAX_HEAT, this.entityData.get(COAX_HEAT) + 4);
|
||||||
this.entityData.set(FIRE_ANIM, 2);
|
this.entityData.set(FIRE_ANIM, 2);
|
||||||
|
|
||||||
float pitch = this.entityData.get(COAX_HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - this.entityData.get(COAX_HEAT)));
|
|
||||||
|
|
||||||
if (!player.level().isClientSide) {
|
if (!player.level().isClientSide) {
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
playShootSound3p(player, 0, 4, 12, 24);
|
||||||
serverPlayer.playSound(ModSounds.M_2_FIRE_3P.get(), 4, pitch);
|
|
||||||
serverPlayer.playSound(ModSounds.M_2_FAR.get(), 12, pitch);
|
|
||||||
serverPlayer.playSound(ModSounds.M_2_VERYFAR.get(), 24, pitch);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -593,14 +599,8 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
|
|
||||||
this.level().addFreshEntity(projectileEntity);
|
this.level().addFreshEntity(projectileEntity);
|
||||||
|
|
||||||
float pitch = this.entityData.get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - this.entityData.get(HEAT)));
|
|
||||||
|
|
||||||
if (!player.level().isClientSide) {
|
if (!player.level().isClientSide) {
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
playShootSound3p(player, 1, 4, 12, 24);
|
||||||
serverPlayer.playSound(ModSounds.M_2_FIRE_3P.get(), 4, pitch);
|
|
||||||
serverPlayer.playSound(ModSounds.M_2_FAR.get(), 12, pitch);
|
|
||||||
serverPlayer.playSound(ModSounds.M_2_VERYFAR.get(), 24, pitch);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.entityData.set(GUN_FIRE_TIME, 2);
|
this.entityData.set(GUN_FIRE_TIME, 2);
|
||||||
|
@ -1163,6 +1163,19 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWeaponHeat(Player player) {
|
||||||
|
if (player == getNthEntity(0)) {
|
||||||
|
return entityData.get(COAX_HEAT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player == getNthEntity(1)) {
|
||||||
|
return entityData.get(HEAT);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changeWeapon(int index, int value, boolean isScroll) {
|
public void changeWeapon(int index, int value, boolean isScroll) {
|
||||||
if (index != 0) return;
|
if (index != 0) return;
|
||||||
|
|
|
@ -74,4 +74,6 @@ public interface ArmedVehicleEntity {
|
||||||
* @return 放大倍率
|
* @return 放大倍率
|
||||||
*/
|
*/
|
||||||
int zoomFov();
|
int zoomFov();
|
||||||
|
|
||||||
|
int getWeaponHeat(Player player);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.atsuishio.superbwarfare.entity.vehicle.base;
|
package com.atsuishio.superbwarfare.entity.vehicle.base;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -144,4 +146,22 @@ public interface WeaponVehicleEntity extends ArmedVehicleEntity {
|
||||||
selectedWeapons.set(index, type);
|
selectedWeapons.set(index, type);
|
||||||
vehicle.getEntityData().set(VehicleEntity.SELECTED_WEAPON, selectedWeapons);
|
vehicle.getEntityData().set(VehicleEntity.SELECTED_WEAPON, selectedWeapons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default void playShootSound3p(Player player, int seat, int radius, int radius2, int radius3) {
|
||||||
|
var weapons = getAvailableWeapons(seat);
|
||||||
|
var weapon = weapons.get(getWeaponIndex(seat));
|
||||||
|
float pitch = getWeaponHeat(player) <= 60 ? 1 : (float) (1 - 0.011 * java.lang.Math.abs(60 - getWeaponHeat(player)));
|
||||||
|
|
||||||
|
if (player instanceof ServerPlayer serverPlayer) {
|
||||||
|
if (weapon.sound3p != null) {
|
||||||
|
serverPlayer.playSound(weapon.sound3p, radius, pitch);
|
||||||
|
}
|
||||||
|
if (weapon.sound3pFar != null) {
|
||||||
|
serverPlayer.playSound(weapon.sound3pFar, radius2, pitch);
|
||||||
|
}
|
||||||
|
if (weapon.sound3pVeryFar != null) {
|
||||||
|
serverPlayer.playSound(weapon.sound3pVeryFar, radius3, pitch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,14 @@ public abstract class VehicleWeapon {
|
||||||
public int backupAmmo;
|
public int backupAmmo;
|
||||||
|
|
||||||
public SoundEvent sound;
|
public SoundEvent sound;
|
||||||
|
// 第一人称射击音效
|
||||||
|
public SoundEvent sound1p;
|
||||||
|
// 第三人称射击音效
|
||||||
|
public SoundEvent sound3p;
|
||||||
|
public SoundEvent sound3pFar;
|
||||||
|
// 第一人称射击音效
|
||||||
|
public SoundEvent sound3pVeryFar;
|
||||||
|
|
||||||
|
|
||||||
public VehicleWeapon icon(ResourceLocation icon) {
|
public VehicleWeapon icon(ResourceLocation icon) {
|
||||||
this.icon = icon;
|
this.icon = icon;
|
||||||
|
@ -76,4 +84,24 @@ public abstract class VehicleWeapon {
|
||||||
this.maxAmmo = maxAmmo;
|
this.maxAmmo = maxAmmo;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public VehicleWeapon sound1p(SoundEvent sound1p) {
|
||||||
|
this.sound1p = sound1p;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VehicleWeapon sound3p(SoundEvent sound3p) {
|
||||||
|
this.sound3p = sound3p;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VehicleWeapon sound3pFar(SoundEvent sound3pFar) {
|
||||||
|
this.sound3pFar = sound3pFar;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VehicleWeapon sound3pVeryFar(SoundEvent sound3pVeryFar) {
|
||||||
|
this.sound3pVeryFar = sound3pVeryFar;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,8 @@ import com.atsuishio.superbwarfare.Mod;
|
||||||
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.config.server.MiscConfig;
|
import com.atsuishio.superbwarfare.config.server.MiscConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.*;
|
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||||
|
@ -59,9 +60,6 @@ import software.bernie.geckolib.cache.object.GeoBone;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity.COAX_HEAT;
|
|
||||||
import static com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity.HEAT;
|
|
||||||
|
|
||||||
@EventBusSubscriber(modid = Mod.MODID, bus = EventBusSubscriber.Bus.GAME, value = Dist.CLIENT)
|
@EventBusSubscriber(modid = Mod.MODID, bus = EventBusSubscriber.Bus.GAME, value = Dist.CLIENT)
|
||||||
public class ClientEventHandler {
|
public class ClientEventHandler {
|
||||||
|
|
||||||
|
@ -860,114 +858,18 @@ public class ClientEventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void playVehicleClientSounds(Player player, WeaponVehicleEntity iVehicle, int type) {
|
public static void playVehicleClientSounds(Player player, WeaponVehicleEntity iVehicle, int type) {
|
||||||
if (iVehicle instanceof SpeedboatEntity speedboat) {
|
var weapons = iVehicle.getAvailableWeapons(type);
|
||||||
float pitch = speedboat.getEntityData().get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - speedboat.getEntityData().get(HEAT)));
|
var weapon = weapons.get(iVehicle.getWeaponIndex(type));
|
||||||
player.playSound(ModSounds.M_2_FIRE_1P.get(), 1f, pitch);
|
|
||||||
player.playSound(ModSounds.SHELL_CASING_50CAL.get(), 0.3f, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iVehicle instanceof Ah6Entity ah6Entity) {
|
float pitch = iVehicle.getWeaponHeat(player) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - iVehicle.getWeaponHeat(player)));
|
||||||
float pitch = ah6Entity.getEntityData().get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - ah6Entity.getEntityData().get(HEAT)));
|
|
||||||
if (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON) {
|
if (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON || (zoomVehicle && !(iVehicle instanceof Ah6Entity))) {
|
||||||
if (ah6Entity.getWeaponIndex(0) == 0) {
|
if (weapon.sound1p != null) {
|
||||||
player.playSound(ModSounds.HELICOPTER_CANNON_FIRE_1P.get(), 1f, pitch);
|
player.playSound(weapon.sound1p, 1f, pitch);
|
||||||
} else if (ah6Entity.getWeaponIndex(0) == 1) {
|
|
||||||
player.playSound(ModSounds.HELICOPTER_ROCKET_FIRE_1P.get(), 1f, 1);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ah6Entity.getWeaponIndex(0) == 0) {
|
if (weapon.sound3p != null) {
|
||||||
player.playSound(ModSounds.HELICOPTER_CANNON_FIRE_3P.get(), 4f, pitch);
|
player.playSound(weapon.sound3p, 3f, pitch);
|
||||||
} else if (ah6Entity.getWeaponIndex(0) == 1) {
|
|
||||||
player.playSound(ModSounds.HELICOPTER_ROCKET_FIRE_3P.get(), 4f, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (iVehicle instanceof Lav150Entity lav150) {
|
|
||||||
if (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON) {
|
|
||||||
if (lav150.getWeaponIndex(0) == 0) {
|
|
||||||
float pitch = lav150.getEntityData().get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - lav150.getEntityData().get(HEAT)));
|
|
||||||
player.playSound(ModSounds.LAV_CANNON_FIRE_1P.get(), 1f, pitch);
|
|
||||||
player.playSound(ModSounds.SHELL_CASING_50CAL.get(), 0.3f, 1);
|
|
||||||
} else if (lav150.getWeaponIndex(0) == 1) {
|
|
||||||
float pitch = lav150.getEntityData().get(COAX_HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - lav150.getEntityData().get(COAX_HEAT)));
|
|
||||||
player.playSound(ModSounds.COAX_FIRE_1P.get(), 1f, pitch);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (lav150.getWeaponIndex(0) == 0) {
|
|
||||||
float pitch = lav150.getEntityData().get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - lav150.getEntityData().get(HEAT)));
|
|
||||||
player.playSound(ModSounds.LAV_CANNON_FIRE_3P.get(), 4f, pitch);
|
|
||||||
} else if (lav150.getWeaponIndex(0) == 1) {
|
|
||||||
float pitch = lav150.getEntityData().get(COAX_HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - lav150.getEntityData().get(COAX_HEAT)));
|
|
||||||
player.playSound(ModSounds.M_60_FIRE_3P.get(), 4f, pitch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
if (iVehicle instanceof Bmp2Entity bmp2) {
|
|
||||||
if (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON) {
|
|
||||||
if (bmp2.getWeaponIndex(0) == 0) {
|
|
||||||
float pitch = bmp2.getEntityData().get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - bmp2.getEntityData().get(HEAT)));
|
|
||||||
player.playSound(ModSounds.BMP_CANNON_FIRE_1P.get(), 1f, pitch);
|
|
||||||
player.playSound(ModSounds.SHELL_CASING_50CAL.get(), 0.3f, 1);
|
|
||||||
} else if (bmp2.getWeaponIndex(0) == 1) {
|
|
||||||
float pitch = bmp2.getEntityData().get(COAX_HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - bmp2.getEntityData().get(COAX_HEAT)));
|
|
||||||
player.playSound(ModSounds.COAX_FIRE_1P.get(), 1f, pitch);
|
|
||||||
} else if (bmp2.getWeaponIndex(0) == 2) {
|
|
||||||
player.playSound(ModSounds.BMP_MISSILE_FIRE_1P.get(), 1f, 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (bmp2.getWeaponIndex(0) == 0) {
|
|
||||||
float pitch = bmp2.getEntityData().get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - bmp2.getEntityData().get(HEAT)));
|
|
||||||
player.playSound(ModSounds.BMP_CANNON_FIRE_3P.get(), 4f, pitch);
|
|
||||||
} else if (bmp2.getWeaponIndex(0) == 1) {
|
|
||||||
float pitch = bmp2.getEntityData().get(COAX_HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - bmp2.getEntityData().get(COAX_HEAT)));
|
|
||||||
player.playSound(ModSounds.M_60_FIRE_3P.get(), 4f, pitch);
|
|
||||||
} else if (bmp2.getWeaponIndex(0) == 2) {
|
|
||||||
player.playSound(ModSounds.BMP_MISSILE_FIRE_3P.get(), 4f, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (iVehicle instanceof Yx100Entity yx100) {
|
|
||||||
if (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON) {
|
|
||||||
if (type == 1) {
|
|
||||||
float pitch = yx100.getEntityData().get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - yx100.getEntityData().get(HEAT)));
|
|
||||||
player.playSound(ModSounds.M_2_FIRE_1P.get(), 1f, pitch);
|
|
||||||
player.playSound(ModSounds.SHELL_CASING_50CAL.get(), 0.3f, 1);
|
|
||||||
} else if (type == 0) {
|
|
||||||
if (yx100.getWeaponIndex(0) == 0 || yx100.getWeaponIndex(0) == 1) {
|
|
||||||
player.playSound(ModSounds.YX_100_FIRE_1P.get(), 1f, 1);
|
|
||||||
} else if (yx100.getWeaponIndex(0) == 2) {
|
|
||||||
float pitch = yx100.getEntityData().get(COAX_HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - yx100.getEntityData().get(COAX_HEAT)));
|
|
||||||
player.playSound(ModSounds.M_2_FIRE_1P.get(), 1f, pitch);
|
|
||||||
player.playSound(ModSounds.SHELL_CASING_50CAL.get(), 0.3f, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (type == 1) {
|
|
||||||
float pitch = yx100.getEntityData().get(HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - yx100.getEntityData().get(HEAT)));
|
|
||||||
player.playSound(ModSounds.M_2_FIRE_3P.get(), 4f, pitch);
|
|
||||||
} else if (type == 0) {
|
|
||||||
if (yx100.getWeaponIndex(0) == 0 || yx100.getWeaponIndex(0) == 1) {
|
|
||||||
player.playSound(ModSounds.YX_100_FIRE_3P.get(), 4f, 1);
|
|
||||||
} else if (yx100.getWeaponIndex(0) == 2) {
|
|
||||||
float pitch = yx100.getEntityData().get(COAX_HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - yx100.getEntityData().get(COAX_HEAT)));
|
|
||||||
player.playSound(ModSounds.M_2_FIRE_3P.get(), 4f, pitch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (iVehicle instanceof PrismTankEntity prismTank) {
|
|
||||||
if (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON) {
|
|
||||||
if (prismTank.getWeaponIndex(0) == 0) {
|
|
||||||
player.playSound(ModSounds.PRISM_FIRE_1P.get(), 1f, 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (prismTank.getWeaponIndex(0) == 0) {
|
|
||||||
player.playSound(ModSounds.PRISM_FIRE_3P.get(), 4f, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Reference in a new issue