基本完成固定翼HUD

This commit is contained in:
Atsuishio 2025-05-07 17:09:49 +08:00 committed by Light_Quanta
parent 5f52d7981f
commit 25e2a82e53
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
7 changed files with 87 additions and 84 deletions

View file

@ -3,11 +3,13 @@ package com.atsuishio.superbwarfare.client.overlay;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.client.ClickHandler;
import com.atsuishio.superbwarfare.client.RenderHelper;
import com.atsuishio.superbwarfare.entity.vehicle.A10Entity;
import com.atsuishio.superbwarfare.entity.vehicle.base.AircraftEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.tools.FormatTool;
import com.atsuishio.superbwarfare.tools.InventoryTool;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
@ -23,7 +25,6 @@ import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.phys.Vec3;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
@ -31,6 +32,7 @@ import org.jetbrains.annotations.NotNull;
import org.joml.Math;
import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
import static com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity.HEAT;
@OnlyIn(Dist.CLIENT)
public class AircraftOverlay implements LayeredDraw.Layer {
@ -39,7 +41,6 @@ public class AircraftOverlay implements LayeredDraw.Layer {
private static float scopeScale = 1;
private static float lerpVy = 1;
private static float lerpPower = 1;
@Override
public void render(GuiGraphics guiGraphics, @NotNull DeltaTracker deltaTracker) {
@ -69,14 +70,7 @@ public class AircraftOverlay implements LayeredDraw.Layer {
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
RenderSystem.setShaderColor(1, 1, 1, 1);
scopeScale = Mth.lerp(partialTick, scopeScale, 0.75F);
float f = (float) Math.min(screenWidth, screenHeight);
float f1 = Math.min((float) screenWidth / f, (float) screenHeight / f) * scopeScale;
float i = Mth.floor(f * f1);
float j = Mth.floor(f * f1);
float k = ((screenWidth - i) / 2);
float l = ((screenHeight - j) / 2);
lerpVy = (float) Mth.lerp(0.021f * partialTick, lerpVy, mobileVehicle.getDeltaMovement().y());
float diffY = Mth.wrapDegrees(Mth.lerp(partialTick, player.yHeadRotO, player.getYHeadRot()) - Mth.lerp(partialTick, mobileVehicle.yRotO, mobileVehicle.getYRot())) * 0.5f;
float diffX = Mth.wrapDegrees(Mth.lerp(partialTick, player.xRotO, player.getXRot()) - Mth.lerp(partialTick, mobileVehicle.xRotO, mobileVehicle.getXRot())) * 0.5f;
@ -98,7 +92,6 @@ public class AircraftOverlay implements LayeredDraw.Layer {
float y = (float) p.y;
if (mc.options.getCameraType() == CameraType.FIRST_PERSON) {
RenderSystem.disableDepthTest();
RenderSystem.depthMask(false);
RenderSystem.enableBlend();
@ -106,53 +99,54 @@ public class AircraftOverlay implements LayeredDraw.Layer {
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
RenderSystem.setShaderColor(1, 1, 1, 1);
preciseBlit(guiGraphics, Mod.loc("textures/screens/aircraft/hud_base.png"), x - 128, y - 128, 0, 0, 256, 256, 256, 256);
preciseBlit(guiGraphics, Mod.loc("textures/screens/aircraft/hud_base.png"), x - 160, y - 160, 0, 0, 320, 320, 320, 320);
preciseBlit(guiGraphics, Mod.loc("textures/screens/compass.png"), x - 128, (float) 6, 128 + ((float) 64 / 45 * mobileVehicle.getYRot()), 0, 256, 16, 512, 16);
//指南针
preciseBlit(guiGraphics, Mod.loc("textures/screens/compass.png"), x - 128, y - 122, 128 + ((float) 64 / 45 * mobileVehicle.getYRot()), 0, 256, 16, 512, 16);
preciseBlit(guiGraphics, Mod.loc("textures/screens/aircraft/compass_ind.png"), x - 4, y - 123, 0, 0, 8, 8, 8, 8);
//滚转指示
poseStack.pushPose();
poseStack.rotateAround(Axis.ZP.rotationDegrees(aircraftEntity.getRotZ(partialTick)), x, y, 0);
preciseBlit(guiGraphics, Mod.loc("textures/screens/helicopter/roll_ind.png"), x - 8, y + 112, 0, 0, 16, 16, 16, 16);
poseStack.rotateAround(Axis.ZP.rotationDegrees(aircraftEntity.getRotZ(partialTick)), x, y + 48, 0);
preciseBlit(guiGraphics, Mod.loc("textures/screens/helicopter/roll_ind.png"), x - 4, y + 144, 0, 0, 8, 8, 8, 8);
poseStack.popPose();
double height = mobileVehicle.position().distanceTo((Vec3.atLowerCornerOf(mobileVehicle.level().clip(new ClipContext(mobileVehicle.position(), mobileVehicle.position().add(new Vec3(0, -1, 0).scale(100)),
ClipContext.Block.OUTLINE, ClipContext.Fluid.ANY, mobileVehicle)).getBlockPos())));
double blockInWay = mobileVehicle.position().distanceTo((Vec3.atLowerCornerOf(mobileVehicle.level().clip(new ClipContext(mobileVehicle.position(), mobileVehicle.position().add(new Vec3(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y + 0.06, mobileVehicle.getDeltaMovement().z).normalize().scale(100)),
ClipContext.Block.OUTLINE, ClipContext.Fluid.ANY, mobileVehicle)).getBlockPos())));
//时速
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(FormatTool.format0D(mobileVehicle.getDeltaMovement().dot(mobileVehicle.getViewVector(1)) * 72)),
(int) x - 105, (int) y - 61, 0x66FF00, false);
//高度
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(FormatTool.format0D(mobileVehicle.getY())),
(int) x + 111 - 36, (int) y - 61, 0x66FF00, false);
//
preciseBlit(guiGraphics, Mod.loc("textures/screens/helicopter/speed_frame.png"), x - 108, y - 64, 0, 0, 36, 12, 36, 12);
preciseBlit(guiGraphics, Mod.loc("textures/screens/helicopter/speed_frame.png"), x + 108 - 36, y - 64, 0, 0, 36, 12, 36, 12);
//垂直速度
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(FormatTool.format0D(lerpVy * 20)), (int) x - 96, (int) y + 60, 0x66FF00, false);
// 热诱弹
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("IR FLARES " + aircraftEntity.getDecoy()), (int) x + 72, (int) y, 0x66FF00, false);
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(FormatTool.format0D(lerpVy * 20, "m/s")), (int) x + 146, (int) y, 0x66FF00, false);
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(FormatTool.format0D(mobileVehicle.getY())), (int) x + 104, (int) y, 0x66FF00, false);
preciseBlit(guiGraphics, Mod.loc("textures/screens/helicopter/speed_frame.png"), x - 144, y, 0, 0, 50, 18, 50, 18);
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(FormatTool.format0D(mobileVehicle.getDeltaMovement().dot(mobileVehicle.getViewVector(1)) * 72, "km/h")), (int) x - 140, (int) y, 0x66FF00, false);
if (mobileVehicle instanceof A10Entity a10Entity) {
if (weaponVehicle.getWeaponIndex(0) == 0) {
double heat = 1 - a10Entity.getEntityData().get(HEAT) / 100.0F;
String name = "30MM CANNON";
int width = Minecraft.getInstance().font.width(name);
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(name), (int) x - width / 2, (int) y + 67, Mth.hsvToRgb((float) heat / 3.745318352059925F, 1.0F, 1.0F), false);
// if (mobileVehicle instanceof Ah6Entity ah6Entity) {
// if (weaponVehicle.getWeaponIndex(0) == 0) {
// double heat = 1 - ah6Entity.getEntityData().get(HEAT) / 100.0F;
// guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("20MM CANNON " + (InventoryTool.hasCreativeAmmoBox(player) ? "" : aircraftEntity.getAmmoCount(player))), screenWidth / 2 - 160, screenHeight / 2 - 60, Mth.hsvToRgb((float) heat / 3.745318352059925F, 1.0F, 1.0F), false);
// } else {
// guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("70MM ROCKET " + aircraftEntity.getAmmoCount(player)), screenWidth / 2 - 160, screenHeight / 2 - 60, 0x66FF00, false);
// }
// }
String count = InventoryTool.hasCreativeAmmoBox(player) ? "" : String.valueOf(aircraftEntity.getAmmoCount(player));
int width2 = Minecraft.getInstance().font.width(count);
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(count), (int) x - width2 / 2, (int) y + 76, Mth.hsvToRgb((float) heat / 3.745318352059925F, 1.0F, 1.0F), false);
} else {
String name = "70MM ROCKET";
int width = Minecraft.getInstance().font.width(name);
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(name), (int) x - width / 2, (int) y + 67, 0x66FF00, false);
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("FLARE " + aircraftEntity.getDecoy()), (int) x - 160, (int) y - 50, 0x66FF00, false);
if (lerpVy * 20 < -24) {
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("SINK RATEPULL UP!"),
(int) x - 53, (int) y + 24, -65536, false);
} else if (((lerpVy * 20 < -10 || (lerpVy * 20 < -1 && length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y, mobileVehicle.getDeltaMovement().z) * 72 > 100)) && height < 36)
|| (length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y, mobileVehicle.getDeltaMovement().z) * 72 > 40 && blockInWay < 72)) {
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("TERRAIN TERRAIN"),
(int) x - 42, (int) y + 24, -65536, false);
String count = String.valueOf(aircraftEntity.getAmmoCount(player));
int width2 = Minecraft.getInstance().font.width(count);
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(count), (int) x - width2 / 2, (int) y + 76, 0x66FF00, false);
}
if (mobileVehicle.getEnergy() < 0.02 * mobileVehicle.getMaxEnergy()) {
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("NO POWER!"),
(int) x - 144, (int) y + 14, -65536, false);
} else if (mobileVehicle.getEnergy() < 0.2 * mobileVehicle.getMaxEnergy()) {
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("LOW POWER"),
(int) x - 144, (int) y + 14, 0xFF6B00, false);
}
//角度
@ -167,9 +161,19 @@ public class AircraftOverlay implements LayeredDraw.Layer {
poseStack.rotateAround(Axis.ZP.rotationDegrees(-aircraftEntity.getRotZ(partialTick)), x, y, 0);
float pitch = aircraftEntity.getRotX(partialTick);
preciseBlit(guiGraphics, Mod.loc("textures/screens/aircraft/hud_line.png"), x - 128 + diffY, y - 512 - 5.475f * pitch, 0, 0, 256, 1024, 256, 1024);
preciseBlit(guiGraphics, Mod.loc("textures/screens/aircraft/hud_line2.png"), x - 128 + diffY, y - 512 - 5.475f * pitch + diffX, 0, 0, 256, 1024, 256, 1024);
preciseBlit(guiGraphics, Mod.loc("textures/screens/aircraft/hud_line.png"), x - 96 + diffY, y - 128, 0, 448 + 4.10625f * pitch, 192, 256, 192, 1152);
preciseBlit(guiGraphics, Mod.loc("textures/screens/aircraft/hud_ind.png"), x - 18 + diffY, y - 12, 0, 0, 36, 24, 36, 24);
poseStack.popPose();
//能量警告
if (mobileVehicle.getEnergy() < 0.02 * mobileVehicle.getMaxEnergy()) {
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("NO POWER!"),
(int) x - 144, (int) y + 14, -65536, false);
} else if (mobileVehicle.getEnergy() < 0.2 * mobileVehicle.getMaxEnergy()) {
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("LOW POWER"),
(int) x - 144, (int) y + 14, 0xFF6B00, false);
}
}
}
@ -188,7 +192,7 @@ public class AircraftOverlay implements LayeredDraw.Layer {
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
RenderSystem.setShaderColor(1, 1, 1, 1);
preciseBlit(guiGraphics, Mod.loc("textures/screens/aircraft/hud_base2.png"), x - 96 + diffX, y - 96 + diffY, 0, 0, 192, 192, 192, 192);
preciseBlit(guiGraphics, Mod.loc("textures/screens/aircraft/hud_base2.png"), x - 72 + diffX, y - 72 + diffY, 0, 0, 144, 144, 144, 144);
preciseBlit(guiGraphics, Mod.loc("textures/screens/aircraft/crosshair_ind.png"), x - 16, y - 16, 0, 0, 32, 32, 32, 32);
renderKillIndicator(guiGraphics, x - 7.5f + (float) (2 * (Math.random() - 0.5f)), y - 7.5f + (float) (2 * (Math.random() - 0.5f)));
@ -204,25 +208,22 @@ public class AircraftOverlay implements LayeredDraw.Layer {
poseStack.translate(x, y, 0);
poseStack.scale(0.75f, 0.75f, 1);
// if (mobileVehicle instanceof Ah6Entity ah6Entity) {
// if (weaponVehicle.getWeaponIndex(0) == 0) {
// double heat = ah6Entity.getEntityData().get(HEAT) / 100.0F;
// guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("20MM CANNON " + (InventoryTool.hasCreativeAmmoBox(player) ? "" : aircraftEntity.getAmmoCount(player))), 25, -9, Mth.hsvToRgb(0F, (float) heat, 1.0F), false);
// } else {
// guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("70MM ROCKET " + aircraftEntity.getAmmoCount(player)), 25, -9, -1, false);
// }
// }
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("FLARE " + aircraftEntity.getDecoy()), 25, 1, -1, false);
poseStack.popPose();
poseStack.popPose();
}
poseStack.popPose();
}
poseStack.popPose();
if (mobileVehicle instanceof A10Entity a10Entity) {
if (weaponVehicle.getWeaponIndex(0) == 0) {
double heat = a10Entity.getEntityData().get(HEAT) / 100.0F;
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("30MM CANNON " + (InventoryTool.hasCreativeAmmoBox(player) ? "" : aircraftEntity.getAmmoCount(player))), 25, -9, Mth.hsvToRgb(0F, (float) heat, 1.0F), false);
} else {
scopeScale = 0.7f;
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("70MM ROCKET " + aircraftEntity.getAmmoCount(player)), 25, -9, -1, false);
}
}
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("IR FLARES " + aircraftEntity.getDecoy()), 25, 1, -1, false);
poseStack.popPose();
poseStack.popPose();
}
poseStack.popPose();
}
poseStack.popPose();
}
}

View file

@ -16,7 +16,10 @@ import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.init.ModTags;
import com.atsuishio.superbwarfare.network.message.receive.ShakeClientMessage;
import com.atsuishio.superbwarfare.tools.*;
import com.atsuishio.superbwarfare.tools.CustomExplosion;
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
import com.atsuishio.superbwarfare.tools.InventoryTool;
import com.atsuishio.superbwarfare.tools.ParticleTool;
import com.mojang.math.Axis;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@ -82,7 +85,7 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
.explosionDamage(VehicleConfig.BMP_2_CANNON_EXPLOSION_DAMAGE.get().floatValue())
.explosionRadius(VehicleConfig.BMP_2_CANNON_EXPLOSION_RADIUS.get().floatValue())
.sound(ModSounds.INTO_CANNON.get())
.icon(Mod.loc("textures/screens/vehicle_weapon/cannon_20mm.png")),
.icon(Mod.loc("textures/screens/vehicle_weapon/cannon_30mm.png")),
new HeliRocketWeapon()
.damage(VehicleConfig.AH_6_ROCKET_DAMAGE.get())
.explosionDamage(VehicleConfig.AH_6_ROCKET_EXPLOSION_DAMAGE.get())
@ -165,11 +168,11 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
super.baseTick();
float f;
f = (float) Mth.clamp(Math.max((onGround() ? 0.785f : 0.79f) - 0.01 * getDeltaMovement().length(), 0.5) + 0.031f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90, 0.01, 0.99);
f = (float) Mth.clamp(Math.max((onGround() ? 0.88f : 0.89f) - 0.01 * getDeltaMovement().length(), 0.5) + 0.001f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90, 0.01, 0.99);
boolean forward = Mth.abs((float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) < 90;
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).scale((forward ? 0.23 : -0.23) * this.getDeltaMovement().length())));
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).scale((forward ? 0.13 : -0.02) * this.getDeltaMovement().length())));
this.setDeltaMovement(this.getDeltaMovement().multiply(f, f, f));
if (this.isInWater() && this.tickCount % 4 == 0) {
@ -208,12 +211,7 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
private void handleAmmo() {
if (!(this.getFirstPassenger() instanceof Player player)) return;
int ammoCount = this.getItemStacks().stream().filter(stack -> {
if (stack.is(ModItems.AMMO_BOX.get())) {
return Ammo.HEAVY.get(stack) > 0;
}
return false;
}).mapToInt(Ammo.HEAVY::get).sum() + countItem(ModItems.SMALL_SHELL.get());
int ammoCount = countItem(ModItems.SMALL_SHELL.get());
if ((hasItem(ModItems.ROCKET_70.get()) || InventoryTool.hasCreativeAmmoBox(player)) && reloadCoolDown == 0 && this.getEntityData().get(LOADED_ROCKET) < 28) {
this.entityData.set(LOADED_ROCKET, this.getEntityData().get(LOADED_ROCKET) + 1);
@ -261,9 +259,9 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
if (!onGround()) {
if (rightInputDown) {
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) - 0.3f);
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) - 0.4f);
} else if (this.leftInputDown) {
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) + 0.3f);
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) + 0.4f);
}
} else {
// 刹车
@ -278,8 +276,8 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
float roll = Mth.abs(Mth.clamp(getRoll() / 60, -1.5f, 1.5f));
float addY = Mth.clamp(Math.max((this.onGround() ? 0.1f : 0.2f) * (float) Math.max(getDeltaMovement().dot(getViewVector(1)), 0.05), 0f) * diffY - 0.5f * this.entityData.get(DELTA_ROT), -1.5f * (roll + 1), 1.5f * (roll + 1));
float addX = Mth.clamp(Math.min((float) Math.max(getDeltaMovement().dot(getViewVector(1)) - 0.17, 0.02), 0.5f) * diffX, -1.8f, 1.8f);
float addY = Mth.clamp(Math.max((this.onGround() ? 0.1f : 0.2f) * (float) Math.max(getDeltaMovement().dot(getViewVector(1)), 0), 0f) * diffY - 0.5f * this.entityData.get(DELTA_ROT), -1.5f * (roll + 1), 1.5f * (roll + 1));
float addX = Mth.clamp(Math.min((float) Math.max(getDeltaMovement().dot(getViewVector(1)) - 0.17, 0.01), 0.7f) * diffX, -2.4f, 2.4f);
float addZ = this.entityData.get(DELTA_ROT) - (this.onGround() ? 0 : 0.01f) * diffY * (float) getDeltaMovement().dot(getViewVector(1));
float i = getXRot() / 90;
@ -325,7 +323,7 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
this.entityData.set(POWER, this.entityData.get(POWER) * 0.99f);
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * 0.95f);
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale(Math.max((90 + this.getXRot()) / 90, 0.3) * 0.4 * this.entityData.get(POWER))));
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale(Math.max((90 + this.getXRot()) / 90, 0.8) * 0.4 * this.entityData.get(POWER))));
double flapAngle = (getFlap1LRot() + getFlap1RRot()) / 2;
@ -539,7 +537,7 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
if (getWeaponIndex(0) == 0) {
if (this.cannotFire) return;
boolean hasCreativeAmmo = (getFirstPassenger() instanceof Player pPlayer && InventoryTool.hasCreativeAmmoBox(pPlayer)) || hasItem(ModItems.CREATIVE_AMMO_BOX.get());
boolean hasCreativeAmmo = getFirstPassenger() instanceof Player pPlayer && InventoryTool.hasCreativeAmmoBox(pPlayer);
Vector4f worldPosition = transformPosition(transform, 0.1321625f, -0.56446875f, 7.85210625f);
@ -547,16 +545,18 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
var entityToSpawn = ((SmallCannonShellWeapon) getWeapon(0)).create(player);
entityToSpawn.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
entityToSpawn.shoot(getLookAngle().x, getLookAngle().y - 0.062, getLookAngle().z, 20, 0.5f);
entityToSpawn.shoot(getLookAngle().x, getLookAngle().y - 0.057, getLookAngle().z, 20, 0.5f);
level().addFreshEntity(entityToSpawn);
sendParticle((ServerLevel) this.level(), ParticleTypes.LARGE_SMOKE, worldPosition.x, worldPosition.y, worldPosition.z, 1, 0, 0, 0, 0, false);
BlockPos pos = BlockPos.containing(new Vec3(worldPosition.x, worldPosition.y, worldPosition.z));
if (!player.level().isClientSide) {
if (player instanceof ServerPlayer serverPlayer) {
serverPlayer.level().playSound(null, this.getOnPos(), ModSounds.HPJ_11_FIRE_3P.get(), SoundSource.PLAYERS, 6, random.nextFloat() * 0.05f + 1);
serverPlayer.level().playSound(null, this.getOnPos(), ModSounds.HPJ_11_FAR.get(), SoundSource.PLAYERS, 12, random.nextFloat() * 0.05f + 1);
serverPlayer.level().playSound(null, this.getOnPos(), ModSounds.HPJ_11_VERYFAR.get(), SoundSource.PLAYERS, 24, random.nextFloat() * 0.05f + 1);
serverPlayer.level().playSound(null, pos, ModSounds.HPJ_11_FIRE_3P.get(), SoundSource.PLAYERS, 6, random.nextFloat() * 0.05f + 1);
serverPlayer.level().playSound(null, pos, ModSounds.HPJ_11_FAR.get(), SoundSource.PLAYERS, 12, random.nextFloat() * 0.05f + 1);
serverPlayer.level().playSound(null, pos, ModSounds.HPJ_11_VERYFAR.get(), SoundSource.PLAYERS, 24, random.nextFloat() * 0.05f + 1);
}
}
@ -606,10 +606,12 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
shootAngle = new Vec3(worldPosition.x, worldPosition.y, worldPosition.z).vectorTo(new Vec3(worldPosition2.x, worldPosition2.y, worldPosition2.z)).normalize();
heliRocketEntity.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
heliRocketEntity.shoot(shootAngle.x, shootAngle.y - 0.07, shootAngle.z, 8, 0.5f);
heliRocketEntity.shoot(shootAngle.x, shootAngle.y - 0.08, shootAngle.z, 8, 0.5f);
player.level().addFreshEntity(heliRocketEntity);
this.level().playSound(null, BlockPos.containing(new Vec3(worldPosition.x, worldPosition.y, worldPosition.z)), ModSounds.HELICOPTER_ROCKET_FIRE_3P.get(), SoundSource.PLAYERS, 5, 1);
BlockPos pos = BlockPos.containing(new Vec3(worldPosition.x, worldPosition.y, worldPosition.z));
this.level().playSound(null, pos, ModSounds.HELICOPTER_ROCKET_FIRE_3P.get(), SoundSource.PLAYERS, 5, 1);
this.entityData.set(LOADED_ROCKET, this.getEntityData().get(LOADED_ROCKET) - 1);

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB