diff --git a/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java b/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java index 84ac49c66..636ba041c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java @@ -358,10 +358,8 @@ public class ClickHandler { public static void handleWeaponZoomPress(Player player, ItemStack stack) { ModUtils.PACKET_HANDLER.sendToServer(new ZoomMessage(0)); - if (player.getVehicle() instanceof ArmedVehicleEntity iVehicle && iVehicle.banHand(player)) { - if (iVehicle.isDriver(player)) { - ClientEventHandler.zoomVehicle = true; - } + if (player.getVehicle() instanceof VehicleEntity pVehicle && player.getVehicle() instanceof WeaponVehicleEntity iVehicle && iVehicle.hasWeapon(pVehicle.getSeatIndex(player))) { + ClientEventHandler.zoomVehicle = true; return; } diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/AmmoBarOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/AmmoBarOverlay.java index 2adf05f36..1abff9f66 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/AmmoBarOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/AmmoBarOverlay.java @@ -2,6 +2,7 @@ package com.atsuishio.superbwarfare.client.overlay; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.client.DisplayConfig; +import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModKeyMappings; import com.atsuishio.superbwarfare.init.ModTags; @@ -50,7 +51,7 @@ public class AmmoBarOverlay { if (player.isSpectator()) return; ItemStack stack = player.getMainHandItem(); - if (stack.getItem() instanceof GunItem gunItem) { + if (stack.getItem() instanceof GunItem gunItem &&!(player.getVehicle() instanceof ArmedVehicleEntity vehicle && vehicle.banHand(player))) { PoseStack poseStack = event.getGuiGraphics().pose(); // 渲染图标 diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java index e64cf4fc2..88af89ecb 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java @@ -178,7 +178,7 @@ public class KillMessageOverlay { if (player != null && player.getVehicle() instanceof VehicleEntity vehicleEntity) { // 载具图标 - if ((vehicleEntity instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.banHand(player)) || record.damageType == ModDamageTypes.VEHICLE_STRIKE) { + if ((vehicleEntity instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.banHand(player)) || record.damageType == ModDamageTypes.VEHICLE_STRIKE) { renderItem = true; ResourceLocation resourceLocation = vehicleEntity.getVehicleIcon(); diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java index 7f49e9214..66eacc72b 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java @@ -96,50 +96,50 @@ public class VehicleHudOverlay { } poseStack.popPose(); - if (vehicle instanceof ArmedVehicleEntity iVehicle && iVehicle.getAmmoCount(player) != -1 && iVehicle.isDriver(player)) { - boolean iCharge = iVehicle instanceof EnergyVehicleEntity; - - // 渲染当前弹药量 - poseStack.pushPose(); - poseStack.scale(1.5f, 1.5f, 1f); - float v = h / 1.5f - (iCharge ? 42 : 29) / 1.5f; - - if (player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())) - && !(iVehicle instanceof CannonEntity - || (iVehicle instanceof Ah6Entity ah6Entity && ah6Entity.getWeaponType(0) == 1)) - ) { - event.getGuiGraphics().drawString( - Minecraft.getInstance().font, - "∞", - w / 1.5f - 41 / 1.5f, - v, - 0xFFFFFF, - true - ); - } else { - event.getGuiGraphics().drawString( - Minecraft.getInstance().font, - iVehicle.getAmmoCount(player) + "", - w / 1.5f - 41 / 1.5f, - v, - 0xFFFFFF, - true - ); - } - - poseStack.popPose(); - ItemStack stack = player.getMainHandItem(); - - // 渲染弹药类型 - event.getGuiGraphics().drawString( - Minecraft.getInstance().font, - getVehicleAmmoType(stack, iVehicle), - w - 90, - h - (iCharge ? 38 : 26), - 0xFFFFFF, - true - ); - } +// if (vehicle instanceof ArmedVehicleEntity iVehicle && iVehicle.getAmmoCount(player) != -1 && iVehicle.isDriver(player)) { +// boolean iCharge = iVehicle instanceof EnergyVehicleEntity; +// +// // 渲染当前弹药量 +// poseStack.pushPose(); +// poseStack.scale(1.5f, 1.5f, 1f); +// float v = h / 1.5f - (iCharge ? 42 : 29) / 1.5f; +// +// if (player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())) +// && !(iVehicle instanceof CannonEntity +// || (iVehicle instanceof Ah6Entity ah6Entity && ah6Entity.getWeaponType(0) == 1)) +// ) { +// event.getGuiGraphics().drawString( +// Minecraft.getInstance().font, +// "∞", +// w / 1.5f - 41 / 1.5f, +// v, +// 0xFFFFFF, +// true +// ); +// } else { +// event.getGuiGraphics().drawString( +// Minecraft.getInstance().font, +// iVehicle.getAmmoCount(player) + "", +// w / 1.5f - 41 / 1.5f, +// v, +// 0xFFFFFF, +// true +// ); +// } +// +// poseStack.popPose(); +// ItemStack stack = player.getMainHandItem(); +// +// // 渲染弹药类型 +// event.getGuiGraphics().drawString( +// Minecraft.getInstance().font, +// getVehicleAmmoType(stack, iVehicle), +// w - 90, +// h - (iCharge ? 38 : 26), +// 0xFFFFFF, +// true +// ); +// } } private static boolean shouldRenderHud(Player player) { @@ -420,7 +420,7 @@ public class VehicleHudOverlay { } } - private static void renderKillIndicator3P(GuiGraphics guiGraphics, float posX, float posY) { + public static void renderKillIndicator3P(GuiGraphics guiGraphics, float posX, float posY) { float rate = (40 - KILL_INDICATOR * 5) / 5.5f; if (HIT_INDICATOR > 0) { diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleMgHudOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleMgHudOverlay.java index 465e93bd6..19d4f36a7 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleMgHudOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleMgHudOverlay.java @@ -3,20 +3,37 @@ package com.atsuishio.superbwarfare.client.overlay; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.client.RenderHelper; import com.atsuishio.superbwarfare.entity.vehicle.SpeedboatEntity; +import com.atsuishio.superbwarfare.entity.vehicle.Yx100Entity; +import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity; +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.init.ModTags; +import com.atsuishio.superbwarfare.init.ModItems; +import com.atsuishio.superbwarfare.tools.FormatTool; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.Camera; +import net.minecraft.client.CameraType; import net.minecraft.client.Minecraft; +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.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; 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 static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit; +import static com.atsuishio.superbwarfare.client.overlay.VehicleHudOverlay.renderKillIndicator3P; +import static com.atsuishio.superbwarfare.entity.vehicle.Yx100Entity.MACHINE_GUN_HEAT; +import static com.atsuishio.superbwarfare.entity.vehicle.Yx100Entity.MG_AMMO; @Mod.EventBusSubscriber(value = Dist.CLIENT) public class VehicleMgHudOverlay { @@ -25,7 +42,12 @@ public class VehicleMgHudOverlay { public static void eventHandler(RenderGuiEvent.Pre event) { int w = event.getWindow().getGuiScaledWidth(); int h = event.getWindow().getGuiScaledHeight(); - Player player = Minecraft.getInstance().player; + Minecraft mc = Minecraft.getInstance(); + Player player = mc.player; + GuiGraphics guiGraphics = event.getGuiGraphics(); + PoseStack poseStack = guiGraphics.pose(); + Camera camera = mc.gameRenderer.getMainCamera(); + Vec3 cameraPos = camera.getPosition(); if (!shouldRenderCrossHair(player)) return; @@ -39,20 +61,61 @@ public class VehicleMgHudOverlay { RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); RenderSystem.setShaderColor(1, 1, 1, 1); - float fovAdjust = (float) 70 / Minecraft.getInstance().options.fov().get(); + if (player.getVehicle() instanceof LandArmorEntity iLand && iLand instanceof WeaponVehicleEntity && iLand instanceof MobileVehicleEntity mobileVehicle) { + if (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON || ClientEventHandler.zoomVehicle) { + float fovAdjust = (float) 70 / Minecraft.getInstance().options.fov().get(); - float f = (float) Math.min(w, h); - float f1 = Math.min((float) w / f, (float) h / f) * fovAdjust; - int i = Mth.floor(f * f1); - int j = Mth.floor(f * f1); - int k = (w - i) / 2; - int l = (h - j) / 2; - RenderHelper.preciseBlit(event.getGuiGraphics(), ModUtils.loc("textures/screens/cannon/cannon_crosshair_notzoom.png"), k, l, 0, 0.0F, i, j, i, j); + float f = (float) Math.min(w, h); + float f1 = Math.min((float) w / f, (float) h / f) * fovAdjust; + int i = Mth.floor(f * f1); + int j = Mth.floor(f * f1); + int k = (w - i) / 2; + int l = (h - j) / 2; + RenderHelper.preciseBlit(guiGraphics, ModUtils.loc("textures/screens/cannon/cannon_crosshair_notzoom.png"), k, l, 0, 0.0F, i, j, i, j); + VehicleHudOverlay.renderKillIndicator(guiGraphics, w, h); + + } else if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK && !ClientEventHandler.zoomVehicle) { + Vec3 p = RenderHelper.worldToScreen(new Vec3(Mth.lerp(event.getPartialTick(), player.xo, player.getX()), Mth.lerp(event.getPartialTick(), player.yo + player.getEyeHeight(), player.getEyeY()), Mth.lerp(event.getPartialTick(), player.zo, player.getZ())).add(iLand.getGunVec(event.getPartialTick()).scale(192)), cameraPos); + // 第三人称准星 + if (p != null) { + poseStack.pushPose(); + float x = (float) p.x; + float y = (float) p.y; + + poseStack.pushPose(); + preciseBlit(guiGraphics, ModUtils.loc("textures/screens/drone.png"), x - 12, y - 12, 0, 0, 24, 24, 24, 24); + renderKillIndicator3P(guiGraphics, x - 7.5f + (float) (2 * (Math.random() - 0.5f)), y - 7.5f + (float) (2 * (Math.random() - 0.5f))); + + poseStack.pushPose(); + + poseStack.translate(x, y, 0); + poseStack.scale(0.75f, 0.75f, 1); + + + //YX-100 + if (player.getVehicle() instanceof Yx100Entity yx100) { + double heat = yx100.getEntityData().get(MACHINE_GUN_HEAT) / 100.0F; + guiGraphics.drawString(mc.font, Component.literal(".50 HMG " + (player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get())) ? "∞" : yx100.getEntityData().get(MG_AMMO))), 30, -9, Mth.hsvToRgb(0F, (float) heat, 1.0F), false); + } + + double heal = 1 - mobileVehicle.getHealth() / mobileVehicle.getMaxHealth(); + + guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("HP " + + FormatTool.format0D(100 * mobileVehicle.getHealth() / mobileVehicle.getMaxHealth())), 30, 1, Mth.hsvToRgb(0F, (float) heal, 1.0F), false); + + poseStack.popPose(); + poseStack.popPose(); + poseStack.popPose(); + } + } + + } } private static boolean shouldRenderCrossHair(Player player) { if (player == null) return false; return !player.isSpectator() - && player.getVehicle() instanceof SpeedboatEntity && ClientEventHandler.zoomVehicle && !player.getMainHandItem().is(ModTags.Items.GUN); + && (player.getVehicle() instanceof SpeedboatEntity + || player.getVehicle() instanceof Yx100Entity yx100 && yx100.getNthEntity(1) == player); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java index e696b7820..b88bb95ee 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java @@ -539,6 +539,11 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit return getBarrelVector(ticks); } + @Override + public Vec3 getGunVec(float ticks) { + return null; + } + public float getTurretYRot() { return this.turretYRot; } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java index 6c1e4d4a2..49e5fa0c8 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java @@ -483,6 +483,11 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt return getBarrelVector(ticks); } + @Override + public Vec3 getGunVec(float ticks) { + return null; + } + public float getTurretYRot() { return this.turretYRot; } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java index a76b23150..7bd9ba869 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java @@ -438,7 +438,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti if (this.cannotFire) return; Matrix4f transform = getGunTransform(); - Vector4f worldPosition = transformPosition(transform, 0, -0.2f, 0); + Vector4f worldPosition = transformPosition(transform, 0, -0.25f, 0); ProjectileEntity projectile = new ProjectileEntity(player.level()) .shooter(player) @@ -448,7 +448,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti projectile.bypassArmorRate(0.4f); projectile.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z); - projectile.shoot(getGunVector(1).x, getGunVector(1).y + 0.005f, getGunVector(1).z, 20, 0.02f); + projectile.shoot(getGunVector(1).x, getGunVector(1).y + 0.005f, getGunVector(1).z, 20, 0.3f); this.level().addFreshEntity(projectile); float pitch = this.entityData.get(MACHINE_GUN_HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - this.entityData.get(MACHINE_GUN_HEAT))); @@ -469,7 +469,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti for (Entity target : level.getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(4), e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) { if (target instanceof ServerPlayer serverPlayer) { - ModUtils.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> serverPlayer), new ShakeClientMessage(6, 5, 5, this.getX(), this.getEyeY(), this.getZ())); + ModUtils.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> serverPlayer), new ShakeClientMessage(6, 4, 8, this.getX(), this.getEyeY(), this.getZ())); } } @@ -608,8 +608,8 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti diffY = Mth.wrapDegrees(gunAngle - getGunYRot()); diffX = Mth.wrapDegrees(gunner.getXRot() - this.getGunXRot()); - this.setGunXRot(Mth.clamp(this.getGunXRot() + Mth.clamp(0.95f * diffX, -10, 10), -50f, 10f)); - this.setGunYRot(this.getGunYRot() + Mth.clamp(0.9f * diffY, -18, 18)); + this.setGunXRot(Mth.clamp(this.getGunXRot() + Mth.clamp(0.95f * diffX, -10, 10), -60f, 12.5f)); + this.setGunYRot(this.getGunYRot() + Mth.clamp(0.9f * diffY, -15, 15)); } @Override @@ -653,6 +653,11 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti return getBarrelVector(ticks); } + @Override + public Vec3 getGunVec(float ticks) { + return getGunVector(ticks); + } + public float getTurretYRot() { return this.turretYRot; } @@ -814,13 +819,13 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti } protected void clampRotation(Entity entity) { + Minecraft mc = Minecraft.getInstance(); if (entity.level().isClientSide && entity == getFirstPassenger()) { float f = Mth.wrapDegrees(entity.getXRot()); float f1 = Mth.clamp(f, -30F, 4F); entity.xRotO += f1 - f; entity.setXRot(entity.getXRot() + f1 - f); - Minecraft mc = Minecraft.getInstance(); if (mc.options.getCameraType() == CameraType.FIRST_PERSON) { entity.setYBodyRot(this.getYRot()); float f2 = Mth.wrapDegrees(entity.getYRot() - this.getBarrelYRot(1)); @@ -831,9 +836,18 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti } } else if (entity == getNthEntity(1)) { float f = Mth.wrapDegrees(entity.getXRot()); - float f1 = Mth.clamp(f, -50F, 10F); + float f1 = Mth.clamp(f, -60F, 12.5F); entity.xRotO += f1 - f; entity.setXRot(entity.getXRot() + f1 - f); + + if (mc.options.getCameraType() == CameraType.FIRST_PERSON) { + entity.setYBodyRot(this.getYRot()); + float f2 = Mth.wrapDegrees(entity.getYRot() - this.getGunYRot(1)); + float f3 = Mth.clamp(f2, -150.0F, 150.0F); + entity.yRotO += f3 - f2; + entity.setYRot(entity.getYRot() + f3 - f2); + entity.setYBodyRot(this.getYRot()); + } } } @@ -849,9 +863,17 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti return event.setAndContinue(RawAnimation.begin().thenLoop("animation.yx100.idle")); } + private PlayState gunFirePredicate(AnimationState event) { + if (this.entityData.get(FIRE_TIME) > 0) { + return event.setAndContinue(RawAnimation.begin().thenPlay("animation.yx100.fire2")); + } + return event.setAndContinue(RawAnimation.begin().thenLoop("animation.yx100.idle")); + } + @Override public void registerControllers(AnimatableManager.ControllerRegistrar data) { data.add(new AnimationController<>(this, "movement", 0, this::firePredicate)); + data.add(new AnimationController<>(this, "shoot", 0, this::gunFirePredicate)); } @Override diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/LandArmorEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/LandArmorEntity.java index 027e7452a..471c55a7c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/LandArmorEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/LandArmorEntity.java @@ -13,4 +13,6 @@ public interface LandArmorEntity extends ArmedVehicleEntity { float turretXRot(); Vec3 getBarrelVec(float ticks); + + Vec3 getGunVec(float ticks); } diff --git a/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java index da5db562a..9daf9f945 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java @@ -1335,8 +1335,8 @@ public class ClientEventHandler { ItemStack stack = player.getMainHandItem(); - if (player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.banHand(player) && zoomVehicle) { - event.setFOV(event.getFOV() / iArmedVehicle.zoomFov()); + if (player.getVehicle() instanceof WeaponVehicleEntity iVehicle && zoomVehicle) { + event.setFOV(event.getFOV() / iVehicle.zoomFov()); return; } @@ -1435,7 +1435,7 @@ public class ClientEventHandler { event.setCanceled(true); } - if (player.getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player)) { + if (player.getVehicle() instanceof VehicleEntity pVehicle && player.getVehicle() instanceof WeaponVehicleEntity iVehicle && iVehicle.hasWeapon(pVehicle.getSeatIndex(player))) { event.setCanceled(true); } diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java index 65ab45568..a6b48cb06 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/CameraMixin.java @@ -178,8 +178,12 @@ public abstract class CameraMixin { move(-getMaxZoom(3), 1, 0.0); } - if (thirdPerson && entity.getVehicle() instanceof Yx100Entity && !ClientEventHandler.zoomVehicle) { - move(-getMaxZoom(5), 1.5, 0.0); + if (thirdPerson && entity.getVehicle() instanceof Yx100Entity yx100 && !ClientEventHandler.zoomVehicle) { + if (yx100.getFirstPassenger() == entity) { + move(-getMaxZoom(5), 1.5, -0.8669625f); + } else if (yx100.getNthEntity(1) == entity) { + move(-getMaxZoom(-0.5), 2, 0); + } } } diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java index 9b2fef0f4..d3a9337bc 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java @@ -65,7 +65,7 @@ public class MouseHandlerMixin { if (player == yx100.getFirstPassenger()) { return ClientEventHandler.zoomVehicle ? 0.17 : 0.22; } else if (player ==yx100.getNthEntity(1)){ - return ClientEventHandler.zoomVehicle ? 0.27 : 0.35; + return ClientEventHandler.zoomVehicle ? 0.25 : 0.35; } } diff --git a/src/main/resources/assets/superbwarfare/animations/yx_100.animation.json b/src/main/resources/assets/superbwarfare/animations/yx_100.animation.json index ba17f88a3..38a5669e4 100644 --- a/src/main/resources/assets/superbwarfare/animations/yx_100.animation.json +++ b/src/main/resources/assets/superbwarfare/animations/yx_100.animation.json @@ -7,6 +7,9 @@ "bones": { "glow": { "scale": 0 + }, + "flare": { + "scale": 0 } } }, @@ -122,6 +125,39 @@ "0.9917": [0, 0, 0], "2.0": [0, 0, 0] } + }, + "flare": { + "scale": 0 + } + } + }, + "animation.yx100.fire2": { + "loop": "hold_on_last_frame", + "animation_length": 0.5, + "bones": { + "glow": { + "scale": 0 + }, + "flare": { + "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] + } + }, + "action": { + "position": { + "0.0": [0, 0, 0], + "0.0417": { + "pre": [0, 0, 4.1], + "post": [0, 0, 6.1], + "lerp_mode": "catmullrom" + }, + "0.1167": [0, 0, 0] + } } } } diff --git a/src/main/resources/assets/superbwarfare/geo/yx_100.geo.json b/src/main/resources/assets/superbwarfare/geo/yx_100.geo.json index 10401e6c0..352d3c647 100644 --- a/src/main/resources/assets/superbwarfare/geo/yx_100.geo.json +++ b/src/main/resources/assets/superbwarfare/geo/yx_100.geo.json @@ -7,8 +7,8 @@ "texture_width": 1024, "texture_height": 1024, "visible_bounds_width": 81, - "visible_bounds_height": 15, - "visible_bounds_offset": [0, 0.5, 0] + "visible_bounds_height": 16, + "visible_bounds_offset": [0, 1, 0] }, "bones": [ { @@ -1405,9 +1405,9 @@ "pivot": [22.01115, 53.85625, 54.84162], "cubes": [ { - "origin": [22.14844, 49.35625, 54.70433], + "origin": [22.4799, 49.35625, 54.84162], "size": [0.9375, 60, 0], - "pivot": [22.61719, 56.3875, 55.17308], + "pivot": [22.94865, 79.35625, 54.84162], "rotation": [0, -45, 0], "uv": { "north": {"uv": [422, 566], "uv_size": [1, 64]} @@ -7513,28 +7513,143 @@ "up": {"uv": [344, 602], "uv_size": [4, 14]}, "down": {"uv": [348, 616], "uv_size": [4, -14]} } - }, + } + ] + }, + { + "name": "flare", + "parent": "qiangguan", + "pivot": [-14.13, 61.41482, -30.27799], + "cubes": [ { - "origin": [-15.8914, 60.01786, -20.3125], - "size": [1.875, 1.875, 5.625], - "pivot": [-14.42656, 61.00808, -20.78125], - "rotation": [0, 0, 135], + "origin": [-14.85751, 60.68732, -30.33986], + "size": [1.455, 1.455, 0], "uv": { - "east": {"uv": [639, 44], "uv_size": [6, 2]}, - "south": {"uv": [538, 652], "uv_size": [1, 2]}, - "west": {"uv": [639, 46], "uv_size": [6, 2]}, - "up": {"uv": [103, 643], "uv_size": [1, 6]}, - "down": {"uv": [104, 649], "uv_size": [1, -6]} + "north": {"uv": [900, 548], "uv_size": [114, 114]}, + "south": {"uv": [1014, 548], "uv_size": [-114, 114]} } }, { - "origin": [-15.53984, 60.03798, -26.875], - "size": [2.8125, 2.8125, 6.5625], + "origin": [-15.96001, 60.80731, -31.12738], + "size": [3.66, 1.215, 0], + "pivot": [-14.13001, 61.41482, -31.12736], + "rotation": [0, -90, 0], + "uv": { + "north": {"uv": [1014, 548], "uv_size": [-106.125, 114]}, + "south": {"uv": [907.875, 548], "uv_size": [106.125, 114]} + } + }, + { + "origin": [-15.96001, 60.80731, -31.12738], + "size": [3.66, 1.215, 0], + "pivot": [-14.13001, 61.41482, -31.12736], + "rotation": [0, -90, 60], + "uv": { + "north": {"uv": [1014, 548], "uv_size": [-106.125, 114]}, + "south": {"uv": [907.875, 548], "uv_size": [106.125, 114]} + } + }, + { + "origin": [-15.96001, 60.80731, -31.12738], + "size": [3.66, 1.215, 0], + "pivot": [-14.13001, 61.41482, -31.12736], + "rotation": [0, -90, 120], + "uv": { + "north": {"uv": [1014, 548], "uv_size": [-106.125, 114]}, + "south": {"uv": [907.875, 548], "uv_size": [106.125, 114]} + } + } + ] + }, + { + "name": "action", + "parent": "qiangguan", + "pivot": [-14.13359, 61.44423, -23.10156], + "cubes": [ + { + "origin": [-15.02845, 61.03074, -20.3125], + "size": [1.875, 0.775, 5.625], + "pivot": [-14.09095, 61.41824, -17.5], + "rotation": [0, 0, 112.5], + "uv": { + "east": {"uv": [639, 44], "uv_size": [6, 2]}, + "west": {"uv": [639, 46], "uv_size": [6, 2]} + } + }, + { + "origin": [-14.62765, 60.24892, -25.3125], + "size": [0.98812, 2.39063, 5], + "pivot": [-14.13359, 61.44423, -23.10156], + "rotation": [0, 0, 22.5], + "uv": { + "north": {"uv": [133, 650], "uv_size": [1, 3]}, + "south": {"uv": [170, 650], "uv_size": [1, 3]}, + "up": {"uv": [69, 642], "uv_size": [1, 7]}, + "down": {"uv": [70, 649], "uv_size": [1, -7]} + } + }, + { + "origin": [-15.02845, 61.03074, -20.3125], + "size": [1.875, 0.775, 5.625], + "pivot": [-14.09095, 61.41824, -17.5], + "rotation": [0, 0, 67.5], + "uv": { + "east": {"uv": [639, 44], "uv_size": [6, 2]}, + "west": {"uv": [639, 46], "uv_size": [6, 2]} + } + }, + { + "origin": [-15.02845, 61.03074, -20.3125], + "size": [1.875, 0.775, 5.625], + "pivot": [-14.09095, 61.41824, -17.5], + "rotation": [0, 0, 157.5], + "uv": { + "east": {"uv": [639, 44], "uv_size": [6, 2]}, + "west": {"uv": [639, 46], "uv_size": [6, 2]} + } + }, + { + "origin": [-15.02845, 61.03074, -20.3125], + "size": [1.875, 0.775, 5.625], + "pivot": [-14.09095, 61.41824, -17.5], + "rotation": [0, 0, 22.5], + "uv": { + "east": {"uv": [639, 44], "uv_size": [6, 2]}, + "west": {"uv": [639, 46], "uv_size": [6, 2]} + } + }, + { + "origin": [-14.62765, 60.24892, -25.3125], + "size": [0.98812, 2.39063, 5], + "pivot": [-14.13359, 61.44423, -23.10156], + "rotation": [0, 0, -22.5], + "uv": { + "north": {"uv": [133, 650], "uv_size": [1, 3]}, + "south": {"uv": [170, 650], "uv_size": [1, 3]}, + "up": {"uv": [69, 642], "uv_size": [1, 7]}, + "down": {"uv": [70, 649], "uv_size": [1, -7]} + } + }, + { + "origin": [-14.62765, 60.24892, -25.3125], + "size": [0.98812, 2.39063, 5], + "pivot": [-14.13359, 61.44423, -23.10156], + "rotation": [0, 0, 67.5], + "uv": { + "north": {"uv": [133, 650], "uv_size": [1, 3]}, + "south": {"uv": [170, 650], "uv_size": [1, 3]}, + "up": {"uv": [69, 642], "uv_size": [1, 7]}, + "down": {"uv": [70, 649], "uv_size": [1, -7]} + } + }, + { + "origin": [-14.62765, 60.24892, -25.3125], + "size": [0.98812, 2.39063, 5], + "pivot": [-14.13359, 61.44423, -23.10156], + "rotation": [0, 0, -67.5], "uv": { "north": {"uv": [133, 650], "uv_size": [1, 3]}, - "east": {"uv": [192, 631], "uv_size": [7, 3]}, "south": {"uv": [170, 650], "uv_size": [1, 3]}, - "west": {"uv": [631, 194], "uv_size": [7, 3]}, "up": {"uv": [69, 642], "uv_size": [1, 7]}, "down": {"uv": [70, 649], "uv_size": [1, -7]} } diff --git a/src/main/resources/assets/superbwarfare/textures/entity/yx_100_glow.png b/src/main/resources/assets/superbwarfare/textures/entity/yx_100_glow.png index ef299d26c..03364f5e7 100644 Binary files a/src/main/resources/assets/superbwarfare/textures/entity/yx_100_glow.png and b/src/main/resources/assets/superbwarfare/textures/entity/yx_100_glow.png differ