Back to mods
Thread Weave project artwork

CurseForge · Minecraft mod

Thread Weave

Async processing framework for safe multithreaded simulations

Choose a version Pick your version below, then grab the matching file.

Quick answer

Which Thread Weave release matches 1.21.8 NeoForge?

Updated 4 months ago
Best match for your filters Thread Weave NeoForge-0.2.3
Game version 1.21, 1.21.8, 1.21.5
Loader NeoForge

Thread Weave NeoForge-0.2.3 targets 1.21, 1.21.8, 1.21.5 with NeoForge. The project page does not say whether this file belongs on the client, dedicated server, or both. No extra mods listed for this file.

Where it goes

Is Thread Weave required on the client, server, or both?

The project page does not say whether this file belongs on the client, dedicated server, or both.

Client Source doesn’t say
Dedicated server Source doesn’t say
Loader for this release NeoForge
Required install it here Optional supported, not mandatory Not supported do not install here Source doesn’t say do not assume

The source does not explicitly classify this release as client-only or server-only.

What else does Thread Weave NeoForge-0.2.3 need?

Thread Weave NeoForge-0.2.3 on 1.21.8 NeoForge. Every mod below is checked against that same setup.

No extra mods listed for this file

This file does not list any required mods. Do not add a library just because a different file uses it.

This file does not list any required or optional mods.

Before you install it

Add Thread Weave without breaking your instance.

Built for Thread Weave NeoForge-0.2.3 on 1.21.8 NeoForge. Pick another file and the loader, install side or required mods may change.

  1. 01

    Stick to this file

    Use Thread Weave NeoForge-0.2.3. It targets 1.21, 1.21.8, 1.21.5 with NeoForge; another release may have different loader, side or dependency requirements.

  2. 02

    Bring the mods it needs

    This file does not list any required mods. Do not add a library just because a different file uses it.

  3. 03

    Put it on the correct side

    The project page does not say whether this file belongs on the client, dedicated server, or both.

  4. 04

    Pick the file you checked

    Use the “Get this file” button beside Thread Weave NeoForge-0.2.3. It opens that exact file at the source.

About this project

What does Thread Weave add?

ThreadWeave is a lightweight simulation framework that allows you to move expensive logic from Minecraft thread into other threads while keeping all world modifications thread-safe

- Mod does not modify Minecraft or patch vanilla code. This is library for other mods

  • All world changes are still executed on the main server thread

Isolated simulation does not have Live Level changing access due to race-conditions on threads so it only processes calculations and e.t.c. This may sound useless unless you start to make AI, reactors, computers or more complicated systems like physics Engines.

Execution changes to world like placing blocks will still depend on Minecraft Thread to not create race conditions

Minecraft mods often suffer from:

  • Heavy tick logic on main thread
  • Expensive calculations inside BlockEntities
  • Complex systems (reactors, AI, factories)

ThreadWeave allows you to move only the computation part into async execution while keeping world safety intact

Only pure data is allowed inside simulation methods

Important limitation

Simulation methods must be pure methods:

  • input DTO -> output DTO
  • No side effects allowed inside async execution

How it works?

ThreadWeave works by separating what your mod does into two parts: data processing and world changes

Minecraft normally runs everything on a single thread. That means all calculations, AI, machines, and block logic compete for the same limited performance budget

ThreadWeave changes this by safely moving heavy calculations to background threads

  1. Minecraft Tick
  2. Extract data from BlockEntity
  3. Run simulation in background threads
  4. Get results (updated values)
  5. Apply changes back to world

Modder only defines:

  • What data is used
  • What calculation should happen
  • How results are applied

What ThreadWeave does automatically?

  • Extracts data from BlockEntity
  • Runs calculations on multiple threads
  • Prevents unsafe access to the game world
  • Applies results back safely
  • Manages tick timing (normal or accelerated simulation)

Tick modes

WORLD_SYNCED

Runs in sync with Minecraft (20 times per second)

Used for normal game logic

ISOLATED

Runs independently of Minecraft speed

Used for simulations that can run faster or slower than the game itself

Safety

  • Minecraft world is never accessed from background threads
  • Only simple data is used during calculations
  • All world changes happen safely on the main thread

Framework prevents unsafe access to:

  • Level
  • Entities
  • BlockEntities
  • Server internals

How to use?

Installation Guide

repositories {
    maven {
        url = "https://api.modrinth.com/maven"
    }
}

dependencies {
    implementation "maven.modrinth:thread-weave:{version}"
}

Do not forget to define dependency in mods.toml or you will get minecraft crashed

[[dependencies.${mod_id}]]
modId="thread_weave"
type="required"
versionRange="[{version},)"
ordering="AFTER" // VERY important to load your mod AFTER ThreadWeave
side="BOTH"

For example you have BlockEntity (you can use custom classes. No matter it's minecraft or not)

public class ReactorBlockBE extends BlockEntity implements TickableBE {
    private int heat;
    private int fuel;

    public ReactorBlockBE(BlockPos pos, BlockState state) {
        super(ThreadBlockEntities.REACTOR_BE.get(), pos, state);
    }

    @Override
    public void tick() {
        if (level == null || level.isClientSide()) return;
        heat+=20;
        fuel-=1;
    }
}

I - You need to set what variables will be used in async-processing

public record ReactorData(int heat, int fuel) implements SimulationDelta {}

II - Then you need to split your processing. Simply take all of your calculations and move it to other method. Here you need to set @SimulatedThread annotation. TickMode can be Isolated or WorldSynced. WorldSynced will run at minecraft TPS. Isolated will run at any tick speed you set without minecraft dependency

    //value = MOD_ID + ":reactor"
    //value = "my_mod:reactor"
    @SimulatedThread(value = MOD_ID + ":reactor", mode = TickMode.WORLD_SYNCED)
    public ReactorData simulate(ReactorData data) {
        int heat = data.heat() + 20;
        int fuel = data.fuel() - 1;
        return new ReactorData(heat, fuel);
    }

III - Last you need to submit your data to framework. Use static method "submit"

    @Override
    public void tick() {
        if (level == null || level.isClientSide()) return;

        Simulations.submit(this);
        System.out.println("heat=" + this.getHeat() + " fuel=" + this.getFuel());
    }

IV - Also you need set what classes that will be scanned for @SimulatedThread annotation

    public YourMainModClass(IEventBus modEventBus, ModContainer modContainer) {
        modEventBus.addListener(this::commonSetup);
        Simulations.submitScan(NavMeshSimulation.class);
        ...
    }

You can also manually control interpreter and extractor by @SimulatedInterpreter and @SimulatedExtractor annotations

For example: work ticks

    @SimulatedThread(value = MOD_ID + ":reactor", mode = TickMode.WORLD_SYNCED)
    public ReactorData simulate(ReactorData data) {
        int heat = data.heat() + 20;
        int fuel = data.fuel() - 1;
        return new ReactorData(heat, fuel);
    }

    @SimulatedInterpreter
    public void interpreter(NavData data) {
        this.heat = data.heat();
        this.fuel = data.fuel();
        workTicks++;
    }

Example above is not the best. Custom interpreter is much usable in per-region processing when you need to merge result (Baked Navmesh generation)

    @SimulatedThread(value = MOD_ID + ":navgraph", mode = TickMode.WORLD_SYNCED)
    public NavData simulate(NavProcessorData data) {
        if (processor.isEmpty()) return null;
        return processor.build(navLevel);
    }

    @SimulatedInterpreter
    public void interpreter(NavData data) {
        if (data == null) return;
        for (NavNode node : data.toRemove()) {
            navLevel.nodes.remove(node.id());
        }
        navLevel.nodes.putAll(data.nodes());
        navLevel.portals.putAll(data.portals());
        navLevel.chunkIndices.putAll(data.chunkIndices());
    }

Is this peak optimisation?

No. There is still much work to do. You can follow progress in my discord server

For example most of TickingBlockEntities is not really good with this library due to Level require (Yet)

P.S: I will post a fabric port + other versions later [1.7.10 - 26.x]

Project description from CurseForge.

Pick your setup

Thread Weave by Minecraft version and loader

Choose the version and loader you play, then open the matching release.

12 available setups

Check the dependencies, then try the file in a copied instance before changing a world you care about.

Recent files

Thread Weave versions and loaders

3 of 3 releases match
Clear filters

Looking for an older file? The official CurseForge project page is in Resources.