mirror of https://github.com/kami-blue/client
Add coordinate log command and improved the CoordUtil
This commit is contained in:
parent
d912611b60
commit
df06025019
|
@ -0,0 +1,131 @@
|
|||
package me.zeroeightsix.kami.command.commands;
|
||||
|
||||
import me.zeroeightsix.kami.command.Command;
|
||||
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
|
||||
import me.zeroeightsix.kami.command.syntax.parsers.EnumParser;
|
||||
import me.zeroeightsix.kami.util.Coordinate;
|
||||
import me.zeroeightsix.kami.util.CoordinateInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
import static me.zeroeightsix.kami.util.CoordUtil.*;
|
||||
import static me.zeroeightsix.kami.util.MessageSendHelper.sendChatMessage;
|
||||
import static me.zeroeightsix.kami.util.MessageSendHelper.sendRawChatMessage;
|
||||
|
||||
/**
|
||||
* @author wnuke
|
||||
* Created by wnuke on 17/04/20
|
||||
*/
|
||||
|
||||
public class CoordsCommand extends Command {
|
||||
public CoordsCommand() {
|
||||
super("coord", new ChunkBuilder()
|
||||
.append("command", true, new EnumParser(new String[]{"add", "del", "list", "stashes", "help"}))
|
||||
.append("name", false)
|
||||
.build(), "pos");
|
||||
setDescription("Log the current coordinates.");
|
||||
}
|
||||
|
||||
public void call(String[] args) {
|
||||
if (args[0] != null) {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "add":
|
||||
if (args[1] != null) {
|
||||
confirm(args[1], writePlayerCoords(args[1]));
|
||||
} else {
|
||||
confirm("Unnamed", writePlayerCoords("Unnamed"));
|
||||
}
|
||||
break;
|
||||
case "list":
|
||||
if (args[1] != null) {
|
||||
searchCoords(args[1]);
|
||||
} else {
|
||||
listCoords(false);
|
||||
}
|
||||
break;
|
||||
case "stashes":
|
||||
listCoords(true);
|
||||
break;
|
||||
case "del":
|
||||
if (args[1] != null) {
|
||||
if (removeCoord(args[1], coordsLogFilename)) {
|
||||
sendChatMessage("Removed coordinate with name " + args[1]);
|
||||
} else {
|
||||
sendChatMessage("No coordinate with name " + args[1]);
|
||||
}
|
||||
} else {
|
||||
sendChatMessage("Please provide the name of a coordinate to remove.");
|
||||
}
|
||||
break;
|
||||
case "help":
|
||||
sendChatMessage("Coordinate logger help:");
|
||||
sendRawChatMessage(" list &7[searchterm]&f - lists logged coordinates, optionally searches and filters the results");
|
||||
sendRawChatMessage(" stashes - lists logged stashes");
|
||||
sendRawChatMessage(" add &7[name]&f - logs a coordinate with an optional name");
|
||||
sendRawChatMessage(" del <name> - removes a coordinate with the specified name");
|
||||
sendRawChatMessage(" help - displays this list");
|
||||
break;
|
||||
default:
|
||||
sendChatMessage("Please use a valid command (add, del, list, stashes or help");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
sendChatMessage("Please choose a command (list or save)");
|
||||
}
|
||||
}
|
||||
|
||||
private void listCoords(boolean stashes) {
|
||||
ArrayList<CoordinateInfo> coords = readCoords(coordsLogFilename);
|
||||
if (coords.isEmpty()) {
|
||||
if (!stashes) {
|
||||
sendChatMessage("No coordinates have been logged.");
|
||||
} else {
|
||||
sendChatMessage("No stashes have been logged.");
|
||||
}
|
||||
} else {
|
||||
if (!stashes) {
|
||||
sendChatMessage("List of logged coordinates:");
|
||||
} else {
|
||||
sendChatMessage("List of logged stashes:");
|
||||
}
|
||||
String stashRegex = "(\\(.*chests, .* shulkers\\))";
|
||||
Objects.requireNonNull(coords).forEach(coord -> {
|
||||
if (stashes) {
|
||||
if (coord.name.matches(stashRegex)) {
|
||||
sendRawChatMessage(format(coord, ""));
|
||||
}
|
||||
} else {
|
||||
if (!coord.name.matches(stashRegex)) {
|
||||
sendRawChatMessage(format(coord, ""));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
private void searchCoords(String searchterm) {
|
||||
boolean hasfound = false;
|
||||
boolean firstfind = true;
|
||||
ArrayList<CoordinateInfo> coords = readCoords(coordsLogFilename);
|
||||
for (CoordinateInfo coord : Objects.requireNonNull(coords)) {
|
||||
if (coord.name.contains(searchterm)) {
|
||||
if (firstfind) {
|
||||
sendChatMessage("Result of search for &7" + searchterm + "&f: ");
|
||||
firstfind = false;
|
||||
}
|
||||
sendRawChatMessage(format(coord, searchterm));
|
||||
hasfound = true;
|
||||
}
|
||||
}
|
||||
if (!hasfound) {
|
||||
sendChatMessage("No results for " + searchterm);
|
||||
}
|
||||
}
|
||||
private String format(CoordinateInfo coord, String searchterm) {
|
||||
String message = " " + coord.name + " (" + coord.xyz.x + " " + coord.xyz.y + " " + coord.xyz.z + ")";
|
||||
return message.replaceAll(searchterm, "&7" + searchterm + "&f");
|
||||
}
|
||||
private void confirm(String name, Coordinate xyz) {
|
||||
sendChatMessage("Added coordinate " + xyz.x + " " + xyz.y + " " + xyz.z + " with name " + name + ".");
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package me.zeroeightsix.kami.command.commands;
|
|||
|
||||
import me.zeroeightsix.kami.command.Command;
|
||||
import me.zeroeightsix.kami.command.syntax.ChunkBuilder;
|
||||
import me.zeroeightsix.kami.command.syntax.parsers.EnumParser;
|
||||
import me.zeroeightsix.kami.module.modules.render.Search;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
|
@ -15,7 +16,7 @@ import static me.zeroeightsix.kami.util.MessageSendHelper.*;
|
|||
*/
|
||||
public class SearchCommand extends Command {
|
||||
public SearchCommand() {
|
||||
super("search", new ChunkBuilder().append("help").append("+block|-block|=block").append("list|defaults|clear").build());
|
||||
super("search", new ChunkBuilder().append("command", true, new EnumParser(new String[]{"help", "+", "-", "=", "list", "defaults", "clear"})).build());
|
||||
setDescription("Allows you to add or remove blocks from the &fSearch &7module");
|
||||
}
|
||||
|
||||
|
@ -38,12 +39,12 @@ public class SearchCommand extends Command {
|
|||
continue;
|
||||
if (s.equalsIgnoreCase("help")) {
|
||||
sendChatMessage("Available options: \n" +
|
||||
"+block: Adds a block to the list\n" +
|
||||
"-block: Removes a block from the list\n" +
|
||||
"=block: Changes the list to only that block\n" +
|
||||
"list: Prints the list of selected blocks\n" +
|
||||
"defaults: Resets the list to the default list\n" +
|
||||
"clear: Removes all blocks from the " + search.getName() + " block list");
|
||||
" +block: Adds block to the list\n" +
|
||||
" -block: Removes block from the list\n" +
|
||||
" =block: Changes the list to only contain block\n" +
|
||||
" list: Prints the list of selected blocks\n" +
|
||||
" defaults: Resets the list to the default list\n" +
|
||||
" clear: Removes all blocks from the " + search.getName() + " block list");
|
||||
} else if (s.equalsIgnoreCase("override")) {
|
||||
search.overrideWarning.setValue(true);
|
||||
sendWarningMessage(search.getChatName() + "Override for Intel Integrated GPUs enabled!");
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
package me.zeroeightsix.kami.module.modules.experimental;
|
||||
|
||||
import me.zeroeightsix.kami.module.Module;
|
||||
import me.zeroeightsix.kami.setting.Setting;
|
||||
import me.zeroeightsix.kami.setting.Settings;
|
||||
import me.zeroeightsix.kami.util.CoordUtil;
|
||||
import me.zeroeightsix.kami.util.Coordinate;
|
||||
|
||||
import static me.zeroeightsix.kami.util.MessageSendHelper.sendChatMessage;
|
||||
|
||||
@Module.Info(name = "CoordsLog", description = "Automatically writes the coordinates of the player to a file with a user defined delay between logs.", category = Module.Category.EXPERIMENTAL, showOnArray = Module.ShowOnArray.ON)
|
||||
public class CoordsLog extends Module {
|
||||
private Setting<Boolean> forceLogOnDeath = register(Settings.b("onDeath", true));
|
||||
private Setting<Boolean> deathInChat = register(Settings.b("logDeathInChat", true));
|
||||
private Setting<Boolean> autoLog = register(Settings.b("onDelay", false));
|
||||
private Setting<Double> delay = register(Settings.doubleBuilder("delay").withMinimum(1.0).withValue(15.0).withMaximum(60.0).build());
|
||||
private Setting<Boolean> checkDuplicates = register(Settings.b("avoidDuplicates", true));
|
||||
|
||||
private String previousCoord;
|
||||
|
||||
private boolean playerIsDead = false;
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
if (mc.player == null)
|
||||
return;
|
||||
if (autoLog.getValue()) {
|
||||
timeout();
|
||||
}
|
||||
if (0 < mc.player.getHealth() && playerIsDead) {
|
||||
playerIsDead = false;
|
||||
}
|
||||
if (!playerIsDead && 0 >= mc.player.getHealth() && forceLogOnDeath.getValue()) {
|
||||
Coordinate deathPoint = logCoordinates("deathPoint");
|
||||
if (deathInChat.getValue()) {
|
||||
sendChatMessage("You died at " + deathPoint.x + " " + deathPoint.y + " " + deathPoint.z);
|
||||
playerIsDead = true;
|
||||
} else {
|
||||
playerIsDead = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static long startTime = 0;
|
||||
|
||||
private void timeout() {
|
||||
if (startTime == 0)
|
||||
startTime = System.currentTimeMillis();
|
||||
if (startTime + (delay.getValue() * 1000) <= System.currentTimeMillis()) { // 1 timeout = 1 second = 1000 ms
|
||||
startTime = System.currentTimeMillis();
|
||||
Coordinate pos = CoordUtil.getCurrentCoord();
|
||||
String currentCoord = pos.toString();
|
||||
if (checkDuplicates.getValue()) {
|
||||
if (!currentCoord.equals(previousCoord)) {
|
||||
logCoordinates("autoLogger");
|
||||
previousCoord = currentCoord;
|
||||
}
|
||||
} else {
|
||||
logCoordinates("autoLogger");
|
||||
previousCoord = currentCoord;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Coordinate logCoordinates(String name) {
|
||||
return CoordUtil.writePlayerCoords(name);
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
startTime = 0;
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package me.zeroeightsix.kami.module.modules.hidden;
|
||||
|
||||
import me.zeroeightsix.kami.module.Module;
|
||||
import me.zeroeightsix.kami.setting.Setting;
|
||||
import me.zeroeightsix.kami.setting.Settings;
|
||||
import me.zeroeightsix.kami.util.LogUtil;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@Module.Info(
|
||||
name = "CoordsLog",
|
||||
description = "Automatically writes the coordinates of the player to a file with a user defined delay between logs.",
|
||||
category = Module.Category.HIDDEN,
|
||||
showOnArray = Module.ShowOnArray.OFF
|
||||
)
|
||||
public class CoordsLog extends Module {
|
||||
private Setting<Double> delay = register(Settings.doubleBuilder("Time between logs").withMinimum(1.0).withValue(15.0).withMaximum(60.0).build());
|
||||
private Setting<Boolean> checkDuplicates = register(Settings.b("Don't log same coord 2 times in a row", true));
|
||||
private Setting<Boolean> useChunkCoord = register(Settings.b("Use chunk coordinate", true));
|
||||
|
||||
private int previousCoord;
|
||||
|
||||
private static boolean playerIsDead = false;
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
if (mc.player == null)
|
||||
return;
|
||||
timeout();
|
||||
if (!playerIsDead && 0 >= mc.player.getHealth()) {
|
||||
logCoordinates();
|
||||
playerIsDead = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private static long startTime = 0;
|
||||
|
||||
private void timeout() {
|
||||
if (startTime == 0)
|
||||
startTime = System.currentTimeMillis();
|
||||
if (startTime + (delay.getValue() * 1000) <= System.currentTimeMillis()) { // 1 timeout = 1 second = 1000 ms
|
||||
startTime = System.currentTimeMillis();
|
||||
int[] cCArray = LogUtil.getCurrentCoord(useChunkCoord.getValue());
|
||||
int currentCoord = (int) cCArray[0]*3 + (int) cCArray[1]*32 + (int) cCArray[2]/2;
|
||||
if (checkDuplicates.getValue() == true) {
|
||||
if (currentCoord != previousCoord) {
|
||||
logCoordinates();
|
||||
previousCoord = currentCoord;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
logCoordinates();
|
||||
previousCoord = currentCoord;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void logCoordinates() {
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
|
||||
final String time = sdf.format(new Date());
|
||||
LogUtil.writePlayerCoords(time, useChunkCoord.getValue());
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
startTime = 0;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,11 @@
|
|||
package me.zeroeightsix.kami.module.modules.misc
|
||||
|
||||
import kotlin.math.roundToInt
|
||||
import me.zeroeightsix.kami.module.Module
|
||||
import me.zeroeightsix.kami.setting.Settings
|
||||
import me.zeroeightsix.kami.util.LogUtil
|
||||
import me.zeroeightsix.kami.util.CoordUtil
|
||||
import me.zeroeightsix.kami.util.CoordUtil.coordsLogFilename
|
||||
import me.zeroeightsix.kami.util.Coordinate
|
||||
import me.zeroeightsix.kami.util.MessageSendHelper
|
||||
import net.minecraft.client.audio.PositionedSoundRecord
|
||||
import net.minecraft.init.SoundEvents
|
||||
|
@ -11,7 +14,6 @@ import net.minecraft.tileentity.TileEntityChest
|
|||
import net.minecraft.tileentity.TileEntityShulkerBox
|
||||
import net.minecraft.util.math.BlockPos
|
||||
import net.minecraft.util.math.ChunkPos
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
* @author Nucleus
|
||||
|
@ -51,6 +53,11 @@ class StashFinder : Module() {
|
|||
return intArrayOf(x, y, z)
|
||||
}
|
||||
|
||||
fun getBlockPos(): Coordinate {
|
||||
val xyz = this.getPosition()
|
||||
return Coordinate(xyz[0], xyz[1], xyz[2])
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "($chests chests, $shulkers shulkers)"
|
||||
}
|
||||
|
@ -90,7 +97,7 @@ class StashFinder : Module() {
|
|||
chunkStats.hot = false
|
||||
|
||||
// mfw int array instead of Vec3i
|
||||
LogUtil.writeCoords(chunkStats.getPosition(), chunkStats.toString())
|
||||
CoordUtil.writeCoords(chunkStats.getBlockPos(), chunkStats.toString(), coordsLogFilename)
|
||||
|
||||
if (playSound.value) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.getRecord(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 1.0f))
|
||||
|
|
|
@ -7,6 +7,7 @@ import me.zeroeightsix.kami.event.events.RenderEvent;
|
|||
import me.zeroeightsix.kami.module.Module;
|
||||
import me.zeroeightsix.kami.setting.Setting;
|
||||
import me.zeroeightsix.kami.setting.Settings;
|
||||
import me.zeroeightsix.kami.util.Coordinate;
|
||||
import me.zeroeightsix.kami.util.GeometryMasks;
|
||||
import me.zeroeightsix.kami.util.KamiTessellator;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -29,7 +30,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
import static me.zeroeightsix.kami.util.ColourConverter.rgbToInt;
|
||||
import static me.zeroeightsix.kami.util.ColourUtils.toRGBA;
|
||||
import static me.zeroeightsix.kami.util.LogUtil.getCurrentCoord;
|
||||
import static me.zeroeightsix.kami.util.CoordUtil.getCurrentCoord;
|
||||
import static me.zeroeightsix.kami.util.MessageSendHelper.sendErrorMessage;
|
||||
import static me.zeroeightsix.kami.util.MessageSendHelper.sendWarningMessage;
|
||||
|
||||
|
@ -183,7 +184,7 @@ public class Search extends Module {
|
|||
});
|
||||
|
||||
private void reloadChunks() {
|
||||
int[] pcoords = getCurrentCoord(false);
|
||||
Coordinate pcoords = getCurrentCoord();
|
||||
int renderdist = mc.gameSettings.renderDistanceChunks;
|
||||
if (renderdist > 8) {
|
||||
renderdist = 8;
|
||||
|
@ -191,7 +192,7 @@ public class Search extends Module {
|
|||
ChunkProviderClient providerClient = mc.world.getChunkProvider();
|
||||
for (int x = -renderdist; x < renderdist; x++) {
|
||||
for (int z = -renderdist; z < renderdist; z++) {
|
||||
Chunk chunk = providerClient.getLoadedChunk((pcoords[0] >> 4) + x, (pcoords[2] >> 4) + z);
|
||||
Chunk chunk = providerClient.getLoadedChunk((pcoords.x >> 4) + x, (pcoords.z >> 4) + z);
|
||||
if (chunk != null)
|
||||
exec.execute(() ->
|
||||
loadChunk(chunk)
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
package me.zeroeightsix.kami.util;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author dominikaaaa
|
||||
* Created by dominikaaaa on 18/02/20
|
||||
* Updated by wnuke on 14/04/20
|
||||
* Renamed by wnuke on 26/04/20 from LogUtil.java to CoordUtil.java
|
||||
*/
|
||||
public class CoordUtil {
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
|
||||
public static final String coordsLogFilename = "KAMIBlueCoords.json";
|
||||
private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
|
||||
public static Coordinate getCurrentCoord() {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
return new Coordinate((int) mc.player.posX, (int) mc.player.posY, (int) mc.player.posZ);
|
||||
}
|
||||
|
||||
public static Coordinate writePlayerCoords(String locationName) {
|
||||
Coordinate coords = getCurrentCoord();
|
||||
writeCoords(coords, locationName, coordsLogFilename);
|
||||
return coords;
|
||||
}
|
||||
|
||||
public static void writeCoords(Coordinate xyz, String locationName, String filename) {
|
||||
try {
|
||||
ArrayList<CoordinateInfo> coords = readCoords(filename);
|
||||
coords.add(formatter(xyz, locationName));
|
||||
FileWriter writer = new FileWriter(filename);
|
||||
gson.toJson(coords, writer);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean removeCoord(String name, String filename) {
|
||||
boolean removed = false;
|
||||
try {
|
||||
ArrayList<CoordinateInfo> coords = readCoords(filename);
|
||||
for (CoordinateInfo coord : coords) {
|
||||
if (coord.getName().equals(name)) {
|
||||
coords.remove(coord);
|
||||
removed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
FileWriter writer = new FileWriter(filename);
|
||||
gson.toJson(coords, writer);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
private static CoordinateInfo formatter(Coordinate xyz, String locationName) {
|
||||
String time = sdf.format(new Date());
|
||||
return new CoordinateInfo(xyz, locationName, time);
|
||||
}
|
||||
public static ArrayList<CoordinateInfo> readCoords(String filename) {
|
||||
try {
|
||||
ArrayList<CoordinateInfo> coords;
|
||||
coords = gson.fromJson(new FileReader(filename), new TypeToken<ArrayList<CoordinateInfo>>(){}.getType());
|
||||
if (coords != null) {
|
||||
return coords;
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
File file = new File(filename);
|
||||
file.createNewFile();
|
||||
} catch (IOException ioException) {
|
||||
ioException.printStackTrace();
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package me.zeroeightsix.kami.util;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Coordinate {
|
||||
@SerializedName("x")
|
||||
public int x;
|
||||
@SerializedName("y")
|
||||
public int y;
|
||||
@SerializedName("z")
|
||||
public int z;
|
||||
|
||||
public Coordinate(int x, int y, int z) {
|
||||
this.setX(x);
|
||||
this.setY(y);
|
||||
this.setZ(z);
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public void setZ(int z) {
|
||||
this.z = z;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package me.zeroeightsix.kami.util;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author wnuke
|
||||
* Created by wnuke on 17/04/20
|
||||
*/
|
||||
|
||||
public class CoordinateInfo {
|
||||
@SerializedName("position")
|
||||
public Coordinate xyz;
|
||||
@SerializedName("name")
|
||||
public String name;
|
||||
@SerializedName("time")
|
||||
public String time;
|
||||
@SerializedName("date")
|
||||
public String date;
|
||||
|
||||
public CoordinateInfo(int x, int y, int z, String nameSet, String timeSet) {
|
||||
xyz = new Coordinate(x, y, z);
|
||||
name = nameSet;
|
||||
time = timeSet;
|
||||
}
|
||||
|
||||
public CoordinateInfo(Coordinate pos, String nameSet, String timeSet) {
|
||||
xyz = pos;
|
||||
name = nameSet;
|
||||
time = timeSet;
|
||||
}
|
||||
|
||||
public Coordinate getPos() {
|
||||
return xyz;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
return date;
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package me.zeroeightsix.kami.util;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author dominikaaaa
|
||||
* Created by dominikaaaa on 18/02/20
|
||||
* Updated by wnuke on 14/04/20
|
||||
*/
|
||||
public class LogUtil {
|
||||
public static int[] getCurrentCoord(boolean chunk) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
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 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(xyz[0], xyz[1], xyz[2], locationName));
|
||||
fW.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static String formatter(int x, int y, int z, String locationName) {
|
||||
return x + ", " + y + ", " + z + ", " + locationName + "\n";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue