├── .editorconfig ├── .github └── workflows │ ├── build.yml │ ├── prerelease.yml │ └── release.yml ├── .gitignore ├── LICENSE ├── README.md ├── build.gradle.kts ├── buildSrc ├── build.gradle.kts ├── gradle.properties ├── settings.gradle.kts └── src │ └── main │ └── kotlin │ └── com │ └── kneelawk │ ├── mojmap │ ├── MojmapExtension.kt │ └── MojmapPlugin.kt │ └── utils.kt ├── changelogs ├── changelog-v0.1.0+1.18.2.md ├── changelog-v0.1.1+1.18.2.md ├── changelog-v0.1.2+1.18.2.md ├── changelog-v0.1.3+1.18.2.md ├── changelog-v0.1.4+1.18.2.md ├── changelog-v0.1.5+1.18.2.md ├── changelog-v0.1.6+1.18.2.md ├── changelog-v0.2.0+1.18.2.md ├── changelog-v0.2.1+1.18.2.md ├── changelog-v0.2.2+1.18.2.md ├── changelog-v0.2.3+1.18.2.md ├── changelog-v0.2.4+1.18.2.md ├── changelog-v0.3.0+1.19.md ├── changelog-v0.3.1+1.19.md ├── changelog-v0.3.2+1.19.md ├── changelog-v0.3.3+1.19.md ├── changelog-v0.4.0+1.19.3.md ├── changelog-v0.4.1+1.19.3.md ├── changelog-v0.4.2+1.19.3.md ├── changelog-v0.4.3+1.19.3.md ├── changelog-v0.4.4+1.19.3.md ├── changelog-v1.0.0+1.20.md ├── changelog-v1.1.0+1.20.md ├── changelog-v1.1.1+1.20.md ├── changelog-v1.2.0+1.20.md ├── changelog-v1.3.0+1.20.md ├── changelog-v1.3.1+1.20.md ├── changelog-v1.3.2+1.20.md ├── changelog-v1.4.0+1.20.2.md ├── changelog-v1.4.0+1.20.4.md ├── changelog-v1.4.0+1.20.md ├── changelog-v2.0.0+1.21.md ├── changelog-v2.0.1+1.21.md ├── changelog-v2.0.2+1.21.md └── changelog-v2.0.3+1.21.md ├── examples └── multiblock-lamps │ ├── README.md │ ├── build.gradle.kts │ ├── fabric │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── kneelawk │ │ │ └── multiblocklamps │ │ │ └── fabric │ │ │ ├── MLPlatformImpl.java │ │ │ └── MultiblockLampsFabric.java │ │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ └── com.kneelawk.multiblocklamps.MLPlatform │ │ └── fabric.mod.json │ ├── neoforge │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── kneelawk │ │ │ └── multiblocklamps │ │ │ └── neoforge │ │ │ ├── MLPlatformImpl.java │ │ │ └── MultiblockLampsNeoForge.java │ │ └── resources │ │ ├── META-INF │ │ ├── neoforge.mods.toml │ │ └── services │ │ │ └── com.kneelawk.multiblocklamps.MLPlatform │ │ └── pack.mcmeta │ └── xplat │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ └── main │ ├── java │ └── com │ │ └── kneelawk │ │ └── multiblocklamps │ │ ├── LampLogic.java │ │ ├── MLPlatform.java │ │ ├── MultiblockLamps.java │ │ ├── block │ │ ├── ConnectableBlock.java │ │ ├── ConnectedLampBlock.java │ │ └── LampConnectorBlock.java │ │ └── node │ │ ├── ConnectedLampNode.java │ │ ├── LampConnectorNode.java │ │ ├── LampInputNode.java │ │ └── LampNode.java │ └── resources │ └── assets │ └── multiblock_lamps │ ├── blockstates │ ├── connected_lamp.json │ └── lamp_connector.json │ ├── icon-128.png │ ├── lang │ └── en_us.json │ ├── models │ ├── block │ │ ├── connected_lamp.json │ │ ├── connected_lamp_on.json │ │ └── lamp_connector.json │ └── item │ │ ├── connected_lamp.json │ │ └── lamp_connector.json │ └── textures │ └── block │ ├── connected_lamp.png │ ├── connected_lamp_on.png │ └── lamp_connector.png ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── javadoc-options.txt ├── javadoc ├── fabric │ ├── build.gradle.kts │ └── gradle.properties ├── neoforge │ ├── build.gradle.kts │ └── gradle.properties └── xplat │ ├── build.gradle.kts │ └── gradle.properties ├── modules ├── core-fabric │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── kneelawk │ │ │ └── graphlib │ │ │ └── fabric │ │ │ └── impl │ │ │ └── GraphLibFabricMod.java │ │ └── resources │ │ └── fabric.mod.json ├── core-neoforge │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── kneelawk │ │ │ └── graphlib │ │ │ └── neoforge │ │ │ └── impl │ │ │ └── GraphLibNeoForgeMod.java │ │ └── resources │ │ └── META-INF │ │ └── neoforge.mods.toml ├── core-xplat-mojmap │ ├── build.gradle.kts │ └── gradle.properties ├── core-xplat │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── kneelawk │ │ │ │ └── graphlib │ │ │ │ ├── api │ │ │ │ ├── GraphLib.java │ │ │ │ ├── event │ │ │ │ │ └── GraphLibEvents.java │ │ │ │ ├── graph │ │ │ │ │ ├── BlockGraph.java │ │ │ │ │ ├── GraphEntityContext.java │ │ │ │ │ ├── GraphUniverse.java │ │ │ │ │ ├── GraphView.java │ │ │ │ │ ├── GraphWorld.java │ │ │ │ │ ├── LinkEntityContext.java │ │ │ │ │ ├── LinkHolder.java │ │ │ │ │ ├── NodeEntityContext.java │ │ │ │ │ ├── NodeHolder.java │ │ │ │ │ ├── SnapshotNode.java │ │ │ │ │ └── user │ │ │ │ │ │ ├── AbstractGraphEntity.java │ │ │ │ │ │ ├── AbstractLinkEntity.java │ │ │ │ │ │ ├── AbstractNodeEntity.java │ │ │ │ │ │ ├── BlockNode.java │ │ │ │ │ │ ├── BlockNodeDiscoverer.java │ │ │ │ │ │ ├── BlockNodeType.java │ │ │ │ │ │ ├── GraphEntity.java │ │ │ │ │ │ ├── GraphEntityFactory.java │ │ │ │ │ │ ├── GraphEntitySplitter.java │ │ │ │ │ │ ├── GraphEntityType.java │ │ │ │ │ │ ├── LinkEntity.java │ │ │ │ │ │ ├── LinkEntityType.java │ │ │ │ │ │ ├── LinkKey.java │ │ │ │ │ │ ├── LinkKeyType.java │ │ │ │ │ │ ├── NodeEntity.java │ │ │ │ │ │ ├── NodeEntityType.java │ │ │ │ │ │ ├── SidedBlockNode.java │ │ │ │ │ │ └── package-info.java │ │ │ │ ├── util │ │ │ │ │ ├── CacheCategory.java │ │ │ │ │ ├── ChunkPillarUnloadTimer.java │ │ │ │ │ ├── ChunkSectionUnloadTimer.java │ │ │ │ │ ├── ChunkUnloadTimer.java │ │ │ │ │ ├── ColorUtils.java │ │ │ │ │ ├── DirectionUtils.java │ │ │ │ │ ├── EmptyLinkKey.java │ │ │ │ │ ├── HalfLink.java │ │ │ │ │ ├── InUniverse.java │ │ │ │ │ ├── LinkPos.java │ │ │ │ │ ├── NodePos.java │ │ │ │ │ ├── ObjectType.java │ │ │ │ │ ├── SidedPos.java │ │ │ │ │ └── graph │ │ │ │ │ │ ├── Graph.java │ │ │ │ │ │ ├── Link.java │ │ │ │ │ │ └── Node.java │ │ │ │ ├── wire │ │ │ │ │ ├── CenterWireBlockNode.java │ │ │ │ │ ├── CenterWireConnectionFilter.java │ │ │ │ │ ├── FullWireBlockNode.java │ │ │ │ │ ├── FullWireConnectionFilter.java │ │ │ │ │ ├── LinkKeyFactory.java │ │ │ │ │ ├── SidedFaceBlockNode.java │ │ │ │ │ ├── SidedFaceConnectionFilter.java │ │ │ │ │ ├── SidedWireBlockNode.java │ │ │ │ │ ├── SidedWireConnectionFilter.java │ │ │ │ │ ├── WireConnectionDiscoverers.java │ │ │ │ │ ├── WireConnectionFilter.java │ │ │ │ │ └── WireConnectionType.java │ │ │ │ └── world │ │ │ │ │ ├── RegionBasedStorage.java │ │ │ │ │ ├── SaveMode.java │ │ │ │ │ ├── TrackingChunkFactory.java │ │ │ │ │ └── UnloadingRegionBasedStorage.java │ │ │ │ └── impl │ │ │ │ ├── Constants.java │ │ │ │ ├── GLLog.java │ │ │ │ ├── GraphLibImpl.java │ │ │ │ ├── command │ │ │ │ └── GraphLibCommand.java │ │ │ │ ├── event │ │ │ │ └── InternalEvents.java │ │ │ │ ├── graph │ │ │ │ ├── BlockGraphImpl.java │ │ │ │ ├── GraphUniverseImpl.java │ │ │ │ ├── GraphWorldStorage.java │ │ │ │ ├── RebuildChunksListener.java │ │ │ │ ├── ServerGraphWorldImpl.java │ │ │ │ ├── ServerGraphWorldStorage.java │ │ │ │ ├── listener │ │ │ │ │ ├── UniverseListener.java │ │ │ │ │ └── WorldListener.java │ │ │ │ └── simple │ │ │ │ │ ├── SimpleBlockGraph.java │ │ │ │ │ ├── SimpleBlockGraphChunk.java │ │ │ │ │ ├── SimpleBlockGraphPillar.java │ │ │ │ │ ├── SimpleGraphCollection.java │ │ │ │ │ ├── SimpleGraphEntityContext.java │ │ │ │ │ ├── SimpleGraphUniverse.java │ │ │ │ │ ├── SimpleGraphUniverseBuilder.java │ │ │ │ │ ├── SimpleLinkEntityContext.java │ │ │ │ │ ├── SimpleLinkHolder.java │ │ │ │ │ ├── SimpleNodeEntityContext.java │ │ │ │ │ ├── SimpleNodeHolder.java │ │ │ │ │ ├── SimpleNodeWrapper.java │ │ │ │ │ └── SimpleServerGraphWorld.java │ │ │ │ ├── mixin │ │ │ │ ├── api │ │ │ │ │ ├── GraphWorldStorageAccess.java │ │ │ │ │ └── StorageHelper.java │ │ │ │ └── impl │ │ │ │ │ ├── StorageIoWorkerAccessor.java │ │ │ │ │ └── ThreadedChunkManagerMixin.java │ │ │ │ └── util │ │ │ │ ├── ClassUtils.java │ │ │ │ ├── DefaultHashStrategy.java │ │ │ │ └── ReadOnlyMappingCollection.java │ │ └── resources │ │ │ ├── assets │ │ │ └── graphlib │ │ │ │ ├── icon-128.png │ │ │ │ ├── icon-256.png │ │ │ │ ├── icon-512.png │ │ │ │ └── lang │ │ │ │ └── en_us.json │ │ │ ├── graphlib-common.mixins.json │ │ │ └── pack.mcmeta │ │ └── test │ │ └── java │ │ └── com │ │ └── kneelawk │ │ └── graphlib │ │ └── api │ │ └── util │ │ ├── LinkPosEqualityTests.java │ │ └── graph │ │ ├── GraphMergeTests.java │ │ ├── GraphSplitTests.java │ │ └── LinkEqualityTests.java ├── core │ └── README.md ├── debugrender-fabric │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── kneelawk │ │ │ └── graphlib │ │ │ └── debugrender │ │ │ └── fabric │ │ │ └── impl │ │ │ ├── GLDRPlatformImpl.java │ │ │ ├── GraphLibDebugRenderFabricMod.java │ │ │ └── client │ │ │ └── GraphLibDebugRenderFabricModClient.java │ │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ └── com.kneelawk.graphlib.debugrender.impl.GLDRPlatform │ │ └── fabric.mod.json ├── debugrender-neoforge │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── kneelawk │ │ │ └── graphlib │ │ │ └── debugrender │ │ │ └── neoforge │ │ │ └── impl │ │ │ ├── GLDRPlatformImpl.java │ │ │ ├── GraphLibDebugRenderNeoforgeMod.java │ │ │ └── client │ │ │ ├── GLDRModClient.java │ │ │ └── GLDRRenderClient.java │ │ └── resources │ │ └── META-INF │ │ ├── accesstransformer.cfg │ │ ├── neoforge.mods.toml │ │ └── services │ │ └── com.kneelawk.graphlib.debugrender.impl.GLDRPlatform ├── debugrender-xplat-mojmap │ ├── build.gradle.kts │ └── gradle.properties ├── debugrender-xplat │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── kneelawk │ │ │ └── graphlib │ │ │ └── debugrender │ │ │ ├── api │ │ │ ├── GraphLibDebugRender.java │ │ │ ├── client │ │ │ │ ├── BlockNodeDebugPacketDecoder.java │ │ │ │ ├── ClientBlockNodeHolder.java │ │ │ │ ├── DebugBlockGraph.java │ │ │ │ ├── GraphLibDebugRenderClient.java │ │ │ │ └── render │ │ │ │ │ ├── BlockNodeDebugRenderer.java │ │ │ │ │ └── RenderUtils.java │ │ │ └── graph │ │ │ │ ├── BlockNodeDebugPacketEncoder.java │ │ │ │ ├── DebugBlockNode.java │ │ │ │ ├── SidedDebugBlockNode.java │ │ │ │ └── package-info.java │ │ │ └── impl │ │ │ ├── GLDRPlatform.java │ │ │ ├── GLDebugNet.java │ │ │ ├── GraphLibDebugRenderImpl.java │ │ │ ├── client │ │ │ ├── GLClientDebugNet.java │ │ │ ├── GraphLibDebugRenderClientImpl.java │ │ │ └── debug │ │ │ │ ├── graph │ │ │ │ ├── SimpleDebugBlockGraph.java │ │ │ │ ├── SimpleDebugBlockNode.java │ │ │ │ └── SimpleDebugSidedBlockNode.java │ │ │ │ └── render │ │ │ │ ├── BlockNodeDebugRendererHolder.java │ │ │ │ ├── DebugRenderer.java │ │ │ │ ├── SimpleBlockNodeDebugRenderer.java │ │ │ │ └── SimpleSidedBlockNodeDebugRenderer.java │ │ │ ├── command │ │ │ └── GraphLibDebugRenderCommand.java │ │ │ ├── mixin │ │ │ ├── api │ │ │ │ └── RenderLayerHelper.java │ │ │ └── impl │ │ │ │ └── RenderLayerAccessor.java │ │ │ └── payload │ │ │ ├── DebuggingStopPayload.java │ │ │ ├── GraphDestroyPayload.java │ │ │ ├── GraphUpdateBulkPayload.java │ │ │ ├── GraphUpdatePayload.java │ │ │ ├── PayloadGraph.java │ │ │ ├── PayloadHeader.java │ │ │ ├── PayloadLink.java │ │ │ └── PayloadNode.java │ │ └── resources │ │ ├── assets │ │ └── graphlib_debugrender │ │ │ └── icon-128.png │ │ ├── common-events.json │ │ ├── graphlib_debugrender.mixins.json │ │ └── pack.mcmeta ├── debugrender │ └── README.md ├── syncing-core-fabric │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── kneelawk │ │ │ └── graphlib │ │ │ └── syncing │ │ │ └── fabric │ │ │ └── impl │ │ │ ├── GraphLibSyncingFabricMod.java │ │ │ └── client │ │ │ └── GraphLibSyncingFabricModClient.java │ │ └── resources │ │ └── fabric.mod.json ├── syncing-core-neoforge │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── kneelawk │ │ │ └── graphlib │ │ │ └── syncing │ │ │ └── neoforge │ │ │ └── impl │ │ │ ├── GraphLibSyncingNeoforgeMod.java │ │ │ └── client │ │ │ ├── GraphLibSyncingNeoforgeEvents.java │ │ │ └── GraphLibSyncingNeoforgeModClient.java │ │ └── resources │ │ └── META-INF │ │ └── neoforge.mods.toml ├── syncing-core-xplat-mojmap │ ├── build.gradle.kts │ └── gradle.properties ├── syncing-core-xplat │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── kneelawk │ │ │ └── graphlib │ │ │ └── syncing │ │ │ ├── api │ │ │ ├── GraphLibSyncing.java │ │ │ ├── graph │ │ │ │ ├── SyncedUniverse.java │ │ │ │ └── user │ │ │ │ │ ├── PlayerSyncFilter.java │ │ │ │ │ └── SyncProfile.java │ │ │ └── util │ │ │ │ └── ObjectSyncing.java │ │ │ └── impl │ │ │ ├── CommonProxy.java │ │ │ ├── GraphLibSyncingImpl.java │ │ │ ├── SyncedConstants.java │ │ │ ├── client │ │ │ └── ClientProxy.java │ │ │ ├── graph │ │ │ ├── ClientGraphWorldImpl.java │ │ │ ├── ClientGraphWorldStorage.java │ │ │ ├── SyncedUniverseImpl.java │ │ │ └── simple │ │ │ │ ├── SimpleClientGraphChunkManager.java │ │ │ │ └── SimpleClientGraphWorld.java │ │ │ └── mixin │ │ │ ├── api │ │ │ ├── ClientGraphWorldStorageAccess.java │ │ │ └── ClientStorageHelper.java │ │ │ └── impl │ │ │ ├── ClientChunkManagerMixin.java │ │ │ └── ServerChunkSenderMixin.java │ │ └── resources │ │ ├── assets │ │ └── graphlib_syncing │ │ │ └── icon-128.png │ │ ├── graphlib_syncing.mixins.json │ │ └── pack.mcmeta ├── syncing-core │ └── README.md ├── syncing-knet-fabric │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── kneelawk │ │ │ └── graphlib │ │ │ └── syncing │ │ │ └── knet │ │ │ └── fabric │ │ │ └── impl │ │ │ └── GraphLibSyncingKNetFabricMod.java │ │ └── resources │ │ └── fabric.mod.json ├── syncing-knet-neoforge │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── kneelawk │ │ │ └── graphlib │ │ │ └── syncing │ │ │ └── knet │ │ │ └── neoforge │ │ │ └── impl │ │ │ └── GraphLibSyncingKNetNeoforgeMod.java │ │ └── resources │ │ └── META-INF │ │ └── neoforge.mods.toml ├── syncing-knet-xplat-mojmap │ ├── build.gradle.kts │ └── gradle.properties ├── syncing-knet-xplat │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── kneelawk │ │ │ └── graphlib │ │ │ └── syncing │ │ │ └── knet │ │ │ ├── api │ │ │ ├── SyncingKNet.java │ │ │ ├── graph │ │ │ │ ├── KNetSyncedUniverse.java │ │ │ │ └── user │ │ │ │ │ ├── BlockNodeSyncing.java │ │ │ │ │ ├── GraphEntitySyncing.java │ │ │ │ │ ├── LinkEntitySyncing.java │ │ │ │ │ ├── LinkKeySyncing.java │ │ │ │ │ └── NodeEntitySyncing.java │ │ │ └── util │ │ │ │ ├── IdPaletteUtils.java │ │ │ │ └── InSyncedUniverse.java │ │ │ └── impl │ │ │ ├── KNetChannels.java │ │ │ ├── KNetDecoding.java │ │ │ ├── KNetEncoding.java │ │ │ ├── StreamCodecHelper.java │ │ │ ├── SyncingKNetImpl.java │ │ │ ├── graph │ │ │ ├── KNetWorldListener.java │ │ │ └── simple │ │ │ │ ├── SimpleKNetSyncedUniverse.java │ │ │ │ └── SimpleKNetSyncedUniverseBuilder.java │ │ │ └── payload │ │ │ ├── ChunkDataPayload.java │ │ │ ├── LinkPayload.java │ │ │ ├── MergePayload.java │ │ │ ├── NodeAddPayload.java │ │ │ ├── NodeRemovePayload.java │ │ │ ├── PayloadExternalLink.java │ │ │ ├── PayloadGraph.java │ │ │ ├── PayloadInternalLink.java │ │ │ ├── PayloadNode.java │ │ │ ├── SplitPayload.java │ │ │ └── UnlinkPayload.java │ │ └── resources │ │ ├── assets │ │ └── graphlib_syncing_knet │ │ │ └── icon-128.png │ │ └── pack.mcmeta ├── syncing-knet │ └── README.md └── syncing-lns │ ├── README.md │ ├── build.gradle.kts │ ├── gradle.properties │ └── src │ └── main │ ├── java │ └── com │ │ └── kneelawk │ │ └── graphlib │ │ └── syncing │ │ └── lns │ │ ├── api │ │ ├── SyncingLNS.java │ │ └── graph │ │ │ ├── LNSSyncedUniverse.java │ │ │ └── user │ │ │ ├── BlockNodePacketDecoder.java │ │ │ ├── BlockNodePacketEncoder.java │ │ │ ├── BlockNodeSyncing.java │ │ │ ├── GraphEntityPacketDecoder.java │ │ │ ├── GraphEntityPacketEncoder.java │ │ │ ├── GraphEntitySyncing.java │ │ │ ├── LinkEntityPacketDecoder.java │ │ │ ├── LinkEntityPacketEncoder.java │ │ │ ├── LinkEntitySyncing.java │ │ │ ├── LinkKeyPacketDecoder.java │ │ │ ├── LinkKeyPacketEncoder.java │ │ │ ├── LinkKeySyncing.java │ │ │ ├── NodeEntityPacketDecoder.java │ │ │ ├── NodeEntityPacketEncoder.java │ │ │ └── NodeEntitySyncing.java │ │ └── impl │ │ ├── GraphLibSyncingLNSFabricMod.java │ │ ├── LNSDecoding.java │ │ ├── LNSEncoding.java │ │ ├── LNSNetworking.java │ │ └── graph │ │ ├── LNSWorldListener.java │ │ └── simple │ │ ├── SimpleLNSSyncedUniverse.java │ │ └── SimpleLNSSyncedUniverseBuilder.java │ └── resources │ ├── assets │ └── graphlib_syncing_lns │ │ └── icon-128.png │ └── fabric.mod.json ├── remapCheck └── build.gradle.kts └── settings.gradle.kts /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: [ pull_request, push ] 4 | 5 | jobs: 6 | build: 7 | strategy: 8 | matrix: 9 | java: [ 10 | 21 # Current LTS 11 | ] 12 | os: [ ubuntu-latest ] 13 | runs-on: ${{ matrix.os }} 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v4 17 | - name: Validate Gradle Wrapper 18 | uses: gradle/actions/wrapper-validation@v3 19 | - name: Gradle Cache 20 | uses: actions/cache@v4 21 | with: 22 | path: | 23 | ~/.gradle/caches 24 | ~/.gradle/wrapper 25 | .gradle/loom-cache 26 | build/ 27 | */build/ 28 | */*/build/ 29 | key: ${{ runner.os }}-jdk${{ matrix.java }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties', '**/gradle-wrapper.properties', '.github/workflows/build.yml') }} 30 | - name: Setup JDK ${{ matrix.java }} 31 | uses: actions/setup-java@v4 32 | with: 33 | distribution: 'temurin' 34 | java-version: ${{ matrix.java }} 35 | - name: Make Gradle Wrapper Executable 36 | if: ${{ runner.os != 'Windows' }} 37 | run: chmod +x ./gradlew 38 | - name: Build 39 | run: ./gradlew build --no-daemon 40 | env: 41 | JAVA_VERSION: ${{ matrix.java }} # override default toolchain version 42 | - name: Capture Build Artifacts 43 | if: ${{ runner.os == 'Linux' && matrix.java == '21' }} 44 | uses: actions/upload-artifact@v4 45 | with: 46 | name: Artifacts 47 | path: build/libs/ 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build/ 3 | !gradle/wrapper/gradle-wrapper.jar 4 | !**/src/main/**/build/ 5 | !**/src/test/**/build/ 6 | 7 | ### Loom ### 8 | run/ 9 | !**/src/main/**/run/ 10 | !**/src/test/**/run/ 11 | /.architectury-transformer/ 12 | 13 | ### IntelliJ IDEA ### 14 | /.idea/ 15 | *.iws 16 | *.iml 17 | *.ipr 18 | logs/ 19 | !**/src/main/**/logs/ 20 | !**/src/test/**/logs/ 21 | out/ 22 | !**/src/main/**/out/ 23 | !**/src/test/**/out/ 24 | 25 | ### Eclipse ### 26 | .apt_generated 27 | .classpath 28 | .factorypath 29 | .project 30 | .settings 31 | .springBeans 32 | .sts4-cache 33 | bin/ 34 | !**/src/main/**/bin/ 35 | !**/src/test/**/bin/ 36 | 37 | ### NetBeans ### 38 | /nbproject/private/ 39 | /nbbuild/ 40 | /dist/ 41 | /nbdist/ 42 | /.nb-gradle/ 43 | 44 | ### VS Code ### 45 | .vscode/ 46 | 47 | ### Mac OS ### 48 | .DS_Store 49 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Cyan Kneelawk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("fabric-loom") apply false 3 | id("com.kneelawk.submodule") apply false 4 | id("com.kneelawk.mojmap") apply false 5 | id("com.kneelawk.versioning") apply false 6 | id("com.kneelawk.kpublish") apply false 7 | } 8 | 9 | tasks.create("clean", Delete::class) { 10 | delete(rootProject.layout.buildDirectory) 11 | } 12 | 13 | allprojects { 14 | // make builds reproducible 15 | tasks.withType().configureEach { 16 | isPreserveFileTimestamps = false 17 | isReproducibleFileOrder = true 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("java-gradle-plugin") 3 | kotlin("jvm") version "1.9.20" 4 | `kotlin-dsl` 5 | } 6 | 7 | repositories { 8 | mavenCentral() 9 | gradlePluginPortal() 10 | maven("https://maven.fabricmc.net/") { name = "Fabric" } 11 | maven("https://maven.architectury.dev/") { name = "Architectury" } 12 | maven("https://maven.quiltmc.org/repository/release") { name = "Quilt" } 13 | maven("https://maven.neoforged.net/releases/") { name = "NeoForged" } 14 | maven("https://kneelawk.com/maven") { name = "Kneelawk" } 15 | } 16 | 17 | dependencies { 18 | val architectury_loom_version: String by project 19 | implementation("dev.architectury.loom:dev.architectury.loom.gradle.plugin:$architectury_loom_version") 20 | } 21 | 22 | gradlePlugin { 23 | plugins { 24 | create("mojmapPlugin") { 25 | id = "com.kneelawk.mojmap" 26 | implementationClass = "com.kneelawk.mojmap.MojmapPlugin" 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /buildSrc/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | # Gradle Plugins 27 | architectury_loom_version = 1.6-SNAPSHOT 28 | -------------------------------------------------------------------------------- /buildSrc/settings.gradle.kts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kneelawk/GraphLib/bcd35d39e7b20d1d34686be9a1fdbfbc09d978f4/buildSrc/settings.gradle.kts -------------------------------------------------------------------------------- /buildSrc/src/main/kotlin/com/kneelawk/mojmap/MojmapPlugin.kt: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Emi 2 | // MIT License 3 | 4 | package com.kneelawk.mojmap 5 | 6 | import com.kneelawk.getProperty 7 | import net.fabricmc.loom.api.LoomGradleExtensionAPI 8 | import org.gradle.api.Plugin 9 | import org.gradle.api.Project 10 | import org.gradle.api.plugins.BasePluginExtension 11 | import org.gradle.api.tasks.bundling.AbstractArchiveTask 12 | import org.gradle.kotlin.dsl.dependencies 13 | import org.gradle.kotlin.dsl.getByType 14 | import org.gradle.kotlin.dsl.named 15 | 16 | class MojmapPlugin : Plugin { 17 | override fun apply(project: Project) { 18 | project.plugins.apply("dev.architectury.loom") 19 | 20 | val baseEx = project.extensions.getByType(BasePluginExtension::class) 21 | val loomEx = project.extensions.getByType(LoomGradleExtensionAPI::class) 22 | 23 | project.extensions.create("mojmap", MojmapExtension::class.java, project) 24 | 25 | val mavenGroup = project.getProperty("maven_group") 26 | project.group = mavenGroup 27 | val archivesBaseName = project.getProperty("archives_base_name") 28 | baseEx.archivesName.set("${archivesBaseName}-${project.parent!!.name}-${project.name}") 29 | 30 | project.dependencies { 31 | val minecraftVersion = project.getProperty("minecraft_version") 32 | add("minecraft", "com.mojang:minecraft:$minecraftVersion") 33 | 34 | add("mappings", loomEx.officialMojangMappings()) 35 | } 36 | 37 | project.tasks.apply { 38 | named("remapJar", AbstractArchiveTask::class).configure { 39 | archiveClassifier.set("remapJar-disabled") 40 | } 41 | named("remapSourcesJar", AbstractArchiveTask::class).configure { 42 | archiveClassifier.set("remapSourcesJar-disabled") 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /buildSrc/src/main/kotlin/com/kneelawk/utils.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk 27 | 28 | import org.gradle.api.Project 29 | 30 | inline fun Project.getProperty(propertyName: String): T { 31 | return property(propertyName) as? T ?: throw IllegalStateException("No property '$propertyName' found") 32 | } 33 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.1.0+1.18.2.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.1.0+1.18.2 2 | 3 | GraphLib version 0.1.0 for Minecraft 1.18.2 4 | 5 | This is the initial release version. 6 | 7 | ## About GraphLib 8 | 9 | GraphLib is a rewrite of 2xsaiko's HCTM-Base wirenet functionality for improved speed and memory usage, as well as being 10 | its own stand-alone library. This library is still in an early stage of development, so expect bugs, breaking changes, 11 | etc. 12 | 13 | There may still be some breaking changes made to the save format. If/When that happens, a command will be provided that 14 | fixes any errors caused by this. 15 | 16 | ## Changes from HCTM-Base 17 | 18 | There are many changes from the original library, but here are some of the most prominent ones: 19 | 20 | * GraphLib is written in Java instead of Kotlin, because that seems to provide the best compatibility with Java 21 | projects. 22 | * Many classes were renamed. Some examples are: 23 | * `PartExt` -> `BlockNode` 24 | * `Network` -> `BlockGraph` 25 | * `WireNetworkController` -> `BlockGraphController` 26 | * GraphLib stores graphs in separate files so that the ones that are not being used can be unloaded to save memory. 27 | This idea was taken from 2xsaiko's HCTM-Base in-progress Java-rewrite. 28 | * Graphs-In-Pos information is stored to avoid expensive recalculation. This information is then updated when necessary 29 | instead of being completely recalculated. 30 | * Graph IDs are incrementing Longs instead of random UUIDs. This allows both for better ID collision avoidance and for 31 | the use of FastUtil's optimized datastructures. 32 | * `BlockNode`s are decoded by dedicated `BlockNodeDecoder`s registered in a registry instead of by the block associated 33 | with the `BlockNode`. 34 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.1.1+1.18.2.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.1.1+1.18.2 2 | 3 | GraphLib version 0.1.1 for Minecraft 1.18.2 4 | 5 | Changes: 6 | 7 | * Fixes QSL and QFAPI being brought into dependants' environments. 8 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.1.2+1.18.2.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.1.2+1.18.2 2 | 3 | GraphLib version 0.1.2 for Minecraft 1.18.2 4 | 5 | Changes: 6 | 7 | * Adds command `/graphlib updateblocks ` to update the BlockNodes in a given area. This command should be 8 | used when migrating from one kind of graph-save format to another. 9 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.1.3+1.18.2.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.1.3+1.18.2 2 | 3 | GraphLib version 0.1.3 for Minecraft 1.18.2 4 | 5 | Changes: 6 | 7 | * Fixes things breaking when being given `BlockPos.Mutable` objects. 8 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.1.4+1.18.2.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.1.4+1.18.2 2 | 3 | GraphLib version 0.1.4 for Minecraft 1.18.2 4 | 5 | Changes: 6 | 7 | * Removes empty graphs when something attempts to load them. 8 | * Adds `getGraphId` method to `BlockNodeWrapper`. 9 | * Adds `/graphlib removeemptygraphs` command for removing all empty graphs. 10 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.1.5+1.18.2.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.1.5+1.18.2 2 | 3 | GraphLib version 0.1.5 for Minecraft 1.18.2 4 | 5 | Changes: 6 | 7 | * Adds null-check when adding block-nodes. 8 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.1.6+1.18.2.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.1.6+1.18.2 2 | 3 | GraphLib version 0.1.6 for Minecraft 1.18.2 4 | 5 | Changes: 6 | 7 | * Adds more null checks to things attempting to schedule updates for block nodes along with stack traces to some 8 | existing null checks. 9 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.2.0+1.18.2.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.2.0+1.18.2 2 | 3 | GraphLib version 0.2.0 for Minecraft 1.18.2 4 | 5 | Changes: 6 | 7 | * Separates BlockGraph interface from implementation. 8 | * Renames some methods to make it more obvious what they do and what they should be used for. 9 | * Adds some method parameters that give extra context that would not have been accessible before. 10 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.2.1+1.18.2.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.2.1+1.18.2 2 | 3 | GraphLib version 0.2.1 for Minecraft 1.18.2 4 | 5 | Changes: 6 | 7 | * Catches many errors that would otherwise cause a server crash and logs them. I'm not quite sure if this is the best 8 | thing to do, but it is a kind of brute-force approach to stability. 9 | * Adds some more info to existing null-check error logging. 10 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.2.2+1.18.2.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.2.2+1.18.2 2 | 3 | GraphLib version 0.2.2 for Minecraft 1.18.2 4 | 5 | Changes: 6 | 7 | * Adds logging to a separate file in the `logs` directory. This file is called `graphlib-.log`. 8 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.2.3+1.18.2.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.2.3+1.18.2 2 | 3 | GraphLib version 0.2.3 for Minecraft 1.18.2 4 | 5 | Changes: 6 | 7 | * Fixes logging using filenames that don't work on Windows. 8 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.2.4+1.18.2.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.2.4+1.18.2 2 | 3 | GraphLib version 0.2.4 for Minecraft 1.18.2 4 | 5 | Changes: 6 | 7 | * Fixes issue where `/graphlib removeemptygraphs` wouldn't detect graphs with letters `A`-`F` in their filenames. 8 | * Yes, I forgot to set the radix when parsing graph filenames. That's fixed now. 9 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.3.0+1.19.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.3.0+1.19 2 | 3 | GraphLib version 0.3.0 for Minecraft 1.19 4 | 5 | Changes: 6 | 7 | * Updates to Minecraft 1.19. 8 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.3.1+1.19.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.3.1+1.19 2 | 3 | GraphLib version 0.3.1 for Minecraft 1.19 4 | 5 | Changes: 6 | 7 | * Fixes `fabric.mod.json` to use the correct Minecraft version. 8 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.3.2+1.19.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.3.2+1.19 2 | 3 | GraphLib version 0.3.2 for Minecraft 1.19 4 | 5 | Changes: 6 | 7 | * Adds `getGraphs`, `getGraphsInChunk`, and `getGraphsInChunkSection` methods to `BlockGraphController`s. 8 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.3.3+1.19.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.3.3+1.19 2 | 3 | GraphLib version 0.3.3 for Minecraft 1.19 4 | 5 | Changes: 6 | 7 | * Cache empty chunks just like chunks with data in them. This should improve performance. 8 | * Removes 'saving' log spam. 9 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.4.0+1.19.3.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.4.0+1.19.3 2 | 3 | GraphLib version 0.4.0 for Minecraft 1.19.3 4 | 5 | Changes: 6 | 7 | * Updates to Minecraft 1.19.3. 8 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.4.1+1.19.3.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.4.1+1.19.3 2 | 3 | GraphLib version 0.4.1 for Minecraft 1.19.3 4 | 5 | Changes: 6 | 7 | * Fixes git mess. 8 | * Brings in features from `v0.3.2+1.19` and `v0.3.3+1.19`. 9 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.4.2+1.19.3.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.4.2+1.19.3 2 | 3 | GraphLib version 0.4.2 for Minecraft 1.19.3 4 | 5 | Changes: 6 | 7 | * Delays all node and connection updates until the end of the server tick to allow for update-deduplication and 8 | lag-reduction. 9 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.4.3+1.19.3.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.4.3+1.19.3 2 | 3 | GraphLib version 0.4.3 for Minecraft 1.19.3 4 | 5 | Changes: 6 | 7 | * Adds debug rendering for block graphs, accessible via the `/graphlib debugrender start` 8 | and `/graphlib debugrender stop` commands. 9 | -------------------------------------------------------------------------------- /changelogs/changelog-v0.4.4+1.19.3.md: -------------------------------------------------------------------------------- 1 | # GraphLib v0.4.4+1.19.3 2 | 3 | GraphLib version 0.4.4 for Minecraft 1.19.3 4 | 5 | Changes: 6 | 7 | * Fixes the debug render so that it does not corrupt the projection matrix when in use. 8 | -------------------------------------------------------------------------------- /changelogs/changelog-v1.0.0+1.20.md: -------------------------------------------------------------------------------- 1 | Changes: 2 | 3 | * Updated to Minecraft 1.20. 4 | * Split everything into graph 'universes'. 5 | * Added new save modes, for potentially saving more frequently than the default. 6 | * Reorganized package structure, hiding internals. 7 | * Added Node Entities, Link Entities, and Graph Entities. 8 | * Made Links have keys. 9 | * Added optional server to client synchronization of graphs. 10 | * Added ability for nodes to be manually added, removed, connected, and disconnected. 11 | * Added a *ton* of utility methods and types. 12 | -------------------------------------------------------------------------------- /changelogs/changelog-v1.1.0+1.20.md: -------------------------------------------------------------------------------- 1 | Changes: 2 | 3 | * Added `GraphUniverse.getSidedGraphView(...)` which will not crash when given a `World` that is neither a `ClientWorld` 4 | nor a `ServerWorld`. 5 | * Deprecated `GraphUniverse.getGraphView(...)` because it will crash when given a `World` that is neither 6 | a `ClientWorld` nor a `ServerWorld`. 7 | * Caught some other `World` to `ServerWorld` casts. 8 | -------------------------------------------------------------------------------- /changelogs/changelog-v1.1.1+1.20.md: -------------------------------------------------------------------------------- 1 | Changes: 2 | 3 | * Fixed minimizing Minecraft window with debug rendering active causing crashes on some platforms. 4 | -------------------------------------------------------------------------------- /changelogs/changelog-v1.2.0+1.20.md: -------------------------------------------------------------------------------- 1 | Changes: 2 | 3 | * Annotated chunk decoder & factory interfaces as functional interfaces. 4 | * Added default `onAdded` and `onLoaded` methods to `NodeEntity`s and `LinkEntity`s for detecting when an entity was 5 | newly added versus loaded from NBT. 6 | -------------------------------------------------------------------------------- /changelogs/changelog-v1.3.0+1.20.md: -------------------------------------------------------------------------------- 1 | Changes: 2 | 3 | * Fixed loading graph chunks during world-chunk loading causing deadlocks. 4 | * Added `/graphlib rebuildchunks ` command for rebuilding 5 | chunk graph indices if they get corrupted by a server crash. 6 | -------------------------------------------------------------------------------- /changelogs/changelog-v1.3.1+1.20.md: -------------------------------------------------------------------------------- 1 | Changes: 2 | 3 | * Fixed situation where attempting to remove multiple nodes via `updateNodes` could end up with some not being removed 4 | correctly. 5 | -------------------------------------------------------------------------------- /changelogs/changelog-v1.3.2+1.20.md: -------------------------------------------------------------------------------- 1 | Changes: 2 | 3 | * Fixed debug renderer projection matrix getting corrupted by other mods. 4 | -------------------------------------------------------------------------------- /changelogs/changelog-v1.4.0+1.20.2.md: -------------------------------------------------------------------------------- 1 | Changes: 2 | 3 | * Updated to 1.20.2. 4 | -------------------------------------------------------------------------------- /changelogs/changelog-v1.4.0+1.20.4.md: -------------------------------------------------------------------------------- 1 | Changes: 2 | 3 | * Updated to 1.20.3 & 1.20.4 (Patbox). 4 | -------------------------------------------------------------------------------- /changelogs/changelog-v1.4.0+1.20.md: -------------------------------------------------------------------------------- 1 | Changes: 2 | 3 | * Added `link` and `unlink` methods to `Graph` that take whole `Link` objects instead of just the component nodes. 4 | * Added checking code to prevent the creation of duplicate nodes and links. 5 | * This fixes a bug where duplicate node creation would corrupt one of the graph's internal maps. 6 | * This also makes sure graph-entities no longer receive duplicate events for duplicate creations. 7 | -------------------------------------------------------------------------------- /changelogs/changelog-v2.0.0+1.21.md: -------------------------------------------------------------------------------- 1 | Changes: 2 | 3 | * Same as version 2.0.0-beta.1. 4 | * Updated to Minecraft 1.21. 5 | * Divided GraphLib up into modules: 6 | * `core` - Houses the primary GraphLib stuff, like graphs, nodes, and entities. 7 | * `debugrender` - Houses the debug renderer. 8 | * `syncing-core` - Houses the client-side graph stuff, allowing syncing implementations to transmit graphs to the 9 | client. 10 | * `syncing-knet` - Houses the KNet-based synchronization mechanism. 11 | * `syncing-lns` - Houses the LibNetworkStack-based synchronization mechanism. 12 | * Made GraphLib multi-platform, supporting both Fabric and NeoForge, supporting both vanilla-gradle and 13 | architectury-based setups. 14 | * Added Codextra library dependency. 15 | * Moved everything over to using `Codec`s for encoding and decoding. 16 | * Moved syncing over to using `StreamCodec`s for buffer encoding and decoding. 17 | * Removed `LEGACY_UNIVERSE` default graph universe from pre-1.0 versions. 18 | * Moved events system over to using Common Events library. 19 | -------------------------------------------------------------------------------- /changelogs/changelog-v2.0.1+1.21.md: -------------------------------------------------------------------------------- 1 | Changes: 2 | 3 | * Fixed missing explicit dependencies on fabric. 4 | * Fixed some class initializer orders that would cause GraphLib-Syncing-KNet to have null fields. 5 | -------------------------------------------------------------------------------- /changelogs/changelog-v2.0.2+1.21.md: -------------------------------------------------------------------------------- 1 | Changes: 2 | 3 | * Fixed client-sided graph worlds throwing NPEs when trying to get a graph at an empty block-pos. 4 | -------------------------------------------------------------------------------- /changelogs/changelog-v2.0.3+1.21.md: -------------------------------------------------------------------------------- 1 | Changes: 2 | 3 | * Fixed debug-renderer packet sending being broken on dedicated servers. 4 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/README.md: -------------------------------------------------------------------------------- 1 | # Multiblock Lamps 2 | 3 | This is an example mod for showing how to do basic things with GraphLib. 4 | 5 | This mod adds lamp and lamp-connector blocks that form a graph. If any block in the graph is supplied a redstone signal, 6 | all lamps in the graph turn on. 7 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/fabric/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | } 30 | 31 | submodule { 32 | setLibsDirectory() 33 | applyXplatConnection(":multiblock-lamps:xplat") 34 | generateRuns() 35 | } 36 | 37 | dependencies { 38 | // Codextra 39 | val codextra_version: String by project 40 | modRuntimeOnly("com.kneelawk.codextra:codextra-fabric:$codextra_version") 41 | 42 | // KModLib Overlay 43 | val kml_version: String by project 44 | modRuntimeOnly("com.kneelawk.kmodlib:kmodlib-overlay-fabric:$kml_version") 45 | modRuntimeOnly("com.kneelawk.kmodlib:kmodlib-renderlayer:$kml_version") 46 | 47 | // Mod Menu 48 | // val mod_menu_version: String by project 49 | // modLocalRuntime("com.terraformersmc:modmenu:$mod_menu_version") 50 | } 51 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/fabric/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = fabric 27 | mod_id = multiblock_lamps 28 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/fabric/src/main/resources/META-INF/services/com.kneelawk.multiblocklamps.MLPlatform: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | com.kneelawk.multiblocklamps.fabric.MLPlatformImpl 27 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/fabric/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "${mod_id}", 4 | "version": "${version}", 5 | "name": "Multiblock Lamps", 6 | "description": "A simple GraphLib example mod that adds connected lamps.", 7 | "authors": [ 8 | "Kneelawk" 9 | ], 10 | "contact": { 11 | "homepage": "https://github.com/Kneelawk/GraphLib", 12 | "issues": "https://github.com/Kneelawk/GraphLib/issues", 13 | "sources": "https://github.com/Kneelawk/GraphLib" 14 | }, 15 | "license": "MIT", 16 | "icon": "assets/${mod_id}/icon-128.png", 17 | "environment": "*", 18 | "entrypoints": { 19 | "main": [ 20 | { 21 | "value": "com.kneelawk.multiblocklamps.fabric.MultiblockLampsFabric" 22 | } 23 | ] 24 | }, 25 | "mixins": [ ], 26 | "depends": { 27 | "graphlib": "*", 28 | "fabricloader": ">=0.15.10", 29 | "fabric-api": "*", 30 | "minecraft": ">=1.21- <1.22-", 31 | "java": ">=21" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/neoforge/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | } 30 | 31 | submodule { 32 | setLibsDirectory() 33 | applyXplatConnection(":multiblock-lamps:xplat") 34 | generateRuns() 35 | } 36 | 37 | dependencies { 38 | // Codextra 39 | val codextra_version: String by project 40 | runtimeOnly("com.kneelawk.codextra:codextra-neoforge:$codextra_version") 41 | 42 | // KModLib Overlay 43 | val kml_version: String by project 44 | runtimeOnly("com.kneelawk.kmodlib:kmodlib-overlay-neoforge:$kml_version") 45 | } 46 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/neoforge/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = neoforge 27 | mod_id = multiblock_lamps 28 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/neoforge/src/main/resources/META-INF/neoforge.mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[1,)" 3 | license = "MIT" 4 | 5 | [[mods]] 6 | modId = "${mod_id}" 7 | version = "${version}" 8 | displayName = "Multiblock Lamps" 9 | authors = "Kneelawk" 10 | description = "A simple GraphLib example mod that adds connected lamps." 11 | logoFile = "assets/${mod_id}/icon-128.png" 12 | 13 | [[dependencies.${mod_id}]] 14 | modId = "neoforge" 15 | type = "REQUIRED" 16 | versionRange = "[20.4.148-beta,)" 17 | ordering = "NONE" 18 | side = "BOTH" 19 | 20 | [[dependencies.${mod_id}]] 21 | modId = "graphlib" 22 | type = "REQUIRED" 23 | versionRange = "[2-alpha,)" 24 | ordering = "NONE" 25 | side = "BOTH" 26 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/neoforge/src/main/resources/META-INF/services/com.kneelawk.multiblocklamps.MLPlatform: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | com.kneelawk.multiblocklamps.neoforge.MLPlatformImpl 27 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/neoforge/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "Example Mod", 4 | "pack_format": 15 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | } 30 | 31 | submodule { 32 | setRefmaps("multiblock-lamps") 33 | xplatProjectDependency(":core") 34 | xplatProjectDependency(":debugrender") 35 | } 36 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = xplat 27 | mod_id = multiblock_lamps 28 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/java/com/kneelawk/multiblocklamps/MLPlatform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.multiblocklamps; 27 | 28 | import java.util.ServiceLoader; 29 | import java.util.function.Supplier; 30 | 31 | import com.mojang.serialization.MapCodec; 32 | 33 | import net.minecraft.world.level.block.Block; 34 | 35 | public interface MLPlatform { 36 | MLPlatform INSTANCE = ServiceLoader.load(MLPlatform.class).findFirst() 37 | .orElseThrow(() -> new RuntimeException("Failed to load Multiblock Lamps platform")); 38 | 39 | Supplier registerBlockWithItem(String path, Supplier creator, 40 | MapCodec codec); 41 | } 42 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/java/com/kneelawk/multiblocklamps/block/ConnectableBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.multiblocklamps.block; 27 | 28 | import java.util.Collection; 29 | 30 | import com.kneelawk.graphlib.api.graph.user.BlockNode; 31 | 32 | public interface ConnectableBlock { 33 | Collection createNodes(); 34 | } 35 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/java/com/kneelawk/multiblocklamps/node/LampInputNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.multiblocklamps.node; 27 | 28 | import com.kneelawk.graphlib.api.graph.NodeHolder; 29 | import com.kneelawk.graphlib.api.graph.user.BlockNode; 30 | 31 | public interface LampInputNode extends BlockNode { 32 | boolean isPowered(NodeHolder self); 33 | } 34 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/java/com/kneelawk/multiblocklamps/node/LampNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.multiblocklamps.node; 27 | 28 | import com.kneelawk.graphlib.api.graph.NodeHolder; 29 | import com.kneelawk.graphlib.api.graph.user.BlockNode; 30 | 31 | public interface LampNode extends BlockNode { 32 | void setLit(NodeHolder self, boolean lit); 33 | } 34 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/blockstates/connected_lamp.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "lit=false": { 4 | "model": "multiblock_lamps:block/connected_lamp" 5 | }, 6 | "lit=true": { 7 | "model": "multiblock_lamps:block/connected_lamp_on" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/blockstates/lamp_connector.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "": { 4 | "model": "multiblock_lamps:block/lamp_connector" 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kneelawk/GraphLib/bcd35d39e7b20d1d34686be9a1fdbfbc09d978f4/examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/icon-128.png -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/lang/en_us.json: -------------------------------------------------------------------------------- 1 | { 2 | "block.multiblock_lamps.connected_lamp": "Connected Lamp", 3 | "block.multiblock_lamps.lamp_connector": "Lamp Connector" 4 | } 5 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/models/block/connected_lamp.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "minecraft:block/cube_all", 3 | "textures": { 4 | "all": "multiblock_lamps:block/connected_lamp" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/models/block/connected_lamp_on.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "minecraft:block/cube_all", 3 | "textures": { 4 | "all": "multiblock_lamps:block/connected_lamp_on" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/models/block/lamp_connector.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "minecraft:block/cube_all", 3 | "textures": { 4 | "all": "multiblock_lamps:block/lamp_connector" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/models/item/connected_lamp.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "multiblock_lamps:block/connected_lamp" 3 | } 4 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/models/item/lamp_connector.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "multiblock_lamps:block/lamp_connector" 3 | } 4 | -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/textures/block/connected_lamp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kneelawk/GraphLib/bcd35d39e7b20d1d34686be9a1fdbfbc09d978f4/examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/textures/block/connected_lamp.png -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/textures/block/connected_lamp_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kneelawk/GraphLib/bcd35d39e7b20d1d34686be9a1fdbfbc09d978f4/examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/textures/block/connected_lamp_on.png -------------------------------------------------------------------------------- /examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/textures/block/lamp_connector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kneelawk/GraphLib/bcd35d39e7b20d1d34686be9a1fdbfbc09d978f4/examples/multiblock-lamps/xplat/src/main/resources/assets/multiblock_lamps/textures/block/lamp_connector.png -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Gradle Properties 2 | org.gradle.jvmargs = -Xmx4G 3 | org.gradle.parallel = true 4 | 5 | # Gradle Plugins 6 | loom_version = 1.7-SNAPSHOT 7 | moddev_version = 2.0.33-beta 8 | versioning_version = 1.0.0 9 | kpublish_version = 1.0.0 10 | submodule_version = 0.7.0 11 | remapcheck_version = 0.3.4 12 | 13 | # Fabric Properties 14 | # check these on https://fabricmc.net/develop 15 | java_version=21 16 | minecraft_version = 1.21.1 17 | parchment_mc_version = 1.21 18 | parchment_version = 2024.07.28 19 | yarn_version = 3 20 | fabric_loader_version = 0.16.9 21 | neoforge_version = 21.1.84 22 | 23 | # Mod Properties 24 | project_version = 2.0.99+1.21.local 25 | maven_group = com.kneelawk.graphlib 26 | archives_base_name = graphlib 27 | javadoc_package_name = com/kneelawk/graphlib 28 | 29 | # Dependencies 30 | fapi_version = 0.100.0+1.21 31 | codextra_version = 2.0.0+1.21 32 | common_events_version = 1.0.0+1.21 33 | lns_version = 0.13.0-pre.1 34 | kml_version = 0.4.3+1.21 35 | knet_version = 1.0.2+1.21 36 | 37 | # Runtime Only Dependencies 38 | mod_menu_version = 11.0.0-beta.1 39 | 40 | # Javadoc Dependencies 41 | jetbrains_annotations_version = 24.0.0 42 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kneelawk/GraphLib/bcd35d39e7b20d1d34686be9a1fdbfbc09d978f4/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /javadoc-options.txt: -------------------------------------------------------------------------------- 1 | -Werror 2 | -------------------------------------------------------------------------------- /javadoc/fabric/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = fabric 27 | mod_id = javadoc 28 | -------------------------------------------------------------------------------- /javadoc/neoforge/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = neoforge 27 | mod_id = javadoc 28 | -------------------------------------------------------------------------------- /javadoc/xplat/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = xplat 27 | mod_id = javadoc 28 | -------------------------------------------------------------------------------- /modules/core-fabric/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | setLibsDirectory() 34 | applyXplatConnection(":core-xplat") 35 | setupJavadoc() 36 | } 37 | 38 | kpublish { 39 | createPublication() 40 | } 41 | -------------------------------------------------------------------------------- /modules/core-fabric/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = fabric 27 | mod_id = graphlib 28 | -------------------------------------------------------------------------------- /modules/core-fabric/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "${mod_id}", 4 | "version": "${version}", 5 | "name": "Graph Lib", 6 | "description": "Library for helping mods that use graph networks, like Wired Redstone.", 7 | "authors": [ 8 | "2xsaiko", 9 | "Kneelawk" 10 | ], 11 | "contact": { 12 | "homepage": "https://github.com/Kneelawk/GraphLib", 13 | "issues": "https://github.com/Kneelawk/GraphLib/issues", 14 | "sources": "https://github.com/Kneelawk/GraphLib" 15 | }, 16 | "license": "MIT", 17 | "icon": "assets/${mod_id}/icon-128.png", 18 | "environment": "*", 19 | "entrypoints": { 20 | "main": [ 21 | { 22 | "value": "com.kneelawk.graphlib.fabric.impl.GraphLibFabricMod" 23 | } 24 | ] 25 | }, 26 | "mixins": [ 27 | "graphlib-common.mixins.json" 28 | ], 29 | "depends": { 30 | "codextra": "*", 31 | "common_events": "*", 32 | "fabricloader": ">=0.15.10", 33 | "fabric-api": "*", 34 | "minecraft": ">=1.21- <1.22-", 35 | "java": ">=21" 36 | }, 37 | "custom": { 38 | "modmenu": { 39 | "badges": [ "library" ] 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/core-neoforge/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | setLibsDirectory() 34 | applyXplatConnection(":core-xplat") 35 | setupJavadoc() 36 | } 37 | 38 | kpublish { 39 | createPublication() 40 | } 41 | -------------------------------------------------------------------------------- /modules/core-neoforge/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = neoforge 27 | mod_id = graphlib 28 | -------------------------------------------------------------------------------- /modules/core-neoforge/src/main/resources/META-INF/neoforge.mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[1,)" 3 | license = "MIT" 4 | 5 | [[mixins]] 6 | config = "graphlib-common.mixins.json" 7 | 8 | [[mods]] 9 | modId = "graphlib" 10 | version = "${version}" 11 | displayName = "GraphLib" 12 | authors = "Kneelawk" 13 | description = "Library for helping mods that use graph networks." 14 | logoFile = "assets/graphlib/icon-128.png" 15 | 16 | [[dependencies.graphlib]] 17 | modId = "neoforge" 18 | type = "REQUIRED" 19 | versionRange = "[20.4.148-beta,)" 20 | ordering = "NONE" 21 | side = "BOTH" 22 | -------------------------------------------------------------------------------- /modules/core-xplat-mojmap/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Cyan Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | applyXplatConnection(":core-xplat") 34 | setupJavadoc() 35 | } 36 | 37 | kpublish { 38 | createPublication() 39 | } 40 | -------------------------------------------------------------------------------- /modules/core-xplat-mojmap/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = mojmap 27 | mod_id = graphlib 28 | -------------------------------------------------------------------------------- /modules/core-xplat/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | setRefmaps("graphlib-core") 34 | setupJavadoc() 35 | val codextra_version: String by project 36 | xplatExternalDependency { "com.kneelawk.codextra:codextra-$it:$codextra_version" } 37 | val common_events_version: String by project 38 | xplatExternalDependency { "com.kneelawk.common-events:common-events-$it:$common_events_version" } 39 | } 40 | 41 | kpublish { 42 | createPublication("intermediary") 43 | } 44 | -------------------------------------------------------------------------------- /modules/core-xplat/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = xplat 27 | mod_id = graphlib 28 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/GraphLib.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import net.minecraft.resources.ResourceLocation; 6 | 7 | import com.kneelawk.graphlib.api.graph.GraphUniverse; 8 | import com.kneelawk.graphlib.impl.Constants; 9 | import com.kneelawk.graphlib.impl.GraphLibImpl; 10 | import com.kneelawk.graphlib.impl.graph.GraphUniverseImpl; 11 | 12 | /** 13 | * Graph Lib public API. This class contains static methods and fields for interacting with Graph Lib, like obtaining a 14 | * previously-registered {@link GraphUniverse}. 15 | */ 16 | public final class GraphLib { 17 | private GraphLib() { 18 | } 19 | 20 | /** 21 | * Gets whether the given universe has been registered. 22 | * 23 | * @param universeId the id of the universe to check. 24 | * @return {@code true} if the universe has been registered. 25 | */ 26 | public static boolean universeExists(@NotNull ResourceLocation universeId) { 27 | return GraphLibImpl.UNIVERSE.containsKey(universeId); 28 | } 29 | 30 | /** 31 | * Gets a registered {@link GraphUniverse} by its id. 32 | * 33 | * @param universeId the id of the universe to look up. 34 | * @return the universe with the given id. 35 | */ 36 | public static @NotNull GraphUniverse getUniverse(@NotNull ResourceLocation universeId) { 37 | GraphUniverseImpl graphUniverse = GraphLibImpl.UNIVERSE.get(universeId); 38 | if (graphUniverse == null) { 39 | throw new IllegalArgumentException("No universe exists with the name " + universeId); 40 | } 41 | 42 | return graphUniverse; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/graph/SnapshotNode.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.graph; 2 | 3 | import org.jetbrains.annotations.ApiStatus; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import net.minecraft.core.BlockPos; 7 | 8 | import com.kneelawk.graphlib.api.graph.user.BlockNode; 9 | 10 | /** 11 | * Immutable version of {@link NodeHolder}, holding only a node and its position. 12 | *

13 | * This can be useful if a set of nodes needs to be sent to another thread for processing. 14 | * 15 | * @param pos the block position of the node. 16 | * @param node the node itself. 17 | * @param graphId the id of the graph that this node belonged to when {@link NodeHolder#toSnapshot()} was called. 18 | * @param the specific type of the node. 19 | */ 20 | public record SnapshotNode(@NotNull BlockPos pos, @NotNull T node, long graphId) { 21 | /** 22 | * Creates a PositionedNode. 23 | * 24 | * @param pos the block position of the node. 25 | * @param node the node itself. 26 | * @param graphId the id of the graph that this node belonged to when {@link NodeHolder#toSnapshot()} was called. 27 | */ 28 | @ApiStatus.Internal 29 | public SnapshotNode(@NotNull BlockPos pos, @NotNull T node, long graphId) { 30 | this.pos = pos.immutable(); 31 | this.node = node; 32 | this.graphId = graphId; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/graph/user/BlockNodeDiscoverer.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.graph.user; 2 | 3 | import java.util.Collection; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import net.minecraft.core.BlockPos; 8 | import net.minecraft.server.level.ServerLevel; 9 | 10 | /** 11 | * Used to get the {@link BlockNode}s that a block should have. 12 | *

13 | * Nodes that are discovered here are usually created by the block or block-entity present at the given location. 14 | * These nodes are then compared, using their hashCode() and equals() functions, to the 15 | * nodes already in the controller's graphs at the given location and used to make adjustments if necessary (creating or 16 | * destroying connections, nodes, or graphs). 17 | */ 18 | public interface BlockNodeDiscoverer { 19 | /** 20 | * Gets the {@link BlockNode}s that the given block should have. 21 | * 22 | * @param world the world to check in. 23 | * @param pos the position to check at. 24 | * @return all the {@link BlockNode}s that should be here. 25 | */ 26 | @NotNull 27 | Collection getNodesInBlock(@NotNull ServerLevel world, @NotNull BlockPos pos); 28 | } 29 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/graph/user/GraphEntityFactory.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.graph.user; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | /** 6 | * Creates new graph entities. 7 | */ 8 | @FunctionalInterface 9 | public interface GraphEntityFactory { 10 | /** 11 | * Creates a new graph entity. 12 | * 13 | * @return a newly created graph entity. 14 | */ 15 | @NotNull 16 | GraphEntity createNew(); 17 | } 18 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/graph/user/GraphEntitySplitter.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.graph.user; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import com.kneelawk.graphlib.api.graph.BlockGraph; 6 | 7 | /** 8 | * Splits a new graph entity off of an existing graph entity. 9 | * 10 | * @param the type of graph this splitter handles. 11 | */ 12 | @FunctionalInterface 13 | public interface GraphEntitySplitter> { 14 | /** 15 | * Splits a new graph entity off of an existing graph entity. 16 | * 17 | * @param original the original graph entity. 18 | * @param originalGraph the graph of the original graph entity. 19 | * @param newGraph the graph of the new graph entity. 20 | * @return a newly created graph entity split off of the original graph entity. 21 | */ 22 | @NotNull 23 | GraphEntity splitNew(@NotNull G original, @NotNull BlockGraph originalGraph, 24 | @NotNull BlockGraph newGraph); 25 | } 26 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/graph/user/SidedBlockNode.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.graph.user; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import net.minecraft.core.Direction; 6 | 7 | import com.kneelawk.graphlib.api.graph.GraphView; 8 | import com.kneelawk.graphlib.api.util.SidedPos; 9 | import com.kneelawk.graphlib.api.wire.WireConnectionDiscoverers; 10 | 11 | /** 12 | * Describes a block node that is positioned on the side of a block. 13 | *

14 | * An example of a block node that is positioned on the side of a block would be a wire or gate from Wired Redstone. 15 | */ 16 | public interface SidedBlockNode extends BlockNode { 17 | /** 18 | * The side of the block this node is positioned at. 19 | *

20 | * The value returned here corresponds to what nodes are returned by 21 | * {@link GraphView#getNodesAt(SidedPos)}, depending on the side given in the sided block-position. The 22 | * side returned here also influences the {@link WireConnectionDiscoverers} connection 23 | * logic. 24 | *

25 | * A wire is determined to be on the {@link Direction#DOWN} side if it is sitting in the bottom of its block-space, 26 | * on the top side of the block beneath it. A wire is determined to be on the {@link Direction#NORTH} side if it is 27 | * sitting at the north side of its block-space, on the south side of the block to the north of it. This same logic 28 | * applies for all directions. 29 | * 30 | * @return the side of the block this node is positioned at. 31 | */ 32 | @NotNull 33 | Direction getSide(); 34 | } 35 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/util/DirectionUtils.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.util; 2 | 3 | import org.jetbrains.annotations.Contract; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import com.mojang.serialization.Codec; 7 | 8 | import net.minecraft.core.Direction; 9 | 10 | /** 11 | * Simple {@link Direction} utilities. 12 | */ 13 | public final class DirectionUtils { 14 | private DirectionUtils() { 15 | } 16 | 17 | private static final Direction[][] PERPENDICULARS; 18 | 19 | static { 20 | PERPENDICULARS = new Direction[6][]; 21 | 22 | for (Direction side : Direction.values()) { 23 | Direction[] array = new Direction[4]; 24 | 25 | int index = 0; 26 | for (Direction dir : Direction.values()) { 27 | if (!dir.getAxis().equals(side.getAxis())) { 28 | array[index++] = dir; 29 | } 30 | } 31 | 32 | PERPENDICULARS[side.get3DDataValue()] = array; 33 | } 34 | } 35 | 36 | /** 37 | * A direction codec that uses the direction's 3D data value. 38 | */ 39 | public static final Codec BYTE_CODEC = 40 | Codec.BYTE.xmap(Direction::from3DDataValue, dir -> (byte) dir.get3DDataValue()); 41 | 42 | /** 43 | * Gets all the directions perpendicular to the given direction. 44 | * 45 | * @param side the direction to find directions perpendicular to. 46 | * @return an array of directions perpendicular to the given direction. 47 | */ 48 | @Contract(pure = true) 49 | public static @NotNull Direction[] perpendiculars(@NotNull Direction side) { 50 | return PERPENDICULARS[side.get3DDataValue()]; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/util/EmptyLinkKey.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.util; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import com.mojang.serialization.Codec; 6 | 7 | import net.minecraft.resources.ResourceLocation; 8 | 9 | import com.kneelawk.graphlib.api.graph.user.LinkKey; 10 | import com.kneelawk.graphlib.api.graph.user.LinkKeyType; 11 | import com.kneelawk.graphlib.api.wire.LinkKeyFactory; 12 | import com.kneelawk.graphlib.impl.Constants; 13 | 14 | /** 15 | * An empty link key. 16 | *

17 | * This is the default link key. 18 | */ 19 | public final class EmptyLinkKey implements LinkKey { 20 | /** 21 | * The type of the empty link key. 22 | */ 23 | public static final ResourceLocation TYPE_ID = Constants.id("empty"); 24 | 25 | /** 26 | * The empty link key is a singleton. Here is its instance. 27 | */ 28 | public static final EmptyLinkKey INSTANCE = new EmptyLinkKey(); 29 | 30 | /** 31 | * Always returns this singleton's link key instance. 32 | */ 33 | public static final LinkKeyFactory FACTORY = (self, other) -> INSTANCE; 34 | 35 | /** 36 | * The link key type for the empty link key. 37 | */ 38 | public static final LinkKeyType TYPE = LinkKeyType.of(TYPE_ID, () -> INSTANCE); 39 | 40 | private EmptyLinkKey() {} 41 | 42 | @Override 43 | public @NotNull LinkKeyType getType() { 44 | return TYPE; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return "EmptyLinkKey"; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/util/HalfLink.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.util; 2 | 3 | import com.kneelawk.graphlib.api.graph.NodeHolder; 4 | import com.kneelawk.graphlib.api.graph.user.BlockNode; 5 | import com.kneelawk.graphlib.api.graph.user.LinkKey; 6 | 7 | /** 8 | * Describes a link from the perspective of an existing node. 9 | * 10 | * @param key the key of the link this describes. 11 | * @param other the other node in the link this describes. 12 | */ 13 | public record HalfLink(LinkKey key, NodeHolder other) { 14 | 15 | /** 16 | * Reverses this half link, replacing other with newOther. 17 | * 18 | * @param newOther the new end of the half link. 19 | * @return a half link pointing at the new other node. 20 | */ 21 | public HalfLink reverse(NodeHolder newOther) { 22 | return new HalfLink(key, newOther); 23 | } 24 | 25 | /** 26 | * Creates a link pos describing this link, including the given perspective. 27 | * 28 | * @param perspective the originator of this half link. 29 | * @return a link pos containing both the given node and this half link. 30 | */ 31 | public LinkPos toLinkPos(NodePos perspective) { 32 | return new LinkPos(perspective, other.getPos(), key); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/util/ObjectType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.api.util; 27 | 28 | import org.jetbrains.annotations.NotNull; 29 | 30 | import net.minecraft.resources.ResourceLocation; 31 | 32 | /** 33 | * Describes a type of something. 34 | */ 35 | public interface ObjectType { 36 | /** 37 | * All types should have associated ids. 38 | * 39 | * @return this type's id. 40 | */ 41 | @NotNull 42 | ResourceLocation getId(); 43 | } 44 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/wire/CenterWireConnectionFilter.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.wire; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import net.minecraft.core.Direction; 6 | 7 | import com.kneelawk.graphlib.api.graph.NodeHolder; 8 | import com.kneelawk.graphlib.api.graph.user.BlockNode; 9 | import com.kneelawk.graphlib.api.util.HalfLink; 10 | 11 | /** 12 | * Allows an external object to filter the connections connecting to a center wire block node. 13 | */ 14 | public interface CenterWireConnectionFilter { 15 | /** 16 | * Checks whether this filter allows the two block nodes to connect. 17 | * 18 | * @param self the node that this check is with respect to. 19 | * @param holder the node's holder. 20 | * @param onSide the side of this block that the other node is trying to connect to. 21 | * @param link the link to the block node holder holding the other node. 22 | * @return true if the two nodes should be allowed to connect, false otherwise. 23 | */ 24 | boolean canConnect(@NotNull CenterWireBlockNode self, @NotNull NodeHolder holder, 25 | @NotNull Direction onSide, @NotNull HalfLink link); 26 | 27 | /** 28 | * Creates a new connection filter that must satisfy both this filter and the other filter. 29 | * 30 | * @param otherFilter the other filter that must be satisfied. 31 | * @return a new connection filter that must satisfy both this filter and the other filter. 32 | */ 33 | default @NotNull CenterWireConnectionFilter and(@NotNull CenterWireConnectionFilter otherFilter) { 34 | return (self, holder, onSide, link) -> canConnect(self, holder, onSide, link) && 35 | otherFilter.canConnect(self, holder, onSide, link); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/wire/LinkKeyFactory.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.wire; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import com.kneelawk.graphlib.api.graph.NodeHolder; 6 | import com.kneelawk.graphlib.api.graph.user.BlockNode; 7 | import com.kneelawk.graphlib.api.graph.user.LinkKey; 8 | 9 | /** 10 | * Creates link keys from context. 11 | */ 12 | public interface LinkKeyFactory { 13 | /** 14 | * Create a link key from the given context and other node. 15 | * 16 | * @param self the node creating the link. 17 | * @param other the node the link is being created to. 18 | * @return a new link key for the given context. 19 | */ 20 | @NotNull 21 | LinkKey createLinkKey(@NotNull NodeHolder self, NodeHolder other); 22 | } 23 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/wire/SidedWireConnectionFilter.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.wire; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import net.minecraft.core.Direction; 6 | 7 | import com.kneelawk.graphlib.api.graph.NodeHolder; 8 | import com.kneelawk.graphlib.api.graph.user.BlockNode; 9 | import com.kneelawk.graphlib.api.util.HalfLink; 10 | 11 | /** 12 | * Allows an external object to filter the connections connecting to a sided wire block node. 13 | */ 14 | public interface SidedWireConnectionFilter { 15 | /** 16 | * Checks whether this filter allows two block nodes to connect. 17 | * 18 | * @param self the node that the check is with respect to. 19 | * @param holder the node's holder and context. 20 | * @param inDirection the direction that the other node is connecting from. 21 | * @param connectionType the type of connection that would be formed. 22 | * @param link the link to the other block node. 23 | * @return true if the two block nodes should be allowed to connect, false otherwise. 24 | */ 25 | boolean canConnect(@NotNull SidedWireBlockNode self, @NotNull NodeHolder holder, 26 | @NotNull Direction inDirection, @NotNull WireConnectionType connectionType, 27 | @NotNull HalfLink link); 28 | 29 | /** 30 | * Creates a new connection filter that must satisfy both this filter and the other filter. 31 | * 32 | * @param otherFilter the other filter that must be satisfied. 33 | * @return a new connection filter that must satisfy both this filter and the other filter. 34 | */ 35 | default @NotNull SidedWireConnectionFilter and(@NotNull SidedWireConnectionFilter otherFilter) { 36 | return (self, holder, inDirection, connectionType, link) -> 37 | canConnect(self, holder, inDirection, connectionType, link) && 38 | otherFilter.canConnect(self, holder, inDirection, connectionType, link); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/wire/WireConnectionType.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.wire; 2 | 3 | /** 4 | * The type of connection a sided wire block node could be forming. 5 | */ 6 | public enum WireConnectionType { 7 | /** 8 | * Inside corner connection to a wire within the same block. 9 | */ 10 | INTERNAL, 11 | 12 | /** 13 | * Flat connection to a wire in an adjacent block. 14 | */ 15 | EXTERNAL, 16 | 17 | /** 18 | * Outside corner connection to a wire on an adjacent side of the block this wire is sitting on. 19 | */ 20 | CORNER, 21 | 22 | /** 23 | * Only currently used for connecting to full-block nodes under the wire. 24 | */ 25 | UNDER, 26 | 27 | /** 28 | * Connection to something above this wire but in the same block, like a center-wire (e.g. standing cables, lamps, 29 | * powerline-connectors, etc.). 30 | */ 31 | ABOVE 32 | } 33 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/world/SaveMode.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.world; 2 | 3 | /** 4 | * Describes when an object should be saved. 5 | */ 6 | public enum SaveMode { 7 | /** 8 | * Only save things when their associated world chunk is saved or unloaded. 9 | *

10 | * This is best for graphs that are updated frequently, and where minor graph corruption is not a big deal. 11 | */ 12 | UNLOAD, 13 | /** 14 | * Save some things every tick. 15 | *

16 | * This is best for graphs that are updated less-frequently, and where graph corruption is to be avoided. 17 | */ 18 | INCREMENTAL, 19 | /** 20 | * Save all unsaved things every tick. 21 | *

22 | * This is best for graphs that are updated very infrequently, but that must really avoid graph corruption. 23 | */ 24 | IMMEDIATE 25 | } 26 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/api/world/TrackingChunkFactory.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.world; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import net.minecraft.core.SectionPos; 6 | 7 | /** 8 | * Creates a storage chunk that can alert its holder when it has changed. 9 | * 10 | * @param the type of storage chunk this creates. 11 | */ 12 | @FunctionalInterface 13 | public interface TrackingChunkFactory { 14 | /** 15 | * Create a new storage chunk. 16 | * 17 | * @param pos the position of the storage chunk being created. 18 | * @param markDirty used to signal when the created storage chunk has changed. 19 | * @return the newly created storage chunk. 20 | */ 21 | @NotNull 22 | R createNew(@NotNull SectionPos pos, @NotNull Runnable markDirty); 23 | } 24 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/Constants.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.impl; 2 | 3 | import org.jetbrains.annotations.Contract; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import net.minecraft.network.chat.Component; 7 | import net.minecraft.resources.ResourceLocation; 8 | 9 | public final class Constants { 10 | private Constants() { 11 | } 12 | 13 | public static final String MOD_ID = "graphlib"; 14 | public static final String DATA_DIRNAME = "data"; 15 | public static final String GRAPHDATA_DIRNAME = "graphdata"; 16 | public static final String REGION_DIRNAME = "region"; 17 | public static final String GRAPHS_DIRNAME = "graphs"; 18 | public static final String STATE_FILENAME = "state.dat"; 19 | public static final String UNIVERSE_MODIFY_INITIALIZER = MOD_ID + ":universe_modify"; 20 | 21 | @Contract(value = "_ -> new", pure = true) 22 | public static @NotNull ResourceLocation id(String path) { 23 | return ResourceLocation.fromNamespaceAndPath(MOD_ID, path); 24 | } 25 | 26 | @Contract(value = "_, _, _ -> new", pure = true) 27 | public static @NotNull Component tt(String prefix, String suffix, Object... args) { 28 | return Component.translatable(prefix + "." + MOD_ID + "." + suffix, args); 29 | } 30 | 31 | @Contract(value = "_, _ -> new", pure = true) 32 | public static @NotNull Component command(String suffix, Object... args) { 33 | return tt("command", suffix, args); 34 | } 35 | 36 | @Contract(pure = true) 37 | public static @NotNull String str(String path) { 38 | return MOD_ID + ":" + path; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/GraphLibImpl.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.impl; 2 | 3 | import java.util.LinkedHashMap; 4 | import java.util.Map; 5 | 6 | import com.mojang.brigadier.CommandDispatcher; 7 | 8 | import net.minecraft.commands.CommandBuildContext; 9 | import net.minecraft.commands.CommandSourceStack; 10 | import net.minecraft.resources.ResourceLocation; 11 | 12 | import com.kneelawk.graphlib.impl.command.GraphLibCommand; 13 | import com.kneelawk.graphlib.impl.graph.GraphUniverseImpl; 14 | 15 | public final class GraphLibImpl { 16 | private GraphLibImpl() { 17 | } 18 | 19 | public static final Map UNIVERSE = new LinkedHashMap<>(); 20 | 21 | public static void registerCommands(CommandDispatcher dispatcher, 22 | CommandBuildContext context) { 23 | GraphLibCommand.register(dispatcher, context); 24 | } 25 | 26 | public static void register(GraphUniverseImpl universe) { 27 | if (UNIVERSE.containsKey(universe.getId())) throw new IllegalArgumentException( 28 | "A graph universe is already registered with the key: " + universe.getId()); 29 | 30 | UNIVERSE.put(universe.getId(), universe); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/event/InternalEvents.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.impl.event; 27 | 28 | import com.mojang.brigadier.builder.RequiredArgumentBuilder; 29 | 30 | import net.minecraft.commands.CommandSourceStack; 31 | import net.minecraft.resources.ResourceLocation; 32 | 33 | import com.kneelawk.commonevents.api.Event; 34 | 35 | public class InternalEvents { 36 | public static final Event ADD_UNIVERSE_SUBCOMMANDS = Event.createSimple( 37 | AddUniverseSubcommands.class); 38 | 39 | public interface AddUniverseSubcommands { 40 | void addUniverseSubcommands(RequiredArgumentBuilder universe); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/graph/GraphUniverseImpl.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.impl.graph; 2 | 3 | import java.nio.file.Path; 4 | import java.util.Set; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import net.minecraft.core.BlockPos; 9 | import net.minecraft.resources.ResourceLocation; 10 | import net.minecraft.server.level.ServerLevel; 11 | import net.minecraft.world.level.storage.LevelStorageSource; 12 | 13 | import com.kneelawk.graphlib.api.graph.GraphUniverse; 14 | import com.kneelawk.graphlib.api.graph.user.BlockNode; 15 | import com.kneelawk.graphlib.impl.graph.listener.UniverseListener; 16 | 17 | public interface GraphUniverseImpl extends GraphUniverse { 18 | @Override 19 | @NotNull 20 | ServerGraphWorldImpl getGraphWorld(@NotNull ServerLevel world); 21 | 22 | ServerGraphWorldImpl createGraphWorld(LevelStorageSource.LevelStorageAccess session, ServerLevel world, Path path, 23 | boolean syncChunkWrites); 24 | 25 | void addListener(ResourceLocation key, UniverseListener listener); 26 | 27 | @NotNull 28 | Set discoverNodesInBlock(@NotNull ServerLevel world, @NotNull BlockPos pos); 29 | } 30 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/graph/GraphWorldStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.impl.graph; 27 | 28 | import java.util.Map; 29 | 30 | import org.jetbrains.annotations.NotNull; 31 | 32 | import net.minecraft.resources.ResourceLocation; 33 | 34 | import com.kneelawk.graphlib.api.graph.GraphView; 35 | 36 | public interface GraphWorldStorage { 37 | @NotNull 38 | GraphView get(@NotNull ResourceLocation universeId); 39 | 40 | @NotNull 41 | Map getAll(); 42 | } 43 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/graph/RebuildChunksListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.impl.graph; 27 | 28 | public interface RebuildChunksListener { 29 | void onAlreadyRunning(double progress, int graphCount, int chunkCount); 30 | 31 | void onBegin(int graphCount, int chunkCount); 32 | 33 | void onProgress(double progress, int graphCount, int chunkCount); 34 | 35 | void onComplete(int graphCount, int chunkCount); 36 | } 37 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/graph/ServerGraphWorldImpl.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.impl.graph; 2 | 3 | import java.util.List; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | import net.minecraft.core.SectionPos; 9 | import net.minecraft.resources.ResourceLocation; 10 | import net.minecraft.server.level.ServerLevel; 11 | import net.minecraft.world.level.ChunkPos; 12 | 13 | import com.kneelawk.graphlib.api.graph.GraphWorld; 14 | import com.kneelawk.graphlib.impl.graph.listener.WorldListener; 15 | 16 | public interface ServerGraphWorldImpl extends GraphWorld, AutoCloseable { 17 | 18 | void onWorldChunkLoad(@NotNull ChunkPos pos); 19 | 20 | void onWorldChunkUnload(@NotNull ChunkPos pos); 21 | 22 | void tick(); 23 | 24 | void saveChunk(@NotNull ChunkPos pos); 25 | 26 | void saveAll(boolean flush); 27 | 28 | /** 29 | * Called by the /graphlib removeemptygraphs command. 30 | *

31 | * Removes all empty graphs. Graphs should never be empty, but it could theoretically happen if the server crashes 32 | * and some things didn't get saved. 33 | * 34 | * @return the number of empty graphs removed. 35 | */ 36 | int removeEmptyGraphs(); 37 | 38 | /** 39 | * Starts a chunk rebuilding task. 40 | * 41 | * @param toRebuild the chunks to rebuild. 42 | * @param listener progress and completion listeners. 43 | */ 44 | void rebuildChunks(List toRebuild, RebuildChunksListener listener); 45 | 46 | @Override 47 | @NotNull 48 | ServerLevel getWorld(); 49 | 50 | @Nullable 51 | WorldListener getListener(ResourceLocation id); 52 | 53 | @Override 54 | @Nullable 55 | BlockGraphImpl getGraph(long id); 56 | } 57 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/graph/listener/UniverseListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.impl.graph.listener; 27 | 28 | import org.jetbrains.annotations.NotNull; 29 | 30 | import com.kneelawk.graphlib.impl.graph.ServerGraphWorldImpl; 31 | 32 | public interface UniverseListener { 33 | @NotNull 34 | WorldListener createWorldListener(ServerGraphWorldImpl world); 35 | } 36 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/graph/simple/SimpleGraphEntityContext.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.impl.graph.simple; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import net.minecraft.world.level.Level; 6 | 7 | import com.kneelawk.graphlib.api.graph.BlockGraph; 8 | import com.kneelawk.graphlib.api.graph.GraphEntityContext; 9 | import com.kneelawk.graphlib.api.graph.GraphView; 10 | 11 | public record SimpleGraphEntityContext(Level blockWorld, SimpleGraphCollection graphWorld, BlockGraph graph) 12 | implements GraphEntityContext { 13 | @Override 14 | public void markDirty() { 15 | graphWorld.markDirty(graph.getId()); 16 | } 17 | 18 | @Override 19 | public @NotNull Level getBlockWorld() { 20 | return blockWorld; 21 | } 22 | 23 | @Override 24 | public @NotNull GraphView getGraphWorld() { 25 | return graphWorld; 26 | } 27 | 28 | @Override 29 | public @NotNull BlockGraph getGraph() { 30 | return graph; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/graph/simple/SimpleGraphUniverseBuilder.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.impl.graph.simple; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import net.minecraft.resources.ResourceLocation; 6 | 7 | import com.kneelawk.graphlib.api.graph.GraphUniverse; 8 | import com.kneelawk.graphlib.api.world.SaveMode; 9 | 10 | public class SimpleGraphUniverseBuilder implements GraphUniverse.Builder { 11 | SaveMode saveMode = SaveMode.UNLOAD; 12 | 13 | @Override 14 | public @NotNull GraphUniverse build(@NotNull ResourceLocation universeId) { 15 | return new SimpleGraphUniverse(universeId, this); 16 | } 17 | 18 | @Override 19 | public GraphUniverse.@NotNull Builder saveMode(@NotNull SaveMode saveMode) { 20 | this.saveMode = saveMode; 21 | return this; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/graph/simple/SimpleLinkEntityContext.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.impl.graph.simple; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import net.minecraft.world.level.Level; 6 | 7 | import com.kneelawk.graphlib.api.graph.GraphView; 8 | import com.kneelawk.graphlib.api.graph.LinkEntityContext; 9 | import com.kneelawk.graphlib.api.graph.LinkHolder; 10 | import com.kneelawk.graphlib.api.graph.user.LinkKey; 11 | 12 | public record SimpleLinkEntityContext(LinkHolder holder, Level blockWorld, SimpleGraphCollection graphWorld) 13 | implements LinkEntityContext { 14 | @Override 15 | public void markDirty() { 16 | graphWorld.markDirty(holder.getFirst().getGraphId()); 17 | } 18 | 19 | @Override 20 | public @NotNull LinkHolder getHolder() { 21 | return holder; 22 | } 23 | 24 | @Override 25 | public @NotNull Level getBlockWorld() { 26 | return blockWorld; 27 | } 28 | 29 | @Override 30 | public @NotNull GraphView getGraphWorld() { 31 | return graphWorld; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/graph/simple/SimpleNodeEntityContext.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.impl.graph.simple; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import net.minecraft.world.level.Level; 6 | 7 | import com.kneelawk.graphlib.api.graph.GraphView; 8 | import com.kneelawk.graphlib.api.graph.NodeEntityContext; 9 | import com.kneelawk.graphlib.api.graph.NodeHolder; 10 | import com.kneelawk.graphlib.api.graph.user.BlockNode; 11 | 12 | public record SimpleNodeEntityContext(@NotNull NodeHolder holder, @NotNull Level blockWorld, 13 | @NotNull SimpleGraphCollection graphWorld) implements NodeEntityContext { 14 | @Override 15 | public void markDirty() { 16 | graphWorld.markDirty(getGraphId()); 17 | } 18 | 19 | @Override 20 | public @NotNull NodeHolder getHolder() { 21 | return holder; 22 | } 23 | 24 | @Override 25 | public @NotNull Level getBlockWorld() { 26 | return blockWorld; 27 | } 28 | 29 | @Override 30 | public @NotNull GraphView getGraphWorld() { 31 | return graphWorld; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/mixin/api/GraphWorldStorageAccess.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.impl.mixin.api; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import com.kneelawk.graphlib.impl.graph.ServerGraphWorldStorage; 6 | 7 | public interface GraphWorldStorageAccess { 8 | @NotNull 9 | ServerGraphWorldStorage graphlib_getGraphWorldStorage(); 10 | } 11 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/mixin/api/StorageHelper.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.impl.mixin.api; 2 | 3 | import java.nio.file.Path; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import net.minecraft.server.level.ServerLevel; 8 | import net.minecraft.world.level.chunk.storage.IOWorker; 9 | import net.minecraft.world.level.chunk.storage.RegionStorageInfo; 10 | 11 | import com.kneelawk.graphlib.impl.graph.ServerGraphWorldStorage; 12 | import com.kneelawk.graphlib.impl.mixin.impl.StorageIoWorkerAccessor; 13 | 14 | public class StorageHelper { 15 | public static @NotNull IOWorker newWorker(@NotNull RegionStorageInfo key, @NotNull Path directory, boolean dsync) { 16 | return StorageIoWorkerAccessor.create(key, directory, dsync); 17 | } 18 | 19 | public static @NotNull ServerGraphWorldStorage getStorage(@NotNull ServerLevel world) { 20 | return ((GraphWorldStorageAccess) world.getChunkSource().chunkMap).graphlib_getGraphWorldStorage(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/mixin/impl/StorageIoWorkerAccessor.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.impl.mixin.impl; 2 | 3 | import java.nio.file.Path; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Invoker; 7 | 8 | import net.minecraft.world.level.chunk.storage.IOWorker; 9 | import net.minecraft.world.level.chunk.storage.RegionStorageInfo; 10 | 11 | @Mixin(IOWorker.class) 12 | public interface StorageIoWorkerAccessor { 13 | @Invoker("") 14 | static IOWorker create(RegionStorageInfo storageKey, Path directory, boolean dsync) { 15 | throw new RuntimeException("StorageIoWorkerAccessor not mixed in."); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/util/ClassUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.impl.util; 27 | 28 | import org.jetbrains.annotations.NotNull; 29 | import org.jetbrains.annotations.Nullable; 30 | 31 | public class ClassUtils { 32 | public static @NotNull String classOf(@Nullable Object object) { 33 | if (object == null) return "null"; 34 | return object.getClass().toString(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/java/com/kneelawk/graphlib/impl/util/DefaultHashStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.impl.util; 27 | 28 | import java.util.Objects; 29 | 30 | import it.unimi.dsi.fastutil.Hash; 31 | 32 | public class DefaultHashStrategy implements Hash.Strategy { 33 | @Override 34 | public int hashCode(T o) { 35 | return o.hashCode(); 36 | } 37 | 38 | @Override 39 | public boolean equals(T a, T b) { 40 | return Objects.equals(a, b); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/resources/assets/graphlib/icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kneelawk/GraphLib/bcd35d39e7b20d1d34686be9a1fdbfbc09d978f4/modules/core-xplat/src/main/resources/assets/graphlib/icon-128.png -------------------------------------------------------------------------------- /modules/core-xplat/src/main/resources/assets/graphlib/icon-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kneelawk/GraphLib/bcd35d39e7b20d1d34686be9a1fdbfbc09d978f4/modules/core-xplat/src/main/resources/assets/graphlib/icon-256.png -------------------------------------------------------------------------------- /modules/core-xplat/src/main/resources/assets/graphlib/icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kneelawk/GraphLib/bcd35d39e7b20d1d34686be9a1fdbfbc09d978f4/modules/core-xplat/src/main/resources/assets/graphlib/icon-512.png -------------------------------------------------------------------------------- /modules/core-xplat/src/main/resources/assets/graphlib/lang/en_us.json: -------------------------------------------------------------------------------- 1 | { 2 | "command.graphlib.graphlib.updateblocks.starting": "Updating GraphLib block-nodes from %s to %s... This could cause some lag.", 3 | "command.graphlib.graphlib.updateblocks.success": "Finished updating GraphLib block-nodes from %s to %s.", 4 | "command.graphlib.graphlib.removeemptygraphs.success": "Removed %d empty graphs.", 5 | "command.graphlib.graphlib.rebuildchunks.begin": "Rebuilding %s chunks with %d graphs over section (%d, %d, %d) to section (%d, %d, %d) (%d chunks).", 6 | "command.graphlib.graphlib.rebuildchunks.progress": "%s%% complete. Rebuilding %s chunks with %d graphs over section (%d, %d, %d) to section (%d, %d, %d) (%d chunks).", 7 | "command.graphlib.graphlib.rebuildchunks.complete": "Finished rebuilding %s chunks with %d graphs over section (%d, %d, %d) to section (%d, %d, %d) (%d chunks).", 8 | "command.graphlib.graphlib.rebuildchunks.alreadyrunning": "Chunk rebuild already running. %s%% complete. Rebuilding %s chunks with %d graphs over section (%d, %d, %d) to section (%d, %d, %d) (%d chunks)." 9 | } 10 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/resources/graphlib-common.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "com.kneelawk.graphlib.impl.mixin.impl", 4 | "compatibilityLevel": "JAVA_21", 5 | "minVersion": "0.8", 6 | "refmap": "${refmap}", 7 | "injectors": { 8 | "defaultRequire": 1 9 | }, 10 | "client": [ ], 11 | "mixins": [ 12 | "StorageIoWorkerAccessor", 13 | "ThreadedChunkManagerMixin" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /modules/core-xplat/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "Example Mod", 4 | "pack_format": 15 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /modules/core-xplat/src/test/java/com/kneelawk/graphlib/api/util/graph/GraphMergeTests.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.util.graph; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.assertEquals; 6 | import static org.junit.jupiter.api.Assertions.assertTrue; 7 | 8 | public class GraphMergeTests { 9 | private static final Object PRESENT = new Object(); 10 | 11 | @Test 12 | public void simpleMergeTest() { 13 | Graph graphA = new Graph<>(); 14 | Graph graphB = new Graph<>(); 15 | 16 | var a = graphA.add("A"); 17 | var b = graphB.add("B"); 18 | var c = graphB.add("C"); 19 | var link = graphB.link(b, c, PRESENT); 20 | 21 | graphA.join(graphB); 22 | 23 | assertEquals(3, graphA.size(), "Graph A should have 3 nodes."); 24 | assertEquals(0, graphB.size(), "Graph B should have 0 nodes."); 25 | 26 | assertTrue(graphA.contains(a) && graphA.contains(b) && graphA.contains(c), 27 | "Graph A should contain A, B, and C."); 28 | assertTrue(b.connections().contains(link) && c.connections().contains(link), "B and C should stay linked."); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /modules/core-xplat/src/test/java/com/kneelawk/graphlib/api/util/graph/LinkEqualityTests.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.api.util.graph; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.assertEquals; 6 | import static org.junit.jupiter.api.Assertions.assertNotEquals; 7 | 8 | public class LinkEqualityTests { 9 | @Test 10 | public void testLinksEqualBothWays() { 11 | Node a = new Node<>("A"); 12 | Node b = new Node<>("B"); 13 | 14 | Link aToB = new Link<>(a, b, "C"); 15 | Link bToA = new Link<>(b, a, "C"); 16 | 17 | assertEquals(aToB, bToA, "The links should equal each other"); 18 | assertEquals(aToB.hashCode(), bToA.hashCode(), "The links' hashCodes should equal each other"); 19 | } 20 | 21 | @Test 22 | public void testLinksWithDifferentKeys() { 23 | Node a = new Node<>("A"); 24 | Node b = new Node<>("B"); 25 | 26 | Link cLink = new Link<>(a, b, "C"); 27 | Link dLink = new Link<>(a, b, "D"); 28 | 29 | assertNotEquals(cLink, dLink, "The links should not be equal"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /modules/core/README.md: -------------------------------------------------------------------------------- 1 | # GraphLib Core 2 | 3 | This is the heart of GraphLib. This contains the graph saving, updating, and managing mechanisms. 4 | -------------------------------------------------------------------------------- /modules/debugrender-fabric/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | setLibsDirectory() 34 | applyXplatConnection(":debugrender-xplat") 35 | setupJavadoc() 36 | } 37 | 38 | dependencies { 39 | // KModLib RenderLayer 40 | val kml_version: String by project 41 | modImplementation("com.kneelawk.kmodlib:kmodlib-renderlayer:$kml_version") 42 | include("com.kneelawk.kmodlib:kmodlib-renderlayer:$kml_version") 43 | } 44 | 45 | kpublish { 46 | createPublication() 47 | } 48 | -------------------------------------------------------------------------------- /modules/debugrender-fabric/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = fabric 27 | mod_id = graphlib_debugrender 28 | -------------------------------------------------------------------------------- /modules/debugrender-fabric/src/main/java/com/kneelawk/graphlib/debugrender/fabric/impl/GLDRPlatformImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.debugrender.fabric.impl; 27 | 28 | import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; 29 | 30 | import net.minecraft.network.protocol.common.custom.CustomPacketPayload; 31 | import net.minecraft.server.level.ServerPlayer; 32 | 33 | import com.kneelawk.graphlib.debugrender.impl.GLDRPlatform; 34 | 35 | public class GLDRPlatformImpl implements GLDRPlatform { 36 | @Override 37 | public void sendPlayPayload(ServerPlayer player, CustomPacketPayload payload) { 38 | ServerPlayNetworking.send(player, payload); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modules/debugrender-fabric/src/main/resources/META-INF/services/com.kneelawk.graphlib.debugrender.impl.GLDRPlatform: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | com.kneelawk.graphlib.debugrender.fabric.impl.GLDRPlatformImpl 27 | -------------------------------------------------------------------------------- /modules/debugrender-fabric/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "${mod_id}", 4 | "version": "${version}", 5 | "name": "Graph Lib Debug Render", 6 | "description": "Client-side rendering of graphs for debugging server-side graphs.", 7 | "authors": [ 8 | "Kneelawk" 9 | ], 10 | "contact": { 11 | "homepage": "https://github.com/Kneelawk/GraphLib", 12 | "issues": "https://github.com/Kneelawk/GraphLib/issues", 13 | "sources": "https://github.com/Kneelawk/GraphLib" 14 | }, 15 | "license": "MIT", 16 | "icon": "assets/${mod_id}/icon-128.png", 17 | "environment": "*", 18 | "entrypoints": { 19 | "main": [ 20 | "com.kneelawk.graphlib.debugrender.fabric.impl.GraphLibDebugRenderFabricMod" 21 | ], 22 | "client": [ 23 | "com.kneelawk.graphlib.debugrender.fabric.impl.client.GraphLibDebugRenderFabricModClient" 24 | ] 25 | }, 26 | "mixins": [ 27 | "${mod_id}.mixins.json" 28 | ], 29 | "depends": { 30 | "graphlib": "*", 31 | "fabricloader": ">=0.15.10", 32 | "fabric-api": "*", 33 | "minecraft": ">=1.21- <1.22-", 34 | "java": ">=21" 35 | }, 36 | "custom": { 37 | "modmenu": { 38 | "badges": [ "library" ], 39 | "parent": "graphlib" 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/debugrender-neoforge/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | setLibsDirectory() 34 | applyXplatConnection(":debugrender-xplat") 35 | setupJavadoc() 36 | } 37 | 38 | kpublish { 39 | createPublication() 40 | } 41 | -------------------------------------------------------------------------------- /modules/debugrender-neoforge/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = neoforge 27 | mod_id = graphlib_debugrender 28 | -------------------------------------------------------------------------------- /modules/debugrender-neoforge/src/main/java/com/kneelawk/graphlib/debugrender/neoforge/impl/GLDRPlatformImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.debugrender.neoforge.impl; 27 | 28 | import net.minecraft.network.protocol.common.custom.CustomPacketPayload; 29 | import net.minecraft.server.level.ServerPlayer; 30 | 31 | import net.neoforged.neoforge.network.PacketDistributor; 32 | 33 | import com.kneelawk.graphlib.debugrender.impl.GLDRPlatform; 34 | 35 | public class GLDRPlatformImpl implements GLDRPlatform { 36 | @Override 37 | public void sendPlayPayload(ServerPlayer player, CustomPacketPayload payload) { 38 | PacketDistributor.sendToPlayer(player, payload); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modules/debugrender-neoforge/src/main/resources/META-INF/accesstransformer.cfg: -------------------------------------------------------------------------------- 1 | 2 | # RenderLayer access wideners 3 | public net.minecraft.client.renderer.RenderType$CompositeRenderType 4 | public net.minecraft.client.renderer.RenderType$CompositeState 5 | -------------------------------------------------------------------------------- /modules/debugrender-neoforge/src/main/resources/META-INF/neoforge.mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[1,)" 3 | license = "MIT" 4 | 5 | [[mixins]] 6 | config = "${mod_id}.mixins.json" 7 | 8 | [[accessTransformers]] 9 | file = "META-INF/accesstransformer.cfg" 10 | 11 | [[mods]] 12 | modId = "${mod_id}" 13 | version = "${version}" 14 | displayName = "GraphLib Debug Render" 15 | authors = "Kneelawk" 16 | description = "Client-side rendering of graphs for debugging server-side graphs." 17 | logoFile = "assets/${mod_id}/icon-128.png" 18 | 19 | [[dependencies.${mod_id}]] 20 | modId = "neoforge" 21 | type = "REQUIRED" 22 | versionRange = "[20.4.148-beta,)" 23 | ordering = "NONE" 24 | side = "BOTH" 25 | 26 | [[dependencies.${mod_id}]] 27 | modId = "graphlib" 28 | type = "REQUIRED" 29 | versionRange = "[2-alpha,)" 30 | ordering = "NONE" 31 | side = "BOTH" 32 | 33 | [[dependencies.${mod_id}]] 34 | modId = "kmodlib_overlay" 35 | type = "REQUIRED" 36 | versionRange = "[0,)" 37 | ordering = "NONE" 38 | side = "CLIENT" 39 | -------------------------------------------------------------------------------- /modules/debugrender-neoforge/src/main/resources/META-INF/services/com.kneelawk.graphlib.debugrender.impl.GLDRPlatform: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | com.kneelawk.graphlib.debugrender.neoforge.impl.GLDRPlatformImpl 27 | -------------------------------------------------------------------------------- /modules/debugrender-xplat-mojmap/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Cyan Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | applyXplatConnection(":debugrender-xplat") 34 | setupJavadoc() 35 | } 36 | 37 | dependencies { 38 | val kml_version: String by project 39 | modCompileOnly("com.kneelawk.kmodlib:kmodlib-renderlayer:$kml_version") 40 | } 41 | 42 | kpublish { 43 | createPublication() 44 | } 45 | -------------------------------------------------------------------------------- /modules/debugrender-xplat-mojmap/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = mojmap 27 | mod_id = graphlib_debugrender 28 | -------------------------------------------------------------------------------- /modules/debugrender-xplat/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | setRefmaps("graphlib-debugrender") 34 | xplatProjectDependency(":core") 35 | setupJavadoc() 36 | val kml_version: String by project 37 | xplatExternalDependency { "com.kneelawk.kmodlib:kmodlib-overlay-$it:$kml_version" } 38 | } 39 | 40 | dependencies { 41 | val kml_version: String by project 42 | modCompileOnly("com.kneelawk.kmodlib:kmodlib-renderlayer:$kml_version") 43 | } 44 | 45 | kpublish { 46 | createPublication("intermediary") 47 | } 48 | -------------------------------------------------------------------------------- /modules/debugrender-xplat/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = xplat 27 | mod_id = graphlib_debugrender 28 | -------------------------------------------------------------------------------- /modules/debugrender-xplat/src/main/java/com/kneelawk/graphlib/debugrender/api/client/ClientBlockNodeHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.debugrender.api.client; 27 | 28 | import org.jetbrains.annotations.NotNull; 29 | 30 | import com.kneelawk.graphlib.debugrender.api.graph.DebugBlockNode; 31 | 32 | import net.minecraft.core.BlockPos; 33 | 34 | /** 35 | * Holds a {@link DebugBlockNode} along with its {@link BlockPos}. 36 | * 37 | * @param pos the block position of the node. 38 | * @param node the node itself. 39 | * @param graphId the id of the graph this node belongs to. 40 | */ 41 | public record ClientBlockNodeHolder(@NotNull BlockPos pos, @NotNull DebugBlockNode node, long graphId) { 42 | } 43 | -------------------------------------------------------------------------------- /modules/debugrender-xplat/src/main/java/com/kneelawk/graphlib/debugrender/api/graph/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | /** 27 | * This package contains interfaces that allow users to define custom client-side, debug block-nodes for debug rendering. 28 | *

29 | * Note that it is not required for every node to have a custom debug version as well. The default debug 30 | * block-node implementation can cover most use-cases. 31 | */ 32 | package com.kneelawk.graphlib.debugrender.api.graph; 33 | -------------------------------------------------------------------------------- /modules/debugrender-xplat/src/main/java/com/kneelawk/graphlib/debugrender/impl/GLDRPlatform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.debugrender.impl; 27 | 28 | import java.util.ServiceLoader; 29 | 30 | import net.minecraft.network.protocol.common.custom.CustomPacketPayload; 31 | import net.minecraft.server.level.ServerPlayer; 32 | 33 | public interface GLDRPlatform { 34 | GLDRPlatform INSTANCE = ServiceLoader.load(GLDRPlatform.class).findFirst() 35 | .orElseThrow(() -> new RuntimeException("Failed to find platform object for GraphLib Debug Renderer")); 36 | 37 | void sendPlayPayload(ServerPlayer player, CustomPacketPayload payload); 38 | } 39 | -------------------------------------------------------------------------------- /modules/debugrender-xplat/src/main/java/com/kneelawk/graphlib/debugrender/impl/client/debug/graph/SimpleDebugBlockGraph.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.debugrender.impl.client.debug.graph; 27 | 28 | import org.jetbrains.annotations.NotNull; 29 | 30 | import it.unimi.dsi.fastutil.longs.LongSet; 31 | 32 | import net.minecraft.resources.ResourceLocation; 33 | 34 | import com.kneelawk.graphlib.api.util.EmptyLinkKey; 35 | import com.kneelawk.graphlib.api.util.graph.Graph; 36 | import com.kneelawk.graphlib.debugrender.api.client.ClientBlockNodeHolder; 37 | import com.kneelawk.graphlib.debugrender.api.client.DebugBlockGraph; 38 | 39 | public record SimpleDebugBlockGraph(@NotNull ResourceLocation universeId, long graphId, 40 | @NotNull Graph graph, @NotNull LongSet chunks) 41 | implements DebugBlockGraph { 42 | } 43 | -------------------------------------------------------------------------------- /modules/debugrender-xplat/src/main/java/com/kneelawk/graphlib/debugrender/impl/client/debug/graph/SimpleDebugBlockNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.debugrender.impl.client.debug.graph; 27 | 28 | import org.jetbrains.annotations.NotNull; 29 | 30 | import com.kneelawk.graphlib.debugrender.api.graph.DebugBlockNode; 31 | import com.kneelawk.graphlib.impl.Constants; 32 | 33 | import net.minecraft.resources.ResourceLocation; 34 | 35 | public record SimpleDebugBlockNode(int hash, int color) implements DebugBlockNode { 36 | @Override 37 | public @NotNull ResourceLocation getRenderId() { 38 | return Constants.id("simple"); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /modules/debugrender-xplat/src/main/java/com/kneelawk/graphlib/debugrender/impl/payload/PayloadLink.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.debugrender.impl.payload; 27 | 28 | public record PayloadLink(int nodeA, int nodeB) { 29 | } 30 | -------------------------------------------------------------------------------- /modules/debugrender-xplat/src/main/java/com/kneelawk/graphlib/debugrender/impl/payload/PayloadNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.debugrender.impl.payload; 27 | 28 | import net.minecraft.core.BlockPos; 29 | 30 | public record PayloadNode(int typeId, BlockPos pos) { 31 | } 32 | -------------------------------------------------------------------------------- /modules/debugrender-xplat/src/main/resources/assets/graphlib_debugrender/icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kneelawk/GraphLib/bcd35d39e7b20d1d34686be9a1fdbfbc09d978f4/modules/debugrender-xplat/src/main/resources/assets/graphlib_debugrender/icon-128.png -------------------------------------------------------------------------------- /modules/debugrender-xplat/src/main/resources/common-events.json: -------------------------------------------------------------------------------- 1 | { 2 | "scan": [ 3 | "com.kneelawk.graphlib.debugrender.impl.command.GraphLibDebugRenderCommand", 4 | "com.kneelawk.graphlib.debugrender.impl.GLDebugNet" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /modules/debugrender-xplat/src/main/resources/graphlib_debugrender.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "com.kneelawk.graphlib.debugrender.impl.mixin.impl", 4 | "compatibilityLevel": "JAVA_21", 5 | "minVersion": "0.8", 6 | "refmap": "${refmap}", 7 | "injectors": { 8 | "defaultRequire": 1 9 | }, 10 | "client": [ 11 | "RenderLayerAccessor" 12 | ], 13 | "mixins": [ ] 14 | } 15 | -------------------------------------------------------------------------------- /modules/debugrender-xplat/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "GraphLib Debugrender", 4 | "pack_format": 15 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /modules/debugrender/README.md: -------------------------------------------------------------------------------- 1 | # GraphLib DebugRender 2 | 3 | This houses the code for analyzing and debugging server-side graphs on the client, separate from the `syncing` module. 4 | -------------------------------------------------------------------------------- /modules/syncing-core-fabric/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | setLibsDirectory() 34 | applyXplatConnection(":syncing-core-xplat") 35 | setupJavadoc() 36 | } 37 | 38 | kpublish { 39 | createPublication() 40 | } 41 | -------------------------------------------------------------------------------- /modules/syncing-core-fabric/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = fabric 27 | mod_id = graphlib_syncing 28 | -------------------------------------------------------------------------------- /modules/syncing-core-fabric/src/main/java/com/kneelawk/graphlib/syncing/fabric/impl/GraphLibSyncingFabricMod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.syncing.fabric.impl; 27 | 28 | import net.fabricmc.api.ModInitializer; 29 | 30 | import com.kneelawk.graphlib.impl.GLLog; 31 | 32 | @SuppressWarnings("unused") 33 | public class GraphLibSyncingFabricMod implements ModInitializer { 34 | @Override 35 | public void onInitialize() { 36 | GLLog.info("GraphLibSyncing Initialized."); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /modules/syncing-core-fabric/src/main/java/com/kneelawk/graphlib/syncing/fabric/impl/client/GraphLibSyncingFabricModClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.syncing.fabric.impl.client; 27 | 28 | import net.fabricmc.api.ClientModInitializer; 29 | import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; 30 | 31 | import com.kneelawk.graphlib.syncing.impl.client.ClientProxy; 32 | import com.kneelawk.graphlib.syncing.impl.mixin.api.ClientStorageHelper; 33 | 34 | public class GraphLibSyncingFabricModClient implements ClientModInitializer { 35 | @Override 36 | public void onInitializeClient() { 37 | ClientProxy.init(); 38 | 39 | ClientTickEvents.END_WORLD_TICK.register(world -> ClientStorageHelper.getStorage(world).tick()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/syncing-core-fabric/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "${mod_id}", 4 | "version": "${version}", 5 | "name": "Graph Lib Syncing", 6 | "description": "Server to client synchronization of graphs for client-side rendering.", 7 | "authors": [ 8 | "Kneelawk" 9 | ], 10 | "contact": { 11 | "homepage": "https://github.com/Kneelawk/GraphLib", 12 | "issues": "https://github.com/Kneelawk/GraphLib/issues", 13 | "sources": "https://github.com/Kneelawk/GraphLib" 14 | }, 15 | "license": "MIT", 16 | "icon": "assets/${mod_id}/icon-128.png", 17 | "environment": "*", 18 | "entrypoints": { 19 | "main": [ 20 | { 21 | "value": "com.kneelawk.graphlib.syncing.fabric.impl.GraphLibSyncingFabricMod" 22 | } 23 | ], 24 | "client": [ 25 | { 26 | "value": "com.kneelawk.graphlib.syncing.fabric.impl.client.GraphLibSyncingFabricModClient" 27 | } 28 | ] 29 | }, 30 | "mixins": [ 31 | "${mod_id}.mixins.json" 32 | ], 33 | "depends": { 34 | "graphlib": "*", 35 | "fabricloader": ">=0.15.10", 36 | "fabric-api": "*", 37 | "minecraft": ">=1.21- <1.22-", 38 | "java": ">=21" 39 | }, 40 | "custom": { 41 | "modmenu": { 42 | "badges": [ "library" ], 43 | "parent": "graphlib" 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /modules/syncing-core-neoforge/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | setLibsDirectory() 34 | applyXplatConnection(":syncing-core-xplat") 35 | setupJavadoc() 36 | } 37 | 38 | kpublish { 39 | createPublication() 40 | } 41 | -------------------------------------------------------------------------------- /modules/syncing-core-neoforge/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = neoforge 27 | mod_id = graphlib_syncing 28 | -------------------------------------------------------------------------------- /modules/syncing-core-neoforge/src/main/java/com/kneelawk/graphlib/syncing/neoforge/impl/GraphLibSyncingNeoforgeMod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.syncing.neoforge.impl; 27 | 28 | import net.neoforged.fml.common.Mod; 29 | 30 | import com.kneelawk.graphlib.impl.GLLog; 31 | import com.kneelawk.graphlib.syncing.impl.SyncedConstants; 32 | 33 | @Mod(SyncedConstants.MOD_ID) 34 | public class GraphLibSyncingNeoforgeMod { 35 | public GraphLibSyncingNeoforgeMod() { 36 | GLLog.info("GraphLibSyncing Initialized."); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /modules/syncing-core-neoforge/src/main/java/com/kneelawk/graphlib/syncing/neoforge/impl/client/GraphLibSyncingNeoforgeEvents.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.syncing.neoforge.impl.client; 27 | 28 | import net.minecraft.client.multiplayer.ClientLevel; 29 | 30 | import net.neoforged.api.distmarker.Dist; 31 | import net.neoforged.bus.api.SubscribeEvent; 32 | import net.neoforged.fml.common.EventBusSubscriber; 33 | import net.neoforged.neoforge.event.tick.LevelTickEvent; 34 | 35 | import com.kneelawk.graphlib.syncing.impl.mixin.api.ClientStorageHelper; 36 | 37 | @EventBusSubscriber(value = Dist.CLIENT) 38 | public class GraphLibSyncingNeoforgeEvents { 39 | @SubscribeEvent 40 | public static void onLevelTick(LevelTickEvent.Post event) { 41 | if (event.getLevel() instanceof ClientLevel world) { 42 | ClientStorageHelper.getStorage(world).tick(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /modules/syncing-core-neoforge/src/main/java/com/kneelawk/graphlib/syncing/neoforge/impl/client/GraphLibSyncingNeoforgeModClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.syncing.neoforge.impl.client; 27 | 28 | import net.neoforged.api.distmarker.Dist; 29 | import net.neoforged.bus.api.SubscribeEvent; 30 | import net.neoforged.fml.common.EventBusSubscriber; 31 | import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; 32 | 33 | import com.kneelawk.graphlib.syncing.impl.client.ClientProxy; 34 | 35 | @EventBusSubscriber(value = Dist.CLIENT, bus = EventBusSubscriber.Bus.MOD) 36 | public class GraphLibSyncingNeoforgeModClient { 37 | @SubscribeEvent 38 | public static void onClientStartup(FMLClientSetupEvent event) { 39 | ClientProxy.init(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/syncing-core-neoforge/src/main/resources/META-INF/neoforge.mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[1,)" 3 | license = "MIT" 4 | 5 | [[mixins]] 6 | config = "${mod_id}.mixins.json" 7 | 8 | [[mods]] 9 | modId = "${mod_id}" 10 | version = "${version}" 11 | displayName = "GraphLib Syncing" 12 | authors = "Kneelawk" 13 | description = "Server to client synchronization of graphs for client-side rendering." 14 | logoFile = "assets/${mod_id}/icon-128.png" 15 | 16 | [[dependencies.${mod_id}]] 17 | modId = "neoforge" 18 | type = "REQUIRED" 19 | versionRange = "[20.4.148-beta,)" 20 | ordering = "NONE" 21 | side = "BOTH" 22 | 23 | [[dependencies.${mod_id}]] 24 | modId = "graphlib" 25 | type = "REQUIRED" 26 | versionRange = "[2-alpha,)" 27 | ordering = "NONE" 28 | side = "BOTH" 29 | -------------------------------------------------------------------------------- /modules/syncing-core-xplat-mojmap/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Cyan Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | applyXplatConnection(":syncing-core-xplat") 34 | setupJavadoc() 35 | } 36 | 37 | kpublish { 38 | createPublication() 39 | } 40 | -------------------------------------------------------------------------------- /modules/syncing-core-xplat-mojmap/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = mojmap 27 | mod_id = graphlib_syncing 28 | -------------------------------------------------------------------------------- /modules/syncing-core-xplat/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | setRefmaps("graphlib-syncing-core") 34 | xplatProjectDependency(":core") 35 | setupJavadoc() 36 | } 37 | 38 | kpublish { 39 | createPublication("intermediary") 40 | } 41 | -------------------------------------------------------------------------------- /modules/syncing-core-xplat/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = xplat 27 | mod_id = graphlib_syncing 28 | -------------------------------------------------------------------------------- /modules/syncing-core-xplat/src/main/java/com/kneelawk/graphlib/syncing/api/graph/user/PlayerSyncFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.syncing.api.graph.user; 27 | 28 | import net.minecraft.server.level.ServerPlayer; 29 | 30 | /** 31 | * Determines which players the server should synchronize graphs to. 32 | */ 33 | @FunctionalInterface 34 | public interface PlayerSyncFilter { 35 | /** 36 | * Determines whether the server should synchronize graphs to the given player. 37 | * 38 | * @param player the player to potentially synchronize graphs to. 39 | * @return true if graphs should be synchronized to the given player. 40 | */ 41 | boolean shouldSync(ServerPlayer player); 42 | } 43 | -------------------------------------------------------------------------------- /modules/syncing-core-xplat/src/main/java/com/kneelawk/graphlib/syncing/api/util/ObjectSyncing.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Cyan Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.syncing.api.util; 27 | 28 | import org.jetbrains.annotations.NotNull; 29 | 30 | import net.minecraft.resources.ResourceLocation; 31 | 32 | import com.kneelawk.graphlib.api.util.ObjectType; 33 | 34 | /** 35 | * Simple super type for all syncing types. 36 | * 37 | * @param the object type this syncing type is associated with. 38 | */ 39 | public interface ObjectSyncing { 40 | /** 41 | * {@return the object type associated with this syncing type} 42 | */ 43 | @NotNull 44 | T getType(); 45 | 46 | /** 47 | * {@return the id associated with this syncing type} 48 | */ 49 | default ResourceLocation getId() { 50 | return getType().getId(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /modules/syncing-core-xplat/src/main/java/com/kneelawk/graphlib/syncing/impl/SyncedConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.syncing.impl; 27 | 28 | import net.minecraft.resources.ResourceLocation; 29 | 30 | public class SyncedConstants { 31 | public static final String MOD_ID = "graphlib_syncing"; 32 | 33 | public static final ResourceLocation LISTENER_KEY = id("synchronizer"); 34 | 35 | public static ResourceLocation id(String path) { 36 | return ResourceLocation.fromNamespaceAndPath(MOD_ID, path); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /modules/syncing-core-xplat/src/main/java/com/kneelawk/graphlib/syncing/impl/mixin/api/ClientGraphWorldStorageAccess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.syncing.impl.mixin.api; 27 | 28 | import com.kneelawk.graphlib.syncing.impl.graph.ClientGraphWorldStorage; 29 | 30 | public interface ClientGraphWorldStorageAccess { 31 | ClientGraphWorldStorage graphlib_syncing_getClientGraphWorldStorage(); 32 | } 33 | -------------------------------------------------------------------------------- /modules/syncing-core-xplat/src/main/java/com/kneelawk/graphlib/syncing/impl/mixin/api/ClientStorageHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.syncing.impl.mixin.api; 27 | 28 | import org.jetbrains.annotations.NotNull; 29 | 30 | import com.kneelawk.graphlib.syncing.impl.graph.ClientGraphWorldStorage; 31 | 32 | import net.minecraft.client.multiplayer.ClientLevel; 33 | 34 | public class ClientStorageHelper { 35 | public static @NotNull ClientGraphWorldStorage getStorage(@NotNull ClientLevel world) { 36 | return ((ClientGraphWorldStorageAccess) world.getChunkSource()).graphlib_syncing_getClientGraphWorldStorage(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /modules/syncing-core-xplat/src/main/resources/assets/graphlib_syncing/icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kneelawk/GraphLib/bcd35d39e7b20d1d34686be9a1fdbfbc09d978f4/modules/syncing-core-xplat/src/main/resources/assets/graphlib_syncing/icon-128.png -------------------------------------------------------------------------------- /modules/syncing-core-xplat/src/main/resources/graphlib_syncing.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "com.kneelawk.graphlib.syncing.impl.mixin.impl", 4 | "compatibilityLevel": "JAVA_21", 5 | "minVersion": "0.8", 6 | "refmap": "${refmap}", 7 | "injectors": { 8 | "defaultRequire": 1 9 | }, 10 | "client": [ 11 | "ClientChunkManagerMixin" 12 | ], 13 | "mixins": [ 14 | "ServerChunkSenderMixin" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /modules/syncing-core-xplat/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "GraphLib Syncing Core", 4 | "pack_format": 15 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /modules/syncing-core/README.md: -------------------------------------------------------------------------------- 1 | # GraphLib Syncing 2 | 3 | This houses the server to client synchronization code, allowing graphs to be rendered on the client. 4 | -------------------------------------------------------------------------------- /modules/syncing-knet-fabric/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | setLibsDirectory() 34 | applyXplatConnection(":syncing-knet-xplat") 35 | setupJavadoc() 36 | } 37 | 38 | kpublish { 39 | createPublication() 40 | } 41 | -------------------------------------------------------------------------------- /modules/syncing-knet-fabric/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = fabric 27 | mod_id = graphlib_syncing_knet 28 | -------------------------------------------------------------------------------- /modules/syncing-knet-fabric/src/main/java/com/kneelawk/graphlib/syncing/knet/fabric/impl/GraphLibSyncingKNetFabricMod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.syncing.knet.fabric.impl; 27 | 28 | import net.fabricmc.api.ModInitializer; 29 | 30 | import com.kneelawk.graphlib.syncing.knet.impl.KNetChannels; 31 | import com.kneelawk.knet.fabric.api.KNetRegistrarFabric; 32 | 33 | public class GraphLibSyncingKNetFabricMod implements ModInitializer { 34 | @Override 35 | public void onInitialize() { 36 | KNetChannels.register(new KNetRegistrarFabric()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /modules/syncing-knet-fabric/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "${mod_id}", 4 | "version": "${version}", 5 | "name": "Graph Lib Syncing KNet", 6 | "description": "KNet-based graph syncing.", 7 | "authors": [ 8 | "Kneelawk" 9 | ], 10 | "contact": { 11 | "homepage": "https://github.com/Kneelawk/GraphLib", 12 | "issues": "https://github.com/Kneelawk/GraphLib/issues", 13 | "sources": "https://github.com/Kneelawk/GraphLib" 14 | }, 15 | "license": "MIT", 16 | "icon": "assets/${mod_id}/icon-128.png", 17 | "environment": "*", 18 | "entrypoints": { 19 | "main": [ 20 | { 21 | "value": "com.kneelawk.graphlib.syncing.knet.fabric.impl.GraphLibSyncingKNetFabricMod" 22 | } 23 | ] 24 | }, 25 | "mixins": [ ], 26 | "depends": { 27 | "graphlib": "*", 28 | "graphlib_syncing": "*", 29 | "knet": "*", 30 | "codextra": "*", 31 | "fabricloader": ">=0.15.10", 32 | "fabric-api": "*", 33 | "minecraft": ">=1.21- <1.22-", 34 | "java": ">=21" 35 | }, 36 | "custom": { 37 | "modmenu": { 38 | "badges": [ "library" ], 39 | "parent": "graphlib" 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/syncing-knet-neoforge/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | setLibsDirectory() 34 | applyXplatConnection(":syncing-knet-xplat") 35 | setupJavadoc() 36 | } 37 | 38 | kpublish { 39 | createPublication() 40 | } 41 | -------------------------------------------------------------------------------- /modules/syncing-knet-neoforge/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = neoforge 27 | mod_id = graphlib_syncing_knet 28 | -------------------------------------------------------------------------------- /modules/syncing-knet-neoforge/src/main/resources/META-INF/neoforge.mods.toml: -------------------------------------------------------------------------------- 1 | modLoader = "javafml" 2 | loaderVersion = "[1,)" 3 | license = "MIT" 4 | 5 | [[mods]] 6 | modId = "${mod_id}" 7 | version = "${version}" 8 | displayName = "GraphLib Syncing KNet" 9 | authors = "Kneelawk" 10 | description = "KNet-based graph syncing." 11 | logoFile = "assets/${mod_id}/icon-128.png" 12 | 13 | [[dependencies.${mod_id}]] 14 | modId = "neoforge" 15 | type = "REQUIRED" 16 | versionRange = "[20.4.148-beta,)" 17 | ordering = "NONE" 18 | side = "BOTH" 19 | 20 | [[dependencies.${mod_id}]] 21 | modId = "graphlib" 22 | type = "REQUIRED" 23 | versionRange = "[2-alpha,)" 24 | ordering = "NONE" 25 | side = "BOTH" 26 | -------------------------------------------------------------------------------- /modules/syncing-knet-xplat-mojmap/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Cyan Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | applyXplatConnection(":syncing-knet-xplat") 34 | setupJavadoc() 35 | } 36 | 37 | kpublish { 38 | createPublication() 39 | } 40 | -------------------------------------------------------------------------------- /modules/syncing-knet-xplat-mojmap/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = mojmap 27 | mod_id = graphlib_syncing_knet 28 | -------------------------------------------------------------------------------- /modules/syncing-knet-xplat/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | plugins { 27 | id("com.kneelawk.submodule") 28 | id("com.kneelawk.versioning") 29 | id("com.kneelawk.kpublish") 30 | } 31 | 32 | submodule { 33 | setRefmaps("graphlib-syncing-knet") 34 | xplatProjectDependency(":core") 35 | xplatProjectDependency(":syncing-core") 36 | setupJavadoc() 37 | 38 | val knet_version: String by project 39 | xplatExternalDependency { "com.kneelawk.knet:knet-$it:$knet_version" } 40 | 41 | val codextra_version: String by project 42 | xplatExternalDependency { "com.kneelawk.codextra:codextra-$it:$codextra_version" } 43 | } 44 | 45 | kpublish { 46 | createPublication("intermediary") 47 | } 48 | -------------------------------------------------------------------------------- /modules/syncing-knet-xplat/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = xplat 27 | mod_id = graphlib_syncing_knet 28 | -------------------------------------------------------------------------------- /modules/syncing-knet-xplat/src/main/java/com/kneelawk/graphlib/syncing/knet/api/util/InSyncedUniverse.java: -------------------------------------------------------------------------------- 1 | package com.kneelawk.graphlib.syncing.knet.api.util; 2 | 3 | import net.minecraft.network.FriendlyByteBuf; 4 | import net.minecraft.network.codec.StreamCodec; 5 | 6 | import com.kneelawk.codextra.api.util.FunctionUtils; 7 | import com.kneelawk.graphlib.syncing.knet.api.graph.KNetSyncedUniverse; 8 | 9 | /** 10 | * Describes an object in a {@link KNetSyncedUniverse}. 11 | * 12 | * @param universe the universe the object is within. 13 | * @param obj the object. 14 | * @param the type of the object. 15 | */ 16 | public record InSyncedUniverse(KNetSyncedUniverse universe, T obj) { 17 | /** 18 | * Creates an in-universe stream codec for the given type. 19 | *

20 | * This provides the {@link KNetSyncedUniverse#ATTACHMENT_KEY} attachment. 21 | * 22 | * @param objCodec the codec for the object to be associated with a universe. 23 | * @param the buffer type. 24 | * @param the object type. 25 | * @return the created stream codec. 26 | */ 27 | public static StreamCodec> codec( 28 | StreamCodec objCodec) { 29 | return StreamCodec., KNetSyncedUniverse, V>composite( 30 | KNetSyncedUniverse.ATTACHMENT_KEY.retrieveStream(), FunctionUtils.nullFunc(), 31 | objCodec, InSyncedUniverse::obj, InSyncedUniverse::new) 32 | .apply(KNetSyncedUniverse.readAttachingOp(InSyncedUniverse::universe)); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /modules/syncing-knet-xplat/src/main/java/com/kneelawk/graphlib/syncing/knet/impl/SyncingKNetImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.syncing.knet.impl; 27 | 28 | import net.minecraft.resources.ResourceLocation; 29 | 30 | public class SyncingKNetImpl { 31 | public static final String MOD_ID = "graphlib_syncing_knet"; 32 | 33 | public static ResourceLocation id(String path) { 34 | return ResourceLocation.fromNamespaceAndPath(MOD_ID, path); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /modules/syncing-knet-xplat/src/main/resources/assets/graphlib_syncing_knet/icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kneelawk/GraphLib/bcd35d39e7b20d1d34686be9a1fdbfbc09d978f4/modules/syncing-knet-xplat/src/main/resources/assets/graphlib_syncing_knet/icon-128.png -------------------------------------------------------------------------------- /modules/syncing-knet-xplat/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "GraphLib Syncing KNet", 4 | "pack_format": 15 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /modules/syncing-knet/README.md: -------------------------------------------------------------------------------- 1 | # GraphLib Syncing KNet 2 | 3 | KNet-based syncing mechanism for graphs from server to client. 4 | -------------------------------------------------------------------------------- /modules/syncing-lns/README.md: -------------------------------------------------------------------------------- 1 | # GraphLib Syncing LNS 2 | 3 | LibNetworkStack-based syncing mechanism for graphs from server to client. 4 | -------------------------------------------------------------------------------- /modules/syncing-lns/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.kneelawk.submodule") 3 | id("com.kneelawk.versioning") 4 | id("com.kneelawk.kpublish") 5 | } 6 | 7 | submodule { 8 | setLibsDirectory() 9 | setRefmaps("graphlib-syncing-lns") 10 | fabricProjectDependency(":core") 11 | fabricProjectDependency(":syncing-core") 12 | setupJavadoc() 13 | } 14 | 15 | dependencies { 16 | // LibNetworkStack 17 | val lns_version: String by project 18 | modApi("alexiil.mc.lib:libnetworkstack-base:$lns_version") 19 | include("alexiil.mc.lib:libnetworkstack-base:$lns_version") 20 | } 21 | 22 | kpublish { 23 | createPublication() 24 | } 25 | -------------------------------------------------------------------------------- /modules/syncing-lns/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2024 Cyan Kneelawk. 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | # 25 | 26 | submodule.platform = fabric 27 | mod_id = graphlib_syncing_lns 28 | -------------------------------------------------------------------------------- /modules/syncing-lns/src/main/java/com/kneelawk/graphlib/syncing/lns/impl/GraphLibSyncingLNSFabricMod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2024 Kneelawk. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | * 24 | */ 25 | 26 | package com.kneelawk.graphlib.syncing.lns.impl; 27 | 28 | import net.fabricmc.api.ModInitializer; 29 | 30 | public class GraphLibSyncingLNSFabricMod implements ModInitializer { 31 | @Override 32 | public void onInitialize() { 33 | LNSNetworking.init(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /modules/syncing-lns/src/main/resources/assets/graphlib_syncing_lns/icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kneelawk/GraphLib/bcd35d39e7b20d1d34686be9a1fdbfbc09d978f4/modules/syncing-lns/src/main/resources/assets/graphlib_syncing_lns/icon-128.png -------------------------------------------------------------------------------- /modules/syncing-lns/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "${mod_id}", 4 | "version": "${version}", 5 | "name": "Graph Lib Syncing LNS", 6 | "description": "LibNetworkStack-based graph syncing.", 7 | "authors": [ 8 | "Kneelawk" 9 | ], 10 | "contact": { 11 | "homepage": "https://github.com/Kneelawk/GraphLib", 12 | "issues": "https://github.com/Kneelawk/GraphLib/issues", 13 | "sources": "https://github.com/Kneelawk/GraphLib" 14 | }, 15 | "license": "MIT", 16 | "icon": "assets/${mod_id}/icon-128.png", 17 | "environment": "*", 18 | "entrypoints": { 19 | "main": [ 20 | { 21 | "value": "com.kneelawk.graphlib.syncing.lns.impl.GraphLibSyncingLNSFabricMod" 22 | } 23 | ] 24 | }, 25 | "mixins": [ 26 | ], 27 | "depends": { 28 | "graphlib": "*", 29 | "graphlib_syncing": "*", 30 | "libnetworkstack": "*", 31 | "fabricloader": ">=0.15.10", 32 | "fabric-api": "*", 33 | "minecraft": ">=1.21- <1.22-", 34 | "java": ">=21" 35 | }, 36 | "custom": { 37 | "modmenu": { 38 | "badges": [ "library" ], 39 | "parent": "graphlib" 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /remapCheck/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("fabric-loom") 3 | id("com.kneelawk.remapcheck") 4 | } 5 | 6 | remapCheck { 7 | val minecraft_version: String by project 8 | val yarn_version: String by project 9 | applyTargetMapping("net.fabricmc:yarn:$minecraft_version+build.$yarn_version:v2") 10 | checkRemap { 11 | targetProject(":core-fabric") 12 | taskNameBase("core") 13 | } 14 | checkRemap { 15 | targetProject(":debugrender-fabric") 16 | taskNameBase("debugrender") 17 | } 18 | checkRemap { 19 | targetProject(":syncing-core-fabric") 20 | taskNameBase("syncing-core") 21 | } 22 | checkRemap { 23 | targetProject(":syncing-knet-fabric") 24 | taskNameBase("syncing-knet") 25 | } 26 | checkRemap { 27 | targetProject(":syncing-lns") 28 | taskNameBase("syncing-lns") 29 | } 30 | } 31 | --------------------------------------------------------------------------------