Renames RelativeBlockVector's right, depth and distance to right, down and out respectively

This commit is contained in:
2021-10-24 22:48:13 +02:00
parent 822f8fb2b5
commit 669767ef89
9 changed files with 82 additions and 71 deletions

View File

@ -12,8 +12,8 @@ public class RelativeBlockVectorTest {
public void getTest() {
RelativeBlockVector relativeBlockVector = new RelativeBlockVector(56, 44, 23);
assertEquals(56, relativeBlockVector.getRight());
assertEquals(44, relativeBlockVector.getDepth());
assertEquals(23, relativeBlockVector.getDistance());
assertEquals(44, relativeBlockVector.getDown());
assertEquals(23, relativeBlockVector.getOut());
}
@Test

View File

@ -27,22 +27,22 @@ public class BlockLocationTest {
RelativeBlockVector relativeBlockVector = new RelativeBlockVector(2, 1, 3);
BlockLocation relativeLocation1 = startLocation.getRelativeLocation(relativeBlockVector, 0);
//With yaw = 0, going right goes in the x direction, and distance goes in the z direction, while y is decremented
//With yaw = 0, going right goes in the x direction, and out goes in the z direction, while y is decremented
BlockLocation targetLocation1 = new BlockLocation(world, 9, 2, 9);
Assertions.assertEquals(targetLocation1, relativeLocation1);
BlockLocation relativeLocation2 = startLocation.getRelativeLocation(relativeBlockVector, 90);
//With yaw = 90, going right goes in the z direction, and distance goes in the -x direction, while y is decremented
//With yaw = 90, going right goes in the z direction, and out goes in the -x direction, while y is decremented
BlockLocation targetLocation2 = new BlockLocation(world, 4, 2, 8);
Assertions.assertEquals(targetLocation2, relativeLocation2);
BlockLocation relativeLocation3 = startLocation.getRelativeLocation(relativeBlockVector, 180);
//With yaw = 180, going right goes in the -x direction, and distance goes in the -z direction, while y is decremented
//With yaw = 180, going right goes in the -x direction, and out goes in the -z direction, while y is decremented
BlockLocation targetLocation3 = new BlockLocation(world, 5, 2, 3);
Assertions.assertEquals(targetLocation3, relativeLocation3);
BlockLocation relativeLocation4 = startLocation.getRelativeLocation(relativeBlockVector, 270);
//With yaw = 270, going right goes in the -z direction, and distance goes in the x direction, while y is decremented
//With yaw = 270, going right goes in the -z direction, and out goes in the x direction, while y is decremented
BlockLocation targetLocation4 = new BlockLocation(world, 10, 2, 4);
Assertions.assertEquals(targetLocation4, relativeLocation4);
}

View File

@ -8,21 +8,21 @@ public class RelativeBlockVectorTest {
@Test
public void addToVectorTest() {
int right = 5;
int depth = 5;
int distance = 3;
int down = 5;
int out = 3;
RelativeBlockVector relativeBlockVector = new RelativeBlockVector(right, depth, distance);
RelativeBlockVector relativeBlockVector = new RelativeBlockVector(right, down, out);
for (int i = 0; i < 1000; i++) {
int randomValue = getRandomNumber();
RelativeBlockVector newVector = relativeBlockVector.addToVector(RelativeBlockVector.Property.RIGHT, randomValue);
Assertions.assertEquals(new RelativeBlockVector(right + randomValue, depth, distance), newVector);
Assertions.assertEquals(new RelativeBlockVector(right + randomValue, down, out), newVector);
newVector = relativeBlockVector.addToVector(RelativeBlockVector.Property.DISTANCE, randomValue);
Assertions.assertEquals(new RelativeBlockVector(right, depth, distance + randomValue), newVector);
newVector = relativeBlockVector.addToVector(RelativeBlockVector.Property.OUT, randomValue);
Assertions.assertEquals(new RelativeBlockVector(right, down, out + randomValue), newVector);
newVector = relativeBlockVector.addToVector(RelativeBlockVector.Property.DEPTH, randomValue);
Assertions.assertEquals(new RelativeBlockVector(right, depth + randomValue, distance), newVector);
newVector = relativeBlockVector.addToVector(RelativeBlockVector.Property.DOWN, randomValue);
Assertions.assertEquals(new RelativeBlockVector(right, down + randomValue, out), newVector);
}
}