BREAKING UPDATE
THIS WILL BREAK YOUR SAVES All ID's are now configurable. This does mean ids have changed, such as to make ids make more logical sense when configured.main
parent
83ad98169d
commit
19da9d70e3
@ -0,0 +1,72 @@
|
||||
package net.brokenmoon.afloydwiremod;
|
||||
import com.moandjiezana.toml.Toml;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import static net.brokenmoon.afloydwiremod.WireMod.LOGGER;
|
||||
|
||||
public class WiremodConfig {
|
||||
|
||||
//Packet ID's
|
||||
public int programmerGuiPacket;
|
||||
public int programmingPacket;
|
||||
public int wiringGuiPacket;
|
||||
public int syncPacket;
|
||||
public int wiringPacket;
|
||||
public int wiringSettingsPacket;
|
||||
public int chipSettingsPacket;
|
||||
public int programmerItemID;
|
||||
public int wiringItemID;
|
||||
public int chipTileID;
|
||||
public int linkTileInactiveID;
|
||||
public int linkTileActiveID;
|
||||
public int displayTileID;
|
||||
|
||||
|
||||
public WiremodConfig(){
|
||||
Toml toml = new Toml().read(this.getConfig());
|
||||
//Packets
|
||||
programmingPacket = toml.getLong("ids.packet.programming", (long)109).intValue();
|
||||
programmerGuiPacket = toml.getLong("ids.packet.programmerGui", (long)110).intValue();
|
||||
wiringPacket = toml.getLong("ids.packet.wiring", (long)111).intValue();
|
||||
wiringGuiPacket = toml.getLong("ids.packet.wiringGui", (long)112).intValue();
|
||||
wiringSettingsPacket = toml.getLong("ids.packet.wiringSettingsGui", (long)113).intValue();
|
||||
syncPacket = toml.getLong("ids.packet.sync", (long)114).intValue();
|
||||
chipSettingsPacket = toml.getLong("ids.packet.chipSettingsGui", (long)115).intValue();
|
||||
//Items
|
||||
programmerItemID = toml.getLong("ids.item.programmingTool", (long)906).intValue();
|
||||
wiringItemID = toml.getLong("ids.item.wiringTool", (long)907).intValue();
|
||||
//Tiles
|
||||
chipTileID = toml.getLong("ids.tile.chipTile", (long)905).intValue();
|
||||
linkTileInactiveID = toml.getLong("ids.tile.linkTileInactive", (long)906).intValue();
|
||||
linkTileActiveID = toml.getLong("ids.tile.linkTileActive", (long)907).intValue();
|
||||
displayTileID = toml.getLong("ids.tile.displayTile", (long)908).intValue();
|
||||
|
||||
}
|
||||
public static File getConfig() {
|
||||
File config = new File("config/AWM.toml");
|
||||
if (!config.exists()) {
|
||||
LOGGER.warn("Config For AWM Not Found! Creating new config based upon default :)");
|
||||
InputStream in;
|
||||
OutputStream out;
|
||||
try {
|
||||
File configDir = new File("config");
|
||||
if (!configDir.exists())
|
||||
configDir.mkdir();
|
||||
in = WireMod.class.getClassLoader().getResourceAsStream("assets/afloydwiremod/config.toml");
|
||||
out = new FileOutputStream(config);
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
while ((length = in.read(buffer)) > 0) {
|
||||
out.write(buffer, 0, length);
|
||||
}
|
||||
return getConfig();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
LOGGER.info("Config for AWM loaded!");
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
[ids]
|
||||
|
||||
[ids.packet]
|
||||
chipTile = 905
|
||||
linkTileInactive = 906
|
||||
linkTileActive = 907
|
||||
displayTile = 908
|
||||
|
||||
[ids.item]
|
||||
programmingTool = 909
|
||||
wiringTool = 910
|
||||
|
||||
[ids.tile]
|
||||
programming = 109
|
||||
programmerGui = 110
|
||||
wiring = 111
|
||||
wiringGui = 112
|
||||
wiringSettingsGui = 113
|
||||
sync = 114
|
||||
chipSettingsGui = 115
|
Loading…
Reference in New Issue