mirror of
https://github.com/JonasunderscoreJones/Microcraft.git
synced 2025-10-25 12:39:21 +02:00
some progress here I think. urgent push tho
This commit is contained in:
parent
f74512eea1
commit
8040263a8b
9 changed files with 57 additions and 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,8 +1,10 @@
|
||||||
package me.jonasjones.microcraft;
|
package me.jonasjones.microcraft;
|
||||||
|
|
||||||
import me.jonasjones.microcraft.config.ModConfigs;
|
import me.jonasjones.microcraft.config.ModConfigs;
|
||||||
|
import me.jonasjones.microcraft.config.ProfileConfig;
|
||||||
import me.jonasjones.microcraft.util.boardmanager.SerialNumberScanner;
|
import me.jonasjones.microcraft.util.boardmanager.SerialNumberScanner;
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
|
import org.json.simple.parser.ParseException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
@ -37,5 +39,14 @@ public class Microcraft implements ClientModInitializer {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
LOGGER.info("Failed to make Arduino LED blink. ARDUINO NOT CONNECTED!");
|
LOGGER.info("Failed to make Arduino LED blink. ARDUINO NOT CONNECTED!");
|
||||||
}*/
|
}*/
|
||||||
|
try {
|
||||||
|
ProfileConfig.uwu();
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOGGER.error("AHHHHHHHHHHHHHHHHHHHHH IO");
|
||||||
|
System.out.print(e);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
LOGGER.error("AHHHHHHHHHHHHHHHHHHHHH PARSE");
|
||||||
|
System.out.print(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
package me.jonasjones.microcraft.config;
|
||||||
|
|
||||||
|
import me.jonasjones.microcraft.object.BoardData;
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
import org.json.simple.JSONArray;
|
||||||
|
import org.json.simple.parser.JSONParser;
|
||||||
|
import org.json.simple.parser.ParseException;
|
||||||
|
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public class ProfileConfig {
|
||||||
|
public static void uwu() throws IOException, ParseException {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
JSONObject defaultBoardProfile = new JSONObject();
|
||||||
|
JSONArray defaultBoardProfilePinMaps = new JSONArray();
|
||||||
|
JSONObject pin1 = new JSONObject();
|
||||||
|
pin1.put("A1", "advancement.uwu");
|
||||||
|
JSONObject pin2 = new JSONObject();
|
||||||
|
pin2.put("D4", "read.pin");
|
||||||
|
defaultBoardProfilePinMaps.add(pin1);
|
||||||
|
defaultBoardProfilePinMaps.add(pin2);
|
||||||
|
defaultBoardProfile.put("displayname", "Default Profile");
|
||||||
|
defaultBoardProfile.put("board", BoardData.board.Custom);
|
||||||
|
defaultBoardProfile.put("pinmapping", defaultBoardProfilePinMaps);
|
||||||
|
jsonArray.add(defaultBoardProfile);
|
||||||
|
jsonObject.put("profiles", jsonArray);
|
||||||
|
|
||||||
|
FileWriter file = new FileWriter("uwu.txt");
|
||||||
|
file.write(jsonObject.toJSONString());
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
//TODO: check if file can be read and interpreted as json
|
||||||
|
|
||||||
|
String str = Files.readString(Path.of("uwu.txt"));
|
||||||
|
|
||||||
|
JSONParser jsonParser = new JSONParser();
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject uwu = (JSONObject) jsonParser.parse(str);
|
||||||
|
/*System.out.print(uwu.toJSONString());*/
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue