移除无用代码,增大载具标识,调整鼠标操控
This commit is contained in:
parent
a3feab62a6
commit
101ae62310
3 changed files with 4 additions and 50 deletions
|
@ -72,7 +72,7 @@ public class VehicleTeamOverlay implements LayeredDraw.Layer {
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
poseStack.translate(x, y - 12, 0);
|
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);
|
poseStack.scale(size, size, size);
|
||||||
var font = Minecraft.getInstance().font;
|
var font = Minecraft.getInstance().font;
|
||||||
|
|
||||||
|
|
|
@ -950,6 +950,9 @@ public abstract class VehicleEntity extends Entity implements Container {
|
||||||
this.handlePartHealth();
|
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();
|
this.refreshDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.tools;
|
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.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.minecraft.world.phys.Vec3;
|
||||||
import net.neoforged.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.neoforged.bus.api.EventPriority;
|
import net.neoforged.bus.api.EventPriority;
|
||||||
|
@ -59,42 +48,4 @@ public class VectorUtil {
|
||||||
fov = event.getFOV();
|
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));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue