mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2025-01-02 18:17:36 +01:00
19w03c
This commit is contained in:
parent
9bc592aa6f
commit
ac1cdf1b83
@ -35,13 +35,13 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
shade('us.myles:viaversion:2.0.0-19w03a') {
|
shade('us.myles:viaversion:2.0.0-19w03c') {
|
||||||
transitive = false
|
transitive = false
|
||||||
changing = true
|
changing = true
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft "com.mojang:minecraft:19w03a"
|
minecraft "com.mojang:minecraft:19w03c"
|
||||||
mappings "net.fabricmc:yarn:19w03a.3"
|
mappings "net.fabricmc:yarn:19w03c.1"
|
||||||
modCompile "net.fabricmc:fabric-loader:0.3.2.96"
|
modCompile "net.fabricmc:fabric-loader:0.3.2.96"
|
||||||
|
|
||||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||||
|
@ -37,10 +37,20 @@ import org.apache.logging.log4j.LogManager;
|
|||||||
import us.myles.ViaVersion.ViaManager;
|
import us.myles.ViaVersion.ViaManager;
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ThreadFactory;
|
||||||
|
|
||||||
public class ViaFabric implements ClientModInitializer {
|
public class ViaFabric implements ClientModInitializer {
|
||||||
public static final java.util.logging.Logger JLOGGER = new JLoggerToLog4j(LogManager.getLogger("ViaFabric"));
|
public static final java.util.logging.Logger JLOGGER = new JLoggerToLog4j(LogManager.getLogger("ViaFabric"));
|
||||||
public static final EventLoop EVENT_LOOP = new DefaultEventLoop(new ThreadFactoryBuilder()
|
public static final ExecutorService ASYNC_EXECUTOR;
|
||||||
.setNameFormat("ViaFabric").build());
|
public static final EventLoop EVENT_LOOP;
|
||||||
|
|
||||||
|
static {
|
||||||
|
ThreadFactory factory = new ThreadFactoryBuilder().setNameFormat("ViaFabric").build();
|
||||||
|
ASYNC_EXECUTOR = Executors.newCachedThreadPool(factory);
|
||||||
|
EVENT_LOOP = new DefaultEventLoop(factory);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
|
@ -27,7 +27,6 @@ package com.github.creeper123123321.viafabric.platform;
|
|||||||
import com.github.creeper123123321.viafabric.ViaFabric;
|
import com.github.creeper123123321.viafabric.ViaFabric;
|
||||||
import com.github.creeper123123321.viafabric.protocol.Interceptor;
|
import com.github.creeper123123321.viafabric.protocol.Interceptor;
|
||||||
import com.github.creeper123123321.viafabric.util.FutureTaskId;
|
import com.github.creeper123123321.viafabric.util.FutureTaskId;
|
||||||
import com.github.creeper123123321.viafabric.util.ManagedBlockerRunnable;
|
|
||||||
import net.fabricmc.loader.FabricLoader;
|
import net.fabricmc.loader.FabricLoader;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
@ -48,7 +47,6 @@ import us.myles.viaversion.libs.gson.JsonObject;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ForkJoinPool;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@ -81,30 +79,24 @@ public class VRPlatform implements ViaPlatform {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TaskId runAsync(Runnable runnable) {
|
public TaskId runAsync(Runnable runnable) {
|
||||||
return new FutureTaskId(
|
return new FutureTaskId(CompletableFuture
|
||||||
CompletableFuture
|
.runAsync(runnable, ViaFabric.ASYNC_EXECUTOR)
|
||||||
.runAsync(() -> {
|
.exceptionally(throwable -> {
|
||||||
try {
|
throwable.printStackTrace();
|
||||||
ForkJoinPool.managedBlock(new ManagedBlockerRunnable(runnable));
|
return null;
|
||||||
} catch (InterruptedException e) {
|
})
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}).exceptionally(ex -> {
|
|
||||||
if (ex != null) ex.printStackTrace();
|
|
||||||
return null;
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TaskId runSync(Runnable runnable) {
|
public TaskId runSync(Runnable runnable) {
|
||||||
return new FutureTaskId(
|
return new FutureTaskId(ViaFabric.EVENT_LOOP
|
||||||
CompletableFuture
|
.submit(runnable)
|
||||||
.runAsync(runnable)
|
.addListener(future -> {
|
||||||
.exceptionally(ex -> {
|
if (!future.isSuccess()) {
|
||||||
if (ex != null) ex.printStackTrace();
|
future.cause().printStackTrace();
|
||||||
return null;
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user