Extract shared core infrastructure from Power and Fluid systems#10
Merged
Extract shared core infrastructure from Power and Fluid systems#10
Conversation
…tor into core package PowerBlock and FluidBlock now extend AtlasBlock, which owns the shared start/stop/updateVisualState lifecycle. PowerBlockRegistry and FluidBlockRegistry extend the generic BlockRegistry. Each concrete block class gains a companion BlockDescriptor with self-describing metadata and overrides for facing/baseBlockId properties.
…idBlockFactory Both factories now extend BlockFactory<T>, which owns the registration map and create/isRegistered/getRegisteredBlockIds/clear methods. Domain factories retain their convenience delegate methods (createPowerBlock, createFluidBlock).
…data classes BlockPersistence<T> handles common location/world/facing serialization. PowerBlockPersistence and FluidBlockPersistence are now thin wrappers providing serialize/restore lambdas for domain-specific fields. Data classes use block.facing property instead of when chains.
…ied AtlasBlockListener Add BlockSystem to bundle registry, factory, descriptors, and dialog handler per system. AtlasBlockListener iterates systems generically for placement, break, and interact events. Delete PowerBlockListener and FluidBlockListener. Update Atlas.kt to register a single unified listener. Rewrite listener tests to target AtlasBlockListener.
Move activeDialogs management, proximity/online/registry checks, and refresh task scheduling into core AtlasBlockDialog. PowerBlockDialog and FluidBlockDialog become thin rendering wrappers that delegate to AtlasBlockDialog.showDialog with domain-specific render lambdas.
…ed list Replace the 90-entry hardcoded texture list in NexoIntegration with classpath scanning via discoverResources(). Supports both JAR (production) and file (test/dev) protocols. Adding new textures now requires zero code changes — just drop the .png file into the resources directory.
Add BlockFactory.registerFromDescriptors() to register all block IDs from BlockDescriptor metadata. Delete PowerBlockInitializer and FluidBlockInitializer. Atlas.kt now derives registrations from the same descriptor lists used by BlockSystem. Update all tests to use TestHelper.initPowerFactory() / initFluidFactory() helpers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AtlasBlock), genericBlockRegistry,BlockFactory,BlockPersistence, andBlockDescriptorinto acorepackage, eliminating ~800 lines of duplicated infrastructure between the Power and Fluid systemsPowerBlockListenerandFluidBlockListenerwith a single descriptor-drivenAtlasBlockListenerthat handles all block systems generically viaBlockSystemAtlasBlockDialog, with domain dialogs as thin rendering wrappersPowerBlockInitializerandFluidBlockInitializerwith declarative descriptor-driven registration viaBlockFactory.registerFromDescriptors()Adding a new block type now requires only: creating the block class with a
descriptorcompanion, adding it to the system's descriptor list, and dropping texture files. Adding a new system requires only: a domain block class, a thin dialog wrapper, and aBlockSystemregistration inAtlas.kt.