This repository was archived by the owner on Jul 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathBlock.java
More file actions
109 lines (76 loc) · 2.72 KB
/
Block.java
File metadata and controls
109 lines (76 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package org.cloudburstmc.api.block;
import org.cloudburstmc.api.level.Level;
import org.cloudburstmc.api.level.chunk.Chunk;
import org.cloudburstmc.api.util.Direction;
import org.cloudburstmc.api.util.behavior.BehaviorCollection;
import org.cloudburstmc.math.vector.Vector3i;
import org.cloudburstmc.math.vector.Vector4i;
public interface Block extends BlockSnapshot {
BlockSnapshot snapshot();
Block refresh();
Level getLevel();
Chunk getChunk();
Vector3i getPosition();
BehaviorCollection getBehaviors();
int getBrightness();
default int getX() {
return getPosition().getX();
}
default int getY() {
return getPosition().getY();
}
default int getZ() {
return getPosition().getZ();
}
default Block up() {
return getSide(Direction.UP, 1);
}
default Block getSide(Direction face) {
return getSide(face, 1);
}
default BlockState getSideState(Direction face) {
return getSideState(face, 1);
}
Block getSide(Direction face, int step);
default BlockState getSideState(Direction face, int step) {
return getSideState(face, step, 0);
}
BlockState getSideState(Direction face, int step, int layer);
default Block getRelative(Vector3i pos) {
return getRelative(pos.getX(), pos.getY(), pos.getZ());
}
Block getRelative(int x, int y, int z);
default BlockState getRelativeState(int x, int y, int z) {
return getRelativeState(x, y, z, 0);
}
default BlockState getRelativeState(Vector3i pos) {
return getRelativeState(pos.getX(), pos.getY(), pos.getZ(), 0);
}
default BlockState getRelativeState(Vector4i pos) {
return getRelativeState(pos.getX(), pos.getY(), pos.getZ(), pos.getW());
}
default BlockState getRelativeState(Vector3i pos, int layer) {
return getRelativeState(pos.getX(), pos.getY(), pos.getZ(), layer);
}
BlockState getRelativeState(int x, int y, int z, int layer);
boolean isWaterlogged();
default void set(BlockState state) {
this.set(state, 0, false, true);
}
default void set(BlockState state, boolean direct) {
this.set(state, 0, direct, true);
}
default void set(BlockState state, boolean direct, boolean update) {
this.set(state, 0, direct, update);
}
default void setExtra(BlockState state) {
this.set(state, 1, false, true);
}
default void setExtra(BlockState state, boolean direct) {
this.set(state, 1, direct, true);
}
default void setExtra(BlockState state, boolean direct, boolean update) {
this.set(state, 1, direct, update);
}
void set(BlockState state, int layer, boolean direct, boolean update);
}