net.minecraftforge.fml.DistExecutor Java Examples

The following examples show how to use net.minecraftforge.fml.DistExecutor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PatchworkFML.java    From patchwork-api with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void onInitialize() {
	ServerStartCallback.EVENT.register(server -> LogicalSidedProvider.setServer(() -> server));
	ServerStopCallback.EVENT.register(server -> LogicalSidedProvider.setServer(null));

	Object instance = FabricLoader.getInstance().getGameInstance();

	DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> LogicalSidedProvider.setClient(() -> (MinecraftClient) instance));
	DistExecutor.runWhenOn(Dist.DEDICATED_SERVER, () -> () -> LogicalSidedProvider.setServer(() -> (MinecraftServer) instance));
}
 
Example #2
Source File: CodeChickenLib.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
public CodeChickenLib() {
    proxy = DistExecutor.runForDist(() -> ProxyClient::new, () -> Proxy::new);
    FMLJavaModLoadingContext.get().getModEventBus().register(this);
    DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
        FMLJavaModLoadingContext.get().getModEventBus().addListener(OpenGLUtils::onModelRegistryEvent);
    });
}
 
Example #3
Source File: PacketDurabilitySync.java    From MiningGadgets with MIT License 4 votes vote down vote up
public static void handle(PacketDurabilitySync msg, Supplier<NetworkEvent.Context> ctx) {
    ctx.get().enqueueWork(() -> DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> clientPacketHandler(msg)));
    ctx.get().setPacketHandled(true);
}
 
Example #4
Source File: EnderStorage.java    From EnderStorage with MIT License 4 votes vote down vote up
public EnderStorage() {
    proxy = DistExecutor.runForDist(() -> ProxyClient::new, () -> Proxy::new);
    FMLJavaModLoadingContext.get().getModEventBus().register(this);
    EnderStorageConfig.load();
}