Class UIState

java.lang.Object
journeymap.api.v2.client.util.UIState

public final class UIState extends Object
Provides the current state of a Map UI in JourneyMap.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final boolean
    Whether the UI is active or not.
    final net.minecraft.world.phys.AABB
    The area of blocks displayed in the UI.
    final double
    The width in pixels of a single block in the UI's map at the current zoom level.
    final Integer
    For underground/cave/nether/end maps, the vertical slice (chunk y) displayed.
    final net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level>
    The dimension displayed in the UI.
    The screen area (pixels) used by the UI.
    static final int
    Max Zoom Out for fullscreen 2 pixels per region.
    final net.minecraft.core.BlockPos
    The block position at the center of the UI.
    The current map type of the UI.
    static final int
    Maz Zoom out for the minimap.
    The UI to which this state applies.
    final int
    The current zoom level of the UI.
    static final int
    Max Zoom In value.
  • Constructor Summary

    Constructors
    Constructor
    Description
    UIState(Context.UI ui, boolean active, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension, int zoom, Context.MapType mapType, net.minecraft.core.BlockPos mapCenter, Integer chunkY, net.minecraft.world.phys.AABB blockBounds, Rectangle2D.Double displayBounds)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
     
    static UIState
    newInactive(Context.UI ui, net.minecraft.client.Minecraft minecraft)
    Convenience factory method to create an inactive UIState.
    static UIState
    newInactive(UIState priorState)
    Convenience factory method to create an inactive UIState.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • ZOOM_IN_MAX

      public static final int ZOOM_IN_MAX
      Max Zoom In value.
      See Also:
    • FULLSCREEN_ZOOM_MIN

      public static final int FULLSCREEN_ZOOM_MIN
      Max Zoom Out for fullscreen 2 pixels per region.
      See Also:
    • MINIMAP_ZOOM_MIN

      public static final int MINIMAP_ZOOM_MIN
      Maz Zoom out for the minimap.
      See Also:
    • ui

      public final Context.UI ui
      The UI to which this state applies.
    • active

      public final boolean active
      Whether the UI is active or not. If false, other values reflect the state of the display when it was last used.
    • dimension

      public final net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension
      The dimension displayed in the UI. If active==false and the display has never been used, this will default to 0.
    • zoom

      public final int zoom
      The current zoom level of the UI. If active==false and the display has never been used, this will default to 0.
    • mapType

      public final Context.MapType mapType
      The current map type of the UI. If active==false and the display has never been used, this will default to Context.MapType.Day.
    • mapCenter

      public final net.minecraft.core.BlockPos mapCenter
      The block position at the center of the UI. If active==false and the display has never been used, this will default to the world spawnpoint.
    • chunkY

      public final Integer chunkY
      For underground/cave/nether/end maps, the vertical slice (chunk y) displayed.
    • blockBounds

      public final net.minecraft.world.phys.AABB blockBounds
      The area of blocks displayed in the UI. If active==false, this will be null.
    • displayBounds

      public final Rectangle2D.Double displayBounds
      The screen area (pixels) used by the UI. If active==false, this will be null.
    • blockSize

      public final double blockSize
      The width in pixels of a single block in the UI's map at the current zoom level.
  • Constructor Details

    • UIState

      public UIState(Context.UI ui, boolean active, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension, int zoom, @Nullable Context.MapType mapType, @Nullable net.minecraft.core.BlockPos mapCenter, @Nullable Integer chunkY, @Nullable net.minecraft.world.phys.AABB blockBounds, @Nullable Rectangle2D.Double displayBounds)
      Constructor.
      Parameters:
      ui - The UI which has been updated.
      active - Whether the UI is active
      dimension - The current dimension shown in the UI.
      zoom - The current zoom level of the UI.
      mapType - The current map type of the UI.
      mapCenter - The block position at the center of the UI.
      blockBounds - The area of blocks displayed in the UI.
  • Method Details

    • newInactive

      public static UIState newInactive(Context.UI ui, net.minecraft.client.Minecraft minecraft)
      Convenience factory method to create an inactive UIState.
      Parameters:
      ui - the ui
      Returns:
      a UIState
    • newInactive

      public static UIState newInactive(UIState priorState)
      Convenience factory method to create an inactive UIState.
      Parameters:
      priorState - the prior UIState
      Returns:
      a UIState
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object