Skip to content

refactor: remove last Fabric API imports from common/#352

Merged
Indemnity83 merged 2 commits into
mc/26.1from
refactor/multiloader-abstraction-roadmap-tracking
May 8, 2026
Merged

refactor: remove last Fabric API imports from common/#352
Indemnity83 merged 2 commits into
mc/26.1from
refactor/multiloader-abstraction-roadmap-tracking

Conversation

@Indemnity83
Copy link
Copy Markdown
Owner

Summary

Eliminates the final three net.fabricmc.* imports from common/ main sources, completing the acceptance criterion from #324: :common has zero loader-specific imports.

Changes

Power domain — drop unused ExtendedMenuType / ExtendedMenuProvider:

  • The Stirling Engine screen was using Fabric's ExtendedMenuType to send a BlockPos to the client on screen open, but the client constructor had it labeled unusedPos and ignored it entirely
  • Replaced ExtendedMenuType with vanilla MenuType in LogisticsPower.SCREEN.register()
  • Removed ExtendedMenuProvider<BlockPos> from StirlingEngineBlockEntity's implements clause and dropped getScreenOpeningData()
  • Simplified StirlingEngineScreenHandler's client constructor to the vanilla (int syncId, Inventory) signature

Pipe domain — abstract ServerPlayNetworking.send() via SPI:

  • Introduced ServerNetworking in core.lib.platform (Pattern A — same shape as ItemStorageLookup)
  • FabricPacketRegistration registers ServerPlayNetworking::send as the implementation
  • RequesterScreenHandler.broadcastChanges() now calls ServerNetworking.send() instead of the Fabric API directly

Notes

  • common/src/main now has zero net.fabricmc.* or team.reborn.* imports
  • All 69 game tests pass

Closes #324

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1d9b9801-ed08-4361-bce1-aaae049c8d30

📥 Commits

Reviewing files that changed from the base of the PR and between bd0f718 and 18826c6.

📒 Files selected for processing (1)
  • common/src/main/java/com/logistics/core/lib/platform/ServerNetworking.java

📝 Walkthrough

Walkthrough

This PR introduces a common ServerNetworking SPI and wires it to Fabric, migrates RequesterScreenHandler to use ServerNetworking.send(), updates FabricPacketRegistration to register the Fabric sender, refactors StirlingEngineBlockEntity to implement MenuBehavior.HasMenu with an anonymous MenuProvider, changes menu type registration to use MenuType with FeatureFlagSet.of(), and simplifies StirlingEngineScreenHandler’s client constructor signature.

Sequence Diagram(s)

sequenceDiagram
  participant RequesterScreenHandler
  participant ServerNetworking
  participant ServerPlayNetworking
  participant ServerPlayer
  RequesterScreenHandler->>ServerNetworking: send(player, packet)
  ServerNetworking->>ServerPlayNetworking: delegate (registered Sender)
  ServerPlayNetworking->>ServerPlayer: deliver packet
Loading

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main objective: removing Fabric API imports from common code by eliminating ExtendedMenuType/ExtendedMenuProvider and introducing a ServerNetworking abstraction.
Description check ✅ Passed The description clearly explains the changes and their motivation: eliminating Fabric imports from common sources by replacing ExtendedMenuType with vanilla MenuType and abstracting ServerPlayNetworking through an SPI.
Linked Issues check ✅ Passed The PR successfully meets all coding requirements from #324: removes ExtendedMenuType/ExtendedMenuProvider usage, introduces ServerNetworking SPI, eliminates net.fabricmc imports from common/, and maintains all game test passes.
Out of Scope Changes check ✅ Passed All changes are directly scoped to #324's requirement of removing Fabric imports from common code; no extraneous refactoring or unrelated modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/multiloader-abstraction-roadmap-tracking

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@common/src/main/java/com/logistics/core/lib/platform/ServerNetworking.java`:
- Around line 43-45: The send method in ServerNetworking currently drops packets
silently when the SPI field sender is null; change it to fail fast by throwing
an IllegalStateException with a clear message when sender is null (e.g., in
send(ServerPlayer, CustomPacketPayload) check sender and throw if null) and
ensure the register method that assigns sender (e.g., register(...) or
setSender(...)) validates its input with a null-check to prevent registering a
null sender; this surfaces wiring/order problems immediately rather than
silently dropping packets.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 14df757a-4799-4efa-8727-3033dade8650

📥 Commits

Reviewing files that changed from the base of the PR and between af63fdb and bd0f718.

📒 Files selected for processing (6)
  • common/src/main/java/com/logistics/LogisticsPower.java
  • common/src/main/java/com/logistics/core/lib/platform/ServerNetworking.java
  • common/src/main/java/com/logistics/pipe/ui/RequesterScreenHandler.java
  • common/src/main/java/com/logistics/power/engine/block/entity/StirlingEngineBlockEntity.java
  • common/src/main/java/com/logistics/power/engine/ui/StirlingEngineScreenHandler.java
  • fabric/src/main/java/com/logistics/fabric/FabricPacketRegistration.java

@Indemnity83 Indemnity83 merged commit 6977c52 into mc/26.1 May 8, 2026
6 checks passed
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.

Multiloader abstraction: roadmap and tracking

1 participant