From 0d43681d54b1142803055fd604e39a9e7e8def77 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Wed, 17 Apr 2024 12:05:04 -0700 Subject: [PATCH 01/62] Begin architectury setup --- .gitignore | 1 + build.gradle | 197 ++--------------- common/build.gradle | 124 +++++++++++ .../java/com/jozufozu/flywheel/Flywheel.java | 0 .../flywheel/api/BackendImplemented.java | 0 .../flywheel/api/backend/Backend.java | 0 .../flywheel/api/backend/BackendManager.java | 0 .../jozufozu/flywheel/api/backend/Engine.java | 0 .../flywheel/api/event/BeginFrameEvent.java | 0 .../event/EndClientResourceReloadEvent.java | 0 .../api/event/ReloadLevelRendererEvent.java | 0 .../flywheel/api/event/RenderContext.java | 0 .../flywheel/api/event/RenderStage.java | 0 .../flywheel/api/event/RenderStageEvent.java | 0 .../flywheel/api/instance/Instance.java | 0 .../flywheel/api/instance/InstanceHandle.java | 0 .../flywheel/api/instance/InstanceType.java | 0 .../flywheel/api/instance/InstanceWriter.java | 0 .../flywheel/api/instance/Instancer.java | 0 .../api/instance/InstancerProvider.java | 0 .../api/internal/InternalFlywheelApi.java | 0 .../flywheel/api/internal/package-info.java | 0 .../flywheel/api/layout/ArrayElementType.java | 0 .../flywheel/api/layout/ElementType.java | 0 .../flywheel/api/layout/FloatRepr.java | 0 .../flywheel/api/layout/IntegerRepr.java | 0 .../jozufozu/flywheel/api/layout/Layout.java | 0 .../flywheel/api/layout/LayoutBuilder.java | 0 .../api/layout/MatrixElementType.java | 0 .../api/layout/ScalarElementType.java | 0 .../api/layout/UnsignedIntegerRepr.java | 0 .../flywheel/api/layout/ValueRepr.java | 0 .../api/layout/VectorElementType.java | 0 .../flywheel/api/material/CutoutShader.java | 0 .../flywheel/api/material/DepthTest.java | 0 .../flywheel/api/material/FogShader.java | 0 .../flywheel/api/material/Material.java | 0 .../api/material/MaterialShaders.java | 0 .../flywheel/api/material/Transparency.java | 0 .../flywheel/api/material/WriteMask.java | 0 .../flywheel/api/model/IndexSequence.java | 0 .../com/jozufozu/flywheel/api/model/Mesh.java | 0 .../jozufozu/flywheel/api/model/Model.java | 0 .../flywheel/api/registry/IdRegistry.java | 0 .../flywheel/api/registry/Registry.java | 0 .../com/jozufozu/flywheel/api/task/Plan.java | 0 .../flywheel/api/task/TaskExecutor.java | 0 .../api/vertex/MutableVertexList.java | 0 .../flywheel/api/vertex/VertexList.java | 0 .../flywheel/api/vertex/VertexView.java | 0 .../api/vertex/VertexViewProvider.java | 0 .../vertex/VertexViewProviderRegistry.java | 0 .../api/visual/BlockEntityVisual.java | 0 .../api/visual/DistanceUpdateLimiter.java | 0 .../flywheel/api/visual/DynamicVisual.java | 0 .../jozufozu/flywheel/api/visual/Effect.java | 0 .../flywheel/api/visual/EffectVisual.java | 0 .../flywheel/api/visual/EntityVisual.java | 0 .../flywheel/api/visual/LitVisual.java | 0 .../flywheel/api/visual/TickableVisual.java | 0 .../jozufozu/flywheel/api/visual/Visual.java | 0 .../visualization/BlockEntityVisualizer.java | 0 .../api/visualization/EntityVisualizer.java | 0 .../api/visualization/VisualEmbedding.java | 0 .../api/visualization/VisualManager.java | 0 .../visualization/VisualizationContext.java | 0 .../api/visualization/VisualizationLevel.java | 0 .../visualization/VisualizationManager.java | 0 .../api/visualization/VisualizerRegistry.java | 0 .../jozufozu/flywheel/backend/Backends.java | 0 .../flywheel/backend/InternalVertex.java | 0 .../flywheel/backend/LayoutAttributes.java | 0 .../jozufozu/flywheel/backend/Samplers.java | 0 .../flywheel/backend/ShaderIndices.java | 0 .../backend/compile/ContextShader.java | 0 .../flywheel/backend/compile/FlwPrograms.java | 0 .../backend/compile/IndirectPrograms.java | 0 .../backend/compile/InstancingPrograms.java | 0 .../flywheel/backend/compile/Pipeline.java | 0 .../backend/compile/PipelineCompiler.java | 0 .../backend/compile/PipelineProgramKey.java | 0 .../flywheel/backend/compile/Pipelines.java | 0 .../backend/compile/SourceChecks.java | 0 .../BufferTextureInstanceComponent.java | 0 .../component/InstanceAssemblerComponent.java | 0 .../component/InstanceStructComponent.java | 0 .../component/SsboInstanceComponent.java | 0 .../StringSubstitutionComponent.java | 0 .../component/UberShaderComponent.java | 0 .../backend/compile/core/Compilation.java | 0 .../compile/core/CompilationHarness.java | 0 .../backend/compile/core/Compile.java | 0 .../backend/compile/core/CompilerStats.java | 0 .../compile/core/FailedCompilation.java | 0 .../backend/compile/core/LinkResult.java | 0 .../backend/compile/core/ProgramLinker.java | 0 .../backend/compile/core/ShaderCache.java | 0 .../backend/compile/core/ShaderResult.java | 0 .../backend/compile/core/SourceLoader.java | 0 .../backend/engine/AbstractInstancer.java | 0 .../backend/engine/CommonCrumbling.java | 0 .../flywheel/backend/engine/DrawManager.java | 0 .../flywheel/backend/engine/EngineImpl.java | 0 .../backend/engine/EnvironmentStorage.java | 0 .../flywheel/backend/engine/GroupKey.java | 0 .../flywheel/backend/engine/IndexPool.java | 0 .../backend/engine/InstanceHandleImpl.java | 0 .../flywheel/backend/engine/InstancerKey.java | 0 .../backend/engine/InstancerProviderImpl.java | 0 .../backend/engine/MaterialEncoder.java | 0 .../backend/engine/MaterialRenderState.java | 0 .../flywheel/backend/engine/MeshPool.java | 0 .../backend/engine/TextureBinder.java | 0 .../embed/AbstractEmbeddedEnvironment.java | 0 .../engine/embed/EmbeddedLightTexture.java | 0 .../engine/embed/EmbeddedLightVolume.java | 0 .../engine/embed/EmbeddingUniforms.java | 0 .../backend/engine/embed/Environment.java | 0 .../engine/embed/GlobalEnvironment.java | 0 .../embed/NestedEmbeddedEnvironment.java | 0 .../embed/TopLevelEmbeddedEnvironment.java | 0 .../engine/indirect/IndirectBuffers.java | 0 .../engine/indirect/IndirectCullingGroup.java | 0 .../backend/engine/indirect/IndirectDraw.java | 0 .../engine/indirect/IndirectDrawManager.java | 0 .../engine/indirect/IndirectInstancer.java | 0 .../indirect/ResizableStorageArray.java | 0 .../indirect/ResizableStorageBuffer.java | 0 .../backend/engine/indirect/ScatterList.java | 0 .../engine/indirect/StagingBuffer.java | 0 .../backend/engine/indirect/TransferList.java | 0 .../engine/instancing/InstancedDraw.java | 0 .../instancing/InstancedDrawManager.java | 0 .../engine/instancing/InstancedInstancer.java | 0 .../instancing/InstancedRenderStage.java | 0 .../backend/engine/uniform/FogUniforms.java | 0 .../backend/engine/uniform/FrameUniforms.java | 0 .../backend/engine/uniform/LevelUniforms.java | 0 .../engine/uniform/OptionsUniforms.java | 0 .../engine/uniform/PlayerUniforms.java | 0 .../backend/engine/uniform/UniformBuffer.java | 0 .../backend/engine/uniform/UniformWriter.java | 0 .../backend/engine/uniform/Uniforms.java | 0 .../jozufozu/flywheel/backend/gl/Driver.java | 0 .../flywheel/backend/gl/GlCompat.java | 0 .../jozufozu/flywheel/backend/gl/GlFence.java | 0 .../flywheel/backend/gl/GlNumericType.java | 0 .../flywheel/backend/gl/GlObject.java | 0 .../flywheel/backend/gl/GlPrimitive.java | 0 .../flywheel/backend/gl/GlStateTracker.java | 0 .../flywheel/backend/gl/GlTexture.java | 0 .../flywheel/backend/gl/GlTextureUnit.java | 0 .../flywheel/backend/gl/TextureBuffer.java | 0 .../backend/gl/array/GlVertexArray.java | 0 .../backend/gl/array/GlVertexArrayDSA.java | 0 .../backend/gl/array/GlVertexArrayGL3.java | 0 .../GlVertexArraySeparateAttributes.java | 0 .../backend/gl/array/VertexAttribute.java | 0 .../flywheel/backend/gl/buffer/Buffer.java | 0 .../flywheel/backend/gl/buffer/GlBuffer.java | 0 .../backend/gl/buffer/GlBufferType.java | 0 .../backend/gl/buffer/GlBufferUsage.java | 0 .../flywheel/backend/gl/error/GlError.java | 0 .../backend/gl/error/GlException.java | 0 .../flywheel/backend/gl/shader/GlProgram.java | 0 .../flywheel/backend/gl/shader/GlShader.java | 0 .../backend/gl/shader/ShaderType.java | 0 .../flywheel/backend/glsl/GlslVersion.java | 0 .../flywheel/backend/glsl/LoadError.java | 0 .../flywheel/backend/glsl/LoadResult.java | 0 .../flywheel/backend/glsl/ShaderSources.java | 0 .../backend/glsl/SourceComponent.java | 0 .../flywheel/backend/glsl/SourceFile.java | 0 .../flywheel/backend/glsl/SourceLines.java | 0 .../backend/glsl/error/ConsoleColors.java | 0 .../backend/glsl/error/ErrorBuilder.java | 0 .../backend/glsl/error/ErrorLevel.java | 0 .../backend/glsl/error/lines/Divider.java | 0 .../backend/glsl/error/lines/ErrorLine.java | 0 .../backend/glsl/error/lines/FileLine.java | 0 .../backend/glsl/error/lines/HeaderLine.java | 0 .../backend/glsl/error/lines/NestedLine.java | 0 .../backend/glsl/error/lines/SourceLine.java | 0 .../glsl/error/lines/SpanHighlightLine.java | 0 .../backend/glsl/error/lines/TextLine.java | 0 .../flywheel/backend/glsl/generate/BinOp.java | 0 .../backend/glsl/generate/FnSignature.java | 0 .../backend/glsl/generate/GlslBlock.java | 0 .../backend/glsl/generate/GlslBuilder.java | 0 .../backend/glsl/generate/GlslExpr.java | 0 .../backend/glsl/generate/GlslFn.java | 0 .../backend/glsl/generate/GlslStmt.java | 0 .../backend/glsl/generate/GlslStruct.java | 0 .../backend/glsl/generate/GlslSwitch.java | 0 .../glsl/generate/GlslUniformBlock.java | 0 .../glsl/generate/GlslVertexInput.java | 0 .../flywheel/backend/glsl/parse/Import.java | 0 .../backend/glsl/parse/ShaderField.java | 0 .../backend/glsl/parse/ShaderFunction.java | 0 .../backend/glsl/parse/ShaderStruct.java | 0 .../backend/glsl/parse/ShaderVariable.java | 0 .../backend/glsl/parse/StructField.java | 0 .../flywheel/backend/glsl/span/CharPos.java | 0 .../flywheel/backend/glsl/span/ErrorSpan.java | 0 .../flywheel/backend/glsl/span/Span.java | 0 .../backend/glsl/span/StringSpan.java | 0 .../mixin/AbstractClientPlayerAccessor.java | 0 .../backend/mixin/GameRendererAccessor.java | 0 .../backend/mixin/GlStateManagerMixin.java | 0 .../backend/mixin/LightTextureAccessor.java | 0 .../flywheel/backend/mixin/OptionsMixin.java | 0 .../backend/mixin/OverlayTextureAccessor.java | 0 .../backend/mixin/RenderSystemMixin.java | 0 .../backend/util/AtomicReferenceCounted.java | 0 .../flywheel/backend/util/MemoryBuffer.java | 0 .../backend/util/ReferenceCounted.java | 0 .../flywheel/config/BackendArgument.java | 0 .../jozufozu/flywheel/config/DebugMode.java | 0 .../jozufozu/flywheel/config/FlwCommands.java | 0 .../jozufozu/flywheel/config/FlwConfig.java | 0 .../flywheel/impl/BackendManagerImpl.java | 0 .../flywheel/impl/InternalFlywheelImpl.java | 0 .../impl/event/RenderContextImpl.java | 0 .../extension/BlockEntityTypeExtension.java | 0 .../impl/extension/EntityTypeExtension.java | 0 .../impl/extension/LevelExtension.java | 0 .../impl/extension/PoseStackExtension.java | 0 .../impl/extension/VertexFormatExtension.java | 0 .../impl/layout/ArrayElementTypeImpl.java | 0 .../impl/layout/LayoutBuilderImpl.java | 0 .../flywheel/impl/layout/LayoutImpl.java | 0 .../impl/layout/LayoutInterpreter.java | 0 .../impl/layout/MatrixElementTypeImpl.java | 0 .../impl/layout/ScalarElementTypeImpl.java | 0 .../impl/layout/VectorElementTypeImpl.java | 0 .../impl/mixin/BlockEntityTypeMixin.java | 0 .../impl/mixin/ClientChunkCacheMixin.java | 0 .../flywheel/impl/mixin/ClientLevelMixin.java | 0 .../flywheel/impl/mixin/EntityTypeMixin.java | 0 .../flywheel/impl/mixin/LevelMixin.java | 0 .../impl/mixin/LevelRendererMixin.java | 0 .../flywheel/impl/mixin/MinecraftMixin.java | 0 .../flywheel/impl/mixin/PoseStackMixin.java | 0 .../impl/mixin/VertexFormatMixin.java | 0 .../impl/mixin/fix/FixFabulousDepthMixin.java | 0 .../impl/mixin/fix/FixNormalScalingMixin.java | 0 .../sodium/ChunkBuilderMeshingTaskMixin.java | 0 .../impl/mixin/sodium/SodiumMixinPlugin.java | 0 .../mixin/visualmanage/BlockEntityMixin.java | 0 .../mixin/visualmanage/LevelChunkMixin.java | 0 .../visualmanage/LevelRendererMixin.java | 0 .../mixin/visualmanage/RebuildTaskMixin.java | 0 .../impl/registry/IdRegistryImpl.java | 0 .../flywheel/impl/registry/RegistryImpl.java | 0 .../flywheel/impl/task/FlwTaskExecutor.java | 0 .../impl/task/ParallelTaskExecutor.java | 0 .../impl/task/SerialTaskExecutor.java | 0 .../impl/task/ThreadGroupNotifier.java | 0 .../flywheel/impl/task/WaitGroup.java | 0 .../impl/vertex/InferredVertexFormatInfo.java | 0 .../impl/vertex/InferredVertexView.java | 0 .../vertex/InferredVertexViewProvider.java | 0 .../VertexViewProviderRegistryImpl.java | 0 .../impl/visual/DynamicVisualContextImpl.java | 0 .../visual/TickableVisualContextImpl.java | 0 .../VisualizationEventHandler.java | 0 .../visualization/VisualizationHelper.java | 0 .../VisualizationManagerImpl.java | 0 .../visualization/VisualizerRegistryImpl.java | 0 .../manager/BlockEntityStorage.java | 0 .../visualization/manager/EffectStorage.java | 0 .../visualization/manager/EntityStorage.java | 0 .../manager/VisualManagerImpl.java | 0 .../ratelimit/BandedPrimeLimiter.java | 0 .../ratelimit/DistanceUpdateLimiterImpl.java | 0 .../visualization/ratelimit/NonLimiter.java | 0 .../impl/visualization/storage/Action.java | 0 .../storage/LitVisualStorage.java | 0 .../impl/visualization/storage/Storage.java | 0 .../visualization/storage/Transaction.java | 0 .../flywheel/lib/backend/SimpleBackend.java | 0 .../com/jozufozu/flywheel/lib/box/Box.java | 0 .../jozufozu/flywheel/lib/box/MutableBox.java | 0 .../lib/instance/AbstractInstance.java | 0 .../lib/instance/ColoredLitInstance.java | 0 .../flywheel/lib/instance/FlatLit.java | 0 .../flywheel/lib/instance/InstanceTypes.java | 0 .../lib/instance/OrientedInstance.java | 0 .../flywheel/lib/instance/ShadowInstance.java | 0 .../lib/instance/SimpleInstanceType.java | 0 .../lib/instance/TransformedInstance.java | 0 .../flywheel/lib/light/LightPacking.java | 0 .../flywheel/lib/light/LightVolume.java | 0 .../flywheel/lib/material/CutoutShaders.java | 0 .../flywheel/lib/material/FogShaders.java | 0 .../flywheel/lib/material/Materials.java | 0 .../lib/material/SimpleCutoutShader.java | 0 .../lib/material/SimpleFogShader.java | 0 .../flywheel/lib/material/SimpleMaterial.java | 0 .../lib/material/SimpleMaterialShaders.java | 0 .../lib/material/StandardMaterialShaders.java | 0 .../flywheel/lib/math/MatrixMath.java | 0 .../jozufozu/flywheel/lib/math/MoreMath.java | 0 .../flywheel/lib/math/RenderMath.java | 0 .../lib/memory/AbstractMemoryBlockImpl.java | 0 .../lib/memory/DebugMemoryBlockImpl.java | 0 .../flywheel/lib/memory/FlwMemoryTracker.java | 0 .../flywheel/lib/memory/MemoryBlock.java | 0 .../flywheel/lib/memory/MemoryBlockImpl.java | 0 .../lib/memory/TrackedMemoryBlockImpl.java | 0 .../flywheel/lib/model/LineModelBuilder.java | 0 .../flywheel/lib/model/ModelCache.java | 0 .../flywheel/lib/model/ModelHolder.java | 0 .../flywheel/lib/model/ModelUtil.java | 0 .../jozufozu/flywheel/lib/model/Models.java | 0 .../flywheel/lib/model/QuadIndexSequence.java | 0 .../jozufozu/flywheel/lib/model/QuadMesh.java | 0 .../flywheel/lib/model/SimpleMesh.java | 0 .../flywheel/lib/model/SimpleModel.java | 0 .../flywheel/lib/model/SingleMeshModel.java | 0 .../lib/model/baked/BakedModelBufferer.java | 0 .../lib/model/baked/BakedModelBuilder.java | 0 .../lib/model/baked/BlockModelBuilder.java | 0 .../flywheel/lib/model/baked/MeshEmitter.java | 0 .../model/baked/MultiBlockModelBuilder.java | 0 .../lib/model/baked/PartialModel.java | 0 .../baked/TransformingVertexConsumer.java | 0 .../lib/model/baked/VirtualBlockGetter.java | 0 .../model/baked/VirtualEmptyBlockGetter.java | 0 .../lib/model/baked/VirtualLightEngine.java | 0 .../lib/model/part/ModelPartConverter.java | 0 .../flywheel/lib/model/part/VertexWriter.java | 0 .../flywheel/lib/task/BarrierPlan.java | 0 .../flywheel/lib/task/Distribute.java | 0 .../flywheel/lib/task/DynamicNestedPlan.java | 0 .../com/jozufozu/flywheel/lib/task/Flag.java | 0 .../flywheel/lib/task/ForEachPlan.java | 0 .../flywheel/lib/task/ForEachSlicePlan.java | 0 .../flywheel/lib/task/IfElsePlan.java | 0 .../flywheel/lib/task/MapContextPlan.java | 0 .../jozufozu/flywheel/lib/task/NamedFlag.java | 0 .../flywheel/lib/task/NestedPlan.java | 0 .../jozufozu/flywheel/lib/task/PlanMap.java | 0 .../jozufozu/flywheel/lib/task/RaisePlan.java | 0 .../flywheel/lib/task/RunnablePlan.java | 0 .../flywheel/lib/task/SimplePlan.java | 0 .../flywheel/lib/task/SimplyComposedPlan.java | 0 .../jozufozu/flywheel/lib/task/StageFlag.java | 0 .../flywheel/lib/task/SyncedPlan.java | 0 .../flywheel/lib/task/Synchronizer.java | 0 .../jozufozu/flywheel/lib/task/UnitPlan.java | 0 .../BooleanSupplierWithContext.java | 0 .../task/functional/ConsumerWithContext.java | 0 .../task/functional/RunnableWithContext.java | 0 .../task/functional/SupplierWithContext.java | 0 .../lib/task/functional/package-info.java | 0 .../flywheel/lib/transform/Affine.java | 0 .../lib/transform/PoseTransformStack.java | 0 .../flywheel/lib/transform/Rotate.java | 0 .../flywheel/lib/transform/Scale.java | 0 .../flywheel/lib/transform/Transform.java | 0 .../lib/transform/TransformStack.java | 0 .../flywheel/lib/transform/Translate.java | 0 .../flywheel/lib/util/AtomicBitset.java | 0 .../jozufozu/flywheel/lib/util/FlwUtil.java | 0 .../flywheel/lib/util/LevelAttached.java | 0 .../com/jozufozu/flywheel/lib/util/Pair.java | 0 .../flywheel/lib/util/ResourceUtil.java | 0 .../flywheel/lib/util/SectionUtil.java | 0 .../flywheel/lib/util/ShadersModHandler.java | 0 .../flywheel/lib/util/StringUtil.java | 0 .../com/jozufozu/flywheel/lib/util/Unit.java | 0 .../lib/vertex/AbstractVertexView.java | 0 .../flywheel/lib/vertex/EmptyVertexList.java | 0 .../flywheel/lib/vertex/FullVertexView.java | 0 .../lib/vertex/NoOverlayVertexView.java | 0 .../lib/vertex/PosTexNormalVertexView.java | 0 .../flywheel/lib/vertex/PosVertexView.java | 0 .../lib/visual/AbstractBlockEntityVisual.java | 0 .../lib/visual/AbstractEntityVisual.java | 0 .../flywheel/lib/visual/AbstractVisual.java | 0 .../flywheel/lib/visual/EntityComponent.java | 0 .../lib/visual/EntityVisibilityTester.java | 0 .../flywheel/lib/visual/InstanceRecycler.java | 0 .../visual/SimpleBlockEntityVisualizer.java | 0 .../lib/visual/SimpleDynamicVisual.java | 0 .../lib/visual/SimpleEntityVisual.java | 0 .../lib/visual/SimpleEntityVisualizer.java | 0 .../lib/visual/SimpleTickableVisual.java | 0 .../flywheel/lib/visual/SmartRecycler.java | 0 .../lib/visual/component/FireComponent.java | 0 .../lib/visual/component/HitboxComponent.java | 0 .../lib/visual/component/ShadowComponent.java | 0 .../jozufozu/flywheel/vanilla/BellVisual.java | 0 .../flywheel/vanilla/ChestVisual.java | 0 .../flywheel/vanilla/MinecartVisual.java | 0 .../flywheel/vanilla/ShulkerBoxVisual.java | 0 .../flywheel/vanilla/TntMinecartVisual.java | 0 .../flywheel/vanilla/VanillaVisuals.java | 0 .../vanilla/effect/ExampleEffect.java | 0 .../src}/main/resources/META-INF/mods.toml | 0 .../flywheel/flywheel/cutout/epsilon.glsl | 0 .../assets/flywheel/flywheel/cutout/half.glsl | 0 .../assets/flywheel/flywheel/cutout/off.glsl | 0 .../flywheel/flywheel/cutout/one_tenth.glsl | 0 .../assets/flywheel/flywheel/fog/linear.glsl | 0 .../flywheel/flywheel/fog/linear_fade.glsl | 0 .../assets/flywheel/flywheel/fog/none.glsl | 0 .../flywheel/instance/cull/oriented.glsl | 0 .../flywheel/instance/cull/shadow.glsl | 0 .../flywheel/instance/cull/transformed.glsl | 0 .../flywheel/flywheel/instance/oriented.vert | 0 .../flywheel/flywheel/instance/shadow.vert | 0 .../flywheel/instance/transformed.vert | 0 .../flywheel/flywheel/internal/api_impl.frag | 0 .../flywheel/flywheel/internal/api_impl.vert | 0 .../flywheel/flywheel/internal/colorizer.glsl | 0 .../flywheel/flywheel/internal/common.frag | 0 .../flywheel/flywheel/internal/common.vert | 0 .../flywheel/internal/components_header.frag | 0 .../flywheel/internal/components_header.vert | 0 .../flywheel/flywheel/internal/diffuse.glsl | 0 .../flywheel/internal/fog_distance.glsl | 0 .../flywheel/internal/indirect/apply.glsl | 0 .../internal/indirect/buffer_bindings.glsl | 0 .../flywheel/internal/indirect/cull.glsl | 0 .../internal/indirect/cull_api_impl.glsl | 0 .../internal/indirect/draw_command.glsl | 0 .../flywheel/internal/indirect/main.frag | 0 .../flywheel/internal/indirect/main.vert | 0 .../internal/indirect/model_descriptor.glsl | 0 .../flywheel/internal/indirect/scatter.glsl | 0 .../flywheel/internal/instancing/main.frag | 0 .../flywheel/internal/instancing/main.vert | 0 .../flywheel/flywheel/internal/material.glsl | 0 .../flywheel/internal/packed_material.glsl | 0 .../flywheel/internal/uniforms/fog.glsl | 0 .../flywheel/internal/uniforms/frame.glsl | 0 .../flywheel/internal/uniforms/level.glsl | 0 .../flywheel/internal/uniforms/options.glsl | 0 .../flywheel/internal/uniforms/player.glsl | 0 .../flywheel/internal/uniforms/uniforms.glsl | 0 .../flywheel/internal/vertex_input.vert | 0 .../flywheel/flywheel/material/default.frag | 0 .../flywheel/flywheel/material/default.vert | 0 .../flywheel/flywheel/material/lines.frag | 0 .../flywheel/flywheel/material/lines.vert | 0 .../flywheel/flywheel/material/wireframe.frag | 0 .../flywheel/flywheel/material/wireframe.vert | 0 .../assets/flywheel/flywheel/util/color.glsl | 0 .../assets/flywheel/flywheel/util/matrix.glsl | 0 .../flywheel/flywheel/util/quaternion.glsl | 0 .../resources/assets/flywheel/lang/en_us.json | 0 .../resources/flywheel.backend.mixins.json | 0 .../main/resources/flywheel.impl.mixins.json | 0 .../flywheel.impl.sodium.mixins.json | 0 {src => common/src}/main/resources/logo.png | Bin .../src}/main/resources/pack.mcmeta | 0 .../backend/glsl/MockShaderSources.java | 0 .../flywheel/backend/glsl/TestBase.java | 0 .../backend/glsl/TestErrorMessages.java | 0 .../backend/glsl/TestShaderSourceLoading.java | 0 .../flywheel/impl/task/WaitGroupTest.java | 0 .../lib/task/PlanCompositionTest.java | 0 .../flywheel/lib/task/PlanExecutionTest.java | 0 .../flywheel/lib/util/TestAtomicBitset.java | 0 fabric/build.gradle | 151 +++++++++++++ forge/build.gradle | 147 +++++++++++++ forge/gradle.properties | 1 + gradle.properties | 4 + gradle/wrapper/gradle-wrapper.jar | Bin 62076 -> 43453 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew | 22 +- gradlew.bat | 20 +- old.build.gradle | 205 ++++++++++++++++++ settings.gradle | 15 +- 476 files changed, 684 insertions(+), 206 deletions(-) create mode 100644 common/build.gradle rename {src => common/src}/main/java/com/jozufozu/flywheel/Flywheel.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/BackendImplemented.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/backend/Backend.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/backend/BackendManager.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/backend/Engine.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/event/BeginFrameEvent.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadEvent.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererEvent.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/event/RenderContext.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/event/RenderStage.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/event/RenderStageEvent.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/instance/Instance.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/instance/InstanceHandle.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/instance/InstanceType.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/instance/InstanceWriter.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/instance/Instancer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/instance/InstancerProvider.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/internal/package-info.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/layout/ArrayElementType.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/layout/ElementType.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/layout/FloatRepr.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/layout/IntegerRepr.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/layout/Layout.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/layout/LayoutBuilder.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/layout/MatrixElementType.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/layout/ScalarElementType.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/layout/UnsignedIntegerRepr.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/layout/ValueRepr.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/layout/VectorElementType.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/material/CutoutShader.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/material/DepthTest.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/material/FogShader.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/material/Material.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/material/MaterialShaders.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/material/Transparency.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/material/WriteMask.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/model/IndexSequence.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/model/Mesh.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/model/Model.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/registry/IdRegistry.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/registry/Registry.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/task/Plan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/task/TaskExecutor.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/vertex/MutableVertexList.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/vertex/VertexList.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/vertex/VertexView.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProvider.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProviderRegistry.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visual/BlockEntityVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visual/DistanceUpdateLimiter.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visual/DynamicVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visual/Effect.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visual/EffectVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visual/EntityVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visual/LitVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visual/TickableVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visual/Visual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visualization/BlockEntityVisualizer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visualization/EntityVisualizer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visualization/VisualEmbedding.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visualization/VisualManager.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visualization/VisualizationContext.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visualization/VisualizationLevel.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visualization/VisualizationManager.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/api/visualization/VisualizerRegistry.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/Backends.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/InternalVertex.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/LayoutAttributes.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/Samplers.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/ShaderIndices.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/ContextShader.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/Pipeline.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/PipelineProgramKey.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/Pipelines.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/SourceChecks.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/component/BufferTextureInstanceComponent.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceAssemblerComponent.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/component/SsboInstanceComponent.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/component/StringSubstitutionComponent.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/component/UberShaderComponent.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/core/CompilationHarness.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/core/Compile.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/core/CompilerStats.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/core/FailedCompilation.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/core/LinkResult.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/core/ProgramLinker.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/core/ShaderCache.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/core/ShaderResult.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/compile/core/SourceLoader.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/AbstractInstancer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/CommonCrumbling.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/DrawManager.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/EngineImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/EnvironmentStorage.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/GroupKey.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/IndexPool.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/InstanceHandleImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/InstancerKey.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/InstancerProviderImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/MaterialEncoder.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/MaterialRenderState.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/MeshPool.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/TextureBinder.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/embed/AbstractEmbeddedEnvironment.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightTexture.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightVolume.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddingUniforms.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/embed/Environment.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/embed/GlobalEnvironment.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/embed/NestedEmbeddedEnvironment.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/embed/TopLevelEmbeddedEnvironment.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectBuffers.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectCullingGroup.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDraw.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDrawManager.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectInstancer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageArray.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageBuffer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/indirect/ScatterList.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/indirect/StagingBuffer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/indirect/TransferList.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDraw.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDrawManager.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedInstancer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedRenderStage.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/uniform/FogUniforms.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/uniform/LevelUniforms.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/uniform/OptionsUniforms.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformBuffer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformWriter.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/Driver.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/GlCompat.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/GlFence.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/GlNumericType.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/GlObject.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/GlPrimitive.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/GlStateTracker.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/GlTexture.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/GlTextureUnit.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/TextureBuffer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArray.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayDSA.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayGL3.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArraySeparateAttributes.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/array/VertexAttribute.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/buffer/Buffer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferType.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferUsage.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/error/GlError.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/error/GlException.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/shader/GlProgram.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/shader/GlShader.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/gl/shader/ShaderType.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/GlslVersion.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/LoadError.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/LoadResult.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/ShaderSources.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/SourceComponent.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/SourceFile.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/SourceLines.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/error/ConsoleColors.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/error/ErrorBuilder.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/error/ErrorLevel.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/Divider.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/ErrorLine.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/FileLine.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/HeaderLine.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/NestedLine.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/SourceLine.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/SpanHighlightLine.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/TextLine.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/generate/BinOp.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/generate/FnSignature.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBlock.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBuilder.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslExpr.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslFn.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStmt.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStruct.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslSwitch.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslUniformBlock.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslVertexInput.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/parse/Import.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderField.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderFunction.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderStruct.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderVariable.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/parse/StructField.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/span/CharPos.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/span/ErrorSpan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/span/Span.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/glsl/span/StringSpan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/mixin/AbstractClientPlayerAccessor.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/mixin/GameRendererAccessor.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/mixin/GlStateManagerMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/mixin/LightTextureAccessor.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/mixin/OptionsMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/mixin/OverlayTextureAccessor.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/mixin/RenderSystemMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/util/AtomicReferenceCounted.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/util/MemoryBuffer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/backend/util/ReferenceCounted.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/config/BackendArgument.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/config/DebugMode.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/config/FlwCommands.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/config/FlwConfig.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/event/RenderContextImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/extension/BlockEntityTypeExtension.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/extension/EntityTypeExtension.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/extension/LevelExtension.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/extension/PoseStackExtension.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/extension/VertexFormatExtension.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/layout/ArrayElementTypeImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/layout/LayoutBuilderImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/layout/LayoutImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/layout/LayoutInterpreter.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/layout/MatrixElementTypeImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/layout/ScalarElementTypeImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/layout/VectorElementTypeImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/BlockEntityTypeMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/ClientChunkCacheMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/ClientLevelMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/EntityTypeMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/LevelMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/PoseStackMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/VertexFormatMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/fix/FixFabulousDepthMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/fix/FixNormalScalingMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/sodium/ChunkBuilderMeshingTaskMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/BlockEntityMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/LevelChunkMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/LevelRendererMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/RebuildTaskMixin.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/registry/IdRegistryImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/registry/RegistryImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/task/FlwTaskExecutor.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/task/ParallelTaskExecutor.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/task/SerialTaskExecutor.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/task/ThreadGroupNotifier.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/task/WaitGroup.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/vertex/InferredVertexFormatInfo.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/vertex/InferredVertexView.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/vertex/InferredVertexViewProvider.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/vertex/VertexViewProviderRegistryImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visual/DynamicVisualContextImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visual/TickableVisualContextImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationHelper.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visualization/VisualizerRegistryImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visualization/manager/BlockEntityStorage.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visualization/manager/EffectStorage.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visualization/manager/EntityStorage.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visualization/manager/VisualManagerImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visualization/ratelimit/BandedPrimeLimiter.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visualization/ratelimit/DistanceUpdateLimiterImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visualization/ratelimit/NonLimiter.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visualization/storage/Action.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visualization/storage/LitVisualStorage.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visualization/storage/Storage.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/impl/visualization/storage/Transaction.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/backend/SimpleBackend.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/box/Box.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/box/MutableBox.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/instance/AbstractInstance.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/instance/ColoredLitInstance.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/instance/FlatLit.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/instance/OrientedInstance.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/instance/ShadowInstance.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/instance/SimpleInstanceType.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/instance/TransformedInstance.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/light/LightPacking.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/light/LightVolume.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/material/CutoutShaders.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/material/FogShaders.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/material/Materials.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/material/SimpleCutoutShader.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/material/SimpleFogShader.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/material/SimpleMaterial.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/material/SimpleMaterialShaders.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/math/MatrixMath.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/math/MoreMath.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/math/RenderMath.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/memory/AbstractMemoryBlockImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/memory/DebugMemoryBlockImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/memory/FlwMemoryTracker.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/memory/MemoryBlock.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/memory/MemoryBlockImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/memory/TrackedMemoryBlockImpl.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/LineModelBuilder.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/ModelCache.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/ModelHolder.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/Models.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/QuadIndexSequence.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/QuadMesh.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/SimpleMesh.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/SimpleModel.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/SingleMeshModel.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/baked/TransformingVertexConsumer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualBlockGetter.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualEmptyBlockGetter.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualLightEngine.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/part/ModelPartConverter.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/model/part/VertexWriter.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/BarrierPlan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/Distribute.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/DynamicNestedPlan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/Flag.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/ForEachPlan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/ForEachSlicePlan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/IfElsePlan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/MapContextPlan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/NamedFlag.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/NestedPlan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/PlanMap.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/RaisePlan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/RunnablePlan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/SimplePlan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/SimplyComposedPlan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/StageFlag.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/SyncedPlan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/Synchronizer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/UnitPlan.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/functional/BooleanSupplierWithContext.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/functional/ConsumerWithContext.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/functional/RunnableWithContext.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/functional/SupplierWithContext.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/task/functional/package-info.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/transform/Affine.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/transform/PoseTransformStack.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/transform/Rotate.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/transform/Scale.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/transform/Transform.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/transform/Translate.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/util/AtomicBitset.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/util/FlwUtil.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/util/LevelAttached.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/util/Pair.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/util/ResourceUtil.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/util/SectionUtil.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/util/StringUtil.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/util/Unit.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/vertex/AbstractVertexView.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/vertex/EmptyVertexList.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/vertex/FullVertexView.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/vertex/NoOverlayVertexView.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/vertex/PosTexNormalVertexView.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/vertex/PosVertexView.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/visual/AbstractBlockEntityVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/visual/AbstractEntityVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/visual/AbstractVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/visual/EntityComponent.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/visual/EntityVisibilityTester.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/visual/InstanceRecycler.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/visual/SimpleBlockEntityVisualizer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisualizer.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/visual/SmartRecycler.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/visual/component/FireComponent.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/visual/component/HitboxComponent.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/lib/visual/component/ShadowComponent.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/vanilla/BellVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/vanilla/ChestVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/vanilla/MinecartVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/vanilla/ShulkerBoxVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/vanilla/TntMinecartVisual.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/vanilla/VanillaVisuals.java (100%) rename {src => common/src}/main/java/com/jozufozu/flywheel/vanilla/effect/ExampleEffect.java (100%) rename {src => common/src}/main/resources/META-INF/mods.toml (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/cutout/epsilon.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/cutout/half.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/cutout/off.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/cutout/one_tenth.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/fog/linear.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/fog/linear_fade.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/fog/none.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/instance/cull/oriented.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/instance/cull/shadow.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/instance/cull/transformed.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/instance/oriented.vert (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/instance/shadow.vert (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/instance/transformed.vert (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/api_impl.frag (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/api_impl.vert (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/colorizer.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/common.frag (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/common.vert (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/components_header.frag (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/components_header.vert (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/diffuse.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/fog_distance.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/indirect/apply.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/indirect/buffer_bindings.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/indirect/cull_api_impl.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/indirect/draw_command.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/indirect/main.frag (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/indirect/main.vert (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/indirect/model_descriptor.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/indirect/scatter.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/instancing/main.frag (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/instancing/main.vert (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/material.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/packed_material.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/uniforms/fog.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/uniforms/frame.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/uniforms/level.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/uniforms/options.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/uniforms/player.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/uniforms/uniforms.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/internal/vertex_input.vert (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/material/default.frag (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/material/default.vert (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/material/lines.frag (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/material/lines.vert (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/material/wireframe.frag (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/material/wireframe.vert (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/util/color.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/util/matrix.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/flywheel/util/quaternion.glsl (100%) rename {src => common/src}/main/resources/assets/flywheel/lang/en_us.json (100%) rename {src => common/src}/main/resources/flywheel.backend.mixins.json (100%) rename {src => common/src}/main/resources/flywheel.impl.mixins.json (100%) rename {src => common/src}/main/resources/flywheel.impl.sodium.mixins.json (100%) rename {src => common/src}/main/resources/logo.png (100%) rename {src => common/src}/main/resources/pack.mcmeta (100%) rename {src => common/src}/test/java/com/jozufozu/flywheel/backend/glsl/MockShaderSources.java (100%) rename {src => common/src}/test/java/com/jozufozu/flywheel/backend/glsl/TestBase.java (100%) rename {src => common/src}/test/java/com/jozufozu/flywheel/backend/glsl/TestErrorMessages.java (100%) rename {src => common/src}/test/java/com/jozufozu/flywheel/backend/glsl/TestShaderSourceLoading.java (100%) rename {src => common/src}/test/java/com/jozufozu/flywheel/impl/task/WaitGroupTest.java (100%) rename {src => common/src}/test/java/com/jozufozu/flywheel/lib/task/PlanCompositionTest.java (100%) rename {src => common/src}/test/java/com/jozufozu/flywheel/lib/task/PlanExecutionTest.java (100%) rename {src => common/src}/test/java/com/jozufozu/flywheel/lib/util/TestAtomicBitset.java (100%) create mode 100644 fabric/build.gradle create mode 100644 forge/build.gradle create mode 100644 forge/gradle.properties create mode 100644 old.build.gradle diff --git a/.gitignore b/.gitignore index 88fc08b84..c5cbdefa4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ build/ gradle-app.setting out/ logs/ +dist/ ## IntelliJ IDEA diff --git a/build.gradle b/build.gradle index 6caf08ab3..1ec9b2791 100644 --- a/build.gradle +++ b/build.gradle @@ -1,108 +1,34 @@ plugins { id 'eclipse' id 'idea' - id 'maven-publish' - id 'net.minecraftforge.gradle' version "${forgegradle_version}" - id 'org.parchmentmc.librarian.forgegradle' version "${librarian_version}" - id 'org.spongepowered.mixin' version "${mixingradle_version}" + // make sure gradle loads the same arch plugin across all subprojects + id 'dev.architectury.loom' apply false } -boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false'); - -ext.buildNumber = System.getenv('BUILD_NUMBER') - -group = 'com.jozufozu.flywheel' -archivesBaseName = "flywheel-forge-${artifact_minecraft_version}" -version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') - -java.toolchain.languageVersion = JavaLanguageVersion.of(17) - println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" -minecraft { - mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" - copyIdeResources = true +subprojects { + boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false'); - runs { - configureEach { - workingDirectory project.file('run') + ext.buildNumber = System.getenv('BUILD_NUMBER') - property 'forge.logging.markers', '' - property 'forge.logging.console.level', 'debug' + group = 'com.jozufozu.flywheel' + version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') - property 'mixin.env.remapRefMap', 'true' - property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" - - mods { - flywheel { - source sourceSets.main - } - } - } - - client { - property 'flw.dumpShaderSource', 'true' - property 'flw.debugMemorySafety', 'true' + tasks { + // make builds reproducible + withType(AbstractArchiveTask).configureEach { + preserveFileTimestamps = false + reproducibleFileOrder = true } - server { - args '--nogui' + // module metadata is often broken on multi-platform projects + withType(GenerateModuleMetadata).configureEach { + enabled = false } } } -repositories { - maven { - url 'https://www.cursemaven.com' - content { - includeGroup "curse.maven" - } - } - maven { - name 'tterrag maven' - url 'https://maven.tterrag.com/' - } - maven { - name = "Modrinth" - url = "https://api.modrinth.com/maven" - content { - includeGroup "maven.modrinth" - } - } - mavenCentral() -} - -dependencies { - testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1' - minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" - - compileOnly fg.deobf("maven.modrinth:embeddium:0.3.9+mc1.20.1") - compileOnly fg.deobf("maven.modrinth:oculus:1.20.1-1.6.15a") - // implementation fg.deobf("maven.modrinth:starlight-forge:1.1.2+1.20") - - // https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497 - // Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings - // This allows 'Settings > Build, Execution, and Deployment > Build Tools > Gradle > Build and run using' set to IntelliJ to work correctly - // if (System.getProperty('idea.sync.active') != 'true') { - annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor" - // } -} - -test { - useJUnitPlatform() -} - -mixin { - add sourceSets.main, 'flywheel.refmap.json' - - config 'flywheel.backend.mixins.json' - config 'flywheel.impl.mixins.json' - config 'flywheel.impl.sodium.mixins.json' - - debug.verbose = true - debug.export = true -} - idea { // Tell IDEA to always download sources/javadoc artifacts from maven. module { @@ -110,96 +36,3 @@ idea { downloadSources = true } } - -// Workaround for SpongePowered/MixinGradle#38 -afterEvaluate { - tasks.configureReobfTaskForReobfJar.mustRunAfter(tasks.compileJava) -} - -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation -} - -javadoc { - source = [sourceSets.main.allJava] - // prevent java 8's strict doclint for javadocs from failing builds - options.addStringOption('Xdoclint:none', '-quiet') -} - -compileJava { - options.compilerArgs = ['-Xdiags:verbose'] -} - -tasks.named('processResources', ProcessResources).configure { - var replaceProperties = [ - minecraft_version : minecraft_version, - minecraft_version_range: minecraft_version_range, - forge_version : forge_version, - forge_version_range : forge_version_range, - loader_version_range : loader_version_range, - mod_version : mod_version - ] - inputs.properties replaceProperties - - filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { - expand replaceProperties + [project: project] - } -} - -apply from: rootProject.file('gradle/package-infos.gradle') - -void addLicense(jarTask) { - jarTask.from('LICENSE.md') { - rename '(.*)\\.(.*)', '$1_' + archivesBaseName + '.$2' - } -} - -void addManifest(jarTask) { - jarTask.manifest { - attributes([ - 'Specification-Title' : 'flywheel', - // 'Specification-Vendor': 'flywheel authors', - 'Specification-Version' : '1', // We are version 1 of ourselves - 'Implementation-Title' : project.jar.archiveBaseName, - 'Implementation-Version' : project.jar.archiveVersion, - // 'Implementation-Vendor': 'flywheel authors', - 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - ]) - } -} - -tasks.named('jar', Jar).configure { - archiveClassifier = '' - - finalizedBy 'reobfJar' - addManifest(it) - addLicense(it) -} - -java { - withSourcesJar() - withJavadocJar() -} - -publishing { - publications { - register('mavenJava', MavenPublication) { - artifact jar - artifact sourcesJar - artifact javadocJar - - artifactId = archivesBaseName - - fg.component(it) - } - } - repositories { - maven { - url "file://${project.projectDir}/mcmodsrepo" - } - - if (project.hasProperty('mavendir')) { - maven { url mavendir } - } - } -} diff --git a/common/build.gradle b/common/build.gradle new file mode 100644 index 000000000..3e4ebaeeb --- /dev/null +++ b/common/build.gradle @@ -0,0 +1,124 @@ +plugins { + id 'maven-publish' + id 'dev.architectury.loom' +} + +base { + archivesName = "flywheel-${project.name}-${artifact_minecraft_version}" +} + +repositories { + maven { + name = 'ParchmentMC' + url = 'https://maven.parchmentmc.org' + } + mavenCentral() +} + +dependencies { + minecraft "com.mojang:minecraft:$minecraft_version" + mappings(loom.layered() { + officialMojangMappings() + parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") + }) + + modCompileOnly "net.fabricmc:fabric-loader:$fabric_loader_version" +} + +java { + JavaVersion javaVersion = JavaVersion.toVersion(java_version) + sourceCompatibility = javaVersion + targetCompatibility = javaVersion + + toolchain.languageVersion = JavaLanguageVersion.of(java_version) + + withSourcesJar() + withJavadocJar() +} + +processResources.configure { + from(project(':common').sourceSets.main.resources) + + var replaceProperties = [ + minecraft_version : minecraft_version, + minecraft_version_range: minecraft_version_range, + forge_version : forge_version, + forge_version_range : forge_version_range, + loader_version_range : loader_version_range, + mod_version : mod_version + ] + inputs.properties replaceProperties + + filesMatching(['META-INF/mods.toml', 'META-INF/neoforge.mods.toml', 'pack.mcmeta', 'fabric.mod.json']) { + expand replaceProperties + [project: project] + } +} + +tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' + options.release = Integer.parseInt(java_version) + options.compilerArgs = ['-Xdiags:verbose'] +} + +jar.configure { + archiveClassifier = '' + addManifest(it) + addLicense(it) +} + +sourcesJar.configure { + addManifest(it) + addLicense(it) +} + +javadoc.configure { + // prevent java 8's strict doclint for javadocs from failing builds + options.addStringOption('Xdoclint:none', '-quiet') +} + +test.configure { + useJUnitPlatform() +} + +void addLicense(jarTask) { + jarTask.from('LICENSE.md') { + rename '(.*)\\.(.*)', '$1_' + archivesBaseName + '.$2' + } +} + +void addManifest(jarTask) { + jarTask.manifest { + attributes([ + 'Specification-Title' : 'flywheel', + // 'Specification-Vendor': 'flywheel authors', + 'Specification-Version' : '1', // We are version 1 of ourselves + 'Implementation-Title' : project.jar.archiveBaseName, + 'Implementation-Version' : project.jar.archiveVersion, + // 'Implementation-Vendor': 'flywheel authors', + 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), + ]) + } +} + +publishing { + publications { + register('mavenJava', MavenPublication) { + from(components["java"]) + artifactId = "flywheel-${project.name}-intermediary-${artifact_minecraft_version}" + } + register('mojmapJava', MavenPublication) { + artifact jar + artifact sourcesJar + artifactId = "flywheel-${project.name}-mojmap-${artifact_minecraft_version}" + } + } + repositories { + maven { + url "file://${project.projectDir}/mcmodsrepo" + } + + if (project.hasProperty('mavendir')) { + maven { url rootProject.file(property('mavendir')) } + } + } +} diff --git a/src/main/java/com/jozufozu/flywheel/Flywheel.java b/common/src/main/java/com/jozufozu/flywheel/Flywheel.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/Flywheel.java rename to common/src/main/java/com/jozufozu/flywheel/Flywheel.java diff --git a/src/main/java/com/jozufozu/flywheel/api/BackendImplemented.java b/common/src/main/java/com/jozufozu/flywheel/api/BackendImplemented.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/BackendImplemented.java rename to common/src/main/java/com/jozufozu/flywheel/api/BackendImplemented.java diff --git a/src/main/java/com/jozufozu/flywheel/api/backend/Backend.java b/common/src/main/java/com/jozufozu/flywheel/api/backend/Backend.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/backend/Backend.java rename to common/src/main/java/com/jozufozu/flywheel/api/backend/Backend.java diff --git a/src/main/java/com/jozufozu/flywheel/api/backend/BackendManager.java b/common/src/main/java/com/jozufozu/flywheel/api/backend/BackendManager.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/backend/BackendManager.java rename to common/src/main/java/com/jozufozu/flywheel/api/backend/BackendManager.java diff --git a/src/main/java/com/jozufozu/flywheel/api/backend/Engine.java b/common/src/main/java/com/jozufozu/flywheel/api/backend/Engine.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/backend/Engine.java rename to common/src/main/java/com/jozufozu/flywheel/api/backend/Engine.java diff --git a/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameEvent.java b/common/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameEvent.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/event/BeginFrameEvent.java rename to common/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameEvent.java diff --git a/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadEvent.java b/common/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadEvent.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadEvent.java rename to common/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadEvent.java diff --git a/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererEvent.java b/common/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererEvent.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererEvent.java rename to common/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererEvent.java diff --git a/src/main/java/com/jozufozu/flywheel/api/event/RenderContext.java b/common/src/main/java/com/jozufozu/flywheel/api/event/RenderContext.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/event/RenderContext.java rename to common/src/main/java/com/jozufozu/flywheel/api/event/RenderContext.java diff --git a/src/main/java/com/jozufozu/flywheel/api/event/RenderStage.java b/common/src/main/java/com/jozufozu/flywheel/api/event/RenderStage.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/event/RenderStage.java rename to common/src/main/java/com/jozufozu/flywheel/api/event/RenderStage.java diff --git a/src/main/java/com/jozufozu/flywheel/api/event/RenderStageEvent.java b/common/src/main/java/com/jozufozu/flywheel/api/event/RenderStageEvent.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/event/RenderStageEvent.java rename to common/src/main/java/com/jozufozu/flywheel/api/event/RenderStageEvent.java diff --git a/src/main/java/com/jozufozu/flywheel/api/instance/Instance.java b/common/src/main/java/com/jozufozu/flywheel/api/instance/Instance.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/instance/Instance.java rename to common/src/main/java/com/jozufozu/flywheel/api/instance/Instance.java diff --git a/src/main/java/com/jozufozu/flywheel/api/instance/InstanceHandle.java b/common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceHandle.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/instance/InstanceHandle.java rename to common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceHandle.java diff --git a/src/main/java/com/jozufozu/flywheel/api/instance/InstanceType.java b/common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceType.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/instance/InstanceType.java rename to common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceType.java diff --git a/src/main/java/com/jozufozu/flywheel/api/instance/InstanceWriter.java b/common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceWriter.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/instance/InstanceWriter.java rename to common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceWriter.java diff --git a/src/main/java/com/jozufozu/flywheel/api/instance/Instancer.java b/common/src/main/java/com/jozufozu/flywheel/api/instance/Instancer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/instance/Instancer.java rename to common/src/main/java/com/jozufozu/flywheel/api/instance/Instancer.java diff --git a/src/main/java/com/jozufozu/flywheel/api/instance/InstancerProvider.java b/common/src/main/java/com/jozufozu/flywheel/api/instance/InstancerProvider.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/instance/InstancerProvider.java rename to common/src/main/java/com/jozufozu/flywheel/api/instance/InstancerProvider.java diff --git a/src/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java b/common/src/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java rename to common/src/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java diff --git a/src/main/java/com/jozufozu/flywheel/api/internal/package-info.java b/common/src/main/java/com/jozufozu/flywheel/api/internal/package-info.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/internal/package-info.java rename to common/src/main/java/com/jozufozu/flywheel/api/internal/package-info.java diff --git a/src/main/java/com/jozufozu/flywheel/api/layout/ArrayElementType.java b/common/src/main/java/com/jozufozu/flywheel/api/layout/ArrayElementType.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/layout/ArrayElementType.java rename to common/src/main/java/com/jozufozu/flywheel/api/layout/ArrayElementType.java diff --git a/src/main/java/com/jozufozu/flywheel/api/layout/ElementType.java b/common/src/main/java/com/jozufozu/flywheel/api/layout/ElementType.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/layout/ElementType.java rename to common/src/main/java/com/jozufozu/flywheel/api/layout/ElementType.java diff --git a/src/main/java/com/jozufozu/flywheel/api/layout/FloatRepr.java b/common/src/main/java/com/jozufozu/flywheel/api/layout/FloatRepr.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/layout/FloatRepr.java rename to common/src/main/java/com/jozufozu/flywheel/api/layout/FloatRepr.java diff --git a/src/main/java/com/jozufozu/flywheel/api/layout/IntegerRepr.java b/common/src/main/java/com/jozufozu/flywheel/api/layout/IntegerRepr.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/layout/IntegerRepr.java rename to common/src/main/java/com/jozufozu/flywheel/api/layout/IntegerRepr.java diff --git a/src/main/java/com/jozufozu/flywheel/api/layout/Layout.java b/common/src/main/java/com/jozufozu/flywheel/api/layout/Layout.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/layout/Layout.java rename to common/src/main/java/com/jozufozu/flywheel/api/layout/Layout.java diff --git a/src/main/java/com/jozufozu/flywheel/api/layout/LayoutBuilder.java b/common/src/main/java/com/jozufozu/flywheel/api/layout/LayoutBuilder.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/layout/LayoutBuilder.java rename to common/src/main/java/com/jozufozu/flywheel/api/layout/LayoutBuilder.java diff --git a/src/main/java/com/jozufozu/flywheel/api/layout/MatrixElementType.java b/common/src/main/java/com/jozufozu/flywheel/api/layout/MatrixElementType.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/layout/MatrixElementType.java rename to common/src/main/java/com/jozufozu/flywheel/api/layout/MatrixElementType.java diff --git a/src/main/java/com/jozufozu/flywheel/api/layout/ScalarElementType.java b/common/src/main/java/com/jozufozu/flywheel/api/layout/ScalarElementType.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/layout/ScalarElementType.java rename to common/src/main/java/com/jozufozu/flywheel/api/layout/ScalarElementType.java diff --git a/src/main/java/com/jozufozu/flywheel/api/layout/UnsignedIntegerRepr.java b/common/src/main/java/com/jozufozu/flywheel/api/layout/UnsignedIntegerRepr.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/layout/UnsignedIntegerRepr.java rename to common/src/main/java/com/jozufozu/flywheel/api/layout/UnsignedIntegerRepr.java diff --git a/src/main/java/com/jozufozu/flywheel/api/layout/ValueRepr.java b/common/src/main/java/com/jozufozu/flywheel/api/layout/ValueRepr.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/layout/ValueRepr.java rename to common/src/main/java/com/jozufozu/flywheel/api/layout/ValueRepr.java diff --git a/src/main/java/com/jozufozu/flywheel/api/layout/VectorElementType.java b/common/src/main/java/com/jozufozu/flywheel/api/layout/VectorElementType.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/layout/VectorElementType.java rename to common/src/main/java/com/jozufozu/flywheel/api/layout/VectorElementType.java diff --git a/src/main/java/com/jozufozu/flywheel/api/material/CutoutShader.java b/common/src/main/java/com/jozufozu/flywheel/api/material/CutoutShader.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/material/CutoutShader.java rename to common/src/main/java/com/jozufozu/flywheel/api/material/CutoutShader.java diff --git a/src/main/java/com/jozufozu/flywheel/api/material/DepthTest.java b/common/src/main/java/com/jozufozu/flywheel/api/material/DepthTest.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/material/DepthTest.java rename to common/src/main/java/com/jozufozu/flywheel/api/material/DepthTest.java diff --git a/src/main/java/com/jozufozu/flywheel/api/material/FogShader.java b/common/src/main/java/com/jozufozu/flywheel/api/material/FogShader.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/material/FogShader.java rename to common/src/main/java/com/jozufozu/flywheel/api/material/FogShader.java diff --git a/src/main/java/com/jozufozu/flywheel/api/material/Material.java b/common/src/main/java/com/jozufozu/flywheel/api/material/Material.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/material/Material.java rename to common/src/main/java/com/jozufozu/flywheel/api/material/Material.java diff --git a/src/main/java/com/jozufozu/flywheel/api/material/MaterialShaders.java b/common/src/main/java/com/jozufozu/flywheel/api/material/MaterialShaders.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/material/MaterialShaders.java rename to common/src/main/java/com/jozufozu/flywheel/api/material/MaterialShaders.java diff --git a/src/main/java/com/jozufozu/flywheel/api/material/Transparency.java b/common/src/main/java/com/jozufozu/flywheel/api/material/Transparency.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/material/Transparency.java rename to common/src/main/java/com/jozufozu/flywheel/api/material/Transparency.java diff --git a/src/main/java/com/jozufozu/flywheel/api/material/WriteMask.java b/common/src/main/java/com/jozufozu/flywheel/api/material/WriteMask.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/material/WriteMask.java rename to common/src/main/java/com/jozufozu/flywheel/api/material/WriteMask.java diff --git a/src/main/java/com/jozufozu/flywheel/api/model/IndexSequence.java b/common/src/main/java/com/jozufozu/flywheel/api/model/IndexSequence.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/model/IndexSequence.java rename to common/src/main/java/com/jozufozu/flywheel/api/model/IndexSequence.java diff --git a/src/main/java/com/jozufozu/flywheel/api/model/Mesh.java b/common/src/main/java/com/jozufozu/flywheel/api/model/Mesh.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/model/Mesh.java rename to common/src/main/java/com/jozufozu/flywheel/api/model/Mesh.java diff --git a/src/main/java/com/jozufozu/flywheel/api/model/Model.java b/common/src/main/java/com/jozufozu/flywheel/api/model/Model.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/model/Model.java rename to common/src/main/java/com/jozufozu/flywheel/api/model/Model.java diff --git a/src/main/java/com/jozufozu/flywheel/api/registry/IdRegistry.java b/common/src/main/java/com/jozufozu/flywheel/api/registry/IdRegistry.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/registry/IdRegistry.java rename to common/src/main/java/com/jozufozu/flywheel/api/registry/IdRegistry.java diff --git a/src/main/java/com/jozufozu/flywheel/api/registry/Registry.java b/common/src/main/java/com/jozufozu/flywheel/api/registry/Registry.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/registry/Registry.java rename to common/src/main/java/com/jozufozu/flywheel/api/registry/Registry.java diff --git a/src/main/java/com/jozufozu/flywheel/api/task/Plan.java b/common/src/main/java/com/jozufozu/flywheel/api/task/Plan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/task/Plan.java rename to common/src/main/java/com/jozufozu/flywheel/api/task/Plan.java diff --git a/src/main/java/com/jozufozu/flywheel/api/task/TaskExecutor.java b/common/src/main/java/com/jozufozu/flywheel/api/task/TaskExecutor.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/task/TaskExecutor.java rename to common/src/main/java/com/jozufozu/flywheel/api/task/TaskExecutor.java diff --git a/src/main/java/com/jozufozu/flywheel/api/vertex/MutableVertexList.java b/common/src/main/java/com/jozufozu/flywheel/api/vertex/MutableVertexList.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/vertex/MutableVertexList.java rename to common/src/main/java/com/jozufozu/flywheel/api/vertex/MutableVertexList.java diff --git a/src/main/java/com/jozufozu/flywheel/api/vertex/VertexList.java b/common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexList.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/vertex/VertexList.java rename to common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexList.java diff --git a/src/main/java/com/jozufozu/flywheel/api/vertex/VertexView.java b/common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexView.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/vertex/VertexView.java rename to common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexView.java diff --git a/src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProvider.java b/common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProvider.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProvider.java rename to common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProvider.java diff --git a/src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProviderRegistry.java b/common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProviderRegistry.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProviderRegistry.java rename to common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProviderRegistry.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visual/BlockEntityVisual.java b/common/src/main/java/com/jozufozu/flywheel/api/visual/BlockEntityVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visual/BlockEntityVisual.java rename to common/src/main/java/com/jozufozu/flywheel/api/visual/BlockEntityVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visual/DistanceUpdateLimiter.java b/common/src/main/java/com/jozufozu/flywheel/api/visual/DistanceUpdateLimiter.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visual/DistanceUpdateLimiter.java rename to common/src/main/java/com/jozufozu/flywheel/api/visual/DistanceUpdateLimiter.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visual/DynamicVisual.java b/common/src/main/java/com/jozufozu/flywheel/api/visual/DynamicVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visual/DynamicVisual.java rename to common/src/main/java/com/jozufozu/flywheel/api/visual/DynamicVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visual/Effect.java b/common/src/main/java/com/jozufozu/flywheel/api/visual/Effect.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visual/Effect.java rename to common/src/main/java/com/jozufozu/flywheel/api/visual/Effect.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visual/EffectVisual.java b/common/src/main/java/com/jozufozu/flywheel/api/visual/EffectVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visual/EffectVisual.java rename to common/src/main/java/com/jozufozu/flywheel/api/visual/EffectVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visual/EntityVisual.java b/common/src/main/java/com/jozufozu/flywheel/api/visual/EntityVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visual/EntityVisual.java rename to common/src/main/java/com/jozufozu/flywheel/api/visual/EntityVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visual/LitVisual.java b/common/src/main/java/com/jozufozu/flywheel/api/visual/LitVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visual/LitVisual.java rename to common/src/main/java/com/jozufozu/flywheel/api/visual/LitVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visual/TickableVisual.java b/common/src/main/java/com/jozufozu/flywheel/api/visual/TickableVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visual/TickableVisual.java rename to common/src/main/java/com/jozufozu/flywheel/api/visual/TickableVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visual/Visual.java b/common/src/main/java/com/jozufozu/flywheel/api/visual/Visual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visual/Visual.java rename to common/src/main/java/com/jozufozu/flywheel/api/visual/Visual.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visualization/BlockEntityVisualizer.java b/common/src/main/java/com/jozufozu/flywheel/api/visualization/BlockEntityVisualizer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visualization/BlockEntityVisualizer.java rename to common/src/main/java/com/jozufozu/flywheel/api/visualization/BlockEntityVisualizer.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visualization/EntityVisualizer.java b/common/src/main/java/com/jozufozu/flywheel/api/visualization/EntityVisualizer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visualization/EntityVisualizer.java rename to common/src/main/java/com/jozufozu/flywheel/api/visualization/EntityVisualizer.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visualization/VisualEmbedding.java b/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualEmbedding.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visualization/VisualEmbedding.java rename to common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualEmbedding.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visualization/VisualManager.java b/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualManager.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visualization/VisualManager.java rename to common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualManager.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationContext.java b/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationContext.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationContext.java rename to common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationContext.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationLevel.java b/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationLevel.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationLevel.java rename to common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationLevel.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationManager.java b/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationManager.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationManager.java rename to common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationManager.java diff --git a/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizerRegistry.java b/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizerRegistry.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/api/visualization/VisualizerRegistry.java rename to common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizerRegistry.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/Backends.java b/common/src/main/java/com/jozufozu/flywheel/backend/Backends.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/Backends.java rename to common/src/main/java/com/jozufozu/flywheel/backend/Backends.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/InternalVertex.java b/common/src/main/java/com/jozufozu/flywheel/backend/InternalVertex.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/InternalVertex.java rename to common/src/main/java/com/jozufozu/flywheel/backend/InternalVertex.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/LayoutAttributes.java b/common/src/main/java/com/jozufozu/flywheel/backend/LayoutAttributes.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/LayoutAttributes.java rename to common/src/main/java/com/jozufozu/flywheel/backend/LayoutAttributes.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/Samplers.java b/common/src/main/java/com/jozufozu/flywheel/backend/Samplers.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/Samplers.java rename to common/src/main/java/com/jozufozu/flywheel/backend/Samplers.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/ShaderIndices.java b/common/src/main/java/com/jozufozu/flywheel/backend/ShaderIndices.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/ShaderIndices.java rename to common/src/main/java/com/jozufozu/flywheel/backend/ShaderIndices.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/ContextShader.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/ContextShader.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/ContextShader.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/ContextShader.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/Pipeline.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/Pipeline.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/Pipeline.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/Pipeline.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/PipelineProgramKey.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/PipelineProgramKey.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/PipelineProgramKey.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/PipelineProgramKey.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/Pipelines.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/Pipelines.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/Pipelines.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/Pipelines.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/SourceChecks.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/SourceChecks.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/SourceChecks.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/SourceChecks.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/component/BufferTextureInstanceComponent.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/BufferTextureInstanceComponent.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/component/BufferTextureInstanceComponent.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/component/BufferTextureInstanceComponent.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceAssemblerComponent.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceAssemblerComponent.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceAssemblerComponent.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceAssemblerComponent.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/component/SsboInstanceComponent.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/SsboInstanceComponent.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/component/SsboInstanceComponent.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/component/SsboInstanceComponent.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/component/StringSubstitutionComponent.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/StringSubstitutionComponent.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/component/StringSubstitutionComponent.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/component/StringSubstitutionComponent.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/component/UberShaderComponent.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/UberShaderComponent.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/component/UberShaderComponent.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/component/UberShaderComponent.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/core/CompilationHarness.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/CompilationHarness.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/core/CompilationHarness.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/core/CompilationHarness.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/core/Compile.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/Compile.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/core/Compile.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/core/Compile.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/core/CompilerStats.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/CompilerStats.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/core/CompilerStats.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/core/CompilerStats.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/core/FailedCompilation.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/FailedCompilation.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/core/FailedCompilation.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/core/FailedCompilation.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/core/LinkResult.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/LinkResult.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/core/LinkResult.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/core/LinkResult.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/core/ProgramLinker.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/ProgramLinker.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/core/ProgramLinker.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/core/ProgramLinker.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/core/ShaderCache.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/ShaderCache.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/core/ShaderCache.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/core/ShaderCache.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/core/ShaderResult.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/ShaderResult.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/core/ShaderResult.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/core/ShaderResult.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/compile/core/SourceLoader.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/SourceLoader.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/compile/core/SourceLoader.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/core/SourceLoader.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/AbstractInstancer.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/AbstractInstancer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/AbstractInstancer.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/AbstractInstancer.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/CommonCrumbling.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/CommonCrumbling.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/CommonCrumbling.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/CommonCrumbling.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/DrawManager.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/DrawManager.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/DrawManager.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/DrawManager.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/EngineImpl.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/EngineImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/EngineImpl.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/EngineImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/EnvironmentStorage.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/EnvironmentStorage.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/EnvironmentStorage.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/EnvironmentStorage.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/GroupKey.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/GroupKey.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/GroupKey.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/GroupKey.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/IndexPool.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/IndexPool.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/IndexPool.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/IndexPool.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/InstanceHandleImpl.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/InstanceHandleImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/InstanceHandleImpl.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/InstanceHandleImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/InstancerKey.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/InstancerKey.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/InstancerKey.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/InstancerKey.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/InstancerProviderImpl.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/InstancerProviderImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/InstancerProviderImpl.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/InstancerProviderImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/MaterialEncoder.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/MaterialEncoder.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/MaterialEncoder.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/MaterialEncoder.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/MaterialRenderState.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/MaterialRenderState.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/MaterialRenderState.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/MaterialRenderState.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/MeshPool.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/MeshPool.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/MeshPool.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/MeshPool.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/TextureBinder.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/TextureBinder.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/TextureBinder.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/TextureBinder.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/embed/AbstractEmbeddedEnvironment.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/AbstractEmbeddedEnvironment.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/embed/AbstractEmbeddedEnvironment.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/AbstractEmbeddedEnvironment.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightTexture.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightTexture.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightTexture.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightTexture.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightVolume.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightVolume.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightVolume.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightVolume.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddingUniforms.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddingUniforms.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddingUniforms.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddingUniforms.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/embed/Environment.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/Environment.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/embed/Environment.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/Environment.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/embed/GlobalEnvironment.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/GlobalEnvironment.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/embed/GlobalEnvironment.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/GlobalEnvironment.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/embed/NestedEmbeddedEnvironment.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/NestedEmbeddedEnvironment.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/embed/NestedEmbeddedEnvironment.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/NestedEmbeddedEnvironment.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/embed/TopLevelEmbeddedEnvironment.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/TopLevelEmbeddedEnvironment.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/embed/TopLevelEmbeddedEnvironment.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/TopLevelEmbeddedEnvironment.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectBuffers.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectBuffers.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectBuffers.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectBuffers.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectCullingGroup.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectCullingGroup.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectCullingGroup.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectCullingGroup.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDraw.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDraw.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDraw.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDraw.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDrawManager.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDrawManager.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDrawManager.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDrawManager.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectInstancer.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectInstancer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectInstancer.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectInstancer.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageArray.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageArray.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageArray.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageArray.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageBuffer.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageBuffer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageBuffer.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageBuffer.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ScatterList.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ScatterList.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ScatterList.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ScatterList.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/StagingBuffer.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/StagingBuffer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/indirect/StagingBuffer.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/StagingBuffer.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/TransferList.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/TransferList.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/indirect/TransferList.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/TransferList.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDraw.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDraw.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDraw.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDraw.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDrawManager.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDrawManager.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDrawManager.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDrawManager.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedInstancer.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedInstancer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedInstancer.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedInstancer.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedRenderStage.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedRenderStage.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedRenderStage.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedRenderStage.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FogUniforms.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FogUniforms.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FogUniforms.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FogUniforms.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/LevelUniforms.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/LevelUniforms.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/uniform/LevelUniforms.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/LevelUniforms.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/OptionsUniforms.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/OptionsUniforms.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/uniform/OptionsUniforms.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/OptionsUniforms.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformBuffer.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformBuffer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformBuffer.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformBuffer.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformWriter.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformWriter.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformWriter.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformWriter.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/Driver.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/Driver.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/Driver.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/Driver.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/GlCompat.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlCompat.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/GlCompat.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/GlCompat.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/GlFence.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlFence.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/GlFence.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/GlFence.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/GlNumericType.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlNumericType.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/GlNumericType.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/GlNumericType.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/GlObject.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlObject.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/GlObject.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/GlObject.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/GlPrimitive.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlPrimitive.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/GlPrimitive.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/GlPrimitive.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/GlStateTracker.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlStateTracker.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/GlStateTracker.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/GlStateTracker.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/GlTexture.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlTexture.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/GlTexture.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/GlTexture.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/GlTextureUnit.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlTextureUnit.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/GlTextureUnit.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/GlTextureUnit.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/TextureBuffer.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/TextureBuffer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/TextureBuffer.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/TextureBuffer.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArray.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArray.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArray.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArray.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayDSA.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayDSA.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayDSA.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayDSA.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayGL3.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayGL3.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayGL3.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayGL3.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArraySeparateAttributes.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArraySeparateAttributes.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArraySeparateAttributes.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArraySeparateAttributes.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/array/VertexAttribute.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/array/VertexAttribute.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/array/VertexAttribute.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/array/VertexAttribute.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/Buffer.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/Buffer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/buffer/Buffer.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/Buffer.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferType.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferType.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferType.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferType.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferUsage.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferUsage.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferUsage.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferUsage.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/error/GlError.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/error/GlError.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/error/GlError.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/error/GlError.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/error/GlException.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/error/GlException.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/error/GlException.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/error/GlException.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/shader/GlProgram.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/shader/GlProgram.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/shader/GlProgram.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/shader/GlProgram.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/shader/GlShader.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/shader/GlShader.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/shader/GlShader.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/shader/GlShader.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/shader/ShaderType.java b/common/src/main/java/com/jozufozu/flywheel/backend/gl/shader/ShaderType.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/gl/shader/ShaderType.java rename to common/src/main/java/com/jozufozu/flywheel/backend/gl/shader/ShaderType.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/GlslVersion.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/GlslVersion.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/GlslVersion.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/GlslVersion.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/LoadError.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/LoadError.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/LoadError.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/LoadError.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/LoadResult.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/LoadResult.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/LoadResult.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/LoadResult.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/ShaderSources.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/ShaderSources.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/ShaderSources.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/ShaderSources.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/SourceComponent.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/SourceComponent.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/SourceComponent.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/SourceComponent.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/SourceFile.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/SourceFile.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/SourceFile.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/SourceFile.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/SourceLines.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/SourceLines.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/SourceLines.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/SourceLines.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/error/ConsoleColors.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/ConsoleColors.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/error/ConsoleColors.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/ConsoleColors.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/error/ErrorBuilder.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/ErrorBuilder.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/error/ErrorBuilder.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/ErrorBuilder.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/error/ErrorLevel.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/ErrorLevel.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/error/ErrorLevel.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/ErrorLevel.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/Divider.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/Divider.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/Divider.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/Divider.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/ErrorLine.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/ErrorLine.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/ErrorLine.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/ErrorLine.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/FileLine.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/FileLine.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/FileLine.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/FileLine.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/HeaderLine.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/HeaderLine.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/HeaderLine.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/HeaderLine.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/NestedLine.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/NestedLine.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/NestedLine.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/NestedLine.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/SourceLine.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/SourceLine.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/SourceLine.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/SourceLine.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/SpanHighlightLine.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/SpanHighlightLine.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/SpanHighlightLine.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/SpanHighlightLine.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/TextLine.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/TextLine.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/TextLine.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/TextLine.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/BinOp.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/BinOp.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/generate/BinOp.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/BinOp.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/FnSignature.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/FnSignature.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/generate/FnSignature.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/FnSignature.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBlock.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBlock.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBlock.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBlock.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBuilder.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBuilder.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBuilder.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBuilder.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslExpr.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslExpr.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslExpr.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslExpr.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslFn.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslFn.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslFn.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslFn.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStmt.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStmt.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStmt.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStmt.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStruct.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStruct.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStruct.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStruct.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslSwitch.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslSwitch.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslSwitch.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslSwitch.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslUniformBlock.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslUniformBlock.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslUniformBlock.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslUniformBlock.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslVertexInput.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslVertexInput.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslVertexInput.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslVertexInput.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/Import.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/Import.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/parse/Import.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/Import.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderField.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderField.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderField.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderField.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderFunction.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderFunction.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderFunction.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderFunction.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderStruct.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderStruct.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderStruct.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderStruct.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderVariable.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderVariable.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderVariable.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderVariable.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/StructField.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/StructField.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/parse/StructField.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/StructField.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/span/CharPos.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/CharPos.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/span/CharPos.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/CharPos.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/span/ErrorSpan.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/ErrorSpan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/span/ErrorSpan.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/ErrorSpan.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/span/Span.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/Span.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/span/Span.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/Span.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/glsl/span/StringSpan.java b/common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/StringSpan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/glsl/span/StringSpan.java rename to common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/StringSpan.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/mixin/AbstractClientPlayerAccessor.java b/common/src/main/java/com/jozufozu/flywheel/backend/mixin/AbstractClientPlayerAccessor.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/mixin/AbstractClientPlayerAccessor.java rename to common/src/main/java/com/jozufozu/flywheel/backend/mixin/AbstractClientPlayerAccessor.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/mixin/GameRendererAccessor.java b/common/src/main/java/com/jozufozu/flywheel/backend/mixin/GameRendererAccessor.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/mixin/GameRendererAccessor.java rename to common/src/main/java/com/jozufozu/flywheel/backend/mixin/GameRendererAccessor.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/mixin/GlStateManagerMixin.java b/common/src/main/java/com/jozufozu/flywheel/backend/mixin/GlStateManagerMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/mixin/GlStateManagerMixin.java rename to common/src/main/java/com/jozufozu/flywheel/backend/mixin/GlStateManagerMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/mixin/LightTextureAccessor.java b/common/src/main/java/com/jozufozu/flywheel/backend/mixin/LightTextureAccessor.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/mixin/LightTextureAccessor.java rename to common/src/main/java/com/jozufozu/flywheel/backend/mixin/LightTextureAccessor.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/mixin/OptionsMixin.java b/common/src/main/java/com/jozufozu/flywheel/backend/mixin/OptionsMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/mixin/OptionsMixin.java rename to common/src/main/java/com/jozufozu/flywheel/backend/mixin/OptionsMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/mixin/OverlayTextureAccessor.java b/common/src/main/java/com/jozufozu/flywheel/backend/mixin/OverlayTextureAccessor.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/mixin/OverlayTextureAccessor.java rename to common/src/main/java/com/jozufozu/flywheel/backend/mixin/OverlayTextureAccessor.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/mixin/RenderSystemMixin.java b/common/src/main/java/com/jozufozu/flywheel/backend/mixin/RenderSystemMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/mixin/RenderSystemMixin.java rename to common/src/main/java/com/jozufozu/flywheel/backend/mixin/RenderSystemMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/util/AtomicReferenceCounted.java b/common/src/main/java/com/jozufozu/flywheel/backend/util/AtomicReferenceCounted.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/util/AtomicReferenceCounted.java rename to common/src/main/java/com/jozufozu/flywheel/backend/util/AtomicReferenceCounted.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/util/MemoryBuffer.java b/common/src/main/java/com/jozufozu/flywheel/backend/util/MemoryBuffer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/util/MemoryBuffer.java rename to common/src/main/java/com/jozufozu/flywheel/backend/util/MemoryBuffer.java diff --git a/src/main/java/com/jozufozu/flywheel/backend/util/ReferenceCounted.java b/common/src/main/java/com/jozufozu/flywheel/backend/util/ReferenceCounted.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/backend/util/ReferenceCounted.java rename to common/src/main/java/com/jozufozu/flywheel/backend/util/ReferenceCounted.java diff --git a/src/main/java/com/jozufozu/flywheel/config/BackendArgument.java b/common/src/main/java/com/jozufozu/flywheel/config/BackendArgument.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/config/BackendArgument.java rename to common/src/main/java/com/jozufozu/flywheel/config/BackendArgument.java diff --git a/src/main/java/com/jozufozu/flywheel/config/DebugMode.java b/common/src/main/java/com/jozufozu/flywheel/config/DebugMode.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/config/DebugMode.java rename to common/src/main/java/com/jozufozu/flywheel/config/DebugMode.java diff --git a/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java b/common/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/config/FlwCommands.java rename to common/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java diff --git a/src/main/java/com/jozufozu/flywheel/config/FlwConfig.java b/common/src/main/java/com/jozufozu/flywheel/config/FlwConfig.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/config/FlwConfig.java rename to common/src/main/java/com/jozufozu/flywheel/config/FlwConfig.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/event/RenderContextImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/event/RenderContextImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/event/RenderContextImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/event/RenderContextImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/extension/BlockEntityTypeExtension.java b/common/src/main/java/com/jozufozu/flywheel/impl/extension/BlockEntityTypeExtension.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/extension/BlockEntityTypeExtension.java rename to common/src/main/java/com/jozufozu/flywheel/impl/extension/BlockEntityTypeExtension.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/extension/EntityTypeExtension.java b/common/src/main/java/com/jozufozu/flywheel/impl/extension/EntityTypeExtension.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/extension/EntityTypeExtension.java rename to common/src/main/java/com/jozufozu/flywheel/impl/extension/EntityTypeExtension.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/extension/LevelExtension.java b/common/src/main/java/com/jozufozu/flywheel/impl/extension/LevelExtension.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/extension/LevelExtension.java rename to common/src/main/java/com/jozufozu/flywheel/impl/extension/LevelExtension.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/extension/PoseStackExtension.java b/common/src/main/java/com/jozufozu/flywheel/impl/extension/PoseStackExtension.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/extension/PoseStackExtension.java rename to common/src/main/java/com/jozufozu/flywheel/impl/extension/PoseStackExtension.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/extension/VertexFormatExtension.java b/common/src/main/java/com/jozufozu/flywheel/impl/extension/VertexFormatExtension.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/extension/VertexFormatExtension.java rename to common/src/main/java/com/jozufozu/flywheel/impl/extension/VertexFormatExtension.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/layout/ArrayElementTypeImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/layout/ArrayElementTypeImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/layout/ArrayElementTypeImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/layout/ArrayElementTypeImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/layout/LayoutBuilderImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/layout/LayoutBuilderImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/layout/LayoutBuilderImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/layout/LayoutBuilderImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/layout/LayoutImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/layout/LayoutImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/layout/LayoutImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/layout/LayoutImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/layout/LayoutInterpreter.java b/common/src/main/java/com/jozufozu/flywheel/impl/layout/LayoutInterpreter.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/layout/LayoutInterpreter.java rename to common/src/main/java/com/jozufozu/flywheel/impl/layout/LayoutInterpreter.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/layout/MatrixElementTypeImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/layout/MatrixElementTypeImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/layout/MatrixElementTypeImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/layout/MatrixElementTypeImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/layout/ScalarElementTypeImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/layout/ScalarElementTypeImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/layout/ScalarElementTypeImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/layout/ScalarElementTypeImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/layout/VectorElementTypeImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/layout/VectorElementTypeImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/layout/VectorElementTypeImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/layout/VectorElementTypeImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/BlockEntityTypeMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/BlockEntityTypeMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/BlockEntityTypeMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/BlockEntityTypeMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/ClientChunkCacheMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/ClientChunkCacheMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/ClientChunkCacheMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/ClientChunkCacheMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/ClientLevelMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/ClientLevelMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/ClientLevelMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/ClientLevelMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/EntityTypeMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/EntityTypeMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/EntityTypeMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/EntityTypeMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/LevelMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/PoseStackMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/PoseStackMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/PoseStackMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/PoseStackMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/VertexFormatMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/VertexFormatMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/VertexFormatMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/VertexFormatMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/fix/FixFabulousDepthMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/fix/FixFabulousDepthMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/fix/FixFabulousDepthMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/fix/FixFabulousDepthMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/fix/FixNormalScalingMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/fix/FixNormalScalingMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/fix/FixNormalScalingMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/fix/FixNormalScalingMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/ChunkBuilderMeshingTaskMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/ChunkBuilderMeshingTaskMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/ChunkBuilderMeshingTaskMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/ChunkBuilderMeshingTaskMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/BlockEntityMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/BlockEntityMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/BlockEntityMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/BlockEntityMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/LevelChunkMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/LevelChunkMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/LevelChunkMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/LevelChunkMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/LevelRendererMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/LevelRendererMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/LevelRendererMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/LevelRendererMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/RebuildTaskMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/RebuildTaskMixin.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/RebuildTaskMixin.java rename to common/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/RebuildTaskMixin.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/registry/IdRegistryImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/registry/IdRegistryImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/registry/IdRegistryImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/registry/IdRegistryImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/registry/RegistryImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/registry/RegistryImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/registry/RegistryImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/registry/RegistryImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/task/FlwTaskExecutor.java b/common/src/main/java/com/jozufozu/flywheel/impl/task/FlwTaskExecutor.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/task/FlwTaskExecutor.java rename to common/src/main/java/com/jozufozu/flywheel/impl/task/FlwTaskExecutor.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/task/ParallelTaskExecutor.java b/common/src/main/java/com/jozufozu/flywheel/impl/task/ParallelTaskExecutor.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/task/ParallelTaskExecutor.java rename to common/src/main/java/com/jozufozu/flywheel/impl/task/ParallelTaskExecutor.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/task/SerialTaskExecutor.java b/common/src/main/java/com/jozufozu/flywheel/impl/task/SerialTaskExecutor.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/task/SerialTaskExecutor.java rename to common/src/main/java/com/jozufozu/flywheel/impl/task/SerialTaskExecutor.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/task/ThreadGroupNotifier.java b/common/src/main/java/com/jozufozu/flywheel/impl/task/ThreadGroupNotifier.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/task/ThreadGroupNotifier.java rename to common/src/main/java/com/jozufozu/flywheel/impl/task/ThreadGroupNotifier.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/task/WaitGroup.java b/common/src/main/java/com/jozufozu/flywheel/impl/task/WaitGroup.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/task/WaitGroup.java rename to common/src/main/java/com/jozufozu/flywheel/impl/task/WaitGroup.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/vertex/InferredVertexFormatInfo.java b/common/src/main/java/com/jozufozu/flywheel/impl/vertex/InferredVertexFormatInfo.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/vertex/InferredVertexFormatInfo.java rename to common/src/main/java/com/jozufozu/flywheel/impl/vertex/InferredVertexFormatInfo.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/vertex/InferredVertexView.java b/common/src/main/java/com/jozufozu/flywheel/impl/vertex/InferredVertexView.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/vertex/InferredVertexView.java rename to common/src/main/java/com/jozufozu/flywheel/impl/vertex/InferredVertexView.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/vertex/InferredVertexViewProvider.java b/common/src/main/java/com/jozufozu/flywheel/impl/vertex/InferredVertexViewProvider.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/vertex/InferredVertexViewProvider.java rename to common/src/main/java/com/jozufozu/flywheel/impl/vertex/InferredVertexViewProvider.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/vertex/VertexViewProviderRegistryImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/vertex/VertexViewProviderRegistryImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/vertex/VertexViewProviderRegistryImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/vertex/VertexViewProviderRegistryImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visual/DynamicVisualContextImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/visual/DynamicVisualContextImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visual/DynamicVisualContextImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visual/DynamicVisualContextImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visual/TickableVisualContextImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/visual/TickableVisualContextImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visual/TickableVisualContextImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visual/TickableVisualContextImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationHelper.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationHelper.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationHelper.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationHelper.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizerRegistryImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizerRegistryImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizerRegistryImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizerRegistryImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/manager/BlockEntityStorage.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/manager/BlockEntityStorage.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visualization/manager/BlockEntityStorage.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visualization/manager/BlockEntityStorage.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/manager/EffectStorage.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/manager/EffectStorage.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visualization/manager/EffectStorage.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visualization/manager/EffectStorage.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/manager/EntityStorage.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/manager/EntityStorage.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visualization/manager/EntityStorage.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visualization/manager/EntityStorage.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/manager/VisualManagerImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/manager/VisualManagerImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visualization/manager/VisualManagerImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visualization/manager/VisualManagerImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/ratelimit/BandedPrimeLimiter.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/ratelimit/BandedPrimeLimiter.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visualization/ratelimit/BandedPrimeLimiter.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visualization/ratelimit/BandedPrimeLimiter.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/ratelimit/DistanceUpdateLimiterImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/ratelimit/DistanceUpdateLimiterImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visualization/ratelimit/DistanceUpdateLimiterImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visualization/ratelimit/DistanceUpdateLimiterImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/ratelimit/NonLimiter.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/ratelimit/NonLimiter.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visualization/ratelimit/NonLimiter.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visualization/ratelimit/NonLimiter.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Action.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Action.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Action.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Action.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/LitVisualStorage.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/LitVisualStorage.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visualization/storage/LitVisualStorage.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/LitVisualStorage.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Storage.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Storage.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Storage.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Storage.java diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Transaction.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Transaction.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Transaction.java rename to common/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Transaction.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/backend/SimpleBackend.java b/common/src/main/java/com/jozufozu/flywheel/lib/backend/SimpleBackend.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/backend/SimpleBackend.java rename to common/src/main/java/com/jozufozu/flywheel/lib/backend/SimpleBackend.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/box/Box.java b/common/src/main/java/com/jozufozu/flywheel/lib/box/Box.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/box/Box.java rename to common/src/main/java/com/jozufozu/flywheel/lib/box/Box.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/box/MutableBox.java b/common/src/main/java/com/jozufozu/flywheel/lib/box/MutableBox.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/box/MutableBox.java rename to common/src/main/java/com/jozufozu/flywheel/lib/box/MutableBox.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/instance/AbstractInstance.java b/common/src/main/java/com/jozufozu/flywheel/lib/instance/AbstractInstance.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/instance/AbstractInstance.java rename to common/src/main/java/com/jozufozu/flywheel/lib/instance/AbstractInstance.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/instance/ColoredLitInstance.java b/common/src/main/java/com/jozufozu/flywheel/lib/instance/ColoredLitInstance.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/instance/ColoredLitInstance.java rename to common/src/main/java/com/jozufozu/flywheel/lib/instance/ColoredLitInstance.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/instance/FlatLit.java b/common/src/main/java/com/jozufozu/flywheel/lib/instance/FlatLit.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/instance/FlatLit.java rename to common/src/main/java/com/jozufozu/flywheel/lib/instance/FlatLit.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java b/common/src/main/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java rename to common/src/main/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/instance/OrientedInstance.java b/common/src/main/java/com/jozufozu/flywheel/lib/instance/OrientedInstance.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/instance/OrientedInstance.java rename to common/src/main/java/com/jozufozu/flywheel/lib/instance/OrientedInstance.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/instance/ShadowInstance.java b/common/src/main/java/com/jozufozu/flywheel/lib/instance/ShadowInstance.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/instance/ShadowInstance.java rename to common/src/main/java/com/jozufozu/flywheel/lib/instance/ShadowInstance.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/instance/SimpleInstanceType.java b/common/src/main/java/com/jozufozu/flywheel/lib/instance/SimpleInstanceType.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/instance/SimpleInstanceType.java rename to common/src/main/java/com/jozufozu/flywheel/lib/instance/SimpleInstanceType.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/instance/TransformedInstance.java b/common/src/main/java/com/jozufozu/flywheel/lib/instance/TransformedInstance.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/instance/TransformedInstance.java rename to common/src/main/java/com/jozufozu/flywheel/lib/instance/TransformedInstance.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/light/LightPacking.java b/common/src/main/java/com/jozufozu/flywheel/lib/light/LightPacking.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/light/LightPacking.java rename to common/src/main/java/com/jozufozu/flywheel/lib/light/LightPacking.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/light/LightVolume.java b/common/src/main/java/com/jozufozu/flywheel/lib/light/LightVolume.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/light/LightVolume.java rename to common/src/main/java/com/jozufozu/flywheel/lib/light/LightVolume.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/material/CutoutShaders.java b/common/src/main/java/com/jozufozu/flywheel/lib/material/CutoutShaders.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/material/CutoutShaders.java rename to common/src/main/java/com/jozufozu/flywheel/lib/material/CutoutShaders.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/material/FogShaders.java b/common/src/main/java/com/jozufozu/flywheel/lib/material/FogShaders.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/material/FogShaders.java rename to common/src/main/java/com/jozufozu/flywheel/lib/material/FogShaders.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/material/Materials.java b/common/src/main/java/com/jozufozu/flywheel/lib/material/Materials.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/material/Materials.java rename to common/src/main/java/com/jozufozu/flywheel/lib/material/Materials.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/material/SimpleCutoutShader.java b/common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleCutoutShader.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/material/SimpleCutoutShader.java rename to common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleCutoutShader.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/material/SimpleFogShader.java b/common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleFogShader.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/material/SimpleFogShader.java rename to common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleFogShader.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/material/SimpleMaterial.java b/common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleMaterial.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/material/SimpleMaterial.java rename to common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleMaterial.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/material/SimpleMaterialShaders.java b/common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleMaterialShaders.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/material/SimpleMaterialShaders.java rename to common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleMaterialShaders.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java b/common/src/main/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java rename to common/src/main/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/math/MatrixMath.java b/common/src/main/java/com/jozufozu/flywheel/lib/math/MatrixMath.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/math/MatrixMath.java rename to common/src/main/java/com/jozufozu/flywheel/lib/math/MatrixMath.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/math/MoreMath.java b/common/src/main/java/com/jozufozu/flywheel/lib/math/MoreMath.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/math/MoreMath.java rename to common/src/main/java/com/jozufozu/flywheel/lib/math/MoreMath.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/math/RenderMath.java b/common/src/main/java/com/jozufozu/flywheel/lib/math/RenderMath.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/math/RenderMath.java rename to common/src/main/java/com/jozufozu/flywheel/lib/math/RenderMath.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/memory/AbstractMemoryBlockImpl.java b/common/src/main/java/com/jozufozu/flywheel/lib/memory/AbstractMemoryBlockImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/memory/AbstractMemoryBlockImpl.java rename to common/src/main/java/com/jozufozu/flywheel/lib/memory/AbstractMemoryBlockImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/memory/DebugMemoryBlockImpl.java b/common/src/main/java/com/jozufozu/flywheel/lib/memory/DebugMemoryBlockImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/memory/DebugMemoryBlockImpl.java rename to common/src/main/java/com/jozufozu/flywheel/lib/memory/DebugMemoryBlockImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/memory/FlwMemoryTracker.java b/common/src/main/java/com/jozufozu/flywheel/lib/memory/FlwMemoryTracker.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/memory/FlwMemoryTracker.java rename to common/src/main/java/com/jozufozu/flywheel/lib/memory/FlwMemoryTracker.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/memory/MemoryBlock.java b/common/src/main/java/com/jozufozu/flywheel/lib/memory/MemoryBlock.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/memory/MemoryBlock.java rename to common/src/main/java/com/jozufozu/flywheel/lib/memory/MemoryBlock.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/memory/MemoryBlockImpl.java b/common/src/main/java/com/jozufozu/flywheel/lib/memory/MemoryBlockImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/memory/MemoryBlockImpl.java rename to common/src/main/java/com/jozufozu/flywheel/lib/memory/MemoryBlockImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/memory/TrackedMemoryBlockImpl.java b/common/src/main/java/com/jozufozu/flywheel/lib/memory/TrackedMemoryBlockImpl.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/memory/TrackedMemoryBlockImpl.java rename to common/src/main/java/com/jozufozu/flywheel/lib/memory/TrackedMemoryBlockImpl.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/LineModelBuilder.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/LineModelBuilder.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/LineModelBuilder.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/LineModelBuilder.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/ModelCache.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelCache.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/ModelCache.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/ModelCache.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/ModelHolder.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelHolder.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/ModelHolder.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/ModelHolder.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/Models.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/Models.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/Models.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/Models.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/QuadIndexSequence.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/QuadIndexSequence.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/QuadIndexSequence.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/QuadIndexSequence.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/QuadMesh.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/QuadMesh.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/QuadMesh.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/QuadMesh.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/SimpleMesh.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/SimpleMesh.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/SimpleMesh.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/SimpleMesh.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/SimpleModel.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/SimpleModel.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/SimpleModel.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/SimpleModel.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/SingleMeshModel.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/SingleMeshModel.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/SingleMeshModel.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/SingleMeshModel.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/baked/TransformingVertexConsumer.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/TransformingVertexConsumer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/baked/TransformingVertexConsumer.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/baked/TransformingVertexConsumer.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualBlockGetter.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualBlockGetter.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualBlockGetter.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualBlockGetter.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualEmptyBlockGetter.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualEmptyBlockGetter.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualEmptyBlockGetter.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualEmptyBlockGetter.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualLightEngine.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualLightEngine.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualLightEngine.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualLightEngine.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/part/ModelPartConverter.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/part/ModelPartConverter.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/part/ModelPartConverter.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/part/ModelPartConverter.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/model/part/VertexWriter.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/part/VertexWriter.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/model/part/VertexWriter.java rename to common/src/main/java/com/jozufozu/flywheel/lib/model/part/VertexWriter.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/BarrierPlan.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/BarrierPlan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/BarrierPlan.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/BarrierPlan.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/Distribute.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/Distribute.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/Distribute.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/Distribute.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/DynamicNestedPlan.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/DynamicNestedPlan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/DynamicNestedPlan.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/DynamicNestedPlan.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/Flag.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/Flag.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/Flag.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/Flag.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/ForEachPlan.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/ForEachPlan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/ForEachPlan.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/ForEachPlan.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/ForEachSlicePlan.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/ForEachSlicePlan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/ForEachSlicePlan.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/ForEachSlicePlan.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/IfElsePlan.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/IfElsePlan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/IfElsePlan.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/IfElsePlan.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/MapContextPlan.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/MapContextPlan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/MapContextPlan.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/MapContextPlan.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/NamedFlag.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/NamedFlag.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/NamedFlag.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/NamedFlag.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/NestedPlan.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/NestedPlan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/NestedPlan.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/NestedPlan.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/PlanMap.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/PlanMap.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/PlanMap.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/PlanMap.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/RaisePlan.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/RaisePlan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/RaisePlan.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/RaisePlan.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/RunnablePlan.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/RunnablePlan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/RunnablePlan.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/RunnablePlan.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/SimplePlan.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/SimplePlan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/SimplePlan.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/SimplePlan.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/SimplyComposedPlan.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/SimplyComposedPlan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/SimplyComposedPlan.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/SimplyComposedPlan.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/StageFlag.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/StageFlag.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/StageFlag.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/StageFlag.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/SyncedPlan.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/SyncedPlan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/SyncedPlan.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/SyncedPlan.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/Synchronizer.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/Synchronizer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/Synchronizer.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/Synchronizer.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/UnitPlan.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/UnitPlan.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/UnitPlan.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/UnitPlan.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/functional/BooleanSupplierWithContext.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/functional/BooleanSupplierWithContext.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/functional/BooleanSupplierWithContext.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/functional/BooleanSupplierWithContext.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/functional/ConsumerWithContext.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/functional/ConsumerWithContext.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/functional/ConsumerWithContext.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/functional/ConsumerWithContext.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/functional/RunnableWithContext.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/functional/RunnableWithContext.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/functional/RunnableWithContext.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/functional/RunnableWithContext.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/functional/SupplierWithContext.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/functional/SupplierWithContext.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/functional/SupplierWithContext.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/functional/SupplierWithContext.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/task/functional/package-info.java b/common/src/main/java/com/jozufozu/flywheel/lib/task/functional/package-info.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/task/functional/package-info.java rename to common/src/main/java/com/jozufozu/flywheel/lib/task/functional/package-info.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/transform/Affine.java b/common/src/main/java/com/jozufozu/flywheel/lib/transform/Affine.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/transform/Affine.java rename to common/src/main/java/com/jozufozu/flywheel/lib/transform/Affine.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/transform/PoseTransformStack.java b/common/src/main/java/com/jozufozu/flywheel/lib/transform/PoseTransformStack.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/transform/PoseTransformStack.java rename to common/src/main/java/com/jozufozu/flywheel/lib/transform/PoseTransformStack.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/transform/Rotate.java b/common/src/main/java/com/jozufozu/flywheel/lib/transform/Rotate.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/transform/Rotate.java rename to common/src/main/java/com/jozufozu/flywheel/lib/transform/Rotate.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/transform/Scale.java b/common/src/main/java/com/jozufozu/flywheel/lib/transform/Scale.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/transform/Scale.java rename to common/src/main/java/com/jozufozu/flywheel/lib/transform/Scale.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/transform/Transform.java b/common/src/main/java/com/jozufozu/flywheel/lib/transform/Transform.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/transform/Transform.java rename to common/src/main/java/com/jozufozu/flywheel/lib/transform/Transform.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java b/common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java rename to common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/transform/Translate.java b/common/src/main/java/com/jozufozu/flywheel/lib/transform/Translate.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/transform/Translate.java rename to common/src/main/java/com/jozufozu/flywheel/lib/transform/Translate.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/util/AtomicBitset.java b/common/src/main/java/com/jozufozu/flywheel/lib/util/AtomicBitset.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/util/AtomicBitset.java rename to common/src/main/java/com/jozufozu/flywheel/lib/util/AtomicBitset.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/util/FlwUtil.java b/common/src/main/java/com/jozufozu/flywheel/lib/util/FlwUtil.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/util/FlwUtil.java rename to common/src/main/java/com/jozufozu/flywheel/lib/util/FlwUtil.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/util/LevelAttached.java b/common/src/main/java/com/jozufozu/flywheel/lib/util/LevelAttached.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/util/LevelAttached.java rename to common/src/main/java/com/jozufozu/flywheel/lib/util/LevelAttached.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/util/Pair.java b/common/src/main/java/com/jozufozu/flywheel/lib/util/Pair.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/util/Pair.java rename to common/src/main/java/com/jozufozu/flywheel/lib/util/Pair.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/util/ResourceUtil.java b/common/src/main/java/com/jozufozu/flywheel/lib/util/ResourceUtil.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/util/ResourceUtil.java rename to common/src/main/java/com/jozufozu/flywheel/lib/util/ResourceUtil.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/util/SectionUtil.java b/common/src/main/java/com/jozufozu/flywheel/lib/util/SectionUtil.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/util/SectionUtil.java rename to common/src/main/java/com/jozufozu/flywheel/lib/util/SectionUtil.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java b/common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java rename to common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/util/StringUtil.java b/common/src/main/java/com/jozufozu/flywheel/lib/util/StringUtil.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/util/StringUtil.java rename to common/src/main/java/com/jozufozu/flywheel/lib/util/StringUtil.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/util/Unit.java b/common/src/main/java/com/jozufozu/flywheel/lib/util/Unit.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/util/Unit.java rename to common/src/main/java/com/jozufozu/flywheel/lib/util/Unit.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/vertex/AbstractVertexView.java b/common/src/main/java/com/jozufozu/flywheel/lib/vertex/AbstractVertexView.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/vertex/AbstractVertexView.java rename to common/src/main/java/com/jozufozu/flywheel/lib/vertex/AbstractVertexView.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/vertex/EmptyVertexList.java b/common/src/main/java/com/jozufozu/flywheel/lib/vertex/EmptyVertexList.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/vertex/EmptyVertexList.java rename to common/src/main/java/com/jozufozu/flywheel/lib/vertex/EmptyVertexList.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/vertex/FullVertexView.java b/common/src/main/java/com/jozufozu/flywheel/lib/vertex/FullVertexView.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/vertex/FullVertexView.java rename to common/src/main/java/com/jozufozu/flywheel/lib/vertex/FullVertexView.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/vertex/NoOverlayVertexView.java b/common/src/main/java/com/jozufozu/flywheel/lib/vertex/NoOverlayVertexView.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/vertex/NoOverlayVertexView.java rename to common/src/main/java/com/jozufozu/flywheel/lib/vertex/NoOverlayVertexView.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/vertex/PosTexNormalVertexView.java b/common/src/main/java/com/jozufozu/flywheel/lib/vertex/PosTexNormalVertexView.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/vertex/PosTexNormalVertexView.java rename to common/src/main/java/com/jozufozu/flywheel/lib/vertex/PosTexNormalVertexView.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/vertex/PosVertexView.java b/common/src/main/java/com/jozufozu/flywheel/lib/vertex/PosVertexView.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/vertex/PosVertexView.java rename to common/src/main/java/com/jozufozu/flywheel/lib/vertex/PosVertexView.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractBlockEntityVisual.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractBlockEntityVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/visual/AbstractBlockEntityVisual.java rename to common/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractBlockEntityVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractEntityVisual.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractEntityVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/visual/AbstractEntityVisual.java rename to common/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractEntityVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractVisual.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/visual/AbstractVisual.java rename to common/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/EntityComponent.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/EntityComponent.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/visual/EntityComponent.java rename to common/src/main/java/com/jozufozu/flywheel/lib/visual/EntityComponent.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/EntityVisibilityTester.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/EntityVisibilityTester.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/visual/EntityVisibilityTester.java rename to common/src/main/java/com/jozufozu/flywheel/lib/visual/EntityVisibilityTester.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/InstanceRecycler.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/InstanceRecycler.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/visual/InstanceRecycler.java rename to common/src/main/java/com/jozufozu/flywheel/lib/visual/InstanceRecycler.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleBlockEntityVisualizer.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleBlockEntityVisualizer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/visual/SimpleBlockEntityVisualizer.java rename to common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleBlockEntityVisualizer.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java rename to common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisual.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisual.java rename to common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisualizer.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisualizer.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisualizer.java rename to common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisualizer.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java rename to common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/SmartRecycler.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/SmartRecycler.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/visual/SmartRecycler.java rename to common/src/main/java/com/jozufozu/flywheel/lib/visual/SmartRecycler.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/component/FireComponent.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/component/FireComponent.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/visual/component/FireComponent.java rename to common/src/main/java/com/jozufozu/flywheel/lib/visual/component/FireComponent.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/component/HitboxComponent.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/component/HitboxComponent.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/visual/component/HitboxComponent.java rename to common/src/main/java/com/jozufozu/flywheel/lib/visual/component/HitboxComponent.java diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/component/ShadowComponent.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/component/ShadowComponent.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/lib/visual/component/ShadowComponent.java rename to common/src/main/java/com/jozufozu/flywheel/lib/visual/component/ShadowComponent.java diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/BellVisual.java b/common/src/main/java/com/jozufozu/flywheel/vanilla/BellVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/vanilla/BellVisual.java rename to common/src/main/java/com/jozufozu/flywheel/vanilla/BellVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/ChestVisual.java b/common/src/main/java/com/jozufozu/flywheel/vanilla/ChestVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/vanilla/ChestVisual.java rename to common/src/main/java/com/jozufozu/flywheel/vanilla/ChestVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/MinecartVisual.java b/common/src/main/java/com/jozufozu/flywheel/vanilla/MinecartVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/vanilla/MinecartVisual.java rename to common/src/main/java/com/jozufozu/flywheel/vanilla/MinecartVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/ShulkerBoxVisual.java b/common/src/main/java/com/jozufozu/flywheel/vanilla/ShulkerBoxVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/vanilla/ShulkerBoxVisual.java rename to common/src/main/java/com/jozufozu/flywheel/vanilla/ShulkerBoxVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/TntMinecartVisual.java b/common/src/main/java/com/jozufozu/flywheel/vanilla/TntMinecartVisual.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/vanilla/TntMinecartVisual.java rename to common/src/main/java/com/jozufozu/flywheel/vanilla/TntMinecartVisual.java diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/VanillaVisuals.java b/common/src/main/java/com/jozufozu/flywheel/vanilla/VanillaVisuals.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/vanilla/VanillaVisuals.java rename to common/src/main/java/com/jozufozu/flywheel/vanilla/VanillaVisuals.java diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/effect/ExampleEffect.java b/common/src/main/java/com/jozufozu/flywheel/vanilla/effect/ExampleEffect.java similarity index 100% rename from src/main/java/com/jozufozu/flywheel/vanilla/effect/ExampleEffect.java rename to common/src/main/java/com/jozufozu/flywheel/vanilla/effect/ExampleEffect.java diff --git a/src/main/resources/META-INF/mods.toml b/common/src/main/resources/META-INF/mods.toml similarity index 100% rename from src/main/resources/META-INF/mods.toml rename to common/src/main/resources/META-INF/mods.toml diff --git a/src/main/resources/assets/flywheel/flywheel/cutout/epsilon.glsl b/common/src/main/resources/assets/flywheel/flywheel/cutout/epsilon.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/cutout/epsilon.glsl rename to common/src/main/resources/assets/flywheel/flywheel/cutout/epsilon.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/cutout/half.glsl b/common/src/main/resources/assets/flywheel/flywheel/cutout/half.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/cutout/half.glsl rename to common/src/main/resources/assets/flywheel/flywheel/cutout/half.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/cutout/off.glsl b/common/src/main/resources/assets/flywheel/flywheel/cutout/off.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/cutout/off.glsl rename to common/src/main/resources/assets/flywheel/flywheel/cutout/off.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/cutout/one_tenth.glsl b/common/src/main/resources/assets/flywheel/flywheel/cutout/one_tenth.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/cutout/one_tenth.glsl rename to common/src/main/resources/assets/flywheel/flywheel/cutout/one_tenth.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/fog/linear.glsl b/common/src/main/resources/assets/flywheel/flywheel/fog/linear.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/fog/linear.glsl rename to common/src/main/resources/assets/flywheel/flywheel/fog/linear.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/fog/linear_fade.glsl b/common/src/main/resources/assets/flywheel/flywheel/fog/linear_fade.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/fog/linear_fade.glsl rename to common/src/main/resources/assets/flywheel/flywheel/fog/linear_fade.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/fog/none.glsl b/common/src/main/resources/assets/flywheel/flywheel/fog/none.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/fog/none.glsl rename to common/src/main/resources/assets/flywheel/flywheel/fog/none.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/instance/cull/oriented.glsl b/common/src/main/resources/assets/flywheel/flywheel/instance/cull/oriented.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/instance/cull/oriented.glsl rename to common/src/main/resources/assets/flywheel/flywheel/instance/cull/oriented.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/instance/cull/shadow.glsl b/common/src/main/resources/assets/flywheel/flywheel/instance/cull/shadow.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/instance/cull/shadow.glsl rename to common/src/main/resources/assets/flywheel/flywheel/instance/cull/shadow.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/instance/cull/transformed.glsl b/common/src/main/resources/assets/flywheel/flywheel/instance/cull/transformed.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/instance/cull/transformed.glsl rename to common/src/main/resources/assets/flywheel/flywheel/instance/cull/transformed.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/instance/oriented.vert b/common/src/main/resources/assets/flywheel/flywheel/instance/oriented.vert similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/instance/oriented.vert rename to common/src/main/resources/assets/flywheel/flywheel/instance/oriented.vert diff --git a/src/main/resources/assets/flywheel/flywheel/instance/shadow.vert b/common/src/main/resources/assets/flywheel/flywheel/instance/shadow.vert similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/instance/shadow.vert rename to common/src/main/resources/assets/flywheel/flywheel/instance/shadow.vert diff --git a/src/main/resources/assets/flywheel/flywheel/instance/transformed.vert b/common/src/main/resources/assets/flywheel/flywheel/instance/transformed.vert similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/instance/transformed.vert rename to common/src/main/resources/assets/flywheel/flywheel/instance/transformed.vert diff --git a/src/main/resources/assets/flywheel/flywheel/internal/api_impl.frag b/common/src/main/resources/assets/flywheel/flywheel/internal/api_impl.frag similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/api_impl.frag rename to common/src/main/resources/assets/flywheel/flywheel/internal/api_impl.frag diff --git a/src/main/resources/assets/flywheel/flywheel/internal/api_impl.vert b/common/src/main/resources/assets/flywheel/flywheel/internal/api_impl.vert similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/api_impl.vert rename to common/src/main/resources/assets/flywheel/flywheel/internal/api_impl.vert diff --git a/src/main/resources/assets/flywheel/flywheel/internal/colorizer.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/colorizer.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/colorizer.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/colorizer.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/common.frag b/common/src/main/resources/assets/flywheel/flywheel/internal/common.frag similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/common.frag rename to common/src/main/resources/assets/flywheel/flywheel/internal/common.frag diff --git a/src/main/resources/assets/flywheel/flywheel/internal/common.vert b/common/src/main/resources/assets/flywheel/flywheel/internal/common.vert similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/common.vert rename to common/src/main/resources/assets/flywheel/flywheel/internal/common.vert diff --git a/src/main/resources/assets/flywheel/flywheel/internal/components_header.frag b/common/src/main/resources/assets/flywheel/flywheel/internal/components_header.frag similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/components_header.frag rename to common/src/main/resources/assets/flywheel/flywheel/internal/components_header.frag diff --git a/src/main/resources/assets/flywheel/flywheel/internal/components_header.vert b/common/src/main/resources/assets/flywheel/flywheel/internal/components_header.vert similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/components_header.vert rename to common/src/main/resources/assets/flywheel/flywheel/internal/components_header.vert diff --git a/src/main/resources/assets/flywheel/flywheel/internal/diffuse.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/diffuse.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/diffuse.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/diffuse.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/fog_distance.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/fog_distance.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/fog_distance.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/fog_distance.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/indirect/apply.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/apply.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/indirect/apply.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/indirect/apply.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/indirect/buffer_bindings.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/buffer_bindings.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/indirect/buffer_bindings.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/indirect/buffer_bindings.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull_api_impl.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull_api_impl.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/indirect/cull_api_impl.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull_api_impl.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/indirect/draw_command.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/draw_command.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/indirect/draw_command.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/indirect/draw_command.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/indirect/main.frag b/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/main.frag similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/indirect/main.frag rename to common/src/main/resources/assets/flywheel/flywheel/internal/indirect/main.frag diff --git a/src/main/resources/assets/flywheel/flywheel/internal/indirect/main.vert b/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/main.vert similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/indirect/main.vert rename to common/src/main/resources/assets/flywheel/flywheel/internal/indirect/main.vert diff --git a/src/main/resources/assets/flywheel/flywheel/internal/indirect/model_descriptor.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/model_descriptor.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/indirect/model_descriptor.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/indirect/model_descriptor.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/indirect/scatter.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/scatter.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/indirect/scatter.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/indirect/scatter.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/instancing/main.frag b/common/src/main/resources/assets/flywheel/flywheel/internal/instancing/main.frag similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/instancing/main.frag rename to common/src/main/resources/assets/flywheel/flywheel/internal/instancing/main.frag diff --git a/src/main/resources/assets/flywheel/flywheel/internal/instancing/main.vert b/common/src/main/resources/assets/flywheel/flywheel/internal/instancing/main.vert similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/instancing/main.vert rename to common/src/main/resources/assets/flywheel/flywheel/internal/instancing/main.vert diff --git a/src/main/resources/assets/flywheel/flywheel/internal/material.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/material.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/material.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/material.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/packed_material.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/packed_material.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/packed_material.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/packed_material.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/uniforms/fog.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/fog.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/uniforms/fog.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/fog.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/uniforms/frame.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/frame.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/uniforms/frame.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/frame.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/uniforms/level.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/level.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/uniforms/level.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/level.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/uniforms/options.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/options.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/uniforms/options.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/options.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/uniforms/player.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/player.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/uniforms/player.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/player.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/uniforms/uniforms.glsl b/common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/uniforms.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/uniforms/uniforms.glsl rename to common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/uniforms.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/internal/vertex_input.vert b/common/src/main/resources/assets/flywheel/flywheel/internal/vertex_input.vert similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/internal/vertex_input.vert rename to common/src/main/resources/assets/flywheel/flywheel/internal/vertex_input.vert diff --git a/src/main/resources/assets/flywheel/flywheel/material/default.frag b/common/src/main/resources/assets/flywheel/flywheel/material/default.frag similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/material/default.frag rename to common/src/main/resources/assets/flywheel/flywheel/material/default.frag diff --git a/src/main/resources/assets/flywheel/flywheel/material/default.vert b/common/src/main/resources/assets/flywheel/flywheel/material/default.vert similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/material/default.vert rename to common/src/main/resources/assets/flywheel/flywheel/material/default.vert diff --git a/src/main/resources/assets/flywheel/flywheel/material/lines.frag b/common/src/main/resources/assets/flywheel/flywheel/material/lines.frag similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/material/lines.frag rename to common/src/main/resources/assets/flywheel/flywheel/material/lines.frag diff --git a/src/main/resources/assets/flywheel/flywheel/material/lines.vert b/common/src/main/resources/assets/flywheel/flywheel/material/lines.vert similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/material/lines.vert rename to common/src/main/resources/assets/flywheel/flywheel/material/lines.vert diff --git a/src/main/resources/assets/flywheel/flywheel/material/wireframe.frag b/common/src/main/resources/assets/flywheel/flywheel/material/wireframe.frag similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/material/wireframe.frag rename to common/src/main/resources/assets/flywheel/flywheel/material/wireframe.frag diff --git a/src/main/resources/assets/flywheel/flywheel/material/wireframe.vert b/common/src/main/resources/assets/flywheel/flywheel/material/wireframe.vert similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/material/wireframe.vert rename to common/src/main/resources/assets/flywheel/flywheel/material/wireframe.vert diff --git a/src/main/resources/assets/flywheel/flywheel/util/color.glsl b/common/src/main/resources/assets/flywheel/flywheel/util/color.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/util/color.glsl rename to common/src/main/resources/assets/flywheel/flywheel/util/color.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/util/matrix.glsl b/common/src/main/resources/assets/flywheel/flywheel/util/matrix.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/util/matrix.glsl rename to common/src/main/resources/assets/flywheel/flywheel/util/matrix.glsl diff --git a/src/main/resources/assets/flywheel/flywheel/util/quaternion.glsl b/common/src/main/resources/assets/flywheel/flywheel/util/quaternion.glsl similarity index 100% rename from src/main/resources/assets/flywheel/flywheel/util/quaternion.glsl rename to common/src/main/resources/assets/flywheel/flywheel/util/quaternion.glsl diff --git a/src/main/resources/assets/flywheel/lang/en_us.json b/common/src/main/resources/assets/flywheel/lang/en_us.json similarity index 100% rename from src/main/resources/assets/flywheel/lang/en_us.json rename to common/src/main/resources/assets/flywheel/lang/en_us.json diff --git a/src/main/resources/flywheel.backend.mixins.json b/common/src/main/resources/flywheel.backend.mixins.json similarity index 100% rename from src/main/resources/flywheel.backend.mixins.json rename to common/src/main/resources/flywheel.backend.mixins.json diff --git a/src/main/resources/flywheel.impl.mixins.json b/common/src/main/resources/flywheel.impl.mixins.json similarity index 100% rename from src/main/resources/flywheel.impl.mixins.json rename to common/src/main/resources/flywheel.impl.mixins.json diff --git a/src/main/resources/flywheel.impl.sodium.mixins.json b/common/src/main/resources/flywheel.impl.sodium.mixins.json similarity index 100% rename from src/main/resources/flywheel.impl.sodium.mixins.json rename to common/src/main/resources/flywheel.impl.sodium.mixins.json diff --git a/src/main/resources/logo.png b/common/src/main/resources/logo.png similarity index 100% rename from src/main/resources/logo.png rename to common/src/main/resources/logo.png diff --git a/src/main/resources/pack.mcmeta b/common/src/main/resources/pack.mcmeta similarity index 100% rename from src/main/resources/pack.mcmeta rename to common/src/main/resources/pack.mcmeta diff --git a/src/test/java/com/jozufozu/flywheel/backend/glsl/MockShaderSources.java b/common/src/test/java/com/jozufozu/flywheel/backend/glsl/MockShaderSources.java similarity index 100% rename from src/test/java/com/jozufozu/flywheel/backend/glsl/MockShaderSources.java rename to common/src/test/java/com/jozufozu/flywheel/backend/glsl/MockShaderSources.java diff --git a/src/test/java/com/jozufozu/flywheel/backend/glsl/TestBase.java b/common/src/test/java/com/jozufozu/flywheel/backend/glsl/TestBase.java similarity index 100% rename from src/test/java/com/jozufozu/flywheel/backend/glsl/TestBase.java rename to common/src/test/java/com/jozufozu/flywheel/backend/glsl/TestBase.java diff --git a/src/test/java/com/jozufozu/flywheel/backend/glsl/TestErrorMessages.java b/common/src/test/java/com/jozufozu/flywheel/backend/glsl/TestErrorMessages.java similarity index 100% rename from src/test/java/com/jozufozu/flywheel/backend/glsl/TestErrorMessages.java rename to common/src/test/java/com/jozufozu/flywheel/backend/glsl/TestErrorMessages.java diff --git a/src/test/java/com/jozufozu/flywheel/backend/glsl/TestShaderSourceLoading.java b/common/src/test/java/com/jozufozu/flywheel/backend/glsl/TestShaderSourceLoading.java similarity index 100% rename from src/test/java/com/jozufozu/flywheel/backend/glsl/TestShaderSourceLoading.java rename to common/src/test/java/com/jozufozu/flywheel/backend/glsl/TestShaderSourceLoading.java diff --git a/src/test/java/com/jozufozu/flywheel/impl/task/WaitGroupTest.java b/common/src/test/java/com/jozufozu/flywheel/impl/task/WaitGroupTest.java similarity index 100% rename from src/test/java/com/jozufozu/flywheel/impl/task/WaitGroupTest.java rename to common/src/test/java/com/jozufozu/flywheel/impl/task/WaitGroupTest.java diff --git a/src/test/java/com/jozufozu/flywheel/lib/task/PlanCompositionTest.java b/common/src/test/java/com/jozufozu/flywheel/lib/task/PlanCompositionTest.java similarity index 100% rename from src/test/java/com/jozufozu/flywheel/lib/task/PlanCompositionTest.java rename to common/src/test/java/com/jozufozu/flywheel/lib/task/PlanCompositionTest.java diff --git a/src/test/java/com/jozufozu/flywheel/lib/task/PlanExecutionTest.java b/common/src/test/java/com/jozufozu/flywheel/lib/task/PlanExecutionTest.java similarity index 100% rename from src/test/java/com/jozufozu/flywheel/lib/task/PlanExecutionTest.java rename to common/src/test/java/com/jozufozu/flywheel/lib/task/PlanExecutionTest.java diff --git a/src/test/java/com/jozufozu/flywheel/lib/util/TestAtomicBitset.java b/common/src/test/java/com/jozufozu/flywheel/lib/util/TestAtomicBitset.java similarity index 100% rename from src/test/java/com/jozufozu/flywheel/lib/util/TestAtomicBitset.java rename to common/src/test/java/com/jozufozu/flywheel/lib/util/TestAtomicBitset.java diff --git a/fabric/build.gradle b/fabric/build.gradle new file mode 100644 index 000000000..97418b24c --- /dev/null +++ b/fabric/build.gradle @@ -0,0 +1,151 @@ +plugins { + id 'maven-publish' + id 'dev.architectury.loom' +} + +evaluationDependsOn(':common') + +base { + archivesName = "flywheel-${project.name}-${artifact_minecraft_version}" +} + +loom { + runs { + configureEach { + property 'forge.logging.markers', '' + property 'forge.logging.console.level', 'debug' + } + + client { + ideConfigGenerated true + property 'flw.dumpShaderSource', 'true' + property 'flw.debugMemorySafety', 'true' + programArgs '--width', '1280', '--height', '720' + } + + server { + ideConfigGenerated true + programArgs '--nogui' + } + } +} + +repositories { + maven { + name = 'ParchmentMC' + url = 'https://maven.parchmentmc.org' + } + mavenCentral() +} + +dependencies { + minecraft "com.mojang:minecraft:$minecraft_version" + mappings(loom.layered() { + officialMojangMappings() + parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") + }) + + modCompileOnly "net.fabricmc:fabric-loader:$fabric_loader_version" + modLocalRuntime "net.fabricmc:fabric-loader:$fabric_loader_version" + + modCompileOnly "net.fabricmc.fabric-api:fabric-api:$fabric_api_version" + modLocalRuntime "net.fabricmc.fabric-api:fabric-api:$fabric_api_version" + + compileOnly project(path: ':common', configuration: 'namedElements') +} + +java { + JavaVersion javaVersion = JavaVersion.toVersion(java_version) + sourceCompatibility = javaVersion + targetCompatibility = javaVersion + + toolchain.languageVersion = JavaLanguageVersion.of(java_version) + + withSourcesJar() + withJavadocJar() +} + +processResources.configure { + from(project(':common').sourceSets.main.resources) + + var replaceProperties = [ + minecraft_version : minecraft_version, + minecraft_version_range: minecraft_version_range, + forge_version : forge_version, + forge_version_range : forge_version_range, + loader_version_range : loader_version_range, + mod_version : mod_version + ] + inputs.properties replaceProperties + + filesMatching(['META-INF/mods.toml', 'META-INF/neoforge.mods.toml', 'pack.mcmeta', 'fabric.mod.json']) { + expand replaceProperties + [project: project] + } +} + +tasks.withType(JavaCompile).configureEach { + source(project(':common').sourceSets.main.allSource) + options.encoding = 'UTF-8' + options.release = Integer.parseInt(java_version) + options.compilerArgs = ['-Xdiags:verbose'] +} + +jar.configure { + archiveClassifier = '' + addManifest(it) + addLicense(it) +} + +sourcesJar.configure { + from(project(':common').sourceSets.main.allSource) + addManifest(it) + addLicense(it) +} + +javadoc.configure { + source(project(':common').sourceSets.main.allJava) + // prevent java 8's strict doclint for javadocs from failing builds + options.addStringOption('Xdoclint:none', '-quiet') +} + +test.configure { + useJUnitPlatform() +} + +void addLicense(jarTask) { + jarTask.from('LICENSE.md') { + rename '(.*)\\.(.*)', '$1_' + archivesBaseName + '.$2' + } +} + +void addManifest(jarTask) { + jarTask.manifest { + attributes([ + 'Specification-Title' : 'flywheel', + // 'Specification-Vendor': 'flywheel authors', + 'Specification-Version' : '1', // We are version 1 of ourselves + 'Implementation-Title' : project.jar.archiveBaseName, + 'Implementation-Version' : project.jar.archiveVersion, + // 'Implementation-Vendor': 'flywheel authors', + 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), + ]) + } +} + +publishing { + publications { + register('mavenJava', MavenPublication) { + from(components["java"]) + artifactId = "flywheel-${project.name}-intermediary-${artifact_minecraft_version}" + } + } + repositories { + maven { + url "file://${project.projectDir}/mcmodsrepo" + } + + if (project.hasProperty('mavendir')) { + maven { url rootProject.file(property('mavendir')) } + } + } +} diff --git a/forge/build.gradle b/forge/build.gradle new file mode 100644 index 000000000..5d5ba26dd --- /dev/null +++ b/forge/build.gradle @@ -0,0 +1,147 @@ +plugins { + id 'maven-publish' + id 'dev.architectury.loom' +} + +evaluationDependsOn(':common') + +base { + archivesName = "flywheel-${project.name}-${artifact_minecraft_version}" +} + +loom { + runs { + configureEach { + property 'forge.logging.markers', '' + property 'forge.logging.console.level', 'debug' + } + + client { + ideConfigGenerated true + property 'flw.dumpShaderSource', 'true' + property 'flw.debugMemorySafety', 'true' + programArgs '--width', '1280', '--height', '720' + } + + server { + ideConfigGenerated true + programArgs '--nogui' + } + } +} + +repositories { + maven { + name = 'ParchmentMC' + url = 'https://maven.parchmentmc.org' + } + mavenCentral() +} + +dependencies { + minecraft "com.mojang:minecraft:$minecraft_version" + mappings(loom.layered() { + officialMojangMappings() + parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") + }) + + forge "net.minecraftforge:forge:${minecraft_version}-${forge_version}" + + compileOnly project(path: ':common', configuration: 'namedElements') +} + +java { + JavaVersion javaVersion = JavaVersion.toVersion(java_version) + sourceCompatibility = javaVersion + targetCompatibility = javaVersion + + toolchain.languageVersion = JavaLanguageVersion.of(java_version) + + withSourcesJar() + withJavadocJar() +} + +processResources.configure { + from(project(':common').sourceSets.main.resources) + + var replaceProperties = [ + minecraft_version : minecraft_version, + minecraft_version_range: minecraft_version_range, + forge_version : forge_version, + forge_version_range : forge_version_range, + loader_version_range : loader_version_range, + mod_version : mod_version + ] + inputs.properties replaceProperties + + filesMatching(['META-INF/mods.toml', 'META-INF/neoforge.mods.toml', 'pack.mcmeta', 'fabric.mod.json']) { + expand replaceProperties + [project: project] + } +} + +tasks.withType(JavaCompile).configureEach { + source(project(':common').sourceSets.main.allSource) + options.encoding = 'UTF-8' + options.release = Integer.parseInt(java_version) + options.compilerArgs = ['-Xdiags:verbose'] +} + +jar.configure { + archiveClassifier = '' + addManifest(it) + addLicense(it) +} + +sourcesJar.configure { + from(project(':common').sourceSets.main.allSource) + addManifest(it) + addLicense(it) +} + +javadoc.configure { + source(project(':common').sourceSets.main.allJava) + // prevent java 8's strict doclint for javadocs from failing builds + options.addStringOption('Xdoclint:none', '-quiet') +} + +test.configure { + useJUnitPlatform() +} + +void addLicense(jarTask) { + jarTask.from('LICENSE.md') { + rename '(.*)\\.(.*)', '$1_' + archivesBaseName + '.$2' + } +} + +void addManifest(jarTask) { + jarTask.manifest { + attributes([ + 'Specification-Title' : 'flywheel', + // 'Specification-Vendor': 'flywheel authors', + 'Specification-Version' : '1', // We are version 1 of ourselves + 'Implementation-Title' : project.jar.archiveBaseName, + 'Implementation-Version' : project.jar.archiveVersion, + // 'Implementation-Vendor': 'flywheel authors', + 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), + ]) + } +} + +publishing { + publications { + register('mavenJava', MavenPublication) { + from(components["java"]) + artifactId = "flywheel-${project.name}-intermediary-${artifact_minecraft_version}" + } + } + repositories { + maven { + url "file://${project.projectDir}/mcmodsrepo" + } + + if (project.hasProperty('mavendir')) { + maven { url rootProject.file(property('mavendir')) } + } + } +} diff --git a/forge/gradle.properties b/forge/gradle.properties new file mode 100644 index 000000000..a58ba1416 --- /dev/null +++ b/forge/gradle.properties @@ -0,0 +1 @@ +loom.platform = forge diff --git a/gradle.properties b/gradle.properties index 878a41fce..1f59a4afe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,12 +6,16 @@ mod_version = 1.0.0-alpha artifact_minecraft_version = 1.20.1 minecraft_version = 1.20.1 forge_version = 47.2.19 +fabric_loader_version = 0.15.9 +fabric_api_version = 0.92.1+1.20.1 # Version ranges for the mods.toml minecraft_version_range = [1.20.1,1.20.2) forge_version_range = [47,) loader_version_range = [47,) # build dependency versions +java_version = 17 +arch_loom_version = 1.6-SNAPSHOT forgegradle_version = [6.0.16,6.2) mixingradle_version = 0.7.+ mixin_version = 0.8.5 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d3e0ab67b14947c167a862655af9b..e6441136f3d4ba8a0da8d277868979cfbc8ad796 100644 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9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yR69y0rnjg8cqjmWyz7*Kx3~X> z|BZX}Y;oVB1HX@l9_-y7dI*WgruY@?rC&64`}3W`ECA>O@Y#Q@JS<4WBF(QbwJqHM zt)fE#6jTSyZ^E8y0INaIf!omWjvS=@15`O%V2CKg+}z=M9##kLKRN0uJuK250bXVU zwzT&n@30^dzKnlL^us;wClg?CKWEtiEb#zhPVx{PxFQiwEPp^C53zN21EdZAz?3D& zC6fK|_!S5Mq&0z;xWGLEv}!zjfpRg_orp7|fXMx=uP!@X`yT@5(N_Hza}p5fBk&|)J7fZ`NQ9Nz@5xT? zi?iV$q+bG!2LZUpF)>Yl!u;DEHV3!i{ipcJm_8Gj@Dac%N3|SQVGqRhrJ;WOR|CtrwzPTW^&$A6!A$E)h7xohm>hA8p{PUZ~ z_&zeg@OL3PxPtzkfsNZAqXCZ8Is7yQ+plm~8;}|~DEkv&f@?q5hB*OGQYXuwVQOp0 z?QQ`6qyp|-$47wjuV74IE_x2I17$+grwMBE^25d<5!lYhnszuh|5Yk;RB+Uk*hk=m zu73=E^7ul{40{A^?Rg^fq0ZfZO@C1HupR*_d;J>lkFv6&x&}4N;t}1T@2}~AC^<3b zA}RxFPPZe5R{_6dIN9N-GT29Oa}RzA2ekKuEVZbuMOB?Xf**`N5&m}?)TjigdY(rF z?~+a=`0);TlDa1j)1G`AfW? zRl883QPq=w zbB|bHEx%_u*$t@Yl#Vc;y*?2W^|^NJ)DmioQFr~1&>MSBL_b(YIpGWdDm3bT=Mgm1 e+h0K+-~H6qzyuy}`;+tYAZFmzUSVSYum1yJqxCBQ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 309b4e18d..e7646dead 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index aeb74cbb4..1aa94a426 100755 --- a/gradlew +++ b/gradlew @@ -83,7 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -130,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -141,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -149,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -198,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 93e3f59f1..25da30dbd 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/old.build.gradle b/old.build.gradle new file mode 100644 index 000000000..6caf08ab3 --- /dev/null +++ b/old.build.gradle @@ -0,0 +1,205 @@ +plugins { + id 'eclipse' + id 'idea' + id 'maven-publish' + id 'net.minecraftforge.gradle' version "${forgegradle_version}" + id 'org.parchmentmc.librarian.forgegradle' version "${librarian_version}" + id 'org.spongepowered.mixin' version "${mixingradle_version}" +} + +boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false'); + +ext.buildNumber = System.getenv('BUILD_NUMBER') + +group = 'com.jozufozu.flywheel' +archivesBaseName = "flywheel-forge-${artifact_minecraft_version}" +version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') + +java.toolchain.languageVersion = JavaLanguageVersion.of(17) + +println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" +minecraft { + mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" + + copyIdeResources = true + + runs { + configureEach { + workingDirectory project.file('run') + + property 'forge.logging.markers', '' + property 'forge.logging.console.level', 'debug' + + property 'mixin.env.remapRefMap', 'true' + property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" + + mods { + flywheel { + source sourceSets.main + } + } + } + + client { + property 'flw.dumpShaderSource', 'true' + property 'flw.debugMemorySafety', 'true' + } + + server { + args '--nogui' + } + } +} + +repositories { + maven { + url 'https://www.cursemaven.com' + content { + includeGroup "curse.maven" + } + } + maven { + name 'tterrag maven' + url 'https://maven.tterrag.com/' + } + maven { + name = "Modrinth" + url = "https://api.modrinth.com/maven" + content { + includeGroup "maven.modrinth" + } + } + mavenCentral() +} + +dependencies { + testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1' + minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" + + compileOnly fg.deobf("maven.modrinth:embeddium:0.3.9+mc1.20.1") + compileOnly fg.deobf("maven.modrinth:oculus:1.20.1-1.6.15a") + // implementation fg.deobf("maven.modrinth:starlight-forge:1.1.2+1.20") + + // https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497 + // Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings + // This allows 'Settings > Build, Execution, and Deployment > Build Tools > Gradle > Build and run using' set to IntelliJ to work correctly + // if (System.getProperty('idea.sync.active') != 'true') { + annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor" + // } +} + +test { + useJUnitPlatform() +} + +mixin { + add sourceSets.main, 'flywheel.refmap.json' + + config 'flywheel.backend.mixins.json' + config 'flywheel.impl.mixins.json' + config 'flywheel.impl.sodium.mixins.json' + + debug.verbose = true + debug.export = true +} + +idea { + // Tell IDEA to always download sources/javadoc artifacts from maven. + module { + downloadJavadoc = true + downloadSources = true + } +} + +// Workaround for SpongePowered/MixinGradle#38 +afterEvaluate { + tasks.configureReobfTaskForReobfJar.mustRunAfter(tasks.compileJava) +} + +tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation +} + +javadoc { + source = [sourceSets.main.allJava] + // prevent java 8's strict doclint for javadocs from failing builds + options.addStringOption('Xdoclint:none', '-quiet') +} + +compileJava { + options.compilerArgs = ['-Xdiags:verbose'] +} + +tasks.named('processResources', ProcessResources).configure { + var replaceProperties = [ + minecraft_version : minecraft_version, + minecraft_version_range: minecraft_version_range, + forge_version : forge_version, + forge_version_range : forge_version_range, + loader_version_range : loader_version_range, + mod_version : mod_version + ] + inputs.properties replaceProperties + + filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { + expand replaceProperties + [project: project] + } +} + +apply from: rootProject.file('gradle/package-infos.gradle') + +void addLicense(jarTask) { + jarTask.from('LICENSE.md') { + rename '(.*)\\.(.*)', '$1_' + archivesBaseName + '.$2' + } +} + +void addManifest(jarTask) { + jarTask.manifest { + attributes([ + 'Specification-Title' : 'flywheel', + // 'Specification-Vendor': 'flywheel authors', + 'Specification-Version' : '1', // We are version 1 of ourselves + 'Implementation-Title' : project.jar.archiveBaseName, + 'Implementation-Version' : project.jar.archiveVersion, + // 'Implementation-Vendor': 'flywheel authors', + 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), + ]) + } +} + +tasks.named('jar', Jar).configure { + archiveClassifier = '' + + finalizedBy 'reobfJar' + addManifest(it) + addLicense(it) +} + +java { + withSourcesJar() + withJavadocJar() +} + +publishing { + publications { + register('mavenJava', MavenPublication) { + artifact jar + artifact sourcesJar + artifact javadocJar + + artifactId = archivesBaseName + + fg.component(it) + } + } + repositories { + maven { + url "file://${project.projectDir}/mcmodsrepo" + } + + if (project.hasProperty('mavendir')) { + maven { url mavendir } + } + } +} diff --git a/settings.gradle b/settings.gradle index 26eaa3d68..db8285a90 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,13 +6,20 @@ pluginManagement { name = 'MinecraftForge' url = 'https://maven.minecraftforge.net/' } + maven { + name = 'Architectury' + url = 'https://maven.architectury.dev/' + } maven { url = 'https://repo.spongepowered.org/repository/maven-public' } maven { url = 'https://maven.parchmentmc.org' } } + plugins { + id 'dev.architectury.loom' version arch_loom_version + } } -plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' -} +rootProject.name = 'Flywheel' -rootProject.name = 'Flywheel-Forge' +include('common') +include('fabric') +include('forge') From 99044bcf7b28905637db4f2151b0ea4c205ae8b1 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Wed, 17 Apr 2024 12:21:28 -0700 Subject: [PATCH 02/62] Re-add package-info generation --- .gitignore | 2 +- common/build.gradle | 4 +++- fabric/build.gradle | 4 +++- forge/build.gradle | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index c5cbdefa4..96431a961 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ build/ gradle-app.setting out/ logs/ -dist/ ## IntelliJ IDEA @@ -47,3 +46,4 @@ local.properties # Other mcmodsrepo src/*/generatedPackageInfos/ +*/src/*/generatedPackageInfos/ diff --git a/common/build.gradle b/common/build.gradle index 3e4ebaeeb..c690035d6 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -100,6 +100,8 @@ void addManifest(jarTask) { } } +apply from: rootProject.file('gradle/package-infos.gradle') + publishing { publications { register('mavenJava', MavenPublication) { @@ -114,7 +116,7 @@ publishing { } repositories { maven { - url "file://${project.projectDir}/mcmodsrepo" + url "file://${rootProject.projectDir}/mcmodsrepo" } if (project.hasProperty('mavendir')) { diff --git a/fabric/build.gradle b/fabric/build.gradle index 97418b24c..6d44e1948 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -132,6 +132,8 @@ void addManifest(jarTask) { } } +apply from: rootProject.file('gradle/package-infos.gradle') + publishing { publications { register('mavenJava', MavenPublication) { @@ -141,7 +143,7 @@ publishing { } repositories { maven { - url "file://${project.projectDir}/mcmodsrepo" + url "file://${rootProject.projectDir}/mcmodsrepo" } if (project.hasProperty('mavendir')) { diff --git a/forge/build.gradle b/forge/build.gradle index 5d5ba26dd..8feaa4c8e 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -128,6 +128,8 @@ void addManifest(jarTask) { } } +apply from: rootProject.file('gradle/package-infos.gradle') + publishing { publications { register('mavenJava', MavenPublication) { @@ -137,7 +139,7 @@ publishing { } repositories { maven { - url "file://${project.projectDir}/mcmodsrepo" + url "file://${rootProject.projectDir}/mcmodsrepo" } if (project.hasProperty('mavendir')) { From a6157c59b3d65af94c00341178cc5075eb80fc74 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Wed, 17 Apr 2024 12:32:36 -0700 Subject: [PATCH 03/62] Re-add sodium/embeddium, iris/oculus, starlight dependencies --- common/build.gradle | 17 +++++++++++++++++ fabric/build.gradle | 23 +++++++++++++++++++++++ forge/build.gradle | 20 ++++++++++++++++++++ gradle.properties | 7 +++++++ 4 files changed, 67 insertions(+) diff --git a/common/build.gradle b/common/build.gradle index c690035d6..30d460a3b 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -12,6 +12,23 @@ repositories { name = 'ParchmentMC' url = 'https://maven.parchmentmc.org' } + maven { + url 'https://www.cursemaven.com' + content { + includeGroup "curse.maven" + } + } + maven { + name 'tterrag maven' + url 'https://maven.tterrag.com/' + } + maven { + name = "Modrinth" + url = "https://api.modrinth.com/maven" + content { + includeGroup "maven.modrinth" + } + } mavenCentral() } diff --git a/fabric/build.gradle b/fabric/build.gradle index 6d44e1948..7b3d10222 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -35,6 +35,23 @@ repositories { name = 'ParchmentMC' url = 'https://maven.parchmentmc.org' } + maven { + url 'https://www.cursemaven.com' + content { + includeGroup "curse.maven" + } + } + maven { + name 'tterrag maven' + url 'https://maven.tterrag.com/' + } + maven { + name = "Modrinth" + url = "https://api.modrinth.com/maven" + content { + includeGroup "maven.modrinth" + } + } mavenCentral() } @@ -52,6 +69,12 @@ dependencies { modLocalRuntime "net.fabricmc.fabric-api:fabric-api:$fabric_api_version" compileOnly project(path: ':common', configuration: 'namedElements') + + // switch to implementation for debugging + modCompileOnly "maven.modrinth:starlight:$starlight_version" + + modCompileOnly "maven.modrinth:sodium:$sodium_version" + modCompileOnly "maven.modrinth:iris:$iris_version" } java { diff --git a/forge/build.gradle b/forge/build.gradle index 8feaa4c8e..ed45787f3 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -35,6 +35,23 @@ repositories { name = 'ParchmentMC' url = 'https://maven.parchmentmc.org' } + maven { + url 'https://www.cursemaven.com' + content { + includeGroup "curse.maven" + } + } + maven { + name 'tterrag maven' + url 'https://maven.tterrag.com/' + } + maven { + name = "Modrinth" + url = "https://api.modrinth.com/maven" + content { + includeGroup "maven.modrinth" + } + } mavenCentral() } @@ -48,6 +65,9 @@ dependencies { forge "net.minecraftforge:forge:${minecraft_version}-${forge_version}" compileOnly project(path: ':common', configuration: 'namedElements') + + modCompileOnly "maven.modrinth:embeddium:$embeddium_version" + modCompileOnly "maven.modrinth:oculus:$oculus_version" } java { diff --git a/gradle.properties b/gradle.properties index 1f59a4afe..c21a937b9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,3 +22,10 @@ mixin_version = 0.8.5 librarian_version = 1.+ cursegradle_version = 1.4.0 parchment_version = 2023.09.03 + +# dependency mod versions +embeddium_version = 0.3.9+mc1.20.1 +oculus_version = 1.20.1-1.6.15a +sodium_version = mc1.20.1-0.5.8 +iris_version = 1.6.17+1.20.1 +starlight_version = 1.1.2+1.20 From 0d8a63f1899434ab26c1c64b36146b25f414c8cb Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Wed, 17 Apr 2024 12:59:44 -0700 Subject: [PATCH 04/62] Add jsr305 compile dependency --- common/build.gradle | 2 ++ fabric/build.gradle | 2 ++ forge/build.gradle | 2 ++ 3 files changed, 6 insertions(+) diff --git a/common/build.gradle b/common/build.gradle index 30d460a3b..cd95427fe 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -40,6 +40,8 @@ dependencies { }) modCompileOnly "net.fabricmc:fabric-loader:$fabric_loader_version" + + compileOnly "com.google.code.findbugs:jsr305:3.0.2" } java { diff --git a/fabric/build.gradle b/fabric/build.gradle index 7b3d10222..ab6142982 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -75,6 +75,8 @@ dependencies { modCompileOnly "maven.modrinth:sodium:$sodium_version" modCompileOnly "maven.modrinth:iris:$iris_version" + + compileOnly "com.google.code.findbugs:jsr305:3.0.2" } java { diff --git a/forge/build.gradle b/forge/build.gradle index ed45787f3..eb5e84009 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -68,6 +68,8 @@ dependencies { modCompileOnly "maven.modrinth:embeddium:$embeddium_version" modCompileOnly "maven.modrinth:oculus:$oculus_version" + + compileOnly "com.google.code.findbugs:jsr305:3.0.2" } java { From 85fc7c8246e00c4383ca1f60776b3d79aa5da1f3 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Wed, 17 Apr 2024 17:22:12 -0700 Subject: [PATCH 05/62] Begin on platform abstraction interface --- .../flywheel/platform/ClientPlatform.java | 22 +++++++++++++++++++ .../flywheel/platform/ClientPlatformImpl.java | 4 ++++ .../flywheel/platform/ClientPlatformImpl.java | 4 ++++ 3 files changed, 30 insertions(+) create mode 100644 common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java create mode 100644 forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java diff --git a/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java b/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java new file mode 100644 index 000000000..ee62f49ea --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java @@ -0,0 +1,22 @@ +package com.jozufozu.flywheel.platform; + +import java.lang.reflect.InvocationTargetException; + +public abstract class ClientPlatform { + private static final ClientPlatform INSTANCE; + + static { + try { + INSTANCE = + (ClientPlatform) Class.forName("com.jozufozu.flywheel.platform.ClientPlatformImpl").getConstructor() + .newInstance(); + } catch (ClassNotFoundException | InvocationTargetException | InstantiationException | IllegalAccessException | + NoSuchMethodException e) { + throw new RuntimeException(e); + } + } + + public static ClientPlatform getInstance() { + return INSTANCE; + } +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java b/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java new file mode 100644 index 000000000..34abe1089 --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java @@ -0,0 +1,4 @@ +package com.jozufozu.flywheel.platform; + +public class ClientPlatformImpl extends ClientPlatform { +} diff --git a/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java b/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java new file mode 100644 index 000000000..34abe1089 --- /dev/null +++ b/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java @@ -0,0 +1,4 @@ +package com.jozufozu.flywheel.platform; + +public class ClientPlatformImpl extends ClientPlatform { +} From 54f2ffd6eae0c664e687003e1dfdd263e866fd68 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Wed, 17 Apr 2024 17:26:24 -0700 Subject: [PATCH 06/62] Move Sodium mixin to platform code --- .../sodium/ChunkBuilderMeshingTaskMixin.java | 0 .../impl/mixin/sodium/SodiumMixinPlugin.java | 48 +++++++++++++++++++ .../flywheel.impl.sodium.mixins.json | 0 .../sodium/ChunkBuilderMeshingTaskMixin.java | 23 +++++++++ .../impl/mixin/sodium/SodiumMixinPlugin.java | 0 .../flywheel.impl.sodium.mixins.json | 14 ++++++ 6 files changed, 85 insertions(+) rename {common => fabric}/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/ChunkBuilderMeshingTaskMixin.java (100%) create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java rename {common => fabric}/src/main/resources/flywheel.impl.sodium.mixins.json (100%) create mode 100644 forge/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/ChunkBuilderMeshingTaskMixin.java rename {common => forge}/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java (100%) create mode 100644 forge/src/main/resources/flywheel.impl.sodium.mixins.json diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/ChunkBuilderMeshingTaskMixin.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/ChunkBuilderMeshingTaskMixin.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/ChunkBuilderMeshingTaskMixin.java rename to fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/ChunkBuilderMeshingTaskMixin.java diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java new file mode 100644 index 000000000..b2021bdc1 --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java @@ -0,0 +1,48 @@ +package com.jozufozu.flywheel.impl.mixin.sodium; + +import java.util.List; +import java.util.Set; +import java.util.function.Supplier; + +import com.google.common.base.Suppliers; + +import org.objectweb.asm.tree.ClassNode; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; +import org.spongepowered.asm.mixin.extensibility.IMixinInfo; + +import net.fabricmc.loader.api.FabricLoader; + +public class SodiumMixinPlugin implements IMixinConfigPlugin { + private static final Supplier IS_SODIUM_LOADED = Suppliers.memoize(() -> FabricLoader.getInstance().isModLoaded("sodium")); + + @Override + public void onLoad(String mixinPackage) { + } + + @Override + public String getRefMapperConfig() { + return null; + } + + @Override + public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { + return IS_SODIUM_LOADED.get(); + } + + @Override + public void acceptTargets(Set myTargets, Set otherTargets) { + } + + @Override + public List getMixins() { + return null; + } + + @Override + public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { + } + + @Override + public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { + } +} diff --git a/common/src/main/resources/flywheel.impl.sodium.mixins.json b/fabric/src/main/resources/flywheel.impl.sodium.mixins.json similarity index 100% rename from common/src/main/resources/flywheel.impl.sodium.mixins.json rename to fabric/src/main/resources/flywheel.impl.sodium.mixins.json diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/ChunkBuilderMeshingTaskMixin.java b/forge/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/ChunkBuilderMeshingTaskMixin.java new file mode 100644 index 000000000..71e32d0cd --- /dev/null +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/ChunkBuilderMeshingTaskMixin.java @@ -0,0 +1,23 @@ +package com.jozufozu.flywheel.impl.mixin.sodium; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import com.jozufozu.flywheel.impl.visualization.VisualizationHelper; + +import me.jellysquid.mods.sodium.client.render.chunk.compile.tasks.ChunkBuilderMeshingTask; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.world.level.block.entity.BlockEntity; + +@Mixin(value = ChunkBuilderMeshingTask.class, remap = false) +abstract class ChunkBuilderMeshingTaskMixin { + @Redirect(method = "execute", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher;getRenderer(Lnet/minecraft/world/level/block/entity/BlockEntity;)Lnet/minecraft/client/renderer/blockentity/BlockEntityRenderer;", remap = true)) + private BlockEntityRenderer flywheel$redirectGetRenderer(BlockEntityRenderDispatcher dispatcher, BlockEntity blockEntity) { + if (VisualizationHelper.tryAddBlockEntity(blockEntity)) { + return null; + } + return dispatcher.getRenderer(blockEntity); + } +} diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java b/forge/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java rename to forge/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java diff --git a/forge/src/main/resources/flywheel.impl.sodium.mixins.json b/forge/src/main/resources/flywheel.impl.sodium.mixins.json new file mode 100644 index 000000000..c02f33509 --- /dev/null +++ b/forge/src/main/resources/flywheel.impl.sodium.mixins.json @@ -0,0 +1,14 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "com.jozufozu.flywheel.impl.mixin.sodium", + "compatibilityLevel": "JAVA_17", + "refmap": "flywheel.refmap.json", + "plugin": "com.jozufozu.flywheel.impl.mixin.sodium.SodiumMixinPlugin", + "client": [ + "ChunkBuilderMeshingTaskMixin" + ], + "injectors": { + "defaultRequire": 1 + } +} From 2163ad95c6f122d1c41eec32f506721956951b1f Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Wed, 17 Apr 2024 18:55:08 -0700 Subject: [PATCH 07/62] Move MinecraftMixin to platforms --- .../flywheel/impl/mixin/MinecraftMixin.java | 35 +++++++++++++++++++ .../flywheel/impl/mixin/MinecraftMixin.java | 0 2 files changed, 35 insertions(+) create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java rename {common => forge}/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java (100%) diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java new file mode 100644 index 000000000..f76827547 --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java @@ -0,0 +1,35 @@ +package com.jozufozu.flywheel.impl.mixin; + +import java.util.Optional; +import java.util.concurrent.CompletableFuture; + +import com.jozufozu.flywheel.api.event.EndClientResourceReloadEvent; + +import net.minecraftforge.fml.ModLoader; + +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import net.minecraft.client.Minecraft; +import net.minecraft.server.packs.resources.ReloadableResourceManager; + +@Mixin(Minecraft.class) +abstract class MinecraftMixin { + @Shadow + @Final + private ReloadableResourceManager resourceManager; + + @Inject(method = "method_24040", at = @At("HEAD")) + private void flywheel$onEndInitialResourceReload(Optional error, CallbackInfo ci) { + ModLoader.get().postEvent(new EndClientResourceReloadEvent((Minecraft) (Object) this, resourceManager, true, error)); + } + + @Inject(method = "method_24228", at = @At("HEAD")) + private void flywheel$onEndManualResourceReload(boolean recovery, CompletableFuture future, Optional error, CallbackInfo ci) { + ModLoader.get().postEvent(new EndClientResourceReloadEvent((Minecraft) (Object) this, resourceManager, false, error)); + } +} diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java b/forge/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java rename to forge/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java From c027023709118d4fb72f32609bad948dd6046906 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Wed, 17 Apr 2024 19:20:16 -0700 Subject: [PATCH 08/62] Move events to platforms --- .../api/event/BeginFrameCallback.java | 15 +++++++++++++ .../EndClientResourceReloadCallback.java | 21 +++++++++++++++++++ .../event/ReloadLevelRendererCallback.java | 17 +++++++++++++++ .../api/event/RenderStageCallback.java | 15 +++++++++++++ .../flywheel/impl/mixin/MinecraftMixin.java | 15 ++++++------- .../flywheel/api/event/BeginFrameEvent.java | 0 .../event/EndClientResourceReloadEvent.java | 0 .../api/event/ReloadLevelRendererEvent.java | 0 .../flywheel/api/event/RenderStageEvent.java | 0 9 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameCallback.java create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadCallback.java create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererCallback.java create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/api/event/RenderStageCallback.java rename {common => forge}/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameEvent.java (100%) rename {common => forge}/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadEvent.java (100%) rename {common => forge}/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererEvent.java (100%) rename {common => forge}/src/main/java/com/jozufozu/flywheel/api/event/RenderStageEvent.java (100%) diff --git a/fabric/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameCallback.java b/fabric/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameCallback.java new file mode 100644 index 000000000..47d16fd95 --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameCallback.java @@ -0,0 +1,15 @@ +package com.jozufozu.flywheel.api.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; + +@FunctionalInterface +public interface BeginFrameCallback { + Event EVENT = EventFactory.createArrayBacked(BeginFrameCallback.class, callbacks -> context -> { + for (BeginFrameCallback callback : callbacks) { + callback.onBeginFrame(context); + } + }); + + void onBeginFrame(RenderContext context); +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadCallback.java b/fabric/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadCallback.java new file mode 100644 index 000000000..d6f1a8644 --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadCallback.java @@ -0,0 +1,21 @@ +package com.jozufozu.flywheel.api.event; + +import java.util.Optional; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.client.Minecraft; +import net.minecraft.server.packs.resources.ResourceManager; + +@FunctionalInterface +public interface EndClientResourceReloadCallback { + Event EVENT = EventFactory.createArrayBacked(EndClientResourceReloadCallback.class, + callbacks -> (minecraft, resourceManager, initialReload, error) -> { + for (EndClientResourceReloadCallback callback : callbacks) { + callback.onEndClientResourceReload(minecraft, resourceManager, initialReload, error); + } + }); + + void onEndClientResourceReload(Minecraft minecraft, ResourceManager resourceManager, boolean initialReload, + Optional error); +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererCallback.java b/fabric/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererCallback.java new file mode 100644 index 000000000..ca16d46a3 --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererCallback.java @@ -0,0 +1,17 @@ +package com.jozufozu.flywheel.api.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.client.multiplayer.ClientLevel; + +@FunctionalInterface +public interface ReloadLevelRendererCallback { + Event EVENT = + EventFactory.createArrayBacked(ReloadLevelRendererCallback.class, callbacks -> level -> { + for (ReloadLevelRendererCallback callback : callbacks) { + callback.onReloadLevelRenderer(level); + } + }); + + void onReloadLevelRenderer(ClientLevel level); +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/api/event/RenderStageCallback.java b/fabric/src/main/java/com/jozufozu/flywheel/api/event/RenderStageCallback.java new file mode 100644 index 000000000..27170fda5 --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/api/event/RenderStageCallback.java @@ -0,0 +1,15 @@ +package com.jozufozu.flywheel.api.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; + +public interface RenderStageCallback { + Event EVENT = + EventFactory.createArrayBacked(RenderStageCallback.class, callbacks -> (context, stage) -> { + for (RenderStageCallback callback : callbacks) { + callback.onRenderStage(context, stage); + } + }); + + void onRenderStage(RenderContext context, RenderStage stage); +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java index f76827547..c1ec8c809 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java @@ -3,10 +3,6 @@ import java.util.Optional; import java.util.concurrent.CompletableFuture; -import com.jozufozu.flywheel.api.event.EndClientResourceReloadEvent; - -import net.minecraftforge.fml.ModLoader; - import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -14,6 +10,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import com.jozufozu.flywheel.api.event.EndClientResourceReloadCallback; + import net.minecraft.client.Minecraft; import net.minecraft.server.packs.resources.ReloadableResourceManager; @@ -25,11 +23,14 @@ abstract class MinecraftMixin { @Inject(method = "method_24040", at = @At("HEAD")) private void flywheel$onEndInitialResourceReload(Optional error, CallbackInfo ci) { - ModLoader.get().postEvent(new EndClientResourceReloadEvent((Minecraft) (Object) this, resourceManager, true, error)); + EndClientResourceReloadCallback.EVENT.invoker() + .onEndClientResourceReload((Minecraft) (Object) this, resourceManager, true, error); } @Inject(method = "method_24228", at = @At("HEAD")) - private void flywheel$onEndManualResourceReload(boolean recovery, CompletableFuture future, Optional error, CallbackInfo ci) { - ModLoader.get().postEvent(new EndClientResourceReloadEvent((Minecraft) (Object) this, resourceManager, false, error)); + private void flywheel$onEndManualResourceReload(boolean recovery, CompletableFuture future, + Optional error, CallbackInfo ci) { + EndClientResourceReloadCallback.EVENT.invoker() + .onEndClientResourceReload((Minecraft) (Object) this, resourceManager, false, error); } } diff --git a/common/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameEvent.java b/forge/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameEvent.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameEvent.java rename to forge/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameEvent.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadEvent.java b/forge/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadEvent.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadEvent.java rename to forge/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadEvent.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererEvent.java b/forge/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererEvent.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererEvent.java rename to forge/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererEvent.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/event/RenderStageEvent.java b/forge/src/main/java/com/jozufozu/flywheel/api/event/RenderStageEvent.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/event/RenderStageEvent.java rename to forge/src/main/java/com/jozufozu/flywheel/api/event/RenderStageEvent.java From 5e7e867bcd144bbb46593352febc02f666ff035f Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Thu, 18 Apr 2024 17:12:13 -0700 Subject: [PATCH 09/62] Deduplication and stubs - Move common gradle business from each subproject into the rootProject.subprojects closure - Add fabric.mod.json - Register forge mixin configs - Make blaze3d mixins remap = false - Separate common, forge, and fabric mod entrypoints --- build.gradle | 120 +++++++++++++- common/build.gradle | 109 ------------- .../java/com/jozufozu/flywheel/Flywheel.java | 147 +---------------- .../backend/mixin/GlStateManagerMixin.java | 2 +- .../backend/mixin/RenderSystemMixin.java | 2 +- fabric/build.gradle | 104 ------------ .../com/jozufozu/flywheel/FlywheelFabric.java | 10 ++ fabric/src/main/resources/fabric.mod.json | 32 ++++ forge/build.gradle | 110 +------------ .../com/jozufozu/flywheel/FlywheelForge.java | 154 ++++++++++++++++++ .../src/main/resources/META-INF/mods.toml | 0 11 files changed, 326 insertions(+), 464 deletions(-) create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/FlywheelFabric.java create mode 100644 fabric/src/main/resources/fabric.mod.json create mode 100644 forge/src/main/java/com/jozufozu/flywheel/FlywheelForge.java rename {common => forge}/src/main/resources/META-INF/mods.toml (100%) diff --git a/build.gradle b/build.gradle index 1ec9b2791..516025ba3 100644 --- a/build.gradle +++ b/build.gradle @@ -7,14 +7,24 @@ plugins { println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" -subprojects { - boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false'); +boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false'); - ext.buildNumber = System.getenv('BUILD_NUMBER') +ext.buildNumber = System.getenv('BUILD_NUMBER') +subprojects { group = 'com.jozufozu.flywheel' version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') + apply plugin: "maven-publish" + apply plugin: "dev.architectury.loom" + apply from: rootProject.file('gradle/package-infos.gradle') + + loom { + silentMojangMappingsLicense() + } + + ideaSyncTask.finalizedBy(generatePackageInfos) + tasks { // make builds reproducible withType(AbstractArchiveTask).configureEach { @@ -27,6 +37,110 @@ subprojects { enabled = false } } + + processResources.configure { + from(project(':common').sourceSets.main.resources) + + var replaceProperties = [ + minecraft_version : minecraft_version, + minecraft_version_range: minecraft_version_range, + forge_version : forge_version, + forge_version_range : forge_version_range, + loader_version_range : loader_version_range, + mod_version : mod_version + ] + inputs.properties replaceProperties + + filesMatching(['META-INF/mods.toml', 'META-INF/neoforge.mods.toml', 'pack.mcmeta', 'fabric.mod.json']) { + expand replaceProperties + [project: project] + } + } + + repositories { + maven { + name = 'ParchmentMC' + url = 'https://maven.parchmentmc.org' + } + maven { + url 'https://www.cursemaven.com' + content { + includeGroup "curse.maven" + } + } + maven { + name 'tterrag maven' + url 'https://maven.tterrag.com/' + } + maven { + name = "Modrinth" + url = "https://api.modrinth.com/maven" + content { + includeGroup "maven.modrinth" + } + } + mavenCentral() + } + + dependencies { + minecraft "com.mojang:minecraft:$minecraft_version" + mappings(loom.layered() { + officialMojangMappings() + parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") + }) + } + + java { + JavaVersion javaVersion = JavaVersion.toVersion(java_version) + sourceCompatibility = javaVersion + targetCompatibility = javaVersion + + toolchain.languageVersion = JavaLanguageVersion.of(java_version) + + withSourcesJar() + withJavadocJar() + } + + tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' + options.release = Integer.parseInt(java_version) + options.compilerArgs = ['-Xdiags:verbose'] + } + + jar.configure { + archiveClassifier = '' + addManifest(it) + addLicense(it) + } + + sourcesJar.configure { + addManifest(it) + addLicense(it) + } + + javadoc.configure { + // prevent java 8's strict doclint for javadocs from failing builds + options.addStringOption('Xdoclint:none', '-quiet') + } +} + +void addLicense(jarTask) { + jarTask.from('LICENSE.md') { + rename '(.*)\\.(.*)', '$1_' + jarTask.archiveBaseName + '.$2' + } +} + +void addManifest(jarTask) { + jarTask.manifest { + attributes([ + 'Specification-Title' : 'flywheel', + // 'Specification-Vendor': 'flywheel authors', + 'Specification-Version' : '1', // We are version 1 of ourselves + 'Implementation-Title' : jarTask.archiveBaseName, + 'Implementation-Version' : jarTask.archiveVersion, + // 'Implementation-Vendor': 'flywheel authors', + 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), + ]) + } } idea { diff --git a/common/build.gradle b/common/build.gradle index cd95427fe..061701ba7 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,126 +1,17 @@ -plugins { - id 'maven-publish' - id 'dev.architectury.loom' -} - base { archivesName = "flywheel-${project.name}-${artifact_minecraft_version}" } -repositories { - maven { - name = 'ParchmentMC' - url = 'https://maven.parchmentmc.org' - } - maven { - url 'https://www.cursemaven.com' - content { - includeGroup "curse.maven" - } - } - maven { - name 'tterrag maven' - url 'https://maven.tterrag.com/' - } - maven { - name = "Modrinth" - url = "https://api.modrinth.com/maven" - content { - includeGroup "maven.modrinth" - } - } - mavenCentral() -} - dependencies { - minecraft "com.mojang:minecraft:$minecraft_version" - mappings(loom.layered() { - officialMojangMappings() - parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") - }) - modCompileOnly "net.fabricmc:fabric-loader:$fabric_loader_version" compileOnly "com.google.code.findbugs:jsr305:3.0.2" } -java { - JavaVersion javaVersion = JavaVersion.toVersion(java_version) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - - toolchain.languageVersion = JavaLanguageVersion.of(java_version) - - withSourcesJar() - withJavadocJar() -} - -processResources.configure { - from(project(':common').sourceSets.main.resources) - - var replaceProperties = [ - minecraft_version : minecraft_version, - minecraft_version_range: minecraft_version_range, - forge_version : forge_version, - forge_version_range : forge_version_range, - loader_version_range : loader_version_range, - mod_version : mod_version - ] - inputs.properties replaceProperties - - filesMatching(['META-INF/mods.toml', 'META-INF/neoforge.mods.toml', 'pack.mcmeta', 'fabric.mod.json']) { - expand replaceProperties + [project: project] - } -} - -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' - options.release = Integer.parseInt(java_version) - options.compilerArgs = ['-Xdiags:verbose'] -} - -jar.configure { - archiveClassifier = '' - addManifest(it) - addLicense(it) -} - -sourcesJar.configure { - addManifest(it) - addLicense(it) -} - -javadoc.configure { - // prevent java 8's strict doclint for javadocs from failing builds - options.addStringOption('Xdoclint:none', '-quiet') -} - test.configure { useJUnitPlatform() } -void addLicense(jarTask) { - jarTask.from('LICENSE.md') { - rename '(.*)\\.(.*)', '$1_' + archivesBaseName + '.$2' - } -} - -void addManifest(jarTask) { - jarTask.manifest { - attributes([ - 'Specification-Title' : 'flywheel', - // 'Specification-Vendor': 'flywheel authors', - 'Specification-Version' : '1', // We are version 1 of ourselves - 'Implementation-Title' : project.jar.archiveBaseName, - 'Implementation-Version' : project.jar.archiveVersion, - // 'Implementation-Vendor': 'flywheel authors', - 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - ]) - } -} - -apply from: rootProject.file('gradle/package-infos.gradle') - publishing { publications { register('mavenJava', MavenPublication) { diff --git a/common/src/main/java/com/jozufozu/flywheel/Flywheel.java b/common/src/main/java/com/jozufozu/flywheel/Flywheel.java index 290722f23..37ab7a864 100644 --- a/common/src/main/java/com/jozufozu/flywheel/Flywheel.java +++ b/common/src/main/java/com/jozufozu/flywheel/Flywheel.java @@ -1,120 +1,30 @@ package com.jozufozu.flywheel; -import java.util.ArrayList; - -import org.apache.maven.artifact.versioning.ArtifactVersion; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.jozufozu.flywheel.api.event.EndClientResourceReloadEvent; -import com.jozufozu.flywheel.api.visualization.VisualizationManager; import com.jozufozu.flywheel.backend.Backends; import com.jozufozu.flywheel.backend.ShaderIndices; -import com.jozufozu.flywheel.backend.compile.FlwPrograms; -import com.jozufozu.flywheel.backend.engine.uniform.Uniforms; -import com.jozufozu.flywheel.config.BackendArgument; -import com.jozufozu.flywheel.config.FlwCommands; -import com.jozufozu.flywheel.config.FlwConfig; import com.jozufozu.flywheel.impl.BackendManagerImpl; import com.jozufozu.flywheel.impl.registry.IdRegistryImpl; import com.jozufozu.flywheel.impl.registry.RegistryImpl; -import com.jozufozu.flywheel.impl.visualization.VisualizationEventHandler; import com.jozufozu.flywheel.lib.instance.InstanceTypes; import com.jozufozu.flywheel.lib.material.CutoutShaders; import com.jozufozu.flywheel.lib.material.FogShaders; import com.jozufozu.flywheel.lib.material.StandardMaterialShaders; -import com.jozufozu.flywheel.lib.memory.FlwMemoryTracker; -import com.jozufozu.flywheel.lib.model.ModelCache; -import com.jozufozu.flywheel.lib.model.ModelHolder; -import com.jozufozu.flywheel.lib.model.baked.PartialModel; -import com.jozufozu.flywheel.lib.util.LevelAttached; import com.jozufozu.flywheel.lib.util.ShadersModHandler; -import com.jozufozu.flywheel.lib.util.StringUtil; -import com.jozufozu.flywheel.vanilla.VanillaVisuals; -import net.minecraft.client.Minecraft; -import net.minecraft.commands.synchronization.ArgumentTypeInfos; -import net.minecraft.core.Vec3i; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.CustomizeGuiOverlayEvent; -import net.minecraftforge.client.event.RegisterClientReloadListenersEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.level.LevelEvent; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fml.IExtensionPoint; -import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegisterEvent; -@Mod(Flywheel.ID) public class Flywheel { public static final String ID = "flywheel"; public static final Logger LOGGER = LoggerFactory.getLogger(ID); - private static ArtifactVersion version; - - public Flywheel() { - ModLoadingContext modLoadingContext = ModLoadingContext.get(); - - version = modLoadingContext - .getActiveContainer() - .getModInfo() - .getVersion(); - - IEventBus forgeEventBus = MinecraftForge.EVENT_BUS; - IEventBus modEventBus = FMLJavaModLoadingContext.get() - .getModEventBus(); - modEventBus.addListener(Flywheel::onCommonSetup); - modEventBus.addListener(Flywheel::onRegister); - - FlwConfig.get().registerSpecs(modLoadingContext); - modLoadingContext.registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest( - () -> "any", - (serverVersion, isNetwork) -> true - )); - - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> Flywheel.clientInit(forgeEventBus, modEventBus)); + public static ResourceLocation rl(String path) { + return new ResourceLocation(ID, path); } - private static void clientInit(IEventBus forgeEventBus, IEventBus modEventBus) { - forgeEventBus.addListener(Flywheel::addDebugInfo); - - forgeEventBus.addListener(BackendManagerImpl::onReloadLevelRenderer); - - forgeEventBus.addListener(VisualizationEventHandler::onClientTick); - forgeEventBus.addListener(VisualizationEventHandler::onBeginFrame); - forgeEventBus.addListener(VisualizationEventHandler::onRenderStage); - forgeEventBus.addListener(VisualizationEventHandler::onEntityJoinLevel); - forgeEventBus.addListener(VisualizationEventHandler::onEntityLeaveLevel); - - forgeEventBus.addListener(FlwCommands::registerClientCommands); - - forgeEventBus.addListener(Uniforms::onReloadLevelRenderer); - - forgeEventBus.addListener((LevelEvent.Unload e) -> LevelAttached.onUnloadLevel(e)); - -// forgeEventBus.addListener(ExampleEffect::tick); -// forgeEventBus.addListener(ExampleEffect::onReload); - - modEventBus.addListener(Flywheel::registerClientReloadListeners); - modEventBus.addListener(Flywheel::onClientSetup); - modEventBus.addListener(Flywheel::onLoadComplete); - - modEventBus.addListener(BackendManagerImpl::onEndClientResourceReload); - - modEventBus.addListener((EndClientResourceReloadEvent e) -> ModelCache.onEndClientResourceReload(e)); - modEventBus.addListener(ModelHolder::onEndClientResourceReload); - - modEventBus.addListener(PartialModel::onModelRegistry); - modEventBus.addListener(PartialModel::onModelBake); - + public static void earlyInit() { BackendManagerImpl.init(); ShadersModHandler.init(); @@ -122,64 +32,17 @@ private static void clientInit(IEventBus forgeEventBus, IEventBus modEventBus) { Backends.init(); } - private static void registerClientReloadListeners(RegisterClientReloadListenersEvent event) { - event.registerReloadListener(FlwPrograms.ResourceReloadListener.INSTANCE); - } - - private static void onClientSetup(FMLClientSetupEvent event) { + public static void init() { InstanceTypes.init(); CutoutShaders.init(); FogShaders.init(); StandardMaterialShaders.init(); ShaderIndices.init(); - - VanillaVisuals.init(); } - private static void onLoadComplete(FMLLoadCompleteEvent event) { + public static void freeze() { RegistryImpl.freezeAll(); IdRegistryImpl.freezeAll(); } - - private static void onCommonSetup(FMLCommonSetupEvent event) { - ArgumentTypeInfos.registerByClass(BackendArgument.class, BackendArgument.INFO); - } - - private static void onRegister(RegisterEvent event) { - event.register(ForgeRegistries.Keys.COMMAND_ARGUMENT_TYPES, rl("backend"), () -> BackendArgument.INFO); - } - - private static void addDebugInfo(CustomizeGuiOverlayEvent.DebugText event) { - Minecraft mc = Minecraft.getInstance(); - - if (!mc.options.renderDebug) { - return; - } - - ArrayList info = event.getRight(); - info.add(""); - info.add("Flywheel: " + getVersion()); - info.add("Backend: " + BackendManagerImpl.getBackendString()); - info.add("Update limiting: " + (FlwConfig.get().limitUpdates() ? "on" : "off")); - - VisualizationManager manager = VisualizationManager.get(mc.level); - if (manager != null) { - info.add("B: " + manager.getBlockEntities().getVisualCount() - + ", E: " + manager.getEntities().getVisualCount() - + ", F: " + manager.getEffects().getVisualCount()); - Vec3i renderOrigin = manager.getRenderOrigin(); - info.add("Origin: " + renderOrigin.getX() + ", " + renderOrigin.getY() + ", " + renderOrigin.getZ()); - } - - info.add("Memory Usage: CPU: " + StringUtil.formatBytes(FlwMemoryTracker.getCPUMemory()) + ", GPU: " + StringUtil.formatBytes(FlwMemoryTracker.getGPUMemory())); - } - - public static ArtifactVersion getVersion() { - return version; - } - - public static ResourceLocation rl(String path) { - return new ResourceLocation(ID, path); - } } diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/mixin/GlStateManagerMixin.java b/common/src/main/java/com/jozufozu/flywheel/backend/mixin/GlStateManagerMixin.java index 695e4399d..2c0b4ecdb 100644 --- a/common/src/main/java/com/jozufozu/flywheel/backend/mixin/GlStateManagerMixin.java +++ b/common/src/main/java/com/jozufozu/flywheel/backend/mixin/GlStateManagerMixin.java @@ -9,7 +9,7 @@ import com.jozufozu.flywheel.backend.gl.buffer.GlBufferType; import com.mojang.blaze3d.platform.GlStateManager; -@Mixin(GlStateManager.class) +@Mixin(value = GlStateManager.class, remap = false) abstract class GlStateManagerMixin { @Inject(method = "_glBindBuffer(II)V", at = @At("RETURN")) private static void flywheel$onBindBuffer(int target, int buffer, CallbackInfo ci) { diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/mixin/RenderSystemMixin.java b/common/src/main/java/com/jozufozu/flywheel/backend/mixin/RenderSystemMixin.java index c29da817b..fb12d286d 100644 --- a/common/src/main/java/com/jozufozu/flywheel/backend/mixin/RenderSystemMixin.java +++ b/common/src/main/java/com/jozufozu/flywheel/backend/mixin/RenderSystemMixin.java @@ -9,7 +9,7 @@ import com.jozufozu.flywheel.backend.gl.GlCompat; import com.mojang.blaze3d.systems.RenderSystem; -@Mixin(RenderSystem.class) +@Mixin(value = RenderSystem.class, remap = false) abstract class RenderSystemMixin { @Inject(method = "initRenderer(IZ)V", at = @At("RETURN")) private static void flywheel$onInitRenderer(CallbackInfo ci) { diff --git a/fabric/build.gradle b/fabric/build.gradle index ab6142982..f6749b800 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,8 +1,3 @@ -plugins { - id 'maven-publish' - id 'dev.architectury.loom' -} - evaluationDependsOn(':common') base { @@ -30,38 +25,7 @@ loom { } } -repositories { - maven { - name = 'ParchmentMC' - url = 'https://maven.parchmentmc.org' - } - maven { - url 'https://www.cursemaven.com' - content { - includeGroup "curse.maven" - } - } - maven { - name 'tterrag maven' - url 'https://maven.tterrag.com/' - } - maven { - name = "Modrinth" - url = "https://api.modrinth.com/maven" - content { - includeGroup "maven.modrinth" - } - } - mavenCentral() -} - dependencies { - minecraft "com.mojang:minecraft:$minecraft_version" - mappings(loom.layered() { - officialMojangMappings() - parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") - }) - modCompileOnly "net.fabricmc:fabric-loader:$fabric_loader_version" modLocalRuntime "net.fabricmc:fabric-loader:$fabric_loader_version" @@ -79,86 +43,18 @@ dependencies { compileOnly "com.google.code.findbugs:jsr305:3.0.2" } -java { - JavaVersion javaVersion = JavaVersion.toVersion(java_version) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - - toolchain.languageVersion = JavaLanguageVersion.of(java_version) - - withSourcesJar() - withJavadocJar() -} - -processResources.configure { - from(project(':common').sourceSets.main.resources) - - var replaceProperties = [ - minecraft_version : minecraft_version, - minecraft_version_range: minecraft_version_range, - forge_version : forge_version, - forge_version_range : forge_version_range, - loader_version_range : loader_version_range, - mod_version : mod_version - ] - inputs.properties replaceProperties - - filesMatching(['META-INF/mods.toml', 'META-INF/neoforge.mods.toml', 'pack.mcmeta', 'fabric.mod.json']) { - expand replaceProperties + [project: project] - } -} - tasks.withType(JavaCompile).configureEach { source(project(':common').sourceSets.main.allSource) - options.encoding = 'UTF-8' - options.release = Integer.parseInt(java_version) - options.compilerArgs = ['-Xdiags:verbose'] -} - -jar.configure { - archiveClassifier = '' - addManifest(it) - addLicense(it) } sourcesJar.configure { from(project(':common').sourceSets.main.allSource) - addManifest(it) - addLicense(it) } javadoc.configure { source(project(':common').sourceSets.main.allJava) - // prevent java 8's strict doclint for javadocs from failing builds - options.addStringOption('Xdoclint:none', '-quiet') -} - -test.configure { - useJUnitPlatform() } -void addLicense(jarTask) { - jarTask.from('LICENSE.md') { - rename '(.*)\\.(.*)', '$1_' + archivesBaseName + '.$2' - } -} - -void addManifest(jarTask) { - jarTask.manifest { - attributes([ - 'Specification-Title' : 'flywheel', - // 'Specification-Vendor': 'flywheel authors', - 'Specification-Version' : '1', // We are version 1 of ourselves - 'Implementation-Title' : project.jar.archiveBaseName, - 'Implementation-Version' : project.jar.archiveVersion, - // 'Implementation-Vendor': 'flywheel authors', - 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - ]) - } -} - -apply from: rootProject.file('gradle/package-infos.gradle') - publishing { publications { register('mavenJava', MavenPublication) { diff --git a/fabric/src/main/java/com/jozufozu/flywheel/FlywheelFabric.java b/fabric/src/main/java/com/jozufozu/flywheel/FlywheelFabric.java new file mode 100644 index 000000000..b6353f97c --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/FlywheelFabric.java @@ -0,0 +1,10 @@ +package com.jozufozu.flywheel; + +import net.fabricmc.api.ClientModInitializer; + +public class FlywheelFabric implements ClientModInitializer { + @Override + public void onInitializeClient() { + + } +} diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..b62133644 --- /dev/null +++ b/fabric/src/main/resources/fabric.mod.json @@ -0,0 +1,32 @@ +{ + "schemaVersion": 1, + "id": "flywheel", + "version": "${version}", + "name": "Flywheel", + "description": "A modern engine for modded minecraft.", + "authors": [ + "Jozufozu", + "PepperCode1" + ], + "contact": { + "homepage": "https://fabricmc.net/", + "sources": "https://github.com/FabricMC/fabric-example-mod" + }, + "license": "MIT", + "icon": "assets/flywheel/logo.png", + "environment": "*", + "entrypoints": { + "client": [ + "com.jozufozu.flywheel.FlywheelFabric" + ] + }, + "mixins": [ + "flywheel.backend.mixins.json", + "flywheel.impl.mixins.json", + "flywheel.impl.sodium.mixins.json" + ], + "depends": { + "fabric": "*", + "minecraft": ">=1.20.1" + } +} diff --git a/forge/build.gradle b/forge/build.gradle index eb5e84009..8ec5cd047 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,8 +1,3 @@ -plugins { - id 'maven-publish' - id 'dev.architectury.loom' -} - evaluationDependsOn(':common') base { @@ -10,6 +5,12 @@ base { } loom { + forge { + mixinConfig "flywheel.backend.mixins.json" + mixinConfig "flywheel.impl.mixins.json" + mixinConfig "flywheel.impl.sodium.mixins.json" + } + runs { configureEach { property 'forge.logging.markers', '' @@ -30,38 +31,7 @@ loom { } } -repositories { - maven { - name = 'ParchmentMC' - url = 'https://maven.parchmentmc.org' - } - maven { - url 'https://www.cursemaven.com' - content { - includeGroup "curse.maven" - } - } - maven { - name 'tterrag maven' - url 'https://maven.tterrag.com/' - } - maven { - name = "Modrinth" - url = "https://api.modrinth.com/maven" - content { - includeGroup "maven.modrinth" - } - } - mavenCentral() -} - dependencies { - minecraft "com.mojang:minecraft:$minecraft_version" - mappings(loom.layered() { - officialMojangMappings() - parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") - }) - forge "net.minecraftforge:forge:${minecraft_version}-${forge_version}" compileOnly project(path: ':common', configuration: 'namedElements') @@ -72,86 +42,18 @@ dependencies { compileOnly "com.google.code.findbugs:jsr305:3.0.2" } -java { - JavaVersion javaVersion = JavaVersion.toVersion(java_version) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - - toolchain.languageVersion = JavaLanguageVersion.of(java_version) - - withSourcesJar() - withJavadocJar() -} - -processResources.configure { - from(project(':common').sourceSets.main.resources) - - var replaceProperties = [ - minecraft_version : minecraft_version, - minecraft_version_range: minecraft_version_range, - forge_version : forge_version, - forge_version_range : forge_version_range, - loader_version_range : loader_version_range, - mod_version : mod_version - ] - inputs.properties replaceProperties - - filesMatching(['META-INF/mods.toml', 'META-INF/neoforge.mods.toml', 'pack.mcmeta', 'fabric.mod.json']) { - expand replaceProperties + [project: project] - } -} - tasks.withType(JavaCompile).configureEach { source(project(':common').sourceSets.main.allSource) - options.encoding = 'UTF-8' - options.release = Integer.parseInt(java_version) - options.compilerArgs = ['-Xdiags:verbose'] -} - -jar.configure { - archiveClassifier = '' - addManifest(it) - addLicense(it) } sourcesJar.configure { from(project(':common').sourceSets.main.allSource) - addManifest(it) - addLicense(it) } javadoc.configure { source(project(':common').sourceSets.main.allJava) - // prevent java 8's strict doclint for javadocs from failing builds - options.addStringOption('Xdoclint:none', '-quiet') -} - -test.configure { - useJUnitPlatform() -} - -void addLicense(jarTask) { - jarTask.from('LICENSE.md') { - rename '(.*)\\.(.*)', '$1_' + archivesBaseName + '.$2' - } } -void addManifest(jarTask) { - jarTask.manifest { - attributes([ - 'Specification-Title' : 'flywheel', - // 'Specification-Vendor': 'flywheel authors', - 'Specification-Version' : '1', // We are version 1 of ourselves - 'Implementation-Title' : project.jar.archiveBaseName, - 'Implementation-Version' : project.jar.archiveVersion, - // 'Implementation-Vendor': 'flywheel authors', - 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - ]) - } -} - -apply from: rootProject.file('gradle/package-infos.gradle') - publishing { publications { register('mavenJava', MavenPublication) { diff --git a/forge/src/main/java/com/jozufozu/flywheel/FlywheelForge.java b/forge/src/main/java/com/jozufozu/flywheel/FlywheelForge.java new file mode 100644 index 000000000..166e30659 --- /dev/null +++ b/forge/src/main/java/com/jozufozu/flywheel/FlywheelForge.java @@ -0,0 +1,154 @@ +package com.jozufozu.flywheel; + +import java.util.ArrayList; + +import org.apache.maven.artifact.versioning.ArtifactVersion; + +import com.jozufozu.flywheel.api.event.EndClientResourceReloadEvent; +import com.jozufozu.flywheel.api.visualization.VisualizationManager; +import com.jozufozu.flywheel.backend.compile.FlwPrograms; +import com.jozufozu.flywheel.backend.engine.uniform.Uniforms; +import com.jozufozu.flywheel.config.BackendArgument; +import com.jozufozu.flywheel.config.FlwCommands; +import com.jozufozu.flywheel.config.FlwConfig; +import com.jozufozu.flywheel.impl.BackendManagerImpl; +import com.jozufozu.flywheel.impl.visualization.VisualizationEventHandler; +import com.jozufozu.flywheel.lib.memory.FlwMemoryTracker; +import com.jozufozu.flywheel.lib.model.ModelCache; +import com.jozufozu.flywheel.lib.model.ModelHolder; +import com.jozufozu.flywheel.lib.model.baked.PartialModel; +import com.jozufozu.flywheel.lib.util.LevelAttached; +import com.jozufozu.flywheel.lib.util.StringUtil; + +import net.minecraft.client.Minecraft; +import net.minecraft.commands.synchronization.ArgumentTypeInfos; +import net.minecraft.core.Vec3i; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.client.event.CustomizeGuiOverlayEvent; +import net.minecraftforge.client.event.RegisterClientReloadListenersEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.level.LevelEvent; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.IExtensionPoint; +import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegisterEvent; + +@Mod(Flywheel.ID) +public class FlywheelForge { + private static ArtifactVersion version; + + public FlywheelForge() { + ModLoadingContext modLoadingContext = ModLoadingContext.get(); + + version = modLoadingContext + .getActiveContainer() + .getModInfo() + .getVersion(); + + IEventBus forgeEventBus = MinecraftForge.EVENT_BUS; + IEventBus modEventBus = FMLJavaModLoadingContext.get() + .getModEventBus(); + modEventBus.addListener(FlywheelForge::onCommonSetup); + modEventBus.addListener(FlywheelForge::onRegister); + + FlwConfig.get().registerSpecs(modLoadingContext); + + modLoadingContext.registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest( + () -> "any", + (serverVersion, isNetwork) -> true + )); + + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> FlywheelForge.clientInit(forgeEventBus, modEventBus)); + } + + private static void clientInit(IEventBus forgeEventBus, IEventBus modEventBus) { + forgeEventBus.addListener(FlywheelForge::addDebugInfo); + + forgeEventBus.addListener(BackendManagerImpl::onReloadLevelRenderer); + + forgeEventBus.addListener(VisualizationEventHandler::onClientTick); + forgeEventBus.addListener(VisualizationEventHandler::onBeginFrame); + forgeEventBus.addListener(VisualizationEventHandler::onRenderStage); + forgeEventBus.addListener(VisualizationEventHandler::onEntityJoinLevel); + forgeEventBus.addListener(VisualizationEventHandler::onEntityLeaveLevel); + + forgeEventBus.addListener(FlwCommands::registerClientCommands); + + forgeEventBus.addListener(Uniforms::onReloadLevelRenderer); + + forgeEventBus.addListener((LevelEvent.Unload e) -> LevelAttached.onUnloadLevel(e)); + +// forgeEventBus.addListener(ExampleEffect::tick); +// forgeEventBus.addListener(ExampleEffect::onReload); + + modEventBus.addListener(FlywheelForge::registerClientReloadListeners); + modEventBus.addListener(FlywheelForge::onClientSetup); + modEventBus.addListener(FlywheelForge::onLoadComplete); + + modEventBus.addListener(BackendManagerImpl::onEndClientResourceReload); + + modEventBus.addListener((EndClientResourceReloadEvent e) -> ModelCache.onEndClientResourceReload(e)); + modEventBus.addListener(ModelHolder::onEndClientResourceReload); + + modEventBus.addListener(PartialModel::onModelRegistry); + modEventBus.addListener(PartialModel::onModelBake); + + Flywheel.earlyInit(); + } + + private static void registerClientReloadListeners(RegisterClientReloadListenersEvent event) { + event.registerReloadListener(FlwPrograms.ResourceReloadListener.INSTANCE); + } + + private static void onClientSetup(FMLClientSetupEvent event) { + Flywheel.init(); + } + + private static void onLoadComplete(FMLLoadCompleteEvent event) { + Flywheel.freeze(); + } + + private static void onCommonSetup(FMLCommonSetupEvent event) { + ArgumentTypeInfos.registerByClass(BackendArgument.class, BackendArgument.INFO); + } + + private static void onRegister(RegisterEvent event) { + event.register(ForgeRegistries.Keys.COMMAND_ARGUMENT_TYPES, Flywheel.rl("backend"), () -> BackendArgument.INFO); + } + + private static void addDebugInfo(CustomizeGuiOverlayEvent.DebugText event) { + Minecraft mc = Minecraft.getInstance(); + + if (!mc.options.renderDebug) { + return; + } + + ArrayList info = event.getRight(); + info.add(""); + info.add("Flywheel: " + getVersion()); + info.add("Backend: " + BackendManagerImpl.getBackendString()); + info.add("Update limiting: " + (FlwConfig.get().limitUpdates() ? "on" : "off")); + + VisualizationManager manager = VisualizationManager.get(mc.level); + if (manager != null) { + info.add("B: " + manager.getBlockEntities().getVisualCount() + + ", E: " + manager.getEntities().getVisualCount() + + ", F: " + manager.getEffects().getVisualCount()); + Vec3i renderOrigin = manager.getRenderOrigin(); + info.add("Origin: " + renderOrigin.getX() + ", " + renderOrigin.getY() + ", " + renderOrigin.getZ()); + } + + info.add("Memory Usage: CPU: " + StringUtil.formatBytes(FlwMemoryTracker.getCPUMemory()) + ", GPU: " + StringUtil.formatBytes(FlwMemoryTracker.getGPUMemory())); + } + + public static ArtifactVersion getVersion() { + return version; + } +} diff --git a/common/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml similarity index 100% rename from common/src/main/resources/META-INF/mods.toml rename to forge/src/main/resources/META-INF/mods.toml From d9c178cd6c3438e9f1224c49675c34d10166b297 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Thu, 18 Apr 2024 17:40:32 -0700 Subject: [PATCH 10/62] Platform dependent wheeling - Use ClientPlatform to: - Dispatch events - Create iris/oculus handler - Move VisualizationEventHandler into forge project --- .../impl/mixin/LevelRendererMixin.java | 11 ++-- .../flywheel/lib/util/ShadersModHandler.java | 42 +++++--------- .../flywheel/platform/ClientPlatform.java | 19 +++++++ .../flywheel/platform/ClientPlatformImpl.java | 55 ++++++++++++++++++ .../VisualizationEventHandler.java | 1 + .../flywheel/platform/ClientPlatformImpl.java | 56 +++++++++++++++++++ 6 files changed, 149 insertions(+), 35 deletions(-) rename {common => forge}/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java (98%) diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java index 05c7af4f7..ff11b3bea 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java @@ -14,12 +14,10 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import com.jozufozu.flywheel.api.event.BeginFrameEvent; -import com.jozufozu.flywheel.api.event.ReloadLevelRendererEvent; import com.jozufozu.flywheel.api.event.RenderStage; -import com.jozufozu.flywheel.api.event.RenderStageEvent; import com.jozufozu.flywheel.impl.event.RenderContextImpl; import com.jozufozu.flywheel.impl.visualization.VisualizationManagerImpl; +import com.jozufozu.flywheel.platform.ClientPlatform; import com.mojang.blaze3d.vertex.PoseStack; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; @@ -30,7 +28,6 @@ import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.RenderBuffers; import net.minecraft.server.level.BlockDestructionProgress; -import net.minecraftforge.common.MinecraftForge; @Mixin(value = LevelRenderer.class, priority = 1001) // Higher priority to go after Sodium abstract class LevelRendererMixin { @@ -54,7 +51,7 @@ abstract class LevelRendererMixin { private void flywheel$beginRender(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { flywheel$renderContext = RenderContextImpl.create((LevelRenderer) (Object) this, level, renderBuffers, poseStack, projectionMatrix, camera, partialTick); - MinecraftForge.EVENT_BUS.post(new BeginFrameEvent(flywheel$renderContext)); + ClientPlatform.getInstance().dispatchBeginFrame(flywheel$renderContext); } @Inject(method = "renderLevel", at = @At("RETURN")) @@ -64,7 +61,7 @@ abstract class LevelRendererMixin { @Inject(method = "allChanged", at = @At("RETURN")) private void flywheel$refresh(CallbackInfo ci) { - MinecraftForge.EVENT_BUS.post(new ReloadLevelRendererEvent(level)); + ClientPlatform.getInstance().dispatchReloadLevelRenderer(level); } @Inject(method = "renderLevel", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiling/ProfilerFiller;popPush(Ljava/lang/String;)V", args = "ldc=destroyProgress")) @@ -84,7 +81,7 @@ abstract class LevelRendererMixin { @Unique private void flywheel$dispatch(RenderStage stage) { if (flywheel$renderContext != null) { - MinecraftForge.EVENT_BUS.post(new RenderStageEvent(flywheel$renderContext, stage)); + ClientPlatform.getInstance().dispatchRenderStage(flywheel$renderContext, stage); } } diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java b/common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java index 1c70cd4c9..49ca164fe 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java @@ -6,34 +6,34 @@ import org.jetbrains.annotations.ApiStatus; import org.slf4j.Logger; +import com.jozufozu.flywheel.platform.ClientPlatform; import com.mojang.logging.LogUtils; -import net.irisshaders.iris.api.v0.IrisApi; -import net.minecraftforge.fml.ModList; - public final class ShadersModHandler { private static final Logger LOGGER = LogUtils.getLogger(); private static final String OPTIFINE_ROOT_PACKAGE = "net.optifine"; - private static final boolean IS_OCULUS_LOADED; + private static final boolean IS_IRIS_LOADED; private static final boolean IS_OPTIFINE_INSTALLED; private static final InternalHandler INTERNAL_HANDLER; static { Package optifinePackage = Package.getPackage(OPTIFINE_ROOT_PACKAGE); IS_OPTIFINE_INSTALLED = optifinePackage != null; - IS_OCULUS_LOADED = ModList.get() - .isLoaded("oculus"); - // OptiFine and Oculus are assumed to be mutually exclusive + var irisOculusHandler = ClientPlatform.getInstance() + .createIrisOculusHandlerIfPresent(); + IS_IRIS_LOADED = irisOculusHandler != null; + + // OptiFine and Iris/Oculus are assumed to be mutually exclusive if (IS_OPTIFINE_INSTALLED) { LOGGER.info("Optifine detected."); INTERNAL_HANDLER = new Optifine(); - } else if (IS_OCULUS_LOADED) { - LOGGER.info("Oculus detected."); - INTERNAL_HANDLER = new Oculus(); + } else if (IS_IRIS_LOADED) { + LOGGER.info("Iris detected."); + INTERNAL_HANDLER = irisOculusHandler; } else { LOGGER.info("No shaders mod detected."); INTERNAL_HANDLER = new InternalHandler() {}; @@ -43,8 +43,8 @@ public final class ShadersModHandler { private ShadersModHandler() { } - public static boolean isOculusLoaded() { - return IS_OCULUS_LOADED; + public static boolean isIrisLoaded() { + return IS_IRIS_LOADED; } public static boolean isOptifineInstalled() { @@ -63,7 +63,8 @@ public static boolean isRenderingShadowPass() { public static void init() { } - private interface InternalHandler { + @ApiStatus.Internal + public interface InternalHandler { default boolean isShaderPackInUse() { return false; }; @@ -73,21 +74,6 @@ default boolean isRenderingShadowPass() { }; } - // simple, lovely api calls - private static class Oculus implements InternalHandler { - @Override - public boolean isShaderPackInUse() { - return IrisApi.getInstance() - .isShaderPackInUse(); - } - - @Override - public boolean isRenderingShadowPass() { - return IrisApi.getInstance() - .isRenderingShadowPass(); - } - } - // evil reflection private static class Optifine implements InternalHandler { private final BooleanSupplier shadersEnabledSupplier; diff --git a/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java b/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java index ee62f49ea..d165fe14d 100644 --- a/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java +++ b/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java @@ -2,6 +2,14 @@ import java.lang.reflect.InvocationTargetException; +import org.jetbrains.annotations.Nullable; + +import com.jozufozu.flywheel.api.event.RenderContext; +import com.jozufozu.flywheel.api.event.RenderStage; +import com.jozufozu.flywheel.lib.util.ShadersModHandler; + +import net.minecraft.client.multiplayer.ClientLevel; + public abstract class ClientPlatform { private static final ClientPlatform INSTANCE; @@ -19,4 +27,15 @@ public abstract class ClientPlatform { public static ClientPlatform getInstance() { return INSTANCE; } + + public abstract void dispatchReloadLevelRenderer(ClientLevel level); + + public abstract void dispatchBeginFrame(RenderContext context); + + public abstract void dispatchRenderStage(RenderContext context, RenderStage stage); + + public abstract boolean isModLoaded(String modid); + + @Nullable + public abstract ShadersModHandler.InternalHandler createIrisOculusHandlerIfPresent(); } diff --git a/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java b/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java index 34abe1089..da3be665b 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java @@ -1,4 +1,59 @@ package com.jozufozu.flywheel.platform; +import org.jetbrains.annotations.Nullable; + +import com.jozufozu.flywheel.api.event.BeginFrameCallback; +import com.jozufozu.flywheel.api.event.ReloadLevelRendererCallback; +import com.jozufozu.flywheel.api.event.RenderContext; +import com.jozufozu.flywheel.api.event.RenderStage; +import com.jozufozu.flywheel.api.event.RenderStageCallback; +import com.jozufozu.flywheel.lib.util.ShadersModHandler; + +import net.fabricmc.loader.api.FabricLoader; +import net.irisshaders.iris.api.v0.IrisApi; +import net.minecraft.client.multiplayer.ClientLevel; + public class ClientPlatformImpl extends ClientPlatform { + @Override + public void dispatchReloadLevelRenderer(ClientLevel level) { + ReloadLevelRendererCallback.EVENT.invoker().onReloadLevelRenderer(level); + } + + @Override + public void dispatchBeginFrame(RenderContext context) { + BeginFrameCallback.EVENT.invoker().onBeginFrame(context); + } + + @Override + public void dispatchRenderStage(RenderContext context, RenderStage stage) { + RenderStageCallback.EVENT.invoker().onRenderStage(context, stage); + } + + @Override + public boolean isModLoaded(String modid) { + return FabricLoader.getInstance() + .isModLoaded(modid); + } + + @Nullable + @Override + public ShadersModHandler.InternalHandler createIrisOculusHandlerIfPresent() { + if (isModLoaded("iris")) { + return new ShadersModHandler.InternalHandler() { + @Override + public boolean isShaderPackInUse() { + return IrisApi.getInstance() + .isShaderPackInUse(); + } + + @Override + public boolean isRenderingShadowPass() { + return IrisApi.getInstance() + .isRenderingShadowPass(); + } + }; + } else { + return null; + } + } } diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java b/forge/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java similarity index 98% rename from common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java rename to forge/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java index f7a74fee2..df837301b 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java @@ -12,6 +12,7 @@ import net.minecraftforge.event.entity.EntityLeaveLevelEvent; import net.minecraftforge.fml.LogicalSide; +// TODO: fabric event handler public final class VisualizationEventHandler { private VisualizationEventHandler() { } diff --git a/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java b/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java index 34abe1089..1ef702ac0 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java +++ b/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java @@ -1,4 +1,60 @@ package com.jozufozu.flywheel.platform; +import org.jetbrains.annotations.Nullable; + +import com.jozufozu.flywheel.api.event.BeginFrameEvent; +import com.jozufozu.flywheel.api.event.ReloadLevelRendererEvent; +import com.jozufozu.flywheel.api.event.RenderContext; +import com.jozufozu.flywheel.api.event.RenderStage; +import com.jozufozu.flywheel.api.event.RenderStageEvent; +import com.jozufozu.flywheel.lib.util.ShadersModHandler; + +import net.irisshaders.iris.api.v0.IrisApi; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.ModList; + public class ClientPlatformImpl extends ClientPlatform { + @Override + public void dispatchReloadLevelRenderer(ClientLevel level) { + MinecraftForge.EVENT_BUS.post(new ReloadLevelRendererEvent(level)); + } + + @Override + public void dispatchBeginFrame(RenderContext context) { + MinecraftForge.EVENT_BUS.post(new BeginFrameEvent(context)); + } + + @Override + public void dispatchRenderStage(RenderContext context, RenderStage stage) { + MinecraftForge.EVENT_BUS.post(new RenderStageEvent(context, stage)); + } + + @Override + public boolean isModLoaded(String modid) { + return ModList.get() + .isLoaded(modid); + } + + @Nullable + @Override + public ShadersModHandler.InternalHandler createIrisOculusHandlerIfPresent() { + if (isModLoaded("oculus")) { + return new ShadersModHandler.InternalHandler() { + @Override + public boolean isShaderPackInUse() { + return IrisApi.getInstance() + .isShaderPackInUse(); + } + + @Override + public boolean isRenderingShadowPass() { + return IrisApi.getInstance() + .isRenderingShadowPass(); + } + }; + } else { + return null; + } + } } From 69290410eb65638720bb117acf92903855e2fde1 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Thu, 18 Apr 2024 19:00:19 -0700 Subject: [PATCH 11/62] Out for a run - Move loom.runs into subprojects closure - Move common code sharing into subprojects closure - Apply java plugin - Fix runs not being generated by moving generatePackageInfos to the bottom --- build.gradle | 36 +++++++++++++++++++++++++++++++----- fabric/build.gradle | 33 --------------------------------- forge/build.gradle | 24 ------------------------ 3 files changed, 31 insertions(+), 62 deletions(-) diff --git a/build.gradle b/build.gradle index 516025ba3..700792afb 100644 --- a/build.gradle +++ b/build.gradle @@ -7,23 +7,39 @@ plugins { println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" -boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false'); +subprojects { + boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false'); -ext.buildNumber = System.getenv('BUILD_NUMBER') + ext.buildNumber = System.getenv('BUILD_NUMBER') -subprojects { group = 'com.jozufozu.flywheel' version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') + apply plugin: "java" apply plugin: "maven-publish" apply plugin: "dev.architectury.loom" - apply from: rootProject.file('gradle/package-infos.gradle') loom { silentMojangMappingsLicense() } - ideaSyncTask.finalizedBy(generatePackageInfos) + if (it != project(':common')) { + loom { + runs { + client { + ideConfigGenerated true + property 'flw.dumpShaderSource', 'true' + property 'flw.debugMemorySafety', 'true' + programArgs '--width', '1280', '--height', '720' + } + + server { + ideConfigGenerated true + programArgs '--nogui' + } + } + } + } tasks { // make builds reproducible @@ -101,6 +117,8 @@ subprojects { } tasks.withType(JavaCompile).configureEach { + source(project(':common').sourceSets.main.allSource) + options.encoding = 'UTF-8' options.release = Integer.parseInt(java_version) options.compilerArgs = ['-Xdiags:verbose'] @@ -113,14 +131,22 @@ subprojects { } sourcesJar.configure { + from(project(':common').sourceSets.main.allSource) + addManifest(it) addLicense(it) } javadoc.configure { + source(project(':common').sourceSets.main.allJava) + // prevent java 8's strict doclint for javadocs from failing builds options.addStringOption('Xdoclint:none', '-quiet') } + + apply from: rootProject.file('gradle/package-infos.gradle') + + ideaSyncTask.finalizedBy(generatePackageInfos) } void addLicense(jarTask) { diff --git a/fabric/build.gradle b/fabric/build.gradle index f6749b800..fac6ac166 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -4,27 +4,6 @@ base { archivesName = "flywheel-${project.name}-${artifact_minecraft_version}" } -loom { - runs { - configureEach { - property 'forge.logging.markers', '' - property 'forge.logging.console.level', 'debug' - } - - client { - ideConfigGenerated true - property 'flw.dumpShaderSource', 'true' - property 'flw.debugMemorySafety', 'true' - programArgs '--width', '1280', '--height', '720' - } - - server { - ideConfigGenerated true - programArgs '--nogui' - } - } -} - dependencies { modCompileOnly "net.fabricmc:fabric-loader:$fabric_loader_version" modLocalRuntime "net.fabricmc:fabric-loader:$fabric_loader_version" @@ -43,18 +22,6 @@ dependencies { compileOnly "com.google.code.findbugs:jsr305:3.0.2" } -tasks.withType(JavaCompile).configureEach { - source(project(':common').sourceSets.main.allSource) -} - -sourcesJar.configure { - from(project(':common').sourceSets.main.allSource) -} - -javadoc.configure { - source(project(':common').sourceSets.main.allJava) -} - publishing { publications { register('mavenJava', MavenPublication) { diff --git a/forge/build.gradle b/forge/build.gradle index 8ec5cd047..7d44d99cb 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -16,18 +16,6 @@ loom { property 'forge.logging.markers', '' property 'forge.logging.console.level', 'debug' } - - client { - ideConfigGenerated true - property 'flw.dumpShaderSource', 'true' - property 'flw.debugMemorySafety', 'true' - programArgs '--width', '1280', '--height', '720' - } - - server { - ideConfigGenerated true - programArgs '--nogui' - } } } @@ -42,18 +30,6 @@ dependencies { compileOnly "com.google.code.findbugs:jsr305:3.0.2" } -tasks.withType(JavaCompile).configureEach { - source(project(':common').sourceSets.main.allSource) -} - -sourcesJar.configure { - from(project(':common').sourceSets.main.allSource) -} - -javadoc.configure { - source(project(':common').sourceSets.main.allJava) -} - publishing { publications { register('mavenJava', MavenPublication) { From 87b9a922c34558bfae575d053e7eb39b8f345ac8 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Thu, 18 Apr 2024 19:32:05 -0700 Subject: [PATCH 12/62] Everything but models - Trying to get xplat forge working, fabric can wait until the common project compiles - Move backend manager event handling to separate class - Move commands into forge for now - Make FlwConfig an interface and move concrete impl into forge - Remove event parameters from handlers than don't actually use them - Add platform specific blockstate light emission for uniforms - Remove example effect - Add accessor for LevelRenderer#ticks --- .../backend/engine/uniform/FrameUniforms.java | 4 +- .../engine/uniform/PlayerUniforms.java | 4 +- .../backend/engine/uniform/Uniforms.java | 3 +- .../backend/mixin/LevelRendererAccessor.java | 12 + .../jozufozu/flywheel/config/FlwConfig.java | 91 +----- .../flywheel/impl/BackendManagerImpl.java | 25 +- .../flywheel/lib/model/ModelCache.java | 3 +- .../flywheel/lib/model/ModelHolder.java | 3 +- .../flywheel/lib/model/baked/MeshEmitter.java | 11 +- .../flywheel/lib/util/LevelAttached.java | 6 - .../flywheel/platform/ClientPlatform.java | 7 + .../vanilla/effect/ExampleEffect.java | 292 ------------------ .../resources/flywheel.backend.mixins.json | 1 + .../flywheel/platform/ClientPlatformImpl.java | 14 + .../com/jozufozu/flywheel/FlywheelForge.java | 22 +- .../jozufozu/flywheel/config/FlwCommands.java | 2 +- .../flywheel/config/FlwForgeConfig.java | 88 ++++++ .../flywheel/impl/BackendEventHandler.java | 28 ++ .../lib/model/baked/ForgeMeshEmitter.java | 21 ++ .../flywheel/platform/ClientPlatformImpl.java | 14 + 20 files changed, 216 insertions(+), 435 deletions(-) create mode 100644 common/src/main/java/com/jozufozu/flywheel/backend/mixin/LevelRendererAccessor.java delete mode 100644 common/src/main/java/com/jozufozu/flywheel/vanilla/effect/ExampleEffect.java rename {common => forge}/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java (99%) create mode 100644 forge/src/main/java/com/jozufozu/flywheel/config/FlwForgeConfig.java create mode 100644 forge/src/main/java/com/jozufozu/flywheel/impl/BackendEventHandler.java create mode 100644 forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeMeshEmitter.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java index b9437118d..7bdb80edb 100644 --- a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java +++ b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java @@ -6,6 +6,7 @@ import com.jozufozu.flywheel.api.event.RenderContext; import com.jozufozu.flywheel.api.visualization.VisualizationManager; +import com.jozufozu.flywheel.backend.mixin.LevelRendererAccessor; import com.jozufozu.flywheel.config.DebugMode; import com.jozufozu.flywheel.lib.math.MatrixMath; @@ -147,8 +148,7 @@ private static long writeCamera(long ptr) { } private static long writeTime(long ptr, RenderContext context) { - int ticks = context.renderer() - .getTicks(); + int ticks = ((LevelRendererAccessor) context.renderer()).flywheel$ticks(); float partialTick = context.partialTick(); float renderTicks = ticks + partialTick; float renderSeconds = renderTicks / 20f; diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java index 1d976226c..02e14a5da 100644 --- a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java +++ b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java @@ -4,6 +4,7 @@ import com.jozufozu.flywheel.api.event.RenderContext; import com.jozufozu.flywheel.backend.mixin.AbstractClientPlayerAccessor; +import com.jozufozu.flywheel.platform.ClientPlatform; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; @@ -93,7 +94,8 @@ private static long writeHeldLight(long ptr, LocalPlayer player) { Item handItem = player.getItemInHand(hand).getItem(); if (handItem instanceof BlockItem bitem) { Block block = bitem.getBlock(); - int blockLight = block.defaultBlockState().getLightEmission(player.clientLevel, player.blockPosition()); + int blockLight = ClientPlatform.getInstance() + .getLightEmission(block.defaultBlockState(), player.clientLevel, player.blockPosition()); if (heldLight < blockLight) { heldLight = blockLight; } diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java index cd11491cc..8fa7e0115 100644 --- a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java +++ b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java @@ -1,6 +1,5 @@ package com.jozufozu.flywheel.backend.engine.uniform; -import com.jozufozu.flywheel.api.event.ReloadLevelRendererEvent; import com.jozufozu.flywheel.api.event.RenderContext; public final class Uniforms { @@ -33,7 +32,7 @@ private static void deleteAll() { } } - public static void onReloadLevelRenderer(ReloadLevelRendererEvent event) { + public static void onReloadLevelRenderer() { deleteAll(); } } diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/mixin/LevelRendererAccessor.java b/common/src/main/java/com/jozufozu/flywheel/backend/mixin/LevelRendererAccessor.java new file mode 100644 index 000000000..5ddc4a5ba --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/backend/mixin/LevelRendererAccessor.java @@ -0,0 +1,12 @@ +package com.jozufozu.flywheel.backend.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +import net.minecraft.client.renderer.LevelRenderer; + +@Mixin(LevelRenderer.class) +public interface LevelRendererAccessor { + @Accessor("ticks") + int flywheel$ticks(); +} diff --git a/common/src/main/java/com/jozufozu/flywheel/config/FlwConfig.java b/common/src/main/java/com/jozufozu/flywheel/config/FlwConfig.java index 2fa01e342..4ec3356aa 100644 --- a/common/src/main/java/com/jozufozu/flywheel/config/FlwConfig.java +++ b/common/src/main/java/com/jozufozu/flywheel/config/FlwConfig.java @@ -1,94 +1,17 @@ package com.jozufozu.flywheel.config; -import org.apache.commons.lang3.tuple.Pair; -import org.jetbrains.annotations.Nullable; -import org.slf4j.Logger; - import com.jozufozu.flywheel.api.backend.Backend; -import com.jozufozu.flywheel.api.backend.BackendManager; -import com.mojang.logging.LogUtils; - -import net.minecraft.ResourceLocationException; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.common.ForgeConfigSpec; -import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; -import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; -import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.config.ModConfig; - -public class FlwConfig { - private static final Logger LOGGER = LogUtils.getLogger(); - private static final FlwConfig INSTANCE = new FlwConfig(); - - public final ClientConfig client; - private final ForgeConfigSpec clientSpec; - - private FlwConfig() { - Pair clientPair = new ForgeConfigSpec.Builder().configure(ClientConfig::new); - this.client = clientPair.getLeft(); - clientSpec = clientPair.getRight(); - } +import com.jozufozu.flywheel.platform.ClientPlatform; - public static FlwConfig get() { +public interface FlwConfig { + FlwConfig INSTANCE = ClientPlatform.getInstance().getConfigInstance(); + static FlwConfig get() { return INSTANCE; } - public Backend getBackend() { - Backend backend = parseBackend(client.backend.get()); - if (backend == null) { - backend = BackendManager.getDefaultBackend(); - client.backend.set(Backend.REGISTRY.getIdOrThrow(backend).toString()); - } + Backend getBackend(); - return backend; - } - - @Nullable - private static Backend parseBackend(String idStr) { - ResourceLocation backendId; - try { - backendId = new ResourceLocation(idStr); - } catch (ResourceLocationException e) { - LOGGER.warn("Config contains invalid backend ID '" + idStr + "'!"); - return null; - } - - Backend backend = Backend.REGISTRY.get(backendId); - if (backend == null) { - LOGGER.warn("Config contains non-existent backend with ID '" + backendId + "'!"); - return null; - } - - return backend; - } + boolean limitUpdates(); - public boolean limitUpdates() { - return client.limitUpdates.get(); - } - - public int workerThreads() { - return client.workerThreads.get(); - } - - public void registerSpecs(ModLoadingContext context) { - context.registerConfig(ModConfig.Type.CLIENT, clientSpec); - } - - public static class ClientConfig { - public final ConfigValue backend; - public final BooleanValue limitUpdates; - public final ForgeConfigSpec.IntValue workerThreads; - - private ClientConfig(ForgeConfigSpec.Builder builder) { - backend = builder.comment("Select the backend to use.") - .define("backend", Backend.REGISTRY.getIdOrThrow(BackendManager.getDefaultBackend()).toString()); - - limitUpdates = builder.comment("Enable or disable instance update limiting with distance.") - .define("limitUpdates", true); - - workerThreads = builder.comment("The number of worker threads to use. Set to -1 to let Flywheel decide. Set to 0 to disable parallelism. Requires a game restart to take effect.") - .defineInRange("workerThreads", -1, -1, Runtime.getRuntime() - .availableProcessors()); - } - } + int workerThreads(); } diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java index 302959cbf..0f4d10f85 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java @@ -4,8 +4,6 @@ import com.jozufozu.flywheel.Flywheel; import com.jozufozu.flywheel.api.backend.Backend; -import com.jozufozu.flywheel.api.event.EndClientResourceReloadEvent; -import com.jozufozu.flywheel.api.event.ReloadLevelRendererEvent; import com.jozufozu.flywheel.backend.Backends; import com.jozufozu.flywheel.config.FlwConfig; import com.jozufozu.flywheel.impl.visualization.VisualizationManagerImpl; @@ -14,7 +12,6 @@ import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.fml.CrashReportCallables; public final class BackendManagerImpl { private static final Logger LOGGER = LogUtils.getLogger(); @@ -47,7 +44,7 @@ private static Backend findDefaultBackend() { return Backends.INDIRECT; } - private static void chooseBackend() { + public static void chooseBackend() { var preferred = FlwConfig.get().getBackend(); var actual = preferred.findFallback(); @@ -67,25 +64,5 @@ public static String getBackendString() { } public static void init() { - CrashReportCallables.registerCrashCallable("Flywheel Backend", BackendManagerImpl::getBackendString); - } - - public static void onEndClientResourceReload(EndClientResourceReloadEvent event) { - if (event.error() - .isPresent()) { - return; - } - - chooseBackend(); - VisualizationManagerImpl.resetAll(); - } - - public static void onReloadLevelRenderer(ReloadLevelRendererEvent event) { - chooseBackend(); - - ClientLevel level = event.level(); - if (level != null) { - VisualizationManagerImpl.reset(level); - } } } diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelCache.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelCache.java index 9f12cfc0b..b514c28ed 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelCache.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelCache.java @@ -8,7 +8,6 @@ import org.jetbrains.annotations.ApiStatus; -import com.jozufozu.flywheel.api.event.EndClientResourceReloadEvent; import com.jozufozu.flywheel.api.model.Model; public class ModelCache { @@ -31,7 +30,7 @@ public void clear() { } @ApiStatus.Internal - public static void onEndClientResourceReload(EndClientResourceReloadEvent event) { + public static void onEndClientResourceReload() { for (ModelCache cache : ALL) { cache.clear(); } diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelHolder.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelHolder.java index 84088f6e8..505727da2 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelHolder.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelHolder.java @@ -7,7 +7,6 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; -import com.jozufozu.flywheel.api.event.EndClientResourceReloadEvent; import com.jozufozu.flywheel.api.model.Model; public class ModelHolder { @@ -51,7 +50,7 @@ public void clear() { } @ApiStatus.Internal - public static void onEndClientResourceReload(EndClientResourceReloadEvent event) { + public static void onEndClientResourceReload() { for (ModelHolder holder : ALL) { holder.clear(); } diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java index 8f00b36a2..caa332875 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java @@ -12,7 +12,7 @@ import net.minecraft.client.renderer.block.model.BakedQuad; class MeshEmitter implements VertexConsumer { - private final BufferBuilder bufferBuilder; + protected final BufferBuilder bufferBuilder; private final RenderType renderType; private boolean lastQuadWasShaded; private boolean seenFirstQuad; @@ -51,7 +51,7 @@ private void emit() { } } - private void observeQuadAndEmitIfNecessary(BakedQuad quad) { + protected void observeQuadAndEmitIfNecessary(BakedQuad quad) { if (seenFirstQuad && lastQuadWasShaded != quad.isShade()) { emit(); begin(); @@ -68,13 +68,6 @@ public void putBulkData(PoseStack.Pose poseEntry, BakedQuad quad, float[] colorM bufferBuilder.putBulkData(poseEntry, quad, colorMuls, red, green, blue, combinedLights, combinedOverlay, mulColor); } - @Override - public void putBulkData(PoseStack.Pose matrixEntry, BakedQuad quad, float[] baseBrightness, float red, float green, float blue, float alpha, int[] lightmapCoords, int overlayCoords, boolean readExistingColor) { - observeQuadAndEmitIfNecessary(quad); - - bufferBuilder.putBulkData(matrixEntry, quad, baseBrightness, red, green, blue, alpha, lightmapCoords, overlayCoords, readExistingColor); - } - @Override public VertexConsumer vertex(double x, double y, double z) { throw new UnsupportedOperationException("ShadeSeparatingVertexConsumer only supports putBulkData!"); diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/util/LevelAttached.java b/common/src/main/java/com/jozufozu/flywheel/lib/util/LevelAttached.java index e19bd7e40..b3175f781 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/util/LevelAttached.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/util/LevelAttached.java @@ -14,7 +14,6 @@ import com.google.common.cache.LoadingCache; import net.minecraft.world.level.LevelAccessor; -import net.minecraftforge.event.level.LevelEvent; public final class LevelAttached { private static final ConcurrentLinkedDeque>> ALL = new ConcurrentLinkedDeque<>(); @@ -42,11 +41,6 @@ public LevelAttached(Function factory) { this(factory, t -> {}); } - @ApiStatus.Internal - public static void onUnloadLevel(LevelEvent.Unload event) { - invalidateLevel(event.getLevel()); - } - public static void invalidateLevel(LevelAccessor level) { Iterator>> iterator = ALL.iterator(); while (iterator.hasNext()) { diff --git a/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java b/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java index d165fe14d..1fc1e41cf 100644 --- a/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java +++ b/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java @@ -6,9 +6,12 @@ import com.jozufozu.flywheel.api.event.RenderContext; import com.jozufozu.flywheel.api.event.RenderStage; +import com.jozufozu.flywheel.config.FlwConfig; import com.jozufozu.flywheel.lib.util.ShadersModHandler; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.BlockState; public abstract class ClientPlatform { private static final ClientPlatform INSTANCE; @@ -38,4 +41,8 @@ public static ClientPlatform getInstance() { @Nullable public abstract ShadersModHandler.InternalHandler createIrisOculusHandlerIfPresent(); + + public abstract int getLightEmission(BlockState state, ClientLevel level, BlockPos pos); + + public abstract FlwConfig getConfigInstance(); } diff --git a/common/src/main/java/com/jozufozu/flywheel/vanilla/effect/ExampleEffect.java b/common/src/main/java/com/jozufozu/flywheel/vanilla/effect/ExampleEffect.java deleted file mode 100644 index fd6712536..000000000 --- a/common/src/main/java/com/jozufozu/flywheel/vanilla/effect/ExampleEffect.java +++ /dev/null @@ -1,292 +0,0 @@ -package com.jozufozu.flywheel.vanilla.effect; - -import java.util.ArrayList; -import java.util.List; - -import org.joml.Vector3f; - -import com.jozufozu.flywheel.api.event.ReloadLevelRendererEvent; -import com.jozufozu.flywheel.api.task.Plan; -import com.jozufozu.flywheel.api.visual.DynamicVisual; -import com.jozufozu.flywheel.api.visual.Effect; -import com.jozufozu.flywheel.api.visual.EffectVisual; -import com.jozufozu.flywheel.api.visual.TickableVisual; -import com.jozufozu.flywheel.api.visualization.VisualizationContext; -import com.jozufozu.flywheel.api.visualization.VisualizationManager; -import com.jozufozu.flywheel.lib.instance.InstanceTypes; -import com.jozufozu.flywheel.lib.instance.TransformedInstance; -import com.jozufozu.flywheel.lib.model.Models; -import com.jozufozu.flywheel.lib.task.ForEachPlan; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.LightTexture; -import net.minecraft.core.Vec3i; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.phys.Vec3; -import net.minecraftforge.event.TickEvent; - -// http://www.kfish.org/boids/pseudocode.html -public class ExampleEffect implements Effect { - private static final List ALL_EFFECTS = new ArrayList<>(); - - private static final int VISUAL_COUNT = 500; - private static final float SPAWN_RADIUS = 8.0f; - private static final float LIMIT_RANGE = 10.0f; - private static final float SPEED_LIMIT = 0.1f; - private static final float RENDER_SCALE = 2 / 16f; - - private static final float SIGHT_RANGE = 5; - - private static final float COHERENCE = 1f / 60f; - private static final float SEPARATION = 0.05f; - private static final float ALIGNMENT = 1 / 20f; - private static final float TENDENCY = 1 / 1000f; - private static final float AVERSION = 1; - - private static final float GNAT_JITTER = 0.05f; - - private final Level level; - private final Vector3f targetPoint; - - public ExampleEffect(Level level, Vector3f targetPoint) { - this.level = level; - this.targetPoint = targetPoint; - } - - public static void tick(TickEvent.ClientTickEvent event) { - if (event.phase != TickEvent.Phase.START || Minecraft.getInstance().isPaused()) { - return; - } - - trySpawnNewEffect(); - } - - public static void onReloadLevelRenderer(ReloadLevelRendererEvent event) { - ALL_EFFECTS.clear(); - } - - private static void trySpawnNewEffect() { - Level level = Minecraft.getInstance().level; - Player player = Minecraft.getInstance().player; - - if (player == null || level == null) { - return; - } - - VisualizationManager manager = VisualizationManager.get(level); - if (manager == null) { - return; - } - - if (!ALL_EFFECTS.isEmpty() && level.random.nextFloat() > 0.005f) { - return; - } - - Vec3 playerPos = player.position(); - - var x = (float) (playerPos.x + Mth.nextFloat(level.random, -20, 20)); - var y = (float) (playerPos.y + Mth.nextFloat(level.random, 0, 5)); - var z = (float) (playerPos.z + Mth.nextFloat(level.random, -20, 20)); - - ExampleEffect effect = new ExampleEffect(level, new Vector3f(x, y, z)); - ALL_EFFECTS.add(effect); - manager.getEffects().queueAdd(effect); - } - - @Override - public EffectVisual visualize(VisualizationContext ctx) { - return new ExampleVisual(ctx); - } - - public class ExampleVisual implements EffectVisual, TickableVisual, DynamicVisual { - private final List effects; - private final List boids; - - public ExampleVisual(VisualizationContext ctx) { - this.effects = new ArrayList<>(VISUAL_COUNT); - this.boids = new ArrayList<>(VISUAL_COUNT); - - for (int i = 0; i < VISUAL_COUNT; i++) { - var x = targetPoint.x + Mth.nextFloat(level.random, -SPAWN_RADIUS, SPAWN_RADIUS); - var y = targetPoint.y + Mth.nextFloat(level.random, -SPAWN_RADIUS, SPAWN_RADIUS); - var z = targetPoint.z + Mth.nextFloat(level.random, -SPAWN_RADIUS, SPAWN_RADIUS); - - Boid boid = new Boid(x, y, z); - boids.add(boid); - effects.add(new BoidVisual(ctx, boid)); - } - } - - @Override - public Plan planTick() { - Plan beginTick = ForEachPlan.of(() -> boids, Boid::beginTick); - return beginTick.then(ForEachPlan.of(() -> effects, boid -> boid.self.tick(boids))); - } - - @Override - public Plan planFrame() { - return ForEachPlan.of(() -> effects, BoidVisual::beginFrame); - } - - @Override - public void init(float partialTick) { - } - - @Override - public void update(float partialTick) { - } - - @Override - public void delete() { - effects.forEach(BoidVisual::_delete); - } - } - - public static class Boid { - final Vector3f lastPosition; - final Vector3f position; - final Vector3f lastVelocity = new Vector3f(0); - final Vector3f velocity = new Vector3f(0); - - final Vector3f scratch = new Vector3f(0); - final Vector3f coherence = new Vector3f(0); - final Vector3f alignment = new Vector3f(0); - - public Boid(float x, float y, float z) { - lastPosition = new Vector3f(x, y, z); - position = new Vector3f(x, y, z); - } - - - private void beginTick() { - lastVelocity.set(velocity); - lastPosition.set(position); - } - - public void tick(List swarm) { - int seen = 0; - coherence.set(0); - alignment.set(0); - for (Boid boid : swarm) { - if (boid == this) { - continue; - } - - float distance = boid.lastPosition.distance(lastPosition); - - if (distance > SIGHT_RANGE) { - continue; - } - seen++; - - coherence(boid); - separation(boid); - alignment(boid); - } - - if (seen > 0) { - coherencePost(seen); - alignmentPost(seen); - } - //tend(ExampleEffect.this.targetPoint); - - avoidPlayer(); - - position.add(capSpeed(velocity)); - } - - private void avoidPlayer() { - var player = Minecraft.getInstance().player.position(); - scratch.set(player.x, player.y, player.z); - - float dsq = lastPosition.distanceSquared(scratch); - if (dsq > SIGHT_RANGE * SIGHT_RANGE) { - return; - } - - lastPosition.sub(scratch, scratch) - .mul(AVERSION / dsq); - - velocity.add(capSpeed(scratch)); - } - - private void coherence(Boid other) { - this.coherence.add(other.lastPosition); - } - - private void separation(Boid other) { - float dsq = lastPosition.distanceSquared(other.lastPosition); - var push = other.lastPosition.sub(lastPosition, this.scratch) - .mul(SEPARATION / dsq); - - this.velocity.sub(push); - } - - private void alignment(Boid boid) { - this.alignment.add(boid.lastVelocity); - } - - private void coherencePost(int seen) { - this.coherence.div(seen) - .sub(lastPosition) - .mul(COHERENCE); - this.velocity.add(capSpeed(this.coherence)); - } - - private void alignmentPost(int seen) { - this.alignment.div(seen) - .sub(lastVelocity) - .mul(ALIGNMENT); - - this.velocity.add(this.alignment); - } - - private void tend(Vector3f target) { - this.scratch.set(target) - .sub(lastPosition) - .mul(TENDENCY); - this.velocity.add(capSpeed(this.scratch)); - } - - private static Vector3f capSpeed(Vector3f vec) { - return vec.normalize(SPEED_LIMIT); - } - } - - public static class BoidVisual { - private final Boid self; - private final Vec3i renderOrigin; - - private final TransformedInstance instance; - - public BoidVisual(VisualizationContext ctx, Boid self) { - renderOrigin = ctx.renderOrigin(); - this.self = self; - - instance = ctx.instancerProvider() - .instancer(InstanceTypes.TRANSFORMED, Models.block(Blocks.SHROOMLIGHT.defaultBlockState())) - .createInstance(); - - instance.light(LightTexture.FULL_BRIGHT); - } - - public void _delete() { - instance.delete(); - } - - public void beginFrame(DynamicVisual.Context context) { - float partialTick = context.partialTick(); - var x = Mth.lerp(partialTick, self.lastPosition.x, self.position.x); - var y = Mth.lerp(partialTick, self.lastPosition.y, self.position.y); - var z = Mth.lerp(partialTick, self.lastPosition.z, self.position.z); - - instance.loadIdentity() - .translateBack(renderOrigin) - .translate(x, y, z) - .scale(RENDER_SCALE); - } - } -} diff --git a/common/src/main/resources/flywheel.backend.mixins.json b/common/src/main/resources/flywheel.backend.mixins.json index 25dbe6fb9..233033999 100644 --- a/common/src/main/resources/flywheel.backend.mixins.json +++ b/common/src/main/resources/flywheel.backend.mixins.json @@ -8,6 +8,7 @@ "AbstractClientPlayerAccessor", "GameRendererAccessor", "GlStateManagerMixin", + "LevelRendererAccessor", "LightTextureAccessor", "OptionsMixin", "OverlayTextureAccessor", diff --git a/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java b/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java index da3be665b..af277f9f9 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java @@ -7,11 +7,14 @@ import com.jozufozu.flywheel.api.event.RenderContext; import com.jozufozu.flywheel.api.event.RenderStage; import com.jozufozu.flywheel.api.event.RenderStageCallback; +import com.jozufozu.flywheel.config.FlwConfig; import com.jozufozu.flywheel.lib.util.ShadersModHandler; import net.fabricmc.loader.api.FabricLoader; import net.irisshaders.iris.api.v0.IrisApi; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.BlockState; public class ClientPlatformImpl extends ClientPlatform { @Override @@ -56,4 +59,15 @@ public boolean isRenderingShadowPass() { return null; } } + + @Override + public int getLightEmission(BlockState state, ClientLevel level, BlockPos pos) { + return state.getLightEmission(); + } + + @Override + public FlwConfig getConfigInstance() { + // TODO: fabric config + return null; + } } diff --git a/forge/src/main/java/com/jozufozu/flywheel/FlywheelForge.java b/forge/src/main/java/com/jozufozu/flywheel/FlywheelForge.java index 166e30659..e96eb55f2 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/FlywheelForge.java +++ b/forge/src/main/java/com/jozufozu/flywheel/FlywheelForge.java @@ -5,12 +5,15 @@ import org.apache.maven.artifact.versioning.ArtifactVersion; import com.jozufozu.flywheel.api.event.EndClientResourceReloadEvent; +import com.jozufozu.flywheel.api.event.ReloadLevelRendererEvent; import com.jozufozu.flywheel.api.visualization.VisualizationManager; import com.jozufozu.flywheel.backend.compile.FlwPrograms; import com.jozufozu.flywheel.backend.engine.uniform.Uniforms; import com.jozufozu.flywheel.config.BackendArgument; import com.jozufozu.flywheel.config.FlwCommands; import com.jozufozu.flywheel.config.FlwConfig; +import com.jozufozu.flywheel.config.FlwForgeConfig; +import com.jozufozu.flywheel.impl.BackendEventHandler; import com.jozufozu.flywheel.impl.BackendManagerImpl; import com.jozufozu.flywheel.impl.visualization.VisualizationEventHandler; import com.jozufozu.flywheel.lib.memory.FlwMemoryTracker; @@ -29,6 +32,7 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.level.LevelEvent; import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.CrashReportCallables; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.IExtensionPoint; import net.minecraftforge.fml.ModLoadingContext; @@ -58,7 +62,7 @@ public FlywheelForge() { modEventBus.addListener(FlywheelForge::onCommonSetup); modEventBus.addListener(FlywheelForge::onRegister); - FlwConfig.get().registerSpecs(modLoadingContext); + FlwForgeConfig.INSTANCE.registerSpecs(modLoadingContext); modLoadingContext.registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest( () -> "any", @@ -71,7 +75,7 @@ public FlywheelForge() { private static void clientInit(IEventBus forgeEventBus, IEventBus modEventBus) { forgeEventBus.addListener(FlywheelForge::addDebugInfo); - forgeEventBus.addListener(BackendManagerImpl::onReloadLevelRenderer); + forgeEventBus.addListener(BackendEventHandler::onReloadLevelRenderer); forgeEventBus.addListener(VisualizationEventHandler::onClientTick); forgeEventBus.addListener(VisualizationEventHandler::onBeginFrame); @@ -81,26 +85,24 @@ private static void clientInit(IEventBus forgeEventBus, IEventBus modEventBus) { forgeEventBus.addListener(FlwCommands::registerClientCommands); - forgeEventBus.addListener(Uniforms::onReloadLevelRenderer); + forgeEventBus.addListener($ -> Uniforms.onReloadLevelRenderer()); - forgeEventBus.addListener((LevelEvent.Unload e) -> LevelAttached.onUnloadLevel(e)); - -// forgeEventBus.addListener(ExampleEffect::tick); -// forgeEventBus.addListener(ExampleEffect::onReload); + forgeEventBus.addListener((LevelEvent.Unload e) -> LevelAttached.invalidateLevel(e.getLevel())); modEventBus.addListener(FlywheelForge::registerClientReloadListeners); modEventBus.addListener(FlywheelForge::onClientSetup); modEventBus.addListener(FlywheelForge::onLoadComplete); - modEventBus.addListener(BackendManagerImpl::onEndClientResourceReload); + modEventBus.addListener(BackendEventHandler::onEndClientResourceReload); - modEventBus.addListener((EndClientResourceReloadEvent e) -> ModelCache.onEndClientResourceReload(e)); - modEventBus.addListener(ModelHolder::onEndClientResourceReload); + modEventBus.addListener($ -> ModelCache.onEndClientResourceReload()); + modEventBus.addListener($ -> ModelHolder.onEndClientResourceReload()); modEventBus.addListener(PartialModel::onModelRegistry); modEventBus.addListener(PartialModel::onModelBake); Flywheel.earlyInit(); + CrashReportCallables.registerCrashCallable("Flywheel Backend", BackendManagerImpl::getBackendString); } private static void registerClientReloadListeners(RegisterClientReloadListenersEvent event) { diff --git a/common/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java b/forge/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java similarity index 99% rename from common/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java rename to forge/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java index d355478fa..3265e495c 100644 --- a/common/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java +++ b/forge/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java @@ -25,7 +25,7 @@ private FlwCommands() { } public static void registerClientCommands(RegisterClientCommandsEvent event) { - FlwConfig config = FlwConfig.get(); + var config = FlwForgeConfig.INSTANCE; LiteralArgumentBuilder command = Commands.literal("flywheel"); diff --git a/forge/src/main/java/com/jozufozu/flywheel/config/FlwForgeConfig.java b/forge/src/main/java/com/jozufozu/flywheel/config/FlwForgeConfig.java new file mode 100644 index 000000000..a83cf60fd --- /dev/null +++ b/forge/src/main/java/com/jozufozu/flywheel/config/FlwForgeConfig.java @@ -0,0 +1,88 @@ +package com.jozufozu.flywheel.config; + +import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; + +import com.jozufozu.flywheel.api.backend.Backend; +import com.jozufozu.flywheel.api.backend.BackendManager; +import com.mojang.logging.LogUtils; + +import net.minecraft.ResourceLocationException; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.common.ForgeConfigSpec; +import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.fml.config.ModConfig; + +public class FlwForgeConfig implements FlwConfig { + private static final Logger LOGGER = LogUtils.getLogger(); + public static final FlwForgeConfig INSTANCE = new FlwForgeConfig(); + + public final ClientConfig client; + private final ForgeConfigSpec clientSpec; + + private FlwForgeConfig() { + Pair clientPair = new ForgeConfigSpec.Builder().configure(ClientConfig::new); + this.client = clientPair.getLeft(); + clientSpec = clientPair.getRight(); + } + + public Backend getBackend() { + Backend backend = parseBackend(client.backend.get()); + if (backend == null) { + backend = BackendManager.getDefaultBackend(); + client.backend.set(Backend.REGISTRY.getIdOrThrow(backend).toString()); + } + + return backend; + } + + @Nullable + private static Backend parseBackend(String idStr) { + ResourceLocation backendId; + try { + backendId = new ResourceLocation(idStr); + } catch (ResourceLocationException e) { + LOGGER.warn("Config contains invalid backend ID '" + idStr + "'!"); + return null; + } + + Backend backend = Backend.REGISTRY.get(backendId); + if (backend == null) { + LOGGER.warn("Config contains non-existent backend with ID '" + backendId + "'!"); + return null; + } + + return backend; + } + + public boolean limitUpdates() { + return client.limitUpdates.get(); + } + + public int workerThreads() { + return client.workerThreads.get(); + } + + public void registerSpecs(ModLoadingContext context) { + context.registerConfig(ModConfig.Type.CLIENT, clientSpec); + } + + public static class ClientConfig { + public final ForgeConfigSpec.ConfigValue backend; + public final ForgeConfigSpec.BooleanValue limitUpdates; + public final ForgeConfigSpec.IntValue workerThreads; + + private ClientConfig(ForgeConfigSpec.Builder builder) { + backend = builder.comment("Select the backend to use.") + .define("backend", Backend.REGISTRY.getIdOrThrow(BackendManager.getDefaultBackend()).toString()); + + limitUpdates = builder.comment("Enable or disable instance update limiting with distance.") + .define("limitUpdates", true); + + workerThreads = builder.comment("The number of worker threads to use. Set to -1 to let Flywheel decide. Set to 0 to disable parallelism. Requires a game restart to take effect.") + .defineInRange("workerThreads", -1, -1, Runtime.getRuntime() + .availableProcessors()); + } + } +} diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/BackendEventHandler.java b/forge/src/main/java/com/jozufozu/flywheel/impl/BackendEventHandler.java new file mode 100644 index 000000000..a8254b49d --- /dev/null +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/BackendEventHandler.java @@ -0,0 +1,28 @@ +package com.jozufozu.flywheel.impl; + +import com.jozufozu.flywheel.api.event.EndClientResourceReloadEvent; +import com.jozufozu.flywheel.api.event.ReloadLevelRendererEvent; +import com.jozufozu.flywheel.impl.visualization.VisualizationManagerImpl; + +import net.minecraft.client.multiplayer.ClientLevel; + +public class BackendEventHandler { + public static void onEndClientResourceReload(EndClientResourceReloadEvent event) { + if (event.error() + .isPresent()) { + return; + } + + BackendManagerImpl.chooseBackend(); + VisualizationManagerImpl.resetAll(); + } + + public static void onReloadLevelRenderer(ReloadLevelRendererEvent event) { + BackendManagerImpl.chooseBackend(); + + ClientLevel level = event.level(); + if (level != null) { + VisualizationManagerImpl.reset(level); + } + } +} diff --git a/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeMeshEmitter.java b/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeMeshEmitter.java new file mode 100644 index 000000000..ffebddce2 --- /dev/null +++ b/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeMeshEmitter.java @@ -0,0 +1,21 @@ +package com.jozufozu.flywheel.lib.model.baked; + +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.PoseStack; + +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.block.model.BakedQuad; + +class ForgeMeshEmitter extends MeshEmitter { + ForgeMeshEmitter(BufferBuilder bufferBuilder, RenderType renderType) { + super(bufferBuilder, renderType); + } + + // Forge has another putBulkData that we need to override + @Override + public void putBulkData(PoseStack.Pose matrixEntry, BakedQuad quad, float[] baseBrightness, float red, float green, float blue, float alpha, int[] lightmapCoords, int overlayCoords, boolean readExistingColor) { + observeQuadAndEmitIfNecessary(quad); + + bufferBuilder.putBulkData(matrixEntry, quad, baseBrightness, red, green, blue, alpha, lightmapCoords, overlayCoords, readExistingColor); + } +} diff --git a/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java b/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java index 1ef702ac0..f82da2fc8 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java +++ b/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java @@ -7,10 +7,14 @@ import com.jozufozu.flywheel.api.event.RenderContext; import com.jozufozu.flywheel.api.event.RenderStage; import com.jozufozu.flywheel.api.event.RenderStageEvent; +import com.jozufozu.flywheel.config.FlwConfig; +import com.jozufozu.flywheel.config.FlwForgeConfig; import com.jozufozu.flywheel.lib.util.ShadersModHandler; import net.irisshaders.iris.api.v0.IrisApi; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.ModList; @@ -57,4 +61,14 @@ public boolean isRenderingShadowPass() { return null; } } + + @Override + public int getLightEmission(BlockState state, ClientLevel level, BlockPos pos) { + return state.getLightEmission(level, pos); + } + + @Override + public FlwConfig getConfigInstance() { + return FlwForgeConfig.INSTANCE; + } } From 5b2339875e25ed016a9f44a2c3e2387247fa1a1c Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Fri, 19 Apr 2024 23:01:28 -0700 Subject: [PATCH 13/62] Compiling models - Make model builders abstract - Move BakedModelBufferer as is into forge project - Create Forge*ModelBuilders with modeldata parameters - Wrap ModelBuilder ctors in factory methods - Add FlywheelLibPlatform api, similar to api.internal package but for lib-only/platform specific stuff - Move TransformStack wrapping into FlywheelLibPlatform - Create vanilla renderer through FlywheelLibPlatform - Handle partial model initialization in separate event handler class - Fix test configuration in common project --- common/build.gradle | 4 +- .../api/internal/InternalFlywheelApi.java | 4 -- .../flywheel/impl/InternalFlywheelImpl.java | 5 -- .../lib/internal/FlywheelLibPlatform.java | 64 ++++++++++++++++++ .../flywheel/lib/internal/package-info.java | 12 ++++ .../flywheel/lib/model/ModelUtil.java | 27 +------- .../jozufozu/flywheel/lib/model/Models.java | 8 ++- .../lib/model/baked/BakedModelBuilder.java | 59 ++++------------ .../lib/model/baked/BlockModelBuilder.java | 54 ++++----------- .../flywheel/lib/model/baked/MeshEmitter.java | 8 ++- .../model/baked/MultiBlockModelBuilder.java | 60 ++++------------- .../lib/model/baked/PartialModel.java | 28 ++------ .../lib/transform/TransformStack.java | 4 +- .../com/jozufozu/flywheel/FlywheelForge.java | 6 +- .../impl/FlywheelLibPlatformImpl.java | 67 +++++++++++++++++++ .../lib/model/baked/BakedModelBufferer.java | 10 +-- .../model/baked/ForgeBakedModelBuilder.java | 62 +++++++++++++++++ .../model/baked/ForgeBlockModelBuilder.java | 58 ++++++++++++++++ .../baked/ForgeMultiBlockModelBuilder.java | 58 ++++++++++++++++ .../model/baked/PartialModelEventHandler.java | 20 ++++++ 20 files changed, 413 insertions(+), 205 deletions(-) create mode 100644 common/src/main/java/com/jozufozu/flywheel/lib/internal/FlywheelLibPlatform.java create mode 100644 common/src/main/java/com/jozufozu/flywheel/lib/internal/package-info.java create mode 100644 forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelLibPlatformImpl.java rename {common => forge}/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java (92%) create mode 100644 forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java create mode 100644 forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java create mode 100644 forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java create mode 100644 forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java diff --git a/common/build.gradle b/common/build.gradle index 061701ba7..d68cff3fb 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -6,9 +6,11 @@ dependencies { modCompileOnly "net.fabricmc:fabric-loader:$fabric_loader_version" compileOnly "com.google.code.findbugs:jsr305:3.0.2" + + testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1' } -test.configure { +test { useJUnitPlatform() } diff --git a/common/src/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java b/common/src/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java index 72c368630..cb88d5f63 100644 --- a/common/src/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java +++ b/common/src/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java @@ -12,8 +12,6 @@ import com.jozufozu.flywheel.api.visualization.BlockEntityVisualizer; import com.jozufozu.flywheel.api.visualization.EntityVisualizer; import com.jozufozu.flywheel.api.visualization.VisualizationManager; -import com.jozufozu.flywheel.lib.transform.PoseTransformStack; -import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexFormat; import net.minecraft.world.entity.Entity; @@ -94,6 +92,4 @@ private static InternalFlywheelApi load() { void setVisualizer(BlockEntityType type, BlockEntityVisualizer visualizer); void setVisualizer(EntityType type, EntityVisualizer visualizer); - - PoseTransformStack getPoseTransformStackOf(PoseStack stack); } diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java index c32738e52..4dd9829f0 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java @@ -111,9 +111,4 @@ public void setVisualizer(BlockEntityType type, Block public void setVisualizer(EntityType type, EntityVisualizer visualizer) { VisualizerRegistryImpl.setVisualizer(type, visualizer); } - - @Override - public PoseTransformStack getPoseTransformStackOf(PoseStack stack) { - return ((PoseStackExtension) stack).flywheel$transformStack(); - } } diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/internal/FlywheelLibPlatform.java b/common/src/main/java/com/jozufozu/flywheel/lib/internal/FlywheelLibPlatform.java new file mode 100644 index 000000000..9413c94b9 --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/lib/internal/FlywheelLibPlatform.java @@ -0,0 +1,64 @@ +package com.jozufozu.flywheel.lib.internal; + +import java.lang.reflect.Constructor; + +import com.jozufozu.flywheel.lib.model.baked.BakedModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.BlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.MultiBlockModelBuilder; +import com.jozufozu.flywheel.lib.transform.PoseTransformStack; +import com.mojang.blaze3d.vertex.PoseStack; + +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.block.state.BlockState; + +public interface FlywheelLibPlatform { + FlywheelLibPlatform INSTANCE = load(); + + // Adapted from https://github.com/CaffeineMC/sodium-fabric/blob/bf4fc9dab16e1cca07b2f23a1201c9bf237c8044/src/api/java/net/caffeinemc/mods/sodium/api/internal/DependencyInjection.java + private static FlywheelLibPlatform load() { + Class apiClass = FlywheelLibPlatform.class; + Class implClass; + + try { + implClass = Class.forName("com.jozufozu.flywheel.impl.FlywheelLibPlatformImpl"); + } catch (ReflectiveOperationException e) { + throw new RuntimeException("Could not find implementation", e); + } + + if (!apiClass.isAssignableFrom(implClass)) { + throw new RuntimeException("Class %s does not implement interface %s" + .formatted(implClass.getName(), apiClass.getName())); + } + + Constructor implConstructor; + + try { + implConstructor = implClass.getConstructor(); + } catch (ReflectiveOperationException e) { + throw new RuntimeException("Could not find default constructor", e); + } + + Object implInstance; + + try { + implInstance = implConstructor.newInstance(); + } catch (ReflectiveOperationException e) { + throw new RuntimeException("Could not instantiate implementation", e); + } + + return apiClass.cast(implInstance); + } + + PoseTransformStack getPoseTransformStackOf(PoseStack stack); + + BlockRenderDispatcher createVanillaRenderer(); + + BakedModelBuilder bakedModelBuilder(BakedModel bakedModel); + + BlockModelBuilder blockModelBuilder(BlockState state); + + MultiBlockModelBuilder multiBlockModelBuilder(BlockAndTintGetter level, Iterable positions); +} diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/internal/package-info.java b/common/src/main/java/com/jozufozu/flywheel/lib/internal/package-info.java new file mode 100644 index 000000000..b4efe3fa3 --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/lib/internal/package-info.java @@ -0,0 +1,12 @@ +@ApiStatus.Internal +@ParametersAreNonnullByDefault +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +package com.jozufozu.flywheel.lib.internal; + +import javax.annotation.ParametersAreNonnullByDefault; + +import org.jetbrains.annotations.ApiStatus; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java index dc2a155de..8a5797343 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java @@ -1,6 +1,5 @@ package com.jozufozu.flywheel.lib.model; -import java.lang.reflect.Field; import java.nio.ByteBuffer; import java.util.Collection; @@ -8,8 +7,8 @@ import org.joml.Vector3f; import org.joml.Vector4f; import org.lwjgl.system.MemoryUtil; -import org.slf4j.Logger; +import com.jozufozu.flywheel.lib.internal.FlywheelLibPlatform; import com.jozufozu.flywheel.api.material.Material; import com.jozufozu.flywheel.api.model.Mesh; import com.jozufozu.flywheel.api.model.Model; @@ -22,43 +21,21 @@ import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.BufferBuilder.DrawState; import com.mojang.blaze3d.vertex.VertexFormat; -import com.mojang.logging.LogUtils; -import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.block.BlockRenderDispatcher; -import net.minecraft.client.renderer.block.ModelBlockRenderer; -import net.minecraftforge.fml.util.ObfuscationReflectionHelper; public final class ModelUtil { - private static final Logger LOGGER = LogUtils.getLogger(); - /** * An alternative BlockRenderDispatcher that circumvents the Forge rendering pipeline to ensure consistency. * Meant to be used for virtual rendering. */ - public static final BlockRenderDispatcher VANILLA_RENDERER = createVanillaRenderer(); + public static final BlockRenderDispatcher VANILLA_RENDERER = FlywheelLibPlatform.INSTANCE.createVanillaRenderer(); private static final float BOUNDING_SPHERE_EPSILON = 1e-4f; private ModelUtil() { } - private static BlockRenderDispatcher createVanillaRenderer() { - BlockRenderDispatcher defaultDispatcher = Minecraft.getInstance().getBlockRenderer(); - BlockRenderDispatcher dispatcher = new BlockRenderDispatcher(null, null, null); - try { - for (Field field : BlockRenderDispatcher.class.getDeclaredFields()) { - field.setAccessible(true); - field.set(dispatcher, field.get(defaultDispatcher)); - } - ObfuscationReflectionHelper.setPrivateValue(BlockRenderDispatcher.class, dispatcher, new ModelBlockRenderer(Minecraft.getInstance().getBlockColors()), "f_110900_"); - } catch (Exception e) { - LOGGER.error("Failed to initialize vanilla BlockRenderDispatcher!", e); - return defaultDispatcher; - } - return dispatcher; - } - public static MemoryBlock convertVanillaBuffer(BufferBuilder.RenderedBuffer buffer, VertexView vertexView) { DrawState drawState = buffer.drawState(); int vertexCount = drawState.vertexCount(); diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/Models.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/Models.java index a0dbbd72e..ad821d6ee 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/Models.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/Models.java @@ -19,8 +19,10 @@ * method with the same parameters will return the same object. */ public final class Models { - private static final ModelCache BLOCK_STATE = new ModelCache<>(it -> new BlockModelBuilder(it).build()); - private static final ModelCache PARTIAL = new ModelCache<>(it -> new BakedModelBuilder(it.get()).build()); + private static final ModelCache BLOCK_STATE = new ModelCache<>(it -> BlockModelBuilder.create(it) + .build()); + private static final ModelCache PARTIAL = new ModelCache<>(it -> BakedModelBuilder.create(it.get()) + .build()); private static final ModelCache> TRANSFORMED_PARTIAL = new ModelCache<>(TransformedPartial::create); private Models() { @@ -85,7 +87,7 @@ private record TransformedPartial(PartialModel partial, T key, BiConsumer materialFunc; + protected BiFunction materialFunc; + + public static BakedModelBuilder create(BakedModel bakedModel) { + return FlywheelLibPlatform.INSTANCE.bakedModelBuilder(bakedModel); + } - public BakedModelBuilder(BakedModel bakedModel) { + protected BakedModelBuilder(BakedModel bakedModel) { this.bakedModel = bakedModel; } @@ -55,43 +57,10 @@ public BakedModelBuilder poseStack(PoseStack poseStack) { return this; } - public BakedModelBuilder modelData(ModelData modelData) { - this.modelData = modelData; - return this; - } - public BakedModelBuilder materialFunc(BiFunction materialFunc) { this.materialFunc = materialFunc; return this; } - public SimpleModel build() { - if (level == null) { - level = VirtualEmptyBlockGetter.INSTANCE; - } - if (blockState == null) { - blockState = Blocks.AIR.defaultBlockState(); - } - if (modelData == null) { - modelData = ModelData.EMPTY; - } - if (materialFunc == null) { - materialFunc = ModelUtil::getMaterial; - } - - var out = ImmutableList.builder(); - - ResultConsumer resultConsumer = (renderType, shaded, data) -> { - Material material = materialFunc.apply(renderType, shaded); - if (material != null) { - VertexView vertexView = new NoOverlayVertexView(); - MemoryBlock meshData = ModelUtil.convertVanillaBuffer(data, vertexView); - var mesh = new SimpleMesh(vertexView, meshData, "source=BakedModelBuilder," + "bakedModel=" + bakedModel + ",renderType=" + renderType + ",shaded=" + shaded); - out.add(new Model.ConfiguredMesh(material, mesh)); - } - }; - BakedModelBufferer.bufferSingle(ModelUtil.VANILLA_RENDERER.getModelRenderer(), level, bakedModel, blockState, poseStack, modelData, resultConsumer); - - return new SimpleModel(out.build()); - } + public abstract SimpleModel build(); } diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java index c0e16e7db..7058735d8 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java @@ -8,31 +8,33 @@ import com.jozufozu.flywheel.api.material.Material; import com.jozufozu.flywheel.api.model.Model; import com.jozufozu.flywheel.api.vertex.VertexView; +import com.jozufozu.flywheel.lib.internal.FlywheelLibPlatform; import com.jozufozu.flywheel.lib.memory.MemoryBlock; import com.jozufozu.flywheel.lib.model.ModelUtil; import com.jozufozu.flywheel.lib.model.SimpleMesh; import com.jozufozu.flywheel.lib.model.SimpleModel; -import com.jozufozu.flywheel.lib.model.baked.BakedModelBufferer.ResultConsumer; +import com.jozufozu.flywheel.lib.model.baked.MeshEmitter.ResultConsumer; import com.jozufozu.flywheel.lib.vertex.NoOverlayVertexView; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.renderer.RenderType; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.client.model.data.ModelData; -public class BlockModelBuilder { - private final BlockState state; +public abstract class BlockModelBuilder { + protected final BlockState state; @Nullable - private BlockAndTintGetter level; + protected BlockAndTintGetter level; @Nullable - private PoseStack poseStack; + protected PoseStack poseStack; @Nullable - private ModelData modelData; - @Nullable - private BiFunction materialFunc; + protected BiFunction materialFunc; + + public static BlockModelBuilder create(BlockState state) { + return FlywheelLibPlatform.INSTANCE.blockModelBuilder(state); + } - public BlockModelBuilder(BlockState state) { + protected BlockModelBuilder(BlockState state) { this.state = state; } @@ -46,40 +48,10 @@ public BlockModelBuilder poseStack(PoseStack poseStack) { return this; } - public BlockModelBuilder modelData(ModelData modelData) { - this.modelData = modelData; - return this; - } - public BlockModelBuilder materialFunc(BiFunction materialFunc) { this.materialFunc = materialFunc; return this; } - public SimpleModel build() { - if (level == null) { - level = VirtualEmptyBlockGetter.INSTANCE; - } - if (modelData == null) { - modelData = ModelData.EMPTY; - } - if (materialFunc == null) { - materialFunc = ModelUtil::getMaterial; - } - - var out = ImmutableList.builder(); - - ResultConsumer resultConsumer = (renderType, shaded, data) -> { - Material material = materialFunc.apply(renderType, shaded); - if (material != null) { - VertexView vertexView = new NoOverlayVertexView(); - MemoryBlock meshData = ModelUtil.convertVanillaBuffer(data, vertexView); - var mesh = new SimpleMesh(vertexView, meshData, "source=BlockModelBuilder," + "blockState=" + state + ",renderType=" + renderType + ",shaded=" + shaded); - out.add(new Model.ConfiguredMesh(material, mesh)); - } - }; - BakedModelBufferer.bufferBlock(ModelUtil.VANILLA_RENDERER, level, state, poseStack, modelData, resultConsumer); - - return new SimpleModel(out.build()); - } + public abstract SimpleModel build(); } diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java index caa332875..b8d5be399 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java @@ -17,14 +17,14 @@ class MeshEmitter implements VertexConsumer { private boolean lastQuadWasShaded; private boolean seenFirstQuad; @Nullable - private BakedModelBufferer.ResultConsumer resultConsumer; + private MeshEmitter.ResultConsumer resultConsumer; MeshEmitter(BufferBuilder bufferBuilder, RenderType renderType) { this.bufferBuilder = bufferBuilder; this.renderType = renderType; } - public void begin(BakedModelBufferer.ResultConsumer resultConsumer) { + public void begin(ResultConsumer resultConsumer) { this.resultConsumer = resultConsumer; begin(); @@ -112,4 +112,8 @@ public void defaultColor(int red, int green, int blue, int alpha) { public void unsetDefaultColor() { throw new UnsupportedOperationException("ShadeSeparatingVertexConsumer only supports putBulkData!"); } + + public interface ResultConsumer { + void accept(RenderType renderType, boolean shaded, BufferBuilder.RenderedBuffer data); + } } diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java index f372d36ba..61d46ae95 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java @@ -1,39 +1,32 @@ package com.jozufozu.flywheel.lib.model.baked; import java.util.function.BiFunction; -import java.util.function.Function; import org.jetbrains.annotations.Nullable; -import com.google.common.collect.ImmutableList; import com.jozufozu.flywheel.api.material.Material; -import com.jozufozu.flywheel.api.model.Model; -import com.jozufozu.flywheel.api.vertex.VertexView; -import com.jozufozu.flywheel.lib.memory.MemoryBlock; -import com.jozufozu.flywheel.lib.model.ModelUtil; -import com.jozufozu.flywheel.lib.model.SimpleMesh; +import com.jozufozu.flywheel.lib.internal.FlywheelLibPlatform; import com.jozufozu.flywheel.lib.model.SimpleModel; -import com.jozufozu.flywheel.lib.model.baked.BakedModelBufferer.ResultConsumer; -import com.jozufozu.flywheel.lib.vertex.NoOverlayVertexView; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.renderer.RenderType; import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockAndTintGetter; -import net.minecraftforge.client.model.data.ModelData; -public class MultiBlockModelBuilder { - private final BlockAndTintGetter level; - private final Iterable positions; +public abstract class MultiBlockModelBuilder { + protected final BlockAndTintGetter level; + protected final Iterable positions; @Nullable - private PoseStack poseStack; + protected PoseStack poseStack; + protected boolean renderFluids = false; @Nullable - private Function modelDataLookup; - private boolean renderFluids = false; - @Nullable - private BiFunction materialFunc; + protected BiFunction materialFunc; + + public static MultiBlockModelBuilder create(BlockAndTintGetter level, Iterable positions) { + return FlywheelLibPlatform.INSTANCE.multiBlockModelBuilder(level, positions); + } - public MultiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { + protected MultiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { this.level = level; this.positions = positions; } @@ -43,11 +36,6 @@ public MultiBlockModelBuilder poseStack(PoseStack poseStack) { return this; } - public MultiBlockModelBuilder modelDataLookup(Function modelDataLookup) { - this.modelDataLookup = modelDataLookup; - return this; - } - public MultiBlockModelBuilder enableFluidRendering() { renderFluids = true; return this; @@ -58,27 +46,5 @@ public MultiBlockModelBuilder materialFunc(BiFunction ModelData.EMPTY; - } - if (materialFunc == null) { - materialFunc = ModelUtil::getMaterial; - } - - var out = ImmutableList.builder(); - - ResultConsumer resultConsumer = (renderType, shaded, data) -> { - Material material = materialFunc.apply(renderType, shaded); - if (material != null) { - VertexView vertexView = new NoOverlayVertexView(); - MemoryBlock meshData = ModelUtil.convertVanillaBuffer(data, vertexView); - var mesh = new SimpleMesh(vertexView, meshData, "source=MultiBlockModelBuilder," + "renderType=" + renderType + ",shaded=" + shaded); - out.add(new Model.ConfiguredMesh(material, mesh)); - } - }; - BakedModelBufferer.bufferMultiBlock(ModelUtil.VANILLA_RENDERER, positions.iterator(), level, poseStack, modelDataLookup, renderFluids, resultConsumer); - - return new SimpleModel(out.build()); - } + public abstract SimpleModel build(); } diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java index c8fc27a0c..48ce637be 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java @@ -5,7 +5,6 @@ import net.minecraft.client.resources.model.BakedModel; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.client.event.ModelEvent; /** * A helper class for loading and accessing json models. @@ -19,8 +18,8 @@ * Attempting to create a PartialModel after {@link ModelEvent.RegisterAdditional} will cause an error. */ public class PartialModel { - private static final List ALL = new ArrayList<>(); - private static boolean tooLate = false; + static final List ALL = new ArrayList<>(); + static boolean tooLate = false; protected final ResourceLocation modelLocation; protected BakedModel bakedModel; @@ -34,30 +33,11 @@ public PartialModel(ResourceLocation modelLocation) { ALL.add(this); } - public static void onModelRegistry(ModelEvent.RegisterAdditional event) { - for (PartialModel partial : ALL) { - event.register(partial.getLocation()); - } - - tooLate = true; - } - - public static void onModelBake(ModelEvent.BakingCompleted event) { - var modelRegistry = event.getModels(); - for (PartialModel partial : ALL) { - partial.set(modelRegistry.get(partial.getLocation())); - } - } - public String getName() { return getLocation() .toString(); } - protected void set(BakedModel bakedModel) { - this.bakedModel = bakedModel; - } - public ResourceLocation getLocation() { return modelLocation; } @@ -65,4 +45,8 @@ public ResourceLocation getLocation() { public BakedModel get() { return bakedModel; } + + void set(BakedModel bakedModel) { + this.bakedModel = bakedModel; + } } diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java b/common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java index 306972421..2d2db3a3c 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java @@ -1,11 +1,11 @@ package com.jozufozu.flywheel.lib.transform; -import com.jozufozu.flywheel.api.internal.InternalFlywheelApi; +import com.jozufozu.flywheel.lib.internal.FlywheelLibPlatform; import com.mojang.blaze3d.vertex.PoseStack; public interface TransformStack> extends Transform { static PoseTransformStack of(PoseStack stack) { - return InternalFlywheelApi.INSTANCE.getPoseTransformStackOf(stack); + return FlywheelLibPlatform.INSTANCE.getPoseTransformStackOf(stack); } Self pushPose(); diff --git a/forge/src/main/java/com/jozufozu/flywheel/FlywheelForge.java b/forge/src/main/java/com/jozufozu/flywheel/FlywheelForge.java index e96eb55f2..8905e734b 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/FlywheelForge.java +++ b/forge/src/main/java/com/jozufozu/flywheel/FlywheelForge.java @@ -19,7 +19,7 @@ import com.jozufozu.flywheel.lib.memory.FlwMemoryTracker; import com.jozufozu.flywheel.lib.model.ModelCache; import com.jozufozu.flywheel.lib.model.ModelHolder; -import com.jozufozu.flywheel.lib.model.baked.PartialModel; +import com.jozufozu.flywheel.lib.model.baked.PartialModelEventHandler; import com.jozufozu.flywheel.lib.util.LevelAttached; import com.jozufozu.flywheel.lib.util.StringUtil; @@ -98,8 +98,8 @@ private static void clientInit(IEventBus forgeEventBus, IEventBus modEventBus) { modEventBus.addListener($ -> ModelCache.onEndClientResourceReload()); modEventBus.addListener($ -> ModelHolder.onEndClientResourceReload()); - modEventBus.addListener(PartialModel::onModelRegistry); - modEventBus.addListener(PartialModel::onModelBake); + modEventBus.addListener(PartialModelEventHandler::onModelRegistry); + modEventBus.addListener(PartialModelEventHandler::onModelBake); Flywheel.earlyInit(); CrashReportCallables.registerCrashCallable("Flywheel Backend", BackendManagerImpl::getBackendString); diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelLibPlatformImpl.java b/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelLibPlatformImpl.java new file mode 100644 index 000000000..547375265 --- /dev/null +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelLibPlatformImpl.java @@ -0,0 +1,67 @@ +package com.jozufozu.flywheel.impl; + +import java.lang.reflect.Field; + +import org.slf4j.Logger; + +import com.jozufozu.flywheel.impl.extension.PoseStackExtension; +import com.jozufozu.flywheel.lib.internal.FlywheelLibPlatform; +import com.jozufozu.flywheel.lib.model.baked.BakedModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.BlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.ForgeBakedModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.ForgeBlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.ForgeMultiBlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.MultiBlockModelBuilder; +import com.jozufozu.flywheel.lib.transform.PoseTransformStack; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.logging.LogUtils; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.block.ModelBlockRenderer; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.fml.util.ObfuscationReflectionHelper; + +public class FlywheelLibPlatformImpl implements FlywheelLibPlatform { + private static final Logger LOGGER = LogUtils.getLogger(); + + @Override + public PoseTransformStack getPoseTransformStackOf(PoseStack stack) { + return ((PoseStackExtension) stack).flywheel$transformStack(); + } + + @Override + public BlockRenderDispatcher createVanillaRenderer() { + BlockRenderDispatcher defaultDispatcher = Minecraft.getInstance().getBlockRenderer(); + BlockRenderDispatcher dispatcher = new BlockRenderDispatcher(null, null, null); + try { + for (Field field : BlockRenderDispatcher.class.getDeclaredFields()) { + field.setAccessible(true); + field.set(dispatcher, field.get(defaultDispatcher)); + } + ObfuscationReflectionHelper.setPrivateValue(BlockRenderDispatcher.class, dispatcher, new ModelBlockRenderer(Minecraft.getInstance().getBlockColors()), "f_110900_"); + } catch (Exception e) { + LOGGER.error("Failed to initialize vanilla BlockRenderDispatcher!", e); + return defaultDispatcher; + } + return dispatcher; + } + + @Override + public BakedModelBuilder bakedModelBuilder(BakedModel bakedModel) { + return new ForgeBakedModelBuilder(bakedModel); + } + + @Override + public BlockModelBuilder blockModelBuilder(BlockState state) { + return new ForgeBlockModelBuilder(state); + } + + @Override + public MultiBlockModelBuilder multiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { + return new ForgeMultiBlockModelBuilder(level, positions); + } +} diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java b/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java similarity index 92% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java rename to forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java index dcfa860f7..c454aaf52 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java +++ b/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java @@ -33,7 +33,7 @@ final class BakedModelBufferer { private BakedModelBufferer() { } - public static void bufferSingle(ModelBlockRenderer blockRenderer, BlockAndTintGetter level, BakedModel model, BlockState state, @Nullable PoseStack poseStack, ModelData modelData, ResultConsumer resultConsumer) { + public static void bufferSingle(ModelBlockRenderer blockRenderer, BlockAndTintGetter level, BakedModel model, BlockState state, @Nullable PoseStack poseStack, ModelData modelData, MeshEmitter.ResultConsumer resultConsumer) { ThreadLocalObjects objects = THREAD_LOCAL_OBJECTS.get(); if (poseStack == null) { poseStack = objects.identityPoseStack; @@ -59,7 +59,7 @@ public static void bufferSingle(ModelBlockRenderer blockRenderer, BlockAndTintGe } } - public static void bufferBlock(BlockRenderDispatcher renderDispatcher, BlockAndTintGetter level, BlockState state, @Nullable PoseStack poseStack, ModelData modelData, ResultConsumer resultConsumer) { + public static void bufferBlock(BlockRenderDispatcher renderDispatcher, BlockAndTintGetter level, BlockState state, @Nullable PoseStack poseStack, ModelData modelData, MeshEmitter.ResultConsumer resultConsumer) { if (state.getRenderShape() != RenderShape.MODEL) { return; } @@ -67,7 +67,7 @@ public static void bufferBlock(BlockRenderDispatcher renderDispatcher, BlockAndT bufferSingle(renderDispatcher.getModelRenderer(), level, renderDispatcher.getBlockModel(state), state, poseStack, modelData, resultConsumer); } - public static void bufferMultiBlock(BlockRenderDispatcher renderDispatcher, Iterator posIterator, BlockAndTintGetter level, @Nullable PoseStack poseStack, Function modelDataLookup, boolean renderFluids, ResultConsumer resultConsumer) { + public static void bufferMultiBlock(BlockRenderDispatcher renderDispatcher, Iterator posIterator, BlockAndTintGetter level, @Nullable PoseStack poseStack, Function modelDataLookup, boolean renderFluids, MeshEmitter.ResultConsumer resultConsumer) { ThreadLocalObjects objects = THREAD_LOCAL_OBJECTS.get(); if (poseStack == null) { poseStack = objects.identityPoseStack; @@ -142,13 +142,13 @@ private static class ThreadLocalObjects { public final TransformingVertexConsumer transformingWrapper = new TransformingVertexConsumer(); - public final MeshEmitter[] emitters = new MeshEmitter[CHUNK_LAYER_AMOUNT]; + public final ForgeMeshEmitter[] emitters = new ForgeMeshEmitter[CHUNK_LAYER_AMOUNT]; { for (int layerIndex = 0; layerIndex < CHUNK_LAYER_AMOUNT; layerIndex++) { var renderType = CHUNK_LAYERS[layerIndex]; var buffer = new BufferBuilder(renderType.bufferSize()); - emitters[layerIndex] = new MeshEmitter(buffer, renderType); + emitters[layerIndex] = new ForgeMeshEmitter(buffer, renderType); } } } diff --git a/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java b/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java new file mode 100644 index 000000000..e313a8aa7 --- /dev/null +++ b/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java @@ -0,0 +1,62 @@ +package com.jozufozu.flywheel.lib.model.baked; + +import org.jetbrains.annotations.Nullable; + +import com.google.common.collect.ImmutableList; +import com.jozufozu.flywheel.api.material.Material; +import com.jozufozu.flywheel.api.model.Model; +import com.jozufozu.flywheel.api.vertex.VertexView; +import com.jozufozu.flywheel.lib.memory.MemoryBlock; +import com.jozufozu.flywheel.lib.model.ModelUtil; +import com.jozufozu.flywheel.lib.model.SimpleMesh; +import com.jozufozu.flywheel.lib.model.SimpleModel; +import com.jozufozu.flywheel.lib.model.baked.MeshEmitter.ResultConsumer; +import com.jozufozu.flywheel.lib.vertex.NoOverlayVertexView; + +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.world.level.block.Blocks; +import net.minecraftforge.client.model.data.ModelData; + +public class ForgeBakedModelBuilder extends BakedModelBuilder { + @Nullable + private ModelData modelData; + + public ForgeBakedModelBuilder(BakedModel bakedModel) { + super(bakedModel); + } + + public ForgeBakedModelBuilder modelData(ModelData modelData) { + this.modelData = modelData; + return this; + } + + public SimpleModel build() { + if (level == null) { + level = VirtualEmptyBlockGetter.INSTANCE; + } + if (blockState == null) { + blockState = Blocks.AIR.defaultBlockState(); + } + if (modelData == null) { + modelData = ModelData.EMPTY; + } + if (materialFunc == null) { + materialFunc = ModelUtil::getMaterial; + } + + var out = ImmutableList.builder(); + + ResultConsumer resultConsumer = (renderType, shaded, data) -> { + Material material = materialFunc.apply(renderType, shaded); + if (material != null) { + VertexView vertexView = new NoOverlayVertexView(); + MemoryBlock meshData = ModelUtil.convertVanillaBuffer(data, vertexView); + var mesh = new SimpleMesh(vertexView, meshData, "source=BakedModelBuilder," + "bakedModel=" + bakedModel + ",renderType=" + renderType + ",shaded=" + shaded); + out.add(new Model.ConfiguredMesh(material, mesh)); + } + }; + BakedModelBufferer.bufferSingle(ModelUtil.VANILLA_RENDERER.getModelRenderer(), level, bakedModel, blockState, poseStack, modelData, resultConsumer); + + return new SimpleModel(out.build()); + } +} diff --git a/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java b/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java new file mode 100644 index 000000000..017480a30 --- /dev/null +++ b/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java @@ -0,0 +1,58 @@ +package com.jozufozu.flywheel.lib.model.baked; + +import org.jetbrains.annotations.Nullable; + +import com.google.common.collect.ImmutableList; +import com.jozufozu.flywheel.api.material.Material; +import com.jozufozu.flywheel.api.model.Model; +import com.jozufozu.flywheel.api.vertex.VertexView; +import com.jozufozu.flywheel.lib.memory.MemoryBlock; +import com.jozufozu.flywheel.lib.model.ModelUtil; +import com.jozufozu.flywheel.lib.model.SimpleMesh; +import com.jozufozu.flywheel.lib.model.SimpleModel; +import com.jozufozu.flywheel.lib.model.baked.MeshEmitter.ResultConsumer; +import com.jozufozu.flywheel.lib.vertex.NoOverlayVertexView; + +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.client.model.data.ModelData; + +public class ForgeBlockModelBuilder extends BlockModelBuilder { + @Nullable + private ModelData modelData; + + public ForgeBlockModelBuilder(BlockState state) { + super(state); + } + + public ForgeBlockModelBuilder modelData(ModelData modelData) { + this.modelData = modelData; + return this; + } + + public SimpleModel build() { + if (level == null) { + level = VirtualEmptyBlockGetter.INSTANCE; + } + if (modelData == null) { + modelData = ModelData.EMPTY; + } + if (materialFunc == null) { + materialFunc = ModelUtil::getMaterial; + } + + var out = ImmutableList.builder(); + + ResultConsumer resultConsumer = (renderType, shaded, data) -> { + Material material = materialFunc.apply(renderType, shaded); + if (material != null) { + VertexView vertexView = new NoOverlayVertexView(); + MemoryBlock meshData = ModelUtil.convertVanillaBuffer(data, vertexView); + var mesh = new SimpleMesh(vertexView, meshData, "source=BlockModelBuilder," + "blockState=" + state + ",renderType=" + renderType + ",shaded=" + shaded); + out.add(new Model.ConfiguredMesh(material, mesh)); + } + }; + BakedModelBufferer.bufferBlock(ModelUtil.VANILLA_RENDERER, level, state, poseStack, modelData, resultConsumer); + + return new SimpleModel(out.build()); + } +} diff --git a/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java b/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java new file mode 100644 index 000000000..bc4bc05cc --- /dev/null +++ b/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java @@ -0,0 +1,58 @@ +package com.jozufozu.flywheel.lib.model.baked; + +import java.util.function.Function; + +import org.jetbrains.annotations.Nullable; + +import com.google.common.collect.ImmutableList; +import com.jozufozu.flywheel.api.material.Material; +import com.jozufozu.flywheel.api.model.Model; +import com.jozufozu.flywheel.api.vertex.VertexView; +import com.jozufozu.flywheel.lib.memory.MemoryBlock; +import com.jozufozu.flywheel.lib.model.ModelUtil; +import com.jozufozu.flywheel.lib.model.SimpleMesh; +import com.jozufozu.flywheel.lib.model.SimpleModel; +import com.jozufozu.flywheel.lib.model.baked.MeshEmitter.ResultConsumer; +import com.jozufozu.flywheel.lib.vertex.NoOverlayVertexView; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraftforge.client.model.data.ModelData; + +public class ForgeMultiBlockModelBuilder extends MultiBlockModelBuilder { + @Nullable + private Function modelDataLookup; + + public ForgeMultiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { + super(level, positions); + } + + public ForgeMultiBlockModelBuilder modelDataLookup(Function modelDataLookup) { + this.modelDataLookup = modelDataLookup; + return this; + } + + public SimpleModel build() { + if (modelDataLookup == null) { + modelDataLookup = pos -> ModelData.EMPTY; + } + if (materialFunc == null) { + materialFunc = ModelUtil::getMaterial; + } + + var out = ImmutableList.builder(); + + ResultConsumer resultConsumer = (renderType, shaded, data) -> { + Material material = materialFunc.apply(renderType, shaded); + if (material != null) { + VertexView vertexView = new NoOverlayVertexView(); + MemoryBlock meshData = ModelUtil.convertVanillaBuffer(data, vertexView); + var mesh = new SimpleMesh(vertexView, meshData, "source=MultiBlockModelBuilder," + "renderType=" + renderType + ",shaded=" + shaded); + out.add(new Model.ConfiguredMesh(material, mesh)); + } + }; + BakedModelBufferer.bufferMultiBlock(ModelUtil.VANILLA_RENDERER, positions.iterator(), level, poseStack, modelDataLookup, renderFluids, resultConsumer); + + return new SimpleModel(out.build()); + } +} diff --git a/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java b/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java new file mode 100644 index 000000000..0c2f4d57a --- /dev/null +++ b/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java @@ -0,0 +1,20 @@ +package com.jozufozu.flywheel.lib.model.baked; + +import net.minecraftforge.client.event.ModelEvent; + +public class PartialModelEventHandler { + public static void onModelRegistry(ModelEvent.RegisterAdditional event) { + for (PartialModel partial : PartialModel.ALL) { + event.register(partial.getLocation()); + } + + PartialModel.tooLate = true; + } + + public static void onModelBake(ModelEvent.BakingCompleted event) { + var modelRegistry = event.getModels(); + for (PartialModel partial : PartialModel.ALL) { + partial.set(modelRegistry.get(partial.getLocation())); + } + } +} From f471edc5f459f16ad220736c9901b85eb25b6925 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sat, 20 Apr 2024 18:28:54 -0700 Subject: [PATCH 14/62] Gradle grumbles - Apply java, maven-publish to all projects - Prefer the tasks.named() syntax for configuring tasks - Separate shared configuration for platform projects into a separate configure block - Add more fields to processResources - Make helper methods static - Exclude duplicated package infos --- build.gradle | 210 +++++++++++++------- common/build.gradle | 6 - common/src/main/resources/pack.mcmeta | 2 +- fabric/build.gradle | 8 - fabric/src/main/resources/fabric.mod.json | 19 +- forge/build.gradle | 9 +- forge/src/main/resources/META-INF/mods.toml | 19 +- gradle.properties | 15 +- 8 files changed, 170 insertions(+), 118 deletions(-) diff --git a/build.gradle b/build.gradle index 700792afb..4b5257b3b 100644 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,12 @@ plugins { println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" subprojects { + apply plugin: "dev.architectury.loom" + + base { + archivesName = "flywheel-${name}-${artifact_minecraft_version}" + } + boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false'); ext.buildNumber = System.getenv('BUILD_NUMBER') @@ -15,63 +21,10 @@ subprojects { group = 'com.jozufozu.flywheel' version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') - apply plugin: "java" - apply plugin: "maven-publish" - apply plugin: "dev.architectury.loom" - loom { silentMojangMappingsLicense() } - if (it != project(':common')) { - loom { - runs { - client { - ideConfigGenerated true - property 'flw.dumpShaderSource', 'true' - property 'flw.debugMemorySafety', 'true' - programArgs '--width', '1280', '--height', '720' - } - - server { - ideConfigGenerated true - programArgs '--nogui' - } - } - } - } - - tasks { - // make builds reproducible - withType(AbstractArchiveTask).configureEach { - preserveFileTimestamps = false - reproducibleFileOrder = true - } - - // module metadata is often broken on multi-platform projects - withType(GenerateModuleMetadata).configureEach { - enabled = false - } - } - - processResources.configure { - from(project(':common').sourceSets.main.resources) - - var replaceProperties = [ - minecraft_version : minecraft_version, - minecraft_version_range: minecraft_version_range, - forge_version : forge_version, - forge_version_range : forge_version_range, - loader_version_range : loader_version_range, - mod_version : mod_version - ] - inputs.properties replaceProperties - - filesMatching(['META-INF/mods.toml', 'META-INF/neoforge.mods.toml', 'pack.mcmeta', 'fabric.mod.json']) { - expand replaceProperties + [project: project] - } - } - repositories { maven { name = 'ParchmentMC' @@ -103,8 +56,43 @@ subprojects { officialMojangMappings() parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") }) + + implementation "com.google.code.findbugs:jsr305:3.0.2" + } + + processResources { + var replaceProperties = [ + minecraft_version : minecraft_version, + minecraft_version_range: minecraft_version_range, + forge_version : forge_version, + forge_version_range : forge_version_range, + loader_version_range : loader_version_range, + mod_version : mod_version, + mod_id : mod_id, + mod_name : mod_name, + mod_description : mod_description, + mod_license : mod_license, + mod_sources : mod_sources, + mod_issues : mod_issues, + mod_homepage : mod_homepage, + ] + inputs.properties replaceProperties + + filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml', 'META-INF/neoforge.mods.toml']) { + expand replaceProperties + [project: project] + } } + apply from: rootProject.file('gradle/package-infos.gradle') + + ideaSyncTask.finalizedBy(generatePackageInfos) +} + +// Need to setup the java plugin for all projects so that our subprojects can find an output directory +allprojects { + apply plugin: "java" + apply plugin: "maven-publish" + java { JavaVersion javaVersion = JavaVersion.toVersion(java_version) sourceCompatibility = javaVersion @@ -116,46 +104,105 @@ subprojects { withJavadocJar() } - tasks.withType(JavaCompile).configureEach { - source(project(':common').sourceSets.main.allSource) - - options.encoding = 'UTF-8' - options.release = Integer.parseInt(java_version) - options.compilerArgs = ['-Xdiags:verbose'] + // make builds reproducible + tasks.withType(AbstractArchiveTask).configureEach { + preserveFileTimestamps = false + reproducibleFileOrder = true } - jar.configure { - archiveClassifier = '' - addManifest(it) - addLicense(it) + // module metadata is often broken on multi-platform projects + tasks.withType(GenerateModuleMetadata).configureEach { + enabled = false } - sourcesJar.configure { - from(project(':common').sourceSets.main.allSource) + tasks.withType(JavaCompile).configureEach { JavaCompile javaCompile -> + javaCompile.options.encoding = 'UTF-8' + javaCompile.options.release = Integer.parseInt(java_version) + javaCompile.options.compilerArgs = ['-Xdiags:verbose'] + } - addManifest(it) - addLicense(it) + tasks.named('jar', Jar).configure { Jar jar -> + archiveClassifier = '' + addManifest(jar) + addLicense(jar) } - javadoc.configure { - source(project(':common').sourceSets.main.allJava) + tasks.named('sourcesJar', Jar).configure { Jar jar -> + addManifest(jar) + addLicense(jar) + } + tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> + javadoc.source sourceSets.main.allJava // prevent java 8's strict doclint for javadocs from failing builds - options.addStringOption('Xdoclint:none', '-quiet') + javadoc.options.addStringOption('Xdoclint:none', '-quiet') } +} - apply from: rootProject.file('gradle/package-infos.gradle') +// Common configuration for platform dependent subprojects. +for (final def subprojectName in [":fabric", ":forge"]) { + project(subprojectName) { + evaluationDependsOn(':common') - ideaSyncTask.finalizedBy(generatePackageInfos) + loom { + runs { + client { + ideConfigGenerated true + // Turn on our own debug flags + property 'flw.dumpShaderSource', 'true' + property 'flw.debugMemorySafety', 'true' + + // Turn on mixin debug flags + property 'mixin.debug.export', 'true' + property 'mixin.debug.verbose', 'true' + + // 720p baby! + programArgs '--width', '1280', '--height', '720' + } + + // We're a client mod, but we need to make sure we correctly render when playing on a server. + server { + ideConfigGenerated true + programArgs '--nogui' + } + } + } + + tasks.named('processResources', ProcessResources).configure { ProcessResources processResources -> + processResources.from project(':common').tasks.named('processResources', ProcessResources).get().source + } + + tasks.named('compileJava', JavaCompile).configure { JavaCompile compileJava -> + compileJava.source project(':common').tasks.named('compileJava', JavaCompile).get().source + excludeDuplicatePackageInfos(compileJava) + } + + tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> + javadoc.source project(':common').tasks.named('javadoc', Javadoc).get().source + excludeDuplicatePackageInfos(javadoc) + } + + tasks.named('jar', Jar).configure { Jar jar -> + excludeDuplicatePackageInfos(jar) + } + + tasks.named('sourcesJar', Jar).configure { Jar jar -> + def commonSources = project(":common").tasks.named('sourcesJar', Jar) + dependsOn commonSources + jar.from zipTree(commonSources.flatMap { it.archiveFile }) + + excludeDuplicatePackageInfos(jar) + } + } } -void addLicense(jarTask) { +static void addLicense(Jar jarTask) { jarTask.from('LICENSE.md') { rename '(.*)\\.(.*)', '$1_' + jarTask.archiveBaseName + '.$2' } } -void addManifest(jarTask) { +static void addManifest(Jar jarTask) { jarTask.manifest { attributes([ 'Specification-Title' : 'flywheel', @@ -169,6 +216,21 @@ void addManifest(jarTask) { } } +// We have duplicate packages between the common and platform dependent subprojects. +// In theory the package-info.java files should be identical, so just take the first one we find. +static void excludeDuplicatePackageInfos(AbstractCopyTask copyTask) { + copyTask.filesMatching('**/package-info.java') { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } +} + +// The compile/javadoc tasks have a different base type that isn't so smart about exclusion handling. +static void excludeDuplicatePackageInfos(SourceTask sourceTask) { + // FIXME: actually scan the files and exclude the duplicates + // may be tough because the files have absolute paths + sourceTask.exclude('**/package-info.java') +} + idea { // Tell IDEA to always download sources/javadoc artifacts from maven. module { diff --git a/common/build.gradle b/common/build.gradle index d68cff3fb..aacd3633c 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,12 +1,6 @@ -base { - archivesName = "flywheel-${project.name}-${artifact_minecraft_version}" -} - dependencies { modCompileOnly "net.fabricmc:fabric-loader:$fabric_loader_version" - compileOnly "com.google.code.findbugs:jsr305:3.0.2" - testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1' } diff --git a/common/src/main/resources/pack.mcmeta b/common/src/main/resources/pack.mcmeta index 2f2b4f1e2..ae03c9b7f 100644 --- a/common/src/main/resources/pack.mcmeta +++ b/common/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { - "description": "Flywheel resources", + "description": "${mod_name} resources", "pack_format": 15 } } diff --git a/fabric/build.gradle b/fabric/build.gradle index fac6ac166..86f8ea549 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,9 +1,3 @@ -evaluationDependsOn(':common') - -base { - archivesName = "flywheel-${project.name}-${artifact_minecraft_version}" -} - dependencies { modCompileOnly "net.fabricmc:fabric-loader:$fabric_loader_version" modLocalRuntime "net.fabricmc:fabric-loader:$fabric_loader_version" @@ -18,8 +12,6 @@ dependencies { modCompileOnly "maven.modrinth:sodium:$sodium_version" modCompileOnly "maven.modrinth:iris:$iris_version" - - compileOnly "com.google.code.findbugs:jsr305:3.0.2" } publishing { diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index b62133644..9d1336191 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -1,19 +1,20 @@ { "schemaVersion": 1, - "id": "flywheel", - "version": "${version}", - "name": "Flywheel", - "description": "A modern engine for modded minecraft.", + "id": "${mod_id}", + "version": "${mod_version}", + "name": "${mod_name}", + "description": "${mod_description}", "authors": [ "Jozufozu", "PepperCode1" ], "contact": { - "homepage": "https://fabricmc.net/", - "sources": "https://github.com/FabricMC/fabric-example-mod" + "homepage": "${mod_homepage}", + "sources": "${mod_sources}", + "issues": "${mod_issues}" }, - "license": "MIT", - "icon": "assets/flywheel/logo.png", + "license": "${mod_license}", + "icon": "logo.png", "environment": "*", "entrypoints": { "client": [ @@ -27,6 +28,6 @@ ], "depends": { "fabric": "*", - "minecraft": ">=1.20.1" + "minecraft": "${minecraft_version_range}" } } diff --git a/forge/build.gradle b/forge/build.gradle index 7d44d99cb..ca6f186e9 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,9 +1,4 @@ -evaluationDependsOn(':common') - -base { - archivesName = "flywheel-${project.name}-${artifact_minecraft_version}" -} - +// Add some forge specific configurations loom { forge { mixinConfig "flywheel.backend.mixins.json" @@ -26,8 +21,6 @@ dependencies { modCompileOnly "maven.modrinth:embeddium:$embeddium_version" modCompileOnly "maven.modrinth:oculus:$oculus_version" - - compileOnly "com.google.code.findbugs:jsr305:3.0.2" } publishing { diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 5d3bde9cc..6a20ac8da 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -1,33 +1,32 @@ modLoader = "javafml" loaderVersion = "${loader_version_range}" -issueTrackerURL = "https://github.com/Jozufozu/Flywheel/issues" -license = "MIT" +issueTrackerURL = "${mod_issues}" +license = "${mod_license}" [[mods]] -modId = "flywheel" +modId = "${mod_id}" version = "${mod_version}" -displayName = "Flywheel" +displayName = "${mod_name}" logoFile = "logo.png" -displayURL = "https://github.com/Jozufozu/Flywheel" +displayURL = "${mod_homepage}" authors = "Jozufozu, PepperCode1" -description = ''' -A modern engine for modded minecraft.''' +description = "${mod_description}" -[[dependencies.flywheel]] +[[dependencies.${mod_id}]] modId = "forge" mandatory = true versionRange = "${forge_version_range}" ordering = "NONE" side = "CLIENT" -[[dependencies.flywheel]] +[[dependencies.${mod_id}]] modId = "minecraft" mandatory = true versionRange = "${minecraft_version_range}" ordering = "NONE" side = "CLIENT" -[[dependencies.flywheel]] +[[dependencies.${mod_id}]] modId = "rubidium" # This replicates a "breaks" dependency. # There's a mixin crash with Rubidium <0.7.0. diff --git a/gradle.properties b/gradle.properties index c21a937b9..2bf7a0f10 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,19 +1,30 @@ org.gradle.jvmargs = -Xmx3G org.gradle.daemon = false -# mod version info +# General mod metadata +mod_id = flywheel +mod_name = Flywheel +mod_license = MIT +mod_description = An overhauled entity and block entity rendering API. + +mod_sources = https://github.com/Jozufozu/Flywheel +mod_issues = https://github.com/Jozufozu/Flywheel/issues +mod_homepage = https://github.com/Jozufozu/Flywheel + +# Mod version info mod_version = 1.0.0-alpha artifact_minecraft_version = 1.20.1 minecraft_version = 1.20.1 forge_version = 47.2.19 fabric_loader_version = 0.15.9 fabric_api_version = 0.92.1+1.20.1 + # Version ranges for the mods.toml minecraft_version_range = [1.20.1,1.20.2) forge_version_range = [47,) loader_version_range = [47,) -# build dependency versions +# Build dependency versions java_version = 17 arch_loom_version = 1.6-SNAPSHOT forgegradle_version = [6.0.16,6.2) From b5066e36cfa51d0063a27e3b3b93918d64286edf Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sun, 21 Apr 2024 11:57:38 -0700 Subject: [PATCH 15/62] One line optimization - Actually init vanilla visuals --- common/src/main/java/com/jozufozu/flywheel/Flywheel.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/src/main/java/com/jozufozu/flywheel/Flywheel.java b/common/src/main/java/com/jozufozu/flywheel/Flywheel.java index 37ab7a864..173ec41b7 100644 --- a/common/src/main/java/com/jozufozu/flywheel/Flywheel.java +++ b/common/src/main/java/com/jozufozu/flywheel/Flywheel.java @@ -13,6 +13,7 @@ import com.jozufozu.flywheel.lib.material.FogShaders; import com.jozufozu.flywheel.lib.material.StandardMaterialShaders; import com.jozufozu.flywheel.lib.util.ShadersModHandler; +import com.jozufozu.flywheel.vanilla.VanillaVisuals; import net.minecraft.resources.ResourceLocation; @@ -39,6 +40,8 @@ public static void init() { StandardMaterialShaders.init(); ShaderIndices.init(); + + VanillaVisuals.init(); } public static void freeze() { From 9d227c5887e519482e7b31616b5efa08227f53fb Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Sun, 21 Apr 2024 17:15:21 -0700 Subject: [PATCH 16/62] Minor clean up and fixes --- .editorconfig | 4 +- build.gradle | 186 +++++++++--------- common/build.gradle | 13 +- .../api/internal/DependencyInjection.java | 76 +++++++ .../api/internal/InternalFlywheelApi.java | 43 +--- .../engine/uniform/PlayerUniforms.java | 6 +- .../jozufozu/flywheel/config/FlwConfig.java | 4 +- .../flywheel/impl/BackendManagerImpl.java | 22 ++- .../flywheel/impl/InternalFlywheelImpl.java | 5 + .../impl/mixin/LevelRendererMixin.java | 6 +- .../lib/internal/FlywheelLibPlatform.java | 64 ------ .../flywheel/lib/internal/package-info.java | 12 -- .../flywheel/lib/model/ModelUtil.java | 4 +- .../lib/model/baked/BakedModelBuilder.java | 13 +- .../lib/model/baked/BlockModelBuilder.java | 12 +- .../model/baked/MultiBlockModelBuilder.java | 4 +- .../lib/transform/TransformStack.java | 4 +- .../flywheel/lib/util/LevelAttached.java | 2 - .../flywheel/lib/util/ShadersModHandler.java | 2 +- .../flywheel/platform/ClientPlatform.java | 49 +++-- fabric/build.gradle | 25 +-- fabric/gradle.properties | 1 + .../flywheel/{ => impl}/FlywheelFabric.java | 2 +- .../impl/mixin/sodium/SodiumMixinPlugin.java | 4 +- .../flywheel/platform/ClientPlatformImpl.java | 32 ++- fabric/src/main/resources/fabric.mod.json | 11 +- forge/build.gradle | 22 +-- .../flywheel/config/FlwForgeConfig.java | 2 +- .../flywheel/impl/BackendEventHandler.java | 28 --- .../flywheel/{ => impl}/FlywheelForge.java | 27 +-- .../impl/FlywheelLibPlatformImpl.java | 67 ------- .../flywheel/platform/ClientPlatformImpl.java | 57 +++++- forge/src/main/resources/META-INF/mods.toml | 23 ++- .../src/main/resources/pack.mcmeta | 0 gradle.properties | 50 ++--- settings.gradle | 1 + 36 files changed, 395 insertions(+), 488 deletions(-) create mode 100644 common/src/main/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java delete mode 100644 common/src/main/java/com/jozufozu/flywheel/lib/internal/FlywheelLibPlatform.java delete mode 100644 common/src/main/java/com/jozufozu/flywheel/lib/internal/package-info.java create mode 100644 fabric/gradle.properties rename fabric/src/main/java/com/jozufozu/flywheel/{ => impl}/FlywheelFabric.java (81%) delete mode 100644 forge/src/main/java/com/jozufozu/flywheel/impl/BackendEventHandler.java rename forge/src/main/java/com/jozufozu/flywheel/{ => impl}/FlywheelForge.java (85%) delete mode 100644 forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelLibPlatformImpl.java rename {common => forge}/src/main/resources/pack.mcmeta (100%) diff --git a/.editorconfig b/.editorconfig index 6319172a3..038bc765e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,14 +4,12 @@ root = true [*] indent_style = space indent_size = 4 -ij_continuation_indent_size = 8 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.json] -indent_style = space indent_size = 2 max_line_length = 500 ij_json_keep_blank_lines_in_code = 0 @@ -27,12 +25,12 @@ ij_json_wrap_long_lines = false [*.java] indent_style = tab +ij_continuation_indent_size = 8 ij_java_blank_lines_before_class_end = 0 ij_java_blank_lines_after_anonymous_class_header = 0 ij_java_blank_lines_after_class_header = 0 ij_java_blank_lines_before_method_body = 0 ij_java_else_on_new_line = false -ij_continuation_indent_size = 8 ij_java_class_count_to_use_import_on_demand = 99 ij_java_names_count_to_use_import_on_demand = 99 ij_java_imports_layout = $*, |, java.**, |, javax.**, |, org.**, |, com.**, |, * diff --git a/build.gradle b/build.gradle index 4b5257b3b..2a823f262 100644 --- a/build.gradle +++ b/build.gradle @@ -1,45 +1,93 @@ plugins { - id 'eclipse' id 'idea' // make sure gradle loads the same arch plugin across all subprojects id 'dev.architectury.loom' apply false } -println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" +println("Java: ${System.getProperty('java.version')}, JVM: ${System.getProperty('java.vm.version')} (${System.getProperty('java.vendor')}), Arch: ${System.getProperty('os.arch')}") -subprojects { - apply plugin: "dev.architectury.loom" +allprojects { + // Need to setup the java plugin for all projects so that our subprojects can find an output directory + apply plugin: 'java' + apply plugin: 'maven-publish' + + boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false') + String buildNumber = System.getenv('BUILD_NUMBER') + + group = 'com.jozufozu.flywheel' + version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') base { archivesName = "flywheel-${name}-${artifact_minecraft_version}" } - boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false'); + java { + JavaVersion javaVersion = JavaVersion.toVersion(java_version) + sourceCompatibility = javaVersion + targetCompatibility = javaVersion - ext.buildNumber = System.getenv('BUILD_NUMBER') + toolchain.languageVersion = JavaLanguageVersion.of(java_version) - group = 'com.jozufozu.flywheel' - version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') + withSourcesJar() + withJavadocJar() + } + + // make builds reproducible + tasks.withType(AbstractArchiveTask).configureEach { + preserveFileTimestamps = false + reproducibleFileOrder = true + } + + // module metadata is often broken on multi-platform projects + tasks.withType(GenerateModuleMetadata).configureEach { + enabled = false + } + + tasks.withType(JavaCompile).configureEach { JavaCompile javaCompile -> + javaCompile.options.encoding = 'UTF-8' + javaCompile.options.release = Integer.parseInt(java_version) + javaCompile.options.compilerArgs = ['-Xdiags:verbose'] + } + + tasks.named('jar', Jar).configure { Jar jar -> + archiveClassifier = '' + addLicense(jar) + } + + tasks.named('sourcesJar', Jar).configure { Jar jar -> + addLicense(jar) + } + + tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> + javadoc.source sourceSets.main.allJava + // prevent java 8's strict doclint for javadocs from failing builds + javadoc.options.addStringOption('Xdoclint:none', '-quiet') + } +} + +subprojects { + apply plugin: 'dev.architectury.loom' loom { silentMojangMappingsLicense() } repositories { + mavenCentral() maven { name = 'ParchmentMC' url = 'https://maven.parchmentmc.org' } + maven { + name 'tterrag maven' + url 'https://maven.tterrag.com/' + } maven { url 'https://www.cursemaven.com' content { includeGroup "curse.maven" } } - maven { - name 'tterrag maven' - url 'https://maven.tterrag.com/' - } maven { name = "Modrinth" url = "https://api.modrinth.com/maven" @@ -47,100 +95,59 @@ subprojects { includeGroup "maven.modrinth" } } - mavenCentral() } dependencies { - minecraft "com.mojang:minecraft:$minecraft_version" + minecraft "com.mojang:minecraft:${minecraft_version}" mappings(loom.layered() { officialMojangMappings() parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") }) - implementation "com.google.code.findbugs:jsr305:3.0.2" + api 'com.google.code.findbugs:jsr305:3.0.2' } processResources { var replaceProperties = [ - minecraft_version : minecraft_version, - minecraft_version_range: minecraft_version_range, - forge_version : forge_version, - forge_version_range : forge_version_range, - loader_version_range : loader_version_range, - mod_version : mod_version, - mod_id : mod_id, - mod_name : mod_name, - mod_description : mod_description, - mod_license : mod_license, - mod_sources : mod_sources, - mod_issues : mod_issues, - mod_homepage : mod_homepage, + mod_id : mod_id, + mod_name : mod_name, + mod_description : mod_description, + mod_license : mod_license, + mod_sources : mod_sources, + mod_issues : mod_issues, + mod_homepage : mod_homepage, + mod_version : mod_version, + minecraft_semver_version_range: minecraft_semver_version_range, + minecraft_maven_version_range : minecraft_maven_version_range, + fabric_api_version_range : fabric_api_version_range, + forge_version_range : forge_version_range, ] inputs.properties replaceProperties - filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml', 'META-INF/neoforge.mods.toml']) { - expand replaceProperties + [project: project] + filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml']) { + expand replaceProperties } } - apply from: rootProject.file('gradle/package-infos.gradle') - - ideaSyncTask.finalizedBy(generatePackageInfos) -} - -// Need to setup the java plugin for all projects so that our subprojects can find an output directory -allprojects { - apply plugin: "java" - apply plugin: "maven-publish" - - java { - JavaVersion javaVersion = JavaVersion.toVersion(java_version) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - - toolchain.languageVersion = JavaLanguageVersion.of(java_version) - - withSourcesJar() - withJavadocJar() - } - - // make builds reproducible - tasks.withType(AbstractArchiveTask).configureEach { - preserveFileTimestamps = false - reproducibleFileOrder = true - } - - // module metadata is often broken on multi-platform projects - tasks.withType(GenerateModuleMetadata).configureEach { - enabled = false - } - - tasks.withType(JavaCompile).configureEach { JavaCompile javaCompile -> - javaCompile.options.encoding = 'UTF-8' - javaCompile.options.release = Integer.parseInt(java_version) - javaCompile.options.compilerArgs = ['-Xdiags:verbose'] - } + publishing { + repositories { + maven { + url "file://${rootProject.projectDir}/mcmodsrepo" + } - tasks.named('jar', Jar).configure { Jar jar -> - archiveClassifier = '' - addManifest(jar) - addLicense(jar) + if (project.hasProperty('mavendir')) { + maven { url rootProject.file(property('mavendir')) } + } + } } - tasks.named('sourcesJar', Jar).configure { Jar jar -> - addManifest(jar) - addLicense(jar) - } + apply from: rootProject.file('gradle/package-infos.gradle') - tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> - javadoc.source sourceSets.main.allJava - // prevent java 8's strict doclint for javadocs from failing builds - javadoc.options.addStringOption('Xdoclint:none', '-quiet') - } + ideaSyncTask.finalizedBy(generatePackageInfos) } // Common configuration for platform dependent subprojects. -for (final def subprojectName in [":fabric", ":forge"]) { +for (final String subprojectName in [':fabric', ':forge']) { project(subprojectName) { evaluationDependsOn(':common') @@ -148,6 +155,7 @@ for (final def subprojectName in [":fabric", ":forge"]) { runs { client { ideConfigGenerated true + // Turn on our own debug flags property 'flw.dumpShaderSource', 'true' property 'flw.debugMemorySafety', 'true' @@ -187,7 +195,7 @@ for (final def subprojectName in [":fabric", ":forge"]) { } tasks.named('sourcesJar', Jar).configure { Jar jar -> - def commonSources = project(":common").tasks.named('sourcesJar', Jar) + def commonSources = project(':common').tasks.named('sourcesJar', Jar) dependsOn commonSources jar.from zipTree(commonSources.flatMap { it.archiveFile }) @@ -202,20 +210,6 @@ static void addLicense(Jar jarTask) { } } -static void addManifest(Jar jarTask) { - jarTask.manifest { - attributes([ - 'Specification-Title' : 'flywheel', - // 'Specification-Vendor': 'flywheel authors', - 'Specification-Version' : '1', // We are version 1 of ourselves - 'Implementation-Title' : jarTask.archiveBaseName, - 'Implementation-Version' : jarTask.archiveVersion, - // 'Implementation-Vendor': 'flywheel authors', - 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - ]) - } -} - // We have duplicate packages between the common and platform dependent subprojects. // In theory the package-info.java files should be identical, so just take the first one we find. static void excludeDuplicatePackageInfos(AbstractCopyTask copyTask) { diff --git a/common/build.gradle b/common/build.gradle index aacd3633c..9b27890cf 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,5 +1,5 @@ dependencies { - modCompileOnly "net.fabricmc:fabric-loader:$fabric_loader_version" + modCompileOnly "net.fabricmc:fabric-loader:${fabric_loader_version}" testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1' } @@ -11,7 +11,7 @@ test { publishing { publications { register('mavenJava', MavenPublication) { - from(components["java"]) + from(components['java']) artifactId = "flywheel-${project.name}-intermediary-${artifact_minecraft_version}" } register('mojmapJava', MavenPublication) { @@ -20,13 +20,4 @@ publishing { artifactId = "flywheel-${project.name}-mojmap-${artifact_minecraft_version}" } } - repositories { - maven { - url "file://${rootProject.projectDir}/mcmodsrepo" - } - - if (project.hasProperty('mavendir')) { - maven { url rootProject.file(property('mavendir')) } - } - } } diff --git a/common/src/main/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java b/common/src/main/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java new file mode 100644 index 000000000..72b1b0a21 --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java @@ -0,0 +1,76 @@ +package com.jozufozu.flywheel.api.internal; + +import java.lang.reflect.Constructor; + +// Adapted from https://github.com/CaffeineMC/sodium-fabric/blob/bf4fc9dab16e1cca07b2f23a1201c9bf237c8044/src/api/java/net/caffeinemc/mods/sodium/api/internal/DependencyInjection.java +public final class DependencyInjection { + private DependencyInjection() { + } + + public static T load(Class apiClass, String implClassName) { + Class implClass; + + try { + implClass = Class.forName(implClassName); + } catch (ReflectiveOperationException e) { + throw new RuntimeException("Could not find implementation", e); + } + + if (!apiClass.isAssignableFrom(implClass)) { + throw new RuntimeException("Class %s does not implement interface %s" + .formatted(implClass.getName(), apiClass.getName())); + } + + Constructor implConstructor; + + try { + implConstructor = implClass.getConstructor(); + } catch (ReflectiveOperationException e) { + throw new RuntimeException("Could not find default constructor", e); + } + + Object implInstance; + + try { + implInstance = implConstructor.newInstance(); + } catch (ReflectiveOperationException e) { + throw new RuntimeException("Could not instantiate implementation", e); + } + + return apiClass.cast(implInstance); + } + + private static InternalFlywheelApi load() { + Class apiClass = InternalFlywheelApi.class; + Class implClass; + + try { + implClass = Class.forName("com.jozufozu.flywheel.impl.InternalFlywheelImpl"); + } catch (ReflectiveOperationException e) { + throw new RuntimeException("Could not find implementation", e); + } + + if (!apiClass.isAssignableFrom(implClass)) { + throw new RuntimeException("Class %s does not implement interface %s" + .formatted(implClass.getName(), apiClass.getName())); + } + + Constructor implConstructor; + + try { + implConstructor = implClass.getConstructor(); + } catch (ReflectiveOperationException e) { + throw new RuntimeException("Could not find default constructor", e); + } + + Object implInstance; + + try { + implInstance = implConstructor.newInstance(); + } catch (ReflectiveOperationException e) { + throw new RuntimeException("Could not instantiate implementation", e); + } + + return apiClass.cast(implInstance); + } +} diff --git a/common/src/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java b/common/src/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java index cb88d5f63..46737afa2 100644 --- a/common/src/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java +++ b/common/src/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java @@ -1,7 +1,5 @@ package com.jozufozu.flywheel.api.internal; -import java.lang.reflect.Constructor; - import org.jetbrains.annotations.Nullable; import com.jozufozu.flywheel.api.backend.Backend; @@ -12,6 +10,8 @@ import com.jozufozu.flywheel.api.visualization.BlockEntityVisualizer; import com.jozufozu.flywheel.api.visualization.EntityVisualizer; import com.jozufozu.flywheel.api.visualization.VisualizationManager; +import com.jozufozu.flywheel.lib.transform.PoseTransformStack; +import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexFormat; import net.minecraft.world.entity.Entity; @@ -21,42 +21,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType; public interface InternalFlywheelApi { - InternalFlywheelApi INSTANCE = load(); - - // Adapted from https://github.com/CaffeineMC/sodium-fabric/blob/bf4fc9dab16e1cca07b2f23a1201c9bf237c8044/src/api/java/net/caffeinemc/mods/sodium/api/internal/DependencyInjection.java - private static InternalFlywheelApi load() { - Class apiClass = InternalFlywheelApi.class; - Class implClass; - - try { - implClass = Class.forName("com.jozufozu.flywheel.impl.InternalFlywheelImpl"); - } catch (ReflectiveOperationException e) { - throw new RuntimeException("Could not find implementation", e); - } - - if (!apiClass.isAssignableFrom(implClass)) { - throw new RuntimeException("Class %s does not implement interface %s" - .formatted(implClass.getName(), apiClass.getName())); - } - - Constructor implConstructor; - - try { - implConstructor = implClass.getConstructor(); - } catch (ReflectiveOperationException e) { - throw new RuntimeException("Could not find default constructor", e); - } - - Object implInstance; - - try { - implInstance = implConstructor.newInstance(); - } catch (ReflectiveOperationException e) { - throw new RuntimeException("Could not instantiate implementation", e); - } - - return apiClass.cast(implInstance); - } + InternalFlywheelApi INSTANCE = DependencyInjection.load(InternalFlywheelApi.class, "com.jozufozu.flywheel.impl.InternalFlywheelImpl"); Registry createRegistry(); @@ -92,4 +57,6 @@ private static InternalFlywheelApi load() { void setVisualizer(BlockEntityType type, BlockEntityVisualizer visualizer); void setVisualizer(EntityType type, EntityVisualizer visualizer); + + PoseTransformStack getPoseTransformStackOf(PoseStack stack); } diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java index 02e14a5da..ca5b4b6d6 100644 --- a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java +++ b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java @@ -92,9 +92,9 @@ private static long writeHeldLight(long ptr, LocalPlayer player) { for (InteractionHand hand : InteractionHand.values()) { Item handItem = player.getItemInHand(hand).getItem(); - if (handItem instanceof BlockItem bitem) { - Block block = bitem.getBlock(); - int blockLight = ClientPlatform.getInstance() + if (handItem instanceof BlockItem blockItem) { + Block block = blockItem.getBlock(); + int blockLight = ClientPlatform.INSTANCE .getLightEmission(block.defaultBlockState(), player.clientLevel, player.blockPosition()); if (heldLight < blockLight) { heldLight = blockLight; diff --git a/common/src/main/java/com/jozufozu/flywheel/config/FlwConfig.java b/common/src/main/java/com/jozufozu/flywheel/config/FlwConfig.java index 4ec3356aa..a6e751595 100644 --- a/common/src/main/java/com/jozufozu/flywheel/config/FlwConfig.java +++ b/common/src/main/java/com/jozufozu/flywheel/config/FlwConfig.java @@ -4,12 +4,12 @@ import com.jozufozu.flywheel.platform.ClientPlatform; public interface FlwConfig { - FlwConfig INSTANCE = ClientPlatform.getInstance().getConfigInstance(); + FlwConfig INSTANCE = ClientPlatform.INSTANCE.getConfigInstance(); static FlwConfig get() { return INSTANCE; } - Backend getBackend(); + Backend backend(); boolean limitUpdates(); diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java index 0f4d10f85..550d13003 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java @@ -1,5 +1,6 @@ package com.jozufozu.flywheel.impl; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import com.jozufozu.flywheel.Flywheel; @@ -44,8 +45,8 @@ private static Backend findDefaultBackend() { return Backends.INDIRECT; } - public static void chooseBackend() { - var preferred = FlwConfig.get().getBackend(); + private static void chooseBackend() { + var preferred = FlwConfig.get().backend(); var actual = preferred.findFallback(); if (preferred != actual) { @@ -65,4 +66,21 @@ public static String getBackendString() { public static void init() { } + + public static void onEndClientResourceReload(boolean didError) { + if (didError) { + return; + } + + chooseBackend(); + VisualizationManagerImpl.resetAll(); + } + + public static void onReloadLevelRenderer(@Nullable ClientLevel level) { + chooseBackend(); + + if (level != null) { + VisualizationManagerImpl.reset(level); + } + } } diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java index 4dd9829f0..c32738e52 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java @@ -111,4 +111,9 @@ public void setVisualizer(BlockEntityType type, Block public void setVisualizer(EntityType type, EntityVisualizer visualizer) { VisualizerRegistryImpl.setVisualizer(type, visualizer); } + + @Override + public PoseTransformStack getPoseTransformStackOf(PoseStack stack) { + return ((PoseStackExtension) stack).flywheel$transformStack(); + } } diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java index ff11b3bea..ea28763c3 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java @@ -51,7 +51,7 @@ abstract class LevelRendererMixin { private void flywheel$beginRender(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { flywheel$renderContext = RenderContextImpl.create((LevelRenderer) (Object) this, level, renderBuffers, poseStack, projectionMatrix, camera, partialTick); - ClientPlatform.getInstance().dispatchBeginFrame(flywheel$renderContext); + ClientPlatform.INSTANCE.dispatchBeginFrame(flywheel$renderContext); } @Inject(method = "renderLevel", at = @At("RETURN")) @@ -61,7 +61,7 @@ abstract class LevelRendererMixin { @Inject(method = "allChanged", at = @At("RETURN")) private void flywheel$refresh(CallbackInfo ci) { - ClientPlatform.getInstance().dispatchReloadLevelRenderer(level); + ClientPlatform.INSTANCE.dispatchReloadLevelRenderer(level); } @Inject(method = "renderLevel", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiling/ProfilerFiller;popPush(Ljava/lang/String;)V", args = "ldc=destroyProgress")) @@ -81,7 +81,7 @@ abstract class LevelRendererMixin { @Unique private void flywheel$dispatch(RenderStage stage) { if (flywheel$renderContext != null) { - ClientPlatform.getInstance().dispatchRenderStage(flywheel$renderContext, stage); + ClientPlatform.INSTANCE.dispatchRenderStage(flywheel$renderContext, stage); } } diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/internal/FlywheelLibPlatform.java b/common/src/main/java/com/jozufozu/flywheel/lib/internal/FlywheelLibPlatform.java deleted file mode 100644 index 9413c94b9..000000000 --- a/common/src/main/java/com/jozufozu/flywheel/lib/internal/FlywheelLibPlatform.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.jozufozu.flywheel.lib.internal; - -import java.lang.reflect.Constructor; - -import com.jozufozu.flywheel.lib.model.baked.BakedModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.BlockModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.MultiBlockModelBuilder; -import com.jozufozu.flywheel.lib.transform.PoseTransformStack; -import com.mojang.blaze3d.vertex.PoseStack; - -import net.minecraft.client.renderer.block.BlockRenderDispatcher; -import net.minecraft.client.resources.model.BakedModel; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.BlockAndTintGetter; -import net.minecraft.world.level.block.state.BlockState; - -public interface FlywheelLibPlatform { - FlywheelLibPlatform INSTANCE = load(); - - // Adapted from https://github.com/CaffeineMC/sodium-fabric/blob/bf4fc9dab16e1cca07b2f23a1201c9bf237c8044/src/api/java/net/caffeinemc/mods/sodium/api/internal/DependencyInjection.java - private static FlywheelLibPlatform load() { - Class apiClass = FlywheelLibPlatform.class; - Class implClass; - - try { - implClass = Class.forName("com.jozufozu.flywheel.impl.FlywheelLibPlatformImpl"); - } catch (ReflectiveOperationException e) { - throw new RuntimeException("Could not find implementation", e); - } - - if (!apiClass.isAssignableFrom(implClass)) { - throw new RuntimeException("Class %s does not implement interface %s" - .formatted(implClass.getName(), apiClass.getName())); - } - - Constructor implConstructor; - - try { - implConstructor = implClass.getConstructor(); - } catch (ReflectiveOperationException e) { - throw new RuntimeException("Could not find default constructor", e); - } - - Object implInstance; - - try { - implInstance = implConstructor.newInstance(); - } catch (ReflectiveOperationException e) { - throw new RuntimeException("Could not instantiate implementation", e); - } - - return apiClass.cast(implInstance); - } - - PoseTransformStack getPoseTransformStackOf(PoseStack stack); - - BlockRenderDispatcher createVanillaRenderer(); - - BakedModelBuilder bakedModelBuilder(BakedModel bakedModel); - - BlockModelBuilder blockModelBuilder(BlockState state); - - MultiBlockModelBuilder multiBlockModelBuilder(BlockAndTintGetter level, Iterable positions); -} diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/internal/package-info.java b/common/src/main/java/com/jozufozu/flywheel/lib/internal/package-info.java deleted file mode 100644 index b4efe3fa3..000000000 --- a/common/src/main/java/com/jozufozu/flywheel/lib/internal/package-info.java +++ /dev/null @@ -1,12 +0,0 @@ -@ApiStatus.Internal -@ParametersAreNonnullByDefault -@FieldsAreNonnullByDefault -@MethodsReturnNonnullByDefault -package com.jozufozu.flywheel.lib.internal; - -import javax.annotation.ParametersAreNonnullByDefault; - -import org.jetbrains.annotations.ApiStatus; - -import net.minecraft.FieldsAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java index 8a5797343..0eea8d801 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java @@ -8,7 +8,6 @@ import org.joml.Vector4f; import org.lwjgl.system.MemoryUtil; -import com.jozufozu.flywheel.lib.internal.FlywheelLibPlatform; import com.jozufozu.flywheel.api.material.Material; import com.jozufozu.flywheel.api.model.Mesh; import com.jozufozu.flywheel.api.model.Model; @@ -18,6 +17,7 @@ import com.jozufozu.flywheel.lib.material.Materials; import com.jozufozu.flywheel.lib.memory.MemoryBlock; import com.jozufozu.flywheel.lib.vertex.PosVertexView; +import com.jozufozu.flywheel.platform.ClientPlatform; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.BufferBuilder.DrawState; import com.mojang.blaze3d.vertex.VertexFormat; @@ -30,7 +30,7 @@ public final class ModelUtil { * An alternative BlockRenderDispatcher that circumvents the Forge rendering pipeline to ensure consistency. * Meant to be used for virtual rendering. */ - public static final BlockRenderDispatcher VANILLA_RENDERER = FlywheelLibPlatform.INSTANCE.createVanillaRenderer(); + public static final BlockRenderDispatcher VANILLA_RENDERER = ClientPlatform.INSTANCE.createVanillaRenderer(); private static final float BOUNDING_SPHERE_EPSILON = 1e-4f; private ModelUtil() { diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java index 238aedd9e..0eeb0c22b 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java @@ -4,23 +4,14 @@ import org.jetbrains.annotations.Nullable; -import com.google.common.collect.ImmutableList; import com.jozufozu.flywheel.api.material.Material; -import com.jozufozu.flywheel.api.model.Model; -import com.jozufozu.flywheel.api.vertex.VertexView; -import com.jozufozu.flywheel.lib.internal.FlywheelLibPlatform; -import com.jozufozu.flywheel.lib.memory.MemoryBlock; -import com.jozufozu.flywheel.lib.model.ModelUtil; -import com.jozufozu.flywheel.lib.model.SimpleMesh; import com.jozufozu.flywheel.lib.model.SimpleModel; -import com.jozufozu.flywheel.lib.model.baked.MeshEmitter.ResultConsumer; -import com.jozufozu.flywheel.lib.vertex.NoOverlayVertexView; +import com.jozufozu.flywheel.platform.ClientPlatform; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.world.level.BlockAndTintGetter; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; public abstract class BakedModelBuilder { @@ -35,7 +26,7 @@ public abstract class BakedModelBuilder { protected BiFunction materialFunc; public static BakedModelBuilder create(BakedModel bakedModel) { - return FlywheelLibPlatform.INSTANCE.bakedModelBuilder(bakedModel); + return ClientPlatform.INSTANCE.bakedModelBuilder(bakedModel); } protected BakedModelBuilder(BakedModel bakedModel) { diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java index 7058735d8..aeb1497b6 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java @@ -4,17 +4,9 @@ import org.jetbrains.annotations.Nullable; -import com.google.common.collect.ImmutableList; import com.jozufozu.flywheel.api.material.Material; -import com.jozufozu.flywheel.api.model.Model; -import com.jozufozu.flywheel.api.vertex.VertexView; -import com.jozufozu.flywheel.lib.internal.FlywheelLibPlatform; -import com.jozufozu.flywheel.lib.memory.MemoryBlock; -import com.jozufozu.flywheel.lib.model.ModelUtil; -import com.jozufozu.flywheel.lib.model.SimpleMesh; import com.jozufozu.flywheel.lib.model.SimpleModel; -import com.jozufozu.flywheel.lib.model.baked.MeshEmitter.ResultConsumer; -import com.jozufozu.flywheel.lib.vertex.NoOverlayVertexView; +import com.jozufozu.flywheel.platform.ClientPlatform; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.renderer.RenderType; @@ -31,7 +23,7 @@ public abstract class BlockModelBuilder { protected BiFunction materialFunc; public static BlockModelBuilder create(BlockState state) { - return FlywheelLibPlatform.INSTANCE.blockModelBuilder(state); + return ClientPlatform.INSTANCE.blockModelBuilder(state); } protected BlockModelBuilder(BlockState state) { diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java index 61d46ae95..2ad7a7b33 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java @@ -5,8 +5,8 @@ import org.jetbrains.annotations.Nullable; import com.jozufozu.flywheel.api.material.Material; -import com.jozufozu.flywheel.lib.internal.FlywheelLibPlatform; import com.jozufozu.flywheel.lib.model.SimpleModel; +import com.jozufozu.flywheel.platform.ClientPlatform; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.renderer.RenderType; @@ -23,7 +23,7 @@ public abstract class MultiBlockModelBuilder { protected BiFunction materialFunc; public static MultiBlockModelBuilder create(BlockAndTintGetter level, Iterable positions) { - return FlywheelLibPlatform.INSTANCE.multiBlockModelBuilder(level, positions); + return ClientPlatform.INSTANCE.multiBlockModelBuilder(level, positions); } protected MultiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java b/common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java index 2d2db3a3c..306972421 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java @@ -1,11 +1,11 @@ package com.jozufozu.flywheel.lib.transform; -import com.jozufozu.flywheel.lib.internal.FlywheelLibPlatform; +import com.jozufozu.flywheel.api.internal.InternalFlywheelApi; import com.mojang.blaze3d.vertex.PoseStack; public interface TransformStack> extends Transform { static PoseTransformStack of(PoseStack stack) { - return FlywheelLibPlatform.INSTANCE.getPoseTransformStackOf(stack); + return InternalFlywheelApi.INSTANCE.getPoseTransformStackOf(stack); } Self pushPose(); diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/util/LevelAttached.java b/common/src/main/java/com/jozufozu/flywheel/lib/util/LevelAttached.java index b3175f781..e8817d6e1 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/util/LevelAttached.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/util/LevelAttached.java @@ -7,8 +7,6 @@ import java.util.function.Consumer; import java.util.function.Function; -import org.jetbrains.annotations.ApiStatus; - import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java b/common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java index 49ca164fe..8e1de6f37 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java @@ -22,7 +22,7 @@ public final class ShadersModHandler { Package optifinePackage = Package.getPackage(OPTIFINE_ROOT_PACKAGE); IS_OPTIFINE_INSTALLED = optifinePackage != null; - var irisOculusHandler = ClientPlatform.getInstance() + var irisOculusHandler = ClientPlatform.INSTANCE .createIrisOculusHandlerIfPresent(); IS_IRIS_LOADED = irisOculusHandler != null; diff --git a/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java b/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java index 1fc1e41cf..ac61c5e52 100644 --- a/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java +++ b/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java @@ -1,48 +1,47 @@ package com.jozufozu.flywheel.platform; -import java.lang.reflect.InvocationTargetException; - import org.jetbrains.annotations.Nullable; import com.jozufozu.flywheel.api.event.RenderContext; import com.jozufozu.flywheel.api.event.RenderStage; +import com.jozufozu.flywheel.api.internal.DependencyInjection; import com.jozufozu.flywheel.config.FlwConfig; +import com.jozufozu.flywheel.lib.model.baked.BakedModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.BlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.MultiBlockModelBuilder; import com.jozufozu.flywheel.lib.util.ShadersModHandler; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.state.BlockState; -public abstract class ClientPlatform { - private static final ClientPlatform INSTANCE; +public interface ClientPlatform { + ClientPlatform INSTANCE = DependencyInjection.load(ClientPlatform.class, "com.jozufozu.flywheel.platform.ClientPlatformImpl"); - static { - try { - INSTANCE = - (ClientPlatform) Class.forName("com.jozufozu.flywheel.platform.ClientPlatformImpl").getConstructor() - .newInstance(); - } catch (ClassNotFoundException | InvocationTargetException | InstantiationException | IllegalAccessException | - NoSuchMethodException e) { - throw new RuntimeException(e); - } - } + void dispatchReloadLevelRenderer(ClientLevel level); - public static ClientPlatform getInstance() { - return INSTANCE; - } + void dispatchBeginFrame(RenderContext context); - public abstract void dispatchReloadLevelRenderer(ClientLevel level); + void dispatchRenderStage(RenderContext context, RenderStage stage); - public abstract void dispatchBeginFrame(RenderContext context); + boolean isModLoaded(String modid); - public abstract void dispatchRenderStage(RenderContext context, RenderStage stage); + @Nullable + ShadersModHandler.InternalHandler createIrisOculusHandlerIfPresent(); - public abstract boolean isModLoaded(String modid); + int getLightEmission(BlockState state, BlockGetter level, BlockPos pos); - @Nullable - public abstract ShadersModHandler.InternalHandler createIrisOculusHandlerIfPresent(); + FlwConfig getConfigInstance(); + + BlockRenderDispatcher createVanillaRenderer(); + + BakedModelBuilder bakedModelBuilder(BakedModel bakedModel); - public abstract int getLightEmission(BlockState state, ClientLevel level, BlockPos pos); + BlockModelBuilder blockModelBuilder(BlockState state); - public abstract FlwConfig getConfigInstance(); + MultiBlockModelBuilder multiBlockModelBuilder(BlockAndTintGetter level, Iterable positions); } diff --git a/fabric/build.gradle b/fabric/build.gradle index 86f8ea549..ec6a423a2 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,33 +1,18 @@ dependencies { - modCompileOnly "net.fabricmc:fabric-loader:$fabric_loader_version" - modLocalRuntime "net.fabricmc:fabric-loader:$fabric_loader_version" - - modCompileOnly "net.fabricmc.fabric-api:fabric-api:$fabric_api_version" - modLocalRuntime "net.fabricmc.fabric-api:fabric-api:$fabric_api_version" - compileOnly project(path: ':common', configuration: 'namedElements') - // switch to implementation for debugging - modCompileOnly "maven.modrinth:starlight:$starlight_version" + modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" + modApi "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}" - modCompileOnly "maven.modrinth:sodium:$sodium_version" - modCompileOnly "maven.modrinth:iris:$iris_version" + modCompileOnly "maven.modrinth:sodium:${sodium_version}" + modCompileOnly "maven.modrinth:iris:${iris_version}" } publishing { publications { register('mavenJava', MavenPublication) { - from(components["java"]) + from(components['java']) artifactId = "flywheel-${project.name}-intermediary-${artifact_minecraft_version}" } } - repositories { - maven { - url "file://${rootProject.projectDir}/mcmodsrepo" - } - - if (project.hasProperty('mavendir')) { - maven { url rootProject.file(property('mavendir')) } - } - } } diff --git a/fabric/gradle.properties b/fabric/gradle.properties new file mode 100644 index 000000000..6c5947614 --- /dev/null +++ b/fabric/gradle.properties @@ -0,0 +1 @@ +loom.platform = fabric diff --git a/fabric/src/main/java/com/jozufozu/flywheel/FlywheelFabric.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java similarity index 81% rename from fabric/src/main/java/com/jozufozu/flywheel/FlywheelFabric.java rename to fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java index b6353f97c..4e4c56eeb 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/FlywheelFabric.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java @@ -1,4 +1,4 @@ -package com.jozufozu.flywheel; +package com.jozufozu.flywheel.impl; import net.fabricmc.api.ClientModInitializer; diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java index b2021bdc1..0673915cb 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java @@ -4,12 +4,12 @@ import java.util.Set; import java.util.function.Supplier; -import com.google.common.base.Suppliers; - import org.objectweb.asm.tree.ClassNode; import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; import org.spongepowered.asm.mixin.extensibility.IMixinInfo; +import com.google.common.base.Suppliers; + import net.fabricmc.loader.api.FabricLoader; public class SodiumMixinPlugin implements IMixinConfigPlugin { diff --git a/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java b/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java index af277f9f9..372357310 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java @@ -8,15 +8,23 @@ import com.jozufozu.flywheel.api.event.RenderStage; import com.jozufozu.flywheel.api.event.RenderStageCallback; import com.jozufozu.flywheel.config.FlwConfig; +import com.jozufozu.flywheel.lib.model.baked.BakedModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.BlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.MultiBlockModelBuilder; import com.jozufozu.flywheel.lib.util.ShadersModHandler; import net.fabricmc.loader.api.FabricLoader; import net.irisshaders.iris.api.v0.IrisApi; +import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.state.BlockState; -public class ClientPlatformImpl extends ClientPlatform { +public class ClientPlatformImpl implements ClientPlatform { @Override public void dispatchReloadLevelRenderer(ClientLevel level) { ReloadLevelRendererCallback.EVENT.invoker().onReloadLevelRenderer(level); @@ -61,7 +69,7 @@ public boolean isRenderingShadowPass() { } @Override - public int getLightEmission(BlockState state, ClientLevel level, BlockPos pos) { + public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos) { return state.getLightEmission(); } @@ -70,4 +78,24 @@ public FlwConfig getConfigInstance() { // TODO: fabric config return null; } + + @Override + public BlockRenderDispatcher createVanillaRenderer() { + return Minecraft.getInstance().getBlockRenderer(); + } + + @Override + public BakedModelBuilder bakedModelBuilder(BakedModel bakedModel) { + return null; + } + + @Override + public BlockModelBuilder blockModelBuilder(BlockState state) { + return null; + } + + @Override + public MultiBlockModelBuilder multiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { + return null; + } } diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 9d1336191..35b681801 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -15,10 +15,10 @@ }, "license": "${mod_license}", "icon": "logo.png", - "environment": "*", + "environment": "client", "entrypoints": { "client": [ - "com.jozufozu.flywheel.FlywheelFabric" + "com.jozufozu.flywheel.impl.FlywheelFabric" ] }, "mixins": [ @@ -27,7 +27,10 @@ "flywheel.impl.sodium.mixins.json" ], "depends": { - "fabric": "*", - "minecraft": "${minecraft_version_range}" + "minecraft": "${minecraft_semver_version_range}", + "fabric-api": "${fabric_api_version_range}" + }, + "breaks": { + "sodium": "<0.5.0" } } diff --git a/forge/build.gradle b/forge/build.gradle index ca6f186e9..239e9ce34 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,9 +1,8 @@ -// Add some forge specific configurations loom { forge { - mixinConfig "flywheel.backend.mixins.json" - mixinConfig "flywheel.impl.mixins.json" - mixinConfig "flywheel.impl.sodium.mixins.json" + mixinConfig 'flywheel.backend.mixins.json' + mixinConfig 'flywheel.impl.mixins.json' + mixinConfig 'flywheel.impl.sodium.mixins.json' } runs { @@ -19,24 +18,15 @@ dependencies { compileOnly project(path: ':common', configuration: 'namedElements') - modCompileOnly "maven.modrinth:embeddium:$embeddium_version" - modCompileOnly "maven.modrinth:oculus:$oculus_version" + modCompileOnly "maven.modrinth:embeddium:${embeddium_version}" + modCompileOnly "maven.modrinth:oculus:${oculus_version}" } publishing { publications { register('mavenJava', MavenPublication) { - from(components["java"]) + from(components['java']) artifactId = "flywheel-${project.name}-intermediary-${artifact_minecraft_version}" } } - repositories { - maven { - url "file://${rootProject.projectDir}/mcmodsrepo" - } - - if (project.hasProperty('mavendir')) { - maven { url rootProject.file(property('mavendir')) } - } - } } diff --git a/forge/src/main/java/com/jozufozu/flywheel/config/FlwForgeConfig.java b/forge/src/main/java/com/jozufozu/flywheel/config/FlwForgeConfig.java index a83cf60fd..acce638f1 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/config/FlwForgeConfig.java +++ b/forge/src/main/java/com/jozufozu/flywheel/config/FlwForgeConfig.java @@ -27,7 +27,7 @@ private FlwForgeConfig() { clientSpec = clientPair.getRight(); } - public Backend getBackend() { + public Backend backend() { Backend backend = parseBackend(client.backend.get()); if (backend == null) { backend = BackendManager.getDefaultBackend(); diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/BackendEventHandler.java b/forge/src/main/java/com/jozufozu/flywheel/impl/BackendEventHandler.java deleted file mode 100644 index a8254b49d..000000000 --- a/forge/src/main/java/com/jozufozu/flywheel/impl/BackendEventHandler.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.jozufozu.flywheel.impl; - -import com.jozufozu.flywheel.api.event.EndClientResourceReloadEvent; -import com.jozufozu.flywheel.api.event.ReloadLevelRendererEvent; -import com.jozufozu.flywheel.impl.visualization.VisualizationManagerImpl; - -import net.minecraft.client.multiplayer.ClientLevel; - -public class BackendEventHandler { - public static void onEndClientResourceReload(EndClientResourceReloadEvent event) { - if (event.error() - .isPresent()) { - return; - } - - BackendManagerImpl.chooseBackend(); - VisualizationManagerImpl.resetAll(); - } - - public static void onReloadLevelRenderer(ReloadLevelRendererEvent event) { - BackendManagerImpl.chooseBackend(); - - ClientLevel level = event.level(); - if (level != null) { - VisualizationManagerImpl.reset(level); - } - } -} diff --git a/forge/src/main/java/com/jozufozu/flywheel/FlywheelForge.java b/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelForge.java similarity index 85% rename from forge/src/main/java/com/jozufozu/flywheel/FlywheelForge.java rename to forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelForge.java index 8905e734b..90c6cc49c 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/FlywheelForge.java +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelForge.java @@ -1,9 +1,10 @@ -package com.jozufozu.flywheel; +package com.jozufozu.flywheel.impl; import java.util.ArrayList; import org.apache.maven.artifact.versioning.ArtifactVersion; +import com.jozufozu.flywheel.Flywheel; import com.jozufozu.flywheel.api.event.EndClientResourceReloadEvent; import com.jozufozu.flywheel.api.event.ReloadLevelRendererEvent; import com.jozufozu.flywheel.api.visualization.VisualizationManager; @@ -13,8 +14,6 @@ import com.jozufozu.flywheel.config.FlwCommands; import com.jozufozu.flywheel.config.FlwConfig; import com.jozufozu.flywheel.config.FlwForgeConfig; -import com.jozufozu.flywheel.impl.BackendEventHandler; -import com.jozufozu.flywheel.impl.BackendManagerImpl; import com.jozufozu.flywheel.impl.visualization.VisualizationEventHandler; import com.jozufozu.flywheel.lib.memory.FlwMemoryTracker; import com.jozufozu.flywheel.lib.model.ModelCache; @@ -34,7 +33,6 @@ import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.CrashReportCallables; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fml.IExtensionPoint; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; @@ -64,18 +62,13 @@ public FlywheelForge() { FlwForgeConfig.INSTANCE.registerSpecs(modLoadingContext); - modLoadingContext.registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest( - () -> "any", - (serverVersion, isNetwork) -> true - )); - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> FlywheelForge.clientInit(forgeEventBus, modEventBus)); } private static void clientInit(IEventBus forgeEventBus, IEventBus modEventBus) { forgeEventBus.addListener(FlywheelForge::addDebugInfo); - forgeEventBus.addListener(BackendEventHandler::onReloadLevelRenderer); + forgeEventBus.addListener((ReloadLevelRendererEvent e) -> BackendManagerImpl.onReloadLevelRenderer(e.level())); forgeEventBus.addListener(VisualizationEventHandler::onClientTick); forgeEventBus.addListener(VisualizationEventHandler::onBeginFrame); @@ -85,7 +78,7 @@ private static void clientInit(IEventBus forgeEventBus, IEventBus modEventBus) { forgeEventBus.addListener(FlwCommands::registerClientCommands); - forgeEventBus.addListener($ -> Uniforms.onReloadLevelRenderer()); + forgeEventBus.addListener((EndClientResourceReloadEvent e) -> Uniforms.onReloadLevelRenderer()); forgeEventBus.addListener((LevelEvent.Unload e) -> LevelAttached.invalidateLevel(e.getLevel())); @@ -93,10 +86,10 @@ private static void clientInit(IEventBus forgeEventBus, IEventBus modEventBus) { modEventBus.addListener(FlywheelForge::onClientSetup); modEventBus.addListener(FlywheelForge::onLoadComplete); - modEventBus.addListener(BackendEventHandler::onEndClientResourceReload); + modEventBus.addListener((EndClientResourceReloadEvent e) -> BackendManagerImpl.onEndClientResourceReload(e.error().isPresent())); - modEventBus.addListener($ -> ModelCache.onEndClientResourceReload()); - modEventBus.addListener($ -> ModelHolder.onEndClientResourceReload()); + modEventBus.addListener((EndClientResourceReloadEvent e) -> ModelCache.onEndClientResourceReload()); + modEventBus.addListener((EndClientResourceReloadEvent e) -> ModelHolder.onEndClientResourceReload()); modEventBus.addListener(PartialModelEventHandler::onModelRegistry); modEventBus.addListener(PartialModelEventHandler::onModelBake); @@ -134,7 +127,7 @@ private static void addDebugInfo(CustomizeGuiOverlayEvent.DebugText event) { ArrayList info = event.getRight(); info.add(""); - info.add("Flywheel: " + getVersion()); + info.add("Flywheel: " + version); info.add("Backend: " + BackendManagerImpl.getBackendString()); info.add("Update limiting: " + (FlwConfig.get().limitUpdates() ? "on" : "off")); @@ -149,8 +142,4 @@ private static void addDebugInfo(CustomizeGuiOverlayEvent.DebugText event) { info.add("Memory Usage: CPU: " + StringUtil.formatBytes(FlwMemoryTracker.getCPUMemory()) + ", GPU: " + StringUtil.formatBytes(FlwMemoryTracker.getGPUMemory())); } - - public static ArtifactVersion getVersion() { - return version; - } } diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelLibPlatformImpl.java b/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelLibPlatformImpl.java deleted file mode 100644 index 547375265..000000000 --- a/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelLibPlatformImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.jozufozu.flywheel.impl; - -import java.lang.reflect.Field; - -import org.slf4j.Logger; - -import com.jozufozu.flywheel.impl.extension.PoseStackExtension; -import com.jozufozu.flywheel.lib.internal.FlywheelLibPlatform; -import com.jozufozu.flywheel.lib.model.baked.BakedModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.BlockModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.ForgeBakedModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.ForgeBlockModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.ForgeMultiBlockModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.MultiBlockModelBuilder; -import com.jozufozu.flywheel.lib.transform.PoseTransformStack; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.logging.LogUtils; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.block.BlockRenderDispatcher; -import net.minecraft.client.renderer.block.ModelBlockRenderer; -import net.minecraft.client.resources.model.BakedModel; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.BlockAndTintGetter; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.fml.util.ObfuscationReflectionHelper; - -public class FlywheelLibPlatformImpl implements FlywheelLibPlatform { - private static final Logger LOGGER = LogUtils.getLogger(); - - @Override - public PoseTransformStack getPoseTransformStackOf(PoseStack stack) { - return ((PoseStackExtension) stack).flywheel$transformStack(); - } - - @Override - public BlockRenderDispatcher createVanillaRenderer() { - BlockRenderDispatcher defaultDispatcher = Minecraft.getInstance().getBlockRenderer(); - BlockRenderDispatcher dispatcher = new BlockRenderDispatcher(null, null, null); - try { - for (Field field : BlockRenderDispatcher.class.getDeclaredFields()) { - field.setAccessible(true); - field.set(dispatcher, field.get(defaultDispatcher)); - } - ObfuscationReflectionHelper.setPrivateValue(BlockRenderDispatcher.class, dispatcher, new ModelBlockRenderer(Minecraft.getInstance().getBlockColors()), "f_110900_"); - } catch (Exception e) { - LOGGER.error("Failed to initialize vanilla BlockRenderDispatcher!", e); - return defaultDispatcher; - } - return dispatcher; - } - - @Override - public BakedModelBuilder bakedModelBuilder(BakedModel bakedModel) { - return new ForgeBakedModelBuilder(bakedModel); - } - - @Override - public BlockModelBuilder blockModelBuilder(BlockState state) { - return new ForgeBlockModelBuilder(state); - } - - @Override - public MultiBlockModelBuilder multiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { - return new ForgeMultiBlockModelBuilder(level, positions); - } -} diff --git a/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java b/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java index f82da2fc8..8c2ae01a0 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java +++ b/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java @@ -1,6 +1,9 @@ package com.jozufozu.flywheel.platform; +import java.lang.reflect.Field; + import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; import com.jozufozu.flywheel.api.event.BeginFrameEvent; import com.jozufozu.flywheel.api.event.ReloadLevelRendererEvent; @@ -9,16 +12,32 @@ import com.jozufozu.flywheel.api.event.RenderStageEvent; import com.jozufozu.flywheel.config.FlwConfig; import com.jozufozu.flywheel.config.FlwForgeConfig; +import com.jozufozu.flywheel.lib.model.baked.BakedModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.BlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.ForgeBakedModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.ForgeBlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.ForgeMultiBlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.MultiBlockModelBuilder; import com.jozufozu.flywheel.lib.util.ShadersModHandler; +import com.mojang.logging.LogUtils; import net.irisshaders.iris.api.v0.IrisApi; +import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.block.ModelBlockRenderer; +import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.ModList; +import net.minecraftforge.fml.util.ObfuscationReflectionHelper; + +public class ClientPlatformImpl implements ClientPlatform { + private static final Logger LOGGER = LogUtils.getLogger(); -public class ClientPlatformImpl extends ClientPlatform { @Override public void dispatchReloadLevelRenderer(ClientLevel level) { MinecraftForge.EVENT_BUS.post(new ReloadLevelRendererEvent(level)); @@ -40,8 +59,8 @@ public boolean isModLoaded(String modid) { .isLoaded(modid); } - @Nullable @Override + @Nullable public ShadersModHandler.InternalHandler createIrisOculusHandlerIfPresent() { if (isModLoaded("oculus")) { return new ShadersModHandler.InternalHandler() { @@ -63,7 +82,7 @@ public boolean isRenderingShadowPass() { } @Override - public int getLightEmission(BlockState state, ClientLevel level, BlockPos pos) { + public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos) { return state.getLightEmission(level, pos); } @@ -71,4 +90,36 @@ public int getLightEmission(BlockState state, ClientLevel level, BlockPos pos) { public FlwConfig getConfigInstance() { return FlwForgeConfig.INSTANCE; } + + @Override + public BlockRenderDispatcher createVanillaRenderer() { + BlockRenderDispatcher defaultDispatcher = Minecraft.getInstance().getBlockRenderer(); + BlockRenderDispatcher dispatcher = new BlockRenderDispatcher(null, null, null); + try { + for (Field field : BlockRenderDispatcher.class.getDeclaredFields()) { + field.setAccessible(true); + field.set(dispatcher, field.get(defaultDispatcher)); + } + ObfuscationReflectionHelper.setPrivateValue(BlockRenderDispatcher.class, dispatcher, new ModelBlockRenderer(Minecraft.getInstance().getBlockColors()), "f_110900_"); + } catch (Exception e) { + LOGGER.error("Failed to initialize vanilla BlockRenderDispatcher!", e); + return defaultDispatcher; + } + return dispatcher; + } + + @Override + public BakedModelBuilder bakedModelBuilder(BakedModel bakedModel) { + return new ForgeBakedModelBuilder(bakedModel); + } + + @Override + public BlockModelBuilder blockModelBuilder(BlockState state) { + return new ForgeBlockModelBuilder(state); + } + + @Override + public MultiBlockModelBuilder multiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { + return new ForgeMultiBlockModelBuilder(level, positions); + } } diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 6a20ac8da..2dc330582 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -1,36 +1,35 @@ modLoader = "javafml" -loaderVersion = "${loader_version_range}" -issueTrackerURL = "${mod_issues}" +# The loader version doesn't matter. Modify the Forge and/or Minecraft version ranges instead. +loaderVersion = "[0,)" license = "${mod_license}" +issueTrackerURL = "${mod_issues}" [[mods]] modId = "${mod_id}" version = "${mod_version}" displayName = "${mod_name}" +description = "${mod_description}" logoFile = "logo.png" -displayURL = "${mod_homepage}" authors = "Jozufozu, PepperCode1" -description = "${mod_description}" +displayURL = "${mod_homepage}" +displayTest = "IGNORE_ALL_VERSION" [[dependencies.${mod_id}]] -modId = "forge" +modId = "minecraft" mandatory = true -versionRange = "${forge_version_range}" -ordering = "NONE" +versionRange = "${minecraft_maven_version_range}" side = "CLIENT" [[dependencies.${mod_id}]] -modId = "minecraft" +modId = "forge" mandatory = true -versionRange = "${minecraft_version_range}" -ordering = "NONE" +versionRange = "${forge_version_range}" side = "CLIENT" [[dependencies.${mod_id}]] -modId = "rubidium" # This replicates a "breaks" dependency. # There's a mixin crash with Rubidium <0.7.0. +modId = "rubidium" mandatory = false versionRange = "[0.7.0,)" -ordering = "NONE" side = "CLIENT" diff --git a/common/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta similarity index 100% rename from common/src/main/resources/pack.mcmeta rename to forge/src/main/resources/pack.mcmeta diff --git a/gradle.properties b/gradle.properties index 2bf7a0f10..b39b08802 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,42 +1,44 @@ org.gradle.jvmargs = -Xmx3G org.gradle.daemon = false -# General mod metadata +# Mod metadata mod_id = flywheel mod_name = Flywheel -mod_license = MIT +mod_version = 1.0.0-alpha mod_description = An overhauled entity and block entity rendering API. - +mod_license = MIT mod_sources = https://github.com/Jozufozu/Flywheel mod_issues = https://github.com/Jozufozu/Flywheel/issues mod_homepage = https://github.com/Jozufozu/Flywheel -# Mod version info -mod_version = 1.0.0-alpha -artifact_minecraft_version = 1.20.1 -minecraft_version = 1.20.1 -forge_version = 47.2.19 -fabric_loader_version = 0.15.9 -fabric_api_version = 0.92.1+1.20.1 - -# Version ranges for the mods.toml -minecraft_version_range = [1.20.1,1.20.2) -forge_version_range = [47,) -loader_version_range = [47,) +# Mod dependency declarations +minecraft_semver_version_range = >=1.20.1 <1.20.2 +minecraft_maven_version_range = [1.20.1,1.20.2) +fabric_api_version_range = >=0.84.0 +forge_version_range = [47.0.0,) -# Build dependency versions +# General build dependency versions java_version = 17 arch_loom_version = 1.6-SNAPSHOT -forgegradle_version = [6.0.16,6.2) -mixingradle_version = 0.7.+ -mixin_version = 0.8.5 -librarian_version = 1.+ cursegradle_version = 1.4.0 parchment_version = 2023.09.03 -# dependency mod versions -embeddium_version = 0.3.9+mc1.20.1 -oculus_version = 1.20.1-1.6.15a +# Minecraft build dependency versions +minecraft_version = 1.20.1 +forge_version = 47.2.19 +fabric_loader_version = 0.15.9 +fabric_api_version = 0.92.1+1.20.1 + +# Build dependency mod versions sodium_version = mc1.20.1-0.5.8 iris_version = 1.6.17+1.20.1 -starlight_version = 1.1.2+1.20 +embeddium_version = 0.3.9+mc1.20.1 +oculus_version = 1.20.1-1.6.15a + +# Publication info +artifact_minecraft_version = 1.20.1 + +#forgegradle_version = [6.0.16,6.2) +#mixingradle_version = 0.7.+ +#mixin_version = 0.8.5 +#librarian_version = 1.+ diff --git a/settings.gradle b/settings.gradle index db8285a90..bbbca7a35 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,6 +13,7 @@ pluginManagement { maven { url = 'https://repo.spongepowered.org/repository/maven-public' } maven { url = 'https://maven.parchmentmc.org' } } + plugins { id 'dev.architectury.loom' version arch_loom_version } From 77c21813187064b60359c9097d77f26a42a01217 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Mon, 22 Apr 2024 11:51:28 -0700 Subject: [PATCH 17/62] Graidiomatic - Move common build script stuff to buildSrc - Set ideaSyncTask finalizedBy generatePackageInfos directly in package-infos.gradle - Enable loom multiproject optimization, though not sure if it makes a difference for us yet --- build.gradle | 224 +--------------------- buildSrc/build.gradle | 2 + {gradle => buildSrc}/package-infos.gradle | 4 + buildSrc/platforms.gradle | 67 +++++++ buildSrc/simple-java.gradle | 58 ++++++ buildSrc/subprojects.gradle | 72 +++++++ common/build.gradle | 11 ++ fabric/build.gradle | 12 ++ forge/build.gradle | 12 ++ gradle.properties | 1 + 10 files changed, 243 insertions(+), 220 deletions(-) create mode 100644 buildSrc/build.gradle rename {gradle => buildSrc}/package-infos.gradle (96%) create mode 100644 buildSrc/platforms.gradle create mode 100644 buildSrc/simple-java.gradle create mode 100644 buildSrc/subprojects.gradle diff --git a/build.gradle b/build.gradle index 2a823f262..9f9460aad 100644 --- a/build.gradle +++ b/build.gradle @@ -1,229 +1,13 @@ plugins { id 'idea' - // make sure gradle loads the same arch plugin across all subprojects + id 'java' + id 'maven-publish' id 'dev.architectury.loom' apply false } -println("Java: ${System.getProperty('java.version')}, JVM: ${System.getProperty('java.vm.version')} (${System.getProperty('java.vendor')}), Arch: ${System.getProperty('os.arch')}") - -allprojects { - // Need to setup the java plugin for all projects so that our subprojects can find an output directory - apply plugin: 'java' - apply plugin: 'maven-publish' - - boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false') - String buildNumber = System.getenv('BUILD_NUMBER') - - group = 'com.jozufozu.flywheel' - version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') - - base { - archivesName = "flywheel-${name}-${artifact_minecraft_version}" - } - - java { - JavaVersion javaVersion = JavaVersion.toVersion(java_version) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - - toolchain.languageVersion = JavaLanguageVersion.of(java_version) - - withSourcesJar() - withJavadocJar() - } - - // make builds reproducible - tasks.withType(AbstractArchiveTask).configureEach { - preserveFileTimestamps = false - reproducibleFileOrder = true - } - - // module metadata is often broken on multi-platform projects - tasks.withType(GenerateModuleMetadata).configureEach { - enabled = false - } - - tasks.withType(JavaCompile).configureEach { JavaCompile javaCompile -> - javaCompile.options.encoding = 'UTF-8' - javaCompile.options.release = Integer.parseInt(java_version) - javaCompile.options.compilerArgs = ['-Xdiags:verbose'] - } - - tasks.named('jar', Jar).configure { Jar jar -> - archiveClassifier = '' - addLicense(jar) - } - - tasks.named('sourcesJar', Jar).configure { Jar jar -> - addLicense(jar) - } - - tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> - javadoc.source sourceSets.main.allJava - // prevent java 8's strict doclint for javadocs from failing builds - javadoc.options.addStringOption('Xdoclint:none', '-quiet') - } -} - -subprojects { - apply plugin: 'dev.architectury.loom' - - loom { - silentMojangMappingsLicense() - } - - repositories { - mavenCentral() - maven { - name = 'ParchmentMC' - url = 'https://maven.parchmentmc.org' - } - maven { - name 'tterrag maven' - url 'https://maven.tterrag.com/' - } - maven { - url 'https://www.cursemaven.com' - content { - includeGroup "curse.maven" - } - } - maven { - name = "Modrinth" - url = "https://api.modrinth.com/maven" - content { - includeGroup "maven.modrinth" - } - } - } - - dependencies { - minecraft "com.mojang:minecraft:${minecraft_version}" - mappings(loom.layered() { - officialMojangMappings() - parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") - }) - - api 'com.google.code.findbugs:jsr305:3.0.2' - } +apply from: rootProject.file('buildSrc/simple-java.gradle') - processResources { - var replaceProperties = [ - mod_id : mod_id, - mod_name : mod_name, - mod_description : mod_description, - mod_license : mod_license, - mod_sources : mod_sources, - mod_issues : mod_issues, - mod_homepage : mod_homepage, - mod_version : mod_version, - minecraft_semver_version_range: minecraft_semver_version_range, - minecraft_maven_version_range : minecraft_maven_version_range, - fabric_api_version_range : fabric_api_version_range, - forge_version_range : forge_version_range, - ] - inputs.properties replaceProperties - - filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml']) { - expand replaceProperties - } - } - - publishing { - repositories { - maven { - url "file://${rootProject.projectDir}/mcmodsrepo" - } - - if (project.hasProperty('mavendir')) { - maven { url rootProject.file(property('mavendir')) } - } - } - } - - apply from: rootProject.file('gradle/package-infos.gradle') - - ideaSyncTask.finalizedBy(generatePackageInfos) -} - -// Common configuration for platform dependent subprojects. -for (final String subprojectName in [':fabric', ':forge']) { - project(subprojectName) { - evaluationDependsOn(':common') - - loom { - runs { - client { - ideConfigGenerated true - - // Turn on our own debug flags - property 'flw.dumpShaderSource', 'true' - property 'flw.debugMemorySafety', 'true' - - // Turn on mixin debug flags - property 'mixin.debug.export', 'true' - property 'mixin.debug.verbose', 'true' - - // 720p baby! - programArgs '--width', '1280', '--height', '720' - } - - // We're a client mod, but we need to make sure we correctly render when playing on a server. - server { - ideConfigGenerated true - programArgs '--nogui' - } - } - } - - tasks.named('processResources', ProcessResources).configure { ProcessResources processResources -> - processResources.from project(':common').tasks.named('processResources', ProcessResources).get().source - } - - tasks.named('compileJava', JavaCompile).configure { JavaCompile compileJava -> - compileJava.source project(':common').tasks.named('compileJava', JavaCompile).get().source - excludeDuplicatePackageInfos(compileJava) - } - - tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> - javadoc.source project(':common').tasks.named('javadoc', Javadoc).get().source - excludeDuplicatePackageInfos(javadoc) - } - - tasks.named('jar', Jar).configure { Jar jar -> - excludeDuplicatePackageInfos(jar) - } - - tasks.named('sourcesJar', Jar).configure { Jar jar -> - def commonSources = project(':common').tasks.named('sourcesJar', Jar) - dependsOn commonSources - jar.from zipTree(commonSources.flatMap { it.archiveFile }) - - excludeDuplicatePackageInfos(jar) - } - } -} - -static void addLicense(Jar jarTask) { - jarTask.from('LICENSE.md') { - rename '(.*)\\.(.*)', '$1_' + jarTask.archiveBaseName + '.$2' - } -} - -// We have duplicate packages between the common and platform dependent subprojects. -// In theory the package-info.java files should be identical, so just take the first one we find. -static void excludeDuplicatePackageInfos(AbstractCopyTask copyTask) { - copyTask.filesMatching('**/package-info.java') { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - } -} - -// The compile/javadoc tasks have a different base type that isn't so smart about exclusion handling. -static void excludeDuplicatePackageInfos(SourceTask sourceTask) { - // FIXME: actually scan the files and exclude the duplicates - // may be tough because the files have absolute paths - sourceTask.exclude('**/package-info.java') -} +println("Java: ${System.getProperty('java.version')}, JVM: ${System.getProperty('java.vm.version')} (${System.getProperty('java.vendor')}), Arch: ${System.getProperty('os.arch')}") idea { // Tell IDEA to always download sources/javadoc artifacts from maven. diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 000000000..a42435e5e --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,2 @@ + +// TODO: port stuff to convention plugins diff --git a/gradle/package-infos.gradle b/buildSrc/package-infos.gradle similarity index 96% rename from gradle/package-infos.gradle rename to buildSrc/package-infos.gradle index b6877b240..1fd334292 100644 --- a/gradle/package-infos.gradle +++ b/buildSrc/package-infos.gradle @@ -20,6 +20,10 @@ def setupGeneratePackageInfos(SourceSet sourceSet) { } sourceSet.java.srcDir task + tasks.named('ideaSyncTask').configure { + finalizedBy task + } + def cleanTask = tasks.register(sourceSet.getTaskName('clean', 'PackageInfos'), Delete) { group = 'flywheel' delete file("src/$sourceSetName/generatedPackageInfos") diff --git a/buildSrc/platforms.gradle b/buildSrc/platforms.gradle new file mode 100644 index 000000000..f8200edaf --- /dev/null +++ b/buildSrc/platforms.gradle @@ -0,0 +1,67 @@ +evaluationDependsOn(':common') + +loom { + runs { + client { + ideConfigGenerated true + + // Turn on our own debug flags + property 'flw.dumpShaderSource', 'true' + property 'flw.debugMemorySafety', 'true' + + // Turn on mixin debug flags + property 'mixin.debug.export', 'true' + property 'mixin.debug.verbose', 'true' + + // 720p baby! + programArgs '--width', '1280', '--height', '720' + } + + // We're a client mod, but we need to make sure we correctly render when playing on a server. + server { + ideConfigGenerated true + programArgs '--nogui' + } + } +} + +tasks.named('processResources', ProcessResources).configure { ProcessResources processResources -> + processResources.from project(':common').tasks.named('processResources', ProcessResources).get().source +} + +tasks.named('compileJava', JavaCompile).configure { JavaCompile compileJava -> + compileJava.source project(':common').tasks.named('compileJava', JavaCompile).get().source + excludeDuplicatePackageInfos(compileJava) +} + +tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> + javadoc.source project(':common').tasks.named('javadoc', Javadoc).get().source + excludeDuplicatePackageInfos(javadoc) +} + +tasks.named('jar', Jar).configure { Jar jar -> + excludeDuplicatePackageInfos(jar) +} + +tasks.named('sourcesJar', Jar).configure { Jar jar -> + def commonSources = project(':common').tasks.named('sourcesJar', Jar) + dependsOn commonSources + jar.from zipTree(commonSources.flatMap { it.archiveFile }) + + excludeDuplicatePackageInfos(jar) +} + +// We have duplicate packages between the common and platform dependent subprojects. +// In theory the package-info.java files should be identical, so just take the first one we find. +static void excludeDuplicatePackageInfos(AbstractCopyTask copyTask) { + copyTask.filesMatching('**/package-info.java') { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } +} + +// The compile/javadoc tasks have a different base type that isn't so smart about exclusion handling. +static void excludeDuplicatePackageInfos(SourceTask sourceTask) { + // FIXME: actually scan the files and exclude the duplicates + // may be tough because the files have absolute paths + sourceTask.exclude('**/package-info.java') +} diff --git a/buildSrc/simple-java.gradle b/buildSrc/simple-java.gradle new file mode 100644 index 000000000..3c74a001a --- /dev/null +++ b/buildSrc/simple-java.gradle @@ -0,0 +1,58 @@ +boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false') +String buildNumber = System.getenv('BUILD_NUMBER') + +group = 'com.jozufozu.flywheel' +version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') + +base { + archivesName = "flywheel-${name}-${artifact_minecraft_version}" +} + +java { + JavaVersion javaVersion = JavaVersion.toVersion(java_version) + sourceCompatibility = javaVersion + targetCompatibility = javaVersion + + toolchain.languageVersion = JavaLanguageVersion.of(java_version) + + withSourcesJar() + withJavadocJar() +} + +// make builds reproducible +tasks.withType(AbstractArchiveTask).configureEach { + preserveFileTimestamps = false + reproducibleFileOrder = true +} + +// module metadata is often broken on multi-platform projects +tasks.withType(GenerateModuleMetadata).configureEach { + enabled = false +} + +tasks.withType(JavaCompile).configureEach { JavaCompile javaCompile -> + javaCompile.options.encoding = 'UTF-8' + javaCompile.options.release = Integer.parseInt(java_version) + javaCompile.options.compilerArgs = ['-Xdiags:verbose'] +} + +tasks.named('jar', Jar).configure { Jar jar -> + archiveClassifier = '' + addLicense(jar) +} + +tasks.named('sourcesJar', Jar).configure { Jar jar -> + addLicense(jar) +} + +tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> + javadoc.source sourceSets.main.allJava + // prevent java 8's strict doclint for javadocs from failing builds + javadoc.options.addStringOption('Xdoclint:none', '-quiet') +} + +static void addLicense(Jar jarTask) { + jarTask.from('LICENSE.md') { + rename '(.*)\\.(.*)', '$1_' + jarTask.archiveBaseName + '.$2' + } +} diff --git a/buildSrc/subprojects.gradle b/buildSrc/subprojects.gradle new file mode 100644 index 000000000..967b3d6c4 --- /dev/null +++ b/buildSrc/subprojects.gradle @@ -0,0 +1,72 @@ +loom { + silentMojangMappingsLicense() +} + +repositories { + mavenCentral() + maven { + name = 'ParchmentMC' + url = 'https://maven.parchmentmc.org' + } + maven { + name 'tterrag maven' + url 'https://maven.tterrag.com/' + } + maven { + url 'https://www.cursemaven.com' + content { + includeGroup "curse.maven" + } + } + maven { + name = "Modrinth" + url = "https://api.modrinth.com/maven" + content { + includeGroup "maven.modrinth" + } + } +} + +dependencies { + minecraft "com.mojang:minecraft:${minecraft_version}" + mappings(loom.layered() { + officialMojangMappings() + parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") + }) + + api 'com.google.code.findbugs:jsr305:3.0.2' +} + +processResources { + var replaceProperties = [ + mod_id : mod_id, + mod_name : mod_name, + mod_description : mod_description, + mod_license : mod_license, + mod_sources : mod_sources, + mod_issues : mod_issues, + mod_homepage : mod_homepage, + mod_version : mod_version, + minecraft_semver_version_range: minecraft_semver_version_range, + minecraft_maven_version_range : minecraft_maven_version_range, + fabric_api_version_range : fabric_api_version_range, + forge_version_range : forge_version_range, + ] + inputs.properties replaceProperties + + filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml']) { + expand replaceProperties + } +} + +publishing { + repositories { + maven { + url "file://${rootProject.projectDir}/mcmodsrepo" + } + + if (project.hasProperty('mavendir')) { + maven { url rootProject.file(property('mavendir')) } + } + } +} diff --git a/common/build.gradle b/common/build.gradle index 9b27890cf..076a9c801 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,3 +1,14 @@ +plugins { + id 'idea' + id 'java' + id 'maven-publish' + id 'dev.architectury.loom' +} + +apply from: rootProject.file('buildSrc/simple-java.gradle') +apply from: rootProject.file('buildSrc/subprojects.gradle') +apply from: rootProject.file('buildSrc/package-infos.gradle') + dependencies { modCompileOnly "net.fabricmc:fabric-loader:${fabric_loader_version}" diff --git a/fabric/build.gradle b/fabric/build.gradle index ec6a423a2..f04a6c6ad 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,3 +1,15 @@ +plugins { + id 'idea' + id 'java' + id 'maven-publish' + id 'dev.architectury.loom' +} + +apply from: rootProject.file('buildSrc/simple-java.gradle') +apply from: rootProject.file('buildSrc/subprojects.gradle') +apply from: rootProject.file('buildSrc/platforms.gradle') +apply from: rootProject.file('buildSrc/package-infos.gradle') + dependencies { compileOnly project(path: ':common', configuration: 'namedElements') diff --git a/forge/build.gradle b/forge/build.gradle index 239e9ce34..e33ef4ae1 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,3 +1,15 @@ +plugins { + id 'idea' + id 'java' + id 'maven-publish' + id 'dev.architectury.loom' +} + +apply from: rootProject.file('buildSrc/simple-java.gradle') +apply from: rootProject.file('buildSrc/subprojects.gradle') +apply from: rootProject.file('buildSrc/platforms.gradle') +apply from: rootProject.file('buildSrc/package-infos.gradle') + loom { forge { mixinConfig 'flywheel.backend.mixins.json' diff --git a/gradle.properties b/gradle.properties index b39b08802..04eec2432 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,6 @@ org.gradle.jvmargs = -Xmx3G org.gradle.daemon = false +fabric.loom.multiProjectOptimisation=true # Mod metadata mod_id = flywheel From 543f759feee4b07f66be2f2bcddf90462d010409 Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Mon, 22 Apr 2024 15:36:45 -0700 Subject: [PATCH 18/62] Most of Fabric - Organize almost all remaining code into one of four modules - Fix some incorrect inter-module dependencies - Get Fabric into a working state - The config, client commands, and model builders are still missing and registry freezing happens too late --- .../java/com/jozufozu/flywheel/Flywheel.java | 41 +----- .../flywheel/api/backend/Backend.java | 4 +- .../flywheel/api/backend/BackendManager.java | 10 +- .../flywheel/api/instance/InstanceType.java | 4 +- .../api/internal/DependencyInjection.java | 6 +- ...ternalFlywheelApi.java => FlwApiLink.java} | 8 +- .../flywheel/api/layout/LayoutBuilder.java | 4 +- .../flywheel/api/material/CutoutShader.java | 4 +- .../flywheel/api/material/FogShader.java | 4 +- .../api/material/MaterialShaders.java | 4 +- .../vertex/VertexViewProviderRegistry.java | 6 +- .../visualization/VisualizationManager.java | 8 +- .../api/visualization/VisualizerRegistry.java | 10 +- .../flywheel/backend/FlwBackendXplat.java | 13 ++ .../flywheel/backend/compile/FlwPrograms.java | 15 +- .../compile}/LayoutInterpreter.java | 2 +- .../component/InstanceAssemblerComponent.java | 2 +- .../component/InstanceStructComponent.java | 2 +- .../engine/uniform}/DebugMode.java | 2 +- .../backend/engine/uniform/FrameUniforms.java | 1 - .../engine/uniform/PlayerUniforms.java | 4 +- .../jozufozu/flywheel/config/FlwConfig.java | 17 --- .../{config => impl}/BackendArgument.java | 2 +- .../flywheel/impl/BackendManagerImpl.java | 3 +- ...lFlywheelImpl.java => FlwApiLinkImpl.java} | 12 +- .../com/jozufozu/flywheel/impl/FlwConfig.java | 13 ++ .../jozufozu/flywheel/impl/FlwDebugInfo.java | 37 +++++ .../jozufozu/flywheel/impl/FlwImplXplat.java | 23 ++++ .../flywheel/impl/FlwLibLinkImpl.java | 13 ++ .../jozufozu/flywheel/impl/FlywheelInit.java | 41 ++++++ .../impl/mixin/LevelRendererMixin.java | 19 ++- .../flywheel/impl/task/FlwTaskExecutor.java | 4 +- .../VisualizationEventHandler.java | 67 +++++++++ .../VisualizationManagerImpl.java | 4 +- .../flywheel/lib/internal/FlwLibLink.java | 11 ++ .../flywheel/lib/internal/FlwLibXplat.java | 30 ++++ .../flywheel/lib/internal/package-info.java | 12 ++ .../flywheel/lib/model/ModelCache.java | 5 +- .../flywheel/lib/model/ModelHolder.java | 5 +- .../flywheel/lib/model/ModelUtil.java | 4 +- .../lib/model/baked/BakedModelBuilder.java | 4 +- .../lib/model/baked/BlockModelBuilder.java | 4 +- .../model/baked/MultiBlockModelBuilder.java | 4 +- .../lib/model/baked/PartialModel.java | 29 ++-- .../lib/transform/TransformStack.java | 4 +- .../flywheel/lib/util/ShadersModHandler.java | 40 +++--- .../visual/SimpleBlockEntityVisualizer.java | 4 + .../lib/visual/SimpleEntityVisualizer.java | 4 + .../flywheel/platform/ClientPlatform.java | 47 ------- .../event/ReloadLevelRendererCallback.java | 4 +- .../flywheel/backend/FlwBackendXplatImpl.java | 12 ++ .../backend/compile/FlwProgramsReloader.java | 26 ++++ .../flywheel/impl/FabricFlwConfig.java | 24 ++++ .../flywheel/impl/FlwImplXplatImpl.java | 38 ++++++ .../flywheel/impl/FlwLibXplatImpl.java | 63 +++++++++ .../flywheel/impl/FlywheelFabric.java | 86 +++++++++++- .../mixin/fabric/DebugScreenOverlayMixin.java | 27 ++++ .../impl/mixin/fabric/MinecraftMixin.java | 32 +++++ .../impl/mixin/fabric/SystemReportMixin.java | 19 +++ .../model/baked/PartialModelEventHandler.java | 56 ++++++++ .../flywheel/platform/ClientPlatformImpl.java | 101 -------------- fabric/src/main/resources/fabric.mod.json | 3 +- .../flywheel.impl.fabric.mixins.json | 15 ++ .../flywheel/backend/FlwBackendXplatImpl.java | 12 ++ .../backend/compile/FlwProgramsReloader.java | 16 +++ .../{config => impl}/FlwCommands.java | 5 +- .../flywheel/impl/FlwImplXplatImpl.java | 39 ++++++ .../flywheel/impl/FlwLibXplatImpl.java | 86 ++++++++++++ .../jozufozu/flywheel/impl/FlywheelForge.java | 128 ++++++++---------- .../ForgeFlwConfig.java} | 11 +- .../VisualizationEventHandler.java | 80 ----------- .../model/baked/PartialModelEventHandler.java | 21 ++- .../flywheel/platform/ClientPlatformImpl.java | 125 ----------------- gradle.properties | 2 +- 74 files changed, 1027 insertions(+), 620 deletions(-) rename common/src/main/java/com/jozufozu/flywheel/api/internal/{InternalFlywheelApi.java => FlwApiLink.java} (84%) create mode 100644 common/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplat.java rename common/src/main/java/com/jozufozu/flywheel/{impl/layout => backend/compile}/LayoutInterpreter.java (97%) rename common/src/main/java/com/jozufozu/flywheel/{config => backend/engine/uniform}/DebugMode.java (68%) delete mode 100644 common/src/main/java/com/jozufozu/flywheel/config/FlwConfig.java rename common/src/main/java/com/jozufozu/flywheel/{config => impl}/BackendArgument.java (98%) rename common/src/main/java/com/jozufozu/flywheel/impl/{InternalFlywheelImpl.java => FlwApiLinkImpl.java} (88%) create mode 100644 common/src/main/java/com/jozufozu/flywheel/impl/FlwConfig.java create mode 100644 common/src/main/java/com/jozufozu/flywheel/impl/FlwDebugInfo.java create mode 100644 common/src/main/java/com/jozufozu/flywheel/impl/FlwImplXplat.java create mode 100644 common/src/main/java/com/jozufozu/flywheel/impl/FlwLibLinkImpl.java create mode 100644 common/src/main/java/com/jozufozu/flywheel/impl/FlywheelInit.java create mode 100644 common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java create mode 100644 common/src/main/java/com/jozufozu/flywheel/lib/internal/FlwLibLink.java create mode 100644 common/src/main/java/com/jozufozu/flywheel/lib/internal/FlwLibXplat.java create mode 100644 common/src/main/java/com/jozufozu/flywheel/lib/internal/package-info.java delete mode 100644 common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/impl/FlwImplXplatImpl.java create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/fabric/DebugScreenOverlayMixin.java create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/fabric/MinecraftMixin.java create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/fabric/SystemReportMixin.java create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java delete mode 100644 fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java create mode 100644 fabric/src/main/resources/flywheel.impl.fabric.mixins.json create mode 100644 forge/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java create mode 100644 forge/src/main/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java rename forge/src/main/java/com/jozufozu/flywheel/{config => impl}/FlwCommands.java (97%) create mode 100644 forge/src/main/java/com/jozufozu/flywheel/impl/FlwImplXplatImpl.java create mode 100644 forge/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java rename forge/src/main/java/com/jozufozu/flywheel/{config/FlwForgeConfig.java => impl/ForgeFlwConfig.java} (92%) delete mode 100644 forge/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java delete mode 100644 forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java diff --git a/common/src/main/java/com/jozufozu/flywheel/Flywheel.java b/common/src/main/java/com/jozufozu/flywheel/Flywheel.java index 173ec41b7..857125674 100644 --- a/common/src/main/java/com/jozufozu/flywheel/Flywheel.java +++ b/common/src/main/java/com/jozufozu/flywheel/Flywheel.java @@ -3,49 +3,16 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.jozufozu.flywheel.backend.Backends; -import com.jozufozu.flywheel.backend.ShaderIndices; -import com.jozufozu.flywheel.impl.BackendManagerImpl; -import com.jozufozu.flywheel.impl.registry.IdRegistryImpl; -import com.jozufozu.flywheel.impl.registry.RegistryImpl; -import com.jozufozu.flywheel.lib.instance.InstanceTypes; -import com.jozufozu.flywheel.lib.material.CutoutShaders; -import com.jozufozu.flywheel.lib.material.FogShaders; -import com.jozufozu.flywheel.lib.material.StandardMaterialShaders; -import com.jozufozu.flywheel.lib.util.ShadersModHandler; -import com.jozufozu.flywheel.vanilla.VanillaVisuals; - import net.minecraft.resources.ResourceLocation; -public class Flywheel { +public final class Flywheel { public static final String ID = "flywheel"; public static final Logger LOGGER = LoggerFactory.getLogger(ID); - public static ResourceLocation rl(String path) { - return new ResourceLocation(ID, path); - } - - public static void earlyInit() { - BackendManagerImpl.init(); - - ShadersModHandler.init(); - - Backends.init(); + private Flywheel() { } - public static void init() { - InstanceTypes.init(); - CutoutShaders.init(); - FogShaders.init(); - StandardMaterialShaders.init(); - - ShaderIndices.init(); - - VanillaVisuals.init(); - } - - public static void freeze() { - RegistryImpl.freezeAll(); - IdRegistryImpl.freezeAll(); + public static ResourceLocation rl(String path) { + return new ResourceLocation(ID, path); } } diff --git a/common/src/main/java/com/jozufozu/flywheel/api/backend/Backend.java b/common/src/main/java/com/jozufozu/flywheel/api/backend/Backend.java index 0d229152e..0c6e8ae40 100644 --- a/common/src/main/java/com/jozufozu/flywheel/api/backend/Backend.java +++ b/common/src/main/java/com/jozufozu/flywheel/api/backend/Backend.java @@ -1,14 +1,14 @@ package com.jozufozu.flywheel.api.backend; import com.jozufozu.flywheel.api.BackendImplemented; -import com.jozufozu.flywheel.api.internal.InternalFlywheelApi; +import com.jozufozu.flywheel.api.internal.FlwApiLink; import com.jozufozu.flywheel.api.registry.IdRegistry; import net.minecraft.world.level.LevelAccessor; @BackendImplemented public interface Backend { - static IdRegistry REGISTRY = InternalFlywheelApi.INSTANCE.createIdRegistry(); + static IdRegistry REGISTRY = FlwApiLink.INSTANCE.createIdRegistry(); /** * Create a new engine instance. diff --git a/common/src/main/java/com/jozufozu/flywheel/api/backend/BackendManager.java b/common/src/main/java/com/jozufozu/flywheel/api/backend/BackendManager.java index bf6e7d751..02eb06020 100644 --- a/common/src/main/java/com/jozufozu/flywheel/api/backend/BackendManager.java +++ b/common/src/main/java/com/jozufozu/flywheel/api/backend/BackendManager.java @@ -1,6 +1,6 @@ package com.jozufozu.flywheel.api.backend; -import com.jozufozu.flywheel.api.internal.InternalFlywheelApi; +import com.jozufozu.flywheel.api.internal.FlwApiLink; public final class BackendManager { private BackendManager() { @@ -10,18 +10,18 @@ private BackendManager() { * Get the current backend. */ public static Backend getBackend() { - return InternalFlywheelApi.INSTANCE.getBackend(); + return FlwApiLink.INSTANCE.getBackend(); } public static boolean isBackendOn() { - return InternalFlywheelApi.INSTANCE.isBackendOn(); + return FlwApiLink.INSTANCE.isBackendOn(); } public static Backend getOffBackend() { - return InternalFlywheelApi.INSTANCE.getOffBackend(); + return FlwApiLink.INSTANCE.getOffBackend(); } public static Backend getDefaultBackend() { - return InternalFlywheelApi.INSTANCE.getDefaultBackend(); + return FlwApiLink.INSTANCE.getDefaultBackend(); } } diff --git a/common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceType.java b/common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceType.java index 189d12906..6b84e3382 100644 --- a/common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceType.java +++ b/common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceType.java @@ -1,6 +1,6 @@ package com.jozufozu.flywheel.api.instance; -import com.jozufozu.flywheel.api.internal.InternalFlywheelApi; +import com.jozufozu.flywheel.api.internal.FlwApiLink; import com.jozufozu.flywheel.api.layout.Layout; import com.jozufozu.flywheel.api.registry.Registry; @@ -12,7 +12,7 @@ * @param The java representation of the instance. */ public interface InstanceType { - static Registry> REGISTRY = InternalFlywheelApi.INSTANCE.createRegistry(); + static Registry> REGISTRY = FlwApiLink.INSTANCE.createRegistry(); /** * @param handle A handle that allows you to mark the instance as dirty or deleted. diff --git a/common/src/main/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java b/common/src/main/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java index 72b1b0a21..74280b12c 100644 --- a/common/src/main/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java +++ b/common/src/main/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java @@ -40,12 +40,12 @@ public static T load(Class apiClass, String implClassName) { return apiClass.cast(implInstance); } - private static InternalFlywheelApi load() { - Class apiClass = InternalFlywheelApi.class; + private static FlwApiLink load() { + Class apiClass = FlwApiLink.class; Class implClass; try { - implClass = Class.forName("com.jozufozu.flywheel.impl.InternalFlywheelImpl"); + implClass = Class.forName("com.jozufozu.flywheel.impl.FlwApiLinkImpl"); } catch (ReflectiveOperationException e) { throw new RuntimeException("Could not find implementation", e); } diff --git a/common/src/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java b/common/src/main/java/com/jozufozu/flywheel/api/internal/FlwApiLink.java similarity index 84% rename from common/src/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java rename to common/src/main/java/com/jozufozu/flywheel/api/internal/FlwApiLink.java index 46737afa2..3f1e826aa 100644 --- a/common/src/main/java/com/jozufozu/flywheel/api/internal/InternalFlywheelApi.java +++ b/common/src/main/java/com/jozufozu/flywheel/api/internal/FlwApiLink.java @@ -10,8 +10,6 @@ import com.jozufozu.flywheel.api.visualization.BlockEntityVisualizer; import com.jozufozu.flywheel.api.visualization.EntityVisualizer; import com.jozufozu.flywheel.api.visualization.VisualizationManager; -import com.jozufozu.flywheel.lib.transform.PoseTransformStack; -import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexFormat; import net.minecraft.world.entity.Entity; @@ -20,8 +18,8 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; -public interface InternalFlywheelApi { - InternalFlywheelApi INSTANCE = DependencyInjection.load(InternalFlywheelApi.class, "com.jozufozu.flywheel.impl.InternalFlywheelImpl"); +public interface FlwApiLink { + FlwApiLink INSTANCE = DependencyInjection.load(FlwApiLink.class, "com.jozufozu.flywheel.impl.FlwApiLinkImpl"); Registry createRegistry(); @@ -57,6 +55,4 @@ public interface InternalFlywheelApi { void setVisualizer(BlockEntityType type, BlockEntityVisualizer visualizer); void setVisualizer(EntityType type, EntityVisualizer visualizer); - - PoseTransformStack getPoseTransformStackOf(PoseStack stack); } diff --git a/common/src/main/java/com/jozufozu/flywheel/api/layout/LayoutBuilder.java b/common/src/main/java/com/jozufozu/flywheel/api/layout/LayoutBuilder.java index 77d866199..db506cdab 100644 --- a/common/src/main/java/com/jozufozu/flywheel/api/layout/LayoutBuilder.java +++ b/common/src/main/java/com/jozufozu/flywheel/api/layout/LayoutBuilder.java @@ -3,7 +3,7 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Range; -import com.jozufozu.flywheel.api.internal.InternalFlywheelApi; +import com.jozufozu.flywheel.api.internal.FlwApiLink; @ApiStatus.NonExtendable public interface LayoutBuilder { @@ -26,6 +26,6 @@ public interface LayoutBuilder { Layout build(); static LayoutBuilder create() { - return InternalFlywheelApi.INSTANCE.createLayoutBuilder(); + return FlwApiLink.INSTANCE.createLayoutBuilder(); } } diff --git a/common/src/main/java/com/jozufozu/flywheel/api/material/CutoutShader.java b/common/src/main/java/com/jozufozu/flywheel/api/material/CutoutShader.java index be469762f..43f8fada9 100644 --- a/common/src/main/java/com/jozufozu/flywheel/api/material/CutoutShader.java +++ b/common/src/main/java/com/jozufozu/flywheel/api/material/CutoutShader.java @@ -1,12 +1,12 @@ package com.jozufozu.flywheel.api.material; -import com.jozufozu.flywheel.api.internal.InternalFlywheelApi; +import com.jozufozu.flywheel.api.internal.FlwApiLink; import com.jozufozu.flywheel.api.registry.Registry; import net.minecraft.resources.ResourceLocation; public interface CutoutShader { - static Registry REGISTRY = InternalFlywheelApi.INSTANCE.createRegistry(); + static Registry REGISTRY = FlwApiLink.INSTANCE.createRegistry(); ResourceLocation source(); } diff --git a/common/src/main/java/com/jozufozu/flywheel/api/material/FogShader.java b/common/src/main/java/com/jozufozu/flywheel/api/material/FogShader.java index 4d891afbd..c68759c1f 100644 --- a/common/src/main/java/com/jozufozu/flywheel/api/material/FogShader.java +++ b/common/src/main/java/com/jozufozu/flywheel/api/material/FogShader.java @@ -1,12 +1,12 @@ package com.jozufozu.flywheel.api.material; -import com.jozufozu.flywheel.api.internal.InternalFlywheelApi; +import com.jozufozu.flywheel.api.internal.FlwApiLink; import com.jozufozu.flywheel.api.registry.Registry; import net.minecraft.resources.ResourceLocation; public interface FogShader { - static Registry REGISTRY = InternalFlywheelApi.INSTANCE.createRegistry(); + static Registry REGISTRY = FlwApiLink.INSTANCE.createRegistry(); ResourceLocation source(); } diff --git a/common/src/main/java/com/jozufozu/flywheel/api/material/MaterialShaders.java b/common/src/main/java/com/jozufozu/flywheel/api/material/MaterialShaders.java index 6cab5f4d1..dba708e43 100644 --- a/common/src/main/java/com/jozufozu/flywheel/api/material/MaterialShaders.java +++ b/common/src/main/java/com/jozufozu/flywheel/api/material/MaterialShaders.java @@ -1,12 +1,12 @@ package com.jozufozu.flywheel.api.material; -import com.jozufozu.flywheel.api.internal.InternalFlywheelApi; +import com.jozufozu.flywheel.api.internal.FlwApiLink; import com.jozufozu.flywheel.api.registry.Registry; import net.minecraft.resources.ResourceLocation; public interface MaterialShaders { - static Registry REGISTRY = InternalFlywheelApi.INSTANCE.createRegistry(); + static Registry REGISTRY = FlwApiLink.INSTANCE.createRegistry(); ResourceLocation vertexShader(); diff --git a/common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProviderRegistry.java b/common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProviderRegistry.java index 541e9248a..b173effb8 100644 --- a/common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProviderRegistry.java +++ b/common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProviderRegistry.java @@ -1,6 +1,6 @@ package com.jozufozu.flywheel.api.vertex; -import com.jozufozu.flywheel.api.internal.InternalFlywheelApi; +import com.jozufozu.flywheel.api.internal.FlwApiLink; import com.mojang.blaze3d.vertex.VertexFormat; public final class VertexViewProviderRegistry { @@ -8,10 +8,10 @@ private VertexViewProviderRegistry() { } public static VertexViewProvider getProvider(VertexFormat format) { - return InternalFlywheelApi.INSTANCE.getVertexViewProvider(format); + return FlwApiLink.INSTANCE.getVertexViewProvider(format); } public static void setProvider(VertexFormat format, VertexViewProvider provider) { - InternalFlywheelApi.INSTANCE.setVertexViewProvider(format, provider); + FlwApiLink.INSTANCE.setVertexViewProvider(format, provider); } } diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationManager.java b/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationManager.java index a9f000e89..cf312b718 100644 --- a/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationManager.java +++ b/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationManager.java @@ -3,7 +3,7 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; -import com.jozufozu.flywheel.api.internal.InternalFlywheelApi; +import com.jozufozu.flywheel.api.internal.FlwApiLink; import com.jozufozu.flywheel.api.visual.Effect; import com.jozufozu.flywheel.api.visual.Visual; @@ -16,16 +16,16 @@ @ApiStatus.NonExtendable public interface VisualizationManager { static boolean supportsVisualization(@Nullable LevelAccessor level) { - return InternalFlywheelApi.INSTANCE.supportsVisualization(level); + return FlwApiLink.INSTANCE.supportsVisualization(level); } @Nullable static VisualizationManager get(@Nullable LevelAccessor level) { - return InternalFlywheelApi.INSTANCE.getVisualizationManager(level); + return FlwApiLink.INSTANCE.getVisualizationManager(level); } static VisualizationManager getOrThrow(@Nullable LevelAccessor level) { - return InternalFlywheelApi.INSTANCE.getVisualizationManagerOrThrow(level); + return FlwApiLink.INSTANCE.getVisualizationManagerOrThrow(level); } /** diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizerRegistry.java b/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizerRegistry.java index 604aea42f..55e1b8e75 100644 --- a/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizerRegistry.java +++ b/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizerRegistry.java @@ -2,7 +2,7 @@ import org.jetbrains.annotations.Nullable; -import com.jozufozu.flywheel.api.internal.InternalFlywheelApi; +import com.jozufozu.flywheel.api.internal.FlwApiLink; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -24,7 +24,7 @@ private VisualizerRegistry() { */ @Nullable public static BlockEntityVisualizer getVisualizer(BlockEntityType type) { - return InternalFlywheelApi.INSTANCE.getVisualizer(type); + return FlwApiLink.INSTANCE.getVisualizer(type); } /** @@ -35,7 +35,7 @@ public static BlockEntityVisualizer getVisual */ @Nullable public static EntityVisualizer getVisualizer(EntityType type) { - return InternalFlywheelApi.INSTANCE.getVisualizer(type); + return FlwApiLink.INSTANCE.getVisualizer(type); } /** @@ -45,7 +45,7 @@ public static EntityVisualizer getVisualizer(Entit * @param The type of the block entity. */ public static void setVisualizer(BlockEntityType type, BlockEntityVisualizer visualizer) { - InternalFlywheelApi.INSTANCE.setVisualizer(type, visualizer); + FlwApiLink.INSTANCE.setVisualizer(type, visualizer); } /** @@ -55,6 +55,6 @@ public static void setVisualizer(BlockEntityType type * @param The type of the entity. */ public static void setVisualizer(EntityType type, EntityVisualizer visualizer) { - InternalFlywheelApi.INSTANCE.setVisualizer(type, visualizer); + FlwApiLink.INSTANCE.setVisualizer(type, visualizer); } } diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplat.java b/common/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplat.java new file mode 100644 index 000000000..129515b48 --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplat.java @@ -0,0 +1,13 @@ +package com.jozufozu.flywheel.backend; + +import com.jozufozu.flywheel.api.internal.DependencyInjection; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.state.BlockState; + +public interface FlwBackendXplat { + FlwBackendXplat INSTANCE = DependencyInjection.load(FlwBackendXplat.class, "com.jozufozu.flywheel.backend.FlwBackendXplatImpl"); + + int getLightEmission(BlockState state, BlockGetter level, BlockPos pos); +} diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java index 57188b533..2364ee4bb 100644 --- a/common/src/main/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java +++ b/common/src/main/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java @@ -20,7 +20,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; -import net.minecraft.server.packs.resources.ResourceManagerReloadListener; public final class FlwPrograms { public static final Logger LOGGER = LoggerFactory.getLogger(Flywheel.ID + "/shaders"); @@ -31,7 +30,7 @@ public final class FlwPrograms { private FlwPrograms() { } - private static void reload(ResourceManager resourceManager) { + static void reload(ResourceManager resourceManager) { // Reset the programs in case the ubershader load fails. InstancingPrograms.setInstance(null); IndirectPrograms.setInstance(null); @@ -119,16 +118,4 @@ private static UberShaderComponent createCutoutComponent(SourceLoader loader) { .switchOn(GlslExpr.variable("_flw_uberCutoutIndex")) .build(loader); } - - public static class ResourceReloadListener implements ResourceManagerReloadListener { - public static final ResourceReloadListener INSTANCE = new ResourceReloadListener(); - - private ResourceReloadListener() { - } - - @Override - public void onResourceManagerReload(ResourceManager manager) { - FlwPrograms.reload(manager); - } - } } diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/layout/LayoutInterpreter.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/LayoutInterpreter.java similarity index 97% rename from common/src/main/java/com/jozufozu/flywheel/impl/layout/LayoutInterpreter.java rename to common/src/main/java/com/jozufozu/flywheel/backend/compile/LayoutInterpreter.java index 3df4af593..41c5c3c15 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/layout/LayoutInterpreter.java +++ b/common/src/main/java/com/jozufozu/flywheel/backend/compile/LayoutInterpreter.java @@ -1,4 +1,4 @@ -package com.jozufozu.flywheel.impl.layout; +package com.jozufozu.flywheel.backend.compile; import com.jozufozu.flywheel.api.layout.ArrayElementType; import com.jozufozu.flywheel.api.layout.ElementType; diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceAssemblerComponent.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceAssemblerComponent.java index 348146314..0513226c5 100644 --- a/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceAssemblerComponent.java +++ b/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceAssemblerComponent.java @@ -19,10 +19,10 @@ import com.jozufozu.flywheel.api.layout.UnsignedIntegerRepr; import com.jozufozu.flywheel.api.layout.ValueRepr; import com.jozufozu.flywheel.api.layout.VectorElementType; +import com.jozufozu.flywheel.backend.compile.LayoutInterpreter; import com.jozufozu.flywheel.backend.glsl.SourceComponent; import com.jozufozu.flywheel.backend.glsl.generate.GlslBuilder; import com.jozufozu.flywheel.backend.glsl.generate.GlslExpr; -import com.jozufozu.flywheel.impl.layout.LayoutInterpreter; public abstract class InstanceAssemblerComponent implements SourceComponent { protected static final String STRUCT_NAME = "FlwInstance"; diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java b/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java index 49986e50f..3a78fdc7f 100644 --- a/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java +++ b/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java @@ -6,9 +6,9 @@ import com.jozufozu.flywheel.Flywheel; import com.jozufozu.flywheel.api.instance.InstanceType; import com.jozufozu.flywheel.api.layout.Layout; +import com.jozufozu.flywheel.backend.compile.LayoutInterpreter; import com.jozufozu.flywheel.backend.glsl.SourceComponent; import com.jozufozu.flywheel.backend.glsl.generate.GlslBuilder; -import com.jozufozu.flywheel.impl.layout.LayoutInterpreter; public class InstanceStructComponent implements SourceComponent { private static final String STRUCT_NAME = "FlwInstance"; diff --git a/common/src/main/java/com/jozufozu/flywheel/config/DebugMode.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/DebugMode.java similarity index 68% rename from common/src/main/java/com/jozufozu/flywheel/config/DebugMode.java rename to common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/DebugMode.java index d8cbdbf50..8a4c7a069 100644 --- a/common/src/main/java/com/jozufozu/flywheel/config/DebugMode.java +++ b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/DebugMode.java @@ -1,4 +1,4 @@ -package com.jozufozu.flywheel.config; +package com.jozufozu.flywheel.backend.engine.uniform; public enum DebugMode { OFF, diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java index 7bdb80edb..8cf6380ab 100644 --- a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java +++ b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java @@ -7,7 +7,6 @@ import com.jozufozu.flywheel.api.event.RenderContext; import com.jozufozu.flywheel.api.visualization.VisualizationManager; import com.jozufozu.flywheel.backend.mixin.LevelRendererAccessor; -import com.jozufozu.flywheel.config.DebugMode; import com.jozufozu.flywheel.lib.math.MatrixMath; import net.minecraft.client.Camera; diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java index ca5b4b6d6..7bdfc44a6 100644 --- a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java +++ b/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java @@ -3,8 +3,8 @@ import org.jetbrains.annotations.Nullable; import com.jozufozu.flywheel.api.event.RenderContext; +import com.jozufozu.flywheel.backend.FlwBackendXplat; import com.jozufozu.flywheel.backend.mixin.AbstractClientPlayerAccessor; -import com.jozufozu.flywheel.platform.ClientPlatform; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; @@ -94,7 +94,7 @@ private static long writeHeldLight(long ptr, LocalPlayer player) { Item handItem = player.getItemInHand(hand).getItem(); if (handItem instanceof BlockItem blockItem) { Block block = blockItem.getBlock(); - int blockLight = ClientPlatform.INSTANCE + int blockLight = FlwBackendXplat.INSTANCE .getLightEmission(block.defaultBlockState(), player.clientLevel, player.blockPosition()); if (heldLight < blockLight) { heldLight = blockLight; diff --git a/common/src/main/java/com/jozufozu/flywheel/config/FlwConfig.java b/common/src/main/java/com/jozufozu/flywheel/config/FlwConfig.java deleted file mode 100644 index a6e751595..000000000 --- a/common/src/main/java/com/jozufozu/flywheel/config/FlwConfig.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.jozufozu.flywheel.config; - -import com.jozufozu.flywheel.api.backend.Backend; -import com.jozufozu.flywheel.platform.ClientPlatform; - -public interface FlwConfig { - FlwConfig INSTANCE = ClientPlatform.INSTANCE.getConfigInstance(); - static FlwConfig get() { - return INSTANCE; - } - - Backend backend(); - - boolean limitUpdates(); - - int workerThreads(); -} diff --git a/common/src/main/java/com/jozufozu/flywheel/config/BackendArgument.java b/common/src/main/java/com/jozufozu/flywheel/impl/BackendArgument.java similarity index 98% rename from common/src/main/java/com/jozufozu/flywheel/config/BackendArgument.java rename to common/src/main/java/com/jozufozu/flywheel/impl/BackendArgument.java index 5f340ad5d..bbc2ff860 100644 --- a/common/src/main/java/com/jozufozu/flywheel/config/BackendArgument.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/BackendArgument.java @@ -1,4 +1,4 @@ -package com.jozufozu.flywheel.config; +package com.jozufozu.flywheel.impl; import java.util.Collection; import java.util.List; diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java index 550d13003..cd144716d 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java @@ -6,7 +6,6 @@ import com.jozufozu.flywheel.Flywheel; import com.jozufozu.flywheel.api.backend.Backend; import com.jozufozu.flywheel.backend.Backends; -import com.jozufozu.flywheel.config.FlwConfig; import com.jozufozu.flywheel.impl.visualization.VisualizationManagerImpl; import com.jozufozu.flywheel.lib.backend.SimpleBackend; import com.mojang.logging.LogUtils; @@ -46,7 +45,7 @@ private static Backend findDefaultBackend() { } private static void chooseBackend() { - var preferred = FlwConfig.get().backend(); + var preferred = FlwConfig.INSTANCE.backend(); var actual = preferred.findFallback(); if (preferred != actual) { diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/FlwApiLinkImpl.java similarity index 88% rename from common/src/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java rename to common/src/main/java/com/jozufozu/flywheel/impl/FlwApiLinkImpl.java index c32738e52..877135322 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/InternalFlywheelImpl.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/FlwApiLinkImpl.java @@ -3,7 +3,7 @@ import org.jetbrains.annotations.Nullable; import com.jozufozu.flywheel.api.backend.Backend; -import com.jozufozu.flywheel.api.internal.InternalFlywheelApi; +import com.jozufozu.flywheel.api.internal.FlwApiLink; import com.jozufozu.flywheel.api.layout.LayoutBuilder; import com.jozufozu.flywheel.api.registry.IdRegistry; import com.jozufozu.flywheel.api.registry.Registry; @@ -11,15 +11,12 @@ import com.jozufozu.flywheel.api.visualization.BlockEntityVisualizer; import com.jozufozu.flywheel.api.visualization.EntityVisualizer; import com.jozufozu.flywheel.api.visualization.VisualizationManager; -import com.jozufozu.flywheel.impl.extension.PoseStackExtension; import com.jozufozu.flywheel.impl.layout.LayoutBuilderImpl; import com.jozufozu.flywheel.impl.registry.IdRegistryImpl; import com.jozufozu.flywheel.impl.registry.RegistryImpl; import com.jozufozu.flywheel.impl.vertex.VertexViewProviderRegistryImpl; import com.jozufozu.flywheel.impl.visualization.VisualizationManagerImpl; import com.jozufozu.flywheel.impl.visualization.VisualizerRegistryImpl; -import com.jozufozu.flywheel.lib.transform.PoseTransformStack; -import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexFormat; import net.minecraft.world.entity.Entity; @@ -28,7 +25,7 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; -public final class InternalFlywheelImpl implements InternalFlywheelApi { +public class FlwApiLinkImpl implements FlwApiLink { @Override public Registry createRegistry() { return new RegistryImpl<>(); @@ -111,9 +108,4 @@ public void setVisualizer(BlockEntityType type, Block public void setVisualizer(EntityType type, EntityVisualizer visualizer) { VisualizerRegistryImpl.setVisualizer(type, visualizer); } - - @Override - public PoseTransformStack getPoseTransformStackOf(PoseStack stack) { - return ((PoseStackExtension) stack).flywheel$transformStack(); - } } diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/FlwConfig.java b/common/src/main/java/com/jozufozu/flywheel/impl/FlwConfig.java new file mode 100644 index 000000000..35e167d94 --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/impl/FlwConfig.java @@ -0,0 +1,13 @@ +package com.jozufozu.flywheel.impl; + +import com.jozufozu.flywheel.api.backend.Backend; + +public interface FlwConfig { + FlwConfig INSTANCE = FlwImplXplat.INSTANCE.getConfig(); + + Backend backend(); + + boolean limitUpdates(); + + int workerThreads(); +} diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/FlwDebugInfo.java b/common/src/main/java/com/jozufozu/flywheel/impl/FlwDebugInfo.java new file mode 100644 index 000000000..6150146b1 --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/impl/FlwDebugInfo.java @@ -0,0 +1,37 @@ +package com.jozufozu.flywheel.impl; + +import java.util.List; + +import com.jozufozu.flywheel.api.visualization.VisualizationManager; +import com.jozufozu.flywheel.lib.memory.FlwMemoryTracker; +import com.jozufozu.flywheel.lib.util.StringUtil; + +import net.minecraft.client.Minecraft; +import net.minecraft.core.Vec3i; + +public final class FlwDebugInfo { + private FlwDebugInfo() { + } + + public static void addDebugInfo(Minecraft minecraft, List systemInfo) { + if (minecraft.showOnlyReducedInfo()) { + return; + } + + systemInfo.add(""); + systemInfo.add("Flywheel: " + FlwImplXplat.INSTANCE.getVersionStr()); + systemInfo.add("Backend: " + BackendManagerImpl.getBackendString()); + systemInfo.add("Update limiting: " + (FlwConfig.INSTANCE.limitUpdates() ? "on" : "off")); + + VisualizationManager manager = VisualizationManager.get(minecraft.level); + if (manager != null) { + systemInfo.add("B: " + manager.getBlockEntities().getVisualCount() + + ", E: " + manager.getEntities().getVisualCount() + + ", F: " + manager.getEffects().getVisualCount()); + Vec3i renderOrigin = manager.getRenderOrigin(); + systemInfo.add("Origin: " + renderOrigin.getX() + ", " + renderOrigin.getY() + ", " + renderOrigin.getZ()); + } + + systemInfo.add("Memory Usage: CPU: " + StringUtil.formatBytes(FlwMemoryTracker.getCPUMemory()) + ", GPU: " + StringUtil.formatBytes(FlwMemoryTracker.getGPUMemory())); + } +} diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/FlwImplXplat.java b/common/src/main/java/com/jozufozu/flywheel/impl/FlwImplXplat.java new file mode 100644 index 000000000..198b821ab --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/impl/FlwImplXplat.java @@ -0,0 +1,23 @@ +package com.jozufozu.flywheel.impl; + +import org.jetbrains.annotations.Nullable; + +import com.jozufozu.flywheel.api.event.RenderContext; +import com.jozufozu.flywheel.api.event.RenderStage; +import com.jozufozu.flywheel.api.internal.DependencyInjection; + +import net.minecraft.client.multiplayer.ClientLevel; + +public interface FlwImplXplat { + FlwImplXplat INSTANCE = DependencyInjection.load(FlwImplXplat.class, "com.jozufozu.flywheel.impl.FlwImplXplatImpl"); + + void dispatchBeginFrameEvent(RenderContext context); + + void dispatchReloadLevelRendererEvent(@Nullable ClientLevel level); + + void dispatchRenderStageEvent(RenderContext context, RenderStage stage); + + String getVersionStr(); + + FlwConfig getConfig(); +} diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/FlwLibLinkImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/FlwLibLinkImpl.java new file mode 100644 index 000000000..346afd1d1 --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/impl/FlwLibLinkImpl.java @@ -0,0 +1,13 @@ +package com.jozufozu.flywheel.impl; + +import com.jozufozu.flywheel.impl.extension.PoseStackExtension; +import com.jozufozu.flywheel.lib.internal.FlwLibLink; +import com.jozufozu.flywheel.lib.transform.PoseTransformStack; +import com.mojang.blaze3d.vertex.PoseStack; + +public class FlwLibLinkImpl implements FlwLibLink { + @Override + public PoseTransformStack getPoseTransformStackOf(PoseStack stack) { + return ((PoseStackExtension) stack).flywheel$transformStack(); + } +} diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/FlywheelInit.java b/common/src/main/java/com/jozufozu/flywheel/impl/FlywheelInit.java new file mode 100644 index 000000000..a7a81f478 --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/impl/FlywheelInit.java @@ -0,0 +1,41 @@ +package com.jozufozu.flywheel.impl; + +import com.jozufozu.flywheel.backend.Backends; +import com.jozufozu.flywheel.backend.ShaderIndices; +import com.jozufozu.flywheel.impl.registry.IdRegistryImpl; +import com.jozufozu.flywheel.impl.registry.RegistryImpl; +import com.jozufozu.flywheel.lib.instance.InstanceTypes; +import com.jozufozu.flywheel.lib.material.CutoutShaders; +import com.jozufozu.flywheel.lib.material.FogShaders; +import com.jozufozu.flywheel.lib.material.StandardMaterialShaders; +import com.jozufozu.flywheel.lib.util.ShadersModHandler; +import com.jozufozu.flywheel.vanilla.VanillaVisuals; + +public final class FlywheelInit { + private FlywheelInit() { + } + + public static void init() { + // impl + BackendManagerImpl.init(); + + // lib + ShadersModHandler.init(); + InstanceTypes.init(); + CutoutShaders.init(); + FogShaders.init(); + StandardMaterialShaders.init(); + + // backend + ShaderIndices.init(); + Backends.init(); + + // vanilla + VanillaVisuals.init(); + } + + public static void freezeRegistries() { + RegistryImpl.freezeAll(); + IdRegistryImpl.freezeAll(); + } +} diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java index ea28763c3..993c0dffb 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java @@ -11,13 +11,14 @@ import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At.Shift; +import org.spongepowered.asm.mixin.injection.Group; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import com.jozufozu.flywheel.api.event.RenderStage; +import com.jozufozu.flywheel.impl.FlwImplXplat; import com.jozufozu.flywheel.impl.event.RenderContextImpl; import com.jozufozu.flywheel.impl.visualization.VisualizationManagerImpl; -import com.jozufozu.flywheel.platform.ClientPlatform; import com.mojang.blaze3d.vertex.PoseStack; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; @@ -32,6 +33,7 @@ @Mixin(value = LevelRenderer.class, priority = 1001) // Higher priority to go after Sodium abstract class LevelRendererMixin { @Shadow + @Nullable private ClientLevel level; @Shadow @@ -51,7 +53,7 @@ abstract class LevelRendererMixin { private void flywheel$beginRender(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { flywheel$renderContext = RenderContextImpl.create((LevelRenderer) (Object) this, level, renderBuffers, poseStack, projectionMatrix, camera, partialTick); - ClientPlatform.INSTANCE.dispatchBeginFrame(flywheel$renderContext); + FlwImplXplat.INSTANCE.dispatchBeginFrameEvent(flywheel$renderContext); } @Inject(method = "renderLevel", at = @At("RETURN")) @@ -61,7 +63,7 @@ abstract class LevelRendererMixin { @Inject(method = "allChanged", at = @At("RETURN")) private void flywheel$refresh(CallbackInfo ci) { - ClientPlatform.INSTANCE.dispatchReloadLevelRenderer(level); + FlwImplXplat.INSTANCE.dispatchReloadLevelRendererEvent(level); } @Inject(method = "renderLevel", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiling/ProfilerFiller;popPush(Ljava/lang/String;)V", args = "ldc=destroyProgress")) @@ -81,7 +83,7 @@ abstract class LevelRendererMixin { @Unique private void flywheel$dispatch(RenderStage stage) { if (flywheel$renderContext != null) { - ClientPlatform.INSTANCE.dispatchRenderStage(flywheel$renderContext, stage); + FlwImplXplat.INSTANCE.dispatchRenderStageEvent(flywheel$renderContext, stage); } } @@ -105,8 +107,15 @@ abstract class LevelRendererMixin { flywheel$dispatch(RenderStage.AFTER_TRANSLUCENT_TERRAIN); } + @Group(name = "onStage$afterParticles", min = 1) + @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/ParticleEngine;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/client/Camera;F)V", shift = Shift.AFTER)) + private void flywheel$onStage$afterParticles$fabric(CallbackInfo ci) { + flywheel$dispatch(RenderStage.AFTER_PARTICLES); + } + + @Group(name = "onStage$afterParticles") @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/ParticleEngine;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/client/Camera;FLnet/minecraft/client/renderer/culling/Frustum;)V", shift = Shift.AFTER)) - private void flywheel$onStage$afterParticles(CallbackInfo ci) { + private void flywheel$onStage$afterParticles$forge(CallbackInfo ci) { flywheel$dispatch(RenderStage.AFTER_PARTICLES); } diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/task/FlwTaskExecutor.java b/common/src/main/java/com/jozufozu/flywheel/impl/task/FlwTaskExecutor.java index 0caa47fbd..470cb97e5 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/task/FlwTaskExecutor.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/task/FlwTaskExecutor.java @@ -4,7 +4,7 @@ import org.apache.commons.lang3.concurrent.ConcurrentUtils; import com.jozufozu.flywheel.api.task.TaskExecutor; -import com.jozufozu.flywheel.config.FlwConfig; +import com.jozufozu.flywheel.impl.FlwConfig; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.util.Mth; @@ -39,7 +39,7 @@ private static int getMaxThreadCount() { private static class Initializer extends AtomicSafeInitializer { @Override protected TaskExecutor initialize() { - int threadCount = FlwConfig.get() + int threadCount = FlwConfig.INSTANCE .workerThreads(); if (threadCount == 0) { diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java new file mode 100644 index 000000000..15f1102de --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java @@ -0,0 +1,67 @@ +package com.jozufozu.flywheel.impl.visualization; + +import com.jozufozu.flywheel.api.event.RenderContext; +import com.jozufozu.flywheel.api.event.RenderStage; +import com.jozufozu.flywheel.api.visualization.VisualizationManager; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.Level; + +public final class VisualizationEventHandler { + private VisualizationEventHandler() { + } + + public static void onClientTick(Minecraft minecraft, Level level) { + // The game won't be paused in the tick event, but let's make sure there's a player. + if (minecraft.player == null) { + return; + } + + VisualizationManagerImpl manager = VisualizationManagerImpl.get(level); + if (manager == null) { + return; + } + + manager.tick(); + } + + public static void onBeginFrame(RenderContext context) { + ClientLevel level = context.level(); + VisualizationManagerImpl manager = VisualizationManagerImpl.get(level); + if (manager == null) { + return; + } + + manager.beginFrame(context); + } + + public static void onRenderStage(RenderContext context, RenderStage stage) { + ClientLevel level = context.level(); + VisualizationManagerImpl manager = VisualizationManagerImpl.get(level); + if (manager == null) { + return; + } + + manager.renderStage(context, stage); + } + + public static void onEntityJoinLevel(Level level, Entity entity) { + VisualizationManager manager = VisualizationManager.get(level); + if (manager == null) { + return; + } + + manager.getEntities().queueAdd(entity); + } + + public static void onEntityLeaveLevel(Level level, Entity entity) { + VisualizationManager manager = VisualizationManager.get(level); + if (manager == null) { + return; + } + + manager.getEntities().queueRemove(entity); + } +} diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java index adc6ffc2e..73cd1b1d6 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java @@ -24,7 +24,7 @@ import com.jozufozu.flywheel.api.visualization.VisualizationContext; import com.jozufozu.flywheel.api.visualization.VisualizationLevel; import com.jozufozu.flywheel.api.visualization.VisualizationManager; -import com.jozufozu.flywheel.config.FlwConfig; +import com.jozufozu.flywheel.impl.FlwConfig; import com.jozufozu.flywheel.impl.extension.LevelExtension; import com.jozufozu.flywheel.impl.task.FlwTaskExecutor; import com.jozufozu.flywheel.impl.visual.DynamicVisualContextImpl; @@ -133,7 +133,7 @@ private DynamicVisual.Context createVisualFrameContext(RenderContext ctx) { } protected DistanceUpdateLimiterImpl createUpdateLimiter() { - if (FlwConfig.get() + if (FlwConfig.INSTANCE .limitUpdates()) { return new BandedPrimeLimiter(); } else { diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/internal/FlwLibLink.java b/common/src/main/java/com/jozufozu/flywheel/lib/internal/FlwLibLink.java new file mode 100644 index 000000000..a12b696ba --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/lib/internal/FlwLibLink.java @@ -0,0 +1,11 @@ +package com.jozufozu.flywheel.lib.internal; + +import com.jozufozu.flywheel.api.internal.DependencyInjection; +import com.jozufozu.flywheel.lib.transform.PoseTransformStack; +import com.mojang.blaze3d.vertex.PoseStack; + +public interface FlwLibLink { + FlwLibLink INSTANCE = DependencyInjection.load(FlwLibLink.class, "com.jozufozu.flywheel.impl.FlwLibLinkImpl"); + + PoseTransformStack getPoseTransformStackOf(PoseStack stack); +} diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/internal/FlwLibXplat.java b/common/src/main/java/com/jozufozu/flywheel/lib/internal/FlwLibXplat.java new file mode 100644 index 000000000..0fb9bc58a --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/lib/internal/FlwLibXplat.java @@ -0,0 +1,30 @@ +package com.jozufozu.flywheel.lib.internal; + +import org.jetbrains.annotations.Nullable; + +import com.jozufozu.flywheel.api.internal.DependencyInjection; +import com.jozufozu.flywheel.lib.model.baked.BakedModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.BlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.MultiBlockModelBuilder; +import com.jozufozu.flywheel.lib.util.ShadersModHandler; + +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.block.state.BlockState; + +public interface FlwLibXplat { + FlwLibXplat INSTANCE = DependencyInjection.load(FlwLibXplat.class, "com.jozufozu.flywheel.impl.FlwLibXplatImpl"); + + BlockRenderDispatcher createVanillaBlockRenderDispatcher(); + + BakedModelBuilder createBakedModelBuilder(BakedModel bakedModel); + + BlockModelBuilder createBlockModelBuilder(BlockState state); + + MultiBlockModelBuilder createMultiBlockModelBuilder(BlockAndTintGetter level, Iterable positions); + + @Nullable + ShadersModHandler.InternalHandler createIrisHandler(); +} diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/internal/package-info.java b/common/src/main/java/com/jozufozu/flywheel/lib/internal/package-info.java new file mode 100644 index 000000000..b4efe3fa3 --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/lib/internal/package-info.java @@ -0,0 +1,12 @@ +@ApiStatus.Internal +@ParametersAreNonnullByDefault +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +package com.jozufozu.flywheel.lib.internal; + +import javax.annotation.ParametersAreNonnullByDefault; + +import org.jetbrains.annotations.ApiStatus; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelCache.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelCache.java index b514c28ed..016f706aa 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelCache.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelCache.java @@ -17,7 +17,10 @@ public class ModelCache { public ModelCache(Function factory) { this.factory = factory; - ALL.add(this); + + synchronized (ALL) { + ALL.add(this); + } } public Model get(T key) { diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelHolder.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelHolder.java index 505727da2..cc1d3d0f5 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelHolder.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelHolder.java @@ -17,7 +17,10 @@ public class ModelHolder { public ModelHolder(Supplier factory) { this.factory = factory; - ALL.add(this); + + synchronized (ALL) { + ALL.add(this); + } } public Model get() { diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java index 0eea8d801..b5078b918 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java @@ -14,10 +14,10 @@ import com.jozufozu.flywheel.api.vertex.VertexList; import com.jozufozu.flywheel.api.vertex.VertexView; import com.jozufozu.flywheel.api.vertex.VertexViewProviderRegistry; +import com.jozufozu.flywheel.lib.internal.FlwLibXplat; import com.jozufozu.flywheel.lib.material.Materials; import com.jozufozu.flywheel.lib.memory.MemoryBlock; import com.jozufozu.flywheel.lib.vertex.PosVertexView; -import com.jozufozu.flywheel.platform.ClientPlatform; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.BufferBuilder.DrawState; import com.mojang.blaze3d.vertex.VertexFormat; @@ -30,7 +30,7 @@ public final class ModelUtil { * An alternative BlockRenderDispatcher that circumvents the Forge rendering pipeline to ensure consistency. * Meant to be used for virtual rendering. */ - public static final BlockRenderDispatcher VANILLA_RENDERER = ClientPlatform.INSTANCE.createVanillaRenderer(); + public static final BlockRenderDispatcher VANILLA_RENDERER = FlwLibXplat.INSTANCE.createVanillaBlockRenderDispatcher(); private static final float BOUNDING_SPHERE_EPSILON = 1e-4f; private ModelUtil() { diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java index 0eeb0c22b..528dea4bb 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java @@ -5,8 +5,8 @@ import org.jetbrains.annotations.Nullable; import com.jozufozu.flywheel.api.material.Material; +import com.jozufozu.flywheel.lib.internal.FlwLibXplat; import com.jozufozu.flywheel.lib.model.SimpleModel; -import com.jozufozu.flywheel.platform.ClientPlatform; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.renderer.RenderType; @@ -26,7 +26,7 @@ public abstract class BakedModelBuilder { protected BiFunction materialFunc; public static BakedModelBuilder create(BakedModel bakedModel) { - return ClientPlatform.INSTANCE.bakedModelBuilder(bakedModel); + return FlwLibXplat.INSTANCE.createBakedModelBuilder(bakedModel); } protected BakedModelBuilder(BakedModel bakedModel) { diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java index aeb1497b6..0c2b44d85 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java @@ -5,8 +5,8 @@ import org.jetbrains.annotations.Nullable; import com.jozufozu.flywheel.api.material.Material; +import com.jozufozu.flywheel.lib.internal.FlwLibXplat; import com.jozufozu.flywheel.lib.model.SimpleModel; -import com.jozufozu.flywheel.platform.ClientPlatform; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.renderer.RenderType; @@ -23,7 +23,7 @@ public abstract class BlockModelBuilder { protected BiFunction materialFunc; public static BlockModelBuilder create(BlockState state) { - return ClientPlatform.INSTANCE.blockModelBuilder(state); + return FlwLibXplat.INSTANCE.createBlockModelBuilder(state); } protected BlockModelBuilder(BlockState state) { diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java index 2ad7a7b33..c750f5950 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java @@ -5,8 +5,8 @@ import org.jetbrains.annotations.Nullable; import com.jozufozu.flywheel.api.material.Material; +import com.jozufozu.flywheel.lib.internal.FlwLibXplat; import com.jozufozu.flywheel.lib.model.SimpleModel; -import com.jozufozu.flywheel.platform.ClientPlatform; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.renderer.RenderType; @@ -23,7 +23,7 @@ public abstract class MultiBlockModelBuilder { protected BiFunction materialFunc; public static MultiBlockModelBuilder create(BlockAndTintGetter level, Iterable positions) { - return ClientPlatform.INSTANCE.multiBlockModelBuilder(level, positions); + return FlwLibXplat.INSTANCE.createMultiBlockModelBuilder(level, positions); } protected MultiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java index 48ce637be..b7f4a760c 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java @@ -7,15 +7,13 @@ import net.minecraft.resources.ResourceLocation; /** - * A helper class for loading and accessing json models. + * A helper class for loading and accessing JSON models not directly used by any blocks or items. *
- * Creating a PartialModel will make the associated modelLocation automatically load. - * PartialModels must be initialized in the mod class constructor. + * Creating a PartialModel will make Minecraft automatically load the associated modelLocation. + * PartialModels must be initialized before the initial resource reload, otherwise an error will be thrown. + * It is recommended to do this in the client mod initializer on Fabric and the mod class constructor on Forge. *
- * Once {@link ModelEvent.RegisterAdditional} finishes, all PartialModels (with valid modelLocations) - * will have their bakedModel fields populated. - *
- * Attempting to create a PartialModel after {@link ModelEvent.RegisterAdditional} will cause an error. + * Once Minecraft has finished baking all models, all PartialModels will have their bakedModel fields populated. */ public class PartialModel { static final List ALL = new ArrayList<>(); @@ -26,27 +24,30 @@ public class PartialModel { public PartialModel(ResourceLocation modelLocation) { if (tooLate) { - throw new RuntimeException("PartialModel '" + modelLocation + "' loaded after ModelRegistryEvent"); + throw new RuntimeException("Attempted to create PartialModel with location '" + modelLocation + "' after start of initial resource reload!"); } this.modelLocation = modelLocation; - ALL.add(this); - } - public String getName() { - return getLocation() - .toString(); + synchronized (ALL) { + ALL.add(this); + } } public ResourceLocation getLocation() { return modelLocation; } + public String getName() { + return getLocation() + .toString(); + } + public BakedModel get() { return bakedModel; } - void set(BakedModel bakedModel) { + protected void set(BakedModel bakedModel) { this.bakedModel = bakedModel; } } diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java b/common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java index 306972421..00d77576e 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java @@ -1,11 +1,11 @@ package com.jozufozu.flywheel.lib.transform; -import com.jozufozu.flywheel.api.internal.InternalFlywheelApi; +import com.jozufozu.flywheel.lib.internal.FlwLibLink; import com.mojang.blaze3d.vertex.PoseStack; public interface TransformStack> extends Transform { static PoseTransformStack of(PoseStack stack) { - return InternalFlywheelApi.INSTANCE.getPoseTransformStackOf(stack); + return FlwLibLink.INSTANCE.getPoseTransformStackOf(stack); } Self pushPose(); diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java b/common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java index 8e1de6f37..cd451ac32 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java @@ -6,7 +6,7 @@ import org.jetbrains.annotations.ApiStatus; import org.slf4j.Logger; -import com.jozufozu.flywheel.platform.ClientPlatform; +import com.jozufozu.flywheel.lib.internal.FlwLibXplat; import com.mojang.logging.LogUtils; public final class ShadersModHandler { @@ -19,23 +19,23 @@ public final class ShadersModHandler { private static final InternalHandler INTERNAL_HANDLER; static { + InternalHandler irisHandler = FlwLibXplat.INSTANCE + .createIrisHandler(); + IS_IRIS_LOADED = irisHandler != null; + Package optifinePackage = Package.getPackage(OPTIFINE_ROOT_PACKAGE); IS_OPTIFINE_INSTALLED = optifinePackage != null; - var irisOculusHandler = ClientPlatform.INSTANCE - .createIrisOculusHandlerIfPresent(); - IS_IRIS_LOADED = irisOculusHandler != null; - // OptiFine and Iris/Oculus are assumed to be mutually exclusive - if (IS_OPTIFINE_INSTALLED) { - LOGGER.info("Optifine detected."); - INTERNAL_HANDLER = new Optifine(); - } else if (IS_IRIS_LOADED) { - LOGGER.info("Iris detected."); - INTERNAL_HANDLER = irisOculusHandler; + if (IS_IRIS_LOADED) { + LOGGER.debug("Iris detected."); + INTERNAL_HANDLER = irisHandler; + } else if (IS_OPTIFINE_INSTALLED) { + LOGGER.debug("OptiFine detected."); + INTERNAL_HANDLER = new OptifineHandler(); } else { - LOGGER.info("No shaders mod detected."); + LOGGER.debug("No shaders mod detected."); INTERNAL_HANDLER = new InternalHandler() {}; } } @@ -67,19 +67,19 @@ public static void init() { public interface InternalHandler { default boolean isShaderPackInUse() { return false; - }; + } default boolean isRenderingShadowPass() { return false; - }; + } } // evil reflection - private static class Optifine implements InternalHandler { + private static class OptifineHandler implements InternalHandler { private final BooleanSupplier shadersEnabledSupplier; private final BooleanSupplier shadowPassSupplier; - Optifine() { + private OptifineHandler() { shadersEnabledSupplier = createShadersEnabledSupplier(); shadowPassSupplier = createShadowPassSupplier(); } @@ -102,11 +102,11 @@ private static BooleanSupplier createShadersEnabledSupplier() { return () -> { try { return field.getBoolean(null); - } catch (IllegalAccessException ignored) { + } catch (IllegalAccessException e) { return false; } }; - } catch (Exception ignored) { + } catch (Exception e) { return () -> false; } } @@ -119,11 +119,11 @@ private static BooleanSupplier createShadowPassSupplier() { return () -> { try { return field.getBoolean(null); - } catch (IllegalAccessException ignored) { + } catch (IllegalAccessException e) { return false; } }; - } catch (Exception ignored) { + } catch (Exception e) { return () -> false; } } diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleBlockEntityVisualizer.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleBlockEntityVisualizer.java index 49f2e4d5e..f32a814d5 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleBlockEntityVisualizer.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleBlockEntityVisualizer.java @@ -3,6 +3,8 @@ import java.util.Objects; import java.util.function.Predicate; +import org.jetbrains.annotations.Nullable; + import com.jozufozu.flywheel.api.visual.BlockEntityVisual; import com.jozufozu.flywheel.api.visualization.BlockEntityVisualizer; import com.jozufozu.flywheel.api.visualization.VisualizationContext; @@ -54,7 +56,9 @@ public interface Factory { */ public static class Builder { protected BlockEntityType type; + @Nullable protected Factory visualFactory; + @Nullable protected Predicate skipVanillaRender; public Builder(BlockEntityType type) { diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisualizer.java b/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisualizer.java index 0cedc825d..220e43e7c 100644 --- a/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisualizer.java +++ b/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisualizer.java @@ -3,6 +3,8 @@ import java.util.Objects; import java.util.function.Predicate; +import org.jetbrains.annotations.Nullable; + import com.jozufozu.flywheel.api.visual.EntityVisual; import com.jozufozu.flywheel.api.visualization.EntityVisualizer; import com.jozufozu.flywheel.api.visualization.VisualizationContext; @@ -54,7 +56,9 @@ public interface Factory { */ public static class Builder { protected EntityType type; + @Nullable protected Factory visualFactory; + @Nullable protected Predicate skipVanillaRender; public Builder(EntityType type) { diff --git a/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java b/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java deleted file mode 100644 index ac61c5e52..000000000 --- a/common/src/main/java/com/jozufozu/flywheel/platform/ClientPlatform.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.jozufozu.flywheel.platform; - -import org.jetbrains.annotations.Nullable; - -import com.jozufozu.flywheel.api.event.RenderContext; -import com.jozufozu.flywheel.api.event.RenderStage; -import com.jozufozu.flywheel.api.internal.DependencyInjection; -import com.jozufozu.flywheel.config.FlwConfig; -import com.jozufozu.flywheel.lib.model.baked.BakedModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.BlockModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.MultiBlockModelBuilder; -import com.jozufozu.flywheel.lib.util.ShadersModHandler; - -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.block.BlockRenderDispatcher; -import net.minecraft.client.resources.model.BakedModel; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.BlockAndTintGetter; -import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.block.state.BlockState; - -public interface ClientPlatform { - ClientPlatform INSTANCE = DependencyInjection.load(ClientPlatform.class, "com.jozufozu.flywheel.platform.ClientPlatformImpl"); - - void dispatchReloadLevelRenderer(ClientLevel level); - - void dispatchBeginFrame(RenderContext context); - - void dispatchRenderStage(RenderContext context, RenderStage stage); - - boolean isModLoaded(String modid); - - @Nullable - ShadersModHandler.InternalHandler createIrisOculusHandlerIfPresent(); - - int getLightEmission(BlockState state, BlockGetter level, BlockPos pos); - - FlwConfig getConfigInstance(); - - BlockRenderDispatcher createVanillaRenderer(); - - BakedModelBuilder bakedModelBuilder(BakedModel bakedModel); - - BlockModelBuilder blockModelBuilder(BlockState state); - - MultiBlockModelBuilder multiBlockModelBuilder(BlockAndTintGetter level, Iterable positions); -} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererCallback.java b/fabric/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererCallback.java index ca16d46a3..a8b448c3d 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererCallback.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererCallback.java @@ -1,5 +1,7 @@ package com.jozufozu.flywheel.api.event; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.fabric.api.event.Event; import net.fabricmc.fabric.api.event.EventFactory; import net.minecraft.client.multiplayer.ClientLevel; @@ -13,5 +15,5 @@ public interface ReloadLevelRendererCallback { } }); - void onReloadLevelRenderer(ClientLevel level); + void onReloadLevelRenderer(@Nullable ClientLevel level); } diff --git a/fabric/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java b/fabric/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java new file mode 100644 index 000000000..222c3c183 --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java @@ -0,0 +1,12 @@ +package com.jozufozu.flywheel.backend; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.state.BlockState; + +public class FlwBackendXplatImpl implements FlwBackendXplat { + @Override + public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos) { + return state.getLightEmission(); + } +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java b/fabric/src/main/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java new file mode 100644 index 000000000..a6fce9831 --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java @@ -0,0 +1,26 @@ +package com.jozufozu.flywheel.backend.compile; + +import com.jozufozu.flywheel.Flywheel; + +import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.resources.ResourceManager; + +public final class FlwProgramsReloader implements SimpleSynchronousResourceReloadListener { + public static final FlwProgramsReloader INSTANCE = new FlwProgramsReloader(); + + public static final ResourceLocation ID = Flywheel.rl("programs"); + + private FlwProgramsReloader() { + } + + @Override + public void onResourceManagerReload(ResourceManager manager) { + FlwPrograms.reload(manager); + } + + @Override + public ResourceLocation getFabricId() { + return ID; + } +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java new file mode 100644 index 000000000..0ad3e1326 --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java @@ -0,0 +1,24 @@ +package com.jozufozu.flywheel.impl; + +import com.jozufozu.flywheel.api.backend.Backend; +import com.jozufozu.flywheel.backend.Backends; + +// TODO: Fabric config +public class FabricFlwConfig implements FlwConfig { + public static final FabricFlwConfig INSTANCE = new FabricFlwConfig(); + + @Override + public Backend backend() { + return Backends.INDIRECT; + } + + @Override + public boolean limitUpdates() { + return true; + } + + @Override + public int workerThreads() { + return -1; + } +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwImplXplatImpl.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwImplXplatImpl.java new file mode 100644 index 000000000..35de913ce --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwImplXplatImpl.java @@ -0,0 +1,38 @@ +package com.jozufozu.flywheel.impl; + +import org.jetbrains.annotations.Nullable; + +import com.jozufozu.flywheel.api.event.BeginFrameCallback; +import com.jozufozu.flywheel.api.event.ReloadLevelRendererCallback; +import com.jozufozu.flywheel.api.event.RenderContext; +import com.jozufozu.flywheel.api.event.RenderStage; +import com.jozufozu.flywheel.api.event.RenderStageCallback; + +import net.minecraft.client.multiplayer.ClientLevel; + +public class FlwImplXplatImpl implements FlwImplXplat { + @Override + public void dispatchBeginFrameEvent(RenderContext context) { + BeginFrameCallback.EVENT.invoker().onBeginFrame(context); + } + + @Override + public void dispatchReloadLevelRendererEvent(@Nullable ClientLevel level) { + ReloadLevelRendererCallback.EVENT.invoker().onReloadLevelRenderer(level); + } + + @Override + public void dispatchRenderStageEvent(RenderContext context, RenderStage stage) { + RenderStageCallback.EVENT.invoker().onRenderStage(context, stage); + } + + @Override + public String getVersionStr() { + return FlywheelFabric.version().getFriendlyString(); + } + + @Override + public FlwConfig getConfig() { + return FabricFlwConfig.INSTANCE; + } +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java new file mode 100644 index 000000000..908dc3a5d --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java @@ -0,0 +1,63 @@ +package com.jozufozu.flywheel.impl; + +import org.jetbrains.annotations.Nullable; + +import com.jozufozu.flywheel.lib.internal.FlwLibXplat; +import com.jozufozu.flywheel.lib.model.baked.BakedModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.BlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.MultiBlockModelBuilder; +import com.jozufozu.flywheel.lib.util.ShadersModHandler; + +import net.fabricmc.loader.api.FabricLoader; +import net.irisshaders.iris.api.v0.IrisApi; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.block.state.BlockState; + +public class FlwLibXplatImpl implements FlwLibXplat { + @Override + public BlockRenderDispatcher createVanillaBlockRenderDispatcher() { + return Minecraft.getInstance().getBlockRenderer(); + } + + @Override + public BakedModelBuilder createBakedModelBuilder(BakedModel bakedModel) { + return null; + } + + @Override + public BlockModelBuilder createBlockModelBuilder(BlockState state) { + return null; + } + + @Override + public MultiBlockModelBuilder createMultiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { + return null; + } + + @Override + @Nullable + public ShadersModHandler.InternalHandler createIrisHandler() { + if (!FabricLoader.getInstance() + .isModLoaded("iris")) { + return null; + } + + return new ShadersModHandler.InternalHandler() { + @Override + public boolean isShaderPackInUse() { + return IrisApi.getInstance() + .isShaderPackInUse(); + } + + @Override + public boolean isRenderingShadowPass() { + return IrisApi.getInstance() + .isRenderingShadowPass(); + } + }; + } +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java index 4e4c56eeb..b83788de7 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java @@ -1,10 +1,94 @@ package com.jozufozu.flywheel.impl; +import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.event.BeginFrameCallback; +import com.jozufozu.flywheel.api.event.EndClientResourceReloadCallback; +import com.jozufozu.flywheel.api.event.ReloadLevelRendererCallback; +import com.jozufozu.flywheel.api.event.RenderStageCallback; +import com.jozufozu.flywheel.backend.compile.FlwProgramsReloader; +import com.jozufozu.flywheel.backend.engine.uniform.Uniforms; +import com.jozufozu.flywheel.impl.visualization.VisualizationEventHandler; +import com.jozufozu.flywheel.lib.model.ModelCache; +import com.jozufozu.flywheel.lib.model.ModelHolder; +import com.jozufozu.flywheel.lib.model.baked.PartialModelEventHandler; + import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientEntityEvents; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; +import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin; +import net.fabricmc.fabric.api.command.v2.ArgumentTypeRegistry; +import net.fabricmc.fabric.api.resource.ResourceManagerHelper; +import net.fabricmc.loader.api.FabricLoader; +import net.fabricmc.loader.api.ModContainer; +import net.fabricmc.loader.api.Version; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.server.packs.PackType; + +public final class FlywheelFabric implements ClientModInitializer { + private static Version version; -public class FlywheelFabric implements ClientModInitializer { @Override public void onInitializeClient() { + ModContainer modContainer = FabricLoader.getInstance().getModContainer(Flywheel.ID).orElseThrow(); + version = modContainer.getMetadata().getVersion(); + + setupImpl(); + setupLib(); + setupBackend(); + + FlywheelInit.init(); + + // FIXME: Registries cannot be frozen this early. + FlywheelInit.freezeRegistries(); + } + + private static void setupImpl() { + ReloadLevelRendererCallback.EVENT.register(BackendManagerImpl::onReloadLevelRenderer); + + // This Fabric event runs slightly later than the Forge event Flywheel uses, but it shouldn't make a difference. + ClientTickEvents.END_CLIENT_TICK.register(minecraft -> { + if (!minecraft.isPaused()) { + ClientLevel level = minecraft.level; + if (level != null) { + VisualizationEventHandler.onClientTick(minecraft, level); + } + } + }); + BeginFrameCallback.EVENT.register(VisualizationEventHandler::onBeginFrame); + RenderStageCallback.EVENT.register(VisualizationEventHandler::onRenderStage); + ClientEntityEvents.ENTITY_LOAD.register((entity, level) -> VisualizationEventHandler.onEntityJoinLevel(level, entity)); + ClientEntityEvents.ENTITY_UNLOAD.register((entity, level) -> VisualizationEventHandler.onEntityLeaveLevel(level, entity)); + + ClientCommandRegistrationCallback.EVENT.register((dispatcher, ctx) -> { + // TODO: Fabric client commands + }); + + EndClientResourceReloadCallback.EVENT.register((minecraft, resourceManager, initialReload, error) -> + BackendManagerImpl.onEndClientResourceReload(error.isPresent())); + + ArgumentTypeRegistry.registerArgumentType(Flywheel.rl("backend"), BackendArgument.class, BackendArgument.INFO); + } + + private static void setupLib() { + EndClientResourceReloadCallback.EVENT.register((minecraft, resourceManager, initialReload, error) -> + ModelCache.onEndClientResourceReload()); + EndClientResourceReloadCallback.EVENT.register((minecraft, resourceManager, initialReload, error) -> + ModelHolder.onEndClientResourceReload()); + + ModelLoadingPlugin.register(ctx -> { + ctx.addModels(PartialModelEventHandler.onRegisterAdditional()); + }); + ResourceManagerHelper.get(PackType.CLIENT_RESOURCES).registerReloadListener(PartialModelEventHandler.ReloadListener.INSTANCE); + } + + private static void setupBackend() { + ReloadLevelRendererCallback.EVENT.register(level -> Uniforms.onReloadLevelRenderer()); + + ResourceManagerHelper.get(PackType.CLIENT_RESOURCES).registerReloadListener(FlwProgramsReloader.INSTANCE); + } + public static Version version() { + return version; } } diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/fabric/DebugScreenOverlayMixin.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/fabric/DebugScreenOverlayMixin.java new file mode 100644 index 000000000..0d9719aea --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/fabric/DebugScreenOverlayMixin.java @@ -0,0 +1,27 @@ +package com.jozufozu.flywheel.impl.mixin.fabric; + +import java.util.List; + +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import com.jozufozu.flywheel.impl.FlwDebugInfo; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.components.DebugScreenOverlay; + +@Mixin(DebugScreenOverlay.class) +abstract class DebugScreenOverlayMixin { + @Shadow + @Final + private Minecraft minecraft; + + @Inject(method = "getSystemInformation", at = @At("RETURN")) + private void flywheel$onGetSystemInformation(CallbackInfoReturnable> cir) { + FlwDebugInfo.addDebugInfo(minecraft, cir.getReturnValue()); + } +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/fabric/MinecraftMixin.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/fabric/MinecraftMixin.java new file mode 100644 index 000000000..f80623ea7 --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/fabric/MinecraftMixin.java @@ -0,0 +1,32 @@ +package com.jozufozu.flywheel.impl.mixin.fabric; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import com.jozufozu.flywheel.lib.util.LevelAttached; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ClientLevel; + +@Mixin(Minecraft.class) +abstract class MinecraftMixin { + @Shadow + public ClientLevel level; + + @Inject(method = "setLevel(Lnet/minecraft/client/multiplayer/ClientLevel;)V", at = @At("HEAD")) + private void flywheel$onSetLevel(CallbackInfo ci) { + if (level != null) { + LevelAttached.invalidateLevel(level); + } + } + + @Inject(method = "clearLevel(Lnet/minecraft/client/gui/screens/Screen;)V", at = @At("HEAD")) + private void flywheel$onClearLevel(CallbackInfo ci) { + if (level != null) { + LevelAttached.invalidateLevel(level); + } + } +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/fabric/SystemReportMixin.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/fabric/SystemReportMixin.java new file mode 100644 index 000000000..8a8178793 --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/fabric/SystemReportMixin.java @@ -0,0 +1,19 @@ +package com.jozufozu.flywheel.impl.mixin.fabric; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import com.jozufozu.flywheel.impl.BackendManagerImpl; + +import net.minecraft.SystemReport; + +@Mixin(value = SystemReport.class, priority = 1056) +abstract class SystemReportMixin { + @Inject(method = "", at = @At("RETURN")) + private void flywheel$onInit(CallbackInfo ci) { + SystemReport self = (SystemReport) (Object) this; + self.setDetail("Flywheel Backend", BackendManagerImpl::getBackendString); + } +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java b/fabric/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java new file mode 100644 index 000000000..ebab75af5 --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java @@ -0,0 +1,56 @@ +package com.jozufozu.flywheel.lib.model.baked; + +import java.util.List; + +import org.jetbrains.annotations.ApiStatus; + +import com.jozufozu.flywheel.Flywheel; + +import net.fabricmc.fabric.api.resource.ResourceReloadListenerKeys; +import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.resources.ResourceManager; + +@ApiStatus.Internal +public final class PartialModelEventHandler { + private PartialModelEventHandler() { + } + + public static ResourceLocation[] onRegisterAdditional() { + PartialModel.tooLate = true; + return PartialModel.ALL.stream().map(PartialModel::getLocation).toArray(ResourceLocation[]::new); + } + + public static void onBakingCompleted(ModelManager manager) { + for (PartialModel partial : PartialModel.ALL) { + partial.set(manager.getModel(partial.getLocation())); + } + } + + public static final class ReloadListener implements SimpleSynchronousResourceReloadListener { + public static final ReloadListener INSTANCE = new ReloadListener(); + + public static final ResourceLocation ID = Flywheel.rl("partial_models"); + public static final List DEPENDENCIES = List.of(ResourceReloadListenerKeys.MODELS); + + private ReloadListener() { + } + + @Override + public void onResourceManagerReload(ResourceManager resourceManager) { + onBakingCompleted(Minecraft.getInstance().getModelManager()); + } + + @Override + public ResourceLocation getFabricId() { + return ID; + } + + @Override + public List getFabricDependencies() { + return DEPENDENCIES; + } + } +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java b/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java deleted file mode 100644 index 372357310..000000000 --- a/fabric/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.jozufozu.flywheel.platform; - -import org.jetbrains.annotations.Nullable; - -import com.jozufozu.flywheel.api.event.BeginFrameCallback; -import com.jozufozu.flywheel.api.event.ReloadLevelRendererCallback; -import com.jozufozu.flywheel.api.event.RenderContext; -import com.jozufozu.flywheel.api.event.RenderStage; -import com.jozufozu.flywheel.api.event.RenderStageCallback; -import com.jozufozu.flywheel.config.FlwConfig; -import com.jozufozu.flywheel.lib.model.baked.BakedModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.BlockModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.MultiBlockModelBuilder; -import com.jozufozu.flywheel.lib.util.ShadersModHandler; - -import net.fabricmc.loader.api.FabricLoader; -import net.irisshaders.iris.api.v0.IrisApi; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.block.BlockRenderDispatcher; -import net.minecraft.client.resources.model.BakedModel; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.BlockAndTintGetter; -import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.block.state.BlockState; - -public class ClientPlatformImpl implements ClientPlatform { - @Override - public void dispatchReloadLevelRenderer(ClientLevel level) { - ReloadLevelRendererCallback.EVENT.invoker().onReloadLevelRenderer(level); - } - - @Override - public void dispatchBeginFrame(RenderContext context) { - BeginFrameCallback.EVENT.invoker().onBeginFrame(context); - } - - @Override - public void dispatchRenderStage(RenderContext context, RenderStage stage) { - RenderStageCallback.EVENT.invoker().onRenderStage(context, stage); - } - - @Override - public boolean isModLoaded(String modid) { - return FabricLoader.getInstance() - .isModLoaded(modid); - } - - @Nullable - @Override - public ShadersModHandler.InternalHandler createIrisOculusHandlerIfPresent() { - if (isModLoaded("iris")) { - return new ShadersModHandler.InternalHandler() { - @Override - public boolean isShaderPackInUse() { - return IrisApi.getInstance() - .isShaderPackInUse(); - } - - @Override - public boolean isRenderingShadowPass() { - return IrisApi.getInstance() - .isRenderingShadowPass(); - } - }; - } else { - return null; - } - } - - @Override - public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos) { - return state.getLightEmission(); - } - - @Override - public FlwConfig getConfigInstance() { - // TODO: fabric config - return null; - } - - @Override - public BlockRenderDispatcher createVanillaRenderer() { - return Minecraft.getInstance().getBlockRenderer(); - } - - @Override - public BakedModelBuilder bakedModelBuilder(BakedModel bakedModel) { - return null; - } - - @Override - public BlockModelBuilder blockModelBuilder(BlockState state) { - return null; - } - - @Override - public MultiBlockModelBuilder multiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { - return null; - } -} diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 35b681801..8e42e83ae 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -24,7 +24,8 @@ "mixins": [ "flywheel.backend.mixins.json", "flywheel.impl.mixins.json", - "flywheel.impl.sodium.mixins.json" + "flywheel.impl.sodium.mixins.json", + "flywheel.impl.fabric.mixins.json" ], "depends": { "minecraft": "${minecraft_semver_version_range}", diff --git a/fabric/src/main/resources/flywheel.impl.fabric.mixins.json b/fabric/src/main/resources/flywheel.impl.fabric.mixins.json new file mode 100644 index 000000000..6bcba4308 --- /dev/null +++ b/fabric/src/main/resources/flywheel.impl.fabric.mixins.json @@ -0,0 +1,15 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "com.jozufozu.flywheel.impl.mixin.fabric", + "compatibilityLevel": "JAVA_17", + "refmap": "flywheel.refmap.json", + "client": [ + "DebugScreenOverlayMixin", + "MinecraftMixin", + "SystemReportMixin" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/forge/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java b/forge/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java new file mode 100644 index 000000000..b010dfe1f --- /dev/null +++ b/forge/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java @@ -0,0 +1,12 @@ +package com.jozufozu.flywheel.backend; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.state.BlockState; + +public class FlwBackendXplatImpl implements FlwBackendXplat { + @Override + public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos) { + return state.getLightEmission(level, pos); + } +} diff --git a/forge/src/main/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java b/forge/src/main/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java new file mode 100644 index 000000000..475b2586b --- /dev/null +++ b/forge/src/main/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java @@ -0,0 +1,16 @@ +package com.jozufozu.flywheel.backend.compile; + +import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.server.packs.resources.ResourceManagerReloadListener; + +public final class FlwProgramsReloader implements ResourceManagerReloadListener { + public static final FlwProgramsReloader INSTANCE = new FlwProgramsReloader(); + + private FlwProgramsReloader() { + } + + @Override + public void onResourceManagerReload(ResourceManager manager) { + FlwPrograms.reload(manager); + } +} diff --git a/forge/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java b/forge/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java similarity index 97% rename from forge/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java rename to forge/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java index 3265e495c..72a436120 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/config/FlwCommands.java +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java @@ -1,9 +1,10 @@ -package com.jozufozu.flywheel.config; +package com.jozufozu.flywheel.impl; import java.util.function.BiConsumer; import com.jozufozu.flywheel.api.backend.Backend; import com.jozufozu.flywheel.api.backend.BackendManager; +import com.jozufozu.flywheel.backend.engine.uniform.DebugMode; import com.jozufozu.flywheel.backend.engine.uniform.FrameUniforms; import com.mojang.brigadier.Command; import com.mojang.brigadier.arguments.IntegerArgumentType; @@ -25,7 +26,7 @@ private FlwCommands() { } public static void registerClientCommands(RegisterClientCommandsEvent event) { - var config = FlwForgeConfig.INSTANCE; + var config = ForgeFlwConfig.INSTANCE; LiteralArgumentBuilder command = Commands.literal("flywheel"); diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/FlwImplXplatImpl.java b/forge/src/main/java/com/jozufozu/flywheel/impl/FlwImplXplatImpl.java new file mode 100644 index 000000000..1234a4a4a --- /dev/null +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/FlwImplXplatImpl.java @@ -0,0 +1,39 @@ +package com.jozufozu.flywheel.impl; + +import org.jetbrains.annotations.Nullable; + +import com.jozufozu.flywheel.api.event.BeginFrameEvent; +import com.jozufozu.flywheel.api.event.ReloadLevelRendererEvent; +import com.jozufozu.flywheel.api.event.RenderContext; +import com.jozufozu.flywheel.api.event.RenderStage; +import com.jozufozu.flywheel.api.event.RenderStageEvent; + +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraftforge.common.MinecraftForge; + +public class FlwImplXplatImpl implements FlwImplXplat { + @Override + public void dispatchBeginFrameEvent(RenderContext context) { + MinecraftForge.EVENT_BUS.post(new BeginFrameEvent(context)); + } + + @Override + public void dispatchReloadLevelRendererEvent(@Nullable ClientLevel level) { + MinecraftForge.EVENT_BUS.post(new ReloadLevelRendererEvent(level)); + } + + @Override + public void dispatchRenderStageEvent(RenderContext context, RenderStage stage) { + MinecraftForge.EVENT_BUS.post(new RenderStageEvent(context, stage)); + } + + @Override + public String getVersionStr() { + return FlywheelForge.version().toString(); + } + + @Override + public FlwConfig getConfig() { + return ForgeFlwConfig.INSTANCE; + } +} diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java b/forge/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java new file mode 100644 index 000000000..4dc57a159 --- /dev/null +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java @@ -0,0 +1,86 @@ +package com.jozufozu.flywheel.impl; + +import java.lang.reflect.Field; + +import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; + +import com.jozufozu.flywheel.lib.internal.FlwLibXplat; +import com.jozufozu.flywheel.lib.model.baked.BakedModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.BlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.ForgeBakedModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.ForgeBlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.ForgeMultiBlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.MultiBlockModelBuilder; +import com.jozufozu.flywheel.lib.util.ShadersModHandler; +import com.mojang.logging.LogUtils; + +import net.irisshaders.iris.api.v0.IrisApi; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.block.ModelBlockRenderer; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.fml.ModList; +import net.minecraftforge.fml.util.ObfuscationReflectionHelper; + +public class FlwLibXplatImpl implements FlwLibXplat { + private static final Logger LOGGER = LogUtils.getLogger(); + + @Override + public BlockRenderDispatcher createVanillaBlockRenderDispatcher() { + BlockRenderDispatcher defaultDispatcher = Minecraft.getInstance().getBlockRenderer(); + BlockRenderDispatcher dispatcher = new BlockRenderDispatcher(null, null, null); + try { + for (Field field : BlockRenderDispatcher.class.getDeclaredFields()) { + field.setAccessible(true); + field.set(dispatcher, field.get(defaultDispatcher)); + } + ObfuscationReflectionHelper.setPrivateValue(BlockRenderDispatcher.class, dispatcher, new ModelBlockRenderer(Minecraft.getInstance().getBlockColors()), "f_110900_"); + } catch (Exception e) { + LOGGER.error("Failed to initialize vanilla BlockRenderDispatcher!", e); + return defaultDispatcher; + } + return dispatcher; + } + + @Override + public BakedModelBuilder createBakedModelBuilder(BakedModel bakedModel) { + return new ForgeBakedModelBuilder(bakedModel); + } + + @Override + public BlockModelBuilder createBlockModelBuilder(BlockState state) { + return new ForgeBlockModelBuilder(state); + } + + @Override + public MultiBlockModelBuilder createMultiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { + return new ForgeMultiBlockModelBuilder(level, positions); + } + + @Override + @Nullable + public ShadersModHandler.InternalHandler createIrisHandler() { + if (!ModList.get() + .isLoaded("oculus")) { + return null; + } + + return new ShadersModHandler.InternalHandler() { + @Override + public boolean isShaderPackInUse() { + return IrisApi.getInstance() + .isShaderPackInUse(); + } + + @Override + public boolean isRenderingShadowPass() { + return IrisApi.getInstance() + .isRenderingShadowPass(); + } + }; + } +} diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelForge.java b/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelForge.java index 90c6cc49c..71439e4e8 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelForge.java +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelForge.java @@ -1,41 +1,36 @@ package com.jozufozu.flywheel.impl; -import java.util.ArrayList; - import org.apache.maven.artifact.versioning.ArtifactVersion; import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.event.BeginFrameEvent; import com.jozufozu.flywheel.api.event.EndClientResourceReloadEvent; import com.jozufozu.flywheel.api.event.ReloadLevelRendererEvent; -import com.jozufozu.flywheel.api.visualization.VisualizationManager; -import com.jozufozu.flywheel.backend.compile.FlwPrograms; +import com.jozufozu.flywheel.api.event.RenderStageEvent; +import com.jozufozu.flywheel.backend.compile.FlwProgramsReloader; import com.jozufozu.flywheel.backend.engine.uniform.Uniforms; -import com.jozufozu.flywheel.config.BackendArgument; -import com.jozufozu.flywheel.config.FlwCommands; -import com.jozufozu.flywheel.config.FlwConfig; -import com.jozufozu.flywheel.config.FlwForgeConfig; import com.jozufozu.flywheel.impl.visualization.VisualizationEventHandler; -import com.jozufozu.flywheel.lib.memory.FlwMemoryTracker; import com.jozufozu.flywheel.lib.model.ModelCache; import com.jozufozu.flywheel.lib.model.ModelHolder; import com.jozufozu.flywheel.lib.model.baked.PartialModelEventHandler; import com.jozufozu.flywheel.lib.util.LevelAttached; -import com.jozufozu.flywheel.lib.util.StringUtil; import net.minecraft.client.Minecraft; import net.minecraft.commands.synchronization.ArgumentTypeInfos; -import net.minecraft.core.Vec3i; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.CustomizeGuiOverlayEvent; import net.minecraftforge.client.event.RegisterClientReloadListenersEvent; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.TickEvent; +import net.minecraftforge.event.entity.EntityJoinLevelEvent; +import net.minecraftforge.event.entity.EntityLeaveLevelEvent; import net.minecraftforge.event.level.LevelEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.CrashReportCallables; import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -43,7 +38,7 @@ import net.minecraftforge.registries.RegisterEvent; @Mod(Flywheel.ID) -public class FlywheelForge { +public final class FlywheelForge { private static ArtifactVersion version; public FlywheelForge() { @@ -57,89 +52,80 @@ public FlywheelForge() { IEventBus forgeEventBus = MinecraftForge.EVENT_BUS; IEventBus modEventBus = FMLJavaModLoadingContext.get() .getModEventBus(); - modEventBus.addListener(FlywheelForge::onCommonSetup); - modEventBus.addListener(FlywheelForge::onRegister); - FlwForgeConfig.INSTANCE.registerSpecs(modLoadingContext); + ForgeFlwConfig.INSTANCE.registerSpecs(modLoadingContext); DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> FlywheelForge.clientInit(forgeEventBus, modEventBus)); } private static void clientInit(IEventBus forgeEventBus, IEventBus modEventBus) { - forgeEventBus.addListener(FlywheelForge::addDebugInfo); + registerImplEventListeners(forgeEventBus, modEventBus); + registerLibEventListeners(forgeEventBus, modEventBus); + registerBackendEventListeners(forgeEventBus, modEventBus); + CrashReportCallables.registerCrashCallable("Flywheel Backend", BackendManagerImpl::getBackendString); + FlywheelInit.init(); + } + + private static void registerImplEventListeners(IEventBus forgeEventBus, IEventBus modEventBus) { forgeEventBus.addListener((ReloadLevelRendererEvent e) -> BackendManagerImpl.onReloadLevelRenderer(e.level())); - forgeEventBus.addListener(VisualizationEventHandler::onClientTick); - forgeEventBus.addListener(VisualizationEventHandler::onBeginFrame); - forgeEventBus.addListener(VisualizationEventHandler::onRenderStage); - forgeEventBus.addListener(VisualizationEventHandler::onEntityJoinLevel); - forgeEventBus.addListener(VisualizationEventHandler::onEntityLeaveLevel); + forgeEventBus.addListener((TickEvent.LevelTickEvent e) -> { + // Make sure we don't tick on the server somehow. + if (e.phase == TickEvent.Phase.END && e.side == LogicalSide.CLIENT) { + VisualizationEventHandler.onClientTick(Minecraft.getInstance(), e.level); + } + }); + forgeEventBus.addListener((BeginFrameEvent e) -> VisualizationEventHandler.onBeginFrame(e.context())); + forgeEventBus.addListener((RenderStageEvent e) -> VisualizationEventHandler.onRenderStage(e.context(), e.stage())); + forgeEventBus.addListener((EntityJoinLevelEvent e) -> VisualizationEventHandler.onEntityJoinLevel(e.getLevel(), e.getEntity())); + forgeEventBus.addListener((EntityLeaveLevelEvent e) -> VisualizationEventHandler.onEntityLeaveLevel(e.getLevel(), e.getEntity())); forgeEventBus.addListener(FlwCommands::registerClientCommands); - forgeEventBus.addListener((EndClientResourceReloadEvent e) -> Uniforms.onReloadLevelRenderer()); + forgeEventBus.addListener((CustomizeGuiOverlayEvent.DebugText e) -> { + Minecraft minecraft = Minecraft.getInstance(); - forgeEventBus.addListener((LevelEvent.Unload e) -> LevelAttached.invalidateLevel(e.getLevel())); + if (!minecraft.options.renderDebug) { + return; + } - modEventBus.addListener(FlywheelForge::registerClientReloadListeners); - modEventBus.addListener(FlywheelForge::onClientSetup); - modEventBus.addListener(FlywheelForge::onLoadComplete); + FlwDebugInfo.addDebugInfo(minecraft, e.getRight()); + }); - modEventBus.addListener((EndClientResourceReloadEvent e) -> BackendManagerImpl.onEndClientResourceReload(e.error().isPresent())); - - modEventBus.addListener((EndClientResourceReloadEvent e) -> ModelCache.onEndClientResourceReload()); - modEventBus.addListener((EndClientResourceReloadEvent e) -> ModelHolder.onEndClientResourceReload()); + modEventBus.addListener((FMLLoadCompleteEvent e) -> FlywheelInit.freezeRegistries()); - modEventBus.addListener(PartialModelEventHandler::onModelRegistry); - modEventBus.addListener(PartialModelEventHandler::onModelBake); + modEventBus.addListener((EndClientResourceReloadEvent e) -> BackendManagerImpl.onEndClientResourceReload(e.error().isPresent())); - Flywheel.earlyInit(); - CrashReportCallables.registerCrashCallable("Flywheel Backend", BackendManagerImpl::getBackendString); + modEventBus.addListener((FMLCommonSetupEvent e) -> { + ArgumentTypeInfos.registerByClass(BackendArgument.class, BackendArgument.INFO); + }); + modEventBus.addListener((RegisterEvent e) -> { + if (e.getRegistryKey().equals(ForgeRegistries.Keys.COMMAND_ARGUMENT_TYPES)) { + e.register(ForgeRegistries.Keys.COMMAND_ARGUMENT_TYPES, Flywheel.rl("backend"), () -> BackendArgument.INFO); + } + }); } - private static void registerClientReloadListeners(RegisterClientReloadListenersEvent event) { - event.registerReloadListener(FlwPrograms.ResourceReloadListener.INSTANCE); - } + private static void registerLibEventListeners(IEventBus forgeEventBus, IEventBus modEventBus) { + forgeEventBus.addListener((LevelEvent.Unload e) -> LevelAttached.invalidateLevel(e.getLevel())); - private static void onClientSetup(FMLClientSetupEvent event) { - Flywheel.init(); - } + modEventBus.addListener((EndClientResourceReloadEvent e) -> ModelCache.onEndClientResourceReload()); + modEventBus.addListener((EndClientResourceReloadEvent e) -> ModelHolder.onEndClientResourceReload()); - private static void onLoadComplete(FMLLoadCompleteEvent event) { - Flywheel.freeze(); + modEventBus.addListener(PartialModelEventHandler::onRegisterAdditional); + modEventBus.addListener(PartialModelEventHandler::onBakingCompleted); } - private static void onCommonSetup(FMLCommonSetupEvent event) { - ArgumentTypeInfos.registerByClass(BackendArgument.class, BackendArgument.INFO); - } + private static void registerBackendEventListeners(IEventBus forgeEventBus, IEventBus modEventBus) { + forgeEventBus.addListener((ReloadLevelRendererEvent e) -> Uniforms.onReloadLevelRenderer()); - private static void onRegister(RegisterEvent event) { - event.register(ForgeRegistries.Keys.COMMAND_ARGUMENT_TYPES, Flywheel.rl("backend"), () -> BackendArgument.INFO); + modEventBus.addListener((RegisterClientReloadListenersEvent e) -> { + e.registerReloadListener(FlwProgramsReloader.INSTANCE); + }); } - private static void addDebugInfo(CustomizeGuiOverlayEvent.DebugText event) { - Minecraft mc = Minecraft.getInstance(); - - if (!mc.options.renderDebug) { - return; - } - - ArrayList info = event.getRight(); - info.add(""); - info.add("Flywheel: " + version); - info.add("Backend: " + BackendManagerImpl.getBackendString()); - info.add("Update limiting: " + (FlwConfig.get().limitUpdates() ? "on" : "off")); - - VisualizationManager manager = VisualizationManager.get(mc.level); - if (manager != null) { - info.add("B: " + manager.getBlockEntities().getVisualCount() - + ", E: " + manager.getEntities().getVisualCount() - + ", F: " + manager.getEffects().getVisualCount()); - Vec3i renderOrigin = manager.getRenderOrigin(); - info.add("Origin: " + renderOrigin.getX() + ", " + renderOrigin.getY() + ", " + renderOrigin.getZ()); - } - - info.add("Memory Usage: CPU: " + StringUtil.formatBytes(FlwMemoryTracker.getCPUMemory()) + ", GPU: " + StringUtil.formatBytes(FlwMemoryTracker.getGPUMemory())); + public static ArtifactVersion version() { + return version; } } diff --git a/forge/src/main/java/com/jozufozu/flywheel/config/FlwForgeConfig.java b/forge/src/main/java/com/jozufozu/flywheel/impl/ForgeFlwConfig.java similarity index 92% rename from forge/src/main/java/com/jozufozu/flywheel/config/FlwForgeConfig.java rename to forge/src/main/java/com/jozufozu/flywheel/impl/ForgeFlwConfig.java index acce638f1..012bea791 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/config/FlwForgeConfig.java +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/ForgeFlwConfig.java @@ -1,4 +1,4 @@ -package com.jozufozu.flywheel.config; +package com.jozufozu.flywheel.impl; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; @@ -14,19 +14,20 @@ import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.config.ModConfig; -public class FlwForgeConfig implements FlwConfig { +public class ForgeFlwConfig implements FlwConfig { private static final Logger LOGGER = LogUtils.getLogger(); - public static final FlwForgeConfig INSTANCE = new FlwForgeConfig(); + public static final ForgeFlwConfig INSTANCE = new ForgeFlwConfig(); public final ClientConfig client; private final ForgeConfigSpec clientSpec; - private FlwForgeConfig() { + private ForgeFlwConfig() { Pair clientPair = new ForgeConfigSpec.Builder().configure(ClientConfig::new); this.client = clientPair.getLeft(); clientSpec = clientPair.getRight(); } + @Override public Backend backend() { Backend backend = parseBackend(client.backend.get()); if (backend == null) { @@ -56,10 +57,12 @@ private static Backend parseBackend(String idStr) { return backend; } + @Override public boolean limitUpdates() { return client.limitUpdates.get(); } + @Override public int workerThreads() { return client.workerThreads.get(); } diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java b/forge/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java deleted file mode 100644 index df837301b..000000000 --- a/forge/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationEventHandler.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.jozufozu.flywheel.impl.visualization; - -import com.jozufozu.flywheel.api.event.BeginFrameEvent; -import com.jozufozu.flywheel.api.event.RenderStageEvent; -import com.jozufozu.flywheel.api.visualization.VisualizationManager; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.world.level.Level; -import net.minecraftforge.event.TickEvent; -import net.minecraftforge.event.entity.EntityJoinLevelEvent; -import net.minecraftforge.event.entity.EntityLeaveLevelEvent; -import net.minecraftforge.fml.LogicalSide; - -// TODO: fabric event handler -public final class VisualizationEventHandler { - private VisualizationEventHandler() { - } - - public static void onClientTick(TickEvent.LevelTickEvent event) { - // Make sure we don't tick on the server somehow. - if (event.phase != TickEvent.Phase.END || event.side != LogicalSide.CLIENT) { - return; - } - - // The game won't be paused in the tick event, but let's make sure there's a player. - if (Minecraft.getInstance().player == null) { - return; - } - - VisualizationManagerImpl manager = VisualizationManagerImpl.get(event.level); - if (manager == null) { - return; - } - - manager.tick(); - } - - public static void onBeginFrame(BeginFrameEvent event) { - ClientLevel level = event.context() - .level(); - VisualizationManagerImpl manager = VisualizationManagerImpl.get(level); - if (manager == null) { - return; - } - - manager.beginFrame(event.context()); - } - - public static void onRenderStage(RenderStageEvent event) { - ClientLevel level = event.context() - .level(); - VisualizationManagerImpl manager = VisualizationManagerImpl.get(level); - if (manager == null) { - return; - } - - manager.renderStage(event.context(), event.stage()); - } - - public static void onEntityJoinLevel(EntityJoinLevelEvent event) { - Level level = event.getLevel(); - VisualizationManager manager = VisualizationManager.get(level); - if (manager == null) { - return; - } - - manager.getEntities().queueAdd(event.getEntity()); - } - - public static void onEntityLeaveLevel(EntityLeaveLevelEvent event) { - Level level = event.getLevel(); - VisualizationManager manager = VisualizationManager.get(level); - if (manager == null) { - return; - } - - manager.getEntities().queueRemove(event.getEntity()); - } -} diff --git a/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java b/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java index 0c2f4d57a..9957b2f2c 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java +++ b/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java @@ -1,9 +1,19 @@ package com.jozufozu.flywheel.lib.model.baked; +import java.util.Map; + +import org.jetbrains.annotations.ApiStatus; + +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.client.event.ModelEvent; -public class PartialModelEventHandler { - public static void onModelRegistry(ModelEvent.RegisterAdditional event) { +@ApiStatus.Internal +public final class PartialModelEventHandler { + private PartialModelEventHandler() { + } + + public static void onRegisterAdditional(ModelEvent.RegisterAdditional event) { for (PartialModel partial : PartialModel.ALL) { event.register(partial.getLocation()); } @@ -11,10 +21,11 @@ public static void onModelRegistry(ModelEvent.RegisterAdditional event) { PartialModel.tooLate = true; } - public static void onModelBake(ModelEvent.BakingCompleted event) { - var modelRegistry = event.getModels(); + public static void onBakingCompleted(ModelEvent.BakingCompleted event) { + Map models = event.getModels(); + for (PartialModel partial : PartialModel.ALL) { - partial.set(modelRegistry.get(partial.getLocation())); + partial.set(models.get(partial.getLocation())); } } } diff --git a/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java b/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java deleted file mode 100644 index 8c2ae01a0..000000000 --- a/forge/src/main/java/com/jozufozu/flywheel/platform/ClientPlatformImpl.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.jozufozu.flywheel.platform; - -import java.lang.reflect.Field; - -import org.jetbrains.annotations.Nullable; -import org.slf4j.Logger; - -import com.jozufozu.flywheel.api.event.BeginFrameEvent; -import com.jozufozu.flywheel.api.event.ReloadLevelRendererEvent; -import com.jozufozu.flywheel.api.event.RenderContext; -import com.jozufozu.flywheel.api.event.RenderStage; -import com.jozufozu.flywheel.api.event.RenderStageEvent; -import com.jozufozu.flywheel.config.FlwConfig; -import com.jozufozu.flywheel.config.FlwForgeConfig; -import com.jozufozu.flywheel.lib.model.baked.BakedModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.BlockModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.ForgeBakedModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.ForgeBlockModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.ForgeMultiBlockModelBuilder; -import com.jozufozu.flywheel.lib.model.baked.MultiBlockModelBuilder; -import com.jozufozu.flywheel.lib.util.ShadersModHandler; -import com.mojang.logging.LogUtils; - -import net.irisshaders.iris.api.v0.IrisApi; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.block.BlockRenderDispatcher; -import net.minecraft.client.renderer.block.ModelBlockRenderer; -import net.minecraft.client.resources.model.BakedModel; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.BlockAndTintGetter; -import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.ModList; -import net.minecraftforge.fml.util.ObfuscationReflectionHelper; - -public class ClientPlatformImpl implements ClientPlatform { - private static final Logger LOGGER = LogUtils.getLogger(); - - @Override - public void dispatchReloadLevelRenderer(ClientLevel level) { - MinecraftForge.EVENT_BUS.post(new ReloadLevelRendererEvent(level)); - } - - @Override - public void dispatchBeginFrame(RenderContext context) { - MinecraftForge.EVENT_BUS.post(new BeginFrameEvent(context)); - } - - @Override - public void dispatchRenderStage(RenderContext context, RenderStage stage) { - MinecraftForge.EVENT_BUS.post(new RenderStageEvent(context, stage)); - } - - @Override - public boolean isModLoaded(String modid) { - return ModList.get() - .isLoaded(modid); - } - - @Override - @Nullable - public ShadersModHandler.InternalHandler createIrisOculusHandlerIfPresent() { - if (isModLoaded("oculus")) { - return new ShadersModHandler.InternalHandler() { - @Override - public boolean isShaderPackInUse() { - return IrisApi.getInstance() - .isShaderPackInUse(); - } - - @Override - public boolean isRenderingShadowPass() { - return IrisApi.getInstance() - .isRenderingShadowPass(); - } - }; - } else { - return null; - } - } - - @Override - public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos) { - return state.getLightEmission(level, pos); - } - - @Override - public FlwConfig getConfigInstance() { - return FlwForgeConfig.INSTANCE; - } - - @Override - public BlockRenderDispatcher createVanillaRenderer() { - BlockRenderDispatcher defaultDispatcher = Minecraft.getInstance().getBlockRenderer(); - BlockRenderDispatcher dispatcher = new BlockRenderDispatcher(null, null, null); - try { - for (Field field : BlockRenderDispatcher.class.getDeclaredFields()) { - field.setAccessible(true); - field.set(dispatcher, field.get(defaultDispatcher)); - } - ObfuscationReflectionHelper.setPrivateValue(BlockRenderDispatcher.class, dispatcher, new ModelBlockRenderer(Minecraft.getInstance().getBlockColors()), "f_110900_"); - } catch (Exception e) { - LOGGER.error("Failed to initialize vanilla BlockRenderDispatcher!", e); - return defaultDispatcher; - } - return dispatcher; - } - - @Override - public BakedModelBuilder bakedModelBuilder(BakedModel bakedModel) { - return new ForgeBakedModelBuilder(bakedModel); - } - - @Override - public BlockModelBuilder blockModelBuilder(BlockState state) { - return new ForgeBlockModelBuilder(state); - } - - @Override - public MultiBlockModelBuilder multiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { - return new ForgeMultiBlockModelBuilder(level, positions); - } -} diff --git a/gradle.properties b/gradle.properties index 04eec2432..7a24509e8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ mod_homepage = https://github.com/Jozufozu/Flywheel # Mod dependency declarations minecraft_semver_version_range = >=1.20.1 <1.20.2 minecraft_maven_version_range = [1.20.1,1.20.2) -fabric_api_version_range = >=0.84.0 +fabric_api_version_range = >=0.86.0 forge_version_range = [47.0.0,) # General build dependency versions From 6d36f66060e15eca53505e1915ff3392d4df183e Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Mon, 22 Apr 2024 15:39:08 -0700 Subject: [PATCH 19/62] Remove old DependencyInjection#load method --- .../api/internal/DependencyInjection.java | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/common/src/main/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java b/common/src/main/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java index 74280b12c..403b4a785 100644 --- a/common/src/main/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java +++ b/common/src/main/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java @@ -39,38 +39,4 @@ public static T load(Class apiClass, String implClassName) { return apiClass.cast(implInstance); } - - private static FlwApiLink load() { - Class apiClass = FlwApiLink.class; - Class implClass; - - try { - implClass = Class.forName("com.jozufozu.flywheel.impl.FlwApiLinkImpl"); - } catch (ReflectiveOperationException e) { - throw new RuntimeException("Could not find implementation", e); - } - - if (!apiClass.isAssignableFrom(implClass)) { - throw new RuntimeException("Class %s does not implement interface %s" - .formatted(implClass.getName(), apiClass.getName())); - } - - Constructor implConstructor; - - try { - implConstructor = implClass.getConstructor(); - } catch (ReflectiveOperationException e) { - throw new RuntimeException("Could not find default constructor", e); - } - - Object implInstance; - - try { - implInstance = implConstructor.newInstance(); - } catch (ReflectiveOperationException e) { - throw new RuntimeException("Could not instantiate implementation", e); - } - - return apiClass.cast(implInstance); - } } From 819863a11256e10c20f542c0dc25153a617dedbc Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Mon, 22 Apr 2024 23:25:56 -0700 Subject: [PATCH 20/62] Fix javadoc task --- buildSrc/simple-java.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/buildSrc/simple-java.gradle b/buildSrc/simple-java.gradle index 3c74a001a..e74eba5e9 100644 --- a/buildSrc/simple-java.gradle +++ b/buildSrc/simple-java.gradle @@ -49,6 +49,7 @@ tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> javadoc.source sourceSets.main.allJava // prevent java 8's strict doclint for javadocs from failing builds javadoc.options.addStringOption('Xdoclint:none', '-quiet') + javadoc.options.encoding = 'UTF-8' } static void addLicense(Jar jarTask) { From 3c7ecddcc870f41906bb60a5f5504618f8a22a61 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Tue, 23 Apr 2024 00:14:19 -0700 Subject: [PATCH 21/62] Fix artifactIds --- common/build.gradle | 4 ++-- fabric/build.gradle | 2 +- forge/build.gradle | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/build.gradle b/common/build.gradle index 076a9c801..8eae69c2b 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -21,11 +21,11 @@ test { publishing { publications { - register('mavenJava', MavenPublication) { + register('mavenIntermediary', MavenPublication) { from(components['java']) artifactId = "flywheel-${project.name}-intermediary-${artifact_minecraft_version}" } - register('mojmapJava', MavenPublication) { + register('mavenMojmap', MavenPublication) { artifact jar artifact sourcesJar artifactId = "flywheel-${project.name}-mojmap-${artifact_minecraft_version}" diff --git a/fabric/build.gradle b/fabric/build.gradle index f04a6c6ad..c5837720e 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -24,7 +24,7 @@ publishing { publications { register('mavenJava', MavenPublication) { from(components['java']) - artifactId = "flywheel-${project.name}-intermediary-${artifact_minecraft_version}" + artifactId = "flywheel-${project.name}-${artifact_minecraft_version}" } } } diff --git a/forge/build.gradle b/forge/build.gradle index e33ef4ae1..ffcfd816f 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -38,7 +38,7 @@ publishing { publications { register('mavenJava', MavenPublication) { from(components['java']) - artifactId = "flywheel-${project.name}-intermediary-${artifact_minecraft_version}" + artifactId = "flywheel-${project.name}-${artifact_minecraft_version}" } } } From b30b1f7e0d5eb7006aa28327951fc6fe4d39fb75 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Tue, 23 Apr 2024 03:42:07 -0700 Subject: [PATCH 22/62] Fix refmaps --- buildSrc/subprojects.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/buildSrc/subprojects.gradle b/buildSrc/subprojects.gradle index 967b3d6c4..4d87d9606 100644 --- a/buildSrc/subprojects.gradle +++ b/buildSrc/subprojects.gradle @@ -1,5 +1,9 @@ loom { silentMojangMappingsLicense() + + mixin { + defaultRefmapName = "flywheel.refmap.json" + } } repositories { From 1b41ba3e46714bb788b60eca5bbf98961dd40234 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Tue, 23 Apr 2024 04:04:22 -0700 Subject: [PATCH 23/62] Fix forge remapping --- gradle.properties | 1 - 1 file changed, 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 7a24509e8..0f45aed79 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,5 @@ org.gradle.jvmargs = -Xmx3G org.gradle.daemon = false -fabric.loom.multiProjectOptimisation=true # Mod metadata mod_id = flywheel From 82c7adedb729acba213522096cbaaae21d8c86b6 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Wed, 24 Apr 2024 14:06:20 -0700 Subject: [PATCH 24/62] Centrifuge - Separate common project into 4 source sets - Declare outgoing configurations for forge/fabric to depend on - Re-compile source from each source set in each platform's compileJava --- buildSrc/platforms.gradle | 30 ++++++++-- common/build.gradle | 59 ++++++++++++++++++- .../flywheel/api/BackendImplemented.java | 0 .../flywheel/api/backend/Backend.java | 0 .../flywheel/api/backend/BackendManager.java | 0 .../jozufozu/flywheel/api/backend/Engine.java | 0 .../flywheel/api/event/RenderContext.java | 0 .../flywheel/api/event/RenderStage.java | 0 .../flywheel/api/instance/Instance.java | 0 .../flywheel/api/instance/InstanceHandle.java | 0 .../flywheel/api/instance/InstanceType.java | 0 .../flywheel/api/instance/InstanceWriter.java | 0 .../flywheel/api/instance/Instancer.java | 0 .../api/instance/InstancerProvider.java | 0 .../api/internal/DependencyInjection.java | 0 .../flywheel/api/internal/FlwApiLink.java | 0 .../flywheel/api/internal/package-info.java | 0 .../flywheel/api/layout/ArrayElementType.java | 0 .../flywheel/api/layout/ElementType.java | 0 .../flywheel/api/layout/FloatRepr.java | 0 .../flywheel/api/layout/IntegerRepr.java | 0 .../jozufozu/flywheel/api/layout/Layout.java | 0 .../flywheel/api/layout/LayoutBuilder.java | 0 .../api/layout/MatrixElementType.java | 0 .../api/layout/ScalarElementType.java | 0 .../api/layout/UnsignedIntegerRepr.java | 0 .../flywheel/api/layout/ValueRepr.java | 0 .../api/layout/VectorElementType.java | 0 .../flywheel/api/material/CutoutShader.java | 0 .../flywheel/api/material/DepthTest.java | 0 .../flywheel/api/material/FogShader.java | 0 .../flywheel/api/material/Material.java | 0 .../api/material/MaterialShaders.java | 0 .../flywheel/api/material/Transparency.java | 0 .../flywheel/api/material/WriteMask.java | 0 .../flywheel/api/model/IndexSequence.java | 0 .../com/jozufozu/flywheel/api/model/Mesh.java | 0 .../jozufozu/flywheel/api/model/Model.java | 0 .../flywheel/api/registry/IdRegistry.java | 0 .../flywheel/api/registry/Registry.java | 0 .../com/jozufozu/flywheel/api/task/Plan.java | 0 .../flywheel/api/task/TaskExecutor.java | 0 .../api/vertex/MutableVertexList.java | 0 .../flywheel/api/vertex/VertexList.java | 0 .../flywheel/api/vertex/VertexView.java | 0 .../api/vertex/VertexViewProvider.java | 0 .../vertex/VertexViewProviderRegistry.java | 0 .../api/visual/BlockEntityVisual.java | 0 .../api/visual/DistanceUpdateLimiter.java | 0 .../flywheel/api/visual/DynamicVisual.java | 0 .../jozufozu/flywheel/api/visual/Effect.java | 0 .../flywheel/api/visual/EffectVisual.java | 0 .../flywheel/api/visual/EntityVisual.java | 0 .../flywheel/api/visual/LitVisual.java | 0 .../flywheel/api/visual/TickableVisual.java | 0 .../jozufozu/flywheel/api/visual/Visual.java | 0 .../visualization/BlockEntityVisualizer.java | 0 .../api/visualization/EntityVisualizer.java | 0 .../api/visualization/VisualEmbedding.java | 0 .../api/visualization/VisualManager.java | 0 .../visualization/VisualizationContext.java | 0 .../api/visualization/VisualizationLevel.java | 0 .../visualization/VisualizationManager.java | 0 .../api/visualization/VisualizerRegistry.java | 0 .../jozufozu/flywheel/backend/Backends.java | 0 .../flywheel/backend/FlwBackendXplat.java | 0 .../flywheel/backend/InternalVertex.java | 0 .../flywheel/backend/LayoutAttributes.java | 0 .../jozufozu/flywheel/backend/Samplers.java | 0 .../flywheel/backend/ShaderIndices.java | 0 .../backend/compile/ContextShader.java | 0 .../flywheel/backend/compile/FlwPrograms.java | 0 .../backend/compile/IndirectPrograms.java | 0 .../backend/compile/InstancingPrograms.java | 0 .../backend/compile/LayoutInterpreter.java | 0 .../flywheel/backend/compile/Pipeline.java | 0 .../backend/compile/PipelineCompiler.java | 0 .../backend/compile/PipelineProgramKey.java | 0 .../flywheel/backend/compile/Pipelines.java | 0 .../backend/compile/SourceChecks.java | 0 .../BufferTextureInstanceComponent.java | 0 .../component/InstanceAssemblerComponent.java | 0 .../component/InstanceStructComponent.java | 0 .../component/SsboInstanceComponent.java | 0 .../StringSubstitutionComponent.java | 0 .../component/UberShaderComponent.java | 0 .../backend/compile/core/Compilation.java | 0 .../compile/core/CompilationHarness.java | 0 .../backend/compile/core/Compile.java | 0 .../backend/compile/core/CompilerStats.java | 0 .../compile/core/FailedCompilation.java | 0 .../backend/compile/core/LinkResult.java | 0 .../backend/compile/core/ProgramLinker.java | 0 .../backend/compile/core/ShaderCache.java | 0 .../backend/compile/core/ShaderResult.java | 0 .../backend/compile/core/SourceLoader.java | 0 .../backend/engine/AbstractInstancer.java | 0 .../backend/engine/CommonCrumbling.java | 0 .../flywheel/backend/engine/DrawManager.java | 0 .../flywheel/backend/engine/EngineImpl.java | 0 .../backend/engine/EnvironmentStorage.java | 0 .../flywheel/backend/engine/GroupKey.java | 0 .../flywheel/backend/engine/IndexPool.java | 0 .../backend/engine/InstanceHandleImpl.java | 0 .../flywheel/backend/engine/InstancerKey.java | 0 .../backend/engine/InstancerProviderImpl.java | 0 .../backend/engine/MaterialEncoder.java | 0 .../backend/engine/MaterialRenderState.java | 0 .../flywheel/backend/engine/MeshPool.java | 0 .../backend/engine/TextureBinder.java | 0 .../embed/AbstractEmbeddedEnvironment.java | 0 .../engine/embed/EmbeddedLightTexture.java | 0 .../engine/embed/EmbeddedLightVolume.java | 0 .../engine/embed/EmbeddingUniforms.java | 0 .../backend/engine/embed/Environment.java | 0 .../engine/embed/GlobalEnvironment.java | 0 .../embed/NestedEmbeddedEnvironment.java | 0 .../embed/TopLevelEmbeddedEnvironment.java | 0 .../engine/indirect/IndirectBuffers.java | 0 .../engine/indirect/IndirectCullingGroup.java | 0 .../backend/engine/indirect/IndirectDraw.java | 0 .../engine/indirect/IndirectDrawManager.java | 0 .../engine/indirect/IndirectInstancer.java | 0 .../indirect/ResizableStorageArray.java | 0 .../indirect/ResizableStorageBuffer.java | 0 .../backend/engine/indirect/ScatterList.java | 0 .../engine/indirect/StagingBuffer.java | 0 .../backend/engine/indirect/TransferList.java | 0 .../engine/instancing/InstancedDraw.java | 0 .../instancing/InstancedDrawManager.java | 0 .../engine/instancing/InstancedInstancer.java | 0 .../instancing/InstancedRenderStage.java | 0 .../backend/engine/uniform/DebugMode.java | 0 .../backend/engine/uniform/FogUniforms.java | 0 .../backend/engine/uniform/FrameUniforms.java | 0 .../backend/engine/uniform/LevelUniforms.java | 0 .../engine/uniform/OptionsUniforms.java | 0 .../engine/uniform/PlayerUniforms.java | 0 .../backend/engine/uniform/UniformBuffer.java | 0 .../backend/engine/uniform/UniformWriter.java | 0 .../backend/engine/uniform/Uniforms.java | 0 .../jozufozu/flywheel/backend/gl/Driver.java | 0 .../flywheel/backend/gl/GlCompat.java | 0 .../jozufozu/flywheel/backend/gl/GlFence.java | 0 .../flywheel/backend/gl/GlNumericType.java | 0 .../flywheel/backend/gl/GlObject.java | 0 .../flywheel/backend/gl/GlPrimitive.java | 0 .../flywheel/backend/gl/GlStateTracker.java | 0 .../flywheel/backend/gl/GlTexture.java | 0 .../flywheel/backend/gl/GlTextureUnit.java | 0 .../flywheel/backend/gl/TextureBuffer.java | 0 .../backend/gl/array/GlVertexArray.java | 0 .../backend/gl/array/GlVertexArrayDSA.java | 0 .../backend/gl/array/GlVertexArrayGL3.java | 0 .../GlVertexArraySeparateAttributes.java | 0 .../backend/gl/array/VertexAttribute.java | 0 .../flywheel/backend/gl/buffer/Buffer.java | 0 .../flywheel/backend/gl/buffer/GlBuffer.java | 0 .../backend/gl/buffer/GlBufferType.java | 0 .../backend/gl/buffer/GlBufferUsage.java | 0 .../flywheel/backend/gl/error/GlError.java | 0 .../backend/gl/error/GlException.java | 0 .../flywheel/backend/gl/shader/GlProgram.java | 0 .../flywheel/backend/gl/shader/GlShader.java | 0 .../backend/gl/shader/ShaderType.java | 0 .../flywheel/backend/glsl/GlslVersion.java | 0 .../flywheel/backend/glsl/LoadError.java | 0 .../flywheel/backend/glsl/LoadResult.java | 0 .../flywheel/backend/glsl/ShaderSources.java | 0 .../backend/glsl/SourceComponent.java | 0 .../flywheel/backend/glsl/SourceFile.java | 0 .../flywheel/backend/glsl/SourceLines.java | 0 .../backend/glsl/error/ConsoleColors.java | 0 .../backend/glsl/error/ErrorBuilder.java | 0 .../backend/glsl/error/ErrorLevel.java | 0 .../backend/glsl/error/lines/Divider.java | 0 .../backend/glsl/error/lines/ErrorLine.java | 0 .../backend/glsl/error/lines/FileLine.java | 0 .../backend/glsl/error/lines/HeaderLine.java | 0 .../backend/glsl/error/lines/NestedLine.java | 0 .../backend/glsl/error/lines/SourceLine.java | 0 .../glsl/error/lines/SpanHighlightLine.java | 0 .../backend/glsl/error/lines/TextLine.java | 0 .../flywheel/backend/glsl/generate/BinOp.java | 0 .../backend/glsl/generate/FnSignature.java | 0 .../backend/glsl/generate/GlslBlock.java | 0 .../backend/glsl/generate/GlslBuilder.java | 0 .../backend/glsl/generate/GlslExpr.java | 0 .../backend/glsl/generate/GlslFn.java | 0 .../backend/glsl/generate/GlslStmt.java | 0 .../backend/glsl/generate/GlslStruct.java | 0 .../backend/glsl/generate/GlslSwitch.java | 0 .../glsl/generate/GlslUniformBlock.java | 0 .../glsl/generate/GlslVertexInput.java | 0 .../flywheel/backend/glsl/parse/Import.java | 0 .../backend/glsl/parse/ShaderField.java | 0 .../backend/glsl/parse/ShaderFunction.java | 0 .../backend/glsl/parse/ShaderStruct.java | 0 .../backend/glsl/parse/ShaderVariable.java | 0 .../backend/glsl/parse/StructField.java | 0 .../flywheel/backend/glsl/span/CharPos.java | 0 .../flywheel/backend/glsl/span/ErrorSpan.java | 0 .../flywheel/backend/glsl/span/Span.java | 0 .../backend/glsl/span/StringSpan.java | 0 .../mixin/AbstractClientPlayerAccessor.java | 0 .../backend/mixin/GameRendererAccessor.java | 0 .../backend/mixin/GlStateManagerMixin.java | 0 .../backend/mixin/LevelRendererAccessor.java | 0 .../backend/mixin/LightTextureAccessor.java | 0 .../flywheel/backend/mixin/OptionsMixin.java | 0 .../backend/mixin/OverlayTextureAccessor.java | 0 .../backend/mixin/RenderSystemMixin.java | 0 .../backend/util/AtomicReferenceCounted.java | 0 .../flywheel/backend/util/MemoryBuffer.java | 0 .../backend/util/ReferenceCounted.java | 0 .../flywheel/flywheel/internal/api_impl.frag | 0 .../flywheel/flywheel/internal/api_impl.vert | 0 .../flywheel/flywheel/internal/colorizer.glsl | 0 .../flywheel/flywheel/internal/common.frag | 0 .../flywheel/flywheel/internal/common.vert | 0 .../flywheel/internal/components_header.frag | 0 .../flywheel/internal/components_header.vert | 0 .../flywheel/flywheel/internal/diffuse.glsl | 0 .../flywheel/internal/fog_distance.glsl | 0 .../flywheel/internal/indirect/apply.glsl | 0 .../internal/indirect/buffer_bindings.glsl | 0 .../flywheel/internal/indirect/cull.glsl | 0 .../internal/indirect/cull_api_impl.glsl | 0 .../internal/indirect/draw_command.glsl | 0 .../flywheel/internal/indirect/main.frag | 0 .../flywheel/internal/indirect/main.vert | 0 .../internal/indirect/model_descriptor.glsl | 0 .../flywheel/internal/indirect/scatter.glsl | 0 .../flywheel/internal/instancing/main.frag | 0 .../flywheel/internal/instancing/main.vert | 0 .../flywheel/flywheel/internal/material.glsl | 0 .../flywheel/internal/packed_material.glsl | 0 .../flywheel/internal/uniforms/fog.glsl | 0 .../flywheel/internal/uniforms/frame.glsl | 0 .../flywheel/internal/uniforms/level.glsl | 0 .../flywheel/internal/uniforms/options.glsl | 0 .../flywheel/internal/uniforms/player.glsl | 0 .../flywheel/internal/uniforms/uniforms.glsl | 0 .../flywheel/internal/vertex_input.vert | 0 .../java/com/jozufozu/flywheel/Flywheel.java | 0 .../flywheel/lib/backend/SimpleBackend.java | 0 .../com/jozufozu/flywheel/lib/box/Box.java | 0 .../jozufozu/flywheel/lib/box/MutableBox.java | 0 .../lib/instance/AbstractInstance.java | 0 .../lib/instance/ColoredLitInstance.java | 0 .../flywheel/lib/instance/FlatLit.java | 0 .../flywheel/lib/instance/InstanceTypes.java | 0 .../lib/instance/OrientedInstance.java | 0 .../flywheel/lib/instance/ShadowInstance.java | 0 .../lib/instance/SimpleInstanceType.java | 0 .../lib/instance/TransformedInstance.java | 0 .../flywheel/lib/internal/FlwLibLink.java | 0 .../flywheel/lib/internal/FlwLibXplat.java | 0 .../flywheel/lib/internal/package-info.java | 0 .../flywheel/lib/light/LightPacking.java | 0 .../flywheel/lib/light/LightVolume.java | 0 .../flywheel/lib/material/CutoutShaders.java | 0 .../flywheel/lib/material/FogShaders.java | 0 .../flywheel/lib/material/Materials.java | 0 .../lib/material/SimpleCutoutShader.java | 0 .../lib/material/SimpleFogShader.java | 0 .../flywheel/lib/material/SimpleMaterial.java | 0 .../lib/material/SimpleMaterialShaders.java | 0 .../lib/material/StandardMaterialShaders.java | 0 .../flywheel/lib/math/MatrixMath.java | 0 .../jozufozu/flywheel/lib/math/MoreMath.java | 0 .../flywheel/lib/math/RenderMath.java | 0 .../lib/memory/AbstractMemoryBlockImpl.java | 0 .../lib/memory/DebugMemoryBlockImpl.java | 0 .../flywheel/lib/memory/FlwMemoryTracker.java | 0 .../flywheel/lib/memory/MemoryBlock.java | 0 .../flywheel/lib/memory/MemoryBlockImpl.java | 0 .../lib/memory/TrackedMemoryBlockImpl.java | 0 .../flywheel/lib/model/LineModelBuilder.java | 0 .../flywheel/lib/model/ModelCache.java | 0 .../flywheel/lib/model/ModelHolder.java | 0 .../flywheel/lib/model/ModelUtil.java | 0 .../jozufozu/flywheel/lib/model/Models.java | 0 .../flywheel/lib/model/QuadIndexSequence.java | 0 .../jozufozu/flywheel/lib/model/QuadMesh.java | 0 .../flywheel/lib/model/SimpleMesh.java | 0 .../flywheel/lib/model/SimpleModel.java | 0 .../flywheel/lib/model/SingleMeshModel.java | 0 .../lib/model/baked/BakedModelBuilder.java | 0 .../lib/model/baked/BlockModelBuilder.java | 0 .../flywheel/lib/model/baked/MeshEmitter.java | 0 .../model/baked/MultiBlockModelBuilder.java | 0 .../lib/model/baked/PartialModel.java | 0 .../baked/TransformingVertexConsumer.java | 0 .../lib/model/baked/VirtualBlockGetter.java | 0 .../model/baked/VirtualEmptyBlockGetter.java | 0 .../lib/model/baked/VirtualLightEngine.java | 0 .../lib/model/part/ModelPartConverter.java | 0 .../flywheel/lib/model/part/VertexWriter.java | 0 .../flywheel/lib/task/BarrierPlan.java | 0 .../flywheel/lib/task/Distribute.java | 0 .../flywheel/lib/task/DynamicNestedPlan.java | 0 .../com/jozufozu/flywheel/lib/task/Flag.java | 0 .../flywheel/lib/task/ForEachPlan.java | 0 .../flywheel/lib/task/ForEachSlicePlan.java | 0 .../flywheel/lib/task/IfElsePlan.java | 0 .../flywheel/lib/task/MapContextPlan.java | 0 .../jozufozu/flywheel/lib/task/NamedFlag.java | 0 .../flywheel/lib/task/NestedPlan.java | 0 .../jozufozu/flywheel/lib/task/PlanMap.java | 0 .../jozufozu/flywheel/lib/task/RaisePlan.java | 0 .../flywheel/lib/task/RunnablePlan.java | 0 .../flywheel/lib/task/SimplePlan.java | 0 .../flywheel/lib/task/SimplyComposedPlan.java | 0 .../jozufozu/flywheel/lib/task/StageFlag.java | 0 .../flywheel/lib/task/SyncedPlan.java | 0 .../flywheel/lib/task/Synchronizer.java | 0 .../jozufozu/flywheel/lib/task/UnitPlan.java | 0 .../BooleanSupplierWithContext.java | 0 .../task/functional/ConsumerWithContext.java | 0 .../task/functional/RunnableWithContext.java | 0 .../task/functional/SupplierWithContext.java | 0 .../lib/task/functional/package-info.java | 0 .../flywheel/lib/transform/Affine.java | 0 .../lib/transform/PoseTransformStack.java | 0 .../flywheel/lib/transform/Rotate.java | 0 .../flywheel/lib/transform/Scale.java | 0 .../flywheel/lib/transform/Transform.java | 0 .../lib/transform/TransformStack.java | 0 .../flywheel/lib/transform/Translate.java | 0 .../flywheel/lib/util/AtomicBitset.java | 0 .../jozufozu/flywheel/lib/util/FlwUtil.java | 0 .../flywheel/lib/util/LevelAttached.java | 0 .../com/jozufozu/flywheel/lib/util/Pair.java | 0 .../flywheel/lib/util/ResourceUtil.java | 0 .../flywheel/lib/util/SectionUtil.java | 0 .../flywheel/lib/util/ShadersModHandler.java | 0 .../flywheel/lib/util/StringUtil.java | 0 .../com/jozufozu/flywheel/lib/util/Unit.java | 0 .../lib/vertex/AbstractVertexView.java | 0 .../flywheel/lib/vertex/EmptyVertexList.java | 0 .../flywheel/lib/vertex/FullVertexView.java | 0 .../lib/vertex/NoOverlayVertexView.java | 0 .../lib/vertex/PosTexNormalVertexView.java | 0 .../flywheel/lib/vertex/PosVertexView.java | 0 .../lib/visual/AbstractBlockEntityVisual.java | 0 .../lib/visual/AbstractEntityVisual.java | 0 .../flywheel/lib/visual/AbstractVisual.java | 0 .../flywheel/lib/visual/EntityComponent.java | 0 .../lib/visual/EntityVisibilityTester.java | 0 .../flywheel/lib/visual/InstanceRecycler.java | 0 .../visual/SimpleBlockEntityVisualizer.java | 0 .../lib/visual/SimpleDynamicVisual.java | 0 .../lib/visual/SimpleEntityVisual.java | 0 .../lib/visual/SimpleEntityVisualizer.java | 0 .../lib/visual/SimpleTickableVisual.java | 0 .../flywheel/lib/visual/SmartRecycler.java | 0 .../lib/visual/component/FireComponent.java | 0 .../lib/visual/component/HitboxComponent.java | 0 .../lib/visual/component/ShadowComponent.java | 0 .../flywheel/flywheel/cutout/epsilon.glsl | 0 .../assets/flywheel/flywheel/cutout/half.glsl | 0 .../assets/flywheel/flywheel/cutout/off.glsl | 0 .../flywheel/flywheel/cutout/one_tenth.glsl | 0 .../assets/flywheel/flywheel/fog/linear.glsl | 0 .../flywheel/flywheel/fog/linear_fade.glsl | 0 .../assets/flywheel/flywheel/fog/none.glsl | 0 .../flywheel/instance/cull/oriented.glsl | 0 .../flywheel/instance/cull/shadow.glsl | 0 .../flywheel/instance/cull/transformed.glsl | 0 .../flywheel/flywheel/instance/oriented.vert | 0 .../flywheel/flywheel/instance/shadow.vert | 0 .../flywheel/instance/transformed.vert | 0 .../flywheel/flywheel/material/default.frag | 0 .../flywheel/flywheel/material/default.vert | 0 .../flywheel/flywheel/material/lines.frag | 0 .../flywheel/flywheel/material/lines.vert | 0 .../flywheel/flywheel/material/wireframe.frag | 0 .../flywheel/flywheel/material/wireframe.vert | 0 .../assets/flywheel/flywheel/util/color.glsl | 0 .../assets/flywheel/flywheel/util/matrix.glsl | 0 .../flywheel/flywheel/util/quaternion.glsl | 0 fabric/build.gradle | 2 - forge/build.gradle | 2 - 384 files changed, 82 insertions(+), 11 deletions(-) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/BackendImplemented.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/backend/Backend.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/backend/BackendManager.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/backend/Engine.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/event/RenderContext.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/event/RenderStage.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/instance/Instance.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/instance/InstanceHandle.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/instance/InstanceType.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/instance/InstanceWriter.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/instance/Instancer.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/instance/InstancerProvider.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/internal/FlwApiLink.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/internal/package-info.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/layout/ArrayElementType.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/layout/ElementType.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/layout/FloatRepr.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/layout/IntegerRepr.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/layout/Layout.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/layout/LayoutBuilder.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/layout/MatrixElementType.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/layout/ScalarElementType.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/layout/UnsignedIntegerRepr.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/layout/ValueRepr.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/layout/VectorElementType.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/material/CutoutShader.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/material/DepthTest.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/material/FogShader.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/material/Material.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/material/MaterialShaders.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/material/Transparency.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/material/WriteMask.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/model/IndexSequence.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/model/Mesh.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/model/Model.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/registry/IdRegistry.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/registry/Registry.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/task/Plan.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/task/TaskExecutor.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/vertex/MutableVertexList.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/vertex/VertexList.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/vertex/VertexView.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/vertex/VertexViewProvider.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/vertex/VertexViewProviderRegistry.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visual/BlockEntityVisual.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visual/DistanceUpdateLimiter.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visual/DynamicVisual.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visual/Effect.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visual/EffectVisual.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visual/EntityVisual.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visual/LitVisual.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visual/TickableVisual.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visual/Visual.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visualization/BlockEntityVisualizer.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visualization/EntityVisualizer.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visualization/VisualEmbedding.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visualization/VisualManager.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visualization/VisualizationContext.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visualization/VisualizationLevel.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visualization/VisualizationManager.java (100%) rename common/src/{main => api}/java/com/jozufozu/flywheel/api/visualization/VisualizerRegistry.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/Backends.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/FlwBackendXplat.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/InternalVertex.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/LayoutAttributes.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/Samplers.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/ShaderIndices.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/ContextShader.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/LayoutInterpreter.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/Pipeline.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/PipelineProgramKey.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/Pipelines.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/SourceChecks.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/component/BufferTextureInstanceComponent.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/component/InstanceAssemblerComponent.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/component/SsboInstanceComponent.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/component/StringSubstitutionComponent.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/component/UberShaderComponent.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/core/CompilationHarness.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/core/Compile.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/core/CompilerStats.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/core/FailedCompilation.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/core/LinkResult.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/core/ProgramLinker.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/core/ShaderCache.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/core/ShaderResult.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/core/SourceLoader.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/AbstractInstancer.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/CommonCrumbling.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/DrawManager.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/EngineImpl.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/EnvironmentStorage.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/GroupKey.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/IndexPool.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/InstanceHandleImpl.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/InstancerKey.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/InstancerProviderImpl.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/MaterialEncoder.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/MaterialRenderState.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/MeshPool.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/TextureBinder.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/embed/AbstractEmbeddedEnvironment.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightTexture.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightVolume.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddingUniforms.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/embed/Environment.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/embed/GlobalEnvironment.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/embed/NestedEmbeddedEnvironment.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/embed/TopLevelEmbeddedEnvironment.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectBuffers.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectCullingGroup.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDraw.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDrawManager.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectInstancer.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageArray.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageBuffer.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/indirect/ScatterList.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/indirect/StagingBuffer.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/indirect/TransferList.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDraw.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDrawManager.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedInstancer.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedRenderStage.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/uniform/DebugMode.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/uniform/FogUniforms.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/uniform/LevelUniforms.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/uniform/OptionsUniforms.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/uniform/UniformBuffer.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/uniform/UniformWriter.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/Driver.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/GlCompat.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/GlFence.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/GlNumericType.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/GlObject.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/GlPrimitive.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/GlStateTracker.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/GlTexture.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/GlTextureUnit.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/TextureBuffer.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArray.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayDSA.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayGL3.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArraySeparateAttributes.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/array/VertexAttribute.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/buffer/Buffer.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferType.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferUsage.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/error/GlError.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/error/GlException.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/shader/GlProgram.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/shader/GlShader.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/gl/shader/ShaderType.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/GlslVersion.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/LoadError.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/LoadResult.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/ShaderSources.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/SourceComponent.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/SourceFile.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/SourceLines.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/error/ConsoleColors.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/error/ErrorBuilder.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/error/ErrorLevel.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/error/lines/Divider.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/error/lines/ErrorLine.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/error/lines/FileLine.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/error/lines/HeaderLine.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/error/lines/NestedLine.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/error/lines/SourceLine.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/error/lines/SpanHighlightLine.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/error/lines/TextLine.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/generate/BinOp.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/generate/FnSignature.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBlock.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBuilder.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/generate/GlslExpr.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/generate/GlslFn.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStmt.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStruct.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/generate/GlslSwitch.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/generate/GlslUniformBlock.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/generate/GlslVertexInput.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/parse/Import.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderField.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderFunction.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderStruct.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderVariable.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/parse/StructField.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/span/CharPos.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/span/ErrorSpan.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/span/Span.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/glsl/span/StringSpan.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/mixin/AbstractClientPlayerAccessor.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/mixin/GameRendererAccessor.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/mixin/GlStateManagerMixin.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/mixin/LevelRendererAccessor.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/mixin/LightTextureAccessor.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/mixin/OptionsMixin.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/mixin/OverlayTextureAccessor.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/mixin/RenderSystemMixin.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/util/AtomicReferenceCounted.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/util/MemoryBuffer.java (100%) rename common/src/{main => backend}/java/com/jozufozu/flywheel/backend/util/ReferenceCounted.java (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/api_impl.frag (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/api_impl.vert (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/colorizer.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/common.frag (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/common.vert (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/components_header.frag (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/components_header.vert (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/diffuse.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/fog_distance.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/indirect/apply.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/indirect/buffer_bindings.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/indirect/cull_api_impl.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/indirect/draw_command.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/indirect/main.frag (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/indirect/main.vert (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/indirect/model_descriptor.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/indirect/scatter.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/instancing/main.frag (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/instancing/main.vert (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/material.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/packed_material.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/uniforms/fog.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/uniforms/frame.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/uniforms/level.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/uniforms/options.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/uniforms/player.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/uniforms/uniforms.glsl (100%) rename common/src/{main => backend}/resources/assets/flywheel/flywheel/internal/vertex_input.vert (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/Flywheel.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/backend/SimpleBackend.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/box/Box.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/box/MutableBox.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/instance/AbstractInstance.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/instance/ColoredLitInstance.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/instance/FlatLit.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/instance/OrientedInstance.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/instance/ShadowInstance.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/instance/SimpleInstanceType.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/instance/TransformedInstance.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/internal/FlwLibLink.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/internal/FlwLibXplat.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/internal/package-info.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/light/LightPacking.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/light/LightVolume.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/material/CutoutShaders.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/material/FogShaders.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/material/Materials.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/material/SimpleCutoutShader.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/material/SimpleFogShader.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/material/SimpleMaterial.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/material/SimpleMaterialShaders.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/math/MatrixMath.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/math/MoreMath.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/math/RenderMath.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/memory/AbstractMemoryBlockImpl.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/memory/DebugMemoryBlockImpl.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/memory/FlwMemoryTracker.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/memory/MemoryBlock.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/memory/MemoryBlockImpl.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/memory/TrackedMemoryBlockImpl.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/LineModelBuilder.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/ModelCache.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/ModelHolder.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/ModelUtil.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/Models.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/QuadIndexSequence.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/QuadMesh.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/SimpleMesh.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/SimpleModel.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/SingleMeshModel.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/TransformingVertexConsumer.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/VirtualBlockGetter.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/VirtualEmptyBlockGetter.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/VirtualLightEngine.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/part/ModelPartConverter.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/part/VertexWriter.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/BarrierPlan.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/Distribute.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/DynamicNestedPlan.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/Flag.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/ForEachPlan.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/ForEachSlicePlan.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/IfElsePlan.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/MapContextPlan.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/NamedFlag.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/NestedPlan.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/PlanMap.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/RaisePlan.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/RunnablePlan.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/SimplePlan.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/SimplyComposedPlan.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/StageFlag.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/SyncedPlan.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/Synchronizer.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/UnitPlan.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/functional/BooleanSupplierWithContext.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/functional/ConsumerWithContext.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/functional/RunnableWithContext.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/functional/SupplierWithContext.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/task/functional/package-info.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/transform/Affine.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/transform/PoseTransformStack.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/transform/Rotate.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/transform/Scale.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/transform/Transform.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/transform/TransformStack.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/transform/Translate.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/util/AtomicBitset.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/util/FlwUtil.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/util/LevelAttached.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/util/Pair.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/util/ResourceUtil.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/util/SectionUtil.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/util/StringUtil.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/util/Unit.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/vertex/AbstractVertexView.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/vertex/EmptyVertexList.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/vertex/FullVertexView.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/vertex/NoOverlayVertexView.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/vertex/PosTexNormalVertexView.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/vertex/PosVertexView.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/visual/AbstractBlockEntityVisual.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/visual/AbstractEntityVisual.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/visual/AbstractVisual.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/visual/EntityComponent.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/visual/EntityVisibilityTester.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/visual/InstanceRecycler.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/visual/SimpleBlockEntityVisualizer.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisual.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisualizer.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/visual/SmartRecycler.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/visual/component/FireComponent.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/visual/component/HitboxComponent.java (100%) rename common/src/{main => lib}/java/com/jozufozu/flywheel/lib/visual/component/ShadowComponent.java (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/cutout/epsilon.glsl (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/cutout/half.glsl (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/cutout/off.glsl (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/cutout/one_tenth.glsl (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/fog/linear.glsl (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/fog/linear_fade.glsl (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/fog/none.glsl (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/instance/cull/oriented.glsl (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/instance/cull/shadow.glsl (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/instance/cull/transformed.glsl (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/instance/oriented.vert (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/instance/shadow.vert (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/instance/transformed.vert (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/material/default.frag (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/material/default.vert (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/material/lines.frag (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/material/lines.vert (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/material/wireframe.frag (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/material/wireframe.vert (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/util/color.glsl (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/util/matrix.glsl (100%) rename common/src/{main => lib}/resources/assets/flywheel/flywheel/util/quaternion.glsl (100%) diff --git a/buildSrc/platforms.gradle b/buildSrc/platforms.gradle index f8200edaf..19e7feddb 100644 --- a/buildSrc/platforms.gradle +++ b/buildSrc/platforms.gradle @@ -25,17 +25,37 @@ loom { } } +dependencies { + compileOnly project(path: ':common', configuration: 'commonApi') + compileOnly project(path: ':common', configuration: 'commonLib') + compileOnly project(path: ':common', configuration: 'commonBackend') + compileOnly project(path: ':common', configuration: 'commonImpl') +} + +SourceSet commonApiSource = project(':common').sourceSets.api +SourceSet commonLibSource = project(':common').sourceSets.lib +SourceSet commonBackendSource = project(':common').sourceSets.backend +SourceSet commonMainSource = project(':common').sourceSets.main + +def commonSources = [commonApiSource, commonLibSource, commonBackendSource, commonMainSource] + tasks.named('processResources', ProcessResources).configure { ProcessResources processResources -> - processResources.from project(':common').tasks.named('processResources', ProcessResources).get().source + // No resources in API + processResources.from commonLibSource.resources + processResources.from commonBackendSource.resources + processResources.from commonMainSource.resources } tasks.named('compileJava', JavaCompile).configure { JavaCompile compileJava -> - compileJava.source project(':common').tasks.named('compileJava', JavaCompile).get().source + // TODO: Can we avoid this duplication? Would be nice to repackage the 4 common jars without having to re compile + commonSources.forEach { compileJava.source it.allJava } + excludeDuplicatePackageInfos(compileJava) } tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> - javadoc.source project(':common').tasks.named('javadoc', Javadoc).get().source + commonSources.forEach { javadoc.source it.allJava } + excludeDuplicatePackageInfos(javadoc) } @@ -44,9 +64,7 @@ tasks.named('jar', Jar).configure { Jar jar -> } tasks.named('sourcesJar', Jar).configure { Jar jar -> - def commonSources = project(':common').tasks.named('sourcesJar', Jar) - dependsOn commonSources - jar.from zipTree(commonSources.flatMap { it.archiveFile }) + commonSources.forEach { jar.from it.allJava } excludeDuplicatePackageInfos(jar) } diff --git a/common/build.gradle b/common/build.gradle index 8eae69c2b..802838ba7 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -7,7 +7,64 @@ plugins { apply from: rootProject.file('buildSrc/simple-java.gradle') apply from: rootProject.file('buildSrc/subprojects.gradle') -apply from: rootProject.file('buildSrc/package-infos.gradle') +// TODO: package-infos specifically targets the main source set +// apply from: rootProject.file('buildSrc/package-infos.gradle') + +sourceSets { + // Loom only populates mc stuff to the main source set, + // so grab that here and use it for the others. + // Note that the `+` operator does NOT perform a deep copy + // of a FileCollection, so this object is shared between + // the source sets and we should avoid mutating it. + FileCollection mcCompileClassPath = main.compileClasspath + + SourceSet api = api { + compileClasspath = mcCompileClassPath + } + SourceSet lib = lib { + compileClasspath = mcCompileClassPath + api.output + } + SourceSet backend = backend { + compileClasspath = mcCompileClassPath + api.output + lib.output + } + + main { + // Assign here rather than concatenate to avoid modifying the mcCompileClassPath FileCollection + compileClasspath = mcCompileClassPath + api.output + lib.output + backend.output + } + + test { + // Only test needs runtimeClasspath filled since the game shouldn't run from common alone. + // Fine to concatenate here. + compileClasspath += api.output + lib.output + backend.output + runtimeClasspath += api.output + lib.output + backend.output + } +} + +TaskProvider createJarAndOutgoingConfiguration(String name) { + return createJarAndOutgoingConfiguration(name, sourceSets.named(name).get()) +} + +TaskProvider createJarAndOutgoingConfiguration(String name, SourceSet sourceSet) { + def config = configurations.register("common${name.capitalize()}") { + canBeConsumed = true + canBeResolved = false + } + def jarTask = tasks.register("${name}Jar", Jar) { + archiveClassifier.set(name) + from sourceSet.output + } + + artifacts.add(config.name, jarTask) + + return jarTask +} + +// TODO: repackage these for maven publication +def apiJar = createJarAndOutgoingConfiguration("api") +def libJar = createJarAndOutgoingConfiguration("lib") +def backendJar = createJarAndOutgoingConfiguration("backend") +def implJar = createJarAndOutgoingConfiguration("impl", sourceSets.main) dependencies { modCompileOnly "net.fabricmc:fabric-loader:${fabric_loader_version}" diff --git a/common/src/main/java/com/jozufozu/flywheel/api/BackendImplemented.java b/common/src/api/java/com/jozufozu/flywheel/api/BackendImplemented.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/BackendImplemented.java rename to common/src/api/java/com/jozufozu/flywheel/api/BackendImplemented.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/backend/Backend.java b/common/src/api/java/com/jozufozu/flywheel/api/backend/Backend.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/backend/Backend.java rename to common/src/api/java/com/jozufozu/flywheel/api/backend/Backend.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/backend/BackendManager.java b/common/src/api/java/com/jozufozu/flywheel/api/backend/BackendManager.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/backend/BackendManager.java rename to common/src/api/java/com/jozufozu/flywheel/api/backend/BackendManager.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/backend/Engine.java b/common/src/api/java/com/jozufozu/flywheel/api/backend/Engine.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/backend/Engine.java rename to common/src/api/java/com/jozufozu/flywheel/api/backend/Engine.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/event/RenderContext.java b/common/src/api/java/com/jozufozu/flywheel/api/event/RenderContext.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/event/RenderContext.java rename to common/src/api/java/com/jozufozu/flywheel/api/event/RenderContext.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/event/RenderStage.java b/common/src/api/java/com/jozufozu/flywheel/api/event/RenderStage.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/event/RenderStage.java rename to common/src/api/java/com/jozufozu/flywheel/api/event/RenderStage.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/instance/Instance.java b/common/src/api/java/com/jozufozu/flywheel/api/instance/Instance.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/instance/Instance.java rename to common/src/api/java/com/jozufozu/flywheel/api/instance/Instance.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceHandle.java b/common/src/api/java/com/jozufozu/flywheel/api/instance/InstanceHandle.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceHandle.java rename to common/src/api/java/com/jozufozu/flywheel/api/instance/InstanceHandle.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceType.java b/common/src/api/java/com/jozufozu/flywheel/api/instance/InstanceType.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceType.java rename to common/src/api/java/com/jozufozu/flywheel/api/instance/InstanceType.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceWriter.java b/common/src/api/java/com/jozufozu/flywheel/api/instance/InstanceWriter.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/instance/InstanceWriter.java rename to common/src/api/java/com/jozufozu/flywheel/api/instance/InstanceWriter.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/instance/Instancer.java b/common/src/api/java/com/jozufozu/flywheel/api/instance/Instancer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/instance/Instancer.java rename to common/src/api/java/com/jozufozu/flywheel/api/instance/Instancer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/instance/InstancerProvider.java b/common/src/api/java/com/jozufozu/flywheel/api/instance/InstancerProvider.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/instance/InstancerProvider.java rename to common/src/api/java/com/jozufozu/flywheel/api/instance/InstancerProvider.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java b/common/src/api/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java rename to common/src/api/java/com/jozufozu/flywheel/api/internal/DependencyInjection.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/internal/FlwApiLink.java b/common/src/api/java/com/jozufozu/flywheel/api/internal/FlwApiLink.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/internal/FlwApiLink.java rename to common/src/api/java/com/jozufozu/flywheel/api/internal/FlwApiLink.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/internal/package-info.java b/common/src/api/java/com/jozufozu/flywheel/api/internal/package-info.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/internal/package-info.java rename to common/src/api/java/com/jozufozu/flywheel/api/internal/package-info.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/layout/ArrayElementType.java b/common/src/api/java/com/jozufozu/flywheel/api/layout/ArrayElementType.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/layout/ArrayElementType.java rename to common/src/api/java/com/jozufozu/flywheel/api/layout/ArrayElementType.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/layout/ElementType.java b/common/src/api/java/com/jozufozu/flywheel/api/layout/ElementType.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/layout/ElementType.java rename to common/src/api/java/com/jozufozu/flywheel/api/layout/ElementType.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/layout/FloatRepr.java b/common/src/api/java/com/jozufozu/flywheel/api/layout/FloatRepr.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/layout/FloatRepr.java rename to common/src/api/java/com/jozufozu/flywheel/api/layout/FloatRepr.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/layout/IntegerRepr.java b/common/src/api/java/com/jozufozu/flywheel/api/layout/IntegerRepr.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/layout/IntegerRepr.java rename to common/src/api/java/com/jozufozu/flywheel/api/layout/IntegerRepr.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/layout/Layout.java b/common/src/api/java/com/jozufozu/flywheel/api/layout/Layout.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/layout/Layout.java rename to common/src/api/java/com/jozufozu/flywheel/api/layout/Layout.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/layout/LayoutBuilder.java b/common/src/api/java/com/jozufozu/flywheel/api/layout/LayoutBuilder.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/layout/LayoutBuilder.java rename to common/src/api/java/com/jozufozu/flywheel/api/layout/LayoutBuilder.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/layout/MatrixElementType.java b/common/src/api/java/com/jozufozu/flywheel/api/layout/MatrixElementType.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/layout/MatrixElementType.java rename to common/src/api/java/com/jozufozu/flywheel/api/layout/MatrixElementType.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/layout/ScalarElementType.java b/common/src/api/java/com/jozufozu/flywheel/api/layout/ScalarElementType.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/layout/ScalarElementType.java rename to common/src/api/java/com/jozufozu/flywheel/api/layout/ScalarElementType.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/layout/UnsignedIntegerRepr.java b/common/src/api/java/com/jozufozu/flywheel/api/layout/UnsignedIntegerRepr.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/layout/UnsignedIntegerRepr.java rename to common/src/api/java/com/jozufozu/flywheel/api/layout/UnsignedIntegerRepr.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/layout/ValueRepr.java b/common/src/api/java/com/jozufozu/flywheel/api/layout/ValueRepr.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/layout/ValueRepr.java rename to common/src/api/java/com/jozufozu/flywheel/api/layout/ValueRepr.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/layout/VectorElementType.java b/common/src/api/java/com/jozufozu/flywheel/api/layout/VectorElementType.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/layout/VectorElementType.java rename to common/src/api/java/com/jozufozu/flywheel/api/layout/VectorElementType.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/material/CutoutShader.java b/common/src/api/java/com/jozufozu/flywheel/api/material/CutoutShader.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/material/CutoutShader.java rename to common/src/api/java/com/jozufozu/flywheel/api/material/CutoutShader.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/material/DepthTest.java b/common/src/api/java/com/jozufozu/flywheel/api/material/DepthTest.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/material/DepthTest.java rename to common/src/api/java/com/jozufozu/flywheel/api/material/DepthTest.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/material/FogShader.java b/common/src/api/java/com/jozufozu/flywheel/api/material/FogShader.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/material/FogShader.java rename to common/src/api/java/com/jozufozu/flywheel/api/material/FogShader.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/material/Material.java b/common/src/api/java/com/jozufozu/flywheel/api/material/Material.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/material/Material.java rename to common/src/api/java/com/jozufozu/flywheel/api/material/Material.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/material/MaterialShaders.java b/common/src/api/java/com/jozufozu/flywheel/api/material/MaterialShaders.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/material/MaterialShaders.java rename to common/src/api/java/com/jozufozu/flywheel/api/material/MaterialShaders.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/material/Transparency.java b/common/src/api/java/com/jozufozu/flywheel/api/material/Transparency.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/material/Transparency.java rename to common/src/api/java/com/jozufozu/flywheel/api/material/Transparency.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/material/WriteMask.java b/common/src/api/java/com/jozufozu/flywheel/api/material/WriteMask.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/material/WriteMask.java rename to common/src/api/java/com/jozufozu/flywheel/api/material/WriteMask.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/model/IndexSequence.java b/common/src/api/java/com/jozufozu/flywheel/api/model/IndexSequence.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/model/IndexSequence.java rename to common/src/api/java/com/jozufozu/flywheel/api/model/IndexSequence.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/model/Mesh.java b/common/src/api/java/com/jozufozu/flywheel/api/model/Mesh.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/model/Mesh.java rename to common/src/api/java/com/jozufozu/flywheel/api/model/Mesh.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/model/Model.java b/common/src/api/java/com/jozufozu/flywheel/api/model/Model.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/model/Model.java rename to common/src/api/java/com/jozufozu/flywheel/api/model/Model.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/registry/IdRegistry.java b/common/src/api/java/com/jozufozu/flywheel/api/registry/IdRegistry.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/registry/IdRegistry.java rename to common/src/api/java/com/jozufozu/flywheel/api/registry/IdRegistry.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/registry/Registry.java b/common/src/api/java/com/jozufozu/flywheel/api/registry/Registry.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/registry/Registry.java rename to common/src/api/java/com/jozufozu/flywheel/api/registry/Registry.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/task/Plan.java b/common/src/api/java/com/jozufozu/flywheel/api/task/Plan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/task/Plan.java rename to common/src/api/java/com/jozufozu/flywheel/api/task/Plan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/task/TaskExecutor.java b/common/src/api/java/com/jozufozu/flywheel/api/task/TaskExecutor.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/task/TaskExecutor.java rename to common/src/api/java/com/jozufozu/flywheel/api/task/TaskExecutor.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/vertex/MutableVertexList.java b/common/src/api/java/com/jozufozu/flywheel/api/vertex/MutableVertexList.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/vertex/MutableVertexList.java rename to common/src/api/java/com/jozufozu/flywheel/api/vertex/MutableVertexList.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexList.java b/common/src/api/java/com/jozufozu/flywheel/api/vertex/VertexList.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexList.java rename to common/src/api/java/com/jozufozu/flywheel/api/vertex/VertexList.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexView.java b/common/src/api/java/com/jozufozu/flywheel/api/vertex/VertexView.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexView.java rename to common/src/api/java/com/jozufozu/flywheel/api/vertex/VertexView.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProvider.java b/common/src/api/java/com/jozufozu/flywheel/api/vertex/VertexViewProvider.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProvider.java rename to common/src/api/java/com/jozufozu/flywheel/api/vertex/VertexViewProvider.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProviderRegistry.java b/common/src/api/java/com/jozufozu/flywheel/api/vertex/VertexViewProviderRegistry.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/vertex/VertexViewProviderRegistry.java rename to common/src/api/java/com/jozufozu/flywheel/api/vertex/VertexViewProviderRegistry.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visual/BlockEntityVisual.java b/common/src/api/java/com/jozufozu/flywheel/api/visual/BlockEntityVisual.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visual/BlockEntityVisual.java rename to common/src/api/java/com/jozufozu/flywheel/api/visual/BlockEntityVisual.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visual/DistanceUpdateLimiter.java b/common/src/api/java/com/jozufozu/flywheel/api/visual/DistanceUpdateLimiter.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visual/DistanceUpdateLimiter.java rename to common/src/api/java/com/jozufozu/flywheel/api/visual/DistanceUpdateLimiter.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visual/DynamicVisual.java b/common/src/api/java/com/jozufozu/flywheel/api/visual/DynamicVisual.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visual/DynamicVisual.java rename to common/src/api/java/com/jozufozu/flywheel/api/visual/DynamicVisual.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visual/Effect.java b/common/src/api/java/com/jozufozu/flywheel/api/visual/Effect.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visual/Effect.java rename to common/src/api/java/com/jozufozu/flywheel/api/visual/Effect.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visual/EffectVisual.java b/common/src/api/java/com/jozufozu/flywheel/api/visual/EffectVisual.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visual/EffectVisual.java rename to common/src/api/java/com/jozufozu/flywheel/api/visual/EffectVisual.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visual/EntityVisual.java b/common/src/api/java/com/jozufozu/flywheel/api/visual/EntityVisual.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visual/EntityVisual.java rename to common/src/api/java/com/jozufozu/flywheel/api/visual/EntityVisual.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visual/LitVisual.java b/common/src/api/java/com/jozufozu/flywheel/api/visual/LitVisual.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visual/LitVisual.java rename to common/src/api/java/com/jozufozu/flywheel/api/visual/LitVisual.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visual/TickableVisual.java b/common/src/api/java/com/jozufozu/flywheel/api/visual/TickableVisual.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visual/TickableVisual.java rename to common/src/api/java/com/jozufozu/flywheel/api/visual/TickableVisual.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visual/Visual.java b/common/src/api/java/com/jozufozu/flywheel/api/visual/Visual.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visual/Visual.java rename to common/src/api/java/com/jozufozu/flywheel/api/visual/Visual.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visualization/BlockEntityVisualizer.java b/common/src/api/java/com/jozufozu/flywheel/api/visualization/BlockEntityVisualizer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visualization/BlockEntityVisualizer.java rename to common/src/api/java/com/jozufozu/flywheel/api/visualization/BlockEntityVisualizer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visualization/EntityVisualizer.java b/common/src/api/java/com/jozufozu/flywheel/api/visualization/EntityVisualizer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visualization/EntityVisualizer.java rename to common/src/api/java/com/jozufozu/flywheel/api/visualization/EntityVisualizer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualEmbedding.java b/common/src/api/java/com/jozufozu/flywheel/api/visualization/VisualEmbedding.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualEmbedding.java rename to common/src/api/java/com/jozufozu/flywheel/api/visualization/VisualEmbedding.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualManager.java b/common/src/api/java/com/jozufozu/flywheel/api/visualization/VisualManager.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualManager.java rename to common/src/api/java/com/jozufozu/flywheel/api/visualization/VisualManager.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationContext.java b/common/src/api/java/com/jozufozu/flywheel/api/visualization/VisualizationContext.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationContext.java rename to common/src/api/java/com/jozufozu/flywheel/api/visualization/VisualizationContext.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationLevel.java b/common/src/api/java/com/jozufozu/flywheel/api/visualization/VisualizationLevel.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationLevel.java rename to common/src/api/java/com/jozufozu/flywheel/api/visualization/VisualizationLevel.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationManager.java b/common/src/api/java/com/jozufozu/flywheel/api/visualization/VisualizationManager.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizationManager.java rename to common/src/api/java/com/jozufozu/flywheel/api/visualization/VisualizationManager.java diff --git a/common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizerRegistry.java b/common/src/api/java/com/jozufozu/flywheel/api/visualization/VisualizerRegistry.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/api/visualization/VisualizerRegistry.java rename to common/src/api/java/com/jozufozu/flywheel/api/visualization/VisualizerRegistry.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/Backends.java b/common/src/backend/java/com/jozufozu/flywheel/backend/Backends.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/Backends.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/Backends.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplat.java b/common/src/backend/java/com/jozufozu/flywheel/backend/FlwBackendXplat.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplat.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/FlwBackendXplat.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/InternalVertex.java b/common/src/backend/java/com/jozufozu/flywheel/backend/InternalVertex.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/InternalVertex.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/InternalVertex.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/LayoutAttributes.java b/common/src/backend/java/com/jozufozu/flywheel/backend/LayoutAttributes.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/LayoutAttributes.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/LayoutAttributes.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/Samplers.java b/common/src/backend/java/com/jozufozu/flywheel/backend/Samplers.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/Samplers.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/Samplers.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/ShaderIndices.java b/common/src/backend/java/com/jozufozu/flywheel/backend/ShaderIndices.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/ShaderIndices.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/ShaderIndices.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/ContextShader.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/ContextShader.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/ContextShader.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/ContextShader.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/LayoutInterpreter.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/LayoutInterpreter.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/LayoutInterpreter.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/LayoutInterpreter.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/Pipeline.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/Pipeline.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/Pipeline.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/Pipeline.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/PipelineProgramKey.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineProgramKey.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/PipelineProgramKey.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineProgramKey.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/Pipelines.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/Pipelines.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/Pipelines.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/Pipelines.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/SourceChecks.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/SourceChecks.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/SourceChecks.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/SourceChecks.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/BufferTextureInstanceComponent.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/BufferTextureInstanceComponent.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/component/BufferTextureInstanceComponent.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/BufferTextureInstanceComponent.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceAssemblerComponent.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/InstanceAssemblerComponent.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceAssemblerComponent.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/InstanceAssemblerComponent.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/SsboInstanceComponent.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/SsboInstanceComponent.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/component/SsboInstanceComponent.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/SsboInstanceComponent.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/StringSubstitutionComponent.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/StringSubstitutionComponent.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/component/StringSubstitutionComponent.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/StringSubstitutionComponent.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/component/UberShaderComponent.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/UberShaderComponent.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/component/UberShaderComponent.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/UberShaderComponent.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/CompilationHarness.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/CompilationHarness.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/core/CompilationHarness.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/CompilationHarness.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/Compile.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compile.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/core/Compile.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compile.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/CompilerStats.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/CompilerStats.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/core/CompilerStats.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/CompilerStats.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/FailedCompilation.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/FailedCompilation.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/core/FailedCompilation.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/FailedCompilation.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/LinkResult.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/LinkResult.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/core/LinkResult.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/LinkResult.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/ProgramLinker.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/ProgramLinker.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/core/ProgramLinker.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/ProgramLinker.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/ShaderCache.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/ShaderCache.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/core/ShaderCache.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/ShaderCache.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/ShaderResult.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/ShaderResult.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/core/ShaderResult.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/ShaderResult.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/compile/core/SourceLoader.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/SourceLoader.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/compile/core/SourceLoader.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/SourceLoader.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/AbstractInstancer.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/AbstractInstancer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/AbstractInstancer.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/AbstractInstancer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/CommonCrumbling.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/CommonCrumbling.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/CommonCrumbling.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/CommonCrumbling.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/DrawManager.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/DrawManager.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/DrawManager.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/DrawManager.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/EngineImpl.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/EngineImpl.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/EngineImpl.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/EngineImpl.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/EnvironmentStorage.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/EnvironmentStorage.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/EnvironmentStorage.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/EnvironmentStorage.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/GroupKey.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/GroupKey.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/GroupKey.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/GroupKey.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/IndexPool.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/IndexPool.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/IndexPool.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/IndexPool.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/InstanceHandleImpl.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/InstanceHandleImpl.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/InstanceHandleImpl.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/InstanceHandleImpl.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/InstancerKey.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/InstancerKey.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/InstancerKey.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/InstancerKey.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/InstancerProviderImpl.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/InstancerProviderImpl.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/InstancerProviderImpl.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/InstancerProviderImpl.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/MaterialEncoder.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/MaterialEncoder.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/MaterialEncoder.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/MaterialEncoder.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/MaterialRenderState.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/MaterialRenderState.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/MaterialRenderState.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/MaterialRenderState.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/MeshPool.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/MeshPool.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/MeshPool.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/MeshPool.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/TextureBinder.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/TextureBinder.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/TextureBinder.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/TextureBinder.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/AbstractEmbeddedEnvironment.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/AbstractEmbeddedEnvironment.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/AbstractEmbeddedEnvironment.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/AbstractEmbeddedEnvironment.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightTexture.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightTexture.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightTexture.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightTexture.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightVolume.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightVolume.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightVolume.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddedLightVolume.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddingUniforms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddingUniforms.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddingUniforms.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/EmbeddingUniforms.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/Environment.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/Environment.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/Environment.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/Environment.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/GlobalEnvironment.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/GlobalEnvironment.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/GlobalEnvironment.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/GlobalEnvironment.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/NestedEmbeddedEnvironment.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/NestedEmbeddedEnvironment.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/NestedEmbeddedEnvironment.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/NestedEmbeddedEnvironment.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/TopLevelEmbeddedEnvironment.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/TopLevelEmbeddedEnvironment.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/embed/TopLevelEmbeddedEnvironment.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/embed/TopLevelEmbeddedEnvironment.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectBuffers.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectBuffers.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectBuffers.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectBuffers.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectCullingGroup.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectCullingGroup.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectCullingGroup.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectCullingGroup.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDraw.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDraw.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDraw.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDraw.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDrawManager.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDrawManager.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDrawManager.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectDrawManager.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectInstancer.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectInstancer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectInstancer.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/IndirectInstancer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageArray.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageArray.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageArray.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageArray.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageBuffer.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageBuffer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageBuffer.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/ResizableStorageBuffer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ScatterList.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/ScatterList.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/ScatterList.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/ScatterList.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/StagingBuffer.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/StagingBuffer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/StagingBuffer.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/StagingBuffer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/TransferList.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/TransferList.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/indirect/TransferList.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/indirect/TransferList.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDraw.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDraw.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDraw.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDraw.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDrawManager.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDrawManager.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDrawManager.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedDrawManager.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedInstancer.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedInstancer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedInstancer.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedInstancer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedRenderStage.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedRenderStage.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedRenderStage.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/instancing/InstancedRenderStage.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/DebugMode.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/DebugMode.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/DebugMode.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/DebugMode.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FogUniforms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/FogUniforms.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FogUniforms.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/FogUniforms.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/LevelUniforms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/LevelUniforms.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/LevelUniforms.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/LevelUniforms.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/OptionsUniforms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/OptionsUniforms.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/OptionsUniforms.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/OptionsUniforms.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/PlayerUniforms.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformBuffer.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/UniformBuffer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformBuffer.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/UniformBuffer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformWriter.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/UniformWriter.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/UniformWriter.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/UniformWriter.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/Driver.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/Driver.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/Driver.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/Driver.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlCompat.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/GlCompat.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlFence.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlFence.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/GlFence.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlFence.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlNumericType.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlNumericType.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/GlNumericType.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlNumericType.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlObject.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlObject.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/GlObject.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlObject.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlPrimitive.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlPrimitive.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/GlPrimitive.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlPrimitive.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlStateTracker.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlStateTracker.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/GlStateTracker.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlStateTracker.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlTexture.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlTexture.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/GlTexture.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlTexture.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/GlTextureUnit.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlTextureUnit.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/GlTextureUnit.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlTextureUnit.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/TextureBuffer.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/TextureBuffer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/TextureBuffer.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/TextureBuffer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArray.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArray.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArray.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArray.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayDSA.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayDSA.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayDSA.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayDSA.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayGL3.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayGL3.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayGL3.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArrayGL3.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArraySeparateAttributes.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArraySeparateAttributes.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArraySeparateAttributes.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/array/GlVertexArraySeparateAttributes.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/array/VertexAttribute.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/array/VertexAttribute.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/array/VertexAttribute.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/array/VertexAttribute.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/Buffer.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/buffer/Buffer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/Buffer.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/buffer/Buffer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferType.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferType.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferType.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferType.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferUsage.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferUsage.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferUsage.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/buffer/GlBufferUsage.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/error/GlError.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/error/GlError.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/error/GlError.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/error/GlError.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/error/GlException.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/error/GlException.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/error/GlException.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/error/GlException.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/shader/GlProgram.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/shader/GlProgram.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/shader/GlProgram.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/shader/GlProgram.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/shader/GlShader.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/shader/GlShader.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/shader/GlShader.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/shader/GlShader.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/gl/shader/ShaderType.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/shader/ShaderType.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/gl/shader/ShaderType.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/gl/shader/ShaderType.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/GlslVersion.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/GlslVersion.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/GlslVersion.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/GlslVersion.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/LoadError.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/LoadError.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/LoadError.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/LoadError.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/LoadResult.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/LoadResult.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/LoadResult.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/LoadResult.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/ShaderSources.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/ShaderSources.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/ShaderSources.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/ShaderSources.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/SourceComponent.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/SourceComponent.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/SourceComponent.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/SourceComponent.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/SourceFile.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/SourceFile.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/SourceFile.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/SourceFile.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/SourceLines.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/SourceLines.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/SourceLines.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/SourceLines.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/ConsoleColors.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/ConsoleColors.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/ConsoleColors.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/ConsoleColors.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/ErrorBuilder.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/ErrorBuilder.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/ErrorBuilder.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/ErrorBuilder.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/ErrorLevel.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/ErrorLevel.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/ErrorLevel.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/ErrorLevel.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/Divider.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/Divider.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/Divider.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/Divider.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/ErrorLine.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/ErrorLine.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/ErrorLine.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/ErrorLine.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/FileLine.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/FileLine.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/FileLine.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/FileLine.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/HeaderLine.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/HeaderLine.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/HeaderLine.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/HeaderLine.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/NestedLine.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/NestedLine.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/NestedLine.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/NestedLine.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/SourceLine.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/SourceLine.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/SourceLine.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/SourceLine.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/SpanHighlightLine.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/SpanHighlightLine.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/SpanHighlightLine.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/SpanHighlightLine.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/TextLine.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/TextLine.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/error/lines/TextLine.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/error/lines/TextLine.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/BinOp.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/BinOp.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/BinOp.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/BinOp.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/FnSignature.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/FnSignature.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/FnSignature.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/FnSignature.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBlock.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBlock.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBlock.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBlock.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBuilder.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBuilder.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBuilder.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslBuilder.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslExpr.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslExpr.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslExpr.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslExpr.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslFn.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslFn.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslFn.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslFn.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStmt.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStmt.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStmt.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStmt.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStruct.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStruct.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStruct.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslStruct.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslSwitch.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslSwitch.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslSwitch.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslSwitch.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslUniformBlock.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslUniformBlock.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslUniformBlock.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslUniformBlock.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslVertexInput.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslVertexInput.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/generate/GlslVertexInput.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/generate/GlslVertexInput.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/Import.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/parse/Import.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/Import.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/parse/Import.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderField.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderField.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderField.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderField.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderFunction.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderFunction.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderFunction.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderFunction.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderStruct.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderStruct.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderStruct.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderStruct.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderVariable.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderVariable.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderVariable.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/parse/ShaderVariable.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/StructField.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/parse/StructField.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/parse/StructField.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/parse/StructField.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/CharPos.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/span/CharPos.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/CharPos.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/span/CharPos.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/ErrorSpan.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/span/ErrorSpan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/ErrorSpan.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/span/ErrorSpan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/Span.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/span/Span.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/Span.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/span/Span.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/StringSpan.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/span/StringSpan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/glsl/span/StringSpan.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/glsl/span/StringSpan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/mixin/AbstractClientPlayerAccessor.java b/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/AbstractClientPlayerAccessor.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/mixin/AbstractClientPlayerAccessor.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/mixin/AbstractClientPlayerAccessor.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/mixin/GameRendererAccessor.java b/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/GameRendererAccessor.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/mixin/GameRendererAccessor.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/mixin/GameRendererAccessor.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/mixin/GlStateManagerMixin.java b/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/GlStateManagerMixin.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/mixin/GlStateManagerMixin.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/mixin/GlStateManagerMixin.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/mixin/LevelRendererAccessor.java b/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/LevelRendererAccessor.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/mixin/LevelRendererAccessor.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/mixin/LevelRendererAccessor.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/mixin/LightTextureAccessor.java b/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/LightTextureAccessor.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/mixin/LightTextureAccessor.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/mixin/LightTextureAccessor.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/mixin/OptionsMixin.java b/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/OptionsMixin.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/mixin/OptionsMixin.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/mixin/OptionsMixin.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/mixin/OverlayTextureAccessor.java b/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/OverlayTextureAccessor.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/mixin/OverlayTextureAccessor.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/mixin/OverlayTextureAccessor.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/mixin/RenderSystemMixin.java b/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/RenderSystemMixin.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/mixin/RenderSystemMixin.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/mixin/RenderSystemMixin.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/util/AtomicReferenceCounted.java b/common/src/backend/java/com/jozufozu/flywheel/backend/util/AtomicReferenceCounted.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/util/AtomicReferenceCounted.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/util/AtomicReferenceCounted.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/util/MemoryBuffer.java b/common/src/backend/java/com/jozufozu/flywheel/backend/util/MemoryBuffer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/util/MemoryBuffer.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/util/MemoryBuffer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/backend/util/ReferenceCounted.java b/common/src/backend/java/com/jozufozu/flywheel/backend/util/ReferenceCounted.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/backend/util/ReferenceCounted.java rename to common/src/backend/java/com/jozufozu/flywheel/backend/util/ReferenceCounted.java diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/api_impl.frag b/common/src/backend/resources/assets/flywheel/flywheel/internal/api_impl.frag similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/api_impl.frag rename to common/src/backend/resources/assets/flywheel/flywheel/internal/api_impl.frag diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/api_impl.vert b/common/src/backend/resources/assets/flywheel/flywheel/internal/api_impl.vert similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/api_impl.vert rename to common/src/backend/resources/assets/flywheel/flywheel/internal/api_impl.vert diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/colorizer.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/colorizer.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/colorizer.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/colorizer.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/common.frag b/common/src/backend/resources/assets/flywheel/flywheel/internal/common.frag similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/common.frag rename to common/src/backend/resources/assets/flywheel/flywheel/internal/common.frag diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/common.vert b/common/src/backend/resources/assets/flywheel/flywheel/internal/common.vert similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/common.vert rename to common/src/backend/resources/assets/flywheel/flywheel/internal/common.vert diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/components_header.frag b/common/src/backend/resources/assets/flywheel/flywheel/internal/components_header.frag similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/components_header.frag rename to common/src/backend/resources/assets/flywheel/flywheel/internal/components_header.frag diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/components_header.vert b/common/src/backend/resources/assets/flywheel/flywheel/internal/components_header.vert similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/components_header.vert rename to common/src/backend/resources/assets/flywheel/flywheel/internal/components_header.vert diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/diffuse.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/diffuse.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/diffuse.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/diffuse.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/fog_distance.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/fog_distance.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/fog_distance.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/fog_distance.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/apply.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/apply.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/indirect/apply.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/apply.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/buffer_bindings.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/buffer_bindings.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/indirect/buffer_bindings.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/buffer_bindings.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull_api_impl.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/cull_api_impl.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/indirect/cull_api_impl.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/cull_api_impl.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/draw_command.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/draw_command.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/indirect/draw_command.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/draw_command.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/main.frag b/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/main.frag similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/indirect/main.frag rename to common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/main.frag diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/main.vert b/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/main.vert similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/indirect/main.vert rename to common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/main.vert diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/model_descriptor.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/model_descriptor.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/indirect/model_descriptor.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/model_descriptor.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/indirect/scatter.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/scatter.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/indirect/scatter.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/scatter.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/instancing/main.frag b/common/src/backend/resources/assets/flywheel/flywheel/internal/instancing/main.frag similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/instancing/main.frag rename to common/src/backend/resources/assets/flywheel/flywheel/internal/instancing/main.frag diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/instancing/main.vert b/common/src/backend/resources/assets/flywheel/flywheel/internal/instancing/main.vert similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/instancing/main.vert rename to common/src/backend/resources/assets/flywheel/flywheel/internal/instancing/main.vert diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/material.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/material.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/material.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/material.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/packed_material.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/packed_material.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/packed_material.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/packed_material.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/fog.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/fog.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/fog.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/fog.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/frame.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/frame.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/frame.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/frame.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/level.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/level.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/level.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/level.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/options.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/options.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/options.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/options.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/player.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/player.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/player.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/player.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/uniforms.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/uniforms.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/uniforms/uniforms.glsl rename to common/src/backend/resources/assets/flywheel/flywheel/internal/uniforms/uniforms.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/internal/vertex_input.vert b/common/src/backend/resources/assets/flywheel/flywheel/internal/vertex_input.vert similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/internal/vertex_input.vert rename to common/src/backend/resources/assets/flywheel/flywheel/internal/vertex_input.vert diff --git a/common/src/main/java/com/jozufozu/flywheel/Flywheel.java b/common/src/lib/java/com/jozufozu/flywheel/Flywheel.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/Flywheel.java rename to common/src/lib/java/com/jozufozu/flywheel/Flywheel.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/backend/SimpleBackend.java b/common/src/lib/java/com/jozufozu/flywheel/lib/backend/SimpleBackend.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/backend/SimpleBackend.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/backend/SimpleBackend.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/box/Box.java b/common/src/lib/java/com/jozufozu/flywheel/lib/box/Box.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/box/Box.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/box/Box.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/box/MutableBox.java b/common/src/lib/java/com/jozufozu/flywheel/lib/box/MutableBox.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/box/MutableBox.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/box/MutableBox.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/instance/AbstractInstance.java b/common/src/lib/java/com/jozufozu/flywheel/lib/instance/AbstractInstance.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/instance/AbstractInstance.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/instance/AbstractInstance.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/instance/ColoredLitInstance.java b/common/src/lib/java/com/jozufozu/flywheel/lib/instance/ColoredLitInstance.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/instance/ColoredLitInstance.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/instance/ColoredLitInstance.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/instance/FlatLit.java b/common/src/lib/java/com/jozufozu/flywheel/lib/instance/FlatLit.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/instance/FlatLit.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/instance/FlatLit.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java b/common/src/lib/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/instance/OrientedInstance.java b/common/src/lib/java/com/jozufozu/flywheel/lib/instance/OrientedInstance.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/instance/OrientedInstance.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/instance/OrientedInstance.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/instance/ShadowInstance.java b/common/src/lib/java/com/jozufozu/flywheel/lib/instance/ShadowInstance.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/instance/ShadowInstance.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/instance/ShadowInstance.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/instance/SimpleInstanceType.java b/common/src/lib/java/com/jozufozu/flywheel/lib/instance/SimpleInstanceType.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/instance/SimpleInstanceType.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/instance/SimpleInstanceType.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/instance/TransformedInstance.java b/common/src/lib/java/com/jozufozu/flywheel/lib/instance/TransformedInstance.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/instance/TransformedInstance.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/instance/TransformedInstance.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/internal/FlwLibLink.java b/common/src/lib/java/com/jozufozu/flywheel/lib/internal/FlwLibLink.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/internal/FlwLibLink.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/internal/FlwLibLink.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/internal/FlwLibXplat.java b/common/src/lib/java/com/jozufozu/flywheel/lib/internal/FlwLibXplat.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/internal/FlwLibXplat.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/internal/FlwLibXplat.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/internal/package-info.java b/common/src/lib/java/com/jozufozu/flywheel/lib/internal/package-info.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/internal/package-info.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/internal/package-info.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/light/LightPacking.java b/common/src/lib/java/com/jozufozu/flywheel/lib/light/LightPacking.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/light/LightPacking.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/light/LightPacking.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/light/LightVolume.java b/common/src/lib/java/com/jozufozu/flywheel/lib/light/LightVolume.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/light/LightVolume.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/light/LightVolume.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/material/CutoutShaders.java b/common/src/lib/java/com/jozufozu/flywheel/lib/material/CutoutShaders.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/material/CutoutShaders.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/material/CutoutShaders.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/material/FogShaders.java b/common/src/lib/java/com/jozufozu/flywheel/lib/material/FogShaders.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/material/FogShaders.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/material/FogShaders.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/material/Materials.java b/common/src/lib/java/com/jozufozu/flywheel/lib/material/Materials.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/material/Materials.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/material/Materials.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleCutoutShader.java b/common/src/lib/java/com/jozufozu/flywheel/lib/material/SimpleCutoutShader.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleCutoutShader.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/material/SimpleCutoutShader.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleFogShader.java b/common/src/lib/java/com/jozufozu/flywheel/lib/material/SimpleFogShader.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleFogShader.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/material/SimpleFogShader.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleMaterial.java b/common/src/lib/java/com/jozufozu/flywheel/lib/material/SimpleMaterial.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleMaterial.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/material/SimpleMaterial.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleMaterialShaders.java b/common/src/lib/java/com/jozufozu/flywheel/lib/material/SimpleMaterialShaders.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/material/SimpleMaterialShaders.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/material/SimpleMaterialShaders.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java b/common/src/lib/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/math/MatrixMath.java b/common/src/lib/java/com/jozufozu/flywheel/lib/math/MatrixMath.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/math/MatrixMath.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/math/MatrixMath.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/math/MoreMath.java b/common/src/lib/java/com/jozufozu/flywheel/lib/math/MoreMath.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/math/MoreMath.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/math/MoreMath.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/math/RenderMath.java b/common/src/lib/java/com/jozufozu/flywheel/lib/math/RenderMath.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/math/RenderMath.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/math/RenderMath.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/memory/AbstractMemoryBlockImpl.java b/common/src/lib/java/com/jozufozu/flywheel/lib/memory/AbstractMemoryBlockImpl.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/memory/AbstractMemoryBlockImpl.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/memory/AbstractMemoryBlockImpl.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/memory/DebugMemoryBlockImpl.java b/common/src/lib/java/com/jozufozu/flywheel/lib/memory/DebugMemoryBlockImpl.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/memory/DebugMemoryBlockImpl.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/memory/DebugMemoryBlockImpl.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/memory/FlwMemoryTracker.java b/common/src/lib/java/com/jozufozu/flywheel/lib/memory/FlwMemoryTracker.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/memory/FlwMemoryTracker.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/memory/FlwMemoryTracker.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/memory/MemoryBlock.java b/common/src/lib/java/com/jozufozu/flywheel/lib/memory/MemoryBlock.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/memory/MemoryBlock.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/memory/MemoryBlock.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/memory/MemoryBlockImpl.java b/common/src/lib/java/com/jozufozu/flywheel/lib/memory/MemoryBlockImpl.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/memory/MemoryBlockImpl.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/memory/MemoryBlockImpl.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/memory/TrackedMemoryBlockImpl.java b/common/src/lib/java/com/jozufozu/flywheel/lib/memory/TrackedMemoryBlockImpl.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/memory/TrackedMemoryBlockImpl.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/memory/TrackedMemoryBlockImpl.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/LineModelBuilder.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/LineModelBuilder.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/LineModelBuilder.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/LineModelBuilder.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelCache.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/ModelCache.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/ModelCache.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/ModelCache.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelHolder.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/ModelHolder.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/ModelHolder.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/ModelHolder.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/ModelUtil.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/ModelUtil.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/ModelUtil.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/Models.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/Models.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/Models.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/Models.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/QuadIndexSequence.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/QuadIndexSequence.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/QuadIndexSequence.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/QuadIndexSequence.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/QuadMesh.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/QuadMesh.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/QuadMesh.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/QuadMesh.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/SimpleMesh.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/SimpleMesh.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/SimpleMesh.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/SimpleMesh.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/SimpleModel.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/SimpleModel.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/SimpleModel.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/SimpleModel.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/SingleMeshModel.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/SingleMeshModel.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/SingleMeshModel.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/SingleMeshModel.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/PartialModel.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/TransformingVertexConsumer.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/TransformingVertexConsumer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/baked/TransformingVertexConsumer.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/TransformingVertexConsumer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualBlockGetter.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/VirtualBlockGetter.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualBlockGetter.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/VirtualBlockGetter.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualEmptyBlockGetter.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/VirtualEmptyBlockGetter.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualEmptyBlockGetter.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/VirtualEmptyBlockGetter.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualLightEngine.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/VirtualLightEngine.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/baked/VirtualLightEngine.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/VirtualLightEngine.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/part/ModelPartConverter.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/part/ModelPartConverter.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/part/ModelPartConverter.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/part/ModelPartConverter.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/model/part/VertexWriter.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/part/VertexWriter.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/model/part/VertexWriter.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/model/part/VertexWriter.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/BarrierPlan.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/BarrierPlan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/BarrierPlan.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/BarrierPlan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/Distribute.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/Distribute.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/Distribute.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/Distribute.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/DynamicNestedPlan.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/DynamicNestedPlan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/DynamicNestedPlan.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/DynamicNestedPlan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/Flag.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/Flag.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/Flag.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/Flag.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/ForEachPlan.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/ForEachPlan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/ForEachPlan.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/ForEachPlan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/ForEachSlicePlan.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/ForEachSlicePlan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/ForEachSlicePlan.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/ForEachSlicePlan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/IfElsePlan.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/IfElsePlan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/IfElsePlan.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/IfElsePlan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/MapContextPlan.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/MapContextPlan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/MapContextPlan.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/MapContextPlan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/NamedFlag.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/NamedFlag.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/NamedFlag.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/NamedFlag.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/NestedPlan.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/NestedPlan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/NestedPlan.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/NestedPlan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/PlanMap.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/PlanMap.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/PlanMap.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/PlanMap.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/RaisePlan.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/RaisePlan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/RaisePlan.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/RaisePlan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/RunnablePlan.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/RunnablePlan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/RunnablePlan.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/RunnablePlan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/SimplePlan.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/SimplePlan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/SimplePlan.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/SimplePlan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/SimplyComposedPlan.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/SimplyComposedPlan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/SimplyComposedPlan.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/SimplyComposedPlan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/StageFlag.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/StageFlag.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/StageFlag.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/StageFlag.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/SyncedPlan.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/SyncedPlan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/SyncedPlan.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/SyncedPlan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/Synchronizer.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/Synchronizer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/Synchronizer.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/Synchronizer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/UnitPlan.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/UnitPlan.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/UnitPlan.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/UnitPlan.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/functional/BooleanSupplierWithContext.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/functional/BooleanSupplierWithContext.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/functional/BooleanSupplierWithContext.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/functional/BooleanSupplierWithContext.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/functional/ConsumerWithContext.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/functional/ConsumerWithContext.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/functional/ConsumerWithContext.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/functional/ConsumerWithContext.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/functional/RunnableWithContext.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/functional/RunnableWithContext.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/functional/RunnableWithContext.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/functional/RunnableWithContext.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/functional/SupplierWithContext.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/functional/SupplierWithContext.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/functional/SupplierWithContext.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/functional/SupplierWithContext.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/task/functional/package-info.java b/common/src/lib/java/com/jozufozu/flywheel/lib/task/functional/package-info.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/task/functional/package-info.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/task/functional/package-info.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/transform/Affine.java b/common/src/lib/java/com/jozufozu/flywheel/lib/transform/Affine.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/transform/Affine.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/transform/Affine.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/transform/PoseTransformStack.java b/common/src/lib/java/com/jozufozu/flywheel/lib/transform/PoseTransformStack.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/transform/PoseTransformStack.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/transform/PoseTransformStack.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/transform/Rotate.java b/common/src/lib/java/com/jozufozu/flywheel/lib/transform/Rotate.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/transform/Rotate.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/transform/Rotate.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/transform/Scale.java b/common/src/lib/java/com/jozufozu/flywheel/lib/transform/Scale.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/transform/Scale.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/transform/Scale.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/transform/Transform.java b/common/src/lib/java/com/jozufozu/flywheel/lib/transform/Transform.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/transform/Transform.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/transform/Transform.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java b/common/src/lib/java/com/jozufozu/flywheel/lib/transform/TransformStack.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/transform/TransformStack.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/transform/TransformStack.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/transform/Translate.java b/common/src/lib/java/com/jozufozu/flywheel/lib/transform/Translate.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/transform/Translate.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/transform/Translate.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/util/AtomicBitset.java b/common/src/lib/java/com/jozufozu/flywheel/lib/util/AtomicBitset.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/util/AtomicBitset.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/util/AtomicBitset.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/util/FlwUtil.java b/common/src/lib/java/com/jozufozu/flywheel/lib/util/FlwUtil.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/util/FlwUtil.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/util/FlwUtil.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/util/LevelAttached.java b/common/src/lib/java/com/jozufozu/flywheel/lib/util/LevelAttached.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/util/LevelAttached.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/util/LevelAttached.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/util/Pair.java b/common/src/lib/java/com/jozufozu/flywheel/lib/util/Pair.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/util/Pair.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/util/Pair.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/util/ResourceUtil.java b/common/src/lib/java/com/jozufozu/flywheel/lib/util/ResourceUtil.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/util/ResourceUtil.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/util/ResourceUtil.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/util/SectionUtil.java b/common/src/lib/java/com/jozufozu/flywheel/lib/util/SectionUtil.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/util/SectionUtil.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/util/SectionUtil.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java b/common/src/lib/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/util/StringUtil.java b/common/src/lib/java/com/jozufozu/flywheel/lib/util/StringUtil.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/util/StringUtil.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/util/StringUtil.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/util/Unit.java b/common/src/lib/java/com/jozufozu/flywheel/lib/util/Unit.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/util/Unit.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/util/Unit.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/vertex/AbstractVertexView.java b/common/src/lib/java/com/jozufozu/flywheel/lib/vertex/AbstractVertexView.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/vertex/AbstractVertexView.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/vertex/AbstractVertexView.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/vertex/EmptyVertexList.java b/common/src/lib/java/com/jozufozu/flywheel/lib/vertex/EmptyVertexList.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/vertex/EmptyVertexList.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/vertex/EmptyVertexList.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/vertex/FullVertexView.java b/common/src/lib/java/com/jozufozu/flywheel/lib/vertex/FullVertexView.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/vertex/FullVertexView.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/vertex/FullVertexView.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/vertex/NoOverlayVertexView.java b/common/src/lib/java/com/jozufozu/flywheel/lib/vertex/NoOverlayVertexView.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/vertex/NoOverlayVertexView.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/vertex/NoOverlayVertexView.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/vertex/PosTexNormalVertexView.java b/common/src/lib/java/com/jozufozu/flywheel/lib/vertex/PosTexNormalVertexView.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/vertex/PosTexNormalVertexView.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/vertex/PosTexNormalVertexView.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/vertex/PosVertexView.java b/common/src/lib/java/com/jozufozu/flywheel/lib/vertex/PosVertexView.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/vertex/PosVertexView.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/vertex/PosVertexView.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractBlockEntityVisual.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/AbstractBlockEntityVisual.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractBlockEntityVisual.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/visual/AbstractBlockEntityVisual.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractEntityVisual.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/AbstractEntityVisual.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractEntityVisual.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/visual/AbstractEntityVisual.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractVisual.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/AbstractVisual.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractVisual.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/visual/AbstractVisual.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/EntityComponent.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/EntityComponent.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/visual/EntityComponent.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/visual/EntityComponent.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/EntityVisibilityTester.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/EntityVisibilityTester.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/visual/EntityVisibilityTester.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/visual/EntityVisibilityTester.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/InstanceRecycler.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/InstanceRecycler.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/visual/InstanceRecycler.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/visual/InstanceRecycler.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleBlockEntityVisualizer.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleBlockEntityVisualizer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleBlockEntityVisualizer.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleBlockEntityVisualizer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisual.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisual.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisual.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisual.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisualizer.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisualizer.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisualizer.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleEntityVisualizer.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/SmartRecycler.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SmartRecycler.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/visual/SmartRecycler.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/visual/SmartRecycler.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/component/FireComponent.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/component/FireComponent.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/visual/component/FireComponent.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/visual/component/FireComponent.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/component/HitboxComponent.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/component/HitboxComponent.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/visual/component/HitboxComponent.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/visual/component/HitboxComponent.java diff --git a/common/src/main/java/com/jozufozu/flywheel/lib/visual/component/ShadowComponent.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/component/ShadowComponent.java similarity index 100% rename from common/src/main/java/com/jozufozu/flywheel/lib/visual/component/ShadowComponent.java rename to common/src/lib/java/com/jozufozu/flywheel/lib/visual/component/ShadowComponent.java diff --git a/common/src/main/resources/assets/flywheel/flywheel/cutout/epsilon.glsl b/common/src/lib/resources/assets/flywheel/flywheel/cutout/epsilon.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/cutout/epsilon.glsl rename to common/src/lib/resources/assets/flywheel/flywheel/cutout/epsilon.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/cutout/half.glsl b/common/src/lib/resources/assets/flywheel/flywheel/cutout/half.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/cutout/half.glsl rename to common/src/lib/resources/assets/flywheel/flywheel/cutout/half.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/cutout/off.glsl b/common/src/lib/resources/assets/flywheel/flywheel/cutout/off.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/cutout/off.glsl rename to common/src/lib/resources/assets/flywheel/flywheel/cutout/off.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/cutout/one_tenth.glsl b/common/src/lib/resources/assets/flywheel/flywheel/cutout/one_tenth.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/cutout/one_tenth.glsl rename to common/src/lib/resources/assets/flywheel/flywheel/cutout/one_tenth.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/fog/linear.glsl b/common/src/lib/resources/assets/flywheel/flywheel/fog/linear.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/fog/linear.glsl rename to common/src/lib/resources/assets/flywheel/flywheel/fog/linear.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/fog/linear_fade.glsl b/common/src/lib/resources/assets/flywheel/flywheel/fog/linear_fade.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/fog/linear_fade.glsl rename to common/src/lib/resources/assets/flywheel/flywheel/fog/linear_fade.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/fog/none.glsl b/common/src/lib/resources/assets/flywheel/flywheel/fog/none.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/fog/none.glsl rename to common/src/lib/resources/assets/flywheel/flywheel/fog/none.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/instance/cull/oriented.glsl b/common/src/lib/resources/assets/flywheel/flywheel/instance/cull/oriented.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/instance/cull/oriented.glsl rename to common/src/lib/resources/assets/flywheel/flywheel/instance/cull/oriented.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/instance/cull/shadow.glsl b/common/src/lib/resources/assets/flywheel/flywheel/instance/cull/shadow.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/instance/cull/shadow.glsl rename to common/src/lib/resources/assets/flywheel/flywheel/instance/cull/shadow.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/instance/cull/transformed.glsl b/common/src/lib/resources/assets/flywheel/flywheel/instance/cull/transformed.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/instance/cull/transformed.glsl rename to common/src/lib/resources/assets/flywheel/flywheel/instance/cull/transformed.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/instance/oriented.vert b/common/src/lib/resources/assets/flywheel/flywheel/instance/oriented.vert similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/instance/oriented.vert rename to common/src/lib/resources/assets/flywheel/flywheel/instance/oriented.vert diff --git a/common/src/main/resources/assets/flywheel/flywheel/instance/shadow.vert b/common/src/lib/resources/assets/flywheel/flywheel/instance/shadow.vert similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/instance/shadow.vert rename to common/src/lib/resources/assets/flywheel/flywheel/instance/shadow.vert diff --git a/common/src/main/resources/assets/flywheel/flywheel/instance/transformed.vert b/common/src/lib/resources/assets/flywheel/flywheel/instance/transformed.vert similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/instance/transformed.vert rename to common/src/lib/resources/assets/flywheel/flywheel/instance/transformed.vert diff --git a/common/src/main/resources/assets/flywheel/flywheel/material/default.frag b/common/src/lib/resources/assets/flywheel/flywheel/material/default.frag similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/material/default.frag rename to common/src/lib/resources/assets/flywheel/flywheel/material/default.frag diff --git a/common/src/main/resources/assets/flywheel/flywheel/material/default.vert b/common/src/lib/resources/assets/flywheel/flywheel/material/default.vert similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/material/default.vert rename to common/src/lib/resources/assets/flywheel/flywheel/material/default.vert diff --git a/common/src/main/resources/assets/flywheel/flywheel/material/lines.frag b/common/src/lib/resources/assets/flywheel/flywheel/material/lines.frag similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/material/lines.frag rename to common/src/lib/resources/assets/flywheel/flywheel/material/lines.frag diff --git a/common/src/main/resources/assets/flywheel/flywheel/material/lines.vert b/common/src/lib/resources/assets/flywheel/flywheel/material/lines.vert similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/material/lines.vert rename to common/src/lib/resources/assets/flywheel/flywheel/material/lines.vert diff --git a/common/src/main/resources/assets/flywheel/flywheel/material/wireframe.frag b/common/src/lib/resources/assets/flywheel/flywheel/material/wireframe.frag similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/material/wireframe.frag rename to common/src/lib/resources/assets/flywheel/flywheel/material/wireframe.frag diff --git a/common/src/main/resources/assets/flywheel/flywheel/material/wireframe.vert b/common/src/lib/resources/assets/flywheel/flywheel/material/wireframe.vert similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/material/wireframe.vert rename to common/src/lib/resources/assets/flywheel/flywheel/material/wireframe.vert diff --git a/common/src/main/resources/assets/flywheel/flywheel/util/color.glsl b/common/src/lib/resources/assets/flywheel/flywheel/util/color.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/util/color.glsl rename to common/src/lib/resources/assets/flywheel/flywheel/util/color.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/util/matrix.glsl b/common/src/lib/resources/assets/flywheel/flywheel/util/matrix.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/util/matrix.glsl rename to common/src/lib/resources/assets/flywheel/flywheel/util/matrix.glsl diff --git a/common/src/main/resources/assets/flywheel/flywheel/util/quaternion.glsl b/common/src/lib/resources/assets/flywheel/flywheel/util/quaternion.glsl similarity index 100% rename from common/src/main/resources/assets/flywheel/flywheel/util/quaternion.glsl rename to common/src/lib/resources/assets/flywheel/flywheel/util/quaternion.glsl diff --git a/fabric/build.gradle b/fabric/build.gradle index c5837720e..e1e426b0e 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -11,8 +11,6 @@ apply from: rootProject.file('buildSrc/platforms.gradle') apply from: rootProject.file('buildSrc/package-infos.gradle') dependencies { - compileOnly project(path: ':common', configuration: 'namedElements') - modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" modApi "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}" diff --git a/forge/build.gradle b/forge/build.gradle index ffcfd816f..7066b5c65 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -28,8 +28,6 @@ loom { dependencies { forge "net.minecraftforge:forge:${minecraft_version}-${forge_version}" - compileOnly project(path: ':common', configuration: 'namedElements') - modCompileOnly "maven.modrinth:embeddium:${embeddium_version}" modCompileOnly "maven.modrinth:oculus:${oculus_version}" } From 52eef2e53834e3adcd0b55ae6bf90ae26786d357 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Thu, 25 Apr 2024 10:37:12 -0700 Subject: [PATCH 25/62] Unconventional - Use convention plugins for common build logic - Convention plugins get to be applied in the plugins block and can load other plugins - Move GeneratePackageInfosTask to its own file in buildSrc - Apply GeneratePackageInfosTask to every sourceSet --- build.gradle | 2 - buildSrc/build.gradle | 5 +- buildSrc/package-infos.gradle | 74 ------------------- .../groovy/GeneratePackageInfosTask.groovy | 53 +++++++++++++ .../main/groovy/flywheel.java.gradle} | 4 + .../main/groovy/flywheel.package-infos.gradle | 31 ++++++++ .../main/groovy/flywheel.platform.gradle} | 4 + .../main/groovy/flywheel.subproject.gradle} | 8 ++ common/build.gradle | 10 +-- fabric/build.gradle | 10 +-- forge/build.gradle | 10 +-- 11 files changed, 106 insertions(+), 105 deletions(-) delete mode 100644 buildSrc/package-infos.gradle create mode 100644 buildSrc/src/main/groovy/GeneratePackageInfosTask.groovy rename buildSrc/{simple-java.gradle => src/main/groovy/flywheel.java.gradle} (98%) create mode 100644 buildSrc/src/main/groovy/flywheel.package-infos.gradle rename buildSrc/{platforms.gradle => src/main/groovy/flywheel.platform.gradle} (98%) rename buildSrc/{subprojects.gradle => src/main/groovy/flywheel.subproject.gradle} (93%) diff --git a/build.gradle b/build.gradle index 9f9460aad..30891b8f7 100644 --- a/build.gradle +++ b/build.gradle @@ -5,8 +5,6 @@ plugins { id 'dev.architectury.loom' apply false } -apply from: rootProject.file('buildSrc/simple-java.gradle') - println("Java: ${System.getProperty('java.version')}, JVM: ${System.getProperty('java.vm.version')} (${System.getProperty('java.vendor')}), Arch: ${System.getProperty('os.arch')}") idea { diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index a42435e5e..678405245 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -1,2 +1,3 @@ - -// TODO: port stuff to convention plugins +plugins { + id 'groovy-gradle-plugin' +} diff --git a/buildSrc/package-infos.gradle b/buildSrc/package-infos.gradle deleted file mode 100644 index 1fd334292..000000000 --- a/buildSrc/package-infos.gradle +++ /dev/null @@ -1,74 +0,0 @@ -// Adapted from https://github.com/FabricMC/fabric/blob/31787236d242247e0b6c4ae806b1cfaa7042a62c/gradle/package-info.gradle, which is licensed under Apache 2.0. - -import java.nio.file.Files - -setupGeneratePackageInfos(sourceSets.main) - -def setupGeneratePackageInfos(SourceSet sourceSet) { - // We have to capture the source set name for the lazy string literals, - // otherwise it'll just be whatever the last source set is in the list. - def sourceSetName = sourceSet.name - def taskName = sourceSet.getTaskName('generate', 'PackageInfos') - def task = tasks.register(taskName, GeneratePackageInfosTask) { - group = 'flywheel' - description = "Generates package-info files for $sourceSetName packages." - - // Only apply to default source directory since we also add the generated - // sources to the source set. - sourceRoot = file("src/$sourceSetName/java") - outputDir = file("src/$sourceSetName/generatedPackageInfos") - } - sourceSet.java.srcDir task - - tasks.named('ideaSyncTask').configure { - finalizedBy task - } - - def cleanTask = tasks.register(sourceSet.getTaskName('clean', 'PackageInfos'), Delete) { - group = 'flywheel' - delete file("src/$sourceSetName/generatedPackageInfos") - } - clean.dependsOn cleanTask -} - -class GeneratePackageInfosTask extends DefaultTask { - @SkipWhenEmpty - @InputDirectory - final DirectoryProperty sourceRoot = project.objects.directoryProperty() - - @OutputDirectory - final DirectoryProperty outputDir = project.objects.directoryProperty() - - @TaskAction - def run() { - def output = outputDir.get().asFile.toPath() - output.deleteDir() - def root = sourceRoot.get().asFile.toPath() - - root.eachDirRecurse { - def containsJava = Files.list(it).any { - Files.isRegularFile(it) && it.fileName.toString().endsWith('.java') - } - - if (containsJava && Files.notExists(it.resolve('package-info.java'))) { - def relativePath = root.relativize(it) - def target = output.resolve(relativePath) - Files.createDirectories(target) - - target.resolve('package-info.java').withWriter { - def packageName = relativePath.toString().replace(File.separator, '.') - it.write("""@ParametersAreNonnullByDefault - |@FieldsAreNonnullByDefault - |@MethodsReturnNonnullByDefault - |package $packageName; - | - |import javax.annotation.ParametersAreNonnullByDefault; - | - |import net.minecraft.FieldsAreNonnullByDefault; - |import net.minecraft.MethodsReturnNonnullByDefault; - |""".stripMargin()) - } - } - } - } -} diff --git a/buildSrc/src/main/groovy/GeneratePackageInfosTask.groovy b/buildSrc/src/main/groovy/GeneratePackageInfosTask.groovy new file mode 100644 index 000000000..36533a10a --- /dev/null +++ b/buildSrc/src/main/groovy/GeneratePackageInfosTask.groovy @@ -0,0 +1,53 @@ + + +import org.gradle.api.DefaultTask +import org.gradle.api.file.DirectoryProperty +import org.gradle.api.tasks.InputDirectory +import org.gradle.api.tasks.OutputDirectory +import org.gradle.api.tasks.SkipWhenEmpty +import org.gradle.api.tasks.TaskAction + +import java.nio.file.Files + +// Adapted from https://github.com/FabricMC/fabric/blob/31787236d242247e0b6c4ae806b1cfaa7042a62c/gradle/package-info.gradle, which is licensed under Apache 2.0. +class GeneratePackageInfosTask extends DefaultTask { + @SkipWhenEmpty + @InputDirectory + final DirectoryProperty sourceRoot = project.objects.directoryProperty() + + @OutputDirectory + final DirectoryProperty outputDir = project.objects.directoryProperty() + + @TaskAction + def run() { + def output = outputDir.get().asFile.toPath() + output.deleteDir() + def root = sourceRoot.get().asFile.toPath() + + root.eachDirRecurse { + def containsJava = Files.list(it).any { + Files.isRegularFile(it) && it.fileName.toString().endsWith('.java') + } + + if (containsJava && Files.notExists(it.resolve('package-info.java'))) { + def relativePath = root.relativize(it) + def target = output.resolve(relativePath) + Files.createDirectories(target) + + target.resolve('package-info.java').withWriter { + def packageName = relativePath.toString().replace(File.separator, '.') + it.write("""@ParametersAreNonnullByDefault + |@FieldsAreNonnullByDefault + |@MethodsReturnNonnullByDefault + |package $packageName; + | + |import javax.annotation.ParametersAreNonnullByDefault; + | + |import net.minecraft.FieldsAreNonnullByDefault; + |import net.minecraft.MethodsReturnNonnullByDefault; + |""".stripMargin()) + } + } + } + } +} diff --git a/buildSrc/simple-java.gradle b/buildSrc/src/main/groovy/flywheel.java.gradle similarity index 98% rename from buildSrc/simple-java.gradle rename to buildSrc/src/main/groovy/flywheel.java.gradle index e74eba5e9..0aa594e6e 100644 --- a/buildSrc/simple-java.gradle +++ b/buildSrc/src/main/groovy/flywheel.java.gradle @@ -1,3 +1,7 @@ +plugins { + id 'java' +} + boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false') String buildNumber = System.getenv('BUILD_NUMBER') diff --git a/buildSrc/src/main/groovy/flywheel.package-infos.gradle b/buildSrc/src/main/groovy/flywheel.package-infos.gradle new file mode 100644 index 000000000..1e9392da6 --- /dev/null +++ b/buildSrc/src/main/groovy/flywheel.package-infos.gradle @@ -0,0 +1,31 @@ + +sourceSets.configureEach { + setupGeneratePackageInfos(it) +} + +def setupGeneratePackageInfos(SourceSet sourceSet) { + // We have to capture the source set name for the lazy string literals, + // otherwise it'll just be whatever the last source set is in the list. + def sourceSetName = sourceSet.name + def taskName = sourceSet.getTaskName('generate', 'PackageInfos') + def task = tasks.register(taskName, GeneratePackageInfosTask) { + group = 'flywheel' + description = "Generates package-info files for $sourceSetName packages." + + // Only apply to default source directory since we also add the generated + // sources to the source set. + sourceRoot = file("src/$sourceSetName/java") + outputDir = file("src/$sourceSetName/generatedPackageInfos") + } + sourceSet.java.srcDir task + + tasks.named('ideaSyncTask').configure { + finalizedBy task + } + + def cleanTask = tasks.register(sourceSet.getTaskName('clean', 'PackageInfos'), Delete) { + group = 'flywheel' + delete file("src/$sourceSetName/generatedPackageInfos") + } + clean.dependsOn cleanTask +} diff --git a/buildSrc/platforms.gradle b/buildSrc/src/main/groovy/flywheel.platform.gradle similarity index 98% rename from buildSrc/platforms.gradle rename to buildSrc/src/main/groovy/flywheel.platform.gradle index 19e7feddb..84a73a2a1 100644 --- a/buildSrc/platforms.gradle +++ b/buildSrc/src/main/groovy/flywheel.platform.gradle @@ -1,3 +1,7 @@ +plugins { + id 'flywheel.subproject' +} + evaluationDependsOn(':common') loom { diff --git a/buildSrc/subprojects.gradle b/buildSrc/src/main/groovy/flywheel.subproject.gradle similarity index 93% rename from buildSrc/subprojects.gradle rename to buildSrc/src/main/groovy/flywheel.subproject.gradle index 4d87d9606..e7ee6cd41 100644 --- a/buildSrc/subprojects.gradle +++ b/buildSrc/src/main/groovy/flywheel.subproject.gradle @@ -1,3 +1,11 @@ +plugins { + id 'idea' + id 'flywheel.java' + id 'maven-publish' + id 'dev.architectury.loom' + id 'flywheel.package-infos' +} + loom { silentMojangMappingsLicense() diff --git a/common/build.gradle b/common/build.gradle index 802838ba7..51970de5b 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,15 +1,7 @@ plugins { - id 'idea' - id 'java' - id 'maven-publish' - id 'dev.architectury.loom' + id 'flywheel.subproject' } -apply from: rootProject.file('buildSrc/simple-java.gradle') -apply from: rootProject.file('buildSrc/subprojects.gradle') -// TODO: package-infos specifically targets the main source set -// apply from: rootProject.file('buildSrc/package-infos.gradle') - sourceSets { // Loom only populates mc stuff to the main source set, // so grab that here and use it for the others. diff --git a/fabric/build.gradle b/fabric/build.gradle index e1e426b0e..c9262ed2c 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,15 +1,7 @@ plugins { - id 'idea' - id 'java' - id 'maven-publish' - id 'dev.architectury.loom' + id 'flywheel.platform' } -apply from: rootProject.file('buildSrc/simple-java.gradle') -apply from: rootProject.file('buildSrc/subprojects.gradle') -apply from: rootProject.file('buildSrc/platforms.gradle') -apply from: rootProject.file('buildSrc/package-infos.gradle') - dependencies { modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" modApi "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}" diff --git a/forge/build.gradle b/forge/build.gradle index 7066b5c65..79882c90c 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,15 +1,7 @@ plugins { - id 'idea' - id 'java' - id 'maven-publish' - id 'dev.architectury.loom' + id 'flywheel.platform' } -apply from: rootProject.file('buildSrc/simple-java.gradle') -apply from: rootProject.file('buildSrc/subprojects.gradle') -apply from: rootProject.file('buildSrc/platforms.gradle') -apply from: rootProject.file('buildSrc/package-infos.gradle') - loom { forge { mixinConfig 'flywheel.backend.mixins.json' From 2e7c33b355bafc0f68aab32eb292a165b2d9f373 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Fri, 26 Apr 2024 17:04:00 -0700 Subject: [PATCH 26/62] Pretty groovy man - Upgrade platform script plugin to pre-compiled groovy plugin - It was getting really difficult to manage all the logic/plugins/types from the basic script, and implementing a real plugin gives us much better type safety and IDE access to upstream plugins - Separate api/lib/backend/impl in platform projects - Add platform module output to main runtime classpath so the fabric loader recognizes our additional modules --- buildSrc/build.gradle | 28 +++ .../groovy/GeneratePackageInfosTask.groovy | 2 - .../com/jozufozu/gradle/PlatformPlugin.groovy | 173 ++++++++++++++++++ buildSrc/src/main/groovy/flywheel.java.gradle | 11 +- .../src/main/groovy/flywheel.platform.gradle | 89 --------- .../main/groovy/flywheel.subproject.gradle | 10 +- common/build.gradle | 6 + fabric/build.gradle | 46 ++++- .../api/event/BeginFrameCallback.java | 0 .../EndClientResourceReloadCallback.java | 0 .../event/ReloadLevelRendererCallback.java | 0 .../api/event/RenderStageCallback.java | 0 .../flywheel/backend/FlwBackendXplatImpl.java | 0 .../backend/compile/FlwProgramsReloader.java | 0 .../model/baked/PartialModelEventHandler.java | 0 forge/build.gradle | 42 ++++- .../flywheel/api/event/BeginFrameEvent.java | 0 .../event/EndClientResourceReloadEvent.java | 0 .../api/event/ReloadLevelRendererEvent.java | 0 .../flywheel/api/event/RenderStageEvent.java | 0 .../flywheel/backend/FlwBackendXplatImpl.java | 0 .../backend/compile/FlwProgramsReloader.java | 0 .../lib/model/baked/BakedModelBufferer.java | 0 .../model/baked/ForgeBakedModelBuilder.java | 0 .../model/baked/ForgeBlockModelBuilder.java | 0 .../lib/model/baked/ForgeMeshEmitter.java | 0 .../baked/ForgeMultiBlockModelBuilder.java | 0 .../model/baked/PartialModelEventHandler.java | 0 28 files changed, 281 insertions(+), 126 deletions(-) create mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy delete mode 100644 buildSrc/src/main/groovy/flywheel.platform.gradle rename fabric/src/{main => api}/java/com/jozufozu/flywheel/api/event/BeginFrameCallback.java (100%) rename fabric/src/{main => api}/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadCallback.java (100%) rename fabric/src/{main => api}/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererCallback.java (100%) rename fabric/src/{main => api}/java/com/jozufozu/flywheel/api/event/RenderStageCallback.java (100%) rename fabric/src/{main => backend}/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java (100%) rename fabric/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java (100%) rename fabric/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java (100%) rename forge/src/{main => api}/java/com/jozufozu/flywheel/api/event/BeginFrameEvent.java (100%) rename forge/src/{main => api}/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadEvent.java (100%) rename forge/src/{main => api}/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererEvent.java (100%) rename forge/src/{main => api}/java/com/jozufozu/flywheel/api/event/RenderStageEvent.java (100%) rename forge/src/{main => backend}/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java (100%) rename forge/src/{main => backend}/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java (100%) rename forge/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java (100%) rename forge/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java (100%) rename forge/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java (100%) rename forge/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/ForgeMeshEmitter.java (100%) rename forge/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java (100%) rename forge/src/{main => lib}/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java (100%) diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 678405245..40d8a06a0 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -1,3 +1,31 @@ plugins { id 'groovy-gradle-plugin' } + +repositories { + gradlePluginPortal() + mavenCentral() + maven { + name = 'MinecraftForge' + url = 'https://maven.minecraftforge.net/' + } + maven { + name = 'Architectury' + url = 'https://maven.architectury.dev/' + } + maven { url = 'https://repo.spongepowered.org/repository/maven-public' } + maven { url = 'https://maven.parchmentmc.org' } +} + +gradlePlugin { + plugins { + simplePlugin { + id = 'flywheel.platform' + implementationClass = 'com.jozufozu.gradle.PlatformPlugin' + } + } +} + +dependencies { + implementation 'dev.architectury.loom:dev.architectury.loom.gradle.plugin:1.6-SNAPSHOT' +} diff --git a/buildSrc/src/main/groovy/GeneratePackageInfosTask.groovy b/buildSrc/src/main/groovy/GeneratePackageInfosTask.groovy index 36533a10a..dbb693f74 100644 --- a/buildSrc/src/main/groovy/GeneratePackageInfosTask.groovy +++ b/buildSrc/src/main/groovy/GeneratePackageInfosTask.groovy @@ -1,5 +1,3 @@ - - import org.gradle.api.DefaultTask import org.gradle.api.file.DirectoryProperty import org.gradle.api.tasks.InputDirectory diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy new file mode 100644 index 000000000..b8ed05ead --- /dev/null +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy @@ -0,0 +1,173 @@ +package com.jozufozu.gradle + +import groovy.transform.CompileStatic +import net.fabricmc.loom.api.LoomGradleExtensionAPI +import net.fabricmc.loom.task.RemapJarTask +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.Task +import org.gradle.api.artifacts.Configuration +import org.gradle.api.file.DuplicatesStrategy +import org.gradle.api.file.FileCollection +import org.gradle.api.file.FileCopyDetails +import org.gradle.api.publish.PublishingExtension +import org.gradle.api.tasks.AbstractCopyTask +import org.gradle.api.tasks.SourceSet +import org.gradle.api.tasks.SourceSetContainer +import org.gradle.api.tasks.SourceTask +import org.gradle.api.tasks.bundling.Jar +import org.gradle.api.tasks.compile.JavaCompile +import org.gradle.api.tasks.javadoc.Javadoc +import org.gradle.language.jvm.tasks.ProcessResources + +// Couldn't get imports for loom to work in the simple .gradle file, so upgraded this to a real plugin. +@CompileStatic +class PlatformPlugin implements Plugin { + @Override + void apply(Project project) { + def commonProject = project.project(':common') + def commonSourceSets = commonProject.getExtensions().getByType(SourceSetContainer) + + def sourceSets = project.getExtensions().getByType(SourceSetContainer) + def loom = project.getExtensions().getByType(LoomGradleExtensionAPI) + def publishing = project.getExtensions().getByType(PublishingExtension) + + // Loom only populates mc stuff to the main source set, + // so grab that here and use it for the others. + // Note that the `+` operator does NOT perform a deep copy + // of a FileCollection, so this object is shared between + // the source sets and we should avoid mutating it. + SourceSet platformImpl = sourceSets.named('main').get() + FileCollection mcCompileClassPath = platformImpl.compileClasspath + + SourceSet platformApi = sourceSets.create('api') + platformApi.compileClasspath = mcCompileClassPath + + SourceSet platformLib = sourceSets.create('lib') + platformLib.compileClasspath = mcCompileClassPath + platformApi.output + + SourceSet platformBackend = sourceSets.create('backend') + platformBackend.compileClasspath = mcCompileClassPath + platformApi.output + platformLib.output + + // Assign here rather than concatenate to avoid modifying the mcCompileClassPath FileCollection + platformImpl.compileClasspath = mcCompileClassPath + platformApi.output + platformLib.output + platformBackend.output + // This isn't necessary for forge but fabric needs to recognize each classpath entry from ModSettings. + platformImpl.runtimeClasspath += platformApi.output + platformLib.output + platformBackend.output + + // This is needed for both platforms. + def mainMod = loom.mods.maybeCreate('main') + mainMod.sourceSet(platformApi) + mainMod.sourceSet(platformLib) + mainMod.sourceSet(platformBackend) + mainMod.sourceSet(platformImpl) + + def forApi = newConfiguration(project, 'forApi') + def forLib = newConfiguration(project, 'forLib') + def forBackend = newConfiguration(project, 'forBackend') + def forImpl = newConfiguration(project, 'forImpl') + + extendsFrom(project, platformApi.compileOnlyConfigurationName, forApi) + extendsFrom(project, platformLib.compileOnlyConfigurationName, forApi, forLib) + extendsFrom(project, platformBackend.compileOnlyConfigurationName, forApi, forLib, forBackend) + extendsFrom(project, platformImpl.compileOnlyConfigurationName, forApi, forLib, forBackend, forImpl) + + SourceSet commonApi = commonSourceSets.named('api').get() + SourceSet commonLib = commonSourceSets.named('lib').get() + SourceSet commonBackend = commonSourceSets.named('backend').get() + SourceSet commonImpl = commonSourceSets.named('main').get() + + def commonSources = [commonApi, commonLib, commonBackend, commonImpl] + + // Directly compile the platform sources with the common sources + includeFromCommon(project, platformApi, commonApi) + includeFromCommon(project, platformLib, commonLib) + includeFromCommon(project, platformBackend, commonBackend) + includeFromCommon(project, platformImpl, commonImpl) + + def tasks = project.tasks + + tasks.withType(JavaCompile).configureEach { JavaCompile compileJava -> + excludeDuplicatePackageInfos(compileJava) + } + + def apiJar = tasks.register('apiJar', Jar) { Jar jar -> + jar.archiveClassifier.set('api-dev') + jar.from platformApi.output, platformLib.output + + jar.destinationDirectory.set(project.layout.buildDirectory.dir('devlibs')) + + excludeDuplicatePackageInfos(jar) + } + + tasks.named('jar', Jar).configure { Jar jar -> + jar.archiveClassifier.set('dev') + jar.from platformApi.output, platformLib.output, platformBackend.output + + excludeDuplicatePackageInfos(jar) + } + + tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> + commonSources.forEach { javadoc.source it.allJava } + + javadoc.source platformApi.allJava, platformLib.allJava, platformBackend.allJava + + excludeDuplicatePackageInfos(javadoc) + } + + tasks.named('sourcesJar', Jar).configure { Jar jar -> + commonSources.forEach { jar.from it.allJava } + + jar.from platformApi.allJava, platformLib.allJava, platformBackend.allJava + + excludeDuplicatePackageInfos(jar) + } + + def remapApiJar = tasks.register('remapApiJar', RemapJarTask) { RemapJarTask remapJar -> + remapJar.dependsOn(apiJar) + remapJar.inputFile.set(apiJar.flatMap { it.archiveFile }) + remapJar.archiveClassifier.set('api') + } + + def remapJar = tasks.named('remapJar', RemapJarTask) + + tasks.named('build').configure { Task build -> + build.dependsOn(remapApiJar) + } + } + + // We have duplicate packages between the common and platform dependent subprojects. + // In theory the package-info.java files should be identical, so just take the first one we find. + static void excludeDuplicatePackageInfos(AbstractCopyTask copyTask) { + copyTask.filesMatching('**/package-info.java') { FileCopyDetails details -> + details.duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } + } + + // The compile/javadoc tasks have a different base type that isn't so smart about exclusion handling. + static void excludeDuplicatePackageInfos(SourceTask sourceTask) { + sourceTask.exclude('**/package-info.java') + } + + static Configuration newConfiguration(Project project, String name) { + return project.configurations.create(name) { Configuration it -> + it.canBeConsumed = true + it.canBeResolved = false + } + } + + static void extendsFrom(Project project, String name, Configuration... configurations) { + project.configurations.named(name).configure { + it.extendsFrom(configurations) + } + } + + static void includeFromCommon(Project project, SourceSet sourceSet, SourceSet commonSourceSet) { + project.tasks.named(sourceSet.compileJavaTaskName, JavaCompile).configure { JavaCompile compileJava -> + compileJava.source commonSourceSet.allJava + } + + project.tasks.named(sourceSet.processResourcesTaskName, ProcessResources).configure { ProcessResources processResources -> + processResources.from commonSourceSet.resources + } + } +} diff --git a/buildSrc/src/main/groovy/flywheel.java.gradle b/buildSrc/src/main/groovy/flywheel.java.gradle index 0aa594e6e..9124d5377 100644 --- a/buildSrc/src/main/groovy/flywheel.java.gradle +++ b/buildSrc/src/main/groovy/flywheel.java.gradle @@ -1,7 +1,3 @@ -plugins { - id 'java' -} - boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false') String buildNumber = System.getenv('BUILD_NUMBER') @@ -40,12 +36,7 @@ tasks.withType(JavaCompile).configureEach { JavaCompile javaCompile -> javaCompile.options.compilerArgs = ['-Xdiags:verbose'] } -tasks.named('jar', Jar).configure { Jar jar -> - archiveClassifier = '' - addLicense(jar) -} - -tasks.named('sourcesJar', Jar).configure { Jar jar -> +tasks.withType(Jar).configureEach { Jar jar -> addLicense(jar) } diff --git a/buildSrc/src/main/groovy/flywheel.platform.gradle b/buildSrc/src/main/groovy/flywheel.platform.gradle deleted file mode 100644 index 84a73a2a1..000000000 --- a/buildSrc/src/main/groovy/flywheel.platform.gradle +++ /dev/null @@ -1,89 +0,0 @@ -plugins { - id 'flywheel.subproject' -} - -evaluationDependsOn(':common') - -loom { - runs { - client { - ideConfigGenerated true - - // Turn on our own debug flags - property 'flw.dumpShaderSource', 'true' - property 'flw.debugMemorySafety', 'true' - - // Turn on mixin debug flags - property 'mixin.debug.export', 'true' - property 'mixin.debug.verbose', 'true' - - // 720p baby! - programArgs '--width', '1280', '--height', '720' - } - - // We're a client mod, but we need to make sure we correctly render when playing on a server. - server { - ideConfigGenerated true - programArgs '--nogui' - } - } -} - -dependencies { - compileOnly project(path: ':common', configuration: 'commonApi') - compileOnly project(path: ':common', configuration: 'commonLib') - compileOnly project(path: ':common', configuration: 'commonBackend') - compileOnly project(path: ':common', configuration: 'commonImpl') -} - -SourceSet commonApiSource = project(':common').sourceSets.api -SourceSet commonLibSource = project(':common').sourceSets.lib -SourceSet commonBackendSource = project(':common').sourceSets.backend -SourceSet commonMainSource = project(':common').sourceSets.main - -def commonSources = [commonApiSource, commonLibSource, commonBackendSource, commonMainSource] - -tasks.named('processResources', ProcessResources).configure { ProcessResources processResources -> - // No resources in API - processResources.from commonLibSource.resources - processResources.from commonBackendSource.resources - processResources.from commonMainSource.resources -} - -tasks.named('compileJava', JavaCompile).configure { JavaCompile compileJava -> - // TODO: Can we avoid this duplication? Would be nice to repackage the 4 common jars without having to re compile - commonSources.forEach { compileJava.source it.allJava } - - excludeDuplicatePackageInfos(compileJava) -} - -tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> - commonSources.forEach { javadoc.source it.allJava } - - excludeDuplicatePackageInfos(javadoc) -} - -tasks.named('jar', Jar).configure { Jar jar -> - excludeDuplicatePackageInfos(jar) -} - -tasks.named('sourcesJar', Jar).configure { Jar jar -> - commonSources.forEach { jar.from it.allJava } - - excludeDuplicatePackageInfos(jar) -} - -// We have duplicate packages between the common and platform dependent subprojects. -// In theory the package-info.java files should be identical, so just take the first one we find. -static void excludeDuplicatePackageInfos(AbstractCopyTask copyTask) { - copyTask.filesMatching('**/package-info.java') { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - } -} - -// The compile/javadoc tasks have a different base type that isn't so smart about exclusion handling. -static void excludeDuplicatePackageInfos(SourceTask sourceTask) { - // FIXME: actually scan the files and exclude the duplicates - // may be tough because the files have absolute paths - sourceTask.exclude('**/package-info.java') -} diff --git a/buildSrc/src/main/groovy/flywheel.subproject.gradle b/buildSrc/src/main/groovy/flywheel.subproject.gradle index e7ee6cd41..d206a8758 100644 --- a/buildSrc/src/main/groovy/flywheel.subproject.gradle +++ b/buildSrc/src/main/groovy/flywheel.subproject.gradle @@ -1,11 +1,3 @@ -plugins { - id 'idea' - id 'flywheel.java' - id 'maven-publish' - id 'dev.architectury.loom' - id 'flywheel.package-infos' -} - loom { silentMojangMappingsLicense() @@ -49,7 +41,7 @@ dependencies { api 'com.google.code.findbugs:jsr305:3.0.2' } -processResources { +tasks.withType(ProcessResources).configureEach { var replaceProperties = [ mod_id : mod_id, mod_name : mod_name, diff --git a/common/build.gradle b/common/build.gradle index 51970de5b..20a518168 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,4 +1,10 @@ plugins { + id 'idea' + id 'java' + id 'maven-publish' + id 'dev.architectury.loom' + id 'flywheel.java' + id 'flywheel.package-infos' id 'flywheel.subproject' } diff --git a/fabric/build.gradle b/fabric/build.gradle index c9262ed2c..bcb20f5e5 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,20 +1,50 @@ plugins { + id 'idea' + id 'java' + id 'maven-publish' + id 'dev.architectury.loom' + id 'flywheel.java' + id 'flywheel.package-infos' + id 'flywheel.subproject' id 'flywheel.platform' } +evaluationDependsOn(':common') + +loom { + runs { + client { + ideConfigGenerated true + + // Turn on our own debug flags + property 'flw.dumpShaderSource', 'true' + property 'flw.debugMemorySafety', 'true' + + // Turn on mixin debug flags + property 'mixin.debug.export', 'true' + property 'mixin.debug.verbose', 'true' + + // 720p baby! + programArgs '--width', '1280', '--height', '720' + } + + // We're a client mod, but we need to make sure we correctly render when playing on a server. + server { + ideConfigGenerated true + programArgs '--nogui' + } + } +} + dependencies { modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" modApi "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}" modCompileOnly "maven.modrinth:sodium:${sodium_version}" modCompileOnly "maven.modrinth:iris:${iris_version}" -} -publishing { - publications { - register('mavenJava', MavenPublication) { - from(components['java']) - artifactId = "flywheel-${project.name}-${artifact_minecraft_version}" - } - } + forApi project(path: ':common', configuration: 'commonApi') + forLib project(path: ':common', configuration: 'commonLib') + forBackend project(path: ':common', configuration: 'commonBackend') + forImpl project(path: ':common', configuration: 'commonImpl') } diff --git a/fabric/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameCallback.java b/fabric/src/api/java/com/jozufozu/flywheel/api/event/BeginFrameCallback.java similarity index 100% rename from fabric/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameCallback.java rename to fabric/src/api/java/com/jozufozu/flywheel/api/event/BeginFrameCallback.java diff --git a/fabric/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadCallback.java b/fabric/src/api/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadCallback.java similarity index 100% rename from fabric/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadCallback.java rename to fabric/src/api/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadCallback.java diff --git a/fabric/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererCallback.java b/fabric/src/api/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererCallback.java similarity index 100% rename from fabric/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererCallback.java rename to fabric/src/api/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererCallback.java diff --git a/fabric/src/main/java/com/jozufozu/flywheel/api/event/RenderStageCallback.java b/fabric/src/api/java/com/jozufozu/flywheel/api/event/RenderStageCallback.java similarity index 100% rename from fabric/src/main/java/com/jozufozu/flywheel/api/event/RenderStageCallback.java rename to fabric/src/api/java/com/jozufozu/flywheel/api/event/RenderStageCallback.java diff --git a/fabric/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java b/fabric/src/backend/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java similarity index 100% rename from fabric/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java rename to fabric/src/backend/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java diff --git a/fabric/src/main/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java b/fabric/src/backend/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java similarity index 100% rename from fabric/src/main/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java rename to fabric/src/backend/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java diff --git a/fabric/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java similarity index 100% rename from fabric/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java rename to fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java diff --git a/forge/build.gradle b/forge/build.gradle index 79882c90c..2b7c0ce57 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,7 +1,16 @@ plugins { + id 'idea' + id 'java' + id 'maven-publish' + id 'dev.architectury.loom' + id 'flywheel.java' + id 'flywheel.package-infos' + id 'flywheel.subproject' id 'flywheel.platform' } +evaluationDependsOn(':common') + loom { forge { mixinConfig 'flywheel.backend.mixins.json' @@ -14,6 +23,27 @@ loom { property 'forge.logging.markers', '' property 'forge.logging.console.level', 'debug' } + + client { + ideConfigGenerated true + + // Turn on our own debug flags + property 'flw.dumpShaderSource', 'true' + property 'flw.debugMemorySafety', 'true' + + // Turn on mixin debug flags + property 'mixin.debug.export', 'true' + property 'mixin.debug.verbose', 'true' + + // 720p baby! + programArgs '--width', '1280', '--height', '720' + } + + // We're a client mod, but we need to make sure we correctly render when playing on a server. + server { + ideConfigGenerated true + programArgs '--nogui' + } } } @@ -22,13 +52,9 @@ dependencies { modCompileOnly "maven.modrinth:embeddium:${embeddium_version}" modCompileOnly "maven.modrinth:oculus:${oculus_version}" -} -publishing { - publications { - register('mavenJava', MavenPublication) { - from(components['java']) - artifactId = "flywheel-${project.name}-${artifact_minecraft_version}" - } - } + forApi project(path: ':common', configuration: 'commonApi') + forLib project(path: ':common', configuration: 'commonLib') + forBackend project(path: ':common', configuration: 'commonBackend') + forImpl project(path: ':common', configuration: 'commonImpl') } diff --git a/forge/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameEvent.java b/forge/src/api/java/com/jozufozu/flywheel/api/event/BeginFrameEvent.java similarity index 100% rename from forge/src/main/java/com/jozufozu/flywheel/api/event/BeginFrameEvent.java rename to forge/src/api/java/com/jozufozu/flywheel/api/event/BeginFrameEvent.java diff --git a/forge/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadEvent.java b/forge/src/api/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadEvent.java similarity index 100% rename from forge/src/main/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadEvent.java rename to forge/src/api/java/com/jozufozu/flywheel/api/event/EndClientResourceReloadEvent.java diff --git a/forge/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererEvent.java b/forge/src/api/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererEvent.java similarity index 100% rename from forge/src/main/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererEvent.java rename to forge/src/api/java/com/jozufozu/flywheel/api/event/ReloadLevelRendererEvent.java diff --git a/forge/src/main/java/com/jozufozu/flywheel/api/event/RenderStageEvent.java b/forge/src/api/java/com/jozufozu/flywheel/api/event/RenderStageEvent.java similarity index 100% rename from forge/src/main/java/com/jozufozu/flywheel/api/event/RenderStageEvent.java rename to forge/src/api/java/com/jozufozu/flywheel/api/event/RenderStageEvent.java diff --git a/forge/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java b/forge/src/backend/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java similarity index 100% rename from forge/src/main/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java rename to forge/src/backend/java/com/jozufozu/flywheel/backend/FlwBackendXplatImpl.java diff --git a/forge/src/main/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java b/forge/src/backend/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java similarity index 100% rename from forge/src/main/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java rename to forge/src/backend/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java diff --git a/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java similarity index 100% rename from forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java rename to forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java diff --git a/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java similarity index 100% rename from forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java rename to forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java diff --git a/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java similarity index 100% rename from forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java rename to forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java diff --git a/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeMeshEmitter.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMeshEmitter.java similarity index 100% rename from forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeMeshEmitter.java rename to forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMeshEmitter.java diff --git a/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java similarity index 100% rename from forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java rename to forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java diff --git a/forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java similarity index 100% rename from forge/src/main/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java rename to forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java From 77fa0923f55d08f658017c3b09b1b5c8556c0607 Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Fri, 26 Apr 2024 22:31:29 -0700 Subject: [PATCH 27/62] Best-effort untested Fabric model builders - Also fix crash buffering fluids in BakedModelBufferer#bufferMultiBlock (Forge) - The mesh order in models created by model builders is currently incorrect and will be fixed later --- .../lib/model/baked/BakedModelBuilder.java | 20 ++- .../lib/model/baked/BlockModelBuilder.java | 18 +- .../flywheel/lib/model/baked/MeshEmitter.java | 119 -------------- .../model/baked/MultiBlockModelBuilder.java | 22 +-- .../baked/TransformingVertexConsumer.java | 3 + .../impl/mixin/ClientChunkCacheMixin.java | 2 +- .../lib/model/baked/BakedModelBufferer.java | 154 ++++++++++++++++++ .../model/baked/FabricBakedModelBuilder.java | 77 +++++++++ .../model/baked/FabricBlockModelBuilder.java | 66 ++++++++ .../baked/FabricMultiBlockModelBuilder.java | 63 +++++++ .../flywheel/lib/model/baked/MeshEmitter.java | 57 +++++++ .../lib/model/baked/UniversalMeshEmitter.java | 146 +++++++++++++++++ .../flywheel/impl/FlwLibXplatImpl.java | 9 +- .../lib/model/baked/BakedModelBufferer.java | 43 +++-- .../model/baked/ForgeBakedModelBuilder.java | 45 ++++- .../model/baked/ForgeBlockModelBuilder.java | 38 ++++- .../lib/model/baked/ForgeMeshEmitter.java | 21 --- .../baked/ForgeMultiBlockModelBuilder.java | 36 +++- .../flywheel/lib/model/baked/MeshEmitter.java | 133 +++++++++++++++ 19 files changed, 853 insertions(+), 219 deletions(-) delete mode 100644 common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java create mode 100644 fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java create mode 100644 fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBakedModelBuilder.java create mode 100644 fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBlockModelBuilder.java create mode 100644 fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricMultiBlockModelBuilder.java create mode 100644 fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java create mode 100644 fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/UniversalMeshEmitter.java delete mode 100644 forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMeshEmitter.java create mode 100644 forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java index 528dea4bb..db51497b0 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBuilder.java @@ -2,6 +2,7 @@ import java.util.function.BiFunction; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import com.jozufozu.flywheel.api.material.Material; @@ -14,23 +15,24 @@ import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.block.state.BlockState; +@ApiStatus.NonExtendable public abstract class BakedModelBuilder { - protected final BakedModel bakedModel; + final BakedModel bakedModel; @Nullable - protected BlockAndTintGetter level; + BlockAndTintGetter level; @Nullable - protected BlockState blockState; + BlockState blockState; @Nullable - protected PoseStack poseStack; + PoseStack poseStack; @Nullable - protected BiFunction materialFunc; + BiFunction materialFunc; - public static BakedModelBuilder create(BakedModel bakedModel) { - return FlwLibXplat.INSTANCE.createBakedModelBuilder(bakedModel); + BakedModelBuilder(BakedModel bakedModel) { + this.bakedModel = bakedModel; } - protected BakedModelBuilder(BakedModel bakedModel) { - this.bakedModel = bakedModel; + public static BakedModelBuilder create(BakedModel bakedModel) { + return FlwLibXplat.INSTANCE.createBakedModelBuilder(bakedModel); } public BakedModelBuilder level(BlockAndTintGetter level) { diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java index 0c2b44d85..aab97fdfe 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BlockModelBuilder.java @@ -2,6 +2,7 @@ import java.util.function.BiFunction; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import com.jozufozu.flywheel.api.material.Material; @@ -13,21 +14,22 @@ import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.block.state.BlockState; +@ApiStatus.NonExtendable public abstract class BlockModelBuilder { - protected final BlockState state; + final BlockState state; @Nullable - protected BlockAndTintGetter level; + BlockAndTintGetter level; @Nullable - protected PoseStack poseStack; + PoseStack poseStack; @Nullable - protected BiFunction materialFunc; + BiFunction materialFunc; - public static BlockModelBuilder create(BlockState state) { - return FlwLibXplat.INSTANCE.createBlockModelBuilder(state); + BlockModelBuilder(BlockState state) { + this.state = state; } - protected BlockModelBuilder(BlockState state) { - this.state = state; + public static BlockModelBuilder create(BlockState state) { + return FlwLibXplat.INSTANCE.createBlockModelBuilder(state); } public BlockModelBuilder level(BlockAndTintGetter level) { diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java deleted file mode 100644 index b8d5be399..000000000 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.jozufozu.flywheel.lib.model.baked; - -import org.jetbrains.annotations.Nullable; - -import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.blaze3d.vertex.VertexFormat; - -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.block.model.BakedQuad; - -class MeshEmitter implements VertexConsumer { - protected final BufferBuilder bufferBuilder; - private final RenderType renderType; - private boolean lastQuadWasShaded; - private boolean seenFirstQuad; - @Nullable - private MeshEmitter.ResultConsumer resultConsumer; - - MeshEmitter(BufferBuilder bufferBuilder, RenderType renderType) { - this.bufferBuilder = bufferBuilder; - this.renderType = renderType; - } - - public void begin(ResultConsumer resultConsumer) { - this.resultConsumer = resultConsumer; - - begin(); - } - - public void end() { - emit(); - seenFirstQuad = false; - resultConsumer = null; - } - - private void begin() { - bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); - } - - private void emit() { - var renderedBuffer = bufferBuilder.endOrDiscardIfEmpty(); - - if (renderedBuffer != null) { - if (resultConsumer != null) { - resultConsumer.accept(renderType, lastQuadWasShaded, renderedBuffer); - } - renderedBuffer.release(); - } - } - - protected void observeQuadAndEmitIfNecessary(BakedQuad quad) { - if (seenFirstQuad && lastQuadWasShaded != quad.isShade()) { - emit(); - begin(); - } - - seenFirstQuad = true; - lastQuadWasShaded = quad.isShade(); - } - - @Override - public void putBulkData(PoseStack.Pose poseEntry, BakedQuad quad, float[] colorMuls, float red, float green, float blue, int[] combinedLights, int combinedOverlay, boolean mulColor) { - observeQuadAndEmitIfNecessary(quad); - - bufferBuilder.putBulkData(poseEntry, quad, colorMuls, red, green, blue, combinedLights, combinedOverlay, mulColor); - } - - @Override - public VertexConsumer vertex(double x, double y, double z) { - throw new UnsupportedOperationException("ShadeSeparatingVertexConsumer only supports putBulkData!"); - } - - @Override - public VertexConsumer color(int red, int green, int blue, int alpha) { - throw new UnsupportedOperationException("ShadeSeparatingVertexConsumer only supports putBulkData!"); - } - - @Override - public VertexConsumer uv(float u, float v) { - throw new UnsupportedOperationException("ShadeSeparatingVertexConsumer only supports putBulkData!"); - } - - @Override - public VertexConsumer overlayCoords(int u, int v) { - throw new UnsupportedOperationException("ShadeSeparatingVertexConsumer only supports putBulkData!"); - } - - @Override - public VertexConsumer uv2(int u, int v) { - throw new UnsupportedOperationException("ShadeSeparatingVertexConsumer only supports putBulkData!"); - } - - @Override - public VertexConsumer normal(float x, float y, float z) { - throw new UnsupportedOperationException("ShadeSeparatingVertexConsumer only supports putBulkData!"); - } - - @Override - public void endVertex() { - throw new UnsupportedOperationException("ShadeSeparatingVertexConsumer only supports putBulkData!"); - } - - @Override - public void defaultColor(int red, int green, int blue, int alpha) { - throw new UnsupportedOperationException("ShadeSeparatingVertexConsumer only supports putBulkData!"); - } - - @Override - public void unsetDefaultColor() { - throw new UnsupportedOperationException("ShadeSeparatingVertexConsumer only supports putBulkData!"); - } - - public interface ResultConsumer { - void accept(RenderType renderType, boolean shaded, BufferBuilder.RenderedBuffer data); - } -} diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java index c750f5950..fdf9db403 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MultiBlockModelBuilder.java @@ -2,6 +2,7 @@ import java.util.function.BiFunction; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import com.jozufozu.flywheel.api.material.Material; @@ -13,24 +14,25 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockAndTintGetter; +@ApiStatus.NonExtendable public abstract class MultiBlockModelBuilder { - protected final BlockAndTintGetter level; - protected final Iterable positions; + final BlockAndTintGetter level; + final Iterable positions; @Nullable - protected PoseStack poseStack; - protected boolean renderFluids = false; + PoseStack poseStack; + boolean renderFluids = false; @Nullable - protected BiFunction materialFunc; + BiFunction materialFunc; - public static MultiBlockModelBuilder create(BlockAndTintGetter level, Iterable positions) { - return FlwLibXplat.INSTANCE.createMultiBlockModelBuilder(level, positions); - } - - protected MultiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { + MultiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { this.level = level; this.positions = positions; } + public static MultiBlockModelBuilder create(BlockAndTintGetter level, Iterable positions) { + return FlwLibXplat.INSTANCE.createMultiBlockModelBuilder(level, positions); + } + public MultiBlockModelBuilder poseStack(PoseStack poseStack) { this.poseStack = poseStack; return this; diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/TransformingVertexConsumer.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/TransformingVertexConsumer.java index 09054e2b4..42f7c9f93 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/TransformingVertexConsumer.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/model/baked/TransformingVertexConsumer.java @@ -1,5 +1,6 @@ package com.jozufozu.flywheel.lib.model.baked; +import org.jetbrains.annotations.UnknownNullability; import org.joml.Matrix3f; import org.joml.Matrix4f; @@ -8,7 +9,9 @@ import com.mojang.blaze3d.vertex.VertexConsumer; class TransformingVertexConsumer implements VertexConsumer { + @UnknownNullability private VertexConsumer delegate; + @UnknownNullability private PoseStack poseStack; public void prepare(VertexConsumer delegate, PoseStack poseStack) { diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/ClientChunkCacheMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/ClientChunkCacheMixin.java index 4cf130204..6f032bd86 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/ClientChunkCacheMixin.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/ClientChunkCacheMixin.java @@ -15,7 +15,7 @@ import net.minecraft.world.level.LightLayer; @Mixin(ClientChunkCache.class) -public class ClientChunkCacheMixin { +abstract class ClientChunkCacheMixin { @Shadow @Final ClientLevel level; diff --git a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java new file mode 100644 index 000000000..39b9fb9eb --- /dev/null +++ b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java @@ -0,0 +1,154 @@ +package com.jozufozu.flywheel.lib.model.baked; + +import java.util.Iterator; + +import org.jetbrains.annotations.Nullable; + +import com.mojang.blaze3d.vertex.BufferBuilder.RenderedBuffer; +import com.mojang.blaze3d.vertex.PoseStack; + +import it.unimi.dsi.fastutil.objects.Reference2ReferenceMap; +import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; +import net.minecraft.client.renderer.ItemBlockRenderTypes; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.block.ModelBlockRenderer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.BlockPos; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.FluidState; + +final class BakedModelBufferer { + private static final RenderType[] CHUNK_LAYERS = RenderType.chunkBufferLayers().toArray(RenderType[]::new); + private static final int CHUNK_LAYER_AMOUNT = CHUNK_LAYERS.length; + + private static final ThreadLocal THREAD_LOCAL_OBJECTS = ThreadLocal.withInitial(ThreadLocalObjects::new); + + private BakedModelBufferer() { + } + + public static void bufferSingle(ModelBlockRenderer blockRenderer, BlockAndTintGetter level, BakedModel model, BlockState state, @Nullable PoseStack poseStack, ResultConsumer resultConsumer) { + ThreadLocalObjects objects = THREAD_LOCAL_OBJECTS.get(); + if (poseStack == null) { + poseStack = objects.identityPoseStack; + } + RandomSource random = objects.random; + MeshEmitter[] emitters = objects.emitters; + UniversalMeshEmitter universalEmitter = objects.universalEmitter; + + for (MeshEmitter emitter : emitters) { + emitter.prepare(resultConsumer); + } + + RenderType defaultLayer = ItemBlockRenderTypes.getChunkRenderType(state); + universalEmitter.prepare(defaultLayer); + model = universalEmitter.wrapModel(model); + + poseStack.pushPose(); + blockRenderer.tesselateBlock(level, model, state, BlockPos.ZERO, poseStack, universalEmitter, false, random, 42L, OverlayTexture.NO_OVERLAY); + poseStack.popPose(); + + universalEmitter.clear(); + + for (MeshEmitter emitter : emitters) { + emitter.end(); + } + } + + public static void bufferBlock(BlockRenderDispatcher renderDispatcher, BlockAndTintGetter level, BlockState state, @Nullable PoseStack poseStack, ResultConsumer resultConsumer) { + if (state.getRenderShape() != RenderShape.MODEL) { + return; + } + + bufferSingle(renderDispatcher.getModelRenderer(), level, renderDispatcher.getBlockModel(state), state, poseStack, resultConsumer); + } + + public static void bufferMultiBlock(BlockRenderDispatcher renderDispatcher, Iterator posIterator, BlockAndTintGetter level, @Nullable PoseStack poseStack, boolean renderFluids, ResultConsumer resultConsumer) { + ThreadLocalObjects objects = THREAD_LOCAL_OBJECTS.get(); + if (poseStack == null) { + poseStack = objects.identityPoseStack; + } + RandomSource random = objects.random; + MeshEmitter[] emitters = objects.emitters; + Reference2ReferenceMap emitterMap = objects.emitterMap; + UniversalMeshEmitter universalEmitter = objects.universalEmitter; + TransformingVertexConsumer transformingWrapper = objects.transformingWrapper; + + for (MeshEmitter emitter : emitters) { + emitter.prepare(resultConsumer); + } + + ModelBlockRenderer blockRenderer = renderDispatcher.getModelRenderer(); + ModelBlockRenderer.enableCaching(); + + while (posIterator.hasNext()) { + BlockPos pos = posIterator.next(); + BlockState state = level.getBlockState(pos); + + if (renderFluids) { + FluidState fluidState = state.getFluidState(); + + if (!fluidState.isEmpty()) { + RenderType renderType = ItemBlockRenderTypes.getRenderLayer(fluidState); + + transformingWrapper.prepare(emitterMap.get(renderType).getBuffer(true), poseStack); + + poseStack.pushPose(); + poseStack.translate(pos.getX() - (pos.getX() & 0xF), pos.getY() - (pos.getY() & 0xF), pos.getZ() - (pos.getZ() & 0xF)); + renderDispatcher.renderLiquid(pos, level, transformingWrapper, state, fluidState); + poseStack.popPose(); + } + } + + if (state.getRenderShape() == RenderShape.MODEL) { + long seed = state.getSeed(pos); + BakedModel model = renderDispatcher.getBlockModel(state); + + RenderType defaultLayer = ItemBlockRenderTypes.getChunkRenderType(state); + universalEmitter.prepare(defaultLayer); + model = universalEmitter.wrapModel(model); + + poseStack.pushPose(); + poseStack.translate(pos.getX(), pos.getY(), pos.getZ()); + blockRenderer.tesselateBlock(level, model, state, pos, poseStack, universalEmitter, true, random, seed, OverlayTexture.NO_OVERLAY); + poseStack.popPose(); + } + } + + ModelBlockRenderer.clearCache(); + transformingWrapper.clear(); + universalEmitter.clear(); + + for (MeshEmitter emitter : emitters) { + emitter.end(); + } + } + + public interface ResultConsumer { + void accept(RenderType renderType, boolean shaded, RenderedBuffer data); + } + + private static class ThreadLocalObjects { + public final PoseStack identityPoseStack = new PoseStack(); + public final RandomSource random = RandomSource.createNewThreadLocalInstance(); + + public final MeshEmitter[] emitters = new MeshEmitter[CHUNK_LAYER_AMOUNT]; + public final Reference2ReferenceMap emitterMap = new Reference2ReferenceOpenHashMap<>(); + public final UniversalMeshEmitter universalEmitter; + public final TransformingVertexConsumer transformingWrapper = new TransformingVertexConsumer(); + + { + for (int layerIndex = 0; layerIndex < CHUNK_LAYER_AMOUNT; layerIndex++) { + RenderType renderType = CHUNK_LAYERS[layerIndex]; + MeshEmitter emitter = new MeshEmitter(renderType); + emitters[layerIndex] = emitter; + emitterMap.put(renderType, emitter); + } + universalEmitter = new UniversalMeshEmitter(emitterMap); + } + } +} diff --git a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBakedModelBuilder.java b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBakedModelBuilder.java new file mode 100644 index 000000000..a4b47d019 --- /dev/null +++ b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBakedModelBuilder.java @@ -0,0 +1,77 @@ +package com.jozufozu.flywheel.lib.model.baked; + +import java.util.function.BiFunction; + +import com.google.common.collect.ImmutableList; +import com.jozufozu.flywheel.api.material.Material; +import com.jozufozu.flywheel.api.model.Model; +import com.jozufozu.flywheel.api.vertex.VertexView; +import com.jozufozu.flywheel.lib.memory.MemoryBlock; +import com.jozufozu.flywheel.lib.model.ModelUtil; +import com.jozufozu.flywheel.lib.model.SimpleMesh; +import com.jozufozu.flywheel.lib.model.SimpleModel; +import com.jozufozu.flywheel.lib.vertex.NoOverlayVertexView; +import com.mojang.blaze3d.vertex.PoseStack; + +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; + +public final class FabricBakedModelBuilder extends BakedModelBuilder { + public FabricBakedModelBuilder(BakedModel bakedModel) { + super(bakedModel); + } + + @Override + public FabricBakedModelBuilder level(BlockAndTintGetter level) { + super.level(level); + return this; + } + + @Override + public FabricBakedModelBuilder blockState(BlockState blockState) { + super.blockState(blockState); + return this; + } + + @Override + public FabricBakedModelBuilder poseStack(PoseStack poseStack) { + super.poseStack(poseStack); + return this; + } + + @Override + public FabricBakedModelBuilder materialFunc(BiFunction materialFunc) { + super.materialFunc(materialFunc); + return this; + } + + @Override + public SimpleModel build() { + if (level == null) { + level = VirtualEmptyBlockGetter.INSTANCE; + } + if (blockState == null) { + blockState = Blocks.AIR.defaultBlockState(); + } + if (materialFunc == null) { + materialFunc = ModelUtil::getMaterial; + } + + var out = ImmutableList.builder(); + + BakedModelBufferer.bufferSingle(ModelUtil.VANILLA_RENDERER.getModelRenderer(), level, bakedModel, blockState, poseStack, (renderType, shaded, data) -> { + Material material = materialFunc.apply(renderType, shaded); + if (material != null) { + VertexView vertexView = new NoOverlayVertexView(); + MemoryBlock meshData = ModelUtil.convertVanillaBuffer(data, vertexView); + var mesh = new SimpleMesh(vertexView, meshData, "source=BakedModelBuilder," + "bakedModel=" + bakedModel + ",renderType=" + renderType + ",shaded=" + shaded); + out.add(new Model.ConfiguredMesh(material, mesh)); + } + }); + + return new SimpleModel(out.build()); + } +} diff --git a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBlockModelBuilder.java b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBlockModelBuilder.java new file mode 100644 index 000000000..bfc2ab0ca --- /dev/null +++ b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBlockModelBuilder.java @@ -0,0 +1,66 @@ +package com.jozufozu.flywheel.lib.model.baked; + +import java.util.function.BiFunction; + +import com.google.common.collect.ImmutableList; +import com.jozufozu.flywheel.api.material.Material; +import com.jozufozu.flywheel.api.model.Model; +import com.jozufozu.flywheel.api.vertex.VertexView; +import com.jozufozu.flywheel.lib.memory.MemoryBlock; +import com.jozufozu.flywheel.lib.model.ModelUtil; +import com.jozufozu.flywheel.lib.model.SimpleMesh; +import com.jozufozu.flywheel.lib.model.SimpleModel; +import com.jozufozu.flywheel.lib.vertex.NoOverlayVertexView; +import com.mojang.blaze3d.vertex.PoseStack; + +import net.minecraft.client.renderer.RenderType; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.block.state.BlockState; + +public final class FabricBlockModelBuilder extends BlockModelBuilder { + public FabricBlockModelBuilder(BlockState state) { + super(state); + } + + @Override + public FabricBlockModelBuilder level(BlockAndTintGetter level) { + super.level(level); + return this; + } + + @Override + public FabricBlockModelBuilder poseStack(PoseStack poseStack) { + super.poseStack(poseStack); + return this; + } + + @Override + public FabricBlockModelBuilder materialFunc(BiFunction materialFunc) { + super.materialFunc(materialFunc); + return this; + } + + @Override + public SimpleModel build() { + if (level == null) { + level = VirtualEmptyBlockGetter.INSTANCE; + } + if (materialFunc == null) { + materialFunc = ModelUtil::getMaterial; + } + + var out = ImmutableList.builder(); + + BakedModelBufferer.bufferBlock(ModelUtil.VANILLA_RENDERER, level, state, poseStack, (renderType, shaded, data) -> { + Material material = materialFunc.apply(renderType, shaded); + if (material != null) { + VertexView vertexView = new NoOverlayVertexView(); + MemoryBlock meshData = ModelUtil.convertVanillaBuffer(data, vertexView); + var mesh = new SimpleMesh(vertexView, meshData, "source=BlockModelBuilder," + "blockState=" + state + ",renderType=" + renderType + ",shaded=" + shaded); + out.add(new Model.ConfiguredMesh(material, mesh)); + } + }); + + return new SimpleModel(out.build()); + } +} diff --git a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricMultiBlockModelBuilder.java b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricMultiBlockModelBuilder.java new file mode 100644 index 000000000..d3dbf408c --- /dev/null +++ b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricMultiBlockModelBuilder.java @@ -0,0 +1,63 @@ +package com.jozufozu.flywheel.lib.model.baked; + +import java.util.function.BiFunction; + +import com.google.common.collect.ImmutableList; +import com.jozufozu.flywheel.api.material.Material; +import com.jozufozu.flywheel.api.model.Model; +import com.jozufozu.flywheel.api.vertex.VertexView; +import com.jozufozu.flywheel.lib.memory.MemoryBlock; +import com.jozufozu.flywheel.lib.model.ModelUtil; +import com.jozufozu.flywheel.lib.model.SimpleMesh; +import com.jozufozu.flywheel.lib.model.SimpleModel; +import com.jozufozu.flywheel.lib.vertex.NoOverlayVertexView; +import com.mojang.blaze3d.vertex.PoseStack; + +import net.minecraft.client.renderer.RenderType; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockAndTintGetter; + +public final class FabricMultiBlockModelBuilder extends MultiBlockModelBuilder { + public FabricMultiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { + super(level, positions); + } + + @Override + public FabricMultiBlockModelBuilder poseStack(PoseStack poseStack) { + super.poseStack(poseStack); + return this; + } + + @Override + public FabricMultiBlockModelBuilder enableFluidRendering() { + super.enableFluidRendering(); + return this; + } + + @Override + public FabricMultiBlockModelBuilder materialFunc(BiFunction materialFunc) { + super.materialFunc(materialFunc); + return this; + } + + @Override + public SimpleModel build() { + if (materialFunc == null) { + materialFunc = ModelUtil::getMaterial; + } + + var out = ImmutableList.builder(); + + BakedModelBufferer.bufferMultiBlock(ModelUtil.VANILLA_RENDERER, positions.iterator(), level, poseStack, renderFluids, (renderType, shaded, data) -> { + Material material = materialFunc.apply(renderType, shaded); + if (material != null) { + VertexView vertexView = new NoOverlayVertexView(); + MemoryBlock meshData = ModelUtil.convertVanillaBuffer(data, vertexView); + var mesh = new SimpleMesh(vertexView, meshData, "source=MultiBlockModelBuilder," + "renderType=" + renderType + ",shaded=" + shaded); + out.add(new Model.ConfiguredMesh(material, mesh)); + } + }); + + return new SimpleModel(out.build()); + } +} diff --git a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java new file mode 100644 index 000000000..c443807af --- /dev/null +++ b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java @@ -0,0 +1,57 @@ +package com.jozufozu.flywheel.lib.model.baked; + +import org.jetbrains.annotations.UnknownNullability; + +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.blaze3d.vertex.VertexFormat; + +import net.minecraft.client.renderer.RenderType; + +class MeshEmitter { + private final RenderType renderType; + private final BufferBuilder bufferBuilder; + + private BakedModelBufferer.@UnknownNullability ResultConsumer resultConsumer; + private boolean currentShade; + + MeshEmitter(RenderType renderType) { + this.renderType = renderType; + this.bufferBuilder = new BufferBuilder(renderType.bufferSize()); + } + + public void prepare(BakedModelBufferer.ResultConsumer resultConsumer) { + this.resultConsumer = resultConsumer; + } + + public void end() { + if (bufferBuilder.building()) { + emit(); + } + resultConsumer = null; + } + + public BufferBuilder getBuffer(boolean shade) { + prepareForGeometry(shade); + return bufferBuilder; + } + + void prepareForGeometry(boolean shade) { + if (!bufferBuilder.building()) { + bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); + } else if (shade != currentShade) { + emit(); + } + + currentShade = shade; + } + + void emit() { + var renderedBuffer = bufferBuilder.endOrDiscardIfEmpty(); + + if (renderedBuffer != null) { + resultConsumer.accept(renderType, currentShade, renderedBuffer); + renderedBuffer.release(); + } + } +} diff --git a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/UniversalMeshEmitter.java b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/UniversalMeshEmitter.java new file mode 100644 index 000000000..d56633513 --- /dev/null +++ b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/UniversalMeshEmitter.java @@ -0,0 +1,146 @@ +package com.jozufozu.flywheel.lib.model.baked; + +import java.util.function.Supplier; + +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.UnknownNullability; + +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; + +import it.unimi.dsi.fastutil.objects.Reference2ReferenceMap; +import net.fabricmc.fabric.api.renderer.v1.material.BlendMode; +import net.fabricmc.fabric.api.renderer.v1.material.RenderMaterial; +import net.fabricmc.fabric.api.renderer.v1.model.ForwardingBakedModel; +import net.fabricmc.fabric.api.renderer.v1.render.RenderContext; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.BlockPos; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.block.state.BlockState; + +class UniversalMeshEmitter implements VertexConsumer { + private final Reference2ReferenceMap emitterMap; + private final WrapperModel wrapperModel = new WrapperModel(); + + @UnknownNullability + private RenderType defaultLayer; + @UnknownNullability + private BufferBuilder currentDelegate; + + UniversalMeshEmitter(Reference2ReferenceMap emitterMap) { + this.emitterMap = emitterMap; + } + + public void prepare(RenderType defaultLayer) { + this.defaultLayer = defaultLayer; + } + + public void clear() { + wrapperModel.setWrapped(null); + } + + public BakedModel wrapModel(BakedModel model) { + wrapperModel.setWrapped(model); + return wrapperModel; + } + + private void prepareForGeometry(RenderMaterial material) { + BlendMode blendMode = material.blendMode(); + RenderType layer = blendMode == BlendMode.DEFAULT ? defaultLayer : blendMode.blockRenderLayer; + boolean shade = !material.disableDiffuse(); + currentDelegate = emitterMap.get(layer).getBuffer(shade); + } + + @Override + public VertexConsumer vertex(double x, double y, double z) { + currentDelegate.vertex(x, y, z); + return this; + } + + @Override + public VertexConsumer color(int red, int green, int blue, int alpha) { + currentDelegate.color(red, green, blue, alpha); + return this; + } + + @Override + public VertexConsumer uv(float u, float v) { + currentDelegate.uv(u, v); + return this; + } + + @Override + public VertexConsumer overlayCoords(int u, int v) { + currentDelegate.overlayCoords(u, v); + return this; + } + + @Override + public VertexConsumer uv2(int u, int v) { + currentDelegate.uv2(u, v); + return this; + } + + @Override + public VertexConsumer normal(float x, float y, float z) { + currentDelegate.normal(x, y, z); + return this; + } + + @Override + public void endVertex() { + currentDelegate.endVertex(); + } + + @Override + public void defaultColor(int red, int green, int blue, int alpha) { + currentDelegate.defaultColor(red, green, blue, alpha); + } + + @Override + public void unsetDefaultColor() { + currentDelegate.unsetDefaultColor(); + } + + @Override + public void vertex(float x, float y, float z, float red, float green, float blue, float alpha, float u, float v, int overlay, int light, float normalX, float normalY, float normalZ) { + currentDelegate.vertex(x, y, z, red, green, blue, alpha, u, v, overlay, light, normalX, normalY, normalZ); + } + + @Override + public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float red, float green, float blue, int light, int overlay) { + currentDelegate.putBulkData(pose, quad, red, green, blue, light, overlay); + } + + @Override + public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float[] brightnesses, float red, float green, float blue, int[] lights, int overlay, boolean readExistingColor) { + currentDelegate.putBulkData(pose, quad, brightnesses, red, green, blue, lights, overlay, readExistingColor); + } + + private class WrapperModel extends ForwardingBakedModel { + private final RenderContext.QuadTransform quadTransform = quad -> { + UniversalMeshEmitter.this.prepareForGeometry(quad.material()); + return true; + }; + + public void setWrapped(@Nullable BakedModel wrapped) { + this.wrapped = wrapped; + } + + @Override + public boolean isVanillaAdapter() { + return false; + } + + @Override + public void emitBlockQuads(BlockAndTintGetter level, BlockState state, BlockPos pos, Supplier randomSupplier, RenderContext context) { + context.pushTransform(quadTransform); + super.emitBlockQuads(level, state, pos, randomSupplier, context); + context.popTransform(); + } + } +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java index 908dc3a5d..932a458ac 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java @@ -5,6 +5,9 @@ import com.jozufozu.flywheel.lib.internal.FlwLibXplat; import com.jozufozu.flywheel.lib.model.baked.BakedModelBuilder; import com.jozufozu.flywheel.lib.model.baked.BlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.FabricBakedModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.FabricBlockModelBuilder; +import com.jozufozu.flywheel.lib.model.baked.FabricMultiBlockModelBuilder; import com.jozufozu.flywheel.lib.model.baked.MultiBlockModelBuilder; import com.jozufozu.flywheel.lib.util.ShadersModHandler; @@ -25,17 +28,17 @@ public BlockRenderDispatcher createVanillaBlockRenderDispatcher() { @Override public BakedModelBuilder createBakedModelBuilder(BakedModel bakedModel) { - return null; + return new FabricBakedModelBuilder(bakedModel); } @Override public BlockModelBuilder createBlockModelBuilder(BlockState state) { - return null; + return new FabricBlockModelBuilder(state); } @Override public MultiBlockModelBuilder createMultiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { - return null; + return new FabricMultiBlockModelBuilder(level, positions); } @Override diff --git a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java index c454aaf52..cb6882a4d 100644 --- a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java +++ b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java @@ -5,7 +5,6 @@ import org.jetbrains.annotations.Nullable; -import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.BufferBuilder.RenderedBuffer; import com.mojang.blaze3d.vertex.PoseStack; @@ -33,13 +32,13 @@ final class BakedModelBufferer { private BakedModelBufferer() { } - public static void bufferSingle(ModelBlockRenderer blockRenderer, BlockAndTintGetter level, BakedModel model, BlockState state, @Nullable PoseStack poseStack, ModelData modelData, MeshEmitter.ResultConsumer resultConsumer) { + public static void bufferSingle(ModelBlockRenderer blockRenderer, BlockAndTintGetter level, BakedModel model, BlockState state, @Nullable PoseStack poseStack, ModelData modelData, ResultConsumer resultConsumer) { ThreadLocalObjects objects = THREAD_LOCAL_OBJECTS.get(); if (poseStack == null) { poseStack = objects.identityPoseStack; } RandomSource random = objects.random; - var consumers = objects.emitters; + MeshEmitter[] emitters = objects.emitters; modelData = model.getModelData(level, BlockPos.ZERO, state, modelData); random.setSeed(42L); @@ -47,19 +46,19 @@ public static void bufferSingle(ModelBlockRenderer blockRenderer, BlockAndTintGe for (RenderType renderType : renderTypes) { int layerIndex = renderType.getChunkLayerId(); - var consumer = consumers[layerIndex]; + MeshEmitter emitter = emitters[layerIndex]; - consumer.begin(resultConsumer); + emitter.prepare(resultConsumer); poseStack.pushPose(); - blockRenderer.tesselateBlock(level, model, state, BlockPos.ZERO, poseStack, consumer, false, random, 42L, OverlayTexture.NO_OVERLAY, modelData, renderType); + blockRenderer.tesselateBlock(level, model, state, BlockPos.ZERO, poseStack, emitter, false, random, 42L, OverlayTexture.NO_OVERLAY, modelData, renderType); poseStack.popPose(); - consumer.end(); + emitter.end(); } } - public static void bufferBlock(BlockRenderDispatcher renderDispatcher, BlockAndTintGetter level, BlockState state, @Nullable PoseStack poseStack, ModelData modelData, MeshEmitter.ResultConsumer resultConsumer) { + public static void bufferBlock(BlockRenderDispatcher renderDispatcher, BlockAndTintGetter level, BlockState state, @Nullable PoseStack poseStack, ModelData modelData, ResultConsumer resultConsumer) { if (state.getRenderShape() != RenderShape.MODEL) { return; } @@ -67,18 +66,17 @@ public static void bufferBlock(BlockRenderDispatcher renderDispatcher, BlockAndT bufferSingle(renderDispatcher.getModelRenderer(), level, renderDispatcher.getBlockModel(state), state, poseStack, modelData, resultConsumer); } - public static void bufferMultiBlock(BlockRenderDispatcher renderDispatcher, Iterator posIterator, BlockAndTintGetter level, @Nullable PoseStack poseStack, Function modelDataLookup, boolean renderFluids, MeshEmitter.ResultConsumer resultConsumer) { + public static void bufferMultiBlock(BlockRenderDispatcher renderDispatcher, Iterator posIterator, BlockAndTintGetter level, @Nullable PoseStack poseStack, Function modelDataLookup, boolean renderFluids, ResultConsumer resultConsumer) { ThreadLocalObjects objects = THREAD_LOCAL_OBJECTS.get(); if (poseStack == null) { poseStack = objects.identityPoseStack; } RandomSource random = objects.random; + MeshEmitter[] emitters = objects.emitters; TransformingVertexConsumer transformingWrapper = objects.transformingWrapper; - var emitters = objects.emitters; - - for (var emitter : emitters) { - emitter.begin(resultConsumer); + for (MeshEmitter emitter : emitters) { + emitter.prepare(resultConsumer); } ModelBlockRenderer blockRenderer = renderDispatcher.getModelRenderer(); @@ -92,10 +90,10 @@ public static void bufferMultiBlock(BlockRenderDispatcher renderDispatcher, Iter FluidState fluidState = state.getFluidState(); if (!fluidState.isEmpty()) { - RenderType layer = ItemBlockRenderTypes.getRenderLayer(fluidState); - int layerIndex = layer.getChunkLayerId(); + RenderType renderType = ItemBlockRenderTypes.getRenderLayer(fluidState); + int layerIndex = renderType.getChunkLayerId(); - transformingWrapper.prepare(emitters[layerIndex], poseStack); + transformingWrapper.prepare(emitters[layerIndex].unwrap(true), poseStack); poseStack.pushPose(); poseStack.translate(pos.getX() - (pos.getX() & 0xF), pos.getY() - (pos.getY() & 0xF), pos.getZ() - (pos.getZ() & 0xF)); @@ -124,12 +122,11 @@ public static void bufferMultiBlock(BlockRenderDispatcher renderDispatcher, Iter } ModelBlockRenderer.clearCache(); + transformingWrapper.clear(); - for (var emitter : emitters) { + for (MeshEmitter emitter : emitters) { emitter.end(); } - - transformingWrapper.clear(); } public interface ResultConsumer { @@ -140,15 +137,13 @@ private static class ThreadLocalObjects { public final PoseStack identityPoseStack = new PoseStack(); public final RandomSource random = RandomSource.createNewThreadLocalInstance(); + public final MeshEmitter[] emitters = new MeshEmitter[CHUNK_LAYER_AMOUNT]; public final TransformingVertexConsumer transformingWrapper = new TransformingVertexConsumer(); - public final ForgeMeshEmitter[] emitters = new ForgeMeshEmitter[CHUNK_LAYER_AMOUNT]; - { for (int layerIndex = 0; layerIndex < CHUNK_LAYER_AMOUNT; layerIndex++) { - var renderType = CHUNK_LAYERS[layerIndex]; - var buffer = new BufferBuilder(renderType.bufferSize()); - emitters[layerIndex] = new ForgeMeshEmitter(buffer, renderType); + RenderType renderType = CHUNK_LAYERS[layerIndex]; + emitters[layerIndex] = new MeshEmitter(renderType); } } } diff --git a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java index e313a8aa7..8ad0e0404 100644 --- a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java +++ b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java @@ -1,5 +1,7 @@ package com.jozufozu.flywheel.lib.model.baked; +import java.util.function.BiFunction; + import org.jetbrains.annotations.Nullable; import com.google.common.collect.ImmutableList; @@ -10,14 +12,17 @@ import com.jozufozu.flywheel.lib.model.ModelUtil; import com.jozufozu.flywheel.lib.model.SimpleMesh; import com.jozufozu.flywheel.lib.model.SimpleModel; -import com.jozufozu.flywheel.lib.model.baked.MeshEmitter.ResultConsumer; import com.jozufozu.flywheel.lib.vertex.NoOverlayVertexView; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.client.model.data.ModelData; -public class ForgeBakedModelBuilder extends BakedModelBuilder { +public final class ForgeBakedModelBuilder extends BakedModelBuilder { @Nullable private ModelData modelData; @@ -25,11 +30,36 @@ public ForgeBakedModelBuilder(BakedModel bakedModel) { super(bakedModel); } + @Override + public ForgeBakedModelBuilder level(BlockAndTintGetter level) { + super.level(level); + return this; + } + + @Override + public ForgeBakedModelBuilder blockState(BlockState blockState) { + super.blockState(blockState); + return this; + } + + @Override + public ForgeBakedModelBuilder poseStack(PoseStack poseStack) { + super.poseStack(poseStack); + return this; + } + + @Override + public ForgeBakedModelBuilder materialFunc(BiFunction materialFunc) { + super.materialFunc(materialFunc); + return this; + } + public ForgeBakedModelBuilder modelData(ModelData modelData) { this.modelData = modelData; return this; } + @Override public SimpleModel build() { if (level == null) { level = VirtualEmptyBlockGetter.INSTANCE; @@ -37,16 +67,16 @@ public SimpleModel build() { if (blockState == null) { blockState = Blocks.AIR.defaultBlockState(); } - if (modelData == null) { - modelData = ModelData.EMPTY; - } if (materialFunc == null) { materialFunc = ModelUtil::getMaterial; } + if (modelData == null) { + modelData = ModelData.EMPTY; + } var out = ImmutableList.builder(); - ResultConsumer resultConsumer = (renderType, shaded, data) -> { + BakedModelBufferer.bufferSingle(ModelUtil.VANILLA_RENDERER.getModelRenderer(), level, bakedModel, blockState, poseStack, modelData, (renderType, shaded, data) -> { Material material = materialFunc.apply(renderType, shaded); if (material != null) { VertexView vertexView = new NoOverlayVertexView(); @@ -54,8 +84,7 @@ public SimpleModel build() { var mesh = new SimpleMesh(vertexView, meshData, "source=BakedModelBuilder," + "bakedModel=" + bakedModel + ",renderType=" + renderType + ",shaded=" + shaded); out.add(new Model.ConfiguredMesh(material, mesh)); } - }; - BakedModelBufferer.bufferSingle(ModelUtil.VANILLA_RENDERER.getModelRenderer(), level, bakedModel, blockState, poseStack, modelData, resultConsumer); + }); return new SimpleModel(out.build()); } diff --git a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java index 017480a30..af06eadc9 100644 --- a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java +++ b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java @@ -1,5 +1,7 @@ package com.jozufozu.flywheel.lib.model.baked; +import java.util.function.BiFunction; + import org.jetbrains.annotations.Nullable; import com.google.common.collect.ImmutableList; @@ -10,13 +12,15 @@ import com.jozufozu.flywheel.lib.model.ModelUtil; import com.jozufozu.flywheel.lib.model.SimpleMesh; import com.jozufozu.flywheel.lib.model.SimpleModel; -import com.jozufozu.flywheel.lib.model.baked.MeshEmitter.ResultConsumer; import com.jozufozu.flywheel.lib.vertex.NoOverlayVertexView; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.client.model.data.ModelData; -public class ForgeBlockModelBuilder extends BlockModelBuilder { +public final class ForgeBlockModelBuilder extends BlockModelBuilder { @Nullable private ModelData modelData; @@ -24,25 +28,44 @@ public ForgeBlockModelBuilder(BlockState state) { super(state); } + @Override + public ForgeBlockModelBuilder level(BlockAndTintGetter level) { + super.level(level); + return this; + } + + @Override + public ForgeBlockModelBuilder poseStack(PoseStack poseStack) { + super.poseStack(poseStack); + return this; + } + + @Override + public ForgeBlockModelBuilder materialFunc(BiFunction materialFunc) { + super.materialFunc(materialFunc); + return this; + } + public ForgeBlockModelBuilder modelData(ModelData modelData) { this.modelData = modelData; return this; } + @Override public SimpleModel build() { if (level == null) { level = VirtualEmptyBlockGetter.INSTANCE; } - if (modelData == null) { - modelData = ModelData.EMPTY; - } if (materialFunc == null) { materialFunc = ModelUtil::getMaterial; } + if (modelData == null) { + modelData = ModelData.EMPTY; + } var out = ImmutableList.builder(); - ResultConsumer resultConsumer = (renderType, shaded, data) -> { + BakedModelBufferer.bufferBlock(ModelUtil.VANILLA_RENDERER, level, state, poseStack, modelData, (renderType, shaded, data) -> { Material material = materialFunc.apply(renderType, shaded); if (material != null) { VertexView vertexView = new NoOverlayVertexView(); @@ -50,8 +73,7 @@ public SimpleModel build() { var mesh = new SimpleMesh(vertexView, meshData, "source=BlockModelBuilder," + "blockState=" + state + ",renderType=" + renderType + ",shaded=" + shaded); out.add(new Model.ConfiguredMesh(material, mesh)); } - }; - BakedModelBufferer.bufferBlock(ModelUtil.VANILLA_RENDERER, level, state, poseStack, modelData, resultConsumer); + }); return new SimpleModel(out.build()); } diff --git a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMeshEmitter.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMeshEmitter.java deleted file mode 100644 index ffebddce2..000000000 --- a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMeshEmitter.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.jozufozu.flywheel.lib.model.baked; - -import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.PoseStack; - -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.block.model.BakedQuad; - -class ForgeMeshEmitter extends MeshEmitter { - ForgeMeshEmitter(BufferBuilder bufferBuilder, RenderType renderType) { - super(bufferBuilder, renderType); - } - - // Forge has another putBulkData that we need to override - @Override - public void putBulkData(PoseStack.Pose matrixEntry, BakedQuad quad, float[] baseBrightness, float red, float green, float blue, float alpha, int[] lightmapCoords, int overlayCoords, boolean readExistingColor) { - observeQuadAndEmitIfNecessary(quad); - - bufferBuilder.putBulkData(matrixEntry, quad, baseBrightness, red, green, blue, alpha, lightmapCoords, overlayCoords, readExistingColor); - } -} diff --git a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java index bc4bc05cc..48c3363b4 100644 --- a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java +++ b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java @@ -1,5 +1,6 @@ package com.jozufozu.flywheel.lib.model.baked; +import java.util.function.BiFunction; import java.util.function.Function; import org.jetbrains.annotations.Nullable; @@ -12,14 +13,15 @@ import com.jozufozu.flywheel.lib.model.ModelUtil; import com.jozufozu.flywheel.lib.model.SimpleMesh; import com.jozufozu.flywheel.lib.model.SimpleModel; -import com.jozufozu.flywheel.lib.model.baked.MeshEmitter.ResultConsumer; import com.jozufozu.flywheel.lib.vertex.NoOverlayVertexView; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.RenderType; import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraftforge.client.model.data.ModelData; -public class ForgeMultiBlockModelBuilder extends MultiBlockModelBuilder { +public final class ForgeMultiBlockModelBuilder extends MultiBlockModelBuilder { @Nullable private Function modelDataLookup; @@ -27,22 +29,41 @@ public ForgeMultiBlockModelBuilder(BlockAndTintGetter level, Iterable super(level, positions); } + @Override + public ForgeMultiBlockModelBuilder poseStack(PoseStack poseStack) { + super.poseStack(poseStack); + return this; + } + + @Override + public ForgeMultiBlockModelBuilder enableFluidRendering() { + super.enableFluidRendering(); + return this; + } + + @Override + public ForgeMultiBlockModelBuilder materialFunc(BiFunction materialFunc) { + super.materialFunc(materialFunc); + return this; + } + public ForgeMultiBlockModelBuilder modelDataLookup(Function modelDataLookup) { this.modelDataLookup = modelDataLookup; return this; } + @Override public SimpleModel build() { - if (modelDataLookup == null) { - modelDataLookup = pos -> ModelData.EMPTY; - } if (materialFunc == null) { materialFunc = ModelUtil::getMaterial; } + if (modelDataLookup == null) { + modelDataLookup = pos -> ModelData.EMPTY; + } var out = ImmutableList.builder(); - ResultConsumer resultConsumer = (renderType, shaded, data) -> { + BakedModelBufferer.bufferMultiBlock(ModelUtil.VANILLA_RENDERER, positions.iterator(), level, poseStack, modelDataLookup, renderFluids, (renderType, shaded, data) -> { Material material = materialFunc.apply(renderType, shaded); if (material != null) { VertexView vertexView = new NoOverlayVertexView(); @@ -50,8 +71,7 @@ public SimpleModel build() { var mesh = new SimpleMesh(vertexView, meshData, "source=MultiBlockModelBuilder," + "renderType=" + renderType + ",shaded=" + shaded); out.add(new Model.ConfiguredMesh(material, mesh)); } - }; - BakedModelBufferer.bufferMultiBlock(ModelUtil.VANILLA_RENDERER, positions.iterator(), level, poseStack, modelDataLookup, renderFluids, resultConsumer); + }); return new SimpleModel(out.build()); } diff --git a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java new file mode 100644 index 000000000..41e36bbdb --- /dev/null +++ b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/MeshEmitter.java @@ -0,0 +1,133 @@ +package com.jozufozu.flywheel.lib.model.baked; + +import org.jetbrains.annotations.UnknownNullability; + +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.blaze3d.vertex.VertexFormat; + +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.block.model.BakedQuad; + +class MeshEmitter implements VertexConsumer { + private final RenderType renderType; + private final BufferBuilder bufferBuilder; + + private BakedModelBufferer.@UnknownNullability ResultConsumer resultConsumer; + private boolean currentShade; + + MeshEmitter(RenderType renderType) { + this.renderType = renderType; + this.bufferBuilder = new BufferBuilder(renderType.bufferSize()); + } + + public void prepare(BakedModelBufferer.ResultConsumer resultConsumer) { + this.resultConsumer = resultConsumer; + } + + public void end() { + if (bufferBuilder.building()) { + emit(); + } + resultConsumer = null; + } + + public BufferBuilder unwrap(boolean shade) { + prepareForGeometry(shade); + return bufferBuilder; + } + + private void prepareForGeometry(boolean shade) { + if (!bufferBuilder.building()) { + bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); + } else if (shade != currentShade) { + emit(); + } + + currentShade = shade; + } + + private void prepareForGeometry(BakedQuad quad) { + prepareForGeometry(quad.isShade()); + } + + private void emit() { + var renderedBuffer = bufferBuilder.endOrDiscardIfEmpty(); + + if (renderedBuffer != null) { + resultConsumer.accept(renderType, currentShade, renderedBuffer); + renderedBuffer.release(); + } + } + + @Override + public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float red, float green, float blue, int light, int overlay) { + prepareForGeometry(quad); + bufferBuilder.putBulkData(pose, quad, red, green, blue, light, overlay); + } + + @Override + public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float red, float green, float blue, float alpha, int light, int overlay, boolean readExistingColor) { + prepareForGeometry(quad); + bufferBuilder.putBulkData(pose, quad, red, green, blue, alpha, light, overlay, readExistingColor); + } + + @Override + public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float[] brightnesses, float red, float green, float blue, int[] lights, int overlay, boolean readExistingColor) { + prepareForGeometry(quad); + bufferBuilder.putBulkData(pose, quad, brightnesses, red, green, blue, lights, overlay, readExistingColor); + } + + @Override + public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float[] brightnesses, float red, float green, float blue, float alpha, int[] lights, int overlay, boolean readExistingColor) { + prepareForGeometry(quad); + bufferBuilder.putBulkData(pose, quad, brightnesses, red, green, blue, alpha, lights, overlay, readExistingColor); + } + + @Override + public VertexConsumer vertex(double x, double y, double z) { + throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!"); + } + + @Override + public VertexConsumer color(int red, int green, int blue, int alpha) { + throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!"); + } + + @Override + public VertexConsumer uv(float u, float v) { + throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!"); + } + + @Override + public VertexConsumer overlayCoords(int u, int v) { + throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!"); + } + + @Override + public VertexConsumer uv2(int u, int v) { + throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!"); + } + + @Override + public VertexConsumer normal(float x, float y, float z) { + throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!"); + } + + @Override + public void endVertex() { + throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!"); + } + + @Override + public void defaultColor(int red, int green, int blue, int alpha) { + throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!"); + } + + @Override + public void unsetDefaultColor() { + throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!"); + } +} From dd776861074e53a5c87f8f834cf1efa85c4b84a7 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Fri, 26 Apr 2024 21:23:42 -0700 Subject: [PATCH 28/62] Add common publishing --- buildSrc/build.gradle | 6 +- .../com/jozufozu/gradle/JarTaskSet.groovy | 22 +++++ .../gradle/OutgoingConfigurationPlugin.groovy | 99 +++++++++++++++++++ common/build.gradle | 57 +++++++---- fabric/build.gradle | 2 +- forge/build.gradle | 2 +- 6 files changed, 167 insertions(+), 21 deletions(-) create mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskSet.groovy create mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 40d8a06a0..c3c11c5ef 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -19,10 +19,14 @@ repositories { gradlePlugin { plugins { - simplePlugin { + platformPlugin { id = 'flywheel.platform' implementationClass = 'com.jozufozu.gradle.PlatformPlugin' } + outgoingConfigurationPlugin { + id = 'flywheel.outgoing-configuration' + implementationClass = 'com.jozufozu.gradle.OutgoingConfigurationPlugin' + } } } diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskSet.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskSet.groovy new file mode 100644 index 000000000..d14ed925c --- /dev/null +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskSet.groovy @@ -0,0 +1,22 @@ +package com.jozufozu.gradle + +import net.fabricmc.loom.task.RemapJarTask +import net.fabricmc.loom.task.RemapSourcesJarTask +import org.gradle.api.tasks.TaskProvider +import org.gradle.api.tasks.bundling.Jar + +class JarTaskSet { + TaskProvider jar + TaskProvider remapJar + TaskProvider sources + TaskProvider remapSources + TaskProvider javadocJar + + JarTaskSet(TaskProvider jar, TaskProvider remapJar, TaskProvider sources, TaskProvider remapSources, TaskProvider javadocJar) { + this.jar = jar + this.remapJar = remapJar + this.sources = sources + this.remapSources = remapSources + this.javadocJar = javadocJar + } +} diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy new file mode 100644 index 000000000..d23336943 --- /dev/null +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy @@ -0,0 +1,99 @@ +package com.jozufozu.gradle + +import net.fabricmc.loom.task.RemapJarTask +import net.fabricmc.loom.task.RemapSourcesJarTask +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.artifacts.ConfigurationContainer +import org.gradle.api.artifacts.dsl.ArtifactHandler +import org.gradle.api.tasks.SourceSet +import org.gradle.api.tasks.SourceSetContainer +import org.gradle.api.tasks.TaskContainer +import org.gradle.api.tasks.bundling.Jar +import org.gradle.api.tasks.javadoc.Javadoc + +class OutgoingConfigurationPlugin implements Plugin { + @Override + void apply(Project project) { + project.extensions.create("outgoing", Extension, project) + } + + static class Extension { + private final Project project + private final SourceSetContainer sourceSets + private final ConfigurationContainer configurations + private final TaskContainer tasks + private final ArtifactHandler artifacts + + Extension(Project project) { + this.project = project + this.sourceSets = project.getExtensions().getByType(SourceSetContainer) + this.configurations = project.configurations + this.tasks = project.tasks + this.artifacts = project.artifacts + } + + JarTaskSet createJarAndOutgoingConfiguration(String name) { + return createJarAndOutgoingConfiguration(name, sourceSets.named(name).get()) + } + + JarTaskSet createJarAndOutgoingConfiguration(String name, SourceSet... sourceSetSet) { + def config = configurations.register("common${name.capitalize()}") { + canBeConsumed = true + canBeResolved = false + } + def jarTask = tasks.register("${name}Jar", Jar) { + group = 'Build' + archiveClassifier.set(name) + destinationDirectory.set(project.layout.buildDirectory.dir('devlibs')) + for (SourceSet set in sourceSetSet) { + from set.output + } + } + def remapJarTask = tasks.register("${name}RemapJar", RemapJarTask) { + group = 'Loom' + dependsOn(jarTask) + archiveClassifier.set(name) + inputFile.set(jarTask.flatMap { it.archiveFile }) + } + def sourcesTask = tasks.register("${name}SourcesJar", Jar) { + group = 'Build' + archiveClassifier.set("${name}-sources") + destinationDirectory.set(project.layout.buildDirectory.dir('devlibs')) + for (SourceSet set in sourceSetSet) { + from set.allSource + } + } + def remapSourcesTask = tasks.register("${name}RemapSourcesJar", RemapSourcesJarTask) { + group = 'Loom' + dependsOn(sourcesTask) + archiveClassifier.set("${name}-sources") + inputFile.set(sourcesTask.flatMap { it.archiveFile }) + } + def javadocTask = tasks.register("${name}Javadoc", Javadoc) { + group = 'Build' + destinationDir = project.layout.buildDirectory.dir("docs/${name}-javadoc").get().asFile + options.encoding = 'UTF-8' + for (SourceSet set in sourceSetSet) { + source set.allJava + classpath += set.compileClasspath + } + } + def javadocJarTask = tasks.register("${name}JavadocJar", Jar) { + group = 'Build' + dependsOn(javadocTask) + archiveClassifier.set("${name}-javadoc") + destinationDirectory.set(project.layout.buildDirectory.dir('libs')) + from(javadocTask.map { it.outputs }) + } + + artifacts.add(config.name, jarTask) + + tasks.named('assemble').configure { + dependsOn(jarTask, remapJarTask, sourcesTask, remapSourcesTask, javadocTask, javadocJarTask) + } + + return new JarTaskSet(jarTask, remapJarTask, sourcesTask, remapSourcesTask, javadocJarTask) + } + } +} diff --git a/common/build.gradle b/common/build.gradle index 20a518168..c06a405a0 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -6,6 +6,7 @@ plugins { id 'flywheel.java' id 'flywheel.package-infos' id 'flywheel.subproject' + id 'flywheel.outgoing-configuration' } sourceSets { @@ -39,30 +40,31 @@ sourceSets { } } -TaskProvider createJarAndOutgoingConfiguration(String name) { - return createJarAndOutgoingConfiguration(name, sourceSets.named(name).get()) +jar { + from sourceSets.api.output + from sourceSets.lib.output + from sourceSets.backend.output + archiveClassifier.set('') } -TaskProvider createJarAndOutgoingConfiguration(String name, SourceSet sourceSet) { - def config = configurations.register("common${name.capitalize()}") { - canBeConsumed = true - canBeResolved = false - } - def jarTask = tasks.register("${name}Jar", Jar) { - archiveClassifier.set(name) - from sourceSet.output - } - - artifacts.add(config.name, jarTask) +sourcesJar { + from sourceSets.api.allSource + from sourceSets.lib.allSource + from sourceSets.backend.allSource +} - return jarTask +javadoc { + source sourceSets.api.allJava + source sourceSets.lib.allJava + source sourceSets.backend.allJava } // TODO: repackage these for maven publication -def apiJar = createJarAndOutgoingConfiguration("api") -def libJar = createJarAndOutgoingConfiguration("lib") -def backendJar = createJarAndOutgoingConfiguration("backend") -def implJar = createJarAndOutgoingConfiguration("impl", sourceSets.main) +outgoing.createJarAndOutgoingConfiguration("apiOnly", sourceSets.api) +outgoing.createJarAndOutgoingConfiguration("lib") +def apiLibJar = outgoing.createJarAndOutgoingConfiguration("api", sourceSets.api, sourceSets.lib) +def backendJar = outgoing.createJarAndOutgoingConfiguration("backend") +def implJar = outgoing.createJarAndOutgoingConfiguration("impl", sourceSets.main) dependencies { modCompileOnly "net.fabricmc:fabric-loader:${fabric_loader_version}" @@ -78,11 +80,30 @@ publishing { publications { register('mavenIntermediary', MavenPublication) { from(components['java']) + artifact apiLibJar.remapJar + artifact apiLibJar.remapSources + artifact apiLibJar.javadocJar + artifact backendJar.remapJar + artifact backendJar.remapSources + artifact backendJar.javadocJar + artifact implJar.remapJar + artifact implJar.remapSources + artifact implJar.javadocJar artifactId = "flywheel-${project.name}-intermediary-${artifact_minecraft_version}" } register('mavenMojmap', MavenPublication) { artifact jar artifact sourcesJar + artifact javadocJar + artifact apiLibJar.jar + artifact apiLibJar.sources + artifact apiLibJar.javadocJar + artifact backendJar.jar + artifact backendJar.sources + artifact backendJar.javadocJar + artifact implJar.jar + artifact implJar.sources + artifact implJar.javadocJar artifactId = "flywheel-${project.name}-mojmap-${artifact_minecraft_version}" } } diff --git a/fabric/build.gradle b/fabric/build.gradle index bcb20f5e5..4ae964468 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -43,7 +43,7 @@ dependencies { modCompileOnly "maven.modrinth:sodium:${sodium_version}" modCompileOnly "maven.modrinth:iris:${iris_version}" - forApi project(path: ':common', configuration: 'commonApi') + forApi project(path: ':common', configuration: 'commonApiOnly') forLib project(path: ':common', configuration: 'commonLib') forBackend project(path: ':common', configuration: 'commonBackend') forImpl project(path: ':common', configuration: 'commonImpl') diff --git a/forge/build.gradle b/forge/build.gradle index 2b7c0ce57..b6ef3166c 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -53,7 +53,7 @@ dependencies { modCompileOnly "maven.modrinth:embeddium:${embeddium_version}" modCompileOnly "maven.modrinth:oculus:${oculus_version}" - forApi project(path: ':common', configuration: 'commonApi') + forApi project(path: ':common', configuration: 'commonApiOnly') forLib project(path: ':common', configuration: 'commonLib') forBackend project(path: ':common', configuration: 'commonBackend') forImpl project(path: ':common', configuration: 'commonImpl') From 4145d804418e5dab94d0edf37164f955f2c76b00 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Fri, 26 Apr 2024 21:31:53 -0700 Subject: [PATCH 29/62] Use central javadoc-options file --- .../com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy | 1 + buildSrc/src/main/groovy/flywheel.java.gradle | 2 +- javadoc-options.txt | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 javadoc-options.txt diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy index d23336943..42b354e2f 100644 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy @@ -74,6 +74,7 @@ class OutgoingConfigurationPlugin implements Plugin { group = 'Build' destinationDir = project.layout.buildDirectory.dir("docs/${name}-javadoc").get().asFile options.encoding = 'UTF-8' + options.optionFiles(project.rootProject.file('javadoc-options.txt')) for (SourceSet set in sourceSetSet) { source set.allJava classpath += set.compileClasspath diff --git a/buildSrc/src/main/groovy/flywheel.java.gradle b/buildSrc/src/main/groovy/flywheel.java.gradle index 9124d5377..876f16869 100644 --- a/buildSrc/src/main/groovy/flywheel.java.gradle +++ b/buildSrc/src/main/groovy/flywheel.java.gradle @@ -43,7 +43,7 @@ tasks.withType(Jar).configureEach { Jar jar -> tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> javadoc.source sourceSets.main.allJava // prevent java 8's strict doclint for javadocs from failing builds - javadoc.options.addStringOption('Xdoclint:none', '-quiet') + javadoc.options.optionFiles(rootProject.file('javadoc-options.txt')) javadoc.options.encoding = 'UTF-8' } diff --git a/javadoc-options.txt b/javadoc-options.txt new file mode 100644 index 000000000..54fbbe259 --- /dev/null +++ b/javadoc-options.txt @@ -0,0 +1,2 @@ +-Xdoclint:none +-quiet From ce5a04749cb2761ec60c9f0e0a67681487dc28d6 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Fri, 26 Apr 2024 22:14:14 -0700 Subject: [PATCH 30/62] Get Publishing! --- .../com/jozufozu/gradle/JarTaskUtils.groovy | 90 +++++++++++++++++++ .../gradle/OutgoingConfigurationPlugin.groovy | 76 +--------------- .../com/jozufozu/gradle/PlatformPlugin.groovy | 76 +++++++--------- 3 files changed, 124 insertions(+), 118 deletions(-) create mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy new file mode 100644 index 000000000..9535497c5 --- /dev/null +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy @@ -0,0 +1,90 @@ +package com.jozufozu.gradle + +import net.fabricmc.loom.task.RemapJarTask +import net.fabricmc.loom.task.RemapSourcesJarTask +import org.gradle.api.Project +import org.gradle.api.file.DuplicatesStrategy +import org.gradle.api.file.FileCopyDetails +import org.gradle.api.tasks.AbstractCopyTask +import org.gradle.api.tasks.SourceSet +import org.gradle.api.tasks.SourceTask +import org.gradle.api.tasks.bundling.Jar +import org.gradle.api.tasks.javadoc.Javadoc + +class JarTaskUtils { + // We have duplicate packages between the common and platform dependent subprojects. + // In theory the package-info.java files should be identical, so just take the first one we find. + static void excludeDuplicatePackageInfos(AbstractCopyTask copyTask) { + copyTask.filesMatching('**/package-info.java') { FileCopyDetails details -> + details.duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } + } + + // The compile/javadoc tasks have a different base type that isn't so smart about exclusion handling. + static void excludeDuplicatePackageInfos(SourceTask sourceTask) { + sourceTask.exclude('**/package-info.java') + } + + static JarTaskSet createJarAndOutgoingConfiguration(Project project, String name, SourceSet... sourceSetSet) { + def config = project.configurations.register("common${name.capitalize()}") { + canBeConsumed = true + canBeResolved = false + } + def jarTask = project.tasks.register("${name}Jar", Jar) { + group = 'Build' + archiveClassifier.set(name) + destinationDirectory.set(project.layout.buildDirectory.dir('devlibs')) + for (SourceSet set in sourceSetSet) { + from set.output + } + excludeDuplicatePackageInfos(it) + } + def remapJarTask = project.tasks.register("${name}RemapJar", RemapJarTask) { + group = 'Loom' + dependsOn(jarTask) + archiveClassifier.set(name) + inputFile.set(jarTask.flatMap { it.archiveFile }) + } + def sourcesTask = project.tasks.register("${name}SourcesJar", Jar) { + group = 'Build' + archiveClassifier.set("${name}-sources") + destinationDirectory.set(project.layout.buildDirectory.dir('devlibs')) + for (SourceSet set in sourceSetSet) { + from set.allSource + } + excludeDuplicatePackageInfos(it) + } + def remapSourcesTask = project.tasks.register("${name}RemapSourcesJar", RemapSourcesJarTask) { + group = 'Loom' + dependsOn(sourcesTask) + archiveClassifier.set("${name}-sources") + inputFile.set(sourcesTask.flatMap { it.archiveFile }) + } + def javadocTask = project.tasks.register("${name}Javadoc", Javadoc) { + group = 'Build' + destinationDir = project.layout.buildDirectory.dir("docs/${name}-javadoc").get().asFile + options.encoding = 'UTF-8' + options.optionFiles(project.rootProject.file('javadoc-options.txt')) + for (SourceSet set in sourceSetSet) { + source set.allJava + classpath += set.compileClasspath + } + excludeDuplicatePackageInfos(it) + } + def javadocJarTask = project.tasks.register("${name}JavadocJar", Jar) { + group = 'Build' + dependsOn(javadocTask) + archiveClassifier.set("${name}-javadoc") + destinationDirectory.set(project.layout.buildDirectory.dir('libs')) + from(javadocTask.map { it.outputs }) + } + + project.artifacts.add(config.name, jarTask) + + project.tasks.named('assemble').configure { + dependsOn(jarTask, remapJarTask, sourcesTask, remapSourcesTask, javadocTask, javadocJarTask) + } + + return new JarTaskSet(jarTask, remapJarTask, sourcesTask, remapSourcesTask, javadocJarTask) + } +} diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy index 42b354e2f..468b59f97 100644 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy @@ -1,16 +1,10 @@ package com.jozufozu.gradle -import net.fabricmc.loom.task.RemapJarTask -import net.fabricmc.loom.task.RemapSourcesJarTask + import org.gradle.api.Plugin import org.gradle.api.Project -import org.gradle.api.artifacts.ConfigurationContainer -import org.gradle.api.artifacts.dsl.ArtifactHandler import org.gradle.api.tasks.SourceSet import org.gradle.api.tasks.SourceSetContainer -import org.gradle.api.tasks.TaskContainer -import org.gradle.api.tasks.bundling.Jar -import org.gradle.api.tasks.javadoc.Javadoc class OutgoingConfigurationPlugin implements Plugin { @Override @@ -20,81 +14,17 @@ class OutgoingConfigurationPlugin implements Plugin { static class Extension { private final Project project - private final SourceSetContainer sourceSets - private final ConfigurationContainer configurations - private final TaskContainer tasks - private final ArtifactHandler artifacts Extension(Project project) { this.project = project - this.sourceSets = project.getExtensions().getByType(SourceSetContainer) - this.configurations = project.configurations - this.tasks = project.tasks - this.artifacts = project.artifacts } JarTaskSet createJarAndOutgoingConfiguration(String name) { - return createJarAndOutgoingConfiguration(name, sourceSets.named(name).get()) + return createJarAndOutgoingConfiguration(name, project.getExtensions().getByType(SourceSetContainer).named(name).get()) } JarTaskSet createJarAndOutgoingConfiguration(String name, SourceSet... sourceSetSet) { - def config = configurations.register("common${name.capitalize()}") { - canBeConsumed = true - canBeResolved = false - } - def jarTask = tasks.register("${name}Jar", Jar) { - group = 'Build' - archiveClassifier.set(name) - destinationDirectory.set(project.layout.buildDirectory.dir('devlibs')) - for (SourceSet set in sourceSetSet) { - from set.output - } - } - def remapJarTask = tasks.register("${name}RemapJar", RemapJarTask) { - group = 'Loom' - dependsOn(jarTask) - archiveClassifier.set(name) - inputFile.set(jarTask.flatMap { it.archiveFile }) - } - def sourcesTask = tasks.register("${name}SourcesJar", Jar) { - group = 'Build' - archiveClassifier.set("${name}-sources") - destinationDirectory.set(project.layout.buildDirectory.dir('devlibs')) - for (SourceSet set in sourceSetSet) { - from set.allSource - } - } - def remapSourcesTask = tasks.register("${name}RemapSourcesJar", RemapSourcesJarTask) { - group = 'Loom' - dependsOn(sourcesTask) - archiveClassifier.set("${name}-sources") - inputFile.set(sourcesTask.flatMap { it.archiveFile }) - } - def javadocTask = tasks.register("${name}Javadoc", Javadoc) { - group = 'Build' - destinationDir = project.layout.buildDirectory.dir("docs/${name}-javadoc").get().asFile - options.encoding = 'UTF-8' - options.optionFiles(project.rootProject.file('javadoc-options.txt')) - for (SourceSet set in sourceSetSet) { - source set.allJava - classpath += set.compileClasspath - } - } - def javadocJarTask = tasks.register("${name}JavadocJar", Jar) { - group = 'Build' - dependsOn(javadocTask) - archiveClassifier.set("${name}-javadoc") - destinationDirectory.set(project.layout.buildDirectory.dir('libs')) - from(javadocTask.map { it.outputs }) - } - - artifacts.add(config.name, jarTask) - - tasks.named('assemble').configure { - dependsOn(jarTask, remapJarTask, sourcesTask, remapSourcesTask, javadocTask, javadocJarTask) - } - - return new JarTaskSet(jarTask, remapJarTask, sourcesTask, remapSourcesTask, javadocJarTask) + return JarTaskUtils.createJarAndOutgoingConfiguration(project, name, sourceSetSet) } } } diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy index b8ed05ead..476ded6f8 100644 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy @@ -2,19 +2,14 @@ package com.jozufozu.gradle import groovy.transform.CompileStatic import net.fabricmc.loom.api.LoomGradleExtensionAPI -import net.fabricmc.loom.task.RemapJarTask import org.gradle.api.Plugin import org.gradle.api.Project -import org.gradle.api.Task import org.gradle.api.artifacts.Configuration -import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.file.FileCollection -import org.gradle.api.file.FileCopyDetails import org.gradle.api.publish.PublishingExtension -import org.gradle.api.tasks.AbstractCopyTask +import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.tasks.SourceSet import org.gradle.api.tasks.SourceSetContainer -import org.gradle.api.tasks.SourceTask import org.gradle.api.tasks.bundling.Jar import org.gradle.api.tasks.compile.JavaCompile import org.gradle.api.tasks.javadoc.Javadoc @@ -87,23 +82,14 @@ class PlatformPlugin implements Plugin { def tasks = project.tasks tasks.withType(JavaCompile).configureEach { JavaCompile compileJava -> - excludeDuplicatePackageInfos(compileJava) - } - - def apiJar = tasks.register('apiJar', Jar) { Jar jar -> - jar.archiveClassifier.set('api-dev') - jar.from platformApi.output, platformLib.output - - jar.destinationDirectory.set(project.layout.buildDirectory.dir('devlibs')) - - excludeDuplicatePackageInfos(jar) + JarTaskUtils.excludeDuplicatePackageInfos(compileJava) } tasks.named('jar', Jar).configure { Jar jar -> jar.archiveClassifier.set('dev') jar.from platformApi.output, platformLib.output, platformBackend.output - excludeDuplicatePackageInfos(jar) + JarTaskUtils.excludeDuplicatePackageInfos(jar) } tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> @@ -111,7 +97,7 @@ class PlatformPlugin implements Plugin { javadoc.source platformApi.allJava, platformLib.allJava, platformBackend.allJava - excludeDuplicatePackageInfos(javadoc) + JarTaskUtils.excludeDuplicatePackageInfos(javadoc) } tasks.named('sourcesJar', Jar).configure { Jar jar -> @@ -119,35 +105,35 @@ class PlatformPlugin implements Plugin { jar.from platformApi.allJava, platformLib.allJava, platformBackend.allJava - excludeDuplicatePackageInfos(jar) + JarTaskUtils.excludeDuplicatePackageInfos(jar) } - def remapApiJar = tasks.register('remapApiJar', RemapJarTask) { RemapJarTask remapJar -> - remapJar.dependsOn(apiJar) - remapJar.inputFile.set(apiJar.flatMap { it.archiveFile }) - remapJar.archiveClassifier.set('api') - } - - def remapJar = tasks.named('remapJar', RemapJarTask) - - tasks.named('build').configure { Task build -> - build.dependsOn(remapApiJar) + // for if we decide to have Vanillin be another subproject, we can just use the exported configurations + JarTaskUtils.createJarAndOutgoingConfiguration(project, 'apiOnly', platformApi) + JarTaskUtils.createJarAndOutgoingConfiguration(project, 'lib', platformLib) + + JarTaskSet apiSet = JarTaskUtils.createJarAndOutgoingConfiguration(project, 'api', platformApi, platformLib) + JarTaskSet backendSet = JarTaskUtils.createJarAndOutgoingConfiguration(project, 'backend', platformBackend) + JarTaskSet implSet = JarTaskUtils.createJarAndOutgoingConfiguration(project, 'impl', platformImpl) + + publishing.publications { + // we should be using remapped on both Fabric and Forge because Forge needs to put things in srg + it.register('mavenIntermediary', MavenPublication) { MavenPublication pub -> + pub.from(project.components.named('java').get()) + pub.artifact(apiSet.remapJar) + pub.artifact(apiSet.remapSources) + pub.artifact(apiSet.javadocJar) + pub.artifact(backendSet.remapJar) + pub.artifact(backendSet.remapSources) + pub.artifact(backendSet.javadocJar) + pub.artifact(implSet.remapJar) + pub.artifact(implSet.remapSources) + pub.artifact(implSet.javadocJar) + pub.artifactId = "flywheel-${project.name}-${project.property('artifact_minecraft_version')}" + } } } - // We have duplicate packages between the common and platform dependent subprojects. - // In theory the package-info.java files should be identical, so just take the first one we find. - static void excludeDuplicatePackageInfos(AbstractCopyTask copyTask) { - copyTask.filesMatching('**/package-info.java') { FileCopyDetails details -> - details.duplicatesStrategy = DuplicatesStrategy.EXCLUDE - } - } - - // The compile/javadoc tasks have a different base type that isn't so smart about exclusion handling. - static void excludeDuplicatePackageInfos(SourceTask sourceTask) { - sourceTask.exclude('**/package-info.java') - } - static Configuration newConfiguration(Project project, String name) { return project.configurations.create(name) { Configuration it -> it.canBeConsumed = true @@ -156,9 +142,9 @@ class PlatformPlugin implements Plugin { } static void extendsFrom(Project project, String name, Configuration... configurations) { - project.configurations.named(name).configure { - it.extendsFrom(configurations) - } + project.configurations.named(name).configure { + it.extendsFrom(configurations) + } } static void includeFromCommon(Project project, SourceSet sourceSet, SourceSet commonSourceSet) { From edce7524997be90ea39ab4a8e72cfa953f2cf52d Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Fri, 26 Apr 2024 22:24:34 -0700 Subject: [PATCH 31/62] Fix refmaps, again --- common/build.gradle | 1 - .../{main => backend}/resources/flywheel.backend.mixins.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) rename common/src/{main => backend}/resources/flywheel.backend.mixins.json (90%) diff --git a/common/build.gradle b/common/build.gradle index c06a405a0..49290b0f8 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -59,7 +59,6 @@ javadoc { source sourceSets.backend.allJava } -// TODO: repackage these for maven publication outgoing.createJarAndOutgoingConfiguration("apiOnly", sourceSets.api) outgoing.createJarAndOutgoingConfiguration("lib") def apiLibJar = outgoing.createJarAndOutgoingConfiguration("api", sourceSets.api, sourceSets.lib) diff --git a/common/src/main/resources/flywheel.backend.mixins.json b/common/src/backend/resources/flywheel.backend.mixins.json similarity index 90% rename from common/src/main/resources/flywheel.backend.mixins.json rename to common/src/backend/resources/flywheel.backend.mixins.json index 233033999..164b33dca 100644 --- a/common/src/main/resources/flywheel.backend.mixins.json +++ b/common/src/backend/resources/flywheel.backend.mixins.json @@ -3,7 +3,7 @@ "minVersion": "0.8", "package": "com.jozufozu.flywheel.backend.mixin", "compatibilityLevel": "JAVA_17", - "refmap": "flywheel.refmap.json", + "refmap": "backend-flywheel.refmap.json", "client": [ "AbstractClientPlayerAccessor", "GameRendererAccessor", From 1e6dfa06d05ed71299adaaa593254eaded25f9d9 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Fri, 26 Apr 2024 22:25:45 -0700 Subject: [PATCH 32/62] Fix RenderStageCallback --- .../com/jozufozu/flywheel/api/event/RenderStageCallback.java | 1 + 1 file changed, 1 insertion(+) diff --git a/fabric/src/api/java/com/jozufozu/flywheel/api/event/RenderStageCallback.java b/fabric/src/api/java/com/jozufozu/flywheel/api/event/RenderStageCallback.java index 27170fda5..64e8061ad 100644 --- a/fabric/src/api/java/com/jozufozu/flywheel/api/event/RenderStageCallback.java +++ b/fabric/src/api/java/com/jozufozu/flywheel/api/event/RenderStageCallback.java @@ -3,6 +3,7 @@ import net.fabricmc.fabric.api.event.Event; import net.fabricmc.fabric.api.event.EventFactory; +@FunctionalInterface public interface RenderStageCallback { Event EVENT = EventFactory.createArrayBacked(RenderStageCallback.class, callbacks -> (context, stage) -> { From 7cb3fb8971259a87e6ab23053c8105942c5bb07a Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Fri, 26 Apr 2024 22:29:49 -0700 Subject: [PATCH 33/62] Workflowing --- .github/workflows/build.yml | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..4479a3764 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,43 @@ +name: build + +on: [ pull_request, push ] + +jobs: + build: + strategy: + matrix: + java: [ + 17, # Current Java LTS & minimum supported by Minecraft + 21 + ] + os: [ ubuntu-20.04, windows-2024 ] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Gradle Cache + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + .gradle/loom-cache + build/ + key: ${{ runner.os }}-jdk${{ matrix.java }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties', '**/gradle-wrapper.properties', '.github/workflows/build.yml') }} + - name: Setup JDK ${{ matrix.java }} + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + - name: Make Gradle Wrapper Executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + - name: Build + run: ./gradlew build javadoc --no-daemon + - name: Capture Build Artifacts + if: ${{ runner.os == 'Linux' && matrix.java == '17' }} + uses: actions/upload-artifact@v2 + with: + name: Artifacts + path: build/libs/ From 98999fb5513dce16ef872ff79e14d918d8ea3332 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Fri, 26 Apr 2024 23:27:33 -0700 Subject: [PATCH 34/62] Workflower - Changed GitHub CI to run `publish` task so we can make sure that publishing actually works. --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4479a3764..807c6a990 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,7 +34,8 @@ jobs: if: ${{ runner.os != 'Windows' }} run: chmod +x ./gradlew - name: Build - run: ./gradlew build javadoc --no-daemon + # doesn't actually publish, as no secrets are passed in, just makes sure that publishing works + run: ./gradlew publish --no-daemon - name: Capture Build Artifacts if: ${{ runner.os == 'Linux' && matrix.java == '17' }} uses: actions/upload-artifact@v2 From 95ab918d0c3e4ddad44a87ea8b9863e0d5d735c9 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Fri, 26 Apr 2024 23:40:51 -0700 Subject: [PATCH 35/62] Workflowest Use windows-2022 for runner because the windows-2024 runners aren't running. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 807c6a990..d3d539ff9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ jobs: 17, # Current Java LTS & minimum supported by Minecraft 21 ] - os: [ ubuntu-20.04, windows-2024 ] + os: [ ubuntu-20.04, windows-2022 ] runs-on: ${{ matrix.os }} steps: - name: Checkout From 9a423f7b6f947d6ed5bed3766cd0531ace3b4a5a Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Fri, 26 Apr 2024 23:54:38 -0700 Subject: [PATCH 36/62] Workflowester I forgot windows doesn't provide java toolchains for lower versions. For now CI will only run on Java 17. --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3d539ff9..368aa146a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,8 +7,7 @@ jobs: strategy: matrix: java: [ - 17, # Current Java LTS & minimum supported by Minecraft - 21 + 17 # Current Java LTS & minimum supported by Minecraft ] os: [ ubuntu-20.04, windows-2022 ] runs-on: ${{ matrix.os }} From d4ed53573d87bf6891c4188e1fe2e3a992fd8a83 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Sat, 27 Apr 2024 00:07:04 -0700 Subject: [PATCH 37/62] Workflowestest Since we're not running tests, there's no real use in running on windows. Switching to running CI exclusively on ubuntu-latest for the time-being. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 368aa146a..68993ed5f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: java: [ 17 # Current Java LTS & minimum supported by Minecraft ] - os: [ ubuntu-20.04, windows-2022 ] + os: [ ubuntu-latest ] runs-on: ${{ matrix.os }} steps: - name: Checkout From b5cbd28f74c25f060e7ca46ccc1ce2c0e98733c3 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sat, 27 Apr 2024 19:25:02 -0700 Subject: [PATCH 38/62] Publicity stunt - Only publish api/lib and full jars for platforms - Do not eagerly create outgoing configurations for JarTaskSet - Add method to create outgoing configuration - Clean up JarTaskSet creation and move some string constants to statics - Set @CompileStatic - Remove ${name} classifier prefix from JarTaskSet jars - Put JarTaskSet jars into subdirectories in the output folders - Add configure and configureEach methods to JarTaskSet - Rename OutgoingConfigurationPlugin -> JarSetPlugin and move extension to root module so idea offers completions in gradle files - Standardize artifact naming flywheel-$platform(-api)?-$mcversion --- buildSrc/build.gradle | 12 +- .../com/jozufozu/gradle/JarSetPlugin.groovy | 33 ++++++ .../com/jozufozu/gradle/JarTaskSet.groovy | 106 +++++++++++++++++- .../com/jozufozu/gradle/JarTaskUtils.groovy | 75 ++----------- .../gradle/OutgoingConfigurationPlugin.groovy | 30 ----- .../com/jozufozu/gradle/PlatformPlugin.groovy | 46 ++++---- common/build.gradle | 60 ++++------ 7 files changed, 197 insertions(+), 165 deletions(-) create mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetPlugin.groovy delete mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index c3c11c5ef..b80ca0bb3 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -19,13 +19,13 @@ repositories { gradlePlugin { plugins { - platformPlugin { - id = 'flywheel.platform' - implementationClass = 'com.jozufozu.gradle.PlatformPlugin' + platformPlugin { PluginDeclaration plugin -> + plugin.id = 'flywheel.platform' + plugin.implementationClass = 'com.jozufozu.gradle.PlatformPlugin' } - outgoingConfigurationPlugin { - id = 'flywheel.outgoing-configuration' - implementationClass = 'com.jozufozu.gradle.OutgoingConfigurationPlugin' + jarSetPlugin { PluginDeclaration plugin -> + plugin.id = 'flywheel.jar-sets' + plugin.implementationClass = 'com.jozufozu.gradle.JarSetPlugin' } } } diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetPlugin.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetPlugin.groovy new file mode 100644 index 000000000..4fc44a19a --- /dev/null +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetPlugin.groovy @@ -0,0 +1,33 @@ +package com.jozufozu.gradle + + +import groovy.transform.CompileStatic +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.tasks.SourceSet +import org.gradle.api.tasks.SourceSetContainer + +@CompileStatic +class JarSetPlugin implements Plugin { + @Override + void apply(Project project) { + project.extensions.create("jarSets", JarSetExtension, project) + } +} + +@CompileStatic +class JarSetExtension { + private final Project project + + JarSetExtension(Project project) { + this.project = project + } + + JarTaskSet createJars(String name) { + return createJars(name, project.getExtensions().getByType(SourceSetContainer).named(name).get()) + } + + JarTaskSet createJars(String name, SourceSet... sourceSetSet) { + return JarTaskSet.create(project, name, sourceSetSet) + } +} diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskSet.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskSet.groovy index d14ed925c..f75c93b0b 100644 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskSet.groovy +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskSet.groovy @@ -1,22 +1,126 @@ package com.jozufozu.gradle +import groovy.transform.CompileStatic import net.fabricmc.loom.task.RemapJarTask import net.fabricmc.loom.task.RemapSourcesJarTask +import org.gradle.api.Action +import org.gradle.api.Project +import org.gradle.api.tasks.SourceSet import org.gradle.api.tasks.TaskProvider import org.gradle.api.tasks.bundling.Jar +import org.gradle.api.tasks.javadoc.Javadoc +@CompileStatic class JarTaskSet { + public static final String BUILD_GROUP = 'build' + public static final String LOOM_GROUP = 'loom' + public static final String JAVADOC_CLASSIFIER = "javadoc" + public static final String SOURCES_CLASSIFIER = "sources" + + Project project + String name TaskProvider jar TaskProvider remapJar TaskProvider sources TaskProvider remapSources TaskProvider javadocJar - JarTaskSet(TaskProvider jar, TaskProvider remapJar, TaskProvider sources, TaskProvider remapSources, TaskProvider javadocJar) { + JarTaskSet(Project project, String name, TaskProvider jar, TaskProvider remapJar, TaskProvider sources, TaskProvider remapSources, TaskProvider javadocJar) { + this.project = project + this.name = name this.jar = jar this.remapJar = remapJar this.sources = sources this.remapSources = remapSources this.javadocJar = javadocJar } + + void createOutgoingConfiguration(String prefix) { + def config = project.configurations.register("${prefix}${name.capitalize()}") { + it.canBeConsumed = true + it.canBeResolved = false + } + + project.artifacts.add(config.name, jar) + } + + void configure(Action action) { + action.execute(this) + } + + void configureEach(Action action) { + jar.configure(action) + sources.configure(action) + javadocJar.configure(action) + + remapJar.configure(action as Action) + remapSources.configure(action as Action) + } + + static JarTaskSet create(Project project, String name, SourceSet... sourceSetSet) { + def buildDirectory = project.layout.buildDirectory + def devlibs = buildDirectory.dir("devlibs/${name}") + def libs = buildDirectory.dir("libs/${name}") + + def jarTask = project.tasks.register("${name}Jar", Jar) { + it.group = BUILD_GROUP + it.destinationDirectory.set(devlibs) + + for (SourceSet set in sourceSetSet) { + it.from set.output + } + JarTaskUtils.excludeDuplicatePackageInfos(it) + } + def remapJarTask = project.tasks.register("${name}RemapJar", RemapJarTask) { + it.dependsOn(jarTask) + it.group = LOOM_GROUP + it.destinationDirectory.set(libs) + + it.inputFile.set(jarTask.flatMap { it.archiveFile }) + } + def sourcesTask = project.tasks.register("${name}SourcesJar", Jar) { + it.group = BUILD_GROUP + it.destinationDirectory.set(devlibs) + it.archiveClassifier.set(SOURCES_CLASSIFIER) + + for (SourceSet set in sourceSetSet) { + it.from set.allSource + } + JarTaskUtils.excludeDuplicatePackageInfos(it) + } + def remapSourcesTask = project.tasks.register("${name}RemapSourcesJar", RemapSourcesJarTask) { + it.dependsOn(sourcesTask) + it.group = LOOM_GROUP + it.destinationDirectory.set(libs) + it.archiveClassifier.set(SOURCES_CLASSIFIER) + + it.inputFile.set(sourcesTask.flatMap { it.archiveFile }) + } + def javadocTask = project.tasks.register("${name}Javadoc", Javadoc) { + it.group = BUILD_GROUP + it.destinationDir = buildDirectory.dir("docs/${name}-javadoc").get().asFile + it.options.encoding = 'UTF-8' + it.options.optionFiles(project.rootProject.file('javadoc-options.txt')) + + for (SourceSet set in sourceSetSet) { + it.source set.allJava + it.classpath += set.compileClasspath + } + JarTaskUtils.excludeDuplicatePackageInfos(it) + } + def javadocJarTask = project.tasks.register("${name}JavadocJar", Jar) { + it.dependsOn(javadocTask) + it.group = BUILD_GROUP + it.destinationDirectory.set(libs) + it.archiveClassifier.set(JAVADOC_CLASSIFIER) + + it.from(javadocTask.map { it.outputs }) + } + + project.tasks.named('assemble').configure { + it.dependsOn(remapJarTask, remapSourcesTask, javadocJarTask) + } + + return new JarTaskSet(project, name, jarTask, remapJarTask, sourcesTask, remapSourcesTask, javadocJarTask) + } } diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy index 9535497c5..c178124fe 100644 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy @@ -1,8 +1,10 @@ package com.jozufozu.gradle +import groovy.transform.CompileStatic import net.fabricmc.loom.task.RemapJarTask import net.fabricmc.loom.task.RemapSourcesJarTask import org.gradle.api.Project +import org.gradle.api.file.DirectoryProperty import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.file.FileCopyDetails import org.gradle.api.tasks.AbstractCopyTask @@ -11,80 +13,23 @@ import org.gradle.api.tasks.SourceTask import org.gradle.api.tasks.bundling.Jar import org.gradle.api.tasks.javadoc.Javadoc +@CompileStatic class JarTaskUtils { - // We have duplicate packages between the common and platform dependent subprojects. - // In theory the package-info.java files should be identical, so just take the first one we find. + /** + * We have duplicate packages between the common and platform dependent subprojects. + * In theory the package-info.java files should be identical, so just take the first one we find. + */ static void excludeDuplicatePackageInfos(AbstractCopyTask copyTask) { copyTask.filesMatching('**/package-info.java') { FileCopyDetails details -> details.duplicatesStrategy = DuplicatesStrategy.EXCLUDE } } - // The compile/javadoc tasks have a different base type that isn't so smart about exclusion handling. + /** + * The compile/javadoc tasks have a different base type that isn't so smart about exclusion handling. + */ static void excludeDuplicatePackageInfos(SourceTask sourceTask) { sourceTask.exclude('**/package-info.java') } - static JarTaskSet createJarAndOutgoingConfiguration(Project project, String name, SourceSet... sourceSetSet) { - def config = project.configurations.register("common${name.capitalize()}") { - canBeConsumed = true - canBeResolved = false - } - def jarTask = project.tasks.register("${name}Jar", Jar) { - group = 'Build' - archiveClassifier.set(name) - destinationDirectory.set(project.layout.buildDirectory.dir('devlibs')) - for (SourceSet set in sourceSetSet) { - from set.output - } - excludeDuplicatePackageInfos(it) - } - def remapJarTask = project.tasks.register("${name}RemapJar", RemapJarTask) { - group = 'Loom' - dependsOn(jarTask) - archiveClassifier.set(name) - inputFile.set(jarTask.flatMap { it.archiveFile }) - } - def sourcesTask = project.tasks.register("${name}SourcesJar", Jar) { - group = 'Build' - archiveClassifier.set("${name}-sources") - destinationDirectory.set(project.layout.buildDirectory.dir('devlibs')) - for (SourceSet set in sourceSetSet) { - from set.allSource - } - excludeDuplicatePackageInfos(it) - } - def remapSourcesTask = project.tasks.register("${name}RemapSourcesJar", RemapSourcesJarTask) { - group = 'Loom' - dependsOn(sourcesTask) - archiveClassifier.set("${name}-sources") - inputFile.set(sourcesTask.flatMap { it.archiveFile }) - } - def javadocTask = project.tasks.register("${name}Javadoc", Javadoc) { - group = 'Build' - destinationDir = project.layout.buildDirectory.dir("docs/${name}-javadoc").get().asFile - options.encoding = 'UTF-8' - options.optionFiles(project.rootProject.file('javadoc-options.txt')) - for (SourceSet set in sourceSetSet) { - source set.allJava - classpath += set.compileClasspath - } - excludeDuplicatePackageInfos(it) - } - def javadocJarTask = project.tasks.register("${name}JavadocJar", Jar) { - group = 'Build' - dependsOn(javadocTask) - archiveClassifier.set("${name}-javadoc") - destinationDirectory.set(project.layout.buildDirectory.dir('libs')) - from(javadocTask.map { it.outputs }) - } - - project.artifacts.add(config.name, jarTask) - - project.tasks.named('assemble').configure { - dependsOn(jarTask, remapJarTask, sourcesTask, remapSourcesTask, javadocTask, javadocJarTask) - } - - return new JarTaskSet(jarTask, remapJarTask, sourcesTask, remapSourcesTask, javadocJarTask) - } } diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy deleted file mode 100644 index 468b59f97..000000000 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/OutgoingConfigurationPlugin.groovy +++ /dev/null @@ -1,30 +0,0 @@ -package com.jozufozu.gradle - - -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.tasks.SourceSet -import org.gradle.api.tasks.SourceSetContainer - -class OutgoingConfigurationPlugin implements Plugin { - @Override - void apply(Project project) { - project.extensions.create("outgoing", Extension, project) - } - - static class Extension { - private final Project project - - Extension(Project project) { - this.project = project - } - - JarTaskSet createJarAndOutgoingConfiguration(String name) { - return createJarAndOutgoingConfiguration(name, project.getExtensions().getByType(SourceSetContainer).named(name).get()) - } - - JarTaskSet createJarAndOutgoingConfiguration(String name, SourceSet... sourceSetSet) { - return JarTaskUtils.createJarAndOutgoingConfiguration(project, name, sourceSetSet) - } - } -} diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy index 476ded6f8..055b2ba4b 100644 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy @@ -2,6 +2,9 @@ package com.jozufozu.gradle import groovy.transform.CompileStatic import net.fabricmc.loom.api.LoomGradleExtensionAPI +import net.fabricmc.loom.task.RemapJarTask +import net.fabricmc.loom.task.RemapSourcesJarTask +import org.gradle.api.NamedDomainObjectProvider import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.artifacts.Configuration @@ -56,10 +59,10 @@ class PlatformPlugin implements Plugin { mainMod.sourceSet(platformBackend) mainMod.sourceSet(platformImpl) - def forApi = newConfiguration(project, 'forApi') - def forLib = newConfiguration(project, 'forLib') - def forBackend = newConfiguration(project, 'forBackend') - def forImpl = newConfiguration(project, 'forImpl') + def forApi = newConfiguration(project, 'forApi').get() + def forLib = newConfiguration(project, 'forLib').get() + def forBackend = newConfiguration(project, 'forBackend').get() + def forImpl = newConfiguration(project, 'forImpl').get() extendsFrom(project, platformApi.compileOnlyConfigurationName, forApi) extendsFrom(project, platformLib.compileOnlyConfigurationName, forApi, forLib) @@ -86,7 +89,6 @@ class PlatformPlugin implements Plugin { } tasks.named('jar', Jar).configure { Jar jar -> - jar.archiveClassifier.set('dev') jar.from platformApi.output, platformLib.output, platformBackend.output JarTaskUtils.excludeDuplicatePackageInfos(jar) @@ -108,34 +110,34 @@ class PlatformPlugin implements Plugin { JarTaskUtils.excludeDuplicatePackageInfos(jar) } - // for if we decide to have Vanillin be another subproject, we can just use the exported configurations - JarTaskUtils.createJarAndOutgoingConfiguration(project, 'apiOnly', platformApi) - JarTaskUtils.createJarAndOutgoingConfiguration(project, 'lib', platformLib) + def remapJar = tasks.named('remapJar', RemapJarTask) + def remapSourcesJar = tasks.named('remapSourcesJar', RemapSourcesJarTask) + def javadocJar = tasks.named('javadocJar', Jar) - JarTaskSet apiSet = JarTaskUtils.createJarAndOutgoingConfiguration(project, 'api', platformApi, platformLib) - JarTaskSet backendSet = JarTaskUtils.createJarAndOutgoingConfiguration(project, 'backend', platformBackend) - JarTaskSet implSet = JarTaskUtils.createJarAndOutgoingConfiguration(project, 'impl', platformImpl) + JarTaskSet apiSet = JarTaskSet.create(project, 'api', platformApi, platformLib) + + def mcVersion = project.property('artifact_minecraft_version') publishing.publications { // we should be using remapped on both Fabric and Forge because Forge needs to put things in srg - it.register('mavenIntermediary', MavenPublication) { MavenPublication pub -> - pub.from(project.components.named('java').get()) + it.register('mavenApi', MavenPublication) { MavenPublication pub -> pub.artifact(apiSet.remapJar) pub.artifact(apiSet.remapSources) pub.artifact(apiSet.javadocJar) - pub.artifact(backendSet.remapJar) - pub.artifact(backendSet.remapSources) - pub.artifact(backendSet.javadocJar) - pub.artifact(implSet.remapJar) - pub.artifact(implSet.remapSources) - pub.artifact(implSet.javadocJar) - pub.artifactId = "flywheel-${project.name}-${project.property('artifact_minecraft_version')}" + + pub.artifactId = "flywheel-${project.name}-api-${mcVersion}" + } + it.register('mavenImpl', MavenPublication) { MavenPublication pub -> + pub.artifact(remapJar) + pub.artifact(remapSourcesJar) + pub.artifact(javadocJar) + pub.artifactId = "flywheel-${project.name}-${mcVersion}" } } } - static Configuration newConfiguration(Project project, String name) { - return project.configurations.create(name) { Configuration it -> + static NamedDomainObjectProvider newConfiguration(Project project, String name) { + return project.configurations.register(name) { Configuration it -> it.canBeConsumed = true it.canBeResolved = false } diff --git a/common/build.gradle b/common/build.gradle index 49290b0f8..66d8d4292 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -6,7 +6,7 @@ plugins { id 'flywheel.java' id 'flywheel.package-infos' id 'flywheel.subproject' - id 'flywheel.outgoing-configuration' + id 'flywheel.jar-sets' } sourceSets { @@ -40,30 +40,24 @@ sourceSets { } } -jar { - from sourceSets.api.output - from sourceSets.lib.output - from sourceSets.backend.output - archiveClassifier.set('') -} - -sourcesJar { - from sourceSets.api.allSource - from sourceSets.lib.allSource - from sourceSets.backend.allSource -} - -javadoc { - source sourceSets.api.allJava - source sourceSets.lib.allJava - source sourceSets.backend.allJava +// For sharing with other subprojects. +jarSets { + createJars('apiOnly', sourceSets.api).configure { + it.createOutgoingConfiguration('common') + } + createJars('lib').configure { + it.createOutgoingConfiguration('common') + } + createJars('backend').configure { + it.createOutgoingConfiguration('common') + } + createJars('impl', sourceSets.main).configure { + it.createOutgoingConfiguration('common') + } } -outgoing.createJarAndOutgoingConfiguration("apiOnly", sourceSets.api) -outgoing.createJarAndOutgoingConfiguration("lib") -def apiLibJar = outgoing.createJarAndOutgoingConfiguration("api", sourceSets.api, sourceSets.lib) -def backendJar = outgoing.createJarAndOutgoingConfiguration("backend") -def implJar = outgoing.createJarAndOutgoingConfiguration("impl", sourceSets.main) +// For publishing +def apiLibJar = jarSets.createJars('api', sourceSets.api, sourceSets.lib) dependencies { modCompileOnly "net.fabricmc:fabric-loader:${fabric_loader_version}" @@ -78,32 +72,16 @@ test { publishing { publications { register('mavenIntermediary', MavenPublication) { - from(components['java']) artifact apiLibJar.remapJar artifact apiLibJar.remapSources artifact apiLibJar.javadocJar - artifact backendJar.remapJar - artifact backendJar.remapSources - artifact backendJar.javadocJar - artifact implJar.remapJar - artifact implJar.remapSources - artifact implJar.javadocJar - artifactId = "flywheel-${project.name}-intermediary-${artifact_minecraft_version}" + artifactId = "flywheel-common-intermediary-api-${artifact_minecraft_version}" } register('mavenMojmap', MavenPublication) { - artifact jar - artifact sourcesJar - artifact javadocJar artifact apiLibJar.jar artifact apiLibJar.sources artifact apiLibJar.javadocJar - artifact backendJar.jar - artifact backendJar.sources - artifact backendJar.javadocJar - artifact implJar.jar - artifact implJar.sources - artifact implJar.javadocJar - artifactId = "flywheel-${project.name}-mojmap-${artifact_minecraft_version}" + artifactId = "flywheel-common-mojmap-api-${artifact_minecraft_version}" } } } From da478cd1143efb623781de8b66179a8f660c21c4 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sat, 27 Apr 2024 21:15:42 -0700 Subject: [PATCH 39/62] Plugin play - Convert package infos stuff to a proper plugin - Add extension for specifying which source sets get generated package infos - Move extension classes into their own files - Move GeneratePackageInfosTask into com.jozufozu.gradle --- buildSrc/build.gradle | 4 ++ .../gradle}/GeneratePackageInfosTask.groovy | 2 + .../jozufozu/gradle/JarSetExtension.groovy | 23 +++++++++ .../com/jozufozu/gradle/JarSetPlugin.groovy | 20 +------- .../gradle/PackageInfosExtension.groovy | 50 +++++++++++++++++++ .../jozufozu/gradle/PackageInfosPlugin.groovy | 14 ++++++ .../main/groovy/flywheel.package-infos.gradle | 31 ------------ common/build.gradle | 4 ++ fabric/build.gradle | 4 ++ forge/build.gradle | 4 ++ 10 files changed, 106 insertions(+), 50 deletions(-) rename buildSrc/src/main/groovy/{ => com/jozufozu/gradle}/GeneratePackageInfosTask.groovy (98%) create mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetExtension.groovy create mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosExtension.groovy create mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosPlugin.groovy delete mode 100644 buildSrc/src/main/groovy/flywheel.package-infos.gradle diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index b80ca0bb3..7e9c4587b 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -27,6 +27,10 @@ gradlePlugin { plugin.id = 'flywheel.jar-sets' plugin.implementationClass = 'com.jozufozu.gradle.JarSetPlugin' } + packageInfosPlugin { PluginDeclaration plugin -> + plugin.id = 'flywheel.package-infos' + plugin.implementationClass = 'com.jozufozu.gradle.PackageInfosPlugin' + } } } diff --git a/buildSrc/src/main/groovy/GeneratePackageInfosTask.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/GeneratePackageInfosTask.groovy similarity index 98% rename from buildSrc/src/main/groovy/GeneratePackageInfosTask.groovy rename to buildSrc/src/main/groovy/com/jozufozu/gradle/GeneratePackageInfosTask.groovy index dbb693f74..e3e34cf15 100644 --- a/buildSrc/src/main/groovy/GeneratePackageInfosTask.groovy +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/GeneratePackageInfosTask.groovy @@ -1,3 +1,5 @@ +package com.jozufozu.gradle + import org.gradle.api.DefaultTask import org.gradle.api.file.DirectoryProperty import org.gradle.api.tasks.InputDirectory diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetExtension.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetExtension.groovy new file mode 100644 index 000000000..733761a64 --- /dev/null +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetExtension.groovy @@ -0,0 +1,23 @@ +package com.jozufozu.gradle + +import groovy.transform.CompileStatic +import org.gradle.api.Project +import org.gradle.api.tasks.SourceSet +import org.gradle.api.tasks.SourceSetContainer + +@CompileStatic +class JarSetExtension { + private final Project project + + JarSetExtension(Project project) { + this.project = project + } + + JarTaskSet createJars(String name) { + return createJars(name, project.getExtensions().getByType(SourceSetContainer).named(name).get()) + } + + JarTaskSet createJars(String name, SourceSet... sourceSetSet) { + return JarTaskSet.create(project, name, sourceSetSet) + } +} diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetPlugin.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetPlugin.groovy index 4fc44a19a..50b572565 100644 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetPlugin.groovy +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetPlugin.groovy @@ -4,30 +4,12 @@ package com.jozufozu.gradle import groovy.transform.CompileStatic import org.gradle.api.Plugin import org.gradle.api.Project -import org.gradle.api.tasks.SourceSet -import org.gradle.api.tasks.SourceSetContainer @CompileStatic class JarSetPlugin implements Plugin { @Override void apply(Project project) { - project.extensions.create("jarSets", JarSetExtension, project) + project.extensions.create('jarSets', JarSetExtension, project) } } -@CompileStatic -class JarSetExtension { - private final Project project - - JarSetExtension(Project project) { - this.project = project - } - - JarTaskSet createJars(String name) { - return createJars(name, project.getExtensions().getByType(SourceSetContainer).named(name).get()) - } - - JarTaskSet createJars(String name, SourceSet... sourceSetSet) { - return JarTaskSet.create(project, name, sourceSetSet) - } -} diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosExtension.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosExtension.groovy new file mode 100644 index 000000000..cecc3f80a --- /dev/null +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosExtension.groovy @@ -0,0 +1,50 @@ +package com.jozufozu.gradle + +import groovy.transform.CompileStatic +import org.gradle.api.Project +import org.gradle.api.tasks.Delete +import org.gradle.api.tasks.SourceSet + +@CompileStatic +class PackageInfosExtension { + final Project project + + PackageInfosExtension(Project project) { + this.project = project + } + + void forSourceSets(SourceSet... sourceSets) { + for (SourceSet sourceSet : sourceSets) { + _forSourceSet(sourceSet) + } + } + + private void _forSourceSet(SourceSet sourceSet) { + // We have to capture the source set name for the lazy string literals, + // otherwise it'll just be whatever the last source set is in the list. + def sourceSetName = sourceSet.name + def taskName = sourceSet.getTaskName('generate', 'PackageInfos') + def task = project.tasks.register(taskName, GeneratePackageInfosTask) { + it.group = 'flywheel' + it.description = "Generates package-info files for $sourceSetName packages." + + // Only apply to default source directory since we also add the generated + // sources to the source set. + it.sourceRoot.set(project.file("src/$sourceSetName/java")) + it.outputDir.set(project.file("src/$sourceSetName/generatedPackageInfos")) + } + sourceSet.java.srcDir(task) + + project.tasks.named('ideaSyncTask').configure { + it.finalizedBy(task) + } + + def cleanTask = project.tasks.register(sourceSet.getTaskName('clean', 'PackageInfos'), Delete) { + it.group = 'flywheel' + it.delete(project.file("src/$sourceSetName/generatedPackageInfos")) + } + project.tasks.named('clean').configure { + it.dependsOn(cleanTask) + } + } +} diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosPlugin.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosPlugin.groovy new file mode 100644 index 000000000..8e6435d8f --- /dev/null +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosPlugin.groovy @@ -0,0 +1,14 @@ +package com.jozufozu.gradle + +import groovy.transform.CompileStatic +import org.gradle.api.Plugin +import org.gradle.api.Project + +@CompileStatic +class PackageInfosPlugin implements Plugin { + @Override + void apply(Project target) { + target.extensions.create('defaultPackageInfos', PackageInfosExtension, target) + } +} + diff --git a/buildSrc/src/main/groovy/flywheel.package-infos.gradle b/buildSrc/src/main/groovy/flywheel.package-infos.gradle deleted file mode 100644 index 1e9392da6..000000000 --- a/buildSrc/src/main/groovy/flywheel.package-infos.gradle +++ /dev/null @@ -1,31 +0,0 @@ - -sourceSets.configureEach { - setupGeneratePackageInfos(it) -} - -def setupGeneratePackageInfos(SourceSet sourceSet) { - // We have to capture the source set name for the lazy string literals, - // otherwise it'll just be whatever the last source set is in the list. - def sourceSetName = sourceSet.name - def taskName = sourceSet.getTaskName('generate', 'PackageInfos') - def task = tasks.register(taskName, GeneratePackageInfosTask) { - group = 'flywheel' - description = "Generates package-info files for $sourceSetName packages." - - // Only apply to default source directory since we also add the generated - // sources to the source set. - sourceRoot = file("src/$sourceSetName/java") - outputDir = file("src/$sourceSetName/generatedPackageInfos") - } - sourceSet.java.srcDir task - - tasks.named('ideaSyncTask').configure { - finalizedBy task - } - - def cleanTask = tasks.register(sourceSet.getTaskName('clean', 'PackageInfos'), Delete) { - group = 'flywheel' - delete file("src/$sourceSetName/generatedPackageInfos") - } - clean.dependsOn cleanTask -} diff --git a/common/build.gradle b/common/build.gradle index 66d8d4292..0181025c8 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -40,6 +40,10 @@ sourceSets { } } +defaultPackageInfos { + forSourceSets sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main +} + // For sharing with other subprojects. jarSets { createJars('apiOnly', sourceSets.api).configure { diff --git a/fabric/build.gradle b/fabric/build.gradle index 4ae964468..e975b7754 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -11,6 +11,10 @@ plugins { evaluationDependsOn(':common') +defaultPackageInfos { + forSourceSets sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main +} + loom { runs { client { diff --git a/forge/build.gradle b/forge/build.gradle index b6ef3166c..97a812da3 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -11,6 +11,10 @@ plugins { evaluationDependsOn(':common') +defaultPackageInfos { + forSourceSets sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main +} + loom { forge { mixinConfig 'flywheel.backend.mixins.json' From 8bf6957e39250cb31e26b825498f22976a398c25 Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Mon, 29 Apr 2024 12:06:28 -0700 Subject: [PATCH 40/62] Fabric client commands --- .../com/jozufozu/gradle/JarTaskUtils.groovy | 7 - .../backend/engine/uniform/DebugMode.java | 16 ++- .../flywheel/impl/DebugModeArgument.java | 15 ++ .../flywheel/impl/FabricFlwConfig.java | 12 +- .../jozufozu/flywheel/impl/FlwCommands.java | 132 ++++++++++++++++++ .../flywheel/impl/FlywheelFabric.java | 8 +- .../jozufozu/flywheel/impl/FlwCommands.java | 66 ++++----- .../jozufozu/flywheel/impl/FlywheelForge.java | 4 + 8 files changed, 204 insertions(+), 56 deletions(-) create mode 100644 common/src/main/java/com/jozufozu/flywheel/impl/DebugModeArgument.java create mode 100644 fabric/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy index c178124fe..34d553872 100644 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy @@ -1,17 +1,10 @@ package com.jozufozu.gradle import groovy.transform.CompileStatic -import net.fabricmc.loom.task.RemapJarTask -import net.fabricmc.loom.task.RemapSourcesJarTask -import org.gradle.api.Project -import org.gradle.api.file.DirectoryProperty import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.file.FileCopyDetails import org.gradle.api.tasks.AbstractCopyTask -import org.gradle.api.tasks.SourceSet import org.gradle.api.tasks.SourceTask -import org.gradle.api.tasks.bundling.Jar -import org.gradle.api.tasks.javadoc.Javadoc @CompileStatic class JarTaskUtils { diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/DebugMode.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/DebugMode.java index 8a4c7a069..01ac310f1 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/DebugMode.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/DebugMode.java @@ -1,6 +1,12 @@ package com.jozufozu.flywheel.backend.engine.uniform; -public enum DebugMode { +import java.util.Locale; + +import com.mojang.serialization.Codec; + +import net.minecraft.util.StringRepresentable; + +public enum DebugMode implements StringRepresentable { OFF, NORMALS, INSTANCE_ID, @@ -9,4 +15,12 @@ public enum DebugMode { OVERLAY, DIFFUSE, LIGHT_VOLUME, + ; + + public static final Codec CODEC = StringRepresentable.fromEnum(DebugMode::values); + + @Override + public String getSerializedName() { + return name().toLowerCase(Locale.ROOT); + } } diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/DebugModeArgument.java b/common/src/main/java/com/jozufozu/flywheel/impl/DebugModeArgument.java new file mode 100644 index 000000000..d76b9af1e --- /dev/null +++ b/common/src/main/java/com/jozufozu/flywheel/impl/DebugModeArgument.java @@ -0,0 +1,15 @@ +package com.jozufozu.flywheel.impl; + +import com.jozufozu.flywheel.backend.engine.uniform.DebugMode; + +import net.minecraft.commands.arguments.StringRepresentableArgument; +import net.minecraft.commands.synchronization.SingletonArgumentInfo; + +public class DebugModeArgument extends StringRepresentableArgument { + public static final DebugModeArgument INSTANCE = new DebugModeArgument(); + public static final SingletonArgumentInfo INFO = SingletonArgumentInfo.contextFree(() -> INSTANCE); + + public DebugModeArgument() { + super(DebugMode.CODEC, DebugMode::values); + } +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java index 0ad3e1326..0c2bc0797 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java @@ -1,24 +1,28 @@ package com.jozufozu.flywheel.impl; import com.jozufozu.flywheel.api.backend.Backend; -import com.jozufozu.flywheel.backend.Backends; +import com.jozufozu.flywheel.api.backend.BackendManager; // TODO: Fabric config public class FabricFlwConfig implements FlwConfig { public static final FabricFlwConfig INSTANCE = new FabricFlwConfig(); + public Backend backend = BackendManager.getDefaultBackend(); + public boolean limitUpdates = true; + public int workerThreads = -1; + @Override public Backend backend() { - return Backends.INDIRECT; + return backend; } @Override public boolean limitUpdates() { - return true; + return limitUpdates; } @Override public int workerThreads() { - return -1; + return workerThreads; } } diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java new file mode 100644 index 000000000..7a40b1167 --- /dev/null +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java @@ -0,0 +1,132 @@ +package com.jozufozu.flywheel.impl; + +import com.jozufozu.flywheel.api.backend.Backend; +import com.jozufozu.flywheel.api.backend.BackendManager; +import com.jozufozu.flywheel.backend.engine.uniform.DebugMode; +import com.jozufozu.flywheel.backend.engine.uniform.FrameUniforms; +import com.mojang.brigadier.Command; +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.arguments.IntegerArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import com.mojang.brigadier.context.CommandContext; + +import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; +import net.minecraft.client.Minecraft; +import net.minecraft.commands.CommandBuildContext; +import net.minecraft.commands.arguments.coordinates.BlockPosArgument; +import net.minecraft.commands.arguments.coordinates.Coordinates; +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.Entity; + +public final class FlwCommands { + private FlwCommands() { + } + + public static void registerClientCommands(CommandDispatcher dispatcher, CommandBuildContext buildContext) { + FabricFlwConfig config = FabricFlwConfig.INSTANCE; + + LiteralArgumentBuilder command = ClientCommandManager.literal("flywheel"); + + command.then(ClientCommandManager.literal("backend") + .executes(context -> { + Backend backend = BackendManager.getBackend(); + String idStr = Backend.REGISTRY.getIdOrThrow(backend) + .toString(); + context.getSource().sendFeedback(Component.translatable("command.flywheel.backend.get", idStr)); + return Command.SINGLE_SUCCESS; + }) + .then(ClientCommandManager.argument("id", BackendArgument.INSTANCE) + .executes(context -> { + Backend requestedBackend = context.getArgument("id", Backend.class); + config.backend = requestedBackend; + + // Reload renderers so we can report the actual backend. + Minecraft.getInstance().levelRenderer.allChanged(); + + Backend actualBackend = BackendManager.getBackend(); + if (actualBackend != requestedBackend) { + String requestedIdStr = Backend.REGISTRY.getIdOrThrow(requestedBackend) + .toString(); + context.getSource().sendError(Component.translatable("command.flywheel.backend.set.unavailable", requestedIdStr)); + } + + String actualIdStr = Backend.REGISTRY.getIdOrThrow(actualBackend) + .toString(); + context.getSource().sendFeedback(Component.translatable("command.flywheel.backend.set", actualIdStr)); + return Command.SINGLE_SUCCESS; + }))); + + command.then(ClientCommandManager.literal("limitUpdates") + .executes(context -> { + if (config.limitUpdates) { + context.getSource().sendFeedback(Component.translatable("command.flywheel.limit_updates.get.on")); + } else { + context.getSource().sendFeedback(Component.translatable("command.flywheel.limit_updates.get.off")); + } + return Command.SINGLE_SUCCESS; + }) + .then(ClientCommandManager.literal("on") + .executes(context -> { + config.limitUpdates = true; + context.getSource().sendFeedback(Component.translatable("command.flywheel.limit_updates.set.on")); + Minecraft.getInstance().levelRenderer.allChanged(); + return Command.SINGLE_SUCCESS; + })) + .then(ClientCommandManager.literal("off") + .executes(context -> { + config.limitUpdates = false; + context.getSource().sendFeedback(Component.translatable("command.flywheel.limit_updates.set.off")); + Minecraft.getInstance().levelRenderer.allChanged(); + return Command.SINGLE_SUCCESS; + }))); + + command.then(ClientCommandManager.literal("crumbling") + .then(ClientCommandManager.argument("pos", BlockPosArgument.blockPos()) + .then(ClientCommandManager.argument("stage", IntegerArgumentType.integer(0, 9)) + .executes(context -> { + Entity executor = context.getSource() + .getEntity(); + + if (executor == null) { + return 0; + } + + BlockPos pos = getBlockPos(context, "pos"); + int value = IntegerArgumentType.getInteger(context, "stage"); + + executor.level() + .destroyBlockProgress(executor.getId(), pos, value); + + return Command.SINGLE_SUCCESS; + })))); + + command.then(ClientCommandManager.literal("debug") + .then(ClientCommandManager.argument("mode", DebugModeArgument.INSTANCE) + .executes(context -> { + DebugMode mode = context.getArgument("mode", DebugMode.class); + FrameUniforms.debugMode(mode); + return Command.SINGLE_SUCCESS; + }))); + + command.then(ClientCommandManager.literal("frustum") + .then(ClientCommandManager.literal("capture") + .executes(context -> { + FrameUniforms.captureFrustum(); + return Command.SINGLE_SUCCESS; + })) + .then(ClientCommandManager.literal("unpause") + .executes(context -> { + FrameUniforms.unpauseFrustum(); + return Command.SINGLE_SUCCESS; + }))); + + dispatcher.register(command); + } + + // Client version of BlockPosArgument.getBlockPos + private static BlockPos getBlockPos(CommandContext context, String name) { + return context.getArgument(name, Coordinates.class).getBlockPos(context.getSource().getPlayer().createCommandSourceStack()); + } +} diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java index b83788de7..0885191ab 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java @@ -1,5 +1,7 @@ package com.jozufozu.flywheel.impl; +import org.jetbrains.annotations.UnknownNullability; + import com.jozufozu.flywheel.Flywheel; import com.jozufozu.flywheel.api.event.BeginFrameCallback; import com.jozufozu.flywheel.api.event.EndClientResourceReloadCallback; @@ -26,6 +28,7 @@ import net.minecraft.server.packs.PackType; public final class FlywheelFabric implements ClientModInitializer { + @UnknownNullability private static Version version; @Override @@ -60,14 +63,13 @@ private static void setupImpl() { ClientEntityEvents.ENTITY_LOAD.register((entity, level) -> VisualizationEventHandler.onEntityJoinLevel(level, entity)); ClientEntityEvents.ENTITY_UNLOAD.register((entity, level) -> VisualizationEventHandler.onEntityLeaveLevel(level, entity)); - ClientCommandRegistrationCallback.EVENT.register((dispatcher, ctx) -> { - // TODO: Fabric client commands - }); + ClientCommandRegistrationCallback.EVENT.register(FlwCommands::registerClientCommands); EndClientResourceReloadCallback.EVENT.register((minecraft, resourceManager, initialReload, error) -> BackendManagerImpl.onEndClientResourceReload(error.isPresent())); ArgumentTypeRegistry.registerArgumentType(Flywheel.rl("backend"), BackendArgument.class, BackendArgument.INFO); + ArgumentTypeRegistry.registerArgumentType(Flywheel.rl("debug_mode"), DebugModeArgument.class, DebugModeArgument.INFO); } private static void setupLib() { diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java b/forge/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java index 72a436120..f8cdb2929 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java @@ -1,7 +1,5 @@ package com.jozufozu.flywheel.impl; -import java.util.function.BiConsumer; - import com.jozufozu.flywheel.api.backend.Backend; import com.jozufozu.flywheel.api.backend.BackendManager; import com.jozufozu.flywheel.backend.engine.uniform.DebugMode; @@ -18,15 +16,15 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.entity.Entity; import net.minecraftforge.client.event.RegisterClientCommandsEvent; +import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; -import net.minecraftforge.server.command.EnumArgument; public final class FlwCommands { private FlwCommands() { } public static void registerClientCommands(RegisterClientCommandsEvent event) { - var config = ForgeFlwConfig.INSTANCE; + ForgeFlwConfig config = ForgeFlwConfig.INSTANCE; LiteralArgumentBuilder command = Commands.literal("flywheel"); @@ -60,24 +58,30 @@ public static void registerClientCommands(RegisterClientCommandsEvent event) { return Command.SINGLE_SUCCESS; }))); - command.then(booleanValueCommand(Commands.literal("limitUpdates"), config.client.limitUpdates, - (source, bool) -> { - if (bool) { - sendMessage(source, Component.translatable("command.flywheel.limit_updates.get.on")); - } else { - sendMessage(source, Component.translatable("command.flywheel.limit_updates.get.off")); - } - }, - (source, bool) -> { - if (bool) { - sendMessage(source, Component.translatable("command.flywheel.limit_updates.set.on")); + BooleanValue limitUpdatesValue = config.client.limitUpdates; + command.then(Commands.literal("limitUpdates") + .executes(context -> { + if (limitUpdatesValue.get()) { + sendMessage(context.getSource(), Component.translatable("command.flywheel.limit_updates.get.on")); } else { - sendMessage(source, Component.translatable("command.flywheel.limit_updates.set.off")); + sendMessage(context.getSource(), Component.translatable("command.flywheel.limit_updates.get.off")); } - - Minecraft.getInstance().levelRenderer.allChanged(); - } - )); + return Command.SINGLE_SUCCESS; + }) + .then(Commands.literal("on") + .executes(context -> { + limitUpdatesValue.set(true); + sendMessage(context.getSource(), Component.translatable("command.flywheel.limit_updates.set.on")); + Minecraft.getInstance().levelRenderer.allChanged(); + return Command.SINGLE_SUCCESS; + })) + .then(Commands.literal("off") + .executes(context -> { + limitUpdatesValue.set(false); + sendMessage(context.getSource(), Component.translatable("command.flywheel.limit_updates.set.off")); + Minecraft.getInstance().levelRenderer.allChanged(); + return Command.SINGLE_SUCCESS; + }))); command.then(Commands.literal("crumbling") .then(Commands.argument("pos", BlockPosArgument.blockPos()) @@ -100,7 +104,7 @@ public static void registerClientCommands(RegisterClientCommandsEvent event) { })))); command.then(Commands.literal("debug") - .then(Commands.argument("mode", EnumArgument.enumArgument(DebugMode.class)) + .then(Commands.argument("mode", DebugModeArgument.INSTANCE) .executes(context -> { DebugMode mode = context.getArgument("mode", DebugMode.class); FrameUniforms.debugMode(mode); @@ -122,26 +126,6 @@ public static void registerClientCommands(RegisterClientCommandsEvent event) { event.getDispatcher().register(command); } - private static LiteralArgumentBuilder booleanValueCommand(LiteralArgumentBuilder builder, ConfigValue value, BiConsumer displayAction, BiConsumer setAction) { - return builder - .executes(context -> { - displayAction.accept(context.getSource(), value.get()); - return Command.SINGLE_SUCCESS; - }) - .then(Commands.literal("on") - .executes(context -> { - value.set(true); - setAction.accept(context.getSource(), value.get()); - return Command.SINGLE_SUCCESS; - })) - .then(Commands.literal("off") - .executes(context -> { - value.set(false); - setAction.accept(context.getSource(), value.get()); - return Command.SINGLE_SUCCESS; - })); - } - private static void sendMessage(CommandSourceStack source, Component message) { source.sendSuccess(() -> message, true); } diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelForge.java b/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelForge.java index 71439e4e8..7905f3709 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelForge.java +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelForge.java @@ -1,6 +1,7 @@ package com.jozufozu.flywheel.impl; import org.apache.maven.artifact.versioning.ArtifactVersion; +import org.jetbrains.annotations.UnknownNullability; import com.jozufozu.flywheel.Flywheel; import com.jozufozu.flywheel.api.event.BeginFrameEvent; @@ -39,6 +40,7 @@ @Mod(Flywheel.ID) public final class FlywheelForge { + @UnknownNullability private static ArtifactVersion version; public FlywheelForge() { @@ -99,10 +101,12 @@ private static void registerImplEventListeners(IEventBus forgeEventBus, IEventBu modEventBus.addListener((FMLCommonSetupEvent e) -> { ArgumentTypeInfos.registerByClass(BackendArgument.class, BackendArgument.INFO); + ArgumentTypeInfos.registerByClass(DebugModeArgument.class, DebugModeArgument.INFO); }); modEventBus.addListener((RegisterEvent e) -> { if (e.getRegistryKey().equals(ForgeRegistries.Keys.COMMAND_ARGUMENT_TYPES)) { e.register(ForgeRegistries.Keys.COMMAND_ARGUMENT_TYPES, Flywheel.rl("backend"), () -> BackendArgument.INFO); + e.register(ForgeRegistries.Keys.COMMAND_ARGUMENT_TYPES, Flywheel.rl("debug_mode"), () -> DebugModeArgument.INFO); } }); } From 19d741e354c8bd13d2752802e671b6814c47f624 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Mon, 29 Apr 2024 14:33:51 -0700 Subject: [PATCH 41/62] Caught linking - Upgrade buildSrc to kotlin buildscript - Add TransitiveSourceSet extension to abstract creating the different source sets and creating the configurations to apply dependencies --- buildSrc/build.gradle | 39 --------- buildSrc/build.gradle.kts | 44 +++++++++++ .../com/jozufozu/gradle/PlatformPlugin.groovy | 27 ------- .../gradle/TransitiveSourceSetConfigurator.kt | 40 ++++++++++ .../gradle/TransitiveSourceSetsExtension.kt | 79 +++++++++++++++++++ .../gradle/TransitiveSourceSetsPlugin.kt | 10 +++ common/build.gradle | 38 ++++----- fabric/build.gradle | 24 +++++- forge/build.gradle | 24 +++++- 9 files changed, 234 insertions(+), 91 deletions(-) delete mode 100644 buildSrc/build.gradle create mode 100644 buildSrc/build.gradle.kts create mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetConfigurator.kt create mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetsExtension.kt create mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetsPlugin.kt diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle deleted file mode 100644 index 7e9c4587b..000000000 --- a/buildSrc/build.gradle +++ /dev/null @@ -1,39 +0,0 @@ -plugins { - id 'groovy-gradle-plugin' -} - -repositories { - gradlePluginPortal() - mavenCentral() - maven { - name = 'MinecraftForge' - url = 'https://maven.minecraftforge.net/' - } - maven { - name = 'Architectury' - url = 'https://maven.architectury.dev/' - } - maven { url = 'https://repo.spongepowered.org/repository/maven-public' } - maven { url = 'https://maven.parchmentmc.org' } -} - -gradlePlugin { - plugins { - platformPlugin { PluginDeclaration plugin -> - plugin.id = 'flywheel.platform' - plugin.implementationClass = 'com.jozufozu.gradle.PlatformPlugin' - } - jarSetPlugin { PluginDeclaration plugin -> - plugin.id = 'flywheel.jar-sets' - plugin.implementationClass = 'com.jozufozu.gradle.JarSetPlugin' - } - packageInfosPlugin { PluginDeclaration plugin -> - plugin.id = 'flywheel.package-infos' - plugin.implementationClass = 'com.jozufozu.gradle.PackageInfosPlugin' - } - } -} - -dependencies { - implementation 'dev.architectury.loom:dev.architectury.loom.gradle.plugin:1.6-SNAPSHOT' -} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 000000000..0c9716767 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + id("groovy-gradle-plugin") + id("java-gradle-plugin") + kotlin("jvm") version "1.9.20" + `kotlin-dsl` +} + +repositories { + gradlePluginPortal() + mavenCentral() + maven("https://maven.minecraftforge.net/") { + name = "MinecraftForge" + } + maven("https://maven.architectury.dev/") { + name = "Architectury" + } + maven("https://repo.spongepowered.org/repository/maven-public") + maven("https://maven.parchmentmc.org") +} + +gradlePlugin { + plugins { + create("platformPlugin") { + id = "flywheel.platform" + implementationClass = "com.jozufozu.gradle.PlatformPlugin" + } + create("jarSetPlugin") { + id = "flywheel.jar-sets" + implementationClass = "com.jozufozu.gradle.JarSetPlugin" + } + create("packageInfosPlugin") { + id = "flywheel.package-infos" + implementationClass = "com.jozufozu.gradle.PackageInfosPlugin" + } + create("transitiveSourceSetsPlugin") { + id = "flywheel.transitive-source-sets" + implementationClass = "com.jozufozu.gradle.TransitiveSourceSetsPlugin" + } + } +} + +dependencies { + implementation("dev.architectury.loom:dev.architectury.loom.gradle.plugin:1.6-SNAPSHOT") +} diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy index 055b2ba4b..280df3024 100644 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy +++ b/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy @@ -30,27 +30,10 @@ class PlatformPlugin implements Plugin { def loom = project.getExtensions().getByType(LoomGradleExtensionAPI) def publishing = project.getExtensions().getByType(PublishingExtension) - // Loom only populates mc stuff to the main source set, - // so grab that here and use it for the others. - // Note that the `+` operator does NOT perform a deep copy - // of a FileCollection, so this object is shared between - // the source sets and we should avoid mutating it. SourceSet platformImpl = sourceSets.named('main').get() - FileCollection mcCompileClassPath = platformImpl.compileClasspath - SourceSet platformApi = sourceSets.create('api') - platformApi.compileClasspath = mcCompileClassPath - SourceSet platformLib = sourceSets.create('lib') - platformLib.compileClasspath = mcCompileClassPath + platformApi.output - SourceSet platformBackend = sourceSets.create('backend') - platformBackend.compileClasspath = mcCompileClassPath + platformApi.output + platformLib.output - - // Assign here rather than concatenate to avoid modifying the mcCompileClassPath FileCollection - platformImpl.compileClasspath = mcCompileClassPath + platformApi.output + platformLib.output + platformBackend.output - // This isn't necessary for forge but fabric needs to recognize each classpath entry from ModSettings. - platformImpl.runtimeClasspath += platformApi.output + platformLib.output + platformBackend.output // This is needed for both platforms. def mainMod = loom.mods.maybeCreate('main') @@ -59,16 +42,6 @@ class PlatformPlugin implements Plugin { mainMod.sourceSet(platformBackend) mainMod.sourceSet(platformImpl) - def forApi = newConfiguration(project, 'forApi').get() - def forLib = newConfiguration(project, 'forLib').get() - def forBackend = newConfiguration(project, 'forBackend').get() - def forImpl = newConfiguration(project, 'forImpl').get() - - extendsFrom(project, platformApi.compileOnlyConfigurationName, forApi) - extendsFrom(project, platformLib.compileOnlyConfigurationName, forApi, forLib) - extendsFrom(project, platformBackend.compileOnlyConfigurationName, forApi, forLib, forBackend) - extendsFrom(project, platformImpl.compileOnlyConfigurationName, forApi, forLib, forBackend, forImpl) - SourceSet commonApi = commonSourceSets.named('api').get() SourceSet commonLib = commonSourceSets.named('lib').get() SourceSet commonBackend = commonSourceSets.named('backend').get() diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetConfigurator.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetConfigurator.kt new file mode 100644 index 000000000..f105246da --- /dev/null +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetConfigurator.kt @@ -0,0 +1,40 @@ +package com.jozufozu.gradle + +import org.gradle.api.tasks.SourceSet + +class TransitiveSourceSetConfigurator(private val parent: TransitiveSourceSetsExtension, private val sourceSet: SourceSet) { + internal val compileSourceSets = mutableSetOf() + internal val runtimeSourceSets = mutableSetOf() + + fun rootCompile() { + parent.compileClasspath?.let { sourceSet.compileClasspath = it } + } + + fun rootRuntime() { + parent.runtimeClasspath?.let { sourceSet.runtimeClasspath = it } + } + + fun rootImplementation() { + rootCompile() + rootRuntime() + } + + fun compile(vararg sourceSets: SourceSet) { + compileSourceSets += sourceSets + for (sourceSet in sourceSets) { + this.sourceSet.compileClasspath += sourceSet.output + } + } + + fun runtime(vararg sourceSets: SourceSet) { + runtimeSourceSets += sourceSets + for (sourceSet in sourceSets) { + this.sourceSet.runtimeClasspath += sourceSet.output + } + } + + fun implementation(vararg sourceSets: SourceSet) { + compile(*sourceSets) + runtime(*sourceSets) + } +} diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetsExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetsExtension.kt new file mode 100644 index 000000000..817c9d93b --- /dev/null +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetsExtension.kt @@ -0,0 +1,79 @@ +package com.jozufozu.gradle + +import org.gradle.api.Action +import org.gradle.api.Project +import org.gradle.api.file.FileCollection +import org.gradle.api.tasks.SourceSet +import org.gradle.api.tasks.SourceSetContainer +import org.gradle.kotlin.dsl.the + +open class TransitiveSourceSetsExtension(private val project: Project) { + var compileClasspath: FileCollection? = null + var runtimeClasspath: FileCollection? = null + + private val transitives = mutableMapOf() + + fun create(name: String) { + sourceSet(project.the().maybeCreate(name)) + } + + fun create(name: String, action: Action) { + sourceSet(project.the().maybeCreate(name), action) + } + + fun sourceSet(name: String) { + sourceSet(project.the().getByName(name)) + } + + fun sourceSet(name: String, action: Action) { + sourceSet(project.the().getByName(name), action) + } + + fun sourceSet(sourceSet: SourceSet) { + registerSourceSet(sourceSet) + } + + fun sourceSet(sourceSet: SourceSet, action: Action) { + action.execute(registerSourceSet(sourceSet)) + } + + private fun registerSourceSet(sourceSet: SourceSet): TransitiveSourceSetConfigurator { + return transitives.computeIfAbsent(sourceSet) { TransitiveSourceSetConfigurator(this, it) } + } + + fun createCompileConfigurations() { + val configs = transitives.mapValues { (sourceSet, _) -> + project.configurations.create("for${sourceSet.name.capitalize()}") { + isCanBeConsumed = true + isCanBeResolved = false + } + } + + transitives.forEach { (sourceSet, configurator) -> + project.configurations.named(sourceSet.compileOnlyConfigurationName).configure { + extendsFrom(configs[sourceSet]) + configurator.compileSourceSets.forEach { + extendsFrom(configs[it]) + } + } + } + } + + fun createRuntimeConfigurations() { + val configs = transitives.mapValues { (sourceSet, _) -> + project.configurations.create("run${sourceSet.name.capitalize()}") { + isCanBeConsumed = true + isCanBeResolved = false + } + } + + transitives.forEach { (sourceSet, configurator) -> + project.configurations.named(sourceSet.runtimeOnlyConfigurationName).configure { + extendsFrom(configs[sourceSet]) + configurator.runtimeSourceSets.forEach { + extendsFrom(configs[it]) + } + } + } + } +} diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetsPlugin.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetsPlugin.kt new file mode 100644 index 000000000..2f00416a8 --- /dev/null +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetsPlugin.kt @@ -0,0 +1,10 @@ +package com.jozufozu.gradle + +import org.gradle.api.Plugin +import org.gradle.api.Project + +class TransitiveSourceSetsPlugin: Plugin { + override fun apply(target: Project) { + target.extensions.create("transitiveSourceSets", TransitiveSourceSetsExtension::class.java, target) + } +} diff --git a/common/build.gradle b/common/build.gradle index 0181025c8..b407c7258 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -7,36 +7,28 @@ plugins { id 'flywheel.package-infos' id 'flywheel.subproject' id 'flywheel.jar-sets' + id 'flywheel.transitive-source-sets' } -sourceSets { - // Loom only populates mc stuff to the main source set, - // so grab that here and use it for the others. - // Note that the `+` operator does NOT perform a deep copy - // of a FileCollection, so this object is shared between - // the source sets and we should avoid mutating it. - FileCollection mcCompileClassPath = main.compileClasspath +transitiveSourceSets { + compileClasspath = sourceSets.main.compileClasspath - SourceSet api = api { - compileClasspath = mcCompileClassPath + create('api') { + rootCompile() } - SourceSet lib = lib { - compileClasspath = mcCompileClassPath + api.output + create('lib') { + rootCompile() + compile sourceSets.api } - SourceSet backend = backend { - compileClasspath = mcCompileClassPath + api.output + lib.output + create('backend') { + rootCompile() + compile sourceSets.api, sourceSets.lib } - - main { - // Assign here rather than concatenate to avoid modifying the mcCompileClassPath FileCollection - compileClasspath = mcCompileClassPath + api.output + lib.output + backend.output + sourceSet(sourceSets.main) { + compile sourceSets.api, sourceSets.lib, sourceSets.backend } - - test { - // Only test needs runtimeClasspath filled since the game shouldn't run from common alone. - // Fine to concatenate here. - compileClasspath += api.output + lib.output + backend.output - runtimeClasspath += api.output + lib.output + backend.output + sourceSet(sourceSets.test) { + implementation sourceSets.api, sourceSets.lib, sourceSets.backend } } diff --git a/fabric/build.gradle b/fabric/build.gradle index e975b7754..53483d51f 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -7,10 +7,32 @@ plugins { id 'flywheel.package-infos' id 'flywheel.subproject' id 'flywheel.platform' + id 'flywheel.transitive-source-sets' } evaluationDependsOn(':common') +transitiveSourceSets { + compileClasspath = sourceSets.main.compileClasspath + + create('api') { + rootCompile() + } + create('lib') { + rootCompile() + compile sourceSets.api + } + create('backend') { + rootCompile() + compile sourceSets.api, sourceSets.lib + } + sourceSet(sourceSets.main) { + implementation sourceSets.api, sourceSets.lib, sourceSets.backend + } + + createCompileConfigurations() +} + defaultPackageInfos { forSourceSets sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main } @@ -50,5 +72,5 @@ dependencies { forApi project(path: ':common', configuration: 'commonApiOnly') forLib project(path: ':common', configuration: 'commonLib') forBackend project(path: ':common', configuration: 'commonBackend') - forImpl project(path: ':common', configuration: 'commonImpl') + forMain project(path: ':common', configuration: 'commonImpl') } diff --git a/forge/build.gradle b/forge/build.gradle index 97a812da3..995477e64 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -7,10 +7,32 @@ plugins { id 'flywheel.package-infos' id 'flywheel.subproject' id 'flywheel.platform' + id 'flywheel.transitive-source-sets' } evaluationDependsOn(':common') +transitiveSourceSets { + compileClasspath = sourceSets.main.compileClasspath + + create('api') { + rootCompile() + } + create('lib') { + rootCompile() + compile sourceSets.api + } + create('backend') { + rootCompile() + compile sourceSets.api, sourceSets.lib + } + sourceSet(sourceSets.main) { + compile sourceSets.api, sourceSets.lib, sourceSets.backend + } + + createCompileConfigurations() +} + defaultPackageInfos { forSourceSets sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main } @@ -60,5 +82,5 @@ dependencies { forApi project(path: ':common', configuration: 'commonApiOnly') forLib project(path: ':common', configuration: 'commonLib') forBackend project(path: ':common', configuration: 'commonBackend') - forImpl project(path: ':common', configuration: 'commonImpl') + forMain project(path: ':common', configuration: 'commonImpl') } From 0a1340f107c8d339bc26562b7d8cd34f00bb19ec Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Mon, 29 Apr 2024 15:49:30 -0700 Subject: [PATCH 42/62] Unplugging it and plugging it back in - Convert existing binary plugins to kotlin - Move each plugin to a different package --- buildSrc/build.gradle.kts | 6 +- .../gradle/GeneratePackageInfosTask.groovy | 53 ------- .../jozufozu/gradle/JarSetExtension.groovy | 23 --- .../com/jozufozu/gradle/JarSetPlugin.groovy | 15 -- .../com/jozufozu/gradle/JarTaskSet.groovy | 126 ---------------- .../com/jozufozu/gradle/JarTaskUtils.groovy | 28 ---- .../gradle/PackageInfosExtension.groovy | 50 ------- .../jozufozu/gradle/PackageInfosPlugin.groovy | 14 -- .../com/jozufozu/gradle/PlatformPlugin.groovy | 134 ----------------- .../com/jozufozu/gradle/PlatformPlugin.kt | 115 +++++++++++++++ .../jozufozu/gradle/jarset/JarSetExtension.kt | 16 ++ .../jozufozu/gradle/jarset/JarSetPlugin.kt | 10 ++ .../com/jozufozu/gradle/jarset/JarTaskSet.kt | 138 ++++++++++++++++++ .../nullability/GeneratePackageInfosTask.kt | 58 ++++++++ .../nullability/PackageInfosExtension.kt | 42 ++++++ .../gradle/nullability/PackageInfosPlugin.kt | 10 ++ .../TransitiveSourceSetConfigurator.kt | 2 +- .../TransitiveSourceSetsExtension.kt | 2 +- .../TransitiveSourceSetsPlugin.kt | 2 +- 19 files changed, 395 insertions(+), 449 deletions(-) delete mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/GeneratePackageInfosTask.groovy delete mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetExtension.groovy delete mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetPlugin.groovy delete mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskSet.groovy delete mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy delete mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosExtension.groovy delete mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosPlugin.groovy delete mode 100644 buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy create mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/PlatformPlugin.kt create mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetExtension.kt create mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetPlugin.kt create mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt create mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/GeneratePackageInfosTask.kt create mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosExtension.kt create mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosPlugin.kt rename buildSrc/src/main/kotlin/com/jozufozu/gradle/{ => transitive}/TransitiveSourceSetConfigurator.kt (96%) rename buildSrc/src/main/kotlin/com/jozufozu/gradle/{ => transitive}/TransitiveSourceSetsExtension.kt (98%) rename buildSrc/src/main/kotlin/com/jozufozu/gradle/{ => transitive}/TransitiveSourceSetsPlugin.kt (87%) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 0c9716767..6c37d9e49 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -26,15 +26,15 @@ gradlePlugin { } create("jarSetPlugin") { id = "flywheel.jar-sets" - implementationClass = "com.jozufozu.gradle.JarSetPlugin" + implementationClass = "com.jozufozu.gradle.jarset.JarSetPlugin" } create("packageInfosPlugin") { id = "flywheel.package-infos" - implementationClass = "com.jozufozu.gradle.PackageInfosPlugin" + implementationClass = "com.jozufozu.gradle.nullability.PackageInfosPlugin" } create("transitiveSourceSetsPlugin") { id = "flywheel.transitive-source-sets" - implementationClass = "com.jozufozu.gradle.TransitiveSourceSetsPlugin" + implementationClass = "com.jozufozu.gradle.transitive.TransitiveSourceSetsPlugin" } } } diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/GeneratePackageInfosTask.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/GeneratePackageInfosTask.groovy deleted file mode 100644 index e3e34cf15..000000000 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/GeneratePackageInfosTask.groovy +++ /dev/null @@ -1,53 +0,0 @@ -package com.jozufozu.gradle - -import org.gradle.api.DefaultTask -import org.gradle.api.file.DirectoryProperty -import org.gradle.api.tasks.InputDirectory -import org.gradle.api.tasks.OutputDirectory -import org.gradle.api.tasks.SkipWhenEmpty -import org.gradle.api.tasks.TaskAction - -import java.nio.file.Files - -// Adapted from https://github.com/FabricMC/fabric/blob/31787236d242247e0b6c4ae806b1cfaa7042a62c/gradle/package-info.gradle, which is licensed under Apache 2.0. -class GeneratePackageInfosTask extends DefaultTask { - @SkipWhenEmpty - @InputDirectory - final DirectoryProperty sourceRoot = project.objects.directoryProperty() - - @OutputDirectory - final DirectoryProperty outputDir = project.objects.directoryProperty() - - @TaskAction - def run() { - def output = outputDir.get().asFile.toPath() - output.deleteDir() - def root = sourceRoot.get().asFile.toPath() - - root.eachDirRecurse { - def containsJava = Files.list(it).any { - Files.isRegularFile(it) && it.fileName.toString().endsWith('.java') - } - - if (containsJava && Files.notExists(it.resolve('package-info.java'))) { - def relativePath = root.relativize(it) - def target = output.resolve(relativePath) - Files.createDirectories(target) - - target.resolve('package-info.java').withWriter { - def packageName = relativePath.toString().replace(File.separator, '.') - it.write("""@ParametersAreNonnullByDefault - |@FieldsAreNonnullByDefault - |@MethodsReturnNonnullByDefault - |package $packageName; - | - |import javax.annotation.ParametersAreNonnullByDefault; - | - |import net.minecraft.FieldsAreNonnullByDefault; - |import net.minecraft.MethodsReturnNonnullByDefault; - |""".stripMargin()) - } - } - } - } -} diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetExtension.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetExtension.groovy deleted file mode 100644 index 733761a64..000000000 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetExtension.groovy +++ /dev/null @@ -1,23 +0,0 @@ -package com.jozufozu.gradle - -import groovy.transform.CompileStatic -import org.gradle.api.Project -import org.gradle.api.tasks.SourceSet -import org.gradle.api.tasks.SourceSetContainer - -@CompileStatic -class JarSetExtension { - private final Project project - - JarSetExtension(Project project) { - this.project = project - } - - JarTaskSet createJars(String name) { - return createJars(name, project.getExtensions().getByType(SourceSetContainer).named(name).get()) - } - - JarTaskSet createJars(String name, SourceSet... sourceSetSet) { - return JarTaskSet.create(project, name, sourceSetSet) - } -} diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetPlugin.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetPlugin.groovy deleted file mode 100644 index 50b572565..000000000 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarSetPlugin.groovy +++ /dev/null @@ -1,15 +0,0 @@ -package com.jozufozu.gradle - - -import groovy.transform.CompileStatic -import org.gradle.api.Plugin -import org.gradle.api.Project - -@CompileStatic -class JarSetPlugin implements Plugin { - @Override - void apply(Project project) { - project.extensions.create('jarSets', JarSetExtension, project) - } -} - diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskSet.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskSet.groovy deleted file mode 100644 index f75c93b0b..000000000 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskSet.groovy +++ /dev/null @@ -1,126 +0,0 @@ -package com.jozufozu.gradle - -import groovy.transform.CompileStatic -import net.fabricmc.loom.task.RemapJarTask -import net.fabricmc.loom.task.RemapSourcesJarTask -import org.gradle.api.Action -import org.gradle.api.Project -import org.gradle.api.tasks.SourceSet -import org.gradle.api.tasks.TaskProvider -import org.gradle.api.tasks.bundling.Jar -import org.gradle.api.tasks.javadoc.Javadoc - -@CompileStatic -class JarTaskSet { - public static final String BUILD_GROUP = 'build' - public static final String LOOM_GROUP = 'loom' - public static final String JAVADOC_CLASSIFIER = "javadoc" - public static final String SOURCES_CLASSIFIER = "sources" - - Project project - String name - TaskProvider jar - TaskProvider remapJar - TaskProvider sources - TaskProvider remapSources - TaskProvider javadocJar - - JarTaskSet(Project project, String name, TaskProvider jar, TaskProvider remapJar, TaskProvider sources, TaskProvider remapSources, TaskProvider javadocJar) { - this.project = project - this.name = name - this.jar = jar - this.remapJar = remapJar - this.sources = sources - this.remapSources = remapSources - this.javadocJar = javadocJar - } - - void createOutgoingConfiguration(String prefix) { - def config = project.configurations.register("${prefix}${name.capitalize()}") { - it.canBeConsumed = true - it.canBeResolved = false - } - - project.artifacts.add(config.name, jar) - } - - void configure(Action action) { - action.execute(this) - } - - void configureEach(Action action) { - jar.configure(action) - sources.configure(action) - javadocJar.configure(action) - - remapJar.configure(action as Action) - remapSources.configure(action as Action) - } - - static JarTaskSet create(Project project, String name, SourceSet... sourceSetSet) { - def buildDirectory = project.layout.buildDirectory - def devlibs = buildDirectory.dir("devlibs/${name}") - def libs = buildDirectory.dir("libs/${name}") - - def jarTask = project.tasks.register("${name}Jar", Jar) { - it.group = BUILD_GROUP - it.destinationDirectory.set(devlibs) - - for (SourceSet set in sourceSetSet) { - it.from set.output - } - JarTaskUtils.excludeDuplicatePackageInfos(it) - } - def remapJarTask = project.tasks.register("${name}RemapJar", RemapJarTask) { - it.dependsOn(jarTask) - it.group = LOOM_GROUP - it.destinationDirectory.set(libs) - - it.inputFile.set(jarTask.flatMap { it.archiveFile }) - } - def sourcesTask = project.tasks.register("${name}SourcesJar", Jar) { - it.group = BUILD_GROUP - it.destinationDirectory.set(devlibs) - it.archiveClassifier.set(SOURCES_CLASSIFIER) - - for (SourceSet set in sourceSetSet) { - it.from set.allSource - } - JarTaskUtils.excludeDuplicatePackageInfos(it) - } - def remapSourcesTask = project.tasks.register("${name}RemapSourcesJar", RemapSourcesJarTask) { - it.dependsOn(sourcesTask) - it.group = LOOM_GROUP - it.destinationDirectory.set(libs) - it.archiveClassifier.set(SOURCES_CLASSIFIER) - - it.inputFile.set(sourcesTask.flatMap { it.archiveFile }) - } - def javadocTask = project.tasks.register("${name}Javadoc", Javadoc) { - it.group = BUILD_GROUP - it.destinationDir = buildDirectory.dir("docs/${name}-javadoc").get().asFile - it.options.encoding = 'UTF-8' - it.options.optionFiles(project.rootProject.file('javadoc-options.txt')) - - for (SourceSet set in sourceSetSet) { - it.source set.allJava - it.classpath += set.compileClasspath - } - JarTaskUtils.excludeDuplicatePackageInfos(it) - } - def javadocJarTask = project.tasks.register("${name}JavadocJar", Jar) { - it.dependsOn(javadocTask) - it.group = BUILD_GROUP - it.destinationDirectory.set(libs) - it.archiveClassifier.set(JAVADOC_CLASSIFIER) - - it.from(javadocTask.map { it.outputs }) - } - - project.tasks.named('assemble').configure { - it.dependsOn(remapJarTask, remapSourcesTask, javadocJarTask) - } - - return new JarTaskSet(project, name, jarTask, remapJarTask, sourcesTask, remapSourcesTask, javadocJarTask) - } -} diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy deleted file mode 100644 index 34d553872..000000000 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/JarTaskUtils.groovy +++ /dev/null @@ -1,28 +0,0 @@ -package com.jozufozu.gradle - -import groovy.transform.CompileStatic -import org.gradle.api.file.DuplicatesStrategy -import org.gradle.api.file.FileCopyDetails -import org.gradle.api.tasks.AbstractCopyTask -import org.gradle.api.tasks.SourceTask - -@CompileStatic -class JarTaskUtils { - /** - * We have duplicate packages between the common and platform dependent subprojects. - * In theory the package-info.java files should be identical, so just take the first one we find. - */ - static void excludeDuplicatePackageInfos(AbstractCopyTask copyTask) { - copyTask.filesMatching('**/package-info.java') { FileCopyDetails details -> - details.duplicatesStrategy = DuplicatesStrategy.EXCLUDE - } - } - - /** - * The compile/javadoc tasks have a different base type that isn't so smart about exclusion handling. - */ - static void excludeDuplicatePackageInfos(SourceTask sourceTask) { - sourceTask.exclude('**/package-info.java') - } - -} diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosExtension.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosExtension.groovy deleted file mode 100644 index cecc3f80a..000000000 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosExtension.groovy +++ /dev/null @@ -1,50 +0,0 @@ -package com.jozufozu.gradle - -import groovy.transform.CompileStatic -import org.gradle.api.Project -import org.gradle.api.tasks.Delete -import org.gradle.api.tasks.SourceSet - -@CompileStatic -class PackageInfosExtension { - final Project project - - PackageInfosExtension(Project project) { - this.project = project - } - - void forSourceSets(SourceSet... sourceSets) { - for (SourceSet sourceSet : sourceSets) { - _forSourceSet(sourceSet) - } - } - - private void _forSourceSet(SourceSet sourceSet) { - // We have to capture the source set name for the lazy string literals, - // otherwise it'll just be whatever the last source set is in the list. - def sourceSetName = sourceSet.name - def taskName = sourceSet.getTaskName('generate', 'PackageInfos') - def task = project.tasks.register(taskName, GeneratePackageInfosTask) { - it.group = 'flywheel' - it.description = "Generates package-info files for $sourceSetName packages." - - // Only apply to default source directory since we also add the generated - // sources to the source set. - it.sourceRoot.set(project.file("src/$sourceSetName/java")) - it.outputDir.set(project.file("src/$sourceSetName/generatedPackageInfos")) - } - sourceSet.java.srcDir(task) - - project.tasks.named('ideaSyncTask').configure { - it.finalizedBy(task) - } - - def cleanTask = project.tasks.register(sourceSet.getTaskName('clean', 'PackageInfos'), Delete) { - it.group = 'flywheel' - it.delete(project.file("src/$sourceSetName/generatedPackageInfos")) - } - project.tasks.named('clean').configure { - it.dependsOn(cleanTask) - } - } -} diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosPlugin.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosPlugin.groovy deleted file mode 100644 index 8e6435d8f..000000000 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/PackageInfosPlugin.groovy +++ /dev/null @@ -1,14 +0,0 @@ -package com.jozufozu.gradle - -import groovy.transform.CompileStatic -import org.gradle.api.Plugin -import org.gradle.api.Project - -@CompileStatic -class PackageInfosPlugin implements Plugin { - @Override - void apply(Project target) { - target.extensions.create('defaultPackageInfos', PackageInfosExtension, target) - } -} - diff --git a/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy b/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy deleted file mode 100644 index 280df3024..000000000 --- a/buildSrc/src/main/groovy/com/jozufozu/gradle/PlatformPlugin.groovy +++ /dev/null @@ -1,134 +0,0 @@ -package com.jozufozu.gradle - -import groovy.transform.CompileStatic -import net.fabricmc.loom.api.LoomGradleExtensionAPI -import net.fabricmc.loom.task.RemapJarTask -import net.fabricmc.loom.task.RemapSourcesJarTask -import org.gradle.api.NamedDomainObjectProvider -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.artifacts.Configuration -import org.gradle.api.file.FileCollection -import org.gradle.api.publish.PublishingExtension -import org.gradle.api.publish.maven.MavenPublication -import org.gradle.api.tasks.SourceSet -import org.gradle.api.tasks.SourceSetContainer -import org.gradle.api.tasks.bundling.Jar -import org.gradle.api.tasks.compile.JavaCompile -import org.gradle.api.tasks.javadoc.Javadoc -import org.gradle.language.jvm.tasks.ProcessResources - -// Couldn't get imports for loom to work in the simple .gradle file, so upgraded this to a real plugin. -@CompileStatic -class PlatformPlugin implements Plugin { - @Override - void apply(Project project) { - def commonProject = project.project(':common') - def commonSourceSets = commonProject.getExtensions().getByType(SourceSetContainer) - - def sourceSets = project.getExtensions().getByType(SourceSetContainer) - def loom = project.getExtensions().getByType(LoomGradleExtensionAPI) - def publishing = project.getExtensions().getByType(PublishingExtension) - - SourceSet platformImpl = sourceSets.named('main').get() - SourceSet platformApi = sourceSets.create('api') - SourceSet platformLib = sourceSets.create('lib') - SourceSet platformBackend = sourceSets.create('backend') - - // This is needed for both platforms. - def mainMod = loom.mods.maybeCreate('main') - mainMod.sourceSet(platformApi) - mainMod.sourceSet(platformLib) - mainMod.sourceSet(platformBackend) - mainMod.sourceSet(platformImpl) - - SourceSet commonApi = commonSourceSets.named('api').get() - SourceSet commonLib = commonSourceSets.named('lib').get() - SourceSet commonBackend = commonSourceSets.named('backend').get() - SourceSet commonImpl = commonSourceSets.named('main').get() - - def commonSources = [commonApi, commonLib, commonBackend, commonImpl] - - // Directly compile the platform sources with the common sources - includeFromCommon(project, platformApi, commonApi) - includeFromCommon(project, platformLib, commonLib) - includeFromCommon(project, platformBackend, commonBackend) - includeFromCommon(project, platformImpl, commonImpl) - - def tasks = project.tasks - - tasks.withType(JavaCompile).configureEach { JavaCompile compileJava -> - JarTaskUtils.excludeDuplicatePackageInfos(compileJava) - } - - tasks.named('jar', Jar).configure { Jar jar -> - jar.from platformApi.output, platformLib.output, platformBackend.output - - JarTaskUtils.excludeDuplicatePackageInfos(jar) - } - - tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> - commonSources.forEach { javadoc.source it.allJava } - - javadoc.source platformApi.allJava, platformLib.allJava, platformBackend.allJava - - JarTaskUtils.excludeDuplicatePackageInfos(javadoc) - } - - tasks.named('sourcesJar', Jar).configure { Jar jar -> - commonSources.forEach { jar.from it.allJava } - - jar.from platformApi.allJava, platformLib.allJava, platformBackend.allJava - - JarTaskUtils.excludeDuplicatePackageInfos(jar) - } - - def remapJar = tasks.named('remapJar', RemapJarTask) - def remapSourcesJar = tasks.named('remapSourcesJar', RemapSourcesJarTask) - def javadocJar = tasks.named('javadocJar', Jar) - - JarTaskSet apiSet = JarTaskSet.create(project, 'api', platformApi, platformLib) - - def mcVersion = project.property('artifact_minecraft_version') - - publishing.publications { - // we should be using remapped on both Fabric and Forge because Forge needs to put things in srg - it.register('mavenApi', MavenPublication) { MavenPublication pub -> - pub.artifact(apiSet.remapJar) - pub.artifact(apiSet.remapSources) - pub.artifact(apiSet.javadocJar) - - pub.artifactId = "flywheel-${project.name}-api-${mcVersion}" - } - it.register('mavenImpl', MavenPublication) { MavenPublication pub -> - pub.artifact(remapJar) - pub.artifact(remapSourcesJar) - pub.artifact(javadocJar) - pub.artifactId = "flywheel-${project.name}-${mcVersion}" - } - } - } - - static NamedDomainObjectProvider newConfiguration(Project project, String name) { - return project.configurations.register(name) { Configuration it -> - it.canBeConsumed = true - it.canBeResolved = false - } - } - - static void extendsFrom(Project project, String name, Configuration... configurations) { - project.configurations.named(name).configure { - it.extendsFrom(configurations) - } - } - - static void includeFromCommon(Project project, SourceSet sourceSet, SourceSet commonSourceSet) { - project.tasks.named(sourceSet.compileJavaTaskName, JavaCompile).configure { JavaCompile compileJava -> - compileJava.source commonSourceSet.allJava - } - - project.tasks.named(sourceSet.processResourcesTaskName, ProcessResources).configure { ProcessResources processResources -> - processResources.from commonSourceSet.resources - } - } -} diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/PlatformPlugin.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/PlatformPlugin.kt new file mode 100644 index 000000000..eaa51344e --- /dev/null +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/PlatformPlugin.kt @@ -0,0 +1,115 @@ +package com.jozufozu.gradle + +import com.jozufozu.gradle.jarset.JarTaskSet +import net.fabricmc.loom.api.LoomGradleExtensionAPI +import net.fabricmc.loom.task.RemapJarTask +import net.fabricmc.loom.task.RemapSourcesJarTask +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.publish.PublishingExtension +import org.gradle.api.publish.maven.MavenPublication +import org.gradle.api.tasks.SourceSet +import org.gradle.api.tasks.SourceSetContainer +import org.gradle.api.tasks.compile.JavaCompile +import org.gradle.api.tasks.javadoc.Javadoc +import org.gradle.jvm.tasks.Jar +import org.gradle.kotlin.dsl.the +import org.gradle.language.jvm.tasks.ProcessResources + +class PlatformPlugin: Plugin { + override fun apply(project: Project) { + val commonProject = project.project(":common") + val commonSourceSets = commonProject.the() + + val sourceSets = project.the() + val loom = project.the() + val publishing = project.the() + + val platformImpl = sourceSets.named("main").get() + val platformApi = sourceSets.create("api") + val platformLib = sourceSets.create("lib") + val platformBackend = sourceSets.create("backend") + + // This is needed for both platforms. + val mainMod = loom.mods.maybeCreate("main") + mainMod.sourceSet(platformApi) + mainMod.sourceSet(platformLib) + mainMod.sourceSet(platformBackend) + mainMod.sourceSet(platformImpl) + + val commonApi = commonSourceSets.named("api").get() + val commonLib = commonSourceSets.named("lib").get() + val commonBackend = commonSourceSets.named("backend").get() + val commonImpl = commonSourceSets.named("main").get() + + val commonSources = listOf(commonApi, commonLib, commonBackend, commonImpl) + + // Directly compile the platform sources with the common sources + includeFromCommon(project, platformApi, commonApi) + includeFromCommon(project, platformLib, commonLib) + includeFromCommon(project, platformBackend, commonBackend) + includeFromCommon(project, platformImpl, commonImpl) + + val tasks = project.tasks + + tasks.withType(JavaCompile::class.java).configureEach { + JarTaskSet.excludeDuplicatePackageInfos(this) + } + + tasks.named("jar", Jar::class.java).configure { + from(platformApi.output, platformLib.output, platformBackend.output) + + JarTaskSet.excludeDuplicatePackageInfos(this) + } + + tasks.named("javadoc", Javadoc::class.java).configure { + commonSources.forEach { source(it.allJava) } + + source(platformApi.allJava, platformLib.allJava, platformBackend.allJava) + + JarTaskSet.excludeDuplicatePackageInfos(this) + } + + tasks.named("sourcesJar", Jar::class.java).configure { + commonSources.forEach { from(it.allJava) } + + from(platformApi.allJava, platformLib.allJava, platformBackend.allJava) + + JarTaskSet.excludeDuplicatePackageInfos(this) + } + + val remapJar = tasks.named("remapJar", RemapJarTask::class.java) + val remapSourcesJar = tasks.named("remapSourcesJar", RemapSourcesJarTask::class.java) + val javadocJar = tasks.named("javadocJar", Jar::class.java) + + val apiSet = JarTaskSet.create(project, "api", platformApi, platformLib) + + val mcVersion = project.property("artifact_minecraft_version") + + publishing.publications { + // we should be using remapped on both Fabric and Forge because Forge needs to put things in srg + register("mavenApi", MavenPublication::class.java) { + artifact(apiSet.remapJar) + artifact(apiSet.remapSources) + artifact(apiSet.javadocJar) + artifactId = "flywheel-${project.name}-api-${mcVersion}" + } + register("mavenImpl", MavenPublication::class.java) { + artifact(remapJar) + artifact(remapSourcesJar) + artifact(javadocJar) + artifactId = "flywheel-${project.name}-${mcVersion}" + } + } + } + + private fun includeFromCommon(project: Project, sourceSet: SourceSet, commonSourceSet: SourceSet) { + project.tasks.named(sourceSet.compileJavaTaskName, JavaCompile::class.java).configure { + source(commonSourceSet.allJava) + } + + project.tasks.named(sourceSet.processResourcesTaskName, ProcessResources::class.java).configure { + from(commonSourceSet.resources) + } + } +} diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetExtension.kt new file mode 100644 index 000000000..f20fcd881 --- /dev/null +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetExtension.kt @@ -0,0 +1,16 @@ +package com.jozufozu.gradle.jarset + +import org.gradle.api.Project +import org.gradle.api.tasks.SourceSet +import org.gradle.api.tasks.SourceSetContainer +import org.gradle.kotlin.dsl.the + +open class JarSetExtension(val project: Project) { + fun createJars(name: String): JarTaskSet { + return createJars(name, project.the().named(name).get()) + } + + fun createJars(name: String, vararg sourceSetSet: SourceSet): JarTaskSet { + return JarTaskSet.create(project, name, *sourceSetSet) + } +} diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetPlugin.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetPlugin.kt new file mode 100644 index 000000000..a1895b440 --- /dev/null +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetPlugin.kt @@ -0,0 +1,10 @@ +package com.jozufozu.gradle.jarset + +import org.gradle.api.Plugin +import org.gradle.api.Project + +class JarSetPlugin: Plugin { + override fun apply(target: Project) { + target.extensions.create("jarSets", JarSetExtension::class.java, target) + } +} diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt new file mode 100644 index 000000000..c3278217d --- /dev/null +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt @@ -0,0 +1,138 @@ +package com.jozufozu.gradle.jarset + +import net.fabricmc.loom.task.RemapJarTask +import net.fabricmc.loom.task.RemapSourcesJarTask +import org.gradle.api.Action +import org.gradle.api.Project +import org.gradle.api.file.DuplicatesStrategy +import org.gradle.api.tasks.AbstractCopyTask +import org.gradle.api.tasks.SourceSet +import org.gradle.api.tasks.SourceTask +import org.gradle.api.tasks.TaskProvider +import org.gradle.api.tasks.javadoc.Javadoc +import org.gradle.jvm.tasks.Jar + +class JarTaskSet( + val project: Project, + val name: String, + val jar: TaskProvider, + val remapJar: TaskProvider, + val sources: TaskProvider, + val remapSources: TaskProvider, + val javadocJar: TaskProvider +) { + + fun createOutgoingConfiguration(prefix: String) { + val config = project.configurations.register("${prefix}${name.capitalize()}") { + isCanBeConsumed = true + isCanBeResolved = false + } + + project.artifacts.add(config.name, jar) + } + + fun configure(action: Action) { + action.execute(this) + } + + fun configureEach(action: Action) { + jar.configure(action) + sources.configure(action) + javadocJar.configure(action) + + remapJar.configure(action) + remapSources.configure(action) + } + + companion object { + private const val PACKAGE_INFOS_JAVA_PATTERN = "**/package-info.java" + private const val BUILD_GROUP: String = "build" + private const val LOOM_GROUP: String = "loom" + private const val JAVADOC_CLASSIFIER: String = "javadoc" + private const val SOURCES_CLASSIFIER: String = "sources" + + /** + * We have duplicate packages between the common and platform dependent subprojects. + * In theory the package-info.java files should be identical, so just take the first one we find. + */ + fun excludeDuplicatePackageInfos(copyTask: AbstractCopyTask) { + copyTask.filesMatching(PACKAGE_INFOS_JAVA_PATTERN) { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } + } + + /** + * The compile/javadoc tasks have a different base type that isn't so smart about exclusion handling. + */ + fun excludeDuplicatePackageInfos(sourceTask: SourceTask) { + sourceTask.exclude(PACKAGE_INFOS_JAVA_PATTERN) + } + + fun create(project: Project, name: String, vararg sourceSetSet: SourceSet): JarTaskSet { + val buildDirectory = project.layout.buildDirectory + val devlibs = buildDirectory.dir("devlibs/${name}") + val libs = buildDirectory.dir("libs/${name}") + + val jarTask = project.tasks.register("${name}Jar", Jar::class.java) { + group = BUILD_GROUP + destinationDirectory.set(devlibs) + + for (set in sourceSetSet) { + from(set.output) + } + excludeDuplicatePackageInfos(this) + } + val remapJarTask = project.tasks.register("${name}RemapJar", RemapJarTask::class.java) { + dependsOn(jarTask) + group = LOOM_GROUP + destinationDirectory.set(libs) + + inputFile.set(jarTask.flatMap { it.archiveFile }) + } + val sourcesTask = project.tasks.register("${name}SourcesJar", Jar::class.java) { + group = BUILD_GROUP + destinationDirectory.set(devlibs) + archiveClassifier.set(SOURCES_CLASSIFIER) + + for (set in sourceSetSet) { + from(set.allSource) + } + excludeDuplicatePackageInfos(this) + } + val remapSourcesTask = project.tasks.register("${name}RemapSourcesJar", RemapSourcesJarTask::class.java) { + dependsOn(sourcesTask) + group = LOOM_GROUP + destinationDirectory.set(libs) + archiveClassifier.set(SOURCES_CLASSIFIER) + + inputFile.set(sourcesTask.flatMap { it.archiveFile }) + } + val javadocTask = project.tasks.register("${name}Javadoc", Javadoc::class.java) { + group = BUILD_GROUP + setDestinationDir(buildDirectory.dir("docs/${name}-javadoc").get().asFile) + options.encoding = "UTF-8" + options.optionFiles(project.rootProject.file("javadoc-options.txt")) + + for (set in sourceSetSet) { + source(set.allJava) + classpath += set.compileClasspath + } + excludeDuplicatePackageInfos(this) + } + val javadocJarTask = project.tasks.register("${name}JavadocJar", Jar::class.java) { + dependsOn(javadocTask) + group = BUILD_GROUP + destinationDirectory.set(libs) + archiveClassifier.set(JAVADOC_CLASSIFIER) + + from(javadocTask.map { it.outputs }) + } + + project.tasks.named("assemble").configure { + dependsOn(remapJarTask, remapSourcesTask, javadocJarTask) + } + + return JarTaskSet(project, name, jarTask, remapJarTask, sourcesTask, remapSourcesTask, javadocJarTask) + } + } +} diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/GeneratePackageInfosTask.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/GeneratePackageInfosTask.kt new file mode 100644 index 000000000..fbe7698cb --- /dev/null +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/GeneratePackageInfosTask.kt @@ -0,0 +1,58 @@ +package com.jozufozu.gradle.nullability + +import org.apache.groovy.nio.extensions.NioExtensions +import org.codehaus.groovy.runtime.StringGroovyMethods +import org.gradle.api.DefaultTask +import org.gradle.api.file.DirectoryProperty +import org.gradle.api.tasks.InputDirectory +import org.gradle.api.tasks.OutputDirectory +import org.gradle.api.tasks.SkipWhenEmpty +import org.gradle.api.tasks.TaskAction +import org.gradle.kotlin.dsl.closureOf +import java.io.BufferedWriter +import java.io.File +import java.nio.file.Files +import java.nio.file.Path + +// Adapted from https://github.com/FabricMC/fabric/blob/31787236d242247e0b6c4ae806b1cfaa7042a62c/gradle/package-info.gradle, which is licensed under Apache 2.0. +open class GeneratePackageInfosTask: DefaultTask() { + @SkipWhenEmpty + @InputDirectory + val sourceRoot: DirectoryProperty = project.objects.directoryProperty() + + @OutputDirectory + val outputDir: DirectoryProperty = project.objects.directoryProperty() + + @TaskAction + fun run() { + val output = outputDir.get().asFile.toPath() + NioExtensions.deleteDir(output) + val root = sourceRoot.get().asFile.toPath() + + NioExtensions.eachDirRecurse(root, closureOf { + val containsJava = Files.list(this).anyMatch { + Files.isRegularFile(it) && it.fileName.toString().endsWith(".java") + } + + if (containsJava && Files.notExists(resolve("package-info.java"))) { + val relativePath = root.relativize(this) + val target = output.resolve(relativePath) + Files.createDirectories(target) + + NioExtensions.withWriter(target.resolve("package-info.java"), closureOf { + val packageName = relativePath.toString().replace(File.separator, ".") + write(StringGroovyMethods.stripMargin("""@ParametersAreNonnullByDefault + |@FieldsAreNonnullByDefault + |@MethodsReturnNonnullByDefault + |package $packageName; + | + |import javax.annotation.ParametersAreNonnullByDefault; + | + |import net.minecraft.FieldsAreNonnullByDefault; + |import net.minecraft.MethodsReturnNonnullByDefault; + |""")) + }) + } + }) + } +} diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosExtension.kt new file mode 100644 index 000000000..b32783ef9 --- /dev/null +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosExtension.kt @@ -0,0 +1,42 @@ +package com.jozufozu.gradle.nullability + +import org.gradle.api.Project +import org.gradle.api.tasks.Delete +import org.gradle.api.tasks.SourceSet + +open class PackageInfosExtension(private val project: Project) { + fun forSourceSets(vararg sourceSets: SourceSet) { + for (sourceSet in sourceSets) { + forSourceSet(sourceSet) + } + } + + private fun forSourceSet(sourceSet: SourceSet) { + // We have to capture the source set name for the lazy string literals, + // otherwise it'll just be whatever the last source set is in the list. + val sourceSetName = sourceSet.name + val taskName = sourceSet.getTaskName("generate", "PackageInfos") + val task = project.tasks.register(taskName, GeneratePackageInfosTask::class.java) { + group = "flywheel" + description = "Generates package-info files for $sourceSetName packages." + + // Only apply to default source directory since we also add the generated + // sources to the source set. + sourceRoot.set(project.file("src/$sourceSetName/java")) + outputDir.set(project.file("src/$sourceSetName/generatedPackageInfos")) + } + sourceSet.java.srcDir(task) + + project.tasks.named("ideaSyncTask").configure { + finalizedBy(task) + } + + val cleanTask = project.tasks.register(sourceSet.getTaskName("clean", "PackageInfos"), Delete::class.java) { + group = "flywheel" + delete(project.file("src/$sourceSetName/generatedPackageInfos")) + } + project.tasks.named("clean").configure { + dependsOn(cleanTask) + } + } +} diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosPlugin.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosPlugin.kt new file mode 100644 index 000000000..8c50240f0 --- /dev/null +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosPlugin.kt @@ -0,0 +1,10 @@ +package com.jozufozu.gradle.nullability + +import org.gradle.api.Plugin +import org.gradle.api.Project + +class PackageInfosPlugin: Plugin { + override fun apply(target: Project) { + target.extensions.create("defaultPackageInfos", PackageInfosExtension::class.java, target) + } +} diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetConfigurator.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetConfigurator.kt similarity index 96% rename from buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetConfigurator.kt rename to buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetConfigurator.kt index f105246da..f91dc56a4 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetConfigurator.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetConfigurator.kt @@ -1,4 +1,4 @@ -package com.jozufozu.gradle +package com.jozufozu.gradle.transitive import org.gradle.api.tasks.SourceSet diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetsExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsExtension.kt similarity index 98% rename from buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetsExtension.kt rename to buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsExtension.kt index 817c9d93b..020234cc5 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetsExtension.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsExtension.kt @@ -1,4 +1,4 @@ -package com.jozufozu.gradle +package com.jozufozu.gradle.transitive import org.gradle.api.Action import org.gradle.api.Project diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetsPlugin.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsPlugin.kt similarity index 87% rename from buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetsPlugin.kt rename to buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsPlugin.kt index 2f00416a8..8eb33eec6 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/TransitiveSourceSetsPlugin.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsPlugin.kt @@ -1,4 +1,4 @@ -package com.jozufozu.gradle +package com.jozufozu.gradle.transitive import org.gradle.api.Plugin import org.gradle.api.Project From 45a5ca637275297415e8ed9d82d6def31a8587ca Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Mon, 29 Apr 2024 17:01:18 -0700 Subject: [PATCH 43/62] Declaration of jar - Expose desired behaviors from platform plugin via an extension - Move PlatformPlugin to platform package --- buildSrc/build.gradle.kts | 2 +- .../com/jozufozu/gradle/PlatformPlugin.kt | 115 ------------ .../nullability/PackageInfosExtension.kt | 2 +- .../gradle/platform/PlatformExtension.kt | 164 ++++++++++++++++++ .../gradle/platform/PlatformPlugin.kt | 10 ++ common/build.gradle | 18 +- fabric/build.gradle | 39 ++--- forge/build.gradle | 37 ++-- 8 files changed, 206 insertions(+), 181 deletions(-) delete mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/PlatformPlugin.kt create mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt create mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformPlugin.kt diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 6c37d9e49..070b9c27d 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -22,7 +22,7 @@ gradlePlugin { plugins { create("platformPlugin") { id = "flywheel.platform" - implementationClass = "com.jozufozu.gradle.PlatformPlugin" + implementationClass = "com.jozufozu.gradle.platform.PlatformPlugin" } create("jarSetPlugin") { id = "flywheel.jar-sets" diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/PlatformPlugin.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/PlatformPlugin.kt deleted file mode 100644 index eaa51344e..000000000 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/PlatformPlugin.kt +++ /dev/null @@ -1,115 +0,0 @@ -package com.jozufozu.gradle - -import com.jozufozu.gradle.jarset.JarTaskSet -import net.fabricmc.loom.api.LoomGradleExtensionAPI -import net.fabricmc.loom.task.RemapJarTask -import net.fabricmc.loom.task.RemapSourcesJarTask -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.publish.PublishingExtension -import org.gradle.api.publish.maven.MavenPublication -import org.gradle.api.tasks.SourceSet -import org.gradle.api.tasks.SourceSetContainer -import org.gradle.api.tasks.compile.JavaCompile -import org.gradle.api.tasks.javadoc.Javadoc -import org.gradle.jvm.tasks.Jar -import org.gradle.kotlin.dsl.the -import org.gradle.language.jvm.tasks.ProcessResources - -class PlatformPlugin: Plugin { - override fun apply(project: Project) { - val commonProject = project.project(":common") - val commonSourceSets = commonProject.the() - - val sourceSets = project.the() - val loom = project.the() - val publishing = project.the() - - val platformImpl = sourceSets.named("main").get() - val platformApi = sourceSets.create("api") - val platformLib = sourceSets.create("lib") - val platformBackend = sourceSets.create("backend") - - // This is needed for both platforms. - val mainMod = loom.mods.maybeCreate("main") - mainMod.sourceSet(platformApi) - mainMod.sourceSet(platformLib) - mainMod.sourceSet(platformBackend) - mainMod.sourceSet(platformImpl) - - val commonApi = commonSourceSets.named("api").get() - val commonLib = commonSourceSets.named("lib").get() - val commonBackend = commonSourceSets.named("backend").get() - val commonImpl = commonSourceSets.named("main").get() - - val commonSources = listOf(commonApi, commonLib, commonBackend, commonImpl) - - // Directly compile the platform sources with the common sources - includeFromCommon(project, platformApi, commonApi) - includeFromCommon(project, platformLib, commonLib) - includeFromCommon(project, platformBackend, commonBackend) - includeFromCommon(project, platformImpl, commonImpl) - - val tasks = project.tasks - - tasks.withType(JavaCompile::class.java).configureEach { - JarTaskSet.excludeDuplicatePackageInfos(this) - } - - tasks.named("jar", Jar::class.java).configure { - from(platformApi.output, platformLib.output, platformBackend.output) - - JarTaskSet.excludeDuplicatePackageInfos(this) - } - - tasks.named("javadoc", Javadoc::class.java).configure { - commonSources.forEach { source(it.allJava) } - - source(platformApi.allJava, platformLib.allJava, platformBackend.allJava) - - JarTaskSet.excludeDuplicatePackageInfos(this) - } - - tasks.named("sourcesJar", Jar::class.java).configure { - commonSources.forEach { from(it.allJava) } - - from(platformApi.allJava, platformLib.allJava, platformBackend.allJava) - - JarTaskSet.excludeDuplicatePackageInfos(this) - } - - val remapJar = tasks.named("remapJar", RemapJarTask::class.java) - val remapSourcesJar = tasks.named("remapSourcesJar", RemapSourcesJarTask::class.java) - val javadocJar = tasks.named("javadocJar", Jar::class.java) - - val apiSet = JarTaskSet.create(project, "api", platformApi, platformLib) - - val mcVersion = project.property("artifact_minecraft_version") - - publishing.publications { - // we should be using remapped on both Fabric and Forge because Forge needs to put things in srg - register("mavenApi", MavenPublication::class.java) { - artifact(apiSet.remapJar) - artifact(apiSet.remapSources) - artifact(apiSet.javadocJar) - artifactId = "flywheel-${project.name}-api-${mcVersion}" - } - register("mavenImpl", MavenPublication::class.java) { - artifact(remapJar) - artifact(remapSourcesJar) - artifact(javadocJar) - artifactId = "flywheel-${project.name}-${mcVersion}" - } - } - } - - private fun includeFromCommon(project: Project, sourceSet: SourceSet, commonSourceSet: SourceSet) { - project.tasks.named(sourceSet.compileJavaTaskName, JavaCompile::class.java).configure { - source(commonSourceSet.allJava) - } - - project.tasks.named(sourceSet.processResourcesTaskName, ProcessResources::class.java).configure { - from(commonSourceSet.resources) - } - } -} diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosExtension.kt index b32783ef9..e4bae3acf 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosExtension.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosExtension.kt @@ -5,7 +5,7 @@ import org.gradle.api.tasks.Delete import org.gradle.api.tasks.SourceSet open class PackageInfosExtension(private val project: Project) { - fun forSourceSets(vararg sourceSets: SourceSet) { + fun sources(vararg sourceSets: SourceSet) { for (sourceSet in sourceSets) { forSourceSet(sourceSet) } diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt new file mode 100644 index 000000000..36fb6a127 --- /dev/null +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt @@ -0,0 +1,164 @@ +package com.jozufozu.gradle.platform + +import com.jozufozu.gradle.jarset.JarTaskSet +import net.fabricmc.loom.api.LoomGradleExtensionAPI +import net.fabricmc.loom.task.RemapJarTask +import net.fabricmc.loom.task.RemapSourcesJarTask +import org.gradle.api.Project +import org.gradle.api.publish.PublishingExtension +import org.gradle.api.publish.maven.MavenPublication +import org.gradle.api.tasks.SourceSet +import org.gradle.api.tasks.SourceSetContainer +import org.gradle.api.tasks.compile.JavaCompile +import org.gradle.api.tasks.javadoc.Javadoc +import org.gradle.jvm.tasks.Jar +import org.gradle.kotlin.dsl.provideDelegate +import org.gradle.kotlin.dsl.the +import org.gradle.language.jvm.tasks.ProcessResources +import kotlin.properties.ReadWriteProperty +import kotlin.reflect.KProperty + +open class PlatformExtension(val project: Project) { + var commonProject: Project by DependentProject(this.project) + + var modArtifactId: String = "flywheel-${project.name}-${project.property("artifact_minecraft_version")}" + + var apiArtifactId: String = "flywheel-${project.name}-api-${project.property("artifact_minecraft_version")}" + + private val sources = mutableSetOf() + private val commonSourceSets: SourceSetContainer by lazy { commonProject.the() } + + fun sources(vararg sourceSets: SourceSet) { + this.sources.addAll(sourceSets) + } + + fun setupLoomMod() { + project.the().mods.maybeCreate("main").apply { + sources.forEach(::sourceSet) + } + } + + fun setupLoomRuns() { + project.the().runs.apply { + named("client") { + isIdeConfigGenerated = true + + // Turn on our own debug flags + property("flw.dumpShaderSource", "true") + property("flw.debugMemorySafety", "true") + + // Turn on mixin debug flags + property("mixin.debug.export", "true") + property("mixin.debug.verbose", "true") + + // 720p baby! + programArgs("--width", "1280", "--height", "720") + } + + // We're a client mod, but we need to make sure we correctly render when playing on a server. + named("server") { + isIdeConfigGenerated = true + programArgs("--nogui") + } + } + } + + fun compileWithCommonSourceSets() { + project.tasks.apply { + withType(JavaCompile::class.java).configureEach { + JarTaskSet.excludeDuplicatePackageInfos(this) + } + + sources.forEach { + val commonSourceSet = commonSourceSets.named(it.name).get() + + named(it.compileJavaTaskName, JavaCompile::class.java).configure { + source(commonSourceSet.allJava) + } + named(it.processResourcesTaskName, ProcessResources::class.java).configure { + from(commonSourceSet.resources) + } + } + } + } + + fun setupFatJar() { + project.tasks.apply { + val extraSourceSets = sources.filter { it.name != "main" }.toList() + val commonSources = sources.map { commonSourceSets.named(it.name).get() } + + named("jar", Jar::class.java).configure { + extraSourceSets.forEach { from(it.output) } + + JarTaskSet.excludeDuplicatePackageInfos(this) + } + + named("javadoc", Javadoc::class.java).configure { + commonSources.forEach { source(it.allJava) } + extraSourceSets.forEach { source(it.allJava) } + + JarTaskSet.excludeDuplicatePackageInfos(this) + } + + named("sourcesJar", Jar::class.java).configure { + commonSources.forEach { from(it.allJava) } + extraSourceSets.forEach { from(it.allJava) } + + JarTaskSet.excludeDuplicatePackageInfos(this) + } + } + } + + fun publishMod() { + val remapJar = project.tasks.named("remapJar", RemapJarTask::class.java) + val remapSourcesJar = project.tasks.named("remapSourcesJar", RemapSourcesJarTask::class.java) + val javadocJar = project.tasks.named("javadocJar", Jar::class.java) + + project.the().publications { + register("modMaven", MavenPublication::class.java) { + artifact(remapJar) + artifact(remapSourcesJar) + artifact(javadocJar) + artifactId = modArtifactId + } + } + } + + fun publishRemap(artifactId: String, jarSet: JarTaskSet) { + project.the().publications { + register("${jarSet.name}RemapMaven", MavenPublication::class.java) { + artifact(jarSet.remapJar) + artifact(jarSet.remapSources) + artifact(jarSet.javadocJar) + this.artifactId = artifactId + } + } + } + + fun publish(artifactId: String, jarSet: JarTaskSet) { + project.the().publications { + register("${jarSet.name}Maven", MavenPublication::class.java) { + artifact(jarSet.jar) + artifact(jarSet.sources) + artifact(jarSet.javadocJar) + this.artifactId = artifactId + } + } + } + + private class DependentProject(private val thisProject: Project) : ReadWriteProperty { + private var value: Project? = null + + override fun getValue(thisRef: Any?, property: KProperty<*>): Project { + return value ?: throw IllegalStateException("Property ${property.name} should be initialized before get.") + } + + override fun setValue(thisRef: Any?, property: KProperty<*>, value: Project) { + this.value = value + thisProject.evaluationDependsOn(value.path) + } + + override fun toString(): String = + "NotNullProperty(${if (value != null) "value=$value" else "value not initialized yet"})" + } +} diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformPlugin.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformPlugin.kt new file mode 100644 index 000000000..e3284c103 --- /dev/null +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformPlugin.kt @@ -0,0 +1,10 @@ +package com.jozufozu.gradle.platform + +import org.gradle.api.Plugin +import org.gradle.api.Project + +class PlatformPlugin: Plugin { + override fun apply(project: Project) { + project.extensions.create("platform", PlatformExtension::class.java) + } +} diff --git a/common/build.gradle b/common/build.gradle index b407c7258..8ac5231cb 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -33,23 +33,15 @@ transitiveSourceSets { } defaultPackageInfos { - forSourceSets sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main + sources sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main } // For sharing with other subprojects. jarSets { - createJars('apiOnly', sourceSets.api).configure { - it.createOutgoingConfiguration('common') - } - createJars('lib').configure { - it.createOutgoingConfiguration('common') - } - createJars('backend').configure { - it.createOutgoingConfiguration('common') - } - createJars('impl', sourceSets.main).configure { - it.createOutgoingConfiguration('common') - } + createJars('apiOnly', sourceSets.api).createOutgoingConfiguration('common') + createJars('lib').createOutgoingConfiguration('common') + createJars('backend').createOutgoingConfiguration('common') + createJars('impl', sourceSets.main).createOutgoingConfiguration('common') } // For publishing diff --git a/fabric/build.gradle b/fabric/build.gradle index 53483d51f..7b3fbb111 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -7,11 +7,10 @@ plugins { id 'flywheel.package-infos' id 'flywheel.subproject' id 'flywheel.platform' + id 'flywheel.jar-sets' id 'flywheel.transitive-source-sets' } -evaluationDependsOn(':common') - transitiveSourceSets { compileClasspath = sourceSets.main.compileClasspath @@ -33,33 +32,19 @@ transitiveSourceSets { createCompileConfigurations() } -defaultPackageInfos { - forSourceSets sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main +platform { + commonProject = project(':common') + sources sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main + compileWithCommonSourceSets() + setupLoomMod() + setupLoomRuns() + setupFatJar() + publishMod() + publishRemap(apiArtifactId, jarSets.createJars('api', sourceSets.api, sourceSets.lib)) } -loom { - runs { - client { - ideConfigGenerated true - - // Turn on our own debug flags - property 'flw.dumpShaderSource', 'true' - property 'flw.debugMemorySafety', 'true' - - // Turn on mixin debug flags - property 'mixin.debug.export', 'true' - property 'mixin.debug.verbose', 'true' - - // 720p baby! - programArgs '--width', '1280', '--height', '720' - } - - // We're a client mod, but we need to make sure we correctly render when playing on a server. - server { - ideConfigGenerated true - programArgs '--nogui' - } - } +defaultPackageInfos { + sources sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main } dependencies { diff --git a/forge/build.gradle b/forge/build.gradle index 995477e64..04ec7eab4 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -7,11 +7,10 @@ plugins { id 'flywheel.package-infos' id 'flywheel.subproject' id 'flywheel.platform' + id 'flywheel.jar-sets' id 'flywheel.transitive-source-sets' } -evaluationDependsOn(':common') - transitiveSourceSets { compileClasspath = sourceSets.main.compileClasspath @@ -33,8 +32,19 @@ transitiveSourceSets { createCompileConfigurations() } +platform { + commonProject = project(':common') + sources sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main + compileWithCommonSourceSets() + setupLoomMod() + setupLoomRuns() + setupFatJar() + publishMod() + publishRemap(apiArtifactId, jarSets.createJars('api', sourceSets.api, sourceSets.lib)) +} + defaultPackageInfos { - forSourceSets sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main + sources sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main } loom { @@ -49,27 +59,6 @@ loom { property 'forge.logging.markers', '' property 'forge.logging.console.level', 'debug' } - - client { - ideConfigGenerated true - - // Turn on our own debug flags - property 'flw.dumpShaderSource', 'true' - property 'flw.debugMemorySafety', 'true' - - // Turn on mixin debug flags - property 'mixin.debug.export', 'true' - property 'mixin.debug.verbose', 'true' - - // 720p baby! - programArgs '--width', '1280', '--height', '720' - } - - // We're a client mod, but we need to make sure we correctly render when playing on a server. - server { - ideConfigGenerated true - programArgs '--nogui' - } } } From 71d56adb3d9bc65ef08275fb8cdbe4cca8a01e30 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Mon, 29 Apr 2024 23:52:59 -0700 Subject: [PATCH 44/62] Willing and able - Refine capabilities checks - To compile with glsl 150: - Instancing needs ARB_shader_bit_encoding - Indirect needs gpu_shader5 and shading_language_420pack - Require extensions instead of just enable, probably doesn't make a difference since we check for their presence first but require aligns with our intent better --- .../backend/compile/IndirectPrograms.java | 14 ++++++++++---- .../backend/compile/InstancingPrograms.java | 14 +++++++++++++- .../backend/compile/PipelineCompiler.java | 8 ++------ .../backend/compile/core/Compilation.java | 6 ++++++ .../flywheel/backend/compile/core/Compile.java | 8 ++++++++ .../jozufozu/flywheel/backend/gl/GlCompat.java | 15 +++++++-------- 6 files changed, 46 insertions(+), 19 deletions(-) diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java index 3806b07d7..ff3683f96 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java @@ -54,6 +54,12 @@ private IndirectPrograms(Map pipeline, Map getExtensions(GlslVersion glslVersion) { List extensions = new ArrayList<>(); + if (glslVersion.compareTo(GlslVersion.V400) < 0) { + extensions.add("GL_ARB_gpu_shader5"); + } + if (glslVersion.compareTo(GlslVersion.V420) < 0) { + extensions.add("GL_ARB_shading_language_420pack"); + } if (glslVersion.compareTo(GlslVersion.V430) < 0) { extensions.add("GL_ARB_shader_storage_buffer_object"); } @@ -105,8 +111,8 @@ private static CompilationHarness> createCullingCompiler(ShaderS return CULL.program() .link(CULL.shader(GlCompat.MAX_GLSL_VERSION, ShaderType.COMPUTE) .nameMapper(instanceType -> "culling/" + ResourceUtil.toDebugFileNameNoExtension(instanceType.cullShader())) - .enableExtensions(EXTENSIONS) - .enableExtensions(COMPUTE_EXTENSIONS) + .requireExtensions(EXTENSIONS) + .requireExtensions(COMPUTE_EXTENSIONS) .define("_FLW_SUBGROUP_SIZE", GlCompat.SUBGROUP_SIZE) .withResource(CULL_SHADER_API_IMPL) .withComponent(InstanceStructComponent::new) @@ -127,8 +133,8 @@ private static CompilationHarness createUtilCompiler(ShaderSou return UTIL.program() .link(UTIL.shader(GlCompat.MAX_GLSL_VERSION, ShaderType.COMPUTE) .nameMapper(resourceLocation -> "utilities/" + ResourceUtil.toDebugFileNameNoExtension(resourceLocation)) - .enableExtensions(EXTENSIONS) - .enableExtensions(COMPUTE_EXTENSIONS) + .requireExtensions(EXTENSIONS) + .requireExtensions(COMPUTE_EXTENSIONS) .define("_FLW_SUBGROUP_SIZE", GlCompat.SUBGROUP_SIZE) .withResource(s -> s)) .harness("utilities", sources); diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java index 8109f872c..c2320af3b 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java @@ -1,5 +1,6 @@ package com.jozufozu.flywheel.backend.compile; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -9,11 +10,14 @@ import com.jozufozu.flywheel.api.instance.InstanceType; import com.jozufozu.flywheel.backend.gl.GlCompat; import com.jozufozu.flywheel.backend.gl.shader.GlProgram; +import com.jozufozu.flywheel.backend.glsl.GlslVersion; import com.jozufozu.flywheel.backend.glsl.ShaderSources; import com.jozufozu.flywheel.backend.glsl.SourceComponent; import com.jozufozu.flywheel.backend.util.AtomicReferenceCounted; public class InstancingPrograms extends AtomicReferenceCounted { + private static final List EXTENSIONS = getExtensions(GlCompat.MAX_GLSL_VERSION); + @Nullable private static InstancingPrograms instance; @@ -23,6 +27,14 @@ private InstancingPrograms(Map pipeline) { this.pipeline = pipeline; } + private static List getExtensions(GlslVersion glslVersion) { + List extensions = new ArrayList<>(); + if (glslVersion.compareTo(GlslVersion.V330) < 0) { + extensions.add("GL_ARB_shader_bit_encoding"); + } + return extensions; + } + static void reload(ShaderSources sources, ImmutableList pipelineKeys, List vertexComponents, List fragmentComponents) { if (!GlCompat.SUPPORTS_INSTANCING) { return; @@ -30,7 +42,7 @@ static void reload(ShaderSources sources, ImmutableList pipe InstancingPrograms newInstance = null; - var pipelineCompiler = PipelineCompiler.create(sources, Pipelines.INSTANCING, vertexComponents, fragmentComponents); + var pipelineCompiler = PipelineCompiler.create(sources, Pipelines.INSTANCING, vertexComponents, fragmentComponents, EXTENSIONS); try { var pipelineResult = pipelineCompiler.compileAndReportErrors(pipelineKeys); diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java index a7dc27e3a..c969674ef 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java @@ -37,7 +37,7 @@ static CompilationHarness create(ShaderSources sources, Pipe .nameLowerCase(); return "pipeline/" + pipeline.compilerMarker() + "/" + instance + "_" + context; }) - .enableExtensions(extensions) + .requireExtensions(extensions) .onCompile((key, comp) -> key.contextShader() .onCompile(comp)) .withResource(API_IMPL_VERT) @@ -55,7 +55,7 @@ static CompilationHarness create(ShaderSources sources, Pipe .nameLowerCase(); return "pipeline/" + pipeline.compilerMarker() + "/" + context; }) - .enableExtensions(extensions) + .requireExtensions(extensions) .enableExtension("GL_ARB_conservative_depth") .onCompile((key, comp) -> key.contextShader() .onCompile(comp)) @@ -91,8 +91,4 @@ static CompilationHarness create(ShaderSources sources, Pipe }) .harness(pipeline.compilerMarker(), sources); } - - static CompilationHarness create(ShaderSources sources, Pipeline pipeline, List vertexComponents, List fragmentComponents) { - return create(sources, pipeline, vertexComponents, fragmentComponents, Collections.emptyList()); - } } diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java index 3fea1ffb7..7ab8db17f 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java @@ -64,6 +64,12 @@ public void enableExtension(String ext) { .append(" : enable\n"); } + public void requireExtension(String ext) { + fullSource.append("#extension ") + .append(ext) + .append(" : require\n"); + } + public void define(String key, String value) { fullSource.append("#define ") .append(key) diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compile.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compile.java index b74b71ff0..7642adb37 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compile.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compile.java @@ -113,6 +113,14 @@ public ShaderCompiler enableExtensions(Collection extensions) { }); } + public ShaderCompiler requireExtensions(Collection extensions) { + return onCompile(($, ctx) -> { + for (String extension : extensions) { + ctx.requireExtension(extension); + } + }); + } + @Nullable private GlShader compile(K key, ShaderCache compiler, SourceLoader loader) { var components = new ArrayList(); diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java index fcf56a471..a7fa5c58f 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java @@ -111,25 +111,24 @@ private static GlslVersion maxGlslVersion() { } private static boolean isInstancingSupported() { - if (!CAPABILITIES.OpenGL33) { - return false; + if (CAPABILITIES.OpenGL33) { + return true; } - return true; + return CAPABILITIES.GL_ARB_shader_bit_encoding; } private static boolean isIndirectSupported() { - // The GL requirement cannot be lower because GL_ARB_compute_shader requires at least GL 4.2. - if (!CAPABILITIES.OpenGL42) { - return false; - } if (CAPABILITIES.OpenGL46) { return true; } return CAPABILITIES.GL_ARB_compute_shader && CAPABILITIES.GL_ARB_direct_state_access + && CAPABILITIES.GL_ARB_gpu_shader5 && CAPABILITIES.GL_ARB_multi_bind && CAPABILITIES.GL_ARB_multi_draw_indirect && CAPABILITIES.GL_ARB_shader_draw_parameters - && CAPABILITIES.GL_ARB_shader_storage_buffer_object; + && CAPABILITIES.GL_ARB_shader_storage_buffer_object + && CAPABILITIES.GL_ARB_shading_language_420pack + && CAPABILITIES.GL_ARB_vertex_attrib_binding; } } From cfa7fcc6f5bc478d1ebeea81069d96b9d04dfa95 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Thu, 2 May 2024 12:59:03 -0700 Subject: [PATCH 45/62] Shaders and ladders - Compile with progressively lower glsl versions to test which are available. - Properly returns 460 on my machine even with a gl version of 320 - Remove glsl enums below 150 --- .../backend/compile/core/Compilation.java | 2 +- .../flywheel/backend/gl/GlCompat.java | 62 ++++++++++++------- .../flywheel/backend/glsl/GlslVersion.java | 4 -- 3 files changed, 41 insertions(+), 27 deletions(-) diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java index 7ab8db17f..d61c49133 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/Compilation.java @@ -134,7 +134,7 @@ private static void dumpSource(String source, String fileName) { } } - private static boolean compiledSuccessfully(int handle) { + public static boolean compiledSuccessfully(int handle) { return GL20.glGetShaderi(handle, GL20.GL_COMPILE_STATUS) == GL20.GL_TRUE; } } diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java index a7fa5c58f..3fa3c54a1 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java @@ -4,12 +4,14 @@ import org.lwjgl.PointerBuffer; import org.lwjgl.opengl.GL; +import org.lwjgl.opengl.GL20; import org.lwjgl.opengl.GL20C; import org.lwjgl.opengl.GL31C; import org.lwjgl.opengl.GLCapabilities; import org.lwjgl.opengl.KHRShaderSubgroup; import org.lwjgl.system.MemoryStack; +import com.jozufozu.flywheel.backend.compile.core.Compilation; import com.jozufozu.flywheel.backend.glsl.GlslVersion; import com.jozufozu.flywheel.lib.math.MoreMath; @@ -88,28 +90,6 @@ private static int subgroupSize() { return DRIVER == Driver.AMD || DRIVER == Driver.MESA ? 64 : 32; } - private static GlslVersion maxGlslVersion() { - if (CAPABILITIES.OpenGL46) { - return GlslVersion.V460; - } else if (CAPABILITIES.OpenGL45) { - return GlslVersion.V450; - } else if (CAPABILITIES.OpenGL44) { - return GlslVersion.V440; - } else if (CAPABILITIES.OpenGL43) { - return GlslVersion.V430; - } else if (CAPABILITIES.OpenGL42) { - return GlslVersion.V420; - } else if (CAPABILITIES.OpenGL41) { - return GlslVersion.V410; - } else if (CAPABILITIES.OpenGL40) { - return GlslVersion.V400; - } else if (CAPABILITIES.OpenGL33) { - return GlslVersion.V330; - } else { - return GlslVersion.V150; - } - } - private static boolean isInstancingSupported() { if (CAPABILITIES.OpenGL33) { return true; @@ -131,4 +111,42 @@ private static boolean isIndirectSupported() { && CAPABILITIES.GL_ARB_shading_language_420pack && CAPABILITIES.GL_ARB_vertex_attrib_binding; } + + /** + * Try to compile a shader with progressively lower glsl versions. + * The first version to compile successfully is returned. + * @return The highest glsl version that could be compiled. + */ + private static GlslVersion maxGlslVersion() { + var glslVersions = GlslVersion.values(); + // No need to test glsl 150 as that is guaranteed to be supported by MC. + for (int i = glslVersions.length - 1; i > 0; i--) { + var version = glslVersions[i]; + + if (canCompileVersion(version)) { + return version; + } + } + + return GlslVersion.V150; + } + + private static boolean canCompileVersion(GlslVersion version) { + int handle = GL20.glCreateShader(GL20.GL_VERTEX_SHADER); + + // Compile the simplest possible shader. + var source = """ + #version %d + void main() {} + """.formatted(version.version); + + safeShaderSource(handle, source); + GL20.glCompileShader(handle); + + boolean success = Compilation.compiledSuccessfully(handle); + + GL20.glDeleteShader(handle); + + return success; + } } diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/GlslVersion.java b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/GlslVersion.java index e12d29bd5..11453eb07 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/GlslVersion.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/glsl/GlslVersion.java @@ -1,10 +1,6 @@ package com.jozufozu.flywheel.backend.glsl; public enum GlslVersion { - V110(110), - V120(120), - V130(130), - V140(140), V150(150), V330(330), V400(400), From bc9f515bea0e3fa2b22905a34fa00f873f710b79 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Fri, 3 May 2024 15:54:23 -0700 Subject: [PATCH 46/62] All your script are belong to us - Port java/subproject convention plugins to kotlin binary plugin - Fix licence bundling in jars - Update licence year --- LICENSE.md | 2 +- buildSrc/build.gradle.kts | 5 +- buildSrc/src/main/groovy/flywheel.java.gradle | 54 ------ .../main/groovy/flywheel.subproject.gradle | 76 -------- .../gradle/subproject/SubprojectPlugin.kt | 182 ++++++++++++++++++ common/build.gradle | 1 - fabric/build.gradle | 1 - forge/build.gradle | 1 - 8 files changed, 187 insertions(+), 135 deletions(-) delete mode 100644 buildSrc/src/main/groovy/flywheel.java.gradle delete mode 100644 buildSrc/src/main/groovy/flywheel.subproject.gradle create mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt diff --git a/LICENSE.md b/LICENSE.md index 518a2732c..af23f9c4b 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2021-2023 Jozufozu +Copyright (c) 2021-2024 Jozufozu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 070b9c27d..335241b39 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,5 +1,4 @@ plugins { - id("groovy-gradle-plugin") id("java-gradle-plugin") kotlin("jvm") version "1.9.20" `kotlin-dsl` @@ -36,6 +35,10 @@ gradlePlugin { id = "flywheel.transitive-source-sets" implementationClass = "com.jozufozu.gradle.transitive.TransitiveSourceSetsPlugin" } + create("subprojectPlugin") { + id = "flywheel.subproject" + implementationClass = "com.jozufozu.gradle.subproject.SubprojectPlugin" + } } } diff --git a/buildSrc/src/main/groovy/flywheel.java.gradle b/buildSrc/src/main/groovy/flywheel.java.gradle deleted file mode 100644 index 876f16869..000000000 --- a/buildSrc/src/main/groovy/flywheel.java.gradle +++ /dev/null @@ -1,54 +0,0 @@ -boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false') -String buildNumber = System.getenv('BUILD_NUMBER') - -group = 'com.jozufozu.flywheel' -version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') - -base { - archivesName = "flywheel-${name}-${artifact_minecraft_version}" -} - -java { - JavaVersion javaVersion = JavaVersion.toVersion(java_version) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - - toolchain.languageVersion = JavaLanguageVersion.of(java_version) - - withSourcesJar() - withJavadocJar() -} - -// make builds reproducible -tasks.withType(AbstractArchiveTask).configureEach { - preserveFileTimestamps = false - reproducibleFileOrder = true -} - -// module metadata is often broken on multi-platform projects -tasks.withType(GenerateModuleMetadata).configureEach { - enabled = false -} - -tasks.withType(JavaCompile).configureEach { JavaCompile javaCompile -> - javaCompile.options.encoding = 'UTF-8' - javaCompile.options.release = Integer.parseInt(java_version) - javaCompile.options.compilerArgs = ['-Xdiags:verbose'] -} - -tasks.withType(Jar).configureEach { Jar jar -> - addLicense(jar) -} - -tasks.named('javadoc', Javadoc).configure { Javadoc javadoc -> - javadoc.source sourceSets.main.allJava - // prevent java 8's strict doclint for javadocs from failing builds - javadoc.options.optionFiles(rootProject.file('javadoc-options.txt')) - javadoc.options.encoding = 'UTF-8' -} - -static void addLicense(Jar jarTask) { - jarTask.from('LICENSE.md') { - rename '(.*)\\.(.*)', '$1_' + jarTask.archiveBaseName + '.$2' - } -} diff --git a/buildSrc/src/main/groovy/flywheel.subproject.gradle b/buildSrc/src/main/groovy/flywheel.subproject.gradle deleted file mode 100644 index d206a8758..000000000 --- a/buildSrc/src/main/groovy/flywheel.subproject.gradle +++ /dev/null @@ -1,76 +0,0 @@ -loom { - silentMojangMappingsLicense() - - mixin { - defaultRefmapName = "flywheel.refmap.json" - } -} - -repositories { - mavenCentral() - maven { - name = 'ParchmentMC' - url = 'https://maven.parchmentmc.org' - } - maven { - name 'tterrag maven' - url 'https://maven.tterrag.com/' - } - maven { - url 'https://www.cursemaven.com' - content { - includeGroup "curse.maven" - } - } - maven { - name = "Modrinth" - url = "https://api.modrinth.com/maven" - content { - includeGroup "maven.modrinth" - } - } -} - -dependencies { - minecraft "com.mojang:minecraft:${minecraft_version}" - mappings(loom.layered() { - officialMojangMappings() - parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") - }) - - api 'com.google.code.findbugs:jsr305:3.0.2' -} - -tasks.withType(ProcessResources).configureEach { - var replaceProperties = [ - mod_id : mod_id, - mod_name : mod_name, - mod_description : mod_description, - mod_license : mod_license, - mod_sources : mod_sources, - mod_issues : mod_issues, - mod_homepage : mod_homepage, - mod_version : mod_version, - minecraft_semver_version_range: minecraft_semver_version_range, - minecraft_maven_version_range : minecraft_maven_version_range, - fabric_api_version_range : fabric_api_version_range, - forge_version_range : forge_version_range, - ] - inputs.properties replaceProperties - - filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml']) { - expand replaceProperties - } -} - -publishing { - repositories { - maven { - url "file://${rootProject.projectDir}/mcmodsrepo" - } - - if (project.hasProperty('mavendir')) { - maven { url rootProject.file(property('mavendir')) } - } - } -} diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt new file mode 100644 index 000000000..02419f11a --- /dev/null +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt @@ -0,0 +1,182 @@ +package com.jozufozu.gradle.subproject + +import net.fabricmc.loom.api.LoomGradleExtensionAPI +import org.gradle.api.JavaVersion +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.plugins.BasePluginExtension +import org.gradle.api.plugins.JavaPluginExtension +import org.gradle.api.publish.PublishingExtension +import org.gradle.api.publish.tasks.GenerateModuleMetadata +import org.gradle.api.tasks.bundling.AbstractArchiveTask +import org.gradle.api.tasks.compile.JavaCompile +import org.gradle.api.tasks.javadoc.Javadoc +import org.gradle.jvm.tasks.Jar +import org.gradle.jvm.toolchain.JavaLanguageVersion +import org.gradle.kotlin.dsl.assign +import org.gradle.kotlin.dsl.maven +import org.gradle.kotlin.dsl.provideDelegate +import org.gradle.kotlin.dsl.the +import org.gradle.language.jvm.tasks.ProcessResources + + +class SubprojectPlugin: Plugin { + override fun apply(project: Project) { + setBaseProperties(project) + setupJava(project) + addRepositories(project) + setupLoom(project) + setupDependencies(project) + configureTasks(project) + setupPublishing(project) + } + + private fun setBaseProperties(project: Project) { + val dev = System.getenv("RELEASE")?.contentEquals("false", true) ?: true + val buildNumber = System.getenv("BUILD_NUMBER") + + val mod_version: String by project + project.group = "com.jozufozu.flywheel" + project.version = mod_version + if (dev && buildNumber != null) "-${buildNumber}" else "" + + val artifact_minecraft_version: String by project + project.the().archivesName = "flywheel-${project.name}-${artifact_minecraft_version}" + } + + @Suppress("UnstableApiUsage") + private fun setupLoom(project: Project) { + val loom = project.the() + loom.silentMojangMappingsLicense() + + loom.mixin.defaultRefmapName = "flywheel.refmap.json" + } + + private fun setupJava(project: Project) { + val java_version: String by project + + project.the().apply { + val javaVersion = JavaVersion.toVersion(java_version) + sourceCompatibility = javaVersion + targetCompatibility = javaVersion + + toolchain.languageVersion = JavaLanguageVersion.of(java_version) + + withSourcesJar() + withJavadocJar() + } + } + + private fun addRepositories(project: Project) { + project.repositories.apply { + mavenCentral() + maven("https://maven.parchmentmc.org") { + name = "ParchmentMC" + } + maven("https://maven.tterrag.com/") { + name = "tterrag maven" + } + maven("https://www.cursemaven.com") { + name = "CurseMaven" + content { + includeGroup("curse.maven") + } + } + maven("https://api.modrinth.com/maven") { + name = "Modrinth" + content { + includeGroup("maven.modrinth") + } + } + } + } + + @Suppress("UnstableApiUsage") + private fun setupDependencies(project: Project) { + project.dependencies.apply { + val minecraft_version: String by project + val parchment_version: String by project + val loom = project.the() + + add("minecraft", "com.mojang:minecraft:${minecraft_version}") + + add("mappings", loom.layered { + officialMojangMappings() + parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") + }) + + add("api", "com.google.code.findbugs:jsr305:3.0.2") + } + } + + private fun configureTasks(project: Project) { + val java_version: String by project + + project.tasks.apply { + // make builds reproducible + withType(AbstractArchiveTask::class.java).configureEach { + isPreserveFileTimestamps = false + isReproducibleFileOrder = true + } + + // module metadata is often broken on multi-platform projects + withType(GenerateModuleMetadata::class.java).configureEach { + enabled = false + } + + withType(JavaCompile::class.java).configureEach { + options.encoding = "UTF-8" + options.release = Integer.parseInt(java_version) + options.compilerArgs.add("-Xdiags:verbose") + } + + withType(Jar::class.java).configureEach { + from("${project.rootDir}/LICENSE.md") { + into("META-INF") + } + } + + withType(Javadoc::class.java).configureEach { + options.optionFiles(project.rootProject.file("javadoc-options.txt")) + options.encoding = "UTF-8" + } + + val replaceProperties = processResourcesExpandProperties.associateWith { project.property(it) as String } + + withType(ProcessResources::class.java).configureEach { + inputs.properties(replaceProperties) + + filesMatching(processResourcesExpandFiles) { + expand(replaceProperties) + } + } + } + } + + private fun setupPublishing(project: Project) { + project.the().repositories.apply { + maven("file://${project.rootProject.projectDir}/mcmodsrepo") + + if (project.hasProperty("mavendir")) { + maven(project.rootProject.file(project.property("mavendir") as String)) + } + } + } +} + +val processResourcesExpandFiles = listOf("pack.mcmeta", "fabric.mod.json", "META-INF/mods.toml") + +val processResourcesExpandProperties = listOf( + "mod_id", + "mod_name", + "mod_description", + "mod_license", + "mod_sources", + "mod_issues", + "mod_homepage", + "mod_version", + "minecraft_semver_version_range", + "minecraft_maven_version_range", + "fabric_api_version_range", + "forge_version_range", +) + diff --git a/common/build.gradle b/common/build.gradle index 8ac5231cb..c2f59a552 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -3,7 +3,6 @@ plugins { id 'java' id 'maven-publish' id 'dev.architectury.loom' - id 'flywheel.java' id 'flywheel.package-infos' id 'flywheel.subproject' id 'flywheel.jar-sets' diff --git a/fabric/build.gradle b/fabric/build.gradle index 7b3fbb111..eda0a1e57 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -3,7 +3,6 @@ plugins { id 'java' id 'maven-publish' id 'dev.architectury.loom' - id 'flywheel.java' id 'flywheel.package-infos' id 'flywheel.subproject' id 'flywheel.platform' diff --git a/forge/build.gradle b/forge/build.gradle index 04ec7eab4..707960030 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -3,7 +3,6 @@ plugins { id 'java' id 'maven-publish' id 'dev.architectury.loom' - id 'flywheel.java' id 'flywheel.package-infos' id 'flywheel.subproject' id 'flywheel.platform' From eed40d9fd3d8bdf9f5d44cb28a345e3506b5589f Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Fri, 3 May 2024 17:35:33 -0700 Subject: [PATCH 47/62] Wait, it's all kotlin? - Port to kotlin gradle --- build.gradle | 16 --- build.gradle.kts | 15 +++ buildSrc/build.gradle.kts | 2 +- common/build.gradle | 74 -------------- common/build.gradle.kts | 79 +++++++++++++++ fabric/build.gradle | 60 ----------- fabric/build.gradle.kts | 65 ++++++++++++ forge/build.gradle | 74 -------------- forge/build.gradle.kts | 79 +++++++++++++++ old.build.gradle | 205 -------------------------------------- settings.gradle | 26 ----- settings.gradle.kts | 25 +++++ 12 files changed, 264 insertions(+), 456 deletions(-) delete mode 100644 build.gradle create mode 100644 build.gradle.kts delete mode 100644 common/build.gradle create mode 100644 common/build.gradle.kts delete mode 100644 fabric/build.gradle create mode 100644 fabric/build.gradle.kts delete mode 100644 forge/build.gradle create mode 100644 forge/build.gradle.kts delete mode 100644 old.build.gradle delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 30891b8f7..000000000 --- a/build.gradle +++ /dev/null @@ -1,16 +0,0 @@ -plugins { - id 'idea' - id 'java' - id 'maven-publish' - id 'dev.architectury.loom' apply false -} - -println("Java: ${System.getProperty('java.version')}, JVM: ${System.getProperty('java.vm.version')} (${System.getProperty('java.vendor')}), Arch: ${System.getProperty('os.arch')}") - -idea { - // Tell IDEA to always download sources/javadoc artifacts from maven. - module { - downloadJavadoc = true - downloadSources = true - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 000000000..8704c07bc --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + idea + java + id("dev.architectury.loom") apply false +} + +println("Java: ${System.getProperty("java.version")}, JVM: ${System.getProperty("java.vm.version")} (${System.getProperty("java.vendor")}), Arch: ${System.getProperty("os.arch")}") + +idea { + // Tell IDEA to always download sources/javadoc artifacts from maven. + module { + isDownloadJavadoc = true + isDownloadSources = true + } +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 335241b39..885339096 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("java-gradle-plugin") - kotlin("jvm") version "1.9.20" + kotlin("jvm") version "1.9.23" `kotlin-dsl` } diff --git a/common/build.gradle b/common/build.gradle deleted file mode 100644 index c2f59a552..000000000 --- a/common/build.gradle +++ /dev/null @@ -1,74 +0,0 @@ -plugins { - id 'idea' - id 'java' - id 'maven-publish' - id 'dev.architectury.loom' - id 'flywheel.package-infos' - id 'flywheel.subproject' - id 'flywheel.jar-sets' - id 'flywheel.transitive-source-sets' -} - -transitiveSourceSets { - compileClasspath = sourceSets.main.compileClasspath - - create('api') { - rootCompile() - } - create('lib') { - rootCompile() - compile sourceSets.api - } - create('backend') { - rootCompile() - compile sourceSets.api, sourceSets.lib - } - sourceSet(sourceSets.main) { - compile sourceSets.api, sourceSets.lib, sourceSets.backend - } - sourceSet(sourceSets.test) { - implementation sourceSets.api, sourceSets.lib, sourceSets.backend - } -} - -defaultPackageInfos { - sources sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main -} - -// For sharing with other subprojects. -jarSets { - createJars('apiOnly', sourceSets.api).createOutgoingConfiguration('common') - createJars('lib').createOutgoingConfiguration('common') - createJars('backend').createOutgoingConfiguration('common') - createJars('impl', sourceSets.main).createOutgoingConfiguration('common') -} - -// For publishing -def apiLibJar = jarSets.createJars('api', sourceSets.api, sourceSets.lib) - -dependencies { - modCompileOnly "net.fabricmc:fabric-loader:${fabric_loader_version}" - - testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1' -} - -test { - useJUnitPlatform() -} - -publishing { - publications { - register('mavenIntermediary', MavenPublication) { - artifact apiLibJar.remapJar - artifact apiLibJar.remapSources - artifact apiLibJar.javadocJar - artifactId = "flywheel-common-intermediary-api-${artifact_minecraft_version}" - } - register('mavenMojmap', MavenPublication) { - artifact apiLibJar.jar - artifact apiLibJar.sources - artifact apiLibJar.javadocJar - artifactId = "flywheel-common-mojmap-api-${artifact_minecraft_version}" - } - } -} diff --git a/common/build.gradle.kts b/common/build.gradle.kts new file mode 100644 index 000000000..5b3dc91ed --- /dev/null +++ b/common/build.gradle.kts @@ -0,0 +1,79 @@ +plugins { + idea + java + `maven-publish` + id("dev.architectury.loom") + id("flywheel.package-infos") + id("flywheel.subproject") + id("flywheel.jar-sets") + id("flywheel.transitive-source-sets") +} + +val api = sourceSets.create("api") +val lib = sourceSets.create("lib") +val backend = sourceSets.create("backend") +val main = sourceSets.getByName("main") + +transitiveSourceSets { + compileClasspath = main.compileClasspath + + sourceSet(api) { + rootCompile() + } + sourceSet(lib) { + rootCompile() + compile(api) + } + sourceSet(backend) { + rootCompile() + compile(api, lib) + } + sourceSet(main) { + compile(api, lib, backend) + } + sourceSet(sourceSets.getByName("test")) { + implementation(api, lib, backend) + } +} + +defaultPackageInfos { + sources(api, lib, backend, main) +} + +// For sharing with other subprojects. +jarSets { + createJars("apiOnly", api).createOutgoingConfiguration("common") + createJars("lib").createOutgoingConfiguration("common") + createJars("backend").createOutgoingConfiguration("common") + createJars("impl", main).createOutgoingConfiguration("common") +} + +// For publishing +val apiLibJar = jarSets.createJars("api", api, lib) + +dependencies { + modCompileOnly("net.fabricmc:fabric-loader:${property("fabric_loader_version")}") + + testImplementation("org.junit.jupiter:junit-jupiter:5.8.1") +} + +tasks.test { + useJUnitPlatform() +} + +publishing { + publications { + register("mavenIntermediary") { + artifact(apiLibJar.remapJar) + artifact(apiLibJar.remapSources) + artifact(apiLibJar.javadocJar) + artifactId = "flywheel-common-intermediary-api-${property("artifact_minecraft_version")}" + } + register("mavenMojmap") { + artifact(apiLibJar.jar) + artifact(apiLibJar.sources) + artifact(apiLibJar.javadocJar) + artifactId = "flywheel-common-mojmap-api-${property("artifact_minecraft_version")}" + } + } +} diff --git a/fabric/build.gradle b/fabric/build.gradle deleted file mode 100644 index eda0a1e57..000000000 --- a/fabric/build.gradle +++ /dev/null @@ -1,60 +0,0 @@ -plugins { - id 'idea' - id 'java' - id 'maven-publish' - id 'dev.architectury.loom' - id 'flywheel.package-infos' - id 'flywheel.subproject' - id 'flywheel.platform' - id 'flywheel.jar-sets' - id 'flywheel.transitive-source-sets' -} - -transitiveSourceSets { - compileClasspath = sourceSets.main.compileClasspath - - create('api') { - rootCompile() - } - create('lib') { - rootCompile() - compile sourceSets.api - } - create('backend') { - rootCompile() - compile sourceSets.api, sourceSets.lib - } - sourceSet(sourceSets.main) { - implementation sourceSets.api, sourceSets.lib, sourceSets.backend - } - - createCompileConfigurations() -} - -platform { - commonProject = project(':common') - sources sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main - compileWithCommonSourceSets() - setupLoomMod() - setupLoomRuns() - setupFatJar() - publishMod() - publishRemap(apiArtifactId, jarSets.createJars('api', sourceSets.api, sourceSets.lib)) -} - -defaultPackageInfos { - sources sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main -} - -dependencies { - modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" - modApi "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}" - - modCompileOnly "maven.modrinth:sodium:${sodium_version}" - modCompileOnly "maven.modrinth:iris:${iris_version}" - - forApi project(path: ':common', configuration: 'commonApiOnly') - forLib project(path: ':common', configuration: 'commonLib') - forBackend project(path: ':common', configuration: 'commonBackend') - forMain project(path: ':common', configuration: 'commonImpl') -} diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts new file mode 100644 index 000000000..ba208fd19 --- /dev/null +++ b/fabric/build.gradle.kts @@ -0,0 +1,65 @@ +plugins { + idea + java + `maven-publish` + id("dev.architectury.loom") + id("flywheel.package-infos") + id("flywheel.subproject") + id("flywheel.platform") + id("flywheel.jar-sets") + id("flywheel.transitive-source-sets") +} + +val api = sourceSets.create("api") +val lib = sourceSets.create("lib") +val backend = sourceSets.create("backend") +val main = sourceSets.getByName("main") + +transitiveSourceSets { + compileClasspath = main.compileClasspath + + sourceSet(api) { + rootCompile() + } + sourceSet(lib) { + rootCompile() + compile(api) + } + sourceSet(backend) { + rootCompile() + compile(api, lib) + } + sourceSet(main) { + implementation(api, lib, backend) + } + + createCompileConfigurations() +} + +platform { + commonProject = project(":common") + sources(api, lib, backend, main) + compileWithCommonSourceSets() + setupLoomMod() + setupLoomRuns() + setupFatJar() + publishMod() + publishRemap(apiArtifactId, jarSets.createJars("api", api, lib)) +} + +defaultPackageInfos { + sources(api, lib, backend, main) +} + +dependencies { + modImplementation("net.fabricmc:fabric-loader:${property("fabric_loader_version")}") + modApi("net.fabricmc.fabric-api:fabric-api:${property("fabric_api_version")}") + + modCompileOnly("maven.modrinth:sodium:${property("sodium_version")}") + modCompileOnly("maven.modrinth:iris:${property("iris_version")}") + + "forApi"(project(path = ":common", configuration = "commonApiOnly")) + "forLib"(project(path = ":common", configuration = "commonLib")) + "forBackend"(project(path = ":common", configuration = "commonBackend")) + "forMain"(project(path = ":common", configuration = "commonImpl")) +} diff --git a/forge/build.gradle b/forge/build.gradle deleted file mode 100644 index 707960030..000000000 --- a/forge/build.gradle +++ /dev/null @@ -1,74 +0,0 @@ -plugins { - id 'idea' - id 'java' - id 'maven-publish' - id 'dev.architectury.loom' - id 'flywheel.package-infos' - id 'flywheel.subproject' - id 'flywheel.platform' - id 'flywheel.jar-sets' - id 'flywheel.transitive-source-sets' -} - -transitiveSourceSets { - compileClasspath = sourceSets.main.compileClasspath - - create('api') { - rootCompile() - } - create('lib') { - rootCompile() - compile sourceSets.api - } - create('backend') { - rootCompile() - compile sourceSets.api, sourceSets.lib - } - sourceSet(sourceSets.main) { - compile sourceSets.api, sourceSets.lib, sourceSets.backend - } - - createCompileConfigurations() -} - -platform { - commonProject = project(':common') - sources sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main - compileWithCommonSourceSets() - setupLoomMod() - setupLoomRuns() - setupFatJar() - publishMod() - publishRemap(apiArtifactId, jarSets.createJars('api', sourceSets.api, sourceSets.lib)) -} - -defaultPackageInfos { - sources sourceSets.api, sourceSets.lib, sourceSets.backend, sourceSets.main -} - -loom { - forge { - mixinConfig 'flywheel.backend.mixins.json' - mixinConfig 'flywheel.impl.mixins.json' - mixinConfig 'flywheel.impl.sodium.mixins.json' - } - - runs { - configureEach { - property 'forge.logging.markers', '' - property 'forge.logging.console.level', 'debug' - } - } -} - -dependencies { - forge "net.minecraftforge:forge:${minecraft_version}-${forge_version}" - - modCompileOnly "maven.modrinth:embeddium:${embeddium_version}" - modCompileOnly "maven.modrinth:oculus:${oculus_version}" - - forApi project(path: ':common', configuration: 'commonApiOnly') - forLib project(path: ':common', configuration: 'commonLib') - forBackend project(path: ':common', configuration: 'commonBackend') - forMain project(path: ':common', configuration: 'commonImpl') -} diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts new file mode 100644 index 000000000..158c307f5 --- /dev/null +++ b/forge/build.gradle.kts @@ -0,0 +1,79 @@ +plugins { + idea + java + `maven-publish` + id("dev.architectury.loom") + id("flywheel.package-infos") + id("flywheel.subproject") + id("flywheel.platform") + id("flywheel.jar-sets") + id("flywheel.transitive-source-sets") +} + +val api = sourceSets.create("api") +val lib = sourceSets.create("lib") +val backend = sourceSets.create("backend") +val main = sourceSets.getByName("main") + +transitiveSourceSets { + compileClasspath = main.compileClasspath + + sourceSet(api) { + rootCompile() + } + sourceSet(lib) { + rootCompile() + compile(api) + } + sourceSet(backend) { + rootCompile() + compile(api, lib) + } + sourceSet(main) { + compile(api, lib, backend) + } + + createCompileConfigurations() +} + +platform { + commonProject = project(":common") + sources(api, lib, backend, main) + compileWithCommonSourceSets() + setupLoomMod() + setupLoomRuns() + setupFatJar() + publishMod() + publishRemap(apiArtifactId, jarSets.createJars("api", api, lib)) +} + +defaultPackageInfos { + sources(api, lib, backend, main) +} + +loom { + forge { + mixinConfig("flywheel.backend.mixins.json") + mixinConfig("flywheel.impl.mixins.json") + mixinConfig("flywheel.impl.sodium.mixins.json") + } + + runs { + configureEach { + property("forge.logging.markers", "") + property("forge.logging.console.level", "debug") + } + } +} + +dependencies { + forge("net.minecraftforge:forge:${property("minecraft_version")}-${property("forge_version")}") + + modCompileOnly("maven.modrinth:embeddium:${property("embeddium_version")}") + modCompileOnly("maven.modrinth:oculus:${property("oculus_version")}") + + "forApi"(project(path = ":common", configuration = "commonApiOnly")) + "forLib"(project(path = ":common", configuration = "commonLib")) + "forBackend"(project(path = ":common", configuration = "commonBackend")) + "forMain"(project(path = ":common", configuration = "commonImpl")) +} diff --git a/old.build.gradle b/old.build.gradle deleted file mode 100644 index 6caf08ab3..000000000 --- a/old.build.gradle +++ /dev/null @@ -1,205 +0,0 @@ -plugins { - id 'eclipse' - id 'idea' - id 'maven-publish' - id 'net.minecraftforge.gradle' version "${forgegradle_version}" - id 'org.parchmentmc.librarian.forgegradle' version "${librarian_version}" - id 'org.spongepowered.mixin' version "${mixingradle_version}" -} - -boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equalsIgnoreCase('false'); - -ext.buildNumber = System.getenv('BUILD_NUMBER') - -group = 'com.jozufozu.flywheel' -archivesBaseName = "flywheel-forge-${artifact_minecraft_version}" -version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') - -java.toolchain.languageVersion = JavaLanguageVersion.of(17) - -println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" -minecraft { - mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" - - copyIdeResources = true - - runs { - configureEach { - workingDirectory project.file('run') - - property 'forge.logging.markers', '' - property 'forge.logging.console.level', 'debug' - - property 'mixin.env.remapRefMap', 'true' - property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" - - mods { - flywheel { - source sourceSets.main - } - } - } - - client { - property 'flw.dumpShaderSource', 'true' - property 'flw.debugMemorySafety', 'true' - } - - server { - args '--nogui' - } - } -} - -repositories { - maven { - url 'https://www.cursemaven.com' - content { - includeGroup "curse.maven" - } - } - maven { - name 'tterrag maven' - url 'https://maven.tterrag.com/' - } - maven { - name = "Modrinth" - url = "https://api.modrinth.com/maven" - content { - includeGroup "maven.modrinth" - } - } - mavenCentral() -} - -dependencies { - testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1' - minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" - - compileOnly fg.deobf("maven.modrinth:embeddium:0.3.9+mc1.20.1") - compileOnly fg.deobf("maven.modrinth:oculus:1.20.1-1.6.15a") - // implementation fg.deobf("maven.modrinth:starlight-forge:1.1.2+1.20") - - // https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497 - // Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings - // This allows 'Settings > Build, Execution, and Deployment > Build Tools > Gradle > Build and run using' set to IntelliJ to work correctly - // if (System.getProperty('idea.sync.active') != 'true') { - annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor" - // } -} - -test { - useJUnitPlatform() -} - -mixin { - add sourceSets.main, 'flywheel.refmap.json' - - config 'flywheel.backend.mixins.json' - config 'flywheel.impl.mixins.json' - config 'flywheel.impl.sodium.mixins.json' - - debug.verbose = true - debug.export = true -} - -idea { - // Tell IDEA to always download sources/javadoc artifacts from maven. - module { - downloadJavadoc = true - downloadSources = true - } -} - -// Workaround for SpongePowered/MixinGradle#38 -afterEvaluate { - tasks.configureReobfTaskForReobfJar.mustRunAfter(tasks.compileJava) -} - -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation -} - -javadoc { - source = [sourceSets.main.allJava] - // prevent java 8's strict doclint for javadocs from failing builds - options.addStringOption('Xdoclint:none', '-quiet') -} - -compileJava { - options.compilerArgs = ['-Xdiags:verbose'] -} - -tasks.named('processResources', ProcessResources).configure { - var replaceProperties = [ - minecraft_version : minecraft_version, - minecraft_version_range: minecraft_version_range, - forge_version : forge_version, - forge_version_range : forge_version_range, - loader_version_range : loader_version_range, - mod_version : mod_version - ] - inputs.properties replaceProperties - - filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { - expand replaceProperties + [project: project] - } -} - -apply from: rootProject.file('gradle/package-infos.gradle') - -void addLicense(jarTask) { - jarTask.from('LICENSE.md') { - rename '(.*)\\.(.*)', '$1_' + archivesBaseName + '.$2' - } -} - -void addManifest(jarTask) { - jarTask.manifest { - attributes([ - 'Specification-Title' : 'flywheel', - // 'Specification-Vendor': 'flywheel authors', - 'Specification-Version' : '1', // We are version 1 of ourselves - 'Implementation-Title' : project.jar.archiveBaseName, - 'Implementation-Version' : project.jar.archiveVersion, - // 'Implementation-Vendor': 'flywheel authors', - 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - ]) - } -} - -tasks.named('jar', Jar).configure { - archiveClassifier = '' - - finalizedBy 'reobfJar' - addManifest(it) - addLicense(it) -} - -java { - withSourcesJar() - withJavadocJar() -} - -publishing { - publications { - register('mavenJava', MavenPublication) { - artifact jar - artifact sourcesJar - artifact javadocJar - - artifactId = archivesBaseName - - fg.component(it) - } - } - repositories { - maven { - url "file://${project.projectDir}/mcmodsrepo" - } - - if (project.hasProperty('mavendir')) { - maven { url mavendir } - } - } -} diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index bbbca7a35..000000000 --- a/settings.gradle +++ /dev/null @@ -1,26 +0,0 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven { - name = 'MinecraftForge' - url = 'https://maven.minecraftforge.net/' - } - maven { - name = 'Architectury' - url = 'https://maven.architectury.dev/' - } - maven { url = 'https://repo.spongepowered.org/repository/maven-public' } - maven { url = 'https://maven.parchmentmc.org' } - } - - plugins { - id 'dev.architectury.loom' version arch_loom_version - } -} - -rootProject.name = 'Flywheel' - -include('common') -include('fabric') -include('forge') diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 000000000..cf8fd7a12 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,25 @@ +pluginManagement { + repositories { + gradlePluginPortal() + mavenCentral() + maven("https://maven.minecraftforge.net/") { + name = "MinecraftForge" + } + maven("https://maven.architectury.dev/") { + name = "Architectury" + } + maven("https://repo.spongepowered.org/repository/maven-public") + maven("https://maven.parchmentmc.org") + } + + plugins { + val arch_loom_version: String by settings + id("dev.architectury.loom") version arch_loom_version + } +} + +rootProject.name = "Flywheel" + +include("common") +include("fabric") +include("forge") From ad19e453ced2dfa893d62fe02a71cad9a221c62a Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Fri, 3 May 2024 17:43:10 -0700 Subject: [PATCH 48/62] Overextending - Use cool kotlin dsl extension methods in plugins where possible --- .../com/jozufozu/gradle/jarset/JarTaskSet.kt | 15 +++++------ .../nullability/PackageInfosExtension.kt | 5 ++-- .../gradle/platform/PlatformExtension.kt | 27 +++++++++---------- .../gradle/subproject/SubprojectPlugin.kt | 17 +++++------- 4 files changed, 30 insertions(+), 34 deletions(-) diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt index c3278217d..194dd63ed 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt @@ -11,6 +11,7 @@ import org.gradle.api.tasks.SourceTask import org.gradle.api.tasks.TaskProvider import org.gradle.api.tasks.javadoc.Javadoc import org.gradle.jvm.tasks.Jar +import org.gradle.kotlin.dsl.register class JarTaskSet( val project: Project, @@ -73,7 +74,7 @@ class JarTaskSet( val devlibs = buildDirectory.dir("devlibs/${name}") val libs = buildDirectory.dir("libs/${name}") - val jarTask = project.tasks.register("${name}Jar", Jar::class.java) { + val jarTask = project.tasks.register("${name}Jar") { group = BUILD_GROUP destinationDirectory.set(devlibs) @@ -82,14 +83,14 @@ class JarTaskSet( } excludeDuplicatePackageInfos(this) } - val remapJarTask = project.tasks.register("${name}RemapJar", RemapJarTask::class.java) { + val remapJarTask = project.tasks.register("${name}RemapJar") { dependsOn(jarTask) group = LOOM_GROUP destinationDirectory.set(libs) inputFile.set(jarTask.flatMap { it.archiveFile }) } - val sourcesTask = project.tasks.register("${name}SourcesJar", Jar::class.java) { + val sourcesTask = project.tasks.register("${name}SourcesJar") { group = BUILD_GROUP destinationDirectory.set(devlibs) archiveClassifier.set(SOURCES_CLASSIFIER) @@ -99,7 +100,7 @@ class JarTaskSet( } excludeDuplicatePackageInfos(this) } - val remapSourcesTask = project.tasks.register("${name}RemapSourcesJar", RemapSourcesJarTask::class.java) { + val remapSourcesTask = project.tasks.register("${name}RemapSourcesJar") { dependsOn(sourcesTask) group = LOOM_GROUP destinationDirectory.set(libs) @@ -107,11 +108,9 @@ class JarTaskSet( inputFile.set(sourcesTask.flatMap { it.archiveFile }) } - val javadocTask = project.tasks.register("${name}Javadoc", Javadoc::class.java) { + val javadocTask = project.tasks.register("${name}Javadoc") { group = BUILD_GROUP setDestinationDir(buildDirectory.dir("docs/${name}-javadoc").get().asFile) - options.encoding = "UTF-8" - options.optionFiles(project.rootProject.file("javadoc-options.txt")) for (set in sourceSetSet) { source(set.allJava) @@ -119,7 +118,7 @@ class JarTaskSet( } excludeDuplicatePackageInfos(this) } - val javadocJarTask = project.tasks.register("${name}JavadocJar", Jar::class.java) { + val javadocJarTask = project.tasks.register("${name}JavadocJar") { dependsOn(javadocTask) group = BUILD_GROUP destinationDirectory.set(libs) diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosExtension.kt index e4bae3acf..8a45da808 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosExtension.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosExtension.kt @@ -3,6 +3,7 @@ package com.jozufozu.gradle.nullability import org.gradle.api.Project import org.gradle.api.tasks.Delete import org.gradle.api.tasks.SourceSet +import org.gradle.kotlin.dsl.register open class PackageInfosExtension(private val project: Project) { fun sources(vararg sourceSets: SourceSet) { @@ -16,7 +17,7 @@ open class PackageInfosExtension(private val project: Project) { // otherwise it'll just be whatever the last source set is in the list. val sourceSetName = sourceSet.name val taskName = sourceSet.getTaskName("generate", "PackageInfos") - val task = project.tasks.register(taskName, GeneratePackageInfosTask::class.java) { + val task = project.tasks.register(taskName) { group = "flywheel" description = "Generates package-info files for $sourceSetName packages." @@ -31,7 +32,7 @@ open class PackageInfosExtension(private val project: Project) { finalizedBy(task) } - val cleanTask = project.tasks.register(sourceSet.getTaskName("clean", "PackageInfos"), Delete::class.java) { + val cleanTask = project.tasks.register(sourceSet.getTaskName("clean", "PackageInfos")) { group = "flywheel" delete(project.file("src/$sourceSetName/generatedPackageInfos")) } diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt index 36fb6a127..46ae6d542 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt @@ -12,8 +12,7 @@ import org.gradle.api.tasks.SourceSetContainer import org.gradle.api.tasks.compile.JavaCompile import org.gradle.api.tasks.javadoc.Javadoc import org.gradle.jvm.tasks.Jar -import org.gradle.kotlin.dsl.provideDelegate -import org.gradle.kotlin.dsl.the +import org.gradle.kotlin.dsl.* import org.gradle.language.jvm.tasks.ProcessResources import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty @@ -65,17 +64,17 @@ open class PlatformExtension(val project: Project) { fun compileWithCommonSourceSets() { project.tasks.apply { - withType(JavaCompile::class.java).configureEach { + withType().configureEach { JarTaskSet.excludeDuplicatePackageInfos(this) } sources.forEach { val commonSourceSet = commonSourceSets.named(it.name).get() - named(it.compileJavaTaskName, JavaCompile::class.java).configure { + named(it.compileJavaTaskName).configure { source(commonSourceSet.allJava) } - named(it.processResourcesTaskName, ProcessResources::class.java).configure { + named(it.processResourcesTaskName).configure { from(commonSourceSet.resources) } } @@ -87,20 +86,20 @@ open class PlatformExtension(val project: Project) { val extraSourceSets = sources.filter { it.name != "main" }.toList() val commonSources = sources.map { commonSourceSets.named(it.name).get() } - named("jar", Jar::class.java).configure { + named("jar").configure { extraSourceSets.forEach { from(it.output) } JarTaskSet.excludeDuplicatePackageInfos(this) } - named("javadoc", Javadoc::class.java).configure { + named("javadoc").configure { commonSources.forEach { source(it.allJava) } extraSourceSets.forEach { source(it.allJava) } JarTaskSet.excludeDuplicatePackageInfos(this) } - named("sourcesJar", Jar::class.java).configure { + named("sourcesJar").configure { commonSources.forEach { from(it.allJava) } extraSourceSets.forEach { from(it.allJava) } @@ -110,12 +109,12 @@ open class PlatformExtension(val project: Project) { } fun publishMod() { - val remapJar = project.tasks.named("remapJar", RemapJarTask::class.java) - val remapSourcesJar = project.tasks.named("remapSourcesJar", RemapSourcesJarTask::class.java) - val javadocJar = project.tasks.named("javadocJar", Jar::class.java) + val remapJar = project.tasks.named("remapJar") + val remapSourcesJar = project.tasks.named("remapSourcesJar") + val javadocJar = project.tasks.named("javadocJar") project.the().publications { - register("modMaven", MavenPublication::class.java) { + register("modMaven") { artifact(remapJar) artifact(remapSourcesJar) artifact(javadocJar) @@ -126,7 +125,7 @@ open class PlatformExtension(val project: Project) { fun publishRemap(artifactId: String, jarSet: JarTaskSet) { project.the().publications { - register("${jarSet.name}RemapMaven", MavenPublication::class.java) { + register("${jarSet.name}RemapMaven") { artifact(jarSet.remapJar) artifact(jarSet.remapSources) artifact(jarSet.javadocJar) @@ -137,7 +136,7 @@ open class PlatformExtension(val project: Project) { fun publish(artifactId: String, jarSet: JarTaskSet) { project.the().publications { - register("${jarSet.name}Maven", MavenPublication::class.java) { + register("${jarSet.name}Maven") { artifact(jarSet.jar) artifact(jarSet.sources) artifact(jarSet.javadocJar) diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt index 02419f11a..6c36a48b0 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt @@ -13,10 +13,7 @@ import org.gradle.api.tasks.compile.JavaCompile import org.gradle.api.tasks.javadoc.Javadoc import org.gradle.jvm.tasks.Jar import org.gradle.jvm.toolchain.JavaLanguageVersion -import org.gradle.kotlin.dsl.assign -import org.gradle.kotlin.dsl.maven -import org.gradle.kotlin.dsl.provideDelegate -import org.gradle.kotlin.dsl.the +import org.gradle.kotlin.dsl.* import org.gradle.language.jvm.tasks.ProcessResources @@ -113,36 +110,36 @@ class SubprojectPlugin: Plugin { project.tasks.apply { // make builds reproducible - withType(AbstractArchiveTask::class.java).configureEach { + withType().configureEach { isPreserveFileTimestamps = false isReproducibleFileOrder = true } // module metadata is often broken on multi-platform projects - withType(GenerateModuleMetadata::class.java).configureEach { + withType().configureEach { enabled = false } - withType(JavaCompile::class.java).configureEach { + withType().configureEach { options.encoding = "UTF-8" options.release = Integer.parseInt(java_version) options.compilerArgs.add("-Xdiags:verbose") } - withType(Jar::class.java).configureEach { + withType().configureEach { from("${project.rootDir}/LICENSE.md") { into("META-INF") } } - withType(Javadoc::class.java).configureEach { + withType().configureEach { options.optionFiles(project.rootProject.file("javadoc-options.txt")) options.encoding = "UTF-8" } val replaceProperties = processResourcesExpandProperties.associateWith { project.property(it) as String } - withType(ProcessResources::class.java).configureEach { + withType().configureEach { inputs.properties(replaceProperties) filesMatching(processResourcesExpandFiles) { From e07d65807b5c908ae9be9abfa09818cd19a55870 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Fri, 3 May 2024 21:59:27 -0700 Subject: [PATCH 49/62] Final warning - Address warnings generated by javadocs and mixin remaps for joml --- .../com/jozufozu/flywheel/api/visual/LitVisual.java | 8 ++++---- .../flywheel/lib/visual/SimpleDynamicVisual.java | 2 +- .../flywheel/lib/visual/SimpleTickableVisual.java | 2 +- .../flywheel/lib/visual/component/FireComponent.java | 2 +- .../lib/visual/component/ShadowComponent.java | 2 +- .../impl/mixin/fix/FixNormalScalingMixin.java | 2 +- .../impl/visualization/VisualizationHelper.java | 8 ++++---- .../impl/visualization/VisualizationManagerImpl.java | 11 ++--------- 8 files changed, 15 insertions(+), 22 deletions(-) diff --git a/common/src/api/java/com/jozufozu/flywheel/api/visual/LitVisual.java b/common/src/api/java/com/jozufozu/flywheel/api/visual/LitVisual.java index 13b3638ab..9408c99d9 100644 --- a/common/src/api/java/com/jozufozu/flywheel/api/visual/LitVisual.java +++ b/common/src/api/java/com/jozufozu/flywheel/api/visual/LitVisual.java @@ -17,10 +17,10 @@ public interface LitVisual extends Visual { * *

Even if multiple sections are updated at the same time, this method will only be called once.

* - *

The implementation is free to parallelize calls to this method, as well as call into - * {@link DynamicVisual#beginFrame} simultaneously. It is safe to query/update light here, - * but you must ensure proper synchronization if you want to mutate anything outside this - * visual or anything that is also mutated by {@link DynamicVisual#beginFrame}.

+ *

The implementation is free to parallelize calls to this method, as well as execute the plan + * returned by {@link DynamicVisual#planFrame} simultaneously. It is safe to query/update light here, + * but you must ensure proper synchronization if you want to mutate anything outside this visual or + * anything that is also mutated within {@link DynamicVisual#planFrame}.

*/ void updateLight(); diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java index 9e3220c44..1abd2749d 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java @@ -14,7 +14,7 @@ public interface SimpleDynamicVisual extends DynamicVisual { * The implementation is free to parallelize calls to this method. * You must ensure proper synchronization if you need to mutate anything outside this visual. *
- * This method and {@link TickableVisual#tick} will never be called simultaneously. + * This method and {@link SimpleTickableVisual#tick} will never be called simultaneously. *
* {@link Instancer}/{@link Instance} creation/acquisition is safe here. */ diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java index a59881bdd..baf8246e9 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java @@ -15,7 +15,7 @@ public interface SimpleTickableVisual extends TickableVisual { * The implementation is free to parallelize calls to this method. * You must ensure proper synchronization if you need to mutate anything outside this visual. *
- * This method and {@link DynamicVisual#beginFrame} will never be called simultaneously. + * This method and {@link SimpleDynamicVisual#beginFrame} will never be called simultaneously. *
* {@link Instancer}/{@link Instance} creation/acquisition is safe here. */ diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/visual/component/FireComponent.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/component/FireComponent.java index 9a11224dc..8c0f3bf0d 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/visual/component/FireComponent.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/component/FireComponent.java @@ -63,7 +63,7 @@ private TransformedInstance createInstance(Model model) { /** * Update the fire instances. You'd typically call this in your visual's - * {@link com.jozufozu.flywheel.api.visual.DynamicVisual#beginFrame(DynamicVisual.Context) beginFrame} method. + * {@link com.jozufozu.flywheel.lib.visual.SimpleDynamicVisual#beginFrame(DynamicVisual.Context) beginFrame} method. * * @param context The frame context. */ diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/visual/component/ShadowComponent.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/component/ShadowComponent.java index 305cd1b34..45d3526ca 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/visual/component/ShadowComponent.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/component/ShadowComponent.java @@ -108,7 +108,7 @@ public ShadowComponent strength(float strength) { /** * Update the shadow instances. You'd typically call this in your visual's - * {@link com.jozufozu.flywheel.api.visual.DynamicVisual#beginFrame(DynamicVisual.Context) beginFrame} method. + * {@link com.jozufozu.flywheel.lib.visual.SimpleDynamicVisual#beginFrame(DynamicVisual.Context) beginFrame} method. * * @param context The frame context. */ diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/fix/FixNormalScalingMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/fix/FixNormalScalingMixin.java index b94f596c2..36abaff18 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/fix/FixNormalScalingMixin.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/fix/FixNormalScalingMixin.java @@ -17,7 +17,7 @@ abstract class FixNormalScalingMixin { * applied, which negates the matrix again, resulting in the matrix being the * same as in the beginning. */ - @Inject(method = "scale(FFF)V", at = @At(value = "INVOKE", target = "Lorg/joml/Matrix3f;scale(F)Lorg/joml/Matrix3f;", shift = Shift.AFTER), cancellable = true) + @Inject(method = "scale(FFF)V", at = @At(value = "INVOKE", target = "Lorg/joml/Matrix3f;scale(F)Lorg/joml/Matrix3f;", shift = Shift.AFTER, remap = false), cancellable = true) private void flywheel$returnAfterNegate(float x, float y, float z, CallbackInfo ci) { ci.cancel(); } diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationHelper.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationHelper.java index 439d4dcd6..b9ede2802 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationHelper.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationHelper.java @@ -31,8 +31,8 @@ public static EntityVisualizer getVisualizer(T ent /** * Checks if the given block entity can be visualized. - * @param type The block entity to check. - * @param The block entity. + * @param blockEntity The block entity to check. + * @param The type of the block entity. * @return {@code true} if the block entity can be visualized. */ public static boolean canVisualize(T blockEntity) { @@ -41,8 +41,8 @@ public static boolean canVisualize(T blockEntity) { /** * Checks if the given entity can be visualized. - * @param type The entity to check. - * @param The entity. + * @param entity The entity to check. + * @param The type of the entity. * @return {@code true} if the entity can be visualized. */ public static boolean canVisualize(T entity) { diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java index 73cd1b1d6..300621739 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizationManagerImpl.java @@ -210,10 +210,7 @@ public VisualManager getEffects() { } /** - * Tick the visuals after the game has ticked: - *

- * Call {@link TickableVisual#tick} on all visuals in this level. - *

+ * Begin execution of the tick plan. */ public void tick() { // Make sure we're done with any prior frame or tick to avoid racing. @@ -227,11 +224,7 @@ public void tick() { } /** - * Get ready to render a frame. - * - *

Check and update the render origin. - *
- * Call {@link DynamicVisual#beginFrame} on all visuals in this level.

+ * Begin execution of the frame plan. */ public void beginFrame(RenderContext context) { // Make sure we're done with the last tick. From bba587fa198335467285128e757e6e668a896704 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sat, 4 May 2024 15:45:58 -0700 Subject: [PATCH 50/62] Less is more - Merge package-infos, jar-sets, and transitive-source-sets plugins - Move publishing logic into JarTaskSet - Do not eagerly add all jarsets to assemble - Significantly reduces build times - Add separate helper method for creating outgoing jarsets --- buildSrc/build.gradle.kts | 12 ----- .../jozufozu/gradle/jarset/JarSetExtension.kt | 27 ++++++++--- .../jozufozu/gradle/jarset/JarSetPlugin.kt | 10 ----- .../com/jozufozu/gradle/jarset/JarTaskSet.kt | 45 +++++++++++++++---- .../gradle/nullability/PackageInfosPlugin.kt | 10 ----- .../gradle/platform/PlatformExtension.kt | 37 --------------- .../gradle/platform/PlatformPlugin.kt | 2 +- .../gradle/subproject/SubprojectPlugin.kt | 7 +++ .../TransitiveSourceSetsExtension.kt | 16 ------- .../transitive/TransitiveSourceSetsPlugin.kt | 10 ----- common/build.gradle.kts | 39 +++++----------- fabric/build.gradle.kts | 10 ++--- forge/build.gradle.kts | 10 ++--- 13 files changed, 86 insertions(+), 149 deletions(-) delete mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetPlugin.kt delete mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosPlugin.kt delete mode 100644 buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsPlugin.kt diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 885339096..312a2b4a3 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -23,18 +23,6 @@ gradlePlugin { id = "flywheel.platform" implementationClass = "com.jozufozu.gradle.platform.PlatformPlugin" } - create("jarSetPlugin") { - id = "flywheel.jar-sets" - implementationClass = "com.jozufozu.gradle.jarset.JarSetPlugin" - } - create("packageInfosPlugin") { - id = "flywheel.package-infos" - implementationClass = "com.jozufozu.gradle.nullability.PackageInfosPlugin" - } - create("transitiveSourceSetsPlugin") { - id = "flywheel.transitive-source-sets" - implementationClass = "com.jozufozu.gradle.transitive.TransitiveSourceSetsPlugin" - } create("subprojectPlugin") { id = "flywheel.subproject" implementationClass = "com.jozufozu.gradle.subproject.SubprojectPlugin" diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetExtension.kt index f20fcd881..fea600095 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetExtension.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetExtension.kt @@ -1,16 +1,29 @@ package com.jozufozu.gradle.jarset +import net.fabricmc.loom.task.RemapJarTask +import net.fabricmc.loom.task.RemapSourcesJarTask import org.gradle.api.Project import org.gradle.api.tasks.SourceSet -import org.gradle.api.tasks.SourceSetContainer -import org.gradle.kotlin.dsl.the +import org.gradle.jvm.tasks.Jar +import org.gradle.kotlin.dsl.named +import org.gradle.kotlin.dsl.provideDelegate -open class JarSetExtension(val project: Project) { - fun createJars(name: String): JarTaskSet { - return createJars(name, project.the().named(name).get()) +open class JarSetExtension(private val project: Project) { + fun create(name: String, vararg sourceSetSet: SourceSet): JarTaskSet { + return JarTaskSet.create(project, name, *sourceSetSet) } - fun createJars(name: String, vararg sourceSetSet: SourceSet): JarTaskSet { - return JarTaskSet.create(project, name, *sourceSetSet) + fun outgoing(name: String, vararg sourceSetSet: SourceSet): JarTaskSet { + return JarTaskSet.create(project, name, *sourceSetSet).also { it.createOutgoingConfiguration() } + } + + val mainSet: JarTaskSet by lazy { + val jarTask = project.tasks.named("jar") + val remapJarTask = project.tasks.named("remapJar") + val sourcesJarTask = project.tasks.named("sourcesJar") + val remapSourcesJarTask = project.tasks.named("remapSourcesJar") + val javadocJarTask = project.tasks.named("javadocJar") + + JarTaskSet(project, "main", jarTask, remapJarTask, sourcesJarTask, remapSourcesJarTask, javadocJarTask) } } diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetPlugin.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetPlugin.kt deleted file mode 100644 index a1895b440..000000000 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetPlugin.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.jozufozu.gradle.jarset - -import org.gradle.api.Plugin -import org.gradle.api.Project - -class JarSetPlugin: Plugin { - override fun apply(target: Project) { - target.extensions.create("jarSets", JarSetExtension::class.java, target) - } -} diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt index 194dd63ed..3e925626c 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt @@ -1,10 +1,13 @@ package com.jozufozu.gradle.jarset +import net.fabricmc.loom.task.AbstractRemapJarTask import net.fabricmc.loom.task.RemapJarTask import net.fabricmc.loom.task.RemapSourcesJarTask import org.gradle.api.Action import org.gradle.api.Project import org.gradle.api.file.DuplicatesStrategy +import org.gradle.api.publish.PublishingExtension +import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.tasks.AbstractCopyTask import org.gradle.api.tasks.SourceSet import org.gradle.api.tasks.SourceTask @@ -12,6 +15,7 @@ import org.gradle.api.tasks.TaskProvider import org.gradle.api.tasks.javadoc.Javadoc import org.gradle.jvm.tasks.Jar import org.gradle.kotlin.dsl.register +import org.gradle.kotlin.dsl.the class JarTaskSet( val project: Project, @@ -23,8 +27,30 @@ class JarTaskSet( val javadocJar: TaskProvider ) { - fun createOutgoingConfiguration(prefix: String) { - val config = project.configurations.register("${prefix}${name.capitalize()}") { + fun publishRemap(artifactId: String) { + project.the().publications { + register("${name}RemapMaven") { + artifact(remapJar) + artifact(remapSources) + artifact(javadocJar) + this.artifactId = artifactId + } + } + } + + fun publish(artifactId: String) { + project.the().publications { + register("${name}Maven") { + artifact(jar) + artifact(sources) + artifact(javadocJar) + this.artifactId = artifactId + } + } + } + + fun createOutgoingConfiguration() { + val config = project.configurations.register(name) { isCanBeConsumed = true isCanBeResolved = false } @@ -32,8 +58,10 @@ class JarTaskSet( project.artifacts.add(config.name, jar) } - fun configure(action: Action) { - action.execute(this) + fun assembleRemaps() { + project.tasks.named("assemble").configure { + dependsOn(remapJar, remapSources, javadocJar) + } } fun configureEach(action: Action) { @@ -45,6 +73,11 @@ class JarTaskSet( remapSources.configure(action) } + fun configureRemap(action: Action) { + remapJar.configure(action) + remapSources.configure(action) + } + companion object { private const val PACKAGE_INFOS_JAVA_PATTERN = "**/package-info.java" private const val BUILD_GROUP: String = "build" @@ -127,10 +160,6 @@ class JarTaskSet( from(javadocTask.map { it.outputs }) } - project.tasks.named("assemble").configure { - dependsOn(remapJarTask, remapSourcesTask, javadocJarTask) - } - return JarTaskSet(project, name, jarTask, remapJarTask, sourcesTask, remapSourcesTask, javadocJarTask) } } diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosPlugin.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosPlugin.kt deleted file mode 100644 index 8c50240f0..000000000 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/nullability/PackageInfosPlugin.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.jozufozu.gradle.nullability - -import org.gradle.api.Plugin -import org.gradle.api.Project - -class PackageInfosPlugin: Plugin { - override fun apply(target: Project) { - target.extensions.create("defaultPackageInfos", PackageInfosExtension::class.java, target) - } -} diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt index 46ae6d542..2b5268a18 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt @@ -108,43 +108,6 @@ open class PlatformExtension(val project: Project) { } } - fun publishMod() { - val remapJar = project.tasks.named("remapJar") - val remapSourcesJar = project.tasks.named("remapSourcesJar") - val javadocJar = project.tasks.named("javadocJar") - - project.the().publications { - register("modMaven") { - artifact(remapJar) - artifact(remapSourcesJar) - artifact(javadocJar) - artifactId = modArtifactId - } - } - } - - fun publishRemap(artifactId: String, jarSet: JarTaskSet) { - project.the().publications { - register("${jarSet.name}RemapMaven") { - artifact(jarSet.remapJar) - artifact(jarSet.remapSources) - artifact(jarSet.javadocJar) - this.artifactId = artifactId - } - } - } - - fun publish(artifactId: String, jarSet: JarTaskSet) { - project.the().publications { - register("${jarSet.name}Maven") { - artifact(jarSet.jar) - artifact(jarSet.sources) - artifact(jarSet.javadocJar) - this.artifactId = artifactId - } - } - } - private class DependentProject(private val thisProject: Project) : ReadWriteProperty { private var value: Project? = null diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformPlugin.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformPlugin.kt index e3284c103..652a51121 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformPlugin.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformPlugin.kt @@ -5,6 +5,6 @@ import org.gradle.api.Project class PlatformPlugin: Plugin { override fun apply(project: Project) { - project.extensions.create("platform", PlatformExtension::class.java) + project.extensions.create("platform", PlatformExtension::class.java, project) } } diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt index 6c36a48b0..b448b7e0d 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt @@ -1,5 +1,8 @@ package com.jozufozu.gradle.subproject +import com.jozufozu.gradle.jarset.JarSetExtension +import com.jozufozu.gradle.nullability.PackageInfosExtension +import com.jozufozu.gradle.transitive.TransitiveSourceSetsExtension import net.fabricmc.loom.api.LoomGradleExtensionAPI import org.gradle.api.JavaVersion import org.gradle.api.Plugin @@ -19,6 +22,10 @@ import org.gradle.language.jvm.tasks.ProcessResources class SubprojectPlugin: Plugin { override fun apply(project: Project) { + project.extensions.create("defaultPackageInfos", PackageInfosExtension::class.java, project) + project.extensions.create("transitiveSourceSets", TransitiveSourceSetsExtension::class.java, project) + project.extensions.create("jarSets", JarSetExtension::class.java, project) + setBaseProperties(project) setupJava(project) addRepositories(project) diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsExtension.kt index 020234cc5..e549cc158 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsExtension.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsExtension.kt @@ -13,22 +13,6 @@ open class TransitiveSourceSetsExtension(private val project: Project) { private val transitives = mutableMapOf() - fun create(name: String) { - sourceSet(project.the().maybeCreate(name)) - } - - fun create(name: String, action: Action) { - sourceSet(project.the().maybeCreate(name), action) - } - - fun sourceSet(name: String) { - sourceSet(project.the().getByName(name)) - } - - fun sourceSet(name: String, action: Action) { - sourceSet(project.the().getByName(name), action) - } - fun sourceSet(sourceSet: SourceSet) { registerSourceSet(sourceSet) } diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsPlugin.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsPlugin.kt deleted file mode 100644 index 8eb33eec6..000000000 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsPlugin.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.jozufozu.gradle.transitive - -import org.gradle.api.Plugin -import org.gradle.api.Project - -class TransitiveSourceSetsPlugin: Plugin { - override fun apply(target: Project) { - target.extensions.create("transitiveSourceSets", TransitiveSourceSetsExtension::class.java, target) - } -} diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 5b3dc91ed..cd4b81ca1 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -3,10 +3,7 @@ plugins { java `maven-publish` id("dev.architectury.loom") - id("flywheel.package-infos") id("flywheel.subproject") - id("flywheel.jar-sets") - id("flywheel.transitive-source-sets") } val api = sourceSets.create("api") @@ -40,17 +37,20 @@ defaultPackageInfos { sources(api, lib, backend, main) } -// For sharing with other subprojects. jarSets { - createJars("apiOnly", api).createOutgoingConfiguration("common") - createJars("lib").createOutgoingConfiguration("common") - createJars("backend").createOutgoingConfiguration("common") - createJars("impl", main).createOutgoingConfiguration("common") + // For sharing with other subprojects. + outgoing("commonApiOnly", api) + outgoing("commonLib", lib) + outgoing("commonBackend", backend) + outgoing("commonImpl", main) + + // For publishing. + create("api", api, lib).apply { + publish("flywheel-common-mojmap-api-${property("artifact_minecraft_version")}") + publishRemap("flywheel-common-intermediary-api-${property("artifact_minecraft_version")}") + } } -// For publishing -val apiLibJar = jarSets.createJars("api", api, lib) - dependencies { modCompileOnly("net.fabricmc:fabric-loader:${property("fabric_loader_version")}") @@ -60,20 +60,3 @@ dependencies { tasks.test { useJUnitPlatform() } - -publishing { - publications { - register("mavenIntermediary") { - artifact(apiLibJar.remapJar) - artifact(apiLibJar.remapSources) - artifact(apiLibJar.javadocJar) - artifactId = "flywheel-common-intermediary-api-${property("artifact_minecraft_version")}" - } - register("mavenMojmap") { - artifact(apiLibJar.jar) - artifact(apiLibJar.sources) - artifact(apiLibJar.javadocJar) - artifactId = "flywheel-common-mojmap-api-${property("artifact_minecraft_version")}" - } - } -} diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index ba208fd19..131955622 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -3,11 +3,8 @@ plugins { java `maven-publish` id("dev.architectury.loom") - id("flywheel.package-infos") id("flywheel.subproject") id("flywheel.platform") - id("flywheel.jar-sets") - id("flywheel.transitive-source-sets") } val api = sourceSets.create("api") @@ -43,8 +40,11 @@ platform { setupLoomMod() setupLoomRuns() setupFatJar() - publishMod() - publishRemap(apiArtifactId, jarSets.createJars("api", api, lib)) +} + +jarSets { + mainSet.publishRemap(platform.modArtifactId) + create("api", api, lib).publishRemap(platform.apiArtifactId) } defaultPackageInfos { diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index 158c307f5..8393ade99 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -3,11 +3,8 @@ plugins { java `maven-publish` id("dev.architectury.loom") - id("flywheel.package-infos") id("flywheel.subproject") id("flywheel.platform") - id("flywheel.jar-sets") - id("flywheel.transitive-source-sets") } val api = sourceSets.create("api") @@ -43,8 +40,11 @@ platform { setupLoomMod() setupLoomRuns() setupFatJar() - publishMod() - publishRemap(apiArtifactId, jarSets.createJars("api", api, lib)) +} + +jarSets { + mainSet.publishRemap(platform.modArtifactId) + create("api", api, lib).publishRemap(platform.apiArtifactId) } defaultPackageInfos { From 83d0934f421b4568e3198e19360a1930997add77 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sat, 4 May 2024 16:49:32 -0700 Subject: [PATCH 51/62] Aven-jars assemble - Create separate remap tasks for the common mojmap api to get loom to populate its manifest file - Add helper method to fork a JarTaskSet and generate new remap tasks - Remove non-remap publish method - Set assemble to depend on published jar tasks again - Add companion methods to create individual jar tasks --- .../jozufozu/gradle/jarset/JarSetExtension.kt | 2 +- .../com/jozufozu/gradle/jarset/JarTaskSet.kt | 140 +++++++++++------- common/build.gradle.kts | 16 +- fabric/build.gradle.kts | 7 +- forge/build.gradle.kts | 7 +- 5 files changed, 113 insertions(+), 59 deletions(-) diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetExtension.kt index fea600095..0acac776d 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetExtension.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarSetExtension.kt @@ -24,6 +24,6 @@ open class JarSetExtension(private val project: Project) { val remapSourcesJarTask = project.tasks.named("remapSourcesJar") val javadocJarTask = project.tasks.named("javadocJar") - JarTaskSet(project, "main", jarTask, remapJarTask, sourcesJarTask, remapSourcesJarTask, javadocJarTask) + JarTaskSet(project, "main", jarTask, sourcesJarTask, javadocJarTask, remapJarTask, remapSourcesJarTask) } } diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt index 3e925626c..64bd88cbe 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt @@ -18,16 +18,16 @@ import org.gradle.kotlin.dsl.register import org.gradle.kotlin.dsl.the class JarTaskSet( - val project: Project, - val name: String, - val jar: TaskProvider, - val remapJar: TaskProvider, - val sources: TaskProvider, - val remapSources: TaskProvider, - val javadocJar: TaskProvider + private val project: Project, + private val name: String, + private val jar: TaskProvider, + private val sources: TaskProvider, + private val javadocJar: TaskProvider, + private val remapJar: TaskProvider, + private val remapSources: TaskProvider ) { - fun publishRemap(artifactId: String) { + fun publish(artifactId: String) { project.the().publications { register("${name}RemapMaven") { artifact(remapJar) @@ -38,17 +38,9 @@ class JarTaskSet( } } - fun publish(artifactId: String) { - project.the().publications { - register("${name}Maven") { - artifact(jar) - artifact(sources) - artifact(javadocJar) - this.artifactId = artifactId - } - } - } - + /** + * Create a new configuration that can be consumed by other projects, and export the base jar. + */ fun createOutgoingConfiguration() { val config = project.configurations.register(name) { isCanBeConsumed = true @@ -58,24 +50,31 @@ class JarTaskSet( project.artifacts.add(config.name, jar) } - fun assembleRemaps() { + /** + * Configure the assemble task to depend on the remap tasks and javadoc jar. + */ + fun addToAssemble() { project.tasks.named("assemble").configure { dependsOn(remapJar, remapSources, javadocJar) } } - fun configureEach(action: Action) { - jar.configure(action) - sources.configure(action) - javadocJar.configure(action) - + /** + * Configure the remap tasks with the given action. + */ + fun configureRemap(action: Action) { remapJar.configure(action) remapSources.configure(action) } - fun configureRemap(action: Action) { - remapJar.configure(action) - remapSources.configure(action) + /** + * Create a new JarTaskSet with the same base jars but new tasks for remapping. + */ + fun forkRemap(newName: String): JarTaskSet { + val remapJarTask = createRemapJar(project, newName, jar) + val remapSourcesTask = createRemapSourcesJar(project, newName, sources) + + return JarTaskSet(project, newName, jar, sources, javadocJar, remapJarTask, remapSourcesTask) } companion object { @@ -103,29 +102,40 @@ class JarTaskSet( } fun create(project: Project, name: String, vararg sourceSetSet: SourceSet): JarTaskSet { - val buildDirectory = project.layout.buildDirectory - val devlibs = buildDirectory.dir("devlibs/${name}") - val libs = buildDirectory.dir("libs/${name}") + val jarTask = createJar(project, name, sourceSetSet) + val sourcesTask = createSourcesJar(project, name, sourceSetSet) + val javadocJarTask = createJavadocJar(project, name, sourceSetSet) + + val remapJarTask = createRemapJar(project, name, jarTask) + val remapSourcesTask = createRemapSourcesJar(project, name, sourcesTask) + + return JarTaskSet(project, name, jarTask, sourcesTask, javadocJarTask, remapJarTask, remapSourcesTask) + } - val jarTask = project.tasks.register("${name}Jar") { + private fun createJar( + project: Project, + name: String, + sourceSetSet: Array + ): TaskProvider { + return project.tasks.register("${name}Jar") { group = BUILD_GROUP - destinationDirectory.set(devlibs) + destinationDirectory.set(project.layout.buildDirectory.dir("devlibs/${name}")) for (set in sourceSetSet) { from(set.output) } excludeDuplicatePackageInfos(this) } - val remapJarTask = project.tasks.register("${name}RemapJar") { - dependsOn(jarTask) - group = LOOM_GROUP - destinationDirectory.set(libs) + } - inputFile.set(jarTask.flatMap { it.archiveFile }) - } - val sourcesTask = project.tasks.register("${name}SourcesJar") { + private fun createSourcesJar( + project: Project, + name: String, + sourceSetSet: Array + ): TaskProvider { + return project.tasks.register("${name}SourcesJar") { group = BUILD_GROUP - destinationDirectory.set(devlibs) + destinationDirectory.set(project.layout.buildDirectory.dir("devlibs/${name}")) archiveClassifier.set(SOURCES_CLASSIFIER) for (set in sourceSetSet) { @@ -133,17 +143,16 @@ class JarTaskSet( } excludeDuplicatePackageInfos(this) } - val remapSourcesTask = project.tasks.register("${name}RemapSourcesJar") { - dependsOn(sourcesTask) - group = LOOM_GROUP - destinationDirectory.set(libs) - archiveClassifier.set(SOURCES_CLASSIFIER) + } - inputFile.set(sourcesTask.flatMap { it.archiveFile }) - } + private fun createJavadocJar( + project: Project, + name: String, + sourceSetSet: Array + ): TaskProvider { val javadocTask = project.tasks.register("${name}Javadoc") { group = BUILD_GROUP - setDestinationDir(buildDirectory.dir("docs/${name}-javadoc").get().asFile) + setDestinationDir(project.layout.buildDirectory.dir("docs/${name}-javadoc").get().asFile) for (set in sourceSetSet) { source(set.allJava) @@ -151,16 +160,43 @@ class JarTaskSet( } excludeDuplicatePackageInfos(this) } - val javadocJarTask = project.tasks.register("${name}JavadocJar") { + return project.tasks.register("${name}JavadocJar") { dependsOn(javadocTask) group = BUILD_GROUP - destinationDirectory.set(libs) + destinationDirectory.set(project.layout.buildDirectory.dir("libs/${name}")) archiveClassifier.set(JAVADOC_CLASSIFIER) from(javadocTask.map { it.outputs }) } + } - return JarTaskSet(project, name, jarTask, remapJarTask, sourcesTask, remapSourcesTask, javadocJarTask) + private fun createRemapJar( + project: Project, + name: String, + jar: TaskProvider + ): TaskProvider { + return project.tasks.register("${name}RemapJar") { + dependsOn(jar) + group = LOOM_GROUP + destinationDirectory.set(project.layout.buildDirectory.dir("libs/${name}")) + + inputFile.set(jar.flatMap { it.archiveFile }) + } + } + + private fun createRemapSourcesJar( + project: Project, + name: String, + jar: TaskProvider + ): TaskProvider { + return project.tasks.register("${name}RemapSourcesJar") { + dependsOn(jar) + group = LOOM_GROUP + destinationDirectory.set(project.layout.buildDirectory.dir("libs/${name}")) + archiveClassifier.set(SOURCES_CLASSIFIER) + + inputFile.set(jar.flatMap { it.archiveFile }) + } } } } diff --git a/common/build.gradle.kts b/common/build.gradle.kts index cd4b81ca1..cb95861de 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -46,8 +46,20 @@ jarSets { // For publishing. create("api", api, lib).apply { - publish("flywheel-common-mojmap-api-${property("artifact_minecraft_version")}") - publishRemap("flywheel-common-intermediary-api-${property("artifact_minecraft_version")}") + addToAssemble() + publish("flywheel-common-intermediary-api-${property("artifact_minecraft_version")}") + + // Don't publish the un-remapped jars because they don't have the correct manifest populated by Loom. + forkRemap("apiMojmap").apply { + addToAssemble() + configureRemap { + // "named" == mojmap + // We're probably remapping from named to named so Loom should noop this. + targetNamespace = "named" + } + + publish("flywheel-common-mojmap-api-${property("artifact_minecraft_version")}") + } } } diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 131955622..1d1c8e8c6 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -43,8 +43,11 @@ platform { } jarSets { - mainSet.publishRemap(platform.modArtifactId) - create("api", api, lib).publishRemap(platform.apiArtifactId) + mainSet.publish(platform.modArtifactId) + create("api", api, lib).apply { + addToAssemble() + publish(platform.apiArtifactId) + } } defaultPackageInfos { diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index 8393ade99..49359a794 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -43,8 +43,11 @@ platform { } jarSets { - mainSet.publishRemap(platform.modArtifactId) - create("api", api, lib).publishRemap(platform.apiArtifactId) + mainSet.publish(platform.modArtifactId) + create("api", api, lib).apply { + addToAssemble() + publish(platform.apiArtifactId) + } } defaultPackageInfos { From 4e83d9e0c15a725d7b113b19c37a9001dc423173 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Mon, 6 May 2024 19:18:55 -0700 Subject: [PATCH 52/62] Extending clarity - Use immutable lists for backend extensions - Copy the contents of indirect base extensions into compute extensions - Move uniform block binding to Uniforms class and make magic strings static final --- .../backend/compile/IndirectPrograms.java | 33 ++++++++++--------- .../backend/compile/InstancingPrograms.java | 4 +-- .../backend/compile/PipelineCompiler.java | 6 +--- .../backend/engine/uniform/Uniforms.java | 15 +++++++++ 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java index ff3683f96..2dea078ab 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java @@ -53,7 +53,7 @@ private IndirectPrograms(Map pipeline, Map getExtensions(GlslVersion glslVersion) { - List extensions = new ArrayList<>(); + var extensions = ImmutableList.builder(); if (glslVersion.compareTo(GlslVersion.V400) < 0) { extensions.add("GL_ARB_gpu_shader5"); } @@ -66,15 +66,18 @@ private static List getExtensions(GlslVersion glslVersion) { if (glslVersion.compareTo(GlslVersion.V460) < 0) { extensions.add("GL_ARB_shader_draw_parameters"); } - return extensions; + return extensions.build(); } private static List getComputeExtensions(GlslVersion glslVersion) { - List extensions = new ArrayList<>(); + var extensions = ImmutableList.builder(); + + extensions.addAll(EXTENSIONS); + if (glslVersion.compareTo(GlslVersion.V430) < 0) { extensions.add("GL_ARB_compute_shader"); } - return extensions; + return extensions.build(); } static void reload(ShaderSources sources, ImmutableList pipelineKeys, List vertexComponents, List fragmentComponents) { @@ -86,12 +89,12 @@ static void reload(ShaderSources sources, ImmutableList pipe var pipelineCompiler = PipelineCompiler.create(sources, Pipelines.INDIRECT, vertexComponents, fragmentComponents, EXTENSIONS); var cullingCompiler = createCullingCompiler(sources); - var applyCompiler = createUtilCompiler(sources); + var utilCompiler = createUtilCompiler(sources); try { var pipelineResult = pipelineCompiler.compileAndReportErrors(pipelineKeys); var cullingResult = cullingCompiler.compileAndReportErrors(createCullingKeys()); - var utils = applyCompiler.compileAndReportErrors(List.of(APPLY_SHADER_MAIN, SCATTER_SHADER_MAIN)); + var utils = utilCompiler.compileAndReportErrors(List.of(APPLY_SHADER_MAIN, SCATTER_SHADER_MAIN)); if (pipelineResult != null && cullingResult != null && utils != null) { newInstance = new IndirectPrograms(pipelineResult, cullingResult, utils.get(APPLY_SHADER_MAIN), utils.get(SCATTER_SHADER_MAIN)); @@ -102,16 +105,18 @@ static void reload(ShaderSources sources, ImmutableList pipe pipelineCompiler.delete(); cullingCompiler.delete(); - applyCompiler.delete(); + utilCompiler.delete(); setInstance(newInstance); } + /** + * A compiler for cull shaders, parameterized by the instance type. + */ private static CompilationHarness> createCullingCompiler(ShaderSources sources) { return CULL.program() .link(CULL.shader(GlCompat.MAX_GLSL_VERSION, ShaderType.COMPUTE) .nameMapper(instanceType -> "culling/" + ResourceUtil.toDebugFileNameNoExtension(instanceType.cullShader())) - .requireExtensions(EXTENSIONS) .requireExtensions(COMPUTE_EXTENSIONS) .define("_FLW_SUBGROUP_SIZE", GlCompat.SUBGROUP_SIZE) .withResource(CULL_SHADER_API_IMPL) @@ -119,21 +124,17 @@ private static CompilationHarness> createCullingCompiler(ShaderS .withResource(InstanceType::cullShader) .withComponent(SsboInstanceComponent::new) .withResource(CULL_SHADER_MAIN)) - .postLink((key, program) -> { - program.setUniformBlockBinding("_FlwFrameUniforms", Uniforms.FRAME_INDEX); - program.setUniformBlockBinding("_FlwFogUniforms", Uniforms.FOG_INDEX); - program.setUniformBlockBinding("_FlwOptionsUniforms", Uniforms.OPTIONS_INDEX); - program.setUniformBlockBinding("_FlwPlayerUniforms", Uniforms.PLAYER_INDEX); - program.setUniformBlockBinding("_FlwLevelUniforms", Uniforms.LEVEL_INDEX); - }) + .postLink((key, program) -> Uniforms.setUniformBlockBindings(program)) .harness("culling", sources); } + /** + * A compiler for utility shaders, directly compiles the shader at the resource location specified by the parameter. + */ private static CompilationHarness createUtilCompiler(ShaderSources sources) { return UTIL.program() .link(UTIL.shader(GlCompat.MAX_GLSL_VERSION, ShaderType.COMPUTE) .nameMapper(resourceLocation -> "utilities/" + ResourceUtil.toDebugFileNameNoExtension(resourceLocation)) - .requireExtensions(EXTENSIONS) .requireExtensions(COMPUTE_EXTENSIONS) .define("_FLW_SUBGROUP_SIZE", GlCompat.SUBGROUP_SIZE) .withResource(s -> s)) diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java index c2320af3b..0d9b3de7c 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java @@ -28,11 +28,11 @@ private InstancingPrograms(Map pipeline) { } private static List getExtensions(GlslVersion glslVersion) { - List extensions = new ArrayList<>(); + var extensions = ImmutableList.builder(); if (glslVersion.compareTo(GlslVersion.V330) < 0) { extensions.add("GL_ARB_shader_bit_encoding"); } - return extensions; + return extensions.build(); } static void reload(ShaderSources sources, ImmutableList pipelineKeys, List vertexComponents, List fragmentComponents) { diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java index c969674ef..09fbe049b 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java @@ -71,11 +71,7 @@ static CompilationHarness create(ShaderSources sources, Pipe program.bindAttribLocation("_flw_aNormal", 5); }) .postLink((key, program) -> { - program.setUniformBlockBinding("_FlwFrameUniforms", Uniforms.FRAME_INDEX); - program.setUniformBlockBinding("_FlwFogUniforms", Uniforms.FOG_INDEX); - program.setUniformBlockBinding("_FlwOptionsUniforms", Uniforms.OPTIONS_INDEX); - program.setUniformBlockBinding("_FlwPlayerUniforms", Uniforms.PLAYER_INDEX); - program.setUniformBlockBinding("_FlwLevelUniforms", Uniforms.LEVEL_INDEX); + Uniforms.setUniformBlockBindings(program); program.bind(); diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java index 8fa7e0115..057e506ed 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/Uniforms.java @@ -1,6 +1,7 @@ package com.jozufozu.flywheel.backend.engine.uniform; import com.jozufozu.flywheel.api.event.RenderContext; +import com.jozufozu.flywheel.backend.gl.shader.GlProgram; public final class Uniforms { public static final int FRAME_INDEX = 0; @@ -9,6 +10,12 @@ public final class Uniforms { public static final int PLAYER_INDEX = 3; public static final int LEVEL_INDEX = 4; + public static final String FRAME_BLOCK_NAME = "_FlwFrameUniforms"; + public static final String FOG_BLOCK_NAME = "_FlwFogUniforms"; + public static final String OPTIONS_BLOCK_NAME = "_FlwOptionsUniforms"; + public static final String PLAYER_BLOCK_NAME = "_FlwPlayerUniforms"; + public static final String LEVEL_BLOCK_NAME = "_FlwLevelUniforms"; + private static final UniformBuffer[] ALL_BUFFERS = { FrameUniforms.BUFFER, FogUniforms.BUFFER, OptionsUniforms.BUFFER, PlayerUniforms.BUFFER, LevelUniforms.BUFFER }; private Uniforms() { @@ -32,6 +39,14 @@ private static void deleteAll() { } } + public static void setUniformBlockBindings(GlProgram program) { + program.setUniformBlockBinding(FRAME_BLOCK_NAME, FRAME_INDEX); + program.setUniformBlockBinding(FOG_BLOCK_NAME, FOG_INDEX); + program.setUniformBlockBinding(OPTIONS_BLOCK_NAME, OPTIONS_INDEX); + program.setUniformBlockBinding(PLAYER_BLOCK_NAME, PLAYER_INDEX); + program.setUniformBlockBinding(LEVEL_BLOCK_NAME, LEVEL_INDEX); + } + public static void onReloadLevelRenderer() { deleteAll(); } From d5cdabb26a606fc9a214fc714cbb3d0302968b53 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Thu, 9 May 2024 12:09:19 -0700 Subject: [PATCH 53/62] JSON Fabrication - Add rudimentary JSON parsing to load a config on fabric - Save the config file after a config command changes --- .../flywheel/impl/FabricFlwConfig.java | 143 +++++++++++++++++- .../jozufozu/flywheel/impl/FlwCommands.java | 13 +- .../flywheel/impl/FlywheelFabric.java | 3 + 3 files changed, 149 insertions(+), 10 deletions(-) diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java index 0c2bc0797..f8ec8ff37 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java @@ -1,15 +1,48 @@ package com.jozufozu.flywheel.impl; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.nio.file.Path; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.google.gson.JsonPrimitive; +import com.jozufozu.flywheel.Flywheel; import com.jozufozu.flywheel.api.backend.Backend; import com.jozufozu.flywheel.api.backend.BackendManager; -// TODO: Fabric config +import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.ResourceLocationException; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; + public class FabricFlwConfig implements FlwConfig { - public static final FabricFlwConfig INSTANCE = new FabricFlwConfig(); + public static final Path PATH = FabricLoader.getInstance() + .getConfigDir() + .resolve("flywheel.json"); + + public static final FabricFlwConfig INSTANCE = new FabricFlwConfig(PATH.toFile()); + + protected static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); + + public static final int WORKER_THREADS_DEFAULT = -1; + public static final int WORKER_THREADS_MAX = Runtime.getRuntime() + .availableProcessors(); + public static final boolean LIMIT_UPDATES_DEFAULT = true; public Backend backend = BackendManager.getDefaultBackend(); - public boolean limitUpdates = true; - public int workerThreads = -1; + public boolean limitUpdates = LIMIT_UPDATES_DEFAULT; + public int workerThreads = WORKER_THREADS_DEFAULT; + + private final File file; + + public FabricFlwConfig(File file) { + this.file = file; + } @Override public Backend backend() { @@ -25,4 +58,106 @@ public boolean limitUpdates() { public int workerThreads() { return workerThreads; } + + public void load() { + if (file.exists()) { + try (FileReader reader = new FileReader(file)) { + fromJson(JsonParser.parseReader(reader)); + } catch (Exception e) { + Flywheel.LOGGER.error("Could not load config from file '{}'", file.getAbsolutePath(), e); + } + } + // In case we found an error in the config file, immediately save to fix it. + save(); + } + + public void save() { + try (FileWriter writer = new FileWriter(file)) { + GSON.toJson(toJson(), writer); + } catch (Exception e) { + Flywheel.LOGGER.error("Could not save config to file '{}'", file.getAbsolutePath(), e); + } + } + + public void fromJson(JsonElement json) { + if (!(json instanceof JsonObject object)) { + backend = BackendManager.getDefaultBackend(); + limitUpdates = LIMIT_UPDATES_DEFAULT; + workerThreads = WORKER_THREADS_DEFAULT; + return; + } + + readBackend(object); + readLimitUpdates(object); + readWorkerThreads(object); + } + + private void readBackend(JsonObject object) { + var backendJson = object.get("backend"); + + String err = null; + + if (backendJson instanceof JsonPrimitive primitive && primitive.isString()) { + var backendString = primitive.getAsString(); + try { + this.backend = Backend.REGISTRY.getOrThrow(new ResourceLocation(backendString)); + return; + } catch (IllegalArgumentException e) { + err = "backend ID '" + backendString + "' is not registered"; + } catch (ResourceLocationException e) { + err = "backend '" + backendString + "' is not a valid resource location"; + } catch (Exception e) { + // Something else went wrong? This should be dead code. + err = "backend '" + backendString + "' is invalid"; + } + } else if (backendJson != null) { + err = "backend must be a string"; + } + + // Don't log an error if the field is missing. + if (err != null) { + Flywheel.LOGGER.warn(err); + } + backend = BackendManager.getDefaultBackend(); + } + + private void readLimitUpdates(JsonObject object) { + var limitUpdatesJson = object.get("limitUpdates"); + if (limitUpdatesJson instanceof JsonPrimitive primitive && primitive.isBoolean()) { + limitUpdates = primitive.getAsBoolean(); + return; + } else if (limitUpdatesJson != null) { + Flywheel.LOGGER.warn("limitUpdates must be a boolean"); + } + limitUpdates = LIMIT_UPDATES_DEFAULT; + } + + private void readWorkerThreads(JsonObject object) { + var workerThreadsJson = object.get("workerThreads"); + + if (workerThreadsJson instanceof JsonPrimitive primitive && primitive.isNumber()) { + int configuredValue = primitive.getAsInt(); + + int clamped = Mth.clamp(configuredValue, WORKER_THREADS_DEFAULT, WORKER_THREADS_MAX); + + if (clamped != configuredValue) { + Flywheel.LOGGER.warn("workerThreads value of {} is out of range, clamping to {}", configuredValue, clamped); + } + + workerThreads = clamped; + return; + } else if (workerThreadsJson != null) { + Flywheel.LOGGER.warn("workerThreads must be an integer"); + } + + workerThreads = WORKER_THREADS_DEFAULT; + } + + public JsonObject toJson() { + JsonObject object = new JsonObject(); + object.addProperty("limitUpdates", limitUpdates); + object.addProperty("workerThreads", workerThreads); + object.addProperty("backend", Backend.REGISTRY.getIdOrThrow(backend).toString()); + return object; + } } diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java index 7a40b1167..5e5f44dd2 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java @@ -25,8 +25,6 @@ private FlwCommands() { } public static void registerClientCommands(CommandDispatcher dispatcher, CommandBuildContext buildContext) { - FabricFlwConfig config = FabricFlwConfig.INSTANCE; - LiteralArgumentBuilder command = ClientCommandManager.literal("flywheel"); command.then(ClientCommandManager.literal("backend") @@ -40,7 +38,8 @@ public static void registerClientCommands(CommandDispatcher { Backend requestedBackend = context.getArgument("id", Backend.class); - config.backend = requestedBackend; + FabricFlwConfig.INSTANCE.backend = requestedBackend; + FabricFlwConfig.INSTANCE.save(); // Reload renderers so we can report the actual backend. Minecraft.getInstance().levelRenderer.allChanged(); @@ -60,7 +59,7 @@ public static void registerClientCommands(CommandDispatcher { - if (config.limitUpdates) { + if (FabricFlwConfig.INSTANCE.limitUpdates) { context.getSource().sendFeedback(Component.translatable("command.flywheel.limit_updates.get.on")); } else { context.getSource().sendFeedback(Component.translatable("command.flywheel.limit_updates.get.off")); @@ -69,14 +68,16 @@ public static void registerClientCommands(CommandDispatcher { - config.limitUpdates = true; + FabricFlwConfig.INSTANCE.limitUpdates = true; + FabricFlwConfig.INSTANCE.save(); context.getSource().sendFeedback(Component.translatable("command.flywheel.limit_updates.set.on")); Minecraft.getInstance().levelRenderer.allChanged(); return Command.SINGLE_SUCCESS; })) .then(ClientCommandManager.literal("off") .executes(context -> { - config.limitUpdates = false; + FabricFlwConfig.INSTANCE.limitUpdates = false; + FabricFlwConfig.INSTANCE.save(); context.getSource().sendFeedback(Component.translatable("command.flywheel.limit_updates.set.off")); Minecraft.getInstance().levelRenderer.allChanged(); return Command.SINGLE_SUCCESS; diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java index 0885191ab..e4f58f5d8 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java @@ -44,6 +44,9 @@ public void onInitializeClient() { // FIXME: Registries cannot be frozen this early. FlywheelInit.freezeRegistries(); + // Have to load the config after we freeze registries, + // so we can find third party backends. + FabricFlwConfig.INSTANCE.load(); } private static void setupImpl() { From 3b94a46a1e4f785a12b483b19a7266967b44787f Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Fri, 10 May 2024 17:11:49 -0700 Subject: [PATCH 54/62] Vulcan't - Catch exception from GlCapabilities to detect vulkanmod and similar --- .../flywheel/backend/gl/GlCompat.java | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java index 3fa3c54a1..ae11d94d0 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java @@ -2,6 +2,7 @@ import java.nio.ByteBuffer; +import org.jetbrains.annotations.UnknownNullability; import org.lwjgl.PointerBuffer; import org.lwjgl.opengl.GL; import org.lwjgl.opengl.GL20; @@ -11,12 +12,26 @@ import org.lwjgl.opengl.KHRShaderSubgroup; import org.lwjgl.system.MemoryStack; +import com.jozufozu.flywheel.Flywheel; import com.jozufozu.flywheel.backend.compile.core.Compilation; import com.jozufozu.flywheel.backend.glsl.GlslVersion; import com.jozufozu.flywheel.lib.math.MoreMath; public final class GlCompat { - public static final GLCapabilities CAPABILITIES = GL.getCapabilities(); + @UnknownNullability + public static final GLCapabilities CAPABILITIES; + static { + GLCapabilities caps; + try { + caps = GL.getCapabilities(); + } catch (IllegalStateException e) { + // This happens with vulkanmod installed. + Flywheel.LOGGER.warn("Failed to get GL capabilities, all flywheel backends will be disabled."); + caps = null; + } + CAPABILITIES = caps; + } + public static final Driver DRIVER = readVendorString(); public static final int SUBGROUP_SIZE = subgroupSize(); public static final boolean ALLOW_DSA = true; @@ -57,6 +72,10 @@ public static void safeShaderSource(int glId, CharSequence source) { } private static Driver readVendorString() { + if (CAPABILITIES == null) { + return Driver.UNKNOWN; + } + String vendor = GL20C.glGetString(GL20C.GL_VENDOR); if (vendor == null) { @@ -78,6 +97,9 @@ private static Driver readVendorString() { } private static int subgroupSize() { + if (CAPABILITIES == null) { + return 32; + } if (CAPABILITIES.GL_KHR_shader_subgroup) { return GL31C.glGetInteger(KHRShaderSubgroup.GL_SUBGROUP_SIZE_KHR); } @@ -91,6 +113,9 @@ private static int subgroupSize() { } private static boolean isInstancingSupported() { + if (CAPABILITIES == null) { + return false; + } if (CAPABILITIES.OpenGL33) { return true; } @@ -98,6 +123,9 @@ private static boolean isInstancingSupported() { } private static boolean isIndirectSupported() { + if (CAPABILITIES == null) { + return false; + } if (CAPABILITIES.OpenGL46) { return true; } @@ -118,6 +146,10 @@ private static boolean isIndirectSupported() { * @return The highest glsl version that could be compiled. */ private static GlslVersion maxGlslVersion() { + if (CAPABILITIES == null) { + return GlslVersion.V150; + } + var glslVersions = GlslVersion.values(); // No need to test glsl 150 as that is guaranteed to be supported by MC. for (int i = glslVersions.length - 1; i > 0; i--) { From eec87916d6871764c081f847092c79573f866d0d Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Fri, 10 May 2024 18:20:35 -0700 Subject: [PATCH 55/62] Burning books - Remove changelog.txt - Remove old gradle properties - Update readme but nothing comprehensive --- README.md | 6 ++- changelog.txt | 115 ---------------------------------------------- gradle.properties | 7 +-- 3 files changed, 5 insertions(+), 123 deletions(-) delete mode 100644 changelog.txt diff --git a/README.md b/README.md index 95d7ba6ba..82d4ede4b 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,12 @@ repositories { } dependencies { - implementation fg.deobf("com.jozufozu.flywheel:Flywheel-Forge:${flywheel_version}") + compileOnly fg.deobf("com.jozufozu.flywheel:flywheel-forge-api-${minecraft_version}:${flywheel_version}") + runtimeOnly fg.deobf("com.jozufozu.flywheel:flywheel-forge-${minecraft_version}:${flywheel_version}") } ``` -`${flywheel_version}` gets replaced by the version of Flywheel you want to use, eg. `1.18-0.3.0.3` +`${flywheel_version}` gets replaced by the version of Flywheel you want to use, eg. `1.0.0-beta` +`${minecraft_version}` gets replaced by the version of Minecraft you're on, eg. `1.20.1` For a list of available Flywheel versions, you can check [the maven](https://maven.tterrag.com/com/jozufozu/flywheel/Flywheel-Forge/). diff --git a/changelog.txt b/changelog.txt deleted file mode 100644 index 9ccbe5e24..000000000 --- a/changelog.txt +++ /dev/null @@ -1,115 +0,0 @@ -0.6.8: -Fixes - - Fix colored vertices being incorrectly rendered through instancing - - Fix some miscellaneous bugs with sodium/rubidium - - Fix memory leak associated with model storage -Technical/API - - Memory for models is freed when they are no longer in use - - Element buffers now deal in raw gl handles - - Element buffers are no longer considered part of state resoration - - Quad -> Tri element buffer properly resets itself - -0.6.7: -...is 1.19 only :ioa: - -0.6.6: -Fixes - - Fix instanced entities not rendering correctly when chunk loading is slow -Technical/API - - GL state is more reliably managed - - Slight memory improvements when using Iris/Oculus through lazy instatiation - -0.6.5: -Fixes - - Fix crash with batching backend and Rubidium - -0.6.4: -Fixes - - Fix shader detection with oculus -Technical/API - - LightUpdater is simplified to increase reliability and reflect how it is actually used - - ModelUtil is superseded by model builders, to be improved more in 0.7.0 - - VertexLists now copy input buffers to reduce memory usage - -0.6.3: -Technical/API - - Light updates are now processed in parallel. - - The light updater is now more selective of the levels it processes, fixing a memory leak. - -0.6.2: -Update to 1.18.2 - -0.6.1: -Fixes -- Fix crash when loading block entities for Flywheel to render, most common when exploring the end. -- Fix occasional visual artifacts when enabling optifine shaders. -Technical/API -- Added more debug information to the F3 screen. -- Distance update limiting can now be disabled. - -0.6.0: -With this release, Flywheel is no longer needed on servers! Forge finally has client commands, -and the /flywheel command now takes advantage of this. -Fixes - - Fix crash when running with sodium/magnesium. -Technical/API - - Backend is now a static class. - - Shaders are now compiled on-the-fly and cached. - - Significantly reduced the amount of boilerplate needed in instancing shaders. - - Struct types no longer need to be registered ahead of time. - - Simplify unnecessarily complicated game state system. - -0.5.1: -Fixes - - Fix crash on resource reload with backend off - - Fix artifacts while using Optifine shaders - - Fix crash when trying to access biomes in a VirtualRenderWorld -Technical/API - - Refactor instance renderer registration to separate client and server logic (thanks Pepper!) - - VirtualRenderWorlds now have a "biomeOffset" field which gets added when looking up biomes - - Added GlStateTracker which hooks into GlStateManager to track changes in buffer, vertex array, and program bindings - -0.5.0a: -Fixes - - Address crash experienced by some users while rendering any tile. - - Fix crash caused by loading a world with flywheel backend off. - -0.5.0: -New - - Added parallel batching backend, effectively a CPU instancer. - - Now partially compatible with starlight. -Technical/API - - Much more flexible vertex formats. - - Do instance updates/ticking entirely async. - -0.4.2-rc: -Fixes - - Partially fix crash on intel and mesa drivers (needs Create to update) - - Fix garbage rendering on AMD GPUs - -0.4.1: -Update to 1.18.1 -Changes - - Use cylindrical fog to match vanilla -Fixes - - Fix crash affecting systems that don't support persistent mapping - - Fix crash when Create contraptions extend below Y=0 - - Fix Create contraptions having misaligned light when launched after world load - - Fix minecarts disappearing on chunk reload - -0.4.0: -Update to 1.18 -Fixes - - Fix potential nullpointer rendering breaking overlay - - Fix inconsistency in minecart model - - Fix memory leak when instance worlds get reset -Technical/API - - No more MaterialSpec, everything is StructType - - Move most user facing interfaces to flywheel.api package - - Refactor InstanceData to have no package private fields - - Rename many interfaces - - All materials use the same vertex format: UNLIT_MODEL - - call #tick and #beginFrame on instance creation - - Fixes weird delay in object appearance when reloading chunks - - Add instances when chunks are built for rendering - - Server worlds are not flywheel worlds diff --git a/gradle.properties b/gradle.properties index 0f45aed79..3b9b3881f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.daemon = false # Mod metadata mod_id = flywheel mod_name = Flywheel -mod_version = 1.0.0-alpha +mod_version = 1.0.0-beta mod_description = An overhauled entity and block entity rendering API. mod_license = MIT mod_sources = https://github.com/Jozufozu/Flywheel @@ -37,8 +37,3 @@ oculus_version = 1.20.1-1.6.15a # Publication info artifact_minecraft_version = 1.20.1 - -#forgegradle_version = [6.0.16,6.2) -#mixingradle_version = 0.7.+ -#mixin_version = 0.8.5 -#librarian_version = 1.+ From 30cdeaaa3f97a3171fa097f7eedfad2f9f0d16aa Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Sat, 11 May 2024 22:17:52 -0700 Subject: [PATCH 56/62] Update CI --- .github/workflows/build.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68993ed5f..2c2fb92d4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,11 +13,11 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Validate Gradle Wrapper - uses: gradle/wrapper-validation-action@v1 + uses: gradle/wrapper-validation-action@v3 - name: Gradle Cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.gradle/caches @@ -26,8 +26,9 @@ jobs: build/ key: ${{ runner.os }}-jdk${{ matrix.java }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties', '**/gradle-wrapper.properties', '.github/workflows/build.yml') }} - name: Setup JDK ${{ matrix.java }} - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + distribution: 'temurin' java-version: ${{ matrix.java }} - name: Make Gradle Wrapper Executable if: ${{ runner.os != 'Windows' }} @@ -37,7 +38,7 @@ jobs: run: ./gradlew publish --no-daemon - name: Capture Build Artifacts if: ${{ runner.os == 'Linux' && matrix.java == '17' }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Artifacts path: build/libs/ From 5083ad2b5764dc2e97955099c9f4bdbcd6ea58d3 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Sat, 11 May 2024 22:35:38 -0700 Subject: [PATCH 57/62] Fix upload-artifacts path --- .github/workflows/build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c2fb92d4..7f4f380b1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,4 +41,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: Artifacts - path: build/libs/ + path: | + common/build/libs/ + fabric/build/libs/ + forge/build/libs/ From 1f6972a70bb5a886dad37c99f2adc909913776b7 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Sat, 11 May 2024 23:12:22 -0700 Subject: [PATCH 58/62] Upgrade gradle-wrapper action --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f4f380b1..dd1169eae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Validate Gradle Wrapper - uses: gradle/wrapper-validation-action@v3 + uses: gradle/actions/wrapper-validation@v3 - name: Gradle Cache uses: actions/cache@v4 with: From c5a6fe98c25edecd20ad4d4daba1f8c7a635fc33 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Sun, 12 May 2024 01:45:28 -0700 Subject: [PATCH 59/62] Fix api artifacts getting remapped by consumers --- .../gradle/platform/PlatformExtension.kt | 4 ++- common/src/lib/resources/fabric.mod.json | 31 +++++++++++++++++++ .../{main => lib}/resources/fabric.mod.json | 0 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 common/src/lib/resources/fabric.mod.json rename fabric/src/{main => lib}/resources/fabric.mod.json (100%) diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt index 2b5268a18..281f5eb16 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt @@ -75,7 +75,9 @@ open class PlatformExtension(val project: Project) { source(commonSourceSet.allJava) } named(it.processResourcesTaskName).configure { - from(commonSourceSet.resources) + from(commonSourceSet.resources) { + exclude("fabric.mod.json") + } } } } diff --git a/common/src/lib/resources/fabric.mod.json b/common/src/lib/resources/fabric.mod.json new file mode 100644 index 000000000..39c1d15f3 --- /dev/null +++ b/common/src/lib/resources/fabric.mod.json @@ -0,0 +1,31 @@ +{ + "__comment": "This is to make sure api artifacts get remapped properly", + "schemaVersion": 1, + "id": "${mod_id}", + "version": "${mod_version}", + "name": "${mod_name}", + "description": "${mod_description}", + "authors": [ + "Jozufozu", + "PepperCode1" + ], + "contact": { + "homepage": "${mod_homepage}", + "sources": "${mod_sources}", + "issues": "${mod_issues}" + }, + "license": "${mod_license}", + "icon": "logo.png", + "environment": "client", + "entrypoints": { + }, + "mixins": [ + ], + "depends": { + "minecraft": "${minecraft_semver_version_range}", + "fabric-api": "${fabric_api_version_range}" + }, + "breaks": { + "sodium": "<0.5.0" + } +} diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/lib/resources/fabric.mod.json similarity index 100% rename from fabric/src/main/resources/fabric.mod.json rename to fabric/src/lib/resources/fabric.mod.json From f4ace71821d742c3d316ed08ed8bd59d1813db49 Mon Sep 17 00:00:00 2001 From: Kneelawk Date: Sun, 12 May 2024 02:48:25 -0700 Subject: [PATCH 60/62] Use better method for telling loom to remap api artifacts This reverts commit c5a6fe98c25edecd20ad4d4daba1f8c7a635fc33. --- .../com/jozufozu/gradle/jarset/JarTaskSet.kt | 8 +++++ .../gradle/platform/PlatformExtension.kt | 4 +-- common/build.gradle.kts | 6 ++++ common/src/lib/resources/fabric.mod.json | 31 ------------------- fabric/build.gradle.kts | 6 ++++ .../{lib => main}/resources/fabric.mod.json | 0 forge/build.gradle.kts | 6 ++++ 7 files changed, 27 insertions(+), 34 deletions(-) delete mode 100644 common/src/lib/resources/fabric.mod.json rename fabric/src/{lib => main}/resources/fabric.mod.json (100%) diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt index 64bd88cbe..0bb7e09d2 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/jarset/JarTaskSet.kt @@ -67,6 +67,14 @@ class JarTaskSet( remapSources.configure(action) } + /** + * Configure the jar tasks with the given action. + */ + fun configureJar(action: Action) { + jar.configure(action) + sources.configure(action) + } + /** * Create a new JarTaskSet with the same base jars but new tasks for remapping. */ diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt index 281f5eb16..2b5268a18 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt @@ -75,9 +75,7 @@ open class PlatformExtension(val project: Project) { source(commonSourceSet.allJava) } named(it.processResourcesTaskName).configure { - from(commonSourceSet.resources) { - exclude("fabric.mod.json") - } + from(commonSourceSet.resources) } } } diff --git a/common/build.gradle.kts b/common/build.gradle.kts index cb95861de..23d1f23b4 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -49,6 +49,12 @@ jarSets { addToAssemble() publish("flywheel-common-intermediary-api-${property("artifact_minecraft_version")}") + configureJar { + manifest { + attributes("Fabric-Loom-Remap" to "true") + } + } + // Don't publish the un-remapped jars because they don't have the correct manifest populated by Loom. forkRemap("apiMojmap").apply { addToAssemble() diff --git a/common/src/lib/resources/fabric.mod.json b/common/src/lib/resources/fabric.mod.json deleted file mode 100644 index 39c1d15f3..000000000 --- a/common/src/lib/resources/fabric.mod.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "__comment": "This is to make sure api artifacts get remapped properly", - "schemaVersion": 1, - "id": "${mod_id}", - "version": "${mod_version}", - "name": "${mod_name}", - "description": "${mod_description}", - "authors": [ - "Jozufozu", - "PepperCode1" - ], - "contact": { - "homepage": "${mod_homepage}", - "sources": "${mod_sources}", - "issues": "${mod_issues}" - }, - "license": "${mod_license}", - "icon": "logo.png", - "environment": "client", - "entrypoints": { - }, - "mixins": [ - ], - "depends": { - "minecraft": "${minecraft_semver_version_range}", - "fabric-api": "${fabric_api_version_range}" - }, - "breaks": { - "sodium": "<0.5.0" - } -} diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 1d1c8e8c6..b2c53440d 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -47,6 +47,12 @@ jarSets { create("api", api, lib).apply { addToAssemble() publish(platform.apiArtifactId) + + configureJar { + manifest { + attributes("Fabric-Loom-Remap" to "true") + } + } } } diff --git a/fabric/src/lib/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json similarity index 100% rename from fabric/src/lib/resources/fabric.mod.json rename to fabric/src/main/resources/fabric.mod.json diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index 49359a794..5f51cc55e 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -47,6 +47,12 @@ jarSets { create("api", api, lib).apply { addToAssemble() publish(platform.apiArtifactId) + + configureJar { + manifest { + attributes("Fabric-Loom-Remap" to "true") + } + } } } From e5384c23dc4b761718f684e865f8aea863f70006 Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Sun, 12 May 2024 16:01:08 -0700 Subject: [PATCH 61/62] Fix registry freeze timing - Move registry freezing to right before start of initial resource reload - Also warn if Fabric config JSON is not an object - Move Flywheel.java to API - Remove Flywheel.LOGGER and others; add impl-specific and backend-specific loggers - Remove unused mixins - Organize imports --- .../gradle/platform/PlatformExtension.kt | 9 ++- .../gradle/subproject/SubprojectPlugin.kt | 1 - .../TransitiveSourceSetsExtension.kt | 2 - .../com/jozufozu/flywheel/api}/Flywheel.java | 6 +- .../jozufozu/flywheel/backend/Backends.java | 2 +- .../jozufozu/flywheel/backend/FlwBackend.java | 18 ++++++ .../flywheel/backend/InternalVertex.java | 2 +- .../flywheel/backend/compile/FlwPrograms.java | 4 +- .../backend/compile/IndirectPrograms.java | 3 +- .../backend/compile/InstancingPrograms.java | 1 - .../backend/compile/PipelineCompiler.java | 3 +- .../flywheel/backend/compile/Pipelines.java | 2 +- .../BufferTextureInstanceComponent.java | 2 +- .../component/InstanceStructComponent.java | 2 +- .../component/SsboInstanceComponent.java | 2 +- .../StringSubstitutionComponent.java | 2 +- .../component/UberShaderComponent.java | 2 +- .../compile/core/FailedCompilation.java | 2 +- .../flywheel/backend/engine/DrawManager.java | 4 +- .../backend/engine/uniform/FrameUniforms.java | 2 +- .../flywheel/backend/gl/GlCompat.java | 4 +- .../backend/mixin/GameRendererAccessor.java | 23 -------- .../backend/mixin/LevelRendererAccessor.java | 2 +- .../backend/mixin/LightTextureAccessor.java | 13 ----- .../flywheel/backend/mixin/OptionsMixin.java | 2 +- .../backend/mixin/OverlayTextureAccessor.java | 13 ----- .../resources/flywheel.backend.mixins.json | 3 - .../flywheel/lib/instance/InstanceTypes.java | 2 +- .../flywheel/lib/internal/FlwLibLink.java | 4 ++ .../flywheel/lib/material/CutoutShaders.java | 2 +- .../flywheel/lib/material/FogShaders.java | 2 +- .../lib/material/StandardMaterialShaders.java | 2 +- .../lib/memory/DebugMemoryBlockImpl.java | 4 +- .../flywheel/lib/util/ResourceUtil.java | 2 +- .../flywheel/lib/util/ShadersModHandler.java | 11 ++-- .../lib/visual/SimpleDynamicVisual.java | 1 - .../lib/visual/SimpleTickableVisual.java | 1 - .../flywheel/impl/BackendManagerImpl.java | 8 +-- .../impl/{FlywheelInit.java => FlwImpl.java} | 17 ++++-- .../flywheel/impl/FlwLibLinkImpl.java | 7 +++ .../impl/mixin/ClientChunkCacheMixin.java | 6 +- .../impl/mixin/LevelRendererMixin.java | 2 +- .../impl/task/ParallelTaskExecutor.java | 15 ++--- .../flywheel/backend/glsl/TestBase.java | 2 +- .../backend/compile/FlwProgramsReloader.java | 2 +- .../model/baked/PartialModelEventHandler.java | 2 +- .../flywheel/impl/FabricFlwConfig.java | 56 +++++++++---------- .../flywheel/impl/FlywheelFabric.java | 10 +--- .../flywheel/impl/mixin/MinecraftMixin.java | 10 ++++ .../jozufozu/flywheel/impl/FlwCommands.java | 6 +- .../flywheel/impl/FlwLibXplatImpl.java | 6 +- .../jozufozu/flywheel/impl/FlywheelForge.java | 7 +-- .../flywheel/impl/ForgeFlwConfig.java | 7 +-- .../flywheel/impl/mixin/MinecraftMixin.java | 10 ++++ 54 files changed, 147 insertions(+), 188 deletions(-) rename common/src/{lib/java/com/jozufozu/flywheel => api/java/com/jozufozu/flywheel/api}/Flywheel.java (61%) create mode 100644 common/src/backend/java/com/jozufozu/flywheel/backend/FlwBackend.java delete mode 100644 common/src/backend/java/com/jozufozu/flywheel/backend/mixin/GameRendererAccessor.java delete mode 100644 common/src/backend/java/com/jozufozu/flywheel/backend/mixin/LightTextureAccessor.java delete mode 100644 common/src/backend/java/com/jozufozu/flywheel/backend/mixin/OverlayTextureAccessor.java rename common/src/main/java/com/jozufozu/flywheel/impl/{FlywheelInit.java => FlwImpl.java} (69%) diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt index 2b5268a18..dec97abf7 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/platform/PlatformExtension.kt @@ -2,17 +2,16 @@ package com.jozufozu.gradle.platform import com.jozufozu.gradle.jarset.JarTaskSet import net.fabricmc.loom.api.LoomGradleExtensionAPI -import net.fabricmc.loom.task.RemapJarTask -import net.fabricmc.loom.task.RemapSourcesJarTask import org.gradle.api.Project -import org.gradle.api.publish.PublishingExtension -import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.tasks.SourceSet import org.gradle.api.tasks.SourceSetContainer import org.gradle.api.tasks.compile.JavaCompile import org.gradle.api.tasks.javadoc.Javadoc import org.gradle.jvm.tasks.Jar -import org.gradle.kotlin.dsl.* +import org.gradle.kotlin.dsl.named +import org.gradle.kotlin.dsl.provideDelegate +import org.gradle.kotlin.dsl.the +import org.gradle.kotlin.dsl.withType import org.gradle.language.jvm.tasks.ProcessResources import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt index b448b7e0d..d39d0d9b4 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/subproject/SubprojectPlugin.kt @@ -19,7 +19,6 @@ import org.gradle.jvm.toolchain.JavaLanguageVersion import org.gradle.kotlin.dsl.* import org.gradle.language.jvm.tasks.ProcessResources - class SubprojectPlugin: Plugin { override fun apply(project: Project) { project.extensions.create("defaultPackageInfos", PackageInfosExtension::class.java, project) diff --git a/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsExtension.kt b/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsExtension.kt index e549cc158..9ebbe2dab 100644 --- a/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsExtension.kt +++ b/buildSrc/src/main/kotlin/com/jozufozu/gradle/transitive/TransitiveSourceSetsExtension.kt @@ -4,8 +4,6 @@ import org.gradle.api.Action import org.gradle.api.Project import org.gradle.api.file.FileCollection import org.gradle.api.tasks.SourceSet -import org.gradle.api.tasks.SourceSetContainer -import org.gradle.kotlin.dsl.the open class TransitiveSourceSetsExtension(private val project: Project) { var compileClasspath: FileCollection? = null diff --git a/common/src/lib/java/com/jozufozu/flywheel/Flywheel.java b/common/src/api/java/com/jozufozu/flywheel/api/Flywheel.java similarity index 61% rename from common/src/lib/java/com/jozufozu/flywheel/Flywheel.java rename to common/src/api/java/com/jozufozu/flywheel/api/Flywheel.java index 857125674..f410e4ac2 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/Flywheel.java +++ b/common/src/api/java/com/jozufozu/flywheel/api/Flywheel.java @@ -1,13 +1,9 @@ -package com.jozufozu.flywheel; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +package com.jozufozu.flywheel.api; import net.minecraft.resources.ResourceLocation; public final class Flywheel { public static final String ID = "flywheel"; - public static final Logger LOGGER = LoggerFactory.getLogger(ID); private Flywheel() { } diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/Backends.java b/common/src/backend/java/com/jozufozu/flywheel/backend/Backends.java index fa0ce5ac2..73698e28b 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/Backends.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/Backends.java @@ -1,6 +1,6 @@ package com.jozufozu.flywheel.backend; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.api.backend.Backend; import com.jozufozu.flywheel.backend.compile.IndirectPrograms; import com.jozufozu.flywheel.backend.compile.InstancingPrograms; diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/FlwBackend.java b/common/src/backend/java/com/jozufozu/flywheel/backend/FlwBackend.java new file mode 100644 index 000000000..8f2f5cb19 --- /dev/null +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/FlwBackend.java @@ -0,0 +1,18 @@ +package com.jozufozu.flywheel.backend; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.jozufozu.flywheel.api.Flywheel; + +public final class FlwBackend { + public static final Logger LOGGER = LoggerFactory.getLogger(Flywheel.ID + "/backend"); + + private FlwBackend() { + } + + public static void init() { + ShaderIndices.init(); + Backends.init(); + } +} diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/InternalVertex.java b/common/src/backend/java/com/jozufozu/flywheel/backend/InternalVertex.java index 8b6aa2cb3..bac7f639b 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/InternalVertex.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/InternalVertex.java @@ -2,7 +2,7 @@ import java.util.List; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.api.layout.FloatRepr; import com.jozufozu.flywheel.api.layout.Layout; import com.jozufozu.flywheel.api.layout.LayoutBuilder; diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java index 2364ee4bb..cbe0b6877 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/FlwPrograms.java @@ -7,7 +7,7 @@ import org.slf4j.LoggerFactory; import com.google.common.collect.ImmutableList; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.api.instance.InstanceType; import com.jozufozu.flywheel.backend.ShaderIndices; import com.jozufozu.flywheel.backend.compile.component.UberShaderComponent; @@ -22,7 +22,7 @@ import net.minecraft.server.packs.resources.ResourceManager; public final class FlwPrograms { - public static final Logger LOGGER = LoggerFactory.getLogger(Flywheel.ID + "/shaders"); + public static final Logger LOGGER = LoggerFactory.getLogger(Flywheel.ID + "/backend/shaders"); private static final ResourceLocation COMPONENTS_HEADER_VERT = Flywheel.rl("internal/components_header.vert"); private static final ResourceLocation COMPONENTS_HEADER_FRAG = Flywheel.rl("internal/components_header.frag"); diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java index 2dea078ab..1856776db 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/IndirectPrograms.java @@ -1,13 +1,12 @@ package com.jozufozu.flywheel.backend.compile; -import java.util.ArrayList; import java.util.List; import java.util.Map; import org.jetbrains.annotations.Nullable; import com.google.common.collect.ImmutableList; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.api.instance.InstanceType; import com.jozufozu.flywheel.backend.compile.component.InstanceStructComponent; import com.jozufozu.flywheel.backend.compile.component.SsboInstanceComponent; diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java index 0d9b3de7c..ea29fe109 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/InstancingPrograms.java @@ -1,6 +1,5 @@ package com.jozufozu.flywheel.backend.compile; -import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java index 09fbe049b..a964a8894 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/PipelineCompiler.java @@ -1,10 +1,9 @@ package com.jozufozu.flywheel.backend.compile; import java.util.Collection; -import java.util.Collections; import java.util.List; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.backend.InternalVertex; import com.jozufozu.flywheel.backend.Samplers; import com.jozufozu.flywheel.backend.compile.component.InstanceStructComponent; diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/Pipelines.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/Pipelines.java index 29978c1de..238d5e58b 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/Pipelines.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/Pipelines.java @@ -1,6 +1,6 @@ package com.jozufozu.flywheel.backend.compile; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.backend.Samplers; import com.jozufozu.flywheel.backend.compile.component.BufferTextureInstanceComponent; import com.jozufozu.flywheel.backend.compile.component.SsboInstanceComponent; diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/BufferTextureInstanceComponent.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/BufferTextureInstanceComponent.java index b2218cbb9..1de3b5249 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/BufferTextureInstanceComponent.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/BufferTextureInstanceComponent.java @@ -2,7 +2,7 @@ import java.util.ArrayList; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.api.instance.InstanceType; import com.jozufozu.flywheel.api.layout.Layout; import com.jozufozu.flywheel.backend.glsl.generate.FnSignature; diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java index 3a78fdc7f..123de197a 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/InstanceStructComponent.java @@ -3,7 +3,7 @@ import java.util.Collection; import java.util.Collections; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.api.instance.InstanceType; import com.jozufozu.flywheel.api.layout.Layout; import com.jozufozu.flywheel.backend.compile.LayoutInterpreter; diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/SsboInstanceComponent.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/SsboInstanceComponent.java index a09e87ea7..f8244ffb1 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/SsboInstanceComponent.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/SsboInstanceComponent.java @@ -2,7 +2,7 @@ import java.util.ArrayList; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.api.instance.InstanceType; import com.jozufozu.flywheel.api.layout.Layout; import com.jozufozu.flywheel.backend.engine.indirect.IndirectBuffers; diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/StringSubstitutionComponent.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/StringSubstitutionComponent.java index 071865d80..58cbdb73b 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/StringSubstitutionComponent.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/StringSubstitutionComponent.java @@ -3,7 +3,7 @@ import java.util.Collection; import java.util.Map; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.backend.glsl.SourceComponent; public final class StringSubstitutionComponent implements SourceComponent { diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/UberShaderComponent.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/UberShaderComponent.java index e93c49af2..733b76776 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/UberShaderComponent.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/component/UberShaderComponent.java @@ -9,7 +9,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.backend.compile.core.SourceLoader; import com.jozufozu.flywheel.backend.glsl.SourceComponent; import com.jozufozu.flywheel.backend.glsl.SourceFile; diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/FailedCompilation.java b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/FailedCompilation.java index a8c2c44da..27dc28cb1 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/FailedCompilation.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/compile/core/FailedCompilation.java @@ -8,7 +8,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.backend.glsl.SourceFile; import com.jozufozu.flywheel.backend.glsl.SourceLines; import com.jozufozu.flywheel.backend.glsl.error.ConsoleColors; diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/engine/DrawManager.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/DrawManager.java index c003a9264..404155aab 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/engine/DrawManager.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/DrawManager.java @@ -8,13 +8,13 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; -import com.jozufozu.flywheel.Flywheel; import com.jozufozu.flywheel.api.backend.Engine; import com.jozufozu.flywheel.api.event.RenderStage; import com.jozufozu.flywheel.api.instance.Instance; import com.jozufozu.flywheel.api.instance.InstanceType; import com.jozufozu.flywheel.api.instance.Instancer; import com.jozufozu.flywheel.api.model.Model; +import com.jozufozu.flywheel.backend.FlwBackend; import com.jozufozu.flywheel.backend.engine.embed.Environment; import com.jozufozu.flywheel.lib.util.Pair; @@ -98,7 +98,7 @@ private static boolean checkAndWarnEmptyModel(Model model) { .forEach(f -> builder.append("\n\t") .append(f.toString())); - Flywheel.LOGGER.warn(builder.toString()); + FlwBackend.LOGGER.warn(builder.toString()); return false; } diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java index 8cf6380ab..e4467ab8e 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/engine/uniform/FrameUniforms.java @@ -147,7 +147,7 @@ private static long writeCamera(long ptr) { } private static long writeTime(long ptr, RenderContext context) { - int ticks = ((LevelRendererAccessor) context.renderer()).flywheel$ticks(); + int ticks = ((LevelRendererAccessor) context.renderer()).flywheel$getTicks(); float partialTick = context.partialTick(); float renderTicks = ticks + partialTick; float renderSeconds = renderTicks / 20f; diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java index ae11d94d0..e284d6975 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/gl/GlCompat.java @@ -12,7 +12,7 @@ import org.lwjgl.opengl.KHRShaderSubgroup; import org.lwjgl.system.MemoryStack; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.backend.FlwBackend; import com.jozufozu.flywheel.backend.compile.core.Compilation; import com.jozufozu.flywheel.backend.glsl.GlslVersion; import com.jozufozu.flywheel.lib.math.MoreMath; @@ -26,7 +26,7 @@ public final class GlCompat { caps = GL.getCapabilities(); } catch (IllegalStateException e) { // This happens with vulkanmod installed. - Flywheel.LOGGER.warn("Failed to get GL capabilities, all flywheel backends will be disabled."); + FlwBackend.LOGGER.warn("Failed to get GL capabilities; default Flywheel backends will be disabled."); caps = null; } CAPABILITIES = caps; diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/GameRendererAccessor.java b/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/GameRendererAccessor.java deleted file mode 100644 index cf92578fb..000000000 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/GameRendererAccessor.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.jozufozu.flywheel.backend.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; -import org.spongepowered.asm.mixin.gen.Invoker; - -import net.minecraft.client.Camera; -import net.minecraft.client.renderer.GameRenderer; - -@Mixin(GameRenderer.class) -public interface GameRendererAccessor { - @Invoker("getFov") - double flywheel$getFov(Camera pActiveRenderInfo, float pPartialTicks, boolean pUseFOVSetting); - - @Accessor("zoom") - float flywheel$getZoom(); - - @Accessor("zoomX") - float flywheel$getZoomX(); - - @Accessor("zoomY") - float flywheel$getZoomY(); -} diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/LevelRendererAccessor.java b/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/LevelRendererAccessor.java index 5ddc4a5ba..a22055f7b 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/LevelRendererAccessor.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/LevelRendererAccessor.java @@ -8,5 +8,5 @@ @Mixin(LevelRenderer.class) public interface LevelRendererAccessor { @Accessor("ticks") - int flywheel$ticks(); + int flywheel$getTicks(); } diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/LightTextureAccessor.java b/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/LightTextureAccessor.java deleted file mode 100644 index edda4df14..000000000 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/LightTextureAccessor.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.jozufozu.flywheel.backend.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import net.minecraft.client.renderer.LightTexture; -import net.minecraft.client.renderer.texture.DynamicTexture; - -@Mixin(LightTexture.class) -public interface LightTextureAccessor { - @Accessor("lightTexture") - DynamicTexture flywheel$texture(); -} diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/OptionsMixin.java b/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/OptionsMixin.java index e14e279df..8543d8162 100644 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/OptionsMixin.java +++ b/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/OptionsMixin.java @@ -10,7 +10,7 @@ import net.minecraft.client.Options; @Mixin(Options.class) -public class OptionsMixin { +abstract class OptionsMixin { @Inject(method = "load()V", at = @At("RETURN")) private void flywheel$onLoad(CallbackInfo ci) { OptionsUniforms.update((Options) (Object) this); diff --git a/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/OverlayTextureAccessor.java b/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/OverlayTextureAccessor.java deleted file mode 100644 index 0f5af0ca6..000000000 --- a/common/src/backend/java/com/jozufozu/flywheel/backend/mixin/OverlayTextureAccessor.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.jozufozu.flywheel.backend.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.client.renderer.texture.OverlayTexture; - -@Mixin(OverlayTexture.class) -public interface OverlayTextureAccessor { - @Accessor("texture") - DynamicTexture flywheel$texture(); -} diff --git a/common/src/backend/resources/flywheel.backend.mixins.json b/common/src/backend/resources/flywheel.backend.mixins.json index 164b33dca..9aef02424 100644 --- a/common/src/backend/resources/flywheel.backend.mixins.json +++ b/common/src/backend/resources/flywheel.backend.mixins.json @@ -6,12 +6,9 @@ "refmap": "backend-flywheel.refmap.json", "client": [ "AbstractClientPlayerAccessor", - "GameRendererAccessor", "GlStateManagerMixin", "LevelRendererAccessor", - "LightTextureAccessor", "OptionsMixin", - "OverlayTextureAccessor", "RenderSystemMixin" ], "injectors": { diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java b/common/src/lib/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java index 2f6e8ce47..8a56570ff 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/instance/InstanceTypes.java @@ -3,7 +3,7 @@ import org.jetbrains.annotations.ApiStatus; import org.lwjgl.system.MemoryUtil; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.api.instance.InstanceType; import com.jozufozu.flywheel.api.layout.FloatRepr; import com.jozufozu.flywheel.api.layout.IntegerRepr; diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/internal/FlwLibLink.java b/common/src/lib/java/com/jozufozu/flywheel/lib/internal/FlwLibLink.java index a12b696ba..cf30466a1 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/internal/FlwLibLink.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/internal/FlwLibLink.java @@ -1,5 +1,7 @@ package com.jozufozu.flywheel.lib.internal; +import org.slf4j.Logger; + import com.jozufozu.flywheel.api.internal.DependencyInjection; import com.jozufozu.flywheel.lib.transform.PoseTransformStack; import com.mojang.blaze3d.vertex.PoseStack; @@ -7,5 +9,7 @@ public interface FlwLibLink { FlwLibLink INSTANCE = DependencyInjection.load(FlwLibLink.class, "com.jozufozu.flywheel.impl.FlwLibLinkImpl"); + Logger getLogger(); + PoseTransformStack getPoseTransformStackOf(PoseStack stack); } diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/material/CutoutShaders.java b/common/src/lib/java/com/jozufozu/flywheel/lib/material/CutoutShaders.java index 8ce015841..e5694e97d 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/material/CutoutShaders.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/material/CutoutShaders.java @@ -2,7 +2,7 @@ import org.jetbrains.annotations.ApiStatus; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.api.material.CutoutShader; public class CutoutShaders { diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/material/FogShaders.java b/common/src/lib/java/com/jozufozu/flywheel/lib/material/FogShaders.java index 9c23ae718..7f3630a4e 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/material/FogShaders.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/material/FogShaders.java @@ -2,7 +2,7 @@ import org.jetbrains.annotations.ApiStatus; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.api.material.FogShader; public class FogShaders { diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java b/common/src/lib/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java index bfea555bd..715c476b1 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/material/StandardMaterialShaders.java @@ -2,7 +2,7 @@ import org.jetbrains.annotations.ApiStatus; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.api.material.MaterialShaders; public final class StandardMaterialShaders { diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/memory/DebugMemoryBlockImpl.java b/common/src/lib/java/com/jozufozu/flywheel/lib/memory/DebugMemoryBlockImpl.java index b91dc53a6..e10b2023a 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/memory/DebugMemoryBlockImpl.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/memory/DebugMemoryBlockImpl.java @@ -2,7 +2,7 @@ import java.lang.ref.Cleaner; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.lib.internal.FlwLibLink; import com.jozufozu.flywheel.lib.util.StringUtil; class DebugMemoryBlockImpl extends AbstractMemoryBlockImpl { @@ -91,7 +91,7 @@ public void run() { builder.append("\n\t"); builder.append(frame); } - Flywheel.LOGGER.warn(builder.toString()); + FlwLibLink.INSTANCE.getLogger().warn(builder.toString()); FlwMemoryTracker.free(ptr); FlwMemoryTracker._freeCPUMemory(size); diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/util/ResourceUtil.java b/common/src/lib/java/com/jozufozu/flywheel/lib/util/ResourceUtil.java index 6ab2e76f7..36be0853c 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/util/ResourceUtil.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/util/ResourceUtil.java @@ -1,6 +1,6 @@ package com.jozufozu.flywheel.lib.util; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java b/common/src/lib/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java index cd451ac32..8ab564351 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/util/ShadersModHandler.java @@ -4,14 +4,11 @@ import java.util.function.BooleanSupplier; import org.jetbrains.annotations.ApiStatus; -import org.slf4j.Logger; +import com.jozufozu.flywheel.lib.internal.FlwLibLink; import com.jozufozu.flywheel.lib.internal.FlwLibXplat; -import com.mojang.logging.LogUtils; public final class ShadersModHandler { - private static final Logger LOGGER = LogUtils.getLogger(); - private static final String OPTIFINE_ROOT_PACKAGE = "net.optifine"; private static final boolean IS_IRIS_LOADED; @@ -29,13 +26,13 @@ public final class ShadersModHandler { // OptiFine and Iris/Oculus are assumed to be mutually exclusive if (IS_IRIS_LOADED) { - LOGGER.debug("Iris detected."); + FlwLibLink.INSTANCE.getLogger().debug("Iris detected."); INTERNAL_HANDLER = irisHandler; } else if (IS_OPTIFINE_INSTALLED) { - LOGGER.debug("OptiFine detected."); + FlwLibLink.INSTANCE.getLogger().debug("OptiFine detected."); INTERNAL_HANDLER = new OptifineHandler(); } else { - LOGGER.debug("No shaders mod detected."); + FlwLibLink.INSTANCE.getLogger().debug("No shaders mod detected."); INTERNAL_HANDLER = new InternalHandler() {}; } } diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java index 1abd2749d..8f0b76dc1 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleDynamicVisual.java @@ -4,7 +4,6 @@ import com.jozufozu.flywheel.api.instance.Instancer; import com.jozufozu.flywheel.api.task.Plan; import com.jozufozu.flywheel.api.visual.DynamicVisual; -import com.jozufozu.flywheel.api.visual.TickableVisual; import com.jozufozu.flywheel.lib.task.RunnablePlan; public interface SimpleDynamicVisual extends DynamicVisual { diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java index baf8246e9..ac9a2d658 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/visual/SimpleTickableVisual.java @@ -3,7 +3,6 @@ import com.jozufozu.flywheel.api.instance.Instance; import com.jozufozu.flywheel.api.instance.Instancer; import com.jozufozu.flywheel.api.task.Plan; -import com.jozufozu.flywheel.api.visual.DynamicVisual; import com.jozufozu.flywheel.api.visual.TickableVisual; import com.jozufozu.flywheel.lib.task.RunnablePlan; diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java index cd144716d..de7dbed89 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/BackendManagerImpl.java @@ -1,21 +1,17 @@ package com.jozufozu.flywheel.impl; import org.jetbrains.annotations.Nullable; -import org.slf4j.Logger; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.api.backend.Backend; import com.jozufozu.flywheel.backend.Backends; import com.jozufozu.flywheel.impl.visualization.VisualizationManagerImpl; import com.jozufozu.flywheel.lib.backend.SimpleBackend; -import com.mojang.logging.LogUtils; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.resources.ResourceLocation; public final class BackendManagerImpl { - private static final Logger LOGGER = LogUtils.getLogger(); - public static final Backend OFF_BACKEND = SimpleBackend.builder() .engineFactory(level -> { throw new UnsupportedOperationException("Cannot create engine when backend is off."); @@ -49,7 +45,7 @@ private static void chooseBackend() { var actual = preferred.findFallback(); if (preferred != actual) { - LOGGER.warn("Flywheel backend fell back from '{}' to '{}'", Backend.REGISTRY.getIdOrThrow(preferred), Backend.REGISTRY.getIdOrThrow(actual)); + FlwImpl.LOGGER.warn("Flywheel backend fell back from '{}' to '{}'", Backend.REGISTRY.getIdOrThrow(preferred), Backend.REGISTRY.getIdOrThrow(actual)); } backend = actual; diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/FlywheelInit.java b/common/src/main/java/com/jozufozu/flywheel/impl/FlwImpl.java similarity index 69% rename from common/src/main/java/com/jozufozu/flywheel/impl/FlywheelInit.java rename to common/src/main/java/com/jozufozu/flywheel/impl/FlwImpl.java index a7a81f478..53df9d4e1 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/FlywheelInit.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/FlwImpl.java @@ -1,7 +1,10 @@ package com.jozufozu.flywheel.impl; -import com.jozufozu.flywheel.backend.Backends; -import com.jozufozu.flywheel.backend.ShaderIndices; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.jozufozu.flywheel.api.Flywheel; +import com.jozufozu.flywheel.backend.FlwBackend; import com.jozufozu.flywheel.impl.registry.IdRegistryImpl; import com.jozufozu.flywheel.impl.registry.RegistryImpl; import com.jozufozu.flywheel.lib.instance.InstanceTypes; @@ -11,8 +14,11 @@ import com.jozufozu.flywheel.lib.util.ShadersModHandler; import com.jozufozu.flywheel.vanilla.VanillaVisuals; -public final class FlywheelInit { - private FlywheelInit() { +public final class FlwImpl { + public static final Logger LOGGER = LoggerFactory.getLogger(Flywheel.ID); + public static final Logger CONFIG_LOGGER = LoggerFactory.getLogger(Flywheel.ID + "/config"); + + private FlwImpl() { } public static void init() { @@ -27,8 +33,7 @@ public static void init() { StandardMaterialShaders.init(); // backend - ShaderIndices.init(); - Backends.init(); + FlwBackend.init(); // vanilla VanillaVisuals.init(); diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/FlwLibLinkImpl.java b/common/src/main/java/com/jozufozu/flywheel/impl/FlwLibLinkImpl.java index 346afd1d1..f49536065 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/FlwLibLinkImpl.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/FlwLibLinkImpl.java @@ -1,11 +1,18 @@ package com.jozufozu.flywheel.impl; +import org.slf4j.Logger; + import com.jozufozu.flywheel.impl.extension.PoseStackExtension; import com.jozufozu.flywheel.lib.internal.FlwLibLink; import com.jozufozu.flywheel.lib.transform.PoseTransformStack; import com.mojang.blaze3d.vertex.PoseStack; public class FlwLibLinkImpl implements FlwLibLink { + @Override + public Logger getLogger() { + return FlwImpl.LOGGER; + } + @Override public PoseTransformStack getPoseTransformStackOf(PoseStack stack) { return ((PoseStackExtension) stack).flywheel$transformStack(); diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/ClientChunkCacheMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/ClientChunkCacheMixin.java index 6f032bd86..30532a337 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/ClientChunkCacheMixin.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/ClientChunkCacheMixin.java @@ -20,12 +20,12 @@ abstract class ClientChunkCacheMixin { @Final ClientLevel level; - @Inject(at = @At("HEAD"), method = "onLightUpdate") - private void flywheel$onLightUpdate(LightLayer pType, SectionPos pPos, CallbackInfo ci) { + @Inject(method = "onLightUpdate", at = @At("HEAD")) + private void flywheel$onLightUpdate(LightLayer layer, SectionPos pos, CallbackInfo ci) { var manager = VisualizationManagerImpl.get(level); if (manager != null) { - manager.enqueueLightUpdateSection(pPos.asLong()); + manager.enqueueLightUpdateSection(pos.asLong()); } } } diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java index 993c0dffb..d9afd8992 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/mixin/LevelRendererMixin.java @@ -107,7 +107,7 @@ abstract class LevelRendererMixin { flywheel$dispatch(RenderStage.AFTER_TRANSLUCENT_TERRAIN); } - @Group(name = "onStage$afterParticles", min = 1) + @Group(name = "onStage$afterParticles", min = 2, max = 2) @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/ParticleEngine;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/client/Camera;F)V", shift = Shift.AFTER)) private void flywheel$onStage$afterParticles$fabric(CallbackInfo ci) { flywheel$dispatch(RenderStage.AFTER_PARTICLES); diff --git a/common/src/main/java/com/jozufozu/flywheel/impl/task/ParallelTaskExecutor.java b/common/src/main/java/com/jozufozu/flywheel/impl/task/ParallelTaskExecutor.java index d16efb030..eb1e38282 100644 --- a/common/src/main/java/com/jozufozu/flywheel/impl/task/ParallelTaskExecutor.java +++ b/common/src/main/java/com/jozufozu/flywheel/impl/task/ParallelTaskExecutor.java @@ -9,19 +9,14 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.BooleanSupplier; -import org.slf4j.Logger; - -import com.jozufozu.flywheel.Flywheel; import com.jozufozu.flywheel.api.task.TaskExecutor; -import com.mojang.logging.LogUtils; +import com.jozufozu.flywheel.impl.FlwImpl; import net.minecraft.util.Mth; // https://github.com/CaffeineMC/sodium-fabric/blob/5d364ed5ba63f9067fcf72a078ca310bff4db3e9/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuilder.java // https://stackoverflow.com/questions/29655531 public class ParallelTaskExecutor implements TaskExecutor { - private static final Logger LOGGER = LogUtils.getLogger(); - private final String name; private final int threadCount; @@ -70,7 +65,7 @@ public void startWorkers() { threads.add(thread); } - LOGGER.info("Started {} worker threads", threads.size()); + FlwImpl.LOGGER.info("Started {} worker threads", threads.size()); } public void stopWorkers() { @@ -82,7 +77,7 @@ public void stopWorkers() { throw new IllegalStateException("No threads are alive but the executor is in the RUNNING state"); } - LOGGER.info("Stopping worker threads"); + FlwImpl.LOGGER.info("Stopping worker threads"); // Notify all worker threads to wake up, where they will then terminate synchronized (taskNotifier) { @@ -233,7 +228,7 @@ private void processTask(Runnable task) { try { task.run(); } catch (Exception e) { - Flywheel.LOGGER.error("Error running task", e); + FlwImpl.LOGGER.error("Error running task", e); } finally { waitGroup.done(); } @@ -243,7 +238,7 @@ private void processMainThreadTask(Runnable task) { try { task.run(); } catch (Exception e) { - Flywheel.LOGGER.error("Error running main thread task", e); + FlwImpl.LOGGER.error("Error running main thread task", e); } } diff --git a/common/src/test/java/com/jozufozu/flywheel/backend/glsl/TestBase.java b/common/src/test/java/com/jozufozu/flywheel/backend/glsl/TestBase.java index beebdad43..1d74bdebb 100644 --- a/common/src/test/java/com/jozufozu/flywheel/backend/glsl/TestBase.java +++ b/common/src/test/java/com/jozufozu/flywheel/backend/glsl/TestBase.java @@ -6,7 +6,7 @@ import java.util.List; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import net.minecraft.resources.ResourceLocation; diff --git a/fabric/src/backend/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java b/fabric/src/backend/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java index a6fce9831..4d32525eb 100644 --- a/fabric/src/backend/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java +++ b/fabric/src/backend/java/com/jozufozu/flywheel/backend/compile/FlwProgramsReloader.java @@ -1,6 +1,6 @@ package com.jozufozu.flywheel.backend.compile; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener; import net.minecraft.resources.ResourceLocation; diff --git a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java index ebab75af5..a1d80cbd0 100644 --- a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java +++ b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/PartialModelEventHandler.java @@ -4,7 +4,7 @@ import org.jetbrains.annotations.ApiStatus; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import net.fabricmc.fabric.api.resource.ResourceReloadListenerKeys; import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener; diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java index f8ec8ff37..e147424f1 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/FabricFlwConfig.java @@ -11,7 +11,6 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.JsonPrimitive; -import com.jozufozu.flywheel.Flywheel; import com.jozufozu.flywheel.api.backend.Backend; import com.jozufozu.flywheel.api.backend.BackendManager; @@ -25,21 +24,21 @@ public class FabricFlwConfig implements FlwConfig { .getConfigDir() .resolve("flywheel.json"); - public static final FabricFlwConfig INSTANCE = new FabricFlwConfig(PATH.toFile()); - - protected static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); + private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); + public static final boolean LIMIT_UPDATES_DEFAULT = true; public static final int WORKER_THREADS_DEFAULT = -1; public static final int WORKER_THREADS_MAX = Runtime.getRuntime() .availableProcessors(); - public static final boolean LIMIT_UPDATES_DEFAULT = true; + + public static final FabricFlwConfig INSTANCE = new FabricFlwConfig(PATH.toFile()); + + private final File file; public Backend backend = BackendManager.getDefaultBackend(); public boolean limitUpdates = LIMIT_UPDATES_DEFAULT; public int workerThreads = WORKER_THREADS_DEFAULT; - private final File file; - public FabricFlwConfig(File file) { this.file = file; } @@ -64,7 +63,7 @@ public void load() { try (FileReader reader = new FileReader(file)) { fromJson(JsonParser.parseReader(reader)); } catch (Exception e) { - Flywheel.LOGGER.error("Could not load config from file '{}'", file.getAbsolutePath(), e); + FlwImpl.CONFIG_LOGGER.warn("Could not load config from file '{}'", file.getAbsolutePath(), e); } } // In case we found an error in the config file, immediately save to fix it. @@ -75,12 +74,13 @@ public void save() { try (FileWriter writer = new FileWriter(file)) { GSON.toJson(toJson(), writer); } catch (Exception e) { - Flywheel.LOGGER.error("Could not save config to file '{}'", file.getAbsolutePath(), e); + FlwImpl.CONFIG_LOGGER.warn("Could not save config to file '{}'", file.getAbsolutePath(), e); } } public void fromJson(JsonElement json) { if (!(json instanceof JsonObject object)) { + FlwImpl.CONFIG_LOGGER.warn("Config JSON must be an object"); backend = BackendManager.getDefaultBackend(); limitUpdates = LIMIT_UPDATES_DEFAULT; workerThreads = WORKER_THREADS_DEFAULT; @@ -94,41 +94,42 @@ public void fromJson(JsonElement json) { private void readBackend(JsonObject object) { var backendJson = object.get("backend"); - - String err = null; + String msg = null; if (backendJson instanceof JsonPrimitive primitive && primitive.isString()) { - var backendString = primitive.getAsString(); + var value = primitive.getAsString(); try { - this.backend = Backend.REGISTRY.getOrThrow(new ResourceLocation(backendString)); + this.backend = Backend.REGISTRY.getOrThrow(new ResourceLocation(value)); return; - } catch (IllegalArgumentException e) { - err = "backend ID '" + backendString + "' is not registered"; } catch (ResourceLocationException e) { - err = "backend '" + backendString + "' is not a valid resource location"; + msg = "'backend' value '" + value + "' is not a valid resource location"; + } catch (IllegalArgumentException e) { + msg = "Backend with ID '" + value + "' is not registered"; } catch (Exception e) { // Something else went wrong? This should be dead code. - err = "backend '" + backendString + "' is invalid"; + msg = "'backend' value '" + value + "' is invalid"; } } else if (backendJson != null) { - err = "backend must be a string"; + msg = "'backend' value must be a string"; } // Don't log an error if the field is missing. - if (err != null) { - Flywheel.LOGGER.warn(err); + if (msg != null) { + FlwImpl.CONFIG_LOGGER.warn(msg); } backend = BackendManager.getDefaultBackend(); } private void readLimitUpdates(JsonObject object) { var limitUpdatesJson = object.get("limitUpdates"); + if (limitUpdatesJson instanceof JsonPrimitive primitive && primitive.isBoolean()) { limitUpdates = primitive.getAsBoolean(); return; } else if (limitUpdatesJson != null) { - Flywheel.LOGGER.warn("limitUpdates must be a boolean"); + FlwImpl.CONFIG_LOGGER.warn("'limitUpdates' value must be a boolean"); } + limitUpdates = LIMIT_UPDATES_DEFAULT; } @@ -136,18 +137,17 @@ private void readWorkerThreads(JsonObject object) { var workerThreadsJson = object.get("workerThreads"); if (workerThreadsJson instanceof JsonPrimitive primitive && primitive.isNumber()) { - int configuredValue = primitive.getAsInt(); - - int clamped = Mth.clamp(configuredValue, WORKER_THREADS_DEFAULT, WORKER_THREADS_MAX); + int value = primitive.getAsInt(); + int clamped = Mth.clamp(value, WORKER_THREADS_DEFAULT, WORKER_THREADS_MAX); - if (clamped != configuredValue) { - Flywheel.LOGGER.warn("workerThreads value of {} is out of range, clamping to {}", configuredValue, clamped); + if (clamped != value) { + FlwImpl.CONFIG_LOGGER.warn("'workerThreads' value of {} is out of range, clamping to {}", value, clamped); } workerThreads = clamped; return; } else if (workerThreadsJson != null) { - Flywheel.LOGGER.warn("workerThreads must be an integer"); + FlwImpl.CONFIG_LOGGER.warn("'workerThreads' value must be an integer"); } workerThreads = WORKER_THREADS_DEFAULT; @@ -155,9 +155,9 @@ private void readWorkerThreads(JsonObject object) { public JsonObject toJson() { JsonObject object = new JsonObject(); + object.addProperty("backend", Backend.REGISTRY.getIdOrThrow(backend).toString()); object.addProperty("limitUpdates", limitUpdates); object.addProperty("workerThreads", workerThreads); - object.addProperty("backend", Backend.REGISTRY.getIdOrThrow(backend).toString()); return object; } } diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java index e4f58f5d8..68857a7e1 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/FlywheelFabric.java @@ -2,7 +2,7 @@ import org.jetbrains.annotations.UnknownNullability; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.api.event.BeginFrameCallback; import com.jozufozu.flywheel.api.event.EndClientResourceReloadCallback; import com.jozufozu.flywheel.api.event.ReloadLevelRendererCallback; @@ -40,13 +40,7 @@ public void onInitializeClient() { setupLib(); setupBackend(); - FlywheelInit.init(); - - // FIXME: Registries cannot be frozen this early. - FlywheelInit.freezeRegistries(); - // Have to load the config after we freeze registries, - // so we can find third party backends. - FabricFlwConfig.INSTANCE.load(); + FlwImpl.init(); } private static void setupImpl() { diff --git a/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java index c1ec8c809..0fed00bf7 100644 --- a/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java +++ b/fabric/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java @@ -11,6 +11,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import com.jozufozu.flywheel.api.event.EndClientResourceReloadCallback; +import com.jozufozu.flywheel.impl.FabricFlwConfig; +import com.jozufozu.flywheel.impl.FlwImpl; import net.minecraft.client.Minecraft; import net.minecraft.server.packs.resources.ReloadableResourceManager; @@ -21,6 +23,14 @@ abstract class MinecraftMixin { @Final private ReloadableResourceManager resourceManager; + @Inject(method = "", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/packs/resources/ReloadableResourceManager;createReload(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;Ljava/util/List;)Lnet/minecraft/server/packs/resources/ReloadInstance;")) + private void flywheel$onBeginInitialResourceReload(CallbackInfo ci) { + FlwImpl.freezeRegistries(); + // Load the config after we freeze registries, + // so we can find third party backends. + FabricFlwConfig.INSTANCE.load(); + } + @Inject(method = "method_24040", at = @At("HEAD")) private void flywheel$onEndInitialResourceReload(Optional error, CallbackInfo ci) { EndClientResourceReloadCallback.EVENT.invoker() diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java b/forge/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java index f8cdb2929..37795b40c 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/FlwCommands.java @@ -24,11 +24,9 @@ private FlwCommands() { } public static void registerClientCommands(RegisterClientCommandsEvent event) { - ForgeFlwConfig config = ForgeFlwConfig.INSTANCE; - LiteralArgumentBuilder command = Commands.literal("flywheel"); - ConfigValue backendValue = config.client.backend; + ConfigValue backendValue = ForgeFlwConfig.INSTANCE.client.backend; command.then(Commands.literal("backend") .executes(context -> { Backend backend = BackendManager.getBackend(); @@ -58,7 +56,7 @@ public static void registerClientCommands(RegisterClientCommandsEvent event) { return Command.SINGLE_SUCCESS; }))); - BooleanValue limitUpdatesValue = config.client.limitUpdates; + BooleanValue limitUpdatesValue = ForgeFlwConfig.INSTANCE.client.limitUpdates; command.then(Commands.literal("limitUpdates") .executes(context -> { if (limitUpdatesValue.get()) { diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java b/forge/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java index 4dc57a159..ef50b33fc 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/FlwLibXplatImpl.java @@ -3,7 +3,6 @@ import java.lang.reflect.Field; import org.jetbrains.annotations.Nullable; -import org.slf4j.Logger; import com.jozufozu.flywheel.lib.internal.FlwLibXplat; import com.jozufozu.flywheel.lib.model.baked.BakedModelBuilder; @@ -13,7 +12,6 @@ import com.jozufozu.flywheel.lib.model.baked.ForgeMultiBlockModelBuilder; import com.jozufozu.flywheel.lib.model.baked.MultiBlockModelBuilder; import com.jozufozu.flywheel.lib.util.ShadersModHandler; -import com.mojang.logging.LogUtils; import net.irisshaders.iris.api.v0.IrisApi; import net.minecraft.client.Minecraft; @@ -27,8 +25,6 @@ import net.minecraftforge.fml.util.ObfuscationReflectionHelper; public class FlwLibXplatImpl implements FlwLibXplat { - private static final Logger LOGGER = LogUtils.getLogger(); - @Override public BlockRenderDispatcher createVanillaBlockRenderDispatcher() { BlockRenderDispatcher defaultDispatcher = Minecraft.getInstance().getBlockRenderer(); @@ -40,7 +36,7 @@ public BlockRenderDispatcher createVanillaBlockRenderDispatcher() { } ObfuscationReflectionHelper.setPrivateValue(BlockRenderDispatcher.class, dispatcher, new ModelBlockRenderer(Minecraft.getInstance().getBlockColors()), "f_110900_"); } catch (Exception e) { - LOGGER.error("Failed to initialize vanilla BlockRenderDispatcher!", e); + FlwImpl.LOGGER.error("Failed to initialize vanilla BlockRenderDispatcher!", e); return defaultDispatcher; } return dispatcher; diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelForge.java b/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelForge.java index 7905f3709..03c06b4ec 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelForge.java +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/FlywheelForge.java @@ -3,7 +3,7 @@ import org.apache.maven.artifact.versioning.ArtifactVersion; import org.jetbrains.annotations.UnknownNullability; -import com.jozufozu.flywheel.Flywheel; +import com.jozufozu.flywheel.api.Flywheel; import com.jozufozu.flywheel.api.event.BeginFrameEvent; import com.jozufozu.flywheel.api.event.EndClientResourceReloadEvent; import com.jozufozu.flywheel.api.event.ReloadLevelRendererEvent; @@ -33,7 +33,6 @@ import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegisterEvent; @@ -66,7 +65,7 @@ private static void clientInit(IEventBus forgeEventBus, IEventBus modEventBus) { registerBackendEventListeners(forgeEventBus, modEventBus); CrashReportCallables.registerCrashCallable("Flywheel Backend", BackendManagerImpl::getBackendString); - FlywheelInit.init(); + FlwImpl.init(); } private static void registerImplEventListeners(IEventBus forgeEventBus, IEventBus modEventBus) { @@ -95,8 +94,6 @@ private static void registerImplEventListeners(IEventBus forgeEventBus, IEventBu FlwDebugInfo.addDebugInfo(minecraft, e.getRight()); }); - modEventBus.addListener((FMLLoadCompleteEvent e) -> FlywheelInit.freezeRegistries()); - modEventBus.addListener((EndClientResourceReloadEvent e) -> BackendManagerImpl.onEndClientResourceReload(e.error().isPresent())); modEventBus.addListener((FMLCommonSetupEvent e) -> { diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/ForgeFlwConfig.java b/forge/src/main/java/com/jozufozu/flywheel/impl/ForgeFlwConfig.java index 012bea791..fff51a309 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/impl/ForgeFlwConfig.java +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/ForgeFlwConfig.java @@ -2,11 +2,9 @@ import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; -import org.slf4j.Logger; import com.jozufozu.flywheel.api.backend.Backend; import com.jozufozu.flywheel.api.backend.BackendManager; -import com.mojang.logging.LogUtils; import net.minecraft.ResourceLocationException; import net.minecraft.resources.ResourceLocation; @@ -15,7 +13,6 @@ import net.minecraftforge.fml.config.ModConfig; public class ForgeFlwConfig implements FlwConfig { - private static final Logger LOGGER = LogUtils.getLogger(); public static final ForgeFlwConfig INSTANCE = new ForgeFlwConfig(); public final ClientConfig client; @@ -44,13 +41,13 @@ private static Backend parseBackend(String idStr) { try { backendId = new ResourceLocation(idStr); } catch (ResourceLocationException e) { - LOGGER.warn("Config contains invalid backend ID '" + idStr + "'!"); + FlwImpl.CONFIG_LOGGER.warn("'backend' value '{}' is not a valid resource location", idStr); return null; } Backend backend = Backend.REGISTRY.get(backendId); if (backend == null) { - LOGGER.warn("Config contains non-existent backend with ID '" + backendId + "'!"); + FlwImpl.CONFIG_LOGGER.warn("Backend with ID '{}' is not registered", backendId); return null; } diff --git a/forge/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java b/forge/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java index 38ad493bb..16874dbaf 100644 --- a/forge/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java +++ b/forge/src/main/java/com/jozufozu/flywheel/impl/mixin/MinecraftMixin.java @@ -2,15 +2,18 @@ import java.util.Optional; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import com.jozufozu.flywheel.api.event.EndClientResourceReloadEvent; +import com.jozufozu.flywheel.impl.FlwImpl; import com.mojang.realmsclient.client.RealmsClient; import net.minecraft.client.Minecraft; @@ -25,6 +28,13 @@ abstract class MinecraftMixin { @Final private ReloadableResourceManager resourceManager; + // Inject at invoke cannot be used in constructors in vanilla Mixin, so use ModifyArg instead. + @ModifyArg(method = "", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/packs/resources/ReloadableResourceManager;createReload(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;Ljava/util/List;)Lnet/minecraft/server/packs/resources/ReloadInstance;"), index = 0) + private Executor flywheel$onBeginInitialResourceReload(Executor arg0) { + FlwImpl.freezeRegistries(); + return arg0; + } + @Inject(method = "lambda$new$5", at = @At("HEAD")) private void flywheel$onEndInitialResourceReload(RealmsClient realmsClient, ReloadInstance reloadInstance, GameConfig gameConfig, Optional error, CallbackInfo ci) { ModLoader.get().postEvent(new EndClientResourceReloadEvent((Minecraft) (Object) this, resourceManager, true, error)); From db794889e6862b58d5e373c4c4a115261dc7354e Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Sun, 12 May 2024 20:55:59 -0700 Subject: [PATCH 62/62] Fix mesh order of models from model builders Meshes are now always sorted by chunk layer first, then in order of how the BakedModel returned quads. This should exactly match vanilla's chunk buffering and avoid any rendering issues. --- .../flywheel/lib/model/SimpleModel.java | 5 +- .../lib/model/baked/BakedModelBufferer.java | 4 +- .../baked/ChunkLayerSortedListBuilder.java | 58 +++++++++++++++++++ .../model/baked/FabricBakedModelBuilder.java | 7 +-- .../model/baked/FabricBlockModelBuilder.java | 7 +-- .../baked/FabricMultiBlockModelBuilder.java | 7 +-- .../lib/model/baked/BakedModelBufferer.java | 4 +- .../baked/ChunkLayerSortedListBuilder.java | 54 +++++++++++++++++ .../model/baked/ForgeBakedModelBuilder.java | 7 +-- .../model/baked/ForgeBlockModelBuilder.java | 7 +-- .../baked/ForgeMultiBlockModelBuilder.java | 7 +-- 11 files changed, 136 insertions(+), 31 deletions(-) create mode 100644 fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ChunkLayerSortedListBuilder.java create mode 100644 forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ChunkLayerSortedListBuilder.java diff --git a/common/src/lib/java/com/jozufozu/flywheel/lib/model/SimpleModel.java b/common/src/lib/java/com/jozufozu/flywheel/lib/model/SimpleModel.java index 3f54484ed..bd5b7bb45 100644 --- a/common/src/lib/java/com/jozufozu/flywheel/lib/model/SimpleModel.java +++ b/common/src/lib/java/com/jozufozu/flywheel/lib/model/SimpleModel.java @@ -4,14 +4,13 @@ import org.joml.Vector4fc; -import com.google.common.collect.ImmutableList; import com.jozufozu.flywheel.api.model.Model; public class SimpleModel implements Model { - private final ImmutableList meshes; + private final List meshes; private final Vector4fc boundingSphere; - public SimpleModel(ImmutableList meshes) { + public SimpleModel(List meshes) { this.meshes = meshes; this.boundingSphere = ModelUtil.computeBoundingSphere(meshes); } diff --git a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java index 39b9fb9eb..a0eb2302d 100644 --- a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java +++ b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java @@ -23,8 +23,8 @@ import net.minecraft.world.level.material.FluidState; final class BakedModelBufferer { - private static final RenderType[] CHUNK_LAYERS = RenderType.chunkBufferLayers().toArray(RenderType[]::new); - private static final int CHUNK_LAYER_AMOUNT = CHUNK_LAYERS.length; + static final RenderType[] CHUNK_LAYERS = RenderType.chunkBufferLayers().toArray(RenderType[]::new); + static final int CHUNK_LAYER_AMOUNT = CHUNK_LAYERS.length; private static final ThreadLocal THREAD_LOCAL_OBJECTS = ThreadLocal.withInitial(ThreadLocalObjects::new); diff --git a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ChunkLayerSortedListBuilder.java b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ChunkLayerSortedListBuilder.java new file mode 100644 index 000000000..5978d7729 --- /dev/null +++ b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ChunkLayerSortedListBuilder.java @@ -0,0 +1,58 @@ +package com.jozufozu.flywheel.lib.model.baked; + +import java.util.List; + +import com.google.common.collect.ImmutableList; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.Reference2ReferenceMap; +import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; +import net.minecraft.client.renderer.RenderType; + +class ChunkLayerSortedListBuilder { + private static final ThreadLocal> THREAD_LOCAL = ThreadLocal.withInitial(ChunkLayerSortedListBuilder::new); + + @SuppressWarnings("unchecked") + private final ObjectArrayList[] lists = new ObjectArrayList[BakedModelBufferer.CHUNK_LAYER_AMOUNT]; + private final Reference2ReferenceMap> map = new Reference2ReferenceOpenHashMap<>(); + + private ChunkLayerSortedListBuilder() { + for (int layerIndex = 0; layerIndex < BakedModelBufferer.CHUNK_LAYER_AMOUNT; layerIndex++) { + RenderType renderType = BakedModelBufferer.CHUNK_LAYERS[layerIndex]; + ObjectArrayList list = new ObjectArrayList<>(); + lists[layerIndex] = list; + map.put(renderType, list); + } + } + + @SuppressWarnings("unchecked") + public static ChunkLayerSortedListBuilder getThreadLocal() { + return (ChunkLayerSortedListBuilder) THREAD_LOCAL.get(); + } + + public void add(RenderType renderType, T obj) { + List list = map.get(renderType); + if (list == null) { + throw new IllegalArgumentException("RenderType '" + renderType + "' is not a chunk layer"); + } + list.add(obj); + } + + @SuppressWarnings("unchecked") + public ImmutableList build() { + int size = 0; + for (ObjectArrayList list : lists) { + size += list.size(); + } + + T[] array = (T[]) new Object[size]; + int destPos = 0; + for (ObjectArrayList list : lists) { + System.arraycopy(list.elements(), 0, array, destPos, list.size()); + destPos += list.size(); + list.clear(); + } + + return ImmutableList.copyOf(array); + } +} diff --git a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBakedModelBuilder.java b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBakedModelBuilder.java index a4b47d019..f853ac884 100644 --- a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBakedModelBuilder.java +++ b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBakedModelBuilder.java @@ -2,7 +2,6 @@ import java.util.function.BiFunction; -import com.google.common.collect.ImmutableList; import com.jozufozu.flywheel.api.material.Material; import com.jozufozu.flywheel.api.model.Model; import com.jozufozu.flywheel.api.vertex.VertexView; @@ -60,7 +59,7 @@ public SimpleModel build() { materialFunc = ModelUtil::getMaterial; } - var out = ImmutableList.builder(); + var builder = ChunkLayerSortedListBuilder.getThreadLocal(); BakedModelBufferer.bufferSingle(ModelUtil.VANILLA_RENDERER.getModelRenderer(), level, bakedModel, blockState, poseStack, (renderType, shaded, data) -> { Material material = materialFunc.apply(renderType, shaded); @@ -68,10 +67,10 @@ public SimpleModel build() { VertexView vertexView = new NoOverlayVertexView(); MemoryBlock meshData = ModelUtil.convertVanillaBuffer(data, vertexView); var mesh = new SimpleMesh(vertexView, meshData, "source=BakedModelBuilder," + "bakedModel=" + bakedModel + ",renderType=" + renderType + ",shaded=" + shaded); - out.add(new Model.ConfiguredMesh(material, mesh)); + builder.add(renderType, new Model.ConfiguredMesh(material, mesh)); } }); - return new SimpleModel(out.build()); + return new SimpleModel(builder.build()); } } diff --git a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBlockModelBuilder.java b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBlockModelBuilder.java index bfc2ab0ca..a64144135 100644 --- a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBlockModelBuilder.java +++ b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricBlockModelBuilder.java @@ -2,7 +2,6 @@ import java.util.function.BiFunction; -import com.google.common.collect.ImmutableList; import com.jozufozu.flywheel.api.material.Material; import com.jozufozu.flywheel.api.model.Model; import com.jozufozu.flywheel.api.vertex.VertexView; @@ -49,7 +48,7 @@ public SimpleModel build() { materialFunc = ModelUtil::getMaterial; } - var out = ImmutableList.builder(); + var builder = ChunkLayerSortedListBuilder.getThreadLocal(); BakedModelBufferer.bufferBlock(ModelUtil.VANILLA_RENDERER, level, state, poseStack, (renderType, shaded, data) -> { Material material = materialFunc.apply(renderType, shaded); @@ -57,10 +56,10 @@ public SimpleModel build() { VertexView vertexView = new NoOverlayVertexView(); MemoryBlock meshData = ModelUtil.convertVanillaBuffer(data, vertexView); var mesh = new SimpleMesh(vertexView, meshData, "source=BlockModelBuilder," + "blockState=" + state + ",renderType=" + renderType + ",shaded=" + shaded); - out.add(new Model.ConfiguredMesh(material, mesh)); + builder.add(renderType, new Model.ConfiguredMesh(material, mesh)); } }); - return new SimpleModel(out.build()); + return new SimpleModel(builder.build()); } } diff --git a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricMultiBlockModelBuilder.java b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricMultiBlockModelBuilder.java index d3dbf408c..74a4f29f1 100644 --- a/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricMultiBlockModelBuilder.java +++ b/fabric/src/lib/java/com/jozufozu/flywheel/lib/model/baked/FabricMultiBlockModelBuilder.java @@ -2,7 +2,6 @@ import java.util.function.BiFunction; -import com.google.common.collect.ImmutableList; import com.jozufozu.flywheel.api.material.Material; import com.jozufozu.flywheel.api.model.Model; import com.jozufozu.flywheel.api.vertex.VertexView; @@ -46,7 +45,7 @@ public SimpleModel build() { materialFunc = ModelUtil::getMaterial; } - var out = ImmutableList.builder(); + var builder = ChunkLayerSortedListBuilder.getThreadLocal(); BakedModelBufferer.bufferMultiBlock(ModelUtil.VANILLA_RENDERER, positions.iterator(), level, poseStack, renderFluids, (renderType, shaded, data) -> { Material material = materialFunc.apply(renderType, shaded); @@ -54,10 +53,10 @@ public SimpleModel build() { VertexView vertexView = new NoOverlayVertexView(); MemoryBlock meshData = ModelUtil.convertVanillaBuffer(data, vertexView); var mesh = new SimpleMesh(vertexView, meshData, "source=MultiBlockModelBuilder," + "renderType=" + renderType + ",shaded=" + shaded); - out.add(new Model.ConfiguredMesh(material, mesh)); + builder.add(renderType, new Model.ConfiguredMesh(material, mesh)); } }); - return new SimpleModel(out.build()); + return new SimpleModel(builder.build()); } } diff --git a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java index cb6882a4d..d62de8009 100644 --- a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java +++ b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/BakedModelBufferer.java @@ -24,8 +24,8 @@ import net.minecraftforge.client.model.data.ModelData; final class BakedModelBufferer { - private static final RenderType[] CHUNK_LAYERS = RenderType.chunkBufferLayers().toArray(RenderType[]::new); - private static final int CHUNK_LAYER_AMOUNT = CHUNK_LAYERS.length; + static final RenderType[] CHUNK_LAYERS = RenderType.chunkBufferLayers().toArray(RenderType[]::new); + static final int CHUNK_LAYER_AMOUNT = CHUNK_LAYERS.length; private static final ThreadLocal THREAD_LOCAL_OBJECTS = ThreadLocal.withInitial(ThreadLocalObjects::new); diff --git a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ChunkLayerSortedListBuilder.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ChunkLayerSortedListBuilder.java new file mode 100644 index 000000000..01890f7c7 --- /dev/null +++ b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ChunkLayerSortedListBuilder.java @@ -0,0 +1,54 @@ +package com.jozufozu.flywheel.lib.model.baked; + +import java.util.List; + +import com.google.common.collect.ImmutableList; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import net.minecraft.client.renderer.RenderType; + +class ChunkLayerSortedListBuilder { + private static final ThreadLocal> THREAD_LOCAL = ThreadLocal.withInitial(ChunkLayerSortedListBuilder::new); + + @SuppressWarnings("unchecked") + private final ObjectArrayList[] lists = new ObjectArrayList[BakedModelBufferer.CHUNK_LAYER_AMOUNT]; + + private ChunkLayerSortedListBuilder() { + for (int layerIndex = 0; layerIndex < BakedModelBufferer.CHUNK_LAYER_AMOUNT; layerIndex++) { + ObjectArrayList list = new ObjectArrayList<>(); + lists[layerIndex] = list; + } + } + + @SuppressWarnings("unchecked") + public static ChunkLayerSortedListBuilder getThreadLocal() { + return (ChunkLayerSortedListBuilder) THREAD_LOCAL.get(); + } + + public void add(RenderType renderType, T obj) { + int layerIndex = renderType.getChunkLayerId(); + if (layerIndex == -1) { + throw new IllegalArgumentException("RenderType '" + renderType + "' is not a chunk layer"); + } + List list = lists[layerIndex]; + list.add(obj); + } + + @SuppressWarnings("unchecked") + public ImmutableList build() { + int size = 0; + for (ObjectArrayList list : lists) { + size += list.size(); + } + + T[] array = (T[]) new Object[size]; + int destPos = 0; + for (ObjectArrayList list : lists) { + System.arraycopy(list.elements(), 0, array, destPos, list.size()); + destPos += list.size(); + list.clear(); + } + + return ImmutableList.copyOf(array); + } +} diff --git a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java index 8ad0e0404..515def783 100644 --- a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java +++ b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBakedModelBuilder.java @@ -4,7 +4,6 @@ import org.jetbrains.annotations.Nullable; -import com.google.common.collect.ImmutableList; import com.jozufozu.flywheel.api.material.Material; import com.jozufozu.flywheel.api.model.Model; import com.jozufozu.flywheel.api.vertex.VertexView; @@ -74,7 +73,7 @@ public SimpleModel build() { modelData = ModelData.EMPTY; } - var out = ImmutableList.builder(); + var builder = ChunkLayerSortedListBuilder.getThreadLocal(); BakedModelBufferer.bufferSingle(ModelUtil.VANILLA_RENDERER.getModelRenderer(), level, bakedModel, blockState, poseStack, modelData, (renderType, shaded, data) -> { Material material = materialFunc.apply(renderType, shaded); @@ -82,10 +81,10 @@ public SimpleModel build() { VertexView vertexView = new NoOverlayVertexView(); MemoryBlock meshData = ModelUtil.convertVanillaBuffer(data, vertexView); var mesh = new SimpleMesh(vertexView, meshData, "source=BakedModelBuilder," + "bakedModel=" + bakedModel + ",renderType=" + renderType + ",shaded=" + shaded); - out.add(new Model.ConfiguredMesh(material, mesh)); + builder.add(renderType, new Model.ConfiguredMesh(material, mesh)); } }); - return new SimpleModel(out.build()); + return new SimpleModel(builder.build()); } } diff --git a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java index af06eadc9..ad385e40c 100644 --- a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java +++ b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeBlockModelBuilder.java @@ -4,7 +4,6 @@ import org.jetbrains.annotations.Nullable; -import com.google.common.collect.ImmutableList; import com.jozufozu.flywheel.api.material.Material; import com.jozufozu.flywheel.api.model.Model; import com.jozufozu.flywheel.api.vertex.VertexView; @@ -63,7 +62,7 @@ public SimpleModel build() { modelData = ModelData.EMPTY; } - var out = ImmutableList.builder(); + var builder = ChunkLayerSortedListBuilder.getThreadLocal(); BakedModelBufferer.bufferBlock(ModelUtil.VANILLA_RENDERER, level, state, poseStack, modelData, (renderType, shaded, data) -> { Material material = materialFunc.apply(renderType, shaded); @@ -71,10 +70,10 @@ public SimpleModel build() { VertexView vertexView = new NoOverlayVertexView(); MemoryBlock meshData = ModelUtil.convertVanillaBuffer(data, vertexView); var mesh = new SimpleMesh(vertexView, meshData, "source=BlockModelBuilder," + "blockState=" + state + ",renderType=" + renderType + ",shaded=" + shaded); - out.add(new Model.ConfiguredMesh(material, mesh)); + builder.add(renderType, new Model.ConfiguredMesh(material, mesh)); } }); - return new SimpleModel(out.build()); + return new SimpleModel(builder.build()); } } diff --git a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java index 48c3363b4..d84379598 100644 --- a/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java +++ b/forge/src/lib/java/com/jozufozu/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java @@ -5,7 +5,6 @@ import org.jetbrains.annotations.Nullable; -import com.google.common.collect.ImmutableList; import com.jozufozu.flywheel.api.material.Material; import com.jozufozu.flywheel.api.model.Model; import com.jozufozu.flywheel.api.vertex.VertexView; @@ -61,7 +60,7 @@ public SimpleModel build() { modelDataLookup = pos -> ModelData.EMPTY; } - var out = ImmutableList.builder(); + var builder = ChunkLayerSortedListBuilder.getThreadLocal(); BakedModelBufferer.bufferMultiBlock(ModelUtil.VANILLA_RENDERER, positions.iterator(), level, poseStack, modelDataLookup, renderFluids, (renderType, shaded, data) -> { Material material = materialFunc.apply(renderType, shaded); @@ -69,10 +68,10 @@ public SimpleModel build() { VertexView vertexView = new NoOverlayVertexView(); MemoryBlock meshData = ModelUtil.convertVanillaBuffer(data, vertexView); var mesh = new SimpleMesh(vertexView, meshData, "source=MultiBlockModelBuilder," + "renderType=" + renderType + ",shaded=" + shaded); - out.add(new Model.ConfiguredMesh(material, mesh)); + builder.add(renderType, new Model.ConfiguredMesh(material, mesh)); } }); - return new SimpleModel(out.build()); + return new SimpleModel(builder.build()); } }