diff --git a/.gitignore b/.gitignore index 81a2e88..abab9e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,24 @@ +# Gradle / build output .gradle/ .gradle-local/ build/ -run/ -out/ -ChatGPT/ +# Loom development runtime +run/ + +# IDE .idea/ .vscode/ *.iml +*.ipr +*.iws +# Logs / crash output *.log +crash-reports/ +ChatGPT/ + +# OS files .DS_Store -Thumbs.db \ No newline at end of file +Thumbs.db +Desktop.ini diff --git a/PORT-CHANGELOG.md b/PORT-CHANGELOG.md index 4c0fb98..bca945d 100644 --- a/PORT-CHANGELOG.md +++ b/PORT-CHANGELOG.md @@ -42,3 +42,14 @@ Dedicated-server runtime verification remains a later test step; this iteration - Fixed GeckoLib model and animation resource identifiers to include the actual geo/animations directories and file extensions. - Added dedicated LesRaisins Armor creative tab. - Added run-client/run-server scripts for Windows and Linux. + +## 0.8.0-alpha - Build/Git workflow + +- Version line moved to `0.8.0-alpha`; release version continues to come exclusively from `gradle.properties`. +- Reworked `compile.bat` based on the Lobby Systems workflow supplied by DartoKloning. +- `compile.bat` now reads `mod_version`, `minecraft_version`, `maven_group`, and `archives_base_name` from `gradle.properties`. +- If the exact main JAR for the current `mod_version` already exists, the script asks whether to rebuild or skip directly to Git integration. +- If the current-version JAR is absent (including an empty `build/libs` or a JAR from a different version), the build runs automatically. +- After a successful build, the script can commit and push the repository. +- Git push retries automatically up to three times per round; after three failures the user can choose another three-attempt round or stop. +- Added `.gitignore` for Gradle caches, build output, Loom runtime files, IDE metadata, and logs so Git integration does not stage generated files. diff --git a/README-PORT.md b/README-PORT.md new file mode 100644 index 0000000..12dcf9c --- /dev/null +++ b/README-PORT.md @@ -0,0 +1,26 @@ +# LesRaisinsArmor — Fabric 26.2 private port + +Target: Minecraft 26.2, Fabric Loader 0.19.3, Fabric API 0.156.0+26.2, GeckoLib 5.5.4, Java 25. + +This first port baseline keeps all original GeckoLib geo models, armor textures, inventory textures, translations, armor stat data (converted into registration-time ArmorMaterial values), and recipes. Epic Fight compatibility and Forge-only integrations were intentionally removed. + +## Build +Windows: `compile.bat` +Linux/macOS: `./compile.sh` + +The scripts verify Java 25, download Gradle 9.5.1 locally when needed, then run `clean build`. + +## Current port scope +- All original armor items are registered, including the two-piece `joker_armed` set present in the Forge source. +- Defense, toughness, knockback resistance, enchantability, durability, equip sound, and repair ingredients are migrated from the original `armor_data` JSON. +- GeckoLib 5 armor rendering is wired to the original Bedrock/GeckoLib models and textures. +- Items are added to the vanilla Combat creative tab. +- Forge datasync/networking was removed because armor stats are now deterministic at registration time. + +## Follow-up parity work +The Forge source's full-set effects (Attacker, Defender, Scout, Medical), player-body-part hiding used to reduce model clipping, and any remaining 26.2 recipe/tag schema adjustments should be validated in-game after the first successful compile. These are intentionally isolated from the baseline so compiler/API errors can be resolved first. + + +## Versioning + +Starting with Port 7, this private Fabric 26.2 port uses its own release line. `0.7.0-alpha` is the first version on that line. The upstream Forge version is retained only as source/provenance context. diff --git a/compile.bat b/compile.bat index 13ddd83..4a37e9f 100644 --- a/compile.bat +++ b/compile.bat @@ -1,43 +1,363 @@ @echo off setlocal EnableExtensions EnableDelayedExpansion + +REM ============================================================ +REM LesRaisinsArmor - Fabric Build + Git Script +REM Windows +REM ============================================================ + cd /d "%~dp0" -set "GRADLE_VERSION=9.5.1" + +set "BUILD_ONLY=0" +if /I "%~1"=="--build-only" set "BUILD_ONLY=1" + +set "GRADLE_PROPERTIES=%CD%\gradle.properties" set "LOCAL_GRADLE_DIR=%CD%\.gradle-local" +set "GRADLE_VERSION=9.5.1" set "GRADLE_HOME=%LOCAL_GRADLE_DIR%\gradle-%GRADLE_VERSION%" set "GRADLE_BIN=%GRADLE_HOME%\bin\gradle.bat" +set "GIT_ONLY=0" -set "MOD_VERSION=unknown" -set "MINECRAFT_VERSION=26.2" -for /f "tokens=1,* delims==" %%A in ('findstr /B /C:"mod_version=" gradle.properties') do set "MOD_VERSION=%%B" -for /f "tokens=1,* delims==" %%A in ('findstr /B /C:"minecraft_version=" gradle.properties') do set "MINECRAFT_VERSION=%%B" +REM Values below are read from gradle.properties. Do not hardcode release versions here. +set "MOD_VERSION=" +set "MINECRAFT_VERSION=" +set "MAVEN_GROUP=" +set "ARCHIVES_BASE_NAME=" -echo ============================================ -echo LesRaisinsArmor - Fabric !MINECRAFT_VERSION! Build -echo Mod Version: !MOD_VERSION! -echo ============================================ -where java.exe >nul 2>&1 || (echo [ERROR] Java tidak ditemukan di PATH.& exit /b 1) -for /f "tokens=2" %%V in ('java --version 2^>^&1 ^| findstr /R /C:"^openjdk " /C:"^java "') do if not defined JAVA_VERSION set "JAVA_VERSION=%%V" -for /f "tokens=1 delims=." %%M in ("%JAVA_VERSION%") do set "JAVA_MAJOR=%%M" -if not "%JAVA_MAJOR%"=="25" ( - echo [ERROR] Java 25 diperlukan. Terdeteksi: %JAVA_VERSION% - exit /b 1 +if not exist "%GRADLE_PROPERTIES%" ( + echo [ERROR] gradle.properties tidak ditemukan. + goto :failed ) -if exist "%GRADLE_BIN%" goto gradle_ready -if not exist "%LOCAL_GRADLE_DIR%" mkdir "%LOCAL_GRADLE_DIR%" -set "GRADLE_ZIP=%LOCAL_GRADLE_DIR%\gradle-%GRADLE_VERSION%-bin.zip" -echo [INFO] Mengunduh Gradle %GRADLE_VERSION%... -curl.exe -L --fail --progress-bar "https://services.gradle.org/distributions/gradle-%GRADLE_VERSION%-bin.zip" -o "%GRADLE_ZIP%" || exit /b 1 -powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Expand-Archive -LiteralPath '%GRADLE_ZIP%' -DestinationPath '%LOCAL_GRADLE_DIR%' -Force" || exit /b 1 -del /q "%GRADLE_ZIP%" >nul 2>&1 -:gradle_ready -echo [INFO] clean build... -call "%GRADLE_BIN%" clean build --no-daemon + +for /f "usebackq tokens=1,* delims==" %%A in ("%GRADLE_PROPERTIES%") do ( + if "%%A"=="mod_version" set "MOD_VERSION=%%B" + if "%%A"=="minecraft_version" set "MINECRAFT_VERSION=%%B" + if "%%A"=="maven_group" set "MAVEN_GROUP=%%B" + if "%%A"=="archives_base_name" set "ARCHIVES_BASE_NAME=%%B" +) + +if not defined MOD_VERSION ( + echo [ERROR] mod_version tidak ditemukan atau kosong di gradle.properties. + goto :failed +) +if not defined MINECRAFT_VERSION set "MINECRAFT_VERSION=26.2" +if not defined MAVEN_GROUP set "MAVEN_GROUP=me.xjqsh" +if not defined ARCHIVES_BASE_NAME set "ARCHIVES_BASE_NAME=lrarmor" + +set "JAR_PATH=%CD%\build\libs\%ARCHIVES_BASE_NAME%-%MOD_VERSION%.jar" +set "SOURCES_JAR_PATH=%CD%\build\libs\%ARCHIVES_BASE_NAME%-%MOD_VERSION%-sources.jar" + +call :banner + +REM If the exact release JAR already exists, offer rebuild or Git-only. +REM --build-only always rebuilds and never enters Git integration. +if "%BUILD_ONLY%"=="0" if exist "%JAR_PATH%" ( + echo. + echo [INFO] JAR untuk v%MOD_VERSION% sudah tersedia: + echo %JAR_PATH% + echo. + choice /C CG /N /M "[C] Compile ulang / [G] Git saja: " + if errorlevel 2 ( + set "GIT_ONLY=1" + goto :git_integration + ) +) + +REM If JAR is absent, empty build/libs, or version differs from gradle.properties, +REM compilation proceeds automatically. +where java.exe >nul 2>&1 if errorlevel 1 ( - echo. - echo [ERROR] BUILD FAILED. Kirim output error ini ke ChatGPT untuk iterasi port berikutnya. - exit /b 1 + echo [ERROR] Java tidak ditemukan di PATH. + echo Install JDK 25, buka terminal baru, lalu jalankan script lagi. + goto :failed ) + +for /f "delims=" %%J in ('where java.exe 2^>nul') do ( + set "JAVA_PATH=%%J" + goto :java_path_found +) + +:java_path_found +echo [INFO] Java executable: %JAVA_PATH% + +set "JAVA_VERSION=" +for /f "tokens=2" %%V in ('java --version 2^>^&1 ^| findstr /R /C:"^openjdk " /C:"^java "') do ( + if not defined JAVA_VERSION set "JAVA_VERSION=%%V" +) + +if not defined JAVA_VERSION ( + echo [ERROR] Tidak dapat membaca versi Java. + goto :failed +) + +for /f "tokens=1 delims=." %%M in ("%JAVA_VERSION%") do set "JAVA_MAJOR=%%M" + +if not "%JAVA_MAJOR%"=="25" ( + echo [ERROR] Java 25 diperlukan. + echo [INFO] Java yang terdeteksi: %JAVA_VERSION% + goto :failed +) + +echo [OK] Java 25 terdeteksi. + +if exist "%GRADLE_BIN%" goto :gradle_ready + +echo [INFO] Gradle %GRADLE_VERSION% belum tersedia. +echo [INFO] Mengunduh distribusi resmi... + +if not exist "%LOCAL_GRADLE_DIR%" mkdir "%LOCAL_GRADLE_DIR%" + +set "GRADLE_ZIP=%LOCAL_GRADLE_DIR%\gradle-%GRADLE_VERSION%-bin.zip" +set "GRADLE_URL=https://services.gradle.org/distributions/gradle-%GRADLE_VERSION%-bin.zip" + +where curl.exe >nul 2>&1 +if errorlevel 1 ( + echo [ERROR] curl.exe tidak ditemukan. + goto :failed +) + +curl.exe -L --fail --progress-bar "%GRADLE_URL%" -o "%GRADLE_ZIP%" +if errorlevel 1 ( + echo [ERROR] Gagal mengunduh Gradle %GRADLE_VERSION%. + goto :failed +) + +echo [INFO] Mengekstrak Gradle %GRADLE_VERSION%... +powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Expand-Archive -LiteralPath '%GRADLE_ZIP%' -DestinationPath '%LOCAL_GRADLE_DIR%' -Force" +if errorlevel 1 ( + echo [ERROR] Gagal mengekstrak Gradle. + goto :failed +) + +del /q "%GRADLE_ZIP%" >nul 2>&1 + +if not exist "%GRADLE_BIN%" ( + echo [ERROR] Gradle berhasil diekstrak tetapi executable tidak ditemukan. + goto :failed +) + +:gradle_ready +echo [OK] Gradle %GRADLE_VERSION% tersedia. +echo [INFO] Menjalankan clean build LesRaisinsArmor v%MOD_VERSION%... echo. -echo [OK] BUILD SUCCESS -for %%F in (build\libs\lrarmor-*.jar) do echo JAR: %CD%\%%F -endlocal + +call "%GRADLE_BIN%" clean build --no-daemon +if errorlevel 1 goto :build_failed + +echo. +echo ============================================ +echo BUILD SUCCESS +echo ============================================ + +if exist "%JAR_PATH%" ( + echo JAR: + echo %JAR_PATH% +) else ( + echo [WARN] Build berhasil, tetapi JAR utama tidak ditemukan pada: + echo %JAR_PATH% +) + +if exist "%SOURCES_JAR_PATH%" ( + echo SOURCES JAR: + echo %SOURCES_JAR_PATH% +) + +if "%BUILD_ONLY%"=="1" exit /b 0 + +echo. +choice /C YN /N /M "Commit dan push perubahan ke Git? [Y/N]: " +if errorlevel 2 goto :skip_git +if errorlevel 1 goto :git_integration + +:git_integration +echo. +echo ============================================ +echo Git Integration +echo ============================================ +if "%GIT_ONLY%"=="1" echo [INFO] Mode Git-only: build dilewati karena JAR v%MOD_VERSION% sudah tersedia. + +where git.exe >nul 2>&1 +if errorlevel 1 ( + echo [ERROR] Git tidak ditemukan di PATH. + goto :git_failed +) + +git rev-parse --is-inside-work-tree >nul 2>&1 +if errorlevel 1 ( + echo [ERROR] Folder ini belum menjadi Git repository. + echo. + echo Jalankan terlebih dahulu: + echo git init + echo git branch -M main + echo git remote add origin ^ + echo. + goto :git_failed +) + +set "CURRENT_BRANCH=" +for /f "delims=" %%B in ('git branch --show-current') do set "CURRENT_BRANCH=%%B" +if not defined CURRENT_BRANCH ( + echo [ERROR] Tidak dapat menentukan branch Git aktif. + goto :git_failed +) + +git remote get-url origin >nul 2>&1 +if errorlevel 1 ( + echo [ERROR] Remote Git 'origin' belum dikonfigurasi. + echo [INFO] Commit lokal tetap aman. + goto :git_failed +) + +for /f "delims=" %%R in ('git remote get-url origin') do set "ORIGIN_URL=%%R" +echo [INFO] Branch : !CURRENT_BRANCH! +echo [INFO] Origin : !ORIGIN_URL! + +echo [INFO] Memeriksa perubahan... +set "HAS_CHANGES=" +for /f "delims=" %%G in ('git status --porcelain') do set "HAS_CHANGES=1" + +if defined HAS_CHANGES ( + echo. + echo Perubahan ditemukan: + git status --short + echo. + + call :suggest_commit_message + echo [SUGGEST] Commit message: !SUGGESTED_COMMIT! + echo [INFO] Tekan Enter untuk memakai saran tersebut, atau ketik pesan sendiri. + set "COMMIT_MESSAGE=" + set /p "COMMIT_MESSAGE=Commit message [!SUGGESTED_COMMIT!]: " + if not defined COMMIT_MESSAGE set "COMMIT_MESSAGE=!SUGGESTED_COMMIT!" + + echo. + echo [INFO] Menambahkan perubahan ke staging... + git add -A + if errorlevel 1 ( + echo [ERROR] git add gagal. + goto :git_failed + ) + + echo [INFO] Membuat commit... + git commit -m "!COMMIT_MESSAGE!" + if errorlevel 1 ( + echo [ERROR] git commit gagal. + goto :git_failed + ) +) else ( + echo [INFO] Tidak ada perubahan source yang perlu di-commit. + echo [INFO] Akan mencoba push commit lokal yang belum terkirim, jika ada. +) + +call :push_branch_with_retry +if errorlevel 1 goto :git_failed + +echo. +echo [SUCCESS] Push ke Git berhasil. +goto :success + +:banner +echo ============================================ +echo LesRaisinsArmor - Fabric %MINECRAFT_VERSION% Build +echo Mod Version: %MOD_VERSION% +echo Archive: %ARCHIVES_BASE_NAME% +echo ============================================ +exit /b 0 + +:suggest_commit_message +set "SUGGESTED_COMMIT=Update LesRaisinsArmor v%MOD_VERSION%" +set "HAS_SRC_CHANGE=" +set "HAS_SCRIPT_CHANGE=" +set "HAS_DOC_CHANGE=" +for /f "delims=" %%F in ('git status --porcelain') do ( + set "LINE=%%F" + echo !LINE! | findstr /I /C:"src/" >nul && set "HAS_SRC_CHANGE=1" + echo !LINE! | findstr /I /C:"compile.bat" /C:"compile.sh" /C:"run-client.bat" /C:"run-server.bat" >nul && set "HAS_SCRIPT_CHANGE=1" + echo !LINE! | findstr /I /C:"README" /C:"LICENSE" /C:"PORT-CHANGELOG" >nul && set "HAS_DOC_CHANGE=1" +) + +if defined HAS_SRC_CHANGE set "SUGGESTED_COMMIT=Port LesRaisinsArmor v%MOD_VERSION%" +if not defined HAS_SRC_CHANGE if defined HAS_SCRIPT_CHANGE set "SUGGESTED_COMMIT=Update build scripts for v%MOD_VERSION%" +if not defined HAS_SRC_CHANGE if not defined HAS_SCRIPT_CHANGE if defined HAS_DOC_CHANGE set "SUGGESTED_COMMIT=Update documentation for v%MOD_VERSION%" +exit /b 0 + +:push_branch_with_retry +set /a PUSH_ROUND=1 + +:push_round_start +set /a PUSH_ATTEMPT=1 + +:push_attempt_start +echo. +echo [INFO] Push attempt !PUSH_ATTEMPT!/3 ^(round !PUSH_ROUND!^) ke origin/!CURRENT_BRANCH!... +git push -u origin "!CURRENT_BRANCH!" +if not errorlevel 1 exit /b 0 + +echo [WARN] Push attempt !PUSH_ATTEMPT!/3 gagal. +if !PUSH_ATTEMPT! LSS 3 ( + set /a PUSH_ATTEMPT+=1 + echo [INFO] Mencoba lagi dalam 2 detik... + timeout /t 2 /nobreak >nul + goto :push_attempt_start +) + +echo. +echo ============================================ +echo GIT PUSH FAILED - 3 ATTEMPTS +echo ============================================ +echo [INFO] Commit lokal tetap aman dan tidak perlu compile ulang. +choice /C YN /N /M "Coba push 3x lagi? [Y/N]: " +if errorlevel 2 exit /b 1 +set /a PUSH_ROUND+=1 +goto :push_round_start + +:skip_git +echo. +echo [INFO] Git commit/push dilewati. +goto :success + +:success +echo. +echo ============================================ +echo LesRaisinsArmor v%MOD_VERSION% selesai. +echo ============================================ +echo. +pause +exit /b 0 + +:build_failed +echo. +echo ============================================ +echo BUILD FAILED +echo ============================================ +echo. +echo [ERROR] Build gagal. +echo [INFO] Git Integration tidak dijalankan. +echo. +if "%BUILD_ONLY%"=="1" exit /b 1 +pause +exit /b 1 + +:git_failed +echo. +echo ============================================ +echo GIT FAILED +echo ============================================ +echo. +if "%GIT_ONLY%"=="1" ( + echo [INFO] Build tidak dijalankan; JAR v%MOD_VERSION% yang sudah ada tetap aman. +) else ( + echo [INFO] Build LesRaisinsArmor tetap berhasil jika tahap build sebelumnya sukses. +) +echo [INFO] Commit lokal tetap tersimpan. +echo [INFO] Jalankan compile.bat lagi; jika JAR versi sama terdeteksi, pilih G untuk Git-only. +echo. +pause +exit /b 2 + +:failed +echo. +echo Proses gagal. +echo. +if "%BUILD_ONLY%"=="1" exit /b 1 +pause +exit /b 1 diff --git a/gradle.properties b/gradle.properties index 759e71c..3e4c178 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,6 +8,6 @@ loom_version=1.17-SNAPSHOT fabric_api_version=0.158.0+26.2 geckolib_version=5.5.4 -mod_version=0.7.0-alpha +mod_version=0.8.0-alpha maven_group=me.xjqsh archives_base_name=lrarmor