Skip to content

Commit

Permalink
Fix get/set(PlayerTilePosition) offset by 1
Browse files Browse the repository at this point in the history
  • Loading branch information
johnathanchann committed Jun 11, 2024
1 parent 2356611 commit fe04601
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 5 deletions.
35 changes: 35 additions & 0 deletions Testing/Temporary/LastTest.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Start testing: Jun 12 00:06 AEST
----------------------------------------------------------
Unable to find executable: /mnt/c/Users/yeefh/documents/mcpp/test/local_tests
1/2 Testing: local
1/2 Test: local
Command: ""
Directory: /mnt/c/Users/yeefh/documents/mcpp
"local" start time:
Output:
----------------------------------------------------------
<end of output>
Test time = 0.00 sec
----------------------------------------------------------
Test Passed.
"local" end time: Jun 12 00:06 AEST
"local" time elapsed: 00:00:00
----------------------------------------------------------

Unable to find executable: /mnt/c/Users/yeefh/documents/mcpp/test/test_suite
2/2 Testing: full
2/2 Test: full
Command: ""
Directory: /mnt/c/Users/yeefh/documents/mcpp
"full" start time:
Output:
----------------------------------------------------------
<end of output>
Test time = 0.00 sec
----------------------------------------------------------
Test Passed.
"full" end time: Jun 12 00:06 AEST
"full" time elapsed: 00:00:00
----------------------------------------------------------

End testing: Jun 12 00:06 AEST
2 changes: 2 additions & 0 deletions Testing/Temporary/LastTestsFailed.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1:local
2:full
40 changes: 40 additions & 0 deletions build/Testing/Temporary/LastTest.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Start testing: Jun 12 00:07 AEST
----------------------------------------------------------
Unable to find executable: /mnt/c/Users/yeefh/documents/mcpp/build/test/local_tests
1/2 Testing: local
1/2 Test: local
Command: ""
Directory: /mnt/c/Users/yeefh/documents/mcpp/build
"local" start time:
Output:
----------------------------------------------------------
<end of output>
Test time = 0.00 sec
----------------------------------------------------------
Test Passed.
"local" end time: Jun 12 00:07 AEST
"local" time elapsed: 00:00:00
----------------------------------------------------------

2/2 Testing: full
2/2 Test: full
Command: "/mnt/c/Users/yeefh/documents/mcpp/build/test/test_suite"
Directory: /mnt/c/Users/yeefh/documents/mcpp/build
"full" start time: Jun 12 00:07 AEST
Output:
----------------------------------------------------------
[doctest] doctest version is "2.4.9"
[doctest] run with "--help" for options
===============================================================================
[doctest] test cases: 6 | 6 passed | 0 failed | 0 skipped
[doctest] assertions: 40 | 40 passed | 0 failed |
[doctest] Status: SUCCESS!
<end of output>
Test time = 0.92 sec
----------------------------------------------------------
Test Passed.
"full" end time: Jun 12 00:07 AEST
"full" time elapsed: 00:00:00
----------------------------------------------------------

End testing: Jun 12 00:07 AEST
1 change: 1 addition & 0 deletions build/Testing/Temporary/LastTestsFailed.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1:local
Binary file added build/test/test_suite
Binary file not shown.
9 changes: 4 additions & 5 deletions src/mcpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ Coordinate MinecraftConnection::getPlayerPosition() {
}

void MinecraftConnection::setPlayerTilePosition(const Coordinate& tile) {
conn->sendCommand("player.setTile", tile.x, tile.y, tile.z);
conn->sendCommand("player.setTile", tile.x, (tile.y+1), tile.z);
}

Coordinate MinecraftConnection::getPlayerTilePosition() {
std::string returnString = conn->sendReceiveCommand("player.getTile", "");
std::vector<int> parsedInts;
splitCommaStringToInts(returnString, parsedInts);
return Coordinate(parsedInts[0], parsedInts[1], parsedInts[2]);
Coordinate playerTile = getPlayerPosition();
playerTile.y--;
return playerTile;
}

void MinecraftConnection::setBlock(const Coordinate& loc,
Expand Down
3 changes: 3 additions & 0 deletions test/Testing/Temporary/LastTest.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Start testing: Jun 11 23:57 AEST
----------------------------------------------------------
End testing: Jun 11 23:57 AEST

0 comments on commit fe04601

Please sign in to comment.