You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code Review Summary: PR #7 (refactor: trim project code and comments)
Overall: The refactor removes ~2000 lines of comments and dead code across 88 files. Test suite passes (258 tests), NeoForge checks pass, Landlord/Go regression tests pass. However, several semantic changes and API reductions introduce risk.
🔴 Critical Issues (Runtime/Logic Bugs)
1. ChessRules.legalMoves loses move type flag — Breaks AI & Simulation
- public static List<Move> legalMoves(Board board, PieceColor color) {+ public static List<int[]> legalMoves(Board board, PieceColor color) {
Changed return type from List<Move> (containing type, promotion, castling, enPassant flags) to raw int[] arrays. BuiltInChessAI and ChessSimulationMain depend on move type metadata for promotion handling, castling rights, and en passant detection. This will cause illegal move generation or crashes in AI/simulation.
2. PianoTilesScreen.resize() accumulates widgets on every resize
@Overridepublicvoidresize(Minecraftmc, intwidth, intheight) {
this.width = width; this.height = height;
initWidgets(); // Adds new widgets without clearing old ones
}
Each resize call appends to widgets list → memory leak, duplicate event handlers, visual corruption. Must clear list first: widgets.clear(); initWidgets();.
3. flappy_bird.png is 115 bytes — likely corrupt/placeholder
File: src/main/resources/assets/game_console/textures/games/flappy_bird.png
Binary size 115 bytes is not a valid PNG. Game will crash or show missing texture on load.
🟠 High Risk (API Surface Reduction / Breaking Changes)
4. ExternalFileManager — 17 public methods removed
File: src/main/java/com/wzz/game_console/util/ExternalFileManager.java
Removed: getGameDir(), getRootDir(), listFiles(), readTextFile(), readBytes(), writeBytes(), getFilePath(), fileExists(), ensureSubFolder(), isSafeFileName(). Impact: Any external mod/code using these APIs will fail at runtime with NoSuchMethodError. If this is an internal-only utility, acceptable; otherwise needs deprecation cycle.
5. GameRenderHelper — 14 public methods removed
File: src/main/java/com/wzz/game_console/util/GameRenderHelper.java
Removed: drawBlueButton, drawRedButton, drawOutlinedCenteredText, drawTopHUD(GuiGraphics,int,int) (signature changed), drawCheckerboard, drawGrid, drawMenuLayout, calcScale, calcOffsetX, calcOffsetY, tickAndRenderParticles, drawExitConfirmOverlay, Particle/FloatingText helpers. Impact: Games using these may break. drawTopHUD signature change already broke TicTacToeScreen (fixed in diff).
6. ResourceUtil — Complete rewrite drops version compatibility
Old code handled multiple Minecraft/NeoForge version differences via reflection. New code assumes fromNamespaceAndPath exists. Will crash on older versions where this method is named differently.
7. ModNetworks.PacketHandlerCompat removed — All call sites migrated
File: src/main/java/com/wzz/game_console/init/ModNetworks.java
Compatibility layer deleted. All usages in LandlordGameScreen, GameConsoleItem updated to PacketDistributor.sendToServer/Player. Verify no missed call sites (grep for ModNetworks.PACKET_HANDLER).
8. NetworkHandler.java deleted
File: src/main/java/com/wzz/game_console/util/NetworkHandler.java (deleted)
Functionality inlined to direct PacketDistributor calls. Same verification needed.
- if (type != Type.BOMB && other.type == Type.BOMB) return false;- if (type == other.type && length == other.length) return value > other.value;- return false;+ return type == other.type && length == other.length && value > other.value;
Old logic: non-bomb cannot beat bomb; bomb beats non-bomb implicitly. New logic: bomb vs non-bomb returns false (type differs). This changes game rules — bombs should beat non-bombs. Likely a bug.
Files: src/test/java/com/wzz/game_console/client/screens/games/gogame/GoSimulationRegressionTest.java:10872, MCTSGoAIRegressionTest.java:10911
Reflection calls updated to match new method signatures. Verify production code matches — tests may pass but production method signatures could diverge.
🟢 Low Risk (Cleanup / Comments)
README.md, build.gradle, gradle.properties: Comment/formatting cleanup only
MultiplayerLobbyScreen, TicTacToe*, GameScoreStore, ChessScreen, Match3GameScreen: Comment removal, no logic change
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
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
Validation
gradlew.bat build --no-daemon --no-configuration-cache --max-workers=1 --console=plaingit diff --checkThe original untracked
docs/第十轮修复计划.mdwas intentionally left out of the commit.