Merge pull request #697 from wnuke/master

Improvements to LogUtil
This commit is contained in:
Dominika 2020-04-14 07:42:19 -04:00 committed by GitHub
commit f2920682fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 4 deletions

View File

@ -8,17 +8,28 @@ import java.io.IOException;
/**
* @author S-B99
* Created by S-B99 on 18/02/20
* Updated by wnuke on 14/04/20
*/
public class LogUtil {
public static void writePlayerCoords(String locationName) {
public static int[] getCurrentCoord(boolean chunk) {
Minecraft mc = Minecraft.getMinecraft();
writeCoords((int) mc.player.posX, (int) mc.player.posY, (int) mc.player.posZ, locationName);
int[] currentCoords = {(int) mc.player.posX, (int) mc.player.posY, (int) mc.player.posZ};
if (chunk == true) {
int[] chunkCoords = {currentCoords[0]/16, currentCoords[1]/16, currentCoords[2]/16};
return chunkCoords;
} else {
return currentCoords;
}
}
public static void writeCoords(int x, int y, int z, String locationName) {
public static void writePlayerCoords(String locationName, boolean chunk) {
writeCoords(getCurrentCoord(chunk), "chunk: " + chunk + ", " + locationName);
}
public static void writeCoords(int[] xyz, String locationName) {
try {
FileWriter fW = new FileWriter("KAMIBlueCoords.txt", true);
fW.write(formatter(x, y, z, locationName));
fW.write(formatter(xyz[0], xyz[1], xyz[2], locationName));
fW.close();
} catch (IOException e) {
e.printStackTrace();