3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-29 01:20:15 +01:00
Dieser Commit ist enthalten in:
KennyTV 2020-03-23 10:40:57 +01:00
Ursprung e658304405
Commit 757654aa9d
5 geänderte Dateien mit 19 neuen und 12 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -33,9 +33,9 @@ public class MappingData {
public static Mappings blockMappings; public static Mappings blockMappings;
public static void init() { 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_12 = MappingDataLoader.loadData("mapping-1.12.json", true);
JsonObject mapping1_13 = MappingDataLoader.loadData("mapping-1.13.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")); blockMappings = new BlockMappingsShortArray(mapping1_12.getAsJsonObject("blocks"), mapping1_13.getAsJsonObject("blocks"));
MappingDataLoader.mapIdentifiers(oldToNewItems, mapping1_12.getAsJsonObject("items"), mapping1_13.getAsJsonObject("items")); MappingDataLoader.mapIdentifiers(oldToNewItems, mapping1_12.getAsJsonObject("items"), mapping1_13.getAsJsonObject("items"));

Datei anzeigen

@ -23,9 +23,9 @@ public class MappingData {
public static Set<Integer> nonFullBlocks; public static Set<Integer> nonFullBlocks;
public static void init() { 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_13_2 = MappingDataLoader.loadData("mapping-1.13.2.json", true);
JsonObject mapping1_14 = MappingDataLoader.loadData("mapping-1.14.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")); blockStateMappings = new Mappings(mapping1_13_2.getAsJsonObject("blockstates"), mapping1_14.getAsJsonObject("blockstates"));
blockMappings = new Mappings(mapping1_13_2.getAsJsonObject("blocks"), mapping1_14.getAsJsonObject("blocks")); blockMappings = new Mappings(mapping1_13_2.getAsJsonObject("blocks"), mapping1_14.getAsJsonObject("blocks"));

Datei anzeigen

@ -14,10 +14,10 @@ public class MappingData {
public static Mappings soundMappings; public static Mappings soundMappings;
public static void init() { 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 diffmapping = MappingDataLoader.loadData("mappingdiff-1.14to1.15.json");
JsonObject mapping1_14 = MappingDataLoader.loadData("mapping-1.14.json", true); JsonObject mapping1_14 = MappingDataLoader.loadData("mapping-1.14.json", true);
JsonObject mapping1_15 = MappingDataLoader.loadData("mapping-1.15.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")); 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")); blockMappings = new Mappings(mapping1_14.getAsJsonObject("blocks"), mapping1_15.getAsJsonObject("blocks"));

Datei anzeigen

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