Class ZoomInstance

java.lang.Object
io.github.ennuil.libzoomer.api.ZoomInstance

public class ZoomInstance extends Object
The zoom instance is essentially the zoom. It contains all the values and sub-instances required to zoom.
  • Constructor Details

    • ZoomInstance

      public ZoomInstance(net.minecraft.resources.ResourceLocation instanceId, float defaultZoomDivisor, TransitionMode transition, @Nullable @Nullable MouseModifier modifier, @Nullable @Nullable ZoomOverlay overlay)
      Initializes a zoom instance. It must be registered by the instance registry before being functional
      Parameters:
      instanceId - the identifier for this zoom instance
      defaultZoomDivisor - the default zoom divisor, it will be this instance's initial zoom divisor value
      transition - the zoom instance's transition mode, if null, InstantTransitionMode will be used
      modifier - the zoom instance's mouse modifier, if null, no mouse modifier will be applied
      overlay - the zoom instance's zoom overlay, if null, no zoom overlay will be applied
  • Method Details

    • getInstanceId

      public net.minecraft.resources.ResourceLocation getInstanceId()
      Obtains the identifier of this zoom instance.
      Returns:
      this zoom instance's identifier
    • getZoom

      public boolean getZoom()
      Gets the zoom instance's zoom state. This is used to check if this instance's sub-instances should be active or not.
      Returns:
      the current zoom state
    • setZoom

      public boolean setZoom(boolean newZoom)
      Sets the zoom instance's zoom state.
      Parameters:
      newZoom - The new zoom state.
      Returns:
      the zoom state with the new value
    • getZoomDivisor

      public double getZoomDivisor()
      Gets the zoom instance's current zoom divisor. Do note that this isn't the same as the transition mode's internal multiplier.
      Returns:
      the current zoom divisor
    • setZoomDivisor

      public double setZoomDivisor(double newDivisor)
      Sets the zoom instance's current zoom divisor.
      Parameters:
      newDivisor - the new zoom divisor
      Returns:
      the zoom divisor with the new value
    • resetZoomDivisor

      public double resetZoomDivisor()
      Sets the instance's zoom divisor to the default zoom divisor.
      Returns:
      the zoom divisor with the new value
    • getDefaultZoomDivisor

      public double getDefaultZoomDivisor()
      Gets the instance's default zoom divisor. This is used as the initial zoom divisor and as the value used on resetZoomDivisor().
      Returns:
      the default zoom divisor
    • setDefaultZoomDivisor

      public double setDefaultZoomDivisor(double newDivisor)
      Sets the instance's default zoom divisor.
      Parameters:
      newDivisor - the new default zoom divisor
      Returns:
      the default zoom divisor with the new value
    • getTransitionMode

      public TransitionMode getTransitionMode()
      Gets the instance's transition mode.
      Returns:
      the transition mode
    • setTransitionMode

      public TransitionMode setTransitionMode(TransitionMode transition)
      Sets the instance's transition mode.
      Parameters:
      transition - the new transition mode
      Returns:
      the transition mode with the new mode
    • isTransitionActive

      public boolean isTransitionActive()
      Gets the active state from the instance's transition mode.
      Returns:
      the transition mode's active state
    • getMouseModifier

      @Nullable public @Nullable MouseModifier getMouseModifier()
      Gets the instance's mouse modifier.
      Returns:
      the mouse modifier
    • setMouseModifier

      public MouseModifier setMouseModifier(MouseModifier modifier)
      Sets the mouse modifier.
      Parameters:
      modifier - the new mouse modifier
      Returns:
      the mouse modifier with the new modifier
    • isModifierActive

      public boolean isModifierActive()
      Gets the mouse modifier's active state.
      Returns:
      the mouse modifier's active state if the modifier isn't null, or false otherwise
    • getZoomOverlay

      @Nullable public @Nullable ZoomOverlay getZoomOverlay()
      Gets the instance's zoom overlay.
      Returns:
      the zoom overlay
    • setZoomOverlay

      public ZoomOverlay setZoomOverlay(ZoomOverlay overlay)
      Sets the zoom overlay.
      Parameters:
      overlay - the new zoom overlay
      Returns:
      the zoom overlay with the new overlay
    • isOverlayActive

      public boolean isOverlayActive()
      Gets the zoom overlay's active state.
      Returns:
      the zoom overlay's active state if the overlay isn't null, or false otherwise