Package dev.latvian.mods.klib.math
Record Class ProjectedCoordinates
java.lang.Object
java.lang.Record
dev.latvian.mods.klib.math.ProjectedCoordinates
public record ProjectedCoordinates(net.minecraft.client.Minecraft mc, net.minecraft.world.phys.Vec3 cameraPos, float width, float height, org.joml.Vector2dc defaultScreenPos)
extends Record
-
Constructor Summary
ConstructorsConstructorDescriptionProjectedCoordinates(net.minecraft.client.Minecraft mc, net.minecraft.world.phys.Vec3 cameraPos, float width, float height, org.joml.Vector2dc defaultScreenPos) Creates an instance of aProjectedCoordinatesrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.phys.Vec3Returns the value of thecameraPosrecord component.@Nullable ClipPositionclip(double maxDistance, net.minecraft.world.level.ClipContext.Block blockClipContext, net.minecraft.world.level.ClipContext.Fluid fluidClipContext, @Nullable org.joml.Vector2dc screenPos, @Nullable net.minecraft.world.entity.Entity clipEntity) @Nullable ClipPosition@Nullable ClipPositionorg.joml.Vector2dcReturns the value of thedefaultScreenPosrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.floatheight()Returns the value of theheightrecord component.net.minecraft.client.Minecraftmc()Returns the value of themcrecord component.static ProjectedCoordinatesof(net.minecraft.client.Minecraft mc, net.minecraft.world.phys.Vec3 cameraPos) @Nullable org.joml.Vector2fscreen(double worldX, double worldY, double worldZ) @Nullable org.joml.Vector2fscreen(double worldX, double worldY, double worldZ, boolean allowOutside) Convert world position to screen coordinates@Nullable org.joml.Vector2fscreen(net.minecraft.core.Position worldPos) @Nullable org.joml.Vector2fscreen(net.minecraft.core.Position worldPos, boolean allowOutside) final StringtoString()Returns a string representation of this record class.floatwidth()Returns the value of thewidthrecord component.net.minecraft.world.phys.Vec3world(double x, double y) Convert screen coordinates to world position.
-
Constructor Details
-
ProjectedCoordinates
public ProjectedCoordinates(net.minecraft.client.Minecraft mc, net.minecraft.world.phys.Vec3 cameraPos, float width, float height, org.joml.Vector2dc defaultScreenPos) Creates an instance of aProjectedCoordinatesrecord class.- Parameters:
mc- the value for themcrecord componentcameraPos- the value for thecameraPosrecord componentwidth- the value for thewidthrecord componentheight- the value for theheightrecord componentdefaultScreenPos- the value for thedefaultScreenPosrecord component
-
-
Method Details
-
of
public static ProjectedCoordinates of(net.minecraft.client.Minecraft mc, net.minecraft.world.phys.Vec3 cameraPos) -
clip
@Nullable public @Nullable ClipPosition clip(double maxDistance, net.minecraft.world.level.ClipContext.Block blockClipContext, net.minecraft.world.level.ClipContext.Fluid fluidClipContext, @Nullable @Nullable org.joml.Vector2dc screenPos, @Nullable @Nullable net.minecraft.world.entity.Entity clipEntity) -
clipOutline
-
clipCollision
-
screen
@Nullable public @Nullable org.joml.Vector2f screen(double worldX, double worldY, double worldZ, boolean allowOutside) Convert world position to screen coordinates- Parameters:
worldX- X positionworldY- Y positionworldZ- Z positionallowOutside- Allow outside the screen- Returns:
- Screen coordinates, or null if outside the screen
-
screen
@Nullable public @Nullable org.joml.Vector2f screen(double worldX, double worldY, double worldZ) - Parameters:
worldX- X positionworldY- Y positionworldZ- Z position- See Also:
-
screen
@Nullable public @Nullable org.joml.Vector2f screen(net.minecraft.core.Position worldPos, boolean allowOutside) - Parameters:
worldPos- XYZ positionallowOutside- Allow outside the screen- See Also:
-
screen
@Nullable public @Nullable org.joml.Vector2f 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. Useclip(double, ClipContext.Block, ClipContext.Fluid, Vector2dc, Entity)if you only care about current mouse position- Parameters:
x- screen coordinate x-positiony- screen coordinate y-position- Returns:
- a
Vec3containing the screen coordinates in world position
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
mc
public net.minecraft.client.Minecraft mc()Returns the value of themcrecord component.- Returns:
- the value of the
mcrecord component
-
cameraPos
public net.minecraft.world.phys.Vec3 cameraPos()Returns the value of thecameraPosrecord component.- Returns:
- the value of the
cameraPosrecord component
-
width
public float width()Returns the value of thewidthrecord component.- Returns:
- the value of the
widthrecord component
-
height
public float height()Returns the value of theheightrecord component.- Returns:
- the value of the
heightrecord component
-
defaultScreenPos
public org.joml.Vector2dc defaultScreenPos()Returns the value of thedefaultScreenPosrecord component.- Returns:
- the value of the
defaultScreenPosrecord component
-