├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── dev-build.yml │ ├── pr-build.yml │ └── release.yml ├── .gitignore ├── .gitmodules ├── Beast.pro ├── LICENSE ├── README.md ├── beast ├── logo.jpg ├── patches ├── api │ ├── 0001-misc-rebrand-to-Reaper.patch │ ├── 0002-misc-update-commons-lang3-dependency.patch │ ├── 0003-feat-Reaper-config.patch │ ├── 0004-perf-optimizations.patch │ ├── 0005-perf-optimize-unused.patch │ ├── 0006-perf-use-MethodHandle-for-the-MaterialData.patch │ ├── 0007-perf-single-values-array.patch │ ├── 0008-fix-Bukkit-API.patch │ ├── 0009-feat-add-SpongeAbsorbEvent.patch │ ├── 0010-feat-add-EntityArrowStuckEvent.patch │ ├── 0011-feat-add-PlayerAnvilDamageEvent.patch │ ├── 0012-feat-add-EntityMoveEvent.patch │ ├── 0013-feat-add-AnyEntitySpawnEvent.patch │ ├── 0014-feat-add-EntityTickEvent.patch │ ├── 0015-feat-add-TileEntityTickEvent.patch │ ├── 0016-feat-depth-for-the-BlockPhysicsEvent.patch │ ├── 0017-feat-add-new-setTypeIdAndData-method-to-the-Block-cl.patch │ ├── 0018-feat-add-EntityTrackedEvent-and-EntityUntrackedEvent.patch │ ├── 0019-feat-add-ServerTickStartEvent-ServerTickEndEvent.patch │ ├── 0020-feat-add-WorldTickStartEvent-WorldTickEndEvent.patch │ ├── 0021-feat-add-SoundEvent.patch │ ├── 0022-remove-Timings.patch │ ├── 0023-refactor-to-beast.patch │ └── 0024-friendly-missing-dependency-error.patch └── server │ ├── 0001-fix-mc-dev.patch │ ├── 0002-misc-rebrand-to-Reaper.patch │ ├── 0003-misc-Reaper-config-and-command.patch │ ├── 0004-misc-remove-paper-server-impl-metrics.patch │ ├── 0005-misc-add-Beast-metrics.patch │ ├── 0006-misc-update-netty-dependency.patch │ ├── 0007-misc-update-sqlite-jdbc-dependency.patch │ ├── 0008-misc-update-mysql-connector-java-dependency.patch │ ├── 0009-misc-update-fastutil-dependency.patch │ ├── 0010-misc-add-caffeine-dependency.patch │ ├── 0011-misc-reduce-offline-mode-warn.patch │ ├── 0012-fix-MC-101232.patch │ ├── 0013-fix-MC-103516.patch │ ├── 0014-fix-MC-120780.patch │ ├── 0015-fix-MC-128547.patch │ ├── 0016-perf-revert-Do-not-let-the-server-load-chunks-from-n.patch │ ├── 0017-perf-revert-Anti-Xray.patch │ ├── 0018-perf-remove-snooper.patch │ ├── 0019-perf-optimizations.patch │ ├── 0020-perf-experimental-optimizations.patch │ ├── 0021-perf-use-custom-PacketPlayOutBlockChange-constructor.patch │ ├── 0022-perf-optimize-BlockPosition.patch │ ├── 0023-perf-fast-passengers-check.patch │ ├── 0024-perf-don-t-tick-enchantment-tables.patch │ ├── 0025-perf-disable-sign-commands.patch │ ├── 0026-perf-optimize-physics-update-loop.patch │ ├── 0027-perf-optimize-block-event-queue.patch │ ├── 0028-perf-remove-redundant-toArray-call.patch │ ├── 0029-perf-remove-unnecessary-synchronization.patch │ ├── 0030-perf-don-t-tick-end-gateway-if-not-in-the-end-world.patch │ ├── 0031-perf-optimize-player-lookup.patch │ ├── 0032-perf-guava-to-caffeine.patch │ ├── 0033-perf-cache-entity-owner.patch │ ├── 0034-perf-cache-isInLava-result.patch │ ├── 0035-perf-cache-hashCodes.patch │ ├── 0036-perf-deactivate-PooledBlockPosition.patch │ ├── 0037-perf-cache-current-entity-block-position.patch │ ├── 0038-perf-cache-world-configs.patch │ ├── 0039-perf-reduce-entity-tracker-updates.patch │ ├── 0040-perf-reduce-inventory-updates.patch │ ├── 0041-perf-Lithium-ai-pathing-ChunkCache.patch │ ├── 0042-perf-Lithium-ai-pathing-LandPathNodeMaker.patch │ ├── 0043-perf-Lithium-math-sine_lut-MathHelper.patch │ ├── 0044-fix-Bukkit-API.patch │ ├── 0045-fix-clientside-sword-damage.patch │ ├── 0046-fix-dispenser-shulker-box-crash.patch │ ├── 0047-fix-PlayerInteractEvent-not-called-in-specific-situa.patch │ ├── 0048-fix-don-t-send-unreachable-blocks.patch │ ├── 0049-fix-tile-entity-ticking-crash.patch │ ├── 0050-fix-NaN-pos-on-entity-data-save.patch │ ├── 0051-fix-the-world-not-saving.patch │ ├── 0052-fix-setViewDistance-bug.patch │ ├── 0053-fix-update-player-chunk-map-on-mount.patch │ ├── 0054-fix-entityliving-double-dying.patch │ ├── 0055-fix-rail-and-carpet-dupe.patch │ ├── 0056-fix-force-player-dismount.patch │ ├── 0057-fix-tile-entity-chunk-ban.patch │ ├── 0058-fix-check-the-pages-amount-on-book-NBT-validation.patch │ ├── 0059-fix-check-for-a-book-in-hand-before-accepting-the-bo.patch │ ├── 0060-fix-stackoverflow-while-loading-chunk-entities.patch │ ├── 0061-fix-do-not-load-chunks-on-adjacent-chest-check.patch │ ├── 0062-fix-clientside-entity-desynchronization.patch │ ├── 0063-fix-paper-s-collision-disable-for-custom-scoreboards.patch │ ├── 0064-fix-oversized-bounding-box-on-dismount.patch │ ├── 0065-fix-do-not-accept-invalid-client-settings.patch │ ├── 0066-fix-do-not-reattach-RootVehicle-that-too-far.patch │ ├── 0067-fix-attempt-to-reduce-EntityTracker-memory-leakage.patch │ ├── 0068-feat-max-view-distance-from-32-to-64.patch │ ├── 0069-feat-always-full-chat-visibility.patch │ ├── 0070-feat-dynamic-view-distance.patch │ ├── 0071-feat-add-SpongeAbsorbEvent.patch │ ├── 0072-feat-add-EntityArrowStuckEvent.patch │ ├── 0073-feat-add-PlayerAnvilDamageEvent.patch │ ├── 0074-feat-add-EntityMoveEvent.patch │ ├── 0075-feat-add-AnyEntitySpawnEvent.patch │ ├── 0076-feat-add-EntityTickEvent.patch │ ├── 0077-feat-add-TileEntityTickEvent.patch │ ├── 0078-feat-configurable-portal-travel-cache.patch │ ├── 0079-feat-delayed-chunk-send.patch │ ├── 0080-feat-configurable-wither-spawn-shape-check.patch │ ├── 0081-feat-configurable-end-portal-shape-check.patch │ ├── 0082-feat-configurable-nether-portal-shape-check.patch │ ├── 0083-feat-configurable-halloween-mob-feature.patch │ ├── 0084-feat-configurable-paper-custom-flow-speed.patch │ ├── 0085-feat-configurable-step-sounds.patch │ ├── 0086-feat-old-combat-system.patch │ ├── 0087-perf-lighting-throttling.patch │ ├── 0088-feat-configurable-villagers.patch │ ├── 0089-perf-optimize-chat-component-parsing.patch │ ├── 0090-feat-configurable-time-update-period.patch │ ├── 0091-feat-configurable-relative-arrow-motion.patch │ ├── 0092-feat-round-player-ping.patch │ ├── 0093-feat-configurable-ping-period.patch │ ├── 0094-feat-entity-tracker-check-Y.patch │ ├── 0095-perf-add-Velocity-natives-for-encryption-and-compres.patch │ ├── 0096-perf-optimize-NetworkManager.patch │ ├── 0097-perf-consolidate-flush-calls-for-entity-tracker-pack.patch │ ├── 0098-perf-cache-chunk-NBT-in-the-PacketPlayOutMapChunk.patch │ ├── 0099-feat-add-new-setTypeIdAndData-method-to-the-Block-cl.patch │ ├── 0100-perf-async-spawn-chunks.patch │ ├── 0101-fix-lag-compensate-eating.patch │ ├── 0102-perf-don-t-load-chunks-for-physics.patch │ ├── 0103-perf-don-t-load-chunks-for-light-checks.patch │ ├── 0104-perf-don-t-load-chunks-for-chests.patch │ ├── 0105-perf-don-t-load-chunks-for-endermans.patch │ ├── 0106-perf-don-t-load-chunks-for-village-doors.patch │ ├── 0107-fix-maps-shouldn-t-load-chunk.patch │ ├── 0108-fix-don-t-allow-digging-into-unloaded-chunks.patch │ ├── 0109-perf-handle-bad-chunks-more-gracefully.patch │ ├── 0110-perf-optimize-idle-furnaces.patch │ ├── 0111-fix-MC-158900.patch │ ├── 0112-perf-use-FastUtil-in-PlayerChunkMap.patch │ ├── 0113-perf-faster-entity-list.patch │ ├── 0114-fix-MC-10657.patch │ ├── 0115-perf-avoid-double-I-O-operation-on-player-file.patch │ ├── 0116-perf-configurable-asynchronous-JsonList-saving.patch │ ├── 0117-perf-further-improve-server-tick-loop.patch │ ├── 0118-perf-cache-block-break-animation-packet.patch │ ├── 0119-fix-teleport-invisibility.patch │ ├── 0120-perf-prevent-fishing-hooks-from-portal.patch │ ├── 0121-perf-skip-updating-entity-tracker-without-players.patch │ ├── 0122-fix-reset-players-airTicks-on-respawn.patch │ ├── 0123-fix-cow-dupe.patch │ ├── 0124-fix-MC-161754.patch │ ├── 0125-perf-use-FastUUID.patch │ ├── 0126-fix-use-vanilla-minecart-speeds.patch │ ├── 0127-fix-prevent-vehicle-move-while-awaiting-teleport-con.patch │ ├── 0128-feat-add-EntityTrackedEvent-and-EntityUntrackedEvent.patch │ ├── 0129-fix-truly-async-tab-complete.patch │ ├── 0130-fix-map-id-overflow.patch │ ├── 0131-feat-add-ServerTickStartEvent-ServerTickEndEvent.patch │ ├── 0132-feat-add-WorldTickStartEvent-WorldTickEndEvent.patch │ ├── 0133-feat-packet-limiter.patch │ ├── 0134-fix-don-t-clear-entity-metadata-when-sending-a-packe.patch │ ├── 0135-fix-arrow-velocity-exploit.patch │ ├── 0136-fix-jdk8-support.patch │ ├── 0137-feat-map-decorations-limit.patch │ ├── 0138-feat-drop-use-packets-while-inside-the-inventory.patch │ ├── 0139-feat-configurable-portal-exit-chunks-generation.patch │ ├── 0140-fix-broken-portal-creation.patch │ ├── 0141-feat-async-PlayerList.patch │ ├── 0142-perf-remove-DataWatcher-locking.patch │ ├── 0143-perf-optimize-light-lookup.patch │ ├── 0144-perf-set-IP_TOS-0x18.patch │ ├── 0145-feat-add-SoundEvent.patch │ ├── 0146-perf-Tuinity-Optimise-BlockSoil-nearby-water-lookup.patch │ ├── 0147-perf-cache-random-ticks.patch │ ├── 0148-perf-deactivate-gameLoopFunction.patch │ ├── 0149-fix-packet-spam-for-non-living-entities.patch │ ├── 0150-fix-packet-click-crash.patch │ ├── 0151-perf-optimize-held-items-swapping.patch │ ├── 0152-feat-configurable-collision-check.patch │ ├── 0153-remove-Timings.patch │ ├── 0154-Optimize-canSee-checks.patch │ ├── 0155-Rebrand-to-beast.patch │ ├── 0156-Fix-MC-2025.patch │ ├── 0157-zstd-compression.patch │ ├── 0158-virtual-thread-for-AsyncScheduler.patch │ ├── 0159-refactor-to-beast.patch │ ├── 0160-Do-not-log-empty-messages-warning.patch │ ├── 0161-Fix-compatibility.patch │ ├── 0162-pause-server-when-empty.patch │ ├── 0163-leaf-optimize-minecart-collision.patch │ ├── 0164-vmp-skip-movement-if-zero.patch │ ├── 0165-Fix-MC-110386.patch │ ├── 0166-Dionysus-prevent-IndexOutOfBounds.patch │ ├── 0167-configurable-movement-warnings.patch │ ├── 0168-Fix-randar-exploit.patch │ ├── 0169-Carpet-fast-math-round.patch │ ├── 0170-Virtual-thread-for-async-executor.patch │ ├── 0171-use-more-MathHelper.patch │ ├── 0172-alternate-current-implementation.patch │ ├── 0173-virtual-thread-for-chunkio.patch │ └── 0174-virtual-thread-for-MC-Util.patch ├── pom.xml └── scripts ├── apply.sh ├── generatesources.sh ├── importmcdev.sh ├── init.sh ├── paperclip.sh ├── push.sh ├── rebuildpatches.sh ├── upstream.sh └── upstreamCommit.sh /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report detailing a bug 4 | title: '' 5 | labels: bug, unconfirmed 6 | assignees: '' 7 | --- 8 | 9 | **Describe the bug** 10 | A clear and concise description of what the bug is. 11 | 12 | **To Reproduce** 13 | Steps to reproduce. Videos are nice if applicable. 14 | 15 | **Plugins** 16 | Show the output of /plugins here. 17 | 18 | **Version** 19 | Show the output of /version here. 20 | 21 | **Misc** 22 | Anything else helpful not belonging in the categories above. 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: feature 6 | assignees: '' 7 | --- 8 | 9 | **Is your feature request related to a problem? Please describe.** 10 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 11 | 12 | **Describe the solution you'd like** 13 | A clear and concise description of what you want to happen. 14 | 15 | **Describe alternatives you've considered** 16 | A clear and concise description of any alternative solutions or features you've considered. 17 | 18 | **Additional context** 19 | Add any other context or screenshots about the feature request here. 20 | -------------------------------------------------------------------------------- /.github/workflows/dev-build.yml: -------------------------------------------------------------------------------- 1 | name: Dev Build 2 | 3 | on: 4 | push: 5 | branches: 6 | - ver/* 7 | 8 | jobs: 9 | dev-build: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v4 14 | 15 | - name: Set up JDK 8 16 | uses: actions/setup-java@v4 17 | with: 18 | java-version: 8 19 | distribution: "temurin" 20 | 21 | - uses: actions/cache@v4 22 | with: 23 | path: ~/.m2/repository 24 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} 25 | restore-keys: ${{ runner.os }}-maven- 26 | 27 | - name: Configure Git 28 | run: | 29 | git config --global user.email "no-reply@github.com" 30 | git config --global user.name "Github Actions" 31 | 32 | - name: Patch Beast 33 | run: | 34 | git submodule update --init --recursive 35 | chmod +x ./beast 36 | ./beast jar 37 | 38 | - uses: actions/upload-artifact@v4 39 | with: 40 | name: Beast-JDK8 41 | path: ./Beast-Server/target/beast-1.12.2.jar 42 | -------------------------------------------------------------------------------- /.github/workflows/pr-build.yml: -------------------------------------------------------------------------------- 1 | name: PR Build 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | pr-build: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@v2 11 | 12 | - name: Set up JDK 8 13 | uses: actions/setup-java@v1 14 | with: 15 | java-version: 8 16 | 17 | - uses: actions/cache@v2 18 | with: 19 | path: ~/.m2/repository 20 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} 21 | restore-keys: ${{ runner.os }}-maven- 22 | 23 | - name: Configure Git 24 | run: | 25 | git config --global user.email "no-reply@github.com" 26 | git config --global user.name "Github Actions" 27 | 28 | - name: Patch Beast 29 | run: | 30 | git submodule update --init --recursive 31 | chmod +x ./beast 32 | ./beast jar 33 | 34 | - uses: actions/upload-artifact@v2 35 | with: 36 | name: Beast-PR${{ github.event.pull_request.number }}-JDK8 37 | path: ./Beast-Server/target/beast-1.12.2.jar -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*' 7 | 8 | jobs: 9 | release: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | 15 | - name: Set up JDK 8 16 | uses: actions/setup-java@v1 17 | with: 18 | java-version: 8 19 | 20 | - name: Configure Git 21 | run: | 22 | git config --global user.email "no-reply@github.com" 23 | git config --global user.name "Github Actions" 24 | 25 | - name: Patch Beast 26 | run: | 27 | git submodule update --init --recursive 28 | chmod +x ./beast 29 | ./reaper jar 30 | 31 | - name: Extract release notes 32 | id: extract_release_notes 33 | uses: ffurrer2/extract-release-notes@v1 34 | 35 | - name: Create Release 36 | id: create_release 37 | uses: actions/create-release@v1 38 | env: 39 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 40 | with: 41 | tag_name: ${{ github.ref }} 42 | release_name: Release ${{ github.ref }} 43 | body: ${{ steps.extract_release_notes.outputs.release_notes }} 44 | draft: false 45 | prerelease: false 46 | 47 | - name: Publish to GitHub Packages Apache Maven 48 | run: mvn deploy 49 | env: 50 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 51 | 52 | - name: Upload Release Asset 53 | id: upload-release-asset 54 | uses: actions/upload-release-asset@v1 55 | env: 56 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 57 | with: 58 | upload_url: ${{ steps.create_release.outputs.upload_url }} 59 | asset_path: ./Beast-Server/target/beast-1.12.2.jar 60 | asset_name: beast-paperclip.jar 61 | asset_content_type: application/zip -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Concrete 2 | Reaper-Server 3 | Reaper-API 4 | mc-dev 5 | .idea 6 | testserver 7 | run 8 | current-paper 9 | 10 | # Compiled class file 11 | *.class 12 | 13 | # Log file 14 | *.log 15 | 16 | # BlueJ files 17 | *.ctxt 18 | 19 | # Mobile Tools for Java (J2ME) 20 | .mtj.tmp/ 21 | 22 | # IntelliJ 23 | *.iml 24 | *.ipr 25 | *.iws 26 | .idea/ 27 | out/ 28 | 29 | # Maven 30 | target/ 31 | 32 | # Package Files # 33 | *.jar 34 | *.war 35 | *.nar 36 | *.ear 37 | *.zip 38 | *.tar.gz 39 | *.rar 40 | 41 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 42 | hs_err_pid* 43 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Paper"] 2 | path = Paper 3 | url = https://github.com/PaperMC/Paper 4 | branch = ver/1.12.2 5 | [submodule "work/Paperclip"] 6 | path = work/Paperclip 7 | url = https://github.com/PaperMC/Paperclip 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Beast Face 2 | 3 | # Beast [![Dev Build](https://github.com/HomoMC/Beast/actions/workflows/dev-build.yml/badge.svg)](https://github.com/HomoMC/Beast/actions/workflows/dev-build.yml) 4 | 5 | A Paper 1.12.2 fork aims to provide extreme performance, bug fixes, and improvements. 6 | 7 | *This project is based on Reaper 1.12.2* 8 | 9 | ## Features 10 | 11 | - **Beast is a fork of [Paper-1.12.2](https://github.com/PaperMC/Paper)** designed for performance, new fun and exciting gameplay features. 12 | - **Contains [Lithium](https://github.com/CaffeineMC/lithium-fabric) patches** that optimizing many areas in game. 13 | - **Bug fixes** for several Minecraft issues. 14 | - **Backports** bug fixes of Mojang. 15 | - **Plugin compatibility** with Spigot & Paper plugins. 16 | - **Completely** removed Timings to save your server performance. 17 | - **Various optimizations** for vanilla methods. 18 | - **Brings back** some vanilla features. 19 | - **More events make your server more fun**. 20 | - **Support Virtual Threads which is introduced in Java 21** 21 | - Pause server when no players online(configurable) 22 | - Configurable 1.8 old combat method 23 | 24 | ### Java >= 8 is required, Java >= 21 is recommended. 25 | 26 | ## How To (Server Admins) 27 | 28 | Beast uses the same paperclip jar system that Paper uses. 29 | 30 | You can download the latest release of Beast by going [here](https://github.com/HomoMC/Beast/releases/latest) but I highly recommend to use the latest [dev build](https://nightly.link/HomoMC/Beast/workflows/dev-build/ver%2F1.12.2/Beast-JDK8.zip). 31 | 32 | ## How To (Plugin Developers) 33 | 34 | Maven repository: 35 | ```xml 36 | 37 | github-homomc-beast 38 | GitHub Apache Maven Packages 39 | https://maven.pkg.github.com/HomoMC/Beast 40 | 41 | ``` 42 | 43 | Beast-API maven dependency: 44 | ```xml 45 | 46 | com.homomc.beast 47 | beast-api 48 | 1.12.2-R0.1-SNAPSHOT 49 | provided 50 | 51 | ``` 52 | 53 | Beast-Server maven dependency: 54 | ```xml 55 | 56 | com.homomc.beast 57 | beast 58 | 1.12.2-R0.1-SNAPSHOT 59 | provided 60 | 61 | ``` 62 | 63 | ### Great thanks to these projects: 64 | 65 | - **Reaper (which is the base of Beast)** 66 | - Leaf 67 | - Polpot 68 | - Randar Explanation 69 | -------------------------------------------------------------------------------- /logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HomoMC/Beast/95dc571ac4a0d67500b658765fe03baeeb3c1731/logo.jpg -------------------------------------------------------------------------------- /patches/api/0002-misc-update-commons-lang3-dependency.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 2 Jun 2022 08:55:02 +0500 4 | Subject: [PATCH] misc: update commons-lang3 dependency 5 | 6 | 7 | diff --git a/pom.xml b/pom.xml 8 | index 3aaaa875018096d3cbee773b1214b3320dde845b..db7f0621c09075d906cb312a7305b0aae7d34643 100644 9 | --- a/pom.xml 10 | +++ b/pom.xml 11 | @@ -70,6 +70,14 @@ 12 | 2.6 13 | compile 14 | 15 | + 16 | + 17 | + org.apache.commons 18 | + commons-lang3 19 | + 3.12.0 20 | + compile 21 | + 22 | + 23 | 24 | com.googlecode.json-simple 25 | json-simple 26 | -------------------------------------------------------------------------------- /patches/api/0003-feat-Reaper-config.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 26 May 2022 01:22:53 +0500 4 | Subject: [PATCH] feat: Reaper config 5 | 6 | 7 | diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java 8 | index 40546c05064f0fd307594d5d9aa5a7e0523559cc..e6ea1ffb58c9df7331b61224d6dd270606134058 100644 9 | --- a/src/main/java/co/aikar/timings/TimingsExport.java 10 | +++ b/src/main/java/co/aikar/timings/TimingsExport.java 11 | @@ -203,7 +203,8 @@ class TimingsExport extends Thread { 12 | parent.put("config", createObject( 13 | pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)), 14 | pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)), 15 | - pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)) 16 | + pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)), 17 | + pair("reaper", mapAsJSON(Bukkit.spigot().getReaperConfig(), null)) 18 | )); 19 | 20 | new TimingsExport(listeners, parent, history).start(); 21 | diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java 22 | index 2912bdae68f52a0c3b2c58e849df5271ef2170bf..7b01a35133ea25a0a2676133b4459b51a549e590 100644 23 | --- a/src/main/java/org/bukkit/Server.java 24 | +++ b/src/main/java/org/bukkit/Server.java 25 | @@ -1015,6 +1015,11 @@ public interface Server extends PluginMessageRecipient { 26 | throw new UnsupportedOperationException("Not supported yet."); 27 | } 28 | 29 | + public org.bukkit.configuration.file.YamlConfiguration getReaperConfig() 30 | + { 31 | + throw new UnsupportedOperationException("Not supported yet."); 32 | + } 33 | + 34 | /** 35 | * Sends the component to the player 36 | * 37 | -------------------------------------------------------------------------------- /patches/api/0005-perf-optimize-unused.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 26 May 2022 10:12:29 +0500 4 | Subject: [PATCH] perf: optimize unused 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java 8 | index 5a960f3c7bab6845f1a901c28e2648eb972cdd41..ffa8c6b60ee5d97e39a2d6d06d116949f3eecc37 100644 9 | --- a/src/main/java/org/bukkit/ChatColor.java 10 | +++ b/src/main/java/org/bukkit/ChatColor.java 11 | @@ -221,7 +221,7 @@ public enum ChatColor{ 12 | private final char code; 13 | private final boolean isFormat; 14 | private final String toString; 15 | - private final static Map BY_ID = Maps.newHashMap(); 16 | + // private final static Map BY_ID = Maps.newHashMap(); // Reaper - Optimize unused 17 | private final static Map BY_CHAR = Maps.newHashMap(); 18 | 19 | private ChatColor(char code, int intCode) { 20 | @@ -364,7 +364,7 @@ public enum ChatColor{ 21 | 22 | static { 23 | for (ChatColor color : values()) { 24 | - BY_ID.put(color.intCode, color); 25 | + // BY_ID.put(color.intCode, color); // Reaper - Optimize unused 26 | BY_CHAR.put(color.code, color); 27 | } 28 | } 29 | diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java 30 | index 391713f443bffc87bb49947a88c7d0cb20f506f0..9393459f0a1666ddf0b988042655eb47d6c2f367 100644 31 | --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java 32 | +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java 33 | @@ -51,7 +51,7 @@ public final class SimplePluginManager implements PluginManager { 34 | private final Map> defaultPerms = new LinkedHashMap>(); 35 | private final Map> permSubs = new HashMap>(); 36 | private final Map> defSubs = new HashMap>(); 37 | - private boolean useTimings = false; 38 | + // private boolean useTimings = false; // Reaper - Optimize unused 39 | 40 | public SimplePluginManager(Server instance, SimpleCommandMap commandMap) { 41 | server = instance; 42 | -------------------------------------------------------------------------------- /patches/api/0006-perf-use-MethodHandle-for-the-MaterialData.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruviolence@users.noreply.github.com> 3 | Date: Thu, 26 May 2022 10:09:56 +0500 4 | Subject: [PATCH] perf: use MethodHandle for the MaterialData 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java 8 | index b43bc24376be6acc562a26b05c0228225f46d7b4..0d6cfe3d84f7c703454a0b0f403b2ac04ef83ebc 100644 9 | --- a/src/main/java/org/bukkit/Material.java 10 | +++ b/src/main/java/org/bukkit/Material.java 11 | @@ -1,5 +1,7 @@ 12 | package org.bukkit; 13 | 14 | +import java.lang.invoke.MethodHandle; 15 | +import java.lang.invoke.MethodHandles; 16 | import java.lang.reflect.Constructor; 17 | import java.util.Arrays; 18 | import java.util.Map; 19 | @@ -544,6 +546,10 @@ public enum Material { 20 | private final static Map BY_NAME = Maps.newHashMap(); 21 | private final int maxStack; 22 | private final short durability; 23 | + // Reaper start - Optimize data instantiation 24 | + private final Class dataClass; 25 | + private final MethodHandle ctorMh; 26 | + // Reaper end 27 | 28 | private Material(final int id) { 29 | this(id, 64); 30 | @@ -572,8 +578,13 @@ public enum Material { 31 | // try to cache the constructor for this material 32 | try { 33 | this.ctor = data.getConstructor(int.class, byte.class); 34 | + // Reaper start - Optimize data instantiation 35 | + this.ctorMh = MethodHandles.lookup().unreflectConstructor(ctor); 36 | + this.dataClass = ctor.getDeclaringClass(); 37 | + // Reaper end 38 | } catch (NoSuchMethodException ex) { 39 | throw new AssertionError(ex); 40 | + } catch (IllegalAccessException ex) {throw new AssertionError(ex); // Reaper 41 | } catch (SecurityException ex) { 42 | throw new AssertionError(ex); 43 | } 44 | @@ -614,7 +625,7 @@ public enum Material { 45 | * @return MaterialData associated with this Material 46 | */ 47 | public Class getData() { 48 | - return ctor.getDeclaringClass(); 49 | + return dataClass; // Reaper - Optimize data instantiation 50 | } 51 | 52 | /** 53 | @@ -628,7 +639,7 @@ public enum Material { 54 | @Deprecated 55 | public MaterialData getNewData(final byte raw) { 56 | try { 57 | - return ctor.newInstance(id, raw); 58 | + return (MaterialData) ctorMh.invoke(id, raw); // Reaper - Optimize data instantiation 59 | } catch (InstantiationException ex) { 60 | final Throwable t = ex.getCause(); 61 | if (t instanceof RuntimeException) { 62 | -------------------------------------------------------------------------------- /patches/api/0008-fix-Bukkit-API.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 26 May 2022 10:14:45 +0500 4 | Subject: [PATCH] fix: Bukkit API 5 | 6 | 7 | diff --git a/src/main/java/co/aikar/util/Counter.java b/src/main/java/co/aikar/util/Counter.java 8 | index 8401d33657f97827c57c29a041eed612bf7f1da8..553a52e5fcc8b8f594f4e79ff9c4625a9542f102 100644 9 | --- a/src/main/java/co/aikar/util/Counter.java 10 | +++ b/src/main/java/co/aikar/util/Counter.java 11 | @@ -15,7 +15,7 @@ public class Counter extends ForwardingMap { 12 | return increment(key, 1); 13 | } 14 | public long decrement(T key, long amount) { 15 | - return decrement(key, -amount); 16 | + return increment(key, -amount); // Reaper - Fix Bukkit API 17 | } 18 | public long increment(T key, long amount) { 19 | long count = this.getCount(key); 20 | diff --git a/src/main/java/org/bukkit/event/player/PlayerVelocityEvent.java b/src/main/java/org/bukkit/event/player/PlayerVelocityEvent.java 21 | index 69d2fce4a92e9ce6f7b087d58761172bf4ca791c..3028a5e3c57f929bfd19a56bae86581b9dd8c841 100644 22 | --- a/src/main/java/org/bukkit/event/player/PlayerVelocityEvent.java 23 | +++ b/src/main/java/org/bukkit/event/player/PlayerVelocityEvent.java 24 | @@ -41,7 +41,14 @@ public class PlayerVelocityEvent extends PlayerEvent implements Cancellable { 25 | * @param velocity The velocity vector that will be sent to the player 26 | */ 27 | public void setVelocity(Vector velocity) { 28 | - this.velocity = velocity; 29 | + // Reaper start - Catch bad plugins 30 | + try { 31 | + velocity.checkFinite(); 32 | + this.velocity = velocity; 33 | + } catch (Exception e) { 34 | + e.printStackTrace(); 35 | + } 36 | + // Reaper end 37 | } 38 | 39 | @Override 40 | -------------------------------------------------------------------------------- /patches/api/0009-feat-add-SpongeAbsorbEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 26 May 2022 09:22:23 +0500 4 | Subject: [PATCH] feat: add SpongeAbsorbEvent 5 | 6 | 7 | diff --git a/src/main/java/com/github/ruviolence/reaper/event/block/SpongeAbsorbEvent.java b/src/main/java/com/github/ruviolence/reaper/event/block/SpongeAbsorbEvent.java 8 | new file mode 100644 9 | index 0000000000000000000000000000000000000000..591af04b30cae0bebc587af5374b354b207edd95 10 | --- /dev/null 11 | +++ b/src/main/java/com/github/ruviolence/reaper/event/block/SpongeAbsorbEvent.java 12 | @@ -0,0 +1,50 @@ 13 | +package com.github.ruviolence.reaper.event.block; 14 | + 15 | +import org.bukkit.block.Block; 16 | +import org.bukkit.event.Cancellable; 17 | +import org.bukkit.event.HandlerList; 18 | +import org.bukkit.event.block.BlockEvent; 19 | + 20 | +import java.util.List; 21 | + 22 | +/** 23 | + * Called when a sponge absorbs water. 24 | + */ 25 | +public class SpongeAbsorbEvent extends BlockEvent implements Cancellable { 26 | + private static final HandlerList handlers = new HandlerList(); 27 | + private boolean cancelled; 28 | + private List blocks; 29 | + 30 | + public SpongeAbsorbEvent(Block block, List blocks) { 31 | + super(block); 32 | + this.blocks = blocks; 33 | + } 34 | + 35 | + @Override 36 | + public boolean isCancelled() { 37 | + return cancelled; 38 | + } 39 | + 40 | + @Override 41 | + public void setCancelled(boolean cancelled) { 42 | + this.cancelled = cancelled; 43 | + } 44 | + 45 | + /** 46 | + * Returns the list of blocks that would have been removed or were removed from the absorb event. 47 | + * 48 | + * @return All absorbed blocks 49 | + */ 50 | + public List blockList() { 51 | + return blocks; 52 | + } 53 | + 54 | + @Override 55 | + public HandlerList getHandlers() { 56 | + return handlers; 57 | + } 58 | + 59 | + public static HandlerList getHandlerList() { 60 | + return handlers; 61 | + } 62 | +} 63 | -------------------------------------------------------------------------------- /patches/api/0010-feat-add-EntityArrowStuckEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 26 May 2022 21:21:03 +0500 4 | Subject: [PATCH] feat: add EntityArrowStuckEvent 5 | 6 | 7 | diff --git a/src/main/java/com/github/ruviolence/reaper/event/entity/EntityArrowStuckEvent.java b/src/main/java/com/github/ruviolence/reaper/event/entity/EntityArrowStuckEvent.java 8 | new file mode 100644 9 | index 0000000000000000000000000000000000000000..913e4dd1e1ba2b732ceab159c2bdd67a4e068434 10 | --- /dev/null 11 | +++ b/src/main/java/com/github/ruviolence/reaper/event/entity/EntityArrowStuckEvent.java 12 | @@ -0,0 +1,37 @@ 13 | +package com.github.ruviolence.reaper.event.entity; 14 | + 15 | +import org.bukkit.entity.Entity; 16 | +import org.bukkit.event.Cancellable; 17 | +import org.bukkit.event.HandlerList; 18 | +import org.bukkit.event.entity.EntityEvent; 19 | + 20 | +/** 21 | + * Fired when an arrow gets stuck in an Entity. 22 | + */ 23 | +public class EntityArrowStuckEvent extends EntityEvent implements Cancellable { 24 | + private static final HandlerList handlers = new HandlerList(); 25 | + private boolean cancelled = false; 26 | + 27 | + public EntityArrowStuckEvent(final Entity entity) { 28 | + super(entity); 29 | + } 30 | + 31 | + @Override 32 | + public boolean isCancelled() { 33 | + return cancelled; 34 | + } 35 | + 36 | + @Override 37 | + public void setCancelled(boolean cancel) { 38 | + cancelled = cancel; 39 | + } 40 | + 41 | + @Override 42 | + public HandlerList getHandlers() { 43 | + return handlers; 44 | + } 45 | + 46 | + public static HandlerList getHandlerList() { 47 | + return handlers; 48 | + } 49 | +} 50 | -------------------------------------------------------------------------------- /patches/api/0011-feat-add-PlayerAnvilDamageEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 2 Jun 2022 08:14:09 +0500 4 | Subject: [PATCH] feat: add PlayerAnvilDamageEvent 5 | 6 | 7 | diff --git a/src/main/java/com/github/ruviolence/reaper/event/inventory/PlayerAnvilDamageEvent.java b/src/main/java/com/github/ruviolence/reaper/event/inventory/PlayerAnvilDamageEvent.java 8 | new file mode 100644 9 | index 0000000000000000000000000000000000000000..2c8eb9c1f0e07f61bcc02100e8364a3145c9f12c 10 | --- /dev/null 11 | +++ b/src/main/java/com/github/ruviolence/reaper/event/inventory/PlayerAnvilDamageEvent.java 12 | @@ -0,0 +1,60 @@ 13 | +package com.github.ruviolence.reaper.event.inventory; 14 | + 15 | +import org.bukkit.block.Block; 16 | +import org.bukkit.entity.HumanEntity; 17 | +import org.bukkit.event.Cancellable; 18 | +import org.bukkit.event.HandlerList; 19 | +import org.bukkit.event.inventory.InventoryEvent; 20 | +import org.bukkit.inventory.InventoryView; 21 | + 22 | +/** 23 | + * Fired when a player damages anvil on repair. 24 | + */ 25 | +public class PlayerAnvilDamageEvent extends InventoryEvent implements Cancellable { 26 | + private static final HandlerList handlers = new HandlerList(); 27 | + private final Block anvil; 28 | + private final int damage; 29 | + private boolean cancelled = false; 30 | + 31 | + public PlayerAnvilDamageEvent(InventoryView inventory, final Block anvil, final int damage) { 32 | + super(inventory); 33 | + this.anvil = anvil; 34 | + this.damage = damage; 35 | + } 36 | + 37 | + public Block getAnvil() { 38 | + return anvil; 39 | + } 40 | + 41 | + public int getDamage() { 42 | + return damage; 43 | + } 44 | + 45 | + /** 46 | + * Returns the player involved in this event 47 | + * 48 | + * @return Player who is involved in this event 49 | + */ 50 | + public final HumanEntity getPlayer() { 51 | + return transaction.getPlayer(); 52 | + } 53 | + 54 | + @Override 55 | + public boolean isCancelled() { 56 | + return cancelled; 57 | + } 58 | + 59 | + @Override 60 | + public void setCancelled(boolean cancel) { 61 | + this.cancelled = cancel; 62 | + } 63 | + 64 | + @Override 65 | + public HandlerList getHandlers() { 66 | + return handlers; 67 | + } 68 | + 69 | + public static HandlerList getHandlerList() { 70 | + return handlers; 71 | + } 72 | +} 73 | -------------------------------------------------------------------------------- /patches/api/0013-feat-add-AnyEntitySpawnEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 2 Jun 2022 23:27:42 +0500 4 | Subject: [PATCH] feat: add AnyEntitySpawnEvent 5 | 6 | 7 | diff --git a/src/main/java/com/github/ruviolence/reaper/event/entity/AnyEntitySpawnEvent.java b/src/main/java/com/github/ruviolence/reaper/event/entity/AnyEntitySpawnEvent.java 8 | new file mode 100644 9 | index 0000000000000000000000000000000000000000..ab25e83417f0872cfa773780109616ab7936846d 10 | --- /dev/null 11 | +++ b/src/main/java/com/github/ruviolence/reaper/event/entity/AnyEntitySpawnEvent.java 12 | @@ -0,0 +1,64 @@ 13 | +package com.github.ruviolence.reaper.event.entity; 14 | + 15 | +import org.bukkit.Location; 16 | +import org.bukkit.entity.Entity; 17 | +import org.bukkit.event.HandlerList; 18 | +import org.bukkit.event.entity.CreatureSpawnEvent; 19 | +import org.bukkit.event.entity.EntityEvent; 20 | + 21 | +/** 22 | + * Called when an any entity is spawned into a world. 23 | + *

24 | + * If an Entity Spawn event is cancelled, the entity will not spawn. 25 | + */ 26 | +public class AnyEntitySpawnEvent extends EntityEvent implements org.bukkit.event.Cancellable { 27 | + private static final HandlerList handlers = new HandlerList(); 28 | + private boolean canceled; 29 | + 30 | + private CreatureSpawnEvent.SpawnReason spawnReason; 31 | + 32 | + public AnyEntitySpawnEvent(final Entity spawnee) { 33 | + super(spawnee); 34 | + } 35 | + 36 | + /** 37 | + * Gets the reason for why the creature is being spawned. 38 | + * 39 | + * @return A SpawnReason value detailing the reason for the creature being spawned 40 | + */ 41 | + public CreatureSpawnEvent.SpawnReason getSpawnReason() { 42 | + return spawnReason; 43 | + } 44 | + 45 | + public boolean isCancelled() { 46 | + return canceled; 47 | + } 48 | + 49 | + public void setCancelled(boolean cancel) { 50 | + canceled = cancel; 51 | + } 52 | + 53 | + /** 54 | + * Gets the location at which the entity is spawning. 55 | + * 56 | + * @return The location at which the entity is spawning 57 | + */ 58 | + public Location getLocation() { 59 | + return getEntity().getLocation(); 60 | + } 61 | + 62 | + public void setData(Entity spawnee, CreatureSpawnEvent.SpawnReason spawnReason) { 63 | + super.entity = spawnee; 64 | + this.spawnReason = spawnReason; 65 | + this.canceled = false; 66 | + } 67 | + 68 | + @Override 69 | + public HandlerList getHandlers() { 70 | + return handlers; 71 | + } 72 | + 73 | + public static HandlerList getHandlerList() { 74 | + return handlers; 75 | + } 76 | +} 77 | -------------------------------------------------------------------------------- /patches/api/0014-feat-add-EntityTickEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 3 Jun 2022 00:13:47 +0500 4 | Subject: [PATCH] feat: add EntityTickEvent 5 | 6 | 7 | diff --git a/src/main/java/com/github/ruviolence/reaper/event/entity/EntityTickEvent.java b/src/main/java/com/github/ruviolence/reaper/event/entity/EntityTickEvent.java 8 | new file mode 100644 9 | index 0000000000000000000000000000000000000000..e679d746b2eb68ef34d06f684433f4202302e0a7 10 | --- /dev/null 11 | +++ b/src/main/java/com/github/ruviolence/reaper/event/entity/EntityTickEvent.java 12 | @@ -0,0 +1,48 @@ 13 | +package com.github.ruviolence.reaper.event.entity; 14 | + 15 | +import org.bukkit.World; 16 | +import org.bukkit.entity.Entity; 17 | +import org.bukkit.event.Cancellable; 18 | +import org.bukkit.event.HandlerList; 19 | +import org.bukkit.event.entity.EntityEvent; 20 | + 21 | +public class EntityTickEvent extends EntityEvent implements Cancellable { 22 | + private static final HandlerList handlers = new HandlerList(); 23 | + private boolean cancelled = false; 24 | + 25 | + private World world; 26 | + 27 | + public EntityTickEvent(Entity entity) { 28 | + super(entity); 29 | + } 30 | + 31 | + public World getWorld() { 32 | + return world; 33 | + } 34 | + 35 | + public void setData(Entity entity, World world) { 36 | + super.entity = entity; 37 | + this.world = world; 38 | + 39 | + this.cancelled = false; 40 | + } 41 | + 42 | + @Override 43 | + public HandlerList getHandlers() { 44 | + return handlers; 45 | + } 46 | + 47 | + public static HandlerList getHandlerList() { 48 | + return handlers; 49 | + } 50 | + 51 | + @Override 52 | + public boolean isCancelled() { 53 | + return cancelled; 54 | + } 55 | + 56 | + @Override 57 | + public void setCancelled(boolean cancel) { 58 | + this.cancelled = cancel; 59 | + } 60 | +} 61 | -------------------------------------------------------------------------------- /patches/api/0015-feat-add-TileEntityTickEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 3 Jun 2022 02:58:13 +0500 4 | Subject: [PATCH] feat: add TileEntityTickEvent 5 | 6 | 7 | diff --git a/src/main/java/com/github/ruviolence/reaper/event/block/TileEntityTickEvent.java b/src/main/java/com/github/ruviolence/reaper/event/block/TileEntityTickEvent.java 8 | new file mode 100644 9 | index 0000000000000000000000000000000000000000..e4c48dd4fe6822e7db591d45330fe9222f9d96ce 10 | --- /dev/null 11 | +++ b/src/main/java/com/github/ruviolence/reaper/event/block/TileEntityTickEvent.java 12 | @@ -0,0 +1,40 @@ 13 | +package com.github.ruviolence.reaper.event.block; 14 | + 15 | +import org.bukkit.block.Block; 16 | +import org.bukkit.event.Cancellable; 17 | +import org.bukkit.event.HandlerList; 18 | +import org.bukkit.event.block.BlockEvent; 19 | + 20 | +public class TileEntityTickEvent extends BlockEvent implements Cancellable { 21 | + private static final HandlerList handlers = new HandlerList(); 22 | + private boolean cancelled = false; 23 | + 24 | + public TileEntityTickEvent(Block block) { 25 | + super(block); 26 | + } 27 | + 28 | + public void setData(Block block) { 29 | + super.block = block; 30 | + 31 | + this.cancelled = false; 32 | + } 33 | + 34 | + @Override 35 | + public HandlerList getHandlers() { 36 | + return handlers; 37 | + } 38 | + 39 | + public static HandlerList getHandlerList() { 40 | + return handlers; 41 | + } 42 | + 43 | + @Override 44 | + public boolean isCancelled() { 45 | + return cancelled; 46 | + } 47 | + 48 | + @Override 49 | + public void setCancelled(boolean cancel) { 50 | + this.cancelled = cancel; 51 | + } 52 | +} 53 | -------------------------------------------------------------------------------- /patches/api/0016-feat-depth-for-the-BlockPhysicsEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 27 May 2022 00:35:07 +0500 4 | Subject: [PATCH] feat: depth for the BlockPhysicsEvent 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java 8 | index 57568cd02b55d13572d1bc13dcc3434a74ae2885..c003550c429e2d6b4fc5a23d31dc5ba750b6eb47 100644 9 | --- a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java 10 | +++ b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java 11 | @@ -17,6 +17,7 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable { 12 | private int sourceY; 13 | private int sourceZ; 14 | private Block sourceBlock; 15 | + private int depth; // Reaper - Add depth API 16 | 17 | /** 18 | * 19 | @@ -36,6 +37,28 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable { 20 | this.sourceBlock = null; 21 | } 22 | 23 | + // Reaper start - Add depth API 24 | + /** 25 | + * 26 | + * @deprecated Magic value 27 | + * @param block the block involved in this event 28 | + * @param changed the changed block's type id 29 | + * @param sourceX the x of the source block 30 | + * @param sourceY the y of the source block 31 | + * @param sourceZ the z of the source block 32 | + * @param depth physics trigger depth 33 | + */ 34 | + @Deprecated 35 | + public BlockPhysicsEvent(final Block block, final int changed, final int sourceX, final int sourceY, final int sourceZ, int depth) { 36 | + this(block, changed); 37 | + this.sourceX = sourceX; 38 | + this.sourceY = sourceY; 39 | + this.sourceZ = sourceZ; 40 | + this.sourceBlock = null; 41 | + this.depth = depth; 42 | + } 43 | + // Reaper end 44 | + 45 | /** 46 | * Gets the source block, causing this event 47 | * 48 | @@ -46,6 +69,17 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable { 49 | } 50 | // Paper end 51 | 52 | + // Reaper start - Add depth API 53 | + /** 54 | + * Gets the depth of the block physics trigger 55 | + * 56 | + * @return Depth 57 | + */ 58 | + public int getDepth() { 59 | + return depth; 60 | + } 61 | + // Reaper end 62 | + 63 | /** 64 | * 65 | * @deprecated Magic value 66 | -------------------------------------------------------------------------------- /patches/api/0017-feat-add-new-setTypeIdAndData-method-to-the-Block-cl.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 16 Jun 2022 19:01:36 +0500 4 | Subject: [PATCH] feat: add new "setTypeIdAndData" method to the Block class 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java 8 | index 2dbc784cbe151068e9276516b3b2b851da10395c..6e7611e20a3385ec79368231ef496da9f4aa1442 100644 9 | --- a/src/main/java/org/bukkit/block/Block.java 10 | +++ b/src/main/java/org/bukkit/block/Block.java 11 | @@ -251,6 +251,24 @@ public interface Block extends Metadatable { 12 | @Deprecated 13 | boolean setTypeIdAndData(int type, byte data, boolean applyPhysics); 14 | 15 | + // Reaper start 16 | + /** 17 | + * Sets the type-id of this block 18 | + * 19 | + * @param type Type-Id to change this block to 20 | + * @param data The data value to change this block to 21 | + * @param applyPhysics False to cancel physics on the changed block 22 | + * @param notify False to cancel "onBlockPlace" and "onBlockRemove" triggers 23 | + * @param updateLight False to cancel the light update 24 | + * 25 | + * @return whether the block was changed 26 | + * 27 | + * @deprecated Magic value 28 | + */ 29 | + @Deprecated 30 | + boolean setTypeIdAndData(int type, byte data, boolean applyPhysics, boolean notify, boolean updateLight); 31 | + // Reaper end 32 | + 33 | /** 34 | * Gets the face relation of this block compared to the given block. 35 | *

36 | -------------------------------------------------------------------------------- /patches/api/0024-friendly-missing-dependency-error.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: HaHaWTH 3 | Date: Tue, 9 Apr 2024 00:08:34 +0800 4 | Subject: [PATCH] friendly-missing-dependency-error 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java 8 | index 081b57231ca88e48a49dd808677de6e4bb1880b4..263ac8763609f4537125bd1eebd13cefaa315335 100644 9 | --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java 10 | +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java 11 | @@ -214,8 +214,7 @@ public final class SimplePluginManager implements PluginManager { 12 | 13 | server.getLogger().log( 14 | Level.SEVERE, 15 | - "Could not load '" + entry.getValue().getPath() + "' in folder '" + directory.getPath() + "'", 16 | - new UnknownDependencyException(dependency)); 17 | + "Could not load '" + entry.getValue().getPath() + "' in folder '" + directory.getPath() + "' " + "Missing dependency: " + dependency); 18 | break; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /patches/server/0006-misc-update-netty-dependency.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 8 Jun 2022 13:21:46 +0500 4 | Subject: [PATCH] misc: update netty dependency 5 | 6 | 7 | diff --git a/pom.xml b/pom.xml 8 | index b8b3e8d65d6f30935ed14bf2f876a20d047a4f3f..219383ae227263e8b73e8d77c85b322926eb6fef 100644 9 | --- a/pom.xml 10 | +++ b/pom.xml 11 | @@ -32,7 +32,7 @@ 12 | 13 | io.netty 14 | netty-all 15 | - 4.1.24.Final 16 | + 4.1.77.Final 17 | compile 18 | 19 | 20 | -------------------------------------------------------------------------------- /patches/server/0007-misc-update-sqlite-jdbc-dependency.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 8 Jun 2022 13:22:56 +0500 4 | Subject: [PATCH] misc: update sqlite-jdbc dependency 5 | 6 | 7 | diff --git a/pom.xml b/pom.xml 8 | index 219383ae227263e8b73e8d77c85b322926eb6fef..3e0ee611f77c7078214d93c56822c8e5137350de 100644 9 | --- a/pom.xml 10 | +++ b/pom.xml 11 | @@ -56,7 +56,7 @@ 12 | 13 | org.xerial 14 | sqlite-jdbc 15 | - 3.21.0.1 16 | + 3.36.0.3 17 | runtime 18 | 19 | 20 | -------------------------------------------------------------------------------- /patches/server/0008-misc-update-mysql-connector-java-dependency.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 8 Jun 2022 13:24:07 +0500 4 | Subject: [PATCH] misc: update mysql-connector-java dependency 5 | 6 | 7 | diff --git a/pom.xml b/pom.xml 8 | index 3e0ee611f77c7078214d93c56822c8e5137350de..bac1c3f6a4af7d65d75122d4c3eec299cf8b6876 100644 9 | --- a/pom.xml 10 | +++ b/pom.xml 11 | @@ -62,7 +62,7 @@ 12 | 13 | mysql 14 | mysql-connector-java 15 | - 5.1.45 16 | + 8.0.29 17 | runtime 18 | 19 | 20 | -------------------------------------------------------------------------------- /patches/server/0009-misc-update-fastutil-dependency.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 2 Jun 2022 00:43:50 +0500 4 | Subject: [PATCH] misc: update fastutil dependency 5 | 6 | 7 | diff --git a/pom.xml b/pom.xml 8 | index bac1c3f6a4af7d65d75122d4c3eec299cf8b6876..f1a801b64c5566bbde28c593e6cd05e022fc00b2 100644 9 | --- a/pom.xml 10 | +++ b/pom.xml 11 | @@ -28,6 +28,14 @@ 12 | 13 | 14 | 15 | + 16 | + 17 | + it.unimi.dsi 18 | + fastutil 19 | + 8.5.8 20 | + compile 21 | + 22 | + 23 | 24 | 25 | io.netty 26 | -------------------------------------------------------------------------------- /patches/server/0010-misc-add-caffeine-dependency.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 2 Jun 2022 00:46:58 +0500 4 | Subject: [PATCH] misc: add caffeine dependency 5 | 6 | 7 | diff --git a/pom.xml b/pom.xml 8 | index f1a801b64c5566bbde28c593e6cd05e022fc00b2..58ec16aa951967c393e2d0f55cff5a2fe82614cf 100644 9 | --- a/pom.xml 10 | +++ b/pom.xml 11 | @@ -79,6 +79,14 @@ 12 | 3.0.3 13 | compile 14 | 15 | + 16 | + 17 | + com.github.ben-manes.caffeine 18 | + caffeine 19 | + 2.9.3 20 | + compile 21 | + 22 | + 23 | 24 | 25 | net.minecrell 26 | -------------------------------------------------------------------------------- /patches/server/0011-misc-reduce-offline-mode-warn.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 8 Jun 2022 13:38:35 +0500 4 | Subject: [PATCH] misc: reduce offline mode warn 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java 8 | index 9308ccc85f6243193e49c9a4dd8762ab388a4823..fb5822f7c2c1d96e2711fb081b632ee5d8eb3985 100644 9 | --- a/src/main/java/net/minecraft/server/DedicatedServer.java 10 | +++ b/src/main/java/net/minecraft/server/DedicatedServer.java 11 | @@ -226,6 +226,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer 12 | 13 | if (!this.getOnlineMode()) { 14 | DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); 15 | + /* // Reaper start - Reduce offline mode warn 16 | DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware."); 17 | // Spigot start 18 | if (org.spigotmc.SpigotConfig.bungee) { 19 | @@ -236,6 +237,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer 20 | } 21 | // Spigot end 22 | DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file."); 23 | + */ // Reaper end 24 | } 25 | 26 | if (this.aS()) { 27 | -------------------------------------------------------------------------------- /patches/server/0012-fix-MC-101232.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 27 May 2022 08:23:12 +0500 4 | Subject: [PATCH] fix: MC-101232 5 | 6 | https://bugs.mojang.com/browse/MC-101232 7 | 8 | diff --git a/src/main/java/net/minecraft/server/WorldGenBigTree.java b/src/main/java/net/minecraft/server/WorldGenBigTree.java 9 | index b2fbe1c309101be7795ce5e272a0503b887a7162..dbf5a3431c4159ee39133c5ae7f1cd004f084f32 100644 10 | --- a/src/main/java/net/minecraft/server/WorldGenBigTree.java 11 | +++ b/src/main/java/net/minecraft/server/WorldGenBigTree.java 12 | @@ -247,12 +247,14 @@ public class WorldGenBigTree extends WorldGenTreeAbstract { 13 | } 14 | 15 | if (!this.f()) { 16 | + l = null; // Reaper - Fix MC-101232 17 | return false; 18 | } else { 19 | this.a(); 20 | this.b(); 21 | this.c(); 22 | this.d(); 23 | + l = null; // Reaper - Fix MC-101232 24 | return true; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /patches/server/0013-fix-MC-103516.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 1 Jun 2022 09:05:15 +0500 4 | Subject: [PATCH] fix: MC-103516 5 | 6 | https://bugs.mojang.com/browse/MC-103516 7 | 8 | diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java 9 | index bc231c7f2945d998151f1cb9688b16cc1ab65db0..e82317790b4ae390d5933e4f61b1cf0009ac3c4f 100644 10 | --- a/src/main/java/net/minecraft/server/World.java 11 | +++ b/src/main/java/net/minecraft/server/World.java 12 | @@ -1889,7 +1889,7 @@ public abstract class World implements IBlockAccess { 13 | for (int i = 0; i < list.size(); ++i) { 14 | Entity entity1 = (Entity) list.get(i); 15 | 16 | - if (!entity1.dead && entity1.i && entity1 != entity && (entity == null || entity1.x(entity))) { 17 | + if (!entity1.dead && entity1.i && entity1 != entity && (entity == null || !entity1.x(entity))) { // Reaper - Fix MC-103516 18 | return false; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /patches/server/0014-fix-MC-120780.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 1 Jun 2022 07:38:51 +0500 4 | Subject: [PATCH] fix: MC-120780 5 | 6 | https://bugs.mojang.com/browse/MC-120780 7 | 8 | diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java 9 | index baf72404ec5a26e74667d20070b0a6a58865424a..01c646769e526716c16773d4f141610b3ae49c95 100644 10 | --- a/src/main/java/net/minecraft/server/PlayerChunk.java 11 | +++ b/src/main/java/net/minecraft/server/PlayerChunk.java 12 | @@ -142,6 +142,7 @@ public class PlayerChunk { 13 | this.dirtyCount = 0; 14 | this.h = 0; 15 | this.done = true; 16 | + if (this.c.isEmpty()) return true; // Reaper - Fix MC-120780 17 | PacketPlayOutMapChunk packetplayoutmapchunk = new PacketPlayOutMapChunk(this.chunk, '\uffff'); 18 | Iterator iterator = this.c.iterator(); 19 | 20 | -------------------------------------------------------------------------------- /patches/server/0015-fix-MC-128547.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 27 May 2022 21:22:05 +0500 4 | Subject: [PATCH] fix: MC-128547 5 | 6 | https://bugs.mojang.com/browse/MC-128547 7 | 8 | diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java 9 | index f714dc32645a80c120af5e7c867452dd6a9ef5d0..c74d00b14b2362c82da3a3def9204dac75afbacf 100644 10 | --- a/src/main/java/net/minecraft/server/EnchantmentManager.java 11 | +++ b/src/main/java/net/minecraft/server/EnchantmentManager.java 12 | @@ -114,6 +114,7 @@ public class EnchantmentManager { 13 | EnchantmentManager.a.a = 0; 14 | EnchantmentManager.a.b = damagesource; 15 | a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.a, iterable); 16 | + EnchantmentManager.a.b = null; // Reaper - Fix MC-128547 17 | return EnchantmentManager.a.a; 18 | } 19 | 20 | @@ -141,6 +142,10 @@ public class EnchantmentManager { 21 | a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.c, entityliving.getItemInMainHand()); 22 | } 23 | 24 | + // Reaper start - Fix MC-128547 25 | + EnchantmentManager.c.b = null; 26 | + EnchantmentManager.c.a = null; 27 | + // Reaper end 28 | } 29 | 30 | public static void b(EntityLiving entityliving, Entity entity) { 31 | @@ -154,6 +159,10 @@ public class EnchantmentManager { 32 | a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.d, entityliving.getItemInMainHand()); 33 | } 34 | 35 | + // Reaper start - Fix MC-128547 36 | + EnchantmentManager.d.b = null; 37 | + EnchantmentManager.d.a = null; 38 | + // Reaper end 39 | } 40 | 41 | public static int a(Enchantment enchantment, EntityLiving entityliving) { 42 | -------------------------------------------------------------------------------- /patches/server/0016-perf-revert-Do-not-let-the-server-load-chunks-from-n.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 8 Jun 2022 13:47:40 +0500 4 | Subject: [PATCH] perf: revert "Do not let the server load chunks from newer 5 | versions" 6 | 7 | This reverts commit 7b764831de0fe2e952fd9df6b0c0a3378176a880. 8 | Why do we need it? It's obvious that it won't work. 9 | 10 | diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java 11 | index e6906effb4bb63ec1b856ccb190434e0cb0a7510..bad287fca4dc2cb00150e04980f4e3778d5dc008 100644 12 | --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java 13 | +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java 14 | @@ -90,22 +90,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { 15 | return nbttagcompound != null ? true : RegionFileCache.chunkExists(this.d, i, j); 16 | } 17 | 18 | - // Paper start 19 | - private static final int CURRENT_DATA_VERSION = 1343; // Paper 20 | - private static final boolean JUST_CORRUPT_IT = Boolean.valueOf("Paper.ignoreWorldDataVersion"); 21 | - // Paper end 22 | - 23 | @Nullable 24 | protected Object[] a(World world, int i, int j, NBTTagCompound nbttagcompound) { // CraftBukkit - return Chunk -> Object[] 25 | - // Paper start - Do NOT attempt to load chunks saved with newer versions 26 | - if (nbttagcompound.hasKeyOfType("DataVersion", 3)) { 27 | - int dataVersion = nbttagcompound.getInt("DataVersion"); 28 | - if (!JUST_CORRUPT_IT && dataVersion > CURRENT_DATA_VERSION) { 29 | - new RuntimeException("Server attempted to load chunk saved with newer version of minecraft! " + dataVersion + " > " + CURRENT_DATA_VERSION).printStackTrace(); 30 | - System.exit(1); 31 | - } 32 | - } 33 | - // Paper end 34 | if (!nbttagcompound.hasKeyOfType("Level", 10)) { 35 | ChunkRegionLoader.a.error("Chunk file at {},{} is missing level data, skipping", Integer.valueOf(i), Integer.valueOf(j)); 36 | return null; 37 | -------------------------------------------------------------------------------- /patches/server/0024-perf-don-t-tick-enchantment-tables.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 1 Jun 2022 08:19:40 +0500 4 | Subject: [PATCH] perf: don't tick enchantment tables 5 | 6 | This ticking is only needed for clientside animation processing, so we don't need it. 7 | 8 | diff --git a/src/main/java/net/minecraft/server/TileEntityEnchantTable.java b/src/main/java/net/minecraft/server/TileEntityEnchantTable.java 9 | index 2c5ebde7ed7ad2a3fec0605f584432051413714b..0c6ebc8ff0fb7fc68c7902168449c4735b0757f0 100644 10 | --- a/src/main/java/net/minecraft/server/TileEntityEnchantTable.java 11 | +++ b/src/main/java/net/minecraft/server/TileEntityEnchantTable.java 12 | @@ -2,8 +2,9 @@ package net.minecraft.server; 13 | 14 | import java.util.Random; 15 | 16 | -public class TileEntityEnchantTable extends TileEntity implements ITickable, ITileEntityContainer { 17 | +public class TileEntityEnchantTable extends TileEntity implements /*ITickable,*/ ITileEntityContainer { // Reaper - Don't tick enchantment tables 18 | 19 | + /* // Reaper start - Unused clientside animation fields 20 | public int a; 21 | public float f; 22 | public float g; 23 | @@ -15,6 +16,7 @@ public class TileEntityEnchantTable extends TileEntity implements ITickable, ITi 24 | public float m; 25 | public float n; 26 | private static final Random o = new Random(); 27 | + */ // Reaper end 28 | private String p; 29 | 30 | public TileEntityEnchantTable() {} 31 | @@ -36,6 +38,7 @@ public class TileEntityEnchantTable extends TileEntity implements ITickable, ITi 32 | 33 | } 34 | 35 | + /* // Reaper start - Don't tick enchantment tables 36 | public void e() { 37 | this.k = this.j; 38 | this.m = this.l; 39 | @@ -96,6 +99,7 @@ public class TileEntityEnchantTable extends TileEntity implements ITickable, ITi 40 | this.i += (f2 - this.i) * 0.9F; 41 | this.f += this.i; 42 | } 43 | + */ // Reaper end 44 | 45 | public String getName() { 46 | return this.hasCustomName() ? this.p : "container.enchant"; 47 | -------------------------------------------------------------------------------- /patches/server/0025-perf-disable-sign-commands.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 8 Jun 2022 10:36:47 +0500 4 | Subject: [PATCH] perf: disable sign commands 5 | 6 | Disables the vanilla feature, but protects against exploits and improves performance. 7 | 8 | diff --git a/src/main/java/net/minecraft/server/BlockSign.java b/src/main/java/net/minecraft/server/BlockSign.java 9 | index bc0c9f6b0515309d28fe556c450bf3ba70e387b6..2613f07dc6ec04b5e474d440d2a70c1c01339e14 100644 10 | --- a/src/main/java/net/minecraft/server/BlockSign.java 11 | +++ b/src/main/java/net/minecraft/server/BlockSign.java 12 | @@ -52,6 +52,7 @@ public class BlockSign extends BlockTileEntity { 13 | if (false) { // Reaper - Remove isClientSide check 14 | return true; 15 | } else { 16 | + if (true) return true; // Reaper - Disable sign commands 17 | TileEntity tileentity = world.getTileEntity(blockposition); 18 | 19 | return tileentity instanceof TileEntitySign ? ((TileEntitySign) tileentity).b(entityhuman) : false; 20 | -------------------------------------------------------------------------------- /patches/server/0028-perf-remove-redundant-toArray-call.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 1 Jun 2022 05:23:52 +0500 4 | Subject: [PATCH] perf: remove redundant toArray() call 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java 8 | index fd21564b650669592e928a1f715afb261dce58ff..ef04dfc8d14689fbdf4feaa1b064e9746f1eab14 100644 9 | --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java 10 | +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java 11 | @@ -84,7 +84,10 @@ public class CraftChunk implements Chunk { 12 | 13 | for (int i = 0; i < 16; i++) { 14 | 15 | - for (Object obj : chunk.entitySlices[i].toArray()) { 16 | + // Reaper start - Remove redundant toArray() call 17 | + java.util.List slice = org.bukkit.Bukkit.isPrimaryThread() ? chunk.entitySlices[i] : new java.util.ArrayList<>(chunk.entitySlices[i]); 18 | + for (net.minecraft.server.Entity obj : slice) { 19 | + // Reaper end 20 | if (obj == null) { // Reaper - Optimize 21 | continue; 22 | } 23 | @@ -102,7 +105,10 @@ public class CraftChunk implements Chunk { 24 | 25 | BlockState[] entities = new BlockState[chunk.tileEntities.size()]; 26 | 27 | - for (Object obj : chunk.tileEntities.keySet().toArray()) { 28 | + // Reaper start - Remove redundant toArray() call 29 | + java.util.Set positions = org.bukkit.Bukkit.isPrimaryThread() ? chunk.tileEntities.keySet() : new java.util.HashSet<>(chunk.tileEntities.keySet()); 30 | + for (BlockPosition obj : positions) { 31 | + // Reaper end 32 | if (obj == null) { // Reaper - Optimize 33 | continue; 34 | } 35 | -------------------------------------------------------------------------------- /patches/server/0029-perf-remove-unnecessary-synchronization.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 1 Jun 2022 07:37:14 +0500 4 | Subject: [PATCH] perf: remove unnecessary synchronization 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java 8 | index dee82ad78296644205f41401fd20cf269bf4df9a..e98a638eb3a2146a5e1cb68d34727c2bd627a78f 100644 9 | --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java 10 | +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java 11 | @@ -180,7 +180,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { 12 | return this.processSaveQueueEntry(false); 13 | } 14 | 15 | - private synchronized boolean processSaveQueueEntry(boolean logCompletion) { 16 | + private /*synchronized*/ boolean processSaveQueueEntry(boolean logCompletion) { // Reaper - Remove unnecessary synchronization 17 | // CraftBukkit start 18 | // Paper start - Chunk queue improvements 19 | QueuedChunk chunk = queue.poll(); 20 | -------------------------------------------------------------------------------- /patches/server/0030-perf-don-t-tick-end-gateway-if-not-in-the-end-world.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Sat, 4 Jun 2022 00:32:33 +0500 4 | Subject: [PATCH] perf: don't tick end gateway if not in the end world 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java 8 | index eb2dbbe53498177d2ba45c32068ee7baacb7d51a..df9ce67f4010a9359b62f4dac3615cc1f9c44023 100644 9 | --- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java 10 | +++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java 11 | @@ -48,6 +48,7 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick 12 | } 13 | 14 | public void e() { 15 | + if (!(this.world.worldProvider instanceof WorldProviderTheEnd)) return; // Reaper - Don't tick if not in the end world 16 | boolean flag = this.a(); 17 | boolean flag1 = this.f(); 18 | 19 | -------------------------------------------------------------------------------- /patches/server/0034-perf-cache-isInLava-result.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 1 Jun 2022 09:02:02 +0500 4 | Subject: [PATCH] perf: cache isInLava result 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java 8 | index 492e7e2bb64e05f66799f0646ad6e7a502e11086..4281ab1ba4da46a5a15b8609f735fd247a0c380b 100644 9 | --- a/src/main/java/net/minecraft/server/Entity.java 10 | +++ b/src/main/java/net/minecraft/server/Entity.java 11 | @@ -195,6 +195,10 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper 12 | return this.yaw; 13 | } 14 | // CraftBukkit end 15 | + // Reaper start - Cache isInLava result 16 | + private boolean isInLava; 17 | + private int lastLavaCheck = -1; 18 | + // Reaper end 19 | 20 | public Entity(World world) { 21 | this.id = Entity.entityCount++; 22 | @@ -1254,7 +1258,14 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper 23 | } 24 | 25 | public boolean au() { 26 | - return this.world.a(this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); 27 | + // Reaper start - Cache isInLava result 28 | + int currentTick = MinecraftServer.currentTick; 29 | + if (this.lastLavaCheck != currentTick) { 30 | + this.lastLavaCheck = currentTick; 31 | + this.isInLava = this.world.a(this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); 32 | + } 33 | + return this.isInLava; 34 | + // Reaper end 35 | } 36 | 37 | public void b(float f, float f1, float f2, float f3) { 38 | -------------------------------------------------------------------------------- /patches/server/0036-perf-deactivate-PooledBlockPosition.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 1 Jun 2022 09:46:34 +0500 4 | Subject: [PATCH] perf: deactivate PooledBlockPosition 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java 8 | index e0c122487f631b7945486c538e8e7154b4a080dc..3c8f2520c74afcb4e9bc68932401527c03e3f6cf 100644 9 | --- a/src/main/java/net/minecraft/server/BlockPosition.java 10 | +++ b/src/main/java/net/minecraft/server/BlockPosition.java 11 | @@ -283,8 +283,10 @@ public class BlockPosition extends BaseBlockPosition { 12 | 13 | public static final class PooledBlockPosition extends BlockPosition.MutableBlockPosition { 14 | 15 | + /* // Reaper start - Deactivate PooledBlockPosition 16 | private boolean f; 17 | private static final List g = Lists.newArrayList(); 18 | + */ // Reaper end 19 | 20 | private PooledBlockPosition(int i, int j, int k) { 21 | super(i, j, k); 22 | @@ -300,6 +302,7 @@ public class BlockPosition extends BaseBlockPosition { 23 | } 24 | 25 | public static BlockPosition.PooledBlockPosition e(int i, int j, int k) { 26 | + /* // Reaper start - Deactivate PooledBlockPosition 27 | // List list = BlockPosition.PooledBlockPosition.g; // Reaper - Unused 28 | 29 | synchronized (BlockPosition.PooledBlockPosition.g) { 30 | @@ -313,12 +316,14 @@ public class BlockPosition extends BaseBlockPosition { 31 | } 32 | } 33 | } 34 | + */ // Reaper end 35 | 36 | return new BlockPosition.PooledBlockPosition(i, j, k); 37 | } 38 | 39 | public void free() { t(); } // Paper - OBFHELPER 40 | public void t() { 41 | + /* // Reaper start - Deactivate PooledBlockPosition 42 | // List list = BlockPosition.PooledBlockPosition.g; // Reaper - Unused 43 | 44 | synchronized (BlockPosition.PooledBlockPosition.g) { 45 | @@ -328,13 +333,16 @@ public class BlockPosition extends BaseBlockPosition { 46 | 47 | this.f = true; 48 | } 49 | + */ // Reaper end 50 | } 51 | 52 | public BlockPosition.PooledBlockPosition f(int i, int j, int k) { 53 | + /* // Reaper start - Deactivate PooledBlockPosition 54 | if (this.f) { 55 | BlockPosition.b.error("PooledMutableBlockPosition modified after it was released.", new Throwable()); 56 | this.f = false; 57 | } 58 | + */ // Reaper end 59 | 60 | return (BlockPosition.PooledBlockPosition) super.c(i, j, k); 61 | } 62 | -------------------------------------------------------------------------------- /patches/server/0039-perf-reduce-entity-tracker-updates.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 10 Jun 2022 16:31:51 +0500 4 | Subject: [PATCH] perf: reduce entity tracker updates 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java 8 | index b15cd5874eed58e80781f8d1341b975d414750c2..79d0f7e64be4f8232996c31234a81ff8ebefadec 100644 9 | --- a/src/main/java/net/minecraft/server/EntityPlayer.java 10 | +++ b/src/main/java/net/minecraft/server/EntityPlayer.java 11 | @@ -1370,7 +1370,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { 12 | super.G(); 13 | } 14 | 15 | - this.x().getTracker().a(this); 16 | + // this.x().getTracker().a(this); // Reaper - Reduce entity tracker updates 17 | } 18 | 19 | public Entity getSpecatorTarget() { 20 | -------------------------------------------------------------------------------- /patches/server/0044-fix-Bukkit-API.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 1 Jun 2022 11:16:36 +0500 4 | Subject: [PATCH] fix: Bukkit API 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java 8 | index e68a7d0662372d10806039c66e7833801e773b68..e8f06f20da203db5151f49ce4aa0ea649fe64a1b 100644 9 | --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java 10 | +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java 11 | @@ -116,7 +116,7 @@ public class CraftMetaKnowledgeBook extends CraftMetaItem implements KnowledgeBo 12 | @Override 13 | public void setRecipes(List recipes) { 14 | this.recipes.clear(); 15 | - for (NamespacedKey recipe : this.recipes) { 16 | + for (NamespacedKey recipe : recipes) { // Reaper - Fix Bukkit API 17 | addRecipe(recipe); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /patches/server/0045-fix-clientside-sword-damage.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 19 May 2023 12:55:57 +0800 4 | Subject: [PATCH] fix: clientside sword damage 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java 8 | index c9082c26d04e73e43eeafd1c5a6f48fe846e8805..74f76c51da750d72679670e810a06e13a0d63a2c 100644 9 | --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java 10 | +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java 11 | @@ -226,6 +226,7 @@ public class PlayerInteractManager { 12 | } 13 | // CraftBukkit start - Force block reset to client 14 | } else { 15 | + com.github.ruviolence.reaper.InventoryUpdateHelper.onBlockBreak(this.player, this.player.getItemInMainHand()); // Reaper - Fix clientside sword damage 16 | this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); 17 | // CraftBukkit end 18 | } 19 | @@ -336,6 +337,7 @@ public class PlayerInteractManager { 20 | if (tileentity != null) { 21 | this.player.playerConnection.sendPacket(tileentity.getUpdatePacket()); 22 | } 23 | + com.github.ruviolence.reaper.InventoryUpdateHelper.onBlockBreak(this.player, itemInMainHand); // Reaper - Fix clientside sword damage 24 | return false; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /patches/server/0046-fix-dispenser-shulker-box-crash.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 8 Jun 2022 12:15:31 +0500 4 | Subject: [PATCH] fix: dispenser shulker box crash 5 | 6 | https://youtu.be/zFrCb1RVyys?t=104 7 | 8 | diff --git a/src/main/java/net/minecraft/server/DispenserRegistry.java b/src/main/java/net/minecraft/server/DispenserRegistry.java 9 | index 718f2cb722c94e84eb9ff1587a28bb5021d69a4e..3b976e3765bc7700ac8dc9e424582bcc71844d83 100644 10 | --- a/src/main/java/net/minecraft/server/DispenserRegistry.java 11 | +++ b/src/main/java/net/minecraft/server/DispenserRegistry.java 12 | @@ -758,7 +758,10 @@ public class DispenserRegistry { 13 | EnumDirection enumdirection1 = world.isEmpty(blockposition.down()) ? enumdirection : EnumDirection.UP; 14 | IBlockData iblockdata = block.getBlockData().set(BlockShulkerBox.a, enumdirection1); 15 | 16 | - world.setTypeUpdate(blockposition, iblockdata); 17 | + // Reaper start 18 | + boolean wasPlaced = world.setTypeUpdate(blockposition, iblockdata); 19 | + if (!wasPlaced) return itemstack; 20 | + // Reaper end 21 | TileEntity tileentity = world.getTileEntity(blockposition); 22 | ItemStack itemstack1 = itemstack.cloneAndSubtract(1); 23 | 24 | -------------------------------------------------------------------------------- /patches/server/0049-fix-tile-entity-ticking-crash.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 26 May 2022 23:49:40 +0500 4 | Subject: [PATCH] fix: tile entity ticking crash 5 | 6 | Fixes a NoSuchElementException crash when ticking tile entities, which happens due to bad plugins. 7 | 8 | diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java 9 | index fd489c2a6aae254557e58b12fe17a2674552b099..39221d8e5f04562b2ce86c5bd42bba812ab3570e 100644 10 | --- a/src/main/java/net/minecraft/server/WorldServer.java 11 | +++ b/src/main/java/net/minecraft/server/WorldServer.java 12 | @@ -766,7 +766,15 @@ public class WorldServer extends World implements IAsyncTaskHandler { 13 | NextTickListEntry nextticklistentry; 14 | 15 | for (int j = 0; j < i; ++j) { 16 | + // Reaper start - Fix TileEntity ticking crash 17 | + try { 18 | nextticklistentry = (NextTickListEntry) this.nextTickList.first(); 19 | + } catch (java.util.NoSuchElementException e) { 20 | + LogManager.getLogger().warn("NextTickList got an inconsistency in the world " + worldData.getName() + ", fixing it."); 21 | + nextTickList.fixInconsistence(); 22 | + break; 23 | + } 24 | + // Reaper end 25 | if (!flag && nextticklistentry.b > this.worldData.getTime()) { 26 | break; 27 | } 28 | diff --git a/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java b/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java 29 | index cd864c404747f8f77417e67ca319b3daa04bae59..4a7120b83a93cbcf400780354722c5d5995c74b3 100644 30 | --- a/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java 31 | +++ b/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java 32 | @@ -114,4 +114,5 @@ public class HashTreeSet implements Set { 33 | return tree.first(); 34 | } 35 | 36 | + public void fixInconsistence() { hash.removeIf(entry -> !tree.contains(entry)); } // Reaper - Fix TileEntity ticking crash 37 | } 38 | -------------------------------------------------------------------------------- /patches/server/0050-fix-NaN-pos-on-entity-data-save.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 8 Jun 2022 11:40:48 +0500 4 | Subject: [PATCH] fix: NaN pos on entity data save 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java 8 | index 35bc094758b8f1fcaa58356a0adb865b0b933afd..8061a7c12aa32e6dc9bdd697983925cfd93eee96 100644 9 | --- a/src/main/java/net/minecraft/server/Entity.java 10 | +++ b/src/main/java/net/minecraft/server/Entity.java 11 | @@ -1565,7 +1565,15 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper 12 | 13 | public NBTTagCompound save(NBTTagCompound nbttagcompound) { 14 | try { 15 | - nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY, this.locZ})); 16 | + // Reaper start 17 | + double locX = this.locX; 18 | + double locY = this.locY; 19 | + double locZ = this.locZ; 20 | + if (Double.isNaN(locX)) locX = 0; 21 | + if (Double.isNaN(locY)) locY = 0; 22 | + if (Double.isNaN(locZ)) locZ = 0; 23 | + nbttagcompound.set("Pos", this.a(new double[] {locX, locY, locZ})); 24 | + // Reaper end 25 | nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ})); 26 | 27 | // CraftBukkit start - Checking for NaN pitch/yaw and resetting to zero 28 | -------------------------------------------------------------------------------- /patches/server/0051-fix-the-world-not-saving.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 8 Jun 2022 13:43:28 +0500 4 | Subject: [PATCH] fix: the world not saving 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java 8 | index 5833e5d8e340efc706bc10472fd61b6f224f87c3..5ada3fb0ccec92e8c6d090e2e3dd8f27b4695db0 100644 9 | --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java 10 | +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java 11 | @@ -299,6 +299,7 @@ public class ChunkProviderServer implements IChunkProvider { 12 | } 13 | } 14 | 15 | + if (!flag) // Reaper - Fix the world not saving 16 | if (queueSize > world.paperConfig.queueSizeAutoSaveThreshold){ 17 | return false; 18 | } 19 | -------------------------------------------------------------------------------- /patches/server/0052-fix-setViewDistance-bug.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 26 May 2022 07:22:18 +0500 4 | Subject: [PATCH] fix: setViewDistance bug 5 | 6 | Fixes the bug of the player getting stuck in the PlayerChunk viewers when the player's view distance is changed. 7 | Memory leak when reducing the view distance. 8 | 9 | diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java 10 | index 83c4411ffc42625656d05eace3e3c68057da66e8..728c3e3c1dea2dff959e9dfe0a586be56480e032 100644 11 | --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java 12 | +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java 13 | @@ -430,8 +430,10 @@ public class PlayerChunkMap { 14 | if (i != oldViewDistance) { 15 | int j = i - oldViewDistance; 16 | 17 | - int k = (int) entityplayer.locX >> 4; 18 | - int l = (int) entityplayer.locZ >> 4; 19 | + // Reaper start - Calculate by last managedPos, not by current location, fixes getting stuck in the PlayerChunk viewers list 20 | + int k = (int) entityplayer.d >> 4; 21 | + int l = (int) entityplayer.e >> 4; 22 | + // Reaper end 23 | int i1; 24 | int j1; 25 | 26 | @@ -449,7 +451,7 @@ public class PlayerChunkMap { 27 | for (i1 = k - oldViewDistance; i1 <= k + oldViewDistance; ++i1) { 28 | for (j1 = l - oldViewDistance; j1 <= l + oldViewDistance; ++j1) { 29 | if (!this.a(i1, j1, k, l, i)) { 30 | - this.c(i1, j1).b(entityplayer); 31 | + PlayerChunk chunk = this.getChunk(i1, j1); if (chunk != null) chunk.b(entityplayer); // Reaper - Fix memory leak 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /patches/server/0053-fix-update-player-chunk-map-on-mount.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 26 May 2022 23:15:53 +0500 4 | Subject: [PATCH] fix: update player chunk map on mount 5 | 6 | Fixes a dupe: 7 | https://youtu.be/yi8SWMzk-og 8 | https://youtu.be/9-7KrUMXkv8 9 | 10 | diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java 11 | index 79d0f7e64be4f8232996c31234a81ff8ebefadec..e86017a635b4b7c095c883ec6bdfa0061bf1eb89 100644 12 | --- a/src/main/java/net/minecraft/server/EntityPlayer.java 13 | +++ b/src/main/java/net/minecraft/server/EntityPlayer.java 14 | @@ -744,6 +744,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { 15 | 16 | if (entity2 != entity1 && this.playerConnection != null) { 17 | this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch); 18 | + x().getPlayerChunkMap().movePlayer(this); // Reaper - Fix PyroClient AutoDupe 19 | } 20 | 21 | return true; 22 | -------------------------------------------------------------------------------- /patches/server/0054-fix-entityliving-double-dying.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Sat, 28 May 2022 14:21:29 +0500 4 | Subject: [PATCH] fix: entityliving double dying 5 | 6 | Fixes some dupes 7 | 8 | diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java 9 | index 3b504c23702725240dfc1aa304e29d239c3ed1a2..f715215a17d4ed9c495e8eea1455eeec7155f32e 100644 10 | --- a/src/main/java/net/minecraft/server/EntityLiving.java 11 | +++ b/src/main/java/net/minecraft/server/EntityLiving.java 12 | @@ -1125,6 +1125,7 @@ public abstract class EntityLiving extends Entity { 13 | } 14 | 15 | public void die(DamageSource damagesource) { 16 | + if (this.dead) return; // Reaper 17 | if (!this.aU) { 18 | Entity entity = damagesource.getEntity(); 19 | EntityLiving entityliving = this.ci(); 20 | -------------------------------------------------------------------------------- /patches/server/0056-fix-force-player-dismount.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 27 May 2022 01:37:09 +0500 4 | Subject: [PATCH] fix: force player dismount 5 | 6 | Fixes a dupe: 7 | https://youtu.be/U_u7nYokzSU 8 | 9 | diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java 10 | index 1f49230c0c3b49186f8fc12b4121294908dab34a..df85998c1a59f4f78f74b6444e96db46f24691b1 100644 11 | --- a/src/main/java/net/minecraft/server/PlayerConnection.java 12 | +++ b/src/main/java/net/minecraft/server/PlayerConnection.java 13 | @@ -345,6 +345,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { 14 | 15 | // Paper start - Prevent moving into unloaded chunks 16 | if (player.world.paperConfig.preventMovingIntoUnloadedChunks && !worldserver.isChunkLoaded((int) Math.floor(packetplayinvehiclemove.getX()) >> 4, (int) Math.floor(packetplayinvehiclemove.getZ()) >> 4, false)) { 17 | + player.stopRiding(); // Reaper - Force dismount 18 | this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); 19 | return; 20 | } 21 | @@ -353,6 +354,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { 22 | if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) /*&& (!this.minecraftServer.R() || !this.minecraftServer.Q().equals(entity.getName()))*/) { // Spigot // Reaper - Remove singleplayer code 23 | // CraftBukkit end 24 | PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName(), this.player.getName(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8)); 25 | + player.stopRiding(); // Reaper - Force dismount 26 | this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); 27 | return; 28 | } 29 | -------------------------------------------------------------------------------- /patches/server/0057-fix-tile-entity-chunk-ban.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 3 Jun 2022 04:14:32 +0500 4 | Subject: [PATCH] fix: tile entity chunk ban 5 | 6 | Completely fixes "Badly compressed packet" kicks. 7 | 8 | diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java 9 | index 4808e3af47003bb63cb659a6511daf15a3f74258..6782d7afab4d986a06ab8a2228c4b912748295dd 100644 10 | --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java 11 | +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java 12 | @@ -26,6 +26,7 @@ public class PacketPlayOutMapChunk implements Packet { 13 | return extraPackets; 14 | } 15 | // Paper end 16 | + private static final int EXCESSIVE_TILEENTITIES_CAP = Integer.getInteger("Reaper.excessiveTileEntitiesCap", 500); // Reaper 17 | public PacketPlayOutMapChunk(Chunk chunk, int i) { 18 | this.a = chunk.locX; 19 | this.b = chunk.locZ; 20 | @@ -37,6 +38,7 @@ public class PacketPlayOutMapChunk implements Packet { 21 | this.e = Lists.newArrayList(); 22 | Iterator iterator = chunk.getTileEntities().entrySet().iterator(); 23 | int totalSigns = 0; // Paper 24 | + int totalTileEntities = 0; // Reaper 25 | 26 | while (iterator.hasNext()) { 27 | Entry entry = (Entry) iterator.next(); 28 | @@ -53,6 +55,18 @@ public class PacketPlayOutMapChunk implements Packet { 29 | continue; 30 | } 31 | // Paper end 32 | + // Reaper start 33 | + if (++totalTileEntities > EXCESSIVE_TILEENTITIES_CAP) { 34 | + PacketPlayOutTileEntityData updatePacket = tileentity.getUpdatePacket(); 35 | + if (updatePacket != null) { 36 | + extraPackets.add(updatePacket); 37 | + } else { 38 | + extraPackets.add(new PacketPlayOutBlockChange(blockposition, Blocks.AIR.getBlockData())); 39 | + extraPackets.add(new PacketPlayOutBlockChange(chunk.getWorld(), blockposition)); 40 | + } 41 | + continue; 42 | + } 43 | + // Reaper end 44 | NBTTagCompound nbttagcompound = tileentity.d(); 45 | 46 | this.e.add(nbttagcompound); 47 | -------------------------------------------------------------------------------- /patches/server/0058-fix-check-the-pages-amount-on-book-NBT-validation.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Tue, 7 Jun 2022 18:04:13 +0500 4 | Subject: [PATCH] fix: check the pages amount on book NBT validation 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/ItemBookAndQuill.java b/src/main/java/net/minecraft/server/ItemBookAndQuill.java 8 | index 9d2599dfe7cad1c5615ebdd9d475b946017647b2..4a254b30ba4da873304f8c8c012f9d1097c543d2 100644 9 | --- a/src/main/java/net/minecraft/server/ItemBookAndQuill.java 10 | +++ b/src/main/java/net/minecraft/server/ItemBookAndQuill.java 11 | @@ -21,6 +21,7 @@ public class ItemBookAndQuill extends Item { 12 | return false; 13 | } else { 14 | NBTTagList nbttaglist = nbttagcompound.getList("pages", 8); 15 | + if (nbttaglist.size() > 50) return false; // Reaper 16 | 17 | for (int i = 0; i < nbttaglist.size(); ++i) { 18 | String s = nbttaglist.getString(i); 19 | -------------------------------------------------------------------------------- /patches/server/0060-fix-stackoverflow-while-loading-chunk-entities.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 3 Jun 2022 05:43:33 +0500 4 | Subject: [PATCH] fix: stackoverflow while loading chunk entities 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java 8 | index e98a638eb3a2146a5e1cb68d34727c2bd627a78f..e29cd1b2da4451997d30bf2be3a2e153d3d60565 100644 9 | --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java 10 | +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java 11 | @@ -459,6 +459,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { 12 | public void loadEntities(Chunk chunk, NBTTagCompound nbttagcompound, World world) { 13 | // CraftBukkit end 14 | world.timings.syncChunkLoadNBTTimer.startTiming(); // Spigot 15 | + try { 16 | NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10); 17 | 18 | for (int l = 0; l < nbttaglist1.size(); ++l) { 19 | @@ -494,6 +495,10 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { 20 | world.b(new BlockPosition(nbttagcompound4.getInt("x"), nbttagcompound4.getInt("y"), nbttagcompound4.getInt("z")), block, nbttagcompound4.getInt("t"), nbttagcompound4.getInt("p")); 21 | } 22 | } 23 | + } catch (StackOverflowError e) { 24 | + LogManager.getLogger().warn("StackOverflow while loading chunk entities: " + chunk.locX + " " + chunk.locZ + " - " + world.worldData.getName()); 25 | + e.printStackTrace(); 26 | + } 27 | world.timings.syncChunkLoadNBTTimer.stopTiming(); // Spigot 28 | 29 | // return chunk; // CraftBukkit 30 | -------------------------------------------------------------------------------- /patches/server/0061-fix-do-not-load-chunks-on-adjacent-chest-check.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 3 Jun 2022 05:46:10 +0500 4 | Subject: [PATCH] fix: do not load chunks on adjacent chest check 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java 8 | index b48e8aeb9f0dddb3d722e92ecaee04d5785a9d0b..785a6c1dfbfbdb52c8eb272f3fb6e31d337d60b9 100644 9 | --- a/src/main/java/net/minecraft/server/TileEntityChest.java 10 | +++ b/src/main/java/net/minecraft/server/TileEntityChest.java 11 | @@ -153,6 +153,7 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic 12 | 13 | public void o() { 14 | if (!this.a) { 15 | + if (this.world == null || !this.world.areChunksLoaded(this.position, 1)) return; // Reaper 16 | this.a = true; 17 | this.h = this.a(EnumDirection.WEST); 18 | this.g = this.a(EnumDirection.EAST); 19 | -------------------------------------------------------------------------------- /patches/server/0062-fix-clientside-entity-desynchronization.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 3 Jun 2022 23:37:07 +0500 4 | Subject: [PATCH] fix: clientside entity desynchronization 5 | 6 | Ported from 1.8 to prevent recreating entities that are still within view distance of the player. 7 | 8 | diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java 9 | index d7fbfad3e64cf043dd5c17474c095988a2833a17..2218b542908688972e23c7c0296617e2975a8eef 100644 10 | --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java 11 | +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java 12 | @@ -505,8 +505,10 @@ public class EntityTrackerEntry { 13 | } 14 | private boolean isInRangeOfPlayer(EntityPlayer entityplayer) { 15 | // Paper end 16 | - double d0 = entityplayer.locX - (double) this.xLoc / 4096.0D; 17 | - double d1 = entityplayer.locZ - (double) this.zLoc / 4096.0D; 18 | + // Reaper start - Fix clientside entity desynchronization 19 | + double d0 = entityplayer.locX - this.tracker.locX; 20 | + double d1 = entityplayer.locZ - this.tracker.locZ; 21 | + // Reaper end 22 | int i = Math.min(this.e, this.f); 23 | 24 | return d0 >= (double) (-i) && d0 <= (double) i && d1 >= (double) (-i) && d1 <= (double) i && this.tracker.a(entityplayer); 25 | -------------------------------------------------------------------------------- /patches/server/0063-fix-paper-s-collision-disable-for-custom-scoreboards.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 3 Jun 2022 23:19:06 +0500 4 | Subject: [PATCH] fix: paper's collision disable for custom scoreboards 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 8 | index 82392c3439c1692ec2179c87415204ee02f3dd2a..b989a65e684b2cc456e7c5f5388d40b654eb3ed9 100644 9 | --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 10 | +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 11 | @@ -1557,6 +1557,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { 12 | // throw new IllegalStateException("Cannot set scoreboard for invalid CraftPlayer"); // Spigot - remove this as Mojang's semi asynchronous Netty implementation can lead to races 13 | } 14 | */ // Reaper end 15 | + // Reaper start - Fix Paper's collision disable for custom scoreboards 16 | + if (!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions) { 17 | + String playerName = getName(); 18 | + // If the player does not have their team 19 | + if (scoreboard.getEntryTeam(playerName) == null) { 20 | + org.bukkit.scoreboard.Team collideTeam = scoreboard.getTeam("_c0ll1deRule"); 21 | + // Create new team if does not exists 22 | + if (collideTeam == null) collideTeam = scoreboard.registerNewTeam("_c0ll1deRule"); 23 | + collideTeam.setCanSeeFriendlyInvisibles(false); // Because we want to mimic them not being on a team at all 24 | + collideTeam.addEntry(playerName); // Add player to the collide team 25 | + } 26 | + } 27 | + // Reaper end 28 | 29 | this.server.getScoreboardManager().setPlayerBoard(this, scoreboard); 30 | } 31 | -------------------------------------------------------------------------------- /patches/server/0064-fix-oversized-bounding-box-on-dismount.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 10 Jun 2022 16:14:30 +0500 4 | Subject: [PATCH] fix: oversized bounding box on dismount 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java 8 | index fdc80f6f09817c99143dec00b493ce7645f2a508..1b523a9058a271620d315add0dd62f172300fb6f 100644 9 | --- a/src/main/java/net/minecraft/server/EntityHuman.java 10 | +++ b/src/main/java/net/minecraft/server/EntityHuman.java 11 | @@ -389,6 +389,11 @@ public abstract class EntityHuman extends EntityLiving { 12 | 13 | if (this.isPassenger() && !this.bJ().dead) { 14 | axisalignedbb = this.getBoundingBox().b(this.bJ().getBoundingBox()).grow(1.0D, 0.0D, 1.0D); 15 | + // Reaper start - Fix crash 16 | + if (axisalignedbb.d - axisalignedbb.a > 64 || axisalignedbb.e - axisalignedbb.b > 64 || axisalignedbb.f - axisalignedbb.c > 64) { 17 | + MinecraftServer.LOGGER.warn("Bounding box of the player " + getName() + " is oversized: " + axisalignedbb); 18 | + axisalignedbb = this.getBoundingBox().grow(1.0D, 0.5D, 1.0D); 19 | + } // Reaper end 20 | } else { 21 | axisalignedbb = this.getBoundingBox().grow(1.0D, 0.5D, 1.0D); 22 | } 23 | -------------------------------------------------------------------------------- /patches/server/0065-fix-do-not-accept-invalid-client-settings.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Mon, 30 May 2022 06:10:57 +0500 4 | Subject: [PATCH] fix: do not accept invalid client settings 5 | 6 | Credits to Paper: https://github.com/PaperMC/Paper/blob/e3997543203bc1d86b58b6f1e751b0593228ca7b/patches/server/0906-Do-not-accept-invalid-client-settings.patch 7 | 8 | diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java 9 | index ca590df2973a9db97f5b48b37ee46a10c36f98ab..d23dc67054f9823f85b4f8287bae376a18a7ae6e 100644 10 | --- a/src/main/java/net/minecraft/server/PlayerConnection.java 11 | +++ b/src/main/java/net/minecraft/server/PlayerConnection.java 12 | @@ -2397,6 +2397,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { 13 | 14 | public void a(PacketPlayInSettings packetplayinsettings) { 15 | PlayerConnectionUtils.ensureMainThread(packetplayinsettings, this, this.player.x()); 16 | + // Reaper start - do not accept invalid information 17 | + if (packetplayinsettings.getViewDistance() < 0) { 18 | + LOGGER.warn("Disconnecting " + this.player.getName() + " for invalid view distance: " + packetplayinsettings.getViewDistance()); 19 | + this.disconnect("Invalid client settings"); 20 | + return; 21 | + } 22 | + // Reaper end 23 | this.player.a(packetplayinsettings); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /patches/server/0066-fix-do-not-reattach-RootVehicle-that-too-far.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Sun, 19 Jun 2022 22:13:40 +0500 4 | Subject: [PATCH] fix: do not reattach RootVehicle that too far 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java 8 | index bf6c511f3ce8305b22f2e460e2dd1cf4106edf7a..9cb528a391068ee2fe16c216fa66a1cfb0361768 100644 9 | --- a/src/main/java/net/minecraft/server/PlayerList.java 10 | +++ b/src/main/java/net/minecraft/server/PlayerList.java 11 | @@ -209,6 +209,7 @@ public abstract class PlayerList { 12 | Iterator iterator1; 13 | Entity entity1; 14 | 15 | + if (entityplayer.h(entity) < 256.0D) // Reaper 16 | if (entity.getUniqueID().equals(uuid)) { 17 | entityplayer.a(entity, true); 18 | } else { 19 | -------------------------------------------------------------------------------- /patches/server/0067-fix-attempt-to-reduce-EntityTracker-memory-leakage.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 8 Jun 2022 10:24:33 +0500 4 | Subject: [PATCH] fix: attempt to reduce EntityTracker memory leakage 5 | 6 | If some plugins cause entity memory leaks, this will reduce the amount of memory they take up. But I'm not sure if it really works. 7 | 8 | diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java 9 | index 4822c22b3b1b57d0aa7555aad39a9b6521798448..b644fb09a69b8494d3ccf9595857c9a35f1a1308 100644 10 | --- a/src/main/java/net/minecraft/server/EntityTracker.java 11 | +++ b/src/main/java/net/minecraft/server/EntityTracker.java 12 | @@ -168,6 +168,7 @@ public class EntityTracker { 13 | if (entitytrackerentry1 != null) { 14 | this.c.remove(entitytrackerentry1); 15 | entitytrackerentry1.a(); 16 | + entitytrackerentry1.trackedPlayers.clear(); // Reaper - Attempt to reduce memory leakage 17 | } 18 | 19 | } 20 | diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java 21 | index 9cb528a391068ee2fe16c216fa66a1cfb0361768..7473ba226904b6965e5bd4cf6ba3395d342584a0 100644 22 | --- a/src/main/java/net/minecraft/server/PlayerList.java 23 | +++ b/src/main/java/net/minecraft/server/PlayerList.java 24 | @@ -499,6 +499,7 @@ public abstract class PlayerList { 25 | // CraftBukkit end 26 | 27 | ChunkIOExecutor.adjustPoolSize(this.getPlayerCount()); // CraftBukkit 28 | + worldserver.getTracker().untrackPlayer(entityplayer); // Reaper - Attempt to reduce memory leakage 29 | 30 | return playerQuitEvent.getQuitMessage(); // CraftBukkit 31 | } 32 | -------------------------------------------------------------------------------- /patches/server/0068-feat-max-view-distance-from-32-to-64.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 26 May 2022 06:53:58 +0500 4 | Subject: [PATCH] feat: max view distance from 32 to 64 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java 8 | index 728c3e3c1dea2dff959e9dfe0a586be56480e032..003ba96f3924952be5f683fe1486cfb1be8b0f62 100644 9 | --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java 10 | +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java 11 | @@ -403,7 +403,7 @@ public class PlayerChunkMap { 12 | public final void setViewDistanceForAll(int viewDistance) { this.a(viewDistance); } // Paper - OBFHELPER 13 | // Paper start - Separate into two methods 14 | public void a(int i) { 15 | - i = MathHelper.clamp(i, 3, 32); 16 | + i = MathHelper.clamp(i, 3, 64); 17 | if (i != this.j) { 18 | int j = i - this.j; 19 | ArrayList arraylist = Lists.newArrayList(this.managedPlayers); 20 | @@ -425,7 +425,7 @@ public class PlayerChunkMap { 21 | 22 | // Copied from above with minor changes 23 | public void setViewDistance(EntityPlayer entityplayer, int i, boolean markSort) { 24 | - i = MathHelper.clamp(i, 3, 32); 25 | + i = MathHelper.clamp(i, 3, 64); 26 | int oldViewDistance = entityplayer.getViewDistance(); 27 | if (i != oldViewDistance) { 28 | int j = i - oldViewDistance; 29 | @@ -555,7 +555,7 @@ public class PlayerChunkMap { 30 | 31 | // This represents the view distance that we will set on the player 32 | // It can exist as a negative value 33 | - int playerViewDistance = MathHelper.clamp(distanceIn, 3, 32); 34 | + int playerViewDistance = MathHelper.clamp(distanceIn, 3, 64); 35 | 36 | // This value is the one we actually use to update the chunk map 37 | // We don't ever want this to be a negative 38 | -------------------------------------------------------------------------------- /patches/server/0072-feat-add-EntityArrowStuckEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 26 May 2022 21:21:03 +0500 4 | Subject: [PATCH] feat: add EntityArrowStuckEvent 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java 8 | index 6ca68349f241546c6e799fc04590b2ba6ec49230..4cdbcb0993194b327bc7117c05e8da32e55ea893 100644 9 | --- a/src/main/java/net/minecraft/server/EntityArrow.java 10 | +++ b/src/main/java/net/minecraft/server/EntityArrow.java 11 | @@ -301,6 +301,7 @@ public abstract class EntityArrow extends Entity implements IProjectile { 12 | EntityLiving entityliving = (EntityLiving) entity; 13 | 14 | if (true) { // Reaper - Remove isClientSide check 15 | + if (new com.github.ruviolence.reaper.event.entity.EntityArrowStuckEvent(entityliving.getBukkitEntity()).callEvent()) // Reaper - Add EntityArrowStuckEvent 16 | entityliving.setArrowCount(entityliving.getArrowCount() + 1); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /patches/server/0073-feat-add-PlayerAnvilDamageEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 2 Jun 2022 08:14:09 +0500 4 | Subject: [PATCH] feat: add PlayerAnvilDamageEvent 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java 8 | index b0d4962bfc16a059672da7a1ae9ce1d355c18889..1e90178125910222e459d8b246726b073a1347a7 100644 9 | --- a/src/main/java/net/minecraft/server/ContainerAnvil.java 10 | +++ b/src/main/java/net/minecraft/server/ContainerAnvil.java 11 | @@ -74,6 +74,7 @@ public class ContainerAnvil extends Container { 12 | int i = ((Integer) iblockdata.get(BlockAnvil.DAMAGE)).intValue(); 13 | 14 | ++i; 15 | + if (new com.github.ruviolence.reaper.event.inventory.PlayerAnvilDamageEvent(getBukkitView(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), i).callEvent()) // Reaper - PlayerAnvilDamageEvent 16 | if (i > 2) { 17 | world.setAir(blockposition); 18 | world.triggerEffect(1029, blockposition, 0); 19 | -------------------------------------------------------------------------------- /patches/server/0075-feat-add-AnyEntitySpawnEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 2 Jun 2022 23:27:42 +0500 4 | Subject: [PATCH] feat: add AnyEntitySpawnEvent 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java 8 | index 85be34447769240d629c5d6fce12a7f6a6de5c73..82c6c16c2a20ea7b957b91f7cfa00b267eae09e8 100644 9 | --- a/src/main/java/net/minecraft/server/World.java 10 | +++ b/src/main/java/net/minecraft/server/World.java 11 | @@ -1223,6 +1223,10 @@ public abstract class World implements IBlockAccess { 12 | } // Paper end - End iteration skip check - All tweaking ends here 13 | } 14 | } // Spigot end 15 | + // Reaper start 16 | + else if (com.github.ruviolence.reaper.event.entity.AnyEntitySpawnEvent.getHandlerList().getRegisteredListeners().length != 0) { 17 | + event = CraftEventFactory.callAnyEntitySpawnEvent(entity, spawnReason); 18 | + } // Reaper end 19 | 20 | if (event != null && (event.isCancelled() || entity.dead)) { 21 | entity.dead = true; 22 | diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java 23 | index 9727853a41754a14416611b5184bcd7a3cb02d28..f9e25970d40db707576c7d8a76a27b39d7985d5d 100644 24 | --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java 25 | +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java 26 | @@ -75,6 +75,7 @@ public class CraftEventFactory { 27 | public static Entity entityDamage; // For use in EntityDamageByEntityEvent 28 | // Reaper start 29 | private static final com.github.ruviolence.reaper.event.entity.EntityMoveEvent entityMoveEvent = new com.github.ruviolence.reaper.event.entity.EntityMoveEvent(null); 30 | + private static final com.github.ruviolence.reaper.event.entity.AnyEntitySpawnEvent anyEntitySpawnEvent = new com.github.ruviolence.reaper.event.entity.AnyEntitySpawnEvent(null); 31 | // Reaper end 32 | 33 | // helper methods 34 | @@ -1192,5 +1193,17 @@ public class CraftEventFactory { 35 | 36 | return !event.isCancelled(); 37 | } 38 | + 39 | + public static com.github.ruviolence.reaper.event.entity.AnyEntitySpawnEvent callAnyEntitySpawnEvent(Entity entity, SpawnReason spawnReason) { 40 | + com.github.ruviolence.reaper.event.entity.AnyEntitySpawnEvent event = CraftEventFactory.anyEntitySpawnEvent; 41 | + 42 | + event.setData( 43 | + entity.getBukkitEntity(), 44 | + spawnReason); 45 | + 46 | + Bukkit.getPluginManager().callEvent(event); 47 | + 48 | + return event; 49 | + } 50 | // Reaper end 51 | } 52 | -------------------------------------------------------------------------------- /patches/server/0080-feat-configurable-wither-spawn-shape-check.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 27 May 2022 10:44:34 +0500 4 | Subject: [PATCH] feat: configurable wither spawn shape check 5 | 6 | 7 | diff --git a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 8 | index 62bd42ff283c48963cf203df2b8461045aefc236..5792121210430c1de42cf0e30aaeb67dfa54046b 100644 9 | --- a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 10 | +++ b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 11 | @@ -167,4 +167,9 @@ public class ReaperConfig { 12 | player.initDelayedChunksList(); 13 | } 14 | } 15 | + 16 | + public static boolean shapeCheckWither; 17 | + private static void shapeCheck() { 18 | + shapeCheckWither = getBoolean("shape-check.wither", true); 19 | + } 20 | } 21 | diff --git a/src/main/java/net/minecraft/server/BlockSkull.java b/src/main/java/net/minecraft/server/BlockSkull.java 22 | index 56c7639889f359281969ffc9e841ce60cc14de26..4c357da8f6f3f3a5f44a9d040679f20097764823 100644 23 | --- a/src/main/java/net/minecraft/server/BlockSkull.java 24 | +++ b/src/main/java/net/minecraft/server/BlockSkull.java 25 | @@ -160,6 +160,7 @@ public class BlockSkull extends BlockTileEntity { 26 | } 27 | 28 | public void a(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) { 29 | + if (!com.github.ruviolence.reaper.ReaperConfig.shapeCheckWither) return; // Reaper 30 | if (world.captureBlockStates) return; // CraftBukkit 31 | if (tileentityskull.getSkullType() == 1 && blockposition.getY() >= 2 && world.getDifficulty() != EnumDifficulty.PEACEFUL) { // Reaper - Remove isClientSide check 32 | ShapeDetector shapedetector = this.g(); 33 | -------------------------------------------------------------------------------- /patches/server/0081-feat-configurable-end-portal-shape-check.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 27 May 2022 10:47:51 +0500 4 | Subject: [PATCH] feat: configurable end portal shape check 5 | 6 | 7 | diff --git a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 8 | index 5792121210430c1de42cf0e30aaeb67dfa54046b..b98b063255b5691d6d26750ff502030ac4f2f9d7 100644 9 | --- a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 10 | +++ b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 11 | @@ -169,7 +169,9 @@ public class ReaperConfig { 12 | } 13 | 14 | public static boolean shapeCheckWither; 15 | + public static boolean shapeCheckEndPortal; 16 | private static void shapeCheck() { 17 | shapeCheckWither = getBoolean("shape-check.wither", true); 18 | + shapeCheckEndPortal = getBoolean("shape-check.end-portal", true); 19 | } 20 | } 21 | diff --git a/src/main/java/net/minecraft/server/ItemEnderEye.java b/src/main/java/net/minecraft/server/ItemEnderEye.java 22 | index 34de6c739336f3534c8f8f6a20ff0484c58706b6..a6bbf8ae41282c83e1d45660fdde086450640db1 100644 23 | --- a/src/main/java/net/minecraft/server/ItemEnderEye.java 24 | +++ b/src/main/java/net/minecraft/server/ItemEnderEye.java 25 | @@ -32,6 +32,7 @@ public class ItemEnderEye extends Item { 26 | */ // Reaper end 27 | 28 | world.a((EntityHuman) null, blockposition, SoundEffects.bp, SoundCategory.BLOCKS, 1.0F, 1.0F); 29 | + if (!com.github.ruviolence.reaper.ReaperConfig.shapeCheckEndPortal) return EnumInteractionResult.SUCCESS; // Reaper 30 | ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection = BlockEnderPortalFrame.e().a(world, blockposition); 31 | 32 | if (shapedetector_shapedetectorcollection != null) { 33 | -------------------------------------------------------------------------------- /patches/server/0082-feat-configurable-nether-portal-shape-check.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 27 May 2022 11:00:01 +0500 4 | Subject: [PATCH] feat: configurable nether portal shape check 5 | 6 | 7 | diff --git a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 8 | index b98b063255b5691d6d26750ff502030ac4f2f9d7..b878c1a2c7506d23ebdef8699366edfc93925d01 100644 9 | --- a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 10 | +++ b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 11 | @@ -170,8 +170,10 @@ public class ReaperConfig { 12 | 13 | public static boolean shapeCheckWither; 14 | public static boolean shapeCheckEndPortal; 15 | + public static boolean shapeCheckNetherPortal; 16 | private static void shapeCheck() { 17 | shapeCheckWither = getBoolean("shape-check.wither", true); 18 | shapeCheckEndPortal = getBoolean("shape-check.end-portal", true); 19 | + shapeCheckNetherPortal = getBoolean("shape-check.nether-portal", true); 20 | } 21 | } 22 | diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java 23 | index 93dfcc3eeb58f93db5fc551e2ccb962210eddbb0..b7afac783cdb38f0133148153c1eedf9afdbd39e 100644 24 | --- a/src/main/java/net/minecraft/server/BlockFire.java 25 | +++ b/src/main/java/net/minecraft/server/BlockFire.java 26 | @@ -335,7 +335,7 @@ public class BlockFire extends Block { 27 | } 28 | 29 | public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { 30 | - if (world.worldProvider.getDimensionManager().getDimensionID() > 0 || !Blocks.PORTAL.b(world, blockposition)) { 31 | + if (world.worldProvider.getDimensionManager().getDimensionID() > 0 || (!com.github.ruviolence.reaper.ReaperConfig.shapeCheckNetherPortal || !Blocks.PORTAL.b(world, blockposition))) { // Reaper 32 | if (!world.getType(blockposition.down()).q() && !this.c(world, blockposition)) { 33 | fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke 34 | } else { 35 | -------------------------------------------------------------------------------- /patches/server/0084-feat-configurable-paper-custom-flow-speed.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 2 Jun 2022 07:22:51 +0500 4 | Subject: [PATCH] feat: configurable paper custom flow speed 5 | 6 | Creates an unnecessary load, even when most people don't need custom flow speed 7 | 8 | diff --git a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 9 | index 05f851c7c5cd0e8313414ac8ffcb05ef110c72f7..3fadcf4cfb8a5f8bbe8a3c30623282846e1edaea 100644 10 | --- a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 11 | +++ b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 12 | @@ -181,4 +181,9 @@ public class ReaperConfig { 13 | private static void halloweenMobFeature() { 14 | halloweenMobFeature = getBoolean("halloween-mob-feature", true); 15 | } 16 | + 17 | + public static boolean paperCustomFlowSpeed; 18 | + private static void paperCustomFlowSpeed() { 19 | + paperCustomFlowSpeed = getBoolean("paper-custom-flow-speed", true); 20 | + } 21 | } 22 | diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java 23 | index ff90e08ebebf536c13ec8c67c205f0f593a8c0e1..e09ae0cf9eb6d967a3dc63f9d974fd5181df468a 100644 24 | --- a/src/main/java/net/minecraft/server/BlockFlowing.java 25 | +++ b/src/main/java/net/minecraft/server/BlockFlowing.java 26 | @@ -280,6 +280,7 @@ public class BlockFlowing extends BlockFluids { 27 | * Paper - Get flow speed. Throttle if its water and flowing adjacent to lava 28 | */ 29 | public int getFlowSpeed(World world, BlockPosition blockposition) { 30 | + if (!com.github.ruviolence.reaper.ReaperConfig.paperCustomFlowSpeed) return super.a(world); // Reaper 31 | if (this.material == Material.LAVA) { 32 | return world.worldProvider.isSkyMissing() ? world.paperConfig.lavaFlowSpeedNether : world.paperConfig.lavaFlowSpeedNormal; 33 | } 34 | -------------------------------------------------------------------------------- /patches/server/0085-feat-configurable-step-sounds.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 2 Jun 2022 08:04:40 +0500 4 | Subject: [PATCH] feat: configurable step sounds 5 | 6 | 7 | diff --git a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 8 | index 3fadcf4cfb8a5f8bbe8a3c30623282846e1edaea..78b77dd2863d1a4ceffdc50536830772a4149bba 100644 9 | --- a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 10 | +++ b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 11 | @@ -186,4 +186,9 @@ public class ReaperConfig { 12 | private static void paperCustomFlowSpeed() { 13 | paperCustomFlowSpeed = getBoolean("paper-custom-flow-speed", true); 14 | } 15 | + 16 | + public static boolean stepSounds; 17 | + private static void stepSounds() { 18 | + stepSounds = getBoolean("step-sounds", true); 19 | + } 20 | } 21 | diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java 22 | index 23f91ae7a9fd19247057c489967c920430d40c6f..d0070ccd2ba1bf9bfcc482ab0233ccd2e09cb5af 100644 23 | --- a/src/main/java/net/minecraft/server/Entity.java 24 | +++ b/src/main/java/net/minecraft/server/Entity.java 25 | @@ -954,6 +954,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper 26 | 27 | this.a(this.ae(), f1, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); 28 | } else { 29 | + if (com.github.ruviolence.reaper.ReaperConfig.stepSounds) // Reaper 30 | this.a(blockposition, block1); 31 | } 32 | } else if (this.K > this.ay && this.ah() && iblockdata.getMaterial() == Material.AIR) { 33 | -------------------------------------------------------------------------------- /patches/server/0090-feat-configurable-time-update-period.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 8 Jun 2022 10:49:06 +0500 4 | Subject: [PATCH] feat: configurable time update period 5 | 6 | Allows breaking client-side tickrate meters and also slightly reduce the network load. 7 | 8 | diff --git a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 9 | index b634d2375f167e20b495e95fa25977c3f3a8d52c..50eec3e6050612f5e2dc430d76cddc6fa00992e1 100644 10 | --- a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 11 | +++ b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 12 | @@ -249,4 +249,9 @@ public class ReaperConfig { 13 | private static void alternativeChatComponentParser() { 14 | alternativeChatComponentParser = getBoolean("alternative-chat-component-parser", false); 15 | } 16 | + 17 | + public static int timeUpdatePeriod; 18 | + private static void timeUpdatePeriod() { 19 | + timeUpdatePeriod = getInt("time-update-period", 20); 20 | + } 21 | } 22 | diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java 23 | index fa4e353e83a0bcd55077d11cac48dc845bd3a176..58dcbba12e4a364c16b6e775b62bc2d73d43b46d 100644 24 | --- a/src/main/java/net/minecraft/server/MinecraftServer.java 25 | +++ b/src/main/java/net/minecraft/server/MinecraftServer.java 26 | @@ -124,6 +124,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs 27 | // Spigot start 28 | public final SlackActivityAccountant slackActivityAccountant = new SlackActivityAccountant(); 29 | // Spigot end 30 | + public int timeUpdateTicks; // Reaper - Custom time update period 31 | // Reaper start 32 | boolean hasEntityMoveEvent; 33 | boolean hasEntityTickEvent; 34 | @@ -884,7 +885,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs 35 | 36 | MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot 37 | // Send time updates to everyone, it will get the right time from the world the player is in. 38 | - if (this.ticks % 20 == 0) { 39 | + if (++this.timeUpdateTicks > com.github.ruviolence.reaper.ReaperConfig.timeUpdatePeriod) { this.timeUpdateTicks = 0; // Reaper - Custom time update period 40 | for (int i = 0; i < this.getPlayerList().players.size(); ++i) { 41 | EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i); 42 | entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean("doDaylightCycle"))); // Add support for per player time 43 | -------------------------------------------------------------------------------- /patches/server/0091-feat-configurable-relative-arrow-motion.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 10 Jun 2022 15:58:26 +0500 4 | Subject: [PATCH] feat: configurable relative arrow motion 5 | 6 | It will help to disable the superbow hack: https://youtu.be/zsJKxT1vOZs?t=165 7 | 8 | diff --git a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 9 | index 50eec3e6050612f5e2dc430d76cddc6fa00992e1..2c07d3b083bda2a93050c90e675be3470f1b3d78 100644 10 | --- a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 11 | +++ b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 12 | @@ -254,4 +254,9 @@ public class ReaperConfig { 13 | private static void timeUpdatePeriod() { 14 | timeUpdatePeriod = getInt("time-update-period", 20); 15 | } 16 | + 17 | + public static boolean relativeArrowMotion; 18 | + private static void relativeArrowMotion() { 19 | + relativeArrowMotion = getBoolean("relative-arrow-motion", true); 20 | + } 21 | } 22 | diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java 23 | index 4cdbcb0993194b327bc7117c05e8da32e55ea893..05d03acbd21cf0a8f3cf3274bc1bf50f156e1777 100644 24 | --- a/src/main/java/net/minecraft/server/EntityArrow.java 25 | +++ b/src/main/java/net/minecraft/server/EntityArrow.java 26 | @@ -86,11 +86,13 @@ public abstract class EntityArrow extends Entity implements IProjectile { 27 | float f7 = MathHelper.cos(f1 * 0.017453292F) * MathHelper.cos(f * 0.017453292F); 28 | 29 | this.shoot((double) f5, (double) f6, (double) f7, f3, f4); 30 | + if (com.github.ruviolence.reaper.ReaperConfig.relativeArrowMotion) { // Reaper start 31 | this.motX += entity.motX; 32 | this.motZ += entity.motZ; 33 | if (!entity.onGround) { 34 | this.motY += entity.motY; 35 | } 36 | + } // Reaper end 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /patches/server/0092-feat-round-player-ping.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 10 Jun 2022 16:06:05 +0500 4 | Subject: [PATCH] feat: round player ping 5 | 6 | Helps to hide the real ping from cheat clients. 7 | 8 | diff --git a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 9 | index 2c07d3b083bda2a93050c90e675be3470f1b3d78..c226ce9ca41cbd76d31f11c76f7a43ed097e3e0c 100644 10 | --- a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 11 | +++ b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 12 | @@ -259,4 +259,9 @@ public class ReaperConfig { 13 | private static void relativeArrowMotion() { 14 | relativeArrowMotion = getBoolean("relative-arrow-motion", true); 15 | } 16 | + 17 | + public static boolean roundPlayerPing; 18 | + private static void roundPlayerPing() { 19 | + roundPlayerPing = getBoolean("round-player-ping", false); 20 | + } 21 | } 22 | diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java 23 | index d385a9c950fe3b955536b88cfc6ce8be27cdc587..f244441f879368a0d71751e6163e1d864dabb8a6 100644 24 | --- a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java 25 | +++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java 26 | @@ -192,6 +192,22 @@ public class PacketPlayOutPlayerInfo implements Packet { 27 | } 28 | 29 | public int b() { 30 | + // Reaper start 31 | + if (com.github.ruviolence.reaper.ReaperConfig.roundPlayerPing) { 32 | + int ping = this.b; 33 | + 34 | + if (ping < 150) { 35 | + return 0; 36 | + } else if (ping < 300) { 37 | + return 150; 38 | + } else if (ping < 600) { 39 | + return 300; 40 | + } else if (ping < 1000) { 41 | + return 600; 42 | + } else { 43 | + return 1000; 44 | + } 45 | + } // Reaper end 46 | return this.b; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /patches/server/0093-feat-configurable-ping-period.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 10 Jun 2022 16:09:59 +0500 4 | Subject: [PATCH] feat: configurable ping period 5 | 6 | 7 | diff --git a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 8 | index c226ce9ca41cbd76d31f11c76f7a43ed097e3e0c..da6dfc97cf89a07ae98482760e20d9731ff9020f 100644 9 | --- a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 10 | +++ b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 11 | @@ -264,4 +264,9 @@ public class ReaperConfig { 12 | private static void roundPlayerPing() { 13 | roundPlayerPing = getBoolean("round-player-ping", false); 14 | } 15 | + 16 | + public static long pingPeriod; 17 | + private static void pingPeriod() { 18 | + pingPeriod = MathHelper.clamp(getInt("ping-period", 15), 1, 30) * 1000L; 19 | + } 20 | } 21 | diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java 22 | index e4df17bddc0d74d980a1ae244353c4bf653c1ea6..76ea7bf536204b8605223623cffd76d16b85cfdf 100644 23 | --- a/src/main/java/net/minecraft/server/PlayerConnection.java 24 | +++ b/src/main/java/net/minecraft/server/PlayerConnection.java 25 | @@ -193,7 +193,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { 26 | this.disconnect(new ChatMessage("disconnect.timeout")); 27 | } 28 | } else { 29 | - if (elapsedTime >= 15000L) { // 15 seconds 30 | + if (elapsedTime >= com.github.ruviolence.reaper.ReaperConfig.pingPeriod) { // Reaper 31 | this.setPendingPing(true); 32 | this.setLastPing(currentTime); 33 | this.setKeepAliveID(currentTime); 34 | -------------------------------------------------------------------------------- /patches/server/0094-feat-entity-tracker-check-Y.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 10 Jun 2022 16:51:19 +0500 4 | Subject: [PATCH] feat: entity tracker check Y 5 | 6 | Helps to hide minecarts in mineshafts and reduce the server load 7 | 8 | diff --git a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 9 | index da6dfc97cf89a07ae98482760e20d9731ff9020f..9cb4eb12f2385821a9062e899c0c36849afd8fa4 100644 10 | --- a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 11 | +++ b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 12 | @@ -269,4 +269,9 @@ public class ReaperConfig { 13 | private static void pingPeriod() { 14 | pingPeriod = MathHelper.clamp(getInt("ping-period", 15), 1, 30) * 1000L; 15 | } 16 | + 17 | + public static boolean entityTrackerCheckY; 18 | + private static void entityTrackerCheckY() { 19 | + entityTrackerCheckY = getBoolean("entity-tracker-check-y", false); 20 | + } 21 | } 22 | diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java 23 | index 8f3fd88f52494bd4e949f209735dae20ca032957..efdee67c973fbe12abaace1902eaa710d5a5c15a 100644 24 | --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java 25 | +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java 26 | @@ -511,6 +511,13 @@ public class EntityTrackerEntry { 27 | // Reaper end 28 | int i = Math.min(this.e, com.github.ruviolence.reaper.ReaperConfig.dynamicViewDistance ? entityplayer.getFurthestViewableBlock() : this.f); // Reaper - Dynamic view distance 29 | 30 | + // Reaper start 31 | + if (com.github.ruviolence.reaper.ReaperConfig.entityTrackerCheckY) { 32 | + double y0 = entityplayer.locY - this.tracker.locY; 33 | + if (y0 < -i || y0 > i) { 34 | + return false; 35 | + } 36 | + } // Reaper end 37 | return d0 >= (double) (-i) && d0 <= (double) i && d1 >= (double) (-i) && d1 <= (double) i && this.tracker.a(entityplayer) 38 | && (!com.github.ruviolence.reaper.ReaperConfig.delayedChunksEnabled || !entityplayer.getDelayedChunks().contains(new ChunkCoordIntPair(this.tracker.ab, this.tracker.ad))); // Reaper - Delayed chunks 39 | } 40 | -------------------------------------------------------------------------------- /patches/server/0098-perf-cache-chunk-NBT-in-the-PacketPlayOutMapChunk.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 10 Jun 2022 15:32:25 +0500 4 | Subject: [PATCH] perf: cache chunk NBT in the PacketPlayOutMapChunk 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java 8 | index 6782d7afab4d986a06ab8a2228c4b912748295dd..a727f995d8ea6b7119329580c4f23a1153de4963 100644 9 | --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java 10 | +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java 11 | @@ -16,6 +16,7 @@ public class PacketPlayOutMapChunk implements Packet { 12 | private byte[] d; 13 | private List e; 14 | private boolean f; 15 | + private byte[] nbtData; // Reaper - Cache chunk NBT 16 | 17 | public PacketPlayOutMapChunk() {} 18 | 19 | @@ -72,6 +73,21 @@ public class PacketPlayOutMapChunk implements Packet { 20 | this.e.add(nbttagcompound); 21 | } 22 | } 23 | + // Reaper start - Cache chunk NBT 24 | + if (!this.e.isEmpty()) { 25 | + try { 26 | + java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(); 27 | + java.io.DataOutputStream dos = new java.io.DataOutputStream(baos); 28 | + List nbtTagCompounds = this.e; 29 | + for (int j = 0; j < nbtTagCompounds.size(); j++) { 30 | + NBTCompressedStreamTools.writeNBT(nbtTagCompounds.get(j), dos); 31 | + } 32 | + this.nbtData = baos.toByteArray(); 33 | + } catch (Exception e) { 34 | + e.printStackTrace(); 35 | + } 36 | + } 37 | + // Reaper end 38 | 39 | } 40 | 41 | @@ -106,6 +122,7 @@ public class PacketPlayOutMapChunk implements Packet { 42 | packetdataserializer.d(this.d.length); 43 | packetdataserializer.writeBytes(this.d); 44 | packetdataserializer.d(this.e.size()); 45 | + /* // Reaper start - Cache chunk NBT 46 | Iterator iterator = this.e.iterator(); 47 | 48 | while (iterator.hasNext()) { 49 | @@ -113,6 +130,11 @@ public class PacketPlayOutMapChunk implements Packet { 50 | 51 | packetdataserializer.a(nbttagcompound); 52 | } 53 | + */ 54 | + if (nbtData != null) { 55 | + packetdataserializer.writeBytes(this.nbtData); 56 | + } 57 | + // Reaper end 58 | 59 | } 60 | 61 | -------------------------------------------------------------------------------- /patches/server/0100-perf-async-spawn-chunks.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 04:57:46 +0500 4 | Subject: [PATCH] perf: async spawn chunks 5 | 6 | 7 | diff --git a/src/main/java/com/github/ruviolence/reaper/Constants.java b/src/main/java/com/github/ruviolence/reaper/Constants.java 8 | new file mode 100644 9 | index 0000000000000000000000000000000000000000..8e0e7542ed6d95dc9a403d320640651998abeb6e 10 | --- /dev/null 11 | +++ b/src/main/java/com/github/ruviolence/reaper/Constants.java 12 | @@ -0,0 +1,5 @@ 13 | +package com.github.ruviolence.reaper; 14 | + 15 | +public class Constants { 16 | + public static final Runnable NULL_RUNNABLE = () -> {}; 17 | +} 18 | diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java 19 | index cebb44c67a0116c6b281086fc84d7257028ece8e..3826c468f070b2131d4d8b3843327b17f243b2b7 100644 20 | --- a/src/main/java/net/minecraft/server/MinecraftServer.java 21 | +++ b/src/main/java/net/minecraft/server/MinecraftServer.java 22 | @@ -397,7 +397,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs 23 | } 24 | 25 | ++i; 26 | - worldserver.getChunkProviderServer().getChunkAt(blockposition.getX() + k >> 4, blockposition.getZ() + l >> 4); 27 | + worldserver.getChunkProviderServer().getChunkAt(blockposition.getX() + k >> 4, blockposition.getZ() + l >> 4, com.github.ruviolence.reaper.Constants.NULL_RUNNABLE); // Reaper - Async Spawn Chunks 28 | } 29 | } 30 | } 31 | diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java 32 | index fe770f35b17ba685742f290266a9ef6086ee1148..c5e0a7272a54c7c4de1508747ac1648d6280d650 100644 33 | --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java 34 | +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java 35 | @@ -1000,7 +1000,7 @@ public final class CraftServer implements Server { 36 | } 37 | 38 | BlockPosition chunkcoordinates = internal.getSpawn(); 39 | - internal.getChunkProviderServer().getChunkAt(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4); 40 | + internal.getChunkProviderServer().getChunkAt(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4, com.github.ruviolence.reaper.Constants.NULL_RUNNABLE); // Reaper - Async Spawn Chunks 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /patches/server/0102-perf-don-t-load-chunks-for-physics.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 05:11:53 +0500 4 | Subject: [PATCH] perf: don't load chunks for physics 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java 8 | index a776493411892503cb655ad6713203b93346eb2b..d62058ac42c64d155aeaab888757b8b6e90182c0 100644 9 | --- a/src/main/java/net/minecraft/server/World.java 10 | +++ b/src/main/java/net/minecraft/server/World.java 11 | @@ -677,7 +677,10 @@ public abstract class World implements IBlockAccess { 12 | 13 | public void b(BlockPosition blockposition, final Block block, BlockPosition blockposition1) { 14 | if (true) { // Reaper - Remove isClientSide check 15 | - IBlockData iblockdata = this.getType(blockposition); 16 | + // Reaper start - Don't load chunks for physics 17 | + IBlockData iblockdata = this.getTypeIfLoaded(blockposition); 18 | + if (iblockdata == null) return; 19 | + // Reaper end 20 | 21 | if (iblockdata.getBlock() == Blocks.dk) { 22 | try { 23 | -------------------------------------------------------------------------------- /patches/server/0103-perf-don-t-load-chunks-for-light-checks.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 05:13:06 +0500 4 | Subject: [PATCH] perf: don't load chunks for light checks 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java 8 | index d62058ac42c64d155aeaab888757b8b6e90182c0..f3ec17a36e26893f3b0499af2c533355d32a8f92 100644 9 | --- a/src/main/java/net/minecraft/server/World.java 10 | +++ b/src/main/java/net/minecraft/server/World.java 11 | @@ -747,7 +747,13 @@ public abstract class World implements IBlockAccess { 12 | blockposition = new BlockPosition(blockposition.getX(), 255, blockposition.getZ()); 13 | } 14 | 15 | - return this.getChunkAtWorldCoords(blockposition).a(blockposition, 0); 16 | + // Reaper start - Don't load chunks for light checks 17 | + Chunk chunk = this.getChunkIfLoaded(blockposition); 18 | + if (chunk == null) { 19 | + return 0; 20 | + } 21 | + return chunk.a(blockposition, 0); 22 | + // Reaper end 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /patches/server/0104-perf-don-t-load-chunks-for-chests.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 05:15:58 +0500 4 | Subject: [PATCH] perf: don't load chunks for chests 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java 8 | index 7b279458219ce6ba59ee3c5c3ea08c67b0c71db0..ed5d554e5728dfe2ca060010ad48aa0d0f636349 100644 9 | --- a/src/main/java/net/minecraft/server/BlockChest.java 10 | +++ b/src/main/java/net/minecraft/server/BlockChest.java 11 | @@ -43,7 +43,12 @@ public class BlockChest extends BlockTileEntity { 12 | while (iterator.hasNext()) { 13 | EnumDirection enumdirection = (EnumDirection) iterator.next(); 14 | BlockPosition blockposition1 = blockposition.shift(enumdirection); 15 | - IBlockData iblockdata1 = world.getType(blockposition1); 16 | + // Reaper start - Dont load chunks for chests 17 | + final IBlockData iblockdata1 = world.isLoaded(blockposition1) ? world.getType(blockposition1) : null; 18 | + if (iblockdata1 == null) { 19 | + continue; 20 | + } 21 | + // Reaper end 22 | 23 | if (iblockdata1.getBlock() == this) { 24 | this.e(world, blockposition1, iblockdata1); 25 | -------------------------------------------------------------------------------- /patches/server/0105-perf-don-t-load-chunks-for-endermans.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 05:17:27 +0500 4 | Subject: [PATCH] perf: don't load chunks for endermans 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java 8 | index 26f08a7be0a49313ce0596a26f65410e0de3ca0d..65f88cd5209f8581842cefd076daffbb47a6bc7a 100644 9 | --- a/src/main/java/net/minecraft/server/EntityEnderman.java 10 | +++ b/src/main/java/net/minecraft/server/EntityEnderman.java 11 | @@ -342,7 +342,10 @@ public class EntityEnderman extends EntityMonster { 12 | int j = MathHelper.floor(this.enderman.locY + random.nextDouble() * 3.0D); 13 | int k = MathHelper.floor(this.enderman.locZ - 2.0D + random.nextDouble() * 4.0D); 14 | BlockPosition blockposition = new BlockPosition(i, j, k); 15 | - IBlockData iblockdata = world.getType(blockposition); 16 | + // Reaper start - Don't load chunks for endermans 17 | + IBlockData iblockdata = world.getTypeIfLoaded(blockposition); 18 | + if (iblockdata == null) return; 19 | + // Reaper end 20 | Block block = iblockdata.getBlock(); 21 | MovingObjectPosition movingobjectposition = world.rayTrace(new Vec3D((double) ((float) MathHelper.floor(this.enderman.locX) + 0.5F), (double) ((float) j + 0.5F), (double) ((float) MathHelper.floor(this.enderman.locZ) + 0.5F)), new Vec3D((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F)), false, true, false); 22 | boolean flag = movingobjectposition != null && movingobjectposition.a().equals(blockposition); 23 | @@ -378,7 +381,10 @@ public class EntityEnderman extends EntityMonster { 24 | int j = MathHelper.floor(this.a.locY + random.nextDouble() * 2.0D); 25 | int k = MathHelper.floor(this.a.locZ - 1.0D + random.nextDouble() * 2.0D); 26 | BlockPosition blockposition = new BlockPosition(i, j, k); 27 | - IBlockData iblockdata = world.getType(blockposition); 28 | + // Reaper start - Don't load chunks for endermans 29 | + IBlockData iblockdata = world.getTypeIfLoaded(blockposition); 30 | + if (iblockdata == null) return; 31 | + // Reaper end 32 | IBlockData iblockdata1 = world.getType(blockposition.down()); 33 | IBlockData iblockdata2 = this.a.getCarried(); 34 | 35 | -------------------------------------------------------------------------------- /patches/server/0106-perf-don-t-load-chunks-for-village-doors.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 05:19:50 +0500 4 | Subject: [PATCH] perf: don't load chunks for village doors 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java 8 | index 6536e5fb843fd6e9f28ad975fc73678fafffff47..634cc51777fbbb3256d57805da3a25dba3b12aa3 100644 9 | --- a/src/main/java/net/minecraft/server/Village.java 10 | +++ b/src/main/java/net/minecraft/server/Village.java 11 | @@ -50,6 +50,7 @@ public class Village { 12 | return; 13 | } 14 | // Paper end 15 | + if (!this.isVillageAreaLoaded()) { return; } // Reaper - Don't load chunks for village doors 16 | this.g = i; 17 | this.m(); 18 | this.l(); 19 | @@ -222,6 +223,31 @@ public class Village { 20 | } 21 | } 22 | 23 | + // Reaper start - Don't load chunks for village doors 24 | + private BlockPosition[] positions = null; 25 | + 26 | + private void calculateNewCheckPositions() { 27 | + if (this.d == null || this.d.equals(BlockPosition.ZERO)) { 28 | + this.positions = null; 29 | + } else { 30 | + this.positions = new BlockPosition[]{this.d.a(-this.e, 0, -this.e), 31 | + this.d.a(-this.e, 0, this.e), 32 | + this.d.a(this.e, 0, -this.e), 33 | + this.d.a(this.e, 0, this.e), 34 | + this.d}; 35 | + } 36 | + } 37 | + 38 | + public boolean isVillageAreaLoaded() { 39 | + for (int i = 0; this.positions != null && i < this.positions.length; i++) { 40 | + if (this.a.isLoaded(this.positions[i])) { 41 | + return true; 42 | + } 43 | + } 44 | + return false; 45 | + } 46 | + // Reaper end 47 | + 48 | public void a(VillageDoor villagedoor) { 49 | this.b.add(villagedoor); 50 | this.c = this.c.a((BaseBlockPosition) villagedoor.d()); 51 | @@ -368,6 +394,7 @@ public class Village { 52 | 53 | this.e = Math.max(32, (int) Math.sqrt((double) j) + 1); 54 | } 55 | + this.calculateNewCheckPositions(); // Reaper - Don't load chunks for village doors 56 | } 57 | 58 | public int a(String s) { 59 | @@ -422,7 +449,7 @@ public class Village { 60 | this.j.put(nbttagcompound2.getString("Name"), Integer.valueOf(nbttagcompound2.getInt("S"))); 61 | } 62 | } 63 | - 64 | + this.calculateNewCheckPositions(); // Reaper - Don't load chunks for village doors 65 | } 66 | 67 | public void b(NBTTagCompound nbttagcompound) { 68 | -------------------------------------------------------------------------------- /patches/server/0107-fix-maps-shouldn-t-load-chunk.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 05:21:08 +0500 4 | Subject: [PATCH] fix: maps shouldn't load chunk 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/ItemWorldMap.java b/src/main/java/net/minecraft/server/ItemWorldMap.java 8 | index 9269178738a789764db89980806f93d5c8fc8915..9cf5def08da1319e769d17f62900a64fa6958428 100644 9 | --- a/src/main/java/net/minecraft/server/ItemWorldMap.java 10 | +++ b/src/main/java/net/minecraft/server/ItemWorldMap.java 11 | @@ -90,9 +90,9 @@ public class ItemWorldMap extends ItemWorldMapBase { 12 | int k2 = (j / i + k1 - 64) * i; 13 | int l2 = (k / i + l1 - 64) * i; 14 | HashMultiset hashmultiset = HashMultiset.create(); 15 | - Chunk chunk = world.getChunkAtWorldCoords(new BlockPosition(k2, 0, l2)); 16 | + Chunk chunk = world.getChunkIfLoaded(new BlockPosition(k2, 0, l2)); // Reaper - Maps shouldn't load chunks 17 | 18 | - if (!chunk.isEmpty()) { 19 | + if (chunk != null && !chunk.isEmpty()) { // Reaper - Maps shouldn't load chunks 20 | int i3 = k2 & 15; 21 | int j3 = l2 & 15; 22 | int k3 = 0; 23 | -------------------------------------------------------------------------------- /patches/server/0108-fix-don-t-allow-digging-into-unloaded-chunks.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 05:22:12 +0500 4 | Subject: [PATCH] fix: don't allow digging into unloaded chunks 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java 8 | index c3c167b81098e01c6bd9c5944719bb3ab3df9eb8..2b65e588b2e8d2bf73b9c5066e50e975a58ca4a7 100644 9 | --- a/src/main/java/net/minecraft/server/PlayerConnection.java 10 | +++ b/src/main/java/net/minecraft/server/PlayerConnection.java 11 | @@ -919,6 +919,11 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { 12 | case START_DESTROY_BLOCK: 13 | case ABORT_DESTROY_BLOCK: 14 | case STOP_DESTROY_BLOCK: 15 | + // Reaper start - Don't allow digging in unloaded chunks 16 | + if (!worldserver.isChunkLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4, true)) { 17 | + return; 18 | + } 19 | + // Reaper end 20 | double d0 = this.player.locX - ((double) blockposition.getX() + 0.5D); 21 | double d1 = this.player.locY - ((double) blockposition.getY() + 0.5D) + 1.5D; 22 | double d2 = this.player.locZ - ((double) blockposition.getZ() + 0.5D); 23 | -------------------------------------------------------------------------------- /patches/server/0110-perf-optimize-idle-furnaces.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 05:34:21 +0500 4 | Subject: [PATCH] perf: optimize idle furnaces 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java 8 | index 9254fe05dff14e863160315326de7eb5f27710c2..4a37f298052c17af9942f974c303c19a50263ccb 100644 9 | --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java 10 | +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java 11 | @@ -186,7 +186,7 @@ public class TileEntityFurnace extends TileEntityContainer implements ITickable, 12 | if (!this.isBurning() && this.cookTime > 0) { 13 | this.cookTime = MathHelper.clamp(this.cookTime - 2, 0, this.cookTimeTotal); 14 | } 15 | - } else { 16 | + } else if (itemstack.getItem() != Items.BUCKET) { // Reaper - Optimize idle furnaces 17 | // CraftBukkit start - Handle multiple elapsed ticks 18 | if (this.burnTime <= 0 && this.canBurn()) { // CraftBukkit - == to <= 19 | CraftItemStack fuel = CraftItemStack.asCraftMirror(itemstack); 20 | -------------------------------------------------------------------------------- /patches/server/0111-fix-MC-158900.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 05:38:47 +0500 4 | Subject: [PATCH] fix: MC-158900 5 | 6 | https://bugs.mojang.com/browse/MC-158900 7 | 8 | diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java 9 | index de67be18f4d267941d884bb118cca2487456c78a..48e199eedcd780bf2464ba8cd5ed8284f2a3952c 100644 10 | --- a/src/main/java/net/minecraft/server/PlayerList.java 11 | +++ b/src/main/java/net/minecraft/server/PlayerList.java 12 | @@ -537,8 +537,10 @@ public abstract class PlayerList { 13 | PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.networkManager.getRawAddress()).getAddress()); 14 | String s; 15 | 16 | - if (getProfileBans().isBanned(gameprofile) && !getProfileBans().get(gameprofile).hasExpired()) { 17 | - GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.k.get(gameprofile); 18 | + // Reaper start - Fix MC-158900 19 | + GameProfileBanEntry gameprofilebanentry; 20 | + if (getProfileBans().isBanned(gameprofile) && (gameprofilebanentry = getProfileBans().get(gameprofile)) != null) { 21 | + // Reaper end 22 | 23 | s = "You are banned from this server!\nReason: " + gameprofilebanentry.getReason(); 24 | if (gameprofilebanentry.getExpires() != null) { 25 | -------------------------------------------------------------------------------- /patches/server/0112-perf-use-FastUtil-in-PlayerChunkMap.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 05:44:31 +0500 4 | Subject: [PATCH] perf: use FastUtil in PlayerChunkMap 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java 8 | index 4c2ac3081d7f1770b46ea436f73a4c44506a7bbf..d03f782c0333ad3bcbcae8f82f0fac7a1d2a5489 100644 9 | --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java 10 | +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java 11 | @@ -41,7 +41,7 @@ public class PlayerChunkMap { 12 | } 13 | }; 14 | private final WorldServer world; 15 | - private final List managedPlayers = Lists.newArrayList(); 16 | + private final List managedPlayers = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(); // Reaper - ArrayList -> ObjectArrayList 17 | private final Long2ObjectMap e = new Long2ObjectOpenHashMap(4096); 18 | private final Set f = Sets.newHashSet(); 19 | private final List g = Lists.newLinkedList(); 20 | -------------------------------------------------------------------------------- /patches/server/0114-fix-MC-10657.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 06:05:46 +0500 4 | Subject: [PATCH] fix: MC-10657 5 | 6 | https://bugs.mojang.com/browse/MC-10657 7 | 8 | diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java 9 | index 9fd71607d1031493ba90c23253955a52e65dff70..710f357910fce1dc2d8ec3b7a1d01337310173c7 100644 10 | --- a/src/main/java/net/minecraft/server/EntityPlayer.java 11 | +++ b/src/main/java/net/minecraft/server/EntityPlayer.java 12 | @@ -745,6 +745,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { 13 | this.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1032, BlockPosition.ZERO, 0, false)); 14 | this.lastSentExp = -1; 15 | this.lastHealthSent = -1.0F; 16 | + this.setSneaking(false); // Reaper - Fix MC-10657 17 | this.ch = -1; 18 | return this; 19 | } 20 | diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java 21 | index 48e199eedcd780bf2464ba8cd5ed8284f2a3952c..9a233711473cb1af473538bda669279023f9ca2f 100644 22 | --- a/src/main/java/net/minecraft/server/PlayerList.java 23 | +++ b/src/main/java/net/minecraft/server/PlayerList.java 24 | @@ -748,6 +748,8 @@ public abstract class PlayerList { 25 | entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect)); 26 | } 27 | 28 | + entityplayer.setSneaking(false); // Reaper - Fix MC-10657 29 | + 30 | // Fire advancement trigger 31 | CriterionTriggers.u.a(entityplayer, ((CraftWorld) fromWorld).getHandle().worldProvider.getDimensionManager(), worldserver.worldProvider.getDimensionManager()); 32 | if (((CraftWorld) fromWorld).getHandle().worldProvider.getDimensionManager() == DimensionManager.NETHER && worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD && entityplayer.Q() != null) { 33 | -------------------------------------------------------------------------------- /patches/server/0115-perf-avoid-double-I-O-operation-on-player-file.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 06:08:45 +0500 4 | Subject: [PATCH] perf: avoid double I/O operation on player file 5 | 6 | Credits to Akarin: https://github.com/Akarin-project/Akarin/blob/279a2b23ffd5b71f067638b8170f3f81aa0a4298/patches/server/0007-Avoid-double-I-O-operation-on-load-player-file.patch 7 | 8 | diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java 9 | index 691d511bf7ed8f9787146bd0d7c078f2a56d256f..8b113eac32c732d15cd5b146153c08cbf0e25fd6 100644 10 | --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java 11 | +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java 12 | @@ -168,7 +168,8 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { 13 | File file = new File(this.playerDir, entityhuman.bn() + ".dat"); 14 | // Spigot Start 15 | boolean usingWrongFile = false; 16 | - if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // Paper - Check online mode first 17 | + boolean normalFile = file.exists() && file.isFile(); // Reaper - Ensures normal file 18 | + if ( org.bukkit.Bukkit.getOnlineMode() && !normalFile ) // Paper - Check online mode first // Reaper - Ensures normal file 19 | { 20 | file = new File( this.playerDir, UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat"); 21 | if ( file.exists() ) 22 | @@ -179,7 +180,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { 23 | } 24 | // Spigot End 25 | 26 | - if (file.exists() && file.isFile()) { 27 | + if (normalFile) { // Reaper - Avoid double I/O operation 28 | nbttagcompound = NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file))); 29 | } 30 | // Spigot Start 31 | -------------------------------------------------------------------------------- /patches/server/0116-perf-configurable-asynchronous-JsonList-saving.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 06:12:14 +0500 4 | Subject: [PATCH] perf: configurable asynchronous JsonList saving 5 | 6 | 7 | diff --git a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 8 | index 9cb4eb12f2385821a9062e899c0c36849afd8fa4..45112d5fb7c1ef30549d35e83d0c4b20ce235f56 100644 9 | --- a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 10 | +++ b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 11 | @@ -274,4 +274,9 @@ public class ReaperConfig { 12 | private static void entityTrackerCheckY() { 13 | entityTrackerCheckY = getBoolean("entity-tracker-check-y", false); 14 | } 15 | + 16 | + public static boolean saveJsonAsync; 17 | + private static void saveJsonAsync() { 18 | + saveJsonAsync = getBoolean("save-json-async", false); 19 | + } 20 | } 21 | diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java 22 | index 2a259758b5cf1fd66f5300036d0821c554e457a3..621dd6154238ab39b88a4df795a279f3fd9489c4 100644 23 | --- a/src/main/java/net/minecraft/server/JsonList.java 24 | +++ b/src/main/java/net/minecraft/server/JsonList.java 25 | @@ -167,6 +167,8 @@ public class JsonList> { 26 | public void save() throws IOException { 27 | this.removeStaleEntries(); // Paper - remove expired values before saving 28 | 29 | + // Reaper start - Save json list async 30 | + Runnable runnable = () -> { 31 | Collection collection = this.d.values(); 32 | String s = this.b.toJson(collection); 33 | BufferedWriter bufferedwriter = null; 34 | @@ -174,9 +176,18 @@ public class JsonList> { 35 | try { 36 | bufferedwriter = Files.newWriter(this.c, StandardCharsets.UTF_8); 37 | bufferedwriter.write(s); 38 | + } catch (IOException ex) { // Reaper 39 | + JsonList.a.warn("Failed to save " + this.c, ex); // Reaper 40 | } finally { 41 | IOUtils.closeQuietly(bufferedwriter); 42 | } 43 | + }; 44 | + if (com.github.ruviolence.reaper.ReaperConfig.saveJsonAsync) { 45 | + MCUtil.scheduleAsyncTask(runnable); 46 | + } else { 47 | + runnable.run(); 48 | + } 49 | + // Reaper end 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /patches/server/0118-perf-cache-block-break-animation-packet.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 06:21:12 +0500 4 | Subject: [PATCH] perf: cache block break animation packet 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/WorldManager.java b/src/main/java/net/minecraft/server/WorldManager.java 8 | index 49dfc7ea0fe28ad8a8a23050023adb97ea56eb94..6f1a8bc5db6ce8f3ba28060748a3e80476b605cd 100644 9 | --- a/src/main/java/net/minecraft/server/WorldManager.java 10 | +++ b/src/main/java/net/minecraft/server/WorldManager.java 11 | @@ -70,6 +70,7 @@ public class WorldManager implements IWorldAccess { 12 | // Paper start 13 | java.util.List list = entity != null ? entity.world.players : this.a.getPlayerList().v(); 14 | Iterator iterator = list.iterator(); 15 | + PacketPlayOutBlockBreakAnimation packet = null; // Reaper - Cache block break animation packet 16 | while (iterator.hasNext()) { 17 | EntityHuman human = iterator.next(); 18 | if (!(human instanceof EntityPlayer)) continue; 19 | @@ -88,7 +89,10 @@ public class WorldManager implements IWorldAccess { 20 | // CraftBukkit end 21 | 22 | if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) { 23 | - entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j)); 24 | + // Reaper start - Cache block break animation packet 25 | + if (packet == null) packet = new PacketPlayOutBlockBreakAnimation(i, blockposition, j); 26 | + entityplayer.playerConnection.sendPacket(packet); 27 | + // Reaper end 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /patches/server/0119-fix-teleport-invisibility.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 06:28:11 +0500 4 | Subject: [PATCH] fix: teleport invisibility 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java 8 | index efdee67c973fbe12abaace1902eaa710d5a5c15a..a75732bd1ce691e968ab5398a18b2638fd43be89 100644 9 | --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java 10 | +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java 11 | @@ -182,7 +182,7 @@ public class EntityTrackerEntry { 12 | this.v = 0; 13 | // CraftBukkit start - Refresh list of who can see a player before sending teleport packet 14 | if (this.tracker instanceof EntityPlayer) { 15 | - this.scanPlayers(new java.util.ArrayList(this.trackedPlayers)); 16 | + this.scanPlayers(new java.util.ArrayList(this.tracker.world.players)); // Reaper - Fix teleport invisibility 17 | } 18 | // CraftBukkit end 19 | this.c(); 20 | -------------------------------------------------------------------------------- /patches/server/0120-perf-prevent-fishing-hooks-from-portal.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 06:29:28 +0500 4 | Subject: [PATCH] perf: prevent fishing hooks from portal 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java 8 | index 377b6d21fb6c2dce4645cd174a044b39203075aa..1808c91debc1c8d60d5dbd8d5a3c61a85f221ce0 100644 9 | --- a/src/main/java/net/minecraft/server/EntityFishingHook.java 10 | +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java 11 | @@ -153,6 +153,7 @@ public class EntityFishingHook extends Entity { 12 | this.locY = this.hooked.getBoundingBox().b + d1 * 0.8D; 13 | this.locZ = this.hooked.locZ; 14 | this.setPosition(this.locX, this.locY, this.locZ); 15 | + if (this.ak) this.die(); // Reaper - Prevent going through portals 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /patches/server/0121-perf-skip-updating-entity-tracker-without-players.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 06:31:14 +0500 4 | Subject: [PATCH] perf: skip updating entity tracker without players 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java 8 | index 94c17a0cf03401e49bf1b6680ff9c61d77755a3d..dcedfa9b4495cf5034d71484288ebb24cc475cab 100644 9 | --- a/src/main/java/net/minecraft/server/MinecraftServer.java 10 | +++ b/src/main/java/net/minecraft/server/MinecraftServer.java 11 | @@ -979,6 +979,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs 12 | } 13 | } 14 | try { // Reaper end - Flush consolidation 15 | + if (this.getPlayerList().getPlayerCount() != 0) // Reaper - Skip updating entity tracker without players 16 | worldserver.getTracker().updatePlayers(); 17 | // Reaper start - Flush consolidation 18 | } finally { 19 | -------------------------------------------------------------------------------- /patches/server/0122-fix-reset-players-airTicks-on-respawn.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Softik Lord 3 | Date: Thu, 14 Jul 2022 06:33:20 +0500 4 | Subject: [PATCH] fix: reset players airTicks on respawn 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java 8 | index 710f357910fce1dc2d8ec3b7a1d01337310173c7..60944b5044ff714b05869d8747c2a71dab083a91 100644 9 | --- a/src/main/java/net/minecraft/server/EntityPlayer.java 10 | +++ b/src/main/java/net/minecraft/server/EntityPlayer.java 11 | @@ -1641,6 +1641,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { 12 | 13 | this.setHealth(this.getMaxHealth()); 14 | this.fireTicks = 0; 15 | + this.setAirTicks(300); // Reaper - Reset airTicks on respawn 16 | this.fallDistance = 0; 17 | this.foodData = new FoodMetaData(this); 18 | this.expLevel = this.newLevel; 19 | -------------------------------------------------------------------------------- /patches/server/0123-fix-cow-dupe.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 14 Jul 2022 21:31:44 +0500 4 | Subject: [PATCH] fix: cow dupe 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java 8 | index 1454dfa31445f381cf7bc0794e82c774288cb78b..ae9239c488c4d7510748b9567459f4b7d4e2a9e5 100644 9 | --- a/src/main/java/net/minecraft/server/EntityMushroomCow.java 10 | +++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java 11 | @@ -28,6 +28,7 @@ public class EntityMushroomCow extends EntityCow { 12 | 13 | return true; 14 | } else if (itemstack.getItem() == Items.SHEARS && this.getAge() >= 0) { 15 | + if (this.dead) return false; // Reaper - Fix cow dupe 16 | // CraftBukkit start 17 | PlayerShearEntityEvent event = new PlayerShearEntityEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), this.getBukkitEntity()); 18 | this.world.getServer().getPluginManager().callEvent(event); 19 | -------------------------------------------------------------------------------- /patches/server/0124-fix-MC-161754.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 14 Jul 2022 22:00:28 +0500 4 | Subject: [PATCH] fix: MC-161754 5 | 6 | Item duplication with chested donkeys, mules, and llamas. (Dupe) 7 | 8 | diff --git a/src/main/java/net/minecraft/server/ContainerHorse.java b/src/main/java/net/minecraft/server/ContainerHorse.java 9 | index 1f2d0a58fd2bbd319e2bbc74a1f3370b26318c8d..ccf1db6c75687e7d7265f0c047ef174b6a129dbc 100644 10 | --- a/src/main/java/net/minecraft/server/ContainerHorse.java 11 | +++ b/src/main/java/net/minecraft/server/ContainerHorse.java 12 | @@ -71,7 +71,7 @@ public class ContainerHorse extends Container { 13 | } 14 | 15 | public boolean canUse(EntityHuman entityhuman) { 16 | - return this.a.a(entityhuman) && this.f.isAlive() && this.f.g((Entity) entityhuman) < 8.0F; 17 | + return this.a.a(entityhuman) && this.f.isAlive() && this.f.valid && this.f.g((Entity) entityhuman) < 8.0F; // Reaper - Fix MC-161754 18 | } 19 | 20 | public ItemStack shiftClick(EntityHuman entityhuman, int i) { 21 | -------------------------------------------------------------------------------- /patches/server/0126-fix-use-vanilla-minecart-speeds.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 14 Jul 2022 23:36:55 +0500 4 | Subject: [PATCH] fix: use vanilla minecart speeds 5 | 6 | CraftBukkit changed the values on flying speed, restore back to vanilla 7 | 8 | diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java 9 | index 0eadde0968e12bd5e2535363a0b412cf4a57f04e..aaa05f6693cb7e92fbbaeee8e81906f26c6f0956 100644 10 | --- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java 11 | +++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java 12 | @@ -39,9 +39,9 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableT 13 | private double derailedX = 0.5; 14 | private double derailedY = 0.5; 15 | private double derailedZ = 0.5; 16 | - private double flyingX = 0.95; 17 | - private double flyingY = 0.95; 18 | - private double flyingZ = 0.95; 19 | + private double flyingX = 0.94999998807907104D; // Reaper - Restore vanilla precision 20 | + private double flyingY = 0.94999998807907104D; // Reaper - Restore vanilla precision 21 | + private double flyingZ = 0.94999998807907104D; // Reaper - Restore vanilla precision 22 | public double maxSpeed = 0.4D; 23 | // CraftBukkit end 24 | 25 | -------------------------------------------------------------------------------- /patches/server/0127-fix-prevent-vehicle-move-while-awaiting-teleport-con.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Sun, 31 Jul 2022 11:41:39 +0500 4 | Subject: [PATCH] fix: prevent vehicle move while awaiting teleport confirm 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java 8 | index 2b65e588b2e8d2bf73b9c5066e50e975a58ca4a7..063b6d0d05ca6bd47eab8e3e4268945dec89a492 100644 9 | --- a/src/main/java/net/minecraft/server/PlayerConnection.java 10 | +++ b/src/main/java/net/minecraft/server/PlayerConnection.java 11 | @@ -302,6 +302,16 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { 12 | Entity entity = this.player.getVehicle(); 13 | 14 | if (entity != this.player && entity.bE() == this.player && entity == this.r) { 15 | + // Reaper start - Prevent vehicle move while awaiting teleport confirm 16 | + if (this.teleportPos != null) { 17 | + if (this.e - this.A > 20) { 18 | + this.A = this.e; 19 | + this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); 20 | + } 21 | + this.allowedPlayerTicks = 20; // CraftBukkit 22 | + return; 23 | + } 24 | + // Reaper end 25 | WorldServer worldserver = this.player.x(); 26 | double d0 = entity.locX; 27 | double d1 = entity.locY; 28 | -------------------------------------------------------------------------------- /patches/server/0129-fix-truly-async-tab-complete.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Sun, 14 Aug 2022 21:54:26 +0500 4 | Subject: [PATCH] fix: truly async tab complete 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java 8 | index be5ab01621c2182ddd34e980dda633e9761a6cd9..4d74b40fce46d46229f66d21c7ed2de10b396439 100644 9 | --- a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java 10 | +++ b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java 11 | @@ -36,8 +36,16 @@ public class PacketPlayInTabComplete implements Packet { 12 | 13 | } 14 | 15 | + // Reaper start - Truly async tab complete 16 | + private static final java.util.concurrent.ExecutorService executors = java.util.concurrent.Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon(true).setNameFormat("Async TabComplete Thread - #%d").build()); 17 | public void a(PacketListenerPlayIn packetlistenerplayin) { 18 | - packetlistenerplayin.a(this); 19 | + executors.submit(new Runnable() { 20 | + @Override 21 | + public void run() { 22 | + packetlistenerplayin.a(PacketPlayInTabComplete.this); 23 | + } 24 | + }); 25 | + // Reaper end 26 | } 27 | 28 | public String a() { 29 | -------------------------------------------------------------------------------- /patches/server/0130-fix-map-id-overflow.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Tue, 6 Sep 2022 23:37:26 +0500 4 | Subject: [PATCH] fix: map id overflow 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java 8 | index 50056f49a8eaea687d00175e41a877040934e9ae..21ee0c5039361f04cfd07144d5d8e8e4732f2740 100644 9 | --- a/src/main/java/net/minecraft/server/PersistentCollection.java 10 | +++ b/src/main/java/net/minecraft/server/PersistentCollection.java 11 | @@ -151,6 +151,7 @@ public class PersistentCollection { 12 | oshort = Short.valueOf((short) 0); 13 | } else { 14 | oshort = Short.valueOf((short) (oshort.shortValue() + 1)); 15 | + if (oshort < 0) oshort = 0; // Reaper - Fix map ID overflow 16 | } 17 | 18 | this.d.put(s, oshort); 19 | -------------------------------------------------------------------------------- /patches/server/0134-fix-don-t-clear-entity-metadata-when-sending-a-packe.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Tue, 10 Jan 2023 06:29:25 +0500 4 | Subject: [PATCH] fix: don't clear entity metadata when sending a packet with 5 | all data 6 | 7 | Metadata of an entity is cleared for some reason when some player starts to track that entity. 8 | This causes desynchronization of states for other trackers and the entity itself if it is a player, for example sprinting or gliding. 9 | 10 | diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java 11 | index fdf19d1f41eb581d652e897207b83454ecada873..12ef11ef0eb7d39baf8c66d19466232c1670511c 100644 12 | --- a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java 13 | +++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java 14 | @@ -14,6 +14,7 @@ public class PacketPlayOutEntityMetadata implements Packet 3 | Date: Fri, 27 Jan 2023 09:52:18 +0500 4 | Subject: [PATCH] fix: arrow velocity exploit 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java 8 | index a4395ab3cde44bda444695b8a8351f87b34b9817..4444ecbb9b76abb92cfab7aa7644c17b27a0f4db 100644 9 | --- a/src/main/java/net/minecraft/server/EntityLiving.java 10 | +++ b/src/main/java/net/minecraft/server/EntityLiving.java 11 | @@ -1746,12 +1746,25 @@ public abstract class EntityLiving extends Entity { 12 | return 0.42F; 13 | } 14 | 15 | + protected long lastJumpTime = 0L; // Reaper start - arrow velocity fix 16 | protected void cu() { 17 | + // Reaper start - arrow velocity fix 18 | + long time = System.nanoTime(); 19 | + boolean canCrit = true; 20 | + if (this instanceof EntityPlayer) { 21 | + canCrit = false; 22 | + if (time - this.lastJumpTime > (long)(0.250e9)) { 23 | + this.lastJumpTime = time; 24 | + canCrit = true; 25 | + } 26 | + } 27 | + // Reaper end - arrow velocity fix 28 | this.motY = (double) this.ct(); 29 | if (this.hasEffect(MobEffects.JUMP)) { 30 | this.motY += (double) ((float) (this.getEffect(MobEffects.JUMP).getAmplifier() + 1) * 0.1F); 31 | } 32 | 33 | + if (canCrit) // Reaper - arrow velocity fix 34 | if (this.isSprinting()) { 35 | float f = this.yaw * 0.017453292F; 36 | 37 | -------------------------------------------------------------------------------- /patches/server/0136-fix-jdk8-support.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Sun, 29 Jan 2023 15:25:37 +0500 4 | Subject: [PATCH] fix: jdk8 support 5 | 6 | Fixes JDK8 support after compiling project on JDK17 7 | 8 | diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java 9 | index 273dc269d5617ce1dd9206014cf77cde11bf7ae1..05bd5fe48889bc47eb347e941e7ec61f0b33d407 100644 10 | --- a/src/main/java/net/minecraft/server/RegionFile.java 11 | +++ b/src/main/java/net/minecraft/server/RegionFile.java 12 | @@ -81,7 +81,7 @@ public class RegionFile { 13 | while (header.hasRemaining()) { 14 | if (this.c.getChannel().read(header) == -1) throw new EOFException(); 15 | } 16 | - header.clear(); 17 | + ((java.nio.Buffer) header).clear(); // Reaper - Fix JDK8 support 18 | IntBuffer headerAsInts = header.asIntBuffer(); 19 | initOversizedState(); 20 | // Paper End 21 | -------------------------------------------------------------------------------- /patches/server/0137-feat-map-decorations-limit.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Mon, 13 Feb 2023 14:56:50 +0500 4 | Subject: [PATCH] feat: map decorations limit 5 | 6 | 7 | diff --git a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 8 | index ae9d81b9ceadd7bdeb12883c31b1101351171e53..d541810966faf27deef179281ed1cdf00f227c5f 100644 9 | --- a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 10 | +++ b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 11 | @@ -285,6 +285,11 @@ public class ReaperConfig { 12 | saveJsonAsync = getBoolean("save-json-async", false); 13 | } 14 | 15 | + public static int mapDecorationsLimit; 16 | + private static void mapDecorationsLimit() { 17 | + mapDecorationsLimit = getInt("map-decorations-limit", 10); 18 | + } 19 | + 20 | // Paper start - packet limiter 21 | public static String packetLimiterKickMessage; 22 | public static PacketLimit packetLimiterAllPackets; 23 | diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java 24 | index df317009b47918f764cde3fb9ec44e8d2788c482..418dc27946225803ab73ed66721fc6fb6b268dd1 100644 25 | --- a/src/main/java/net/minecraft/server/WorldMap.java 26 | +++ b/src/main/java/net/minecraft/server/WorldMap.java 27 | @@ -282,9 +282,31 @@ public class WorldMap extends PersistentBase { 28 | } 29 | } 30 | 31 | + if (countMapIcon() >= com.github.ruviolence.reaper.ReaperConfig.mapDecorationsLimit) return; // Reaper - Limit decorations 32 | this.decorations.put(s, new MapIcon(mapicon_type, b0, b1, b2)); 33 | } 34 | 35 | + // Reaper start - Limit decorations 36 | + private int countMapIcon() { 37 | + int count = 0; 38 | + 39 | + for (MapIcon icon : decorations.values()) { 40 | + switch (icon.b()) { 41 | + case PLAYER: 42 | + case PLAYER_OFF_MAP: 43 | + case PLAYER_OFF_LIMITS: 44 | + case MANSION: 45 | + case MONUMENT: 46 | + continue; 47 | + default: 48 | + count += 1; 49 | + } 50 | + } 51 | + 52 | + return count; 53 | + } 54 | + // Reaper end 55 | + 56 | @Nullable 57 | public Packet a(ItemStack itemstack, World world, EntityHuman entityhuman) { 58 | WorldMap.WorldMapHumanTracker worldmap_worldmaphumantracker = (WorldMap.WorldMapHumanTracker) this.k.get(entityhuman); 59 | -------------------------------------------------------------------------------- /patches/server/0138-feat-drop-use-packets-while-inside-the-inventory.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Wed, 15 Feb 2023 01:13:24 +0500 4 | Subject: [PATCH] feat: drop use packets while inside the inventory 5 | 6 | Will help to get rid of the desynchronization of the number of numPlayersUsing in chests/shulkers. 7 | However, it modifies vanilla logic and could lead to problems with some plugins. 8 | 9 | diff --git a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 10 | index d541810966faf27deef179281ed1cdf00f227c5f..9d541de2840d5b1c4ee28ae9beadb28380a239a6 100644 11 | --- a/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 12 | +++ b/src/main/java/com/github/ruviolence/reaper/ReaperConfig.java 13 | @@ -290,6 +290,11 @@ public class ReaperConfig { 14 | mapDecorationsLimit = getInt("map-decorations-limit", 10); 15 | } 16 | 17 | + public static boolean dropUsePacketsInInventory; 18 | + private static void dropUsePacketsInInventory() { 19 | + dropUsePacketsInInventory = getBoolean("drop-use-packets-in-inventory", false); 20 | + } 21 | + 22 | // Paper start - packet limiter 23 | public static String packetLimiterKickMessage; 24 | public static PacketLimit packetLimiterAllPackets; 25 | diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java 26 | index 063b6d0d05ca6bd47eab8e3e4268945dec89a492..329eb0dec15845e8f8f2df2afadd5df473929631 100644 27 | --- a/src/main/java/net/minecraft/server/PlayerConnection.java 28 | +++ b/src/main/java/net/minecraft/server/PlayerConnection.java 29 | @@ -1009,6 +1009,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { 30 | PlayerConnectionUtils.ensureMainThread(packetplayinuseitem, this, this.player.x()); 31 | if (this.player.isFrozen()) return; // CraftBukkit 32 | if (!checkLimit(packetplayinuseitem.timestamp)) return; // Spigot - check limit 33 | + if (player.activeContainer != player.defaultContainer && com.github.ruviolence.reaper.ReaperConfig.dropUsePacketsInInventory) return; // Reaper 34 | WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); 35 | EnumHand enumhand = packetplayinuseitem.c(); 36 | ItemStack itemstack = this.player.b(enumhand); 37 | -------------------------------------------------------------------------------- /patches/server/0140-fix-broken-portal-creation.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 16 Feb 2023 12:22:11 +0500 4 | Subject: [PATCH] fix: broken portal creation 5 | 6 | Fixes bug when the nether portal is created over the sea without PORTAL blocks. 7 | 8 | diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java 9 | index 18124f264ca7fa74df1ea9376abe6614cf16dc14..ddc63f844198e94bbb75bafb88f934e4aac560b7 100644 10 | --- a/src/main/java/net/minecraft/server/PortalTravelAgent.java 11 | +++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java 12 | @@ -454,8 +454,12 @@ public class PortalTravelAgent { 13 | 14 | // Paper start 15 | BlockPosition pos = new BlockPosition(j3, k3, l3); 16 | - nmsBlocks.putIfAbsent(pos, flag1 ? Blocks.OBSIDIAN.getBlockData() : Blocks.AIR.getBlockData()); 17 | + // Reaper start - Fix broken portal creation 18 | + if (flag1) { 19 | + nmsBlocks.putIfAbsent(pos, Blocks.OBSIDIAN.getBlockData()); 20 | bukkitBlocks.add(this.world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ())); 21 | + } 22 | + // Reaper end - Fix broken portal creation 23 | // Paper end 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /patches/server/0144-perf-set-IP_TOS-0x18.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Fri, 21 Apr 2023 19:03:32 +0800 4 | Subject: [PATCH] perf: set IP_TOS 0x18 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java 8 | index e9781c37cf3a35d0e0bfee17ede785ef7dcb15b5..16721840676643e772571f14caa329aee1f17df7 100644 9 | --- a/src/main/java/net/minecraft/server/ServerConnection.java 10 | +++ b/src/main/java/net/minecraft/server/ServerConnection.java 11 | @@ -108,6 +108,13 @@ public class ServerConnection { 12 | } catch (ChannelException channelexception) { 13 | ; 14 | } 15 | + // Reaper start 16 | + try { 17 | + channel.config().setOption(ChannelOption.IP_TOS, 0x18); 18 | + } catch (ChannelException channelexception) { 19 | + ; 20 | + } 21 | + // Reaper end 22 | if (!disableFlushConsolidation) channel.pipeline().addFirst(new io.netty.handler.flush.FlushConsolidationHandler()); // Reaper 23 | channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(ServerConnection.this)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(EnumProtocolDirection.SERVERBOUND)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(EnumProtocolDirection.CLIENTBOUND)); 24 | NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND); 25 | -------------------------------------------------------------------------------- /patches/server/0146-perf-Tuinity-Optimise-BlockSoil-nearby-water-lookup.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 27 Apr 2023 02:59:43 +0800 4 | Subject: [PATCH] perf: Tuinity - Optimise BlockSoil nearby water lookup 5 | 6 | Credits to Tuinity: https://github.com/Tuinity/Tuinity/blob/4c31ea1630f3dfd4a1d64de56c37ac1b0cc096a7/patches/server/0054-Optimise-BlockSoil-nearby-water-lookup.patch 7 | 8 | diff --git a/src/main/java/net/minecraft/server/BlockSoil.java b/src/main/java/net/minecraft/server/BlockSoil.java 9 | index 5c4b290971d2a074bab397f9f9b2568372e1d74f..abffb9e8d6b7bb2e3cc4917583bf8ee997e98385 100644 10 | --- a/src/main/java/net/minecraft/server/BlockSoil.java 11 | +++ b/src/main/java/net/minecraft/server/BlockSoil.java 12 | @@ -103,6 +103,7 @@ public class BlockSoil extends Block { 13 | } 14 | 15 | private boolean d(World world, BlockPosition blockposition) { 16 | + /* // Reaper start - Tuinity: remove abstract block iteration 17 | Iterator iterator = BlockPosition.b(blockposition.a(-4, 0, -4), blockposition.a(4, 1, 4)).iterator(); 18 | 19 | BlockPosition.MutableBlockPosition blockposition_mutableblockposition; 20 | @@ -116,6 +117,27 @@ public class BlockSoil extends Block { 21 | } while (world.getType(blockposition_mutableblockposition).getMaterial() != Material.WATER); 22 | 23 | return true; 24 | + */ 25 | + int xOff = blockposition.getX(); 26 | + int yOff = blockposition.getY(); 27 | + int zOff = blockposition.getZ(); 28 | + 29 | + for (int dz = -4; dz <= 4; ++dz) { 30 | + int z = dz + zOff; 31 | + for (int dx = -4; dx <= 4; ++dx) { 32 | + int x = xOff + dx; 33 | + for (int dy = 0; dy <= 1; ++dy) { 34 | + int y = dy + yOff; 35 | + Chunk chunk = world.getChunkAt(x >> 4, z >> 4); 36 | + if (chunk.getBlockData(x, y, z).getMaterial() == Material.WATER) { 37 | + return true; 38 | + } 39 | + } 40 | + } 41 | + } 42 | + 43 | + return false; 44 | + // Reaper end - Tuinity: remove abstract block iteration 45 | } 46 | 47 | public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1) { 48 | -------------------------------------------------------------------------------- /patches/server/0148-perf-deactivate-gameLoopFunction.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 27 Apr 2023 04:15:54 +0800 4 | Subject: [PATCH] perf: deactivate gameLoopFunction 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java 8 | index ba3e4bf290c7308c8a961ca9232695f9b4051c37..263fd80949aa5aac573b56e0f1c4940f6c90f5ee 100644 9 | --- a/src/main/java/net/minecraft/server/MinecraftServer.java 10 | +++ b/src/main/java/net/minecraft/server/MinecraftServer.java 11 | @@ -1022,9 +1022,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs 12 | this.v.tick(); 13 | MinecraftTimings.playerListTimer.stopTiming(); // Spigot 14 | // this.methodProfiler.c("commandFunctions"); // Reaper - Remove MethodProfiler 15 | + if (false) { // Reaper start - Deactivate gameLoopFunction 16 | MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot 17 | this.aL().e(); 18 | MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot 19 | + } // Reaper end - Deactivate gameLoopFunction 20 | // this.methodProfiler.c("tickables"); // Reaper - Remove MethodProfiler 21 | 22 | MinecraftTimings.tickablesTimer.startTiming(); // Spigot 23 | -------------------------------------------------------------------------------- /patches/server/0149-fix-packet-spam-for-non-living-entities.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Thu, 27 Apr 2023 04:47:06 +0800 4 | Subject: [PATCH] fix: packet spam for non-living entities 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java 8 | index 02f3e1b80abba4e7ddff97d28e180d21bf8158bf..ffeb964579ef5487e23f571fbc9ac6d327714911 100644 9 | --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java 10 | +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java 11 | @@ -427,8 +427,10 @@ public class EntityTrackerEntry { 12 | } 13 | 14 | // CraftBukkit start - Fix for nonsensical head yaw 15 | + if (this.tracker instanceof EntityLiving) { // Reaper start - Fix packet spam 16 | this.headYaw = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F); 17 | this.broadcast(new PacketPlayOutEntityHeadRotation(this.tracker, (byte) headYaw)); 18 | + } // Reaper end 19 | // CraftBukkit end 20 | 21 | if (this.tracker instanceof EntityLiving) { 22 | -------------------------------------------------------------------------------- /patches/server/0150-fix-packet-click-crash.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: ruViolence <78062896+ruViolence@users.noreply.github.com> 3 | Date: Tue, 18 Jul 2023 23:04:40 +0800 4 | Subject: [PATCH] fix: packet click crash 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java 8 | index 329eb0dec15845e8f8f2df2afadd5df473929631..d4f6677dc68a67a7d7b580c8298c2332dff91ff4 100644 9 | --- a/src/main/java/net/minecraft/server/PlayerConnection.java 10 | +++ b/src/main/java/net/minecraft/server/PlayerConnection.java 11 | @@ -1872,6 +1872,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { 12 | if (packetplayinwindowclick.b() < -1 && packetplayinwindowclick.b() != -999) { 13 | return; 14 | } 15 | + if (this.player.activeContainer.slots.size() <= packetplayinwindowclick.b()) return; // Reaper - Fix click crash 16 | 17 | InventoryView inventory = this.player.activeContainer.getBukkitView(); 18 | SlotType type = CraftInventoryView.getSlotType(inventory, packetplayinwindowclick.b()); 19 | -------------------------------------------------------------------------------- /patches/server/0154-Optimize-canSee-checks.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: HaHaWTH 3 | Date: Fri, 5 Apr 2024 00:02:03 +0800 4 | Subject: [PATCH] Optimize-canSee-checks 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 8 | index ad40a68fc7255d7a2e154117750809937d55cc5f..a4b5eebc1727d4bf3ad5feaa23b32932dc6004b3 100644 9 | --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 10 | +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 11 | @@ -84,7 +84,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { 12 | private boolean hasPlayedBefore = false; 13 | private final ConversationTracker conversationTracker = new ConversationTracker(); 14 | private final Set channels = new HashSet(); 15 | - private final Map>> hiddenPlayers = new HashMap<>(); 16 | + private final Map>> hiddenPlayers = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(); 17 | private static final WeakHashMap> pluginWeakReferences = new WeakHashMap<>(); 18 | private int hash = 0; 19 | private double health = 20; 20 | -------------------------------------------------------------------------------- /patches/server/0156-Fix-MC-2025.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: HaHaWTH 3 | Date: Fri, 5 Apr 2024 00:54:17 +0800 4 | Subject: [PATCH] Fix-MC-2025 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java 8 | index 50806baaf2c4195fcf0834d0bc6caa7b8a8a14c1..5801f67907339489a9d64ee095c9c63e6c0ca14f 100644 9 | --- a/src/main/java/net/minecraft/server/Entity.java 10 | +++ b/src/main/java/net/minecraft/server/Entity.java 11 | @@ -1670,6 +1670,16 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper 12 | nbttagcompound.setBoolean("Paper.FromMobSpawner", true); 13 | } 14 | // Paper end 15 | + 16 | + // Beast start - Fix MC-2025 17 | + AxisAlignedBB boundingBox = getBoundingBox(); 18 | + NBTTagList boundingBoxList = new NBTTagList(); 19 | + for (double coord : new double[]{boundingBox.a, boundingBox.b, boundingBox.c, boundingBox.d, boundingBox.e, boundingBox.f}) { 20 | + boundingBoxList.add(new NBTTagDouble(coord)); 21 | + } 22 | + nbttagcompound.set("Beast.BoundingBox", boundingBoxList); 23 | + // Beast end 24 | + 25 | return nbttagcompound; 26 | } catch (Throwable throwable) { 27 | CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT"); 28 | @@ -1760,6 +1770,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper 29 | this.setPosition(this.locX, this.locY, this.locZ); 30 | } 31 | 32 | + // Beast start - Fix MC-2025 33 | + if (nbttagcompound.hasKey("Beast.BoundingBox")) { 34 | + NBTTagList boundingBox = nbttagcompound.getList("Beast.BoundingBox", 6); 35 | + this.a(new AxisAlignedBB(boundingBox.getDoubleAt(0), boundingBox.getDoubleAt(1), boundingBox.getDoubleAt(2), boundingBox.getDoubleAt(3), boundingBox.getDoubleAt(4), boundingBox.getDoubleAt(5))); 36 | + } 37 | + // Beast end 38 | + 39 | // CraftBukkit start 40 | if (this instanceof EntityLiving) { 41 | EntityLiving entity = (EntityLiving) this; 42 | -------------------------------------------------------------------------------- /patches/server/0160-Do-not-log-empty-messages-warning.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: HaHaWTH 3 | Date: Fri, 5 Apr 2024 13:44:18 +0800 4 | Subject: [PATCH] Do-not-log-empty-messages-warning 5 | 6 | 7 | diff --git a/src/main/java/com/homomc/beast/BeastConfig.java b/src/main/java/com/homomc/beast/BeastConfig.java 8 | index 0cdc12c5c125b29adf643f765ec95b29d7cdcb65..62999390f81a7592e242db7b9963807f05f5c8e8 100644 9 | --- a/src/main/java/com/homomc/beast/BeastConfig.java 10 | +++ b/src/main/java/com/homomc/beast/BeastConfig.java 11 | @@ -196,6 +196,12 @@ public class BeastConfig { 12 | shapeCheckNetherPortal = getBoolean("shape-check.nether-portal", true); 13 | } 14 | 15 | + public static boolean emptyMessageWarning; 16 | + 17 | + private static void logMessages() { 18 | + emptyMessageWarning = getBoolean("log.empty-messages-warning", false); 19 | + } 20 | + 21 | public static boolean halloweenMobFeature; 22 | private static void halloweenMobFeature() { 23 | halloweenMobFeature = getBoolean("halloween-mob-feature", true); 24 | diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java 25 | index 5c1d316a35ba7a40c06c9a74d7de89f08878489e..92ae80f58bbfd58750bfec2f41789cf4d9a1de65 100644 26 | --- a/src/main/java/net/minecraft/server/PlayerConnection.java 27 | +++ b/src/main/java/net/minecraft/server/PlayerConnection.java 28 | @@ -1359,7 +1359,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { 29 | this.minecraftServer.server.playerCommandState = false; 30 | } 31 | } else if (s.isEmpty()) { 32 | - LOGGER.warn(this.player.getName() + " tried to send an empty message"); 33 | + if (com.homomc.beast.BeastConfig.emptyMessageWarning) LOGGER.warn(this.player.getName() + " tried to send an empty message"); 34 | } else if (getPlayer().isConversing()) { 35 | // Spigot start 36 | final String message = s; 37 | -------------------------------------------------------------------------------- /patches/server/0161-Fix-compatibility.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: HaHaWTH 3 | Date: Fri, 5 Apr 2024 17:21:20 +0800 4 | Subject: [PATCH] Fix-compatibility 5 | 6 | 7 | diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java 8 | deleted file mode 100644 9 | index 8596b4f2f68c87fa6f6fe0e78a0bb0231ed1fc1a..0000000000000000000000000000000000000000 10 | --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java 11 | +++ /dev/null 12 | @@ -1,7 +0,0 @@ 13 | -package io.papermc.paper.configuration; 14 | - 15 | -public class GlobalConfiguration { 16 | - public class PacketLimiter { 17 | - // Beast - This is just a dummy class to prevent ViaVersion from enabling its packet limiter. 18 | - } 19 | -} 20 | -------------------------------------------------------------------------------- /patches/server/0162-pause-server-when-empty.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: HaHaWTH 3 | Date: Fri, 5 Apr 2024 17:29:01 +0800 4 | Subject: [PATCH] pause-server-when-empty 5 | 6 | 7 | diff --git a/src/main/java/com/homomc/beast/BeastConfig.java b/src/main/java/com/homomc/beast/BeastConfig.java 8 | index 62999390f81a7592e242db7b9963807f05f5c8e8..e79695ae9cdca6c57430826eb706428043073da7 100644 9 | --- a/src/main/java/com/homomc/beast/BeastConfig.java 10 | +++ b/src/main/java/com/homomc/beast/BeastConfig.java 11 | @@ -202,6 +202,12 @@ public class BeastConfig { 12 | emptyMessageWarning = getBoolean("log.empty-messages-warning", false); 13 | } 14 | 15 | + public static boolean pauseServerWhenEmpty; 16 | + 17 | + private static void pauseServerWhenEmpty() { 18 | + pauseServerWhenEmpty = getBoolean("pause-server-when-empty", false); 19 | + } 20 | + 21 | public static boolean halloweenMobFeature; 22 | private static void halloweenMobFeature() { 23 | halloweenMobFeature = getBoolean("halloween-mob-feature", true); 24 | diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java 25 | index 9c00c256f00333fa0086bfd5d3c0e613f55de595..a750dd70e01e819c6c37443ad785ee96c0623265 100644 26 | --- a/src/main/java/net/minecraft/server/WorldServer.java 27 | +++ b/src/main/java/net/minecraft/server/WorldServer.java 28 | @@ -280,6 +280,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { 29 | // CraftBukkit end 30 | 31 | public void doTick() { 32 | + if (players.isEmpty() && com.homomc.beast.BeastConfig.pauseServerWhenEmpty) return; 33 | super.doTick(); 34 | if (this.getWorldData().isHardcore() && this.getDifficulty() != EnumDifficulty.HARD) { 35 | this.getWorldData().setDifficulty(EnumDifficulty.HARD); 36 | -------------------------------------------------------------------------------- /patches/server/0164-vmp-skip-movement-if-zero.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: HaHaWTH 3 | Date: Sun, 7 Apr 2024 15:56:44 +0800 4 | Subject: [PATCH] vmp-skip-movement-if-zero 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java 8 | index 48b61992a45784c7e6201be373e36104face7b85..e067703eb34ec85c3419e9e40647a8270a461eb0 100644 9 | --- a/src/main/java/net/minecraft/server/Entity.java 10 | +++ b/src/main/java/net/minecraft/server/Entity.java 11 | @@ -198,6 +198,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper 12 | private boolean isInLava; 13 | private int lastLavaCheck = -1; 14 | // Beast end 15 | + private boolean isBoundingBoxChanged = false; // Beast - VMP optimization 16 | public EnumMoveType moveType; // Beast - EntityMoveEvent 17 | 18 | // Beast start - Cache current block pos 19 | @@ -608,6 +609,9 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper 20 | } 21 | 22 | public void move(EnumMoveType enummovetype, double d0, double d1, double d2) { 23 | + if (!isBoundingBoxChanged && d0 == 0.0D && d1 == 0.0D && d2 == 0.0D) { 24 | + return; 25 | + } 26 | this.moveType = enummovetype; // Beast - EntityMoveEvent 27 | if (this.noclip) { 28 | this.a(this.getBoundingBox().d(d0, d1, d2)); 29 | @@ -2791,6 +2795,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper 30 | } 31 | 32 | public void a(AxisAlignedBB axisalignedbb) { 33 | + if (!this.boundingBox.equals(axisalignedbb)) isBoundingBoxChanged = true; 34 | // CraftBukkit start - block invalid bounding boxes 35 | double a = axisalignedbb.a, 36 | b = axisalignedbb.b, 37 | -------------------------------------------------------------------------------- /patches/server/0165-Fix-MC-110386.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: HaHaWTH 3 | Date: Sun, 7 Apr 2024 16:14:42 +0800 4 | Subject: [PATCH] Fix-MC-110386 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java 8 | index 50c21e9a134619aa7fa2b769f21c860eecf56134..c904f8f7a049cb1014d21c1539ff674009693292 100644 9 | --- a/src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java 10 | +++ b/src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java 11 | @@ -66,6 +66,7 @@ public class PathfinderGoalHurtByTarget extends PathfinderGoalTarget { 12 | } 13 | 14 | protected void a(EntityCreature entitycreature, EntityLiving entityliving) { 15 | + if (entitycreature == entityliving) return; // Beast - Fix MC-110386 16 | entitycreature.setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit - reason 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /patches/server/0166-Dionysus-prevent-IndexOutOfBounds.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: HaHaWTH 3 | Date: Sun, 7 Apr 2024 16:43:25 +0800 4 | Subject: [PATCH] Dionysus-prevent-IndexOutOfBounds 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java 8 | index bf684956d9919e54c8ccd7a3b152c1cf8454c9bc..49d64b10a23ad5adf824f8012a7cd20cc7260a82 100644 9 | --- a/src/main/java/net/minecraft/server/Container.java 10 | +++ b/src/main/java/net/minecraft/server/Container.java 11 | @@ -112,7 +112,13 @@ public abstract class Container { 12 | } 13 | 14 | public Slot getSlot(int i) { 15 | - return (Slot) this.slots.get(i); 16 | + // Beast start - Prevent IndexOutOfBoundsException 17 | + try { 18 | + return (Slot) this.slots.get(i); 19 | + } catch (IndexOutOfBoundsException e) { 20 | + return null; 21 | + } 22 | + // Beast end 23 | } 24 | 25 | public ItemStack shiftClick(EntityHuman entityhuman, int i) { 26 | -------------------------------------------------------------------------------- /patches/server/0168-Fix-randar-exploit.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: HaHaWTH 3 | Date: Thu, 18 Apr 2024 18:31:50 +0800 4 | Subject: [PATCH] Fix-randar-exploit 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java 8 | index 0d0a57fdd28568d880ad48576571ffe431389849..5466e01c8be056061d1522a39e3495a5ff64b81b 100644 9 | --- a/src/main/java/net/minecraft/server/World.java 10 | +++ b/src/main/java/net/minecraft/server/World.java 11 | @@ -90,6 +90,7 @@ public abstract class World implements IBlockAccess { 12 | protected float q; 13 | private int M; 14 | public final Random random = new Random(); 15 | + private final Random separateRandOnlyForWorldGen = new Random(); // Beast - Fix Randar 16 | public WorldProvider worldProvider; 17 | protected NavigationListener t = new NavigationListener(); 18 | protected List u; 19 | @@ -3316,8 +3317,10 @@ public abstract class World implements IBlockAccess { 20 | public Random a(int i, int j, int k) { 21 | long l = (long) i * 341873128712L + (long) j * 132897987541L + this.getWorldData().getSeed() + (long) k; 22 | 23 | - this.random.setSeed(l); 24 | - return this.random; 25 | + // Beast start 26 | + this.separateRandOnlyForWorldGen.setSeed(l); 27 | + return this.separateRandOnlyForWorldGen; 28 | + // Beast end 29 | } 30 | 31 | public CrashReportSystemDetails a(CrashReport crashreport) { 32 | -------------------------------------------------------------------------------- /patches/server/0173-virtual-thread-for-chunkio.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: HaHaWTH 3 | Date: Wed, 1 May 2024 02:53:15 +0800 4 | Subject: [PATCH] virtual-thread-for-chunkio 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/craftbukkit/util/AsynchronousExecutor.java b/src/main/java/org/bukkit/craftbukkit/util/AsynchronousExecutor.java 8 | index cf1258c559ce47bfb0f3dbd94302eacfd5fc08a0..80313bfaaca8b2e1fd3c4eaa86ebe49742b09747 100644 9 | --- a/src/main/java/org/bukkit/craftbukkit/util/AsynchronousExecutor.java 10 | +++ b/src/main/java/org/bukkit/craftbukkit/util/AsynchronousExecutor.java 11 | @@ -217,7 +217,7 @@ public final class AsynchronousExecutor { 12 | final CallBackProvider provider; 13 | final Queue finished = new ConcurrentLinkedQueue(); 14 | final Map tasks = new HashMap(); 15 | - final ThreadPoolExecutor pool; 16 | + ThreadPoolExecutor pool; 17 | 18 | /** 19 | * Uses a thread pool to pass executions to the provider. 20 | @@ -226,7 +226,17 @@ public final class AsynchronousExecutor { 21 | public AsynchronousExecutor(final CallBackProvider provider, final int coreSize) { 22 | Validate.notNull(provider, "Provider cannot be null"); 23 | this.provider = provider; 24 | - 25 | + // Beast start - Virtual Threads for async executor 26 | + if (com.homomc.beast.virtualthreads.VirtualThreadService.getJavaMajorVersion() >= com.homomc.beast.virtualthreads.VirtualThreadService.minimumJavaMajorVersionWithoutFeaturePreview && com.homomc.beast.BeastConfig.virtualThreadForAsyncExecutor) { 27 | + try { 28 | + pool = new ThreadPoolExecutor(coreSize, Integer.MAX_VALUE, 60l, TimeUnit.SECONDS, new LinkedBlockingQueue(), provider); 29 | + pool.setThreadFactory(com.homomc.beast.virtualthreads.VirtualThreadService.get().createFactory()); 30 | + return; 31 | + } catch (Exception e) { 32 | + System.err.println("Failed to create Virtual Thread executor! Fallback to default executor."); 33 | + } 34 | + } 35 | + // Beast end 36 | // We have an unbound queue size so do not need a max thread size 37 | pool = new ThreadPoolExecutor(coreSize, Integer.MAX_VALUE, 60l, TimeUnit.SECONDS, new LinkedBlockingQueue(), provider); 38 | } 39 | -------------------------------------------------------------------------------- /patches/server/0174-virtual-thread-for-MC-Util.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: HaHaWTH 3 | Date: Wed, 1 May 2024 06:04:21 +0800 4 | Subject: [PATCH] virtual-thread-for-MC-Util 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java 8 | index 70a1dbdb31d44fcabce54fd1b78f29b1848dcd26..7854964c3dbde193cc5b8d2fe0cc8db02d570cee 100644 9 | --- a/src/main/java/net/minecraft/server/MCUtil.java 10 | +++ b/src/main/java/net/minecraft/server/MCUtil.java 11 | @@ -23,18 +23,17 @@ import java.util.function.Supplier; 12 | import java.util.regex.Pattern; 13 | 14 | public final class MCUtil { 15 | - private static Executor asyncExecutor; 16 | + private static Executor asyncExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("Paper Async Task Handler Thread - %1$d").build()); 17 | 18 | static { 19 | if (VirtualThreadService.getJavaMajorVersion() >= VirtualThreadService.minimumJavaMajorVersionWithoutFeaturePreview && BeastConfig.virtualThreadForAsyncExecutor) { 20 | try { 21 | - Method newThreadPerTaskExecutor = Executors.class.getMethod("newThreadPerTaskExecutor", ThreadFactory.class); 22 | - asyncExecutor = (Executor) newThreadPerTaskExecutor.invoke(null, VirtualThreadService.get().createFactory()); 23 | + asyncExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("Paper Async Task Handler Thread - %1$d").setThreadFactory(VirtualThreadService.get().createFactory()).build()); 24 | } catch (Exception ignored) { 25 | System.err.println("Failed to create Virtual Thread executor! Fallback to default executor."); 26 | + asyncExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("Paper Async Task Handler Thread - %1$d").build()); 27 | } 28 | } 29 | - asyncExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("Paper Async Task Handler Thread - %1$d").build()); 30 | } 31 | 32 | private MCUtil() {} 33 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.homomc.beast 5 | beast-parent 6 | dev-SNAPSHOT 7 | pom 8 | Beast (Parent) 9 | 10 | 11 | 12 | github 13 | GitHub HomoMC Apache Maven Packages 14 | https://maven.pkg.github.com/HomoMC/Beast 15 | 16 | 17 | 18 | 19 | 20 | aikar 21 | https://repo.aikar.co/content/groups/aikar/ 22 | 23 | 24 | velocity-snapshots 25 | https://nexus.velocitypowered.com/repository/velocity-artifacts-snapshots/ 26 | 27 | 28 | 29 | 30 | install 31 | ${project.artifactId} 32 | 33 | 34 | Beast-API 35 | Beast-Server 36 | 37 | 38 | 39 | 40 | owasp-dependency-check 41 | 42 | 43 | 44 | org.owasp 45 | dependency-check-maven 46 | 6.1.0 47 | 48 | 49 | 50 | check 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /scripts/generatesources.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | SOURCE="${BASH_SOURCE[0]}" 4 | while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink 5 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 6 | SOURCE="$(readlink "$SOURCE")" 7 | [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located 8 | done 9 | . $(dirname $SOURCE)/init.sh 10 | 11 | 12 | cd $basedir 13 | paperVer=$(cat current-paper) 14 | 15 | minecraftversion=$(cat $basedir/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4) 16 | decompile="Paper/work/Minecraft/$minecraftversion/spigot" 17 | 18 | mkdir -p mc-dev/src/net/minecraft/server 19 | 20 | cd mc-dev 21 | if [ ! -d ".git" ]; then 22 | git init 23 | fi 24 | 25 | rm src/net/minecraft/server/*.java 26 | cp $basedir/$decompile/net/minecraft/server/*.java src/net/minecraft/server 27 | 28 | base="$basedir/Paper/Paper-Server/src/main/java/net/minecraft/server" 29 | cd $basedir/mc-dev/src/net/minecraft/server/ 30 | for file in $(/bin/ls $base) 31 | do 32 | if [ -f "$file" ]; then 33 | rm -f "$file" 34 | fi 35 | done 36 | cd $basedir/mc-dev 37 | git add . -A 38 | git commit . -m "mc-dev" 39 | git tag -a "$paperVer" -m "$paperVer" 2>/dev/null 40 | pushRepo . $MCDEV_REPO $paperVer 41 | -------------------------------------------------------------------------------- /scripts/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # BEGIN config 3 | FORK_NAME="Beast" 4 | API_REPO="" 5 | SERVER_REPO="" 6 | PAPER_API_REPO="" 7 | PAPER_SERVER_REPO="" 8 | MCDEV_REPO="" 9 | # END config 10 | 11 | sourceBase=$(dirname $SOURCE)/../ 12 | cd "${basedir:-$sourceBase}" 13 | 14 | basedir=$(pwd -P) 15 | cd - 16 | 17 | 18 | function bashColor { 19 | if [ $2 ]; then 20 | echo -e "\e[$1;$2m" 21 | else 22 | echo -e "\e[$1m" 23 | fi 24 | } 25 | function bashColorReset { 26 | echo -e "\e[m" 27 | } 28 | 29 | function cleanupPatches { 30 | cd "$1" 31 | for patch in *.patch; do 32 | gitver=$(tail -n 2 $patch | grep -ve "^$" | tail -n 1) 33 | diffs=$(git diff --staged $patch | grep -E "^(\+|\-)" | grep -Ev "(From [a-z0-9]{32,}|\-\-\- a|\+\+\+ b|.index|Date\: )") 34 | 35 | testver=$(echo "$diffs" | tail -n 2 | grep -ve "^$" | tail -n 1 | grep "$gitver") 36 | if [ "x$testver" != "x" ]; then 37 | diffs=$(echo "$diffs" | tail -n +3) 38 | fi 39 | 40 | if [ "x$diffs" == "x" ] ; then 41 | git reset HEAD $patch >/dev/null 42 | git checkout -- $patch >/dev/null 43 | fi 44 | done 45 | } 46 | function pushRepo { 47 | if [ "$(git config minecraft.push-${FORK_NAME})" == "1" ]; then 48 | echo "Pushing - $1 ($3) to $2" 49 | ( 50 | cd "$1" 51 | git remote rm emc-push > /dev/null 2>&1 52 | git remote add emc-push $2 >/dev/null 2>&1 53 | git push emc-push $3 -f 54 | ) 55 | fi 56 | } 57 | function basedir { 58 | cd "$basedir" 59 | } 60 | function gethead { 61 | ( 62 | cd "$1" 63 | git log -1 --oneline 64 | ) 65 | } 66 | -------------------------------------------------------------------------------- /scripts/paperclip.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copied from https://github.com/PaperMC/Paper/blob/d54ce6c17fb7a35238d6b9f734d30a4289886773/scripts/paperclip.sh 4 | # License from Paper applies to this file 5 | 6 | ( 7 | set -e 8 | basedir="$(cd "$1" && pwd -P)" 9 | workdir="$basedir/Paper/work" 10 | localworkdir="$basedir/work" 11 | mcver=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) 12 | paperjar="$basedir/Beast-Server/target/beast-$mcver.jar" 13 | vanillajar="$workdir/Minecraft/$mcver/$mcver.jar" 14 | 15 | ( 16 | cd "$localworkdir/Paperclip" 17 | mvn clean package "-Dmcver=$mcver" "-Dpaperjar=$paperjar" "-Dvanillajar=$vanillajar" 18 | ) 19 | cp "$localworkdir/Paperclip/assembly/target/paperclip-${mcver}.jar" "$basedir/reaper-paperclip.jar" 20 | 21 | echo "" 22 | echo "" 23 | echo "" 24 | echo "Build success!" 25 | echo "Copied final jar to $(cd "$basedir" && pwd -P)/reaper-paperclip.jar" 26 | ) || exit 1 27 | -------------------------------------------------------------------------------- /scripts/push.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # get base dir regardless of execution location 3 | SOURCE="${BASH_SOURCE[0]}" 4 | while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink 5 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 6 | SOURCE="$(readlink "$SOURCE")" 7 | [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located 8 | done 9 | . $(dirname $SOURCE)/init.sh 10 | 11 | minecraftversion=$(cat $basedir/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4) 12 | 13 | basedir 14 | pushRepo ${FORK_NAME}-API $API_REPO master:$minecraftversion 15 | pushRepo ${FORK_NAME}-Server $SERVER_REPO master:$minecraftversion 16 | -------------------------------------------------------------------------------- /scripts/rebuildpatches.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # get base dir regardless of execution location 3 | SOURCE="${BASH_SOURCE[0]}" 4 | while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink 5 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 6 | SOURCE="$(readlink "$SOURCE")" 7 | [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located 8 | done 9 | . $(dirname $SOURCE)/init.sh 10 | 11 | PS1="$" 12 | echo "Rebuilding patch files from current fork state..." 13 | function savePatches { 14 | what=$1 15 | cd $basedir/$what/ 16 | 17 | mkdir -p $basedir/patches/$2 18 | if [ -d ".git/rebase-apply" ]; then 19 | # in middle of a rebase, be smarter 20 | echo "REBASE DETECTED - PARTIAL SAVE" 21 | last=$(cat ".git/rebase-apply/last") 22 | next=$(cat ".git/rebase-apply/next") 23 | declare -a files=("$basedir/patches/$2/"*.patch) 24 | for i in $(seq -f "%04g" 1 1 $last) 25 | do 26 | if [ $i -lt $next ]; then 27 | rm "${files[`expr $i - 1`]}" 28 | fi 29 | done 30 | else 31 | rm $basedir/patches/$2/*.patch 32 | fi 33 | 34 | git format-patch --no-signature --zero-commit --full-index --no-stat -N -o $basedir/patches/$2 upstream/upstream 35 | cd $basedir 36 | git add -A $basedir/patches/$2 37 | echo " Patches saved for $what to patches/$2" 38 | } 39 | 40 | savePatches ${FORK_NAME}-API api 41 | savePatches ${FORK_NAME}-Server server 42 | 43 | $basedir/scripts/push.sh 44 | -------------------------------------------------------------------------------- /scripts/upstream.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # get base dir regardless of execution location 3 | SOURCE="${BASH_SOURCE[0]}" 4 | while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink 5 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 6 | SOURCE="$(readlink "$SOURCE")" 7 | [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located 8 | done 9 | . $(dirname $SOURCE)/init.sh 10 | 11 | git submodule update --init --recursive 12 | 13 | if [[ "$1" == up* ]]; then 14 | ( 15 | cd "$basedir/Paper/" 16 | git fetch && git reset --hard origin/ver/1.12.2 17 | cd ../ 18 | git add Paper 19 | ) 20 | fi 21 | 22 | paperVer=$(gethead Paper) 23 | 24 | minecraftserverurl=$(cat "$basedir"/Paper/work/BuildData/info.json | grep serverUrl | cut -d '"' -f 4) 25 | minecraftversion=$(cat "$basedir"/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4) 26 | decompiledir="$basedir/Paper/work/Minecraft/$minecraftversion" 27 | jarpath="$decompiledir/$minecraftversion" 28 | 29 | if [ ! -f "$jarpath.jar" ]; then 30 | echo "Downloading unmapped vanilla jar..." 31 | mkdir -p "$decompiledir" 32 | curl -s -o "$jarpath.jar" "$minecraftserverurl" 33 | if [ "$?" != "0" ]; then 34 | echo "Failed to download the vanilla server jar. Check connectivity or try again later." 35 | exit 1 36 | fi 37 | fi 38 | 39 | cd "$basedir/Paper/" 40 | 41 | ./paper patch 42 | 43 | cd "Paper-Server" 44 | mcVer=$(mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=minecraft_version | sed -n -e '/^\[.*\]/ !{ /^[0-9]/ { p; q } }') 45 | 46 | basedir 47 | . $basedir/scripts/importmcdev.sh 48 | 49 | version=$(echo -e "Paper: $paperVer\nmc-dev:$importedmcdev") 50 | tag="${minecraftversion}-${mcVer}-$(echo -e $version | shasum | awk '{print $1}')" 51 | echo "$tag" > "$basedir"/current-paper 52 | 53 | "$basedir"/scripts/generatesources.sh 54 | 55 | cd Paper/ 56 | 57 | function tag { 58 | ( 59 | cd $1 60 | if [ "$2" == "1" ]; then 61 | git tag -d "$tag" 2>/dev/null 62 | fi 63 | echo -e "$(date)\n\n$version" | git tag -a "$tag" -F - 2>/dev/null 64 | ) 65 | } 66 | echo "Tagging as $tag" 67 | echo -e "$version" 68 | 69 | forcetag=0 70 | if [ "$(cat "$basedir"/current-paper)" != "$tag" ]; then 71 | forcetag=1 72 | fi 73 | 74 | tag Paper-API $forcetag 75 | tag Paper-Server $forcetag 76 | 77 | pushRepo Paper-API $PAPER_API_REPO $tag 78 | pushRepo Paper-Server $PAPER_SERVER_REPO $tag 79 | 80 | -------------------------------------------------------------------------------- /scripts/upstreamCommit.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ( 3 | set -e 4 | PS1="$" 5 | 6 | function changelog() { 7 | base=$(git ls-tree HEAD $1 | cut -d' ' -f3 | cut -f1) 8 | cd $1 && git log --oneline ${base}...HEAD 9 | } 10 | paper=$(changelog Paper) 11 | 12 | updated="" 13 | logsuffix="" 14 | if [ ! -z "$paper" ]; then 15 | logsuffix="$logsuffix\n\nPaper Changes:\n$paper" 16 | if [ -z "$updated" ]; then updated="Paper"; else updated="$updated/Paper"; fi 17 | fi 18 | disclaimer="Upstream has released updates that appears to apply and compile correctly" 19 | 20 | if [ ! -z "$1" ]; then 21 | disclaimer="$@" 22 | fi 23 | 24 | log="${UP_LOG_PREFIX}Updated Upstream ($updated)\n\n${disclaimer}${logsuffix}" 25 | 26 | echo -e "$log" | git commit -F - 27 | 28 | ) || exit 1 --------------------------------------------------------------------------------