Interface RotationHandler

All Known Implementing Classes:
AddToCutsceneRotation, CutsceneRotation, EaseBackRotation, PlayerRotation

public interface RotationHandler
Defines how to handle the player's rotation.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.resources.ResourceLocation
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.phys.Vec3
    apply(net.minecraft.world.phys.Vec3 initCamRot, net.minecraft.world.phys.Vec3 startRot, net.minecraft.world.phys.Vec3 playerRot, net.minecraft.world.phys.Vec3 cutsceneRot, double dt)
    Applies the rotation transform.
    fromJson(com.google.gson.JsonElement json)
     
    fromNetwork(net.minecraft.network.FriendlyByteBuf buf)
     
    Returns a serializer suitable for this rotation handler
    static <T extends RotationHandler>
    void
    toNetwork(net.minecraft.network.FriendlyByteBuf buf, T handler)
     
  • Field Details

    • UNKNOWN

      static final net.minecraft.resources.ResourceLocation UNKNOWN
  • Method Details

    • apply

      net.minecraft.world.phys.Vec3 apply(net.minecraft.world.phys.Vec3 initCamRot, net.minecraft.world.phys.Vec3 startRot, net.minecraft.world.phys.Vec3 playerRot, net.minecraft.world.phys.Vec3 cutsceneRot, double dt)
      Applies the rotation transform. There is at most one rotation handler ticked at any point in time, so you can freely store data in your instances.
      Parameters:
      initCamRot - the initial player rotation, right before the cutscene started
      startRot - the start rotation of the cutscene, aka the third argument in CutsceneManager#startCutscene
      playerRot - the current player rotation (as if the cutscene never began)
      cutsceneRot - the rotation value output by the cutscene, relative to zero
      dt - the time difference since last call of this method, in seconds. Always less than or equal to zero on the first call to this during a cutscene.
      Returns:
      the camera rotation that the player will ultimately see
    • serializer

      RotationSerializer<?> serializer()
      Returns a serializer suitable for this rotation handler
      Returns:
      a serializer that can be used with this rotation handler
    • toNetwork

      static <T extends RotationHandler> void toNetwork(net.minecraft.network.FriendlyByteBuf buf, T handler)
    • fromNetwork

      static RotationHandler fromNetwork(net.minecraft.network.FriendlyByteBuf buf)
    • fromJson

      static RotationHandler fromJson(com.google.gson.JsonElement json)