移除无用代码,增大载具标识,调整鼠标操控

This commit is contained in:
Atsuishio 2025-07-15 20:27:26 +08:00 committed by Light_Quanta
parent a3feab62a6
commit 101ae62310
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
3 changed files with 4 additions and 50 deletions

View file

@ -72,7 +72,7 @@ public class VehicleTeamOverlay implements LayeredDraw.Layer {
poseStack.pushPose();
poseStack.translate(x, y - 12, 0);
float size = (float) Mth.clamp((50 / VectorUtil.fov) * 0.9f * Math.max((512 - entityRange) / 512, 0.1), 0.1, 1);
float size = (float) Mth.clamp((50 / VectorUtil.fov) * 0.9f * Math.max((512 - entityRange) / 512, 0.1), 0.4, 1);
poseStack.scale(size, size, size);
var font = Minecraft.getInstance().font;

View file

@ -950,6 +950,9 @@ public abstract class VehicleEntity extends Entity implements Container {
this.handlePartHealth();
}
entityData.set(MOUSE_SPEED_X, entityData.get(MOUSE_SPEED_X) * 0.95f);
entityData.set(MOUSE_SPEED_Y, entityData.get(MOUSE_SPEED_Y) * 0.95f);
this.refreshDimensions();
}

View file

@ -1,17 +1,6 @@
package com.atsuishio.superbwarfare.tools;
import com.atsuishio.superbwarfare.config.client.DisplayConfig;
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.init.ModMobEffects;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.phys.Vec3;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.EventPriority;
@ -59,42 +48,4 @@ public class VectorUtil {
fov = event.getFOV();
}
}
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void captureCamera(ViewportEvent.ComputeCameraAngles event) {
float roll;
roll = ClientEventHandler.cameraRoll;
Entity entity = event.getCamera().getEntity();
if (entity instanceof Player player && !player.isSpectator() && player.hasEffect(ModMobEffects.SHOCK)) {
float shakeStrength = (float) DisplayConfig.SHOCK_SCREEN_SHAKE.get() / 100.0f;
if (shakeStrength <= 0.0f) return;
roll = (float) Mth.nextDouble(RandomSource.create(), 8, 12) * shakeStrength;
}
if (entity.getRootVehicle() instanceof VehicleEntity vehicle && (!event.getCamera().isDetached() || vehicle instanceof LandArmorEntity && ClientEventHandler.zoomVehicle)) {
// rotate camera
float a = vehicle.getTurretYaw((float) event.getPartialTick());
float r = (Mth.abs(a) - 90f) / 90f;
float r2;
if (Mth.abs(a) <= 90f) {
r2 = a / 90f;
} else {
if (a < 0) {
r2 = -(180f + a) / 90f;
} else {
r2 = (180f - a) / 90f;
}
}
roll = -r * vehicle.getRoll((float) event.getPartialTick()) + r2 * vehicle.getViewXRot((float) event.getPartialTick());
}
PoseStack poseStack = new PoseStack();
poseStack.mulPose(Axis.ZP.rotationDegrees(roll));
poseStack.mulPose(Axis.XP.rotationDegrees(event.getPitch()));
poseStack.mulPose(Axis.YP.rotationDegrees(event.getYaw() + 180.0F));
}
}