Cursor3D .java

net.minecraft.core.Cursor3D (class): members: TYPE_CORNER, TYPE_INSIDE, getNextType, TYPE_EDGE, TYPE_FACE, nextX, nextY, nextZ, advance, originY, originX.

net.minecraft.coreclass72 linescommon1.5 KB

API Surface (5)

boolean advance()
int nextX()
int nextY()
int nextZ()
int getNextType()

Fields & Constants (15)

TYPE_INSIDE
TYPE_FACE
TYPE_EDGE
TYPE_CORNER
originX
originY
originZ
width
height
depth
end
index
x
y
z

Full Source

Cursor3D.java72 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.core;
2
3
public class Cursor3D {
4
	public static final int TYPE_INSIDE = 0;
5
	public static final int TYPE_FACE = 1;
6
	public static final int TYPE_EDGE = 2;
7
	public static final int TYPE_CORNER = 3;
8
	private final int originX;
9
	private final int originY;
10
	private final int originZ;
11
	private final int width;
12
	private final int height;
13
	private final int depth;
14
	private final int end;
15
	private int index;
16
	private int x;
17
	private int y;
18
	private int z;
19
20
	public Cursor3D(final int minX, final int minY, final int minZ, final int maxX, final int maxY, final int maxZ) {
21
		this.originX = minX;
22
		this.originY = minY;
23
		this.originZ = minZ;
24
		this.width = maxX - minX + 1;
25
		this.height = maxY - minY + 1;
26
		this.depth = maxZ - minZ + 1;
27
		this.end = this.width * this.height * this.depth;
28
	}
29
30
	public boolean advance() {
31
		if (this.index == this.end) {
32
			return false;
33
		}
34
35
		this.x = this.index % this.width;
36
		int slice = this.index / this.width;
37
		this.y = slice % this.height;
38
		this.z = slice / this.height;
39
		this.index++;
40
		return true;
41
	}
42
43
	public int nextX() {
44
		return this.originX + this.x;
45
	}
46
47
	public int nextY() {
48
		return this.originY + this.y;
49
	}
50
51
	public int nextZ() {
52
		return this.originZ + this.z;
53
	}
54
55
	public int getNextType() {
56
		int type = 0;
57
		if (this.x == 0 || this.x == this.width - 1) {
58
			type++;
59
		}
60
61
		if (this.y == 0 || this.y == this.height - 1) {
62
			type++;
63
		}
64
65
		if (this.z == 0 || this.z == this.depth - 1) {
66
			type++;
67
		}
68
69
		return type;
70
	}
71
}
72

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