Package dev.latvian.mods.klib.math
Record Class WorldMouse
java.lang.Object
java.lang.Record
dev.latvian.mods.klib.math.WorldMouse
-
Constructor Summary
ConstructorsConstructorDescriptionWorldMouse(net.minecraft.client.Minecraft mc, net.minecraft.world.phys.Vec3 cameraPos, float width, float height, Vec2d defaultScreenPos) Creates an instance of aWorldMouserecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.phys.Vec3Returns the value of thecameraPosrecord component.@Nullable Cursorclip(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 CursorReturns 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 WorldMouseof(net.minecraft.client.Minecraft mc, net.minecraft.world.phys.Vec3 cameraPos) @Nullable Vec2fscreen(double worldX, double worldY, double worldZ) @Nullable Vec2fscreen(double worldX, double worldY, double worldZ, boolean allowOutside) Convert world position to screen coordinates@Nullable Vec2fscreen(net.minecraft.core.Position worldPos) @Nullable Vec2fscreen(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
-
WorldMouse
public WorldMouse(net.minecraft.client.Minecraft mc, net.minecraft.world.phys.Vec3 cameraPos, float width, float height, Vec2d defaultScreenPos) Creates an instance of aWorldMouserecord 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 WorldMouse of(net.minecraft.client.Minecraft mc, net.minecraft.world.phys.Vec3 cameraPos) -
clip
-
clipOutline
-
clipCollision
-
screen
@Nullable public @Nullable Vec2f 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
- Parameters:
worldX- X positionworldY- Y positionworldZ- Z position- See Also:
-
screen
- Parameters:
worldPos- XYZ positionallowOutside- Allow outside the screen- See Also:
-
screen
- 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, Vec2d, 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
Returns the value of thedefaultScreenPosrecord component.- Returns:
- the value of the
defaultScreenPosrecord component
-