java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.camera.CameraShake

public final class CameraShake extends Object
Shakes the camera: an explosion nearby, a giant's footstep. Shakes add up, fade over their own time, and follow the game's "Distortion Effects" accessibility slider, so a player who turned that down gets less of them, and none at zero.

 CameraShake.shake(1.5F, 12);                                   // a short jolt, wherever the player is
 CameraShake.shake(blastPos, 24.0F, 4.0F, 20);                  // strong at the blast, nothing 24 blocks away
 CameraShake.add(new CameraShake.Shake(Curve.of(0.0F, 2.0F, 0.0F), 60, 0.8F, null, 0.0F));   // a slow swell
 
From the server, ShakeControl does the same for players in range.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    One shake.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
     
    static void
    Stops every shake at once, e.g.
    static float
     
    static void
    setScale(float scale)
    Scales every shake, on top of the player's own accessibility setting: for a mod's own "screen shake" option.
    static void
    shake(float degrees, int ticks)
    A jolt that starts at full strength and dies away, felt wherever the player is.
    static void
    shake(net.minecraft.world.phys.Vec3 origin, float radius, float degrees, int ticks)
    A jolt from a place: full strength there, fading to nothing radius blocks away.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • shake

      public static void shake(float degrees, int ticks)
      A jolt that starts at full strength and dies away, felt wherever the player is.
    • shake

      public static void shake(net.minecraft.world.phys.Vec3 origin, float radius, float degrees, int ticks)
      A jolt from a place: full strength there, fading to nothing radius blocks away.
    • add

      public static void add(CameraShake.Shake shake)
    • clear

      public static void clear()
      Stops every shake at once, e.g. for a cutscene.
    • setScale

      public static void setScale(float scale)
      Scales every shake, on top of the player's own accessibility setting: for a mod's own "screen shake" option. 1 by default.
    • scale

      public static float scale()