diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java index a958a1315..e31221533 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/HelicopterHudOverlay.java @@ -2,10 +2,12 @@ package com.atsuishio.superbwarfare.client.overlay; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.client.RenderHelper; +import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity; import com.atsuishio.superbwarfare.entity.vehicle.IHelicopterEntity; import com.atsuishio.superbwarfare.entity.vehicle.MobileVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; import com.atsuishio.superbwarfare.event.ClientEventHandler; +import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.network.ModVariables; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; @@ -18,6 +20,7 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.ClipContext; import net.minecraft.world.phys.Vec3; @@ -26,6 +29,7 @@ import net.minecraftforge.client.event.RenderGuiEvent; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; +import org.joml.Math; import org.joml.Matrix4f; import org.joml.Vector4f; @@ -33,6 +37,7 @@ import java.text.DecimalFormat; import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit; import static com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay.*; +import static com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity.WEAPON_TYPE; @Mod.EventBusSubscriber(value = Dist.CLIENT) public class HelicopterHudOverlay { @@ -61,6 +66,7 @@ public class HelicopterHudOverlay { if (player.getVehicle() instanceof IHelicopterEntity iHelicopterEntity && player.getVehicle() instanceof MobileVehicleEntity mobileVehicle && iHelicopterEntity.isDriver(player)) { poseStack.pushPose(); + poseStack.translate(-6 * ClientEventHandler.turnRot[1],-6 * ClientEventHandler.turnRot[0],0); RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.enableBlend(); @@ -78,7 +84,7 @@ public class HelicopterHudOverlay { if (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON) { preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/heli_base.png"), k, l, 0, 0.0F, i, j, i, j); - + renderDriverAngle(guiGraphics, player, mobileVehicle, k, l, i, j); poseStack.pushPose(); poseStack.rotateAround(Axis.ZP.rotationDegrees(-iHelicopterEntity.getRotZ(event.getPartialTick())), w / 2f, h / 2f, 0); float pitch = iHelicopterEntity.getRotX(event.getPartialTick()); @@ -103,18 +109,26 @@ public class HelicopterHudOverlay { lerpVy = (float) Mth.lerp(0.021f * event.getPartialTick(), lerpVy, mobileVehicle.getDeltaMovement().y()); preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/heli_vy_move.png"), (float) w / 2 + 138, ((float) h / 2 - 3 - Math.max(lerpVy * 20, -24) * 2.5f), 0, 0, 8, 8, 8, 8); guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(lerpVy * 20) + "m/s"), - w / 2 + 146, (int) (h / 2 - 3 - Math.max(lerpVy * 20, -24) * 2.5), (((lerpVy < -20 || lerpVy * 20 < -5 || (lerpVy * 20 < -1 && length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y + 0.06, mobileVehicle.getDeltaMovement().z) * 72 > 100)) && height < 36) || (length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y + 0.06, mobileVehicle.getDeltaMovement().z) * 72 > 40 && blockInWay < 72) ? -65536 : 0x66FF00), false); + w / 2 + 146, (int) (h / 2 - 3 - Math.max(lerpVy * 20, -24) * 2.5), (lerpVy * 20 < -24 || ((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) ? -65536 : 0x66FF00), false); guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(mobileVehicle.getY())), w / 2 + 104, h / 2, 0x66FF00, false); preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/speed_frame.png"), (float) w / 2 - 144, (float) h / 2 - 6, 0, 0, 50, 18, 50, 18); guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y, mobileVehicle.getDeltaMovement().z) * 72) + "KM/H"), w / 2 - 140, h / 2, 0x66FF00, false); - if (lerpVy * 20 < -20) { + if (mobileVehicle instanceof Ah6Entity ah6Entity) { + if (ah6Entity.getEntityData().get(WEAPON_TYPE) == 0) { + guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("20MM CANNON " + (player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())) ? "∞" : ah6Entity.getAmmoCount(player))), w / 2 - 160, h / 2 - 60, 0x66FF00, false); + } else { + guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("70MM ROCKET " + ah6Entity.getAmmoCount(player)), w / 2 - 160, h / 2 - 60, 0x66FF00, false); + } + } + + if (lerpVy * 20 < -24) { guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("SINK RATE,PULL UP!"), w / 2 - 53, h / 2 + 24, -65536, false); - } else if (((lerpVy * 20 < -5 || (lerpVy * 20 < -1 && length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y + 0.06, mobileVehicle.getDeltaMovement().z) * 72 > 100)) && height < 36) - || (length(mobileVehicle.getDeltaMovement().x, mobileVehicle.getDeltaMovement().y + 0.06, mobileVehicle.getDeltaMovement().z) * 72 > 40 && blockInWay < 72)) { + } 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"), w / 2 - 42, h / 2 + 24, -65536, false); } @@ -186,6 +200,13 @@ public class HelicopterHudOverlay { } } + private static void renderDriverAngle(GuiGraphics guiGraphics, Player player, Entity heli, float k, float l, float i, float j) { + float diffY = Mth.wrapDegrees(player.getYHeadRot() - heli.getYRot()) * 0.35f; + float diffX = Mth.wrapDegrees(player.getXRot() - heli.getXRot()) * 0.072f; + + preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/heli_driver_angle.png"), k + diffY, l + diffX, 0, 0.0F, i, j, i, j); + } + public static Matrix4f getVehicleTransform(VehicleEntity vehicle) { Matrix4f transform = new Matrix4f(); transform.translate((float) vehicle.getX(), (float) vehicle.getY(), (float) vehicle.getZ()); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java index e1bcafebe..8d9552868 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java @@ -58,7 +58,7 @@ import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle; public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHelicopterEntity, MultiWeaponVehicleEntity { private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - public static final float MAX_HEALTH = 400; + public static final float MAX_HEALTH = 500; public static final int MAX_ENERGY = 4000000; public static final EntityDataAccessor DELTA_ROT = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor PROPELLER_ROT = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.FLOAT); @@ -421,12 +421,12 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli ProjectileEntity projectileRight = new ProjectileEntity(player.level()) .shooter(player) - .damage(25) + .damage(18) .headShot(2f) .zoom(false); - projectileRight.heBullet(true, 3); - projectileRight.bypassArmorRate(0.5f); + projectileRight.heBullet(true, 2); + projectileRight.bypassArmorRate(0.2f); projectileRight.setPos(worldPositionRight.x, worldPositionRight.y, worldPositionRight.z); projectileRight.shoot(player, this.getLookAngle().x, this.getLookAngle().y + 0.025, this.getLookAngle().z, 20, (float) 0.2); @@ -435,12 +435,12 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli ProjectileEntity projectileLeft = new ProjectileEntity(player.level()) .shooter(player) - .damage(25) + .damage(18) .headShot(2f) .zoom(false); - projectileLeft.heBullet(true, 3); - projectileLeft.bypassArmorRate(0.5f); + projectileLeft.heBullet(true, 2); + projectileLeft.bypassArmorRate(0.2f); projectileLeft.setPos(worldPositionLeft.x, worldPositionLeft.y, worldPositionLeft.z); projectileLeft.shoot(player, this.getLookAngle().x, this.getLookAngle().y + 0.025, this.getLookAngle().z, 20, (float) 0.2); @@ -477,7 +477,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli if (fireIndex == 0) { HeliRocketEntity heliRocketEntityRight = new HeliRocketEntity(player, player.level(), 140, - 40, + 50, 5); heliRocketEntityRight.setPos(worldPositionRight.x, worldPositionRight.y, worldPositionRight.z); @@ -487,7 +487,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli } else if (fireIndex == 1) { HeliRocketEntity heliRocketEntityLeft = new HeliRocketEntity(player, player.level(), 140, - 40, + 50, 5); heliRocketEntityLeft.setPos(worldPositionLeft.x, worldPositionLeft.y, worldPositionLeft.z); @@ -558,7 +558,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli @Override public int mainGunRpm() { - return 480; + return 360; } @Override diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java index d5e9a5f73..bfc21a404 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java @@ -183,10 +183,12 @@ public class MobileVehicleEntity extends EnergyVehicleEntity { @Override protected void readAdditionalSaveData(CompoundTag compound) { super.readAdditionalSaveData(compound); + this.entityData.set(POWER, compound.getFloat("Power")); } @Override public void addAdditionalSaveData(CompoundTag compound) { super.addAdditionalSaveData(compound); + compound.putFloat("Power", this.entityData.get(POWER)); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/event/ClientSoundHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/ClientSoundHandler.java index 67ffd0e25..f54f641f0 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/ClientSoundHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/ClientSoundHandler.java @@ -2,6 +2,7 @@ package com.atsuishio.superbwarfare.event; import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity; import com.atsuishio.superbwarfare.entity.vehicle.MobileVehicleEntity; +import com.atsuishio.superbwarfare.init.ModSounds; import com.atsuishio.superbwarfare.tools.SeekTool; import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; @@ -45,8 +46,11 @@ public class ClientSoundHandler { float distanceReduce; if (e instanceof Ah6Entity ah6Entity) { distanceReduce = (float) (1 - distance / 64); - player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), 5 * (mobileVehicle.getEntityData().get(PROPELLER_ROT) - 0.012f) * distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.1f + 1.0f), false); -// player.displayClientMessage(Component.literal("Angle:" + engineSoundPos), true); + if (player.getVehicle() == ah6Entity) { + player.playSound(ModSounds.HELICOPTER_ENGINE_1P.get(), 2 * (mobileVehicle.getEntityData().get(PROPELLER_ROT) - 0.012f), (float) ((2 * Math.random() - 1) * 0.1f + 1.0f)); + } else { + player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), 5 * (mobileVehicle.getEntityData().get(PROPELLER_ROT) - 0.012f) * distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.1f + 1.0f), false); + } } } } diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModSounds.java b/src/main/java/com/atsuishio/superbwarfare/init/ModSounds.java index 823d5132f..8eb966790 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModSounds.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModSounds.java @@ -359,6 +359,7 @@ public class ModSounds { public static final RegistryObject HELICOPTER_ENGINE_START = REGISTRY.register("helicopter_engine_start", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("helicopter_engine_start"))); public static final RegistryObject HELICOPTER_ENGINE = REGISTRY.register("helicopter_engine", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("helicopter_engine"))); + public static final RegistryObject HELICOPTER_ENGINE_1P = REGISTRY.register("helicopter_engine_1p", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("helicopter_engine_1p"))); public static final RegistryObject HELICOPTER_CANNON_FIRE_1P = REGISTRY.register("heli_cannon_fire_1p", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("heli_cannon_fire_1p"))); public static final RegistryObject HELICOPTER_CANNON_FIRE_3P = REGISTRY.register("heli_cannon_fire_3p", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("heli_cannon_fire_3p"))); public static final RegistryObject HELICOPTER_CANNON_FAR = REGISTRY.register("heli_cannon_far", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("heli_cannon_far"))); diff --git a/src/main/resources/assets/superbwarfare/sounds.json b/src/main/resources/assets/superbwarfare/sounds.json index 7fe1052f9..adcd671f0 100644 --- a/src/main/resources/assets/superbwarfare/sounds.json +++ b/src/main/resources/assets/superbwarfare/sounds.json @@ -2522,6 +2522,13 @@ } ] }, + "helicopter_engine_1p": { + "sounds": [ + { + "name": "superbwarfare:helicopter/heli_engine_1p" + } + ] + }, "heli_cannon_fire_1p": { "sounds": [ { diff --git a/src/main/resources/assets/superbwarfare/sounds/helicopter/heli_engine_1p.ogg b/src/main/resources/assets/superbwarfare/sounds/helicopter/heli_engine_1p.ogg new file mode 100644 index 000000000..f6a5d16e8 Binary files /dev/null and b/src/main/resources/assets/superbwarfare/sounds/helicopter/heli_engine_1p.ogg differ diff --git a/src/main/resources/assets/superbwarfare/textures/screens/helicopter/heli_driver_angle.png b/src/main/resources/assets/superbwarfare/textures/screens/helicopter/heli_driver_angle.png new file mode 100644 index 000000000..eeddac301 Binary files /dev/null and b/src/main/resources/assets/superbwarfare/textures/screens/helicopter/heli_driver_angle.png differ diff --git a/src/main/resources/assets/superbwarfare/textures/screens/helicopter/heli_line.png b/src/main/resources/assets/superbwarfare/textures/screens/helicopter/heli_line.png index d2902ded1..ee3da4d44 100644 Binary files a/src/main/resources/assets/superbwarfare/textures/screens/helicopter/heli_line.png and b/src/main/resources/assets/superbwarfare/textures/screens/helicopter/heli_line.png differ diff --git a/src/main/resources/data/superbwarfare/recipes/motor_crafting.json b/src/main/resources/data/superbwarfare/recipes/motor_crafting.json index c3f98b587..4d7c926ba 100644 --- a/src/main/resources/data/superbwarfare/recipes/motor_crafting.json +++ b/src/main/resources/data/superbwarfare/recipes/motor_crafting.json @@ -2,26 +2,26 @@ "type": "minecraft:crafting_shaped", "category": "misc", "pattern": [ - "aba", - "aba", - "cdc" + " a ", + "bcd", + "bcd" ], "key": { "a": { - "tag": "forge:plates/copper" - }, - "b": { - "item": "minecraft:iron_ingot" - }, - "c": { "item": "minecraft:iron_nugget" }, + "b": { + "item": "minecraft:lapis_lazuli" + }, + "c": { + "item": "minecraft:copper_ingot" + }, "d": { - "item": "minecraft:lodestone" + "item": "minecraft:redstone" } }, "result": { "item": "superbwarfare:motor", - "count": 32 + "count": 2 } } \ No newline at end of file diff --git a/src/main/resources/data/superbwarfare/recipes/shield_cell_crafting.json b/src/main/resources/data/superbwarfare/recipes/shield_cell_crafting.json index f6efea6d8..8b5bad44f 100644 --- a/src/main/resources/data/superbwarfare/recipes/shield_cell_crafting.json +++ b/src/main/resources/data/superbwarfare/recipes/shield_cell_crafting.json @@ -2,19 +2,16 @@ "type": "minecraft:crafting_shaped", "category": "misc", "pattern": [ - "aba", + " b ", "cdc", - "aea" + " e " ], "key": { - "a": { - "item": "minecraft:light_blue_concrete" - }, "b": { "tag": "forge:plates/copper" }, "c": { - "tag": "forge:stained_glass_panes" + "tag": "forge:glass_panes" }, "d": { "item": "minecraft:redstone" @@ -25,6 +22,6 @@ }, "result": { "item": "superbwarfare:cell", - "count": 2 + "count": 1 } } \ No newline at end of file