Skip to content

[WIP] Test changement solid method#98

Open
Giovanniricotta2002 wants to merge 4 commits intoV2-Reactorfrom
testChangementSolidMethod
Open

[WIP] Test changement solid method#98
Giovanniricotta2002 wants to merge 4 commits intoV2-Reactorfrom
testChangementSolidMethod

Conversation

@Giovanniricotta2002
Copy link
Member

@Giovanniricotta2002 Giovanniricotta2002 commented Feb 1, 2026

This pull request refactors the ReactorControllerBlockEntity and related classes to improve encapsulation, support dependency injection, and separate concerns by introducing service interfaces for heat management and persistence. The changes make the codebase more maintainable, testable, and compliant with the Dependency Inversion Principle (DIP). Key logic for inventory and reactor state is now accessed via getters and setters, and persistence and heat calculation are delegated to dedicated service classes.

Encapsulation and Accessor Refactoring:

  • Converted many public fields in ReactorControllerBlockEntity to private, providing public getter and setter methods for controlled access. This improves encapsulation and prepares the class for better testability and maintainability.
  • Updated all usages in ReactorControllerBlock and ReactorControllerBlockEntity to use the new accessor methods instead of direct field access. [1] [2] [3]

Dependency Injection and Service Abstraction:

  • Introduced interfaces and default implementations for heat management (IHeatService, DefaultHeatService) and persistence (IPersistenceService, DefaultPersistenceService). These are injected as dependencies into ReactorControllerBlockEntity, following DIP and enabling easier testing and extension. [1] [2] [3]
  • Replaced direct usage of HeatManager and persistence logic with calls to the corresponding service interfaces. [1] [2] [3]

Persistence and State Management:

  • Delegated state reading and writing (NBT serialization/deserialization) to the new persistence service, reducing boilerplate and centralizing persistence logic. [1] [2]

Tick Logic and Method Extraction:

  • Refactored the tick method in ReactorControllerBlockEntity to extract sub-steps into private helper methods, improving readability and single responsibility. Added checks for readiness and separated entity resolution and heat update logic. [1] [2]

Deprecation and Documentation:

  • Marked certain internal methods as @Deprecated to indicate they are legacy and may be removed or replaced in the future. [1] [2]

@Giovanniricotta2002 Giovanniricotta2002 changed the title Test changement solid method [WIP] Test changement solid method Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant