mirror of https://github.com/LOOHP/Limbo.git
Merge ce364c9d69 into 4c2d0a25cd
This commit is contained in:
commit
6f4dc50031
|
|
@ -206,13 +206,19 @@ public class Limbo {
|
||||||
|
|
||||||
String mappingName = "mapping.json";
|
String mappingName = "mapping.json";
|
||||||
File mappingFile = new File(internalDataFolder, mappingName);
|
File mappingFile = new File(internalDataFolder, mappingName);
|
||||||
if (!mappingFile.exists()) {
|
InputStream mappingStreamIn = getClass().getClassLoader().getResourceAsStream(mappingName);
|
||||||
try (InputStream in = getClass().getClassLoader().getResourceAsStream(mappingName)) {
|
try {
|
||||||
Files.copy(in, mappingFile.toPath());
|
if (!mappingFile.exists()) {
|
||||||
} catch (IOException e) {
|
Files.copy(mappingStreamIn, mappingFile.toPath());
|
||||||
e.printStackTrace();
|
} else {
|
||||||
}
|
if (Files.newInputStream(mappingFile.toPath()) != mappingStreamIn) {
|
||||||
}
|
mappingFile.delete();
|
||||||
|
Files.copy(mappingStreamIn, mappingFile.toPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
console.sendMessage("Loading packet id mappings from mapping.json ...");
|
console.sendMessage("Loading packet id mappings from mapping.json ...");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,18 +46,24 @@ public class DimensionRegistry {
|
||||||
this.defaultTag = new CompoundTag();
|
this.defaultTag = new CompoundTag();
|
||||||
|
|
||||||
String name = "dimension_registry.json";
|
String name = "dimension_registry.json";
|
||||||
File file = new File(Limbo.getInstance().getInternalDataFolder(), name);
|
File dimensionRegistryFile = new File(Limbo.getInstance().getInternalDataFolder(), name);
|
||||||
if (!file.exists()) {
|
InputStream dimensionRegistryIn = Limbo.class.getClassLoader().getResourceAsStream(name);
|
||||||
try (InputStream in = Limbo.class.getClassLoader().getResourceAsStream(name)) {
|
try {
|
||||||
Files.copy(in, file.toPath());
|
if (!dimensionRegistryFile.exists()) {
|
||||||
} catch (IOException e) {
|
Files.copy(dimensionRegistryIn, dimensionRegistryFile.toPath());
|
||||||
e.printStackTrace();
|
} else {
|
||||||
}
|
if(Files.newInputStream(dimensionRegistryFile.toPath()) != dimensionRegistryIn) {
|
||||||
}
|
dimensionRegistryFile.delete();
|
||||||
|
Files.copy(dimensionRegistryIn, dimensionRegistryFile.toPath());
|
||||||
this.reg = file;
|
}
|
||||||
|
}
|
||||||
try (InputStreamReader reader = new InputStreamReader(Files.newInputStream(reg.toPath()), StandardCharsets.UTF_8)) {
|
} catch (IOException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.reg = dimensionRegistryFile;
|
||||||
|
|
||||||
|
try (InputStreamReader reader = new InputStreamReader(Files.newInputStream(reg.toPath()), StandardCharsets.UTF_8)) {
|
||||||
JSONObject json = (JSONObject) new JSONParser().parse(reader);
|
JSONObject json = (JSONObject) new JSONParser().parse(reader);
|
||||||
CompoundTag tag = CustomNBTUtils.getCompoundTagFromJson((JSONObject) json.get("value"));
|
CompoundTag tag = CustomNBTUtils.getCompoundTagFromJson((JSONObject) json.get("value"));
|
||||||
defaultTag = tag;
|
defaultTag = tag;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue