Record Class WorldMouse

java.lang.Object
java.lang.Record
dev.latvian.mods.klib.math.WorldMouse

public record WorldMouse(net.minecraft.client.Minecraft mc, net.minecraft.world.phys.Vec3 cameraPos, float width, float height, Vec2d defaultScreenPos) extends Record
  • Constructor Summary

    Constructors
    Constructor
    Description
    WorldMouse(net.minecraft.client.Minecraft mc, net.minecraft.world.phys.Vec3 cameraPos, float width, float height, Vec2d defaultScreenPos)
    Creates an instance of a WorldMouse record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.phys.Vec3
    Returns the value of the cameraPos record component.
    @Nullable Cursor
    clip(double maxDistance, net.minecraft.world.level.ClipContext.Block blockClipContext, net.minecraft.world.level.ClipContext.Fluid fluidClipContext, @Nullable Vec2d screenPos, @Nullable net.minecraft.world.entity.Entity clipEntity)
     
    @Nullable Cursor
     
    @Nullable Cursor
     
    Returns the value of the defaultScreenPos record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    float
    Returns the value of the height record component.
    net.minecraft.client.Minecraft
    mc()
    Returns the value of the mc record component.
    static WorldMouse
    of(net.minecraft.client.Minecraft mc, net.minecraft.world.phys.Vec3 cameraPos)
     
    @Nullable Vec2f
    screen(double worldX, double worldY, double worldZ)
     
    @Nullable Vec2f
    screen(double worldX, double worldY, double worldZ, boolean allowOutside)
    Convert world position to screen coordinates
    @Nullable Vec2f
    screen(net.minecraft.core.Position worldPos)
     
    @Nullable Vec2f
    screen(net.minecraft.core.Position worldPos, boolean allowOutside)
     
    final String
    Returns a string representation of this record class.
    float
    Returns the value of the width record component.
    net.minecraft.world.phys.Vec3
    world(double x, double y)
    Convert screen coordinates to world position.

    Methods inherited from class java.lang.Object

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

    • WorldMouse

      public WorldMouse(net.minecraft.client.Minecraft mc, net.minecraft.world.phys.Vec3 cameraPos, float width, float height, Vec2d defaultScreenPos)
      Creates an instance of a WorldMouse record class.
      Parameters:
      mc - the value for the mc record component
      cameraPos - the value for the cameraPos record component
      width - the value for the width record component
      height - the value for the height record component
      defaultScreenPos - the value for the defaultScreenPos record component
  • Method Details

    • of

      public static WorldMouse of(net.minecraft.client.Minecraft mc, net.minecraft.world.phys.Vec3 cameraPos)
    • clip

      @Nullable public @Nullable Cursor clip(double maxDistance, net.minecraft.world.level.ClipContext.Block blockClipContext, net.minecraft.world.level.ClipContext.Fluid fluidClipContext, @Nullable @Nullable Vec2d screenPos, @Nullable @Nullable net.minecraft.world.entity.Entity clipEntity)
    • clipOutline

      @Nullable public @Nullable Cursor clipOutline()
    • clipCollision

      @Nullable public @Nullable Cursor clipCollision()
    • screen

      @Nullable public @Nullable Vec2f screen(double worldX, double worldY, double worldZ, boolean allowOutside)
      Convert world position to screen coordinates
      Parameters:
      worldX - X position
      worldY - Y position
      worldZ - Z position
      allowOutside - Allow outside the screen
      Returns:
      Screen coordinates, or null if outside the screen
    • screen

      @Nullable public @Nullable Vec2f screen(double worldX, double worldY, double worldZ)
      Parameters:
      worldX - X position
      worldY - Y position
      worldZ - Z position
      See Also:
    • screen

      @Nullable public @Nullable Vec2f screen(net.minecraft.core.Position worldPos, boolean allowOutside)
      Parameters:
      worldPos - XYZ position
      allowOutside - Allow outside the screen
      See Also:
    • screen

      @Nullable public @Nullable Vec2f screen(net.minecraft.core.Position worldPos)
      Parameters:
      worldPos - XYZ position
      See Also:
    • world

      public net.minecraft.world.phys.Vec3 world(double x, double y)
      Convert screen coordinates to world position. Use clip(double, ClipContext.Block, ClipContext.Fluid, Vec2d, Entity) if you only care about current mouse position
      Parameters:
      x - screen coordinate x-position
      y - screen coordinate y-position
      Returns:
      a Vec3 containing the screen coordinates in world position
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • mc

      public net.minecraft.client.Minecraft mc()
      Returns the value of the mc record component.
      Returns:
      the value of the mc record component
    • cameraPos

      public net.minecraft.world.phys.Vec3 cameraPos()
      Returns the value of the cameraPos record component.
      Returns:
      the value of the cameraPos record component
    • width

      public float width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • height

      public float height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component
    • defaultScreenPos

      public Vec2d defaultScreenPos()
      Returns the value of the defaultScreenPos record component.
      Returns:
      the value of the defaultScreenPos record component