Minor changes

This commit is contained in:
KennyTV 2020-03-23 10:40:57 +01:00
parent e658304405
commit 757654aa9d
5 changed files with 19 additions and 12 deletions

View File

@ -130,7 +130,11 @@ public class ProtocolRegistry {
CompletableFuture<Void> future = new CompletableFuture<>();
mappingLoaderFutures.put(protocol.getClass(), future);
mappingLoaderExecutor.execute(() -> {
protocol.loadMappingData();
try {
protocol.loadMappingData();
} catch (Exception e) {
e.printStackTrace();
}
future.complete(null);
});
} else {
@ -334,12 +338,15 @@ public class ProtocolRegistry {
}
}
public static void getMappingLoaderFuture(Class<? extends Protocol> protocolClass, Runnable runnable) {
CompletableFuture<Void> future = mappingLoaderFutures.get(protocolClass);
if (future != null) {
future.whenComplete((v, t) -> runnable.run());
} else {
runnable.run();
}
public static CompletableFuture<Void> getMappingLoaderFuture(Class<? extends Protocol> protocolClass) {
return mappingLoaderFutures.get(protocolClass);
}
public static Map<Class<? extends Protocol>, CompletableFuture<Void>> getMappingLoaderFutures() {
return mappingLoaderFutures;
}
public static ThreadPoolExecutor getMappingLoaderExecutor() {
return mappingLoaderExecutor;
}
}

View File

@ -33,9 +33,9 @@ public class MappingData {
public static Mappings blockMappings;
public static void init() {
Via.getPlatform().getLogger().info("Loading 1.12.2 -> 1.13 mappings...");
JsonObject mapping1_12 = MappingDataLoader.loadData("mapping-1.12.json", true);
JsonObject mapping1_13 = MappingDataLoader.loadData("mapping-1.13.json", true);
Via.getPlatform().getLogger().info("Loading 1.12.2 -> 1.13 mappings...");
blockMappings = new BlockMappingsShortArray(mapping1_12.getAsJsonObject("blocks"), mapping1_13.getAsJsonObject("blocks"));
MappingDataLoader.mapIdentifiers(oldToNewItems, mapping1_12.getAsJsonObject("items"), mapping1_13.getAsJsonObject("items"));

View File

@ -23,9 +23,9 @@ public class MappingData {
public static Set<Integer> nonFullBlocks;
public static void init() {
Via.getPlatform().getLogger().info("Loading 1.13.2 -> 1.14 mappings...");
JsonObject mapping1_13_2 = MappingDataLoader.loadData("mapping-1.13.2.json", true);
JsonObject mapping1_14 = MappingDataLoader.loadData("mapping-1.14.json", true);
Via.getPlatform().getLogger().info("Loading 1.13.2 -> 1.14 mappings...");
blockStateMappings = new Mappings(mapping1_13_2.getAsJsonObject("blockstates"), mapping1_14.getAsJsonObject("blockstates"));
blockMappings = new Mappings(mapping1_13_2.getAsJsonObject("blocks"), mapping1_14.getAsJsonObject("blocks"));

View File

@ -14,10 +14,10 @@ public class MappingData {
public static Mappings soundMappings;
public static void init() {
Via.getPlatform().getLogger().info("Loading 1.14.4 -> 1.15 mappings...");
JsonObject diffmapping = MappingDataLoader.loadData("mappingdiff-1.14to1.15.json");
JsonObject mapping1_14 = MappingDataLoader.loadData("mapping-1.14.json", true);
JsonObject mapping1_15 = MappingDataLoader.loadData("mapping-1.15.json", true);
Via.getPlatform().getLogger().info("Loading 1.14.4 -> 1.15 mappings...");
blockStateMappings = new Mappings(mapping1_14.getAsJsonObject("blockstates"), mapping1_15.getAsJsonObject("blockstates"), diffmapping.getAsJsonObject("blockstates"));
blockMappings = new Mappings(mapping1_14.getAsJsonObject("blocks"), mapping1_15.getAsJsonObject("blocks"));

View File

@ -18,10 +18,10 @@ public class MappingData {
public static Mappings soundMappings;
public static void init() {
Via.getPlatform().getLogger().info("Loading 1.15 -> 1.16 mappings...");
JsonObject diffmapping = MappingDataLoader.loadData("mappingdiff-1.15to1.16.json");
JsonObject mapping1_15 = MappingDataLoader.loadData("mapping-1.15.json", true);
JsonObject mapping1_16 = MappingDataLoader.loadData("mapping-1.16.json", true);
Via.getPlatform().getLogger().info("Loading 1.15 -> 1.16 mappings...");
blockStateMappings = new Mappings(mapping1_15.getAsJsonObject("blockstates"), mapping1_16.getAsJsonObject("blockstates"), diffmapping.getAsJsonObject("blockstates"));
blockMappings = new Mappings(mapping1_15.getAsJsonObject("blocks"), mapping1_16.getAsJsonObject("blocks"));