Skip to content

Commit 8049d02

Browse files
committed
docs(facing): Add comments on barrel facing
1 parent c3f1a7b commit 8049d02

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

src/main/java/com/dre/brewery/BarrelFacing.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,24 @@
2020

2121
package com.dre.brewery;
2222

23+
import lombok.AllArgsConstructor;
2324
import lombok.Getter;
2425
import org.bukkit.block.BlockFace;
2526

2627
@Getter
28+
@AllArgsConstructor
2729
public enum BarrelFacing {
2830
EAST(BlockFace.EAST, 1, 0), WEST(BlockFace.WEST, -1, 0), SOUTH(BlockFace.SOUTH, 0, 1), NORTH(BlockFace.NORTH, 0, -1);
2931

3032
private final BlockFace face;
3133
private final int dx;
3234
private final int dz;
3335

34-
BarrelFacing(BlockFace face, int dx, int dz) {
35-
this.face = face;
36-
this.dx = dx;
37-
this.dz = dz;
38-
}
39-
36+
/**
37+
* Rotate in against the positive y-axis, counterclockwise according to mathematical definition of rotations
38+
*
39+
* @return A rotated facing
40+
*/
4041
public BarrelFacing rotate90degrees() {
4142
return switch (this) {
4243
case EAST -> NORTH;
@@ -46,6 +47,11 @@ public BarrelFacing rotate90degrees() {
4647
};
4748
}
4849

50+
/**
51+
* Rotate in against the positive y-axis, counterclockwise according to mathematical definition of rotations
52+
*
53+
* @return A rotated facing
54+
*/
4955
public BarrelFacing rotate180degrees() {
5056
return switch (this) {
5157
case EAST -> WEST;
@@ -55,6 +61,11 @@ public BarrelFacing rotate180degrees() {
5561
};
5662
}
5763

64+
/**
65+
* Rotate in against the positive y-axis, counterclockwise according to mathematical definition of rotations
66+
*
67+
* @return A rotated facing
68+
*/
5869
public BarrelFacing rotate270degrees() {
5970
return switch (this) {
6071
case EAST -> SOUTH;

0 commit comments

Comments
 (0)