ColumnPos .java

net.minecraft.server.level.ColumnPos (record): members: toChunkPos, toLong, COORD_BITS, COORD_MASK, asLong, getZ, getX, hashCode. imports: SectionPos.

net.minecraft.server.levelrecord40 linesserver907 B

API Surface (8)

record ColumnPos(int x, int z)
ChunkPos toChunkPos()
long toLong()
long asLong(final int x, final int z)
int getX(final long pos)
int getZ(final long pos)
String toString()
int hashCode()

Fields & Constants (2)

COORD_BITS
COORD_MASK

Code Graph: Dependencies (2)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ColumnPos.java40 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.server.level;
2
3
import net.minecraft.core.SectionPos;
4
import net.minecraft.world.level.ChunkPos;
5
6
public record ColumnPos(int x, int z) {
7
	private static final long COORD_BITS = 32L;
8
	private static final long COORD_MASK = 4294967295L;
9
10
	public ChunkPos toChunkPos() {
11
		return new ChunkPos(SectionPos.blockToSectionCoord(this.x), SectionPos.blockToSectionCoord(this.z));
12
	}
13
14
	public long toLong() {
15
		return asLong(this.x, this.z);
16
	}
17
18
	public static long asLong(final int x, final int z) {
19
		return x & 4294967295L | (z & 4294967295L) << 32;
20
	}
21
22
	public static int getX(final long pos) {
23
		return (int)(pos & 4294967295L);
24
	}
25
26
	public static int getZ(final long pos) {
27
		return (int)(pos >>> 32 & 4294967295L);
28
	}
29
30
	@Override
31
	public String toString() {
32
		return "[" + this.x + ", " + this.z + "]";
33
	}
34
35
	@Override
36
	public int hashCode() {
37
		return ChunkPos.hash(this.x, this.z);
38
	}
39
}
40

Decompiled Minecraft 26.3 source of ColumnPos (net/minecraft/server/level/ColumnPos.java) with Mojang official mappings, stored verbatim on the site.