44 lines
1.0 KiB
Java
44 lines
1.0 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package net.minecraft.server.level;
|
|
|
|
import net.minecraft.core.SectionPos;
|
|
import net.minecraft.world.level.ChunkPos;
|
|
|
|
public record ColumnPos(int x, int z) {
|
|
private static final long COORD_BITS = 32L;
|
|
private static final long COORD_MASK = 0xFFFFFFFFL;
|
|
|
|
public ChunkPos toChunkPos() {
|
|
return new ChunkPos(SectionPos.blockToSectionCoord(this.x), SectionPos.blockToSectionCoord(this.z));
|
|
}
|
|
|
|
public long toLong() {
|
|
return ColumnPos.asLong(this.x, this.z);
|
|
}
|
|
|
|
public static long asLong(int x, int z) {
|
|
return (long)x & 0xFFFFFFFFL | ((long)z & 0xFFFFFFFFL) << 32;
|
|
}
|
|
|
|
public static int getX(long pos) {
|
|
return (int)(pos & 0xFFFFFFFFL);
|
|
}
|
|
|
|
public static int getZ(long pos) {
|
|
return (int)(pos >>> 32 & 0xFFFFFFFFL);
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "[" + this.x + ", " + this.z + "]";
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return ChunkPos.hash(this.x, this.z);
|
|
}
|
|
}
|
|
|