diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 97c194a1..6a0d9ee5 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,6 +1,9 @@ name: Nightly Release on: + push: + branches: + - main workflow_dispatch: permissions: @@ -18,185 +21,144 @@ jobs: runs-on: windows-latest steps: - - name: Checkout - uses: actions/checkout@v6 + - name: Checkout + uses: actions/checkout@v6 - - name: Setup MSVC - uses: ilammy/msvc-dev-cmd@v1 + - name: Setup MSVC + uses: ilammy/msvc-dev-cmd@v1 - - name: Setup CMake - uses: lukka/get-cmake@latest + - name: Setup CMake + uses: lukka/get-cmake@latest - - name: Run CMake - uses: lukka/run-cmake@v10 - env: - VCPKG_ROOT: "" - with: - configurePreset: windows64 - buildPreset: windows64-release - buildPresetAdditionalArgs: "['--target', 'Minecraft.Client']" + - name: Run CMake + uses: lukka/run-cmake@v10 + env: + VCPKG_ROOT: "" + with: + configurePreset: windows64 + buildPreset: windows64-release + buildPresetAdditionalArgs: "['--target', 'Minecraft.Client']" - - name: Zip Build - shell: pwsh - run: | - $source = "./build/windows64/Minecraft.Client/Release" - $zip = "LCE-Revelations-Client-Win64.zip" - $topLevel = "LCE-Revelations-Client-Win64" - - # Collect files, excluding unwanted extensions - $files = Get-ChildItem -Path $source -Recurse -File | - Where-Object { $_.Extension -notin '.pch', '.zip', '.ipdb', '.iobj' } - - Add-Type -AssemblyName System.IO.Compression - Add-Type -AssemblyName System.IO.Compression.FileSystem - - $basePath = (Resolve-Path $source).Path - $fs = [System.IO.File]::Open($zip, [System.IO.FileMode]::Create) - try { - $archive = New-Object System.IO.Compression.ZipArchive($fs, [System.IO.Compression.ZipArchiveMode]::Create) + - name: Zip Build + shell: pwsh + run: | + $source = "./build/windows64/Minecraft.Client/Release" + $zip = "neoLegacyWindows64.zip" + $topLevel = "neoLegacyWindows64" + + # Collect files, excluding unwanted extensions + $files = Get-ChildItem -Path $source -Recurse -File | + Where-Object { $_.Extension -notin '.pch', '.zip', '.ipdb', '.iobj' } + + Add-Type -AssemblyName System.IO.Compression + Add-Type -AssemblyName System.IO.Compression.FileSystem + + $basePath = (Resolve-Path $source).Path + $fs = [System.IO.File]::Open($zip, [System.IO.FileMode]::Create) try { - # Add directories - Get-ChildItem -Path $basePath -Recurse -Directory | ForEach-Object { - $rel = $_.FullName.Substring($basePath.Length).TrimStart('\', '/') - $archive.CreateEntry("$topLevel/$($rel -replace '\\','/')/") | Out-Null - } - # Add files - foreach ($file in $files) { - $rel = $file.FullName.Substring($basePath.Length).TrimStart('\', '/') - $entryName = "$topLevel/$($rel -replace '\\','/')" - [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile( - $archive, $file.FullName, $entryName, - [System.IO.Compression.CompressionLevel]::Optimal - ) | Out-Null - } - } finally { $archive.Dispose() } - } finally { $fs.Dispose() } + $archive = New-Object System.IO.Compression.ZipArchive($fs, [System.IO.Compression.ZipArchiveMode]::Create) + try { + # Add directories + Get-ChildItem -Path $basePath -Recurse -Directory | ForEach-Object { + $rel = $_.FullName.Substring($basePath.Length).TrimStart('\', '/') + $archive.CreateEntry("$topLevel/$($rel -replace '\\','/')/") | Out-Null + } + # Add files + foreach ($file in $files) { + $rel = $file.FullName.Substring($basePath.Length).TrimStart('\', '/') + $entryName = "$topLevel/$($rel -replace '\\','/')" + [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile( + $archive, $file.FullName, $entryName, + [System.IO.Compression.CompressionLevel]::Optimal + ) | Out-Null + } + } finally { $archive.Dispose() } + } finally { $fs.Dispose() } + + Write-Host "Created $zip" - Write-Host "Created $zip" + - name: Stage artifacts + shell: pwsh + run: | + New-Item -ItemType Directory -Force -Path staging + Copy-Item neoLegacyWindows64.zip staging/ + Copy-Item ./build/windows64/Minecraft.Client/Release/Minecraft.Client.exe staging/ - - name: Stage artifacts - shell: pwsh - run: | - New-Item -ItemType Directory -Force -Path staging - Copy-Item LCE-Revelations-Client-Win64.zip staging/ - Copy-Item ./build/windows64/Minecraft.Client/Release/Minecraft.Client.exe staging/ - - - name: Upload artifacts - uses: actions/upload-artifact@v6 - with: - name: client-build - path: staging/* + - name: Upload artifacts + uses: actions/upload-artifact@v6 + with: + name: client-build + path: staging/* build-server: name: Build Server runs-on: windows-latest steps: - - name: Checkout - uses: actions/checkout@v6 + - name: Checkout + uses: actions/checkout@v6 - - name: Setup MSVC - uses: ilammy/msvc-dev-cmd@v1 + - name: Setup MSVC + uses: ilammy/msvc-dev-cmd@v1 - - name: Setup CMake - uses: lukka/get-cmake@latest + - name: Setup CMake + uses: lukka/get-cmake@latest - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - global-json-file: global.json + - name: Run CMake + uses: lukka/run-cmake@v10 + env: + VCPKG_ROOT: "" + with: + configurePreset: windows64 + buildPreset: windows64-release + buildPresetAdditionalArgs: "['--target', 'Minecraft.Server']" - - name: Run CMake - uses: lukka/run-cmake@v10 - env: - VCPKG_ROOT: "" - with: - configurePreset: windows64 - buildPreset: windows64-release - buildPresetAdditionalArgs: "['--target', 'Minecraft.Server', '--target', 'Minecraft.Server.FourKit']" - - - name: Zip Build (vanilla) - shell: pwsh - run: | - $source = "./build/windows64/Minecraft.Server/Release" - $zip = "LCE-Revelations-Server-Win64.zip" - $topLevel = "LCE-Revelations-Server-Win64" - - $files = Get-ChildItem -Path $source -Recurse -File | - Where-Object { $_.Extension -notin '.pch', '.zip', '.ipdb', '.iobj' } - - Add-Type -AssemblyName System.IO.Compression - Add-Type -AssemblyName System.IO.Compression.FileSystem - - $basePath = (Resolve-Path $source).Path - $fs = [System.IO.File]::Open($zip, [System.IO.FileMode]::Create) - try { - $archive = New-Object System.IO.Compression.ZipArchive($fs, [System.IO.Compression.ZipArchiveMode]::Create) + - name: Zip Build + shell: pwsh + run: | + $source = "./build/windows64/Minecraft.Server/Release" + $zip = "neoLegacyServerWindows64.zip" + $topLevel = "neoLegacyServerWindows64" + + $files = Get-ChildItem -Path $source -Recurse -File | + Where-Object { $_.Extension -notin '.pch', '.zip', '.ipdb', '.iobj' } + + Add-Type -AssemblyName System.IO.Compression + Add-Type -AssemblyName System.IO.Compression.FileSystem + + $basePath = (Resolve-Path $source).Path + $fs = [System.IO.File]::Open($zip, [System.IO.FileMode]::Create) try { - Get-ChildItem -Path $basePath -Recurse -Directory | ForEach-Object { - $rel = $_.FullName.Substring($basePath.Length).TrimStart('\', '/') - $archive.CreateEntry("$topLevel/$($rel -replace '\\','/')/") | Out-Null - } - foreach ($file in $files) { - $rel = $file.FullName.Substring($basePath.Length).TrimStart('\', '/') - $entryName = "$topLevel/$($rel -replace '\\','/')" - [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile( - $archive, $file.FullName, $entryName, - [System.IO.Compression.CompressionLevel]::Optimal - ) | Out-Null - } - } finally { $archive.Dispose() } - } finally { $fs.Dispose() } + $archive = New-Object System.IO.Compression.ZipArchive($fs, [System.IO.Compression.ZipArchiveMode]::Create) + try { + Get-ChildItem -Path $basePath -Recurse -Directory | ForEach-Object { + $rel = $_.FullName.Substring($basePath.Length).TrimStart('\', '/') + $archive.CreateEntry("$topLevel/$($rel -replace '\\','/')/") | Out-Null + } + foreach ($file in $files) { + $rel = $file.FullName.Substring($basePath.Length).TrimStart('\', '/') + $entryName = "$topLevel/$($rel -replace '\\','/')" + [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile( + $archive, $file.FullName, $entryName, + [System.IO.Compression.CompressionLevel]::Optimal + ) | Out-Null + } + } finally { $archive.Dispose() } + } finally { $fs.Dispose() } + + Write-Host "Created $zip" - Write-Host "Created $zip" + - name: Stage artifacts + shell: pwsh + run: | + New-Item -ItemType Directory -Force -Path staging + Copy-Item neoLegacyServerWindows64.zip staging/ - - name: Zip Build (FourKit) - shell: pwsh - run: | - $source = "./build/windows64/Minecraft.Server.FourKit/Release" - $zip = "LCE-Revelations-Server-Win64-FourKit.zip" - $topLevel = "LCE-Revelations-Server-Win64-FourKit" - - $files = Get-ChildItem -Path $source -Recurse -File | - Where-Object { $_.Extension -notin '.pch', '.zip', '.ipdb', '.iobj' } - - Add-Type -AssemblyName System.IO.Compression - Add-Type -AssemblyName System.IO.Compression.FileSystem - - $basePath = (Resolve-Path $source).Path - $fs = [System.IO.File]::Open($zip, [System.IO.FileMode]::Create) - try { - $archive = New-Object System.IO.Compression.ZipArchive($fs, [System.IO.Compression.ZipArchiveMode]::Create) - try { - Get-ChildItem -Path $basePath -Recurse -Directory | ForEach-Object { - $rel = $_.FullName.Substring($basePath.Length).TrimStart('\', '/') - $archive.CreateEntry("$topLevel/$($rel -replace '\\','/')/") | Out-Null - } - foreach ($file in $files) { - $rel = $file.FullName.Substring($basePath.Length).TrimStart('\', '/') - $entryName = "$topLevel/$($rel -replace '\\','/')" - [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile( - $archive, $file.FullName, $entryName, - [System.IO.Compression.CompressionLevel]::Optimal - ) | Out-Null - } - } finally { $archive.Dispose() } - } finally { $fs.Dispose() } - - Write-Host "Created $zip" - - - name: Stage artifacts - shell: pwsh - run: | - New-Item -ItemType Directory -Force -Path staging - Copy-Item LCE-Revelations-Server-Win64.zip staging/ - Copy-Item LCE-Revelations-Server-Win64-FourKit.zip staging/ - - - name: Upload artifacts - uses: actions/upload-artifact@v6 - with: - name: server-build - path: staging/* + - name: Upload artifacts + uses: actions/upload-artifact@v6 + with: + name: server-build + path: staging/* release-server: name: Release Server @@ -204,63 +166,52 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v6 + - name: Checkout + uses: actions/checkout@v6 - - name: Download server artifacts - uses: actions/download-artifact@v7 - with: - name: server-build - path: artifacts + - name: Download server artifacts + uses: actions/download-artifact@v7 + with: + name: server-build + path: artifacts - - name: Attest artifacts - uses: actions/attest-build-provenance@v2 - with: - subject-path: | - artifacts/LCE-Revelations-Server-Win64.zip - artifacts/LCE-Revelations-Server-Win64-FourKit.zip + - name: Attest artifacts + uses: actions/attest-build-provenance@v2 + with: + subject-path: | + artifacts/neoLegacyServerWindows64.zip - - name: Get short SHA - id: sha - run: echo "short=$(echo '${{ github.sha }}' | cut -c1-7)" >> "$GITHUB_OUTPUT" + - name: Get short SHA + id: sha + run: echo "short=$(echo '${{ github.sha }}' | cut -c1-7)" >> "$GITHUB_OUTPUT" - - name: Delete old release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh release delete Nightly-Dedicated-Server --yes || true + - name: Delete old release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh release delete Nightly-Dedicated-Server --yes || true - - name: Delete old tag - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh api repos/${{ github.repository }}/git/refs/tags/Nightly-Dedicated-Server --method DELETE || true + - name: Delete old tag + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh api repos/${{ github.repository }}/git/refs/tags/Nightly-Dedicated-Server --method DELETE || true - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@v6 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.GPG_PASSPHRASE }} - git_user_signingkey: true - git_tag_gpgsign: true + - name: Create tag + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag -f Nightly-Dedicated-Server -m "Nightly server release ${{ steps.sha.outputs.short }}" + git push origin Nightly-Dedicated-Server --force - - name: Create signed tag - run: | - git tag -s -f Nightly-Dedicated-Server -m "Nightly server release ${{ steps.sha.outputs.short }}" - git push origin Nightly-Dedicated-Server --force - - - name: Create release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create Nightly-Dedicated-Server artifacts/* \ - --title "Server: ${{ steps.sha.outputs.short }}" \ - --notes "Dedicated Server runtime for Windows64. - - Two flavours are attached: - - \`LCE-Revelations-Server-Win64.zip\`: vanilla server, no plugin support, smallest download. - - \`LCE-Revelations-Server-Win64-FourKit.zip\`: server with the FourKit plugin host, bundled .NET 10 runtime, and an empty \`plugins/\` folder ready for plugin authors to drop DLLs into. - - Pick the flavour you want and extract it to a folder where you'd like to keep the server runtime." \ - --latest=false + - name: Create release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create Nightly-Dedicated-Server artifacts/* \ + --title "Server: ${{ steps.sha.outputs.short }}" \ + --notes "Dedicated Server runtime for Windows64. + + Download \`neoLegacyServerWindows64.zip\` and extract it to a folder where you'd like to keep the server runtime." \ + --latest=false release-client: name: Release Client @@ -268,97 +219,97 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v6 + - name: Checkout + uses: actions/checkout@v6 - - name: Download client artifacts - uses: actions/download-artifact@v7 - with: - name: client-build - path: artifacts + - name: Download client artifacts + uses: actions/download-artifact@v7 + with: + name: client-build + path: artifacts - - name: Attest artifacts - uses: actions/attest-build-provenance@v2 - with: - subject-path: | - artifacts/LCE-Revelations-Client-Win64.zip - artifacts/Minecraft.Client.exe + - name: Attest artifacts + uses: actions/attest-build-provenance@v2 + with: + subject-path: | + artifacts/neoLegacyWindows64.zip + artifacts/Minecraft.Client.exe - - name: Get short SHA - id: sha - run: echo "short=$(echo '${{ github.sha }}' | cut -c1-7)" >> "$GITHUB_OUTPUT" + - name: Get short SHA + id: sha + run: echo "short=$(echo '${{ github.sha }}' | cut -c1-7)" >> "$GITHUB_OUTPUT" - - name: Delete old release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh release delete Nightly --yes || true + - name: Delete old release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh release delete Nightly --yes || true - - name: Delete old tag - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh api repos/${{ github.repository }}/git/refs/tags/Nightly --method DELETE || true + - name: Delete old tag + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh api repos/${{ github.repository }}/git/refs/tags/Nightly --method DELETE || true - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@v6 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.GPG_PASSPHRASE }} - git_user_signingkey: true - git_tag_gpgsign: true + - name: Create signed tag + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag -f Nightly -m "Nightly release ${{ steps.sha.outputs.short }}" + git push origin Nightly --force - - name: Create signed tag - run: | - git tag -s -f Nightly -m "Nightly release ${{ steps.sha.outputs.short }}" - git push origin Nightly --force + - name: Write release notes + run: | + cat > notes.md <<'NOTES' + # Instructions: + **Newcomers:** + - If this is your first time, download `neoLegacyWindows64.zip` and extract it wherever you would like to keep it. + - I would recommend to set your username prior to launch (create a file called `username.txt`, put your desired username into the file, and save). + - To play, simply run `Minecraft.Client.exe`. + + **For those that wish to update their existing installation with the latest build:** + - Download `Minecraft.Client.exe` and `Minecraft.Client.pdb` and copy them over to your existing neoLegacyWindows64 build (overwrite your old version of Minecraft.Client.exe and Minecraft.Client.pdb). + + **Steam Deck & Linux:** + - Y'all know the drill. Download the `neoLegacyWindows64.zip`, extract it, add the `Minecraft.Client.exe` as a "Non-Steam Game" within the Steam library, turn on compatibility mode with Proton Experimental, and then run it! + + # Multiplayer instructions: + LAN games are natively supported, and any LAN games will appear automatically on the right. However, if you'd like to play with your friends online (and if you don't want to require them to setup a vpn, and/or if you don't want to port forward), I would recommend the following setup. Please keep in mind, you do NOT need to do this to enjoy the game. This is just how I have it setup for me so my friends can join without any hassle: + + Prerequisites: + - Premium playit.gg account, costs about $3 USD per month. This is for setting up the tunnel. + - playit.gg agent installed on host PC. + + How-to: + - Ensure your playit.gg agent is connected to your playit.gg account + - On the playit.gg website, setup a new tunnel (choose TCP). Ensure the configurable settings are set to the below values, assuming your agent is installed on the same computer as your online neoLegacyMinecraft game is hosted from. + - Configurable settings: + - Local IP: `127.0.0.1` + - Local Port: `25565` + - Proxy Protocol: `None` + - After creating your tunnel, navigate to the "Tunnels" main page. You'll see the IP address and port for your tunnel. This is what your friends will input when adding your server in order to join your online game! + + + # Why this fork exists: + Changes/additions that stray from the upstream repo (`smartcmd/MinecraftConsoles`: + - See: https://github.com/itsRevela/MinecraftConsoles?tab=readme-ov-file#latest + - I can tweak this fork while staying compatible with the upstream repo without needing to wait on my pull requests to get accepted upstream (while keeping this fork updated with the latest and greatest from upstream) + NOTES - - name: Write release notes - run: | - cat > notes.md <<'NOTES' - # Instructions: - **Newcomers:** - - If this is your first time, download `LCE-Revelations-Client-Win64.zip` and extract it wherever you would like to keep it. - - I would recommend to set your username prior to launch (create a file called `username.txt`, put your desired username into the file, and save). - - To play, simply run `Minecraft.Client.exe`. - - **For those that wish to update their existing installation with the latest build:** - - Download `Minecraft.Client.exe` and `Minecraft.Client.pdb` and copy them over to your existing LCE-Revelations-Client-Win64 build (overwrite your old version of Minecraft.Client.exe and Minecraft.Client.pdb). - - **Steam Deck & Linux:** - - Y'all know the drill. Download the `LCE-Revelations-Client-Win64.zip`, extract it, add the `Minecraft.Client.exe` as a "Non-Steam Game" within the Steam library, turn on compatibility mode with Proton Experimental, and then run it! - - # Multiplayer instructions: - LAN games are natively supported, and any LAN games will appear automatically on the right. However, if you'd like to play with your friends online (and if you don't want to require them to setup a vpn, and/or if you don't want to port forward), I would recommend the following setup. Please keep in mind, you do NOT need to do this to enjoy the game. This is just how I have it setup for me so my friends can join without any hassle: - - Prerequisites: - - Premium playit.gg account, costs about $3 USD per month. This is for setting up the tunnel. - - playit.gg agent installed on host PC. - - How-to: - - Ensure your playit.gg agent is connected to your playit.gg account - - On the playit.gg website, setup a new tunnel (choose TCP). Ensure the configurable settings are set to the below values, assuming your agent is installed on the same computer as your online LCE Revelations game is hosted from. - - Configurable settings: - - Local IP: `127.0.0.1` - - Local Port: `25565` - - Proxy Protocol: `None` - - After creating your tunnel, navigate to the "Tunnels" main page. You'll see the IP address and port for your tunnel. This is what your friends will input when adding your server in order to join your online game! - NOTES - - - name: Create release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create Nightly artifacts/* \ - --title "Client: ${{ steps.sha.outputs.short }}" \ - --notes-file notes.md + - name: Create release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create Nightly artifacts/* \ + --title "Client: ${{ steps.sha.outputs.short }}" \ + --notes-file notes.md cleanup: needs: [release-client, release-server] if: always() runs-on: ubuntu-latest steps: - - name: Cleanup artifacts - uses: geekyeggo/delete-artifact@v5 - with: - name: | - client-build - server-build + - name: Cleanup artifacts + uses: geekyeggo/delete-artifact@v5 + with: + name: | + client-build + server-build diff --git a/Minecraft.Client/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Common/Audio/SoundEngine.cpp index eb2e0d81..2721b714 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Common/Audio/SoundEngine.cpp @@ -770,14 +770,14 @@ int SoundEngine::GetRandomishTrack(int iStart,int iEnd) if(m_bHeardTrackA[i]==false) { bAllTracksHeard=false; - app.DebugPrintf("Not heard all tracks yet\n"); + //app.DebugPrintf("Not heard all tracks yet\n"); break; } } if(bAllTracksHeard) { - app.DebugPrintf("Heard all tracks - resetting the tracking array\n"); + //app.DebugPrintf("Heard all tracks - resetting the tracking array\n"); for(size_t i=iStart;i<=iEnd;i++) { @@ -793,17 +793,17 @@ int SoundEngine::GetRandomishTrack(int iStart,int iEnd) if(m_bHeardTrackA[iVal]==false) { // not heard this - app.DebugPrintf("(%d) Not heard track %d yet, so playing it now\n",i,iVal); + //app.DebugPrintf("(%d) Not heard track %d yet, so playing it now\n",i,iVal); m_bHeardTrackA[iVal]=true; break; } else { - app.DebugPrintf("(%d) Skipping track %d already heard it recently\n",i,iVal); + //app.DebugPrintf("(%d) Skipping track %d already heard it recently\n",i,iVal); } } - app.DebugPrintf("Select track %d\n",iVal); + //app.DebugPrintf("Select track %d\n",iVal); return iVal; } ///////////////////////////////////////////// diff --git a/Minecraft.Client/Common/Media/MediaWindows64.arc b/Minecraft.Client/Common/Media/MediaWindows64.arc index 05dce975..9eb8ea28 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64.arc and b/Minecraft.Client/Common/Media/MediaWindows64.arc differ diff --git a/Minecraft.Client/Common/UI/UIScene_BookAndQuillMenu.cpp b/Minecraft.Client/Common/UI/UIScene_BookAndQuillMenu.cpp index 4fac0f54..17109584 100644 --- a/Minecraft.Client/Common/UI/UIScene_BookAndQuillMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_BookAndQuillMenu.cpp @@ -287,6 +287,9 @@ void UIScene_BookAndQuillMenu::handleInput(int iPad, int key, bool repeat, bool navigateBack(); } } + else { + navigateBack(); + } } else { @@ -471,10 +474,13 @@ void UIScene_BookAndQuillMenu::handlePress(F64 controlId, F64 childId) #endif break; case eControl_Book: + if (signedBook == true) { + break; + } if (g_KBMInput.IsKBMActive()) { //This does not work when using controller. Why? God knows... this->SetFocusToElement(eControl_Type); - m_typeText.beginDirectEdit(1023, false, L""); + m_typeText.beginDirectEdit(1023, signing, data->player->getDisplayName()); } else { if (signedBook == true) { diff --git a/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp index ced8b5fe..7d1cea3f 100644 --- a/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp @@ -18,10 +18,6 @@ UIScene_EnchantingMenu::UIScene_EnchantingMenu(int iPad, void *_initData, UILaye m_enchantButton[1].init(1); m_enchantButton[2].init(2); - - - - EnchantingScreenInput *initData = static_cast(_initData); m_labelEnchant.init( initData->name.empty() ? app.GetString(IDS_ENCHANT) : initData->name ); diff --git a/Minecraft.Client/LevelRenderer.cpp b/Minecraft.Client/LevelRenderer.cpp index e1e89b58..f7d52d84 100644 --- a/Minecraft.Client/LevelRenderer.cpp +++ b/Minecraft.Client/LevelRenderer.cpp @@ -21,6 +21,7 @@ #include "LavaParticle.h" #include "FootstepParticle.h" #include "SplashParticle.h" +#include "WaterWakeParticle.h" #include "SmokeParticle.h" #include "RedDustParticle.h" #include "BreakingItemParticle.h" @@ -2825,7 +2826,7 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle // 4J - the java code doesn't distance cull these two particle types, we need to implement this behaviour differently as our distance check is // mixed up with other things bool distCull = true; - if ( (eParticleType == eParticleType_hugeexplosion) || (eParticleType == eParticleType_largeexplode) || (eParticleType == eParticleType_dragonbreath) ) + if ( (eParticleType == eParticleType_hugeexplosion) || (eParticleType == eParticleType_largeexplode) || (eParticleType == eParticleType_dragonbreath) || (eParticleType == eParticleType_wake)) { distCull = false; } @@ -2998,6 +2999,9 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle case eParticleType_splash: particle = std::make_shared(lev, x, y, z, xa, ya, za); break; + case eParticleType_wake: + particle = std::make_shared(lev, x, y, z, xa, ya, za); + break; case eParticleType_largesmoke: particle = std::make_shared(lev, x, y, z, xa, ya, za, 2.5f); break; diff --git a/Minecraft.Client/ParticleEngine.cpp b/Minecraft.Client/ParticleEngine.cpp index 7cb051cd..a5385347 100644 --- a/Minecraft.Client/ParticleEngine.cpp +++ b/Minecraft.Client/ParticleEngine.cpp @@ -12,6 +12,7 @@ #include "../Minecraft.World/net.minecraft.world.level.h" #include "../Minecraft.World/StringHelpers.h" #include "../Minecraft.World/net.minecraft.world.level.dimension.h" +#include "../Minecraft.World/InputOutputStream.h" ResourceLocation ParticleEngine::PARTICLES_LOCATION = ResourceLocation(TN_PARTICLES); @@ -49,7 +50,6 @@ void ParticleEngine::add(shared_ptr p) break; } int list = p->getAlpha() != 1.0f ? TRANSLUCENT_LIST : OPAQUE_LIST; // 4J - Brought forward from Java 1.8 - if( particles[l][t][list].size() >= maxParticles) { particles[l][t][list].pop_front(); diff --git a/Minecraft.Client/WaterWakeParticle.cpp b/Minecraft.Client/WaterWakeParticle.cpp new file mode 100644 index 00000000..aedb628f --- /dev/null +++ b/Minecraft.Client/WaterWakeParticle.cpp @@ -0,0 +1,47 @@ +#include "stdafx.h" +#include "WaterWakeParticle.h" +#include "../Minecraft.World/Random.h" +#include "../Minecraft.World/Mth.h" +#include "../Minecraft.World/JavaMath.h" +#include "../Minecraft.World/net.minecraft.world.level.h" +#include "../Minecraft.World/net.minecraft.world.level.material.h" +#include "../Minecraft.World/net.minecraft.world.level.tile.h" + +WaterWakeParticle::WaterWakeParticle(Level *level, double x, double y, double z, double xa, double ya, double za) : Particle(level, x, y, z, 0, 0, 0) +{ + xd *= 0.30000001192092896; + yd = random->nextDouble() * 0.2 + 0.1; + zd *= 0.30000001192092896; + rCol = 1.0f; + gCol = 1.0f; + bCol = 1.0f; + setMiscTex(19); + setSize(0.01f, 0.01f); + lifetime = (int)(8.0 / (random->nextDouble() * 0.8 + 0.2)); + gravity = 0.0F; + xd = xa; + yd = ya; + zd = za; +} + +void WaterWakeParticle::tick() +{ + xo = x; + yo = y; + zo = z; + + move(xd, yd, zd); + xd *= 0.9800000190734863; + yd *= 0.9800000190734863; + zd *= 0.9800000190734863; + + int i = 60 - lifetime; + float f = (float)i * 0.001f; + this->setSize(f, f); + this->setMiscTex(19 + i % 4); + + if (lifetime-- <= 0) + { + this->remove(); + } +} \ No newline at end of file diff --git a/Minecraft.Client/WaterWakeParticle.h b/Minecraft.Client/WaterWakeParticle.h new file mode 100644 index 00000000..2e6a32af --- /dev/null +++ b/Minecraft.Client/WaterWakeParticle.h @@ -0,0 +1,10 @@ +#pragma once +#include "Particle.h" + +class WaterWakeParticle : public Particle +{ +public: + virtual eINSTANCEOF GetType() { return eType_WAKEPARTICLE; } + WaterWakeParticle(Level *level, double x, double y, double z, double xa, double ya, double za); + virtual void tick(); +}; \ No newline at end of file diff --git a/Minecraft.Client/cmake/sources/Common.cmake b/Minecraft.Client/cmake/sources/Common.cmake index 287a2fcf..fff2df91 100644 --- a/Minecraft.Client/cmake/sources/Common.cmake +++ b/Minecraft.Client/cmake/sources/Common.cmake @@ -717,6 +717,8 @@ set(_MINECRAFT_CLIENT_COMMON_NET_MINECRAFT_CLIENT_PARTICLE "${CMAKE_CURRENT_SOURCE_DIR}/SpellParticle.h" "${CMAKE_CURRENT_SOURCE_DIR}/SplashParticle.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/SplashParticle.h" + "${CMAKE_CURRENT_SOURCE_DIR}/WaterWakeParticle.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/WaterWakeParticle.h" "${CMAKE_CURRENT_SOURCE_DIR}/SuspendedParticle.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/SuspendedParticle.h" "${CMAKE_CURRENT_SOURCE_DIR}/SuspendedTownParticle.cpp" diff --git a/Minecraft.Server/cmake/sources/Common.cmake b/Minecraft.Server/cmake/sources/Common.cmake index 63453a5e..ec41d3c6 100644 --- a/Minecraft.Server/cmake/sources/Common.cmake +++ b/Minecraft.Server/cmake/sources/Common.cmake @@ -23,6 +23,7 @@ set(_MINECRAFT_SERVER_COMMON_ROOT "${_MS_SRC}/../Minecraft.Client/BossMobGuiInfo.cpp" "${_MS_SRC}/../Minecraft.Client/BreakingItemParticle.cpp" "${_MS_SRC}/../Minecraft.Client/BubbleParticle.cpp" + "${_MS_SRC}/../Minecraft.Client/WaterWakeParticle.cpp" "${_MS_SRC}/../Minecraft.Client/BufferedImage.cpp" "${_MS_SRC}/../Minecraft.Client/Button.cpp" "${_MS_SRC}/../Minecraft.Client/Camera.cpp" diff --git a/Minecraft.World/Class.h b/Minecraft.World/Class.h index 058cffd9..71b9df55 100644 --- a/Minecraft.World/Class.h +++ b/Minecraft.World/Class.h @@ -292,6 +292,9 @@ enum eINSTANCEOF eType_FIREWORKSSPARKPARTICLE, eType_FIREWORKSOVERLAYPARTICLE, + //TU 31 + eType_WAKEPARTICLE, + // === Tile Entities === // eTYPE_TILEENTITY = BIT_TILE_ENTITY, @@ -503,6 +506,7 @@ public: classes->push_back( SUBCLASS(eType_SMOKEPARTICLE)->addParent(eTYPE_ENTITY) ); classes->push_back( SUBCLASS(eType_SNOWSHOVELPARTICLE)->addParent(eTYPE_ENTITY) ); classes->push_back( SUBCLASS(eType_SPLASHPARTICLE)->addParent(eTYPE_ENTITY) ); + classes->push_back( SUBCLASS(eType_WAKEPARTICLE)->addParent(eTYPE_ENTITY) ); classes->push_back( SUBCLASS(eType_TAKEANIMATIONPARTICLE)->addParent(eTYPE_ENTITY) ); classes->push_back( SUBCLASS(eType_TERRAINPARTICLE)->addParent(eTYPE_ENTITY) ); classes->push_back( SUBCLASS(eType_WATERDROPPARTICLE)->addParent(eTYPE_ENTITY) ); diff --git a/Minecraft.World/EnchantmentMenu.cpp b/Minecraft.World/EnchantmentMenu.cpp index f468907c..64875812 100644 --- a/Minecraft.World/EnchantmentMenu.cpp +++ b/Minecraft.World/EnchantmentMenu.cpp @@ -106,7 +106,6 @@ void EnchantmentMenu::slotsChanged(int a) // 4J used to take a shared_ptr container, int id, int x, int y) : Slot(container,id, x, y) {} - virtual bool mayPlace(shared_ptr item) {return true;} + int slotNum; + //stack->getItem()->id == 351 && stack->getItem()->getMaterial() == 11 + EnchantmentSlot(shared_ptr container, int id, int x, int y) : Slot(container, id, x, y) { slotNum = id; } + virtual bool mayPlace(shared_ptr item) { + if (slotNum == 0 || (item->id == 351 && Item::items[item->id]->getMaterial() == 11)) { + return true; + } + else { + return false; + } + } virtual bool mayCombine(shared_ptr item) {return false;} // 4J Added }; \ No newline at end of file diff --git a/Minecraft.World/FishingHook.cpp b/Minecraft.World/FishingHook.cpp index 1d2de0ad..a95fd8d9 100644 --- a/Minecraft.World/FishingHook.cpp +++ b/Minecraft.World/FishingHook.cpp @@ -15,9 +15,18 @@ #include "../Minecraft.World/EnchantmentHelper.h" #include "../Minecraft.World/Enchantment.h" #include "../Minecraft.World/ItemInstance.h" +#include "SynchedEntityData.h" #include -// 4J - added common ctor code. + +const int FishingHook::DATA_FLAG_RENDER_CLIENT_FX = 20; +const int FishingHook::DATA_FISH_APPROACH_ANGLE = 21; +const int FishingHook::DATA_WAKE_TIMER = 22; +const int FishingHook::DATA_NIBBLE_TIMER = 23; +const int FishingHook::DATA_FLAG_NIBBLE = 24; + + +// 4J - added common ctor code. void FishingHook::_init() { // 4J Stu - This function call had to be moved here from the Entity ctor to ensure that @@ -31,14 +40,16 @@ void FishingHook::_init() inGround = false; shakeTime = 0; flightTime = 0; - nibble = 0; // TU 31: Fishing rod now has a random nibble timer between 5 and 30 seconds, instead of a 1/500 chance every tick (plus modifiers). Source: https://minecraft.wiki/w/Fishing - nibbleTimer = random->nextInt(801) + 100; - lureTime = 0; hookedIn = nullptr; previousItem = nullptr; + fishApproachAngle = 0.0f; + wakeTimer = 0; + nibble = 0; + nibbleTimer = 0; + lureLevel = 0; luckLevel = 0; @@ -113,6 +124,11 @@ void FishingHook::getEnchantLevels() { void FishingHook::defineSynchedData() { + entityData->define(FishingHook::DATA_FLAG_RENDER_CLIENT_FX, (short)0); + entityData->define(FishingHook::DATA_FISH_APPROACH_ANGLE, 0.0f); + entityData->define(FishingHook::DATA_WAKE_TIMER, (short)0); + entityData->define(FishingHook::DATA_NIBBLE_TIMER, (short)0); + entityData->define(FishingHook::DATA_FLAG_NIBBLE, (short)0); } bool FishingHook::shouldRenderAtSqrDistance(double distance) @@ -336,7 +352,7 @@ void FishingHook::tick() inertia = 0.5f; } - int steps = 5; + int steps = 10; double waterPercentage = 0; for (int i = 0; i < steps; i++) { @@ -351,72 +367,19 @@ void FishingHook::tick() if (waterPercentage > 0) { - if (nibble > 0) - { - - nibble--; - } - else - { - - if (!(level->canSeeSky(Mth::floor(x), Mth::floor(y) + 1, Mth::floor(z)))) { - // Don't minus the nibbleTimer if the hook obstructed from the sky. - } - // TU 31: Raining affects the nibble timer by random chance rather than being a fixed rate. Source: https://minecraft.wiki/w/Fishing - else if (!(level->isRainingAt( Mth::floor(x), Mth::floor(y) + 1, Mth::floor(z)))) { - nibbleTimer--; - } - - else { - if (random->nextInt(4) == 0) { - nibbleTimer -= 2; - } - else { - nibbleTimer--; - } - } - - // Only calculate the effect of lure if it hasn't been calculated already. - if (lureTime == 0 && owner != nullptr) - { - lureTime = this->lureLevel * 100; - nibbleTimer -= lureTime; - // if the lure effect causes the nibble timer to go below 0, reset the timer and lure time to recalculate next tick. Source: https://minecraft.wiki/w/Fishing - if (nibbleTimer < 0) - { - nibbleTimer = random->nextInt(801) + 100; - lureTime = 0; - } - } - - // Checks if the nibble timer has ran out. Edge case for if it's raining and the nibble timer goes - // below 0 due to the random chance of the rain decreasing the timer by 2 instead of 1. - if (nibbleTimer == 0 || nibbleTimer == -1) - { - nibble = random->nextInt(11) + 30; - nibbleTimer = random->nextInt(801) + 100; - lureTime = 0; - yd -= 0.2f; - playSound(eSoundType_RANDOM_SPLASH, 0.25f, 1 + (random->nextFloat() - random->nextFloat()) * 0.4f); - float yt = static_cast(Mth::floor(bb->y0)); - for (int i = 0; i < 1 + bbWidth * 20; i++) - { - float xo = (random->nextFloat() * 2 - 1) * bbWidth; - float zo = (random->nextFloat() * 2 - 1) * bbWidth; - level->addParticle(eParticleType_bubble, x + xo, yt + 1, z + zo, xd, yd - random->nextFloat() * 0.2f, zd); - } - for (int i = 0; i < 1 + bbWidth * 20; i++) - { - float xo = (random->nextFloat() * 2 - 1) * bbWidth; - float zo = (random->nextFloat() * 2 - 1) * bbWidth; - level->addParticle(eParticleType_splash, x + xo, yt + 1, z + zo, xd, yd, zd); - } - } + if (!level->isClientSide) { + catchingFish(); + } - } - - if (nibble > 0) + if (level->isClientSide) { + applyClientFX(); + if (entityData->getShort(FishingHook::DATA_FLAG_NIBBLE) != 0) + { + yd -= random->nextFloat() * random->nextFloat() * random->nextFloat() * 0.2; + } + } + else if (nibble > 0) { yd -= random->nextFloat() * random->nextFloat() * random->nextFloat() * 0.2; } @@ -444,6 +407,177 @@ void FishingHook::addAdditonalSaveData(CompoundTag *tag) tag->putByte(L"inTile", static_cast(lastTile)); tag->putByte(L"shake", static_cast(shakeTime)); tag->putByte(L"inGround", static_cast(inGround ? 1 : 0)); + tag->putFloat(L"fishApproachAngle", fishApproachAngle); + tag->putShort(L"wakeTimer", static_cast(wakeTimer)); + tag->putShort(L"nibbleTimer", static_cast(nibbleTimer)); + tag->putShort(L"nibble", static_cast(nibble)); +} + +void FishingHook::catchingFish() { + int timerSubtractor = 1; + // Being under roof increases fishing time + if (!(level->canSeeSky(Mth::floor(x), Mth::floor(y) + 1, Mth::floor(z)) && random->nextInt(2) == 0)) { + timerSubtractor--; + } + // TU 31: Raining affects the nibble timer by random chance rather than being a fixed rate. Source: https://minecraft.wiki/w/Fishing + if (level->isRainingAt( Mth::floor(x), Mth::floor(y) + 1, Mth::floor(z)) && random->nextInt(4) == 0) { + timerSubtractor++; + } + + if (nibble > 0) + { + nibble -= 1; + if (nibble <= 0) + { + nibbleTimer = 0; + wakeTimer = 0; + } + } + + else + { + if (wakeTimer > 0) + { + wakeTimer -= timerSubtractor; + + if (wakeTimer <= 0) + { + yd -= 0.2f; + playSound(eSoundType_RANDOM_SPLASH, 0.25f, 1.0f + (random->nextFloat() - random->nextFloat()) * 0.4f); + nibble = random->nextInt(11) + 30; + } + else + { + fishApproachAngle += (float)(random->nextGaussian() * 4.0); + } + } + else if ( nibbleTimer>0 ) { + nibbleTimer -= timerSubtractor; + if (nibbleTimer <= 0) + { + fishApproachAngle = random->nextFloat() * 360.0f; + wakeTimer = random->nextInt(61) + 20; + } + } + else + { + nibbleTimer = random->nextInt(801) + 100 - lureLevel * 100; + } + } + updateSynchedData(); +} + +// I guess I have to use UK spelling :( +void FishingHook::updateSynchedData() { + short nibbleFlag = (nibble > 0) ? 1 : 0; + if (nibble > 0 && entityData->getShort(FishingHook::DATA_FLAG_RENDER_CLIENT_FX) != 1) { + entityData->set(FishingHook::DATA_FLAG_RENDER_CLIENT_FX, 1); // Render Nibble FX + } + // Flags and synced data are only updated if they have changed. + else if (wakeTimer > 0 && entityData->getShort(FishingHook::DATA_FLAG_RENDER_CLIENT_FX) != 2) { + entityData->set(FishingHook::DATA_FLAG_RENDER_CLIENT_FX, 2); // Render Wake FX + } + + else if (nibbleTimer > 0 && entityData->getShort(FishingHook::DATA_FLAG_RENDER_CLIENT_FX) != 3) { + entityData->set(FishingHook::DATA_FLAG_RENDER_CLIENT_FX, 3); // Render Fishing FX + } + + else if (entityData->getShort(FishingHook::DATA_FLAG_RENDER_CLIENT_FX) != 0){ + entityData->set(FishingHook::DATA_FLAG_RENDER_CLIENT_FX, 0); // Render Nothing + } + + if (entityData->getFloat(FishingHook::DATA_FISH_APPROACH_ANGLE) != fishApproachAngle) { + entityData->set(FishingHook::DATA_FISH_APPROACH_ANGLE, fishApproachAngle); + } + if (entityData->getShort(FishingHook::DATA_NIBBLE_TIMER) != nibbleTimer) { + entityData->set(FishingHook::DATA_NIBBLE_TIMER, nibbleTimer); + } + if (entityData->getShort(FishingHook::DATA_WAKE_TIMER) != wakeTimer) { + entityData->set(FishingHook::DATA_WAKE_TIMER, wakeTimer); + } + + // Nibble flag is only updated if it has changed. + if (entityData->getShort(FishingHook::DATA_FLAG_NIBBLE) != nibbleFlag) { + entityData->set(FishingHook::DATA_FLAG_NIBBLE, nibbleFlag); + } +} + +void FishingHook::applyClientFX() { + float f; + float particleY; + float particleZ; + float particleX; + float xDir; + float zDir; + float xVel; + float zVel; + float yt = static_cast(Mth::floor(bb->y0) + 1.0); + int clientWakeTimer; + int clientNibbleTimer; + + + switch (entityData->getShort(FishingHook::DATA_FLAG_RENDER_CLIENT_FX)) { + case 1: + yd -= 0.2f; + playSound(eSoundType_RANDOM_SPLASH, 0.25f, 1.0f + (random->nextFloat() - random->nextFloat()) * 0.4f); + for (int i = 0; i < 1 + bbWidth * 20; i++) + { + level->addParticle(eParticleType_bubble, x, yt, z, bbWidth, 0, bbWidth); + } + for (int i = 0; i < 1 + bbWidth * 20; i++) + { + level->addParticle(eParticleType_wake, x, yt, z, bbWidth, 0, bbWidth); + } + break; + case 2: + f = entityData->getFloat(FishingHook::DATA_FISH_APPROACH_ANGLE) * 0.017453292f; + xDir = Mth::sin(f); + zDir = Mth::cos(f); + clientWakeTimer = entityData->getShort(FishingHook::DATA_WAKE_TIMER); + particleX = x + (xDir * (float)clientWakeTimer * 0.1f); + particleZ = z+ (zDir * (float)clientWakeTimer * 0.1f); + + if (random->nextFloat() < 0.15f) + { + level->addParticle(eParticleType_bubble, particleX, yt - 0.10000000149011612, particleZ, xDir, 0.1, zDir); + } + + zVel = xDir * 0.04F; + xVel = zDir * 0.04F; + + level->addParticle(eParticleType_wake, particleX, yt, particleZ, xVel, 0.01, (-zVel)); + level->addParticle(eParticleType_wake, particleX, yt, particleZ, (-xVel), 0.01, zVel); + break; + case 3: + f = 0.15F; + clientNibbleTimer = entityData->getShort(FishingHook::DATA_NIBBLE_TIMER); + if (clientNibbleTimer < 20) + { + f = f + (float)(20 - clientNibbleTimer) * 0.05f; + } + else if (clientNibbleTimer < 40) + { + f = (float)(40 - clientNibbleTimer) * 0.02f; + } + else if (clientNibbleTimer < 60) + { + f = (float)(60 - clientNibbleTimer) * 0.01f; + } + + if (random->nextFloat() < f) + { + xDir = random->nextFloat() * 360.0f * 0.017453292f; + zDir = (random->nextFloat() * 45.0f) + 25.0f; + particleX = x + (Mth::sin(xDir) * zDir * 0.1f); + particleY = Mth::floor(bb->y0) + 1.0; + particleZ = z + (Mth::cos(xDir) * zDir * 0.1f); + for (int i = 0; i < 2 + random->nextInt(2); i++) + { + level->addParticle(eParticleType_splash, particleX, particleY, particleZ, 0.10000000149011612, 0.0, 0.10000000149011612); + } + } + break; + } } void FishingHook::readAdditionalSaveData(CompoundTag *tag) @@ -454,6 +588,11 @@ void FishingHook::readAdditionalSaveData(CompoundTag *tag) lastTile = tag->getByte(L"inTile") & 0xff; shakeTime = tag->getByte(L"shake") & 0xff; inGround = tag->getByte(L"inGround") == 1; + fishApproachAngle = tag->getFloat(L"fishApproachAngle"); + wakeTimer = tag->getShort(L"wakeTimer"); + nibbleTimer = tag->getShort(L"nibbleTimer"); + nibble = tag->getShort(L"nibble"); + entityData->set(FishingHook::DATA_FLAG_NIBBLE, (nibble > 0) ? 1 : 0); } float FishingHook::getShadowHeightOffs() @@ -500,7 +639,6 @@ int FishingHook::retrieve() if (inGround) dmg = 2; remove(); - owner->fishing = nullptr; return dmg; } diff --git a/Minecraft.World/FishingHook.h b/Minecraft.World/FishingHook.h index 23af71ab..a7c3f2c9 100644 --- a/Minecraft.World/FishingHook.h +++ b/Minecraft.World/FishingHook.h @@ -25,14 +25,23 @@ public: private: int life; int flightTime; - int nibble; - int nibbleTimer; - int lureTime; int lureLevel; int luckLevel; shared_ptr previousItem; + int wakeTimer; + int nibbleTimer; + int nibble; + float fishApproachAngle; + +private: + static const int DATA_FLAG_RENDER_CLIENT_FX; + static const int DATA_FISH_APPROACH_ANGLE; + static const int DATA_WAKE_TIMER; + static const int DATA_NIBBLE_TIMER; + static const int DATA_FLAG_NIBBLE; + public: shared_ptr hookedIn; @@ -61,6 +70,9 @@ public: virtual void lerpMotion(double xd, double yd, double zd); virtual void tick(); virtual void addAdditonalSaveData(CompoundTag *tag); + void catchingFish(); + void updateSynchedData(); + void applyClientFX(); virtual void readAdditionalSaveData(CompoundTag *tag); virtual float getShadowHeightOffs(); virtual void getEnchantLevels(); diff --git a/Minecraft.World/OceanMonumentPieces.cpp b/Minecraft.World/OceanMonumentPieces.cpp index 8882c073..4cb9f536 100644 --- a/Minecraft.World/OceanMonumentPieces.cpp +++ b/Minecraft.World/OceanMonumentPieces.cpp @@ -381,44 +381,43 @@ std::vector OceanMonumentPieces::MonumentB entryRoom = grid[ENTRY_INDEX]; - for (int x = 0; x < 5; ++x) - for (int y = 0; y < 3; ++y) - for (int z = 0; z < 5; ++z) - { - int idx = Piece::roomIndex(x, y, z); - if (grid[idx] == nullptr) continue; - - - static const int dx[6] = { 0, 0, 0, 0,-1, 1 }; - static const int dy[6] = {-1, 1, 0, 0, 0, 0 }; - static const int dz[6] = { 0, 0,-1, 1, 0, 0 }; - static const int oppFacing[6] = { 1, 0, 3, 2, 5, 4 }; - - for (int f = 0; f < 6; ++f) + for (int x = 0; x < 5; ++x) + for (int y = 0; y < 3; ++y) + for (int z = 0; z < 5; ++z) { - int nx = x + dx[f]; - int ny = y + dy[f]; - int nz = z + dz[f]; - if (nx < 0 || nx >= 5 || ny < 0 || ny >= 3 || nz < 0 || nz >= 5) continue; - int nidx = Piece::roomIndex(nx, ny, nz); - if (grid[nidx] == nullptr) continue; + int idx = Piece::roomIndex(x, y, z); + if (grid[idx] == nullptr) continue; - - if (nidx <= idx) continue; + for (int f = 0; f < 6; ++f) + { + int nx = x + Facing::STEP_X[f]; + int ny = y + Facing::STEP_Y[f]; + int nz = z + Facing::STEP_Z[f]; + if (nx < 0 || nx >= 5 || ny < 0 || ny >= 3 || nz < 0 || nz >= 5) continue; + int nidx = Piece::roomIndex(nx, ny, nz); + if (grid[nidx] == nullptr) continue; + //if (nidx <= idx) continue; - if (nz != z) - { - - int opp = (f % 2 == 0) ? f + 1 : f - 1; - grid[idx]->connectTo(opp, grid[nidx]); - } - else - { - grid[idx]->connectTo(f, grid[nidx]); + + if (nz != z) + { + + + + + + + + + int opp = Facing::OPPOSITE_FACING[f]; + grid[idx]->connectTo(opp, grid[nidx]); + } + else + { + grid[idx]->connectTo(f, grid[nidx]); + } } } - } - RoomDefinition* specialUp = new RoomDefinition(1003); RoomDefinition* specialWing1 = new RoomDefinition(1001); @@ -1482,15 +1481,15 @@ OceanMonumentPieces::EntryRoom::EntryRoom(int facing, RoomDefinition* room) bool OceanMonumentPieces::EntryRoom::postProcess(Level* level, Random* random, BoundingBox* chunkBB) { - generateBox(level, chunkBB, 0, 1, 0, 2, 1, 2, Tile::prismarine_Id, blockPrismarineBricks(),Tile::prismarine_Id, blockPrismarineBricks(), false); - generateBox(level, chunkBB, 5, 3, 0, 7, 3, 7, Tile::prismarine_Id, blockPrismarineBricks(),Tile::prismarine_Id, blockPrismarineBricks(), false); - generateBox(level, chunkBB, 6, 2, 0, 7, 2, 7, Tile::prismarine_Id, blockPrismarineBricks(),Tile::prismarine_Id, blockPrismarineBricks(), false); - generateBox(level, chunkBB, 0, 2, 0, 1, 2, 7, Tile::prismarine_Id, blockPrismarineBricks(),Tile::prismarine_Id, blockPrismarineBricks(), false); - generateBox(level, chunkBB, 0, 1, 0, 0, 1, 7, Tile::prismarine_Id, blockPrismarineBricks(),Tile::prismarine_Id, blockPrismarineBricks(), false); - generateBox(level, chunkBB, 7, 1, 0, 7, 1, 7, Tile::prismarine_Id, blockPrismarineBricks(),Tile::prismarine_Id, blockPrismarineBricks(), false); - generateBox(level, chunkBB, 0, 1, 7, 7, 3, 7, Tile::prismarine_Id, blockPrismarineBricks(),Tile::prismarine_Id, blockPrismarineBricks(), false); - generateBox(level, chunkBB, 1, 1, 0, 2, 3, 0, Tile::prismarine_Id, blockPrismarineBricks(),Tile::prismarine_Id, blockPrismarineBricks(), false); - generateBox(level, chunkBB, 5, 1, 0, 6, 3, 0, Tile::prismarine_Id, blockPrismarineBricks(),Tile::prismarine_Id, blockPrismarineBricks(), false); + generateBox(level, chunkBB, 0, 3, 0, 2, 3, 7, Tile::prismarine_Id, blockPrismarineBricks(), Tile::prismarine_Id, blockPrismarineBricks(), false); + generateBox(level, chunkBB, 5, 3, 0, 7, 3, 7, Tile::prismarine_Id, blockPrismarineBricks(), Tile::prismarine_Id, blockPrismarineBricks(), false); + generateBox(level, chunkBB, 0, 2, 0, 1, 2, 7, Tile::prismarine_Id, blockPrismarineBricks(), Tile::prismarine_Id, blockPrismarineBricks(), false); + generateBox(level, chunkBB, 6, 2, 0, 7, 2, 7, Tile::prismarine_Id, blockPrismarineBricks(), Tile::prismarine_Id, blockPrismarineBricks(), false); + generateBox(level, chunkBB, 0, 1, 0, 0, 1, 7, Tile::prismarine_Id, blockPrismarineBricks(), Tile::prismarine_Id, blockPrismarineBricks(), false); + generateBox(level, chunkBB, 7, 1, 0, 7, 1, 7, Tile::prismarine_Id, blockPrismarineBricks(), Tile::prismarine_Id, blockPrismarineBricks(), false); + generateBox(level, chunkBB, 0, 1, 7, 7, 3, 7, Tile::prismarine_Id, blockPrismarineBricks(), Tile::prismarine_Id, blockPrismarineBricks(), false); + generateBox(level, chunkBB, 1, 1, 0, 2, 3, 0, Tile::prismarine_Id, blockPrismarineBricks(), Tile::prismarine_Id, blockPrismarineBricks(), false); + generateBox(level, chunkBB, 5, 1, 0, 6, 3, 0, Tile::prismarine_Id, blockPrismarineBricks(), Tile::prismarine_Id, blockPrismarineBricks(), false); if (roomDef->hasOpening[F_NORTH]) fillWithAirOrWater(level, chunkBB, 3, 1, 7, 4, 2, 7, false); if (roomDef->hasOpening[F_WEST]) fillWithAirOrWater(level, chunkBB, 0, 1, 3, 1, 2, 4, false); diff --git a/Minecraft.World/ParticleTypes.h b/Minecraft.World/ParticleTypes.h index ecc2ab96..4bb3e360 100644 --- a/Minecraft.World/ParticleTypes.h +++ b/Minecraft.World/ParticleTypes.h @@ -13,6 +13,7 @@ enum ePARTICLE_TYPE eParticleType_lava, eParticleType_footstep, eParticleType_splash, + eParticleType_wake, eParticleType_largesmoke, eParticleType_reddust, eParticleType_snowballpoof, diff --git a/README.md b/README.md index 989a564a..69c58e9d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This project aims to backport the newer title updates back to Legacy Console Edition (which is based on TU19). [![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2?logo=discord&logoColor=white)](https://discord.gg/D6hEPNYeyn) -[![Discord](https://img.shields.io/badge/Get_it_on-Emerald_Launcher-3fc724)](https://discord.gg/D6hEPNYeyn) +[![Emerald Launcher](https://img.shields.io/badge/Get_it_on-Emerald_Launcher-3fc724)](https://github.com/LCE-Hub/LCE-Emerald-Launcher) # Our roadmap: ![Roadmap](.gitea/roadmap.png) diff --git a/configure_cmake.bat b/configure_cmake.bat new file mode 100644 index 00000000..f4942dd2 --- /dev/null +++ b/configure_cmake.bat @@ -0,0 +1,4 @@ +"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" +"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" +cd C:\Users\logat\OneDrive\Documents\GitHub\LegacyEvolved +cmake --preset windows64 \ No newline at end of file