/GraphLib

Library for helping mods that use graph networks of blocks

Primary LanguageJavaMIT LicenseMIT

GraphLib

Github Release Status Maven Status Javadoc Badge Discord Badge Ko-fi Badge

Library for helping mods that use graph networks, like Wired Redstone.

GraphLib and HCTM-Base

This library is based on HCTM-Base by 2xsaiko and is essentially a rewrite of his block-graph-network code in Java with some optimizations. Credit goes to 2xsaiko for designing this system in the first place.

Commands

All commands can be accessed via the /graphlib command.

/graphlib <universe> debugrender start and /graphlib <universe> debugrender stop

These commands are used for starting and stopping the block graph debug renderer. The debug renderer can help you debug your code that uses GraphLib or figure out why your wires aren't connecting after a server crash.

2022-12-16_14 56 38

/graphlib <universe> updateblocks <from> <to>

This command updates all block-nodes in a given area. If block-nodes were not saved due to a server crash then it may cause some machines or wires to act strange, not transmitting signals correctly. This command will re-connect those machines.

/graphlib <universe> removeemptygraphs

Sometimes a server crash can cause a block-graph to get saved without any block-nodes in it. These empty graphs can clutter up your save file. This command removes these empty graphs.

/graphlib <universe> rebuildchunks <from> <to>

Sometimes a server crash can cause only graphs or only chunk-indexes to be saved but not the other, meaning that the index used to look up which graphs are in which positions could be out of date. This command rebuilds that index for the given chunks.

Note: the command arguments <from> and <to> are block-positions, not chunk positions. Running this command for one block in a 16x16x16 chunk section should fix the entire chunk section.

Depending on GraphLib

GraphLib can be added to a gradle project's dependencies like such:

repositories {
    maven {
        url 'https://kneelawk.com/maven/'
        name 'Kneelawk Maven'
    }
    maven {
        // For LibNetworkStack, if using 'syncing' module
        url 'https://maven.alexiil.uk/'
        name 'AlexIIL Maven'
    }
}

dependencies {
    modImplementation("com.kneelawk.graphlib:core:$graphlibVersion")
    include("com.kneelawk.graphlib:core:$graphlibVersion")
}

where $graphlibVersion is replaced by GraphLib's latest release version.