|
2 | 2 |
|
3 | 3 | import net.minecraft.core.block.Block;
|
4 | 4 | import net.minecraft.core.block.entity.TileEntity;
|
| 5 | +import net.minecraft.core.util.helper.Axis; |
5 | 6 | import net.minecraft.core.util.phys.Vec3d;
|
6 | 7 | import net.minecraft.core.world.WorldSource;
|
7 | 8 |
|
8 | 9 | public enum Direction {
|
9 |
| - X_POS (new Vec3i(1,0,0),5,"EAST"), |
10 |
| - X_NEG (new Vec3i(-1,0,0),4,"WEST"), |
11 |
| - Y_POS (new Vec3i(0,1,0),1,"UP"), |
12 |
| - Y_NEG (new Vec3i(0,-1,0),0,"DOWN"), |
13 |
| - Z_POS (new Vec3i(0,0,1),3,"SOUTH"), |
14 |
| - Z_NEG (new Vec3i(0,0,-1),2,"NORTH"); |
| 10 | + X_POS (new Vec3i(1,0,0),5,"EAST", Axis.X), |
| 11 | + X_NEG (new Vec3i(-1,0,0),4,"WEST", Axis.X), |
| 12 | + Y_POS (new Vec3i(0,1,0),1,"UP", Axis.Y), |
| 13 | + Y_NEG (new Vec3i(0,-1,0),0,"DOWN", Axis.Y), |
| 14 | + Z_POS (new Vec3i(0,0,1),3,"SOUTH", Axis.Z), |
| 15 | + Z_NEG (new Vec3i(0,0,-1),2,"NORTH", Axis.Z); |
15 | 16 |
|
16 | 17 | private final Vec3i vec;
|
17 | 18 | private Direction opposite;
|
18 | 19 | private final int side;
|
19 | 20 | private final String name;
|
| 21 | + private final Axis axis; |
20 | 22 |
|
21 |
| - Direction(Vec3i vec3I,int side,String name) { |
| 23 | + Direction(Vec3i vec3I, int side, String name, Axis axis) { |
22 | 24 | this.vec = vec3I;
|
23 | 25 | this.side = side;
|
24 | 26 | this.name = name;
|
| 27 | + this.axis = axis; |
25 | 28 | }
|
26 | 29 |
|
27 | 30 | public TileEntity getTileEntity(WorldSource world, TileEntity tile){
|
@@ -56,7 +59,11 @@ public Vec3i getVec() {
|
56 | 59 | return vec.copy();
|
57 | 60 | }
|
58 | 61 |
|
59 |
| - public static Direction getDirectionFromSide(int side){ |
| 62 | + public Axis getAxis() { |
| 63 | + return axis; |
| 64 | + } |
| 65 | + |
| 66 | + public static Direction getDirectionFromSide(int side){ |
60 | 67 | for (Direction dir : values()) {
|
61 | 68 | if(dir.side == side){
|
62 | 69 | return dir;
|
|
0 commit comments