限制视角抖动衰减范围为0~1
This commit is contained in:
parent
87d395958c
commit
b0913c422d
2 changed files with 2 additions and 2 deletions
|
@ -619,7 +619,7 @@ public class ClientEventHandler {
|
|||
shakeTime = Mth.lerp(0.25 * times, shakeTime, 0);
|
||||
|
||||
if (player != null && shakeTime > 0) {
|
||||
shakeRadiusAmplitude = (float) (1 - player.position().distanceTo(new Vec3(shakePos[0], shakePos[1], shakePos[2])) / shakeRadius);
|
||||
shakeRadiusAmplitude = (float) Mth.clamp(1 - player.position().distanceTo(new Vec3(shakePos[0], shakePos[1], shakePos[2])) / shakeRadius, 0 ,1);
|
||||
|
||||
// player.displayClientMessage(Component.literal(new java.text.DecimalFormat("##.##").format(shakeRadiusAmplitude)), true);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public class CustomExplosion extends Explosion {
|
|||
for (Entity target : level.getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(4 * radius), 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(20 + 0.02 * damage,2 * pRadius,50 + 0.05 * damage, pToBlowX, pToBlowY, pToBlowZ));
|
||||
ModUtils.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> serverPlayer), new ShakeClientMessage(20 + 0.02 * damage,3 * pRadius,50 + 0.05 * damage, pToBlowX, pToBlowY, pToBlowZ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue