Repository: Elytrium/LimboAPI Branch: master Commit: 3781544d8578 Files: 178 Total size: 41.0 MB Directory structure: gitextract_l5oqe6y4/ ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ └── feature_request.md │ └── workflows/ │ ├── build.yml │ └── release.yml ├── .gitignore ├── HEADER.txt ├── HEADER_MCPROTOCOLLIB.txt ├── HEADER_MIXED.txt ├── LICENSE ├── README.md ├── VERSION ├── api/ │ ├── HEADER.txt │ ├── LICENSE │ ├── build.gradle.kts │ └── src/ │ └── main/ │ ├── java/ │ │ └── net/ │ │ └── elytrium/ │ │ └── limboapi/ │ │ └── api/ │ │ ├── Limbo.java │ │ ├── LimboFactory.java │ │ ├── LimboSessionHandler.java │ │ ├── chunk/ │ │ │ ├── BlockEntityVersion.java │ │ │ ├── BuiltInBiome.java │ │ │ ├── Dimension.java │ │ │ ├── VirtualBiome.java │ │ │ ├── VirtualBlock.java │ │ │ ├── VirtualBlockEntity.java │ │ │ ├── VirtualChunk.java │ │ │ ├── VirtualWorld.java │ │ │ ├── data/ │ │ │ │ ├── BlockSection.java │ │ │ │ ├── BlockStorage.java │ │ │ │ ├── ChunkSnapshot.java │ │ │ │ └── LightSection.java │ │ │ └── util/ │ │ │ └── CompactStorage.java │ │ ├── command/ │ │ │ └── LimboCommandMeta.java │ │ ├── event/ │ │ │ └── LoginLimboRegisterEvent.java │ │ ├── file/ │ │ │ ├── BuiltInWorldFileType.java │ │ │ └── WorldFile.java │ │ ├── material/ │ │ │ ├── Block.java │ │ │ ├── Item.java │ │ │ ├── VirtualItem.java │ │ │ └── WorldVersion.java │ │ ├── mcprotocollib/ │ │ │ └── NibbleArray3D.java │ │ ├── player/ │ │ │ ├── GameMode.java │ │ │ └── LimboPlayer.java │ │ ├── protocol/ │ │ │ ├── PacketDirection.java │ │ │ ├── PreparedPacket.java │ │ │ ├── item/ │ │ │ │ ├── ItemComponent.java │ │ │ │ └── ItemComponentMap.java │ │ │ ├── map/ │ │ │ │ └── MapPalette.java │ │ │ └── packets/ │ │ │ ├── PacketFactory.java │ │ │ ├── PacketMapping.java │ │ │ └── data/ │ │ │ ├── AbilityFlags.java │ │ │ ├── BiomeData.java │ │ │ ├── MapData.java │ │ │ └── MapPalette.java │ │ └── utils/ │ │ ├── EnumUniverse.java │ │ ├── OverlayMap.java │ │ └── OverlayVanillaMap.java │ └── templates/ │ └── net/ │ └── elytrium/ │ └── limboapi/ │ └── BuildConstants.java ├── build.gradle.kts ├── config/ │ ├── checkstyle/ │ │ ├── checkstyle.xml │ │ └── suppressions.xml │ └── spotbugs/ │ └── suppressions.xml ├── gradle/ │ ├── libs.versions.toml │ └── wrapper/ │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gradlew ├── gradlew.bat ├── plugin/ │ ├── build.gradle │ ├── mapping/ │ │ ├── fallbackdata.json │ │ ├── legacy_blockentities_mapping.json │ │ ├── legacy_blocks_mapping.json │ │ ├── legacy_data_component_types_mapping.json │ │ ├── legacy_items_mapping.json │ │ ├── legacyblockmapping.json │ │ ├── legacyblocks.json │ │ └── tag_types.json │ └── src/ │ └── main/ │ ├── java/ │ │ └── net/ │ │ └── elytrium/ │ │ └── limboapi/ │ │ ├── LimboAPI.java │ │ ├── Settings.java │ │ ├── file/ │ │ │ ├── MCEditSchematicFile.java │ │ │ ├── StructureNbtFile.java │ │ │ ├── WorldEditSchemFile.java │ │ │ └── WorldFileTypeRegistry.java │ │ ├── injection/ │ │ │ ├── disconnect/ │ │ │ │ └── DisconnectListener.java │ │ │ ├── dummy/ │ │ │ │ ├── ClosedChannel.java │ │ │ │ ├── ClosedMinecraftConnection.java │ │ │ │ └── DummyEventPool.java │ │ │ ├── event/ │ │ │ │ └── EventManagerHook.java │ │ │ ├── login/ │ │ │ │ ├── LoginListener.java │ │ │ │ ├── LoginTasksQueue.java │ │ │ │ └── confirmation/ │ │ │ │ └── LoginConfirmHandler.java │ │ │ ├── packet/ │ │ │ │ ├── LegacyPlayerListItemHook.java │ │ │ │ ├── LimboCompressDecoder.java │ │ │ │ ├── MinecraftDiscardCompressDecoder.java │ │ │ │ ├── MinecraftLimitedCompressDecoder.java │ │ │ │ ├── PreparedPacketImpl.java │ │ │ │ ├── RemovePlayerInfoHook.java │ │ │ │ ├── ServerLoginSuccessHook.java │ │ │ │ └── UpsertPlayerInfoHook.java │ │ │ └── tablist/ │ │ │ ├── RewritingKeyedVelocityTabList.java │ │ │ ├── RewritingTabList.java │ │ │ ├── RewritingVelocityTabList.java │ │ │ └── RewritingVelocityTabListLegacy.java │ │ ├── material/ │ │ │ └── Biome.java │ │ ├── mcprotocollib/ │ │ │ ├── BitStorage116.java │ │ │ └── BitStorage19.java │ │ ├── protocol/ │ │ │ ├── LimboProtocol.java │ │ │ ├── data/ │ │ │ │ ├── BiomeStorage118.java │ │ │ │ ├── BlockStorage17.java │ │ │ │ ├── BlockStorage19.java │ │ │ │ └── StorageUtils.java │ │ │ ├── packets/ │ │ │ │ ├── PacketFactoryImpl.java │ │ │ │ ├── c2s/ │ │ │ │ │ ├── MoveOnGroundOnlyPacket.java │ │ │ │ │ ├── MovePacket.java │ │ │ │ │ ├── MovePositionOnlyPacket.java │ │ │ │ │ ├── MoveRotationOnlyPacket.java │ │ │ │ │ ├── PlayerChatSessionPacket.java │ │ │ │ │ └── TeleportConfirmPacket.java │ │ │ │ └── s2c/ │ │ │ │ ├── ChangeGameStatePacket.java │ │ │ │ ├── ChunkDataPacket.java │ │ │ │ ├── ChunkUnloadPacket.java │ │ │ │ ├── DefaultSpawnPositionPacket.java │ │ │ │ ├── MapDataPacket.java │ │ │ │ ├── PlayerAbilitiesPacket.java │ │ │ │ ├── PositionRotationPacket.java │ │ │ │ ├── SetExperiencePacket.java │ │ │ │ ├── SetSlotPacket.java │ │ │ │ ├── TimeUpdatePacket.java │ │ │ │ ├── UpdateTagsPacket.java │ │ │ │ └── UpdateViewPositionPacket.java │ │ │ └── util/ │ │ │ └── NetworkSection.java │ │ ├── server/ │ │ │ ├── CachedPackets.java │ │ │ ├── LimboImpl.java │ │ │ ├── LimboPlayerImpl.java │ │ │ ├── LimboSessionHandlerImpl.java │ │ │ ├── item/ │ │ │ │ ├── SimpleItemComponentManager.java │ │ │ │ ├── SimpleItemComponentMap.java │ │ │ │ └── type/ │ │ │ │ ├── BooleanItemComponent.java │ │ │ │ ├── ComponentItemComponent.java │ │ │ │ ├── ComponentsItemComponent.java │ │ │ │ ├── DyedColorItemComponent.java │ │ │ │ ├── EmptyItemComponent.java │ │ │ │ ├── EnchantmentsItemComponent.java │ │ │ │ ├── GameProfileItemComponent.java │ │ │ │ ├── IntItemComponent.java │ │ │ │ ├── StringItemComponent.java │ │ │ │ ├── StringsItemComponent.java │ │ │ │ ├── TagItemComponent.java │ │ │ │ ├── VarIntItemComponent.java │ │ │ │ └── WriteableItemComponent.java │ │ │ └── world/ │ │ │ ├── SimpleBlock.java │ │ │ ├── SimpleBlockEntity.java │ │ │ ├── SimpleItem.java │ │ │ ├── SimpleTagManager.java │ │ │ ├── SimpleWorld.java │ │ │ └── chunk/ │ │ │ ├── SimpleChunk.java │ │ │ ├── SimpleChunkSnapshot.java │ │ │ ├── SimpleLightSection.java │ │ │ └── SimpleSection.java │ │ └── utils/ │ │ ├── LambdaUtil.java │ │ ├── OverlayIntObjectMap.java │ │ ├── OverlayObject2IntMap.java │ │ ├── ProtocolTools.java │ │ ├── ReloadListener.java │ │ └── SetIsObjectSet.java │ └── resources/ │ └── mapping/ │ ├── chat_type_1_19.nbt │ ├── chat_type_1_19_1.nbt │ ├── colors_main_map │ ├── colors_minecraft_1_12_map │ ├── colors_minecraft_1_16_map │ ├── colors_minecraft_1_17_map │ ├── colors_minecraft_1_8_map │ ├── colors_minimum_version_map │ ├── damage_type_1_19_4.nbt │ ├── damage_type_1_20.nbt │ ├── fluids.json │ ├── legacyitems.json │ ├── modern_block_id_remap.json │ └── modern_item_id_remap.json └── settings.gradle.kts ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug Report about: Report the problem that has occurred in our project. title: "[BUG] " labels: bug assignees: '' --- **Describe the bug** A clear and concise description of the bug. **To Reproduce** Steps to reproduce the behavior: 1. Set '...' in config to '...' 2. Do in game '....' 3. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Server Info (please complete the following information):** - All Limbo plugins versions: - [e.g. LimboAPI 1.0.4-SNAPSHOT, downloaded from https://github.com/Elytrium/LimboAPI/actions/runs/xxxxxx] - [e.g. LimboFilter 1.0.3-rc3, downloaded from https://github.com/Elytrium/LimboAPI/actions/runs/xxxxxx] - /velocity dump link [e.g. https://dump.velocitypowered.com/abcdef.json] **Additional context** Add any other context about the problem here. ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: Feature Request about: Suggest an idea to improve our project. title: "[ENHANCEMENT] " labels: enhancement assignees: '' --- **Describe the feature you'd like to have implemented** A clear and concise description of what you want to be added. **Is your feature request related to an existing problem? Please describe.** A clear and concise description of what the problem is. **Additional context** Add any other context or screenshots about the feature request here. ================================================ FILE: .github/workflows/build.yml ================================================ name: Java CI with Gradle on: push: branches: - master pull_request: branches: - master jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4.2.2 - name: Set up JDK uses: actions/setup-java@v4.7.0 with: distribution: temurin java-version: 25 - name: Cache generated data uses: actions/cache@v5.0.4 with: path: | plugin/build/minecraft/ plugin/build/generated/minecraft/mapping/ key: minecraft-${{ hashFiles('gradle.properties') }} - name: Build LimboAPI run: ./gradlew build - name: Upload LimboAPI uses: actions/upload-artifact@v4.6.2 with: name: LimboAPI path: "*/build/libs/*.jar" - uses: dev-drprasad/delete-tag-and-release@v0.2.1 if: ${{ github.event_name == 'push' }} with: delete_release: true tag_name: dev-build env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Find git version id: git-version run: echo "id=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Find correct JAR if: ${{ github.event_name == 'push' }} id: find-jar run: | output="$(find plugin/build/libs/ ! -name "*-javadoc.jar" ! -name "*-sources.jar" -type f -printf "%f\n")" echo "::set-output name=jarname::$output" - name: Release the build if: ${{ github.event_name == 'push' }} uses: ncipollo/release-action@v1 with: artifacts: plugin/build/libs/${{ steps.find-jar.outputs.jarname }} body: ${{ join(github.event.commits.*.message, '\n') }} prerelease: true name: Dev-build ${{ steps.git-version.outputs.id }} tag: dev-build - name: Upload to Modrinth if: ${{ github.event_name == 'push' }} uses: RubixDev/modrinth-upload@v1.0.0 with: token: ${{ secrets.MODRINTH_TOKEN }} file_path: plugin/build/libs/${{ steps.find-jar.outputs.jarname }} name: Dev-build ${{ steps.git-version.outputs.id }} version: ${{ steps.git-version.outputs.id }} changelog: ${{ join(github.event.commits.*.message, '\n') }} game_versions: 1.7.2 release_type: beta loaders: velocity featured: false project_id: TZOteSf2 ================================================ FILE: .github/workflows/release.yml ================================================ name: Java CI with Gradle on: release: types: [published] jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4.2.2 - name: Set up JDK uses: actions/setup-java@v4.7.0 with: distribution: temurin java-version: 25 - name: Cache generated data uses: actions/cache@v5.0.4 with: path: | plugin/build/minecraft/ plugin/build/generated/minecraft/mapping/ key: minecraft-${{ hashFiles('gradle.properties') }} - name: Build LimboAPI run: ./gradlew build - name: Upload LimboAPI uses: actions/upload-artifact@v4.6.2 with: name: LimboAPI path: "*/build/libs/*.jar" - name: Find correct JAR id: find-jar run: | output="$(find plugin/build/libs/ ! -name "*-javadoc.jar" ! -name "*-sources.jar" -type f -printf "%f\n")" echo "::set-output name=jarname::$output" - name: Upload to the GitHub release uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} asset_path: plugin/build/libs/${{ steps.find-jar.outputs.jarname }} asset_name: ${{ steps.find-jar.outputs.jarname }} asset_content_type: application/java-archive - name: Upload to Modrinth uses: RubixDev/modrinth-upload@v1.0.0 with: token: ${{ secrets.MODRINTH_TOKEN }} file_path: plugin/build/libs/${{ steps.find-jar.outputs.jarname }} name: Release ${{ github.event.release.tag_name }} version: ${{ github.event.release.tag_name }} changelog: ${{ github.event.release.body }} game_versions: 1.7.2 release_type: release loaders: velocity featured: true project_id: TZOteSf2 ================================================ FILE: .gitignore ================================================ # IntelliJ user-specific stuff .idea/ *.iml # Compiled class file *.class # Log file *.log # Package Files *.jar *.zip *.tar.gz *.rar # Virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* *~ # Temporary files which can be created if a process still has a handle open of a deleted file .fuse_hidden* # KDE directory preferences .directory # Linux trash folder which might appear on any partition or disk .Trash-* # .nfs files are created when an open file is removed but is still being accessed .nfs* # General .DS_Store .AppleDouble .LSOverride # Icon must end with two \r Icon # Thumbnails ._* # Files that might appear in the root of a volume .DocumentRevisions-V100 .fseventsd .Spotlight-V100 .TemporaryItems .Trashes .VolumeIcon.icns .com.apple.timemachine.donotpresent # Directories potentially created on remote AFP share .AppleDB .AppleDesktop Network Trash Folder Temporary Items .apdisk # Windows thumbnail cache files Thumbs.db Thumbs.db:encryptable ehthumbs.db ehthumbs_vista.db # Dump file *.stackdump # Folder config file [Dd]esktop.ini # Recycle Bin used on file shares $RECYCLE.BIN/ # Windows Installer files *.cab *.msi *.msix *.msm *.msp # Windows shortcuts *.lnk # Gradle .gradle build/ # Gradle Patch **/build/ # Common working directory run/ # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) !gradle-wrapper.jar ================================================ FILE: HEADER.txt ================================================ Copyright (C) 2021 - 2025 Elytrium This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . ================================================ FILE: HEADER_MCPROTOCOLLIB.txt ================================================ This file is part of MCProtocolLib, licensed under the MIT License (MIT). Copyright (C) 2013-2021 Steveice10 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: HEADER_MIXED.txt ================================================ Copyright (C) 2021 - 2025 Elytrium This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . This file contains some parts of Velocity, licensed under the AGPLv3 License (AGPLv3). Copyright (C) 2018 Velocity Contributors This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ================================================ FILE: LICENSE ================================================ GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . ================================================ FILE: README.md ================================================ Elytrium # LimboAPI [![Join our Discord](https://img.shields.io/discord/775778822334709780.svg?logo=discord&label=Discord)](https://ely.su/discord) ![Modrinth Game Versions](https://img.shields.io/modrinth/game-versions/TZOteSf2?logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAIkAAAA8CAMAAABl%2FWk9AAABAlBMVEUAAAAApcwAqM4Apc4Ap88Apc4Apc4AqM0Aps0Ap84Apc0ApswApc4Aps0Ap80Aps4Ap80Aps0Ap84Aps0Aps4Aps0EqdAHrNMKrtQNsdcRtNoVttwWtt0buuAbuuAbuuAauuAbuuEauuAbu%2BAbuuAbuuEbu%2BAbuuEau%2BAbuuAbuuEau%2BEauuAbuuAbueAbuuAau%2BEbuuAauuAauuAbuuEauuEau%2BAbuuAau%2BEbu%2BAWtt0bvOAau%2BEZuOEYt94cvOEUtt8YudsVsdYAn90A%2F%2F8CqM8Ap84Bp84Aps0Ap80Aps0Aps0Aps0auuAauuAbuuAbuuAauuAauuAbuuAAps0buuCTPBtaAAAAVHRSTlMAIhwzOj5ESk1aZnB3f4iTnKWqrrW7xMDCxdDa3%2BDc2tbMxcC8uLOvp6KflpCHgXl1b15ZVE5EQDovKSQhHRcRDAgFAgHL1Nne5e30%2FPj08e3q5vwu6%2BLEAAADTUlEQVR42sXXhXLDPAzAcY2ZGcrMzAzjYhK9%2F6N8YA8zW62Xwu9gvOp6yt8JTKmSjXnHA18Jlqn63xAj5IbLGqWWi%2FvH%2BJ2jufwh3oUXPYSGMmlYjFLcN0aRkc%2BJzKACi5DUUSzQBMj22aeuNsxfUTaIjS1qBJkozF3XRS9HBrkczFsGJVwd9vMEcqMazFfLhhIF9vO2Hd%2B5T05n4GAVJJIoEQAmhZ%2BujFl4lYxSH6KYXmY%2Fb4y%2BfevBmIVDEIqiRFTw8%2FGrMQMnIFLuo9iwzg%2FCnz%2B%2F7RnW7YFIACWSwASRm%2BGqXLZAoIASthaPHprojwbh7Xh%2Fkr3NtlrUMsC40UwjVuW1DH%2BVlkaty36exd9uDKn9OUStyKPmQBN6VbbgrxIToybSf5rle0JHrV%2F5iJrQ%2FZtsT1bgbyJTRU1lVd6OdoV23kdc2dnoqkRNa3xETebSUNRjNdvrGcaFoCZ%2BFBsVP6ImNXhRHmUVYKVnWiYyarozVgemioRrQ9U2wA775BxMOr%2Bj5gimCk34kELCnaFqDWCdfXJER80eTLIhvokh4dZQwt%2BJ7jm%2FvoRR40PkG3R%2F6ZXtPV5McrbXZqXcOz1aEUdtGONDiNQHKHXPdo97WQPOStSGJeUCcw%2BzSPz3aEXgt2atBVzHO82W9NpgCX8ATpiGKKaCDh37%2FjIwdQ2F9B8HTx0s4Tvg%2Bz5EyKnjuyFvWzevTxH7Q7DEh0yyYx6C0%2BrAxKYJ7PHGyh%2B1AKDUR8bm5UOYefnjX9tN3J9Y1ztpAiSRlgCmNkKz8ZsxO0cAXT%2BS9CIwOSpq1r3wC4NkawATIaJm3TM7i3Uk%2Bbt8VVzyqFl38H5h0FLAVIaSqFn3fNDmDfUgqV8CJiOJGu14pQNTq42QZG8CE5JEjXIKXVCQQ1oQmKZN%2Fa5xU%2FkgpKWBSapHbQPUtF1IGpT5pqhH7QgUVYZIcrZ4U5Sj1ttvgZo00vxN6KZ1ZO6UotZ7NnvYbwMhjLSBxza7qJ0AoelEwqyjVgdCaYAEMmrqykBJ4VRuZpH3DpACOIXB6wwGWQNaw4YT9dOblq21YJJiH0maP1GDxUigzMgdy9VhcTo%2B%2FG3ojqbLsGh1jRhisQp95Ma%2BWK4Gy1T0DLQlDPEv1X2Xr4VYWO8AAAAASUVORK5CYII%3D) ![Modrinth Downloads](https://img.shields.io/modrinth/dt/TZOteSf2?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iNTEyIiBoZWlnaHQ9IjUxNCIgdmlld0JveD0iMCAwIDUxMiA1MTQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI%2BCiAgPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik01MDMuMTYgMzIzLjU2QzUxNC41NSAyODEuNDcgNTE1LjMyIDIzNS45MSA1MDMuMiAxOTAuNzZDNDY2LjU3IDU0LjIyOTkgMzI2LjA0IC0yNi44MDAxIDE4OS4zMyA5Ljc3OTkxQzgzLjgxMDEgMzguMDE5OSAxMS4zODk5IDEyOC4wNyAwLjY4OTk0MSAyMzAuNDdINDMuOTlDNTQuMjkgMTQ3LjMzIDExMy43NCA3NC43Mjk4IDE5OS43NSA1MS43MDk4QzMwNi4wNSAyMy4yNTk4IDQxNS4xMyA4MC42Njk5IDQ1My4xNyAxODEuMzhMNDExLjAzIDE5Mi42NUMzOTEuNjQgMTQ1LjggMzUyLjU3IDExMS40NSAzMDYuMyA5Ni44MTk4TDI5OC41NiAxNDAuNjZDMzM1LjA5IDE1NC4xMyAzNjQuNzIgMTg0LjUgMzc1LjU2IDIyNC45MUMzOTEuMzYgMjgzLjggMzYxLjk0IDM0NC4xNCAzMDguNTYgMzY5LjE3TDMyMC4wOSA0MTIuMTZDMzkwLjI1IDM4My4yMSA0MzIuNCAzMTAuMyA0MjIuNDMgMjM1LjE0TDQ2NC40MSAyMjMuOTFDNDY4LjkxIDI1Mi42MiA0NjcuMzUgMjgxLjE2IDQ2MC41NSAzMDguMDdMNTAzLjE2IDMyMy41NloiIGZpbGw9IiMxYmQ5NmEiLz4KICA8cGF0aCBkPSJNMzIxLjk5IDUwNC4yMkMxODUuMjcgNTQwLjggNDQuNzUwMSA0NTkuNzcgOC4xMTAxMSAzMjMuMjRDMy44NDAxMSAzMDcuMzEgMS4xNyAyOTEuMzMgMCAyNzUuNDZINDMuMjdDNDQuMzYgMjg3LjM3IDQ2LjQ2OTkgMjk5LjM1IDQ5LjY3OTkgMzExLjI5QzUzLjAzOTkgMzIzLjggNTcuNDUgMzM1Ljc1IDYyLjc5IDM0Ny4wN0wxMDEuMzggMzIzLjkyQzk4LjEyOTkgMzE2LjQyIDk1LjM5IDMwOC42IDkzLjIxIDMwMC40N0M2OS4xNyAyMTAuODcgMTIyLjQxIDExOC43NyAyMTIuMTMgOTQuNzYwMUMyMjkuMTMgOTAuMjEwMSAyNDYuMjMgODguNDQwMSAyNjIuOTMgODkuMTUwMUwyNTUuMTkgMTMzQzI0NC43MyAxMzMuMDUgMjM0LjExIDEzNC40MiAyMjMuNTMgMTM3LjI1QzE1Ny4zMSAxNTQuOTggMTE4LjAxIDIyMi45NSAxMzUuNzUgMjg5LjA5QzEzNi44NSAyOTMuMTYgMTM4LjEzIDI5Ny4xMyAxMzkuNTkgMzAwLjk5TDE4OC45NCAyNzEuMzhMMTc0LjA3IDIzMS45NUwyMjAuNjcgMTg0LjA4TDI3OS41NyAxNzEuMzlMMjk2LjYyIDE5Mi4zOEwyNjkuNDcgMjE5Ljg4TDI0NS43OSAyMjcuMzNMMjI4Ljg3IDI0NC43MkwyMzcuMTYgMjY3Ljc5QzIzNy4xNiAyNjcuNzkgMjUzLjk1IDI4NS42MyAyNTMuOTggMjg1LjY0TDI3Ny43IDI3OS4zM0wyOTQuNTggMjYwLjc5TDMzMS40NCAyNDkuMTJMMzQyLjQyIDI3My44MkwzMDQuMzkgMzIwLjQ1TDI0MC42NiAzNDAuNjNMMjEyLjA4IDMwOC44MUwxNjIuMjYgMzM4LjdDMTg3LjggMzY3Ljc4IDIyNi4yIDM4My45MyAyNjYuMDEgMzgwLjU2TDI3Ny41NCA0MjMuNTVDMjE4LjEzIDQzMS40MSAxNjAuMSA0MDYuODIgMTI0LjA1IDM2MS42NEw4NS42Mzk5IDM4NC42OEMxMzYuMjUgNDUxLjE3IDIyMy44NCA0ODQuMTEgMzA5LjYxIDQ2MS4xNkMzNzEuMzUgNDQ0LjY0IDQxOS40IDQwMi41NiA0NDUuNDIgMzQ5LjM4TDQ4OC4wNiAzNjQuODhDNDU3LjE3IDQzMS4xNiAzOTguMjIgNDgzLjgyIDMyMS45OSA1MDQuMjJaIiBmaWxsPSIjMWJkOTZhIi8%2BCjwvc3ZnPg%3D%3D) [![Proxy Stats](https://img.shields.io/bstats/servers/12530?logo=minecraft&label=Servers)](https://bstats.org/plugin/velocity/LimboAPI/12530) [![Proxy Stats](https://img.shields.io/bstats/players/12530?logo=minecraft&label=Players)](https://bstats.org/plugin/velocity/LimboAPI/12530) Library for sending players to virtual servers (called limbo) \ [Описание и обсуждение на русском языке (spigotmc.ru)](https://spigotmc.ru/resources/limboapi-limboauth-limbofilter-virtualnye-servera-dlja-velocity.715/) \ [Описание и обсуждение на русском языке (rubukkit.org)](http://rubukkit.org/threads/limboapi-limboauth-limbofilter-virtualnye-servera-dlja-velocity.177904/) Test server: [``ely.su``](https://hotmc.ru/minecraft-server-203216) ## See also - [LimboAuth](https://github.com/Elytrium/LimboAuth) - Auth System built in virtual server (Limbo). Uses BCrypt, has TOTP 2FA feature. Supports literally any database due to OrmLite. - [LimboFilter](https://github.com/Elytrium/LimboFilter) - Most powerful bot filtering solution for Minecraft proxies. Built with LimboAPI. ## Features of LimboAPI - Send to the Limbo server during login process - Send to the Limbo server during play process - Send maps, items to player's virtual inventory - Display player's XP - Send Title, Chat, ActionBar - Load world from world files like .schematic - and more... ## How to - Include ``limboapi-api`` to your Maven/Gradle project as compile-only - Subscribe to ``LoginLimboRegisterEvent`` to send players to the Limbo server during login process - Use ``LimboFactory`` to send players to the Limbo server during play process ## How to include it #### Setup your project via adding our maven repository to your pom.xml or build.gradle file. - Maven: ```xml elytrium-repo https://maven.elytrium.net/repo/ net.elytrium.limboapi api 1.1.26 provided ``` - Gradle: ```groovy repositories { maven { setName("elytrium-repo") setUrl("https://maven.elytrium.net/repo/") } } dependencies { compileOnly("net.elytrium.limboapi:api:1.1.26") } ``` ## Used Open Source projects - [ProtocolSupport](https://github.com/ProtocolSupport/ProtocolSupport) - for modern->legacy block mappings - [ViaVersion](https://github.com/ViaVersion/ViaVersion) - for modern string->integer block mappings ## Demo - [LimboAuth](https://github.com/Elytrium/LimboAuth) - The auth plugin, that uses LimboAPI as a dependency at the basic level. - [LimboFilter](https://github.com/Elytrium/LimboFilter) - The antibot solution, that uses LimboAPI as a dependency, using almost all available API methods, like Low-level Minecraft packet control. ## Donation Your donations are really appreciated. Donations wallets/links/cards: - MasterCard Debit Card (Tinkoff Bank): ``5536 9140 0599 1975`` - Qiwi Wallet: ``PFORG`` or [this link](https://my.qiwi.com/form/Petr-YSpyiLt9c6) - YooMoney Wallet: ``4100 1721 8467 044`` or [this link](https://yoomoney.ru/quickpay/shop-widget?writer=seller&targets=Donation&targets-hint=&default-sum=&button-text=11&payment-type-choice=on&mobile-payment-type-choice=on&hint=&successURL=&quickpay=shop&account=410017218467044) - Monero (XMR): 86VQyCz68ApebfFgrzRFAuYLdvd3qG8iT9RHcru9moQkJR9W2Q89Gt3ecFQcFu6wncGwGJsMS9E8Bfr9brztBNbX7Q2rfYS ================================================ FILE: VERSION ================================================ 1.1.26 ================================================ FILE: api/HEADER.txt ================================================ Copyright (C) 2021 - 2025 Elytrium The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, reference the LICENSE file in the api top-level directory. ================================================ FILE: api/LICENSE ================================================ Copyright 2021 Elytrium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: api/build.gradle.kts ================================================ @file:Suppress("GroovyAssignabilityCheck") import net.minecraftforge.licenser.LicenseExtension import net.minecraftforge.licenser.LicenseProperties import org.gradle.kotlin.dsl.closureOf plugins { `java-library` `maven-publish` } tasks.withType { options.release.set(21) options.encoding = "UTF-8" } dependencies { compileOnly(libs.minecraft.velocity.api) api(libs.elytrium.commons.config) api(libs.elytrium.commons.utils) api(libs.elytrium.commons.velocity) api(libs.elytrium.commons.kyori) api(libs.minecraft.adventure.nbt) compileOnly(libs.tool.spotbugs.annotations) } extensions.configure { matching( "**/mcprotocollib/**", closureOf { setHeader(rootProject.file("HEADER_MCPROTOCOLLIB.txt")) } ) setHeader(file("HEADER.txt")) } tasks.named("javadoc") { options.encoding = "UTF-8" (options as? StandardJavadocDocletOptions)?.apply { source = "21" links("https://docs.oracle.com/en/java/javase/11/docs/api/") addStringOption("Xdoclint:none", "-quiet") if (JavaVersion.current() >= JavaVersion.VERSION_1_9 && JavaVersion.current() < JavaVersion.VERSION_12) { addBooleanOption("-no-module-directories", true) } } } val sourcesJar by tasks.registering(Jar::class) { archiveClassifier.set("sources") from(sourceSets.main.get().allSource) } val javadocJar by tasks.registering(Jar::class) { archiveClassifier.set("javadoc") from(tasks.javadoc) } publishing { repositories { maven { credentials { username = System.getenv("ELYTRIUM_MAVEN_USERNAME") password = System.getenv("ELYTRIUM_MAVEN_PASSWORD") } name = "elytrium-repo" url = uri("https://maven.elytrium.net/repo/") } } publications.create("publication") { from(components["java"]) artifact(javadocJar) artifact(sourcesJar) } } artifacts { archives(javadocJar) archives(sourcesJar) } @Suppress("UNCHECKED_CAST") val getCurrentShortRevision = rootProject.extra["getCurrentShortRevision"] as () -> String val versionStringProvider = provider { if (version.toString().contains("-")) { "${version} (git-${getCurrentShortRevision()})" } else { version.toString() } } val copyTask by tasks.register("generateTemplates") { val versionString = versionStringProvider.get() inputs.property("version", versionString) from(file("src/main/templates")) into(layout.buildDirectory.dir("generated/sources/templates")) expand("version" to versionString) } sourceSets.main.configure { java.srcDir(copyTask.outputs) } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/Limbo.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api; import com.velocitypowered.api.command.Command; import com.velocitypowered.api.command.CommandMeta; import com.velocitypowered.api.proxy.Player; import java.util.function.Supplier; import net.elytrium.limboapi.api.command.LimboCommandMeta; import net.elytrium.limboapi.api.player.GameMode; import net.elytrium.limboapi.api.protocol.PacketDirection; import net.elytrium.limboapi.api.protocol.packets.PacketMapping; public interface Limbo { void spawnPlayer(Player player, LimboSessionHandler handler); void respawnPlayer(Player player); long getCurrentOnline(); Limbo setName(String name); Limbo setReadTimeout(int millis); Limbo setWorldTime(long ticks); Limbo setGameMode(GameMode gameMode); Limbo setShouldRejoin(boolean shouldRejoin); Limbo setShouldRespawn(boolean shouldRespawn); @Deprecated Limbo setShouldUpdateTags(boolean shouldUpdateTags); Limbo setReducedDebugInfo(boolean reducedDebugInfo); Limbo setViewDistance(int viewDistance); Limbo setSimulationDistance(int simulationDistance); Limbo setMaxSuppressPacketLength(int maxSuppressPacketLength); Limbo registerCommand(LimboCommandMeta commandMeta); Limbo registerCommand(CommandMeta commandMeta, Command command); Limbo registerPacket(PacketDirection direction, Class packetClass, Supplier packetSupplier, PacketMapping[] packetMappings); void dispose(); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/LimboFactory.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.proxy.Player; import java.io.IOException; import java.io.InputStream; import java.nio.file.Path; import java.util.Map; import net.elytrium.limboapi.api.chunk.BuiltInBiome; import net.elytrium.limboapi.api.chunk.Dimension; import net.elytrium.limboapi.api.chunk.VirtualBiome; import net.elytrium.limboapi.api.chunk.VirtualBlock; import net.elytrium.limboapi.api.chunk.VirtualBlockEntity; import net.elytrium.limboapi.api.chunk.VirtualChunk; import net.elytrium.limboapi.api.chunk.VirtualWorld; import net.elytrium.limboapi.api.file.BuiltInWorldFileType; import net.elytrium.limboapi.api.file.WorldFile; import net.elytrium.limboapi.api.material.Block; import net.elytrium.limboapi.api.material.Item; import net.elytrium.limboapi.api.material.VirtualItem; import net.elytrium.limboapi.api.protocol.PreparedPacket; import net.elytrium.limboapi.api.protocol.item.ItemComponentMap; import net.elytrium.limboapi.api.protocol.packets.PacketFactory; import net.kyori.adventure.nbt.CompoundBinaryTag; public interface LimboFactory { /** * Creates new virtual block from Block enum. * * @param block Block from Block enum. * * @return new virtual block. */ VirtualBlock createSimpleBlock(Block block); /** * Creates new virtual block from id and data. * * @param legacyID Legacy block id. (1.12.2 and lower) * * @return new virtual block. */ VirtualBlock createSimpleBlock(short legacyID); /** * Creates new virtual block from id and data. * * @param modernID Modern block id. * * @return new virtual block. */ VirtualBlock createSimpleBlock(String modernID); /** * Creates new virtual block from id and data. * * @param modernID Modern block id. * @param properties Modern properties like {"waterlogged": "true"}. * * @return new virtual block. */ VirtualBlock createSimpleBlock(String modernID, Map properties); /** * Creates new virtual block from id and data. * * @param legacyID Block id. * @param modern Use the latest supported version ids or 1.12.2 and lower. * * @return new virtual block. */ VirtualBlock createSimpleBlock(short legacyID, boolean modern); /** * Creates new virtual customizable block. * * @param solid Defines if the block is solid or not. * @param air Defines if the block is the air. * @param motionBlocking Defines if the block blocks motions. (1.14+) * @param id Block protocol id. * * @return new virtual block. */ VirtualBlock createSimpleBlock(boolean solid, boolean air, boolean motionBlocking, short id); /** * Creates new virtual customizable block. * * @param solid Defines if the block is solid or not. * @param air Defines if the block is the air. * @param motionBlocking Defines if the block blocks motions. (1.14+) * @param modernID Block id. * @param properties Modern properties like {"waterlogged": "true"}. * * @return new virtual block. */ VirtualBlock createSimpleBlock(boolean solid, boolean air, boolean motionBlocking, String modernID, Map properties); /** * Creates new virtual world. * * @param dimension World dimension. * @param posX Spawn location. (X) * @param posY Spawn location. (Y) * @param posZ Spawn location. (Z) * @param yaw Spawn rotation. (Yaw) * @param pitch Spawn rotation. (Pitch) * * @return new virtual world. */ VirtualWorld createVirtualWorld(Dimension dimension, double posX, double posY, double posZ, float yaw, float pitch); /** * Creates new virtual chunk with plain biomes set as default. * You need to provide the chunk location, you can get it using {@code blockCoordinate >> 4}. * * @param posX Chunk location. (X) * @param posZ Chunk location. (Z) * * @return new virtual chunk. */ @Deprecated VirtualChunk createVirtualChunk(int posX, int posZ); /** * Creates new virtual chunk. * You need to provide the chunk location, you can get it using {@code blockCoordinate >> 4}. * * @param posX Chunk location. (X) * @param posZ Chunk location. (Z) * @param defaultBiome Default biome to fill it. * * @return new virtual chunk. */ VirtualChunk createVirtualChunk(int posX, int posZ, VirtualBiome defaultBiome); /** * Creates new virtual chunk. * You need to provide the chunk location, you can get it using ({@code block_coordinate >> 4}) * * @param posX Chunk location. (X) * @param posZ Chunk location. (Z) * @param defaultBiome Default biome to fill it. * * @return new virtual chunk. */ VirtualChunk createVirtualChunk(int posX, int posZ, BuiltInBiome defaultBiome); /** * Creates new virtual server. * * @param world Virtual world. * * @return new virtual server. */ Limbo createLimbo(VirtualWorld world); /** * Releases a thread after PreparedPacket#build executions. * Used to free compression libraries. */ void releasePreparedPacketThread(Thread thread); /** * Creates new prepared packet builder. * * @return new prepared packet. */ PreparedPacket createPreparedPacket(); /** * Creates new prepared packet builder. * * @param minVersion Minimum version to prepare. * @param maxVersion Maximum version to prepare. * * @return new prepared packet. */ PreparedPacket createPreparedPacket(ProtocolVersion minVersion, ProtocolVersion maxVersion); /** * Creates new prepared packet builder for the CONFIG state. * * @return new prepared packet. */ PreparedPacket createConfigPreparedPacket(); /** * Creates new prepared packet builder for the CONFIG state. * * @param minVersion Minimum version to prepare. * @param maxVersion Maximum version to prepare. * * @return new prepared packet. */ PreparedPacket createConfigPreparedPacket(ProtocolVersion minVersion, ProtocolVersion maxVersion); /** * Pass the player to the next Login Limbo, without spawning at current Limbo. * * @param player Player to pass. */ void passLoginLimbo(Player player); /** * Creates new virtual item from Item enum. * * @param item Item from item enum. * * @return new virtual item. */ VirtualItem getItem(Item item); /** * Creates new virtual item from Item enum. * * @param itemID Modern item identifier. * * @return new virtual item. */ VirtualItem getItem(String itemID); /** * Creates new virtual item from Item enum. * * @param itemLegacyID Legacy item ID * * @return new virtual item. */ VirtualItem getLegacyItem(int itemLegacyID); /** * Creates new item component map. * * @return new item component map */ ItemComponentMap createItemComponentMap(); VirtualBlockEntity getBlockEntity(String entityID); /** * A factory to instantiate Minecraft packet objects. */ PacketFactory getPacketFactory(); ProtocolVersion getPrepareMinVersion(); ProtocolVersion getPrepareMaxVersion(); /** * Opens world file (a.k.a. schematic file) * * @param apiType World file type * @param file World file * @return Ready to use WorldFile */ WorldFile openWorldFile(BuiltInWorldFileType apiType, Path file) throws IOException; /** * Opens world file (a.k.a. schematic file) * * @param apiType World file type * @param stream World file stream * @return Ready to use WorldFile */ WorldFile openWorldFile(BuiltInWorldFileType apiType, InputStream stream) throws IOException; /** * Opens world file (a.k.a. schematic file) * * @param apiType World file type * @param tag World file NBT tag * @return Ready to use WorldFile */ WorldFile openWorldFile(BuiltInWorldFileType apiType, CompoundBinaryTag tag); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/LimboSessionHandler.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api; import net.elytrium.limboapi.api.player.LimboPlayer; public interface LimboSessionHandler { default void onSpawn(Limbo server, LimboPlayer player) { } default void onConfig(Limbo server, LimboPlayer player) { } default void onMove(double posX, double posY, double posZ) { } default void onMove(double posX, double posY, double posZ, float yaw, float pitch) { } default void onRotate(float yaw, float pitch) { } default void onGround(boolean onGround) { } default void onTeleport(int teleportID) { } default void onChat(String chat) { } /** * @param packet Any velocity built-in packet or any packet registered via {@link Limbo#registerPacket}. */ default void onGeneric(Object packet) { } default void onDisconnect() { } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/chunk/BlockEntityVersion.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.chunk; import com.velocitypowered.api.network.ProtocolVersion; import java.util.Arrays; import java.util.EnumMap; import java.util.EnumSet; import java.util.Map; import java.util.Set; import net.elytrium.limboapi.api.utils.EnumUniverse; public enum BlockEntityVersion { LEGACY(EnumSet.range(ProtocolVersion.MINECRAFT_1_7_2, ProtocolVersion.MINECRAFT_1_18_2)), MINECRAFT_1_19(EnumSet.of(ProtocolVersion.MINECRAFT_1_19)), MINECRAFT_1_19_1(EnumSet.of(ProtocolVersion.MINECRAFT_1_19_1)), MINECRAFT_1_19_3(EnumSet.of(ProtocolVersion.MINECRAFT_1_19_3)), MINECRAFT_1_19_4(EnumSet.of(ProtocolVersion.MINECRAFT_1_19_4)), MINECRAFT_1_20(EnumSet.of(ProtocolVersion.MINECRAFT_1_20)), MINECRAFT_1_20_2(EnumSet.of(ProtocolVersion.MINECRAFT_1_20_2)), MINECRAFT_1_20_3(EnumSet.of(ProtocolVersion.MINECRAFT_1_20_3)), MINECRAFT_1_20_5(EnumSet.of(ProtocolVersion.MINECRAFT_1_20_5)), MINECRAFT_1_21(EnumSet.of(ProtocolVersion.MINECRAFT_1_21)), MINECRAFT_1_21_2(EnumSet.of(ProtocolVersion.MINECRAFT_1_21_2)), MINECRAFT_1_21_4(EnumSet.of(ProtocolVersion.MINECRAFT_1_21_4)), MINECRAFT_1_21_5(EnumSet.of(ProtocolVersion.MINECRAFT_1_21_5)), MINECRAFT_1_21_6(EnumSet.of(ProtocolVersion.MINECRAFT_1_21_6)), MINECRAFT_1_21_7(EnumSet.of(ProtocolVersion.MINECRAFT_1_21_7)), MINECRAFT_1_21_9(EnumSet.of(ProtocolVersion.MINECRAFT_1_21_9)), MINECRAFT_1_21_11(EnumSet.of(ProtocolVersion.MINECRAFT_1_21_11)), MINECRAFT_26_1(EnumSet.of(ProtocolVersion.MINECRAFT_26_1)); private static final EnumMap MC_VERSION_TO_ITEM_VERSIONS = new EnumMap<>(ProtocolVersion.class); private static final Map KEY_LOOKUP = Map.copyOf(EnumUniverse.createProtocolLookup(values())); private final Set versions; BlockEntityVersion(ProtocolVersion... versions) { this.versions = EnumSet.copyOf(Arrays.asList(versions)); } BlockEntityVersion(Set versions) { this.versions = versions; } public ProtocolVersion getMinSupportedVersion() { return this.versions.iterator().next(); } public Set getVersions() { return this.versions; } static { for (BlockEntityVersion version : BlockEntityVersion.values()) { for (ProtocolVersion protocolVersion : version.getVersions()) { MC_VERSION_TO_ITEM_VERSIONS.put(protocolVersion, version); } } } public static BlockEntityVersion parse(String from) { return KEY_LOOKUP.getOrDefault(from, LEGACY); } public static BlockEntityVersion from(ProtocolVersion protocolVersion) { return MC_VERSION_TO_ITEM_VERSIONS.get(protocolVersion); } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/chunk/BuiltInBiome.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.chunk; public enum BuiltInBiome { PLAINS, SWAMP, SWAMP_HILLS, NETHER_WASTES, THE_END } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/chunk/Dimension.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.chunk; public enum Dimension { OVERWORLD("minecraft:overworld", 0, 0, 28, true, BuiltInBiome.PLAINS), // (384 + 64) / 16 NETHER("minecraft:the_nether", -1, 1, 16, false, BuiltInBiome.NETHER_WASTES), // 256 / 16 THE_END("minecraft:the_end", 1, 2, 16, false, BuiltInBiome.THE_END); // 256 / 16 private final String key; private final int legacyID; private final int modernID; private final int maxSections; private final boolean hasLegacySkyLight; private final BuiltInBiome defaultBiome; Dimension(String key, int legacyID, int modernID, int maxSections, boolean hasLegacySkyLight, BuiltInBiome defaultBiome) { this.key = key; this.legacyID = legacyID; this.modernID = modernID; this.maxSections = maxSections; this.hasLegacySkyLight = hasLegacySkyLight; this.defaultBiome = defaultBiome; } public String getKey() { return this.key; } public int getLegacyID() { return this.legacyID; } public int getModernID() { return this.modernID; } public int getMaxSections() { return this.maxSections; } public boolean hasLegacySkyLight() { return this.hasLegacySkyLight; } public BuiltInBiome getDefaultBiome() { return this.defaultBiome; } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/chunk/VirtualBiome.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.chunk; public interface VirtualBiome { String getName(); int getID(); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/chunk/VirtualBlock.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.chunk; import com.velocitypowered.api.network.ProtocolVersion; import net.elytrium.limboapi.api.material.WorldVersion; public interface VirtualBlock { short getModernID(); String getModernStringID(); @Deprecated short getID(ProtocolVersion version); short getBlockID(WorldVersion version); short getBlockID(ProtocolVersion version); boolean isSupportedOn(ProtocolVersion version); boolean isSupportedOn(WorldVersion version); short getBlockStateID(ProtocolVersion version); boolean isSolid(); boolean isAir(); boolean isMotionBlocking(); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/chunk/VirtualBlockEntity.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.chunk; import com.velocitypowered.api.network.ProtocolVersion; import net.kyori.adventure.nbt.CompoundBinaryTag; public interface VirtualBlockEntity { int getID(ProtocolVersion version); int getID(BlockEntityVersion version); boolean isSupportedOn(ProtocolVersion version); boolean isSupportedOn(BlockEntityVersion version); String getModernID(); Entry getEntry(int posX, int posY, int posZ, CompoundBinaryTag nbt); interface Entry { VirtualBlockEntity getBlockEntity(); int getPosX(); int getPosY(); int getPosZ(); CompoundBinaryTag getNbt(); int getID(ProtocolVersion version); int getID(BlockEntityVersion version); boolean isSupportedOn(ProtocolVersion version); boolean isSupportedOn(BlockEntityVersion version); } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/chunk/VirtualChunk.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.chunk; import net.elytrium.limboapi.api.chunk.data.ChunkSnapshot; import net.kyori.adventure.nbt.CompoundBinaryTag; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.common.value.qual.IntRange; public interface VirtualChunk { void setBlock(int posX, int posY, int posZ, @Nullable VirtualBlock block); void setBlockEntity(int posX, int posY, int posZ, @Nullable CompoundBinaryTag nbt, @Nullable VirtualBlockEntity blockEntity); void setBlockEntity(VirtualBlockEntity.Entry blockEntityEntry); @NonNull VirtualBlock getBlock(int posX, int posY, int posZ); void setBiome2D(int posX, int posZ, @NonNull VirtualBiome biome); void setBiome3D(int posX, int posY, int posZ, @NonNull VirtualBiome biome); @NonNull VirtualBiome getBiome(int posX, int posY, int posZ); void setBlockLight(int posX, int posY, int posZ, byte light); byte getBlockLight(int posX, int posY, int posZ); void setSkyLight(int posX, int posY, int posZ, byte light); byte getSkyLight(int posX, int posY, int posZ); void fillBlockLight(@IntRange(from = 0, to = 15) int level); void fillSkyLight(@IntRange(from = 0, to = 15) int level); int getPosX(); int getPosZ(); ChunkSnapshot getFullChunkSnapshot(); ChunkSnapshot getPartialChunkSnapshot(long previousUpdate); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/chunk/VirtualWorld.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.chunk; import java.util.List; import net.kyori.adventure.nbt.CompoundBinaryTag; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.common.value.qual.IntRange; public interface VirtualWorld { void setBlockEntity(int posX, int posY, int posZ, @Nullable CompoundBinaryTag nbt, @Nullable VirtualBlockEntity blockEntity); @NonNull VirtualBlock getBlock(int posX, int posY, int posZ); void setBiome2d(int posX, int posZ, @NonNull VirtualBiome biome); void setBiome3d(int posX, int posY, int posZ, @NonNull VirtualBiome biome); VirtualBiome getBiome(int posX, int posY, int posZ); byte getBlockLight(int posX, int posY, int posZ); void setBlockLight(int posX, int posY, int posZ, byte light); void fillBlockLight(@IntRange(from = 0, to = 15) int level); void fillSkyLight(@IntRange(from = 0, to = 15) int level); List getChunks(); List> getOrderedChunks(); @Nullable VirtualChunk getChunk(int posX, int posZ); VirtualChunk getChunkOrNew(int posX, int posZ); @NonNull Dimension getDimension(); double getSpawnX(); double getSpawnY(); double getSpawnZ(); float getYaw(); float getPitch(); void setBlock(int posX, int posY, int posZ, @Nullable VirtualBlock block); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/chunk/data/BlockSection.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.chunk.data; import net.elytrium.limboapi.api.chunk.VirtualBlock; import org.checkerframework.checker.nullness.qual.Nullable; public interface BlockSection { void setBlockAt(int posX, int posY, int posZ, @Nullable VirtualBlock block); VirtualBlock getBlockAt(int posX, int posY, int posZ); BlockSection getSnapshot(); long getLastUpdate(); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/chunk/data/BlockStorage.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.chunk.data; import com.velocitypowered.api.network.ProtocolVersion; import net.elytrium.limboapi.api.chunk.VirtualBlock; import org.checkerframework.checker.nullness.qual.NonNull; public interface BlockStorage { void write(Object byteBufObject, ProtocolVersion version, int pass); void set(int posX, int posY, int posZ, @NonNull VirtualBlock block); @NonNull VirtualBlock get(int posX, int posY, int posZ); int getDataLength(ProtocolVersion version); BlockStorage copy(); static int index(int posX, int posY, int posZ) { return posY << 8 | posZ << 4 | posX; } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/chunk/data/ChunkSnapshot.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.chunk.data; import java.util.List; import net.elytrium.limboapi.api.chunk.VirtualBiome; import net.elytrium.limboapi.api.chunk.VirtualBlock; import net.elytrium.limboapi.api.chunk.VirtualBlockEntity; public interface ChunkSnapshot { VirtualBlock getBlock(int posX, int posY, int posZ); int getPosX(); int getPosZ(); boolean isFullChunk(); BlockSection[] getSections(); LightSection[] getLight(); VirtualBiome[] getBiomes(); List getBlockEntityEntries(); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/chunk/data/LightSection.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.chunk.data; import net.elytrium.limboapi.api.mcprotocollib.NibbleArray3D; public interface LightSection { void setBlockLight(int posX, int posY, int posZ, byte light); NibbleArray3D getBlockLight(); byte getBlockLight(int posX, int posY, int posZ); void setSkyLight(int posX, int posY, int posZ, byte light); NibbleArray3D getSkyLight(); byte getSkyLight(int posX, int posY, int posZ); long getLastUpdate(); LightSection copy(); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/chunk/util/CompactStorage.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.chunk.util; import com.velocitypowered.api.network.ProtocolVersion; public interface CompactStorage { void set(int index, int value); int get(int index); void write(Object byteBufObject, ProtocolVersion version); int getBitsPerEntry(); @Deprecated(forRemoval = true) default int getDataLength() { return this.getDataLength(ProtocolVersion.MINIMUM_VERSION); } int getDataLength(ProtocolVersion version); long[] getData(); CompactStorage copy(); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/command/LimboCommandMeta.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.command; import com.google.common.collect.ImmutableList; import com.mojang.brigadier.tree.CommandNode; import com.velocitypowered.api.command.CommandMeta; import com.velocitypowered.api.command.CommandSource; import java.util.Collection; import java.util.Objects; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; public class LimboCommandMeta implements CommandMeta { @NonNull private final Collection aliases; @NonNull private final Collection> hints; @Nullable // Why?.. private final Object plugin; public LimboCommandMeta(@NonNull Collection aliases) { this(aliases, null, null); } public LimboCommandMeta(@NonNull Collection aliases, @Nullable Collection> hints) { this(aliases, hints, null); } public LimboCommandMeta(@NonNull Collection aliases, @Nullable Collection> hints, @Nullable Object plugin) { this.aliases = aliases; this.hints = Objects.requireNonNullElse(hints, ImmutableList.of()); this.plugin = plugin; } @NonNull @Override public Collection getAliases() { return this.aliases; } @NonNull @Override public Collection> getHints() { return this.hints; } @Nullable @Override public Object getPlugin() { return this.plugin; } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/event/LoginLimboRegisterEvent.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.event; import com.google.common.base.Preconditions; import com.velocitypowered.api.event.player.KickedFromServerEvent; import com.velocitypowered.api.proxy.Player; import java.util.Queue; import java.util.concurrent.LinkedBlockingQueue; import java.util.function.Function; /** * This event is fired during login process before the player has been authenticated, e.g. to enable or disable custom authentication. */ public class LoginLimboRegisterEvent { private final Player player; private final Queue onJoinCallbacks; private Function onKickCallback; public LoginLimboRegisterEvent(Player player) { this.player = Preconditions.checkNotNull(player, "player"); this.onJoinCallbacks = new LinkedBlockingQueue<>(); } public Player getPlayer() { return this.player; } @Override public String toString() { return "LoginLimboRegisterEvent{" + "player=" + this.player + "}"; } public Queue getOnJoinCallbacks() { return this.onJoinCallbacks; } public Function getOnKickCallback() { return this.onKickCallback; } public void addOnJoinCallback(Runnable callback) { this.onJoinCallbacks.add(callback); } /** * @deprecated Use {@link LoginLimboRegisterEvent#addOnJoinCallback(Runnable)} instead */ @Deprecated public void addCallback(Runnable callback) { this.onJoinCallbacks.add(callback); } public void setOnKickCallback(Function callback) { this.onKickCallback = callback; } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/file/BuiltInWorldFileType.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.file; public enum BuiltInWorldFileType { SCHEMATIC, WORLDEDIT_SCHEM, STRUCTURE } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/file/WorldFile.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.file; import net.elytrium.limboapi.api.LimboFactory; import net.elytrium.limboapi.api.chunk.VirtualWorld; import org.checkerframework.common.value.qual.IntRange; public interface WorldFile { default void toWorld(LimboFactory factory, VirtualWorld world, int offsetX, int offsetY, int offsetZ) { this.toWorld(factory, world, offsetX, offsetY, offsetZ, 15); } void toWorld(LimboFactory factory, VirtualWorld world, int offsetX, int offsetY, int offsetZ, @IntRange(from = 0, to = 15) int lightLevel); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/material/Block.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.material; public enum Block { AIR(0), STONE(1), GRASS(2), DIRT(3), COBBLESTONE(4), PLANKS(5), SAPLING(6), BEDROCK(7), FLOWING_WATER(8), WATER(9), FLOWING_LAVA(10), LAVA(11), SAND(12), GRAVEL(13), GOLD_ORE(14), IRON_ORE(15), COAL_ORE(16), LOG(17), LEAVES(18), SPONGE(19), GLASS(20), LAPIS_ORE(21), LAPIS_BLOCK(22), DISPENSER(23), SANDSTONE(24), NOTEBLOCK(25), BED(26), GOLDEN_RAIL(27), DETECTOR_RAIL(28), STICKY_PISTON(29), WEB(30), TALLGRASS(31), DEADBUSH(32), PISTON(33), PISTON_HEAD(34), WOOL(35), PISTON_EXTENSION(36), YELLOW_FLOWER(37), RED_FLOWER(38), BROWN_MUSHROOM(39), RED_MUSHROOM(40), GOLD_BLOCK(41), IRON_BLOCK(42), DOUBLE_STONE_SLAB(43), STONE_SLAB(44), BRICK_BLOCK(45), TNT(46), BOOKSHELF(47), MOSSY_COBBLESTONE(48), OBSIDIAN(49), TORCH(50), FIRE(51), MOB_SPAWNER(52), OAK_STAIRS(53), CHEST(54), REDSTONE_WIRE(55), DIAMOND_ORE(56), DIAMOND_BLOCK(57), CRAFTING_TABLE(58), WHEAT(59), FARMLAND(60), FURNACE(61), LIT_FURNACE(62), STANDING_SIGN(63), WOODEN_DOOR(64), LADDER(65), RAIL(66), STONE_STAIRS(67), WALL_SIGN(68), LEVER(69), STONE_PRESSURE_PLATE(70), IRON_DOOR(71), WOODEN_PRESSURE_PLATE(72), REDSTONE_ORE(73), LIT_REDSTONE_ORE(74), UNLIT_REDSTONE_TORCH(75), REDSTONE_TORCH(76), STONE_BUTTON(77), SNOW_LAYER(78), ICE(79), SNOW(80), CACTUS(81), CLAY(82), REEDS(83), JUKEBOX(84), FENCE(85), PUMPKIN(86), NETHERRACK(87), SOUL_SAND(88), GLOWSTONE(89), PORTAL(90), LIT_PUMPKIN(91), CAKE(92), UNPOWERED_REPEATER(93), POWERED_REPEATER(94), STAINED_GLASS(95), TRAPDOOR(96), MONSTER_EGG(97), STONEBRICK(98), BROWN_MUSHROOM_BLOCK(99), RED_MUSHROOM_BLOCK(100), IRON_BARS(101), GLASS_PANE(102), MELON_BLOCK(103), PUMPKIN_STEM(104), MELON_STEM(105), VINE(106), FENCE_GATE(107), BRICK_STAIRS(108), STONE_BRICK_STAIRS(109), MYCELIUM(110), WATERLILY(111), NETHER_BRICK(112), NETHER_BRICK_FENCE(113), NETHER_BRICK_STAIRS(114), NETHER_WART(115), ENCHANTING_TABLE(116), BREWING_STAND(117), CAULDRON(118), END_PORTAL(119), END_PORTAL_FRAME(120), END_STONE(121), DRAGON_EGG(122), REDSTONE_LAMP(123), LIT_REDSTONE_LAMP(124), DOUBLE_WOODEN_SLAB(125), WOODEN_SLAB(126), COCOA(127), SANDSTONE_STAIRS(128), EMERALD_ORE(129), ENDER_CHEST(130), TRIPWIRE_HOOK(131), TRIPWIRE(132), EMERALD_BLOCK(133), SPRUCE_STAIRS(134), BIRCH_STAIRS(135), JUNGLE_STAIRS(136), COMMAND_BLOCK(137), BEACON(138), COBBLESTONE_WALL(139), FLOWER_POT(140), CARROTS(141), POTATOES(142), WOODEN_BUTTON(143), SKULL(144), ANVIL(145), TRAPPED_CHEST(146), LIGHT_WEIGHTED_PRESSURE_PLATE(147), HEAVY_WEIGHTED_PRESSURE_PLATE(148), UNPOWERED_COMPARATOR(149), POWERED_COMPARATOR(150), DAYLIGHT_DETECTOR(151), REDSTONE_BLOCK(152), QUARTZ_ORE(153), HOPPER(154), QUARTZ_BLOCK(155), QUARTZ_STAIRS(156), ACTIVATOR_RAIL(157), DROPPER(158), STAINED_HARDENED_CLAY(159), STAINED_GLASS_PANE(160), LEAVES2(161), LOG2(162), ACACIA_STAIRS(163), DARK_OAK_STAIRS(164), SLIME(165), BARRIER(166), IRON_TRAPDOOR(167), PRISMARINE(168), SEA_LANTERN(169), HAY_BLOCK(170), CARPET(171), HARDENED_CLAY(172), COAL_BLOCK(173), PACKED_ICE(174), DOUBLE_PLANT(175), STANDING_BANNER(176), WALL_BANNER(177), DAYLIGHT_DETECTOR_INVERTED(178), RED_SANDSTONE(179), RED_SANDSTONE_STAIRS(180), DOUBLE_STONE_SLAB2(181), STONE_SLAB2(182), SPRUCE_FENCE_GATE(183), BIRCH_FENCE_GATE(184), JUNGLE_FENCE_GATE(185), DARK_OAK_FENCE_GATE(186), ACACIA_FENCE_GATE(187), SPRUCE_FENCE(188), BIRCH_FENCE(189), JUNGLE_FENCE(190), DARK_OAK_FENCE(191), ACACIA_FENCE(192), SPRUCE_DOOR(193), BIRCH_DOOR(194), JUNGLE_DOOR(195), ACACIA_DOOR(196), DARK_OAK_DOOR(197), END_ROD(198), CHORUS_PLANT(199), CHORUS_FLOWER(200), PURPUR_BLOCK(201), PURPUR_PILLAR(202), PURPUR_STAIRS(203), PURPUR_DOUBLE_SLAB(204), PURPUR_SLAB(205), END_BRICKS(206), BEETROOTS(207), GRASS_PATH(208), END_GATEWAY(209), REPEATING_COMMAND_BLOCK(210), CHAIN_COMMAND_BLOCK(211), FROSTED_ICE(212), MAGMA(213), NETHER_WART_BLOCK(214), RED_NETHER_BRICK(215), BONE_BLOCK(216), STRUCTURE_VOID(217), OBSERVER(218), WHITE_SHULKER_BOX(219), ORANGE_SHULKER_BOX(220), MAGENTA_SHULKER_BOX(221), LIGHT_BLUE_SHULKER_BOX(222), YELLOW_SHULKER_BOX(223), LIME_SHULKER_BOX(224), PINK_SHULKER_BOX(225), GRAY_SHULKER_BOX(226), SILVER_SHULKER_BOX(227), CYAN_SHULKER_BOX(228), PURPLE_SHULKER_BOX(229), BLUE_SHULKER_BOX(230), BROWN_SHULKER_BOX(231), GREEN_SHULKER_BOX(232), RED_SHULKER_BOX(233), BLACK_SHULKER_BOX(234), WHITE_GLAZED_TERRACOTTA(235), ORANGE_GLAZED_TERRACOTTA(236), MAGENTA_GLAZED_TERRACOTTA(237), LIGHT_BLUE_GLAZED_TERRACOTTA(238), YELLOW_GLAZED_TERRACOTTA(239), LIME_GLAZED_TERRACOTTA(240), PINK_GLAZED_TERRACOTTA(241), GRAY_GLAZED_TERRACOTTA(242), SILVER_GLAZED_TERRACOTTA(243), CYAN_GLAZED_TERRACOTTA(244), PURPLE_GLAZED_TERRACOTTA(245), BLUE_GLAZED_TERRACOTTA(246), BROWN_GLAZED_TERRACOTTA(247), GREEN_GLAZED_TERRACOTTA(248), RED_GLAZED_TERRACOTTA(249), BLACK_GLAZED_TERRACOTTA(250), CONCRETE(251), CONCRETE_POWDER(252), STRUCTURE_BLOCK(255); private final int id; Block(int id) { this.id = id; } public int getID() { return this.id; } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/material/Item.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.material; public enum Item { AIR(0), STONE(1), GRASS(2), DIRT(3), COBBLESTONE(4), PLANKS(5), SAPLING(6), BEDROCK(7), SAND(12), GRAVEL(13), GOLD_ORE(14), IRON_ORE(15), COAL_ORE(16), LOG(17), LEAVES(18), SPONGE(19), GLASS(20), LAPIS_ORE(21), LAPIS_BLOCK(22), DISPENSER(23), SANDSTONE(24), NOTEBLOCK(25), GOLDEN_RAIL(27), DETECTOR_RAIL(28), STICKY_PISTON(29), WEB(30), TALLGRASS(31), DEADBUSH(32), PISTON(33), WOOL(35), YELLOW_FLOWER(37), RED_FLOWER(38), BROWN_MUSHROOM(39), RED_MUSHROOM(40), GOLD_BLOCK(41), IRON_BLOCK(42), STONE_SLAB(44), BRICK_BLOCK(45), TNT(46), BOOKSHELF(47), MOSSY_COBBLESTONE(48), OBSIDIAN(49), TORCH(50), MOB_SPAWNER(52), OAK_STAIRS(53), CHEST(54), DIAMOND_ORE(56), DIAMOND_BLOCK(57), CRAFTING_TABLE(58), FARMLAND(60), FURNACE(61), LADDER(65), RAIL(66), STONE_STAIRS(67), LEVER(69), STONE_PRESSURE_PLATE(70), WOODEN_PRESSURE_PLATE(72), REDSTONE_ORE(73), REDSTONE_TORCH(76), STONE_BUTTON(77), SNOW_LAYER(78), ICE(79), SNOW(80), CACTUS(81), CLAY(82), JUKEBOX(84), FENCE(85), PUMPKIN(86), NETHERRACK(87), SOUL_SAND(88), GLOWSTONE(89), LIT_PUMPKIN(91), STAINED_GLASS(95), TRAPDOOR(96), STONEBRICK(98), BROWN_MUSHROOM_BLOCK(99), RED_MUSHROOM_BLOCK(100), IRON_BARS(101), GLASS_PANE(102), MELON_BLOCK(103), VINE(106), FENCE_GATE(107), BRICK_STAIRS(108), STONE_BRICK_STAIRS(109), MYCELIUM(110), WATERLILY(111), NETHER_BRICK(112), NETHER_BRICK_FENCE(113), NETHER_BRICK_STAIRS(114), ENCHANTING_TABLE(116), END_PORTAL_FRAME(120), END_STONE(121), DRAGON_EGG(122), REDSTONE_LAMP(123), WOODEN_SLAB(126), SANDSTONE_STAIRS(128), EMERALD_ORE(129), ENDER_CHEST(130), TRIPWIRE_HOOK(131), EMERALD_BLOCK(133), SPRUCE_STAIRS(134), BIRCH_STAIRS(135), JUNGLE_STAIRS(136), COMMAND_BLOCK(137), BEACON(138), COBBLESTONE_WALL(139), WOODEN_BUTTON(143), ANVIL(145), TRAPPED_CHEST(146), LIGHT_WEIGHTED_PRESSURE_PLATE(147), HEAVY_WEIGHTED_PRESSURE_PLATE(148), DAYLIGHT_DETECTOR(151), REDSTONE_BLOCK(152), QUARTZ_ORE(153), HOPPER(154), QUARTZ_BLOCK(155), QUARTZ_STAIRS(156), ACTIVATOR_RAIL(157), DROPPER(158), STAINED_HARDENED_CLAY(159), STAINED_GLASS_PANE(160), LEAVES2(161), LOG2(162), ACACIA_STAIRS(163), DARK_OAK_STAIRS(164), SLIME(165), BARRIER(166), IRON_TRAPDOOR(167), PRISMARINE(168), SEA_LANTERN(169), HAY_BLOCK(170), CARPET(171), HARDENED_CLAY(172), COAL_BLOCK(173), PACKED_ICE(174), DOUBLE_PLANT(175), RED_SANDSTONE(179), RED_SANDSTONE_STAIRS(180), STONE_SLAB2(182), SPRUCE_FENCE_GATE(183), BIRCH_FENCE_GATE(184), JUNGLE_FENCE_GATE(185), DARK_OAK_FENCE_GATE(186), ACACIA_FENCE_GATE(187), SPRUCE_FENCE(188), BIRCH_FENCE(189), JUNGLE_FENCE(190), DARK_OAK_FENCE(191), ACACIA_FENCE(192), IRON_SHOVEL(256), IRON_PICKAXE(257), IRON_AXE(258), FLINT_AND_STEEL(259), APPLE(260), BOW(261), ARROW(262), COAL(263), DIAMOND(264), IRON_INGOT(265), GOLD_INGOT(266), IRON_SWORD(267), WOODEN_SWORD(268), WOODEN_SHOVEL(269), WOODEN_PICKAXE(270), WOODEN_AXE(271), STONE_SWORD(272), STONE_SHOVEL(273), STONE_PICKAXE(274), STONE_AXE(275), DIAMOND_SWORD(276), DIAMOND_SHOVEL(277), DIAMOND_PICKAXE(278), DIAMOND_AXE(279), STICK(280), BOWL(281), MUSHROOM_STEW(282), GOLDEN_SWORD(283), GOLDEN_SHOVEL(284), GOLDEN_PICKAXE(285), GOLDEN_AXE(286), STRING(287), FEATHER(288), GUNPOWDER(289), WOODEN_HOE(290), STONE_HOE(291), IRON_HOE(292), DIAMOND_HOE(293), GOLDEN_HOE(294), WHEAT_SEEDS(295), WHEAT(296), BREAD(297), LEATHER_HELMET(298), LEATHER_CHESTPLATE(299), LEATHER_LEGGINGS(300), LEATHER_BOOTS(301), CHAINMAIL_HELMET(302), CHAINMAIL_CHESTPLATE(303), CHAINMAIL_LEGGINGS(304), CHAINMAIL_BOOTS(305), IRON_HELMET(306), IRON_CHESTPLATE(307), IRON_LEGGINGS(308), IRON_BOOTS(309), DIAMOND_HELMET(310), DIAMOND_CHESTPLATE(311), DIAMOND_LEGGINGS(312), DIAMOND_BOOTS(313), GOLDEN_HELMET(314), GOLDEN_CHESTPLATE(315), GOLDEN_LEGGINGS(316), GOLDEN_BOOTS(317), FLINT(318), PORKCHOP(319), COOKED_PORKCHOP(320), PAINTING(321), GOLDEN_APPLE(322), SIGN(323), WOODEN_DOOR(324), BUCKET(325), WATER_BUCKET(326), LAVA_BUCKET(327), MINECART(328), SADDLE(329), IRON_DOOR(330), REDSTONE(331), SNOWBALL(332), BOAT(333), LEATHER(334), MILK_BUCKET(335), BRICK(336), CLAY_BALL(337), REEDS(338), PAPER(339), BOOK(340), SLIME_BALL(341), CHEST_MINECART(342), FURNACE_MINECART(343), EGG(344), COMPASS(345), FISHING_ROD(346), CLOCK(347), GLOWSTONE_DUST(348), FISH(349), COOKED_FISH(350), DYE(351), BONE(352), SUGAR(353), CAKE(354), BED(355), REPEATER(356), COOKIE(357), FILLED_MAP(358), SHEARS(359), MELON(360), PUMPKIN_SEEDS(361), MELON_SEEDS(362), BEEF(363), COOKED_BEEF(364), CHICKEN(365), COOKED_CHICKEN(366), ROTTEN_FLESH(367), ENDER_PEARL(368), BLAZE_ROD(369), GHAST_TEAR(370), GOLD_NUGGET(371), NETHER_WART(372), POTION(373), GLASS_BOTTLE(374), SPIDER_EYE(375), FERMENTED_SPIDER_EYE(376), BLAZE_POWDER(377), MAGMA_CREAM(378), BREWING_STAND(379), CAULDRON(380), ENDER_EYE(381), SPECKLED_MELON(382), SPAWN_EGG(383), EXPERIENCE_BOTTLE(384), FIRE_CHARGE(385), WRITABLE_BOOK(386), WRITTEN_BOOK(387), EMERALD(388), ITEM_FRAME(389), FLOWER_POT(390), CARROT(391), POTATO(392), BAKED_POTATO(393), POISONOUS_POTATO(394), MAP(395), GOLDEN_CARROT(396), SKULL(397), CARROT_ON_A_STICK(398), NETHER_STAR(399), PUMPKIN_PIE(400), FIREWORKS(401), FIREWORK_CHARGE(402), ENCHANTED_BOOK(403), COMPARATOR(404), NETHERBRICK(405), QUARTZ(406), TNT_MINECART(407), HOPPER_MINECART(408), PRISMARINE_SHARD(409), PRISMARINE_CRYSTALS(410), RABBIT(411), COOKED_RABBIT(412), RABBIT_STEW(413), RABBIT_FOOT(414), RABBIT_HIDE(415), ARMOR_STAND(416), IRON_HORSE_ARMOR(417), GOLDEN_HORSE_ARMOR(418), DIAMOND_HORSE_ARMOR(419), LEAD(420), NAME_TAG(421), COMMAND_BLOCK_MINECART(422), MUTTON(423), COOKED_MUTTON(424), BANNER(425), SPRUCE_DOOR(427), BIRCH_DOOR(428), JUNGLE_DOOR(429), ACACIA_DOOR(430), DARK_OAK_DOOR(431), RECORD_13(2256), RECORD_CAT(2257), RECORD_BLOCKS(2258), RECORD_CHIRP(2259), RECORD_FAR(2260), RECORD_MALL(2261), RECORD_MELLOHI(2262), RECORD_STAL(2263), RECORD_STRAD(2264), RECORD_WARD(2265), RECORD_11(2266), RECORD_WAIT(2267); private final int id; Item(int id) { this.id = id; } @Deprecated public int getID() { return this.id; } public int getLegacyID() { return this.id; } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/material/VirtualItem.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.material; import com.velocitypowered.api.network.ProtocolVersion; public interface VirtualItem { short getID(ProtocolVersion version); short getID(WorldVersion version); boolean isSupportedOn(ProtocolVersion version); boolean isSupportedOn(WorldVersion version); String getModernID(); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/material/WorldVersion.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.material; import com.velocitypowered.api.network.ProtocolVersion; import java.util.Arrays; import java.util.EnumMap; import java.util.EnumSet; import java.util.Map; import java.util.Set; import net.elytrium.limboapi.api.utils.EnumUniverse; public enum WorldVersion { LEGACY(EnumSet.range(ProtocolVersion.MINECRAFT_1_7_2, ProtocolVersion.MINECRAFT_1_12_2)), MINECRAFT_1_13(ProtocolVersion.MINECRAFT_1_13), MINECRAFT_1_13_2(ProtocolVersion.MINECRAFT_1_13_1, ProtocolVersion.MINECRAFT_1_13_2), MINECRAFT_1_14(EnumSet.range(ProtocolVersion.MINECRAFT_1_14, ProtocolVersion.MINECRAFT_1_14_4)), MINECRAFT_1_15(EnumSet.range(ProtocolVersion.MINECRAFT_1_15, ProtocolVersion.MINECRAFT_1_15_2)), MINECRAFT_1_16(ProtocolVersion.MINECRAFT_1_16, ProtocolVersion.MINECRAFT_1_16_1), MINECRAFT_1_16_2(EnumSet.range(ProtocolVersion.MINECRAFT_1_16_2, ProtocolVersion.MINECRAFT_1_16_4)), MINECRAFT_1_17(EnumSet.range(ProtocolVersion.MINECRAFT_1_17, ProtocolVersion.MINECRAFT_1_18_2)), MINECRAFT_1_19(EnumSet.range(ProtocolVersion.MINECRAFT_1_19, ProtocolVersion.MINECRAFT_1_19_1)), MINECRAFT_1_19_3(ProtocolVersion.MINECRAFT_1_19_3), MINECRAFT_1_19_4(EnumSet.range(ProtocolVersion.MINECRAFT_1_19_4, ProtocolVersion.MINECRAFT_1_20)), MINECRAFT_1_20(EnumSet.range(ProtocolVersion.MINECRAFT_1_20, ProtocolVersion.MINECRAFT_1_20_2)), MINECRAFT_1_20_3(ProtocolVersion.MINECRAFT_1_20_3), MINECRAFT_1_20_5(EnumSet.range(ProtocolVersion.MINECRAFT_1_20_5, ProtocolVersion.MINECRAFT_1_21)), MINECRAFT_1_21_2(ProtocolVersion.MINECRAFT_1_21_2), MINECRAFT_1_21_4(ProtocolVersion.MINECRAFT_1_21_4), MINECRAFT_1_21_5(ProtocolVersion.MINECRAFT_1_21_5), MINECRAFT_1_21_6(ProtocolVersion.MINECRAFT_1_21_6), MINECRAFT_1_21_7(ProtocolVersion.MINECRAFT_1_21_7), MINECRAFT_1_21_9(ProtocolVersion.MINECRAFT_1_21_9), MINECRAFT_1_21_11(ProtocolVersion.MINECRAFT_1_21_11), MINECRAFT_26_1(EnumSet.range(ProtocolVersion.MINECRAFT_26_1, ProtocolVersion.MAXIMUM_VERSION)); private static final EnumMap MC_VERSION_TO_ITEM_VERSIONS = new EnumMap<>(ProtocolVersion.class); private static final Map KEY_LOOKUP = Map.copyOf(EnumUniverse.createProtocolLookup(values())); private final Set versions; WorldVersion(ProtocolVersion... versions) { this.versions = EnumSet.copyOf(Arrays.asList(versions)); } WorldVersion(Set versions) { this.versions = versions; } public ProtocolVersion getMinSupportedVersion() { return this.versions.iterator().next(); } public Set getVersions() { return this.versions; } static { for (WorldVersion version : WorldVersion.values()) { for (ProtocolVersion protocolVersion : version.getVersions()) { MC_VERSION_TO_ITEM_VERSIONS.put(protocolVersion, version); } } } public static WorldVersion parse(String from) { return KEY_LOOKUP.getOrDefault(from, LEGACY); } public static WorldVersion from(ProtocolVersion protocolVersion) { return MC_VERSION_TO_ITEM_VERSIONS.get(protocolVersion); } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/mcprotocollib/NibbleArray3D.java ================================================ /* * This file is part of MCProtocolLib, licensed under the MIT License (MIT). * * Copyright (C) 2013-2021 Steveice10 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE * OR OTHER DEALINGS IN THE SOFTWARE. */ package net.elytrium.limboapi.api.mcprotocollib; import java.util.Arrays; import net.elytrium.limboapi.api.chunk.data.BlockStorage; public class NibbleArray3D { private final byte[] data; public NibbleArray3D(int size) { this.data = new byte[size >> 1]; } public NibbleArray3D(int size, int defaultValue) { this.data = new byte[size >> 1]; this.fill(defaultValue); } public NibbleArray3D(byte[] array) { this.data = array; } public byte[] getData() { return this.data; } public int get(int posX, int posY, int posZ) { int key = BlockStorage.index(posX, posY, posZ); int index = key >> 1; return (key & 1) == 0 ? this.data[index] & 15 : this.data[index] >> 4 & 15; } public void set(int posX, int posY, int posZ, int value) { this.set(BlockStorage.index(posX, posY, posZ), value); } public void set(int key, int val) { int index = key >> 1; if ((key & 1) == 0) { this.data[index] = (byte) (this.data[index] & 240 | val & 15); } else { this.data[index] = (byte) (this.data[index] & 15 | (val & 15) << 4); } } public void fill(int value) { for (int index = 0; index < this.data.length << 1; ++index) { this.set(index, value); } } public NibbleArray3D copy() { return new NibbleArray3D(Arrays.copyOf(this.data, this.data.length)); } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/player/GameMode.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.player; import org.checkerframework.checker.nullness.qual.Nullable; public enum GameMode { SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR; /** * Cached {@link #values()} array to avoid constant array allocation. */ private static final GameMode[] VALUES = values(); /** * Get the ID of this {@link GameMode}. * * @return The ID. * * @see #getByID(int) */ public short getID() { return (short) this.ordinal(); } /** * Get a {@link GameMode} by its' ID. * * @param id The ID. * * @return The {@link GameMode}, or {@code null} if it does not exist. * * @see #getID() */ @Nullable public static GameMode getByID(int id) { return VALUES[id]; } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/player/LimboPlayer.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.player; import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.server.RegisteredServer; import java.awt.image.BufferedImage; import java.util.concurrent.ScheduledExecutorService; import net.elytrium.limboapi.api.Limbo; import net.elytrium.limboapi.api.material.VirtualItem; import net.elytrium.limboapi.api.protocol.item.ItemComponentMap; import net.kyori.adventure.nbt.CompoundBinaryTag; public interface LimboPlayer { void writePacket(Object packetObj); void writePacketAndFlush(Object packetObj); void flushPackets(); void closeWith(Object packetObj); ScheduledExecutorService getScheduledExecutor(); void sendImage(BufferedImage image); void sendImage(BufferedImage image, boolean sendItem); void sendImage(int mapID, BufferedImage image); void sendImage(int mapID, BufferedImage image, boolean sendItem); void sendImage(int mapID, BufferedImage image, boolean sendItem, boolean resize); void setInventory(VirtualItem item, int count); void setInventory(VirtualItem item, int slot, int count); void setInventory(int slot, VirtualItem item, int count, int data, CompoundBinaryTag nbt); void setInventory(int slot, VirtualItem item, int count, int data, ItemComponentMap map); void setGameMode(GameMode gameMode); void teleport(double posX, double posY, double posZ, float yaw, float pitch); void disableFalling(); void enableFalling(); void disconnect(); void disconnect(RegisteredServer server); void sendAbilities(); void sendAbilities(int abilities, float flySpeed, float walkSpeed); void sendAbilities(byte abilities, float flySpeed, float walkSpeed); byte getAbilities(); GameMode getGameMode(); Limbo getServer(); Player getProxyPlayer(); int getPing(); void setWorldTime(long ticks); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/protocol/PacketDirection.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.protocol; public enum PacketDirection { CLIENTBOUND, SERVERBOUND } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/protocol/PreparedPacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.protocol; import com.velocitypowered.api.network.ProtocolVersion; import java.util.List; import java.util.function.Function; public interface PreparedPacket { PreparedPacket prepare(T packet); PreparedPacket prepare(T[] packets); PreparedPacket prepare(List packets); PreparedPacket prepare(T packet, ProtocolVersion from); PreparedPacket prepare(T packet, ProtocolVersion from, ProtocolVersion to); PreparedPacket prepare(T[] packets, ProtocolVersion from); PreparedPacket prepare(T[] packets, ProtocolVersion from, ProtocolVersion to); PreparedPacket prepare(List packets, ProtocolVersion from); PreparedPacket prepare(List packets, ProtocolVersion from, ProtocolVersion to); PreparedPacket prepare(Function packet); PreparedPacket prepare(Function packet, ProtocolVersion from); PreparedPacket prepare(Function packet, ProtocolVersion from, ProtocolVersion to); PreparedPacket build(); void release(); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/protocol/item/ItemComponent.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.protocol.item; public interface ItemComponent { String getName(); ItemComponent setValue(T value); T getValue(); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/protocol/item/ItemComponentMap.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.protocol.item; import com.velocitypowered.api.network.ProtocolVersion; import java.util.List; public interface ItemComponentMap { ItemComponentMap add(ProtocolVersion version, String name, T value); ItemComponentMap remove(ProtocolVersion version, String name); List getAdded(); List getRemoved(); void read(ProtocolVersion version, Object buffer); void write(ProtocolVersion version, Object buffer); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/protocol/map/MapPalette.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.protocol.map; import com.velocitypowered.api.network.ProtocolVersion; import java.awt.image.BufferedImage; @Deprecated(forRemoval = true) public class MapPalette { public static int[] imageToBytes(BufferedImage image) { return net.elytrium.limboapi.api.protocol.packets.data.MapPalette.imageToBytes(image); } public static int[] imageToBytes(BufferedImage image, ProtocolVersion version) { return net.elytrium.limboapi.api.protocol.packets.data.MapPalette.imageToBytes(image, version); } public static byte tryFastMatchColor(int rgb, ProtocolVersion version) { return net.elytrium.limboapi.api.protocol.packets.data.MapPalette.tryFastMatchColor(rgb, version); } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/protocol/packets/PacketFactory.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.protocol.packets; import com.velocitypowered.api.network.ProtocolVersion; import java.util.List; import java.util.Map; import net.elytrium.limboapi.api.chunk.Dimension; import net.elytrium.limboapi.api.chunk.data.ChunkSnapshot; import net.elytrium.limboapi.api.material.VirtualItem; import net.elytrium.limboapi.api.material.WorldVersion; import net.elytrium.limboapi.api.protocol.item.ItemComponentMap; import net.elytrium.limboapi.api.protocol.packets.data.AbilityFlags; import net.elytrium.limboapi.api.protocol.packets.data.MapData; import net.kyori.adventure.nbt.CompoundBinaryTag; import org.checkerframework.checker.nullness.qual.Nullable; public interface PacketFactory { Object createChangeGameStatePacket(int reason, float value); Object createChunkDataPacket(ChunkSnapshot chunkSnapshot, boolean legacySkyLight, int maxSections); Object createChunkDataPacket(ChunkSnapshot chunkSnapshot, Dimension dimension); Object createChunkUnloadPacket(int posX, int posZ); Object createDefaultSpawnPositionPacket(int posX, int posY, int posZ, float angle); Object createDefaultSpawnPositionPacket(String dimension, int posX, int posY, int posZ, float yaw, float pitch); Object createMapDataPacket(int mapID, byte scale, MapData mapData); /** * @param flags See {@link AbilityFlags}. (e.g. {@code AbilityFlags.ALLOW_FLYING | AbilityFlags.CREATIVE_MODE}) */ Object createPlayerAbilitiesPacket(int flags, float flySpeed, float walkSpeed); /** * @param flags See {@link AbilityFlags}. (e.g. {@code AbilityFlags.ALLOW_FLYING | AbilityFlags.CREATIVE_MODE}) */ Object createPlayerAbilitiesPacket(byte flags, float flySpeed, float walkSpeed); Object createPositionRotationPacket(double posX, double posY, double posZ, float yaw, float pitch, boolean onGround, int teleportID, boolean dismountVehicle); Object createSetExperiencePacket(float expBar, int level, int totalExp); Object createSetSlotPacket(int windowID, int slot, VirtualItem item, int count, int data, @Nullable CompoundBinaryTag nbt); Object createSetSlotPacket(int windowID, int slot, VirtualItem item, int count, int data, @Nullable ItemComponentMap map); Object createTimeUpdatePacket(long worldAge, long timeOfDay); Object createUpdateViewPositionPacket(int posX, int posZ); Object createUpdateTagsPacket(WorldVersion version); Object createUpdateTagsPacket(ProtocolVersion version); Object createUpdateTagsPacket(Map>> tags); } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/protocol/packets/PacketMapping.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.protocol.packets; import com.velocitypowered.api.network.ProtocolVersion; import org.checkerframework.checker.nullness.qual.Nullable; public class PacketMapping { private final int id; private final ProtocolVersion protocolVersion; @Nullable private final ProtocolVersion lastValidProtocolVersion; private final boolean encodeOnly; public PacketMapping(int id, ProtocolVersion protocolVersion, boolean encodeOnly) { this(id, protocolVersion, null, encodeOnly); } public PacketMapping(int id, ProtocolVersion protocolVersion, @Nullable ProtocolVersion lastValidProtocolVersion, boolean encodeOnly) { this.id = id; this.protocolVersion = protocolVersion; this.lastValidProtocolVersion = lastValidProtocolVersion; this.encodeOnly = encodeOnly; } public int getID() { return this.id; } public ProtocolVersion getProtocolVersion() { return this.protocolVersion; } @Nullable public ProtocolVersion getLastValidProtocolVersion() { return this.lastValidProtocolVersion; } public boolean isEncodeOnly() { return this.encodeOnly; } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/protocol/packets/data/AbilityFlags.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.protocol.packets.data; /** * For PlayerAbilities packet. */ public class AbilityFlags { public static final int INVULNERABLE = 1; public static final int FLYING = 2; public static final int ALLOW_FLYING = 4; public static final int CREATIVE_MODE = 8; } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/protocol/packets/data/BiomeData.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.protocol.packets.data; import java.util.HashMap; import java.util.Map; import net.elytrium.limboapi.api.chunk.VirtualBiome; import net.elytrium.limboapi.api.chunk.data.ChunkSnapshot; /** * For ChunkData packet. */ public class BiomeData { private final int[] post115Biomes = new int[1024]; private final byte[] pre115Biomes = new byte[256]; public BiomeData(ChunkSnapshot chunk) { VirtualBiome[] biomes = chunk.getBiomes(); for (int i = 0; i < biomes.length; ++i) { this.post115Biomes[i] = biomes[i].getID(); } // Down sample 4x4x4 3D biomes to 2D XZ. Map samples = new HashMap<>(64); for (int posX = 0; posX < 16; posX += 4) { for (int posZ = 0; posZ < 16; posZ += 4) { samples.clear(); for (int posY = 0; posY < 256; posY += 16) { VirtualBiome biome = biomes[/*SimpleChunk.getBiomeIndex(posX, posY, posZ)*/(posY >> 2 & 63) << 4 | (posZ >> 2 & 3) << 2 | posX >> 2 & 3]; samples.put(biome.getID(), samples.getOrDefault(biome.getID(), 0) + 1); } int id = samples.entrySet() .stream() .max(Map.Entry.comparingByValue()) .orElseThrow() .getKey(); for (int i = posX; i < posX + 4; ++i) { for (int j = posZ; j < posZ + 4; ++j) { this.pre115Biomes[(j << 4) + i] = (byte) id; } } } } } public int[] getPost115Biomes() { return this.post115Biomes; } public byte[] getPre115Biomes() { return this.pre115Biomes; } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/protocol/packets/data/MapData.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.protocol.packets.data; /** * For MapData packet. */ public class MapData { public static final int MAP_DIM_SIZE = 128; public static final int MAP_SIZE = MAP_DIM_SIZE * MAP_DIM_SIZE; // 128² == 16384 private final int columns; private final int rows; private final int posX; private final int posY; private final byte[] data; public MapData(byte[] data) { this(0, data); } public MapData(int posX, byte[] data) { this(MAP_DIM_SIZE, MAP_DIM_SIZE, posX, 0, data); } public MapData(int columns, int rows, int posX, int posY, byte[] data) { this.columns = columns; this.rows = rows; this.posX = posX; this.posY = posY; this.data = data; } public int getColumns() { return this.columns; } public int getRows() { return this.rows; } public int getX() { return this.posX; } public int getY() { return this.posY; } public byte[] getData() { return this.data; } @Override public String toString() { return "MapData{" + "columns=" + this.columns + ", rows=" + this.rows + ", posX=" + this.posX + ", posY=" + this.posY + "}"; } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/protocol/packets/data/MapPalette.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.protocol.packets.data; import com.velocitypowered.api.network.ProtocolVersion; import java.awt.image.BufferedImage; import java.io.IOError; import java.io.IOException; import java.io.InputStream; import java.util.EnumMap; import java.util.EnumSet; import java.util.Locale; import java.util.Map; import java.util.Objects; public class MapPalette { private static final Map REMAP_BUFFERS = new EnumMap<>(MapVersion.class); private static final byte[] MAIN_BUFFER = readBuffer("/mapping/colors_main_map"); /** * @deprecated Use {@link java.awt.Color#WHITE} instead. */ @Deprecated public static final byte WHITE = 34; public static final byte TRANSPARENT = 0; static { for (MapVersion version : MapVersion.values()) { REMAP_BUFFERS.put(version, readBuffer("/mapping/colors_" + version.toString().toLowerCase(Locale.ROOT) + "_map")); } } private static byte[] readBuffer(String filename) { try (InputStream stream = MapPalette.class.getResourceAsStream(filename)) { return Objects.requireNonNull(stream).readAllBytes(); } catch (IOException e) { throw new IOError(e); } } /** * Convert an Image to a byte[] using the palette. * Uses reduced set of colors, to support more colors use {@link MapPalette#imageToBytes(BufferedImage, ProtocolVersion)} * * @param image The image to convert. * * @return A byte[] containing the pixels of the image. */ public static int[] imageToBytes(BufferedImage image) { return imageToBytes(image, ProtocolVersion.MINIMUM_VERSION); } /** * Convert an Image to a byte[] using the palette. * * @param image The image to convert. * @param version The ProtocolVersion to support more colors. * * @return A byte[] containing the pixels of the image. */ public static int[] imageToBytes(BufferedImage image, ProtocolVersion version) { int[] result = image.getRGB(0, 0, image.getWidth(), image.getHeight(), null, 0, image.getWidth()); return imageToBytes(result, result, version); } /** * Convert an image to a byte[] using the palette. * * @param image The image to convert. * @param version The ProtocolVersion to support more colors. * * @return A byte[] containing the pixels of the image. */ public static int[] imageToBytes(int[] image, ProtocolVersion version) { return imageToBytes(image, new int[image.length], version); } /** * Convert an image to a byte[] using the palette. * * @param from The image to convert. * @param to Output image. * @param version The ProtocolVersion to support more colors. * * @return A byte[] containing the pixels of the image. */ public static int[] imageToBytes(int[] from, int[] to, ProtocolVersion version) { for (int i = 0; i < from.length; ++i) { to[i] = tryFastMatchColor(from[i], version); } return to; } /** * Convert an image to a byte[] using the palette. * * @param from The image to convert. * @param to Output image. * @param version The ProtocolVersion to support more colors. * * @return A byte[] containing the pixels of the image. */ public static byte[] imageToBytes(int[] from, byte[] to, ProtocolVersion version) { for (int i = 0; i < from.length; ++i) { to[i] = tryFastMatchColor(from[i], version); } return to; } /** * Get the index of the closest matching color in the palette to the given * color. Uses caching and downscaling of color values. * * @param rgb The Color to match. * * @return The index in the palette. */ public static byte tryFastMatchColor(int rgb, ProtocolVersion version) { if (getAlpha(rgb) < 128) { return TRANSPARENT; } else { MapVersion mapVersion = MapVersion.fromProtocolVersion(version); byte originalColorID = MAIN_BUFFER[rgb & 0xFFFFFF]; if (mapVersion == MapVersion.MAXIMUM_VERSION) { return originalColorID; } else { return remapByte(REMAP_BUFFERS.get(mapVersion), originalColorID); } } } private static int getAlpha(int rgb) { return (rgb & 0xFF000000) >>> 24; } /** * Convert an image from MapVersion.MAXIMUM_VERSION to the desired version * * @param image The image to convert. * @param version The ProtocolVersion to support more colors. * * @return A byte[] containing the pixels of the image. */ public static int[] convertImage(int[] image, MapVersion version) { return convertImage(image, new int[image.length], version); } /** * Convert an image from MapVersion.MAXIMUM_VERSION to the desired version * * @param from The image to convert. * @param to Output image. * @param version The ProtocolVersion to support more colors. * * @return A byte[] containing the pixels of the image. */ public static int[] convertImage(int[] from, int[] to, MapVersion version) { byte[] remapBuffer = REMAP_BUFFERS.get(version); for (int i = 0; i < from.length; ++i) { to[i] = remapByte(remapBuffer, (byte) from[i]); } return to; } /** * Convert an image from MapVersion.MAXIMUM_VERSION to the desired version * * @param from The image to convert. * @param to Output image. * @param version The ProtocolVersion to support more colors. * * @return A byte[] containing the pixels of the image. */ public static byte[] convertImage(byte[] from, byte[] to, MapVersion version) { byte[] remapBuffer = REMAP_BUFFERS.get(version); for (int i = 0; i < from.length; ++i) { to[i] = remapByte(remapBuffer, from[i]); } return to; } /** * Convert an image from MapVersion.MAXIMUM_VERSION to the desired version * * @param from The image to convert. * @param to Output image. * @param version The ProtocolVersion to support more colors. * * @return A byte[] containing the pixels of the image. */ public static byte[] convertImage(int[] from, byte[] to, MapVersion version) { byte[] remapBuffer = REMAP_BUFFERS.get(version); for (int i = 0; i < from.length; ++i) { to[i] = remapByte(remapBuffer, (byte) from[i]); } return to; } private static byte remapByte(byte[] remapBuffer, byte oldByte) { return remapBuffer[Byte.toUnsignedInt(oldByte)]; } public enum MapVersion { MINIMUM_VERSION(EnumSet.range(ProtocolVersion.MINECRAFT_1_7_2, ProtocolVersion.MINECRAFT_1_7_6)), MINECRAFT_1_8(EnumSet.range(ProtocolVersion.MINECRAFT_1_8, ProtocolVersion.MINECRAFT_1_11_1)), MINECRAFT_1_12(EnumSet.range(ProtocolVersion.MINECRAFT_1_12, ProtocolVersion.MINECRAFT_1_15_2)), MINECRAFT_1_16(EnumSet.range(ProtocolVersion.MINECRAFT_1_16, ProtocolVersion.MINECRAFT_1_16_4)), MINECRAFT_1_17(EnumSet.range(ProtocolVersion.MINECRAFT_1_17, ProtocolVersion.MAXIMUM_VERSION)); private static final EnumMap VERSIONS_MAP = new EnumMap<>(ProtocolVersion.class); public static final MapVersion MAXIMUM_VERSION = MINECRAFT_1_17; private final EnumSet versions; MapVersion(EnumSet versions) { this.versions = versions; } public EnumSet getVersions() { return this.versions; } static { for (MapVersion value : MapVersion.values()) { value.versions.forEach(version -> VERSIONS_MAP.put(version, value)); } } public static MapVersion fromProtocolVersion(ProtocolVersion version) { return VERSIONS_MAP.get(version); } } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/utils/EnumUniverse.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.utils; import java.util.HashMap; import java.util.Map; public final class EnumUniverse { private EnumUniverse() { } public static > Map createProtocolLookup(T[] values) { Map lookup = new HashMap<>(); for (T value : values) { if (value.name().startsWith("MINECRAFT_")) { lookup.put(value.name().substring("MINECRAFT_".length()).replace("_", "."), value); } } return lookup; } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/utils/OverlayMap.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.utils; import java.util.Map; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public abstract class OverlayMap implements Map { protected boolean override = false; protected final Map parent; protected final Map overlay; public OverlayMap(Map parent, Map overlay) { this.parent = parent; this.overlay = overlay; } @Override public int size() { return this.parent.size() + this.overlay.size(); } @Override public boolean isEmpty() { return this.parent.isEmpty() && this.overlay.isEmpty(); } @Override public boolean containsKey(Object o) { if (this.override) { return this.overlay.containsKey(o); } return this.parent.containsKey(o) || this.overlay.containsKey(o); } @Override public boolean containsValue(Object o) { if (this.override) { return this.overlay.containsValue(o); } return this.parent.containsValue(o) || this.overlay.containsValue(o); } @Override @SuppressWarnings("SuspiciousMethodCalls") public V get(Object o) { if (this.overlay.containsKey(o)) { return this.overlay.get(o); } return this.parent.get(o); } @Nullable @Override public V put(K k, V v) { return this.overlay.put(k, v); } @Override public V remove(Object o) { return this.overlay.remove(o); } @Override public void putAll(@NotNull Map map) { this.overlay.putAll(map); } @Override public void clear() { this.overlay.clear(); } public boolean isOverride() { return this.override; } public void setOverride(boolean override) { this.override = override; } } ================================================ FILE: api/src/main/java/net/elytrium/limboapi/api/utils/OverlayVanillaMap.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi.api.utils; import com.google.common.collect.Streams; import java.util.Collection; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import org.jetbrains.annotations.NotNull; public class OverlayVanillaMap extends OverlayMap { public OverlayVanillaMap(Map parent, Map overlay) { super(parent, overlay); } @Override public Set keySet() { return Streams.concat(this.parent.keySet().stream(), this.overlay.keySet().stream()).collect(Collectors.toSet()); } @NotNull @Override public Collection values() { return Streams.concat(this.parent.values().stream(), this.overlay.values().stream()).collect(Collectors.toList()); } @NotNull @Override public Set> entrySet() { return Streams.concat(this.parent.entrySet().stream(), this.overlay.entrySet().stream()).collect(Collectors.toSet()); } } ================================================ FILE: api/src/main/templates/net/elytrium/limboapi/BuildConstants.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * The LimboAPI (excluding the LimboAPI plugin) is licensed under the terms of the MIT License. For more details, * reference the LICENSE file in the api top-level directory. */ package net.elytrium.limboapi; // The constants are replaced before compilation. public class BuildConstants { public static final String LIMBO_VERSION = "${version}"; } ================================================ FILE: build.gradle.kts ================================================ import com.github.spotbugs.snom.SpotBugsExtension import com.github.spotbugs.snom.SpotBugsTask plugins { java checkstyle alias(libs.plugins.gradle.spotbugs) apply false alias(libs.plugins.gradle.licenser) apply false } allprojects { apply(plugin = "checkstyle") apply(plugin = "com.github.spotbugs") apply(plugin = "net.minecraftforge.licenser") group = "net.elytrium.limboapi" version = "1.1.27-SNAPSHOT" tasks.withType { sourceCompatibility = JavaVersion.VERSION_21.toString() targetCompatibility = JavaVersion.VERSION_21.toString() } checkstyle { toolVersion = "10.12.1" configFile = file("$rootDir/config/checkstyle/checkstyle.xml") configProperties = mapOf("configDirectory" to "$rootDir/config/checkstyle") maxErrors = 0 maxWarnings = 0 } extensions.configure { excludeFilter.set(file("${rootDir}/config/spotbugs/suppressions.xml")) } tasks.withType() { reports.create("html") { required.set(true) outputLocation.set(layout.buildDirectory.file("reports/spotbugs/main/spotbugs.html")) setStylesheet("fancy-hist.xsl") } } } fun getCurrentShortRevision(): String { val isWindows = System.getProperty("os.name") .lowercase() .contains("win") val process = if (isWindows) { ProcessBuilder("cmd", "/c", "git rev-parse --short HEAD") } else { ProcessBuilder("bash", "-c", "git rev-parse --short HEAD") } return process .start() .inputStream .bufferedReader() .readText() .trim() } // Make the function available to subprojects via extra properties extra["getCurrentShortRevision"] = ::getCurrentShortRevision ================================================ FILE: config/checkstyle/checkstyle.xml ================================================ ================================================ FILE: config/checkstyle/suppressions.xml ================================================ ================================================ FILE: config/spotbugs/suppressions.xml ================================================ ================================================ FILE: gradle/libs.versions.toml ================================================ [versions] elytrium-commons = "1.2.3" # https://github.com/Elytrium/elytrium-java-commons elytrium-fastprepare = "1.0.13" #https://github.com/Elytrium/FastPrepareAPI gradle-licenser = "1.2.0" # https://github.com/CadixDev/licenser gradle-shadow = "9.4.0" # https://github.com/GradleUp/shadow gradle-spotbugs = "6.4.8" # https://github.com/spotbugs/spotbugs-gradle-plugin minecraft-adventure = "4.15.0" # https://github.com/KyoriPowered/adventure minecraft-bstats = "3.0.0" # https://github.com/Bastian/bStats minecraft-velocity = "3.5.0-SNAPSHOT" # https://github.com/PaperMC/Velocity tool-commons-io = "2.6" # https://github.com/apache/commons-io tool-fastutil = "8.5.11" # https://github.com/vigna/fastutil/ tool-google-guava = "28.0-jre" # https://github.com/google/guava tool-netty = "4.1.86.Final" # https://github.com/netty/netty tool-spotbugs-annotations = "4.7.3" # https://github.com/spotbugs/spotbugs [libraries] elytrium-commons-config = { module = "net.elytrium.commons:config", version.ref = "elytrium-commons" } elytrium-commons-kyori = { module = "net.elytrium.commons:kyori", version.ref = "elytrium-commons" } elytrium-commons-utils = { module = "net.elytrium.commons:utils", version.ref = "elytrium-commons" } elytrium-commons-velocity = { module = "net.elytrium.commons:velocity", version.ref = "elytrium-commons" } elytrium-fastprepare = { module = "net.elytrium:fastprepare", version.ref = "elytrium-fastprepare" } minecraft-adventure-nbt = { module = "net.kyori:adventure-nbt", version.ref = "minecraft-adventure" } minecraft-bstats-velocity = { module = "org.bstats:bstats-velocity", version.ref = "minecraft-bstats" } minecraft-velocity-api = { module = "com.velocitypowered:velocity-api", version.ref = "minecraft-velocity" } minecraft-velocity-native = { module = "com.velocitypowered:velocity-native", version.ref = "minecraft-velocity" } minecraft-velocity-proxy = { module = "com.velocitypowered:velocity-proxy", version.ref = "minecraft-velocity" } tool-commons-io = { module = "commons-io:commons-io", version.ref = "tool-commons-io" } tool-fastutil = { module = "it.unimi.dsi:fastutil-core", version.ref = "tool-fastutil" } tool-google-guava = { module = "com.google.guava:guava", version.ref = "tool-google-guava" } tool-netty-codec = { module = "io.netty:netty-codec", version.ref = "tool-netty" } tool-netty-handler = { module = "io.netty:netty-handler", version.ref = "tool-netty" } tool-spotbugs-annotations = { module = "com.github.spotbugs:spotbugs-annotations", version.ref = "tool-spotbugs-annotations" } [plugins] gradle-licenser = { id = "net.minecraftforge.licenser", version.ref = "gradle-licenser" } gradle-shadow = { id = "com.gradleup.shadow", version.ref = "gradle-shadow" } gradle-spotbugs = { id = "com.github.spotbugs", version.ref = "gradle-spotbugs" } ================================================ FILE: gradle/wrapper/gradle-wrapper.properties ================================================ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists ================================================ FILE: gradle.properties ================================================ org.gradle.jvmargs=-Xmx4096m manifestUrl=https://launchermeta.mojang.com/mc/game/version_manifest.json # 1 week cacheValidMillis=604800000 # Change to invalidate mappings cache on CI gameVersion=26.1 ================================================ FILE: gradlew ================================================ #!/bin/sh # # Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ############################################################################## # # Gradle start up script for POSIX generated by Gradle. # # Important for running: # # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is # noncompliant, but you have some other compliant shell such as ksh or # bash, then to run this script, type that shell name before the whole # command line, like: # # ksh Gradle # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», # «${var#prefix}», «${var%suffix}», and «$( cmd )»; # * compound commands having a testable exit status, especially «case»; # * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # # (2) This script targets any POSIX shell, so it avoids extensions provided # by Bash, Ksh, etc; in particular arrays are avoided. # # The "traditional" practice of packing multiple parameters into a # space-separated string is a well documented source of bugs and security # problems, so this is (mostly) avoided, by progressively accumulating # options in "$@", and eventually passing that to Java. # # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; # see the in-line comments for details. # # There are tweaks for specific operating systems such as AIX, CygWin, # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. # ############################################################################## # Attempt to set APP_HOME # Resolve links: $0 may be a link app_path=$0 # Need this for daisy-chained symlinks. while APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path [ -h "$app_path" ] do ls=$( ls -ld "$app_path" ) link=${ls#*' -> '} case $link in #( /*) app_path=$link ;; #( *) app_path=$APP_HOME$link ;; esac done APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum warn () { echo "$*" } >&2 die () { echo echo "$*" echo exit 1 } >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false case "$( uname )" in #( CYGWIN* ) cygwin=true ;; #( Darwin* ) darwin=true ;; #( MSYS* | MINGW* ) msys=true ;; #( NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD=$JAVA_HOME/jre/sh/java else JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi # Collect all arguments for the java command, stacking in reverse order: # * args from the command line # * the main class name # * -classpath # * -D...appname settings # * --module-path (only if needed) # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) # Now convert the arguments - kludge to limit ourselves to /bin/sh for arg do if case $arg in #( -*) false ;; # don't mess with options #( /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath [ -e "$t" ] ;; #( *) false ;; esac then arg=$( cygpath --path --ignore --mixed "$arg" ) fi # Roll the args list around exactly as many times as the number of # args, so each arg winds up back in the position where it started, but # possibly modified. # # NB: a `for` loop captures its iteration list before it begins, so # changing the positional parameters here affects neither the number of # iterations, nor the values presented in `arg`. shift # remove old arg set -- "$@" "$arg" # push replacement arg done fi # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in # double quotes to make sure that they get re-expanded; and # * put everything else in single quotes, so that it's not re-expanded. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ org.gradle.wrapper.GradleWrapperMain \ "$@" # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. # # In Bash we could simply go: # # readarray ARGS < <( xargs -n1 <<<"$var" ) && # set -- "${ARGS[@]}" "$@" # # but POSIX shell has neither arrays nor command substitution, so instead we # post-process each arg (as a line of input to sed) to backslash-escape any # character that might be a shell metacharacter, then use eval to reverse # that process (while maintaining the separation between arguments), and wrap # the whole thing up as a single "set" statement. # # This will of course break if any of these variables contains a newline or # an unmatched quote. # eval "set -- $( printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | xargs -n1 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | tr '\n' ' ' )" '"$@"' exec "$JAVACMD" "$@" ================================================ FILE: gradlew.bat ================================================ @rem @rem Copyright 2015 the original author or authors. @rem @rem Licensed under the Apache License, Version 2.0 (the "License"); @rem you may not use this file except in compliance with the License. @rem You may obtain a copy of the License at @rem @rem https://www.apache.org/licenses/LICENSE-2.0 @rem @rem Unless required by applicable law or agreed to in writing, software @rem distributed under the License is distributed on an "AS IS" BASIS, @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @rem @rem ########################################################################## @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Resolve any "." and ".." in APP_HOME to make it shorter. for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo. echo Please set the JAVA_HOME variable in your environment to match the echo location of your Java installation. goto fail :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo. echo Please set the JAVA_HOME variable in your environment to match the echo location of your Java installation. goto fail :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell if "%ERRORLEVEL%"=="0" goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 exit /b 1 :mainEnd if "%OS%"=="Windows_NT" endlocal :omega ================================================ FILE: plugin/build.gradle ================================================ //file:noinspection GroovyAssignabilityCheck buildscript() { dependencies() { classpath(libs.tool.commons.io) classpath(libs.tool.google.guava) } } plugins() { id("java") alias(libs.plugins.gradle.shadow) } compileJava() { getOptions().getRelease().set(21) getOptions().setEncoding("UTF-8") } dependencies() { implementation(project(":api")) implementation(libs.elytrium.commons.config) implementation(libs.elytrium.commons.utils) implementation(libs.elytrium.commons.velocity) implementation(libs.elytrium.commons.kyori) implementation(libs.elytrium.fastprepare) compileOnly(libs.minecraft.velocity.api) annotationProcessor(libs.minecraft.velocity.api) compileOnly(libs.minecraft.velocity.proxy) // From Elytrium Repo. compileOnly(libs.minecraft.velocity.native) // Needs for some velocity methods. compileOnly(libs.tool.netty.codec) compileOnly(libs.tool.netty.handler) compileOnly(libs.tool.fastutil) implementation(libs.minecraft.bstats.velocity) compileOnly(libs.tool.spotbugs.annotations) } shadowJar() { getArchiveClassifier().set("") setArchiveFileName("limboapi-${project.version}.jar") exclude("META-INF/versions/**") exclude("net/kyori/**") relocate("org.bstats", "net.elytrium.limboapi.thirdparty.org.bstats") relocate("net.elytrium.fastprepare", "net.elytrium.limboapi.thirdparty.fastprepare") relocate("net.elytrium.commons.velocity", "net.elytrium.limboapi.thirdparty.commons.velocity") relocate("net.elytrium.commons.kyori", "net.elytrium.limboapi.thirdparty.commons.kyori") relocate("net.elytrium.commons.config", "net.elytrium.limboapi.thirdparty.commons.config") } license() { matching("**/mcprotocollib/**") { header = rootProject.file("HEADER_MCPROTOCOLLIB.txt") } matching("**/LoginListener.java") { header = rootProject.file("HEADER_MIXED.txt") } matching("**/KickListener.java") { header = rootProject.file("HEADER_MIXED.txt") } matching("**/LoginTasksQueue.java") { header = rootProject.file("HEADER_MIXED.txt") } matching("**/MinecraftLimitedCompressDecoder.java") { header = rootProject.file("HEADER_MIXED.txt") } header = rootProject.file("HEADER.txt") } tasks.register("finalize") { doLast { file("build/libs/${project.name}-${project.version}.jar").delete() } } assemble.dependsOn(shadowJar) build.finalizedBy(finalize) import groovy.io.FileType import groovy.json.JsonOutput import groovy.json.JsonSlurper import org.apache.commons.io.FilenameUtils import org.apache.commons.io.FileUtils import com.google.common.hash.Hashing import com.google.common.io.Files import java.nio.file.Path import java.util.function.Function import java.util.stream.Collectors enum MinecraftVersion { MINECRAFT_1_7_2(4), MINECRAFT_1_7_6(5), MINECRAFT_1_8(47), MINECRAFT_1_9(107), MINECRAFT_1_9_1(108), MINECRAFT_1_9_2(109), MINECRAFT_1_9_4(110), MINECRAFT_1_10(210), MINECRAFT_1_11(315), MINECRAFT_1_11_1(316), MINECRAFT_1_12(335), MINECRAFT_1_12_1(338), MINECRAFT_1_12_2(340), MINECRAFT_1_13(393), MINECRAFT_1_13_1(401), MINECRAFT_1_13_2(404), MINECRAFT_1_14(477), MINECRAFT_1_14_1(480), MINECRAFT_1_14_2(485), MINECRAFT_1_14_3(490), MINECRAFT_1_14_4(498), MINECRAFT_1_15(573), MINECRAFT_1_15_1(575), MINECRAFT_1_15_2(578), MINECRAFT_1_16(735), MINECRAFT_1_16_1(736), MINECRAFT_1_16_2(751), MINECRAFT_1_16_3(753), MINECRAFT_1_16_4(754), MINECRAFT_1_17(755), MINECRAFT_1_17_1(756), MINECRAFT_1_18(757), MINECRAFT_1_18_2(758), MINECRAFT_1_19(759), MINECRAFT_1_19_1(760), MINECRAFT_1_19_3(761), MINECRAFT_1_19_4(762), MINECRAFT_1_20(763), MINECRAFT_1_20_2(764), MINECRAFT_1_20_3(765), MINECRAFT_1_20_5(766), MINECRAFT_1_21(767), MINECRAFT_1_21_2(768), MINECRAFT_1_21_4(769), MINECRAFT_1_21_5(770), MINECRAFT_1_21_6(771), MINECRAFT_1_21_7(772), MINECRAFT_1_21_9(773), MINECRAFT_1_21_11(774), MINECRAFT_26_1(774) public static final List WORLD_VERSIONS = List.of( MINECRAFT_1_13, MINECRAFT_1_13_2, MINECRAFT_1_14, MINECRAFT_1_15, MINECRAFT_1_16, MINECRAFT_1_16_2, MINECRAFT_1_17, MINECRAFT_1_19, MINECRAFT_1_19_3, MINECRAFT_1_19_4, MINECRAFT_1_20, MINECRAFT_1_20_3, MINECRAFT_1_20_5, MINECRAFT_1_21_2, MINECRAFT_1_21_4, MINECRAFT_1_21_5, MINECRAFT_1_21_6, MINECRAFT_1_21_7, MINECRAFT_1_21_9, MINECRAFT_1_21_11, MINECRAFT_26_1 ) public static final MinecraftVersion MINIMUM_VERSION = MINECRAFT_1_7_2 public static final MinecraftVersion MAXIMUM_VERSION = values()[values().length - 1] static MinecraftVersion fromVersionName(String name) { return valueOf("MINECRAFT_" + name.replace('.', '_')) } // Cache version name to reduce memory usage in general final String versionName = this.toString().substring(10).replace('_', '.') final int protocolVersion MinecraftVersion(int protocolVersion) { this.protocolVersion = protocolVersion } int getProtocolVersion() { return this.protocolVersion } String getVersionName() { return this.versionName } } project.ext.dataDirectory = new File(this.getLayout().getBuildDirectory().get().getAsFile(), "minecraft") project.ext.generatedDir = new File(this.getLayout().getBuildDirectory().get().getAsFile(), "generated/minecraft") project.ext.versionManifestFile = new File(dataDirectory, "manifest.json") sourceSets { main { resources { srcDirs += generatedDir } } } tasks.register("downloadManifest") { this.println("> Downloading version manifest...") versionManifestFile.getParentFile().mkdirs() if (checkIsCacheValid(versionManifestFile)) { FileUtils.copyURLToFile(new URL(manifestUrl), versionManifestFile) } } boolean checkIsCacheValid(File file) { if (file.exists() && System.currentTimeMillis() - file.lastModified() < Long.parseLong(cacheValidMillis)) { println("> Found cached " + file.getName()) return false } return true } File downloadVersionManifest(String version) { this.println("> Downloading ${version} manifest...") Object manifest = new JsonSlurper().parse(versionManifestFile) def optional = manifest.versions.stream().filter({ it.id == version }).findFirst() if (optional.empty()) { throw new RuntimeException("Couldn't find version: ${version}") } File output = new File(dataDirectory, "${version}/manifest.json") output.getParentFile().mkdirs() FileUtils.copyURLToFile(new URL(optional.get().url), output) return output } @SuppressWarnings('GrMethodMayBeStatic') File getGeneratedCache(MinecraftVersion version) { File generated = new File(dataDirectory, "${version.getVersionName()}/generated") return new File(generated, "reports/blocks.json").exists() && new File(generated, "reports/${version >= MinecraftVersion.MINECRAFT_1_14 ? "registries" : "items"}.json").exists() && new File(generated, "data/minecraft/tags").exists() ? generated : null } static boolean validateServer(File file, String expected) { if (file == null || !file.exists()) { return false } def hash = Files.asByteSource(file).hash(Hashing.sha1()) StringBuilder hashBuilder = new StringBuilder() hash.asBytes().each({hashBuilder.append(Integer.toString((it & 0xFF) + 0x100, 16).substring(1))}) return hashBuilder.toString() == expected } File getServerJar(String version) { File manifestFile = this.downloadVersionManifest(version) Object manifest = new JsonSlurper().parse(manifestFile) File jarFile = new File(dataDirectory, "${version}/server.jar") if (!validateServer(jarFile, manifest.downloads.server.sha1)) { this.println("> Downloading ${version} server...") jarFile.getParentFile().mkdirs() FileUtils.copyURLToFile(new URL(manifest.downloads.server.url), jarFile) } return jarFile } File generateData(MinecraftVersion version) { File cache = getGeneratedCache(version) if (cache != null) { return cache } File jarFile = this.getServerJar(version.getVersionName()) File parent = jarFile.getParentFile() File targetDir = new File(parent, "generated") try { FileUtils.deleteDirectory(targetDir) } catch (IOException ignored) { // Ignored. } String command if (version >= MinecraftVersion.MINECRAFT_1_18) { command = "\"%s\" -DbundlerMainClass=net.minecraft.data.Main -jar \"${jarFile.getAbsolutePath()}\" --reports --server" } else { command = "\"%s\" -cp \"${jarFile.getAbsolutePath()}\" net.minecraft.data.Main --reports --server" } List commandLine; if (System.getProperty("os.name").toLowerCase().contains("win")) { File java = new File(System.getProperty("java.home"), "bin/java.exe") commandLine = ["cmd", "/c", String.format(command, java)] } else { File java = new File(System.getProperty("java.home"), "bin/java") commandLine = ["bash", "-c", String.format(command, java)] } commandLine.execute([], parent).waitFor() // Remove/compact files, reduces disk usage from ~2.9gb to ~92mb (or ~9.5mb on a compressed filesystem) jarFile.delete() FileUtils.deleteDirectory(new File(parent, "logs")) FileUtils.deleteDirectory(new File(parent, "libraries")) FileUtils.deleteDirectory(new File(parent, "versions")) new File(targetDir, "reports/commands.json").delete() FileUtils.deleteDirectory(new File(targetDir, ".cache")) FileUtils.deleteDirectory(new File(targetDir, "reports/biome_parameters")) FileUtils.deleteDirectory(new File(targetDir, "reports/biomes")) FileUtils.deleteDirectory(new File(targetDir, "reports/worldgen")) FileUtils.deleteDirectory(new File(targetDir, "reports/minecraft/components/item")) FileUtils.deleteDirectory(new File(targetDir, "data/minecraft/datapacks")) FileUtils.deleteDirectory(new File(targetDir, "data/minecraft/advancements")) FileUtils.deleteDirectory(new File(targetDir, "data/minecraft/advancement")) FileUtils.deleteDirectory(new File(targetDir, "data/minecraft/recipes")) FileUtils.deleteDirectory(new File(targetDir, "data/minecraft/recipe")) FileUtils.deleteDirectory(new File(targetDir, "data/minecraft/loot_tables")) FileUtils.deleteDirectory(new File(targetDir, "data/minecraft/loot_table")) FileUtils.deleteDirectory(new File(targetDir, "data/minecraft/worldgen")) java.nio.file.Files.walk(parent.toPath(), 32).forEach { it -> if (it.fileName.toString().endsWith(".json")) { java.nio.file.Files.writeString(it, JsonOutput.toJson(new JsonSlurper().parse(it))) } } return targetDir } static Map> getDefaultProperties(Object data) { Map> defaultProperties = new HashMap<>() data.forEach({ key, block -> if (!block.containsKey("properties")) { return } for (Object blockState : block.states) { if (!blockState.containsKey("default") || !blockState.default) { continue } Map properties = blockState["properties"] defaultProperties.put(key, properties) break } }) return defaultProperties } static Map> loadFallbackMapping(File file) { Object map = new JsonSlurper().parse(file) return MinecraftVersion.values().collectEntries({ version -> [version, map.getOrDefault(version.toString(), Collections.emptyMap())] }) } static Map> loadLegacyMapping(File file) { return new JsonSlurper().parse(file).collectEntries({ version, mapping -> [MinecraftVersion.valueOf(version), mapping.collectEntries({ block, id -> [block, Integer.parseInt(id)] })] }) } static int getBlockID(String block, Map> mappings, Map>> properties, Map> fallback, MinecraftVersion version) { Map> defaultProperties if (version >= MinecraftVersion.MINECRAFT_1_13) { defaultProperties = properties[version] } else { defaultProperties = properties[MinecraftVersion.MINECRAFT_1_18_2] } String[] split = block.split("\\[") String noArgBlock = split[0] MinecraftVersion fallbackVersion = MinecraftVersion.MAXIMUM_VERSION while (fallbackVersion != version) { --fallbackVersion noArgBlock = fallback[fallbackVersion].getOrDefault(noArgBlock, noArgBlock) } Map blockProperties = defaultProperties[noArgBlock] String targetBlockID if (blockProperties == null) { targetBlockID = noArgBlock } else { Map currentProperties = new TreeMap<>(blockProperties) if (split.length > 1) { String[] args = split[1].split(",") Map input = Arrays.stream(args) .map(arg -> arg.replace("]", "").split("=")) .collect(Collectors.toMap(parts -> parts[0], parts -> parts[1])) input.forEach({ key, value -> if (currentProperties.containsKey(key)) { currentProperties.put(key, value) } }) } targetBlockID = noArgBlock + Arrays.toString( currentProperties.collect({ k, v -> k + "=" + v }).toArray() ).replace(" ", "") } Integer id = mappings[version][targetBlockID] if (id == null && blockProperties != null) { targetBlockID = noArgBlock + Arrays.toString( new TreeMap<>(blockProperties).collect({ k, v -> k + "=" + v }).toArray() ).replace(" ", "") id = mappings[version][targetBlockID] } if (id == null) { System.err.println("No ${version.getVersionName()} fallback data for ${noArgBlock}, replacing with minecraft:stone") id = 1 } return id } static Map getBlockMappings(Object data, Map> defaultPropertiesMap) { Map mapping = new HashMap<>() data.forEach({ blockID, blockData -> for (Object blockState : blockData.states) { int protocolID = blockState.id if (blockState.containsKey("properties")) { Map stateProperties = blockState["properties"] Map properties = new TreeMap<>( defaultPropertiesMap.getOrDefault(blockID, Collections.emptyMap())) properties.putAll(stateProperties) String stateID = blockID + Arrays.toString( properties.collect({ k, v -> k + "=" + v }).toArray() ).replace(" ", "") mapping.put(stateID, protocolID) } else { mapping.put(blockID, protocolID) } } }) return mapping } void generateBlockMappings(File targetDir, Map blockReports) { File defaultBlockPropertiesFile = new File(targetDir, "defaultblockproperties.json") File blockStatesFile = new File(targetDir, "blockstates.json") File blockStatesMappingFile = new File(targetDir, "blockstates_mapping.json") File legacyBlocksFile = new File(targetDir, "legacyblocks.json") if (checkIsCacheValid(defaultBlockPropertiesFile) || checkIsCacheValid(blockStatesFile) || checkIsCacheValid(blockStatesMappingFile) || checkIsCacheValid(legacyBlocksFile)) { this.println("> Generating default block properties...") Map>> defaultProperties = blockReports.collectEntries({ version, report -> [version, getDefaultProperties(report)] }) defaultBlockPropertiesFile.write(JsonOutput.prettyPrint( JsonOutput.toJson(defaultProperties[MinecraftVersion.MAXIMUM_VERSION].sort())), "UTF-8") this.println("> Generating blockstates...") Map> mappings = loadLegacyMapping( new File(this.getProjectDir(), "mapping/legacyblockmapping.json")) blockReports.forEach({ version, report -> mappings.put(version, getBlockMappings(report, defaultProperties[version])) }) Map blocks = mappings[MinecraftVersion.MAXIMUM_VERSION] blockStatesFile.write( JsonOutput.prettyPrint(JsonOutput.toJson( blocks.sort(Map.Entry::getValue) .collectEntries({ k, v -> [k, String.valueOf(v)] }) )), "UTF-8") this.println("> Generating blockstates mapping...") Map> fallbackMapping = loadFallbackMapping( new File(this.getProjectDir(), "mapping/fallbackdata.json")) Map> blockstateMapping = new LinkedHashMap<>() blocks.sort(Map.Entry::getValue) .forEach({ block, modernID -> Map blockMapping = new LinkedHashMap<>() int lastID = -1 for (MinecraftVersion version : MinecraftVersion.values()) { int id = getBlockID(block, mappings, defaultProperties, fallbackMapping, version) if (lastID != id) { blockMapping.put(version.getVersionName(), String.valueOf(lastID = id)) } } blockstateMapping.put(String.valueOf(modernID), blockMapping) }) blockStatesMappingFile.write( JsonOutput.prettyPrint(JsonOutput.toJson(blockstateMapping)), "UTF-8") this.println("> Generating legacy blocks...") Map legacyData = new JsonSlurper().parse( new File(this.getProjectDir(), "mapping/legacyblocks.json")) legacyData = legacyData.collectEntries({ legacy, modern -> [legacy, String.valueOf(getBlockID(modern, mappings, defaultProperties, fallbackMapping, MinecraftVersion.MAXIMUM_VERSION))] }) legacyBlocksFile.write( JsonOutput.prettyPrint(JsonOutput.toJson(legacyData)), "UTF-8") } } static Map> sortRegistryMapping(Map> mapping) { return mapping.collectEntries({ modernID, map -> [modernID, map.sort({ if (it.getKey().contains(".")) { return MinecraftVersion.fromVersionName(it.getKey()) } else { return MinecraftVersion.MINIMUM_VERSION } })] }).sort() } void generateRegistryMapping(String target, File targetDir, Map registriesReports) { File targetFile = new File(targetDir, "${target}s.json"); File targetMappingFile = new File(targetDir, "${target}s_mapping.json"); if (checkIsCacheValid(targetFile) || checkIsCacheValid(targetMappingFile)) { this.println("> Generating ${target}s...") Map> idMap = registriesReports.collectEntries({ version, registry -> Object entries = registry["minecraft:${target}"].entries return [version, entries.collectEntries({ name, id -> [name, String.valueOf(id["protocol_id"])] })] }) Map modernIDs = Collections.max(idMap.entrySet(), Map.Entry.comparingByKey()).getValue() targetFile.write(JsonOutput.prettyPrint( JsonOutput.toJson(modernIDs.sort({Integer.parseInt(it.getValue()) }))), "UTF-8") this.println("> Generating ${target}s mapping...") Map> mapping = new JsonSlurper() .parse(new File(this.getProjectDir(), "mapping/legacy_${target}s_mapping.json")) .collectEntries({ key, value -> { if (modernIDs[key] == null) { throw new IllegalStateException("No modern id found for $key") } return [modernIDs[key], value] } }) idMap.forEach({ version, ids -> ids.forEach({ key, id -> if (!modernIDs.containsKey(key)) { return } mapping.computeIfAbsent(modernIDs[key], _ -> new LinkedHashMap<>()).put(version.getVersionName(), id) }) }) mapping = sortRegistryMapping(mapping) targetMappingFile.write(JsonOutput.prettyPrint( JsonOutput.toJson(mapping.sort({ Integer.parseInt(it.getKey()) }))), "UTF-8") } } void generateRegistryMappings(File targetDir, Map registriesReports) { this.generateRegistryMapping("item", targetDir, registriesReports .findAll({ e -> MinecraftVersion.WORLD_VERSIONS.contains(e.getKey()) })) this.generateRegistryMapping("block", targetDir, registriesReports) this.generateRegistryMapping("data_component_type", targetDir, registriesReports .findAll({ e -> e.getKey() >= MinecraftVersion.MINECRAFT_1_20_5 })) File blockEntitiesMappingFile = new File(targetDir, "blockentities_mapping.json"); if (checkIsCacheValid(blockEntitiesMappingFile)) { this.println("> Generating blockentities mapping...") Map> blockentities = new JsonSlurper() .parse(new File(this.getProjectDir(), "mapping/legacy_blockentities_mapping.json")) registriesReports.forEach({ version, registries -> if (version < MinecraftVersion.MINECRAFT_1_19) { return } registries["minecraft:block_entity_type"].entries.forEach({ key, value -> int id = value.protocol_id blockentities.computeIfAbsent(key, _ -> new LinkedHashMap<>()) .put(version.getVersionName(), String.valueOf(id)) }) }) blockentities = sortRegistryMapping(blockentities) blockEntitiesMappingFile.write( JsonOutput.prettyPrint(JsonOutput.toJson(blockentities)), "UTF-8") } } static Map>> getTags(File tagDir, Map tagTypes) { Map>> tags = new LinkedHashMap<>() tagTypes.forEach({ directory, key -> File directoryFile = new File(tagDir, directory) if (!directoryFile.exists()) { return } Map> typeTags = new HashMap<>() Map> tempTags = new HashMap<>() directoryFile.eachFileRecurse(FileType.FILES, { file -> List values = new JsonSlurper().parse(file).values Path relativePath = directoryFile.toPath().relativize(file.toPath()) String name = FilenameUtils.removeExtension(relativePath.toString()).replace(File.separatorChar, '/' as char) typeTags.put("minecraft:" + name, values) }) boolean flatten = false while (!flatten) { flatten = true typeTags.forEach({ name, currentTags -> List newTags = new ArrayList<>() currentTags.forEach({ currentTag -> if (currentTag.startsWith("#")) { newTags.addAll(typeTags.get(currentTag.substring(1))) flatten = false } else { newTags.add(currentTag) } }) tempTags.put(name, newTags) }) typeTags = tempTags tempTags = new HashMap<>() } tags.put(key, typeTags) }) return tags } void generateTags(File targetDir, Map tagDirs) { File tagsFile = new File(targetDir, "tags.json"); if (checkIsCacheValid(tagsFile)) { this.println("> Generating tags...") Map tagTypes = new JsonSlurper().parse(new File(getProjectDir(), "mapping/tag_types.json")) Map>>> allTags = tagDirs.collectEntries({ version, dir -> [version, getTags(dir, tagTypes.tag_types)] }) Map>> mergedTags = new LinkedHashMap<>() allTags.forEach({ version, tags -> tags.forEach({ type, typeTags -> { Map> mergedTypeTags = mergedTags.computeIfAbsent(type, _ -> new HashMap<>()) typeTags.forEach({ name, values -> Set mergedValues = mergedTypeTags.computeIfAbsent(name, _ -> new HashSet<>()) if (!tagTypes.supported_tag_types.contains(type)) { return } mergedValues.addAll(values) }) }}) }) mergedTags = mergedTags.collectEntries({ type, typeTags -> [type, typeTags.collectEntries({ name, values -> [name, values.sort()] }).sort()] }) tagsFile.write(JsonOutput.prettyPrint(JsonOutput.toJson(mergedTags)), "UTF-8") } } tasks.register("generateMappings") { dependsOn(downloadManifest) File targetDir = new File(generatedDir, "mapping") targetDir.mkdirs() this.println("> Generating Minecraft data...") Map generated = Arrays.stream(MinecraftVersion.values()) .dropWhile({ it < MinecraftVersion.MINECRAFT_1_13 }) .collect(Collectors.toMap(Function.identity(), this::generateData)) Map blockReports = generated.collectEntries({ version, directory -> [version, new JsonSlurper().parse(new File(directory, "reports/blocks.json"))] }) this.generateBlockMappings(targetDir, blockReports) Map registriesReports = generated .findAll({ it.getKey() >= MinecraftVersion.MINECRAFT_1_14 }) .collectEntries({ version, directory -> [version, new JsonSlurper().parse(new File(directory, "reports/registries.json"))] }) this.generateRegistryMappings(targetDir, registriesReports) Map tags = generated .collectEntries({ version, directory -> [version, new File(directory, "data/minecraft/tags")] }) this.generateTags(targetDir, tags) } processResources.dependsOn(generateMappings) ================================================ FILE: plugin/mapping/fallbackdata.json ================================================ { "MINECRAFT_1_21_11": { "minecraft:golden_dandelion": "minecraft:dandelion", "minecraft:potted_golden_dandelion": "minecraft:potted_dandelion" }, "MINECRAFT_1_21_7": { "minecraft:acacia_shelf": "minecraft:acacia_planks", "minecraft:bamboo_shelf": "minecraft:bamboo_planks", "minecraft:birch_shelf": "minecraft:birch_planks", "minecraft:cherry_shelf": "minecraft:cherry_planks", "minecraft:crimson_shelf": "minecraft:crimson_planks", "minecraft:dark_oak_shelf": "minecraft:dark_oak_planks", "minecraft:jungle_shelf": "minecraft:jungle_planks", "minecraft:mangrove_shelf": "minecraft:mangrove_planks", "minecraft:oak_shelf": "minecraft:oak_planks", "minecraft:pale_oak_shelf": "minecraft:oak_planks", "minecraft:spruce_shelf": "minecraft:spruce_planks", "minecraft:warped_shelf": "minecraft:warped_planks", "minecraft:copper_chest": "minecraft:chest", "minecraft:exposed_copper_chest": "minecraft:chest", "minecraft:weathered_copper_chest": "minecraft:chest", "minecraft:oxidized_copper_chest": "minecraft:chest", "minecraft:waxed_copper_chest": "minecraft:chest", "minecraft:waxed_exposed_copper_chest": "minecraft:chest", "minecraft:waxed_weathered_copper_chest": "minecraft:chest", "minecraft:waxed_oxidized_copper_chest": "minecraft:chest", "minecraft:copper_golem_statue": "minecraft:copper_block", "minecraft:exposed_copper_golem_statue": "minecraft:copper_block", "minecraft:weathered_copper_golem_statue": "minecraft:copper_block", "minecraft:oxidized_copper_golem_statue": "minecraft:copper_block", "minecraft:waxed_copper_golem_statue": "minecraft:copper_block", "minecraft:waxed_exposed_copper_golem_statue": "minecraft:copper_block", "minecraft:waxed_weathered_copper_golem_statue": "minecraft:copper_block", "minecraft:waxed_oxidized_copper_golem_statue": "minecraft:copper_block", "minecraft:exposed_lightning_rod": "minecraft:lightning_rod", "minecraft:weathered_lightning_rod": "minecraft:lightning_rod", "minecraft:oxidized_lightning_rod": "minecraft:lightning_rod", "minecraft:waxed_lightning_rod": "minecraft:lightning_rod", "minecraft:waxed_exposed_lightning_rod": "minecraft:lightning_rod", "minecraft:waxed_weathered_lightning_rod": "minecraft:lightning_rod", "minecraft:waxed_oxidized_lightning_rod": "minecraft:lightning_rod", "minecraft:copper_torch": "minecraft:soul_torch", "minecraft:copper_wall_torch": "minecraft:soul_wall_torch", "minecraft:copper_bars": "minecraft:iron_bars", "minecraft:exposed_copper_bars": "minecraft:iron_bars", "minecraft:weathered_copper_bars": "minecraft:iron_bars", "minecraft:oxidized_copper_bars": "minecraft:iron_bars", "minecraft:waxed_copper_bars": "minecraft:iron_bars", "minecraft:waxed_exposed_copper_bars": "minecraft:iron_bars", "minecraft:waxed_weathered_copper_bars": "minecraft:iron_bars", "minecraft:waxed_oxidized_copper_bars": "minecraft:iron_bars", "minecraft:copper_chain": "minecraft:chain", "minecraft:exposed_copper_chain": "minecraft:chain", "minecraft:weathered_copper_chain": "minecraft:chain", "minecraft:oxidized_copper_chain": "minecraft:chain", "minecraft:waxed_copper_chain": "minecraft:chain", "minecraft:waxed_exposed_copper_chain": "minecraft:chain", "minecraft:waxed_weathered_copper_chain": "minecraft:chain", "minecraft:waxed_oxidized_copper_chain": "minecraft:chain", "minecraft:copper_lantern": "minecraft:soul_lantern", "minecraft:exposed_copper_lantern": "minecraft:soul_lantern", "minecraft:weathered_copper_lantern": "minecraft:soul_lantern", "minecraft:oxidized_copper_lantern": "minecraft:soul_lantern", "minecraft:waxed_copper_lantern": "minecraft:soul_lantern", "minecraft:waxed_exposed_copper_lantern": "minecraft:soul_lantern", "minecraft:waxed_weathered_copper_lantern": "minecraft:soul_lantern", "minecraft:waxed_oxidized_copper_lantern": "minecraft:soul_lantern", "minecraft:iron_chain": "minecraft:chain" }, "MINECRAFT_1_21_5": { "minecraft:dried_ghast": "minecraft:chorus_plant" }, "MINECRAFT_1_21_4": { "minecraft:wildflowers": "minecraft:glow_lichen", "minecraft:leaf_litter": "minecraft:glow_lichen", "minecraft:test_block": "minecraft:structure_block", "minecraft:test_instance_block": "minecraft:structure_block", "minecraft:bush": "minecraft:short_grass", "minecraft:firefly_bush": "minecraft:short_grass", "minecraft:short_dry_grass": "minecraft:short_grass", "minecraft:tall_dry_grass": "minecraft:short_grass", "minecraft:cactus_flower": "minecraft:brain_coral_fan" }, "MINECRAFT_1_21_2": { "minecraft:resin_clump": "minecraft:glow_lichen", "minecraft:resin_block": "minecraft:cut_copper", "minecraft:resin_bricks": "minecraft:bricks", "minecraft:resin_brick_stairs": "minecraft:brick_stairs", "minecraft:resin_brick_slab": "minecraft:brick_slab", "minecraft:resin_brick_wall": "minecraft:brick_wall", "minecraft:chiseled_resin_bricks": "minecraft:chiseled_copper", "minecraft:open_eyeblossom": "minecraft:torchflower", "minecraft:closed_eyeblossom": "minecraft:cornflower", "minecraft:potted_open_eyeblossom": "minecraft:potted_torchflower", "minecraft:potted_closed_eyeblossom": "minecraft:potted_cornflower" }, "MINECRAFT_1_21": { "minecraft:pale_oak_wood": "minecraft:birch_wood", "minecraft:pale_oak_planks": "minecraft:birch_planks", "minecraft:pale_oak_sapling": "minecraft:birch_sapling", "minecraft:pale_oak_log": "minecraft:birch_log", "minecraft:stripped_pale_oak_log": "minecraft:stripped_birch_log", "minecraft:stripped_pale_oak_wood": "minecraft:stripped_birch_wood", "minecraft:pale_oak_leaves": "minecraft:birch_leaves", "minecraft:creaking_heart": "minecraft:oak_wood", "minecraft:pale_oak_sign": "minecraft:birch_sign", "minecraft:pale_oak_wall_sign": "minecraft:birch_wall_sign", "minecraft:pale_oak_hanging_sign": "minecraft:birch_hanging_sign", "minecraft:pale_oak_wall_hanging_sign": "minecraft:birch_wall_hanging_sign", "minecraft:pale_oak_pressure_plate": "minecraft:birch_pressure_plate", "minecraft:pale_oak_trapdoor": "minecraft:birch_trapdoor", "minecraft:potted_pale_oak_sapling": "minecraft:potted_birch_sapling", "minecraft:pale_oak_button": "minecraft:birch_button", "minecraft:pale_oak_stairs": "minecraft:birch_stairs", "minecraft:pale_oak_slab": "minecraft:birch_slab", "minecraft:pale_oak_fence_gate": "minecraft:birch_fence_gate", "minecraft:pale_oak_fence": "minecraft:birch_fence", "minecraft:pale_oak_door": "minecraft:birch_door", "minecraft:pale_moss_block": "minecraft:moss_block", "minecraft:pale_hanging_moss": "minecraft:hanging_roots", "minecraft:pale_moss_carpet": "minecraft:moss_carpet" }, "MINECRAFT_1_20_3": { "minecraft:vault": "minecraft:spawner", "minecraft:heavy_core": "minecraft:wither_skeleton_skull" }, "MINECRAFT_1_20_2": { "minecraft:short_grass": "minecraft:grass", "minecraft:trial_spawner": "minecraft:spawner", "minecraft:crafter": "minecraft:crafting_table", "minecraft:copper_bulb": "minecraft:shroomlight", "minecraft:exposed_copper_bulb": "minecraft:shroomlight", "minecraft:weathered_copper_bulb": "minecraft:shroomlight", "minecraft:oxidized_copper_bulb": "minecraft:shroomlight", "minecraft:waxed_copper_bulb": "minecraft:shroomlight", "minecraft:waxed_exposed_copper_bulb": "minecraft:shroomlight", "minecraft:waxed_weathered_copper_bulb": "minecraft:shroomlight", "minecraft:waxed_oxidized_copper_bulb": "minecraft:shroomlight", "minecraft:copper_grate": "minecraft:iron_bars", "minecraft:exposed_copper_grate": "minecraft:iron_bars", "minecraft:weathered_copper_grate": "minecraft:iron_bars", "minecraft:oxidized_copper_grate": "minecraft:iron_bars", "minecraft:waxed_copper_grate": "minecraft:iron_bars", "minecraft:waxed_exposed_copper_grate": "minecraft:iron_bars", "minecraft:waxed_weathered_copper_grate": "minecraft:iron_bars", "minecraft:waxed_oxidized_copper_grate": "minecraft:iron_bars", "minecraft:copper_trapdoor": "minecraft:iron_trapdoor", "minecraft:exposed_copper_trapdoor": "minecraft:iron_trapdoor", "minecraft:weathered_copper_trapdoor": "minecraft:iron_trapdoor", "minecraft:oxidized_copper_trapdoor": "minecraft:iron_trapdoor", "minecraft:waxed_copper_trapdoor": "minecraft:iron_trapdoor", "minecraft:waxed_exposed_copper_trapdoor": "minecraft:iron_trapdoor", "minecraft:waxed_weathered_copper_trapdoor": "minecraft:iron_trapdoor", "minecraft:waxed_oxidized_copper_trapdoor": "minecraft:iron_trapdoor", "minecraft:copper_door": "minecraft:iron_door", "minecraft:exposed_copper_door": "minecraft:iron_door", "minecraft:weathered_copper_door": "minecraft:iron_door", "minecraft:oxidized_copper_door": "minecraft:iron_door", "minecraft:waxed_copper_door": "minecraft:iron_door", "minecraft:waxed_exposed_copper_door": "minecraft:iron_door", "minecraft:waxed_weathered_copper_door": "minecraft:iron_door", "minecraft:waxed_oxidized_copper_door": "minecraft:iron_door", "minecraft:tuff_wall": "minecraft:cobblestone_wall", "minecraft:tuff_stairs": "minecraft:cobblestone_stairs", "minecraft:tuff_slab": "minecraft:cobblestone_slab", "minecraft:tuff_brick_wall": "minecraft:stone_brick_wall", "minecraft:tuff_brick_stairs": "minecraft:stone_brick_stairs", "minecraft:tuff_brick_slab": "minecraft:stone_brick_slab", "minecraft:tuff_bricks": "minecraft:stone_bricks", "minecraft:polished_tuff_wall": "minecraft:stone_brick_wall", "minecraft:polished_tuff_stairs": "minecraft:stone_brick_stairs", "minecraft:polished_tuff_slab": "minecraft:stone_brick_slab", "minecraft:polished_tuff": "minecraft:smooth_stone", "minecraft:chiseled_copper": "minecraft:copper_block", "minecraft:exposed_chiseled_copper": "minecraft:exposed_copper", "minecraft:weathered_chiseled_copper": "minecraft:exposed_copper", "minecraft:oxidized_chiseled_copper": "minecraft:exposed_copper", "minecraft:waxed_chiseled_copper": "minecraft:waxed_copper_block", "minecraft:waxed_exposed_chiseled_copper": "minecraft:waxed_copper_block", "minecraft:waxed_weathered_chiseled_copper": "minecraft:waxed_copper_block", "minecraft:waxed_oxidized_chiseled_copper": "minecraft:waxed_copper_block", "minecraft:chiseled_tuff": "minecraft:smooth_stone", "minecraft:chiseled_tuff_bricks": "minecraft:stone_bricks" }, "MINECRAFT_1_19_4": { "minecraft:suspicious_gravel": "minecraft:gravel", "minecraft:pitcher_crop": "minecraft:air", "minecraft:pitcher_plant": "minecraft:air", "minecraft:sniffer_egg": "minecraft:turtle_egg", "minecraft:calibrated_sculk_sensor": "minecraft:sculk_sensor" }, "MINECRAFT_1_19_3": { "minecraft:cherry_planks": "minecraft:birch_planks", "minecraft:cherry_sapling": "minecraft:birch_sapling", "minecraft:suspicious_sand": "minecraft:sand", "minecraft:cherry_log": "minecraft:birch_log", "minecraft:stripped_cherry_log": "minecraft:stripped_birch_log", "minecraft:cherry_wood": "minecraft:birch_wood", "minecraft:stripped_cherry_wood": "minecraft:stripped_birch_wood", "minecraft:cherry_leaves": "minecraft:birch_leaves", "minecraft:torchflower": "minecraft:torch", "minecraft:cherry_sign": "minecraft:birch_sign", "minecraft:cherry_wall_sign": "minecraft:birch_wall_sign", "minecraft:cherry_hanging_sign": "minecraft:birch_hanging_sign", "minecraft:cherry_wall_hanging_sign": "minecraft:birch_wall_hanging_sign", "minecraft:cherry_trapdoor": "minecraft:birch_trapdoor", "minecraft:potted_torchflower": "minecraft:potted_poppy", "minecraft:cherry_button": "minecraft:birch_button", "minecraft:cherry_stairs": "minecraft:birch_stairs", "minecraft:cherry_fence_gate": "minecraft:birch_fence_gate", "minecraft:cherry_fence": "minecraft:birch_fence", "minecraft:cherry_door": "minecraft:birch_door", "minecraft:torchflower_crop": "minecraft:torch", "minecraft:pink_petals": "minecraft:poppy", "minecraft:cherry_pressure_plate": "minecraft:birch_pressure_plate", "minecraft:potted_cherry_sapling": "minecraft:potted_birch_sapling", "minecraft:cherry_slab": "minecraft:birch_slab", "minecraft:decorated_pot": "minecraft:flower_pot" }, "MINECRAFT_1_19_1": { "minecraft:oak_hanging_sign": "minecraft:oak_sign", "minecraft:spruce_hanging_sign": "minecraft:spruce_sign", "minecraft:birch_hanging_sign": "minecraft:birch_sign", "minecraft:acacia_hanging_sign": "minecraft:acacia_sign", "minecraft:jungle_hanging_sign": "minecraft:jungle_sign", "minecraft:dark_oak_hanging_sign": "minecraft:dark_oak_sign", "minecraft:crimson_hanging_sign": "minecraft:crimson_sign", "minecraft:warped_hanging_sign": "minecraft:warped_sign", "minecraft:mangrove_hanging_sign": "minecraft:mangrove_sign", "minecraft:bamboo_hanging_sign": "minecraft:birch_sign", "minecraft:oak_wall_hanging_sign": "minecraft:oak_wall_sign", "minecraft:spruce_wall_hanging_sign": "minecraft:spruce_wall_sign", "minecraft:birch_wall_hanging_sign": "minecraft:birch_wall_sign", "minecraft:acacia_wall_hanging_sign": "minecraft:acacia_wall_sign", "minecraft:jungle_wall_hanging_sign": "minecraft:jungle_wall_sign", "minecraft:dark_oak_wall_hanging_sign": "minecraft:dark_oak_wall_sign", "minecraft:mangrove_wall_hanging_sign": "minecraft:mangrove_wall_sign", "minecraft:crimson_wall_hanging_sign": "minecraft:crimson_wall_sign", "minecraft:warped_wall_hanging_sign": "minecraft:warped_wall_sign", "minecraft:bamboo_wall_hanging_sign": "minecraft:birch_wall_sign", "minecraft:bamboo_door": "minecraft:birch_door", "minecraft:bamboo_trapdoor": "minecraft:birch_trapdoor", "minecraft:bamboo_button": "minecraft:birch_button", "minecraft:bamboo_stairs": "minecraft:birch_stairs", "minecraft:bamboo_mosaic_stairs": "minecraft:birch_stairs", "minecraft:bamboo_slab": "minecraft:birch_slab", "minecraft:bamboo_mosaic_slab": "minecraft:birch_slab", "minecraft:bamboo_sign": "minecraft:birch_sign", "minecraft:bamboo_wall_sign": "minecraft:birch_wall_sign", "minecraft:bamboo_fence_gate": "minecraft:birch_fence_gate", "minecraft:bamboo_fence": "minecraft:birch_fence", "minecraft:bamboo_pressure_plate": "minecraft:birch_pressure_plate", "minecraft:bamboo_planks": "minecraft:birch_planks", "minecraft:bamboo_mosaic": "minecraft:birch_planks", "minecraft:bamboo_block": "minecraft:birch_planks", "minecraft:stripped_bamboo_block": "minecraft:birch_planks", "minecraft:chiseled_bookshelf": "minecraft:bookshelf", "minecraft:piglin_wall_head": "minecraft:zombie_wall_head", "minecraft:piglin_head": "minecraft:zombie_head" }, "MINECRAFT_1_18_2": { "minecraft:ochre_froglight": "minecraft:sea_lantern", "minecraft:pearlescent_froglight": "minecraft:sea_lantern", "minecraft:verdant_froglight": "minecraft:sea_lantern", "minecraft:frogspawn": "minecraft:air", "minecraft:mangrove_planks": "minecraft:dark_oak_planks", "minecraft:mangrove_propagule": "minecraft:dark_oak_sapling", "minecraft:mangrove_log": "minecraft:dark_oak_log", "minecraft:mangrove_roots": "minecraft:dark_oak_leaves", "minecraft:muddy_mangrove_roots": "minecraft:coal_block", "minecraft:stripped_mangrove_log": "minecraft:stripped_dark_oak_log", "minecraft:mangrove_wood": "minecraft:dark_oak_wood", "minecraft:stripped_mangrove_wood": "minecraft:stripped_dark_oak_wood", "minecraft:mangrove_leaves": "minecraft:dark_oak_leaves", "minecraft:mangrove_sign": "minecraft:dark_oak_sign", "minecraft:mangrove_wall_sign": "minecraft:dark_oak_wall_sign", "minecraft:mangrove_pressure_plate": "minecraft:dark_oak_pressure_plate", "minecraft:mangrove_trapdoor": "minecraft:dark_oak_trapdoor", "minecraft:potted_mangrove_propagule": "minecraft:potted_dark_oak_sapling", "minecraft:mangrove_button": "minecraft:dark_oak_button", "minecraft:mangrove_stairs": "minecraft:dark_oak_stairs", "minecraft:mangrove_slab": "minecraft:dark_oak_slab", "minecraft:mangrove_fence_gate": "minecraft:dark_oak_fence_gate", "minecraft:mangrove_fence": "minecraft:dark_oak_fence", "minecraft:mangrove_door": "minecraft:dark_oak_door", "minecraft:mud": "minecraft:coal_block", "minecraft:packed_mud": "minecraft:coarse_dirt", "minecraft:mud_bricks": "minecraft:end_stone_bricks", "minecraft:mud_brick_stairs": "minecraft:end_stone_brick_stairs", "minecraft:mud_brick_slab": "minecraft:end_stone_brick_slab", "minecraft:mud_brick_wall": "minecraft:end_stone_brick_wall", "minecraft:reinforced_deepslate": "minecraft:deepslate", "minecraft:sculk": "minecraft:obsidian", "minecraft:sculk_catalyst": "minecraft:end_portal_frame", "minecraft:sculk_shrieker": "minecraft:sculk_sensor", "minecraft:sculk_vein": "minecraft:air" }, "MINECRAFT_1_16_4": { "minecraft:copper_ore": "minecraft:iron_ore", "minecraft:copper_block": "minecraft:polished_granite", "minecraft:cut_copper": "minecraft:red_sandstone", "minecraft:cut_copper_stairs": "minecraft:red_sandstone_stairs", "minecraft:cut_copper_slab": "minecraft:red_sandstone_slab", "minecraft:exposed_copper": "minecraft:red_sandstone", "minecraft:exposed_cut_copper": "minecraft:red_sandstone", "minecraft:exposed_cut_copper_stairs": "minecraft:red_sandstone_stairs", "minecraft:exposed_cut_copper_slab": "minecraft:red_sandstone_slab", "minecraft:oxidized_copper": "minecraft:dark_prismarine", "minecraft:oxidized_cut_copper": "minecraft:dark_prismarine", "minecraft:oxidized_cut_copper_stairs": "minecraft:dark_prismarine_stairs", "minecraft:oxidized_cut_copper_slab": "minecraft:dark_prismarine_slab", "minecraft:weathered_copper": "minecraft:dark_prismarine", "minecraft:weathered_cut_copper": "minecraft:dark_prismarine", "minecraft:weathered_cut_copper_stairs": "minecraft:dark_prismarine_stairs", "minecraft:weathered_cut_copper_slab": "minecraft:dark_prismarine_stairs", "minecraft:waxed_copper_block": "minecraft:red_sandstone", "minecraft:waxed_cut_copper": "minecraft:red_sandstone", "minecraft:waxed_cut_copper_stairs": "minecraft:red_sandstone_stairs", "minecraft:waxed_cut_copper_slab": "minecraft:red_sandstone_stairs", "minecraft:waxed_weathered_copper": "minecraft:dark_prismarine", "minecraft:waxed_weathered_cut_copper": "minecraft:dark_prismarine", "minecraft:waxed_weathered_cut_copper_stairs": "minecraft:dark_prismarine_stairs", "minecraft:waxed_weathered_cut_copper_slab": "minecraft:dark_prismarine_slab", "minecraft:waxed_exposed_copper": "minecraft:polished_granite", "minecraft:waxed_exposed_cut_copper": "minecraft:polished_granite", "minecraft:waxed_exposed_cut_copper_stairs": "minecraft:polished_granite_stairs", "minecraft:waxed_exposed_cut_copper_slab": "minecraft:polished_granite", "minecraft:waxed_oxidized_copper": "minecraft:prismarine", "minecraft:waxed_oxidized_cut_copper": "minecraft:prismarine", "minecraft:waxed_oxidized_cut_copper_stairs": "minecraft:prismarine_stairs", "minecraft:waxed_oxidized_cut_copper_slab": "minecraft:prismarine_slab", "minecraft:candle": "minecraft:air", "minecraft:lime_candle": "minecraft:air", "minecraft:magenta_candle": "minecraft:air", "minecraft:brown_candle": "minecraft:air", "minecraft:cyan_candle": "minecraft:air", "minecraft:purple_candle": "minecraft:air", "minecraft:green_candle": "minecraft:air", "minecraft:blue_candle": "minecraft:air", "minecraft:red_candle": "minecraft:air", "minecraft:white_candle": "minecraft:air", "minecraft:yellow_candle": "minecraft:air", "minecraft:light_blue_candle": "minecraft:air", "minecraft:gray_candle": "minecraft:air", "minecraft:light_gray_candle": "minecraft:air", "minecraft:orange_candle": "minecraft:air", "minecraft:black_candle": "minecraft:air", "minecraft:pink_candle": "minecraft:air", "minecraft:candle_cake": "minecraft:cake", "minecraft:gray_candle_cake": "minecraft:cake", "minecraft:lime_candle_cake": "minecraft:cake", "minecraft:pink_candle_cake": "minecraft:cake", "minecraft:red_candle_cake": "minecraft:cake", "minecraft:light_gray_candle_cake": "minecraft:cake", "minecraft:brown_candle_cake": "minecraft:cake", "minecraft:light_blue_candle_cake": "minecraft:cake", "minecraft:magenta_candle_cake": "minecraft:cake", "minecraft:cyan_candle_cake": "minecraft:cake", "minecraft:white_candle_cake": "minecraft:cake", "minecraft:yellow_candle_cake": "minecraft:cake", "minecraft:black_candle_cake": "minecraft:cake", "minecraft:green_candle_cake": "minecraft:cake", "minecraft:purple_candle_cake": "minecraft:cake", "minecraft:blue_candle_cake": "minecraft:cake", "minecraft:orange_candle_cake": "minecraft:cake", "minecraft:potted_flowering_azalea_bush": "minecraft:potted_oak_sapling", "minecraft:potted_azalea_bush": "minecraft:potted_oak_sapling", "minecraft:sculk_sensor": "minecraft:daylight_detector", "minecraft:flowering_azalea_leaves": "minecraft:oak_leaves", "minecraft:flowering_azalea": "minecraft:oak_leaves", "minecraft:azalea": "minecraft:oak_leaves", "minecraft:azalea_leaves": "minecraft:oak_leaves", "minecraft:deepslate": "minecraft:blackstone", "minecraft:deepslate_tiles": "minecraft:blackstone", "minecraft:cracked_deepslate_tiles": "minecraft:blackstone", "minecraft:infested_deepslate": "minecraft:blackstone", "minecraft:deepslate_bricks": "minecraft:polished_blackstone_bricks", "minecraft:cracked_deepslate_bricks": "minecraft:cracked_polished_blackstone_bricks", "minecraft:deepslate_tile_wall": "minecraft:blackstone_wall", "minecraft:deepslate_tile_slab": "minecraft:blackstone_slab", "minecraft:deepslate_tile_stairs": "minecraft:polished_blackstone_stairs", "minecraft:deepslate_brick_wall": "minecraft:blackstone_wall", "minecraft:deepslate_brick_slab": "minecraft:blackstone_slab", "minecraft:deepslate_brick_stairs": "minecraft:polished_blackstone_stairs", "minecraft:polished_deepslate": "minecraft:polished_blackstone", "minecraft:polished_deepslate_wall": "minecraft:polished_blackstone_wall", "minecraft:polished_deepslate_slab": "minecraft:polished_blackstone_slab", "minecraft:polished_deepslate_stairs": "minecraft:polished_blackstone_stairs", "minecraft:cobbled_deepslate": "minecraft:blackstone", "minecraft:cobbled_deepslate_wall": "minecraft:blackstone_wall", "minecraft:cobbled_deepslate_stairs": "minecraft:blackstone_stairs", "minecraft:cobbled_deepslate_slab": "minecraft:blackstone_slab", "minecraft:chiseled_deepslate": "minecraft:blackstone", "minecraft:calcite": "minecraft:polished_diorite", "minecraft:light": "minecraft:air", "minecraft:pointed_dripstone": "minecraft:air", "minecraft:dripstone_block": "minecraft:terracotta", "minecraft:glow_lichen": "minecraft:air", "minecraft:cave_vines": "minecraft:vine", "minecraft:cave_vines_plant": "minecraft:tall_grass", "minecraft:big_dripleaf": "minecraft:grass", "minecraft:big_dripleaf_stem": "minecraft:tall_grass", "minecraft:small_dripleaf": "minecraft:grass", "minecraft:deepslate_iron_ore": "minecraft:iron_ore", "minecraft:deepslate_copper_ore": "minecraft:iron_ore", "minecraft:deepslate_emerald_ore": "minecraft:emerald_ore", "minecraft:deepslate_diamond_ore": "minecraft:diamond_ore", "minecraft:deepslate_coal_ore": "minecraft:coal_ore", "minecraft:deepslate_gold_ore": "minecraft:gold_ore", "minecraft:deepslate_redstone_ore": "minecraft:redstone_ore", "minecraft:deepslate_lapis_ore": "minecraft:lapis_ore", "minecraft:raw_gold_block": "minecraft:gold_block", "minecraft:raw_iron_block": "minecraft:iron_block", "minecraft:raw_copper_block": "minecraft:iron_block", "minecraft:tuff": "minecraft:cobblestone", "minecraft:amethyst_cluster": "minecraft:air", "minecraft:small_amethyst_bud": "minecraft:air", "minecraft:medium_amethyst_bud": "minecraft:air", "minecraft:large_amethyst_bud": "minecraft:air", "minecraft:budding_amethyst": "minecraft:purpur_block", "minecraft:amethyst_block": "minecraft:purpur_block", "minecraft:spore_blossom": "minecraft:air", "minecraft:lightning_rod": "minecraft:granite_wall", "minecraft:tinted_glass": "minecraft:black_stained_glass", "minecraft:hanging_roots": "minecraft:air", "minecraft:water_cauldron": "minecraft:cauldron", "minecraft:powder_snow_cauldron": "minecraft:cauldron", "minecraft:lava_cauldron": "minecraft:cauldron", "minecraft:powder_snow": "minecraft:snow", "minecraft:smooth_basalt": "minecraft:blackstone", "minecraft:rooted_dirt": "minecraft:dirt", "minecraft:moss_block": "minecraft:grass_block", "minecraft:moss_carpet": "minecraft:lime_carpet", "minecraft:dirt_path": "minecraft:grass_path" }, "MINECRAFT_1_15_2": { "minecraft:blackstone": "minecraft:stone", "minecraft:gilded_blackstone": "minecraft:stone", "minecraft:blackstone_stairs": "minecraft:stone_stairs", "minecraft:blackstone_wall": "minecraft:cobblestone_wall", "minecraft:blackstone_slab": "minecraft:stone_slab", "minecraft:polished_blackstone": "minecraft:polished_andesite", "minecraft:polished_blackstone_wall": "minecraft:cobblestone_wall", "minecraft:polished_blackstone_stairs": "minecraft:stone_stairs", "minecraft:polished_blackstone_slab": "minecraft:stone_slab", "minecraft:polished_blackstone_button": "minecraft:stone_button", "minecraft:polished_blackstone_pressure_plate": "minecraft:stone_pressure_plate", "minecraft:polished_blackstone_bricks": "minecraft:stone_bricks", "minecraft:polished_blackstone_brick_wall": "minecraft:stone_brick_wall", "minecraft:polished_blackstone_brick_stairs": "minecraft:stone_brick_stairs", "minecraft:polished_blackstone_brick_slab": "minecraft:stone_brick_slab", "minecraft:cracked_polished_blackstone_bricks": "minecraft:cracked_stone_bricks", "minecraft:chiseled_polished_blackstone": "minecraft:stone_bricks", "minecraft:cracked_nether_bricks": "minecraft:nether_bricks", "minecraft:chiseled_nether_bricks": "minecraft:nether_bricks", "minecraft:crimson_trapdoor": "minecraft:acacia_trapdoor", "minecraft:crimson_sign": "minecraft:acacia_sign", "minecraft:crimson_planks": "minecraft:acacia_planks", "minecraft:crimson_stairs": "minecraft:acacia_stairs", "minecraft:crimson_wall_sign": "minecraft:acacia_wall_sign", "minecraft:crimson_button": "minecraft:acacia_button", "minecraft:crimson_fence": "minecraft:acacia_fence", "minecraft:crimson_roots": "minecraft:fire_coral", "minecraft:potted_crimson_roots": "minecraft:flower_pot", "minecraft:stripped_crimson_stem": "minecraft:stripped_acacia_log", "minecraft:crimson_fence_gate": "minecraft:acacia_fence_gate", "minecraft:crimson_door": "minecraft:acacia_door", "minecraft:stripped_crimson_hyphae": "minecraft:stripped_acacia_log", "minecraft:crimson_hyphae": "minecraft:acacia_log", "minecraft:crimson_stem": "minecraft:acacia_log", "minecraft:crimson_fungus": "minecraft:red_mushroom", "minecraft:potted_crimson_fungus": "minecraft:potted_red_mushroom", "minecraft:crimson_slab": "minecraft:acacia_slab", "minecraft:crimson_nylium": "minecraft:netherrack", "minecraft:crimson_pressure_plate": "minecraft:acacia_pressure_plate", "minecraft:warped_sign": "minecraft:oak_sign", "minecraft:warped_wall_sign": "minecraft:oak_wall_sign", "minecraft:warped_button": "minecraft:oak_button", "minecraft:warped_fence": "minecraft:oak_fence", "minecraft:warped_stairs": "minecraft:oak_stairs", "minecraft:warped_door": "minecraft:oak_door", "minecraft:warped_pressure_plate": "minecraft:oak_pressure_plate", "minecraft:warped_fence_gate": "minecraft:oak_fence_gate", "minecraft:warped_trapdoor": "minecraft:oak_trapdoor", "minecraft:warped_slab": "minecraft:oak_slab", "minecraft:stripped_warped_stem": "minecraft:stripped_oak_log", "minecraft:warped_stem": "minecraft:oak_log", "minecraft:warped_roots": "minecraft:air", "minecraft:potted_warped_roots": "minecraft:flower_pot", "minecraft:potted_warped_fungus": "minecraft:potted_brown_mushroom", "minecraft:warped_hyphae": "minecraft:oak_log", "minecraft:stripped_warped_hyphae": "minecraft:stripped_oak_log", "minecraft:warped_fungus": "minecraft:brown_mushroom", "minecraft:warped_planks": "minecraft:oak_planks", "minecraft:warped_wart_block": "minecraft:oak_planks", "minecraft:ancient_debris": "minecraft:jungle_log", "minecraft:netherite_block": "minecraft:nether_bricks", "minecraft:soul_wall_torch": "minecraft:wall_torch", "minecraft:soul_torch": "minecraft:torch", "minecraft:soul_lantern": "minecraft:lantern", "minecraft:soul_campfire": "minecraft:campfire", "minecraft:soul_fire": "minecraft:fire", "minecraft:lodestone": "minecraft:polished_andesite", "minecraft:chain": "minecraft:iron_bars", "minecraft:respawn_anchor": "minecraft:furnace", "minecraft:weeping_vines": "minecraft:fire_coral", "minecraft:weeping_vines_plant": "minecraft:fire_coral", "minecraft:twisting_vines": "minecraft:tube_coral", "minecraft:twisting_vines_plant": "minecraft:tube_coral", "minecraft:nether_sprouts": "minecraft:grass", "minecraft:nether_gold_ore": "minecraft:netherrack", "minecraft:crying_obsidian": "minecraft:obsidian", "minecraft:shroomlight": "minecraft:glowstone", "minecraft:warped_nylium": "minecraft:netherrack", "minecraft:soul_soil": "minecraft:soul_sand", "minecraft:target": "minecraft:quartz_block", "minecraft:polished_basalt": "minecraft:stone", "minecraft:basalt": "minecraft:cobblestone", "minecraft:quartz_bricks": "minecraft:quartz_block" }, "MINECRAFT_1_14_4": { "minecraft:bee_nest": "minecraft:birch_planks", "minecraft:beehive": "minecraft:birch_planks", "minecraft:honeycomb_block": "minecraft:yellow_glazed_terracotta", "minecraft:honey_block": "minecraft:yellow_stained_glass" }, "MINECRAFT_1_13_2": { "minecraft:lily_of_the_valley": "minecraft:white_tulip", "minecraft:potted_lily_of_the_valley": "minecraft:potted_white_tulip", "minecraft:composter": "minecraft:cauldron", "minecraft:potted_cornflower": "minecraft:potted_blue_orchid", "minecraft:potted_bamboo": "minecraft:flower_pot", "minecraft:cartography_table": "minecraft:crafting_table", "minecraft:cornflower": "minecraft:blue_orchid", "minecraft:cut_sandstone_slab": "minecraft:sandstone_slab", "minecraft:bamboo_sapling": "minecraft:air", "minecraft:potted_wither_rose": "minecraft:potted_poppy", "minecraft:granite_slab": "minecraft:cobblestone_slab", "minecraft:smooth_sandstone_slab": "minecraft:stone_brick_slab", "minecraft:polished_andesite_slab": "minecraft:stone_brick_slab", "minecraft:wither_rose": "minecraft:poppy", "minecraft:smoker": "minecraft:furnace", "minecraft:mossy_stone_brick_slab": "minecraft:stone_slab", "minecraft:sweet_berry_bush": "minecraft:grass", "minecraft:andesite_slab": "minecraft:stone_slab", "minecraft:lantern": "minecraft:glowstone", "minecraft:fletching_table": "minecraft:crafting_table", "minecraft:blast_furnace": "minecraft:furnace", "minecraft:grindstone": "minecraft:furnace", "minecraft:smooth_stone_slab": "minecraft:stone_slab", "minecraft:red_nether_brick_slab": "minecraft:nether_brick_slab", "minecraft:smithing_table": "minecraft:furnace", "minecraft:end_stone_brick_slab": "minecraft:sandstone_slab", "minecraft:mossy_cobblestone_slab": "minecraft:cobblestone_slab", "minecraft:barrel": "minecraft:dark_oak_log", "minecraft:polished_granite_slab": "minecraft:stone_slab", "minecraft:cut_red_sandstone_slab": "minecraft:red_sandstone_slab", "minecraft:diorite_slab": "minecraft:cobblestone_slab", "minecraft:scaffolding": "minecraft:crafting_table", "minecraft:polished_diorite_slab": "minecraft:stone_slab", "minecraft:jungle_wall_sign": "minecraft:wall_sign", "minecraft:stonecutter": "minecraft:furnace", "minecraft:smooth_quartz_slab": "minecraft:quartz_slab", "minecraft:loom": "minecraft:crafting_table", "minecraft:oak_wall_sign": "minecraft:wall_sign", "minecraft:smooth_red_sandstone_slab": "minecraft:red_sandstone_slab", "minecraft:dark_oak_wall_sign": "minecraft:wall_sign", "minecraft:spruce_wall_sign": "minecraft:wall_sign", "minecraft:acacia_wall_sign": "minecraft:wall_sign", "minecraft:smooth_sandstone_stairs": "minecraft:sandstone_stairs", "minecraft:diorite_stairs": "minecraft:cobblestone_stairs", "minecraft:bamboo": "minecraft:lime_stained_glass_pane", "minecraft:red_nether_brick_stairs": "minecraft:nether_brick_stairs", "minecraft:birch_wall_sign": "minecraft:wall_sign", "minecraft:lectern": "minecraft:enchanting_table", "minecraft:andesite_stairs": "minecraft:cobblestone_stairs", "minecraft:polished_granite_stairs": "minecraft:cobblestone_stairs", "minecraft:end_stone_brick_stairs": "minecraft:sandstone_stairs", "minecraft:jigsaw": "minecraft:structure_block", "minecraft:mossy_stone_brick_stairs": "minecraft:stone_brick_stairs", "minecraft:sandstone_wall": "minecraft:cobblestone_wall", "minecraft:polished_andesite_stairs": "minecraft:cobblestone_stairs", "minecraft:jungle_sign": "minecraft:sign", "minecraft:mossy_stone_brick_wall": "minecraft:cobblestone_wall", "minecraft:campfire": "minecraft:torch", "minecraft:mossy_cobblestone_stairs": "minecraft:cobblestone_stairs", "minecraft:andesite_wall": "minecraft:cobblestone_wall", "minecraft:polished_diorite_stairs": "minecraft:cobblestone_stairs", "minecraft:smooth_red_sandstone_stairs": "minecraft:red_sandstone_stairs", "minecraft:spruce_sign": "minecraft:sign", "minecraft:nether_brick_wall": "minecraft:mossy_cobblestone_wall", "minecraft:bell": "minecraft:gold_block", "minecraft:acacia_sign": "minecraft:sign", "minecraft:diorite_wall": "minecraft:sign", "minecraft:birch_sign": "minecraft:sign", "minecraft:dark_oak_sign": "minecraft:sign", "minecraft:red_nether_brick_wall": "minecraft:mossy_cobblestone_wall", "minecraft:stone_brick_wall": "minecraft:cobblestone_wall", "minecraft:smooth_quartz_stairs": "minecraft:quartz_stairs", "minecraft:brick_wall": "minecraft:cobblestone_wall", "minecraft:end_stone_brick_wall": "minecraft:cobblestone_wall", "minecraft:red_sandstone_wall": "minecraft:cobblestone_wall", "minecraft:granite_stairs": "minecraft:cobblestone_stairs", "minecraft:oak_sign": "minecraft:sign", "minecraft:granite_wall": "minecraft:cobblestone_wall", "minecraft:prismarine_wall": "minecraft:mossy_cobblestone_wall", "minecraft:stone_stairs": "minecraft:cobblestone_stairs" }, "MINECRAFT_1_13": { "minecraft:dead_horn_coral": "minecraft:air", "minecraft:dead_bubble_coral": "minecraft:air", "minecraft:dead_tube_coral": "minecraft:air", "minecraft:dead_brain_coral": "minecraft:air", "minecraft:dead_fire_coral": "minecraft:air" }, "MINECRAFT_1_12_2": { "minecraft:grass_path": "minecraft:dirt_path", "minecraft:sign": "minecraft:oak_sign", "minecraft:wall_sign": "minecraft:oak_wall_sign" } } ================================================ FILE: plugin/mapping/legacy_blockentities_mapping.json ================================================ { "minecraft:banner": { "legacy": "18" }, "minecraft:barrel": { "legacy": "25" }, "minecraft:beacon": { "legacy": "13" }, "minecraft:bed": { "legacy": "23" }, "minecraft:beehive": { "legacy": "32" }, "minecraft:bell": { "legacy": "29" }, "minecraft:blast_furnace": { "legacy": "27" }, "minecraft:brewing_stand": { "legacy": "10" }, "minecraft:campfire": { "legacy": "31" }, "minecraft:chest": { "legacy": "1" }, "minecraft:chiseled_bookshelf": { "legacy": "36" }, "minecraft:command_block": { "legacy": "21" }, "minecraft:comparator": { "legacy": "17" }, "minecraft:conduit": { "legacy": "24" }, "minecraft:daylight_detector": { "legacy": "15" }, "minecraft:dispenser": { "legacy": "5" }, "minecraft:dropper": { "legacy": "6" }, "minecraft:enchanting_table": { "legacy": "11" }, "minecraft:end_gateway": { "legacy": "20" }, "minecraft:end_portal": { "legacy": "12" }, "minecraft:ender_chest": { "legacy": "3" }, "minecraft:furnace": { "legacy": "0" }, "minecraft:hanging_sign": { "legacy": "7" }, "minecraft:hopper": { "legacy": "16" }, "minecraft:jigsaw": { "legacy": "30" }, "minecraft:jukebox": { "legacy": "4" }, "minecraft:lectern": { "legacy": "28" }, "minecraft:mob_spawner": { "legacy": "8" }, "minecraft:piston": { "legacy": "9" }, "minecraft:sculk_catalyst": { "legacy": "34" }, "minecraft:sculk_sensor": { "legacy": "33" }, "minecraft:sculk_shrieker": { "legacy": "35" }, "minecraft:shulker_box": { "legacy": "22" }, "minecraft:sign": { "legacy": "7" }, "minecraft:skull": { "legacy": "14" }, "minecraft:smoker": { "legacy": "26" }, "minecraft:structure_block": { "legacy": "19" }, "minecraft:trapped_chest": { "legacy": "2" } } ================================================ FILE: plugin/mapping/legacy_blocks_mapping.json ================================================ { "minecraft:acacia_button": { "1.13": "288", "1.13.2": "288" }, "minecraft:acacia_door": { "1.13": "461", "1.13.2": "461" }, "minecraft:acacia_fence": { "1.13": "456", "1.13.2": "456" }, "minecraft:acacia_fence_gate": { "1.13": "451", "1.13.2": "451" }, "minecraft:acacia_leaves": { "1.13": "62", "1.13.2": "62" }, "minecraft:acacia_log": { "1.13": "38", "1.13.2": "38" }, "minecraft:acacia_planks": { "1.13": "17", "1.13.2": "17" }, "minecraft:acacia_pressure_plate": { "1.13": "163", "1.13.2": "163" }, "minecraft:acacia_sapling": { "1.13": "23", "1.13.2": "23" }, "minecraft:acacia_slab": { "1.13": "432", "1.13.2": "432" }, "minecraft:acacia_stairs": { "1.13": "351", "1.13.2": "351" }, "minecraft:acacia_trapdoor": { "1.13": "206", "1.13.2": "206" }, "minecraft:acacia_wood": { "1.13": "50", "1.13.2": "50" }, "minecraft:activator_rail": { "1.13": "317", "1.13.2": "317" }, "minecraft:air": { "1.13": "0", "1.13.2": "0" }, "minecraft:allium": { "1.13": "121", "1.13.2": "121" }, "minecraft:andesite": { "1.13": "6", "1.13.2": "6" }, "minecraft:anvil": { "1.13": "302", "1.13.2": "302" }, "minecraft:attached_melon_stem": { "1.13": "225", "1.13.2": "225" }, "minecraft:attached_pumpkin_stem": { "1.13": "224", "1.13.2": "224" }, "minecraft:azure_bluet": { "1.13": "122", "1.13.2": "122" }, "minecraft:barrier": { "1.13": "354", "1.13.2": "354" }, "minecraft:beacon": { "1.13": "257", "1.13.2": "257" }, "minecraft:bedrock": { "1.13": "25", "1.13.2": "25" }, "minecraft:beetroots": { "1.13": "470", "1.13.2": "470" }, "minecraft:birch_button": { "1.13": "286", "1.13.2": "286" }, "minecraft:birch_door": { "1.13": "459", "1.13.2": "459" }, "minecraft:birch_fence": { "1.13": "454", "1.13.2": "454" }, "minecraft:birch_fence_gate": { "1.13": "449", "1.13.2": "449" }, "minecraft:birch_leaves": { "1.13": "60", "1.13.2": "60" }, "minecraft:birch_log": { "1.13": "36", "1.13.2": "36" }, "minecraft:birch_planks": { "1.13": "15", "1.13.2": "15" }, "minecraft:birch_pressure_plate": { "1.13": "161", "1.13.2": "161" }, "minecraft:birch_sapling": { "1.13": "21", "1.13.2": "21" }, "minecraft:birch_slab": { "1.13": "430", "1.13.2": "430" }, "minecraft:birch_stairs": { "1.13": "254", "1.13.2": "254" }, "minecraft:birch_trapdoor": { "1.13": "204", "1.13.2": "204" }, "minecraft:birch_wood": { "1.13": "48", "1.13.2": "48" }, "minecraft:black_banner": { "1.13": "407", "1.13.2": "407" }, "minecraft:black_bed": { "1.13": "89", "1.13.2": "89" }, "minecraft:black_carpet": { "1.13": "382", "1.13.2": "382" }, "minecraft:black_concrete": { "1.13": "530", "1.13.2": "530" }, "minecraft:black_concrete_powder": { "1.13": "546", "1.13.2": "546" }, "minecraft:black_glazed_terracotta": { "1.13": "514", "1.13.2": "514" }, "minecraft:black_shulker_box": { "1.13": "498", "1.13.2": "498" }, "minecraft:black_stained_glass": { "1.13": "201", "1.13.2": "201" }, "minecraft:black_stained_glass_pane": { "1.13": "350", "1.13.2": "350" }, "minecraft:black_terracotta": { "1.13": "334", "1.13.2": "334" }, "minecraft:black_wall_banner": { "1.13": "423", "1.13.2": "423" }, "minecraft:black_wool": { "1.13": "116", "1.13.2": "116" }, "minecraft:blue_banner": { "1.13": "403", "1.13.2": "403" }, "minecraft:blue_bed": { "1.13": "85", "1.13.2": "85" }, "minecraft:blue_carpet": { "1.13": "378", "1.13.2": "378" }, "minecraft:blue_concrete": { "1.13": "526", "1.13.2": "526" }, "minecraft:blue_concrete_powder": { "1.13": "542", "1.13.2": "542" }, "minecraft:blue_glazed_terracotta": { "1.13": "510", "1.13.2": "510" }, "minecraft:blue_ice": { "1.13": "587", "1.13.2": "592" }, "minecraft:blue_orchid": { "1.13": "120", "1.13.2": "120" }, "minecraft:blue_shulker_box": { "1.13": "494", "1.13.2": "494" }, "minecraft:blue_stained_glass": { "1.13": "197", "1.13.2": "197" }, "minecraft:blue_stained_glass_pane": { "1.13": "346", "1.13.2": "346" }, "minecraft:blue_terracotta": { "1.13": "330", "1.13.2": "330" }, "minecraft:blue_wall_banner": { "1.13": "419", "1.13.2": "419" }, "minecraft:blue_wool": { "1.13": "112", "1.13.2": "112" }, "minecraft:bone_block": { "1.13": "479", "1.13.2": "479" }, "minecraft:bookshelf": { "1.13": "134", "1.13.2": "134" }, "minecraft:brain_coral": { "1.13": "562", "1.13.2": "567" }, "minecraft:brain_coral_block": { "1.13": "557", "1.13.2": "557" }, "minecraft:brain_coral_fan": { "1.13": "582", "1.13.2": "587" }, "minecraft:brain_coral_wall_fan": { "1.13": "572", "1.13.2": "577" }, "minecraft:brewing_stand": { "1.13": "239", "1.13.2": "239" }, "minecraft:brick_slab": { "1.13": "438", "1.13.2": "438" }, "minecraft:brick_stairs": { "1.13": "230", "1.13.2": "230" }, "minecraft:bricks": { "1.13": "132", "1.13.2": "132" }, "minecraft:brown_banner": { "1.13": "404", "1.13.2": "404" }, "minecraft:brown_bed": { "1.13": "86", "1.13.2": "86" }, "minecraft:brown_carpet": { "1.13": "379", "1.13.2": "379" }, "minecraft:brown_concrete": { "1.13": "527", "1.13.2": "527" }, "minecraft:brown_concrete_powder": { "1.13": "543", "1.13.2": "543" }, "minecraft:brown_glazed_terracotta": { "1.13": "511", "1.13.2": "511" }, "minecraft:brown_mushroom": { "1.13": "128", "1.13.2": "128" }, "minecraft:brown_mushroom_block": { "1.13": "218", "1.13.2": "218" }, "minecraft:brown_shulker_box": { "1.13": "495", "1.13.2": "495" }, "minecraft:brown_stained_glass": { "1.13": "198", "1.13.2": "198" }, "minecraft:brown_stained_glass_pane": { "1.13": "347", "1.13.2": "347" }, "minecraft:brown_terracotta": { "1.13": "331", "1.13.2": "331" }, "minecraft:brown_wall_banner": { "1.13": "420", "1.13.2": "420" }, "minecraft:brown_wool": { "1.13": "113", "1.13.2": "113" }, "minecraft:bubble_column": { "1.13": "591", "1.13.2": "596" }, "minecraft:bubble_coral": { "1.13": "563", "1.13.2": "568" }, "minecraft:bubble_coral_block": { "1.13": "558", "1.13.2": "558" }, "minecraft:bubble_coral_fan": { "1.13": "583", "1.13.2": "588" }, "minecraft:bubble_coral_wall_fan": { "1.13": "573", "1.13.2": "578" }, "minecraft:cactus": { "1.13": "172", "1.13.2": "172" }, "minecraft:cake": { "1.13": "184", "1.13.2": "184" }, "minecraft:carrots": { "1.13": "282", "1.13.2": "282" }, "minecraft:carved_pumpkin": { "1.13": "182", "1.13.2": "182" }, "minecraft:cauldron": { "1.13": "240", "1.13.2": "240" }, "minecraft:cave_air": { "1.13": "590", "1.13.2": "595" }, "minecraft:chain_command_block": { "1.13": "474", "1.13.2": "474" }, "minecraft:chest": { "1.13": "142", "1.13.2": "142" }, "minecraft:chipped_anvil": { "1.13": "303", "1.13.2": "303" }, "minecraft:chiseled_quartz_block": { "1.13": "314", "1.13.2": "314" }, "minecraft:chiseled_red_sandstone": { "1.13": "425", "1.13.2": "425" }, "minecraft:chiseled_sandstone": { "1.13": "71", "1.13.2": "71" }, "minecraft:chiseled_stone_bricks": { "1.13": "217", "1.13.2": "217" }, "minecraft:chorus_flower": { "1.13": "465", "1.13.2": "465" }, "minecraft:chorus_plant": { "1.13": "464", "1.13.2": "464" }, "minecraft:clay": { "1.13": "173", "1.13.2": "173" }, "minecraft:coal_block": { "1.13": "384", "1.13.2": "384" }, "minecraft:coal_ore": { "1.13": "33", "1.13.2": "33" }, "minecraft:coarse_dirt": { "1.13": "10", "1.13.2": "10" }, "minecraft:cobblestone": { "1.13": "12", "1.13.2": "12" }, "minecraft:cobblestone_slab": { "1.13": "437", "1.13.2": "437" }, "minecraft:cobblestone_stairs": { "1.13": "154", "1.13.2": "154" }, "minecraft:cobblestone_wall": { "1.13": "258", "1.13.2": "258" }, "minecraft:cobweb": { "1.13": "93", "1.13.2": "93" }, "minecraft:cocoa": { "1.13": "246", "1.13.2": "246" }, "minecraft:command_block": { "1.13": "256", "1.13.2": "256" }, "minecraft:comparator": { "1.13": "308", "1.13.2": "308" }, "minecraft:conduit": { "1.13": "588", "1.13.2": "593" }, "minecraft:cracked_stone_bricks": { "1.13": "216", "1.13.2": "216" }, "minecraft:crafting_table": { "1.13": "146", "1.13.2": "146" }, "minecraft:creeper_head": { "1.13": "299", "1.13.2": "299" }, "minecraft:creeper_wall_head": { "1.13": "298", "1.13.2": "298" }, "minecraft:cut_red_sandstone": { "1.13": "426", "1.13.2": "426" }, "minecraft:cut_sandstone": { "1.13": "72", "1.13.2": "72" }, "minecraft:cyan_banner": { "1.13": "401", "1.13.2": "401" }, "minecraft:cyan_bed": { "1.13": "83", "1.13.2": "83" }, "minecraft:cyan_carpet": { "1.13": "376", "1.13.2": "376" }, "minecraft:cyan_concrete": { "1.13": "524", "1.13.2": "524" }, "minecraft:cyan_concrete_powder": { "1.13": "540", "1.13.2": "540" }, "minecraft:cyan_glazed_terracotta": { "1.13": "508", "1.13.2": "508" }, "minecraft:cyan_shulker_box": { "1.13": "492", "1.13.2": "492" }, "minecraft:cyan_stained_glass": { "1.13": "195", "1.13.2": "195" }, "minecraft:cyan_stained_glass_pane": { "1.13": "344", "1.13.2": "344" }, "minecraft:cyan_terracotta": { "1.13": "328", "1.13.2": "328" }, "minecraft:cyan_wall_banner": { "1.13": "417", "1.13.2": "417" }, "minecraft:cyan_wool": { "1.13": "110", "1.13.2": "110" }, "minecraft:damaged_anvil": { "1.13": "304", "1.13.2": "304" }, "minecraft:dandelion": { "1.13": "118", "1.13.2": "118" }, "minecraft:dark_oak_button": { "1.13": "289", "1.13.2": "289" }, "minecraft:dark_oak_door": { "1.13": "462", "1.13.2": "462" }, "minecraft:dark_oak_fence": { "1.13": "457", "1.13.2": "457" }, "minecraft:dark_oak_fence_gate": { "1.13": "452", "1.13.2": "452" }, "minecraft:dark_oak_leaves": { "1.13": "63", "1.13.2": "63" }, "minecraft:dark_oak_log": { "1.13": "39", "1.13.2": "39" }, "minecraft:dark_oak_planks": { "1.13": "18", "1.13.2": "18" }, "minecraft:dark_oak_pressure_plate": { "1.13": "164", "1.13.2": "164" }, "minecraft:dark_oak_sapling": { "1.13": "24", "1.13.2": "24" }, "minecraft:dark_oak_slab": { "1.13": "433", "1.13.2": "433" }, "minecraft:dark_oak_stairs": { "1.13": "352", "1.13.2": "352" }, "minecraft:dark_oak_trapdoor": { "1.13": "207", "1.13.2": "207" }, "minecraft:dark_oak_wood": { "1.13": "51", "1.13.2": "51" }, "minecraft:dark_prismarine": { "1.13": "358", "1.13.2": "358" }, "minecraft:dark_prismarine_slab": { "1.13": "364", "1.13.2": "364" }, "minecraft:dark_prismarine_stairs": { "1.13": "361", "1.13.2": "361" }, "minecraft:daylight_detector": { "1.13": "309", "1.13.2": "309" }, "minecraft:dead_brain_coral": { "1.13.2": "562" }, "minecraft:dead_brain_coral_block": { "1.13": "552", "1.13.2": "552" }, "minecraft:dead_brain_coral_fan": { "1.13": "577", "1.13.2": "582" }, "minecraft:dead_brain_coral_wall_fan": { "1.13": "567", "1.13.2": "572" }, "minecraft:dead_bubble_coral": { "1.13.2": "563" }, "minecraft:dead_bubble_coral_block": { "1.13": "553", "1.13.2": "553" }, "minecraft:dead_bubble_coral_fan": { "1.13": "578", "1.13.2": "583" }, "minecraft:dead_bubble_coral_wall_fan": { "1.13": "568", "1.13.2": "573" }, "minecraft:dead_bush": { "1.13": "96", "1.13.2": "96" }, "minecraft:dead_fire_coral": { "1.13.2": "564" }, "minecraft:dead_fire_coral_block": { "1.13": "554", "1.13.2": "554" }, "minecraft:dead_fire_coral_fan": { "1.13": "579", "1.13.2": "584" }, "minecraft:dead_fire_coral_wall_fan": { "1.13": "569", "1.13.2": "574" }, "minecraft:dead_horn_coral": { "1.13.2": "565" }, "minecraft:dead_horn_coral_block": { "1.13": "555", "1.13.2": "555" }, "minecraft:dead_horn_coral_fan": { "1.13": "580", "1.13.2": "585" }, "minecraft:dead_horn_coral_wall_fan": { "1.13": "570", "1.13.2": "575" }, "minecraft:dead_tube_coral": { "1.13.2": "561" }, "minecraft:dead_tube_coral_block": { "1.13": "551", "1.13.2": "551" }, "minecraft:dead_tube_coral_fan": { "1.13": "576", "1.13.2": "581" }, "minecraft:dead_tube_coral_wall_fan": { "1.13": "566", "1.13.2": "571" }, "minecraft:detector_rail": { "1.13": "91", "1.13.2": "91" }, "minecraft:diamond_block": { "1.13": "145", "1.13.2": "145" }, "minecraft:diamond_ore": { "1.13": "144", "1.13.2": "144" }, "minecraft:diorite": { "1.13": "4", "1.13.2": "4" }, "minecraft:dirt": { "1.13": "9", "1.13.2": "9" }, "minecraft:dispenser": { "1.13": "69", "1.13.2": "69" }, "minecraft:dragon_egg": { "1.13": "244", "1.13.2": "244" }, "minecraft:dragon_head": { "1.13": "301", "1.13.2": "301" }, "minecraft:dragon_wall_head": { "1.13": "300", "1.13.2": "300" }, "minecraft:dried_kelp_block": { "1.13": "549", "1.13.2": "549" }, "minecraft:dropper": { "1.13": "318", "1.13.2": "318" }, "minecraft:emerald_block": { "1.13": "252", "1.13.2": "252" }, "minecraft:emerald_ore": { "1.13": "248", "1.13.2": "248" }, "minecraft:enchanting_table": { "1.13": "238", "1.13.2": "238" }, "minecraft:end_gateway": { "1.13": "472", "1.13.2": "472" }, "minecraft:end_portal": { "1.13": "241", "1.13.2": "241" }, "minecraft:end_portal_frame": { "1.13": "242", "1.13.2": "242" }, "minecraft:end_rod": { "1.13": "463", "1.13.2": "463" }, "minecraft:end_stone": { "1.13": "243", "1.13.2": "243" }, "minecraft:end_stone_bricks": { "1.13": "469", "1.13.2": "469" }, "minecraft:ender_chest": { "1.13": "249", "1.13.2": "249" }, "minecraft:farmland": { "1.13": "148", "1.13.2": "148" }, "minecraft:fern": { "1.13": "95", "1.13.2": "95" }, "minecraft:fire": { "1.13": "139", "1.13.2": "139" }, "minecraft:fire_coral": { "1.13": "564", "1.13.2": "569" }, "minecraft:fire_coral_block": { "1.13": "559", "1.13.2": "559" }, "minecraft:fire_coral_fan": { "1.13": "584", "1.13.2": "589" }, "minecraft:fire_coral_wall_fan": { "1.13": "574", "1.13.2": "579" }, "minecraft:flower_pot": { "1.13": "260", "1.13.2": "260" }, "minecraft:frosted_ice": { "1.13": "475", "1.13.2": "475" }, "minecraft:furnace": { "1.13": "149", "1.13.2": "149" }, "minecraft:glass": { "1.13": "66", "1.13.2": "66" }, "minecraft:glass_pane": { "1.13": "222", "1.13.2": "222" }, "minecraft:glowstone": { "1.13": "180", "1.13.2": "180" }, "minecraft:gold_block": { "1.13": "130", "1.13.2": "130" }, "minecraft:gold_ore": { "1.13": "31", "1.13.2": "31" }, "minecraft:granite": { "1.13": "2", "1.13.2": "2" }, "minecraft:short_grass": { "1.13": "94", "1.13.2": "94" }, "minecraft:grass_block": { "1.13": "8", "1.13.2": "8" }, "minecraft:gravel": { "1.13": "30", "1.13.2": "30" }, "minecraft:gray_banner": { "1.13": "399", "1.13.2": "399" }, "minecraft:gray_bed": { "1.13": "81", "1.13.2": "81" }, "minecraft:gray_carpet": { "1.13": "374", "1.13.2": "374" }, "minecraft:gray_concrete": { "1.13": "522", "1.13.2": "522" }, "minecraft:gray_concrete_powder": { "1.13": "538", "1.13.2": "538" }, "minecraft:gray_glazed_terracotta": { "1.13": "506", "1.13.2": "506" }, "minecraft:gray_shulker_box": { "1.13": "490", "1.13.2": "490" }, "minecraft:gray_stained_glass": { "1.13": "193", "1.13.2": "193" }, "minecraft:gray_stained_glass_pane": { "1.13": "342", "1.13.2": "342" }, "minecraft:gray_terracotta": { "1.13": "326", "1.13.2": "326" }, "minecraft:gray_wall_banner": { "1.13": "415", "1.13.2": "415" }, "minecraft:gray_wool": { "1.13": "108", "1.13.2": "108" }, "minecraft:green_banner": { "1.13": "405", "1.13.2": "405" }, "minecraft:green_bed": { "1.13": "87", "1.13.2": "87" }, "minecraft:green_carpet": { "1.13": "380", "1.13.2": "380" }, "minecraft:green_concrete": { "1.13": "528", "1.13.2": "528" }, "minecraft:green_concrete_powder": { "1.13": "544", "1.13.2": "544" }, "minecraft:green_glazed_terracotta": { "1.13": "512", "1.13.2": "512" }, "minecraft:green_shulker_box": { "1.13": "496", "1.13.2": "496" }, "minecraft:green_stained_glass": { "1.13": "199", "1.13.2": "199" }, "minecraft:green_stained_glass_pane": { "1.13": "348", "1.13.2": "348" }, "minecraft:green_terracotta": { "1.13": "332", "1.13.2": "332" }, "minecraft:green_wall_banner": { "1.13": "421", "1.13.2": "421" }, "minecraft:green_wool": { "1.13": "114", "1.13.2": "114" }, "minecraft:hay_block": { "1.13": "366", "1.13.2": "366" }, "minecraft:heavy_weighted_pressure_plate": { "1.13": "307", "1.13.2": "307" }, "minecraft:hopper": { "1.13": "312", "1.13.2": "312" }, "minecraft:horn_coral": { "1.13": "565", "1.13.2": "570" }, "minecraft:horn_coral_block": { "1.13": "560", "1.13.2": "560" }, "minecraft:horn_coral_fan": { "1.13": "585", "1.13.2": "590" }, "minecraft:horn_coral_wall_fan": { "1.13": "575", "1.13.2": "580" }, "minecraft:ice": { "1.13": "170", "1.13.2": "170" }, "minecraft:infested_chiseled_stone_bricks": { "1.13": "213", "1.13.2": "213" }, "minecraft:infested_cobblestone": { "1.13": "209", "1.13.2": "209" }, "minecraft:infested_cracked_stone_bricks": { "1.13": "212", "1.13.2": "212" }, "minecraft:infested_mossy_stone_bricks": { "1.13": "211", "1.13.2": "211" }, "minecraft:infested_stone": { "1.13": "208", "1.13.2": "208" }, "minecraft:infested_stone_bricks": { "1.13": "210", "1.13.2": "210" }, "minecraft:iron_bars": { "1.13": "221", "1.13.2": "221" }, "minecraft:iron_block": { "1.13": "131", "1.13.2": "131" }, "minecraft:iron_door": { "1.13": "158", "1.13.2": "158" }, "minecraft:iron_ore": { "1.13": "32", "1.13.2": "32" }, "minecraft:iron_trapdoor": { "1.13": "355", "1.13.2": "355" }, "minecraft:jack_o_lantern": { "1.13": "183", "1.13.2": "183" }, "minecraft:jukebox": { "1.13": "175", "1.13.2": "175" }, "minecraft:jungle_button": { "1.13": "287", "1.13.2": "287" }, "minecraft:jungle_door": { "1.13": "460", "1.13.2": "460" }, "minecraft:jungle_fence": { "1.13": "455", "1.13.2": "455" }, "minecraft:jungle_fence_gate": { "1.13": "450", "1.13.2": "450" }, "minecraft:jungle_leaves": { "1.13": "61", "1.13.2": "61" }, "minecraft:jungle_log": { "1.13": "37", "1.13.2": "37" }, "minecraft:jungle_planks": { "1.13": "16", "1.13.2": "16" }, "minecraft:jungle_pressure_plate": { "1.13": "162", "1.13.2": "162" }, "minecraft:jungle_sapling": { "1.13": "22", "1.13.2": "22" }, "minecraft:jungle_slab": { "1.13": "431", "1.13.2": "431" }, "minecraft:jungle_stairs": { "1.13": "255", "1.13.2": "255" }, "minecraft:jungle_trapdoor": { "1.13": "205", "1.13.2": "205" }, "minecraft:jungle_wood": { "1.13": "49", "1.13.2": "49" }, "minecraft:kelp": { "1.13": "547", "1.13.2": "547" }, "minecraft:kelp_plant": { "1.13": "548", "1.13.2": "548" }, "minecraft:ladder": { "1.13": "152", "1.13.2": "152" }, "minecraft:lapis_block": { "1.13": "68", "1.13.2": "68" }, "minecraft:lapis_ore": { "1.13": "67", "1.13.2": "67" }, "minecraft:large_fern": { "1.13": "391", "1.13.2": "391" }, "minecraft:lava": { "1.13": "27", "1.13.2": "27" }, "minecraft:lever": { "1.13": "156", "1.13.2": "156" }, "minecraft:light_blue_banner": { "1.13": "395", "1.13.2": "395" }, "minecraft:light_blue_bed": { "1.13": "77", "1.13.2": "77" }, "minecraft:light_blue_carpet": { "1.13": "370", "1.13.2": "370" }, "minecraft:light_blue_concrete": { "1.13": "518", "1.13.2": "518" }, "minecraft:light_blue_concrete_powder": { "1.13": "534", "1.13.2": "534" }, "minecraft:light_blue_glazed_terracotta": { "1.13": "502", "1.13.2": "502" }, "minecraft:light_blue_shulker_box": { "1.13": "486", "1.13.2": "486" }, "minecraft:light_blue_stained_glass": { "1.13": "189", "1.13.2": "189" }, "minecraft:light_blue_stained_glass_pane": { "1.13": "338", "1.13.2": "338" }, "minecraft:light_blue_terracotta": { "1.13": "322", "1.13.2": "322" }, "minecraft:light_blue_wall_banner": { "1.13": "411", "1.13.2": "411" }, "minecraft:light_blue_wool": { "1.13": "104", "1.13.2": "104" }, "minecraft:light_gray_banner": { "1.13": "400", "1.13.2": "400" }, "minecraft:light_gray_bed": { "1.13": "82", "1.13.2": "82" }, "minecraft:light_gray_carpet": { "1.13": "375", "1.13.2": "375" }, "minecraft:light_gray_concrete": { "1.13": "523", "1.13.2": "523" }, "minecraft:light_gray_concrete_powder": { "1.13": "539", "1.13.2": "539" }, "minecraft:light_gray_glazed_terracotta": { "1.13": "507", "1.13.2": "507" }, "minecraft:light_gray_shulker_box": { "1.13": "491", "1.13.2": "491" }, "minecraft:light_gray_stained_glass": { "1.13": "194", "1.13.2": "194" }, "minecraft:light_gray_stained_glass_pane": { "1.13": "343", "1.13.2": "343" }, "minecraft:light_gray_terracotta": { "1.13": "327", "1.13.2": "327" }, "minecraft:light_gray_wall_banner": { "1.13": "416", "1.13.2": "416" }, "minecraft:light_gray_wool": { "1.13": "109", "1.13.2": "109" }, "minecraft:light_weighted_pressure_plate": { "1.13": "306", "1.13.2": "306" }, "minecraft:lilac": { "1.13": "387", "1.13.2": "387" }, "minecraft:lily_pad": { "1.13": "233", "1.13.2": "233" }, "minecraft:lime_banner": { "1.13": "397", "1.13.2": "397" }, "minecraft:lime_bed": { "1.13": "79", "1.13.2": "79" }, "minecraft:lime_carpet": { "1.13": "372", "1.13.2": "372" }, "minecraft:lime_concrete": { "1.13": "520", "1.13.2": "520" }, "minecraft:lime_concrete_powder": { "1.13": "536", "1.13.2": "536" }, "minecraft:lime_glazed_terracotta": { "1.13": "504", "1.13.2": "504" }, "minecraft:lime_shulker_box": { "1.13": "488", "1.13.2": "488" }, "minecraft:lime_stained_glass": { "1.13": "191", "1.13.2": "191" }, "minecraft:lime_stained_glass_pane": { "1.13": "340", "1.13.2": "340" }, "minecraft:lime_terracotta": { "1.13": "324", "1.13.2": "324" }, "minecraft:lime_wall_banner": { "1.13": "413", "1.13.2": "413" }, "minecraft:lime_wool": { "1.13": "106", "1.13.2": "106" }, "minecraft:magenta_banner": { "1.13": "394", "1.13.2": "394" }, "minecraft:magenta_bed": { "1.13": "76", "1.13.2": "76" }, "minecraft:magenta_carpet": { "1.13": "369", "1.13.2": "369" }, "minecraft:magenta_concrete": { "1.13": "517", "1.13.2": "517" }, "minecraft:magenta_concrete_powder": { "1.13": "533", "1.13.2": "533" }, "minecraft:magenta_glazed_terracotta": { "1.13": "501", "1.13.2": "501" }, "minecraft:magenta_shulker_box": { "1.13": "485", "1.13.2": "485" }, "minecraft:magenta_stained_glass": { "1.13": "188", "1.13.2": "188" }, "minecraft:magenta_stained_glass_pane": { "1.13": "337", "1.13.2": "337" }, "minecraft:magenta_terracotta": { "1.13": "321", "1.13.2": "321" }, "minecraft:magenta_wall_banner": { "1.13": "410", "1.13.2": "410" }, "minecraft:magenta_wool": { "1.13": "103", "1.13.2": "103" }, "minecraft:magma_block": { "1.13": "476", "1.13.2": "476" }, "minecraft:melon": { "1.13": "223", "1.13.2": "223" }, "minecraft:melon_stem": { "1.13": "227", "1.13.2": "227" }, "minecraft:mossy_cobblestone": { "1.13": "135", "1.13.2": "135" }, "minecraft:mossy_cobblestone_wall": { "1.13": "259", "1.13.2": "259" }, "minecraft:mossy_stone_bricks": { "1.13": "215", "1.13.2": "215" }, "minecraft:moving_piston": { "1.13": "117", "1.13.2": "117" }, "minecraft:mushroom_stem": { "1.13": "220", "1.13.2": "220" }, "minecraft:mycelium": { "1.13": "232", "1.13.2": "232" }, "minecraft:nether_brick_fence": { "1.13": "235", "1.13.2": "235" }, "minecraft:nether_brick_slab": { "1.13": "440", "1.13.2": "440" }, "minecraft:nether_brick_stairs": { "1.13": "236", "1.13.2": "236" }, "minecraft:nether_bricks": { "1.13": "234", "1.13.2": "234" }, "minecraft:nether_portal": { "1.13": "181", "1.13.2": "181" }, "minecraft:nether_quartz_ore": { "1.13": "311", "1.13.2": "311" }, "minecraft:nether_wart": { "1.13": "237", "1.13.2": "237" }, "minecraft:nether_wart_block": { "1.13": "477", "1.13.2": "477" }, "minecraft:netherrack": { "1.13": "178", "1.13.2": "178" }, "minecraft:note_block": { "1.13": "73", "1.13.2": "73" }, "minecraft:oak_button": { "1.13": "284", "1.13.2": "284" }, "minecraft:oak_door": { "1.13": "151", "1.13.2": "151" }, "minecraft:oak_fence": { "1.13": "176", "1.13.2": "176" }, "minecraft:oak_fence_gate": { "1.13": "229", "1.13.2": "229" }, "minecraft:oak_leaves": { "1.13": "58", "1.13.2": "58" }, "minecraft:oak_log": { "1.13": "34", "1.13.2": "34" }, "minecraft:oak_planks": { "1.13": "13", "1.13.2": "13" }, "minecraft:oak_pressure_plate": { "1.13": "159", "1.13.2": "159" }, "minecraft:oak_sapling": { "1.13": "19", "1.13.2": "19" }, "minecraft:oak_sign": { "1.13": "150", "1.13.2": "150" }, "minecraft:oak_slab": { "1.13": "428", "1.13.2": "428" }, "minecraft:oak_stairs": { "1.13": "141", "1.13.2": "141" }, "minecraft:oak_trapdoor": { "1.13": "202", "1.13.2": "202" }, "minecraft:oak_wall_sign": { "1.13": "155", "1.13.2": "155" }, "minecraft:oak_wood": { "1.13": "46", "1.13.2": "46" }, "minecraft:observer": { "1.13": "481", "1.13.2": "481" }, "minecraft:obsidian": { "1.13": "136", "1.13.2": "136" }, "minecraft:orange_banner": { "1.13": "393", "1.13.2": "393" }, "minecraft:orange_bed": { "1.13": "75", "1.13.2": "75" }, "minecraft:orange_carpet": { "1.13": "368", "1.13.2": "368" }, "minecraft:orange_concrete": { "1.13": "516", "1.13.2": "516" }, "minecraft:orange_concrete_powder": { "1.13": "532", "1.13.2": "532" }, "minecraft:orange_glazed_terracotta": { "1.13": "500", "1.13.2": "500" }, "minecraft:orange_shulker_box": { "1.13": "484", "1.13.2": "484" }, "minecraft:orange_stained_glass": { "1.13": "187", "1.13.2": "187" }, "minecraft:orange_stained_glass_pane": { "1.13": "336", "1.13.2": "336" }, "minecraft:orange_terracotta": { "1.13": "320", "1.13.2": "320" }, "minecraft:orange_tulip": { "1.13": "124", "1.13.2": "124" }, "minecraft:orange_wall_banner": { "1.13": "409", "1.13.2": "409" }, "minecraft:orange_wool": { "1.13": "102", "1.13.2": "102" }, "minecraft:oxeye_daisy": { "1.13": "127", "1.13.2": "127" }, "minecraft:packed_ice": { "1.13": "385", "1.13.2": "385" }, "minecraft:peony": { "1.13": "389", "1.13.2": "389" }, "minecraft:petrified_oak_slab": { "1.13": "436", "1.13.2": "436" }, "minecraft:pink_banner": { "1.13": "398", "1.13.2": "398" }, "minecraft:pink_bed": { "1.13": "80", "1.13.2": "80" }, "minecraft:pink_carpet": { "1.13": "373", "1.13.2": "373" }, "minecraft:pink_concrete": { "1.13": "521", "1.13.2": "521" }, "minecraft:pink_concrete_powder": { "1.13": "537", "1.13.2": "537" }, "minecraft:pink_glazed_terracotta": { "1.13": "505", "1.13.2": "505" }, "minecraft:pink_shulker_box": { "1.13": "489", "1.13.2": "489" }, "minecraft:pink_stained_glass": { "1.13": "192", "1.13.2": "192" }, "minecraft:pink_stained_glass_pane": { "1.13": "341", "1.13.2": "341" }, "minecraft:pink_terracotta": { "1.13": "325", "1.13.2": "325" }, "minecraft:pink_tulip": { "1.13": "126", "1.13.2": "126" }, "minecraft:pink_wall_banner": { "1.13": "414", "1.13.2": "414" }, "minecraft:pink_wool": { "1.13": "107", "1.13.2": "107" }, "minecraft:piston": { "1.13": "99", "1.13.2": "99" }, "minecraft:piston_head": { "1.13": "100", "1.13.2": "100" }, "minecraft:player_head": { "1.13": "297", "1.13.2": "297" }, "minecraft:player_wall_head": { "1.13": "296", "1.13.2": "296" }, "minecraft:podzol": { "1.13": "11", "1.13.2": "11" }, "minecraft:polished_andesite": { "1.13": "7", "1.13.2": "7" }, "minecraft:polished_diorite": { "1.13": "5", "1.13.2": "5" }, "minecraft:polished_granite": { "1.13": "3", "1.13.2": "3" }, "minecraft:poppy": { "1.13": "119", "1.13.2": "119" }, "minecraft:potatoes": { "1.13": "283", "1.13.2": "283" }, "minecraft:potted_acacia_sapling": { "1.13": "265", "1.13.2": "265" }, "minecraft:potted_allium": { "1.13": "271", "1.13.2": "271" }, "minecraft:potted_azure_bluet": { "1.13": "272", "1.13.2": "272" }, "minecraft:potted_birch_sapling": { "1.13": "263", "1.13.2": "263" }, "minecraft:potted_blue_orchid": { "1.13": "270", "1.13.2": "270" }, "minecraft:potted_brown_mushroom": { "1.13": "279", "1.13.2": "279" }, "minecraft:potted_cactus": { "1.13": "281", "1.13.2": "281" }, "minecraft:potted_dandelion": { "1.13": "268", "1.13.2": "268" }, "minecraft:potted_dark_oak_sapling": { "1.13": "266", "1.13.2": "266" }, "minecraft:potted_dead_bush": { "1.13": "280", "1.13.2": "280" }, "minecraft:potted_fern": { "1.13": "267", "1.13.2": "267" }, "minecraft:potted_jungle_sapling": { "1.13": "264", "1.13.2": "264" }, "minecraft:potted_oak_sapling": { "1.13": "261", "1.13.2": "261" }, "minecraft:potted_orange_tulip": { "1.13": "274", "1.13.2": "274" }, "minecraft:potted_oxeye_daisy": { "1.13": "277", "1.13.2": "277" }, "minecraft:potted_pink_tulip": { "1.13": "276", "1.13.2": "276" }, "minecraft:potted_poppy": { "1.13": "269", "1.13.2": "269" }, "minecraft:potted_red_mushroom": { "1.13": "278", "1.13.2": "278" }, "minecraft:potted_red_tulip": { "1.13": "273", "1.13.2": "273" }, "minecraft:potted_spruce_sapling": { "1.13": "262", "1.13.2": "262" }, "minecraft:potted_white_tulip": { "1.13": "275", "1.13.2": "275" }, "minecraft:powered_rail": { "1.13": "90", "1.13.2": "90" }, "minecraft:prismarine": { "1.13": "356", "1.13.2": "356" }, "minecraft:prismarine_brick_slab": { "1.13": "363", "1.13.2": "363" }, "minecraft:prismarine_brick_stairs": { "1.13": "360", "1.13.2": "360" }, "minecraft:prismarine_bricks": { "1.13": "357", "1.13.2": "357" }, "minecraft:prismarine_slab": { "1.13": "362", "1.13.2": "362" }, "minecraft:prismarine_stairs": { "1.13": "359", "1.13.2": "359" }, "minecraft:pumpkin": { "1.13": "177", "1.13.2": "177" }, "minecraft:pumpkin_stem": { "1.13": "226", "1.13.2": "226" }, "minecraft:purple_banner": { "1.13": "402", "1.13.2": "402" }, "minecraft:purple_bed": { "1.13": "84", "1.13.2": "84" }, "minecraft:purple_carpet": { "1.13": "377", "1.13.2": "377" }, "minecraft:purple_concrete": { "1.13": "525", "1.13.2": "525" }, "minecraft:purple_concrete_powder": { "1.13": "541", "1.13.2": "541" }, "minecraft:purple_glazed_terracotta": { "1.13": "509", "1.13.2": "509" }, "minecraft:purple_shulker_box": { "1.13": "493", "1.13.2": "493" }, "minecraft:purple_stained_glass": { "1.13": "196", "1.13.2": "196" }, "minecraft:purple_stained_glass_pane": { "1.13": "345", "1.13.2": "345" }, "minecraft:purple_terracotta": { "1.13": "329", "1.13.2": "329" }, "minecraft:purple_wall_banner": { "1.13": "418", "1.13.2": "418" }, "minecraft:purple_wool": { "1.13": "111", "1.13.2": "111" }, "minecraft:purpur_block": { "1.13": "466", "1.13.2": "466" }, "minecraft:purpur_pillar": { "1.13": "467", "1.13.2": "467" }, "minecraft:purpur_slab": { "1.13": "443", "1.13.2": "443" }, "minecraft:purpur_stairs": { "1.13": "468", "1.13.2": "468" }, "minecraft:quartz_block": { "1.13": "313", "1.13.2": "313" }, "minecraft:quartz_pillar": { "1.13": "315", "1.13.2": "315" }, "minecraft:quartz_slab": { "1.13": "441", "1.13.2": "441" }, "minecraft:quartz_stairs": { "1.13": "316", "1.13.2": "316" }, "minecraft:rail": { "1.13": "153", "1.13.2": "153" }, "minecraft:red_banner": { "1.13": "406", "1.13.2": "406" }, "minecraft:red_bed": { "1.13": "88", "1.13.2": "88" }, "minecraft:red_carpet": { "1.13": "381", "1.13.2": "381" }, "minecraft:red_concrete": { "1.13": "529", "1.13.2": "529" }, "minecraft:red_concrete_powder": { "1.13": "545", "1.13.2": "545" }, "minecraft:red_glazed_terracotta": { "1.13": "513", "1.13.2": "513" }, "minecraft:red_mushroom": { "1.13": "129", "1.13.2": "129" }, "minecraft:red_mushroom_block": { "1.13": "219", "1.13.2": "219" }, "minecraft:red_nether_bricks": { "1.13": "478", "1.13.2": "478" }, "minecraft:red_sand": { "1.13": "29", "1.13.2": "29" }, "minecraft:red_sandstone": { "1.13": "424", "1.13.2": "424" }, "minecraft:red_sandstone_slab": { "1.13": "442", "1.13.2": "442" }, "minecraft:red_sandstone_stairs": { "1.13": "427", "1.13.2": "427" }, "minecraft:red_shulker_box": { "1.13": "497", "1.13.2": "497" }, "minecraft:red_stained_glass": { "1.13": "200", "1.13.2": "200" }, "minecraft:red_stained_glass_pane": { "1.13": "349", "1.13.2": "349" }, "minecraft:red_terracotta": { "1.13": "333", "1.13.2": "333" }, "minecraft:red_tulip": { "1.13": "123", "1.13.2": "123" }, "minecraft:red_wall_banner": { "1.13": "422", "1.13.2": "422" }, "minecraft:red_wool": { "1.13": "115", "1.13.2": "115" }, "minecraft:redstone_block": { "1.13": "310", "1.13.2": "310" }, "minecraft:redstone_lamp": { "1.13": "245", "1.13.2": "245" }, "minecraft:redstone_ore": { "1.13": "165", "1.13.2": "165" }, "minecraft:redstone_torch": { "1.13": "166", "1.13.2": "166" }, "minecraft:redstone_wall_torch": { "1.13": "167", "1.13.2": "167" }, "minecraft:redstone_wire": { "1.13": "143", "1.13.2": "143" }, "minecraft:repeater": { "1.13": "185", "1.13.2": "185" }, "minecraft:repeating_command_block": { "1.13": "473", "1.13.2": "473" }, "minecraft:rose_bush": { "1.13": "388", "1.13.2": "388" }, "minecraft:sand": { "1.13": "28", "1.13.2": "28" }, "minecraft:sandstone": { "1.13": "70", "1.13.2": "70" }, "minecraft:sandstone_slab": { "1.13": "435", "1.13.2": "435" }, "minecraft:sandstone_stairs": { "1.13": "247", "1.13.2": "247" }, "minecraft:sea_lantern": { "1.13": "365", "1.13.2": "365" }, "minecraft:sea_pickle": { "1.13": "586", "1.13.2": "591" }, "minecraft:seagrass": { "1.13": "97", "1.13.2": "97" }, "minecraft:shulker_box": { "1.13": "482", "1.13.2": "482" }, "minecraft:skeleton_skull": { "1.13": "291", "1.13.2": "291" }, "minecraft:skeleton_wall_skull": { "1.13": "290", "1.13.2": "290" }, "minecraft:slime_block": { "1.13": "353", "1.13.2": "353" }, "minecraft:smooth_quartz": { "1.13": "446", "1.13.2": "446" }, "minecraft:smooth_red_sandstone": { "1.13": "447", "1.13.2": "447" }, "minecraft:smooth_sandstone": { "1.13": "445", "1.13.2": "445" }, "minecraft:smooth_stone": { "1.13": "444", "1.13.2": "444" }, "minecraft:smooth_stone_slab": { "1.13": "434", "1.13.2": "434" }, "minecraft:snow": { "1.13": "169", "1.13.2": "169" }, "minecraft:snow_block": { "1.13": "171", "1.13.2": "171" }, "minecraft:soul_sand": { "1.13": "179", "1.13.2": "179" }, "minecraft:spawner": { "1.13": "140", "1.13.2": "140" }, "minecraft:sponge": { "1.13": "64", "1.13.2": "64" }, "minecraft:spruce_button": { "1.13": "285", "1.13.2": "285" }, "minecraft:spruce_door": { "1.13": "458", "1.13.2": "458" }, "minecraft:spruce_fence": { "1.13": "453", "1.13.2": "453" }, "minecraft:spruce_fence_gate": { "1.13": "448", "1.13.2": "448" }, "minecraft:spruce_leaves": { "1.13": "59", "1.13.2": "59" }, "minecraft:spruce_log": { "1.13": "35", "1.13.2": "35" }, "minecraft:spruce_planks": { "1.13": "14", "1.13.2": "14" }, "minecraft:spruce_pressure_plate": { "1.13": "160", "1.13.2": "160" }, "minecraft:spruce_sapling": { "1.13": "20", "1.13.2": "20" }, "minecraft:spruce_slab": { "1.13": "429", "1.13.2": "429" }, "minecraft:spruce_stairs": { "1.13": "253", "1.13.2": "253" }, "minecraft:spruce_trapdoor": { "1.13": "203", "1.13.2": "203" }, "minecraft:spruce_wood": { "1.13": "47", "1.13.2": "47" }, "minecraft:sticky_piston": { "1.13": "92", "1.13.2": "92" }, "minecraft:stone": { "1.13": "1", "1.13.2": "1" }, "minecraft:stone_brick_slab": { "1.13": "439", "1.13.2": "439" }, "minecraft:stone_brick_stairs": { "1.13": "231", "1.13.2": "231" }, "minecraft:stone_bricks": { "1.13": "214", "1.13.2": "214" }, "minecraft:stone_button": { "1.13": "168", "1.13.2": "168" }, "minecraft:stone_pressure_plate": { "1.13": "157", "1.13.2": "157" }, "minecraft:stripped_acacia_log": { "1.13": "43", "1.13.2": "43" }, "minecraft:stripped_acacia_wood": { "1.13": "56", "1.13.2": "56" }, "minecraft:stripped_birch_log": { "1.13": "41", "1.13.2": "41" }, "minecraft:stripped_birch_wood": { "1.13": "54", "1.13.2": "54" }, "minecraft:stripped_dark_oak_log": { "1.13": "44", "1.13.2": "44" }, "minecraft:stripped_dark_oak_wood": { "1.13": "57", "1.13.2": "57" }, "minecraft:stripped_jungle_log": { "1.13": "42", "1.13.2": "42" }, "minecraft:stripped_jungle_wood": { "1.13": "55", "1.13.2": "55" }, "minecraft:stripped_oak_log": { "1.13": "45", "1.13.2": "45" }, "minecraft:stripped_oak_wood": { "1.13": "52", "1.13.2": "52" }, "minecraft:stripped_spruce_log": { "1.13": "40", "1.13.2": "40" }, "minecraft:stripped_spruce_wood": { "1.13": "53", "1.13.2": "53" }, "minecraft:structure_block": { "1.13": "592", "1.13.2": "597" }, "minecraft:structure_void": { "1.13": "480", "1.13.2": "480" }, "minecraft:sugar_cane": { "1.13": "174", "1.13.2": "174" }, "minecraft:sunflower": { "1.13": "386", "1.13.2": "386" }, "minecraft:tall_grass": { "1.13": "390", "1.13.2": "390" }, "minecraft:tall_seagrass": { "1.13": "98", "1.13.2": "98" }, "minecraft:terracotta": { "1.13": "383", "1.13.2": "383" }, "minecraft:tnt": { "1.13": "133", "1.13.2": "133" }, "minecraft:torch": { "1.13": "137", "1.13.2": "137" }, "minecraft:trapped_chest": { "1.13": "305", "1.13.2": "305" }, "minecraft:tripwire": { "1.13": "251", "1.13.2": "251" }, "minecraft:tripwire_hook": { "1.13": "250", "1.13.2": "250" }, "minecraft:tube_coral": { "1.13": "561", "1.13.2": "566" }, "minecraft:tube_coral_block": { "1.13": "556", "1.13.2": "556" }, "minecraft:tube_coral_fan": { "1.13": "581", "1.13.2": "586" }, "minecraft:tube_coral_wall_fan": { "1.13": "571", "1.13.2": "576" }, "minecraft:turtle_egg": { "1.13": "550", "1.13.2": "550" }, "minecraft:vine": { "1.13": "228", "1.13.2": "228" }, "minecraft:void_air": { "1.13": "589", "1.13.2": "594" }, "minecraft:wall_torch": { "1.13": "138", "1.13.2": "138" }, "minecraft:water": { "1.13": "26", "1.13.2": "26" }, "minecraft:wet_sponge": { "1.13": "65", "1.13.2": "65" }, "minecraft:wheat": { "1.13": "147", "1.13.2": "147" }, "minecraft:white_banner": { "1.13": "392", "1.13.2": "392" }, "minecraft:white_bed": { "1.13": "74", "1.13.2": "74" }, "minecraft:white_carpet": { "1.13": "367", "1.13.2": "367" }, "minecraft:white_concrete": { "1.13": "515", "1.13.2": "515" }, "minecraft:white_concrete_powder": { "1.13": "531", "1.13.2": "531" }, "minecraft:white_glazed_terracotta": { "1.13": "499", "1.13.2": "499" }, "minecraft:white_shulker_box": { "1.13": "483", "1.13.2": "483" }, "minecraft:white_stained_glass": { "1.13": "186", "1.13.2": "186" }, "minecraft:white_stained_glass_pane": { "1.13": "335", "1.13.2": "335" }, "minecraft:white_terracotta": { "1.13": "319", "1.13.2": "319" }, "minecraft:white_tulip": { "1.13": "125", "1.13.2": "125" }, "minecraft:white_wall_banner": { "1.13": "408", "1.13.2": "408" }, "minecraft:white_wool": { "1.13": "101", "1.13.2": "101" }, "minecraft:wither_skeleton_skull": { "1.13": "293", "1.13.2": "293" }, "minecraft:wither_skeleton_wall_skull": { "1.13": "292", "1.13.2": "292" }, "minecraft:yellow_banner": { "1.13": "396", "1.13.2": "396" }, "minecraft:yellow_bed": { "1.13": "78", "1.13.2": "78" }, "minecraft:yellow_carpet": { "1.13": "371", "1.13.2": "371" }, "minecraft:yellow_concrete": { "1.13": "519", "1.13.2": "519" }, "minecraft:yellow_concrete_powder": { "1.13": "535", "1.13.2": "535" }, "minecraft:yellow_glazed_terracotta": { "1.13": "503", "1.13.2": "503" }, "minecraft:yellow_shulker_box": { "1.13": "487", "1.13.2": "487" }, "minecraft:yellow_stained_glass": { "1.13": "190", "1.13.2": "190" }, "minecraft:yellow_stained_glass_pane": { "1.13": "339", "1.13.2": "339" }, "minecraft:yellow_terracotta": { "1.13": "323", "1.13.2": "323" }, "minecraft:yellow_wall_banner": { "1.13": "412", "1.13.2": "412" }, "minecraft:yellow_wool": { "1.13": "105", "1.13.2": "105" }, "minecraft:zombie_head": { "1.13": "295", "1.13.2": "295" }, "minecraft:zombie_wall_head": { "1.13": "294", "1.13.2": "294" } } ================================================ FILE: plugin/mapping/legacy_data_component_types_mapping.json ================================================ {} ================================================ FILE: plugin/mapping/legacy_items_mapping.json ================================================ { "minecraft:acacia_boat": { "1.13": "762", "1.13.2": "767" }, "minecraft:acacia_button": { "1.13": "245", "1.13.2": "245" }, "minecraft:acacia_door": { "legacy": "430", "1.13": "460", "1.13.2": "465" }, "minecraft:acacia_fence": { "legacy": "192", "1.13": "179", "1.13.2": "179" }, "minecraft:acacia_fence_gate": { "legacy": "187", "1.13": "214", "1.13.2": "214" }, "minecraft:acacia_leaves": { "legacy": "161", "1.13": "60", "1.13.2": "60" }, "minecraft:acacia_log": { "legacy": "162", "1.13": "36", "1.13.2": "36" }, "minecraft:acacia_planks": { "1.13": "17", "1.13.2": "17" }, "minecraft:acacia_pressure_plate": { "1.13": "164", "1.13.2": "164" }, "minecraft:acacia_sapling": { "1.13": "23", "1.13.2": "23" }, "minecraft:acacia_slab": { "1.13": "116", "1.13.2": "116" }, "minecraft:acacia_stairs": { "legacy": "163", "1.13": "301", "1.13.2": "301" }, "minecraft:acacia_trapdoor": { "1.13": "191", "1.13.2": "191" }, "minecraft:acacia_wood": { "1.13": "54", "1.13.2": "54" }, "minecraft:activator_rail": { "legacy": "157", "1.13": "261", "1.13.2": "261" }, "minecraft:air": { "legacy": "0", "1.13": "0", "1.13.2": "0" }, "minecraft:allium": { "1.13": "101", "1.13.2": "101" }, "minecraft:andesite": { "1.13": "6", "1.13.2": "6" }, "minecraft:anvil": { "legacy": "145", "1.13": "247", "1.13.2": "247" }, "minecraft:apple": { "legacy": "260", "1.13": "471", "1.13.2": "476" }, "minecraft:armor_stand": { "legacy": "416", "1.13": "721", "1.13.2": "726" }, "minecraft:arrow": { "legacy": "262", "1.13": "473", "1.13.2": "478" }, "minecraft:azure_bluet": { "1.13": "102", "1.13.2": "102" }, "minecraft:baked_potato": { "legacy": "393", "1.13": "694", "1.13.2": "699" }, "minecraft:barrier": { "legacy": "166", "1.13": "279", "1.13.2": "279" }, "minecraft:bat_spawn_egg": { "1.13": "634", "1.13.2": "639" }, "minecraft:beacon": { "legacy": "138", "1.13": "238", "1.13.2": "238" }, "minecraft:bedrock": { "legacy": "7", "1.13": "25", "1.13.2": "25" }, "minecraft:beef": { "legacy": "363", "1.13": "614", "1.13.2": "619" }, "minecraft:beetroot": { "1.13": "749", "1.13.2": "754" }, "minecraft:beetroot_seeds": { "1.13": "750", "1.13.2": "755" }, "minecraft:beetroot_soup": { "1.13": "751", "1.13.2": "756" }, "minecraft:birch_boat": { "1.13": "760", "1.13.2": "765" }, "minecraft:birch_button": { "1.13": "243", "1.13.2": "243" }, "minecraft:birch_door": { "legacy": "428", "1.13": "458", "1.13.2": "463" }, "minecraft:birch_fence": { "legacy": "189", "1.13": "177", "1.13.2": "177" }, "minecraft:birch_fence_gate": { "legacy": "184", "1.13": "212", "1.13.2": "212" }, "minecraft:birch_leaves": { "1.13": "58", "1.13.2": "58" }, "minecraft:birch_log": { "1.13": "34", "1.13.2": "34" }, "minecraft:birch_planks": { "1.13": "15", "1.13.2": "15" }, "minecraft:birch_pressure_plate": { "1.13": "162", "1.13.2": "162" }, "minecraft:birch_sapling": { "1.13": "21", "1.13.2": "21" }, "minecraft:birch_slab": { "1.13": "114", "1.13.2": "114" }, "minecraft:birch_stairs": { "legacy": "135", "1.13": "235", "1.13.2": "235" }, "minecraft:birch_trapdoor": { "1.13": "189", "1.13.2": "189" }, "minecraft:birch_wood": { "1.13": "52", "1.13.2": "52" }, "minecraft:black_banner": { "1.13": "745", "1.13.2": "750" }, "minecraft:black_bed": { "1.13": "606", "1.13.2": "611" }, "minecraft:black_carpet": { "1.13": "297", "1.13.2": "297" }, "minecraft:black_concrete": { "1.13": "410", "1.13.2": "410" }, "minecraft:black_concrete_powder": { "1.13": "426", "1.13.2": "426" }, "minecraft:black_glazed_terracotta": { "1.13": "394", "1.13.2": "394" }, "minecraft:black_shulker_box": { "1.13": "378", "1.13.2": "378" }, "minecraft:black_stained_glass": { "1.13": "326", "1.13.2": "326" }, "minecraft:black_stained_glass_pane": { "1.13": "342", "1.13.2": "342" }, "minecraft:black_terracotta": { "1.13": "278", "1.13.2": "278" }, "minecraft:black_wool": { "1.13": "97", "1.13.2": "97" }, "minecraft:blaze_powder": { "legacy": "377", "1.13": "628", "1.13.2": "633" }, "minecraft:blaze_rod": { "legacy": "369", "1.13": "620", "1.13.2": "625" }, "minecraft:blaze_spawn_egg": { "1.13": "635", "1.13.2": "640" }, "minecraft:blue_banner": { "1.13": "741", "1.13.2": "746" }, "minecraft:blue_bed": { "1.13": "602", "1.13.2": "607" }, "minecraft:blue_carpet": { "1.13": "293", "1.13.2": "293" }, "minecraft:blue_concrete": { "1.13": "406", "1.13.2": "406" }, "minecraft:blue_concrete_powder": { "1.13": "422", "1.13.2": "422" }, "minecraft:blue_glazed_terracotta": { "1.13": "390", "1.13.2": "390" }, "minecraft:blue_ice": { "1.13": "453", "1.13.2": "458" }, "minecraft:blue_orchid": { "1.13": "100", "1.13.2": "100" }, "minecraft:blue_shulker_box": { "1.13": "374", "1.13.2": "374" }, "minecraft:blue_stained_glass": { "1.13": "322", "1.13.2": "322" }, "minecraft:blue_stained_glass_pane": { "1.13": "338", "1.13.2": "338" }, "minecraft:blue_terracotta": { "1.13": "274", "1.13.2": "274" }, "minecraft:blue_wool": { "1.13": "93", "1.13.2": "93" }, "minecraft:bone": { "legacy": "352", "1.13": "588", "1.13.2": "593" }, "minecraft:bone_block": { "1.13": "359", "1.13.2": "359" }, "minecraft:bone_meal": { "1.13": "587", "1.13.2": "592" }, "minecraft:book": { "legacy": "340", "1.13": "557", "1.13.2": "562" }, "minecraft:bookshelf": { "legacy": "47", "1.13": "137", "1.13.2": "137" }, "minecraft:bow": { "legacy": "261", "1.13": "472", "1.13.2": "477" }, "minecraft:bowl": { "legacy": "281", "1.13": "493", "1.13.2": "498" }, "minecraft:brain_coral": { "1.13": "439", "1.13.2": "439" }, "minecraft:brain_coral_block": { "1.13": "434", "1.13.2": "434" }, "minecraft:brain_coral_fan": { "1.13": "444", "1.13.2": "449" }, "minecraft:bread": { "legacy": "297", "1.13": "509", "1.13.2": "514" }, "minecraft:brewing_stand": { "legacy": "379", "1.13": "630", "1.13.2": "635" }, "minecraft:brick": { "legacy": "336", "1.13": "551", "1.13.2": "556" }, "minecraft:brick_slab": { "1.13": "122", "1.13.2": "122" }, "minecraft:brick_stairs": { "legacy": "108", "1.13": "216", "1.13.2": "216" }, "minecraft:bricks": { "legacy": "45", "1.13": "135", "1.13.2": "135" }, "minecraft:brown_banner": { "1.13": "742", "1.13.2": "747" }, "minecraft:brown_bed": { "1.13": "603", "1.13.2": "608" }, "minecraft:brown_carpet": { "1.13": "294", "1.13.2": "294" }, "minecraft:brown_concrete": { "legacy": "172", "1.13": "407", "1.13.2": "407" }, "minecraft:brown_concrete_powder": { "1.13": "423", "1.13.2": "423" }, "minecraft:brown_glazed_terracotta": { "1.13": "391", "1.13.2": "391" }, "minecraft:brown_mushroom": { "legacy": "39", "1.13": "108", "1.13.2": "108" }, "minecraft:brown_mushroom_block": { "legacy": "99", "1.13": "203", "1.13.2": "203" }, "minecraft:brown_shulker_box": { "1.13": "375", "1.13.2": "375" }, "minecraft:brown_stained_glass": { "1.13": "323", "1.13.2": "323" }, "minecraft:brown_stained_glass_pane": { "1.13": "339", "1.13.2": "339" }, "minecraft:brown_terracotta": { "1.13": "275", "1.13.2": "275" }, "minecraft:brown_wool": { "1.13": "94", "1.13.2": "94" }, "minecraft:bubble_coral": { "1.13": "440", "1.13.2": "440" }, "minecraft:bubble_coral_block": { "1.13": "435", "1.13.2": "435" }, "minecraft:bubble_coral_fan": { "1.13": "445", "1.13.2": "450" }, "minecraft:bucket": { "legacy": "325", "1.13": "537", "1.13.2": "542" }, "minecraft:cactus": { "legacy": "81", "1.13": "172", "1.13.2": "172" }, "minecraft:cake": { "legacy": "354", "1.13": "590", "1.13.2": "595" }, "minecraft:carrot": { "legacy": "391", "1.13": "692", "1.13.2": "697" }, "minecraft:carrot_on_a_stick": { "legacy": "398", "1.13": "704", "1.13.2": "709" }, "minecraft:carved_pumpkin": { "1.13": "182", "1.13.2": "182" }, "minecraft:cauldron": { "legacy": "380", "1.13": "631", "1.13.2": "636" }, "minecraft:cave_spider_spawn_egg": { "1.13": "636", "1.13.2": "641" }, "minecraft:chain_command_block": { "1.13": "355", "1.13.2": "355" }, "minecraft:chainmail_boots": { "legacy": "305", "1.13": "517", "1.13.2": "522" }, "minecraft:chainmail_chestplate": { "legacy": "303", "1.13": "515", "1.13.2": "520" }, "minecraft:chainmail_helmet": { "legacy": "302", "1.13": "514", "1.13.2": "519" }, "minecraft:chainmail_leggings": { "legacy": "304", "1.13": "516", "1.13.2": "521" }, "minecraft:charcoal": { "1.13": "475", "1.13.2": "480" }, "minecraft:chest": { "legacy": "54", "1.13": "149", "1.13.2": "149" }, "minecraft:chest_minecart": { "legacy": "342", "1.13": "559", "1.13.2": "564" }, "minecraft:chicken": { "legacy": "365", "1.13": "616", "1.13.2": "621" }, "minecraft:chicken_spawn_egg": { "1.13": "637", "1.13.2": "642" }, "minecraft:chipped_anvil": { "1.13": "248", "1.13.2": "248" }, "minecraft:chiseled_quartz_block": { "1.13": "257", "1.13.2": "257" }, "minecraft:chiseled_red_sandstone": { "1.13": "351", "1.13.2": "351" }, "minecraft:chiseled_sandstone": { "1.13": "69", "1.13.2": "69" }, "minecraft:chiseled_stone_bricks": { "1.13": "202", "1.13.2": "202" }, "minecraft:chorus_flower": { "1.13": "143", "1.13.2": "143" }, "minecraft:chorus_fruit": { "1.13": "747", "1.13.2": "752" }, "minecraft:chorus_plant": { "1.13": "142", "1.13.2": "142" }, "minecraft:clay": { "legacy": "82", "1.13": "173", "1.13.2": "173" }, "minecraft:clay_ball": { "legacy": "337", "1.13": "552", "1.13.2": "557" }, "minecraft:clock": { "legacy": "347", "1.13": "564", "1.13.2": "569" }, "minecraft:coal": { "legacy": "263", "1.13": "474", "1.13.2": "479" }, "minecraft:coal_block": { "legacy": "173", "1.13": "299", "1.13.2": "299" }, "minecraft:coal_ore": { "legacy": "16", "1.13": "31", "1.13.2": "31" }, "minecraft:coarse_dirt": { "1.13": "10", "1.13.2": "10" }, "minecraft:cobblestone": { "legacy": "4", "1.13": "12", "1.13.2": "12" }, "minecraft:cobblestone_slab": { "1.13": "121", "1.13.2": "121" }, "minecraft:cobblestone_stairs": { "legacy": "67", "1.13": "157", "1.13.2": "157" }, "minecraft:cobblestone_wall": { "legacy": "139", "1.13": "239", "1.13.2": "239" }, "minecraft:cobweb": { "legacy": "30", "1.13": "75", "1.13.2": "75" }, "minecraft:cocoa_beans": { "1.13": "575", "1.13.2": "580" }, "minecraft:cod": { "1.13": "566", "1.13.2": "571" }, "minecraft:cod_bucket": { "1.13": "549", "1.13.2": "554" }, "minecraft:cod_spawn_egg": { "1.13": "638", "1.13.2": "643" }, "minecraft:command_block": { "legacy": "137", "1.13": "237", "1.13.2": "237" }, "minecraft:command_block_minecart": { "legacy": "422", "1.13": "727", "1.13.2": "732" }, "minecraft:comparator": { "legacy": "404", "1.13": "463", "1.13.2": "468" }, "minecraft:compass": { "legacy": "345", "1.13": "562", "1.13.2": "567" }, "minecraft:conduit": { "1.13": "454", "1.13.2": "459" }, "minecraft:cooked_beef": { "legacy": "364", "1.13": "615", "1.13.2": "620" }, "minecraft:cooked_chicken": { "legacy": "366", "1.13": "617", "1.13.2": "622" }, "minecraft:cooked_cod": { "legacy": "350", "1.13": "570", "1.13.2": "575" }, "minecraft:cooked_mutton": { "legacy": "424", "1.13": "729", "1.13.2": "734" }, "minecraft:cooked_porkchop": { "legacy": "320", "1.13": "532", "1.13.2": "537" }, "minecraft:cooked_rabbit": { "legacy": "412", "1.13": "717", "1.13.2": "722" }, "minecraft:cooked_salmon": { "1.13": "571", "1.13.2": "576" }, "minecraft:cookie": { "legacy": "357", "1.13": "607", "1.13.2": "612" }, "minecraft:cow_spawn_egg": { "1.13": "639", "1.13.2": "644" }, "minecraft:cracked_stone_bricks": { "1.13": "201", "1.13.2": "201" }, "minecraft:crafting_table": { "legacy": "58", "1.13": "152", "1.13.2": "152" }, "minecraft:creeper_head": { "1.13": "702", "1.13.2": "707" }, "minecraft:creeper_spawn_egg": { "1.13": "640", "1.13.2": "645" }, "minecraft:cut_red_sandstone": { "1.13": "352", "1.13.2": "352" }, "minecraft:cut_sandstone": { "1.13": "70", "1.13.2": "70" }, "minecraft:cyan_banner": { "1.13": "739", "1.13.2": "744" }, "minecraft:cyan_bed": { "1.13": "600", "1.13.2": "605" }, "minecraft:cyan_carpet": { "1.13": "291", "1.13.2": "291" }, "minecraft:cyan_concrete": { "1.13": "404", "1.13.2": "404" }, "minecraft:cyan_concrete_powder": { "1.13": "420", "1.13.2": "420" }, "minecraft:cyan_dye": { "1.13": "578", "1.13.2": "583" }, "minecraft:cyan_glazed_terracotta": { "1.13": "388", "1.13.2": "388" }, "minecraft:cyan_shulker_box": { "1.13": "372", "1.13.2": "372" }, "minecraft:cyan_stained_glass": { "1.13": "320", "1.13.2": "320" }, "minecraft:cyan_stained_glass_pane": { "1.13": "336", "1.13.2": "336" }, "minecraft:cyan_terracotta": { "1.13": "272", "1.13.2": "272" }, "minecraft:cyan_wool": { "1.13": "91", "1.13.2": "91" }, "minecraft:damaged_anvil": { "1.13": "249", "1.13.2": "249" }, "minecraft:dandelion": { "legacy": "37", "1.13": "98", "1.13.2": "98" }, "minecraft:dark_oak_boat": { "1.13": "763", "1.13.2": "768" }, "minecraft:dark_oak_button": { "1.13": "246", "1.13.2": "246" }, "minecraft:dark_oak_door": { "legacy": "431", "1.13": "461", "1.13.2": "466" }, "minecraft:dark_oak_fence": { "legacy": "191", "1.13": "180", "1.13.2": "180" }, "minecraft:dark_oak_fence_gate": { "legacy": "186", "1.13": "215", "1.13.2": "215" }, "minecraft:dark_oak_leaves": { "1.13": "61", "1.13.2": "61" }, "minecraft:dark_oak_log": { "1.13": "37", "1.13.2": "37" }, "minecraft:dark_oak_planks": { "1.13": "18", "1.13.2": "18" }, "minecraft:dark_oak_pressure_plate": { "1.13": "165", "1.13.2": "165" }, "minecraft:dark_oak_sapling": { "1.13": "24", "1.13.2": "24" }, "minecraft:dark_oak_slab": { "1.13": "117", "1.13.2": "117" }, "minecraft:dark_oak_stairs": { "legacy": "164", "1.13": "302", "1.13.2": "302" }, "minecraft:dark_oak_trapdoor": { "1.13": "192", "1.13.2": "192" }, "minecraft:dark_oak_wood": { "1.13": "55", "1.13.2": "55" }, "minecraft:dark_prismarine": { "1.13": "345", "1.13.2": "345" }, "minecraft:dark_prismarine_slab": { "1.13": "130", "1.13.2": "130" }, "minecraft:dark_prismarine_stairs": { "1.13": "348", "1.13.2": "348" }, "minecraft:daylight_detector": { "legacy": "151", "1.13": "253", "1.13.2": "253" }, "minecraft:dead_brain_coral": { "1.13.2": "443" }, "minecraft:dead_brain_coral_block": { "1.13": "429", "1.13.2": "429" }, "minecraft:dead_brain_coral_fan": { "1.13": "449", "1.13.2": "454" }, "minecraft:dead_bubble_coral": { "1.13.2": "444" }, "minecraft:dead_bubble_coral_block": { "1.13": "430", "1.13.2": "430" }, "minecraft:dead_bubble_coral_fan": { "1.13": "450", "1.13.2": "455" }, "minecraft:dead_bush": { "legacy": "32", "1.13": "78", "1.13.2": "78" }, "minecraft:dead_fire_coral": { "1.13.2": "445" }, "minecraft:dead_fire_coral_block": { "1.13": "431", "1.13.2": "431" }, "minecraft:dead_fire_coral_fan": { "1.13": "451", "1.13.2": "456" }, "minecraft:dead_horn_coral": { "1.13.2": "446" }, "minecraft:dead_horn_coral_block": { "1.13": "432", "1.13.2": "432" }, "minecraft:dead_horn_coral_fan": { "1.13": "452", "1.13.2": "457" }, "minecraft:dead_tube_coral": { "1.13.2": "447" }, "minecraft:dead_tube_coral_block": { "1.13": "428", "1.13.2": "428" }, "minecraft:dead_tube_coral_fan": { "1.13": "448", "1.13.2": "453" }, "minecraft:debug_stick": { "1.13": "768", "1.13.2": "773" }, "minecraft:detector_rail": { "legacy": "28", "1.13": "73", "1.13.2": "73" }, "minecraft:diamond": { "legacy": "264", "1.13": "476", "1.13.2": "481" }, "minecraft:diamond_axe": { "legacy": "279", "1.13": "491", "1.13.2": "496" }, "minecraft:diamond_block": { "legacy": "57", "1.13": "151", "1.13.2": "151" }, "minecraft:diamond_boots": { "legacy": "313", "1.13": "525", "1.13.2": "530" }, "minecraft:diamond_chestplate": { "legacy": "311", "1.13": "523", "1.13.2": "528" }, "minecraft:diamond_helmet": { "legacy": "310", "1.13": "522", "1.13.2": "527" }, "minecraft:diamond_hoe": { "legacy": "293", "1.13": "505", "1.13.2": "510" }, "minecraft:diamond_horse_armor": { "legacy": "419", "1.13": "724", "1.13.2": "729" }, "minecraft:diamond_leggings": { "legacy": "312", "1.13": "524", "1.13.2": "529" }, "minecraft:diamond_ore": { "legacy": "56", "1.13": "150", "1.13.2": "150" }, "minecraft:diamond_pickaxe": { "legacy": "278", "1.13": "490", "1.13.2": "495" }, "minecraft:diamond_shovel": { "legacy": "277", "1.13": "489", "1.13.2": "494" }, "minecraft:diamond_sword": { "legacy": "276", "1.13": "488", "1.13.2": "493" }, "minecraft:diorite": { "1.13": "4", "1.13.2": "4" }, "minecraft:dirt": { "legacy": "3", "1.13": "9", "1.13.2": "9" }, "minecraft:dispenser": { "legacy": "23", "1.13": "67", "1.13.2": "67" }, "minecraft:dolphin_spawn_egg": { "1.13": "641", "1.13.2": "646" }, "minecraft:donkey_spawn_egg": { "1.13": "642", "1.13.2": "647" }, "minecraft:dragon_breath": { "1.13": "752", "1.13.2": "757" }, "minecraft:dragon_egg": { "legacy": "122", "1.13": "227", "1.13.2": "227" }, "minecraft:dragon_head": { "1.13": "703", "1.13.2": "708" }, "minecraft:dried_kelp": { "1.13": "611", "1.13.2": "616" }, "minecraft:dried_kelp_block": { "1.13": "555", "1.13.2": "560" }, "minecraft:dropper": { "legacy": "158", "1.13": "262", "1.13.2": "262" }, "minecraft:drowned_spawn_egg": { "1.13": "643", "1.13.2": "648" }, "minecraft:egg": { "legacy": "344", "1.13": "561", "1.13.2": "566" }, "minecraft:elder_guardian_spawn_egg": { "1.13": "644", "1.13.2": "649" }, "minecraft:elytra": { "1.13": "758", "1.13.2": "763" }, "minecraft:emerald": { "legacy": "388", "1.13": "689", "1.13.2": "694" }, "minecraft:emerald_block": { "legacy": "133", "1.13": "233", "1.13.2": "233" }, "minecraft:emerald_ore": { "legacy": "129", "1.13": "230", "1.13.2": "230" }, "minecraft:enchanted_book": { "legacy": "403", "1.13": "709", "1.13.2": "714" }, "minecraft:enchanted_golden_apple": { "1.13": "535", "1.13.2": "540" }, "minecraft:enchanting_table": { "legacy": "116", "1.13": "223", "1.13.2": "223" }, "minecraft:end_crystal": { "1.13": "746", "1.13.2": "751" }, "minecraft:end_portal_frame": { "legacy": "120", "1.13": "224", "1.13.2": "224" }, "minecraft:end_rod": { "1.13": "141", "1.13.2": "141" }, "minecraft:end_stone": { "legacy": "121", "1.13": "225", "1.13.2": "225" }, "minecraft:end_stone_bricks": { "1.13": "226", "1.13.2": "226" }, "minecraft:ender_chest": { "legacy": "130", "1.13": "231", "1.13.2": "231" }, "minecraft:ender_eye": { "legacy": "381", "1.13": "632", "1.13.2": "637" }, "minecraft:ender_pearl": { "legacy": "368", "1.13": "619", "1.13.2": "624" }, "minecraft:enderman_spawn_egg": { "1.13": "645", "1.13.2": "650" }, "minecraft:endermite_spawn_egg": { "1.13": "646", "1.13.2": "651" }, "minecraft:evoker_spawn_egg": { "1.13": "647", "1.13.2": "652" }, "minecraft:experience_bottle": { "legacy": "384", "1.13": "685", "1.13.2": "690" }, "minecraft:farmland": { "legacy": "60", "1.13": "153", "1.13.2": "153" }, "minecraft:feather": { "legacy": "288", "1.13": "500", "1.13.2": "505" }, "minecraft:fermented_spider_eye": { "legacy": "376", "1.13": "627", "1.13.2": "632" }, "minecraft:fern": { "1.13": "77", "1.13.2": "77" }, "minecraft:filled_map": { "legacy": "358", "1.13": "608", "1.13.2": "613" }, "minecraft:fire_charge": { "legacy": "385", "1.13": "686", "1.13.2": "691" }, "minecraft:fire_coral": { "1.13": "441", "1.13.2": "441" }, "minecraft:fire_coral_block": { "1.13": "436", "1.13.2": "436" }, "minecraft:fire_coral_fan": { "1.13": "446", "1.13.2": "451" }, "minecraft:firework_rocket": { "legacy": "401", "1.13": "707", "1.13.2": "712" }, "minecraft:firework_star": { "legacy": "402", "1.13": "708", "1.13.2": "713" }, "minecraft:fishing_rod": { "legacy": "346", "1.13": "563", "1.13.2": "568" }, "minecraft:flint": { "legacy": "318", "1.13": "530", "1.13.2": "535" }, "minecraft:flint_and_steel": { "legacy": "259", "1.13": "470", "1.13.2": "475" }, "minecraft:flower_pot": { "legacy": "390", "1.13": "691", "1.13.2": "696" }, "minecraft:furnace": { "legacy": "61", "1.13": "154", "1.13.2": "154" }, "minecraft:furnace_minecart": { "legacy": "343", "1.13": "560", "1.13.2": "565" }, "minecraft:ghast_spawn_egg": { "1.13": "648", "1.13.2": "653" }, "minecraft:ghast_tear": { "legacy": "370", "1.13": "621", "1.13.2": "626" }, "minecraft:glass": { "legacy": "20", "1.13": "64", "1.13.2": "64" }, "minecraft:glass_bottle": { "legacy": "374", "1.13": "625", "1.13.2": "630" }, "minecraft:glass_pane": { "legacy": "102", "1.13": "207", "1.13.2": "207" }, "minecraft:glistering_melon_slice": { "legacy": "382", "1.13": "633", "1.13.2": "638" }, "minecraft:glowstone": { "legacy": "89", "1.13": "185", "1.13.2": "185" }, "minecraft:glowstone_dust": { "legacy": "348", "1.13": "565", "1.13.2": "570" }, "minecraft:gold_block": { "legacy": "41", "1.13": "110", "1.13.2": "110" }, "minecraft:gold_ingot": { "legacy": "266", "1.13": "478", "1.13.2": "483" }, "minecraft:gold_nugget": { "legacy": "371", "1.13": "622", "1.13.2": "627" }, "minecraft:gold_ore": { "legacy": "14", "1.13": "29", "1.13.2": "29" }, "minecraft:golden_apple": { "legacy": "322", "1.13": "534", "1.13.2": "539" }, "minecraft:golden_axe": { "legacy": "286", "1.13": "498", "1.13.2": "503" }, "minecraft:golden_boots": { "legacy": "317", "1.13": "529", "1.13.2": "534" }, "minecraft:golden_carrot": { "legacy": "396", "1.13": "697", "1.13.2": "702" }, "minecraft:golden_chestplate": { "legacy": "315", "1.13": "527", "1.13.2": "532" }, "minecraft:golden_helmet": { "legacy": "314", "1.13": "526", "1.13.2": "531" }, "minecraft:golden_hoe": { "legacy": "294", "1.13": "506", "1.13.2": "511" }, "minecraft:golden_horse_armor": { "legacy": "418", "1.13": "723", "1.13.2": "728" }, "minecraft:golden_leggings": { "legacy": "316", "1.13": "528", "1.13.2": "533" }, "minecraft:golden_pickaxe": { "legacy": "285", "1.13": "497", "1.13.2": "502" }, "minecraft:golden_shovel": { "legacy": "284", "1.13": "496", "1.13.2": "501" }, "minecraft:golden_sword": { "legacy": "283", "1.13": "495", "1.13.2": "500" }, "minecraft:granite": { "1.13": "2", "1.13.2": "2" }, "minecraft:short_grass": { "legacy": "2", "1.13": "76", "1.13.2": "76" }, "minecraft:grass_block": { "1.13": "8", "1.13.2": "8" }, "minecraft:gravel": { "legacy": "13", "1.13": "28", "1.13.2": "28" }, "minecraft:gray_banner": { "1.13": "737", "1.13.2": "742" }, "minecraft:gray_bed": { "1.13": "598", "1.13.2": "603" }, "minecraft:gray_carpet": { "1.13": "289", "1.13.2": "289" }, "minecraft:gray_concrete": { "1.13": "402", "1.13.2": "402" }, "minecraft:gray_concrete_powder": { "1.13": "418", "1.13.2": "418" }, "minecraft:gray_dye": { "1.13": "580", "1.13.2": "585" }, "minecraft:gray_glazed_terracotta": { "1.13": "386", "1.13.2": "386" }, "minecraft:gray_shulker_box": { "1.13": "370", "1.13.2": "370" }, "minecraft:gray_stained_glass": { "1.13": "318", "1.13.2": "318" }, "minecraft:gray_stained_glass_pane": { "1.13": "334", "1.13.2": "334" }, "minecraft:gray_terracotta": { "1.13": "270", "1.13.2": "270" }, "minecraft:gray_wool": { "1.13": "89", "1.13.2": "89" }, "minecraft:green_banner": { "1.13": "743", "1.13.2": "748" }, "minecraft:green_bed": { "1.13": "604", "1.13.2": "609" }, "minecraft:green_carpet": { "1.13": "295", "1.13.2": "295" }, "minecraft:green_concrete": { "1.13": "408", "1.13.2": "408" }, "minecraft:green_concrete_powder": { "1.13": "424", "1.13.2": "424" }, "minecraft:green_dye": { "1.13.2": "579" }, "minecraft:green_glazed_terracotta": { "1.13": "392", "1.13.2": "392" }, "minecraft:green_shulker_box": { "1.13": "376", "1.13.2": "376" }, "minecraft:green_stained_glass": { "1.13": "324", "1.13.2": "324" }, "minecraft:green_stained_glass_pane": { "1.13": "340", "1.13.2": "340" }, "minecraft:green_terracotta": { "1.13": "276", "1.13.2": "276" }, "minecraft:green_wool": { "1.13": "95", "1.13.2": "95" }, "minecraft:guardian_spawn_egg": { "1.13": "649", "1.13.2": "654" }, "minecraft:gunpowder": { "legacy": "289", "1.13": "501", "1.13.2": "506" }, "minecraft:hay_block": { "legacy": "170", "1.13": "281", "1.13.2": "281" }, "minecraft:heart_of_the_sea": { "1.13": "784", "1.13.2": "789" }, "minecraft:heavy_weighted_pressure_plate": { "legacy": "148", "1.13": "252", "1.13.2": "252" }, "minecraft:hopper": { "legacy": "154", "1.13": "256", "1.13.2": "256" }, "minecraft:hopper_minecart": { "legacy": "408", "1.13": "713", "1.13.2": "718" }, "minecraft:horn_coral": { "1.13": "442", "1.13.2": "442" }, "minecraft:horn_coral_block": { "1.13": "437", "1.13.2": "437" }, "minecraft:horn_coral_fan": { "1.13": "447", "1.13.2": "452" }, "minecraft:horse_spawn_egg": { "1.13": "650", "1.13.2": "655" }, "minecraft:husk_spawn_egg": { "1.13": "651", "1.13.2": "656" }, "minecraft:ice": { "legacy": "79", "1.13": "170", "1.13.2": "170" }, "minecraft:infested_chiseled_stone_bricks": { "1.13": "198", "1.13.2": "198" }, "minecraft:infested_cobblestone": { "1.13": "194", "1.13.2": "194" }, "minecraft:infested_cracked_stone_bricks": { "1.13": "197", "1.13.2": "197" }, "minecraft:infested_mossy_stone_bricks": { "1.13": "196", "1.13.2": "196" }, "minecraft:infested_stone": { "1.13": "193", "1.13.2": "193" }, "minecraft:infested_stone_bricks": { "1.13": "195", "1.13.2": "195" }, "minecraft:ink_sac": { "1.13": "572", "1.13.2": "577" }, "minecraft:iron_axe": { "legacy": "258", "1.13": "469", "1.13.2": "474" }, "minecraft:iron_bars": { "legacy": "101", "1.13": "206", "1.13.2": "206" }, "minecraft:iron_block": { "legacy": "42", "1.13": "111", "1.13.2": "111" }, "minecraft:iron_boots": { "legacy": "309", "1.13": "521", "1.13.2": "526" }, "minecraft:iron_chestplate": { "legacy": "307", "1.13": "519", "1.13.2": "524" }, "minecraft:iron_door": { "legacy": "330", "1.13": "455", "1.13.2": "460" }, "minecraft:iron_helmet": { "legacy": "306", "1.13": "518", "1.13.2": "523" }, "minecraft:iron_hoe": { "legacy": "292", "1.13": "504", "1.13.2": "509" }, "minecraft:iron_horse_armor": { "legacy": "417", "1.13": "722", "1.13.2": "727" }, "minecraft:iron_ingot": { "legacy": "265", "1.13": "477", "1.13.2": "482" }, "minecraft:iron_leggings": { "legacy": "308", "1.13": "520", "1.13.2": "525" }, "minecraft:iron_nugget": { "1.13": "766", "1.13.2": "771" }, "minecraft:iron_ore": { "legacy": "15", "1.13": "30", "1.13.2": "30" }, "minecraft:iron_pickaxe": { "legacy": "257", "1.13": "468", "1.13.2": "473" }, "minecraft:iron_shovel": { "legacy": "256", "1.13": "467", "1.13.2": "472" }, "minecraft:iron_sword": { "legacy": "267", "1.13": "479", "1.13.2": "484" }, "minecraft:iron_trapdoor": { "legacy": "167", "1.13": "280", "1.13.2": "280" }, "minecraft:item_frame": { "legacy": "389", "1.13": "690", "1.13.2": "695" }, "minecraft:jack_o_lantern": { "legacy": "91", "1.13": "186", "1.13.2": "186" }, "minecraft:jukebox": { "legacy": "84", "1.13": "174", "1.13.2": "174" }, "minecraft:jungle_boat": { "1.13": "761", "1.13.2": "766" }, "minecraft:jungle_button": { "1.13": "244", "1.13.2": "244" }, "minecraft:jungle_door": { "legacy": "429", "1.13": "459", "1.13.2": "464" }, "minecraft:jungle_fence": { "legacy": "190", "1.13": "178", "1.13.2": "178" }, "minecraft:jungle_fence_gate": { "legacy": "185", "1.13": "213", "1.13.2": "213" }, "minecraft:jungle_leaves": { "1.13": "59", "1.13.2": "59" }, "minecraft:jungle_log": { "1.13": "35", "1.13.2": "35" }, "minecraft:jungle_planks": { "1.13": "16", "1.13.2": "16" }, "minecraft:jungle_pressure_plate": { "1.13": "163", "1.13.2": "163" }, "minecraft:jungle_sapling": { "1.13": "22", "1.13.2": "22" }, "minecraft:jungle_slab": { "1.13": "115", "1.13.2": "115" }, "minecraft:jungle_stairs": { "legacy": "136", "1.13": "236", "1.13.2": "236" }, "minecraft:jungle_trapdoor": { "1.13": "190", "1.13.2": "190" }, "minecraft:jungle_wood": { "1.13": "53", "1.13.2": "53" }, "minecraft:kelp": { "1.13": "554", "1.13.2": "559" }, "minecraft:knowledge_book": { "1.13": "767", "1.13.2": "772" }, "minecraft:ladder": { "legacy": "65", "1.13": "155", "1.13.2": "155" }, "minecraft:lapis_block": { "legacy": "22", "1.13": "66", "1.13.2": "66" }, "minecraft:lapis_lazuli": { "1.13": "576", "1.13.2": "581" }, "minecraft:lapis_ore": { "legacy": "21", "1.13": "65", "1.13.2": "65" }, "minecraft:large_fern": { "1.13": "310", "1.13.2": "310" }, "minecraft:lava_bucket": { "legacy": "327", "1.13": "539", "1.13.2": "544" }, "minecraft:lead": { "legacy": "420", "1.13": "725", "1.13.2": "730" }, "minecraft:leather": { "legacy": "334", "1.13": "545", "1.13.2": "550" }, "minecraft:leather_boots": { "legacy": "301", "1.13": "513", "1.13.2": "518" }, "minecraft:leather_chestplate": { "legacy": "299", "1.13": "511", "1.13.2": "516" }, "minecraft:leather_helmet": { "legacy": "298", "1.13": "510", "1.13.2": "515" }, "minecraft:leather_leggings": { "legacy": "300", "1.13": "512", "1.13.2": "517" }, "minecraft:lever": { "legacy": "69", "1.13": "158", "1.13.2": "158" }, "minecraft:light_blue_banner": { "1.13": "733", "1.13.2": "738" }, "minecraft:light_blue_bed": { "1.13": "594", "1.13.2": "599" }, "minecraft:light_blue_carpet": { "1.13": "285", "1.13.2": "285" }, "minecraft:light_blue_concrete": { "1.13": "398", "1.13.2": "398" }, "minecraft:light_blue_concrete_powder": { "1.13": "414", "1.13.2": "414" }, "minecraft:light_blue_dye": { "1.13": "584", "1.13.2": "589" }, "minecraft:light_blue_glazed_terracotta": { "1.13": "382", "1.13.2": "382" }, "minecraft:light_blue_shulker_box": { "1.13": "366", "1.13.2": "366" }, "minecraft:light_blue_stained_glass": { "1.13": "314", "1.13.2": "314" }, "minecraft:light_blue_stained_glass_pane": { "1.13": "330", "1.13.2": "330" }, "minecraft:light_blue_terracotta": { "1.13": "266", "1.13.2": "266" }, "minecraft:light_blue_wool": { "1.13": "85", "1.13.2": "85" }, "minecraft:light_gray_banner": { "1.13": "738", "1.13.2": "743" }, "minecraft:light_gray_bed": { "1.13": "599", "1.13.2": "604" }, "minecraft:light_gray_carpet": { "1.13": "290", "1.13.2": "290" }, "minecraft:light_gray_concrete": { "1.13": "403", "1.13.2": "403" }, "minecraft:light_gray_concrete_powder": { "1.13": "419", "1.13.2": "419" }, "minecraft:light_gray_dye": { "legacy": "351", "1.13": "579", "1.13.2": "584" }, "minecraft:light_gray_glazed_terracotta": { "1.13": "387", "1.13.2": "387" }, "minecraft:light_gray_shulker_box": { "1.13": "371", "1.13.2": "371" }, "minecraft:light_gray_stained_glass": { "1.13": "319", "1.13.2": "319" }, "minecraft:light_gray_stained_glass_pane": { "1.13": "335", "1.13.2": "335" }, "minecraft:light_gray_terracotta": { "1.13": "271", "1.13.2": "271" }, "minecraft:light_gray_wool": { "1.13": "90", "1.13.2": "90" }, "minecraft:light_weighted_pressure_plate": { "legacy": "147", "1.13": "251", "1.13.2": "251" }, "minecraft:lilac": { "1.13": "306", "1.13.2": "306" }, "minecraft:lily_pad": { "legacy": "111", "1.13": "219", "1.13.2": "219" }, "minecraft:lime_banner": { "1.13": "735", "1.13.2": "740" }, "minecraft:lime_bed": { "1.13": "596", "1.13.2": "601" }, "minecraft:lime_carpet": { "1.13": "287", "1.13.2": "287" }, "minecraft:lime_concrete": { "1.13": "400", "1.13.2": "400" }, "minecraft:lime_concrete_powder": { "1.13": "416", "1.13.2": "416" }, "minecraft:lime_dye": { "1.13": "582", "1.13.2": "587" }, "minecraft:lime_glazed_terracotta": { "1.13": "384", "1.13.2": "384" }, "minecraft:lime_shulker_box": { "1.13": "368", "1.13.2": "368" }, "minecraft:lime_stained_glass": { "1.13": "316", "1.13.2": "316" }, "minecraft:lime_stained_glass_pane": { "1.13": "332", "1.13.2": "332" }, "minecraft:lime_terracotta": { "1.13": "268", "1.13.2": "268" }, "minecraft:lime_wool": { "1.13": "87", "1.13.2": "87" }, "minecraft:lingering_potion": { "1.13": "756", "1.13.2": "761" }, "minecraft:llama_spawn_egg": { "1.13": "652", "1.13.2": "657" }, "minecraft:magenta_banner": { "1.13": "732", "1.13.2": "737" }, "minecraft:magenta_bed": { "1.13": "593", "1.13.2": "598" }, "minecraft:magenta_carpet": { "1.13": "284", "1.13.2": "284" }, "minecraft:magenta_concrete": { "1.13": "397", "1.13.2": "397" }, "minecraft:magenta_concrete_powder": { "1.13": "413", "1.13.2": "413" }, "minecraft:magenta_dye": { "1.13": "585", "1.13.2": "590" }, "minecraft:magenta_glazed_terracotta": { "1.13": "381", "1.13.2": "381" }, "minecraft:magenta_shulker_box": { "1.13": "365", "1.13.2": "365" }, "minecraft:magenta_stained_glass": { "1.13": "313", "1.13.2": "313" }, "minecraft:magenta_stained_glass_pane": { "1.13": "329", "1.13.2": "329" }, "minecraft:magenta_terracotta": { "1.13": "265", "1.13.2": "265" }, "minecraft:magenta_wool": { "1.13": "84", "1.13.2": "84" }, "minecraft:magma_block": { "1.13": "356", "1.13.2": "356" }, "minecraft:magma_cream": { "legacy": "378", "1.13": "629", "1.13.2": "634" }, "minecraft:magma_cube_spawn_egg": { "1.13": "653", "1.13.2": "658" }, "minecraft:map": { "legacy": "395", "1.13": "696", "1.13.2": "701" }, "minecraft:melon": { "legacy": "360", "1.13": "208", "1.13.2": "208" }, "minecraft:melon_seeds": { "legacy": "362", "1.13": "613", "1.13.2": "618" }, "minecraft:melon_slice": { "1.13": "610", "1.13.2": "615" }, "minecraft:milk_bucket": { "legacy": "335", "1.13": "546", "1.13.2": "551" }, "minecraft:minecart": { "legacy": "328", "1.13": "540", "1.13.2": "545" }, "minecraft:mooshroom_spawn_egg": { "1.13": "654", "1.13.2": "659" }, "minecraft:mossy_cobblestone": { "legacy": "48", "1.13": "138", "1.13.2": "138" }, "minecraft:mossy_cobblestone_wall": { "1.13": "240", "1.13.2": "240" }, "minecraft:mossy_stone_bricks": { "1.13": "200", "1.13.2": "200" }, "minecraft:mule_spawn_egg": { "1.13": "655", "1.13.2": "660" }, "minecraft:mushroom_stem": { "1.13": "205", "1.13.2": "205" }, "minecraft:mushroom_stew": { "legacy": "282", "1.13": "494", "1.13.2": "499" }, "minecraft:music_disc_11": { "legacy": "2266", "1.13": "779", "1.13.2": "784" }, "minecraft:music_disc_13": { "legacy": "2256", "1.13": "769", "1.13.2": "774" }, "minecraft:music_disc_blocks": { "legacy": "2258", "1.13": "771", "1.13.2": "776" }, "minecraft:music_disc_cat": { "legacy": "2257", "1.13": "770", "1.13.2": "775" }, "minecraft:music_disc_chirp": { "legacy": "2259", "1.13": "772", "1.13.2": "777" }, "minecraft:music_disc_far": { "legacy": "2260", "1.13": "773", "1.13.2": "778" }, "minecraft:music_disc_mall": { "legacy": "2261", "1.13": "774", "1.13.2": "779" }, "minecraft:music_disc_mellohi": { "legacy": "2262", "1.13": "775", "1.13.2": "780" }, "minecraft:music_disc_stal": { "legacy": "2263", "1.13": "776", "1.13.2": "781" }, "minecraft:music_disc_strad": { "legacy": "2264", "1.13": "777", "1.13.2": "782" }, "minecraft:music_disc_wait": { "legacy": "2267", "1.13": "780", "1.13.2": "785" }, "minecraft:music_disc_ward": { "legacy": "2265", "1.13": "778", "1.13.2": "783" }, "minecraft:mutton": { "legacy": "423", "1.13": "728", "1.13.2": "733" }, "minecraft:mycelium": { "legacy": "110", "1.13": "218", "1.13.2": "218" }, "minecraft:name_tag": { "legacy": "421", "1.13": "726", "1.13.2": "731" }, "minecraft:nautilus_shell": { "1.13": "783", "1.13.2": "788" }, "minecraft:nether_brick": { "legacy": "112", "1.13": "710", "1.13.2": "715" }, "minecraft:nether_brick_fence": { "legacy": "113", "1.13": "221", "1.13.2": "221" }, "minecraft:nether_brick_slab": { "1.13": "124", "1.13.2": "124" }, "minecraft:nether_brick_stairs": { "legacy": "114", "1.13": "222", "1.13.2": "222" }, "minecraft:nether_bricks": { "legacy": "405", "1.13": "220", "1.13.2": "220" }, "minecraft:nether_quartz_ore": { "legacy": "153", "1.13": "255", "1.13.2": "255" }, "minecraft:nether_star": { "legacy": "399", "1.13": "705", "1.13.2": "710" }, "minecraft:nether_wart": { "legacy": "372", "1.13": "623", "1.13.2": "628" }, "minecraft:nether_wart_block": { "1.13": "357", "1.13.2": "357" }, "minecraft:netherrack": { "legacy": "87", "1.13": "183", "1.13.2": "183" }, "minecraft:note_block": { "legacy": "25", "1.13": "71", "1.13.2": "71" }, "minecraft:oak_boat": { "legacy": "333", "1.13": "544", "1.13.2": "549" }, "minecraft:oak_button": { "legacy": "143", "1.13": "241", "1.13.2": "241" }, "minecraft:oak_door": { "legacy": "324", "1.13": "456", "1.13.2": "461" }, "minecraft:oak_fence": { "legacy": "85", "1.13": "175", "1.13.2": "175" }, "minecraft:oak_fence_gate": { "legacy": "107", "1.13": "210", "1.13.2": "210" }, "minecraft:oak_leaves": { "legacy": "18", "1.13": "56", "1.13.2": "56" }, "minecraft:oak_log": { "legacy": "17", "1.13": "32", "1.13.2": "32" }, "minecraft:oak_planks": { "legacy": "5", "1.13": "13", "1.13.2": "13" }, "minecraft:oak_pressure_plate": { "legacy": "72", "1.13": "160", "1.13.2": "160" }, "minecraft:oak_sapling": { "legacy": "6", "1.13": "19", "1.13.2": "19" }, "minecraft:oak_sign": { "1.13.2": "541" }, "minecraft:oak_slab": { "legacy": "126", "1.13": "112", "1.13.2": "112" }, "minecraft:oak_stairs": { "legacy": "53", "1.13": "148", "1.13.2": "148" }, "minecraft:oak_trapdoor": { "legacy": "96", "1.13": "187", "1.13.2": "187" }, "minecraft:oak_wood": { "1.13": "50", "1.13.2": "50" }, "minecraft:observer": { "1.13": "361", "1.13.2": "361" }, "minecraft:obsidian": { "legacy": "49", "1.13": "139", "1.13.2": "139" }, "minecraft:ocelot_spawn_egg": { "1.13": "656", "1.13.2": "661" }, "minecraft:orange_banner": { "1.13": "731", "1.13.2": "736" }, "minecraft:orange_bed": { "1.13": "592", "1.13.2": "597" }, "minecraft:orange_carpet": { "1.13": "283", "1.13.2": "283" }, "minecraft:orange_concrete": { "1.13": "396", "1.13.2": "396" }, "minecraft:orange_concrete_powder": { "1.13": "412", "1.13.2": "412" }, "minecraft:orange_dye": { "1.13": "586", "1.13.2": "591" }, "minecraft:orange_glazed_terracotta": { "1.13": "380", "1.13.2": "380" }, "minecraft:orange_shulker_box": { "1.13": "364", "1.13.2": "364" }, "minecraft:orange_stained_glass": { "1.13": "312", "1.13.2": "312" }, "minecraft:orange_stained_glass_pane": { "1.13": "328", "1.13.2": "328" }, "minecraft:orange_terracotta": { "1.13": "264", "1.13.2": "264" }, "minecraft:orange_tulip": { "1.13": "104", "1.13.2": "104" }, "minecraft:orange_wool": { "1.13": "83", "1.13.2": "83" }, "minecraft:oxeye_daisy": { "1.13": "107", "1.13.2": "107" }, "minecraft:packed_ice": { "legacy": "174", "1.13": "300", "1.13.2": "300" }, "minecraft:painting": { "legacy": "321", "1.13": "533", "1.13.2": "538" }, "minecraft:paper": { "legacy": "339", "1.13": "556", "1.13.2": "561" }, "minecraft:parrot_spawn_egg": { "1.13": "657", "1.13.2": "662" }, "minecraft:peony": { "1.13": "308", "1.13.2": "308" }, "minecraft:petrified_oak_slab": { "1.13": "120", "1.13.2": "120" }, "minecraft:phantom_membrane": { "1.13": "782", "1.13.2": "787" }, "minecraft:phantom_spawn_egg": { "1.13": "658", "1.13.2": "663" }, "minecraft:pig_spawn_egg": { "1.13": "659", "1.13.2": "664" }, "minecraft:pink_banner": { "1.13": "736", "1.13.2": "741" }, "minecraft:pink_bed": { "1.13": "597", "1.13.2": "602" }, "minecraft:pink_carpet": { "1.13": "288", "1.13.2": "288" }, "minecraft:pink_concrete": { "1.13": "401", "1.13.2": "401" }, "minecraft:pink_concrete_powder": { "1.13": "417", "1.13.2": "417" }, "minecraft:pink_dye": { "1.13": "581", "1.13.2": "586" }, "minecraft:pink_glazed_terracotta": { "1.13": "385", "1.13.2": "385" }, "minecraft:pink_shulker_box": { "1.13": "369", "1.13.2": "369" }, "minecraft:pink_stained_glass": { "1.13": "317", "1.13.2": "317" }, "minecraft:pink_stained_glass_pane": { "1.13": "333", "1.13.2": "333" }, "minecraft:pink_terracotta": { "1.13": "269", "1.13.2": "269" }, "minecraft:pink_tulip": { "1.13": "106", "1.13.2": "106" }, "minecraft:pink_wool": { "1.13": "88", "1.13.2": "88" }, "minecraft:piston": { "legacy": "33", "1.13": "81", "1.13.2": "81" }, "minecraft:player_head": { "1.13": "700", "1.13.2": "705" }, "minecraft:podzol": { "1.13": "11", "1.13.2": "11" }, "minecraft:poisonous_potato": { "legacy": "394", "1.13": "695", "1.13.2": "700" }, "minecraft:polar_bear_spawn_egg": { "1.13": "660", "1.13.2": "665" }, "minecraft:polished_andesite": { "1.13": "7", "1.13.2": "7" }, "minecraft:polished_diorite": { "1.13": "5", "1.13.2": "5" }, "minecraft:polished_granite": { "1.13": "3", "1.13.2": "3" }, "minecraft:popped_chorus_fruit": { "1.13": "748", "1.13.2": "753" }, "minecraft:poppy": { "legacy": "38", "1.13": "99", "1.13.2": "99" }, "minecraft:porkchop": { "legacy": "319", "1.13": "531", "1.13.2": "536" }, "minecraft:potato": { "legacy": "392", "1.13": "693", "1.13.2": "698" }, "minecraft:potion": { "legacy": "373", "1.13": "624", "1.13.2": "629" }, "minecraft:powered_rail": { "legacy": "27", "1.13": "72", "1.13.2": "72" }, "minecraft:prismarine": { "legacy": "168", "1.13": "343", "1.13.2": "343" }, "minecraft:prismarine_brick_slab": { "1.13": "129", "1.13.2": "129" }, "minecraft:prismarine_brick_stairs": { "1.13": "347", "1.13.2": "347" }, "minecraft:prismarine_bricks": { "1.13": "344", "1.13.2": "344" }, "minecraft:prismarine_crystals": { "legacy": "410", "1.13": "715", "1.13.2": "720" }, "minecraft:prismarine_shard": { "legacy": "409", "1.13": "714", "1.13.2": "719" }, "minecraft:prismarine_slab": { "1.13": "128", "1.13.2": "128" }, "minecraft:prismarine_stairs": { "1.13": "346", "1.13.2": "346" }, "minecraft:pufferfish": { "1.13": "569", "1.13.2": "574" }, "minecraft:pufferfish_bucket": { "1.13": "547", "1.13.2": "552" }, "minecraft:pufferfish_spawn_egg": { "1.13": "661", "1.13.2": "666" }, "minecraft:pumpkin": { "legacy": "86", "1.13": "181", "1.13.2": "181" }, "minecraft:pumpkin_pie": { "legacy": "400", "1.13": "706", "1.13.2": "711" }, "minecraft:pumpkin_seeds": { "legacy": "361", "1.13": "612", "1.13.2": "617" }, "minecraft:purple_banner": { "1.13": "740", "1.13.2": "745" }, "minecraft:purple_bed": { "1.13": "601", "1.13.2": "606" }, "minecraft:purple_carpet": { "1.13": "292", "1.13.2": "292" }, "minecraft:purple_concrete": { "1.13": "405", "1.13.2": "405" }, "minecraft:purple_concrete_powder": { "1.13": "421", "1.13.2": "421" }, "minecraft:purple_dye": { "1.13": "577", "1.13.2": "582" }, "minecraft:purple_glazed_terracotta": { "1.13": "389", "1.13.2": "389" }, "minecraft:purple_shulker_box": { "1.13": "373", "1.13.2": "373" }, "minecraft:purple_stained_glass": { "1.13": "321", "1.13.2": "321" }, "minecraft:purple_stained_glass_pane": { "1.13": "337", "1.13.2": "337" }, "minecraft:purple_terracotta": { "1.13": "273", "1.13.2": "273" }, "minecraft:purple_wool": { "1.13": "92", "1.13.2": "92" }, "minecraft:purpur_block": { "1.13": "144", "1.13.2": "144" }, "minecraft:purpur_pillar": { "1.13": "145", "1.13.2": "145" }, "minecraft:purpur_slab": { "1.13": "127", "1.13.2": "127" }, "minecraft:purpur_stairs": { "1.13": "146", "1.13.2": "146" }, "minecraft:quartz": { "legacy": "406", "1.13": "711", "1.13.2": "716" }, "minecraft:quartz_block": { "legacy": "155", "1.13": "258", "1.13.2": "258" }, "minecraft:quartz_pillar": { "1.13": "259", "1.13.2": "259" }, "minecraft:quartz_slab": { "1.13": "125", "1.13.2": "125" }, "minecraft:quartz_stairs": { "legacy": "156", "1.13": "260", "1.13.2": "260" }, "minecraft:rabbit": { "legacy": "411", "1.13": "716", "1.13.2": "721" }, "minecraft:rabbit_foot": { "legacy": "414", "1.13": "719", "1.13.2": "724" }, "minecraft:rabbit_hide": { "legacy": "415", "1.13": "720", "1.13.2": "725" }, "minecraft:rabbit_spawn_egg": { "1.13": "662", "1.13.2": "667" }, "minecraft:rabbit_stew": { "legacy": "413", "1.13": "718", "1.13.2": "723" }, "minecraft:rail": { "legacy": "66", "1.13": "156", "1.13.2": "156" }, "minecraft:red_banner": { "1.13": "744", "1.13.2": "749" }, "minecraft:red_bed": { "1.13": "605", "1.13.2": "610" }, "minecraft:red_carpet": { "1.13": "296", "1.13.2": "296" }, "minecraft:red_concrete": { "1.13": "409", "1.13.2": "409" }, "minecraft:red_concrete_powder": { "1.13": "425", "1.13.2": "425" }, "minecraft:red_dye": { "1.13.2": "578" }, "minecraft:red_glazed_terracotta": { "1.13": "393", "1.13.2": "393" }, "minecraft:red_mushroom": { "legacy": "40", "1.13": "109", "1.13.2": "109" }, "minecraft:red_mushroom_block": { "legacy": "100", "1.13": "204", "1.13.2": "204" }, "minecraft:red_nether_bricks": { "1.13": "358", "1.13.2": "358" }, "minecraft:red_sand": { "1.13": "27", "1.13.2": "27" }, "minecraft:red_sandstone": { "legacy": "179", "1.13": "350", "1.13.2": "350" }, "minecraft:red_sandstone_slab": { "1.13": "126", "1.13.2": "126" }, "minecraft:red_sandstone_stairs": { "legacy": "180", "1.13": "353", "1.13.2": "353" }, "minecraft:red_shulker_box": { "1.13": "377", "1.13.2": "377" }, "minecraft:red_stained_glass": { "1.13": "325", "1.13.2": "325" }, "minecraft:red_stained_glass_pane": { "1.13": "341", "1.13.2": "341" }, "minecraft:red_terracotta": { "1.13": "277", "1.13.2": "277" }, "minecraft:red_tulip": { "1.13": "103", "1.13.2": "103" }, "minecraft:red_wool": { "1.13": "96", "1.13.2": "96" }, "minecraft:redstone": { "legacy": "331", "1.13": "542", "1.13.2": "547" }, "minecraft:redstone_block": { "legacy": "152", "1.13": "254", "1.13.2": "254" }, "minecraft:redstone_lamp": { "legacy": "123", "1.13": "228", "1.13.2": "228" }, "minecraft:redstone_ore": { "legacy": "73", "1.13": "166", "1.13.2": "166" }, "minecraft:redstone_torch": { "legacy": "76", "1.13": "167", "1.13.2": "167" }, "minecraft:repeater": { "legacy": "356", "1.13": "462", "1.13.2": "467" }, "minecraft:repeating_command_block": { "1.13": "354", "1.13.2": "354" }, "minecraft:rose_bush": { "1.13": "307", "1.13.2": "307" }, "minecraft:rotten_flesh": { "legacy": "367", "1.13": "618", "1.13.2": "623" }, "minecraft:saddle": { "legacy": "329", "1.13": "541", "1.13.2": "546" }, "minecraft:salmon": { "1.13": "567", "1.13.2": "572" }, "minecraft:salmon_bucket": { "1.13": "548", "1.13.2": "553" }, "minecraft:salmon_spawn_egg": { "1.13": "663", "1.13.2": "668" }, "minecraft:sand": { "legacy": "12", "1.13": "26", "1.13.2": "26" }, "minecraft:sandstone": { "legacy": "24", "1.13": "68", "1.13.2": "68" }, "minecraft:sandstone_slab": { "1.13": "119", "1.13.2": "119" }, "minecraft:sandstone_stairs": { "legacy": "128", "1.13": "229", "1.13.2": "229" }, "minecraft:turtle_scute": { "1.13": "466", "1.13.2": "471" }, "minecraft:sea_lantern": { "legacy": "169", "1.13": "349", "1.13.2": "349" }, "minecraft:sea_pickle": { "1.13": "80", "1.13.2": "80" }, "minecraft:seagrass": { "1.13": "79", "1.13.2": "79" }, "minecraft:shears": { "legacy": "359", "1.13": "609", "1.13.2": "614" }, "minecraft:sheep_spawn_egg": { "1.13": "664", "1.13.2": "669" }, "minecraft:shield": { "1.13": "757", "1.13.2": "762" }, "minecraft:shulker_box": { "1.13": "362", "1.13.2": "362" }, "minecraft:shulker_shell": { "1.13": "765", "1.13.2": "770" }, "minecraft:shulker_spawn_egg": { "1.13": "665", "1.13.2": "670" }, "minecraft:silverfish_spawn_egg": { "1.13": "666", "1.13.2": "671" }, "minecraft:skeleton_horse_spawn_egg": { "1.13": "668", "1.13.2": "673" }, "minecraft:skeleton_skull": { "legacy": "397", "1.13": "698", "1.13.2": "703" }, "minecraft:skeleton_spawn_egg": { "1.13": "667", "1.13.2": "672" }, "minecraft:slime_ball": { "legacy": "341", "1.13": "558", "1.13.2": "563" }, "minecraft:slime_block": { "legacy": "165", "1.13": "303", "1.13.2": "303" }, "minecraft:slime_spawn_egg": { "1.13": "669", "1.13.2": "674" }, "minecraft:smooth_quartz": { "1.13": "131", "1.13.2": "131" }, "minecraft:smooth_red_sandstone": { "1.13": "132", "1.13.2": "132" }, "minecraft:smooth_sandstone": { "1.13": "133", "1.13.2": "133" }, "minecraft:smooth_stone": { "1.13": "134", "1.13.2": "134" }, "minecraft:smooth_stone_slab": { "1.13.2": "118" }, "minecraft:snow": { "legacy": "80", "1.13": "169", "1.13.2": "169" }, "minecraft:snow_block": { "legacy": "78", "1.13": "171", "1.13.2": "171" }, "minecraft:snowball": { "legacy": "332", "1.13": "543", "1.13.2": "548" }, "minecraft:soul_sand": { "legacy": "88", "1.13": "184", "1.13.2": "184" }, "minecraft:spawner": { "legacy": "52", "1.13": "147", "1.13.2": "147" }, "minecraft:spectral_arrow": { "1.13": "754", "1.13.2": "759" }, "minecraft:spider_eye": { "legacy": "375", "1.13": "626", "1.13.2": "631" }, "minecraft:spider_spawn_egg": { "1.13": "670", "1.13.2": "675" }, "minecraft:splash_potion": { "1.13": "753", "1.13.2": "758" }, "minecraft:sponge": { "legacy": "19", "1.13": "62", "1.13.2": "62" }, "minecraft:spruce_boat": { "1.13": "759", "1.13.2": "764" }, "minecraft:spruce_button": { "1.13": "242", "1.13.2": "242" }, "minecraft:spruce_door": { "legacy": "427", "1.13": "457", "1.13.2": "462" }, "minecraft:spruce_fence": { "legacy": "188", "1.13": "176", "1.13.2": "176" }, "minecraft:spruce_fence_gate": { "legacy": "183", "1.13": "211", "1.13.2": "211" }, "minecraft:spruce_leaves": { "1.13": "57", "1.13.2": "57" }, "minecraft:spruce_log": { "1.13": "33", "1.13.2": "33" }, "minecraft:spruce_planks": { "1.13": "14", "1.13.2": "14" }, "minecraft:spruce_pressure_plate": { "1.13": "161", "1.13.2": "161" }, "minecraft:spruce_sapling": { "1.13": "20", "1.13.2": "20" }, "minecraft:spruce_slab": { "1.13": "113", "1.13.2": "113" }, "minecraft:spruce_stairs": { "legacy": "134", "1.13": "234", "1.13.2": "234" }, "minecraft:spruce_trapdoor": { "1.13": "188", "1.13.2": "188" }, "minecraft:spruce_wood": { "1.13": "51", "1.13.2": "51" }, "minecraft:squid_spawn_egg": { "1.13": "671", "1.13.2": "676" }, "minecraft:stick": { "legacy": "280", "1.13": "492", "1.13.2": "497" }, "minecraft:sticky_piston": { "legacy": "29", "1.13": "74", "1.13.2": "74" }, "minecraft:stone": { "legacy": "1", "1.13": "1", "1.13.2": "1" }, "minecraft:stone_axe": { "legacy": "275", "1.13": "487", "1.13.2": "492" }, "minecraft:stone_brick_slab": { "1.13": "123", "1.13.2": "123" }, "minecraft:stone_brick_stairs": { "legacy": "109", "1.13": "217", "1.13.2": "217" }, "minecraft:stone_bricks": { "legacy": "98", "1.13": "199", "1.13.2": "199" }, "minecraft:stone_button": { "legacy": "77", "1.13": "168", "1.13.2": "168" }, "minecraft:stone_hoe": { "legacy": "291", "1.13": "503", "1.13.2": "508" }, "minecraft:stone_pickaxe": { "legacy": "274", "1.13": "486", "1.13.2": "491" }, "minecraft:stone_pressure_plate": { "legacy": "70", "1.13": "159", "1.13.2": "159" }, "minecraft:stone_shovel": { "legacy": "273", "1.13": "485", "1.13.2": "490" }, "minecraft:stone_slab": { "legacy": "182", "1.13": "118" }, "minecraft:stone_sword": { "legacy": "272", "1.13": "484", "1.13.2": "489" }, "minecraft:stray_spawn_egg": { "1.13": "672", "1.13.2": "677" }, "minecraft:string": { "legacy": "287", "1.13": "499", "1.13.2": "504" }, "minecraft:stripped_acacia_log": { "1.13": "42", "1.13.2": "42" }, "minecraft:stripped_acacia_wood": { "1.13": "48", "1.13.2": "48" }, "minecraft:stripped_birch_log": { "1.13": "40", "1.13.2": "40" }, "minecraft:stripped_birch_wood": { "1.13": "46", "1.13.2": "46" }, "minecraft:stripped_dark_oak_log": { "1.13": "43", "1.13.2": "43" }, "minecraft:stripped_dark_oak_wood": { "1.13": "49", "1.13.2": "49" }, "minecraft:stripped_jungle_log": { "1.13": "41", "1.13.2": "41" }, "minecraft:stripped_jungle_wood": { "1.13": "47", "1.13.2": "47" }, "minecraft:stripped_oak_log": { "1.13": "38", "1.13.2": "38" }, "minecraft:stripped_oak_wood": { "1.13": "44", "1.13.2": "44" }, "minecraft:stripped_spruce_log": { "1.13": "39", "1.13.2": "39" }, "minecraft:stripped_spruce_wood": { "1.13": "45", "1.13.2": "45" }, "minecraft:structure_block": { "1.13": "464", "1.13.2": "469" }, "minecraft:structure_void": { "1.13": "360", "1.13.2": "360" }, "minecraft:sugar": { "legacy": "353", "1.13": "589", "1.13.2": "594" }, "minecraft:sugar_cane": { "legacy": "338", "1.13": "553", "1.13.2": "558" }, "minecraft:sunflower": { "legacy": "175", "1.13": "305", "1.13.2": "305" }, "minecraft:tall_grass": { "legacy": "31", "1.13": "309", "1.13.2": "309" }, "minecraft:terracotta": { "1.13": "298", "1.13.2": "298" }, "minecraft:tipped_arrow": { "1.13": "755", "1.13.2": "760" }, "minecraft:tnt": { "legacy": "46", "1.13": "136", "1.13.2": "136" }, "minecraft:tnt_minecart": { "legacy": "407", "1.13": "712", "1.13.2": "717" }, "minecraft:torch": { "legacy": "50", "1.13": "140", "1.13.2": "140" }, "minecraft:totem_of_undying": { "1.13": "764", "1.13.2": "769" }, "minecraft:trapped_chest": { "legacy": "146", "1.13": "250", "1.13.2": "250" }, "minecraft:trident": { "1.13": "781", "1.13.2": "786" }, "minecraft:tripwire_hook": { "legacy": "131", "1.13": "232", "1.13.2": "232" }, "minecraft:tropical_fish": { "legacy": "349", "1.13": "568", "1.13.2": "573" }, "minecraft:tropical_fish_bucket": { "1.13": "550", "1.13.2": "555" }, "minecraft:tropical_fish_spawn_egg": { "1.13": "673", "1.13.2": "678" }, "minecraft:tube_coral": { "1.13": "438", "1.13.2": "438" }, "minecraft:tube_coral_block": { "1.13": "433", "1.13.2": "433" }, "minecraft:tube_coral_fan": { "1.13": "443", "1.13.2": "448" }, "minecraft:turtle_egg": { "1.13": "427", "1.13.2": "427" }, "minecraft:turtle_helmet": { "1.13": "465", "1.13.2": "470" }, "minecraft:turtle_spawn_egg": { "1.13": "674", "1.13.2": "679" }, "minecraft:vex_spawn_egg": { "1.13": "675", "1.13.2": "680" }, "minecraft:villager_spawn_egg": { "1.13": "676", "1.13.2": "681" }, "minecraft:vindicator_spawn_egg": { "1.13": "677", "1.13.2": "682" }, "minecraft:vine": { "legacy": "106", "1.13": "209", "1.13.2": "209" }, "minecraft:water_bucket": { "legacy": "326", "1.13": "538", "1.13.2": "543" }, "minecraft:wet_sponge": { "1.13": "63", "1.13.2": "63" }, "minecraft:wheat": { "legacy": "296", "1.13": "508", "1.13.2": "513" }, "minecraft:wheat_seeds": { "legacy": "295", "1.13": "507", "1.13.2": "512" }, "minecraft:white_banner": { "legacy": "425", "1.13": "730", "1.13.2": "735" }, "minecraft:white_bed": { "legacy": "355", "1.13": "591", "1.13.2": "596" }, "minecraft:white_carpet": { "legacy": "171", "1.13": "282", "1.13.2": "282" }, "minecraft:white_concrete": { "legacy": "159", "1.13": "395", "1.13.2": "395" }, "minecraft:white_concrete_powder": { "1.13": "411", "1.13.2": "411" }, "minecraft:white_glazed_terracotta": { "1.13": "379", "1.13.2": "379" }, "minecraft:white_shulker_box": { "1.13": "363", "1.13.2": "363" }, "minecraft:white_stained_glass": { "legacy": "95", "1.13": "311", "1.13.2": "311" }, "minecraft:white_stained_glass_pane": { "legacy": "160", "1.13": "327", "1.13.2": "327" }, "minecraft:white_terracotta": { "1.13": "263", "1.13.2": "263" }, "minecraft:white_tulip": { "1.13": "105", "1.13.2": "105" }, "minecraft:white_wool": { "legacy": "35", "1.13": "82", "1.13.2": "82" }, "minecraft:witch_spawn_egg": { "1.13": "678", "1.13.2": "683" }, "minecraft:wither_skeleton_skull": { "1.13": "699", "1.13.2": "704" }, "minecraft:wither_skeleton_spawn_egg": { "1.13": "679", "1.13.2": "684" }, "minecraft:wolf_spawn_egg": { "legacy": "383", "1.13": "680", "1.13.2": "685" }, "minecraft:wooden_axe": { "legacy": "271", "1.13": "483", "1.13.2": "488" }, "minecraft:wooden_hoe": { "legacy": "290", "1.13": "502", "1.13.2": "507" }, "minecraft:wooden_pickaxe": { "legacy": "270", "1.13": "482", "1.13.2": "487" }, "minecraft:wooden_shovel": { "legacy": "269", "1.13": "481", "1.13.2": "486" }, "minecraft:wooden_sword": { "legacy": "268", "1.13": "480", "1.13.2": "485" }, "minecraft:writable_book": { "legacy": "386", "1.13": "687", "1.13.2": "692" }, "minecraft:written_book": { "legacy": "387", "1.13": "688", "1.13.2": "693" }, "minecraft:yellow_banner": { "1.13": "734", "1.13.2": "739" }, "minecraft:yellow_bed": { "1.13": "595", "1.13.2": "600" }, "minecraft:yellow_carpet": { "1.13": "286", "1.13.2": "286" }, "minecraft:yellow_concrete": { "1.13": "399", "1.13.2": "399" }, "minecraft:yellow_concrete_powder": { "1.13": "415", "1.13.2": "415" }, "minecraft:yellow_dye": { "1.13.2": "588" }, "minecraft:yellow_glazed_terracotta": { "1.13": "383", "1.13.2": "383" }, "minecraft:yellow_shulker_box": { "1.13": "367", "1.13.2": "367" }, "minecraft:yellow_stained_glass": { "1.13": "315", "1.13.2": "315" }, "minecraft:yellow_stained_glass_pane": { "1.13": "331", "1.13.2": "331" }, "minecraft:yellow_terracotta": { "1.13": "267", "1.13.2": "267" }, "minecraft:yellow_wool": { "1.13": "86", "1.13.2": "86" }, "minecraft:zombie_head": { "1.13": "701", "1.13.2": "706" }, "minecraft:zombie_horse_spawn_egg": { "1.13": "682", "1.13.2": "687" }, "minecraft:zombie_spawn_egg": { "1.13": "681", "1.13.2": "686" }, "minecraft:zombie_villager_spawn_egg": { "1.13": "684", "1.13.2": "689" } } ================================================ FILE: plugin/mapping/legacyblockmapping.json ================================================ [File too large to display: 24.2 MB] ================================================ FILE: plugin/mapping/legacyblocks.json ================================================ { "0": "minecraft:air", "1": "minecraft:stone", "2": "minecraft:grass_block", "3": "minecraft:dirt", "4": "minecraft:cobblestone", "5": "minecraft:oak_planks", "6": "minecraft:oak_sapling", "7": "minecraft:bedrock", "8": "minecraft:water", "9": "minecraft:water", "10": "minecraft:lava", "11": "minecraft:lava", "12": "minecraft:sand", "13": "minecraft:gravel", "14": "minecraft:gold_ore", "15": "minecraft:iron_ore", "16": "minecraft:coal_ore", "17": "minecraft:oak_log", "18": "minecraft:oak_leaves", "19": "minecraft:sponge", "20": "minecraft:glass", "21": "minecraft:lapis_ore", "22": "minecraft:lapis_block", "23": "minecraft:dispenser", "24": "minecraft:sandstone", "25": "minecraft:note_block", "26": "minecraft:red_bed", "27": "minecraft:powered_rail", "28": "minecraft:detector_rail", "29": "minecraft:sticky_piston", "30": "minecraft:cobweb", "31": "minecraft:short_grass", "32": "minecraft:dead_bush", "33": "minecraft:piston", "34": "minecraft:piston_head", "35": "minecraft:white_wool", "37": "minecraft:dandelion", "38": "minecraft:poppy", "39": "minecraft:brown_mushroom", "40": "minecraft:red_mushroom", "41": "minecraft:gold_block", "42": "minecraft:iron_block", "43": "minecraft:stone_slab[type=double]", "44": "minecraft:stone_slab", "45": "minecraft:bricks", "46": "minecraft:tnt", "47": "minecraft:bookshelf", "48": "minecraft:mossy_cobblestone", "49": "minecraft:obsidian", "50": "minecraft:torch", "51": "minecraft:fire", "52": "minecraft:spawner", "53": "minecraft:oak_stairs", "54": "minecraft:chest", "55": "minecraft:redstone_wire", "56": "minecraft:diamond_ore", "57": "minecraft:diamond_block", "58": "minecraft:crafting_table", "59": "minecraft:wheat", "60": "minecraft:farmland", "61": "minecraft:furnace", "62": "minecraft:furnace[lit=true]", "63": "minecraft:oak_sign", "64": "minecraft:oak_door", "65": "minecraft:ladder", "66": "minecraft:rail", "67": "minecraft:cobblestone_stairs", "68": "minecraft:oak_wall_sign", "69": "minecraft:lever", "70": "minecraft:stone_pressure_plate", "71": "minecraft:iron_door", "72": "minecraft:oak_pressure_plate", "73": "minecraft:redstone_ore", "74": "minecraft:redstone_ore[lit=true]", "75": "minecraft:redstone_torch[lit=false]", "76": "minecraft:redstone_torch", "77": "minecraft:stone_button", "78": "minecraft:snow", "79": "minecraft:ice", "80": "minecraft:snow_block", "81": "minecraft:cactus", "82": "minecraft:clay", "83": "minecraft:sugar_cane", "84": "minecraft:jukebox", "85": "minecraft:oak_fence", "86": "minecraft:pumpkin", "87": "minecraft:netherrack", "88": "minecraft:soul_sand", "89": "minecraft:glowstone", "90": "minecraft:nether_portal", "91": "minecraft:jack_o_lantern", "92": "minecraft:cake", "93": "minecraft:repeater", "94": "minecraft:repeater[powered=true]", "95": "minecraft:white_stained_glass", "96": "minecraft:oak_trapdoor", "98": "minecraft:stone_bricks", "99": "minecraft:brown_mushroom_block", "100": "minecraft:red_mushroom_block", "101": "minecraft:iron_bars", "102": "minecraft:glass_pane", "103": "minecraft:melon", "104": "minecraft:pumpkin_stem", "105": "minecraft:melon_stem", "106": "minecraft:vine", "107": "minecraft:oak_fence_gate", "108": "minecraft:brick_stairs", "109": "minecraft:stone_brick_stairs", "110": "minecraft:mycelium", "111": "minecraft:lily_pad", "112": "minecraft:nether_bricks", "113": "minecraft:nether_brick_fence", "114": "minecraft:nether_brick_stairs", "115": "minecraft:nether_wart", "116": "minecraft:enchanting_table", "117": "minecraft:brewing_stand", "118": "minecraft:cauldron", "119": "minecraft:end_portal", "120": "minecraft:end_portal_frame", "121": "minecraft:end_stone", "122": "minecraft:dragon_egg", "123": "minecraft:redstone_lamp", "124": "minecraft:redstone_lamp[lit=true]", "125": "minecraft:oak_slab[type=double]", "126": "minecraft:oak_slab", "127": "minecraft:cocoa", "128": "minecraft:sandstone_stairs", "129": "minecraft:emerald_ore", "130": "minecraft:ender_chest", "131": "minecraft:tripwire_hook", "132": "minecraft:tripwire", "133": "minecraft:emerald_block", "134": "minecraft:spruce_stairs", "135": "minecraft:birch_stairs", "136": "minecraft:jungle_stairs", "137": "minecraft:command_block", "138": "minecraft:beacon", "139": "minecraft:cobblestone_wall", "140": "minecraft:flower_pot", "141": "minecraft:carrots", "142": "minecraft:potatoes", "143": "minecraft:oak_button", "144": "minecraft:skeleton_skull", "145": "minecraft:anvil", "146": "minecraft:trapped_chest", "147": "minecraft:light_weighted_pressure_plate", "148": "minecraft:heavy_weighted_pressure_plate", "149": "minecraft:comparator", "150": "minecraft:comparator[powered=true]", "151": "minecraft:daylight_detector", "152": "minecraft:redstone_block", "153": "minecraft:nether_quartz_ore", "154": "minecraft:hopper", "155": "minecraft:quartz_block", "156": "minecraft:quartz_stairs", "157": "minecraft:activator_rail", "158": "minecraft:dropper", "159": "minecraft:white_terracotta", "160": "minecraft:white_stained_glass_pane", "161": "minecraft:acacia_leaves", "162": "minecraft:acacia_log", "163": "minecraft:acacia_stairs", "164": "minecraft:dark_oak_stairs", "165": "minecraft:slime_block", "166": "minecraft:barrier", "167": "minecraft:iron_trapdoor", "168": "minecraft:prismarine", "169": "minecraft:sea_lantern", "170": "minecraft:hay_block", "171": "minecraft:white_carpet", "172": "minecraft:terracotta", "173": "minecraft:coal_block", "174": "minecraft:packed_ice", "175": "minecraft:sunflower", "176": "minecraft:white_banner", "177": "minecraft:white_wall_banner", "178": "minecraft:daylight_detector[inverted=true]", "179": "minecraft:red_sandstone", "180": "minecraft:red_sandstone_stairs", "181": "minecraft:red_sandstone_slab[type=double]", "182": "minecraft:red_sandstone_slab", "183": "minecraft:spruce_fence_gate", "184": "minecraft:birch_fence_gate", "185": "minecraft:jungle_fence_gate", "186": "minecraft:dark_oak_fence_gate", "187": "minecraft:acacia_fence_gate", "188": "minecraft:spruce_fence", "189": "minecraft:birch_fence", "190": "minecraft:jungle_fence", "191": "minecraft:dark_oak_fence", "192": "minecraft:acacia_fence", "193": "minecraft:spruce_door", "194": "minecraft:birch_door", "195": "minecraft:jungle_door", "196": "minecraft:acacia_door", "197": "minecraft:dark_oak_door", "198": "minecraft:end_rod", "199": "minecraft:chorus_plant", "200": "minecraft:chorus_flower", "201": "minecraft:purpur_block", "202": "minecraft:purpur_pillar", "203": "minecraft:purpur_stairs", "204": "minecraft:purpur_slab[type=double]", "205": "minecraft:purpur_slab", "206": "minecraft:end_stone_bricks", "207": "minecraft:beetroots", "208": "minecraft:dirt_path", "209": "minecraft:end_gateway", "210": "minecraft:repeating_command_block", "211": "minecraft:chain_command_block", "212": "minecraft:frosted_ice", "213": "minecraft:magma_block", "214": "minecraft:nether_wart_block", "215": "minecraft:red_nether_bricks", "216": "minecraft:bone_block", "217": "minecraft:structure_void", "218": "minecraft:observer", "219": "minecraft:white_shulker_box", "220": "minecraft:orange_shulker_box", "221": "minecraft:magenta_shulker_box", "222": "minecraft:light_blue_shulker_box", "223": "minecraft:yellow_shulker_box", "224": "minecraft:lime_shulker_box", "225": "minecraft:pink_shulker_box", "226": "minecraft:gray_shulker_box", "227": "minecraft:light_gray_shulker_box", "228": "minecraft:cyan_shulker_box", "229": "minecraft:purple_shulker_box", "230": "minecraft:blue_shulker_box", "231": "minecraft:brown_shulker_box", "232": "minecraft:green_shulker_box", "233": "minecraft:red_shulker_box", "234": "minecraft:black_shulker_box", "235": "minecraft:white_glazed_terracotta", "236": "minecraft:orange_glazed_terracotta", "237": "minecraft:magenta_glazed_terracotta", "238": "minecraft:light_blue_glazed_terracotta", "239": "minecraft:yellow_glazed_terracotta", "240": "minecraft:lime_glazed_terracotta", "241": "minecraft:pink_glazed_terracotta", "242": "minecraft:gray_glazed_terracotta", "243": "minecraft:light_gray_glazed_terracotta", "244": "minecraft:cyan_glazed_terracotta", "245": "minecraft:purple_glazed_terracotta", "246": "minecraft:blue_glazed_terracotta", "247": "minecraft:brown_glazed_terracotta", "248": "minecraft:green_glazed_terracotta", "249": "minecraft:red_glazed_terracotta", "250": "minecraft:black_glazed_terracotta", "251": "minecraft:white_concrete", "252": "minecraft:white_concrete_powder", "253": "minecraft:air", "254": "minecraft:air", "255": "minecraft:structure_block" } ================================================ FILE: plugin/mapping/tag_types.json ================================================ { "tag_types": { "blocks": "minecraft:block", "entity_types": "minecraft:entity_type", "fluids": "minecraft:fluid", "game_events": "minecraft:game_event", "items": "minecraft:item", "damage_type": "minecraft:damage_type", "banner_pattern": "minecraft:banner_pattern" }, "supported_tag_types": [ "minecraft:block", "minecraft:item", "minecraft:fluid" ] } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/LimboAPI.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi; import com.google.inject.Inject; import com.velocitypowered.api.event.PostOrder; import com.velocitypowered.api.event.Subscribe; import com.velocitypowered.api.event.player.KickedFromServerEvent; import com.velocitypowered.api.event.proxy.ProxyInitializeEvent; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.plugin.Plugin; import com.velocitypowered.api.plugin.annotation.DataDirectory; import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.natives.compression.VelocityCompressor; import com.velocitypowered.natives.util.Natives; import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.event.VelocityEventManager; import com.velocitypowered.proxy.network.Connections; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.netty.MinecraftCompressDecoder; import com.velocitypowered.proxy.protocol.netty.MinecraftCompressorAndLengthEncoder; import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder; import com.velocitypowered.proxy.protocol.netty.MinecraftEncoder; import com.velocitypowered.proxy.protocol.netty.MinecraftVarintLengthEncoder; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelPipeline; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.nio.file.Path; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; import net.elytrium.commons.config.YamlConfig; import net.elytrium.commons.kyori.serialization.Serializer; import net.elytrium.commons.kyori.serialization.Serializers; import net.elytrium.commons.utils.reflection.ReflectionException; import net.elytrium.commons.utils.updates.UpdatesChecker; import net.elytrium.fastprepare.PreparedPacketFactory; import net.elytrium.fastprepare.handler.PreparedPacketEncoder; import net.elytrium.limboapi.api.Limbo; import net.elytrium.limboapi.api.LimboFactory; import net.elytrium.limboapi.api.chunk.BuiltInBiome; import net.elytrium.limboapi.api.chunk.Dimension; import net.elytrium.limboapi.api.chunk.VirtualBiome; import net.elytrium.limboapi.api.chunk.VirtualBlock; import net.elytrium.limboapi.api.chunk.VirtualBlockEntity; import net.elytrium.limboapi.api.chunk.VirtualChunk; import net.elytrium.limboapi.api.chunk.VirtualWorld; import net.elytrium.limboapi.api.file.BuiltInWorldFileType; import net.elytrium.limboapi.api.file.WorldFile; import net.elytrium.limboapi.api.material.Block; import net.elytrium.limboapi.api.material.Item; import net.elytrium.limboapi.api.material.VirtualItem; import net.elytrium.limboapi.api.protocol.PreparedPacket; import net.elytrium.limboapi.api.protocol.item.ItemComponentMap; import net.elytrium.limboapi.api.protocol.packets.PacketFactory; import net.elytrium.limboapi.file.WorldFileTypeRegistry; import net.elytrium.limboapi.injection.disconnect.DisconnectListener; import net.elytrium.limboapi.injection.event.EventManagerHook; import net.elytrium.limboapi.injection.login.LoginListener; import net.elytrium.limboapi.injection.login.LoginTasksQueue; import net.elytrium.limboapi.injection.packet.LegacyPlayerListItemHook; import net.elytrium.limboapi.injection.packet.LimboCompressDecoder; import net.elytrium.limboapi.injection.packet.MinecraftDiscardCompressDecoder; import net.elytrium.limboapi.injection.packet.MinecraftLimitedCompressDecoder; import net.elytrium.limboapi.injection.packet.PreparedPacketImpl; import net.elytrium.limboapi.injection.packet.RemovePlayerInfoHook; import net.elytrium.limboapi.injection.packet.UpsertPlayerInfoHook; import net.elytrium.limboapi.material.Biome; import net.elytrium.limboapi.protocol.LimboProtocol; import net.elytrium.limboapi.protocol.packets.PacketFactoryImpl; import net.elytrium.limboapi.server.CachedPackets; import net.elytrium.limboapi.server.LimboImpl; import net.elytrium.limboapi.server.item.SimpleItemComponentManager; import net.elytrium.limboapi.server.item.SimpleItemComponentMap; import net.elytrium.limboapi.server.world.SimpleBlock; import net.elytrium.limboapi.server.world.SimpleBlockEntity; import net.elytrium.limboapi.server.world.SimpleItem; import net.elytrium.limboapi.server.world.SimpleTagManager; import net.elytrium.limboapi.server.world.SimpleWorld; import net.elytrium.limboapi.server.world.chunk.SimpleChunk; import net.elytrium.limboapi.utils.ReloadListener; import net.kyori.adventure.nbt.CompoundBinaryTag; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.ComponentSerializer; import org.bstats.velocity.Metrics; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.slf4j.Logger; @Plugin( id = "limboapi", name = "LimboAPI", version = BuildConstants.LIMBO_VERSION, description = "Velocity plugin for making virtual servers.", url = "https://elytrium.net/", authors = { "Elytrium (https://elytrium.net/)", } ) public class LimboAPI implements LimboFactory { private static final int SUPPORTED_MAXIMUM_PROTOCOL_VERSION_NUMBER = 775; @MonotonicNonNull private static Logger LOGGER; @MonotonicNonNull private static Serializer SERIALIZER; public static final ConcurrentHashMap INITIAL_ID = new ConcurrentHashMap<>(); private static final MethodHandle STATE_FIELD; private final VelocityServer server; private final Metrics.Factory metricsFactory; private final File configFile; private final Set players; private final CachedPackets packets; private final PacketFactory packetFactory; private final SimpleItemComponentManager itemComponentManager = new SimpleItemComponentManager(); private final HashMap loginQueue; private final HashMap> kickCallback; private final HashMap nextServer; private PreparedPacketFactory preparedPacketFactory; private PreparedPacketFactory configPreparedPacketFactory; private PreparedPacketFactory loginUncompressedPreparedPacketFactory; private PreparedPacketFactory loginPreparedPacketFactory; private ProtocolVersion minVersion; private ProtocolVersion maxVersion; private LoginListener loginListener; private boolean compressionEnabled; private EventManagerHook eventManagerHook; @Inject public LimboAPI(Logger logger, ProxyServer server, Metrics.Factory metricsFactory, @DataDirectory Path dataDirectory) { setLogger(logger); this.server = (VelocityServer) server; this.metricsFactory = metricsFactory; this.configFile = dataDirectory.resolve("config.yml").toFile(); this.players = new HashSet<>(); this.packetFactory = new PacketFactoryImpl(); this.packets = new CachedPackets(this); this.loginQueue = new HashMap<>(); this.kickCallback = new HashMap<>(); this.nextServer = new HashMap<>(); int maximumProtocolVersionNumber = ProtocolVersion.MAXIMUM_VERSION.getProtocol(); if (maximumProtocolVersionNumber < SUPPORTED_MAXIMUM_PROTOCOL_VERSION_NUMBER) { LOGGER.error("Please update Velocity (https://papermc.io/downloads#Velocity). LimboAPI support: https://ely.su/discord"); this.server.shutdown(); return; } else if (maximumProtocolVersionNumber != SUPPORTED_MAXIMUM_PROTOCOL_VERSION_NUMBER) { LOGGER.warn("Current LimboAPI version doesn't support current Velocity version (protocol version numbers: supported - {}, velocity - {})", SUPPORTED_MAXIMUM_PROTOCOL_VERSION_NUMBER, maximumProtocolVersionNumber); LOGGER.warn("Please update LimboAPI (https://github.com/Elytrium/LimboAPI/releases). LimboAPI support: https://ely.su/discord"); } LOGGER.info("Initializing Simple Virtual World system..."); SimpleBlock.init(); SimpleBlockEntity.init(); SimpleItem.init(); SimpleTagManager.init(); LOGGER.info("Hooking into PlayerList/UpsertPlayerInfo and StateRegistry..."); try { LegacyPlayerListItemHook.init(this, LimboProtocol.PLAY_CLIENTBOUND_REGISTRY); UpsertPlayerInfoHook.init(this, LimboProtocol.PLAY_CLIENTBOUND_REGISTRY); RemovePlayerInfoHook.init(this, LimboProtocol.PLAY_CLIENTBOUND_REGISTRY); LimboProtocol.init(); } catch (Throwable e) { throw new ReflectionException(e); } } @Subscribe public void onProxyInitialization(ProxyInitializeEvent event) { Settings.IMP.setLogger(LOGGER); if (Settings.IMP.reload(this.configFile, Settings.IMP.PREFIX) == YamlConfig.LoadResult.CONFIG_NOT_EXISTS) { LOGGER.warn("************* FIRST LAUNCH *************"); LOGGER.warn("Thanks for installing LimboAPI!"); LOGGER.warn("(C) 2021 - 2024 Elytrium"); LOGGER.warn(""); LOGGER.warn("Check out our plugins here: https://ely.su/github <3"); LOGGER.warn("Discord: https://ely.su/discord"); LOGGER.warn("****************************************"); } int level = this.server.getConfiguration().getCompressionLevel(); int threshold = this.server.getConfiguration().getCompressionThreshold(); this.preparedPacketFactory = new PreparedPacketFactory( PreparedPacketImpl::new, LimboProtocol.getLimboStateRegistry(), this.compressionEnabled, level, threshold, Settings.IMP.MAIN.SAVE_UNCOMPRESSED_PACKETS, true, Settings.IMP.MAIN.COMPATIBILITY_MODE ); this.configPreparedPacketFactory = new PreparedPacketFactory( PreparedPacketImpl::new, StateRegistry.CONFIG, this.compressionEnabled, level, threshold, Settings.IMP.MAIN.SAVE_UNCOMPRESSED_PACKETS, true, Settings.IMP.MAIN.COMPATIBILITY_MODE ); this.loginUncompressedPreparedPacketFactory = new PreparedPacketFactory( PreparedPacketImpl::new, StateRegistry.LOGIN, false, level, threshold, false, true, Settings.IMP.MAIN.COMPATIBILITY_MODE ); this.loginPreparedPacketFactory = new PreparedPacketFactory( PreparedPacketImpl::new, StateRegistry.LOGIN, this.compressionEnabled, level, threshold, Settings.IMP.MAIN.SAVE_UNCOMPRESSED_PACKETS, true, Settings.IMP.MAIN.COMPATIBILITY_MODE ); this.reloadPreparedPacketFactory(); this.reload(); this.metricsFactory.make(this, 12530); if (Settings.IMP.MAIN.CHECK_FOR_UPDATES) { if (!UpdatesChecker.checkVersionByURL("https://raw.githubusercontent.com/Elytrium/LimboAPI/master/VERSION", Settings.IMP.VERSION)) { LOGGER.error("****************************************"); LOGGER.warn("The new LimboAPI update was found, please update."); LOGGER.error("https://github.com/Elytrium/LimboAPI/releases/"); LOGGER.error("****************************************"); } } } @Subscribe(order = PostOrder.LAST) public void postProxyInitialization(ProxyInitializeEvent event) throws IllegalAccessException { this.eventManagerHook.reloadHandlers(); } public void reload() { Settings.IMP.reload(this.configFile, Settings.IMP.PREFIX); ComponentSerializer serializer = Settings.IMP.SERIALIZER.getSerializer(); if (serializer == null) { LOGGER.warn("The specified serializer could not be founded, using default. (LEGACY_AMPERSAND)"); setSerializer(new Serializer(Objects.requireNonNull(Serializers.LEGACY_AMPERSAND.getSerializer()))); } else { setSerializer(new Serializer(serializer)); } LOGGER.info("Creating and preparing packets..."); this.reloadVersion(); this.packets.createPackets(); this.loginListener = new LoginListener(this, this.server); this.eventManagerHook = new EventManagerHook(this, this.server.getEventManager()); VelocityEventManager eventManager = this.server.getEventManager(); eventManager.unregisterListeners(this); eventManager.register(this, this.loginListener); eventManager.register(this, this.eventManagerHook); eventManager.register(this, new DisconnectListener(this)); eventManager.register(this, new ReloadListener(this)); LOGGER.info("Loaded!"); } private void reloadVersion() { if (Settings.IMP.MAIN.PREPARE_MAX_VERSION.equals("LATEST")) { this.maxVersion = ProtocolVersion.MAXIMUM_VERSION; } else { this.maxVersion = ProtocolVersion.valueOf("MINECRAFT_" + Settings.IMP.MAIN.PREPARE_MAX_VERSION); } this.minVersion = ProtocolVersion.valueOf("MINECRAFT_" + Settings.IMP.MAIN.PREPARE_MIN_VERSION); if (ProtocolVersion.MAXIMUM_VERSION.compareTo(this.maxVersion) > 0 || ProtocolVersion.MINIMUM_VERSION.compareTo(this.minVersion) < 0) { LOGGER.warn( "Currently working only with " + this.minVersion.getVersionIntroducedIn() + " - " + this.maxVersion.getMostRecentSupportedVersion() + " versions, modify the plugins/limboapi/config.yml file if you want the plugin to work with other versions." ); } } public void reloadPreparedPacketFactory() { int level = this.server.getConfiguration().getCompressionLevel(); int threshold = this.server.getConfiguration().getCompressionThreshold(); this.compressionEnabled = threshold != -1; this.preparedPacketFactory.updateCompressor(this.compressionEnabled, level, threshold, Settings.IMP.MAIN.SAVE_UNCOMPRESSED_PACKETS, Settings.IMP.MAIN.COMPATIBILITY_MODE); this.configPreparedPacketFactory.updateCompressor(this.compressionEnabled, level, threshold, Settings.IMP.MAIN.SAVE_UNCOMPRESSED_PACKETS, Settings.IMP.MAIN.COMPATIBILITY_MODE); this.loginPreparedPacketFactory.updateCompressor(this.compressionEnabled, level, threshold, Settings.IMP.MAIN.SAVE_UNCOMPRESSED_PACKETS, Settings.IMP.MAIN.COMPATIBILITY_MODE); } @Override public VirtualBlock createSimpleBlock(Block block) { return SimpleBlock.fromLegacyID((short) block.getID()); } @Override public VirtualBlock createSimpleBlock(short legacyID) { return SimpleBlock.fromLegacyID(legacyID); } @Override public VirtualBlock createSimpleBlock(String modernID) { return SimpleBlock.fromModernID(modernID); } @Override public VirtualBlock createSimpleBlock(String modernID, Map properties) { return SimpleBlock.fromModernID(modernID, properties); } @Override public VirtualBlock createSimpleBlock(short id, boolean modern) { if (modern) { return SimpleBlock.solid(id); } else { return SimpleBlock.fromLegacyID(id); } } @Override public VirtualBlock createSimpleBlock(boolean solid, boolean air, boolean motionBlocking, short id) { return new SimpleBlock(solid, air, motionBlocking, id); } @Override public VirtualBlock createSimpleBlock(boolean solid, boolean air, boolean motionBlocking, String modernID, Map properties) { return new SimpleBlock(solid, air, motionBlocking, modernID, properties); } @Override public VirtualWorld createVirtualWorld(Dimension dimension, double posX, double posY, double posZ, float yaw, float pitch) { return new SimpleWorld(dimension, posX, posY, posZ, yaw, pitch); } @Override public VirtualChunk createVirtualChunk(int posX, int posZ) { return new SimpleChunk(posX, posZ); } @Override public VirtualChunk createVirtualChunk(int posX, int posZ, VirtualBiome defaultBiome) { return new SimpleChunk(posX, posZ, defaultBiome); } @Override public VirtualChunk createVirtualChunk(int posX, int posZ, BuiltInBiome defaultBiome) { return new SimpleChunk(posX, posZ, Biome.of(defaultBiome)); } @Override public Limbo createLimbo(VirtualWorld world) { return new LimboImpl(this, world); } @Override public void releasePreparedPacketThread(Thread thread) { this.preparedPacketFactory.releaseThread(thread); } @Override public PreparedPacket createPreparedPacket() { return (PreparedPacket) this.preparedPacketFactory.createPreparedPacket(this.minVersion, this.maxVersion); } @Override public PreparedPacket createPreparedPacket(ProtocolVersion minVersion, ProtocolVersion maxVersion) { return (PreparedPacket) this.preparedPacketFactory.createPreparedPacket(minVersion, maxVersion); } @Override public PreparedPacket createConfigPreparedPacket() { return (PreparedPacket) this.configPreparedPacketFactory.createPreparedPacket(this.minVersion, this.maxVersion); } @Override public PreparedPacket createConfigPreparedPacket(ProtocolVersion minVersion, ProtocolVersion maxVersion) { return (PreparedPacket) this.configPreparedPacketFactory.createPreparedPacket(minVersion, maxVersion); } public ByteBuf encodeSingleLogin(MinecraftPacket packet, ProtocolVersion version) { return this.loginPreparedPacketFactory.encodeSingle(packet, version); } public ByteBuf encodeSingleLoginUncompressed(MinecraftPacket packet, ProtocolVersion version) { return this.loginUncompressedPreparedPacketFactory.encodeSingle(packet, version); } public void inject3rdParty(Player player, MinecraftConnection connection, ChannelPipeline pipeline) { StateRegistry state = connection.getState(); if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) < 0 || (state != StateRegistry.CONFIG && state != StateRegistry.LOGIN)) { this.preparedPacketFactory.inject(player, connection, pipeline); } else { this.configPreparedPacketFactory.inject(player, connection, pipeline); } } public void setState(MinecraftConnection connection, StateRegistry stateRegistry) { connection.setState(stateRegistry); this.setEncoderState(connection, stateRegistry); this.fixDecoderState(connection, stateRegistry); } public void setActiveSessionHandler(MinecraftConnection connection, StateRegistry stateRegistry, MinecraftSessionHandler sessionHandler) { connection.setActiveSessionHandler(stateRegistry, sessionHandler); this.setEncoderState(connection, stateRegistry); this.fixDecoderState(connection, stateRegistry); } public void setEncoderState(MinecraftConnection connection, StateRegistry state) { // As CONFIG state was added in 1.20.2, no need to track it for lower versions if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) < 0) { return; } if (Settings.IMP.MAIN.COMPATIBILITY_MODE) { MinecraftEncoder encoder = connection.getChannel().pipeline().get(MinecraftEncoder.class); if (encoder != null) { encoder.setState(state); } } PreparedPacketEncoder encoder = connection.getChannel().pipeline().get(PreparedPacketEncoder.class); if (encoder != null) { if (state != StateRegistry.CONFIG && state != StateRegistry.LOGIN) { encoder.setFactory(this.preparedPacketFactory); } else { encoder.setFactory(this.configPreparedPacketFactory); } } } public void fixDecoderState(MinecraftConnection connection, StateRegistry state) { if (state.name() == null) { // custom state MinecraftDecoder decoder = connection.getChannel().pipeline().get(MinecraftDecoder.class); if (decoder != null) { try { // Let decoder know what we're in PLAY state, or it will kick the player. STATE_FIELD.invokeExact(decoder, StateRegistry.PLAY); } catch (Throwable throwable) { LimboAPI.getLogger().error("Failed to fixup decoder", throwable); } } } } public void deject3rdParty(ChannelPipeline pipeline) { this.preparedPacketFactory.deject(pipeline); } public void fixDecompressor(ChannelPipeline pipeline, int threshold, boolean onLogin) { ChannelHandler decoder; if (onLogin && Settings.IMP.MAIN.DISCARD_COMPRESSION_ON_LOGIN) { decoder = new MinecraftDiscardCompressDecoder(); } else if (!onLogin && Settings.IMP.MAIN.DISCARD_COMPRESSION_AFTER_LOGIN) { decoder = new MinecraftDiscardCompressDecoder(); } else { int level = this.server.getConfiguration().getCompressionLevel(); VelocityCompressor compressor = Natives.compress.get().create(level); decoder = new MinecraftLimitedCompressDecoder(threshold, compressor); } if (Settings.IMP.MAIN.COMPATIBILITY_MODE && pipeline.context(Connections.COMPRESSION_DECODER) != null) { pipeline.replace(Connections.COMPRESSION_DECODER, Connections.COMPRESSION_DECODER, decoder); } else { pipeline.addBefore(Connections.MINECRAFT_DECODER, Connections.COMPRESSION_DECODER, decoder); } } public void fixCompressor(ChannelPipeline pipeline, ProtocolVersion version) { ChannelHandler compressionHandler = pipeline.get(Connections.COMPRESSION_ENCODER); if (compressionHandler == null) { if (!Settings.IMP.MAIN.COMPATIBILITY_MODE) { pipeline.addBefore(Connections.MINECRAFT_DECODER, Connections.FRAME_ENCODER, MinecraftVarintLengthEncoder.INSTANCE); } } else { int level = this.server.getConfiguration().getCompressionLevel(); int compressionThreshold = this.server.getConfiguration().getCompressionThreshold(); VelocityCompressor compressor = Natives.compress.get().create(level); if (!Settings.IMP.MAIN.COMPATIBILITY_MODE) { MinecraftCompressorAndLengthEncoder encoder = new MinecraftCompressorAndLengthEncoder(compressionThreshold, compressor); pipeline.remove(compressionHandler); pipeline.addBefore(Connections.MINECRAFT_ENCODER, Connections.COMPRESSION_ENCODER, encoder); } if (pipeline.get(Connections.COMPRESSION_DECODER) instanceof LimboCompressDecoder) { MinecraftCompressDecoder decoder = new MinecraftCompressDecoder(compressionThreshold, compressor, ProtocolUtils.Direction.SERVERBOUND); pipeline.replace(Connections.COMPRESSION_DECODER, Connections.COMPRESSION_DECODER, decoder); } else if (Settings.IMP.MAIN.COMPATIBILITY_MODE) { compressor.close(); } } } @Override public void passLoginLimbo(Player player) { if (this.loginQueue.containsKey(player)) { this.loginQueue.get(player).next(); } } @Override public VirtualItem getItem(Item item) { return SimpleItem.fromItem(item); } @Override public VirtualItem getItem(String itemID) { return SimpleItem.fromModernID(itemID); } @Override public VirtualItem getLegacyItem(int itemLegacyID) { return SimpleItem.fromLegacyID(itemLegacyID); } @Override public ItemComponentMap createItemComponentMap() { return new SimpleItemComponentMap(this.itemComponentManager); } @Override public VirtualBlockEntity getBlockEntity(String entityID) { return SimpleBlockEntity.fromModernID(entityID); } @Override public PacketFactory getPacketFactory() { return this.packetFactory; } public VelocityServer getServer() { return this.server; } public void setLimboJoined(Player player) { if (!this.isLimboJoined(player)) { ConnectedPlayer connectedPlayer = (ConnectedPlayer) player; connectedPlayer.getPhase().onFirstJoin(connectedPlayer); this.players.add(player); } } public void unsetLimboJoined(Player player) { this.players.remove(player); } public boolean isLimboJoined(Player player) { return this.players.contains(player); } public CachedPackets getPackets() { return this.packets; } public void addLoginQueue(Player player, LoginTasksQueue queue) { this.loginQueue.put(player, queue); } public void removeLoginQueue(Player player) { this.loginQueue.remove(player); } public boolean hasLoginQueue(Player player) { return this.loginQueue.containsKey(player); } public LoginTasksQueue getLoginQueue(Player player) { return this.loginQueue.get(player); } public void setKickCallback(Player player, Function queue) { this.kickCallback.put(player, queue); } public void removeKickCallback(Player player) { this.kickCallback.remove(player); } public Function getKickCallback(Player player) { return this.kickCallback.get(player); } public void setNextServer(Player player, RegisteredServer nextServer) { this.nextServer.put(player, nextServer); } public void removeNextServer(Player player) { this.nextServer.remove(player); } public boolean hasNextServer(Player player) { return this.nextServer.containsKey(player); } public RegisteredServer getNextServer(Player player) { return this.nextServer.get(player); } public void setInitialID(Player player, UUID nextServer) { INITIAL_ID.put(player, nextServer); } public void removeInitialID(Player player) { INITIAL_ID.remove(player); } public UUID getInitialID(Player player) { return INITIAL_ID.get(player); } public LoginListener getLoginListener() { return this.loginListener; } public boolean isCompressionEnabled() { return this.compressionEnabled; } public PreparedPacketFactory getPreparedPacketFactory() { return this.preparedPacketFactory; } public ProtocolVersion getPrepareMinVersion() { return this.minVersion; } public ProtocolVersion getPrepareMaxVersion() { return this.maxVersion; } public EventManagerHook getEventManagerHook() { return this.eventManagerHook; } @Override public WorldFile openWorldFile(BuiltInWorldFileType apiType, Path file) throws IOException { return WorldFileTypeRegistry.fromApiType(apiType, file); } @Override public WorldFile openWorldFile(BuiltInWorldFileType apiType, InputStream stream) throws IOException { return WorldFileTypeRegistry.fromApiType(apiType, stream); } @Override public WorldFile openWorldFile(BuiltInWorldFileType apiType, CompoundBinaryTag tag) { return WorldFileTypeRegistry.fromApiType(apiType, tag); } private static void setLogger(Logger logger) { LOGGER = logger; } public static Logger getLogger() { return LOGGER; } private static void setSerializer(Serializer serializer) { SERIALIZER = serializer; } public static Serializer getSerializer() { return SERIALIZER; } static { try { STATE_FIELD = MethodHandles.privateLookupIn(MinecraftDecoder.class, MethodHandles.lookup()) .findSetter(MinecraftDecoder.class, "state", StateRegistry.class); } catch (NoSuchFieldException | IllegalAccessException e) { throw new RuntimeException(e); } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/Settings.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi; import java.util.List; import net.elytrium.commons.config.YamlConfig; import net.elytrium.commons.kyori.serialization.Serializers; public class Settings extends YamlConfig { @Ignore public static final Settings IMP = new Settings(); @Final public String VERSION = BuildConstants.LIMBO_VERSION; @Comment({ "Available serializers:", "LEGACY_AMPERSAND - \"&c&lExample &c&9Text\".", "LEGACY_SECTION - \"§c§lExample §c§9Text\".", "MINIMESSAGE - \"Example Text\". (https://webui.adventure.kyori.net/)", "GSON - \"[{\"text\":\"Example\",\"bold\":true,\"color\":\"red\"},{\"text\":\" \",\"bold\":true},{\"text\":\"Text\",\"bold\":true,\"color\":\"blue\"}]\". (https://minecraft.tools/en/json_text.php/)", "GSON_COLOR_DOWNSAMPLING - Same as GSON, but uses downsampling." }) public Serializers SERIALIZER = Serializers.LEGACY_AMPERSAND; public String PREFIX = "LimboAPI &6>>&f"; @Create public MAIN MAIN; @Comment("Don't use \\n, use {NL} for new line, and {PRFX} for prefix.") public static class MAIN { public boolean CHECK_FOR_UPDATES = true; public int MAX_CHAT_MESSAGE_LENGTH = 256; public int MAX_BRAND_NAME_LENGTH = 64; public int MAX_UNKNOWN_PACKET_LENGTH = 2048; public int MAX_SINGLE_GENERIC_PACKET_LENGTH = 4096; public int MAX_MULTI_GENERIC_PACKET_LENGTH = 131072; @Comment({ "Default max packet length (in bytes) that will be proceeded, other packets will be dropped.", "Can be increased with Limbo#setMaxSuppressPacketLength" }) public int MAX_PACKET_LENGTH_TO_SUPPRESS_IT = 512; @Comment({ "Discards all packets longer than compression-threshold. Helps to mitigate some attacks.", "Needs compression-threshold to be 300 or higher to support 1.19 chat-signing, so it is disabled by default" }) public boolean DISCARD_COMPRESSION_ON_LOGIN = false; public boolean DISCARD_COMPRESSION_AFTER_LOGIN = false; @Comment({ "LimboAPI will consume more RAM if this option is enabled, but compatibility with other plugins will be better", "Enable it if you have a plugin installed that bypasses compression (e.g. Geyser)" }) public boolean SAVE_UNCOMPRESSED_PACKETS = true; @Comment({ "WARNING: do not change when proxy is running, it will break exsiting connections", "LimboAPI will be running in compatibility mode, allowing other plugins to", "intercept or modify packets sent by it, but will reduce performance in some cases.", "Enable if you are using plugins that modify packets. (e.g. ViaVersion, Raknetify or PacketEvents)", "Require 'save-uncompressed-packets: true' to work properly" }) public boolean COMPATIBILITY_MODE = false; @Comment("Logging for connect and disconnect messages.") public boolean LOGGING_ENABLED = true; @Comment({ "Change the parameters below, if you want to reduce the RAM consumption.", "Use VelocityTools to completely block Minecraft versions (https://github.com/Elytrium/VelocityTools/releases/latest).", "Available versions:", "1_7_2, 1_7_6, 1_8, 1_9, 1_9_1, 1_9_2, 1_9_4, 1_10, 1_11, 1_11_1, 1_12, 1_12_1, 1_12_2,", "1_13, 1_13_1, 1_13_2, 1_14, 1_14_1, 1_14_2, 1_14_3, 1_14_4, 1_15, 1_15_1, 1_15_2,", "1_16, 1_16_1, 1_16_2, 1_16_3, 1_16_4, 1_17, 1_17_1, 1_18, 1_18_2, 1_19, 1_19_1, 1_19_3,", "1_20, 1_20_2, 1_20_3, 1_20_5, 1_21, 1_21_2, 1_21_4, 1_21_5, 1_21_6, 1_21_7, 1_21_9, 1_21_11,", "26_1, LATEST" }) public String PREPARE_MIN_VERSION = "1_7_2"; public String PREPARE_MAX_VERSION = "LATEST"; @Comment("Helpful if you want some plugins proceed before LimboAPI. For example, it is needed to Floodgate to replace UUID.") public List PRE_LIMBO_PROFILE_REQUEST_PLUGINS = List.of("floodgate", "geyser"); @Comment("Should reduced debug info be enabled (reduced information in F3) if there is no preference for Limbo") public boolean REDUCED_DEBUG_INFO = false; @Comment("Used to hide unsigned chat popup") public boolean SEND_ENFORCE_SECURE_CHAT = true; public int VIEW_DISTANCE = 10; public int SIMULATION_DISTANCE = 9; @Comment({ "How many chunks we should send when a player spawns.", " 0 = send no chunks on spawn.", " 1 = send only the spawn chunk.", " 2 = send the spawn chunk and chunks next to the spawn chunk.", " 3 = send the spawn chunk, chunks next to the spawn chunk and next to these chunks.", " and so on.." }) public int CHUNK_RADIUS_SEND_ON_SPAWN = 2; @Comment("How many chunks we should send per tick") public int CHUNKS_PER_TICK = 16; @Comment("Maximum delay for receiving ChatSession packet (for online-mode client-side race condition mitigation)") public int CHAT_SESSION_PACKET_TIMEOUT = 5000; @Comment("Ability to force disable chat signing on 1.19.3+") public boolean FORCE_DISABLE_MODERN_CHAT_SIGNING = true; @Create public MESSAGES MESSAGES; public static class MESSAGES { public String TOO_BIG_PACKET = "{PRFX}{NL}{NL}&cYour client sent too big packet!"; public String INVALID_PING = "{PRFX}{NL}{NL}&cYour client sent invalid ping packet!"; public String INVALID_SWITCH = "{PRFX}{NL}{NL}&cYour client sent an unexpected state switching packet!"; public String TIME_OUT = "{PRFX}{NL}{NL}Timed out."; } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/file/MCEditSchematicFile.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.file; import net.elytrium.limboapi.api.LimboFactory; import net.elytrium.limboapi.api.chunk.VirtualWorld; import net.elytrium.limboapi.api.file.WorldFile; import net.kyori.adventure.nbt.CompoundBinaryTag; public class MCEditSchematicFile implements WorldFile { private final short width; private final short height; private final short length; private final byte[] blocks; private byte[] addBlocks = new byte[0]; public MCEditSchematicFile(CompoundBinaryTag tag) { this.width = tag.getShort("Width"); this.height = tag.getShort("Height"); this.length = tag.getShort("Length"); this.blocks = tag.getByteArray("Blocks"); if (tag.keySet().contains("AddBlocks")) { this.addBlocks = tag.getByteArray("AddBlocks"); } } @Override public void toWorld(LimboFactory factory, VirtualWorld world, int offsetX, int offsetY, int offsetZ, int lightLevel) { short[] blockIDs = new short[this.blocks.length]; for (int index = 0; index < blockIDs.length; ++index) { if ((index >> 1) >= this.addBlocks.length) { blockIDs[index] = (short) (this.blocks[index] & 0xFF); } else { if ((index & 1) == 0) { blockIDs[index] = (short) (((this.addBlocks[index >> 1] & 0x0F) << 8) + (this.addBlocks[index] & 0xFF)); } else { blockIDs[index] = (short) (((this.addBlocks[index >> 1] & 0xF0) << 4) + (this.addBlocks[index] & 0xFF)); } } } for (int posX = 0; posX < this.width; ++posX) { for (int posY = 0; posY < this.height; ++posY) { for (int posZ = 0; posZ < this.length; ++posZ) { int index = (posY * this.length + posZ) * this.width + posX; world.setBlock(posX + offsetX, posY + offsetY, posZ + offsetZ, factory.createSimpleBlock(blockIDs[index])); } } } world.fillSkyLight(lightLevel); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/file/StructureNbtFile.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.file; import java.util.HashMap; import java.util.Map; import net.elytrium.limboapi.api.LimboFactory; import net.elytrium.limboapi.api.chunk.VirtualBlock; import net.elytrium.limboapi.api.chunk.VirtualWorld; import net.elytrium.limboapi.api.file.WorldFile; import net.kyori.adventure.nbt.BinaryTag; import net.kyori.adventure.nbt.CompoundBinaryTag; import net.kyori.adventure.nbt.ListBinaryTag; public class StructureNbtFile implements WorldFile { private final ListBinaryTag blocks; private final ListBinaryTag palette; public StructureNbtFile(CompoundBinaryTag tag) { this.blocks = tag.getList("blocks"); this.palette = tag.getList("palette"); } @Override public void toWorld(LimboFactory factory, VirtualWorld world, int offsetX, int offsetY, int offsetZ, int lightLevel) { VirtualBlock[] palettedBlocks = new VirtualBlock[this.palette.size()]; for (int i = 0; i < this.palette.size(); ++i) { CompoundBinaryTag map = this.palette.getCompound(i); Map propertiesMap = null; if (map.keySet().contains("Properties")) { propertiesMap = new HashMap<>(); CompoundBinaryTag properties = map.getCompound("Properties"); for (String entry : properties.keySet()) { propertiesMap.put(entry, properties.getString(entry)); } } palettedBlocks[i] = factory.createSimpleBlock(map.getString("Name"), propertiesMap); } for (BinaryTag binaryTag : this.blocks) { CompoundBinaryTag blockMap = (CompoundBinaryTag) binaryTag; ListBinaryTag posTag = blockMap.getList("pos"); VirtualBlock block = palettedBlocks[blockMap.getInt("state")]; int x = offsetX + posTag.getInt(0); int y = offsetY + posTag.getInt(1); int z = offsetZ + posTag.getInt(2); world.setBlock(x, y, z, block); CompoundBinaryTag blockEntityNbt = blockMap.getCompound("nbt"); if (!blockEntityNbt.keySet().isEmpty()) { world.setBlockEntity(x, y, z, blockEntityNbt, factory.getBlockEntity(block.getModernStringID())); } } world.fillSkyLight(lightLevel); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/file/WorldEditSchemFile.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.file; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import net.elytrium.limboapi.api.LimboFactory; import net.elytrium.limboapi.api.chunk.VirtualBlock; import net.elytrium.limboapi.api.chunk.VirtualWorld; import net.elytrium.limboapi.api.file.WorldFile; import net.kyori.adventure.nbt.BinaryTag; import net.kyori.adventure.nbt.CompoundBinaryTag; import net.kyori.adventure.nbt.IntBinaryTag; import net.kyori.adventure.nbt.ListBinaryTag; public class WorldEditSchemFile implements WorldFile { private final short width; private final short height; private final short length; private final int[] blocks; private final CompoundBinaryTag palette; private final ListBinaryTag blockEntities; public WorldEditSchemFile(CompoundBinaryTag rootTag) { ByteBuf blockDataBuf; if (rootTag.contains("Width")) { // Check is it old worldedit schema this.width = rootTag.getShort("Width"); this.height = rootTag.getShort("Height"); this.length = rootTag.getShort("Length"); this.palette = rootTag.getCompound("Palette"); blockDataBuf = Unpooled.wrappedBuffer(rootTag.getByteArray("BlockData")); this.blockEntities = rootTag.getList("BlockEntities"); } else if (rootTag.getCompound("Schematic").contains("Blocks")) { // Check is it new worldedit schema CompoundBinaryTag schematicTag = rootTag.getCompound("Schematic"); this.width = schematicTag.getShort("Width"); this.height = schematicTag.getShort("Height"); this.length = schematicTag.getShort("Length"); CompoundBinaryTag blocksTag = schematicTag.getCompound("Blocks"); this.palette = blocksTag.getCompound("Palette"); blockDataBuf = Unpooled.wrappedBuffer(blocksTag.getByteArray("Data")); this.blockEntities = blocksTag.getList("BlockEntities"); } else { // Unknown schema, throw exception throw new IllegalArgumentException("Invalid worldedit file format. Please open an issue on GitHub."); } this.blocks = new int[this.width * this.height * this.length]; for (int i = 0; i < this.blocks.length; i++) { this.blocks[i] = ProtocolUtils.readVarInt(blockDataBuf); } } @Override public void toWorld(LimboFactory factory, VirtualWorld world, int offsetX, int offsetY, int offsetZ, int lightLevel) { VirtualBlock[] palettedBlocks = new VirtualBlock[this.palette.keySet().size()]; this.palette.forEach((entry) -> palettedBlocks[((IntBinaryTag) entry.getValue()).value()] = factory.createSimpleBlock(entry.getKey())); for (int posX = 0; posX < this.width; ++posX) { for (int posY = 0; posY < this.height; ++posY) { for (int posZ = 0; posZ < this.length; ++posZ) { int index = (posY * this.length + posZ) * this.width + posX; world.setBlock(posX + offsetX, posY + offsetY, posZ + offsetZ, palettedBlocks[this.blocks[index]]); } } } for (BinaryTag blockEntity : this.blockEntities) { CompoundBinaryTag blockEntityData = (CompoundBinaryTag) blockEntity; int[] posTag = blockEntityData.getIntArray("Pos"); world.setBlockEntity( offsetX + posTag[0], offsetY + posTag[1], offsetZ + posTag[2], blockEntityData, factory.getBlockEntity(blockEntityData.getString("Id"))); } world.fillSkyLight(lightLevel); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/file/WorldFileTypeRegistry.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.file; import java.io.IOException; import java.io.InputStream; import java.nio.file.Path; import java.util.EnumMap; import java.util.function.Function; import net.elytrium.limboapi.api.file.BuiltInWorldFileType; import net.elytrium.limboapi.api.file.WorldFile; import net.kyori.adventure.nbt.BinaryTagIO; import net.kyori.adventure.nbt.CompoundBinaryTag; public enum WorldFileTypeRegistry { SCHEMATIC(BuiltInWorldFileType.SCHEMATIC, MCEditSchematicFile::new), WORLDEDIT_SCHEM(BuiltInWorldFileType.WORLDEDIT_SCHEM, WorldEditSchemFile::new), STRUCTURE(BuiltInWorldFileType.STRUCTURE, StructureNbtFile::new); private static final EnumMap API_TYPE_MAP = new EnumMap<>(BuiltInWorldFileType.class); private final BuiltInWorldFileType apiType; private final Function worldFileFunction; static { for (WorldFileTypeRegistry pluginType : WorldFileTypeRegistry.values()) { API_TYPE_MAP.put(pluginType.apiType, pluginType); } } WorldFileTypeRegistry(BuiltInWorldFileType apiType, Function worldFileFunction) { this.apiType = apiType; this.worldFileFunction = worldFileFunction; } public static WorldFileTypeRegistry fromApiType(BuiltInWorldFileType apiType) { return API_TYPE_MAP.get(apiType); } public static WorldFile fromApiType(BuiltInWorldFileType apiType, Path file) throws IOException { return fromApiType(apiType).fromNbt(file); } public static WorldFile fromApiType(BuiltInWorldFileType apiType, InputStream stream) throws IOException { return fromApiType(apiType).fromNbt(stream); } public static WorldFile fromApiType(BuiltInWorldFileType apiType, CompoundBinaryTag tag) { return fromApiType(apiType).fromNbt(tag); } public WorldFile fromNbt(Path file) throws IOException { return this.fromNbt(BinaryTagIO.unlimitedReader().read(file, BinaryTagIO.Compression.GZIP)); } public WorldFile fromNbt(InputStream stream) throws IOException { return this.fromNbt(BinaryTagIO.unlimitedReader().read(stream, BinaryTagIO.Compression.GZIP)); } public WorldFile fromNbt(CompoundBinaryTag tag) { return this.worldFileFunction.apply(tag); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/disconnect/DisconnectListener.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.disconnect; import com.velocitypowered.api.event.Subscribe; import com.velocitypowered.api.event.connection.DisconnectEvent; import com.velocitypowered.api.proxy.Player; import net.elytrium.limboapi.LimboAPI; public class DisconnectListener { private final LimboAPI plugin; public DisconnectListener(LimboAPI plugin) { this.plugin = plugin; } @Subscribe public void onDisconnect(DisconnectEvent event) { Player player = event.getPlayer(); this.plugin.unsetLimboJoined(player); this.plugin.removeLoginQueue(player); this.plugin.removeKickCallback(player); this.plugin.removeNextServer(player); this.plugin.removeInitialID(player); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/dummy/ClosedChannel.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.dummy; import io.netty.buffer.ByteBufAllocator; import io.netty.channel.Channel; import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelId; import io.netty.channel.ChannelMetadata; import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelProgressivePromise; import io.netty.channel.ChannelPromise; import io.netty.channel.EventLoop; import io.netty.util.Attribute; import io.netty.util.AttributeKey; import java.net.SocketAddress; import org.checkerframework.checker.nullness.qual.NonNull; public class ClosedChannel implements Channel { private final EventLoop eventLoop; public ClosedChannel(EventLoop eventLoop) { this.eventLoop = eventLoop; } @Override public ChannelId id() { return null; } @Override public EventLoop eventLoop() { return this.eventLoop; } @Override public Channel parent() { return null; } @Override public ChannelConfig config() { return null; } @Override public boolean isOpen() { return false; } @Override public boolean isRegistered() { return false; } @Override public boolean isActive() { return false; } @Override public ChannelMetadata metadata() { return null; } @Override public SocketAddress localAddress() { return null; } @Override public SocketAddress remoteAddress() { return null; } @Override public ChannelFuture closeFuture() { return null; } @Override public boolean isWritable() { return false; } @Override public long bytesBeforeUnwritable() { return 0; } @Override public long bytesBeforeWritable() { return 0; } @Override public Unsafe unsafe() { return null; } @Override public ChannelPipeline pipeline() { return null; } @Override public ByteBufAllocator alloc() { return null; } @Override public ChannelFuture bind(SocketAddress localAddress) { return null; } @Override public ChannelFuture bind(SocketAddress localAddress, ChannelPromise promise) { return null; } @Override public ChannelFuture connect(SocketAddress remoteAddress) { return null; } @Override public ChannelFuture connect(SocketAddress remoteAddress, SocketAddress localAddress) { return null; } @Override public ChannelFuture connect(SocketAddress remoteAddress, ChannelPromise promise) { return null; } @Override public ChannelFuture connect(SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) { return null; } @Override public ChannelFuture disconnect() { return null; } @Override public ChannelFuture disconnect(ChannelPromise promise) { return null; } @Override public ChannelFuture close() { return null; } @Override public ChannelFuture close(ChannelPromise promise) { return null; } @Override public ChannelFuture deregister() { return null; } @Override public ChannelFuture deregister(ChannelPromise promise) { return null; } @Override public Channel read() { return null; } @Override public ChannelFuture write(Object msg) { return null; } @Override public ChannelFuture write(Object msg, ChannelPromise promise) { return null; } @Override public Channel flush() { return null; } @Override public ChannelFuture writeAndFlush(Object msg, ChannelPromise promise) { return null; } @Override public ChannelFuture writeAndFlush(Object msg) { return null; } @Override public ChannelPromise newPromise() { return null; } @Override public ChannelProgressivePromise newProgressivePromise() { return null; } @Override public ChannelFuture newSucceededFuture() { return null; } @Override public ChannelFuture newFailedFuture(Throwable cause) { return null; } @Override public ChannelPromise voidPromise() { return null; } @Override public Attribute attr(AttributeKey key) { return null; } @Override public boolean hasAttr(AttributeKey key) { return false; } @Override public int compareTo(@NonNull Channel o) { return 0; } @Override public boolean equals(Object o) { return o instanceof ClosedChannel && this.compareTo((Channel) o) == 0; } @Override public int hashCode() { return 0; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/dummy/ClosedMinecraftConnection.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.dummy; import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.connection.MinecraftConnection; import io.netty.channel.Channel; public class ClosedMinecraftConnection extends MinecraftConnection { public ClosedMinecraftConnection(Channel channel, VelocityServer server) { super(channel, server); } @Override public boolean isClosed() { return true; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/dummy/DummyEventPool.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.dummy; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelPromise; import io.netty.channel.EventLoop; import io.netty.channel.EventLoopGroup; import io.netty.util.concurrent.EventExecutor; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.ProgressivePromise; import io.netty.util.concurrent.Promise; import io.netty.util.concurrent.ScheduledFuture; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; import org.checkerframework.checker.nullness.qual.NonNull; @SuppressWarnings("ConstantConditions") @SuppressFBWarnings(value = "NP_NONNULL_RETURN_VIOLATION", justification = "This is dummy class.") public class DummyEventPool implements EventLoop { @Override public EventLoopGroup parent() { return null; } @Override public boolean inEventLoop() { return true; } @Override public boolean inEventLoop(Thread thread) { return true; } @Override public Promise newPromise() { return null; } @Override public ProgressivePromise newProgressivePromise() { return null; } @Override public Future newSucceededFuture(V v) { return null; } @Override public Future newFailedFuture(Throwable throwable) { return null; } @Override public boolean isShuttingDown() { return false; } @Override public Future shutdownGracefully() { return null; } @Override public Future shutdownGracefully(long l, long l1, TimeUnit timeUnit) { return null; } @Override public Future terminationFuture() { return null; } @Override public void shutdown() { } @Override public List shutdownNow() { return null; } @Override public boolean isShutdown() { return false; } @Override public boolean isTerminated() { return false; } @Override public boolean awaitTermination(long l, @NonNull TimeUnit timeUnit) { return false; } @Override public EventLoop next() { return null; } @Override public Iterator iterator() { return null; } @Override public Future submit(Runnable runnable) { return null; } @Override public Future submit(Runnable runnable, T t) { return null; } @Override public Future submit(Callable callable) { return null; } @NonNull @Override public List> invokeAll(@NonNull Collection> collection) { return null; } @NonNull @Override public List> invokeAll(@NonNull Collection> collection, long l, @NonNull TimeUnit timeUnit) { return null; } @NonNull @Override public T invokeAny(@NonNull Collection> collection) { return null; } @Override public T invokeAny(@NonNull Collection> collection, long l, @NonNull TimeUnit timeUnit) { return null; } @Override public ScheduledFuture schedule(Runnable runnable, long l, TimeUnit timeUnit) { return null; } @Override public ScheduledFuture schedule(Callable callable, long l, TimeUnit timeUnit) { return null; } @Override public ScheduledFuture scheduleAtFixedRate(Runnable runnable, long l, long l1, TimeUnit timeUnit) { return null; } @Override public ScheduledFuture scheduleWithFixedDelay(Runnable runnable, long l, long l1, TimeUnit timeUnit) { return null; } @Override public ChannelFuture register(Channel channel) { return null; } @Override public ChannelFuture register(ChannelPromise channelPromise) { return null; } @Override public ChannelFuture register(Channel channel, ChannelPromise channelPromise) { return null; } @Override public void execute(@NonNull Runnable runnable) { } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/event/EventManagerHook.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.event; import com.google.common.collect.ListMultimap; import com.velocitypowered.api.event.EventTask; import com.velocitypowered.api.event.PostOrder; import com.velocitypowered.api.event.Subscribe; import com.velocitypowered.api.event.player.GameProfileRequestEvent; import com.velocitypowered.api.event.player.KickedFromServerEvent; import com.velocitypowered.api.plugin.PluginContainer; import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.proxy.event.VelocityEventManager; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.lang.reflect.Array; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.function.Function; import net.elytrium.commons.utils.reflection.ReflectionException; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.Settings; @SuppressWarnings("unchecked") public class EventManagerHook { private static final Field HANDLERS_BY_TYPE_FIELD; private static final Class HANDLER_REGISTRATION_CLASS; private static final MethodHandle PLUGIN_FIELD; private static final MethodHandle FIRE_METHOD; private static final MethodHandle FUTURE_FIELD; private final Set proceededProfiles = new HashSet<>(); private final LimboAPI plugin; private final VelocityEventManager eventManager; private Object handlerRegistrations; private boolean hasHandlerRegistration; public EventManagerHook(LimboAPI plugin, VelocityEventManager eventManager) { this.plugin = plugin; this.eventManager = eventManager; } @Subscribe(order = PostOrder.FIRST) public EventTask onGameProfileRequest(GameProfileRequestEvent event) { GameProfile originalProfile = event.getGameProfile(); if (this.proceededProfiles.remove(originalProfile)) { return null; } else { CompletableFuture fireFuture = new CompletableFuture<>(); CompletableFuture hookFuture = new CompletableFuture<>(); fireFuture.thenAccept(modifiedEvent -> { try { this.plugin.getLoginListener().hookLoginSession(modifiedEvent); hookFuture.complete(modifiedEvent); } catch (Throwable e) { LimboAPI.getLogger().error("Failed to handle GameProfileRequestEvent", e); throw new ReflectionException(e); } }); if (this.hasHandlerRegistration) { try { FIRE_METHOD.invoke(this.eventManager, fireFuture, event, 0, false, this.handlerRegistrations); } catch (Throwable e) { fireFuture.complete(event); throw new ReflectionException(e); } } else { fireFuture.complete(event); } // ignoring other subscribers by directly completing the future return EventTask.withContinuation(continuation -> hookFuture.whenComplete((result, cause) -> { try { CompletableFuture future = (CompletableFuture) FUTURE_FIELD.invokeExact(continuation); if (future != null) { future.complete(result); } } catch (Throwable e) { throw new ReflectionException(e); } })); } } @Subscribe(order = PostOrder.LAST) public EventTask onKickedFromServer(KickedFromServerEvent event) { CompletableFuture hookFuture = new CompletableFuture<>(); try { Function callback = this.plugin.getKickCallback(event.getPlayer()); if (callback == null || !callback.apply(event)) { hookFuture.complete(event); } } catch (Throwable throwable) { LimboAPI.getLogger().error("Failed to handle KickCallback, ignoring its result", throwable); hookFuture.complete(event); } // if kick callback is null and no exception occurred, hookFuture won't be ever finished, and // the event chain would be broken, that is what we need. return EventTask.resumeWhenComplete(hookFuture); } public void proceedProfile(GameProfile profile) { this.proceededProfiles.add(profile); } @SuppressWarnings("rawtypes") public void reloadHandlers() throws IllegalAccessException { ListMultimap, ?> handlersMap = (ListMultimap, ?>) HANDLERS_BY_TYPE_FIELD.get(this.eventManager); List disabledHandlers = handlersMap.get(GameProfileRequestEvent.class); List preEvents = new ArrayList<>(); List newHandlers = new ArrayList<>(disabledHandlers); if (this.handlerRegistrations != null) { for (int i = 0; i < Array.getLength(this.handlerRegistrations); ++i) { preEvents.add(Array.get(this.handlerRegistrations, i)); } } try { for (Object handler : disabledHandlers) { PluginContainer pluginContainer = (PluginContainer) PLUGIN_FIELD.invoke(handler); String id = pluginContainer.getDescription().getId(); if (Settings.IMP.MAIN.PRE_LIMBO_PROFILE_REQUEST_PLUGINS.contains(id)) { LimboAPI.getLogger().info("Hooking all GameProfileRequestEvent events from {} ", id); preEvents.add(handler); newHandlers.remove(handler); } } } catch (Throwable e) { throw new ReflectionException(e); } handlersMap.replaceValues(GameProfileRequestEvent.class, newHandlers); this.handlerRegistrations = Array.newInstance(HANDLER_REGISTRATION_CLASS, preEvents.size()); for (int i = 0; i < preEvents.size(); ++i) { Array.set(this.handlerRegistrations, i, preEvents.get(i)); } this.hasHandlerRegistration = !preEvents.isEmpty(); } static { try { HANDLERS_BY_TYPE_FIELD = VelocityEventManager.class.getDeclaredField("handlersByType"); HANDLERS_BY_TYPE_FIELD.setAccessible(true); HANDLER_REGISTRATION_CLASS = Class.forName("com.velocitypowered.proxy.event.VelocityEventManager$HandlerRegistration"); PLUGIN_FIELD = MethodHandles.privateLookupIn(HANDLER_REGISTRATION_CLASS, MethodHandles.lookup()) .findGetter(HANDLER_REGISTRATION_CLASS, "plugin", PluginContainer.class); Class continuationTaskClass = Class.forName("com.velocitypowered.proxy.event.VelocityEventManager$ContinuationTask"); FUTURE_FIELD = MethodHandles.privateLookupIn(continuationTaskClass, MethodHandles.lookup()) .findGetter(continuationTaskClass, "future", CompletableFuture.class); // The desired 5-argument fire method is private, and its 5th argument is the array of the private class, // so we can't pass it into the Class#getDeclaredMethod(Class...) method. Method fireMethod = Arrays.stream(VelocityEventManager.class.getDeclaredMethods()) .filter(method -> method.getName().equals("fire") && method.getParameterCount() == 5) .findFirst() .orElseThrow(); fireMethod.setAccessible(true); FIRE_METHOD = MethodHandles.privateLookupIn(VelocityEventManager.class, MethodHandles.lookup()) .findVirtual(VelocityEventManager.class, "fire", MethodType.methodType( void.class, CompletableFuture.class, Object.class, int.class, boolean.class, Array.newInstance(HANDLER_REGISTRATION_CLASS, 0).getClass() )); } catch (NoSuchFieldException | ClassNotFoundException | IllegalAccessException | NoSuchMethodException e) { throw new ReflectionException(e); } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/login/LoginListener.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * This file contains some parts of Velocity, licensed under the AGPLv3 License (AGPLv3). * * Copyright (C) 2018 Velocity Contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.login; import com.velocitypowered.api.event.Subscribe; import com.velocitypowered.api.event.player.GameProfileRequestEvent; import com.velocitypowered.api.event.player.PlayerChooseInitialServerEvent; import com.velocitypowered.api.event.player.ServerConnectedEvent; import com.velocitypowered.api.network.HandshakeIntent; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.proxy.crypto.IdentifiedKey; import com.velocitypowered.api.proxy.player.TabList; import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.api.util.UuidUtils; import com.velocitypowered.natives.compression.VelocityCompressor; import com.velocitypowered.natives.util.Natives; import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.config.PlayerInfoForwarding; import com.velocitypowered.proxy.config.VelocityConfiguration; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.client.AuthSessionHandler; import com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler; import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.connection.client.InitialInboundConnection; import com.velocitypowered.proxy.connection.client.LoginInboundConnection; import com.velocitypowered.proxy.crypto.IdentifiedKeyImpl; import com.velocitypowered.proxy.network.Connections; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.VelocityConnectionEvent; import com.velocitypowered.proxy.protocol.netty.MinecraftCompressorAndLengthEncoder; import com.velocitypowered.proxy.protocol.packet.ServerLoginSuccessPacket; import com.velocitypowered.proxy.protocol.packet.SetCompressionPacket; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelOutboundHandlerAdapter; import io.netty.channel.ChannelPipeline; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.lang.reflect.Field; import java.net.InetSocketAddress; import java.util.Objects; import java.util.UUID; import java.util.function.BiConsumer; import net.elytrium.commons.utils.reflection.ReflectionException; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.Settings; import net.elytrium.limboapi.api.event.LoginLimboRegisterEvent; import net.elytrium.limboapi.injection.dummy.ClosedChannel; import net.elytrium.limboapi.injection.dummy.ClosedMinecraftConnection; import net.elytrium.limboapi.injection.dummy.DummyEventPool; import net.elytrium.limboapi.injection.login.confirmation.LoginConfirmHandler; import net.elytrium.limboapi.injection.packet.ServerLoginSuccessHook; import net.elytrium.limboapi.injection.tablist.RewritingKeyedVelocityTabList; import net.elytrium.limboapi.injection.tablist.RewritingVelocityTabList; import net.elytrium.limboapi.injection.tablist.RewritingVelocityTabListLegacy; import net.elytrium.limboapi.utils.LambdaUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; public class LoginListener { private static final ClosedMinecraftConnection CLOSED_MINECRAFT_CONNECTION; private static final MethodHandle DELEGATE_FIELD; private static final BiConsumer MC_CONNECTION_SETTER; private static final MethodHandle CONNECTED_PLAYER_CONSTRUCTOR; private static final MethodHandle SPAWNED_FIELD; private static final BiConsumer TAB_LIST_SETTER; private final LimboAPI plugin; private final VelocityServer server; public LoginListener(LimboAPI plugin, VelocityServer server) { this.plugin = plugin; this.server = server; } @Subscribe public void hookInitialServer(PlayerChooseInitialServerEvent event) { if (this.plugin.hasNextServer(event.getPlayer())) { event.setInitialServer(this.plugin.getNextServer(event.getPlayer())); } this.plugin.setLimboJoined(event.getPlayer()); } @SuppressWarnings("ConstantConditions") public void hookLoginSession(GameProfileRequestEvent event) throws Throwable { LoginInboundConnection inboundConnection = (LoginInboundConnection) event.getConnection(); // In some cases, e.g. if the player logged out or was kicked right before the GameProfileRequestEvent hook, // the connection will be broken (possibly by GC) and we can't get it from the delegate field. if (LoginInboundConnection.class.isAssignableFrom(inboundConnection.getClass())) { // Changing mcConnection to the closed one. For what? To break the "initializePlayer" // method (which checks mcConnection.isActive()) and to override it. :) InitialInboundConnection inbound = (InitialInboundConnection) DELEGATE_FIELD.invokeExact(inboundConnection); MinecraftConnection connection = inbound.getConnection(); // Ensure that this method is always invoked inside EventLoop. if (!connection.eventLoop().inEventLoop()) { connection.eventLoop().execute(() -> { try { this.hookLoginSession(event); } catch (Throwable e) { throw new IllegalStateException("failed to handle login request", e); } }); return; } Object handler = connection.getActiveSessionHandler(); MC_CONNECTION_SETTER.accept(handler, CLOSED_MINECRAFT_CONNECTION); LoginConfirmHandler loginHandler = null; if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) >= 0) { connection.setActiveSessionHandler(StateRegistry.LOGIN, loginHandler = new LoginConfirmHandler(this.plugin, connection)); } // From Velocity. if (!connection.isClosed()) { try { IdentifiedKey playerKey = inboundConnection.getIdentifiedKey(); if (playerKey != null) { if (playerKey.getSignatureHolder() == null) { if (playerKey instanceof IdentifiedKeyImpl unlinkedKey) { // Failsafe if (!unlinkedKey.internalAddHolder(event.getGameProfile().getId())) { playerKey = null; } } } else if (!Objects.equals(playerKey.getSignatureHolder(), event.getGameProfile().getId())) { playerKey = null; } } // Initiate a regular connection and move over to it. ConnectedPlayer player = (ConnectedPlayer) CONNECTED_PLAYER_CONSTRUCTOR.invokeExact( this.server, event.getGameProfile(), connection, inboundConnection.getVirtualHost().orElse(null), ((InboundConnection) inboundConnection).getRawVirtualHost().orElse(null), event.isOnlineMode(), ((InboundConnection) inboundConnection).getHandshakeIntent(), playerKey ); if (connection.getProtocolVersion().noLessThan(ProtocolVersion.MINECRAFT_1_19_3)) { TAB_LIST_SETTER.accept(player, new RewritingVelocityTabList(player)); } else if (connection.getProtocolVersion().noLessThan(ProtocolVersion.MINECRAFT_1_8)) { TAB_LIST_SETTER.accept(player, new RewritingKeyedVelocityTabList(player, this.server)); } else { TAB_LIST_SETTER.accept(player, new RewritingVelocityTabListLegacy(player, this.server)); } if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) >= 0) { loginHandler.setPlayer(player); } if (this.server.canRegisterConnection(player)) { if (!connection.isClosed()) { // Complete the Login process. int threshold = this.server.getConfiguration().getCompressionThreshold(); ChannelPipeline pipeline = connection.getChannel().pipeline(); boolean compressionEnabled = threshold >= 0 && connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0; if (compressionEnabled) { connection.write(new SetCompressionPacket(threshold)); this.plugin.fixDecompressor(pipeline, threshold, true); if (!Settings.IMP.MAIN.COMPATIBILITY_MODE) { pipeline.addFirst(Connections.COMPRESSION_ENCODER, new ChannelOutboundHandlerAdapter()); } else { int level = this.server.getConfiguration().getCompressionLevel(); VelocityCompressor compressor = Natives.compress.get().create(level); pipeline.addBefore(Connections.MINECRAFT_ENCODER, Connections.COMPRESSION_ENCODER, new MinecraftCompressorAndLengthEncoder(threshold, compressor)); pipeline.remove(Connections.FRAME_ENCODER); } } if (!Settings.IMP.MAIN.COMPATIBILITY_MODE) { pipeline.remove(Connections.FRAME_ENCODER); } this.plugin.inject3rdParty(player, connection, pipeline); if (compressionEnabled) { pipeline.fireUserEventTriggered(VelocityConnectionEvent.COMPRESSION_ENABLED); } else { pipeline.fireUserEventTriggered(VelocityConnectionEvent.COMPRESSION_DISABLED); } VelocityConfiguration configuration = this.server.getConfiguration(); UUID playerUniqueID = player.getUniqueId(); if (configuration.getPlayerInfoForwardingMode() == PlayerInfoForwarding.NONE) { playerUniqueID = UuidUtils.generateOfflinePlayerUuid(player.getUsername()); } ServerLoginSuccessPacket success = new ServerLoginSuccessPacket(); success.setUsername(player.getUsername()); success.setProperties(player.getGameProfileProperties()); success.setUuid(playerUniqueID); if (Settings.IMP.MAIN.COMPATIBILITY_MODE) { connection.write(success); } else { ServerLoginSuccessHook successHook = new ServerLoginSuccessHook(); successHook.setUsername(player.getUsername()); successHook.setProperties(player.getGameProfileProperties()); successHook.setUuid(playerUniqueID); connection.write(successHook); ChannelHandler compressionHandler = pipeline.get(Connections.COMPRESSION_ENCODER); if (compressionHandler != null) { connection.write(this.plugin.encodeSingleLogin(success, connection.getProtocolVersion())); } else { ChannelHandler frameHandler = pipeline.get(Connections.FRAME_ENCODER); if (frameHandler != null) { pipeline.remove(frameHandler); } connection.write(this.plugin.encodeSingleLoginUncompressed(success, connection.getProtocolVersion())); } } this.plugin.setInitialID(player, playerUniqueID); if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) >= 0) { loginHandler.thenRun(() -> this.fireRegisterEvent(player, connection, inbound, handler)); } else { connection.setState(StateRegistry.PLAY); this.fireRegisterEvent(player, connection, inbound, handler); } } } else { player.disconnect0(Component.translatable("velocity.error.already-connected-proxy", NamedTextColor.RED), true); } } catch (Throwable e) { inbound.getConnection().close(); throw e; } } } } private void fireRegisterEvent(ConnectedPlayer player, MinecraftConnection connection, InitialInboundConnection inbound, Object handler) { this.server.getEventManager().fire(new LoginLimboRegisterEvent(player)).thenAcceptAsync(limboRegisterEvent -> { LoginTasksQueue queue = new LoginTasksQueue(this.plugin, handler, this.server, player, inbound, limboRegisterEvent.getOnJoinCallbacks()); this.plugin.addLoginQueue(player, queue); this.plugin.setKickCallback(player, limboRegisterEvent.getOnKickCallback()); queue.next(); }, connection.eventLoop()).exceptionally(t -> { LimboAPI.getLogger().error("Exception while registering LimboAPI login handlers for {}.", player, t); return null; }); } @Subscribe public void hookPlaySession(ServerConnectedEvent event) { ConnectedPlayer player = (ConnectedPlayer) event.getPlayer(); MinecraftConnection connection = player.getConnection(); // 1.20.2+ can ignore this, as it should be despawned by default if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) >= 0) { return; } connection.eventLoop().execute(() -> { if (!(connection.getActiveSessionHandler() instanceof ClientPlaySessionHandler)) { try { ClientPlaySessionHandler playHandler = new ClientPlaySessionHandler(this.server, player); SPAWNED_FIELD.invokeExact(playHandler, this.plugin.isLimboJoined(player)); connection.setActiveSessionHandler(connection.getState(), playHandler); } catch (Throwable e) { throw new ReflectionException(e); } } }); } static { CLOSED_MINECRAFT_CONNECTION = new ClosedMinecraftConnection(new ClosedChannel(new DummyEventPool()), null); try { CONNECTED_PLAYER_CONSTRUCTOR = MethodHandles.privateLookupIn(ConnectedPlayer.class, MethodHandles.lookup()) .findConstructor(ConnectedPlayer.class, MethodType.methodType( void.class, VelocityServer.class, GameProfile.class, MinecraftConnection.class, InetSocketAddress.class, String.class, boolean.class, HandshakeIntent.class, IdentifiedKey.class ) ); DELEGATE_FIELD = MethodHandles.privateLookupIn(LoginInboundConnection.class, MethodHandles.lookup()) .findGetter(LoginInboundConnection.class, "delegate", InitialInboundConnection.class); Field mcConnectionField = AuthSessionHandler.class.getDeclaredField("mcConnection"); mcConnectionField.setAccessible(true); MC_CONNECTION_SETTER = LambdaUtil.setterOf(mcConnectionField); SPAWNED_FIELD = MethodHandles.privateLookupIn(ClientPlaySessionHandler.class, MethodHandles.lookup()) .findSetter(ClientPlaySessionHandler.class, "spawned", boolean.class); Field tabListField = ConnectedPlayer.class.getDeclaredField("tabList"); tabListField.setAccessible(true); TAB_LIST_SETTER = LambdaUtil.setterOf(tabListField); } catch (Throwable e) { throw new ReflectionException(e); } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/login/LoginTasksQueue.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * This file contains some parts of Velocity, licensed under the AGPLv3 License (AGPLv3). * * Copyright (C) 2018 Velocity Contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.login; import com.velocitypowered.api.event.EventManager; import com.velocitypowered.api.event.connection.DisconnectEvent; import com.velocitypowered.api.event.connection.LoginEvent; import com.velocitypowered.api.event.connection.PostLoginEvent; import com.velocitypowered.api.event.permission.PermissionsSetupEvent; import com.velocitypowered.api.event.player.GameProfileRequestEvent; import com.velocitypowered.api.event.player.PlayerClientBrandEvent; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.permission.PermissionFunction; import com.velocitypowered.api.permission.PermissionProvider; import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.client.AuthSessionHandler; import com.velocitypowered.proxy.connection.client.ClientConfigSessionHandler; import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.connection.client.InitialConnectSessionHandler; import com.velocitypowered.proxy.network.Connections; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.packet.LegacyPlayerListItemPacket; import com.velocitypowered.proxy.protocol.packet.UpsertPlayerInfoPacket; import com.velocitypowered.proxy.protocol.packet.chat.ComponentHolder; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import io.netty.channel.ChannelPipeline; import io.netty.channel.EventLoop; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.lang.reflect.Field; import java.util.EnumSet; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.Queue; import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.function.BiConsumer; import net.elytrium.commons.utils.reflection.ReflectionException; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.injection.login.confirmation.LoginConfirmHandler; import net.elytrium.limboapi.server.LimboSessionHandlerImpl; import net.elytrium.limboapi.utils.LambdaUtil; import net.kyori.adventure.text.Component; import org.slf4j.Logger; public class LoginTasksQueue { private static final MethodHandle PROFILE_FIELD; private static final PermissionProvider DEFAULT_PERMISSIONS; private static final MethodHandle SET_PERMISSION_FUNCTION_METHOD; private static final MethodHandle INITIAL_CONNECT_SESSION_HANDLER_CONSTRUCTOR; private static final BiConsumer MC_CONNECTION_SETTER; private static final MethodHandle CONNECT_TO_INITIAL_SERVER_METHOD; private static final MethodHandle SET_CLIENT_BRAND; public static final BiConsumer BRAND_CHANNEL_SETTER; private final LimboAPI plugin; private final Object handler; private final VelocityServer server; private final ConnectedPlayer player; private final InboundConnection inbound; private final Queue queue; public LoginTasksQueue(LimboAPI plugin, Object handler, VelocityServer server, ConnectedPlayer player, InboundConnection inbound, Queue queue) { this.plugin = plugin; this.handler = handler; this.server = server; this.player = player; this.inbound = inbound; this.queue = queue; } public void next() { MinecraftConnection connection = this.player.getConnection(); if (connection.getChannel().isActive()) { EventLoop eventLoop = connection.eventLoop(); if (this.queue.isEmpty()) { eventLoop.execute(this::finish); } else { eventLoop.execute(Objects.requireNonNull(this.queue.poll())); } } } private void finish() { this.plugin.removeLoginQueue(this.player); EventManager eventManager = this.server.getEventManager(); MinecraftConnection connection = this.player.getConnection(); Logger logger = LimboAPI.getLogger(); this.plugin.getEventManagerHook().proceedProfile(this.player.getGameProfile()); eventManager.fire(new GameProfileRequestEvent(this.inbound, this.player.getGameProfile(), this.player.isOnlineMode())).thenAcceptAsync( gameProfile -> { try { UUID uuid = this.plugin.getInitialID(this.player); if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_19_1) <= 0) { connection.delayedWrite(new LegacyPlayerListItemPacket( LegacyPlayerListItemPacket.REMOVE_PLAYER, List.of(new LegacyPlayerListItemPacket.Item(uuid)) )); connection.delayedWrite(new LegacyPlayerListItemPacket( LegacyPlayerListItemPacket.ADD_PLAYER, List.of( new LegacyPlayerListItemPacket.Item(uuid) .setName(gameProfile.getUsername()) .setProperties(gameProfile.getGameProfile().getProperties()) ) )); } else if (connection.getState() != StateRegistry.CONFIG) { UpsertPlayerInfoPacket.Entry playerInfoEntry = new UpsertPlayerInfoPacket.Entry(uuid); playerInfoEntry.setDisplayName(new ComponentHolder(this.player.getProtocolVersion(), Component.text(gameProfile.getUsername()))); playerInfoEntry.setProfile(gameProfile.getGameProfile()); connection.delayedWrite(new UpsertPlayerInfoPacket( EnumSet.of( UpsertPlayerInfoPacket.Action.UPDATE_DISPLAY_NAME, UpsertPlayerInfoPacket.Action.ADD_PLAYER), List.of(playerInfoEntry))); } PROFILE_FIELD.invokeExact(this.player, gameProfile.getGameProfile()); // From Velocity. eventManager .fire(new PermissionsSetupEvent(this.player, DEFAULT_PERMISSIONS)) .thenAcceptAsync(event -> { if (!connection.isClosed()) { // Wait for permissions to load, then set the players' permission function. PermissionFunction function = event.createFunction(this.player); if (function == null) { logger.error( "A plugin permission provider {} provided an invalid permission function" + " for player {}. This is a bug in the plugin, not in Velocity. Falling" + " back to the default permission function.", event.getProvider().getClass().getName(), this.player.getUsername() ); } else { try { SET_PERMISSION_FUNCTION_METHOD.invokeExact(this.player, function); } catch (Throwable ex) { logger.error("Exception while completing injection to {}", this.player, ex); } } try { this.initialize(connection); } catch (Throwable e) { throw new ReflectionException(e); } } }, connection.eventLoop()); } catch (Throwable e) { logger.error("Exception while completing injection to {}", this.player, e); } }, connection.eventLoop()); } // From Velocity. private void initialize(MinecraftConnection connection) throws Throwable { connection.setAssociation(this.player); if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) < 0 || connection.getState() != StateRegistry.CONFIG) { this.plugin.setState(connection, StateRegistry.PLAY); } ChannelPipeline pipeline = connection.getChannel().pipeline(); this.plugin.deject3rdParty(pipeline); if (pipeline.get(Connections.FRAME_ENCODER) == null) { this.plugin.fixCompressor(pipeline, connection.getProtocolVersion()); } Logger logger = LimboAPI.getLogger(); this.server.getEventManager().fire(new LoginEvent(this.player)).thenAcceptAsync(event -> { if (connection.isClosed()) { // The player was disconnected. this.server.getEventManager().fireAndForget(new DisconnectEvent(this.player, DisconnectEvent.LoginStatus.CANCELLED_BY_USER_BEFORE_COMPLETE)); } else { Optional reason = event.getResult().getReasonComponent(); if (reason.isPresent()) { this.player.disconnect0(reason.get(), false); } else { if (this.server.registerConnection(this.player)) { if (connection.getActiveSessionHandler() instanceof LoginConfirmHandler confirm) { confirm.waitForConfirmation(() -> this.connectToServer(logger, this.player, connection)); } else { this.connectToServer(logger, this.player, connection); } } else { this.player.disconnect0(Component.translatable("velocity.error.already-connected-proxy"), false); } } } }, connection.eventLoop()).exceptionally(t -> { logger.error("Exception while completing login initialisation phase for {}", this.player, t); return null; }); } @SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") private void connectToServer(Logger logger, ConnectedPlayer player, MinecraftConnection connection) { if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) < 0) { try { connection.setActiveSessionHandler(connection.getState(), (InitialConnectSessionHandler) INITIAL_CONNECT_SESSION_HANDLER_CONSTRUCTOR.invokeExact(this.player, this.server)); } catch (Throwable e) { throw new ReflectionException(e); } } else if (connection.getState() == StateRegistry.PLAY) { // Synchronize with the client to ensure that it will not corrupt CONFIG state with PLAY packets ((LimboSessionHandlerImpl) connection.getActiveSessionHandler()) .disconnectToConfig(() -> this.connectToServer(logger, player, connection)); return; // Re-running this method due to synchronization with the client } else { ClientConfigSessionHandler configHandler = new ClientConfigSessionHandler(this.server, this.player); // 1.20.2+ client doesn't send ClientSettings and brand while switching state, // so we need to use packets that was sent during LOGIN completion. if (connection.getActiveSessionHandler() instanceof LimboSessionHandlerImpl sessionHandler) { if (sessionHandler.getSettings() != null) { this.player.setClientSettings(sessionHandler.getSettings()); } // TODO: also queue non-vanilla plugin messages? if (sessionHandler.getBrand() != null) { try { this.server.getEventManager().fireAndForget(new PlayerClientBrandEvent(this.player, sessionHandler.getBrand())); SET_CLIENT_BRAND.invokeExact(this.player, sessionHandler.getBrand()); BRAND_CHANNEL_SETTER.accept(configHandler, "minecraft:brand"); } catch (Throwable e) { throw new ReflectionException(e); } } } this.plugin.setActiveSessionHandler(connection, StateRegistry.CONFIG, configHandler); } this.server.getEventManager().fire(new PostLoginEvent(this.player)).thenAccept(postLoginEvent -> { try { MC_CONNECTION_SETTER.accept(this.handler, connection); CONNECT_TO_INITIAL_SERVER_METHOD.invoke((AuthSessionHandler) this.handler, this.player); } catch (Throwable e) { throw new ReflectionException(e); } }); } static { try { PROFILE_FIELD = MethodHandles.privateLookupIn(ConnectedPlayer.class, MethodHandles.lookup()) .findSetter(ConnectedPlayer.class, "profile", GameProfile.class); Field defaultPermissionsField = ConnectedPlayer.class.getDeclaredField("DEFAULT_PERMISSIONS"); defaultPermissionsField.setAccessible(true); DEFAULT_PERMISSIONS = (PermissionProvider) defaultPermissionsField.get(null); SET_PERMISSION_FUNCTION_METHOD = MethodHandles.privateLookupIn(ConnectedPlayer.class, MethodHandles.lookup()) .findVirtual(ConnectedPlayer.class, "setPermissionFunction", MethodType.methodType(void.class, PermissionFunction.class)); INITIAL_CONNECT_SESSION_HANDLER_CONSTRUCTOR = MethodHandles .privateLookupIn(InitialConnectSessionHandler.class, MethodHandles.lookup()) .findConstructor(InitialConnectSessionHandler.class, MethodType.methodType(void.class, ConnectedPlayer.class, VelocityServer.class)); CONNECT_TO_INITIAL_SERVER_METHOD = MethodHandles.privateLookupIn(AuthSessionHandler.class, MethodHandles.lookup()) .findVirtual(AuthSessionHandler.class, "connectToInitialServer", MethodType.methodType(CompletableFuture.class, ConnectedPlayer.class)); Field mcConnectionField = AuthSessionHandler.class.getDeclaredField("mcConnection"); mcConnectionField.setAccessible(true); MC_CONNECTION_SETTER = LambdaUtil.setterOf(mcConnectionField); SET_CLIENT_BRAND = MethodHandles.privateLookupIn(ConnectedPlayer.class, MethodHandles.lookup()) .findVirtual(ConnectedPlayer.class, "setClientBrand", MethodType.methodType(void.class, String.class)); Field brandChannelField = ClientConfigSessionHandler.class.getDeclaredField("brandChannel"); brandChannelField.setAccessible(true); BRAND_CHANNEL_SETTER = LambdaUtil.setterOf(brandChannelField); } catch (Throwable e) { throw new ReflectionException(e); } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/login/confirmation/LoginConfirmHandler.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.login.confirmation; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.packet.LoginAcknowledgedPacket; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.util.ReferenceCountUtil; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.util.ArrayList; import java.util.List; import java.util.concurrent.CompletableFuture; import net.elytrium.commons.utils.reflection.ReflectionException; import net.elytrium.limboapi.LimboAPI; public class LoginConfirmHandler implements MinecraftSessionHandler { private static final boolean BACKPRESSURE_LOG = Boolean.getBoolean("velocity.log-server-backpressure"); private static final MethodHandle TEARDOWN_METHOD; private final LimboAPI plugin; private final CompletableFuture confirmation = new CompletableFuture<>(); private final List queuedPackets = new ArrayList<>(); private final MinecraftConnection connection; private ConnectedPlayer player; public LoginConfirmHandler(LimboAPI plugin, MinecraftConnection connection) { this.plugin = plugin; this.connection = connection; } public void setPlayer(ConnectedPlayer player) { this.player = player; } public boolean isDone() { return this.confirmation.isDone(); } public CompletableFuture thenRun(Runnable runnable) { return this.confirmation.thenRun(runnable); } public void waitForConfirmation(Runnable runnable) { this.thenRun(() -> { try { runnable.run(); } catch (Throwable throwable) { LimboAPI.getLogger().error("Failed to confirm transition for " + this.player, throwable); } try { ChannelHandlerContext ctx = this.connection.getChannel().pipeline().context(this.connection); for (MinecraftPacket packet : this.queuedPackets) { try { this.connection.channelRead(ctx, packet); } catch (Throwable throwable) { LimboAPI.getLogger().error("{}: exception handling exception in {}", ctx.channel().remoteAddress(), this.connection.getActiveSessionHandler(), throwable); } } this.queuedPackets.clear(); } catch (Throwable throwable) { LimboAPI.getLogger().error("Failed to process packet queue for " + this.player, throwable); } }); } @Override public boolean handle(LoginAcknowledgedPacket packet) { this.plugin.setState(this.connection, StateRegistry.CONFIG); this.confirmation.complete(this); return true; } @Override public void handleGeneric(MinecraftPacket packet) { // As Velocity/LimboAPI can easly skip packets due to random delays, packets should be queued if (this.connection.getState() == StateRegistry.CONFIG) { this.queuedPackets.add(ReferenceCountUtil.retain(packet)); } } @Override public void handleUnknown(ByteBuf buf) { this.connection.close(true); } @Override public void writabilityChanged() { if (BACKPRESSURE_LOG) { if (this.connection.getChannel().isWritable()) { LimboAPI.getLogger().info("{} is writable, will auto-read", this.player); } else { LimboAPI.getLogger().info("{} is not writable, not auto-reading", this.player); } } } @Override public void disconnected() { try { if (this.player != null) { try { TEARDOWN_METHOD.invokeExact(this.player); } catch (Throwable e) { throw new ReflectionException(e); } } } finally { for (MinecraftPacket packet : this.queuedPackets) { ReferenceCountUtil.release(packet); } } } static { try { TEARDOWN_METHOD = MethodHandles.privateLookupIn(ConnectedPlayer.class, MethodHandles.lookup()) .findVirtual(ConnectedPlayer.class, "teardown", MethodType.methodType(void.class)); } catch (NoSuchMethodException | IllegalAccessException e) { throw new ReflectionException(e); } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/packet/LegacyPlayerListItemHook.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.packet; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.backend.BackendPlaySessionHandler; import com.velocitypowered.proxy.connection.backend.VelocityServerConnection; import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.packet.LegacyPlayerListItemPacket; import io.netty.util.collection.IntObjectMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.function.Supplier; import net.elytrium.commons.utils.reflection.ReflectionException; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.protocol.LimboProtocol; @SuppressWarnings("unchecked") public class LegacyPlayerListItemHook extends LegacyPlayerListItemPacket { private static final MethodHandle SERVER_CONN_FIELD; private final LimboAPI plugin; private LegacyPlayerListItemHook(LimboAPI plugin) { this.plugin = plugin; } @Override public boolean handle(MinecraftSessionHandler handler) { if (handler instanceof BackendPlaySessionHandler) { List items = this.getItems(); for (int i = 0; i < items.size(); ++i) { try { Item item = items.get(i); ConnectedPlayer player = ((VelocityServerConnection) SERVER_CONN_FIELD.invokeExact((BackendPlaySessionHandler) handler)).getPlayer(); UUID initialID = this.plugin.getInitialID(player); if (player.getUniqueId().equals(item.getUuid())) { items.set(i, new Item(initialID) .setDisplayName(item.getDisplayName()) .setGameMode(item.getGameMode()) .setLatency(item.getLatency()) .setName(item.getName()) .setProperties(item.getProperties())); } } catch (Throwable e) { throw new ReflectionException(e); } } } return super.handle(handler); } static { try { SERVER_CONN_FIELD = MethodHandles.privateLookupIn(BackendPlaySessionHandler.class, MethodHandles.lookup()) .findGetter(BackendPlaySessionHandler.class, "serverConn", VelocityServerConnection.class); } catch (NoSuchFieldException | IllegalAccessException e) { throw new ReflectionException(e); } } public static void init(LimboAPI plugin, StateRegistry.PacketRegistry registry) throws ReflectiveOperationException { // See LimboProtocol#overlayRegistry about var. var playProtocolRegistryVersions = (Map) LimboProtocol.VERSIONS_FIELD.get(registry); playProtocolRegistryVersions.forEach((protocolVersion, protocolRegistry) -> { try { var packetIDToSupplier = (IntObjectMap>) LimboProtocol.PACKET_ID_TO_SUPPLIER_FIELD.get(protocolRegistry); var packetClassToID = (Object2IntMap>) LimboProtocol.PACKET_CLASS_TO_ID_FIELD.get(protocolRegistry); int id = packetClassToID.getInt(LegacyPlayerListItemPacket.class); packetClassToID.put(LegacyPlayerListItemHook.class, id); packetIDToSupplier.put(id, () -> new LegacyPlayerListItemHook(plugin)); } catch (ReflectiveOperationException e) { throw new ReflectionException(e); } }); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/packet/LimboCompressDecoder.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.packet; public interface LimboCompressDecoder { } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/packet/MinecraftDiscardCompressDecoder.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.packet; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToMessageDecoder; import java.util.List; public class MinecraftDiscardCompressDecoder extends MessageToMessageDecoder implements LimboCompressDecoder { @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) throws Exception { if (in.readByte() == 0) { out.add(in.retain()); } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/packet/MinecraftLimitedCompressDecoder.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * * This file contains some parts of Velocity, licensed under the AGPLv3 License (AGPLv3). * * Copyright (C) 2018 Velocity Contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.packet; import com.velocitypowered.natives.compression.VelocityCompressor; import com.velocitypowered.natives.util.MoreByteBufUtils; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.netty.MinecraftCompressDecoder; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import java.util.List; import net.elytrium.limboapi.Settings; public class MinecraftLimitedCompressDecoder extends MinecraftCompressDecoder implements LimboCompressDecoder { private final int threshold; private final VelocityCompressor compressor; private int uncompressedCap = Settings.IMP.MAIN.MAX_PACKET_LENGTH_TO_SUPPRESS_IT; public MinecraftLimitedCompressDecoder(int threshold, VelocityCompressor compressor) { super(threshold, compressor, ProtocolUtils.Direction.SERVERBOUND); this.threshold = threshold; this.compressor = compressor; } @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) throws Exception { int claimedUncompressedSize = ProtocolUtils.readVarInt(in); if (claimedUncompressedSize == 0) { out.add(in.retain()); } else { if (claimedUncompressedSize > Settings.IMP.MAIN.MAX_SINGLE_GENERIC_PACKET_LENGTH) { ctx.close(); } else { if (claimedUncompressedSize >= this.threshold && claimedUncompressedSize <= this.uncompressedCap) { ByteBuf compatibleIn = MoreByteBufUtils.ensureCompatible(ctx.alloc(), this.compressor, in); ByteBuf uncompressed = MoreByteBufUtils.preferredBuffer(ctx.alloc(), this.compressor, claimedUncompressedSize); try { this.compressor.inflate(compatibleIn, uncompressed, claimedUncompressedSize); out.add(uncompressed); } catch (Exception e) { uncompressed.release(); throw e; } finally { compatibleIn.release(); } } } } } public void setUncompressedCap(int uncompressedCap) { this.uncompressedCap = uncompressedCap; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/packet/PreparedPacketImpl.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.packet; import com.velocitypowered.api.network.ProtocolVersion; import java.util.List; import java.util.function.Function; import net.elytrium.fastprepare.PreparedPacket; import net.elytrium.fastprepare.PreparedPacketFactory; public class PreparedPacketImpl extends PreparedPacket implements net.elytrium.limboapi.api.protocol.PreparedPacket { public PreparedPacketImpl(ProtocolVersion minVersion, ProtocolVersion maxVersion, PreparedPacketFactory factory) { super(minVersion, maxVersion, factory); } @Override public PreparedPacketImpl prepare(T packet) { return (PreparedPacketImpl) super.prepare(packet); } @Override public PreparedPacketImpl prepare(T[] packets) { return (PreparedPacketImpl) super.prepare(packets); } @Override public PreparedPacketImpl prepare(List packets) { return (PreparedPacketImpl) super.prepare(packets); } @Override public PreparedPacketImpl prepare(T packet, ProtocolVersion from) { return (PreparedPacketImpl) super.prepare(packet, from); } @Override public PreparedPacketImpl prepare(T packet, ProtocolVersion from, ProtocolVersion to) { return (PreparedPacketImpl) super.prepare(packet, from, to); } @Override public PreparedPacketImpl prepare(T[] packets, ProtocolVersion from) { return (PreparedPacketImpl) super.prepare(packets, from); } @Override public PreparedPacketImpl prepare(T[] packets, ProtocolVersion from, ProtocolVersion to) { return (PreparedPacketImpl) super.prepare(packets, from, to); } @Override public PreparedPacketImpl prepare(List packets, ProtocolVersion from) { return (PreparedPacketImpl) super.prepare(packets, from); } @Override public PreparedPacketImpl prepare(List packets, ProtocolVersion from, ProtocolVersion to) { return (PreparedPacketImpl) super.prepare(packets, from, to); } @Override public PreparedPacketImpl prepare(Function packet) { return (PreparedPacketImpl) super.prepare(packet); } @Override public PreparedPacketImpl prepare(Function packet, ProtocolVersion from) { return (PreparedPacketImpl) super.prepare(packet, from); } @Override public PreparedPacketImpl prepare(Function packet, ProtocolVersion from, ProtocolVersion to) { return (PreparedPacketImpl) super.prepare(packet, from, to); } @Override public PreparedPacketImpl build() { return (PreparedPacketImpl) super.build(); } @Override public void release() { super.release(); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/packet/RemovePlayerInfoHook.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.packet; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.backend.BackendPlaySessionHandler; import com.velocitypowered.proxy.connection.backend.VelocityServerConnection; import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.packet.RemovePlayerInfoPacket; import io.netty.util.collection.IntObjectMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.function.Supplier; import net.elytrium.commons.utils.reflection.ReflectionException; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.protocol.LimboProtocol; @SuppressWarnings("unchecked") public class RemovePlayerInfoHook extends RemovePlayerInfoPacket { private static final MethodHandle SERVER_CONN_FIELD; private final LimboAPI plugin; private RemovePlayerInfoHook(LimboAPI plugin) { this.plugin = plugin; } @Override public boolean handle(MinecraftSessionHandler handler) { if (handler instanceof BackendPlaySessionHandler) { try { ConnectedPlayer player = ((VelocityServerConnection) SERVER_CONN_FIELD.invokeExact((BackendPlaySessionHandler) handler)).getPlayer(); UUID initialID = this.plugin.getInitialID(player); if (this.getProfilesToRemove() instanceof List uuids) { for (int i = 0; i < uuids.size(); i++) { if (player.getUniqueId().equals(uuids.get(i))) { uuids.set(i, initialID); } } } } catch (Throwable e) { throw new ReflectionException(e); } } return super.handle(handler); } static { try { SERVER_CONN_FIELD = MethodHandles.privateLookupIn(BackendPlaySessionHandler.class, MethodHandles.lookup()) .findGetter(BackendPlaySessionHandler.class, "serverConn", VelocityServerConnection.class); } catch (NoSuchFieldException | IllegalAccessException e) { throw new ReflectionException(e); } } public static void init(LimboAPI plugin, StateRegistry.PacketRegistry registry) throws ReflectiveOperationException { // See LimboProtocol#overlayRegistry about var. var playProtocolRegistryVersions = (Map) LimboProtocol.VERSIONS_FIELD.get(registry); playProtocolRegistryVersions.forEach((protocolVersion, protocolRegistry) -> { try { var packetIDToSupplier = (IntObjectMap>) LimboProtocol.PACKET_ID_TO_SUPPLIER_FIELD.get(protocolRegistry); var packetClassToID = (Object2IntMap>) LimboProtocol.PACKET_CLASS_TO_ID_FIELD.get(protocolRegistry); int id = packetClassToID.getInt(RemovePlayerInfoPacket.class); packetClassToID.put(RemovePlayerInfoHook.class, id); packetIDToSupplier.put(id, () -> new RemovePlayerInfoHook(plugin)); } catch (ReflectiveOperationException e) { throw new ReflectionException(e); } }); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/packet/ServerLoginSuccessHook.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.packet; import com.velocitypowered.proxy.protocol.packet.ServerLoginSuccessPacket; import net.elytrium.fastprepare.dummy.DummyPacket; public class ServerLoginSuccessHook extends ServerLoginSuccessPacket implements DummyPacket { } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/packet/UpsertPlayerInfoHook.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.packet; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.backend.BackendPlaySessionHandler; import com.velocitypowered.proxy.connection.backend.VelocityServerConnection; import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.packet.UpsertPlayerInfoPacket; import io.netty.util.collection.IntObjectMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.function.Supplier; import net.elytrium.commons.utils.reflection.ReflectionException; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.protocol.LimboProtocol; @SuppressWarnings("unchecked") public class UpsertPlayerInfoHook extends UpsertPlayerInfoPacket { private static final MethodHandle SERVER_CONN_FIELD; private final LimboAPI plugin; private UpsertPlayerInfoHook(LimboAPI plugin) { this.plugin = plugin; } @Override public boolean handle(MinecraftSessionHandler handler) { if (handler instanceof BackendPlaySessionHandler) { try { ConnectedPlayer player = ((VelocityServerConnection) SERVER_CONN_FIELD.invokeExact((BackendPlaySessionHandler) handler)).getPlayer(); UUID initialID = this.plugin.getInitialID(player); List items = this.getEntries(); for (int i = 0; i < items.size(); ++i) { Entry item = items.get(i); if (player.getUniqueId().equals(item.getProfileId())) { Entry fixedEntry = new Entry(initialID); fixedEntry.setDisplayName(item.getDisplayName()); fixedEntry.setGameMode(item.getGameMode()); fixedEntry.setLatency(item.getLatency()); fixedEntry.setDisplayName(item.getDisplayName()); if (item.getProfile() != null && item.getProfile().getId().equals(player.getUniqueId())) { fixedEntry.setProfile(new GameProfile(initialID, item.getProfile().getName(), item.getProfile().getProperties())); } else { fixedEntry.setProfile(item.getProfile()); } fixedEntry.setListed(item.isListed()); fixedEntry.setListOrder(item.getListOrder()); fixedEntry.setChatSession(item.getChatSession()); items.set(i, fixedEntry); } } } catch (Throwable e) { throw new ReflectionException(e); } } return super.handle(handler); } static { try { SERVER_CONN_FIELD = MethodHandles.privateLookupIn(BackendPlaySessionHandler.class, MethodHandles.lookup()) .findGetter(BackendPlaySessionHandler.class, "serverConn", VelocityServerConnection.class); } catch (NoSuchFieldException | IllegalAccessException e) { throw new ReflectionException(e); } } public static void init(LimboAPI plugin, StateRegistry.PacketRegistry registry) throws ReflectiveOperationException { // See LimboProtocol#overlayRegistry about var. var playProtocolRegistryVersions = (Map) LimboProtocol.VERSIONS_FIELD.get(registry); playProtocolRegistryVersions.forEach((protocolVersion, protocolRegistry) -> { try { var packetIDToSupplier = (IntObjectMap>) LimboProtocol.PACKET_ID_TO_SUPPLIER_FIELD.get(protocolRegistry); var packetClassToID = (Object2IntMap>) LimboProtocol.PACKET_CLASS_TO_ID_FIELD.get(protocolRegistry); int id = packetClassToID.getInt(UpsertPlayerInfoPacket.class); packetClassToID.put(UpsertPlayerInfoHook.class, id); packetIDToSupplier.put(id, () -> new UpsertPlayerInfoHook(plugin)); } catch (ReflectiveOperationException e) { throw new ReflectionException(e); } }); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/tablist/RewritingKeyedVelocityTabList.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.tablist; import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.player.TabListEntry; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.tablist.KeyedVelocityTabList; import com.velocitypowered.proxy.tablist.KeyedVelocityTabListEntry; import java.util.Map; import java.util.Optional; import java.util.UUID; public class RewritingKeyedVelocityTabList extends KeyedVelocityTabList implements RewritingTabList { // To keep compatibility with other plugins that use internal fields protected final ConnectedPlayer player; protected final MinecraftConnection connection; protected final ProxyServer proxyServer; protected final Map entries; public RewritingKeyedVelocityTabList(ConnectedPlayer player, ProxyServer proxyServer) { super(player, proxyServer); this.player = super.player; this.connection = super.connection; this.proxyServer = super.proxyServer; this.entries = super.entries; } @Override public void addEntry(TabListEntry entry) { super.addEntry(this.rewriteEntry(entry)); } @Override public Optional getEntry(UUID uuid) { return super.getEntry(this.rewriteUuid(uuid)); } @Override public boolean containsEntry(UUID uuid) { return super.containsEntry(this.rewriteUuid(uuid)); } @Override public Optional removeEntry(UUID uuid) { return super.removeEntry(this.rewriteUuid(uuid)); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/tablist/RewritingTabList.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.tablist; import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.player.TabListEntry; import com.velocitypowered.api.util.GameProfile; import java.util.UUID; import net.elytrium.limboapi.LimboAPI; public interface RewritingTabList { Player getPlayer(); default TabListEntry rewriteEntry(TabListEntry entry) { if (entry == null || entry.getProfile() == null || !this.getPlayer().getUniqueId().equals(entry.getProfile().getId())) { return entry; } TabListEntry.Builder builder = TabListEntry.builder(); builder.tabList(entry.getTabList()); builder.profile(new GameProfile(this.rewriteUuid(entry.getProfile().getId()), entry.getProfile().getName(), entry.getProfile().getProperties())); builder.listed(entry.isListed()); builder.latency(entry.getLatency()); builder.gameMode(entry.getGameMode()); entry.getDisplayNameComponent().ifPresent(builder::displayName); builder.chatSession(entry.getChatSession()); builder.listOrder(entry.getListOrder()); builder.showHat(entry.isShowHat()); return builder.build(); } default UUID rewriteUuid(UUID uuid) { if (this.getPlayer().getUniqueId().equals(uuid)) { return LimboAPI.INITIAL_ID.getOrDefault(this.getPlayer(), uuid); } return uuid; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/tablist/RewritingVelocityTabList.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.tablist; import com.velocitypowered.api.proxy.player.TabListEntry; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.tablist.VelocityTabList; import com.velocitypowered.proxy.tablist.VelocityTabListEntry; import java.lang.reflect.Field; import java.util.Map; import java.util.Optional; import java.util.UUID; import java.util.function.Function; import net.elytrium.limboapi.utils.LambdaUtil; public class RewritingVelocityTabList extends VelocityTabList implements RewritingTabList { private static final Function> ENTRIES_GETTER; static { try { Field field = VelocityTabList.class.getDeclaredField("entries"); field.setAccessible(true); ENTRIES_GETTER = LambdaUtil.getterOf(field); } catch (Throwable throwable) { throw new ExceptionInInitializerError(throwable); } } // To keep compatibility with other plugins that use internal fields private final ConnectedPlayer player; private final MinecraftConnection connection; private final Map entries; public RewritingVelocityTabList(ConnectedPlayer player) { super(player); try { this.player = player; this.connection = player.getConnection(); this.entries = ENTRIES_GETTER.apply(this); } catch (Throwable e) { throw new IllegalStateException(e); } } @Override public void addEntry(TabListEntry entry) { super.addEntry(this.rewriteEntry(entry)); } @Override public Optional getEntry(UUID uuid) { return super.getEntry(this.rewriteUuid(uuid)); } @Override public boolean containsEntry(UUID uuid) { return super.containsEntry(this.rewriteUuid(uuid)); } @Override public Optional removeEntry(UUID uuid) { return super.removeEntry(this.rewriteUuid(uuid)); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/injection/tablist/RewritingVelocityTabListLegacy.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.injection.tablist; import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.player.TabListEntry; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.tablist.KeyedVelocityTabListEntry; import com.velocitypowered.proxy.tablist.VelocityTabListLegacy; import java.util.Map; import java.util.Optional; import java.util.UUID; public class RewritingVelocityTabListLegacy extends VelocityTabListLegacy implements RewritingTabList { // To keep compatibility with other plugins that use internal fields protected final ConnectedPlayer player; protected final MinecraftConnection connection; protected final ProxyServer proxyServer; protected final Map entries; public RewritingVelocityTabListLegacy(ConnectedPlayer player, ProxyServer proxyServer) { super(player, proxyServer); this.player = super.player; this.connection = super.connection; this.proxyServer = super.proxyServer; this.entries = super.entries; } @Override public void addEntry(TabListEntry entry) { super.addEntry(this.rewriteEntry(entry)); } @Override public Optional getEntry(UUID uuid) { return super.getEntry(this.rewriteUuid(uuid)); } @Override public boolean containsEntry(UUID uuid) { return super.containsEntry(this.rewriteUuid(uuid)); } @Override public Optional removeEntry(UUID uuid) { return super.removeEntry(this.rewriteUuid(uuid)); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/material/Biome.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.material; import com.velocitypowered.api.network.ProtocolVersion; import java.util.Arrays; import java.util.EnumMap; import java.util.stream.Collectors; import net.elytrium.limboapi.api.chunk.BuiltInBiome; import net.elytrium.limboapi.api.chunk.VirtualBiome; import net.elytrium.limboapi.material.Biome.Effects.MoodSound; import net.kyori.adventure.nbt.CompoundBinaryTag; import net.kyori.adventure.nbt.CompoundBinaryTag.Builder; import net.kyori.adventure.nbt.ListBinaryTag; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; public enum Biome implements VirtualBiome { PLAINS( BuiltInBiome.PLAINS, "minecraft:plains", 1, new Element( true, 0.125F, 0.8F, 0.05F, 0.4F, "plains", Effects.builder(7907327, 329011, 12638463, 415920) .moodSound(MoodSound.of(6000, 2.0, 8, "minecraft:ambient.cave")) .build() ) ), SWAMP( BuiltInBiome.SWAMP, "minecraft:swamp", 6, new Element( true, -0.2F, 0.8F, 0.1F, 0.9F, "swamp", Effects.builder(7907327, 329011, 12638463, 415920) .grassColorModifier("swamp") .foliageColor(6975545) .moodSound(MoodSound.of(6000, 2.0, 8, "minecraft:ambient.cave")) .build() ) ), SWAMP_HILLS( BuiltInBiome.SWAMP_HILLS, "minecraft:swamp_hills", 134, new Element( true, -0.1F, 0.8F, 0.3F, 0.9F, "swamp", Effects.builder(7907327, 329011, 12638463, 415920) .grassColorModifier("swamp") .foliageColor(6975545) .moodSound(MoodSound.of(6000, 2.0, 8, "minecraft:ambient.cave")) .build() ) ), NETHER_WASTES( BuiltInBiome.NETHER_WASTES, "minecraft:nether_wastes", 8, new Element(false, 0.1f, 2.0f, 0.2f, 0.0f, "nether", Effects.builder(7254527, 329011, 3344392, 4159204) .moodSound(MoodSound.of(6000, 2.0, 8, "minecraft:ambient.nether_wastes.mood")) .build() ) ), THE_END( BuiltInBiome.THE_END, "minecraft:the_end", 9, new Element(false, 0.1f, 0.5f, 0.2f, 0.5f, "the_end", Effects.builder(0, 10518688, 12638463, 4159204) .moodSound(MoodSound.of(6000, 2.0, 8, "minecraft:ambient.cave")) .build() ) ); private static final EnumMap BUILT_IN_BIOME_MAP = new EnumMap<>(BuiltInBiome.class); private final BuiltInBiome index; private final String name; private final int id; private final Element element; Biome(BuiltInBiome index, String name, int id, Element element) { this.index = index; this.name = name; this.id = id; this.element = element; } public CompoundBinaryTag encodeBiome(ProtocolVersion version) { return CompoundBinaryTag.builder() .putString("name", this.name) .putInt("id", this.id) .put("element", this.element.encode(version)) .build(); } @Override public String getName() { return this.name; } @Override public int getID() { return this.id; } public Element getElement() { return this.element; } static { for (Biome biome : Biome.values()) { BUILT_IN_BIOME_MAP.put(biome.index, biome); } } public static Biome of(BuiltInBiome index) { return BUILT_IN_BIOME_MAP.get(index); } public static CompoundBinaryTag getRegistry(ProtocolVersion version) { return CompoundBinaryTag.builder() .putString("type", "minecraft:worldgen/biome") .put("value", ListBinaryTag.from(Arrays.stream(Biome.values()).map(biome -> biome.encodeBiome(version)).collect(Collectors.toList()))) .build(); } public static class Element { public final boolean hasPrecipitation; public final float depth; public final float temperature; public final float scale; public final float downfall; public final String category; public final Effects effects; public Element(boolean hasPrecipitation, float depth, float temperature, float scale, float downfall, String category, Effects effects) { this.hasPrecipitation = hasPrecipitation; this.depth = depth; this.temperature = temperature; this.scale = scale; this.downfall = downfall; this.category = category; this.effects = effects; } public CompoundBinaryTag encode(ProtocolVersion version) { CompoundBinaryTag.Builder tagBuilder = CompoundBinaryTag.builder() .putFloat("depth", this.depth) .putFloat("temperature", this.temperature) .putFloat("scale", this.scale) .putFloat("downfall", this.downfall) .putString("category", this.category) .put("effects", this.effects.encode()); if (version.compareTo(ProtocolVersion.MINECRAFT_1_19_4) < 0) { tagBuilder.putString("precipitation", this.hasPrecipitation ? "rain" : "none"); } else { tagBuilder.putBoolean("has_precipitation", this.hasPrecipitation); } return tagBuilder.build(); } public boolean hasPrecipitation() { return this.hasPrecipitation; } public float getDepth() { return this.depth; } public float getTemperature() { return this.temperature; } public float getScale() { return this.scale; } public float getDownfall() { return this.downfall; } public String getCategory() { return this.category; } public Effects getEffects() { return this.effects; } @Override public String toString() { return "Biome.Element{" + "hasPrecipitation=" + this.hasPrecipitation + ", depth=" + this.depth + ", temperature=" + this.temperature + ", scale=" + this.scale + ", downfall=" + this.downfall + ", category=" + this.category + ", effects=" + this.effects + "}"; } } public static class Effects { private final int skyColor; private final int waterFogColor; private final int fogColor; private final int waterColor; @Nullable private final Integer foliageColor; @Nullable private final String grassColorModifier; @Nullable private final Music music; @Nullable private final String ambientSound; @Nullable private final AdditionsSound additionsSound; @Nullable private final MoodSound moodSound; @Nullable private final Particle particle; public Effects(int skyColor, int waterFogColor, int fogColor, int waterColor, @Nullable Integer foliageColor, @Nullable String grassColorModifier, @Nullable Music music, @Nullable String ambientSound, @Nullable AdditionsSound additionsSound, @Nullable MoodSound moodSound, @Nullable Particle particle) { this.skyColor = skyColor; this.waterFogColor = waterFogColor; this.fogColor = fogColor; this.waterColor = waterColor; this.foliageColor = foliageColor; this.grassColorModifier = grassColorModifier; this.music = music; this.ambientSound = ambientSound; this.additionsSound = additionsSound; this.moodSound = moodSound; this.particle = particle; } public CompoundBinaryTag encode() { Builder result = CompoundBinaryTag.builder(); result.putInt("sky_color", this.skyColor); result.putInt("water_fog_color", this.waterColor); result.putInt("fog_color", this.fogColor); result.putInt("water_color", this.waterColor); if (this.foliageColor != null) { result.putInt("foliage_color", this.foliageColor); } if (this.grassColorModifier != null) { result.putString("grass_color_modifier", this.grassColorModifier); } if (this.music != null) { result.put("music", this.music.encode()); } if (this.ambientSound != null) { result.putString("ambient_sound", this.ambientSound); } if (this.additionsSound != null) { result.put("additions_sound", this.additionsSound.encode()); } if (this.moodSound != null) { result.put("mood_sound", this.moodSound.encode()); } if (this.particle != null) { result.put("particle", this.particle.encode()); } return result.build(); } public static EffectsBuilder builder(int skyColor, int waterFogColor, int fogColor, int waterColor) { return new EffectsBuilder() .skyColor(skyColor) .waterFogColor(waterFogColor) .fogColor(fogColor) .waterColor(waterColor); } public int getSkyColor() { return this.skyColor; } public int getWaterFogColor() { return this.waterFogColor; } public int getFogColor() { return this.fogColor; } public int getWaterColor() { return this.waterColor; } @Nullable public Integer getFoliageColor() { return this.foliageColor; } @Nullable public String getGrassColorModifier() { return this.grassColorModifier; } @Nullable public Music getMusic() { return this.music; } @Nullable public String getAmbientSound() { return this.ambientSound; } @Nullable public AdditionsSound getAdditionsSound() { return this.additionsSound; } @Nullable public MoodSound getMoodSound() { return this.moodSound; } @Nullable public Particle getParticle() { return this.particle; } @Override public String toString() { return "Biome.Effects{" + "skyColor=" + this.skyColor + ", waterFogColor=" + this.waterFogColor + ", fogColor=" + this.fogColor + ", waterColor=" + this.waterColor + ", foliageColor=" + this.foliageColor + ", grassColorModifier=" + this.grassColorModifier + ", music=" + this.music + ", ambientSound=" + this.ambientSound + ", additionsSound=" + this.additionsSound + ", moodSound=" + this.moodSound + ", particle=" + this.particle + "}"; } public static final class MoodSound { private final int tickDelay; private final double offset; private final int blockSearchExtent; @NonNull private final String sound; private MoodSound(int tickDelay, double offset, int blockSearchExtent, @NonNull String sound) { this.tickDelay = tickDelay; this.offset = offset; this.blockSearchExtent = blockSearchExtent; this.sound = sound; } public static MoodSound of(int tickDelay, double offset, int blockSearchExtent, @NonNull String sound) { return new MoodSound(tickDelay, offset, blockSearchExtent, sound); } public CompoundBinaryTag encode() { return CompoundBinaryTag.builder() .putInt("tick_delay", this.tickDelay) .putDouble("offset", this.offset) .putInt("block_search_extent", this.blockSearchExtent) .putString("sound", this.sound) .build(); } public int getTickDelay() { return this.tickDelay; } public double getOffset() { return this.offset; } public int getBlockSearchExtent() { return this.blockSearchExtent; } @NonNull public String getSound() { return this.sound; } @Override public String toString() { return "Biome.Effects.MoodSound{" + "tickDelay=" + this.tickDelay + ", offset=" + this.offset + ", blockSearchExtent=" + this.blockSearchExtent + ", sound=" + this.sound + "}"; } } public static final class Music { private final boolean replaceCurrentMusic; @NonNull private final String sound; private final int maxDelay; private final int minDelay; private Music(boolean replaceCurrentMusic, @NonNull String sound, int maxDelay, int minDelay) { this.replaceCurrentMusic = replaceCurrentMusic; this.sound = sound; this.maxDelay = maxDelay; this.minDelay = minDelay; } public static Music of(boolean replaceCurrentMusic, @NonNull String sound, int maxDelay, int minDelay) { return new Music(replaceCurrentMusic, sound, maxDelay, minDelay); } public CompoundBinaryTag encode() { return CompoundBinaryTag.builder() .putBoolean("replace_current_music", this.replaceCurrentMusic) .putString("sound", this.sound) .putInt("max_delay", this.maxDelay) .putInt("min_delay", this.minDelay) .build(); } public boolean isReplaceCurrentMusic() { return this.replaceCurrentMusic; } @NonNull public String getSound() { return this.sound; } public int getMaxDelay() { return this.maxDelay; } public int getMinDelay() { return this.minDelay; } @Override public String toString() { return "Biome.Effects.Music{" + "replaceCurrentMusic=" + this.replaceCurrentMusic + ", sound=" + this.sound + ", maxDelay=" + this.maxDelay + ", minDelay=" + this.minDelay + "}"; } } public static final class AdditionsSound { @NonNull private final String sound; private final double tickChance; private AdditionsSound(@NonNull String sound, double tickChance) { this.sound = sound; this.tickChance = tickChance; } public static AdditionsSound of(@NonNull String sound, double tickChance) { return new AdditionsSound(sound, tickChance); } public CompoundBinaryTag encode() { return CompoundBinaryTag.builder() .putString("sound", this.sound) .putDouble("tick_chance", this.tickChance) .build(); } @NonNull public String getSound() { return this.sound; } public double getTickChance() { return this.tickChance; } @Override public String toString() { return "Biome.Effects.AdditionsSound{" + "sound=" + this.sound + ", tickChance=" + this.tickChance + "}"; } } public static final class Particle { private final float probability; @NonNull private final ParticleOptions options; private Particle(float probability, @NonNull ParticleOptions options) { this.probability = probability; this.options = options; } public static Particle of(float probability, @NonNull ParticleOptions options) { return new Particle(probability, options); } public CompoundBinaryTag encode() { return CompoundBinaryTag.builder() .putFloat("probability", this.probability) .put("options", this.options.encode()) .build(); } public float getProbability() { return this.probability; } @NonNull public ParticleOptions getOptions() { return this.options; } @Override public String toString() { return "Biome.Effects.Particle{" + "probability=" + this.probability + ", options=" + this.options + "}"; } public static class ParticleOptions { @NonNull private final String type; public ParticleOptions(@NonNull String type) { this.type = type; } public CompoundBinaryTag encode() { return CompoundBinaryTag.builder() .putString("type", this.type) .build(); } @NonNull public String getType() { return this.type; } @Override public String toString() { return "Biome.Effects.Particle.ParticleOptions{" + "type=" + this.type + "}"; } } } public static class EffectsBuilder { private int skyColor; private int waterFogColor; private int fogColor; private int waterColor; private Integer foliageColor; private String grassColorModifier; private Music music; private String ambientSound; private AdditionsSound additionsSound; private MoodSound moodSound; private Particle particle; public EffectsBuilder skyColor(int skyColor) { this.skyColor = skyColor; return this; } public EffectsBuilder waterFogColor(int waterFogColor) { this.waterFogColor = waterFogColor; return this; } public EffectsBuilder fogColor(int fogColor) { this.fogColor = fogColor; return this; } public EffectsBuilder waterColor(int waterColor) { this.waterColor = waterColor; return this; } public EffectsBuilder foliageColor(Integer foliageColor) { this.foliageColor = foliageColor; return this; } public EffectsBuilder grassColorModifier(String grassColorModifier) { this.grassColorModifier = grassColorModifier; return this; } public EffectsBuilder music(Music music) { this.music = music; return this; } public EffectsBuilder ambientSound(String ambientSound) { this.ambientSound = ambientSound; return this; } public EffectsBuilder additionsSound(AdditionsSound additionsSound) { this.additionsSound = additionsSound; return this; } public EffectsBuilder moodSound(MoodSound moodSound) { this.moodSound = moodSound; return this; } public EffectsBuilder particle(Particle particle) { this.particle = particle; return this; } public Effects build() { return new Effects( this.skyColor, this.waterFogColor, this.fogColor, this.waterColor, this.foliageColor, this.grassColorModifier, this.music, this.ambientSound, this.additionsSound, this.moodSound, this.particle ); } @Override public String toString() { return "Biome.Effects.EffectsBuilder{" + "skyColor=" + this.skyColor + ", waterFogColor=" + this.waterFogColor + ", fogColor=" + this.fogColor + ", waterColor=" + this.waterColor + ", foliageColor=" + this.foliageColor + ", grassColorModifier=" + this.grassColorModifier + ", music=" + this.music + ", ambientSound=" + this.ambientSound + ", additionsSound=" + this.additionsSound + ", moodSound=" + this.moodSound + ", particle=" + this.particle + "}"; } } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/mcprotocollib/BitStorage116.java ================================================ /* * This file is part of MCProtocolLib, licensed under the MIT License (MIT). * * Copyright (C) 2013-2021 Steveice10 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE * OR OTHER DEALINGS IN THE SOFTWARE. */ package net.elytrium.limboapi.mcprotocollib; import com.google.common.base.Preconditions; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import java.util.Arrays; import net.elytrium.limboapi.api.chunk.util.CompactStorage; public class BitStorage116 implements CompactStorage { private static final int[] MAGIC_VALUES = { -1, -1, 0, Integer.MIN_VALUE, 0, 0, 1431655765, 1431655765, 0, Integer.MIN_VALUE, 0, 1, 858993459, 858993459, 0, 715827882, 715827882, 0, 613566756, 613566756, 0, Integer.MIN_VALUE, 0, 2, 477218588, 477218588, 0, 429496729, 429496729, 0, 390451572, 390451572, 0, 357913941, 357913941, 0, 330382099, 330382099, 0, 306783378, 306783378, 0, 286331153, 286331153, 0, Integer.MIN_VALUE, 0, 3, 252645135, 252645135, 0, 238609294, 238609294, 0, 226050910, 226050910, 0, 214748364, 214748364, 0, 204522252, 204522252, 0, 195225786, 195225786, 0, 186737708, 186737708, 0, 178956970, 178956970, 0, 171798691, 171798691, 0, 165191049, 165191049, 0, 159072862, 159072862, 0, 153391689, 153391689, 0, 148102320, 148102320, 0, 143165576, 143165576, 0, 138547332, 138547332, 0, Integer.MIN_VALUE, 0, 4, 130150524, 130150524, 0, 126322567, 126322567, 0, 122713351, 122713351, 0, 119304647, 119304647, 0, 116080197, 116080197, 0, 113025455, 113025455, 0, 110127366, 110127366, 0, 107374182, 107374182, 0, 104755299, 104755299, 0, 102261126, 102261126, 0, 99882960, 99882960, 0, 97612893, 97612893, 0, 95443717, 95443717, 0, 93368854, 93368854, 0, 91382282, 91382282, 0, 89478485, 89478485, 0, 87652393, 87652393, 0, 85899345, 85899345, 0, 84215045, 84215045, 0, 82595524, 82595524, 0, 81037118, 81037118, 0, 79536431, 79536431, 0, 78090314, 78090314, 0, 76695844, 76695844, 0, 75350303, 75350303, 0, 74051160, 74051160, 0, 72796055, 72796055, 0, 71582788, 71582788, 0, 70409299, 70409299, 0, 69273666, 69273666, 0, 68174084, 68174084, 0, Integer.MIN_VALUE, 0, 5 }; private final long[] data; private final int bitsPerEntry; private final int size; private final long maxValue; private final int valuesPerLong; private final long divideMultiply; private final long divideAdd; private final int divideShift; public BitStorage116(int bitsPerEntry, int size) { this(bitsPerEntry, size, null); } public BitStorage116(int bitsPerEntry, int size, long[] data) { if (bitsPerEntry < 1 || bitsPerEntry > 32) { throw new IllegalArgumentException("bitsPerEntry must be between 1 and 32, inclusive."); } this.bitsPerEntry = bitsPerEntry; this.size = size; this.maxValue = (1L << bitsPerEntry) - 1L; this.valuesPerLong = (char) (64 / bitsPerEntry); int expectedLength = (size + this.valuesPerLong - 1) / this.valuesPerLong; if (data != null) { if (data.length != expectedLength) { throw new IllegalArgumentException("Expected " + expectedLength + " longs but got " + data.length + " longs"); } this.data = Arrays.copyOf(data, data.length); } else { this.data = new long[expectedLength]; } int magicIndex = 3 * (this.valuesPerLong - 1); this.divideMultiply = Integer.toUnsignedLong(MAGIC_VALUES[magicIndex]); this.divideAdd = Integer.toUnsignedLong(MAGIC_VALUES[magicIndex + 1]); this.divideShift = MAGIC_VALUES[magicIndex + 2]; } @Override public void set(int index, int value) { if (index < 0 || index > this.size - 1) { throw new IndexOutOfBoundsException(); } else if (value < 0 || value > this.maxValue) { throw new IllegalArgumentException("Value cannot be outside of accepted range."); } else { int cellIndex = this.cellIndex(index); int bitIndex = this.bitIndex(index, cellIndex); this.data[cellIndex] = this.data[cellIndex] & ~(this.maxValue << bitIndex) | ((long) value & this.maxValue) << bitIndex; } } @Override public int get(int index) { if (index < 0 || index > this.size - 1) { throw new IndexOutOfBoundsException(); } else { int cellIndex = this.cellIndex(index); int bitIndex = this.bitIndex(index, cellIndex); return (int) (this.data[cellIndex] >> bitIndex & this.maxValue); } } @Override public void write(Object byteBufObject, ProtocolVersion version) { Preconditions.checkArgument(byteBufObject instanceof ByteBuf); ByteBuf buf = (ByteBuf) byteBufObject; if (version.compareTo(ProtocolVersion.MINECRAFT_1_21_5) < 0) { ProtocolUtils.writeVarInt(buf, this.data.length); } for (long l : this.data) { buf.writeLong(l); } } @Override public int getBitsPerEntry() { return this.bitsPerEntry; } @Override public int getDataLength(ProtocolVersion version) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_21_5) >= 0) { return this.data.length * 8; } return ProtocolUtils.varIntBytes(this.data.length) + this.data.length * 8; } @Override public long[] getData() { return this.data; } @Override public CompactStorage copy() { return new BitStorage116(this.bitsPerEntry, this.size, Arrays.copyOf(this.data, this.data.length)); } private int cellIndex(int index) { return (int) (index * this.divideMultiply + this.divideAdd >> 32 >> this.divideShift); } private int bitIndex(int index, int cellIndex) { return (index - cellIndex * this.valuesPerLong) * this.bitsPerEntry; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/mcprotocollib/BitStorage19.java ================================================ /* * This file is part of MCProtocolLib, licensed under the MIT License (MIT). * * Copyright (C) 2013-2021 Steveice10 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE * OR OTHER DEALINGS IN THE SOFTWARE. */ package net.elytrium.limboapi.mcprotocollib; import com.google.common.base.Preconditions; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import java.util.Arrays; import net.elytrium.limboapi.api.chunk.util.CompactStorage; public class BitStorage19 implements CompactStorage { private final long[] data; private final int bitsPerEntry; private final int size; private final long maxEntryValue; public BitStorage19(int bitsPerEntry, int size) { this(bitsPerEntry, new long[((size * bitsPerEntry - 1) >> 6) + 1]); } public BitStorage19(int bitsPerEntry, long[] data) { if (bitsPerEntry < 4) { bitsPerEntry = 4; } this.bitsPerEntry = bitsPerEntry; this.data = data; this.size = (this.data.length << 6) / this.bitsPerEntry; this.maxEntryValue = (1L << this.bitsPerEntry) - 1; } @Override public void set(int index, int value) { if (index < 0 || index > this.size - 1) { throw new IndexOutOfBoundsException(); } else if (value < 0 || value > this.maxEntryValue) { throw new IllegalArgumentException("Value cannot be outside of accepted range."); } else { int bitIndex = index * this.bitsPerEntry; int startIndex = bitIndex >> 6; int endIndex = ((index + 1) * this.bitsPerEntry - 1) >> 6; int startBitSubIndex = bitIndex & 63; this.data[startIndex] = this.data[startIndex] & ~(this.maxEntryValue << startBitSubIndex) | ((long) value & this.maxEntryValue) << startBitSubIndex; if (startIndex != endIndex) { int endBitSubIndex = 64 - startBitSubIndex; this.data[endIndex] = this.data[endIndex] >>> endBitSubIndex << endBitSubIndex | ((long) value & this.maxEntryValue) >> endBitSubIndex; } } } @Override public int get(int index) { if (index < 0 || index > this.size - 1) { throw new IndexOutOfBoundsException(); } else { int bitIndex = index * this.bitsPerEntry; int startIndex = bitIndex >> 6; int endIndex = ((index + 1) * this.bitsPerEntry - 1) >> 6; int startBitSubIndex = bitIndex & 63; if (startIndex == endIndex) { return (int) (this.data[startIndex] >>> startBitSubIndex & this.maxEntryValue); } else { int endBitSubIndex = 64 - startBitSubIndex; return (int) ((this.data[startIndex] >>> startBitSubIndex | this.data[endIndex] << endBitSubIndex) & this.maxEntryValue); } } } @Override public void write(Object byteBufObject, ProtocolVersion version) { Preconditions.checkArgument(byteBufObject instanceof ByteBuf); ByteBuf buf = (ByteBuf) byteBufObject; ProtocolUtils.writeVarInt(buf, this.data.length); for (long l : this.data) { buf.writeLong(l); } } @Override public int getBitsPerEntry() { return this.bitsPerEntry; } @Override public int getDataLength(ProtocolVersion version) { return ProtocolUtils.varIntBytes(this.data.length) + this.data.length * 8; } @Override public long[] getData() { return this.data; } @Override public CompactStorage copy() { return new BitStorage19(this.bitsPerEntry, Arrays.copyOf(this.data, this.data.length)); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/LimboProtocol.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.StateRegistry; import io.netty.util.collection.IntObjectHashMap; import io.netty.util.collection.IntObjectMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.lang.reflect.Field; import java.util.Arrays; import java.util.Collections; import java.util.EnumMap; import java.util.List; import java.util.Map; import java.util.function.Supplier; import java.util.stream.Stream; import net.elytrium.commons.utils.reflection.ReflectionException; import net.elytrium.limboapi.api.protocol.PacketDirection; import net.elytrium.limboapi.api.protocol.packets.PacketMapping; import net.elytrium.limboapi.api.utils.OverlayMap; import net.elytrium.limboapi.protocol.packets.c2s.MoveOnGroundOnlyPacket; import net.elytrium.limboapi.protocol.packets.c2s.MovePacket; import net.elytrium.limboapi.protocol.packets.c2s.MovePositionOnlyPacket; import net.elytrium.limboapi.protocol.packets.c2s.MoveRotationOnlyPacket; import net.elytrium.limboapi.protocol.packets.c2s.PlayerChatSessionPacket; import net.elytrium.limboapi.protocol.packets.c2s.TeleportConfirmPacket; import net.elytrium.limboapi.protocol.packets.s2c.ChangeGameStatePacket; import net.elytrium.limboapi.protocol.packets.s2c.ChunkDataPacket; import net.elytrium.limboapi.protocol.packets.s2c.ChunkUnloadPacket; import net.elytrium.limboapi.protocol.packets.s2c.DefaultSpawnPositionPacket; import net.elytrium.limboapi.protocol.packets.s2c.MapDataPacket; import net.elytrium.limboapi.protocol.packets.s2c.PlayerAbilitiesPacket; import net.elytrium.limboapi.protocol.packets.s2c.PositionRotationPacket; import net.elytrium.limboapi.protocol.packets.s2c.SetExperiencePacket; import net.elytrium.limboapi.protocol.packets.s2c.SetSlotPacket; import net.elytrium.limboapi.protocol.packets.s2c.TimeUpdatePacket; import net.elytrium.limboapi.protocol.packets.s2c.UpdateTagsPacket; import net.elytrium.limboapi.protocol.packets.s2c.UpdateViewPositionPacket; import net.elytrium.limboapi.utils.OverlayIntObjectMap; import net.elytrium.limboapi.utils.OverlayObject2IntMap; import sun.misc.Unsafe; @SuppressWarnings("unchecked") public class LimboProtocol { private static final StateRegistry LIMBO_STATE_REGISTRY; private static final MethodHandle REGISTER_METHOD; private static final MethodHandle PACKET_MAPPING_CONSTRUCTOR; private static final Unsafe UNSAFE; public static final String READ_TIMEOUT = "limboapi-read-timeout"; public static final MethodHandle VERSIONS_GETTER; public static final Field VERSIONS_FIELD; public static final MethodHandle PACKET_ID_TO_SUPPLIER_GETTER; public static final Field PACKET_ID_TO_SUPPLIER_FIELD; public static final MethodHandle PACKET_CLASS_TO_ID_GETTER; public static final Field PACKET_CLASS_TO_ID_FIELD; public static final StateRegistry.PacketRegistry PLAY_CLIENTBOUND_REGISTRY; public static final StateRegistry.PacketRegistry PLAY_SERVERBOUND_REGISTRY; public static final StateRegistry.PacketRegistry LIMBO_CLIENTBOUND_REGISTRY; public static final StateRegistry.PacketRegistry LIMBO_SERVERBOUND_REGISTRY; public static final MethodHandle SERVERBOUND_REGISTRY_GETTER; public static final MethodHandle CLIENTBOUND_REGISTRY_GETTER; static { try { Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe"); unsafeField.setAccessible(true); UNSAFE = (Unsafe) unsafeField.get(null); LIMBO_STATE_REGISTRY = (StateRegistry) UNSAFE.allocateInstance(StateRegistry.class); VERSIONS_GETTER = MethodHandles.privateLookupIn(StateRegistry.PacketRegistry.class, MethodHandles.lookup()) .findGetter(StateRegistry.PacketRegistry.class, "versions", Map.class); VERSIONS_FIELD = StateRegistry.PacketRegistry.class.getDeclaredField("versions"); VERSIONS_FIELD.setAccessible(true); PACKET_ID_TO_SUPPLIER_GETTER = MethodHandles.privateLookupIn(StateRegistry.PacketRegistry.ProtocolRegistry.class, MethodHandles.lookup()) .findGetter(StateRegistry.PacketRegistry.ProtocolRegistry.class, "packetIdToSupplier", IntObjectMap.class); PACKET_ID_TO_SUPPLIER_FIELD = StateRegistry.PacketRegistry.ProtocolRegistry.class.getDeclaredField("packetIdToSupplier"); PACKET_ID_TO_SUPPLIER_FIELD.setAccessible(true); PACKET_CLASS_TO_ID_GETTER = MethodHandles.privateLookupIn(StateRegistry.PacketRegistry.ProtocolRegistry.class, MethodHandles.lookup()) .findGetter(StateRegistry.PacketRegistry.ProtocolRegistry.class, "packetClassToId", Object2IntMap.class); PACKET_CLASS_TO_ID_FIELD = StateRegistry.PacketRegistry.ProtocolRegistry.class.getDeclaredField("packetClassToId"); PACKET_CLASS_TO_ID_FIELD.setAccessible(true); CLIENTBOUND_REGISTRY_GETTER = MethodHandles.privateLookupIn(StateRegistry.class, MethodHandles.lookup()) .findGetter(StateRegistry.class, "clientbound", StateRegistry.PacketRegistry.class); SERVERBOUND_REGISTRY_GETTER = MethodHandles.privateLookupIn(StateRegistry.class, MethodHandles.lookup()) .findGetter(StateRegistry.class, "serverbound", StateRegistry.PacketRegistry.class); PLAY_CLIENTBOUND_REGISTRY = (StateRegistry.PacketRegistry) CLIENTBOUND_REGISTRY_GETTER.invokeExact(StateRegistry.PLAY); PLAY_SERVERBOUND_REGISTRY = (StateRegistry.PacketRegistry) SERVERBOUND_REGISTRY_GETTER.invokeExact(StateRegistry.PLAY); overlayRegistry(LIMBO_STATE_REGISTRY, "clientbound", PLAY_CLIENTBOUND_REGISTRY); overlayRegistry(LIMBO_STATE_REGISTRY, "serverbound", PLAY_SERVERBOUND_REGISTRY); LIMBO_CLIENTBOUND_REGISTRY = (StateRegistry.PacketRegistry) CLIENTBOUND_REGISTRY_GETTER.invokeExact(LIMBO_STATE_REGISTRY); LIMBO_SERVERBOUND_REGISTRY = (StateRegistry.PacketRegistry) SERVERBOUND_REGISTRY_GETTER.invokeExact(LIMBO_STATE_REGISTRY); REGISTER_METHOD = MethodHandles.privateLookupIn(StateRegistry.PacketRegistry.class, MethodHandles.lookup()) .findVirtual(StateRegistry.PacketRegistry.class, "register", MethodType.methodType(void.class, Class.class, Supplier.class, StateRegistry.PacketMapping[].class)); PACKET_MAPPING_CONSTRUCTOR = MethodHandles.privateLookupIn(StateRegistry.PacketRegistry.class, MethodHandles.lookup()) .findConstructor(StateRegistry.PacketMapping.class, MethodType.methodType(void.class, int.class, ProtocolVersion.class, ProtocolVersion.class, boolean.class)); } catch (Throwable e) { throw new ReflectionException(e); } } private static void overlayRegistry(StateRegistry stateRegistry, String registryName, StateRegistry.PacketRegistry playRegistry) throws Throwable { StateRegistry.PacketRegistry registry = (StateRegistry.PacketRegistry) UNSAFE.allocateInstance(StateRegistry.PacketRegistry.class); Field directionField = StateRegistry.PacketRegistry.class.getDeclaredField("direction"); directionField.setAccessible(true); directionField.set(registry, directionField.get(playRegistry)); Field versionField = StateRegistry.PacketRegistry.ProtocolRegistry.class.getDeclaredField("version"); versionField.setAccessible(true); // Overlay packets from PLAY state registry. // P.S. I hate it when someone uses var in code, but there I had no choice. var playProtocolRegistryVersions = (Map) VERSIONS_GETTER.invokeExact(playRegistry); Map versions = new EnumMap<>(ProtocolVersion.class); for (ProtocolVersion version : ProtocolVersion.values()) { if (!version.isLegacy() && !version.isUnknown()) { StateRegistry.PacketRegistry.ProtocolRegistry playProtoRegistry = playProtocolRegistryVersions.get(version); var protoRegistry = (StateRegistry.PacketRegistry.ProtocolRegistry) UNSAFE.allocateInstance(StateRegistry.PacketRegistry.ProtocolRegistry.class); versionField.set(protoRegistry, version); var playPacketIDToSupplier = (IntObjectMap>) PACKET_ID_TO_SUPPLIER_GETTER.invokeExact(playProtoRegistry); PACKET_ID_TO_SUPPLIER_FIELD.set(protoRegistry, new OverlayIntObjectMap<>(playPacketIDToSupplier, new IntObjectHashMap<>(16, 0.5F))); var playPacketClassToID = (Object2IntMap>) PACKET_CLASS_TO_ID_GETTER.invokeExact(playProtoRegistry); Object2IntMap> packetClassToID = new Object2IntOpenHashMap<>(16, 0.5F); packetClassToID.defaultReturnValue(playPacketClassToID.defaultReturnValue()); PACKET_CLASS_TO_ID_FIELD.set(protoRegistry, new OverlayObject2IntMap<>(playPacketClassToID, packetClassToID)); versions.put(version, protoRegistry); } } VERSIONS_FIELD.set(registry, Collections.unmodifiableMap(versions)); Field fallbackField = StateRegistry.PacketRegistry.class.getDeclaredField("fallback"); fallbackField.setAccessible(true); fallbackField.set(registry, false); Field registryField = StateRegistry.class.getDeclaredField(registryName); registryField.setAccessible(true); registryField.set(stateRegistry, registry); } public static void init() throws Throwable { register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND, ChangeGameStatePacket.class, ChangeGameStatePacket::new, createMapping(0x2B, ProtocolVersion.MINECRAFT_1_7_2, true), createMapping(0x1E, ProtocolVersion.MINECRAFT_1_9, true), createMapping(0x20, ProtocolVersion.MINECRAFT_1_13, true), createMapping(0x1E, ProtocolVersion.MINECRAFT_1_14, true), createMapping(0x1F, ProtocolVersion.MINECRAFT_1_15, true), createMapping(0x1E, ProtocolVersion.MINECRAFT_1_16, true), createMapping(0x1D, ProtocolVersion.MINECRAFT_1_16_2, true), createMapping(0x1E, ProtocolVersion.MINECRAFT_1_17, true), createMapping(0x1B, ProtocolVersion.MINECRAFT_1_19, true), createMapping(0x1D, ProtocolVersion.MINECRAFT_1_19_1, true), createMapping(0x1C, ProtocolVersion.MINECRAFT_1_19_3, true), createMapping(0x1F, ProtocolVersion.MINECRAFT_1_19_4, true), createMapping(0x20, ProtocolVersion.MINECRAFT_1_20_2, true), createMapping(0x22, ProtocolVersion.MINECRAFT_1_20_5, true), createMapping(0x23, ProtocolVersion.MINECRAFT_1_21_2, true), createMapping(0x22, ProtocolVersion.MINECRAFT_1_21_5, true), createMapping(0x26, ProtocolVersion.MINECRAFT_1_21_9, true) ); register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND, ChunkDataPacket.class, ChunkDataPacket::new, createMapping(0x21, ProtocolVersion.MINECRAFT_1_7_2, true), createMapping(0x20, ProtocolVersion.MINECRAFT_1_9, true), createMapping(0x22, ProtocolVersion.MINECRAFT_1_13, true), createMapping(0x21, ProtocolVersion.MINECRAFT_1_14, true), createMapping(0x22, ProtocolVersion.MINECRAFT_1_15, true), createMapping(0x21, ProtocolVersion.MINECRAFT_1_16, true), createMapping(0x20, ProtocolVersion.MINECRAFT_1_16_2, true), createMapping(0x22, ProtocolVersion.MINECRAFT_1_17, true), createMapping(0x1F, ProtocolVersion.MINECRAFT_1_19, true), createMapping(0x21, ProtocolVersion.MINECRAFT_1_19_1, true), createMapping(0x20, ProtocolVersion.MINECRAFT_1_19_3, true), createMapping(0x24, ProtocolVersion.MINECRAFT_1_19_4, true), createMapping(0x25, ProtocolVersion.MINECRAFT_1_20_2, true), createMapping(0x27, ProtocolVersion.MINECRAFT_1_20_5, true), createMapping(0x28, ProtocolVersion.MINECRAFT_1_21_2, true), createMapping(0x27, ProtocolVersion.MINECRAFT_1_21_5, true), createMapping(0x2C, ProtocolVersion.MINECRAFT_1_21_9, true), createMapping(0x2D, ProtocolVersion.MINECRAFT_26_1, true) ); register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND, ChunkUnloadPacket.class, ChunkUnloadPacket::new, // on <=1.8, there is no ChunkUnload; its role is handled by specially encoded ChunkData, so the id will be the same as for ChunkData createMapping(0x21, ProtocolVersion.MINECRAFT_1_7_2, true), createMapping(0x1D, ProtocolVersion.MINECRAFT_1_9, true), createMapping(0x1F, ProtocolVersion.MINECRAFT_1_13, true), createMapping(0x1D, ProtocolVersion.MINECRAFT_1_14, true), createMapping(0x1E, ProtocolVersion.MINECRAFT_1_15, true), createMapping(0x1D, ProtocolVersion.MINECRAFT_1_16, true), createMapping(0x1C, ProtocolVersion.MINECRAFT_1_16_2, true), createMapping(0x1D, ProtocolVersion.MINECRAFT_1_17, true), createMapping(0x1A, ProtocolVersion.MINECRAFT_1_19, true), createMapping(0x1C, ProtocolVersion.MINECRAFT_1_19_1, true), createMapping(0x1B, ProtocolVersion.MINECRAFT_1_19_3, true), createMapping(0x1E, ProtocolVersion.MINECRAFT_1_19_4, true), createMapping(0x1F, ProtocolVersion.MINECRAFT_1_20_2, true), createMapping(0x21, ProtocolVersion.MINECRAFT_1_20_5, true), createMapping(0x22, ProtocolVersion.MINECRAFT_1_21_2, true), createMapping(0x21, ProtocolVersion.MINECRAFT_1_21_5, true), createMapping(0x25, ProtocolVersion.MINECRAFT_1_21_9, true) ); register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND, DefaultSpawnPositionPacket.class, DefaultSpawnPositionPacket::new, createMapping(0x05, ProtocolVersion.MINECRAFT_1_7_2, true), createMapping(0x43, ProtocolVersion.MINECRAFT_1_9, true), createMapping(0x45, ProtocolVersion.MINECRAFT_1_12, true), createMapping(0x46, ProtocolVersion.MINECRAFT_1_12_1, true), createMapping(0x49, ProtocolVersion.MINECRAFT_1_13, true), createMapping(0x4D, ProtocolVersion.MINECRAFT_1_14, true), createMapping(0x4E, ProtocolVersion.MINECRAFT_1_15, true), createMapping(0x42, ProtocolVersion.MINECRAFT_1_16, true), createMapping(0x4B, ProtocolVersion.MINECRAFT_1_17, true), createMapping(0x4A, ProtocolVersion.MINECRAFT_1_19, true), createMapping(0x4D, ProtocolVersion.MINECRAFT_1_19_1, true), createMapping(0x4C, ProtocolVersion.MINECRAFT_1_19_3, true), createMapping(0x50, ProtocolVersion.MINECRAFT_1_19_4, true), createMapping(0x52, ProtocolVersion.MINECRAFT_1_20_2, true), createMapping(0x54, ProtocolVersion.MINECRAFT_1_20_3, true), createMapping(0x56, ProtocolVersion.MINECRAFT_1_20_5, true), createMapping(0x5B, ProtocolVersion.MINECRAFT_1_21_2, true), createMapping(0x5A, ProtocolVersion.MINECRAFT_1_21_5, true), createMapping(0x5F, ProtocolVersion.MINECRAFT_1_21_9, true), createMapping(0x61, ProtocolVersion.MINECRAFT_26_1, true) ); register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND, MapDataPacket.class, MapDataPacket::new, createMapping(0x34, ProtocolVersion.MINECRAFT_1_7_2, true), createMapping(0x24, ProtocolVersion.MINECRAFT_1_9, true), createMapping(0x26, ProtocolVersion.MINECRAFT_1_13, true), createMapping(0x27, ProtocolVersion.MINECRAFT_1_15, true), createMapping(0x26, ProtocolVersion.MINECRAFT_1_16, true), createMapping(0x25, ProtocolVersion.MINECRAFT_1_16_2, true), createMapping(0x27, ProtocolVersion.MINECRAFT_1_17, true), createMapping(0x24, ProtocolVersion.MINECRAFT_1_19, true), createMapping(0x26, ProtocolVersion.MINECRAFT_1_19_1, true), createMapping(0x25, ProtocolVersion.MINECRAFT_1_19_3, true), createMapping(0x29, ProtocolVersion.MINECRAFT_1_19_4, true), createMapping(0x2A, ProtocolVersion.MINECRAFT_1_20_2, true), createMapping(0x2C, ProtocolVersion.MINECRAFT_1_20_5, true), createMapping(0x2D, ProtocolVersion.MINECRAFT_1_21_2, true), createMapping(0x2C, ProtocolVersion.MINECRAFT_1_21_5, true), createMapping(0x31, ProtocolVersion.MINECRAFT_1_21_9, true), createMapping(0x33, ProtocolVersion.MINECRAFT_26_1, true) ); register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND, PlayerAbilitiesPacket.class, PlayerAbilitiesPacket::new, createMapping(0x39, ProtocolVersion.MINECRAFT_1_7_2, true), createMapping(0x2B, ProtocolVersion.MINECRAFT_1_9, true), createMapping(0x2C, ProtocolVersion.MINECRAFT_1_12_1, true), createMapping(0x2E, ProtocolVersion.MINECRAFT_1_13, true), createMapping(0x31, ProtocolVersion.MINECRAFT_1_14, true), createMapping(0x32, ProtocolVersion.MINECRAFT_1_15, true), createMapping(0x31, ProtocolVersion.MINECRAFT_1_16, true), createMapping(0x30, ProtocolVersion.MINECRAFT_1_16_2, true), createMapping(0x32, ProtocolVersion.MINECRAFT_1_17, true), createMapping(0x2F, ProtocolVersion.MINECRAFT_1_19, true), createMapping(0x31, ProtocolVersion.MINECRAFT_1_19_1, true), createMapping(0x30, ProtocolVersion.MINECRAFT_1_19_3, true), createMapping(0x34, ProtocolVersion.MINECRAFT_1_19_4, true), createMapping(0x36, ProtocolVersion.MINECRAFT_1_20_2, true), createMapping(0x38, ProtocolVersion.MINECRAFT_1_20_5, true), createMapping(0x3A, ProtocolVersion.MINECRAFT_1_21_2, true), createMapping(0x39, ProtocolVersion.MINECRAFT_1_21_5, true), createMapping(0x3E, ProtocolVersion.MINECRAFT_1_21_9, true), createMapping(0x40, ProtocolVersion.MINECRAFT_26_1, true) ); register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND, PositionRotationPacket.class, PositionRotationPacket::new, createMapping(0x08, ProtocolVersion.MINECRAFT_1_7_2, true), createMapping(0x2E, ProtocolVersion.MINECRAFT_1_9, true), createMapping(0x2F, ProtocolVersion.MINECRAFT_1_12_1, true), createMapping(0x32, ProtocolVersion.MINECRAFT_1_13, true), createMapping(0x35, ProtocolVersion.MINECRAFT_1_14, true), createMapping(0x36, ProtocolVersion.MINECRAFT_1_15, true), createMapping(0x35, ProtocolVersion.MINECRAFT_1_16, true), createMapping(0x34, ProtocolVersion.MINECRAFT_1_16_2, true), createMapping(0x38, ProtocolVersion.MINECRAFT_1_17, true), createMapping(0x36, ProtocolVersion.MINECRAFT_1_19, true), createMapping(0x39, ProtocolVersion.MINECRAFT_1_19_1, true), createMapping(0x38, ProtocolVersion.MINECRAFT_1_19_3, true), createMapping(0x3C, ProtocolVersion.MINECRAFT_1_19_4, true), createMapping(0x3E, ProtocolVersion.MINECRAFT_1_20_2, true), createMapping(0x40, ProtocolVersion.MINECRAFT_1_20_5, true), createMapping(0x42, ProtocolVersion.MINECRAFT_1_21_2, true), createMapping(0x41, ProtocolVersion.MINECRAFT_1_21_5, true), createMapping(0x46, ProtocolVersion.MINECRAFT_1_21_9, true), createMapping(0x48, ProtocolVersion.MINECRAFT_26_1, true) ); register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND, SetExperiencePacket.class, SetExperiencePacket::new, createMapping(0x1F, ProtocolVersion.MINECRAFT_1_7_2, true), createMapping(0x3D, ProtocolVersion.MINECRAFT_1_9, true), createMapping(0x3F, ProtocolVersion.MINECRAFT_1_12, true), createMapping(0x40, ProtocolVersion.MINECRAFT_1_12_1, true), createMapping(0x43, ProtocolVersion.MINECRAFT_1_13, true), createMapping(0x47, ProtocolVersion.MINECRAFT_1_14, true), createMapping(0x48, ProtocolVersion.MINECRAFT_1_15, true), createMapping(0x51, ProtocolVersion.MINECRAFT_1_17, true), createMapping(0x54, ProtocolVersion.MINECRAFT_1_19_1, true), createMapping(0x52, ProtocolVersion.MINECRAFT_1_19_3, true), createMapping(0x56, ProtocolVersion.MINECRAFT_1_19_4, true), createMapping(0x58, ProtocolVersion.MINECRAFT_1_20_2, true), createMapping(0x5A, ProtocolVersion.MINECRAFT_1_20_3, true), createMapping(0x5C, ProtocolVersion.MINECRAFT_1_20_5, true), createMapping(0x61, ProtocolVersion.MINECRAFT_1_21_2, true), createMapping(0x60, ProtocolVersion.MINECRAFT_1_21_5, true), createMapping(0x65, ProtocolVersion.MINECRAFT_1_21_9, true), createMapping(0x67, ProtocolVersion.MINECRAFT_26_1, true) ); register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND, SetSlotPacket.class, SetSlotPacket::new, createMapping(0x2F, ProtocolVersion.MINECRAFT_1_7_2, true), createMapping(0x16, ProtocolVersion.MINECRAFT_1_9, true), createMapping(0x17, ProtocolVersion.MINECRAFT_1_13, true), createMapping(0x16, ProtocolVersion.MINECRAFT_1_14, true), createMapping(0x17, ProtocolVersion.MINECRAFT_1_15, true), createMapping(0x16, ProtocolVersion.MINECRAFT_1_16, true), createMapping(0x15, ProtocolVersion.MINECRAFT_1_16_2, true), createMapping(0x16, ProtocolVersion.MINECRAFT_1_17, true), createMapping(0x13, ProtocolVersion.MINECRAFT_1_19, true), createMapping(0x12, ProtocolVersion.MINECRAFT_1_19_3, true), createMapping(0x14, ProtocolVersion.MINECRAFT_1_19_4, true), createMapping(0x15, ProtocolVersion.MINECRAFT_1_20_2, true), createMapping(0x14, ProtocolVersion.MINECRAFT_1_21_5, true) ); register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND, TimeUpdatePacket.class, TimeUpdatePacket::new, createMapping(0x03, ProtocolVersion.MINECRAFT_1_7_2, true), createMapping(0x44, ProtocolVersion.MINECRAFT_1_9, true), createMapping(0x46, ProtocolVersion.MINECRAFT_1_12, true), createMapping(0x47, ProtocolVersion.MINECRAFT_1_12_1, true), createMapping(0x4A, ProtocolVersion.MINECRAFT_1_13, true), createMapping(0x4E, ProtocolVersion.MINECRAFT_1_14, true), createMapping(0x4F, ProtocolVersion.MINECRAFT_1_15, true), createMapping(0x4E, ProtocolVersion.MINECRAFT_1_16, true), createMapping(0x58, ProtocolVersion.MINECRAFT_1_17, true), createMapping(0x59, ProtocolVersion.MINECRAFT_1_18, true), createMapping(0x5C, ProtocolVersion.MINECRAFT_1_19_1, true), createMapping(0x5A, ProtocolVersion.MINECRAFT_1_19_3, true), createMapping(0x5E, ProtocolVersion.MINECRAFT_1_19_4, true), createMapping(0x60, ProtocolVersion.MINECRAFT_1_20_2, true), createMapping(0x62, ProtocolVersion.MINECRAFT_1_20_3, true), createMapping(0x64, ProtocolVersion.MINECRAFT_1_20_5, true), createMapping(0x6B, ProtocolVersion.MINECRAFT_1_21_2, true), createMapping(0x6A, ProtocolVersion.MINECRAFT_1_21_5, true), createMapping(0x6F, ProtocolVersion.MINECRAFT_1_21_9, true), createMapping(0x71, ProtocolVersion.MINECRAFT_26_1, true) ); register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND, UpdateViewPositionPacket.class, UpdateViewPositionPacket::new, // ViewCentre, ChunkRenderDistanceCenter createMapping(0x40, ProtocolVersion.MINECRAFT_1_14, true), createMapping(0x41, ProtocolVersion.MINECRAFT_1_15, true), createMapping(0x40, ProtocolVersion.MINECRAFT_1_16, true), createMapping(0x49, ProtocolVersion.MINECRAFT_1_17, true), createMapping(0x48, ProtocolVersion.MINECRAFT_1_19, true), createMapping(0x4B, ProtocolVersion.MINECRAFT_1_19_1, true), createMapping(0x4A, ProtocolVersion.MINECRAFT_1_19_3, true), createMapping(0x4E, ProtocolVersion.MINECRAFT_1_19_4, true), createMapping(0x50, ProtocolVersion.MINECRAFT_1_20_2, true), createMapping(0x52, ProtocolVersion.MINECRAFT_1_20_3, true), createMapping(0x54, ProtocolVersion.MINECRAFT_1_20_5, true), createMapping(0x58, ProtocolVersion.MINECRAFT_1_21_2, true), createMapping(0x57, ProtocolVersion.MINECRAFT_1_21_5, true), createMapping(0x5C, ProtocolVersion.MINECRAFT_1_21_9, true), createMapping(0x5E, ProtocolVersion.MINECRAFT_26_1, true) ); register(LIMBO_STATE_REGISTRY, PacketDirection.CLIENTBOUND, UpdateTagsPacket.class, UpdateTagsPacket::new, createMapping(0x55, ProtocolVersion.MINECRAFT_1_13, true), createMapping(0x5B, ProtocolVersion.MINECRAFT_1_14, true), createMapping(0x5C, ProtocolVersion.MINECRAFT_1_15, true), createMapping(0x5B, ProtocolVersion.MINECRAFT_1_16, true), createMapping(0x66, ProtocolVersion.MINECRAFT_1_17, true), createMapping(0x67, ProtocolVersion.MINECRAFT_1_18, true), createMapping(0x68, ProtocolVersion.MINECRAFT_1_19, true), createMapping(0x6B, ProtocolVersion.MINECRAFT_1_19_1, true), createMapping(0x6A, ProtocolVersion.MINECRAFT_1_19_3, true), createMapping(0x6E, ProtocolVersion.MINECRAFT_1_19_4, true), createMapping(0x70, ProtocolVersion.MINECRAFT_1_20_2, true), createMapping(0x74, ProtocolVersion.MINECRAFT_1_20_3, true), createMapping(0x78, ProtocolVersion.MINECRAFT_1_20_5, true), createMapping(0x7F, ProtocolVersion.MINECRAFT_1_21_2, true), createMapping(0x84, ProtocolVersion.MINECRAFT_1_21_9, true), createMapping(0x86, ProtocolVersion.MINECRAFT_26_1, true) ); register(LIMBO_STATE_REGISTRY, PacketDirection.SERVERBOUND, MovePacket.class, MovePacket::new, createMapping(0x06, ProtocolVersion.MINECRAFT_1_7_2, false), createMapping(0x0D, ProtocolVersion.MINECRAFT_1_9, false), createMapping(0x0F, ProtocolVersion.MINECRAFT_1_12, false), createMapping(0x0E, ProtocolVersion.MINECRAFT_1_12_1, false), createMapping(0x11, ProtocolVersion.MINECRAFT_1_13, false), createMapping(0x12, ProtocolVersion.MINECRAFT_1_14, false), createMapping(0x13, ProtocolVersion.MINECRAFT_1_16, false), createMapping(0x12, ProtocolVersion.MINECRAFT_1_17, false), createMapping(0x14, ProtocolVersion.MINECRAFT_1_19, false), createMapping(0x15, ProtocolVersion.MINECRAFT_1_19_1, false), createMapping(0x14, ProtocolVersion.MINECRAFT_1_19_3, false), createMapping(0x15, ProtocolVersion.MINECRAFT_1_19_4, false), createMapping(0x17, ProtocolVersion.MINECRAFT_1_20_2, false), createMapping(0x18, ProtocolVersion.MINECRAFT_1_20_3, false), createMapping(0x1B, ProtocolVersion.MINECRAFT_1_20_5, false), createMapping(0x1D, ProtocolVersion.MINECRAFT_1_21_2, false), createMapping(0x1E, ProtocolVersion.MINECRAFT_1_21_6, false), createMapping(0x1F, ProtocolVersion.MINECRAFT_26_1, false) ); register(LIMBO_STATE_REGISTRY, PacketDirection.SERVERBOUND, MovePositionOnlyPacket.class, MovePositionOnlyPacket::new, createMapping(0x04, ProtocolVersion.MINECRAFT_1_7_2, false), createMapping(0x0C, ProtocolVersion.MINECRAFT_1_9, false), createMapping(0x0E, ProtocolVersion.MINECRAFT_1_12, false), createMapping(0x0D, ProtocolVersion.MINECRAFT_1_12_1, false), createMapping(0x10, ProtocolVersion.MINECRAFT_1_13, false), createMapping(0x11, ProtocolVersion.MINECRAFT_1_14, false), createMapping(0x12, ProtocolVersion.MINECRAFT_1_16, false), createMapping(0x11, ProtocolVersion.MINECRAFT_1_17, false), createMapping(0x13, ProtocolVersion.MINECRAFT_1_19, false), createMapping(0x14, ProtocolVersion.MINECRAFT_1_19_1, false), createMapping(0x13, ProtocolVersion.MINECRAFT_1_19_3, false), createMapping(0x14, ProtocolVersion.MINECRAFT_1_19_4, false), createMapping(0x16, ProtocolVersion.MINECRAFT_1_20_2, false), createMapping(0x17, ProtocolVersion.MINECRAFT_1_20_3, false), createMapping(0x1A, ProtocolVersion.MINECRAFT_1_20_5, false), createMapping(0x1C, ProtocolVersion.MINECRAFT_1_21_2, false), createMapping(0x1D, ProtocolVersion.MINECRAFT_1_21_6, false), createMapping(0x1E, ProtocolVersion.MINECRAFT_26_1, false) ); register(LIMBO_STATE_REGISTRY, PacketDirection.SERVERBOUND, MoveRotationOnlyPacket.class, MoveRotationOnlyPacket::new, createMapping(0x05, ProtocolVersion.MINECRAFT_1_7_2, false), createMapping(0x0E, ProtocolVersion.MINECRAFT_1_9, false), createMapping(0x10, ProtocolVersion.MINECRAFT_1_12, false), createMapping(0x0F, ProtocolVersion.MINECRAFT_1_12_1, false), createMapping(0x12, ProtocolVersion.MINECRAFT_1_13, false), createMapping(0x13, ProtocolVersion.MINECRAFT_1_14, false), createMapping(0x14, ProtocolVersion.MINECRAFT_1_16, false), createMapping(0x13, ProtocolVersion.MINECRAFT_1_17, false), createMapping(0x15, ProtocolVersion.MINECRAFT_1_19, false), createMapping(0x16, ProtocolVersion.MINECRAFT_1_19_1, false), createMapping(0x15, ProtocolVersion.MINECRAFT_1_19_3, false), createMapping(0x16, ProtocolVersion.MINECRAFT_1_19_4, false), createMapping(0x18, ProtocolVersion.MINECRAFT_1_20_2, false), createMapping(0x19, ProtocolVersion.MINECRAFT_1_20_3, false), createMapping(0x1C, ProtocolVersion.MINECRAFT_1_20_5, false), createMapping(0x1E, ProtocolVersion.MINECRAFT_1_21_2, false), createMapping(0x1F, ProtocolVersion.MINECRAFT_1_21_6, false), createMapping(0x20, ProtocolVersion.MINECRAFT_26_1, false) ); register(LIMBO_STATE_REGISTRY, PacketDirection.SERVERBOUND, MoveOnGroundOnlyPacket.class, MoveOnGroundOnlyPacket::new, createMapping(0x03, ProtocolVersion.MINECRAFT_1_7_2, false), createMapping(0x0F, ProtocolVersion.MINECRAFT_1_9, false), createMapping(0x0D, ProtocolVersion.MINECRAFT_1_12, false), createMapping(0x0C, ProtocolVersion.MINECRAFT_1_12_1, false), createMapping(0x0F, ProtocolVersion.MINECRAFT_1_13, false), createMapping(0x14, ProtocolVersion.MINECRAFT_1_14, false), createMapping(0x15, ProtocolVersion.MINECRAFT_1_16, false), createMapping(0x14, ProtocolVersion.MINECRAFT_1_17, false), createMapping(0x16, ProtocolVersion.MINECRAFT_1_19, false), createMapping(0x17, ProtocolVersion.MINECRAFT_1_19_1, false), createMapping(0x16, ProtocolVersion.MINECRAFT_1_19_3, false), createMapping(0x17, ProtocolVersion.MINECRAFT_1_19_4, false), createMapping(0x19, ProtocolVersion.MINECRAFT_1_20_2, false), createMapping(0x1A, ProtocolVersion.MINECRAFT_1_20_3, false), createMapping(0x1D, ProtocolVersion.MINECRAFT_1_20_5, false), createMapping(0x1F, ProtocolVersion.MINECRAFT_1_21_2, false), createMapping(0x20, ProtocolVersion.MINECRAFT_1_21_6, false), createMapping(0x21, ProtocolVersion.MINECRAFT_26_1, false) ); register(LIMBO_STATE_REGISTRY, PacketDirection.SERVERBOUND, TeleportConfirmPacket.class, TeleportConfirmPacket::new, createMapping(0x00, ProtocolVersion.MINECRAFT_1_9, false) ); register(PLAY_SERVERBOUND_REGISTRY, PlayerChatSessionPacket.class, PlayerChatSessionPacket::new, createMapping(0x20, ProtocolVersion.MINECRAFT_1_19_3, false), createMapping(0x06, ProtocolVersion.MINECRAFT_1_19_4, false), createMapping(0x07, ProtocolVersion.MINECRAFT_1_20_5, false), createMapping(0x08, ProtocolVersion.MINECRAFT_1_21_2, false), createMapping(0x09, ProtocolVersion.MINECRAFT_1_21_6, false), createMapping(0x0A, ProtocolVersion.MINECRAFT_26_1, false) ); } public static StateRegistry createLocalStateRegistry() { try { StateRegistry stateRegistry = (StateRegistry) UNSAFE.allocateInstance(StateRegistry.class); overlayRegistry(stateRegistry, "clientbound", LIMBO_CLIENTBOUND_REGISTRY); overlayRegistry(stateRegistry, "serverbound", LIMBO_SERVERBOUND_REGISTRY); return stateRegistry; } catch (Throwable e) { throw new ReflectionException(e); } } public static void register(StateRegistry stateRegistry, PacketDirection direction, Class packetClass, Supplier packetSupplier, PacketMapping[] mappings) { register(stateRegistry, direction, packetClass, packetSupplier, Arrays.stream(mappings).map(mapping -> { try { return createMapping(mapping.getID(), mapping.getProtocolVersion(), mapping.getLastValidProtocolVersion(), mapping.isEncodeOnly()); } catch (Throwable e) { throw new ReflectionException(e); } }).toArray(StateRegistry.PacketMapping[]::new)); } public static void register(StateRegistry stateRegistry, PacketDirection direction, Class packetClass, Supplier packetSupplier, StateRegistry.PacketMapping... mappings) { MethodHandle registryGetter; switch (direction) { case CLIENTBOUND: { registryGetter = CLIENTBOUND_REGISTRY_GETTER; break; } case SERVERBOUND: { registryGetter = SERVERBOUND_REGISTRY_GETTER; break; } default: { throw new IllegalStateException("Unexpected value: " + direction); } } try { register((StateRegistry.PacketRegistry) registryGetter.invokeExact(stateRegistry), packetClass, packetSupplier, mappings); } catch (Throwable e) { throw new ReflectionException(e); } } public static void register(StateRegistry.PacketRegistry registry, Class packetClass, Supplier packetSupplier, StateRegistry.PacketMapping... mappings) { try { var versions = (Map) VERSIONS_GETTER.invokeExact(registry); List> overlayMaps = versions.values().stream().flatMap(protocolRegistry -> { try { var idToSupplier = (IntObjectMap>) PACKET_ID_TO_SUPPLIER_GETTER.invokeExact(protocolRegistry); var classToId = (Object2IntMap>) PACKET_CLASS_TO_ID_GETTER.invokeExact(protocolRegistry); if (idToSupplier instanceof OverlayMap && classToId instanceof OverlayMap) { return Stream.of( (OverlayMap) idToSupplier, (OverlayMap) classToId ); } else { return Stream.empty(); } } catch (Throwable e) { throw new ReflectionException(e); } }).toList(); overlayMaps.forEach(overlayMap -> overlayMap.setOverride(true)); REGISTER_METHOD.invokeExact(registry, packetClass, packetSupplier, mappings); overlayMaps.forEach(overlayMap -> overlayMap.setOverride(false)); } catch (Throwable e) { throw new ReflectionException(e); } } private static StateRegistry.PacketMapping createMapping(int id, ProtocolVersion version, boolean encodeOnly) throws Throwable { return createMapping(id, version, null, encodeOnly); } private static StateRegistry.PacketMapping createMapping(int id, ProtocolVersion version, ProtocolVersion lastValidProtocolVersion, boolean encodeOnly) throws Throwable { return (StateRegistry.PacketMapping) PACKET_MAPPING_CONSTRUCTOR.invokeExact(id, version, lastValidProtocolVersion, encodeOnly); } public static StateRegistry getLimboStateRegistry() { return LIMBO_STATE_REGISTRY; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/data/BiomeStorage118.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.data; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import net.elytrium.limboapi.api.chunk.VirtualBiome; import net.elytrium.limboapi.api.chunk.util.CompactStorage; import net.elytrium.limboapi.material.Biome; import net.elytrium.limboapi.mcprotocollib.BitStorage116; import net.elytrium.limboapi.server.world.chunk.SimpleChunk; import org.checkerframework.checker.nullness.qual.NonNull; public class BiomeStorage118 { private final ProtocolVersion version; private List palette = new ArrayList<>(); private Map rawToBiome = new HashMap<>(); private CompactStorage storage; public BiomeStorage118(ProtocolVersion version) { this.version = version; for (Biome biome : Biome.values()) { this.palette.add(biome); this.rawToBiome.put(biome.getID(), biome); } this.storage = new BitStorage116(3, SimpleChunk.MAX_BIOMES_PER_SECTION); } private BiomeStorage118(ProtocolVersion version, List palette, Map rawToBiome, CompactStorage storage) { this.version = version; this.palette = palette; this.rawToBiome = rawToBiome; this.storage = storage; } public void set(int posX, int posY, int posZ, @NonNull VirtualBiome biome) { int id = this.getIndex(biome); this.storage.set(index(posX, posY, posZ), id); } public void set(int index, @NonNull VirtualBiome biome) { int id = this.getIndex(biome); this.storage.set(index, id); } @NonNull public VirtualBiome get(int posX, int posY, int posZ) { return this.get(index(posX, posY, posZ)); } private VirtualBiome get(int index) { int id = this.storage.get(index); if (this.storage.getBitsPerEntry() > 8) { return this.rawToBiome.get(id); } else { return this.palette.get(id); } } public void write(ByteBuf buf, ProtocolVersion version) { buf.writeByte(this.storage.getBitsPerEntry()); if (this.storage.getBitsPerEntry() <= 8) { ProtocolUtils.writeVarInt(buf, this.palette.size()); for (VirtualBiome biome : this.palette) { ProtocolUtils.writeVarInt(buf, biome.getID()); } } this.storage.write(buf, version); } public int getDataLength(ProtocolVersion version) { int length = 1; if (this.storage.getBitsPerEntry() <= 8) { length += ProtocolUtils.varIntBytes(this.palette.size()); for (VirtualBiome biome : this.palette) { length += ProtocolUtils.varIntBytes(biome.getID()); } } return length + this.storage.getDataLength(version); } public BiomeStorage118 copy() { return new BiomeStorage118(this.version, new ArrayList<>(this.palette), new HashMap<>(this.rawToBiome), this.storage.copy()); } private int getIndex(VirtualBiome biome) { if (this.storage.getBitsPerEntry() > 8) { int raw = biome.getID(); this.rawToBiome.put(raw, biome); return raw; } else { int id = this.palette.indexOf(biome); if (id == -1) { if (this.palette.size() >= (1 << this.storage.getBitsPerEntry())) { this.resize(this.storage.getBitsPerEntry() + 1); return this.getIndex(biome); } this.palette.add(biome); id = this.palette.size() - 1; } return id; } } private void resize(int newSize) { newSize = StorageUtils.fixBitsPerEntry(this.version, newSize); CompactStorage newStorage = new BitStorage116(newSize, SimpleChunk.MAX_BIOMES_PER_SECTION); for (int i = 0; i < SimpleChunk.MAX_BIOMES_PER_SECTION; ++i) { newStorage.set(i, newSize > 8 ? this.palette.get(this.storage.get(i)).getID() : this.storage.get(i)); } this.storage = newStorage; } @Override public String toString() { return "BiomeStorage118{" + "version=" + this.version + ", palette=" + this.palette + ", rawToBiome=" + this.rawToBiome + ", storage=" + this.storage + "}"; } private static int index(int posX, int posY, int posZ) { return posY << 4 | posZ << 2 | posX; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/data/BlockStorage17.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.data; import com.google.common.base.Preconditions; import com.velocitypowered.api.network.ProtocolVersion; import io.netty.buffer.ByteBuf; import java.util.Arrays; import net.elytrium.limboapi.api.chunk.VirtualBlock; import net.elytrium.limboapi.api.chunk.data.BlockStorage; import net.elytrium.limboapi.api.mcprotocollib.NibbleArray3D; import net.elytrium.limboapi.server.world.SimpleBlock; import net.elytrium.limboapi.server.world.chunk.SimpleChunk; import org.checkerframework.checker.nullness.qual.NonNull; public class BlockStorage17 implements BlockStorage { private final VirtualBlock[] blocks; public BlockStorage17() { this(new VirtualBlock[SimpleChunk.MAX_BLOCKS_PER_SECTION]); } private BlockStorage17(VirtualBlock[] blocks) { this.blocks = blocks; } @Override public void write(Object byteBufObject, ProtocolVersion version, int pass) { Preconditions.checkArgument(byteBufObject instanceof ByteBuf); ByteBuf buf = (ByteBuf) byteBufObject; if (pass == 0) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0) { byte[] raw = new byte[this.blocks.length]; for (int i = 0; i < this.blocks.length; ++i) { VirtualBlock block = this.blocks[i]; raw[i] = (byte) (block == null ? 0 : block.getBlockStateID(ProtocolVersion.MINECRAFT_1_7_2) >> 4); } buf.writeBytes(raw); } else { short[] raw = new short[this.blocks.length]; for (int i = 0; i < this.blocks.length; ++i) { VirtualBlock block = this.blocks[i]; raw[i] = (short) (block == null ? 0 : block.getBlockStateID(ProtocolVersion.MINECRAFT_1_8)); } for (short s : raw) { buf.writeShortLE(s); } } } else if (pass == 1 && version.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0) { NibbleArray3D metadata = new NibbleArray3D(SimpleChunk.MAX_BLOCKS_PER_SECTION); for (int i = 0; i < this.blocks.length; ++i) { VirtualBlock block = this.blocks[i]; metadata.set(i, block == null ? 0 : block.getBlockStateID(ProtocolVersion.MINECRAFT_1_7_2) & 0xFFFF); } buf.writeBytes(metadata.getData()); } } @Override public void set(int posX, int posY, int posZ, @NonNull VirtualBlock block) { this.blocks[BlockStorage.index(posX, posY, posZ)] = block; } @NonNull @Override public VirtualBlock get(int posX, int posY, int posZ) { VirtualBlock block = this.blocks[BlockStorage.index(posX, posY, posZ)]; return block == null ? SimpleBlock.AIR : block; } @Override public int getDataLength(ProtocolVersion version) { return version.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0 ? this.blocks.length + (SimpleChunk.MAX_BLOCKS_PER_SECTION >> 1) : this.blocks.length * 2; } @Override public BlockStorage copy() { return new BlockStorage17(Arrays.copyOf(this.blocks, this.blocks.length)); } @Override public String toString() { return "BlockStorage17{" + "blocks=" + Arrays.toString(this.blocks) + "}"; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/data/BlockStorage19.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.data; import com.google.common.base.Preconditions; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import net.elytrium.limboapi.api.chunk.VirtualBlock; import net.elytrium.limboapi.api.chunk.data.BlockStorage; import net.elytrium.limboapi.api.chunk.util.CompactStorage; import net.elytrium.limboapi.mcprotocollib.BitStorage116; import net.elytrium.limboapi.mcprotocollib.BitStorage19; import net.elytrium.limboapi.server.world.SimpleBlock; import net.elytrium.limboapi.server.world.chunk.SimpleChunk; import org.checkerframework.checker.nullness.qual.NonNull; public class BlockStorage19 implements BlockStorage { private final ProtocolVersion version; private final List palette; private final Map rawToBlock; private CompactStorage storage; public BlockStorage19(ProtocolVersion version) { this.version = version; this.palette = new ArrayList<>(); this.rawToBlock = new HashMap<>(); this.palette.add(SimpleBlock.AIR); this.rawToBlock.put(SimpleBlock.AIR.getBlockStateID(version), SimpleBlock.AIR); this.storage = this.createStorage(4); } private BlockStorage19(ProtocolVersion version, List palette, Map rawToBlock, CompactStorage storage) { this.version = version; this.palette = palette; this.rawToBlock = rawToBlock; this.storage = storage; } @Override public void write(Object byteBufObject, ProtocolVersion version, int pass) { Preconditions.checkArgument(byteBufObject instanceof ByteBuf); ByteBuf buf = (ByteBuf) byteBufObject; buf.writeByte(this.storage.getBitsPerEntry()); if (this.storage.getBitsPerEntry() > 8) { if (this.version.compareTo(ProtocolVersion.MINECRAFT_1_13) < 0) { ProtocolUtils.writeVarInt(buf, 0); } } else { ProtocolUtils.writeVarInt(buf, this.palette.size()); for (VirtualBlock state : this.palette) { ProtocolUtils.writeVarInt(buf, state.getBlockStateID(this.version)); } } this.storage.write(buf, version); } @Override public void set(int posX, int posY, int posZ, @NonNull VirtualBlock block) { int id = this.getIndex(block); this.storage.set(BlockStorage.index(posX, posY, posZ), id); } private int getIndex(VirtualBlock block) { if (this.storage.getBitsPerEntry() > 8) { short raw = block.getBlockStateID(this.version); this.rawToBlock.put(raw, block); return raw; } else { int id = this.palette.indexOf(block); if (id == -1) { if (this.palette.size() >= (1 << this.storage.getBitsPerEntry())) { int bitsPerEntry = StorageUtils.fixBitsPerEntry(this.version, this.storage.getBitsPerEntry() + 1); CompactStorage newStorage = this.createStorage(bitsPerEntry); for (int i = 0; i < SimpleChunk.MAX_BLOCKS_PER_SECTION; ++i) { newStorage.set(i, bitsPerEntry > 8 ? this.palette.get(this.storage.get(i)).getBlockStateID(this.version) : this.storage.get(i)); } this.storage = newStorage; return this.getIndex(block); } this.palette.add(block); id = this.palette.size() - 1; } return id; } } private CompactStorage createStorage(int bitsPerEntry) { return this.version.compareTo(ProtocolVersion.MINECRAFT_1_16) < 0 ? new BitStorage19(bitsPerEntry, SimpleChunk.MAX_BLOCKS_PER_SECTION) : new BitStorage116(bitsPerEntry, SimpleChunk.MAX_BLOCKS_PER_SECTION); } @NonNull @Override public VirtualBlock get(int posX, int posY, int posZ) { int id = this.storage.get(BlockStorage.index(posX, posY, posZ)); if (this.storage.getBitsPerEntry() > 8) { return this.rawToBlock.get((short) id); } else { return this.palette.get(id); } } @Override public int getDataLength(ProtocolVersion version) { int length = 1; if (this.storage.getBitsPerEntry() > 8) { if (this.version.compareTo(ProtocolVersion.MINECRAFT_1_13) < 0) { length += 1; } } else { length += ProtocolUtils.varIntBytes(this.palette.size()); for (VirtualBlock state : this.palette) { length += ProtocolUtils.varIntBytes(state.getBlockStateID(this.version)); } } return length + this.storage.getDataLength(version); } @Override public BlockStorage copy() { return new BlockStorage19(this.version, new ArrayList<>(this.palette), new HashMap<>(this.rawToBlock), this.storage.copy()); } @Override public String toString() { return "BlockStorage19{" + "version=" + this.version + ", palette=" + this.palette + ", rawToBlock=" + this.rawToBlock + ", storage=" + this.storage + "}"; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/data/StorageUtils.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.data; import com.velocitypowered.api.network.ProtocolVersion; public class StorageUtils { public static int fixBitsPerEntry(ProtocolVersion version, int bitsPerEntry) { if (bitsPerEntry < 4) { return 4; } else if (bitsPerEntry < 9) { return bitsPerEntry; } else if (version.compareTo(ProtocolVersion.MINECRAFT_1_13) < 0) { return 13; } else if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_4) < 0) { return 14; } else { return 15; } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/PacketFactoryImpl.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets; import com.velocitypowered.api.network.ProtocolVersion; import java.util.List; import java.util.Map; import net.elytrium.limboapi.api.chunk.Dimension; import net.elytrium.limboapi.api.chunk.data.ChunkSnapshot; import net.elytrium.limboapi.api.material.VirtualItem; import net.elytrium.limboapi.api.material.WorldVersion; import net.elytrium.limboapi.api.protocol.item.ItemComponentMap; import net.elytrium.limboapi.api.protocol.packets.PacketFactory; import net.elytrium.limboapi.api.protocol.packets.data.MapData; import net.elytrium.limboapi.protocol.packets.s2c.ChangeGameStatePacket; import net.elytrium.limboapi.protocol.packets.s2c.ChunkDataPacket; import net.elytrium.limboapi.protocol.packets.s2c.ChunkUnloadPacket; import net.elytrium.limboapi.protocol.packets.s2c.DefaultSpawnPositionPacket; import net.elytrium.limboapi.protocol.packets.s2c.MapDataPacket; import net.elytrium.limboapi.protocol.packets.s2c.PlayerAbilitiesPacket; import net.elytrium.limboapi.protocol.packets.s2c.PositionRotationPacket; import net.elytrium.limboapi.protocol.packets.s2c.SetExperiencePacket; import net.elytrium.limboapi.protocol.packets.s2c.SetSlotPacket; import net.elytrium.limboapi.protocol.packets.s2c.TimeUpdatePacket; import net.elytrium.limboapi.protocol.packets.s2c.UpdateTagsPacket; import net.elytrium.limboapi.protocol.packets.s2c.UpdateViewPositionPacket; import net.elytrium.limboapi.server.world.SimpleTagManager; import net.kyori.adventure.nbt.CompoundBinaryTag; import org.checkerframework.checker.nullness.qual.Nullable; public class PacketFactoryImpl implements PacketFactory { @Override public Object createChangeGameStatePacket(int reason, float value) { return new ChangeGameStatePacket(reason, value); } @Override public Object createChunkDataPacket(ChunkSnapshot chunkSnapshot, boolean legacySkyLight, int maxSections) { return new ChunkDataPacket(chunkSnapshot, legacySkyLight, maxSections); } @Override public Object createChunkDataPacket(ChunkSnapshot chunkSnapshot, Dimension dimension) { return new ChunkDataPacket(chunkSnapshot, dimension.hasLegacySkyLight(), dimension.getMaxSections()); } @Override public Object createChunkUnloadPacket(int posX, int posZ) { return new ChunkUnloadPacket(posX, posZ); } @Override public Object createDefaultSpawnPositionPacket(int posX, int posY, int posZ, float angle) { return new DefaultSpawnPositionPacket(Dimension.OVERWORLD.getKey(), posX, posY, posZ, angle, 0); } @Override public Object createDefaultSpawnPositionPacket(String dimension, int posX, int posY, int posZ, float yaw, float pitch) { return new DefaultSpawnPositionPacket(dimension, posX, posY, posZ, yaw, pitch); } @Override public Object createMapDataPacket(int mapID, byte scale, MapData mapData) { return new MapDataPacket(mapID, scale, mapData); } @Override public Object createPlayerAbilitiesPacket(int flags, float flySpeed, float walkSpeed) { return new PlayerAbilitiesPacket((byte) flags, flySpeed, walkSpeed); } @Override public Object createPlayerAbilitiesPacket(byte flags, float flySpeed, float walkSpeed) { return new PlayerAbilitiesPacket(flags, flySpeed, walkSpeed); } @Override public Object createPositionRotationPacket(double posX, double posY, double posZ, float yaw, float pitch, boolean onGround, int teleportID, boolean dismountVehicle) { return new PositionRotationPacket(posX, posY, posZ, yaw, pitch, onGround, teleportID, dismountVehicle); } @Override public Object createSetExperiencePacket(float expBar, int level, int totalExp) { return new SetExperiencePacket(expBar, level, totalExp); } @Override public Object createSetSlotPacket(int windowID, int slot, VirtualItem item, int count, int data, @Nullable CompoundBinaryTag nbt) { return new SetSlotPacket(windowID, slot, item, count, data, nbt, null); } @Override public Object createSetSlotPacket(int windowID, int slot, VirtualItem item, int count, int data, @Nullable ItemComponentMap map) { return new SetSlotPacket(windowID, slot, item, count, data, null, map); } @Override public Object createTimeUpdatePacket(long worldAge, long timeOfDay) { return new TimeUpdatePacket(worldAge, timeOfDay); } @Override public Object createUpdateViewPositionPacket(int posX, int posZ) { return new UpdateViewPositionPacket(posX, posZ); } @Override public Object createUpdateTagsPacket(WorldVersion version) { return SimpleTagManager.getUpdateTagsPacket(version); } @Override public Object createUpdateTagsPacket(ProtocolVersion version) { return SimpleTagManager.getUpdateTagsPacket(version); } @Override public Object createUpdateTagsPacket(Map>> tags) { return new UpdateTagsPacket(tags); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/c2s/MoveOnGroundOnlyPacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.c2s; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import net.elytrium.limboapi.server.LimboSessionHandlerImpl; public class MoveOnGroundOnlyPacket implements MinecraftPacket { private boolean onGround; private boolean collideHorizontally; @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { if (protocolVersion.lessThan(ProtocolVersion.MINECRAFT_1_21_2)) { this.onGround = buf.readBoolean(); } else { int flags = buf.readUnsignedByte(); this.onGround = (flags & 1) != 0; this.collideHorizontally = (flags & 2) != 0; } } @Override public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public boolean handle(MinecraftSessionHandler handler) { if (handler instanceof LimboSessionHandlerImpl) { return ((LimboSessionHandlerImpl) handler).handle(this); } else { return true; } } @Override public int decodeExpectedMaxLength(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { return 1; } @Override public int decodeExpectedMinLength(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { return 1; } @Override public String toString() { return "Player{" + "onGround=" + this.onGround + ", collideHorizontally=" + this.collideHorizontally + "}"; } public boolean isOnGround() { return this.onGround; } public boolean isCollideHorizontally() { return this.collideHorizontally; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/c2s/MovePacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.c2s; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction; import io.netty.buffer.ByteBuf; import net.elytrium.limboapi.server.LimboSessionHandlerImpl; public class MovePacket implements MinecraftPacket { private double posX; private double posY; private double posZ; private float yaw; private float pitch; private boolean onGround; private boolean collideHorizontally; @Override public void decode(ByteBuf buf, Direction direction, ProtocolVersion protocolVersion) { this.posX = buf.readDouble(); if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0) { buf.skipBytes(8); } this.posY = buf.readDouble(); this.posZ = buf.readDouble(); this.yaw = buf.readFloat(); this.pitch = buf.readFloat(); if (protocolVersion.lessThan(ProtocolVersion.MINECRAFT_1_21_2)) { this.onGround = buf.readBoolean(); } else { int flags = buf.readUnsignedByte(); this.onGround = (flags & 1) != 0; this.collideHorizontally = (flags & 2) != 0; } } @Override public void encode(ByteBuf buf, Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public boolean handle(MinecraftSessionHandler handler) { if (handler instanceof LimboSessionHandlerImpl) { return ((LimboSessionHandlerImpl) handler).handle(this); } else { return true; } } @Override public int decodeExpectedMaxLength(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { return version.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0 ? 41 : 33; } @Override public int decodeExpectedMinLength(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { return 33; } @Override public String toString() { return "PlayerPositionAndLook{" + "posX=" + this.posX + ", posY=" + this.posY + ", posZ=" + this.posZ + ", yaw=" + this.yaw + ", pitch=" + this.pitch + ", onGround=" + this.onGround + ", collideHorizontally=" + this.collideHorizontally + "}"; } public double getX() { return this.posX; } public double getY() { return this.posY; } public double getZ() { return this.posZ; } public float getYaw() { return this.yaw; } public float getPitch() { return this.pitch; } public boolean isOnGround() { return this.onGround; } public boolean isCollideHorizontally() { return this.collideHorizontally; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/c2s/MovePositionOnlyPacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.c2s; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import net.elytrium.limboapi.server.LimboSessionHandlerImpl; public class MovePositionOnlyPacket implements MinecraftPacket { private double posX; private double posY; private double posZ; private boolean onGround; private boolean collideHorizontally; @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { this.posX = buf.readDouble(); if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0) { buf.skipBytes(8); } this.posY = buf.readDouble(); this.posZ = buf.readDouble(); if (protocolVersion.lessThan(ProtocolVersion.MINECRAFT_1_21_2)) { this.onGround = buf.readBoolean(); } else { int flags = buf.readUnsignedByte(); this.onGround = (flags & 1) != 0; this.collideHorizontally = (flags & 2) != 0; } } @Override public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public boolean handle(MinecraftSessionHandler handler) { if (handler instanceof LimboSessionHandlerImpl) { return ((LimboSessionHandlerImpl) handler).handle(this); } else { return true; } } @Override public int decodeExpectedMaxLength(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { return version.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0 ? 33 : 25; } @Override public int decodeExpectedMinLength(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { return 25; } @Override public String toString() { return "PlayerPosition{" + "posX=" + this.posX + ", posY=" + this.posY + ", posZ=" + this.posZ + ", onGround=" + this.onGround + ", collideHorizontally=" + this.collideHorizontally + "}"; } public double getX() { return this.posX; } public double getY() { return this.posY; } public double getZ() { return this.posZ; } public boolean isOnGround() { return this.onGround; } public boolean isCollideHorizontally() { return this.collideHorizontally; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/c2s/MoveRotationOnlyPacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.c2s; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction; import io.netty.buffer.ByteBuf; import net.elytrium.limboapi.server.LimboSessionHandlerImpl; public class MoveRotationOnlyPacket implements MinecraftPacket { private float yaw; private float pitch; private boolean onGround; private boolean collideHorizontally; @Override public void decode(ByteBuf buf, Direction direction, ProtocolVersion protocolVersion) { this.yaw = buf.readFloat(); this.pitch = buf.readFloat(); if (protocolVersion.lessThan(ProtocolVersion.MINECRAFT_1_21_2)) { this.onGround = buf.readBoolean(); } else { int flags = buf.readUnsignedByte(); this.onGround = (flags & 1) != 0; this.collideHorizontally = (flags & 2) != 0; } } @Override public void encode(ByteBuf buf, Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public boolean handle(MinecraftSessionHandler handler) { if (handler instanceof LimboSessionHandlerImpl) { return ((LimboSessionHandlerImpl) handler).handle(this); } else { return true; } } @Override public int decodeExpectedMaxLength(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { return 9; } @Override public int decodeExpectedMinLength(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { return 9; } @Override public String toString() { return "PlayerLook{" + ", yaw=" + this.yaw + ", pitch=" + this.pitch + ", onGround=" + this.onGround + ", collideHorizontally=" + this.collideHorizontally + "}"; } public float getYaw() { return this.yaw; } public float getPitch() { return this.pitch; } public boolean isOnGround() { return this.onGround; } public boolean isCollideHorizontally() { return this.collideHorizontally; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/c2s/PlayerChatSessionPacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.c2s; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.proxy.crypto.IdentifiedKey; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import java.util.UUID; import net.elytrium.limboapi.Settings; @SuppressWarnings("unused") public class PlayerChatSessionPacket implements MinecraftPacket { private UUID holderId; private IdentifiedKey playerKey; @Override public void decode(ByteBuf byteBuf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { this.holderId = ProtocolUtils.readUuid(byteBuf); this.playerKey = ProtocolUtils.readPlayerKey(protocolVersion, byteBuf); } @Override public void encode(ByteBuf byteBuf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { ProtocolUtils.writeUuid(byteBuf, this.holderId); ProtocolUtils.writePlayerKey(byteBuf, this.playerKey); } @Override public boolean handle(MinecraftSessionHandler minecraftSessionHandler) { // LimboAPI hook - skip server-side signature verification if enabled if (minecraftSessionHandler instanceof ClientPlaySessionHandler) { return Settings.IMP.MAIN.FORCE_DISABLE_MODERN_CHAT_SIGNING; } return false; } public UUID getHolderId() { return this.holderId; } public void setHolderId(UUID holderId) { this.holderId = holderId; } public IdentifiedKey getPlayerKey() { return this.playerKey; } public void setPlayerKey(IdentifiedKey playerKey) { this.playerKey = playerKey; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/c2s/TeleportConfirmPacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.c2s; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import net.elytrium.limboapi.server.LimboSessionHandlerImpl; public class TeleportConfirmPacket implements MinecraftPacket { private int teleportID; @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { this.teleportID = ProtocolUtils.readVarInt(buf); } @Override public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public boolean handle(MinecraftSessionHandler handler) { if (handler instanceof LimboSessionHandlerImpl) { return ((LimboSessionHandlerImpl) handler).handle(this); } else { return true; } } @Override public int decodeExpectedMaxLength(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { return 5; } @Override public int decodeExpectedMinLength(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { return 1; } @Override public String toString() { return "TeleportConfirm{" + "teleportID=" + this.teleportID + "}"; } public int getTeleportID() { return this.teleportID; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/ChangeGameStatePacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.s2c; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; public class ChangeGameStatePacket implements MinecraftPacket { private final int reason; private final float value; // TODO: Reasons enum or builder. public ChangeGameStatePacket(int reason, float value) { this.reason = reason; this.value = value; } public ChangeGameStatePacket() { throw new IllegalStateException(); } @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { buf.writeByte(this.reason); buf.writeFloat(this.value); } @Override public boolean handle(MinecraftSessionHandler handler) { return true; } @Override public String toString() { return "ChangeGameState{" + "reason=" + this.reason + ", value=" + this.value + "}"; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/ChunkDataPacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.s2c; import com.google.common.base.Preconditions; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.ProtocolUtils.Direction; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import java.util.BitSet; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.zip.Deflater; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.api.chunk.VirtualBlock; import net.elytrium.limboapi.api.chunk.VirtualBlockEntity; import net.elytrium.limboapi.api.chunk.data.ChunkSnapshot; import net.elytrium.limboapi.api.chunk.data.LightSection; import net.elytrium.limboapi.api.chunk.util.CompactStorage; import net.elytrium.limboapi.api.material.Block; import net.elytrium.limboapi.api.protocol.packets.data.BiomeData; import net.elytrium.limboapi.material.Biome; import net.elytrium.limboapi.mcprotocollib.BitStorage116; import net.elytrium.limboapi.mcprotocollib.BitStorage19; import net.elytrium.limboapi.protocol.util.NetworkSection; import net.kyori.adventure.nbt.BinaryTag; import net.kyori.adventure.nbt.CompoundBinaryTag; import net.kyori.adventure.nbt.LongArrayBinaryTag; public class ChunkDataPacket implements MinecraftPacket { private final ChunkSnapshot chunk; private final NetworkSection[] sections; private final int mask; private final int maxSections; private final int nonNullSections; private final BiomeData biomeData; private final CompoundBinaryTag heightmap114; private final CompoundBinaryTag heightmap116; private final Map heightmap1215; public ChunkDataPacket(ChunkSnapshot chunkSnapshot, boolean hasLegacySkyLight, int maxSections) { this.maxSections = maxSections; this.sections = new NetworkSection[maxSections]; this.chunk = chunkSnapshot; int mask = 0; int nonNullSections = 0; for (int i = 0; i < this.chunk.getSections().length; ++i) { if (this.chunk.getSections()[i] != null) { ++nonNullSections; mask |= 1 << i; LightSection light = this.chunk.getLight()[i]; NetworkSection section = new NetworkSection( i, this.chunk.getSections()[i], light.getBlockLight(), hasLegacySkyLight ? light.getSkyLight() : null, this.chunk.getBiomes() ); this.sections[i] = section; } } this.nonNullSections = nonNullSections; this.mask = mask; this.heightmap114 = this.createHeightMap(true); this.heightmap116 = this.createHeightMap(false); this.heightmap1215 = new HashMap<>(); for (Map.Entry entry : this.heightmap116) { this.heightmap1215.put(this.findHeightMapId(entry.getKey()), ((LongArrayBinaryTag) entry.getValue()).value()); } this.biomeData = new BiomeData(this.chunk); } private int findHeightMapId(String key) { return switch (key) { case "WORLD_SURFACE" -> 1; /* taken from minecraft decompiled source code */ case "MOTION_BLOCKING" -> 4; /* taken from minecraft decompiled source code */ default -> throw new IllegalArgumentException("Unsupported heightmap: " + key); }; } public ChunkDataPacket() { throw new IllegalStateException(); } @Override public void decode(ByteBuf buf, Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public void encode(ByteBuf buf, Direction direction, ProtocolVersion version) { if (!this.chunk.isFullChunk()) { // 1.17 supports only full chunks. Preconditions.checkState(version.compareTo(ProtocolVersion.MINECRAFT_1_17) < 0); } buf.writeInt(this.chunk.getPosX()); buf.writeInt(this.chunk.getPosZ()); if (version.compareTo(ProtocolVersion.MINECRAFT_1_17) >= 0) { // 1.17 mask. if (version.compareTo(ProtocolVersion.MINECRAFT_1_17_1) <= 0) { long[] mask = this.create117Mask(); ProtocolUtils.writeVarInt(buf, mask.length); for (long l : mask) { buf.writeLong(l); } } } else { buf.writeBoolean(this.chunk.isFullChunk()); if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0 && version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) < 0) { buf.writeBoolean(true); // Ignore old data. } // Mask. if (version.compareTo(ProtocolVersion.MINECRAFT_1_8) > 0) { ProtocolUtils.writeVarInt(buf, this.mask); } else { // OptiFine devs have over-optimized the chunk loading by breaking loading of void-chunks. // We are changing void-chunks length here, and OptiFine client thinks that the chunk is not void-alike. buf.writeShort(this.mask == 0 ? 1 : this.mask); } } // 1.14+ heightMap. if (version.compareTo(ProtocolVersion.MINECRAFT_1_14) >= 0) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) < 0) { ProtocolUtils.writeBinaryTag(buf, version, this.heightmap114); } else if (version.compareTo(ProtocolVersion.MINECRAFT_1_21_5) < 0) { ProtocolUtils.writeBinaryTag(buf, version, this.heightmap116); } else { ProtocolUtils.writeVarInt(buf, this.heightmap1215.size()); for (Map.Entry entry : this.heightmap1215.entrySet()) { ProtocolUtils.writeVarInt(buf, entry.getKey()); ProtocolUtils.writeVarInt(buf, entry.getValue().length); for (long l : entry.getValue()) { buf.writeLong(l); } } } } // 1.15 - 1.17 biomes. if (this.chunk.isFullChunk() && version.compareTo(ProtocolVersion.MINECRAFT_1_15) >= 0 && version.compareTo(ProtocolVersion.MINECRAFT_1_17_1) <= 0) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0) { ProtocolUtils.writeVarInt(buf, this.biomeData.getPost115Biomes().length); for (int b : this.biomeData.getPost115Biomes()) { ProtocolUtils.writeVarInt(buf, b); } } else { for (int b : this.biomeData.getPost115Biomes()) { buf.writeInt(b); } } } ByteBuf data = this.createChunkData(version); try { if (version.compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) { ProtocolUtils.writeVarInt(buf, data.readableBytes()); buf.writeBytes(data); if (version.compareTo(ProtocolVersion.MINECRAFT_1_9_4) >= 0) { List blockEntityEntries = this.chunk.getBlockEntityEntries(); ProtocolUtils.writeVarInt(buf, blockEntityEntries.size()); for (VirtualBlockEntity.Entry blockEntityEntry : blockEntityEntries) { CompoundBinaryTag blockEntityNbt = blockEntityEntry.getNbt(); if (version.compareTo(ProtocolVersion.MINECRAFT_1_18) >= 0) { buf.writeByte(((blockEntityEntry.getPosX() & 15) << 4) | (blockEntityEntry.getPosZ() & 15)); buf.writeShort(blockEntityEntry.getPosY()); ProtocolUtils.writeVarInt(buf, blockEntityEntry.getID(version)); } else { blockEntityNbt.putString("id", blockEntityEntry.getBlockEntity().getModernID()); blockEntityNbt.putInt("x", blockEntityEntry.getPosX()); blockEntityNbt.putInt("y", blockEntityEntry.getPosY()); blockEntityNbt.putInt("z", blockEntityEntry.getPosZ()); } ProtocolUtils.writeBinaryTag(buf, version, blockEntityNbt); } } if (version.compareTo(ProtocolVersion.MINECRAFT_1_17_1) > 0) { long[] mask = this.create117Mask(); if (version.compareTo(ProtocolVersion.MINECRAFT_1_20) < 0) { buf.writeBoolean(true); // Trust edges. } ProtocolUtils.writeVarInt(buf, mask.length); // Skylight mask. for (long m : mask) { buf.writeLong(m); } ProtocolUtils.writeVarInt(buf, mask.length); // BlockLight mask. for (long m : mask) { buf.writeLong(m); } ProtocolUtils.writeVarInt(buf, 0); // EmptySkylight mask. ProtocolUtils.writeVarInt(buf, 0); // EmptyBlockLight mask. ProtocolUtils.writeVarInt(buf, this.chunk.getLight().length); for (LightSection section : this.chunk.getLight()) { ProtocolUtils.writeByteArray(buf, section.getSkyLight().getData()); } ProtocolUtils.writeVarInt(buf, this.chunk.getLight().length); for (LightSection section : this.chunk.getLight()) { ProtocolUtils.writeByteArray(buf, section.getBlockLight().getData()); } } } else { this.write17(buf, data); } } finally { data.release(); } } private ByteBuf createChunkData(ProtocolVersion version) { int dataLength = 0; for (NetworkSection networkSection : this.sections) { if (networkSection != null) { dataLength += networkSection.getDataLength(version); } } if (this.chunk.isFullChunk() && version.compareTo(ProtocolVersion.MINECRAFT_1_15) < 0) { dataLength += (version.compareTo(ProtocolVersion.MINECRAFT_1_13) < 0 ? 256 : 256 * 4); } if (version.compareTo(ProtocolVersion.MINECRAFT_1_18) >= 0) { int emptySectionSize = version.noLessThan(ProtocolVersion.MINECRAFT_26_1) ? 8 : (version.noLessThan(ProtocolVersion.MINECRAFT_1_21_5) ? 6 : 8); dataLength += (this.maxSections - this.nonNullSections) * emptySectionSize; } ByteBuf data = Unpooled.buffer(dataLength); for (int pass = 0; pass < 4; ++pass) { for (NetworkSection section : this.sections) { if (section != null) { section.writeData(data, pass, version); } else if (pass == 0 && version.compareTo(ProtocolVersion.MINECRAFT_1_18) >= 0) { data.writeShort(0); // Block count = 0. if (version.noLessThan(ProtocolVersion.MINECRAFT_26_1)) { data.writeShort(0); // Fluid count = 0. } data.writeByte(0); // BlockStorage: 0 bit per entry = Single palette. ProtocolUtils.writeVarInt(data, Block.AIR.getID()); // Only air block in the palette. if (version.compareTo(ProtocolVersion.MINECRAFT_1_21_5) < 0) { ProtocolUtils.writeVarInt(data, 0); // BlockStorage: 0 entries. } data.writeByte(0); // BiomeStorage: 0 bit per entry = Single palette. ProtocolUtils.writeVarInt(data, Biome.PLAINS.getID()); // Only Plain biome in the palette. if (version.compareTo(ProtocolVersion.MINECRAFT_1_21_5) < 0) { ProtocolUtils.writeVarInt(data, 0); // BiomeStorage: 0 entries. } } } } if (this.chunk.isFullChunk() && version.compareTo(ProtocolVersion.MINECRAFT_1_15) < 0) { for (byte b : this.biomeData.getPre115Biomes()) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_13) < 0) { data.writeByte(b); } else { data.writeInt(b); } } } if (dataLength != data.readableBytes()) { LimboAPI.getLogger().warn("Data length mismatch: " + dataLength + " != " + data.readableBytes() + ". Version: " + version); } return data; } private CompoundBinaryTag createHeightMap(boolean pre116) { CompactStorage surface = pre116 ? new BitStorage19(9, 256) : new BitStorage116(9, 256); CompactStorage motionBlocking = pre116 ? new BitStorage19(9, 256) : new BitStorage116(9, 256); for (int posY = 0; posY < 256; ++posY) { for (int posX = 0; posX < 16; ++posX) { for (int posZ = 0; posZ < 16; ++posZ) { VirtualBlock block = this.chunk.getBlock(posX, posY, posZ); if (!block.isAir()) { surface.set(posX + (posZ << 4), posY + 1); } if (block.isMotionBlocking()) { motionBlocking.set(posX + (posZ << 4), posY + 1); } } } } return CompoundBinaryTag.builder() .putLongArray("MOTION_BLOCKING", motionBlocking.getData()) .putLongArray("WORLD_SURFACE", surface.getData()) .build(); } private long[] create117Mask() { return BitSet.valueOf( new long[] { this.mask } ).toLongArray(); } // TODO: Use velocity compressor. private void write17(ByteBuf out, ByteBuf data) { out.writeShort(0); // Extended bitmask. byte[] uncompressed = new byte[data.readableBytes()]; data.readBytes(uncompressed); ByteBuf compressed = Unpooled.buffer(); Deflater deflater = new Deflater(9); try { deflater.setInput(uncompressed); deflater.finish(); byte[] buffer = new byte[1024]; while (!deflater.finished()) { int count = deflater.deflate(buffer); compressed.writeBytes(buffer, 0, count); } out.writeInt(compressed.readableBytes()); // Compressed size. out.writeBytes(compressed); } finally { deflater.end(); compressed.release(); } } @Override public boolean handle(MinecraftSessionHandler handler) { return true; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/ChunkUnloadPacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.s2c; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; public record ChunkUnloadPacket(int posX, int posZ) implements MinecraftPacket { public ChunkUnloadPacket() { this(0, 0); throw new IllegalStateException(); } @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { buf.writeLong(protocolVersion.noGreaterThan(ProtocolVersion.MINECRAFT_1_20) ? (((long) this.posX & 0xFFFFFFFFL) << 32 | (long) this.posZ & 0xFFFFFFFFL) : (((long) this.posZ & 0xFFFFFFFFL) << 32 | (long) this.posX & 0xFFFFFFFFL) // >=1.20.2 ); if (protocolVersion.noGreaterThan(ProtocolVersion.MINECRAFT_1_8)) { // essentially, it's ChunkData, but written in a way that the chunk gets unloaded buf.writeBoolean(true); buf.writeShort(0); if (protocolVersion == ProtocolVersion.MINECRAFT_1_8) { ProtocolUtils.writeVarInt(buf, 0); } else { buf.writeShort(0); buf.writeInt(0); } } } @Override public boolean handle(MinecraftSessionHandler handler) { throw new IllegalStateException(); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/DefaultSpawnPositionPacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.s2c; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; public class DefaultSpawnPositionPacket implements MinecraftPacket { private final String dimension; private final int posX; private final int posY; private final int posZ; private final float yaw; private final float pitch; public DefaultSpawnPositionPacket(String dimension, int posX, int posY, int posZ, float yaw, float pitch) { this.dimension = dimension; this.posX = posX; this.posY = posY; this.posZ = posZ; this.yaw = yaw; this.pitch = pitch; } public DefaultSpawnPositionPacket() { throw new IllegalStateException(); } @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { if (protocolVersion.noLessThan(ProtocolVersion.MINECRAFT_1_21_9)) { ProtocolUtils.writeString(buf, this.dimension); buf.writeLong(((this.posX & 0x3FFFFFFL) << 38) | ((this.posZ & 0x3FFFFFFL) << 12) | (this.posY & 0xFFFL)); buf.writeFloat(this.yaw); buf.writeFloat(this.pitch); } else if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0) { buf.writeInt(this.posX); buf.writeInt(this.posY); buf.writeInt(this.posZ); } else { long location; if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_14) < 0) { location = ((this.posX & 0x3FFFFFFL) << 38) | ((this.posY & 0xFFFL) << 26) | (this.posZ & 0x3FFFFFFL); } else { location = ((this.posX & 0x3FFFFFFL) << 38) | ((this.posZ & 0x3FFFFFFL) << 12) | (this.posY & 0xFFFL); } buf.writeLong(location); if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_17) >= 0) { buf.writeFloat(this.yaw); } } } @Override public boolean handle(MinecraftSessionHandler handler) { return true; } @Override public String toString() { return "DefaultSpawnPositionPacket{" + "dimension='" + this.dimension + '\'' + ", posX=" + this.posX + ", posY=" + this.posY + ", posZ=" + this.posZ + ", yaw=" + this.yaw + ", pitch=" + this.pitch + '}'; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/MapDataPacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.s2c; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import net.elytrium.limboapi.api.protocol.packets.data.MapData; public class MapDataPacket implements MinecraftPacket { private final int mapID; private final byte scale; private final MapData mapData; public MapDataPacket(int mapID, byte scale, MapData mapData) { this.mapID = mapID; this.scale = scale; this.mapData = mapData; } public MapDataPacket() { throw new IllegalStateException(); } @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { ProtocolUtils.writeVarInt(buf, this.mapID); byte[] data = this.mapData.getData(); if (version.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0) { buf.writeShort(data.length + 3); buf.writeByte(0); buf.writeByte(this.mapData.getX()); buf.writeByte(this.mapData.getY()); buf.writeBytes(data); } else { buf.writeByte(this.scale); if (version.compareTo(ProtocolVersion.MINECRAFT_1_9) >= 0 && version.compareTo(ProtocolVersion.MINECRAFT_1_17) < 0) { buf.writeBoolean(false); } if (version.compareTo(ProtocolVersion.MINECRAFT_1_14) >= 0) { buf.writeBoolean(false); } if (version.compareTo(ProtocolVersion.MINECRAFT_1_17) >= 0) { buf.writeBoolean(false); } else { ProtocolUtils.writeVarInt(buf, 0); } buf.writeByte(this.mapData.getColumns()); buf.writeByte(this.mapData.getRows()); buf.writeByte(this.mapData.getX()); buf.writeByte(this.mapData.getY()); ProtocolUtils.writeByteArray(buf, data); } } @Override public boolean handle(MinecraftSessionHandler handler) { return true; } @Override public String toString() { return "MapDataPacket{" + "mapID=" + this.mapID + ", scale=" + this.scale + ", mapData=" + this.mapData + "}"; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/PlayerAbilitiesPacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.s2c; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; public class PlayerAbilitiesPacket implements MinecraftPacket { private final byte flags; private final float walkSpeed; private final float flySpeed; public PlayerAbilitiesPacket(byte flags, float flySpeed, float walkSpeed) { this.flags = flags; this.flySpeed = flySpeed; this.walkSpeed = walkSpeed; } public PlayerAbilitiesPacket() { throw new IllegalStateException(); } @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { buf.writeByte(this.flags); buf.writeFloat(this.flySpeed); buf.writeFloat(this.walkSpeed); } @Override public boolean handle(MinecraftSessionHandler handler) { return true; } @Override public String toString() { return "PlayerAbilities{" + "flags=" + this.flags + ", flySpeed=" + this.flySpeed + ", walkSpeed=" + this.walkSpeed + "}"; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/PositionRotationPacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.s2c; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; public class PositionRotationPacket implements MinecraftPacket { private final double posX; private final double posY; private final double posZ; private final float yaw; private final float pitch; private final boolean onGround; private final int teleportID; private final boolean dismountVehicle; @Deprecated(forRemoval = true) public PositionRotationPacket(double posX, double posY, double posZ, float yaw, float pitch, int teleportID, boolean onGround, boolean dismountVehicle) { this(posX, posY, posZ, yaw, pitch, onGround, teleportID, dismountVehicle); } public PositionRotationPacket(double posX, double posY, double posZ, float yaw, float pitch, boolean onGround, int teleportID, boolean dismountVehicle) { this.posX = posX; this.posY = posY; this.posZ = posZ; this.yaw = yaw; this.pitch = pitch; this.onGround = onGround; this.teleportID = teleportID; this.dismountVehicle = dismountVehicle; } public PositionRotationPacket() { throw new IllegalStateException(); } @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { if (protocolVersion.noLessThan(ProtocolVersion.MINECRAFT_1_21_2)) { this.encodeModern(buf, protocolVersion); } else { this.encodeLegacy(buf, protocolVersion); } } public void encodeModern(ByteBuf buf, ProtocolVersion protocolVersion) { ProtocolUtils.writeVarInt(buf, this.teleportID); buf.writeDouble(this.posX); buf.writeDouble(this.posY); buf.writeDouble(this.posZ); // velocity buf.writeDouble(0); buf.writeDouble(0); buf.writeDouble(0); buf.writeFloat(this.yaw); buf.writeFloat(this.pitch); buf.writeInt(0); // not relative } public void encodeLegacy(ByteBuf buf, ProtocolVersion protocolVersion) { buf.writeDouble(this.posX); buf.writeDouble(this.posY); buf.writeDouble(this.posZ); buf.writeFloat(this.yaw); buf.writeFloat(this.pitch); if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0) { buf.writeBoolean(this.onGround); } else { buf.writeByte(0x00); // Flags. if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_9) >= 0) { ProtocolUtils.writeVarInt(buf, this.teleportID); } if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_17) >= 0 && protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_19_3) <= 0) { buf.writeBoolean(this.dismountVehicle); } } } @Override public boolean handle(MinecraftSessionHandler handler) { return true; } @Override public String toString() { return "PlayerPositionAndLook{" + "posX=" + this.posX + ", posY=" + this.posY + ", posZ=" + this.posZ + ", yaw=" + this.yaw + ", pitch=" + this.pitch + ", teleportID=" + this.teleportID + ", onGround=" + this.onGround + ", dismountVehicle=" + this.dismountVehicle + "}"; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/SetExperiencePacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.s2c; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; public class SetExperiencePacket implements MinecraftPacket { private final float expBar; private final int level; private final int totalExp; public SetExperiencePacket(float expBar, int level, int totalExp) { this.expBar = expBar; this.level = level; this.totalExp = totalExp; } public SetExperiencePacket() { throw new IllegalStateException(); } @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { buf.writeFloat(this.expBar); if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0) { buf.writeShort(this.level); buf.writeShort(this.totalExp); } else { ProtocolUtils.writeVarInt(buf, this.level); ProtocolUtils.writeVarInt(buf, this.totalExp); } } @Override public boolean handle(MinecraftSessionHandler handler) { return true; } @Override public String toString() { return "SetExperience{" + "expBar=" + this.expBar + ", level=" + this.level + ", totalExp=" + this.totalExp + "}"; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/SetSlotPacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.s2c; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import net.elytrium.limboapi.api.material.VirtualItem; import net.elytrium.limboapi.api.protocol.item.ItemComponentMap; import net.elytrium.limboapi.utils.ProtocolTools; import net.kyori.adventure.nbt.CompoundBinaryTag; import org.checkerframework.checker.nullness.qual.Nullable; public class SetSlotPacket implements MinecraftPacket { private final int windowID; private final int slot; private final VirtualItem item; private final int count; private final int data; @Nullable private final CompoundBinaryTag nbt; @Nullable private final ItemComponentMap map; public SetSlotPacket(int windowID, int slot, VirtualItem item, int count, int data, @Nullable CompoundBinaryTag nbt, @Nullable ItemComponentMap map) { this.windowID = windowID; this.slot = slot; this.item = item; this.count = count; this.data = data; this.nbt = nbt; this.map = map; } public SetSlotPacket() { throw new IllegalStateException(); } @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_20_5) >= 0) { this.encodeModern(buf, direction, protocolVersion); } else { this.encodeLegacy(buf, direction, protocolVersion); } } public void encodeModern(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { ProtocolTools.writeContainerId(buf, protocolVersion, this.windowID); ProtocolUtils.writeVarInt(buf, 0); buf.writeShort(this.slot); int id = this.item.getID(protocolVersion); if (id == 0) { ProtocolUtils.writeVarInt(buf, 0); } else { ProtocolUtils.writeVarInt(buf, this.count); ProtocolUtils.writeVarInt(buf, id); if (this.map != null) { this.map.write(protocolVersion, buf); } else { ProtocolUtils.writeVarInt(buf, 0); ProtocolUtils.writeVarInt(buf, 0); } } } public void encodeLegacy(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { buf.writeByte(this.windowID); if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_17_1) >= 0) { ProtocolUtils.writeVarInt(buf, 0); // State ID. } buf.writeShort(this.slot); int id = this.item.getID(protocolVersion); boolean present = id > 0; if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_13_2) >= 0) { buf.writeBoolean(present); } if (!present && protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_13_2) < 0) { buf.writeShort(-1); } if (present) { if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_13_2) < 0) { buf.writeShort(id); } else { ProtocolUtils.writeVarInt(buf, id); } buf.writeByte(this.count); if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_13) < 0) { buf.writeShort(this.data); } if (this.nbt == null) { if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0) { buf.writeShort(-1); } else { buf.writeByte(0); } } else { ProtocolUtils.writeBinaryTag(buf, protocolVersion, this.nbt); } } } @Override public boolean handle(MinecraftSessionHandler handler) { return true; } @Override public String toString() { return "SetSlot{" + "windowID=" + this.windowID + ", slot=" + this.slot + ", count=" + this.count + ", data=" + this.data + ", nbt=" + this.nbt + ")"; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/TimeUpdatePacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.s2c; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; public class TimeUpdatePacket implements MinecraftPacket { private final long worldAge; private final long timeOfDay; public TimeUpdatePacket(long worldAge, long timeOfDay) { this.worldAge = worldAge; this.timeOfDay = timeOfDay; } public TimeUpdatePacket() { throw new IllegalStateException(); } @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { buf.writeLong(this.worldAge); if (protocolVersion.noLessThan(ProtocolVersion.MINECRAFT_26_1)) { ProtocolUtils.writeVarInt(buf, 1); // map size ProtocolUtils.writeVarInt(buf, 0); // overworld buf.writeLong(this.timeOfDay); buf.writeBoolean(false); // no ticking } else { buf.writeLong(this.timeOfDay); if (protocolVersion.noLessThan(ProtocolVersion.MINECRAFT_1_21_2)) { buf.writeBoolean(false); // no ticking } } } @Override public boolean handle(MinecraftSessionHandler handler) { return true; } @Override public String toString() { return "TimeUpdatePacket{" + "worldAge=" + this.worldAge + ", timeOfDay=" + this.timeOfDay + "}"; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/UpdateTagsPacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.s2c; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; public class UpdateTagsPacket implements MinecraftPacket { private final Map>> tags; public UpdateTagsPacket() { throw new IllegalStateException(); } public UpdateTagsPacket(Map>> tags) { this.tags = tags; } public Map> toVelocityTags() { Map> newTags = new LinkedHashMap<>(); for (Entry>> entry : this.tags.entrySet()) { Map tagRegistry = new LinkedHashMap<>(); for (Entry> tagEntry : entry.getValue().entrySet()) { tagRegistry.put(tagEntry.getKey(), tagEntry.getValue().stream().mapToInt(Integer::intValue).toArray()); } newTags.put(entry.getKey(), tagRegistry); } return newTags; } @Override public void decode(ByteBuf byteBuf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_17) >= 0) { ProtocolUtils.writeVarInt(buf, this.tags.size()); this.tags.forEach((tagType, tagList) -> { ProtocolUtils.writeString(buf, tagType); writeTagList(buf, tagList); }); } else { writeTagList(buf, this.tags.get("minecraft:block")); writeTagList(buf, this.tags.get("minecraft:item")); writeTagList(buf, this.tags.get("minecraft:fluid")); if (version.compareTo(ProtocolVersion.MINECRAFT_1_14) >= 0) { writeTagList(buf, this.tags.get("minecraft:entity_type")); } } } private static void writeTagList(ByteBuf buf, Map> tagList) { ProtocolUtils.writeVarInt(buf, tagList.size()); tagList.forEach((tagId, blockList) -> { ProtocolUtils.writeString(buf, tagId); ProtocolUtils.writeVarInt(buf, blockList.size()); blockList.forEach(blockId -> ProtocolUtils.writeVarInt(buf, blockId)); }); } @Override public boolean handle(MinecraftSessionHandler handler) { return true; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/packets/s2c/UpdateViewPositionPacket.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.packets.s2c; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; public class UpdateViewPositionPacket implements MinecraftPacket { private final int posX; private final int posZ; public UpdateViewPositionPacket(int posX, int posZ) { this.posX = posX; this.posZ = posZ; } public UpdateViewPositionPacket() { throw new IllegalStateException(); } @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { throw new IllegalStateException(); } @Override public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { ProtocolUtils.writeVarInt(buf, this.posX); ProtocolUtils.writeVarInt(buf, this.posZ); } @Override public boolean handle(MinecraftSessionHandler handler) { return true; } @Override public String toString() { return "UpdateViewPosition{" + "posX=" + this.posX + ", posZ=" + this.posZ + "}"; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/protocol/util/NetworkSection.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.protocol.util; import com.velocitypowered.api.network.ProtocolVersion; import io.netty.buffer.ByteBuf; import java.util.EnumMap; import java.util.Map; import net.elytrium.limboapi.api.chunk.VirtualBiome; import net.elytrium.limboapi.api.chunk.VirtualBlock; import net.elytrium.limboapi.api.chunk.data.BlockSection; import net.elytrium.limboapi.api.chunk.data.BlockStorage; import net.elytrium.limboapi.api.mcprotocollib.NibbleArray3D; import net.elytrium.limboapi.protocol.data.BiomeStorage118; import net.elytrium.limboapi.protocol.data.BlockStorage17; import net.elytrium.limboapi.protocol.data.BlockStorage19; import net.elytrium.limboapi.server.world.chunk.SimpleChunk; public class NetworkSection { private final Map storages = new EnumMap<>(ProtocolVersion.class); private final Map biomeStorages = new EnumMap<>(ProtocolVersion.class); private final NibbleArray3D blockLight; private final NibbleArray3D skyLight; private final BlockSection section; private final VirtualBiome[] biomes; private final int index; private int blockCount = -1; private int fluidCount = -1; public NetworkSection(int index, BlockSection section, NibbleArray3D blockLight, NibbleArray3D skyLight, VirtualBiome[] biomes) { this.index = index; this.section = section; this.blockLight = blockLight; this.skyLight = skyLight; this.biomes = biomes; } public int getDataLength(ProtocolVersion version) { int dataLength = this.ensureStorageCreated(version).getDataLength(version); if (version.compareTo(ProtocolVersion.MINECRAFT_1_14) < 0) { dataLength += this.blockLight.getData().length; if (this.skyLight != null) { dataLength += this.skyLight.getData().length; } } if (version.compareTo(ProtocolVersion.MINECRAFT_1_14) >= 0) { dataLength += 2; // Block count short. } if (version.compareTo(ProtocolVersion.MINECRAFT_26_1) >= 0) { dataLength += 2; // Fluid count short. } if (version.compareTo(ProtocolVersion.MINECRAFT_1_17_1) > 0) { dataLength += this.ensure118BiomeCreated(version).getDataLength(version); } return dataLength; } public void writeData(ByteBuf buf, int pass, ProtocolVersion version) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_9) < 0) { BlockStorage storage = this.ensureStorageCreated(version); this.write17Data(buf, storage, version, pass); } else if (pass == 0) { BlockStorage storage = this.ensureStorageCreated(version); if (version.compareTo(ProtocolVersion.MINECRAFT_1_14) < 0) { this.write19Data(buf, storage, version, pass); } else { this.write114Data(buf, storage, version, pass); if (version.compareTo(ProtocolVersion.MINECRAFT_1_17_1) > 0) { this.write118Biomes(buf, version); } } } } private BlockStorage ensureStorageCreated(ProtocolVersion version) { BlockStorage storage = this.storages.get(version); if (storage == null) { synchronized (this.storages) { BlockStorage blockStorage = this.createStorage(version); this.fillBlocks(blockStorage); this.storages.put(version, blockStorage); storage = blockStorage; } } return storage; } private BlockStorage createStorage(ProtocolVersion version) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_9) < 0) { return new BlockStorage17(); } else { return new BlockStorage19(version); } } private void write17Data(ByteBuf buf, BlockStorage storage, ProtocolVersion version, int pass) { if (pass == 0 || pass == 1) { storage.write(buf, version, pass); } else if (pass == 2) { buf.writeBytes(this.blockLight.getData()); } else if (pass == 3 && this.skyLight != null) { buf.writeBytes(this.skyLight.getData()); } } private void write19Data(ByteBuf buf, BlockStorage storage, ProtocolVersion version, int pass) { storage.write(buf, version, pass); buf.writeBytes(this.blockLight.getData()); if (this.skyLight != null) { buf.writeBytes(this.skyLight.getData()); } } private void write114Data(ByteBuf buf, BlockStorage storage, ProtocolVersion version, int pass) { buf.writeShort(this.blockCount); if (version.noLessThan(ProtocolVersion.MINECRAFT_26_1)) { buf.writeShort(this.fluidCount); } storage.write(buf, version, pass); } private void write118Biomes(ByteBuf buf, ProtocolVersion version) { this.ensure118BiomeCreated(version).write(buf, version); } private BiomeStorage118 ensure118BiomeCreated(ProtocolVersion version) { BiomeStorage118 storage = this.biomeStorages.get(version); if (storage == null) { synchronized (this.biomeStorages) { storage = new BiomeStorage118(version); int offset = this.index * SimpleChunk.MAX_BIOMES_PER_SECTION; for (int biomeIndex = 0, biomeArrayIndex = offset; biomeIndex < SimpleChunk.MAX_BIOMES_PER_SECTION; ++biomeIndex, ++biomeArrayIndex) { storage.set(biomeIndex, this.biomes[biomeArrayIndex]); } this.biomeStorages.put(version, storage); } } return storage; } private void fillBlocks(BlockStorage storage) { int blockCount = 0; for (int posX = 0; posX < 16; ++posX) { for (int posY = 0; posY < 16; ++posY) { for (int posZ = 0; posZ < 16; ++posZ) { VirtualBlock block = this.section.getBlockAt(posX, posY, posZ); if (!block.isAir()) { ++blockCount; storage.set(posX, posY, posZ, block); } } } } if (this.blockCount == -1) { this.blockCount = blockCount; // TODO: properly set fluidCount, as of 26.1 it is used only to guess about fluid in chunks. this.fluidCount = blockCount; } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/CachedPackets.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.packet.DisconnectPacket; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.Settings; import net.elytrium.limboapi.api.protocol.PreparedPacket; public class CachedPackets { private final LimboAPI plugin; private PreparedPacket tooBigPacket; private PreparedPacket invalidPing; private PreparedPacket invalidSwitch; private PreparedPacket playTimeOut; private PreparedPacket configTimeOut; private boolean cached; public CachedPackets(LimboAPI plugin) { this.plugin = plugin; } public void createPackets() { if (this.cached) { this.dispose(); } this.tooBigPacket = this.plugin.createPreparedPacket() .prepare(version -> this.createDisconnectPacket(Settings.IMP.MAIN.MESSAGES.TOO_BIG_PACKET, version)).build(); this.invalidPing = this.plugin.createPreparedPacket() .prepare(version -> this.createDisconnectPacket(Settings.IMP.MAIN.MESSAGES.INVALID_PING, version)).build(); this.invalidSwitch = this.plugin.createConfigPreparedPacket() .prepare(version -> this.createDisconnectPacket(Settings.IMP.MAIN.MESSAGES.INVALID_SWITCH, version), ProtocolVersion.MINECRAFT_1_20_2).build(); this.playTimeOut = this.plugin.createPreparedPacket() .prepare(version -> this.createDisconnectPacket(Settings.IMP.MAIN.MESSAGES.TIME_OUT, version)).build(); this.configTimeOut = this.plugin.createConfigPreparedPacket() .prepare(version -> this.createDisconnectPacket(Settings.IMP.MAIN.MESSAGES.TIME_OUT, version), ProtocolVersion.MINECRAFT_1_20_2).build(); this.cached = true; } private DisconnectPacket createDisconnectPacket(String message, ProtocolVersion version) { return DisconnectPacket.create(LimboAPI.getSerializer().deserialize(message), version, StateRegistry.PLAY); } public PreparedPacket getTooBigPacket() { return this.tooBigPacket; } public PreparedPacket getInvalidPing() { return this.invalidPing; } public PreparedPacket getInvalidSwitch() { return this.invalidSwitch; } public PreparedPacket getTimeOut(StateRegistry stateRegistry) { if (stateRegistry == StateRegistry.CONFIG) { return this.configTimeOut; } return this.playTimeOut; } public void dispose() { this.tooBigPacket.release(); this.invalidPing.release(); this.invalidSwitch.release(); this.playTimeOut.release(); this.configTimeOut.release(); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/LimboImpl.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.mojang.brigadier.tree.RootCommandNode; import com.velocitypowered.api.command.Command; import com.velocitypowered.api.command.CommandMeta; import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.command.SimpleCommand; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.proxy.command.registrar.BrigadierCommandRegistrar; import com.velocitypowered.proxy.command.registrar.CommandRegistrar; import com.velocitypowered.proxy.command.registrar.RawCommandRegistrar; import com.velocitypowered.proxy.command.registrar.SimpleCommandRegistrar; import com.velocitypowered.proxy.connection.ConnectionTypes; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.backend.VelocityServerConnection; import com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler; import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.connection.registry.DimensionInfo; import com.velocitypowered.proxy.network.Connections; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.VelocityConnectionEvent; import com.velocitypowered.proxy.protocol.packet.AvailableCommandsPacket; import com.velocitypowered.proxy.protocol.packet.BossBarPacket; import com.velocitypowered.proxy.protocol.packet.JoinGamePacket; import com.velocitypowered.proxy.protocol.packet.LegacyPlayerListItemPacket; import com.velocitypowered.proxy.protocol.packet.PluginMessagePacket; import com.velocitypowered.proxy.protocol.packet.RespawnPacket; import com.velocitypowered.proxy.protocol.packet.UpsertPlayerInfoPacket; import com.velocitypowered.proxy.protocol.packet.chat.ComponentHolder; import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.RegistrySyncPacket; import com.velocitypowered.proxy.protocol.packet.config.StartUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.TagsUpdatePacket; import com.velocitypowered.proxy.protocol.packet.title.GenericTitlePacket; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelOutboundHandlerAdapter; import io.netty.channel.ChannelPipeline; import io.netty.handler.timeout.ReadTimeoutHandler; import it.unimi.dsi.fastutil.Pair; import java.io.IOException; import java.io.InputStream; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.EnumSet; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Objects; import java.util.UUID; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.LongAdder; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.function.Function; import java.util.function.Supplier; import net.elytrium.commons.utils.reflection.ReflectionException; import net.elytrium.fastprepare.PreparedPacketFactory; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.Settings; import net.elytrium.limboapi.api.Limbo; import net.elytrium.limboapi.api.LimboSessionHandler; import net.elytrium.limboapi.api.chunk.Dimension; import net.elytrium.limboapi.api.chunk.VirtualChunk; import net.elytrium.limboapi.api.chunk.VirtualWorld; import net.elytrium.limboapi.api.command.LimboCommandMeta; import net.elytrium.limboapi.api.player.GameMode; import net.elytrium.limboapi.api.protocol.PacketDirection; import net.elytrium.limboapi.api.protocol.PreparedPacket; import net.elytrium.limboapi.api.protocol.packets.PacketMapping; import net.elytrium.limboapi.injection.login.confirmation.LoginConfirmHandler; import net.elytrium.limboapi.injection.packet.MinecraftLimitedCompressDecoder; import net.elytrium.limboapi.material.Biome; import net.elytrium.limboapi.protocol.LimboProtocol; import net.elytrium.limboapi.protocol.packets.s2c.ChangeGameStatePacket; import net.elytrium.limboapi.protocol.packets.s2c.ChunkDataPacket; import net.elytrium.limboapi.protocol.packets.s2c.DefaultSpawnPositionPacket; import net.elytrium.limboapi.protocol.packets.s2c.PositionRotationPacket; import net.elytrium.limboapi.protocol.packets.s2c.TimeUpdatePacket; import net.elytrium.limboapi.protocol.packets.s2c.UpdateViewPositionPacket; import net.elytrium.limboapi.server.world.SimpleTagManager; import net.kyori.adventure.nbt.BinaryTag; import net.kyori.adventure.nbt.BinaryTagIO; import net.kyori.adventure.nbt.BinaryTagTypes; import net.kyori.adventure.nbt.CompoundBinaryTag; import net.kyori.adventure.nbt.ListBinaryTag; import net.kyori.adventure.nbt.StringBinaryTag; import net.kyori.adventure.text.Component; public class LimboImpl implements Limbo { private static final ImmutableSet LEVELS = ImmutableSet.of( Dimension.OVERWORLD.getKey(), Dimension.NETHER.getKey(), Dimension.THE_END.getKey() ); private static final MethodHandle PARTIAL_HASHED_SEED_FIELD; private static final MethodHandle CURRENT_DIMENSION_DATA_FIELD; private static final MethodHandle ROOT_NODE_FIELD; private static final MethodHandle GRACEFUL_DISCONNECT_FIELD; private static final MethodHandle REGISTRY_FIELD; private static final MethodHandle LEVEL_NAMES_FIELDS; private static final CompoundBinaryTag CHAT_TYPE_119; private static final CompoundBinaryTag CHAT_TYPE_1191; private static final CompoundBinaryTag DAMAGE_TYPE_1194; private static final CompoundBinaryTag DAMAGE_TYPE_120; private final Map, PreparedPacket> brandMessages = new HashMap<>(2); private final LimboAPI plugin; private final VirtualWorld world; private final LongAdder currentOnline = new LongAdder(); private final RootCommandNode commandNode = new RootCommandNode<>(); private final ReadWriteLock lock = new ReentrantReadWriteLock(); private final List queuedToRelease = new ArrayList<>(); private final List> registrars = ImmutableList.of( new BrigadierCommandRegistrar(this.commandNode, this.lock.writeLock()), new SimpleCommandRegistrar(this.commandNode, this.lock.writeLock()), new RawCommandRegistrar(this.commandNode, this.lock.writeLock()) ); private String limboName; private Integer readTimeout; private Long worldTicks; private short gameMode = GameMode.ADVENTURE.getID(); private Integer maxSuppressPacketLength; private PreparedPacket joinPackets; private PreparedPacket fastRejoinPackets; private PreparedPacket safeRejoinPackets; private PreparedPacket postJoinPackets; private PreparedPacket firstChunks; private List delayedChunks; private PreparedPacket respawnPackets; protected PreparedPacket configTransitionPackets; protected PreparedPacket configPackets; protected StateRegistry localStateRegistry; private boolean shouldRespawn = true; private boolean shouldRejoin = true; private boolean shouldUpdateTags = true; private boolean reducedDebugInfo = Settings.IMP.MAIN.REDUCED_DEBUG_INFO; private int viewDistance = Settings.IMP.MAIN.VIEW_DISTANCE; private int simulationDistance = Settings.IMP.MAIN.SIMULATION_DISTANCE; private volatile boolean built = true; private boolean disposeScheduled = false; public LimboImpl(LimboAPI plugin, VirtualWorld world) { this.plugin = plugin; this.world = world; this.localStateRegistry = LimboProtocol.getLimboStateRegistry(); this.refresh(); } protected void refresh() { JoinGamePacket legacyJoinGame = this.createLegacyJoinGamePacket(); JoinGamePacket joinGame = this.createJoinGamePacket(ProtocolVersion.MINECRAFT_1_16); JoinGamePacket joinGame1162 = this.createJoinGamePacket(ProtocolVersion.MINECRAFT_1_16_2); JoinGamePacket joinGame1182 = this.createJoinGamePacket(ProtocolVersion.MINECRAFT_1_18_2); JoinGamePacket joinGame119 = this.createJoinGamePacket(ProtocolVersion.MINECRAFT_1_19); JoinGamePacket joinGame1191 = this.createJoinGamePacket(ProtocolVersion.MINECRAFT_1_19_1); JoinGamePacket joinGame1194 = this.createJoinGamePacket(ProtocolVersion.MINECRAFT_1_19_4); JoinGamePacket joinGame120 = this.createJoinGamePacket(ProtocolVersion.MINECRAFT_1_20); JoinGamePacket joinGame121 = this.createJoinGamePacket(ProtocolVersion.MINECRAFT_1_21); JoinGamePacket joinGame1212 = this.createJoinGamePacket(ProtocolVersion.MINECRAFT_1_21_2); final PreparedPacket joinPackets = this.plugin.createPreparedPacket() .prepare(legacyJoinGame, ProtocolVersion.MINIMUM_VERSION, ProtocolVersion.MINECRAFT_1_15_2) .prepare(joinGame, ProtocolVersion.MINECRAFT_1_16, ProtocolVersion.MINECRAFT_1_16_1) .prepare(joinGame1162, ProtocolVersion.MINECRAFT_1_16_2, ProtocolVersion.MINECRAFT_1_18) .prepare(joinGame1182, ProtocolVersion.MINECRAFT_1_18_2, ProtocolVersion.MINECRAFT_1_18_2) .prepare(joinGame119, ProtocolVersion.MINECRAFT_1_19, ProtocolVersion.MINECRAFT_1_19) .prepare(joinGame1191, ProtocolVersion.MINECRAFT_1_19_1, ProtocolVersion.MINECRAFT_1_19_3) .prepare(joinGame1194, ProtocolVersion.MINECRAFT_1_19_4, ProtocolVersion.MINECRAFT_1_19_4) .prepare(joinGame120, ProtocolVersion.MINECRAFT_1_20, ProtocolVersion.MINECRAFT_1_20_5) .prepare(joinGame121, ProtocolVersion.MINECRAFT_1_21, ProtocolVersion.MINECRAFT_1_21) .prepare(joinGame1212, ProtocolVersion.MINECRAFT_1_21_2); PreparedPacket fastRejoinPackets = this.plugin.createPreparedPacket(); this.createFastClientServerSwitch(legacyJoinGame, ProtocolVersion.MINECRAFT_1_7_2) .forEach(minecraftPacket -> fastRejoinPackets.prepare(minecraftPacket, ProtocolVersion.MINIMUM_VERSION, ProtocolVersion.MINECRAFT_1_15_2)); this.createFastClientServerSwitch(joinGame, ProtocolVersion.MINECRAFT_1_16) .forEach(minecraftPacket -> fastRejoinPackets.prepare(minecraftPacket, ProtocolVersion.MINECRAFT_1_16, ProtocolVersion.MINECRAFT_1_16_1)); this.createFastClientServerSwitch(joinGame1162, ProtocolVersion.MINECRAFT_1_16_2) .forEach(minecraftPacket -> fastRejoinPackets.prepare(minecraftPacket, ProtocolVersion.MINECRAFT_1_16_2, ProtocolVersion.MINECRAFT_1_18)); this.createFastClientServerSwitch(joinGame1182, ProtocolVersion.MINECRAFT_1_18_2) .forEach(minecraftPacket -> fastRejoinPackets.prepare(minecraftPacket, ProtocolVersion.MINECRAFT_1_18_2, ProtocolVersion.MINECRAFT_1_18_2)); this.createFastClientServerSwitch(joinGame119, ProtocolVersion.MINECRAFT_1_19) .forEach(minecraftPacket -> fastRejoinPackets.prepare(minecraftPacket, ProtocolVersion.MINECRAFT_1_19, ProtocolVersion.MINECRAFT_1_19)); this.createFastClientServerSwitch(joinGame1191, ProtocolVersion.MINECRAFT_1_19_1) .forEach(minecraftPacket -> fastRejoinPackets.prepare(minecraftPacket, ProtocolVersion.MINECRAFT_1_19_1, ProtocolVersion.MINECRAFT_1_19_3)); this.createFastClientServerSwitch(joinGame1194, ProtocolVersion.MINECRAFT_1_19_4) .forEach(minecraftPacket -> fastRejoinPackets.prepare(minecraftPacket, ProtocolVersion.MINECRAFT_1_19_4, ProtocolVersion.MINECRAFT_1_19_4)); this.createFastClientServerSwitch(joinGame120, ProtocolVersion.MINECRAFT_1_20) .forEach(minecraftPacket -> fastRejoinPackets.prepare(minecraftPacket, ProtocolVersion.MINECRAFT_1_20, ProtocolVersion.MINECRAFT_1_20_5)); this.createFastClientServerSwitch(joinGame121, ProtocolVersion.MINECRAFT_1_21) .forEach(minecraftPacket -> fastRejoinPackets.prepare(minecraftPacket, ProtocolVersion.MINECRAFT_1_21, ProtocolVersion.MINECRAFT_1_21)); this.createFastClientServerSwitch(joinGame1212, ProtocolVersion.MINECRAFT_1_21_2) .forEach(minecraftPacket -> fastRejoinPackets.prepare(minecraftPacket, ProtocolVersion.MINECRAFT_1_21_2)); this.joinPackets = this.addPostJoin(joinPackets); this.fastRejoinPackets = this.addPostJoin(fastRejoinPackets); this.safeRejoinPackets = this.addPostJoin(this.plugin.createPreparedPacket().prepare(this.createSafeClientServerSwitch(legacyJoinGame))); this.postJoinPackets = this.addPostJoin(this.plugin.createPreparedPacket()); this.configTransitionPackets = this.plugin.createPreparedPacket() .prepare(StartUpdatePacket.INSTANCE, ProtocolVersion.MINECRAFT_1_20_2) .build(); PreparedPacket configPackets = this.plugin.createConfigPreparedPacket(); configPackets.prepare(this::createRegistrySyncLegacy, ProtocolVersion.MINECRAFT_1_20_2, ProtocolVersion.MINECRAFT_1_20_3); this.createRegistrySyncModern(configPackets, ProtocolVersion.MINECRAFT_1_20_5, ProtocolVersion.MINECRAFT_1_20_5); this.createRegistrySyncModern(configPackets, ProtocolVersion.MINECRAFT_1_21, ProtocolVersion.MINECRAFT_1_21); this.createRegistrySyncModern(configPackets, ProtocolVersion.MINECRAFT_1_21_2, ProtocolVersion.MINECRAFT_1_21_4); this.createRegistrySyncModern(configPackets, ProtocolVersion.MINECRAFT_1_21_5, ProtocolVersion.MINECRAFT_1_21_9); this.createRegistrySyncModern(configPackets, ProtocolVersion.MINECRAFT_1_21_11, ProtocolVersion.MINECRAFT_1_21_11); this.createRegistrySyncModern(configPackets, ProtocolVersion.MINECRAFT_26_1, ProtocolVersion.MAXIMUM_VERSION); if (this.shouldUpdateTags) { configPackets.prepare(this::createTagsUpdate, ProtocolVersion.MINECRAFT_1_20_2); } else { // 26.1 requires tags to persist. configPackets.prepare(this::createTagsUpdate, ProtocolVersion.MINECRAFT_26_1); } configPackets.prepare(FinishedUpdatePacket.INSTANCE, ProtocolVersion.MINECRAFT_1_20_2); this.configPackets = configPackets.build(); this.firstChunks = this.createFirstChunks(); this.delayedChunks = this.createDelayedChunksPackets(); PreparedPacket respawnPackets = this.plugin.createPreparedPacket() .prepare( this.createPlayerPosAndLook( this.world.getSpawnX(), this.world.getSpawnY(), this.world.getSpawnZ(), this.world.getYaw(), this.world.getPitch() ) ).prepare( this.createUpdateViewPosition((int) this.world.getSpawnX(), (int) this.world.getSpawnZ()), ProtocolVersion.MINECRAFT_1_14 ); if (this.shouldUpdateTags) { respawnPackets.prepare(SimpleTagManager::getUpdateTagsPacket, ProtocolVersion.MINECRAFT_1_13, ProtocolVersion.MINECRAFT_1_20); } this.respawnPackets = respawnPackets.build(); this.built = true; } private ChangeGameStatePacket createLevelChunksLoadStartGameState() { return new ChangeGameStatePacket(13, 0); } private RegistrySyncPacket createRegistrySyncLegacy(ProtocolVersion version) { JoinGamePacket join = this.createJoinGamePacket(version); ByteBuf encodedRegistry = this.plugin.getPreparedPacketFactory().getPreparedPacketAllocator().ioBuffer(); ProtocolUtils.writeBinaryTag(encodedRegistry, version, join.getRegistry()); RegistrySyncPacket sync = new RegistrySyncPacket(); sync.replace(encodedRegistry); return sync; } private void createRegistrySyncModern(PreparedPacket packet, ProtocolVersion from, ProtocolVersion to) { JoinGamePacket join = this.createJoinGamePacket(from); CompoundBinaryTag registryTag = join.getRegistry(); for (String key : registryTag.keySet()) { CompoundBinaryTag entry = registryTag.getCompound(key); String type = entry.getString("type"); ListBinaryTag values = entry.getList("value", BinaryTagTypes.COMPOUND); Pair emptyTag = null; Pair[] tags = new Pair[0]; for (BinaryTag elementTag : values) { CompoundBinaryTag element = (CompoundBinaryTag) elementTag; int id = element.getInt("id"); if (id >= tags.length) { tags = Arrays.copyOf(tags, id + 1); } tags[id] = Pair.of(element.getString("name"), element.getCompound("element")); if (emptyTag == null) { emptyTag = tags[id]; } } for (int i = 0; i < tags.length; i++) { if (tags[i] == null) { tags[i] = Pair.of("limboapi_padding_" + i, emptyTag.value()); } } Pair[] patchedTags = tags; packet.prepare(version -> { ByteBuf registry = this.plugin.getPreparedPacketFactory().getPreparedPacketAllocator().ioBuffer(); ProtocolUtils.writeString(registry, type); ProtocolUtils.writeVarInt(registry, patchedTags.length); for (Pair tag : patchedTags) { ProtocolUtils.writeString(registry, tag.left()); registry.writeBoolean(tag.right() != null); if (tag.right() != null) { ProtocolUtils.writeBinaryTag(registry, version, tag.right()); } } RegistrySyncPacket sync = new RegistrySyncPacket(); sync.replace(registry); return sync; }, from, to); } } private TagsUpdatePacket createTagsUpdate(ProtocolVersion version) { return new TagsUpdatePacket(SimpleTagManager.getUpdateTagsPacket(version).toVelocityTags()); } private PreparedPacket addPostJoin(PreparedPacket packet) { return packet.prepare(this.createAvailableCommandsPacket(), ProtocolVersion.MINECRAFT_1_13) .prepare(this.createDefaultSpawnPositionPacket()) .prepare(this.createLevelChunksLoadStartGameState(), ProtocolVersion.MINECRAFT_1_20_3) .prepare(this.createWorldTicksPacket()) .prepare(this::createBrandMessage) .build(); } @Override public void spawnPlayer(Player apiPlayer, LimboSessionHandler handler) { if (!this.built) { synchronized (this) { if (!this.built) { List packets = this.takeSnapshot(); try { this.refresh(); } finally { List changed = this.takeSnapshot(); for (PreparedPacket packet : packets) { if (!changed.contains(packet)) { this.queuedToRelease.add(packet); } } } } } } ConnectedPlayer player = (ConnectedPlayer) apiPlayer; MinecraftConnection connection = player.getConnection(); boolean shouldSpawnPlayerImmediately = true; // Discard information from previous server if (player.getConnection().getActiveSessionHandler() instanceof ClientPlaySessionHandler sessionHandler) { connection.eventLoop().execute(() -> { player.getTabList().clearAll(); for (UUID serverBossBar : sessionHandler.getServerBossBars()) { player.getConnection().delayedWrite(BossBarPacket.createRemovePacket(serverBossBar, null)); } sessionHandler.getServerBossBars().clear(); if (player.getProtocolVersion().noLessThan(ProtocolVersion.MINECRAFT_1_8)) { player.getConnection().delayedWrite(GenericTitlePacket.constructTitlePacket( GenericTitlePacket.ActionType.RESET, player.getProtocolVersion())); player.clearPlayerListHeaderAndFooter(); } player.getConnection().flush(); }); } if (connection.getState() != this.localStateRegistry) { VelocityServerConnection server = player.getConnectedServer(); if (server != null) { RegisteredServer previousServer = server.getServer(); MinecraftConnection serverConnection = server.getConnection(); if (serverConnection != null) { try { GRACEFUL_DISCONNECT_FIELD.invokeExact(server, true); } catch (Throwable e) { throw new ReflectionException(e); } connection.eventLoop().execute(() -> serverConnection.getChannel().close().addListener(f -> this.spawnPlayerLocal(player, handler, previousServer))); shouldSpawnPlayerImmediately = false; } player.setConnectedServer(null); this.plugin.setLimboJoined(player); } } if (shouldSpawnPlayerImmediately) { this.spawnPlayerLocal(player, handler, null); } } protected void spawnPlayerLocal(Class handlerClass, LimboSessionHandlerImpl sessionHandler, ConnectedPlayer player, MinecraftConnection connection) { if (!connection.eventLoop().inEventLoop()) { connection.eventLoop().execute(() -> this.spawnPlayerLocal(handlerClass, sessionHandler, player, connection)); return; } connection.setActiveSessionHandler(connection.getState(), sessionHandler); if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) >= 0) { if (connection.getState() != StateRegistry.CONFIG) { if (this.shouldRejoin) { // Switch to CONFIG state connection.write(this.configTransitionPackets); return; // Continue transition on the handler side } } else { // Switch to PLAY state connection.delayedWrite(this.configPackets); this.plugin.setEncoderState(connection, this.localStateRegistry); } } sessionHandler.onConfig(new LimboPlayerImpl(this.plugin, this, player)); if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) < 0 || (connection.getState() != StateRegistry.CONFIG && !this.shouldRejoin)) { this.onSpawn(handlerClass, connection, player, sessionHandler); } connection.flush(); } private void spawnPlayerLocal(ConnectedPlayer player, LimboSessionHandler handler, RegisteredServer previousServer) { MinecraftConnection connection = player.getConnection(); connection.eventLoop().execute(() -> { connection.flush(); ChannelPipeline pipeline = connection.getChannel().pipeline(); Class handlerClass = handler.getClass(); if (this.limboName == null) { this.limboName = handlerClass.getSimpleName(); } if (Settings.IMP.MAIN.LOGGING_ENABLED) { LimboAPI.getLogger().info(player.getUsername() + " (" + player.getRemoteAddress() + ") has connected to the " + this.limboName + " Limbo"); } // With an abnormally large number of connections from the same nickname, // requests don't have time to be processed, and an error occurs that "minecraft-encoder" doesn't exist. if (pipeline.get(Connections.MINECRAFT_ENCODER) != null) { if (this.readTimeout != null) { pipeline.replace(Connections.READ_TIMEOUT, LimboProtocol.READ_TIMEOUT, new ReadTimeoutHandler(this.readTimeout, TimeUnit.MILLISECONDS)); } boolean compressionEnabled = false; if (pipeline.get(PreparedPacketFactory.PREPARED_ENCODER) == null) { if (this.plugin.isCompressionEnabled() && connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) { if (pipeline.get(Connections.FRAME_ENCODER) != null) { if (!Settings.IMP.MAIN.COMPATIBILITY_MODE) { pipeline.remove(Connections.FRAME_ENCODER); } } else if (Settings.IMP.MAIN.COMPATIBILITY_MODE) { if (pipeline.context(Connections.COMPRESSION_DECODER) != null) { this.plugin.fixDecompressor(pipeline, this.plugin.getServer().getConfiguration().getCompressionThreshold(), false); } } else { ChannelHandler minecraftCompressDecoder = pipeline.remove(Connections.COMPRESSION_DECODER); if (minecraftCompressDecoder != null) { this.plugin.fixDecompressor(pipeline, this.plugin.getServer().getConfiguration().getCompressionThreshold(), false); pipeline.replace(Connections.COMPRESSION_ENCODER, Connections.COMPRESSION_ENCODER, new ChannelOutboundHandlerAdapter()); compressionEnabled = true; } } } else if (!Settings.IMP.MAIN.COMPATIBILITY_MODE) { pipeline.remove(Connections.FRAME_ENCODER); } this.plugin.inject3rdParty(player, connection, pipeline); if (compressionEnabled) { pipeline.fireUserEventTriggered(VelocityConnectionEvent.COMPRESSION_ENABLED); } else { pipeline.fireUserEventTriggered(VelocityConnectionEvent.COMPRESSION_DISABLED); } } } else { connection.close(); return; } if (this.maxSuppressPacketLength != null) { MinecraftLimitedCompressDecoder decoder = pipeline.get(MinecraftLimitedCompressDecoder.class); if (decoder != null) { decoder.setUncompressedCap(this.maxSuppressPacketLength); } } LimboSessionHandlerImpl sessionHandler = new LimboSessionHandlerImpl( this.plugin, this, player, handler, connection.getState(), connection.getActiveSessionHandler(), previousServer, () -> this.limboName ); if (connection.getActiveSessionHandler() instanceof LoginConfirmHandler confirm) { confirm.waitForConfirmation(() -> { this.currentOnline.increment(); this.spawnPlayerLocal(handlerClass, sessionHandler, player, connection); }); } else { this.currentOnline.increment(); this.spawnPlayerLocal(handlerClass, sessionHandler, player, connection); } }); } protected void onSpawn(Class handlerClass, MinecraftConnection connection, ConnectedPlayer player, LimboSessionHandlerImpl sessionHandler) { this.plugin.setState(connection, this.localStateRegistry); if (this.plugin.isLimboJoined(player)) { if (this.shouldRejoin) { sessionHandler.setJoinGameTriggered(true); if (connection.getType() == ConnectionTypes.LEGACY_FORGE) { connection.delayedWrite(this.safeRejoinPackets); } else { connection.delayedWrite(this.fastRejoinPackets); } } else { connection.delayedWrite(this.postJoinPackets); } } else { sessionHandler.setJoinGameTriggered(true); connection.delayedWrite(this.joinPackets); } MinecraftPacket playerInfoPacket; UUID uuid = this.plugin.getInitialID(player); if (connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_19_1) <= 0) { playerInfoPacket = new LegacyPlayerListItemPacket( LegacyPlayerListItemPacket.ADD_PLAYER, List.of( new LegacyPlayerListItemPacket.Item(uuid) .setName(player.getUsername()) .setGameMode(this.gameMode) .setProperties(player.getGameProfileProperties()) ) ); } else { UpsertPlayerInfoPacket.Entry playerInfoEntry = new UpsertPlayerInfoPacket.Entry(uuid); playerInfoEntry.setDisplayName(new ComponentHolder(player.getProtocolVersion(), Component.text(player.getUsername()))); playerInfoEntry.setGameMode(this.gameMode); playerInfoEntry.setProfile(player.getGameProfile()); playerInfoPacket = new UpsertPlayerInfoPacket( EnumSet.of( UpsertPlayerInfoPacket.Action.UPDATE_DISPLAY_NAME, UpsertPlayerInfoPacket.Action.UPDATE_GAME_MODE, UpsertPlayerInfoPacket.Action.ADD_PLAYER), List.of(playerInfoEntry)); } connection.delayedWrite(playerInfoPacket); connection.delayedWrite(this.getBrandMessage(handlerClass)); this.plugin.setLimboJoined(player); if (this.shouldRespawn) { this.respawnPlayer(player); } sessionHandler.onSpawn(); } @Override public void respawnPlayer(Player player) { MinecraftConnection connection = ((ConnectedPlayer) player).getConnection(); connection.delayedWrite(this.respawnPackets); if (this.firstChunks != null) { connection.write(this.firstChunks); } if (!this.delayedChunks.isEmpty()) { AtomicReference> task = new AtomicReference<>(); task.set(connection.eventLoop().scheduleAtFixedRate(new Runnable() { private final List chunksSnapshot = LimboImpl.this.delayedChunks; private int index; @Override public void run() { if (connection.isClosed()) { task.get().cancel(false); return; } connection.write(this.chunksSnapshot.get(this.index)); if (++this.index >= this.chunksSnapshot.size()) { task.get().cancel(false); } } }, 50, 50, TimeUnit.MILLISECONDS)); if (connection.getActiveSessionHandler() instanceof LimboSessionHandlerImpl sessionHandler) { sessionHandler.setRespawnTask(task.get()); } } } @Override public long getCurrentOnline() { return this.currentOnline.sum(); } public void onDisconnect() { this.currentOnline.decrement(); if (!this.queuedToRelease.isEmpty() && this.currentOnline.sum() == 0) { synchronized (this) { PreparedPacket[] packets = this.queuedToRelease.toArray(new PreparedPacket[0]); this.queuedToRelease.clear(); // Wait some time to ensure that queued packets is really unused this.plugin.getServer().getScheduler().buildTask(this.plugin, () -> { for (PreparedPacket packet : packets) { packet.release(); } }).delay(10, TimeUnit.SECONDS).schedule(); } } if (this.disposeScheduled && this.currentOnline.sum() == 0) { this.localDispose(); } } @Override public Limbo setName(String name) { this.limboName = name; this.built = false; return this; } @Override public Limbo setReadTimeout(int millis) { this.readTimeout = millis; return this; } @Override public Limbo setWorldTime(long ticks) { this.worldTicks = ticks; this.built = false; return this; } @Override public Limbo setGameMode(GameMode gameMode) { this.gameMode = gameMode.getID(); this.built = false; return this; } @Override public Limbo setShouldRejoin(boolean shouldRejoin) { this.shouldRejoin = shouldRejoin; this.built = false; return this; } @Override public Limbo setShouldRespawn(boolean shouldRespawn) { this.shouldRespawn = shouldRespawn; this.built = false; return this; } @Override public Limbo setShouldUpdateTags(boolean shouldUpdateTags) { this.shouldUpdateTags = shouldUpdateTags; this.built = false; return this; } @Override public Limbo setReducedDebugInfo(boolean reducedDebugInfo) { this.reducedDebugInfo = reducedDebugInfo; this.built = false; return this; } @Override public Limbo setViewDistance(int viewDistance) { this.viewDistance = viewDistance; this.built = false; return this; } @Override public Limbo setSimulationDistance(int simulationDistance) { this.simulationDistance = simulationDistance; this.built = false; return this; } @Override public Limbo setMaxSuppressPacketLength(int maxSuppressPacketLength) { this.maxSuppressPacketLength = maxSuppressPacketLength; return this; } @Override public Limbo registerCommand(LimboCommandMeta commandMeta) { return this.registerCommand(commandMeta, (SimpleCommand) invocation -> { // Do nothing. }); } @Override public Limbo registerCommand(CommandMeta commandMeta, Command command) { for (CommandRegistrar registrar : this.registrars) { if (this.tryRegister(registrar, commandMeta, command)) { this.built = false; return this; } } throw new IllegalArgumentException(command + " does not implement a registrable Command sub-interface."); } public Limbo registerPacket(PacketDirection direction, Class packetClass, Supplier packetSupplier, PacketMapping[] packetMappings) { if (this.localStateRegistry == LimboProtocol.getLimboStateRegistry()) { this.localStateRegistry = LimboProtocol.createLocalStateRegistry(); this.plugin.getPreparedPacketFactory().addStateRegistry(this.localStateRegistry); } LimboProtocol.register(this.localStateRegistry, direction, packetClass, packetSupplier, packetMappings); return this; } @Override public void dispose() { if (this.getCurrentOnline() == 0) { this.localDispose(); } else { this.disposeScheduled = true; } } private List takeSnapshot() { List packets = new ArrayList<>(); if (this.joinPackets != null) { packets.add(this.joinPackets); } if (this.fastRejoinPackets != null) { packets.add(this.fastRejoinPackets); } if (this.safeRejoinPackets != null) { packets.add(this.safeRejoinPackets); } if (this.postJoinPackets != null) { packets.add(this.postJoinPackets); } if (this.respawnPackets != null) { packets.add(this.respawnPackets); } if (this.firstChunks != null) { packets.add(this.firstChunks); } if (this.delayedChunks != null) { packets.addAll(this.delayedChunks); } if (this.configTransitionPackets != null) { packets.add(this.configTransitionPackets); } if (this.configPackets != null) { packets.add(this.configPackets); } return packets; } private void localDispose() { this.takeSnapshot().forEach(PreparedPacket::release); this.built = false; this.brandMessages.values().forEach(PreparedPacket::release); this.brandMessages.clear(); } // From Velocity. private boolean tryRegister(CommandRegistrar registrar, CommandMeta commandMeta, Command command) { Class superInterface = registrar.registrableSuperInterface(); if (superInterface.isInstance(command)) { registrar.register(commandMeta, superInterface.cast(command)); return true; } else { return false; } } private CompoundBinaryTag createRegistry(String registryName, Map tags) { int id = 0; ListBinaryTag.Builder builder = ListBinaryTag.builder(BinaryTagTypes.COMPOUND); for (Entry tag : tags.entrySet()) { builder.add(CompoundBinaryTag.builder() .putString("name", tag.getKey()) .putInt("id", id++) .put("element", tag.getValue()) .build()); } return this.createRegistry(registryName, builder.build()); } private CompoundBinaryTag createRegistry(String registryName, ListBinaryTag tags) { return CompoundBinaryTag.builder() .putString("type", registryName) .put("value", tags).build(); } private CompoundBinaryTag createDimensionData(Dimension dimension, ProtocolVersion version) { CompoundBinaryTag.Builder details = CompoundBinaryTag.builder() .putBoolean("natural", false) .putFloat("ambient_light", 0.0F) .putBoolean("shrunk", false) .putBoolean("ultrawarm", false) .putBoolean("has_ceiling", false) .putBoolean("has_skylight", true) .putBoolean("piglin_safe", false) .putBoolean("bed_works", false) .putBoolean("respawn_anchor_works", false) .putBoolean("has_raids", false) .putInt("logical_height", 256) .putString("infiniburn", version.compareTo(ProtocolVersion.MINECRAFT_1_18_2) >= 0 ? "#minecraft:infiniburn_nether" : "minecraft:infiniburn_nether") .putDouble("coordinate_scale", 1.0) .putString("effects", dimension.getKey()) .putInt("min_y", 0) .putInt("height", 256) .putInt("monster_spawn_block_light_limit", 0) .putInt("monster_spawn_light_level", 0); if (version.compareTo(ProtocolVersion.MINECRAFT_1_21_11) >= 0) { CompoundBinaryTag.Builder attributes = CompoundBinaryTag.builder(); switch (dimension) { case OVERWORLD -> { attributes.putString("minecraft:visual/cloud_color", "#ccffffff") .putFloat("minecraft:visual/cloud_height", 192.33f) .putString("minecraft:visual/fog_color", "#c0d8ff") .putString("minecraft:visual/sky_color", "#78a7ff"); if (version.noLessThan(ProtocolVersion.MINECRAFT_26_1)) { attributes.putString("minecraft:visual/ambient_light_color", "#0a0a0a"); } } case NETHER -> { details.putString("cardinal_light", "nether"); details.putString("skybox", "none"); attributes.putFloat("minecraft:gameplay/sky_light_level", 4.0f) .putFloat("minecraft:visual/fog_end_distance", 96.0f) .putFloat("minecraft:visual/fog_start_distance", 10.0f) .putString("minecraft:visual/sky_light_color", "#7a7aff"); if (version.noLessThan(ProtocolVersion.MINECRAFT_26_1)) { attributes.putString("minecraft:visual/ambient_light_color", "#302821"); } } case THE_END -> { details.putString("skybox", "end"); attributes.putString("minecraft:visual/fog_color", "#181318") .putString("minecraft:visual/sky_color", "#000000") .putString("minecraft:visual/sky_light_color", "#e580ff"); if (version.noLessThan(ProtocolVersion.MINECRAFT_26_1)) { attributes.putString("minecraft:visual/ambient_light_color", "#3f473f"); } } default -> throw new IllegalStateException("Unknown dimension: " + dimension); // Checkstyle madness } details.put("attributes", attributes.build()); } if (version.compareTo(ProtocolVersion.MINECRAFT_26_1) >= 0) { switch (dimension) { case OVERWORLD -> { details.putString("timelines", "minecraft:day"); details.putString("default_clock", "minecraft:overworld"); details.putBoolean("has_ender_dragon_fight", false); } case NETHER -> { details.putBoolean("has_ender_dragon_fight", false); } case THE_END -> { details.putString("default_clock", "minecraft:overworld"); details.putBoolean("has_ender_dragon_fight", true); } default -> throw new IllegalStateException("Unknown dimension: " + dimension); // Checkstyle madness } } if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0) { return CompoundBinaryTag.builder() .putString("name", dimension.getKey()) .putInt("id", dimension.getModernID()) .put("element", details.build()) .build(); } else { return details.build().putString("name", dimension.getKey()); } } private JoinGamePacket createJoinGamePacket(ProtocolVersion version) { Dimension dimension = this.world.getDimension(); JoinGamePacket joinGame = new JoinGamePacket(); joinGame.setEntityId(1); joinGame.setIsHardcore(true); joinGame.setGamemode(this.gameMode); joinGame.setPreviousGamemode((short) -1); joinGame.setDimension(dimension.getModernID()); joinGame.setDifficulty((short) 0); try { PARTIAL_HASHED_SEED_FIELD.invokeExact(joinGame, ThreadLocalRandom.current().nextLong()); } catch (Throwable e) { throw new ReflectionException(e); } joinGame.setMaxPlayers(1); joinGame.setLevelType("flat"); joinGame.setViewDistance(this.viewDistance); joinGame.setSimulationDistance(this.simulationDistance); joinGame.setReducedDebugInfo(this.reducedDebugInfo); String key = dimension.getKey(); joinGame.setDimensionInfo(new DimensionInfo(key, key, false, false, version)); joinGame.setEnforcesSecureChat(Settings.IMP.MAIN.SEND_ENFORCE_SECURE_CHAT); CompoundBinaryTag.Builder registryContainer = CompoundBinaryTag.builder(); ListBinaryTag encodedDimensionRegistry = ListBinaryTag.builder(BinaryTagTypes.COMPOUND) .add(this.createDimensionData(Dimension.OVERWORLD, version)) .add(this.createDimensionData(Dimension.NETHER, version)) .add(this.createDimensionData(Dimension.THE_END, version)) .build(); if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0) { CompoundBinaryTag.Builder dimensionRegistryEntry = CompoundBinaryTag.builder(); dimensionRegistryEntry.putString("type", "minecraft:dimension_type"); dimensionRegistryEntry.put("value", encodedDimensionRegistry); registryContainer.put("minecraft:dimension_type", dimensionRegistryEntry.build()); registryContainer.put("minecraft:worldgen/biome", Biome.getRegistry(version)); if (version.compareTo(ProtocolVersion.MINECRAFT_1_19) == 0) { registryContainer.put("minecraft:chat_type", CHAT_TYPE_119); } else if (version.compareTo(ProtocolVersion.MINECRAFT_1_19_1) >= 0) { registryContainer.put("minecraft:chat_type", CHAT_TYPE_1191); } // TODO: Generate mappings for damage_type registry if (version.compareTo(ProtocolVersion.MINECRAFT_1_19_4) == 0) { registryContainer.put("minecraft:damage_type", DAMAGE_TYPE_1194); } else if (version.compareTo(ProtocolVersion.MINECRAFT_1_21) >= 0) { ListBinaryTag values = DAMAGE_TYPE_120.getList("value"); ListBinaryTag.Builder tags = ListBinaryTag.builder(BinaryTagTypes.COMPOUND); for (BinaryTag tag : values) { tags.add((CompoundBinaryTag) tag); } List types = new ArrayList<>(); types.add("minecraft:campfire"); if (version.compareTo(ProtocolVersion.MINECRAFT_1_21_2) >= 0) { types.add("minecraft:ender_pearl"); types.add("minecraft:mace_smash"); } if (version.compareTo(ProtocolVersion.MINECRAFT_26_1) >= 0) { types.add("minecraft:spear"); } int id = values.size(); for (String name : types) { CompoundBinaryTag.Builder type = CompoundBinaryTag.builder() .putString("name", name) .putInt("id", id++) .put("element", values.getCompound(0).getCompound("element")); tags.add(type.build()); } registryContainer.put("minecraft:damage_type", this.createRegistry("minecraft:damage_type", tags.build())); } else if (version.compareTo(ProtocolVersion.MINECRAFT_1_20) >= 0) { registryContainer.put("minecraft:damage_type", DAMAGE_TYPE_120); } // TODO: Auto-generate mappings and implement some APIs if (version.compareTo(ProtocolVersion.MINECRAFT_1_21) >= 0) { CompoundBinaryTag.Builder paintingVariant = CompoundBinaryTag.builder() .putInt("width", 1) .putInt("height", 1) .putString("asset_id", "minecraft:alban"); registryContainer.put("minecraft:painting_variant", this.createRegistry("minecraft:painting_variant", Map.of("minecraft:alban", paintingVariant.build()))); if (version.compareTo(ProtocolVersion.MINECRAFT_1_21_5) >= 0) { // Cat CompoundBinaryTag.Builder catVariant = CompoundBinaryTag.builder() .putString("asset_id", "minecraft:entity/cat/all_black") .put("spawn_conditions", ListBinaryTag.empty()); if (version.noLessThan(ProtocolVersion.MINECRAFT_26_1)) { catVariant.putString("baby_asset_id", "minecraft:entity/cat/all_black"); } registryContainer.put("minecraft:cat_variant", this.createRegistry("minecraft:cat_variant", Map.of("minecraft:all_black", catVariant.build()))); // Chicken CompoundBinaryTag.Builder chickenVariant = CompoundBinaryTag.builder() .putString("asset_id", "minecraft:entity/chicken/cold_chicken") .putString("model", "cold") .put("spawn_conditions", ListBinaryTag.empty()); if (version.noLessThan(ProtocolVersion.MINECRAFT_26_1)) { chickenVariant.putString("baby_asset_id", "minecraft:entity/chicken/cold_chicken"); } registryContainer.put("minecraft:chicken_variant", this.createRegistry("minecraft:chicken_variant", Map.of("minecraft:cold", chickenVariant.build(), "minecraft:temperate", chickenVariant.build(), "minecraft:warm", chickenVariant.build()))); // Cow CompoundBinaryTag.Builder cowVariant = CompoundBinaryTag.builder() .putString("asset_id", "minecraft:entity/cow/cold_cow") .putString("model", "cold") .put("spawn_conditions", ListBinaryTag.empty()); if (version.noLessThan(ProtocolVersion.MINECRAFT_26_1)) { cowVariant.putString("baby_asset_id", "minecraft:entity/cow/cold_cow"); } registryContainer.put("minecraft:cow_variant", this.createRegistry("minecraft:cow_variant", Map.of("minecraft:cold", cowVariant.build()))); // Frog CompoundBinaryTag.Builder frogVariant = CompoundBinaryTag.builder() .putString("asset_id", "minecraft:entity/frog/cold_frog") .put("spawn_conditions", ListBinaryTag.empty()); registryContainer.put("minecraft:frog_variant", this.createRegistry("minecraft:frog_variant", Map.of("minecraft:cold", frogVariant.build()))); // Pig CompoundBinaryTag.Builder pigVariant = CompoundBinaryTag.builder() .putString("asset_id", "minecraft:entity/pig/cold_pig") .putString("model", "cold") .put("spawn_conditions", ListBinaryTag.empty()); if (version.noLessThan(ProtocolVersion.MINECRAFT_26_1)) { pigVariant.putString("baby_asset_id", "minecraft:entity/pig/cold_pig"); } registryContainer.put("minecraft:pig_variant", this.createRegistry("minecraft:pig_variant", Map.of("minecraft:cold", pigVariant.build()))); // Wolf Sound Variant CompoundBinaryTag wolfSoundVariant = CompoundBinaryTag.builder() .putString("ambient_sound", "minecraft:entity.wolf_angry.ambient") .putString("death_sound", "minecraft:entity.wolf_angry.death") .putString("growl_sound", "minecraft:entity.wolf_angry.growl") .putString("hurt_sound", "minecraft:entity.wolf_angry.hurt") .putString("pant_sound", "minecraft:entity.wolf_angry.pant") .putString("whine_sound", "minecraft:entity.wolf_angry.whine").build(); if (version.noLessThan(ProtocolVersion.MINECRAFT_26_1)) { wolfSoundVariant = this.soundVariant( builder -> builder.putString("ambient_sound", "minecraft:entity.wolf_angry.ambient") .putString("death_sound", "minecraft:entity.wolf_angry.death") .putString("growl_sound", "minecraft:entity.wolf_angry.growl") .putString("hurt_sound", "minecraft:entity.wolf_angry.hurt") .putString("pant_sound", "minecraft:entity.wolf_angry.pant") .putString("step_sound", "minecraft:entity.wolf.step") .putString("whine_sound", "minecraft:entity.wolf_angry.whine"), builder -> builder.putString("ambient_sound", "minecraft:entity.baby_wolf.ambient") .putString("death_sound", "minecraft:entity.baby_wolf.death") .putString("growl_sound", "minecraft:entity.baby_wolf.growl") .putString("hurt_sound", "minecraft:entity.baby_wolf.hurt") .putString("pant_sound", "minecraft:entity.baby_wolf.pant") .putString("step_sound", "minecraft:entity.baby_wolf.step") .putString("whine_sound", "minecraft:entity.baby_wolf.whine") ); } registryContainer.put("minecraft:wolf_sound_variant", this.createRegistry("minecraft:wolf_sound_variant", Map.of("minecraft:angry", wolfSoundVariant))); // Wolf CompoundBinaryTag.Builder wolfVariant = CompoundBinaryTag.builder() .put("assets", CompoundBinaryTag.builder() .putString("wild", "minecraft:entity/wolf/wolf_ashen") .putString("tame", "minecraft:entity/wolf/wolf_ashen_tame") .putString("angry", "minecraft:entity/wolf/wolf_ashen_angry") .build()) .put("baby_assets", CompoundBinaryTag.builder() .putString("wild", "minecraft:entity/wolf/wolf_ashen") .putString("tame", "minecraft:entity/wolf/wolf_ashen_tame") .putString("angry", "minecraft:entity/wolf/wolf_ashen_angry") .build()) .put("spawn_conditions", ListBinaryTag.empty()); registryContainer.put("minecraft:wolf_variant", this.createRegistry("minecraft:wolf_variant", Map.of("minecraft:ashen", wolfVariant.build()))); if (version.compareTo(ProtocolVersion.MINECRAFT_1_21_11) >= 0) { // Zombie nautilus variant CompoundBinaryTag zombieVariant = CompoundBinaryTag.builder() .putString("asset_id", "minecraft:entity/nautilus/zombie_nautilus") .put("spawn_conditions", ListBinaryTag.empty()).build(); registryContainer.put("minecraft:zombie_nautilus_variant", this.createRegistry("minecraft:zombie_nautilus_variant", Map.of("minecraft:temperate", zombieVariant))); } if (version.compareTo(ProtocolVersion.MINECRAFT_26_1) >= 0) { // World clock registryContainer.put("minecraft:world_clock", this.createRegistry("minecraft:world_clock", Map.of("minecraft:overworld", CompoundBinaryTag.builder().build()))); // Sound variants CompoundBinaryTag soundVariant = this.soundVariant( builder -> builder.putString("ambient_sound", "minecraft:entity.pig.ambient") .putString("death_sound", "minecraft:entity.pig.death") .putString("eat_sound", "minecraft:entity.pig.eat") .putString("hurt_sound", "minecraft:entity.pig.hurt") .putString("step_sound", "minecraft:entity.pig.step"), builder -> builder.putString("ambient_sound", "minecraft:entity.baby_pig.ambient") .putString("death_sound", "minecraft:entity.baby_pig.death") .putString("eat_sound", "minecraft:entity.baby_pig.eat") .putString("hurt_sound", "minecraft:entity.baby_pig.hurt") .putString("step_sound", "minecraft:entity.baby_pig.step") ); registryContainer.put("minecraft:pig_sound_variant", this.createRegistry("minecraft:pig_sound_variant", Map.of("minecraft:classic", soundVariant))); soundVariant = this.soundVariant( builder -> builder.putString("ambient_sound", "minecraft:entity.cat.ambient") .putString("beg_for_food_sound", "minecraft:entity.cat.beg_for_food") .putString("death_sound", "minecraft:entity.cat.death") .putString("eat_sound", "minecraft:entity.cat.eat") .putString("hiss_sound", "minecraft:entity.cat.hiss") .putString("hurt_sound", "minecraft:entity.cat.hurt") .putString("purr_sound", "minecraft:entity.cat.purr") .putString("purreow_sound", "minecraft:entity.cat.purreow") .putString("stray_ambient_sound", "minecraft:entity.cat.stray_ambient"), builder -> builder.putString("ambient_sound", "minecraft:entity.baby_cat.ambient") .putString("beg_for_food_sound", "minecraft:entity.baby_cat.beg_for_food") .putString("death_sound", "minecraft:entity.baby_cat.death") .putString("eat_sound", "minecraft:entity.baby_cat.eat") .putString("hiss_sound", "minecraft:entity.baby_cat.hiss") .putString("hurt_sound", "minecraft:entity.baby_cat.hurt") .putString("purr_sound", "minecraft:entity.baby_cat.purr") .putString("purreow_sound", "minecraft:entity.baby_cat.purreow") .putString("stray_ambient_sound", "minecraft:entity.baby_cat.stray_ambient") ); registryContainer.put("minecraft:cat_sound_variant", this.createRegistry("minecraft:cat_sound_variant", Map.of("minecraft:classic", soundVariant))); CompoundBinaryTag.Builder cowSoundVariant = CompoundBinaryTag.builder() .putString("ambient_sound", "minecraft:entity.cow.ambient") .putString("death_sound", "minecraft:entity.cow.death") .putString("hurt_sound", "minecraft:entity.cow.hurt") .putString("step_sound", "minecraft:entity.cow.step"); registryContainer.put("minecraft:cow_sound_variant", this.createRegistry("minecraft:cow_sound_variant", Map.of("minecraft:classic", cowSoundVariant.build()))); soundVariant = this.soundVariant( builder -> builder.putString("ambient_sound", "minecraft:entity.chicken.ambient") .putString("death_sound", "minecraft:entity.chicken.death") .putString("hurt_sound", "minecraft:entity.chicken.hurt") .putString("step_sound", "minecraft:entity.chicken.step"), builder -> builder.putString("ambient_sound", "minecraft:entity.baby_chicken.ambient") .putString("death_sound", "minecraft:entity.baby_chicken.death") .putString("hurt_sound", "minecraft:entity.baby_chicken.hurt") .putString("step_sound", "minecraft:entity.baby_chicken.step") ); registryContainer.put("minecraft:chicken_sound_variant", this.createRegistry("minecraft:chicken_sound_variant", Map.of("minecraft:classic", soundVariant))); // Trim material CompoundBinaryTag trim = CompoundBinaryTag.builder() .putString("asset_name", "redstone") .put("description", CompoundBinaryTag.builder() .putString("color", "#971607") .putString("translate", "trim_material.minecraft.redstone") .build()) .build(); Map trims = new HashMap<>(); for (String trimName : List.of("amethyst", "copper", "diamond", "emerald", "gold", "iron", "lapis", "netherite", "quartz", "redstone", "resin")) { trims.put(trimName, trim); } registryContainer.put("minecraft:trim_material", this.createRegistry("minecraft:trim_material", trims)); // Jukebox song CompoundBinaryTag song = CompoundBinaryTag.builder() .putString("sound_event", "minecraft:music_disc.5") .put("description", CompoundBinaryTag.builder() .putString("translate", "jukebox_song.minecraft.5") .build()) .putFloat("length_in_seconds", 178f) .putInt("comparator_output", 15) .build(); Map songs = new HashMap<>(); for (String songName : List.of("11", "13", "5", "blocks", "cat", "chirp", "creator", "creator_music_box", "far", "lava_chicken", "mall", "mellohi", "otherside", "pigstep", "precipice", "relic", "stal", "strad", "tears", "wait", "ward")) { songs.put(songName, song); } registryContainer.put("minecraft:jukebox_song", this.createRegistry("minecraft:jukebox_song", songs)); // Instrument Map instruments = new HashMap<>(); for (String instrumentName : List.of("admire_goat_horn", "call_goat_horn", "dream_goat_horn", "feel_goat_horn", "ponder_goat_horn", "seek_goat_horn", "sing_goat_horn", "yearn_goat_horn")) { instruments.put(instrumentName, CompoundBinaryTag.builder() .putString("sound_event", "minecraft:item.goat_horn.sound.0") .putFloat("range", 256) .putFloat("use_duration", 256) .put("description", CompoundBinaryTag.builder() .putString("translate", "instrument.minecraft.ponder_goat_horn") .build()) .build()); } registryContainer.put("minecraft:instrument", this.createRegistry("minecraft:instrument", instruments)); // Timeline Map timelines = new HashMap<>(); for (String timelineName : List.of("day")) { timelines.put(timelineName, CompoundBinaryTag.builder() .putString("clock", "minecraft:overworld") .putFloat("period_ticks", 24000) .build()); } registryContainer.put("minecraft:timeline", this.createRegistry("minecraft:timeline", timelines)); } } else { CompoundBinaryTag.Builder wolfVariant = CompoundBinaryTag.builder() .putString("wild_texture", "minecraft:entity/wolf/wolf_ashen") .putString("tame_texture", "minecraft:entity/wolf/wolf_ashen_tame") .putString("angry_texture", "minecraft:entity/wolf/wolf_ashen_angry") .put("biomes", ListBinaryTag.builder() .add(StringBinaryTag.stringBinaryTag("minecraft:plains")).build() ); registryContainer.put("minecraft:wolf_variant", this.createRegistry("minecraft:wolf_variant", Map.of("minecraft:ashen", wolfVariant.build()))); } } } else { registryContainer.put("dimension", encodedDimensionRegistry); } try { CompoundBinaryTag currentDimensionData = encodedDimensionRegistry.getCompound(dimension.getModernID()); if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0) { currentDimensionData = currentDimensionData.getCompound("element"); } CURRENT_DIMENSION_DATA_FIELD.invokeExact(joinGame, currentDimensionData); LEVEL_NAMES_FIELDS.invokeExact(joinGame, LEVELS); REGISTRY_FIELD.invokeExact(joinGame, registryContainer.build()); } catch (Throwable e) { throw new ReflectionException(e); } return joinGame; } private CompoundBinaryTag soundVariant(Function adult, Function baby) { return CompoundBinaryTag.builder() .put("adult_sounds", adult.apply(CompoundBinaryTag.builder()).build()) .put("baby_sounds", baby.apply(CompoundBinaryTag.builder()).build()).build(); } private JoinGamePacket createLegacyJoinGamePacket() { JoinGamePacket joinGame = this.createJoinGamePacket(ProtocolVersion.MINIMUM_VERSION); joinGame.setDimension(this.world.getDimension().getLegacyID()); return joinGame; } private DefaultSpawnPositionPacket createDefaultSpawnPositionPacket() { return new DefaultSpawnPositionPacket(this.world.getDimension().getKey(), (int) this.world.getSpawnX(), (int) this.world.getSpawnY(), (int) this.world.getSpawnZ(), 0.0F, 0.0f); } private TimeUpdatePacket createWorldTicksPacket() { return this.worldTicks == null ? null : new TimeUpdatePacket(this.worldTicks, this.worldTicks); } private AvailableCommandsPacket createAvailableCommandsPacket() { try { AvailableCommandsPacket packet = new AvailableCommandsPacket(); ROOT_NODE_FIELD.invokeExact(packet, this.commandNode); return packet; } catch (Throwable e) { throw new ReflectionException(e); } } private PreparedPacket createFirstChunks() { PreparedPacket packet = this.plugin.createPreparedPacket(); List> orderedChunks = this.world.getOrderedChunks(); int chunkCounter = 0; for (List chunksWithSameDistance : orderedChunks) { if (++chunkCounter > Settings.IMP.MAIN.CHUNK_RADIUS_SEND_ON_SPAWN) { break; } for (VirtualChunk chunk : chunksWithSameDistance) { packet.prepare(this.createChunkData(chunk, this.world.getDimension())); } } return packet.build(); } private List createDelayedChunksPackets() { List> orderedChunks = this.world.getOrderedChunks(); if (orderedChunks.size() <= Settings.IMP.MAIN.CHUNK_RADIUS_SEND_ON_SPAWN) { return List.of(); } List packets = new LinkedList<>(); PreparedPacket packet = this.plugin.createPreparedPacket(); int chunkCounter = 0; Iterator> distanceIterator = orderedChunks.listIterator(); for (int i = 0; i < Settings.IMP.MAIN.CHUNK_RADIUS_SEND_ON_SPAWN; i++) { distanceIterator.next(); } while (distanceIterator.hasNext()) { for (VirtualChunk chunk : distanceIterator.next()) { if (++chunkCounter > Settings.IMP.MAIN.CHUNKS_PER_TICK) { packets.add(packet.build()); packet = this.plugin.createPreparedPacket(); chunkCounter = 0; } packet.prepare(this.createChunkData(chunk, this.world.getDimension())); } } packets.add(packet.build()); return packets; } // From Velocity. private List createFastClientServerSwitch(JoinGamePacket joinGame, ProtocolVersion version) { // In order to handle switching to another server, you will need to send two packets: // // - The join game packet from the backend server, with a different dimension. // - A respawn with the correct dimension. // // Most notably, by having the client accept the join game packet, we can work around the need // to perform entity ID rewrites, eliminating potential issues from rewriting packets and // improving compatibility with mods. List packets = new ArrayList<>(); RespawnPacket respawn = RespawnPacket.fromJoinGame(joinGame); if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) < 0) { // Before Minecraft 1.16, we could not switch to the same dimension without sending an // additional respawn. On older versions of Minecraft this forces the client to perform // garbage collection which adds additional latency. joinGame.setDimension(joinGame.getDimension() == 0 ? -1 : 0); } packets.add(joinGame); packets.add(respawn); return packets; } private List createSafeClientServerSwitch(JoinGamePacket joinGame) { // Some clients do not behave well with the "fast" respawn sequence. In this case we will use // a "safe" respawn sequence that involves sending three packets to the client. They have the // same effect but tend to work better with buggier clients (Forge 1.8 in particular). List packets = new ArrayList<>(); // Send the JoinGame packet itself, unmodified. packets.add(joinGame); // Send a respawn packet in a different dimension. RespawnPacket fakeSwitchPacket = RespawnPacket.fromJoinGame(joinGame); fakeSwitchPacket.setDimension(joinGame.getDimension() == 0 ? -1 : 0); packets.add(fakeSwitchPacket); // Now send a respawn packet in the correct dimension. RespawnPacket correctSwitchPacket = RespawnPacket.fromJoinGame(joinGame); packets.add(correctSwitchPacket); return packets; } private PreparedPacket getBrandMessage(Class clazz) { PreparedPacket preparedPacket = this.brandMessages.get(clazz); if (preparedPacket == null) { this.brandMessages.put(clazz, preparedPacket = this.plugin.createPreparedPacket().prepare(this::createBrandMessage).build()); } return preparedPacket; } private PluginMessagePacket createBrandMessage(ProtocolVersion version) { String brand = "LimboAPI (" + Settings.IMP.VERSION + ") -> " + this.limboName; ByteBuf bufWithBrandString = Unpooled.buffer(); if (version.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0) { bufWithBrandString.writeCharSequence(brand, StandardCharsets.UTF_8); } else { ProtocolUtils.writeString(bufWithBrandString, brand); } return new PluginMessagePacket("MC|Brand", bufWithBrandString); } private PositionRotationPacket createPlayerPosAndLook(double posX, double posY, double posZ, float yaw, float pitch) { return new PositionRotationPacket(posX, posY, posZ, yaw, pitch, false, 44, true); } private UpdateViewPositionPacket createUpdateViewPosition(int posX, int posZ) { return new UpdateViewPositionPacket(posX >> 4, posZ >> 4); } private ChunkDataPacket createChunkData(VirtualChunk chunk, Dimension dimension) { return new ChunkDataPacket(chunk.getFullChunkSnapshot(), dimension.hasLegacySkyLight(), dimension.getMaxSections()); } public Integer getReadTimeout() { return this.readTimeout; } static { try { PARTIAL_HASHED_SEED_FIELD = MethodHandles.privateLookupIn(JoinGamePacket.class, MethodHandles.lookup()) .findSetter(JoinGamePacket.class, "partialHashedSeed", long.class); CURRENT_DIMENSION_DATA_FIELD = MethodHandles.privateLookupIn(JoinGamePacket.class, MethodHandles.lookup()) .findSetter(JoinGamePacket.class, "currentDimensionData", CompoundBinaryTag.class); ROOT_NODE_FIELD = MethodHandles.privateLookupIn(AvailableCommandsPacket.class, MethodHandles.lookup()) .findSetter(AvailableCommandsPacket.class, "rootNode", RootCommandNode.class); GRACEFUL_DISCONNECT_FIELD = MethodHandles.privateLookupIn(VelocityServerConnection.class, MethodHandles.lookup()) .findSetter(VelocityServerConnection.class, "gracefulDisconnect", boolean.class); REGISTRY_FIELD = MethodHandles.privateLookupIn(JoinGamePacket.class, MethodHandles.lookup()) .findSetter(JoinGamePacket.class, "registry", CompoundBinaryTag.class); LEVEL_NAMES_FIELDS = MethodHandles.privateLookupIn(JoinGamePacket.class, MethodHandles.lookup()) .findSetter(JoinGamePacket.class, "levelNames", ImmutableSet.class); try (InputStream stream = LimboAPI.class.getResourceAsStream("/mapping/chat_type_1_19.nbt")) { CHAT_TYPE_119 = BinaryTagIO.unlimitedReader().read(Objects.requireNonNull(stream), BinaryTagIO.Compression.GZIP); } try (InputStream stream = LimboAPI.class.getResourceAsStream("/mapping/chat_type_1_19_1.nbt")) { CHAT_TYPE_1191 = BinaryTagIO.unlimitedReader().read(Objects.requireNonNull(stream), BinaryTagIO.Compression.GZIP); } try (InputStream stream = LimboAPI.class.getResourceAsStream("/mapping/damage_type_1_19_4.nbt")) { DAMAGE_TYPE_1194 = BinaryTagIO.unlimitedReader().read(Objects.requireNonNull(stream), BinaryTagIO.Compression.GZIP); } try (InputStream stream = LimboAPI.class.getResourceAsStream("/mapping/damage_type_1_20.nbt")) { DAMAGE_TYPE_120 = BinaryTagIO.unlimitedReader().read(Objects.requireNonNull(stream), BinaryTagIO.Compression.GZIP); } } catch (NoSuchFieldException | IllegalAccessException e) { throw new ReflectionException(e); } catch (IOException e) { throw new IllegalStateException(e); } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/LimboPlayerImpl.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.client.ClientConfigSessionHandler; import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.packet.LegacyPlayerListItemPacket; import com.velocitypowered.proxy.protocol.packet.UpsertPlayerInfoPacket; import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.BufferedImage; import java.util.EnumSet; import java.util.List; import java.util.UUID; import java.util.concurrent.ScheduledExecutorService; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.api.Limbo; import net.elytrium.limboapi.api.material.Item; import net.elytrium.limboapi.api.material.VirtualItem; import net.elytrium.limboapi.api.player.GameMode; import net.elytrium.limboapi.api.player.LimboPlayer; import net.elytrium.limboapi.api.protocol.item.ItemComponentMap; import net.elytrium.limboapi.api.protocol.packets.data.AbilityFlags; import net.elytrium.limboapi.api.protocol.packets.data.MapData; import net.elytrium.limboapi.api.protocol.packets.data.MapPalette; import net.elytrium.limboapi.injection.login.LoginTasksQueue; import net.elytrium.limboapi.protocol.packets.s2c.ChangeGameStatePacket; import net.elytrium.limboapi.protocol.packets.s2c.MapDataPacket; import net.elytrium.limboapi.protocol.packets.s2c.PlayerAbilitiesPacket; import net.elytrium.limboapi.protocol.packets.s2c.PositionRotationPacket; import net.elytrium.limboapi.protocol.packets.s2c.SetSlotPacket; import net.elytrium.limboapi.protocol.packets.s2c.TimeUpdatePacket; import net.elytrium.limboapi.server.world.SimpleItem; import net.kyori.adventure.nbt.CompoundBinaryTag; import net.kyori.adventure.nbt.IntBinaryTag; public class LimboPlayerImpl implements LimboPlayer { private final LimboAPI plugin; private final LimboImpl server; private final ConnectedPlayer player; private final MinecraftConnection connection; private final LimboSessionHandlerImpl sessionHandler; private final ProtocolVersion version; private GameMode gameMode = GameMode.ADVENTURE; public LimboPlayerImpl(LimboAPI plugin, LimboImpl server, ConnectedPlayer player) { this.plugin = plugin; this.server = server; this.player = player; this.connection = this.player.getConnection(); this.sessionHandler = (LimboSessionHandlerImpl) this.connection.getActiveSessionHandler(); this.version = this.player.getProtocolVersion(); } @Override public void writePacket(Object packetObj) { this.connection.delayedWrite(packetObj); } @Override public void writePacketAndFlush(Object packetObj) { this.connection.write(packetObj); } @Override public void flushPackets() { this.connection.flush(); } @Override public void closeWith(Object packetObj) { this.connection.closeWith(packetObj); } @Override public ScheduledExecutorService getScheduledExecutor() { return this.connection.eventLoop(); } @Override public void sendImage(BufferedImage image) { this.sendImage(0, image, true, true); } @Override public void sendImage(BufferedImage image, boolean sendItem) { this.sendImage(0, image, sendItem, true); } @Override public void sendImage(int mapID, BufferedImage image) { this.sendImage(mapID, image, true, true); } @Override public void sendImage(int mapID, BufferedImage image, boolean sendItem) { this.sendImage(mapID, image, sendItem, true); } @Override public void sendImage(int mapID, BufferedImage image, boolean sendItem, boolean resize) { if (sendItem) { if (this.version.noLessThan(ProtocolVersion.MINECRAFT_1_20_5)) { this.setInventory(36, SimpleItem.fromItem(Item.FILLED_MAP), 1, mapID, this.plugin.createItemComponentMap().add(ProtocolVersion.MINECRAFT_1_20_5, "minecraft:map_id", mapID)); } else if (this.version.noLessThan(ProtocolVersion.MINECRAFT_1_17)) { this.setInventory(36, SimpleItem.fromItem(Item.FILLED_MAP), 1, mapID, CompoundBinaryTag.builder().put("map", IntBinaryTag.intBinaryTag(mapID)).build()); } else { this.setInventory(36, SimpleItem.fromItem(Item.FILLED_MAP), 1, mapID, (CompoundBinaryTag) null); } } if (image.getWidth() != MapData.MAP_DIM_SIZE || image.getHeight() != MapData.MAP_DIM_SIZE) { if (resize) { BufferedImage resizedImage = new BufferedImage(MapData.MAP_DIM_SIZE, MapData.MAP_DIM_SIZE, image.getType()); Graphics2D graphics = resizedImage.createGraphics(); graphics.drawImage(image.getScaledInstance(MapData.MAP_DIM_SIZE, MapData.MAP_DIM_SIZE, Image.SCALE_SMOOTH), 0, 0, null); graphics.dispose(); image = resizedImage; } else { throw new IllegalStateException( "You either need to provide an image of " + MapData.MAP_DIM_SIZE + "x" + MapData.MAP_DIM_SIZE + " pixels or set the resize parameter to true so that API will automatically resize your image." ); } } int[] toWrite = MapPalette.imageToBytes(image, this.version); if (this.version.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0) { byte[][] canvas = new byte[MapData.MAP_DIM_SIZE][MapData.MAP_DIM_SIZE]; for (int i = 0; i < MapData.MAP_SIZE; ++i) { canvas[i & 127][i >> 7] = (byte) toWrite[i]; } for (int i = 0; i < MapData.MAP_DIM_SIZE; ++i) { this.writePacket(new MapDataPacket(mapID, (byte) 0, new MapData(i, canvas[i]))); } this.flushPackets(); } else { byte[] canvas = new byte[MapData.MAP_SIZE]; for (int i = 0; i < MapData.MAP_SIZE; ++i) { canvas[i] = (byte) toWrite[i]; } this.writePacketAndFlush(new MapDataPacket(mapID, (byte) 0, new MapData(canvas))); } } @Override public void setInventory(VirtualItem item, int count) { this.writePacketAndFlush(new SetSlotPacket(0, 36, item, count, 0, null, null)); } @Override public void setInventory(VirtualItem item, int slot, int count) { this.writePacketAndFlush(new SetSlotPacket(0, slot, item, count, 0, null, null)); } @Override public void setInventory(int slot, VirtualItem item, int count, int data, CompoundBinaryTag nbt) { this.writePacketAndFlush(new SetSlotPacket(0, slot, item, count, data, nbt, null)); } @Override public void setInventory(int slot, VirtualItem item, int count, int data, ItemComponentMap map) { this.writePacketAndFlush(new SetSlotPacket(0, slot, item, count, data, null, map)); } @Override public void setGameMode(GameMode gameMode) { boolean is17 = this.version.compareTo(ProtocolVersion.MINECRAFT_1_8) < 0; if (gameMode != GameMode.SPECTATOR || !is17) { // Spectator game mode was added in 1.8. this.gameMode = gameMode; int id = this.gameMode.getID(); this.sendAbilities(); if (!is17) { UUID uuid = this.plugin.getInitialID(this.player); if (this.connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_19_1) <= 0) { this.writePacket( new LegacyPlayerListItemPacket(LegacyPlayerListItemPacket.UPDATE_GAMEMODE, List.of( new LegacyPlayerListItemPacket.Item(uuid).setGameMode(id) ) ) ); } else { UpsertPlayerInfoPacket.Entry playerInfoEntry = new UpsertPlayerInfoPacket.Entry(uuid); playerInfoEntry.setGameMode(id); this.writePacket(new UpsertPlayerInfoPacket(EnumSet.of(UpsertPlayerInfoPacket.Action.UPDATE_GAME_MODE), List.of(playerInfoEntry))); } } this.writePacket(new ChangeGameStatePacket(3, id)); this.flushPackets(); } } @Override public void teleport(double posX, double posY, double posZ, float yaw, float pitch) { this.writePacketAndFlush(new PositionRotationPacket(posX, posY, posZ, yaw, pitch, false, 44, true)); } @Override public void disableFalling() { this.writePacketAndFlush(new PlayerAbilitiesPacket((byte) (this.getAbilities() | AbilityFlags.FLYING | AbilityFlags.ALLOW_FLYING), 0F, 0F)); } @Override public void enableFalling() { this.writePacketAndFlush(new PlayerAbilitiesPacket((byte) (this.getAbilities() & (~AbilityFlags.FLYING)), 0.05F, 0.1F)); } @Override public void disconnect() { this.connection.eventLoop().execute(() -> { if (this.connection.getActiveSessionHandler() == this.sessionHandler) { this.sessionHandler.disconnect(() -> { if (this.plugin.hasLoginQueue(this.player)) { if (this.connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) >= 0) { this.sessionHandler.disconnectToConfig(() -> this.plugin.getLoginQueue(this.player).next()); } else { this.sessionHandler.disconnected(); this.plugin.getLoginQueue(this.player).next(); } } else { RegisteredServer server = this.sessionHandler.getPreviousServer(); if (server != null) { this.sendToRegisteredServer(server); } else { this.sessionHandler.disconnected(); } } }); } }); } @Override public void disconnect(RegisteredServer server) { this.connection.eventLoop().execute(() -> { if (this.connection.getActiveSessionHandler() == this.sessionHandler) { this.sessionHandler.disconnect(() -> { if (this.plugin.hasLoginQueue(this.player)) { if (this.connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) >= 0) { this.sessionHandler.disconnectToConfig(() -> { this.plugin.setNextServer(this.player, server); this.plugin.getLoginQueue(this.player).next(); }); } else { this.sessionHandler.disconnected(); this.plugin.setNextServer(this.player, server); this.plugin.getLoginQueue(this.player).next(); } } else { this.sendToRegisteredServer(server); } }); } }); } private void deject() { this.plugin.deject3rdParty(this.connection.getChannel().pipeline()); this.plugin.fixCompressor(this.connection.getChannel().pipeline(), this.version); } private void sendToRegisteredServer(RegisteredServer server) { this.deject(); this.connection.setState(StateRegistry.PLAY); if (this.connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) >= 0) { this.sessionHandler.disconnectToConfig(() -> { // Rollback original CONFIG handler ClientConfigSessionHandler handler = new ClientConfigSessionHandler(this.plugin.getServer(), this.player); LoginTasksQueue.BRAND_CHANNEL_SETTER.accept(handler, "minecraft:brand"); this.connection.setActiveSessionHandler(StateRegistry.CONFIG, handler); this.player.createConnectionRequest(server).fireAndForget(); }); } else { if (this.connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_19_1) <= 0) { this.connection.delayedWrite(new LegacyPlayerListItemPacket( LegacyPlayerListItemPacket.REMOVE_PLAYER, List.of(new LegacyPlayerListItemPacket.Item(this.plugin.getInitialID(this.player))) )); } this.sessionHandler.disconnected(); this.player.createConnectionRequest(server).fireAndForget(); } } @Override public void sendAbilities() { this.writePacketAndFlush(new PlayerAbilitiesPacket(this.getAbilities(), 0.05F, 0.1F)); } @Override public void sendAbilities(int abilities, float flySpeed, float walkSpeed) { this.writePacketAndFlush(new PlayerAbilitiesPacket((byte) abilities, flySpeed, walkSpeed)); } @Override public void sendAbilities(byte abilities, float flySpeed, float walkSpeed) { this.writePacketAndFlush(new PlayerAbilitiesPacket(abilities, flySpeed, walkSpeed)); } @Override public byte getAbilities() { return switch (this.gameMode) { case CREATIVE -> AbilityFlags.ALLOW_FLYING | AbilityFlags.CREATIVE_MODE | AbilityFlags.INVULNERABLE; case SPECTATOR -> AbilityFlags.ALLOW_FLYING | AbilityFlags.INVULNERABLE | AbilityFlags.FLYING; default -> 0; }; } @Override public GameMode getGameMode() { return this.gameMode; } @Override public Limbo getServer() { return this.server; } @Override public Player getProxyPlayer() { return this.player; } @Override public int getPing() { LimboSessionHandlerImpl handler = (LimboSessionHandlerImpl) this.connection.getActiveSessionHandler(); if (handler != null) { return handler.getPing(); } else { return -1; } } @Override public void setWorldTime(long ticks) { this.writePacketAndFlush(new TimeUpdatePacket(ticks, ticks)); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/LimboSessionHandlerImpl.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.client.AuthSessionHandler; import com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler; import com.velocitypowered.proxy.connection.client.ConnectedPlayer; import com.velocitypowered.proxy.network.Connections; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.packet.ClientSettingsPacket; import com.velocitypowered.proxy.protocol.packet.KeepAlivePacket; import com.velocitypowered.proxy.protocol.packet.PluginMessagePacket; import com.velocitypowered.proxy.protocol.packet.chat.keyed.KeyedPlayerChatPacket; import com.velocitypowered.proxy.protocol.packet.chat.keyed.KeyedPlayerCommandPacket; import com.velocitypowered.proxy.protocol.packet.chat.legacy.LegacyChatPacket; import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerChatPacket; import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerCommandPacket; import com.velocitypowered.proxy.protocol.packet.chat.session.UnsignedPlayerCommandPacket; import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.StartUpdatePacket; import com.velocitypowered.proxy.protocol.util.PluginMessageUtil; import com.velocitypowered.proxy.util.except.QuietDecoderException; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelPipeline; import io.netty.handler.timeout.ReadTimeoutHandler; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; import net.elytrium.commons.utils.reflection.ReflectionException; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.Settings; import net.elytrium.limboapi.api.LimboSessionHandler; import net.elytrium.limboapi.api.player.LimboPlayer; import net.elytrium.limboapi.injection.login.confirmation.LoginConfirmHandler; import net.elytrium.limboapi.protocol.LimboProtocol; import net.elytrium.limboapi.protocol.packets.c2s.MoveOnGroundOnlyPacket; import net.elytrium.limboapi.protocol.packets.c2s.MovePacket; import net.elytrium.limboapi.protocol.packets.c2s.MovePositionOnlyPacket; import net.elytrium.limboapi.protocol.packets.c2s.MoveRotationOnlyPacket; import net.elytrium.limboapi.protocol.packets.c2s.PlayerChatSessionPacket; import net.elytrium.limboapi.protocol.packets.c2s.TeleportConfirmPacket; public class LimboSessionHandlerImpl implements MinecraftSessionHandler { private static final boolean BACKPRESSURE_LOG = Boolean.getBoolean("velocity.log-server-backpressure"); private static final MethodHandle TEARDOWN_METHOD; private final LimboAPI plugin; private final LimboImpl limbo; private final ConnectedPlayer player; private final LimboSessionHandler callback; private final StateRegistry originalState; private final MinecraftSessionHandler originalHandler; private final RegisteredServer previousServer; private final Supplier limboName; private final CompletableFuture playTransition = new CompletableFuture<>(); private final CompletableFuture configTransition = new CompletableFuture<>(); private final CompletableFuture chatSession = new CompletableFuture<>(); private LimboPlayer limboPlayer; private ClientSettingsPacket settings; private String brand; private ScheduledFuture keepAliveTask; private ScheduledFuture chatSessionTimeoutTask; private ScheduledFuture respawnTask; private long keepAliveKey; private boolean keepAlivePending; private int keepAlivesSkipped; private long keepAliveSentTime; private int ping = -1; private int genericBytes; private boolean loaded; private boolean switching; private boolean disconnecting; private boolean joinGameTriggered; public LimboSessionHandlerImpl(LimboAPI plugin, LimboImpl limbo, ConnectedPlayer player, LimboSessionHandler callback, StateRegistry originalState, MinecraftSessionHandler originalHandler, RegisteredServer previousServer, Supplier limboName) { this.plugin = plugin; this.limbo = limbo; this.player = player; this.callback = callback; this.originalState = originalState; this.originalHandler = originalHandler; this.previousServer = previousServer; this.limboName = limboName; this.loaded = player.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_18_2) < 0; if (originalHandler instanceof LimboSessionHandlerImpl sessionHandler) { this.settings = sessionHandler.getSettings(); this.brand = sessionHandler.getBrand(); } } public void onConfig(LimboPlayer player) { this.loaded = true; this.limboPlayer = player; this.callback.onConfig(this.limbo, player); Integer serverReadTimeout = this.limbo.getReadTimeout(); if (serverReadTimeout == null) { serverReadTimeout = this.plugin.getServer().getConfiguration().getReadTimeout(); } // We should always send multiple keepalives inside a single timeout to not trigger Netty read timeout. serverReadTimeout /= 2; this.keepAliveTask = player.getScheduledExecutor().scheduleAtFixedRate(() -> { MinecraftConnection connection = this.player.getConnection(); if (connection.isClosed()) { this.keepAliveTask.cancel(true); return; } if (this.keepAlivePending) { if (++this.keepAlivesSkipped == 2) { connection.closeWith(this.plugin.getPackets().getTimeOut(this.player.getConnection().getState())); if (Settings.IMP.MAIN.LOGGING_ENABLED) { LimboAPI.getLogger().warn("{} was kicked due to keepalive timeout.", this.player); } } } else if (this.keepAliveSentTime == 0 && this.originalHandler instanceof LimboSessionHandlerImpl sessionHandler) { this.keepAliveKey = sessionHandler.keepAliveKey; this.keepAlivePending = sessionHandler.keepAlivePending; this.keepAlivesSkipped = sessionHandler.keepAlivesSkipped; this.keepAliveSentTime = sessionHandler.keepAliveSentTime; this.ping = sessionHandler.ping; } else { this.keepAliveKey = ThreadLocalRandom.current().nextInt(); KeepAlivePacket keepAlive = new KeepAlivePacket(); keepAlive.setRandomId(this.keepAliveKey); connection.write(keepAlive); this.keepAlivePending = true; this.keepAlivesSkipped = 0; this.keepAliveSentTime = System.currentTimeMillis(); } }, 250, serverReadTimeout, TimeUnit.MILLISECONDS); } public void onSpawn() { this.callback.onSpawn(this.limbo, this.limboPlayer); // Player is spawned, so can trust that transition to the PLAY state is complete this.playTransition.complete(this); } public void disconnectToConfig(Runnable runnable) { if (this.configTransition.isDone()) { runnable.run(); return; } this.release(); this.switching = true; this.loaded = false; if (this.player.isOnlineMode() && this.player.getProtocolVersion().lessThan(ProtocolVersion.MINECRAFT_1_21_2) && this.joinGameTriggered) { // There is a race condition in the client then it reconnects too quickly (https://bugs.mojang.com/browse/MC-272506) if (!this.chatSession.isDone() && this.chatSessionTimeoutTask == null) { this.chatSessionTimeoutTask = this.player.getConnection().eventLoop() .schedule(() -> this.chatSession.complete(this), Settings.IMP.MAIN.CHAT_SESSION_PACKET_TIMEOUT, TimeUnit.MILLISECONDS); } this.chatSession.thenRunAsync(() -> { this.player.getConnection().write(StartUpdatePacket.INSTANCE); this.configTransition.thenRun(this::disconnected).thenRun(runnable); }, this.player.getConnection().eventLoop()); } else { this.player.getConnection().write(StartUpdatePacket.INSTANCE); this.configTransition.thenRun(this::disconnected).thenRun(runnable); } } @Override public boolean handle(FinishedUpdatePacket packet) { // Switching to CONFIG state if (this.player.getConnection().getState() != StateRegistry.CONFIG) { this.plugin.setActiveSessionHandler(this.player.getConnection(), StateRegistry.CONFIG, this); if (!this.loaded && !this.disconnecting) { this.limbo.spawnPlayerLocal(this.callback.getClass(), this, this.player, this.player.getConnection()); } else if (this.switching) { this.switching = false; this.configTransition.complete(this); } else { this.player.getConnection().closeWith(this.plugin.getPackets().getInvalidSwitch()); if (Settings.IMP.MAIN.LOGGING_ENABLED) { LimboAPI.getLogger().warn("{} sent an unexpected state switch confirmation.", this.player); } } return true; } this.limbo.onSpawn(this.callback.getClass(), this.player.getConnection(), this.player, this); this.player.getConnection().flush(); return true; } public boolean handle(MovePacket packet) { if (this.loaded) { this.callback.onGround(packet.isOnGround()); this.callback.onMove(packet.getX(), packet.getY(), packet.getZ()); this.callback.onMove(packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getPitch()); this.callback.onRotate(packet.getYaw(), packet.getPitch()); } return true; } public boolean handle(MovePositionOnlyPacket packet) { if (this.loaded) { this.callback.onGround(packet.isOnGround()); this.callback.onMove(packet.getX(), packet.getY(), packet.getZ()); } return true; } public boolean handle(MoveRotationOnlyPacket packet) { if (this.loaded) { this.callback.onGround(packet.isOnGround()); this.callback.onRotate(packet.getYaw(), packet.getPitch()); } return true; } public boolean handle(MoveOnGroundOnlyPacket packet) { if (this.loaded) { this.callback.onGround(packet.isOnGround()); } return true; } public boolean handle(TeleportConfirmPacket packet) { if (this.loaded) { this.callback.onTeleport(packet.getTeleportID()); } return true; } @Override public boolean handle(KeepAlivePacket packet) { MinecraftConnection connection = this.player.getConnection(); if (this.keepAlivePending) { if (packet.getRandomId() != this.keepAliveKey) { connection.closeWith(this.plugin.getPackets().getInvalidPing()); if (Settings.IMP.MAIN.LOGGING_ENABLED) { LimboAPI.getLogger().warn("{} sent an invalid keepalive.", this.player); } return false; } else { this.keepAlivePending = false; this.keepAlivesSkipped = 0; int currentPing = (int) (System.currentTimeMillis() - this.keepAliveSentTime); this.ping = this.ping == -1 ? currentPing : (this.ping * 3 + currentPing) / 4; return true; } } else { connection.closeWith(this.plugin.getPackets().getInvalidPing()); if (Settings.IMP.MAIN.LOGGING_ENABLED) { LimboAPI.getLogger().warn("{} sent an unexpected keepalive.", this.player); } return false; } } @Override public boolean handle(LegacyChatPacket packet) { return this.handleChat(packet.getMessage()); } @Override public boolean handle(KeyedPlayerChatPacket packet) { return this.handleChat(packet.getMessage()); } @Override public boolean handle(KeyedPlayerCommandPacket packet) { return this.handleChat("/" + packet.getCommand()); } @Override public boolean handle(SessionPlayerChatPacket packet) { return this.handleChat(packet.getMessage()); } @Override public boolean handle(SessionPlayerCommandPacket packet) { return this.handleChat("/" + packet.getCommand()); } private boolean handleChat(String message) { int messageLength = message.length(); if (messageLength > Settings.IMP.MAIN.MAX_CHAT_MESSAGE_LENGTH) { this.kickTooBigPacket("chat", messageLength); } else { this.callback.onChat(message); } return true; } @Override public void handleUnknown(ByteBuf packet) { int readableBytes = packet.readableBytes(); this.genericBytes += readableBytes; if (readableBytes > Settings.IMP.MAIN.MAX_UNKNOWN_PACKET_LENGTH) { this.kickTooBigPacket("unknown", readableBytes); } else if (this.genericBytes > Settings.IMP.MAIN.MAX_MULTI_GENERIC_PACKET_LENGTH) { this.kickTooBigPacket("unknown, multi", this.genericBytes); } } @Override public void handleGeneric(MinecraftPacket packet) { if (packet instanceof ClientSettingsPacket clientSettings) { this.settings = clientSettings; } else if (packet instanceof PlayerChatSessionPacket) { if (this.chatSessionTimeoutTask != null) { this.chatSessionTimeoutTask.cancel(true); } this.chatSession.complete(this); } else if (packet instanceof PluginMessagePacket pluginMessage) { int singleLength = pluginMessage.content().readableBytes() + pluginMessage.getChannel().length() * 4; this.genericBytes += singleLength; if (singleLength > Settings.IMP.MAIN.MAX_SINGLE_GENERIC_PACKET_LENGTH) { this.kickTooBigPacket("generic (PluginMessage packet (custom payload)), single", singleLength); return; } else if (this.genericBytes > Settings.IMP.MAIN.MAX_MULTI_GENERIC_PACKET_LENGTH) { this.kickTooBigPacket("generic (PluginMessage packet (custom payload)), multi", this.genericBytes); return; } if (this.player.getConnection().getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) >= 0 && PluginMessageUtil.isMcBrand(pluginMessage)) { try { this.brand = ProtocolUtils.readString(pluginMessage.content().slice(), Settings.IMP.MAIN.MAX_BRAND_NAME_LENGTH); } catch (QuietDecoderException ignored) { this.kickTooBigPacket("brand name", pluginMessage.content().readableBytes()); return; } } } else if (packet instanceof UnsignedPlayerCommandPacket commandPacket) { this.handleChat("/" + commandPacket.getCommand()); return; } this.callback.onGeneric(packet); } @Override public void writabilityChanged() { if (BACKPRESSURE_LOG) { if (this.player.getConnection().getChannel().isWritable()) { LimboAPI.getLogger().info("{} is writable, will auto-read", this.player); } else { LimboAPI.getLogger().info("{} is not writable, not auto-reading", this.player); } } } private void kickTooBigPacket(String type, int length) { this.player.getConnection().closeWith(this.plugin.getPackets().getTooBigPacket()); if (Settings.IMP.MAIN.LOGGING_ENABLED) { LimboAPI.getLogger().warn("{} sent too big packet. (type: {}, length: {})", this.player, type, length); } } public void release() { if (this.keepAliveTask != null) { this.keepAliveTask.cancel(true); } if (this.respawnTask != null) { this.respawnTask.cancel(true); } if (this.loaded) { this.limbo.onDisconnect(); this.callback.onDisconnect(); } } @Override public void disconnected() { //this.disconnected = true; this.release(); if (Settings.IMP.MAIN.LOGGING_ENABLED) { LimboAPI.getLogger().info( "{} ({}) has disconnected from the {} Limbo", this.player.getUsername(), this.player.getRemoteAddress(), this.limboName.get() ); } MinecraftConnection connection = this.player.getConnection(); if (connection.isClosed()) { try { TEARDOWN_METHOD.invokeExact(this.player); } catch (Throwable e) { throw new ReflectionException(e); } return; } if (!(this.originalHandler instanceof AuthSessionHandler) && !(this.originalHandler instanceof LimboSessionHandlerImpl) && !(this.originalHandler instanceof ClientPlaySessionHandler) // cause issues with server switching && !(this.originalHandler instanceof LoginConfirmHandler)) { connection.eventLoop().execute(() -> { // Ensure that originalHandler is returned to the proper state if (connection.getState() != this.originalState) { connection.addSessionHandler(this.originalState, this.originalHandler); } else { this.plugin.setActiveSessionHandler(connection, connection.getState(), this.originalHandler); } }); } ChannelPipeline pipeline = connection.getChannel().pipeline(); if (pipeline.get(LimboProtocol.READ_TIMEOUT) != null) { pipeline.replace(LimboProtocol.READ_TIMEOUT, Connections.READ_TIMEOUT, new ReadTimeoutHandler(this.plugin.getServer().getConfiguration().getReadTimeout(), TimeUnit.MILLISECONDS) ); } } public void disconnect(Runnable runnable) { if (!this.disconnecting) { this.disconnecting = true; if (this.player.getConnection().getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) < 0) { runnable.run(); } else { this.playTransition.thenRun(runnable); } } } public RegisteredServer getPreviousServer() { return this.previousServer; } public int getPing() { return this.ping; } public void setJoinGameTriggered(boolean joinGameTriggered) { this.joinGameTriggered = joinGameTriggered; } public void setRespawnTask(ScheduledFuture respawnTask) { if (this.respawnTask != null) { this.respawnTask.cancel(true); } this.respawnTask = respawnTask; } public ClientSettingsPacket getSettings() { return this.settings; } public String getBrand() { return this.brand; } static { try { TEARDOWN_METHOD = MethodHandles.privateLookupIn(ConnectedPlayer.class, MethodHandles.lookup()) .findVirtual(ConnectedPlayer.class, "teardown", MethodType.methodType(void.class)); } catch (NoSuchMethodException | IllegalAccessException e) { throw new ReflectionException(e); } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/item/SimpleItemComponentManager.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.item; import com.google.gson.Gson; import com.google.gson.internal.LinkedTreeMap; import com.velocitypowered.api.network.ProtocolVersion; import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import java.util.Objects; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.server.item.type.BooleanItemComponent; import net.elytrium.limboapi.server.item.type.ComponentItemComponent; import net.elytrium.limboapi.server.item.type.ComponentsItemComponent; import net.elytrium.limboapi.server.item.type.DyedColorItemComponent; import net.elytrium.limboapi.server.item.type.EmptyItemComponent; import net.elytrium.limboapi.server.item.type.EnchantmentsItemComponent; import net.elytrium.limboapi.server.item.type.GameProfileItemComponent; import net.elytrium.limboapi.server.item.type.IntItemComponent; import net.elytrium.limboapi.server.item.type.StringItemComponent; import net.elytrium.limboapi.server.item.type.StringsItemComponent; import net.elytrium.limboapi.server.item.type.TagItemComponent; import net.elytrium.limboapi.server.item.type.VarIntItemComponent; import net.elytrium.limboapi.server.item.type.WriteableItemComponent; public class SimpleItemComponentManager { private static final Gson GSON = new Gson(); private static final Map> ID = new HashMap<>(); static { LinkedTreeMap> mapping = GSON.fromJson( new InputStreamReader( Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/data_component_types_mapping.json")), StandardCharsets.UTF_8 ), LinkedTreeMap.class ); LinkedTreeMap components = GSON.fromJson( new InputStreamReader( Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/data_component_types.json")), StandardCharsets.UTF_8 ), LinkedTreeMap.class ); Map cache = new HashMap<>(); for (ProtocolVersion version : ProtocolVersion.values()) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_20_5) < 0) { continue; } cache.put(version.name().substring("MINECRAFT_".length()).replace('_', '.'), version); } components.forEach((name, id) -> { mapping.get(id).forEach((version, protocolId) -> { ID.computeIfAbsent(cache.get(version), key -> new Object2IntOpenHashMap<>()).put(name, Integer.parseInt(protocolId)); }); }); } private final Map> factory = new HashMap<>(); public SimpleItemComponentManager() { // TODO: implement missing components: // trim, intangible_projectile, food, suspicious_stew_effects, lock, tool, // can_break, writable_book_content, potion_contents, bees, banner_patterns, // pot_decorations, map_decorations, debug_stick_state, can_place_on, lodestone_tracker, // written_book_content, container_loot, container, block_state, attribute_modifiers, // bundle_contents, firework_explosion, charged_projectiles, fireworks this.register("minecraft:lore", version -> new ComponentsItemComponent("minecraft:lore")); this.register("minecraft:dyed_color", version -> new DyedColorItemComponent("minecraft:dyed_color")); this.register("minecraft:profile", version -> new GameProfileItemComponent("minecraft:profile")); for (String type : new String[] { "minecraft:max_stack_size", "minecraft:max_damage", "minecraft:damage", "minecraft:rarity", "minecraft:custom_model_data", "minecraft:repair_cost", "minecraft:map_id", "minecraft:map_post_processing", "minecraft:ominous_bottle_amplifier", "minecraft:base_color" }) { this.register(type, version -> new VarIntItemComponent(type)); } for (String type : new String[] { "minecraft:unbreakable", "minecraft:enchantment_glint_override" }) { this.register(type, version -> new BooleanItemComponent(type)); } for (String type : new String[] { "minecraft:custom_name", "minecraft:item_name" }) { this.register(type, version -> new ComponentItemComponent(type)); } for (String type : new String[] { "minecraft:hide_additional_tooltip", "minecraft:hide_tooltip", "minecraft:creative_slot_lock", "minecraft:fire_resistant" }) { this.register(type, version -> new EmptyItemComponent(type)); } for (String type : new String[] { "minecraft:enchantments", "minecraft:stored_enchantments" }) { this.register(type, version -> new EnchantmentsItemComponent(type)); } for (String type : new String[] { "minecraft:map_color" }) { this.register(type, version -> new IntItemComponent(type)); } for (String type : new String[] { "minecraft:custom_data", "minecraft:entity_data", "minecraft:bucket_entity_data", "minecraft:block_entity_data" }) { this.register(type, version -> new TagItemComponent(type)); } for (String type : new String[] { "minecraft:instrument", "minecraft:note_block_sound" }) { this.register(type, version -> new StringItemComponent(type)); } for (String type : new String[] { "minecraft:recipes" }) { this.register(type, version -> new StringsItemComponent(type)); } } public void register(String name, Function factory) { this.factory.put(name, factory); } public WriteableItemComponent createComponent(ProtocolVersion version, String name) { return (WriteableItemComponent) this.factory.get(name).apply(version); } public int getId(String name, ProtocolVersion version) { Object2IntMap ids = ID.get(version); if (ids == null) { throw new IllegalArgumentException("unsupported version: " + version); } if (!ids.containsKey(name)) { throw new IllegalStateException("component not found: " + name); } return ids.getInt(name); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/item/SimpleItemComponentMap.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.item; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.List; import net.elytrium.limboapi.api.protocol.item.ItemComponent; import net.elytrium.limboapi.api.protocol.item.ItemComponentMap; import net.elytrium.limboapi.server.item.type.WriteableItemComponent; public class SimpleItemComponentMap implements ItemComponentMap { private final List> addedComponents = new ArrayList<>(); private final List> removedComponents = new ArrayList<>(); private final SimpleItemComponentManager manager; public SimpleItemComponentMap(SimpleItemComponentManager manager) { this.manager = manager; } @Override public ItemComponentMap add(ProtocolVersion version, String name, T value) { this.addedComponents.add((WriteableItemComponent) this.manager.createComponent(version, name).setValue(value)); return this; } @Override public ItemComponentMap remove(ProtocolVersion version, String name) { this.removedComponents.add(this.manager.createComponent(version, name)); return null; } @Override public List getAdded() { return (List) (Object) this.addedComponents; } @Override public List getRemoved() { return (List) (Object) this.removedComponents; } @Override public void read(ProtocolVersion version, Object buffer) { // TODO: implement throw new UnsupportedOperationException("read"); } @Override public void write(ProtocolVersion version, Object buffer) { ByteBuf buf = (ByteBuf) buffer; ProtocolUtils.writeVarInt(buf, this.getAdded().size()); ProtocolUtils.writeVarInt(buf, this.getRemoved().size()); for (WriteableItemComponent component : this.addedComponents) { ProtocolUtils.writeVarInt(buf, this.manager.getId(component.getName(), version)); component.write(version, buf); } for (WriteableItemComponent component : this.removedComponents) { ProtocolUtils.writeVarInt(buf, this.manager.getId(component.getName(), version)); } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/item/type/BooleanItemComponent.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.item.type; import com.velocitypowered.api.network.ProtocolVersion; import io.netty.buffer.ByteBuf; public class BooleanItemComponent extends WriteableItemComponent { public BooleanItemComponent(String name) { super(name); } @Override public void write(ProtocolVersion version, ByteBuf buffer) { buffer.writeBoolean(this.getValue()); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/item/type/ComponentItemComponent.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.item.type; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.packet.chat.ComponentHolder; import io.netty.buffer.ByteBuf; import net.kyori.adventure.text.Component; public class ComponentItemComponent extends WriteableItemComponent { public ComponentItemComponent(String name) { super(name); } @Override public void write(ProtocolVersion version, ByteBuf buffer) { new ComponentHolder(version, this.getValue()).write(buffer); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/item/type/ComponentsItemComponent.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.item.type; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.packet.chat.ComponentHolder; import io.netty.buffer.ByteBuf; import java.util.List; import net.kyori.adventure.text.Component; public class ComponentsItemComponent extends WriteableItemComponent> { public ComponentsItemComponent(String name) { super(name); } @Override public void write(ProtocolVersion version, ByteBuf buffer) { ProtocolUtils.writeVarInt(buffer, this.getValue().size()); for (Component component : this.getValue()) { new ComponentHolder(version, component).write(buffer); } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/item/type/DyedColorItemComponent.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.item.type; import com.velocitypowered.api.network.ProtocolVersion; import io.netty.buffer.ByteBuf; import it.unimi.dsi.fastutil.Pair; public class DyedColorItemComponent extends WriteableItemComponent> { public DyedColorItemComponent(String name) { super(name); } @Override public void write(ProtocolVersion version, ByteBuf buffer) { buffer.writeInt(this.getValue().left()); buffer.writeBoolean(this.getValue().right()); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/item/type/EmptyItemComponent.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.item.type; import com.velocitypowered.api.network.ProtocolVersion; import io.netty.buffer.ByteBuf; import net.kyori.adventure.nbt.BinaryTag; public class EmptyItemComponent extends WriteableItemComponent { public EmptyItemComponent(String name) { super(name); } @Override public void write(ProtocolVersion version, ByteBuf buffer) { } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/item/type/EnchantmentsItemComponent.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.item.type; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import it.unimi.dsi.fastutil.Pair; import java.util.List; public class EnchantmentsItemComponent extends WriteableItemComponent>, Boolean>> { public EnchantmentsItemComponent(String name) { super(name); } @Override public void write(ProtocolVersion version, ByteBuf buffer) { ProtocolUtils.writeVarInt(buffer, this.getValue().left().size()); for (Pair enchantment : this.getValue().left()) { ProtocolUtils.writeVarInt(buffer, enchantment.left()); ProtocolUtils.writeVarInt(buffer, enchantment.right()); } buffer.writeBoolean(this.getValue().right()); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/item/type/GameProfileItemComponent.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.item.type; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.util.GameProfile; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import java.util.UUID; public class GameProfileItemComponent extends WriteableItemComponent { private static final UUID ZERO = new UUID(0, 0); public GameProfileItemComponent(String name) { super(name); } @Override public void write(ProtocolVersion version, ByteBuf buffer) { buffer.writeBoolean(!this.getValue().getName().isEmpty()); if (!this.getValue().getName().isEmpty()) { ProtocolUtils.writeString(buffer, this.getValue().getName()); } buffer.writeBoolean(!this.getValue().getId().equals(ZERO)); if (!this.getValue().getId().equals(ZERO)) { ProtocolUtils.writeUuid(buffer, this.getValue().getId()); } ProtocolUtils.writeProperties(buffer, this.getValue().getProperties()); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/item/type/IntItemComponent.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.item.type; import com.velocitypowered.api.network.ProtocolVersion; import io.netty.buffer.ByteBuf; public class IntItemComponent extends WriteableItemComponent { public IntItemComponent(String name) { super(name); } @Override public void write(ProtocolVersion version, ByteBuf buffer) { buffer.writeInt(this.getValue()); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/item/type/StringItemComponent.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.item.type; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; public class StringItemComponent extends WriteableItemComponent { public StringItemComponent(String name) { super(name); } @Override public void write(ProtocolVersion version, ByteBuf buffer) { ProtocolUtils.writeString(buffer, this.getValue()); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/item/type/StringsItemComponent.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.item.type; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import java.util.List; public class StringsItemComponent extends WriteableItemComponent> { public StringsItemComponent(String name) { super(name); } @Override public void write(ProtocolVersion version, ByteBuf buffer) { ProtocolUtils.writeVarInt(buffer, this.getValue().size()); for (String string : this.getValue()) { ProtocolUtils.writeString(buffer, string); } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/item/type/TagItemComponent.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.item.type; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import net.kyori.adventure.nbt.BinaryTag; public class TagItemComponent extends WriteableItemComponent { public TagItemComponent(String name) { super(name); } @Override public void write(ProtocolVersion version, ByteBuf buffer) { ProtocolUtils.writeBinaryTag(buffer, version, this.getValue()); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/item/type/VarIntItemComponent.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.item.type; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; public class VarIntItemComponent extends WriteableItemComponent { public VarIntItemComponent(String name) { super(name); } @Override public void write(ProtocolVersion version, ByteBuf buffer) { ProtocolUtils.writeVarInt(buffer, this.getValue()); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/item/type/WriteableItemComponent.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.item.type; import com.velocitypowered.api.network.ProtocolVersion; import io.netty.buffer.ByteBuf; import net.elytrium.limboapi.api.protocol.item.ItemComponent; public abstract class WriteableItemComponent implements ItemComponent { private final String name; private T value; public WriteableItemComponent(String name) { this.name = name; } public abstract void write(ProtocolVersion version, ByteBuf buffer); @Override public String getName() { return this.name; } @Override public ItemComponent setValue(T value) { this.value = value; return this; } @Override public T getValue() { return this.value; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/world/SimpleBlock.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.world; import com.google.gson.Gson; import com.google.gson.internal.LinkedTreeMap; import com.velocitypowered.api.network.ProtocolVersion; import io.netty.util.collection.ShortObjectHashMap; import io.netty.util.collection.ShortObjectMap; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.EnumMap; import java.util.HashMap; import java.util.HashSet; import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Set; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.api.chunk.VirtualBlock; import net.elytrium.limboapi.api.material.WorldVersion; import org.checkerframework.checker.nullness.qual.NonNull; public class SimpleBlock implements VirtualBlock { private static final Gson GSON = new Gson(); private static final ShortObjectHashMap LEGACY_BLOCK_STATE_IDS_MAP = new ShortObjectHashMap<>(); private static final Map> MODERN_BLOCK_STATE_IDS_MAP = new EnumMap<>(ProtocolVersion.class); private static final ShortObjectHashMap MODERN_BLOCK_STATE_PROTOCOL_ID_MAP = new ShortObjectHashMap<>(); private static final Map, Short>> MODERN_BLOCK_STATE_STRING_MAP = new HashMap<>(); private static final Map MODERN_BLOCK_STRING_MAP = new HashMap<>(); private static final ShortObjectHashMap> LEGACY_BLOCK_IDS_MAP = new ShortObjectHashMap<>(); private static final Map> DEFAULT_PROPERTIES_MAP = new HashMap<>(); private static final Map MODERN_ID_REMAP = new HashMap<>(); public static final SimpleBlock AIR = new SimpleBlock(false, true, false, "minecraft:air", (short) 0, (short) 0); @SuppressWarnings("unchecked") public static void init() { LinkedTreeMap blocks = GSON.fromJson( new InputStreamReader( Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/blocks.json")), StandardCharsets.UTF_8 ), LinkedTreeMap.class ); blocks.forEach((modernId, protocolId) -> MODERN_BLOCK_STRING_MAP.put(modernId, Short.valueOf(protocolId))); LinkedTreeMap> blockVersionMapping = GSON.fromJson( new InputStreamReader( Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/blocks_mapping.json")), StandardCharsets.UTF_8 ), LinkedTreeMap.class ); blockVersionMapping.forEach((protocolId, versionMap) -> { EnumMap deserializedVersionMap = new EnumMap<>(WorldVersion.class); versionMap.forEach((version, id) -> deserializedVersionMap.put(WorldVersion.parse(version), Short.valueOf(id))); LEGACY_BLOCK_IDS_MAP.put(Short.valueOf(protocolId), deserializedVersionMap); }); LinkedTreeMap blockStates = GSON.fromJson( new InputStreamReader(Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/blockstates.json")), StandardCharsets.UTF_8), LinkedTreeMap.class ); blockStates.forEach((key, value) -> { MODERN_BLOCK_STATE_PROTOCOL_ID_MAP.put(Short.valueOf(value), key); String[] stringIDArgs = key.split("\\["); if (!MODERN_BLOCK_STATE_STRING_MAP.containsKey(stringIDArgs[0])) { MODERN_BLOCK_STATE_STRING_MAP.put(stringIDArgs[0], new HashMap<>()); } if (stringIDArgs.length == 1) { MODERN_BLOCK_STATE_STRING_MAP.get(stringIDArgs[0]).put(null, Short.valueOf(value)); } else { stringIDArgs[1] = stringIDArgs[1].substring(0, stringIDArgs[1].length() - 1); MODERN_BLOCK_STATE_STRING_MAP.get(stringIDArgs[0]).put(new HashSet<>(Arrays.asList(stringIDArgs[1].split(","))), Short.valueOf(value)); } }); LinkedTreeMap legacyBlocks = GSON.fromJson( new InputStreamReader(Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/legacyblocks.json")), StandardCharsets.UTF_8), LinkedTreeMap.class ); legacyBlocks.forEach((legacyBlockID, modernID) -> LEGACY_BLOCK_STATE_IDS_MAP.put(Short.valueOf(legacyBlockID), solid(Short.parseShort(modernID)))); LEGACY_BLOCK_STATE_IDS_MAP.put((short) 0, AIR); LinkedTreeMap> modernMap = GSON.fromJson( new InputStreamReader(Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/blockstates_mapping.json")), StandardCharsets.UTF_8), LinkedTreeMap.class ); modernMap.forEach((modernID, versionMap) -> { Short id = null; for (ProtocolVersion version : ProtocolVersion.SUPPORTED_VERSIONS) { id = Short.valueOf(versionMap.getOrDefault(version.toString(), String.valueOf(id))); SimpleBlock.MODERN_BLOCK_STATE_IDS_MAP.computeIfAbsent(version, k -> new ShortObjectHashMap<>()).put(Short.parseShort(modernID), id); } }); LinkedTreeMap> properties = GSON.fromJson( new InputStreamReader( Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/defaultblockproperties.json")), StandardCharsets.UTF_8 ), LinkedTreeMap.class ); properties.forEach((key, value) -> DEFAULT_PROPERTIES_MAP.put(key, new HashMap<>(value))); LinkedTreeMap modernIdRemap = GSON.fromJson( new InputStreamReader( Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/modern_block_id_remap.json")), StandardCharsets.UTF_8 ), LinkedTreeMap.class ); MODERN_ID_REMAP.putAll(modernIdRemap); } private final boolean solid; private final boolean air; private final boolean motionBlocking; // 1.14+ private final String modernID; private final short blockStateID; private final short blockID; public SimpleBlock(boolean solid, boolean air, boolean motionBlocking, short blockStateID) { this(solid, air, motionBlocking, MODERN_BLOCK_STATE_PROTOCOL_ID_MAP.get(blockStateID), blockStateID); } public SimpleBlock(boolean solid, boolean air, boolean motionBlocking, String modernID, short blockStateID) { this(solid, air, motionBlocking, modernID, blockStateID, findId(modernID)); } private static short findId(String modernID) { String block = modernID.split("\\[")[0]; Short id = MODERN_BLOCK_STRING_MAP.get(block); if (id == null) { throw new IllegalStateException("failed to find local id for specific block: " + block); } return id; } public SimpleBlock(boolean solid, boolean air, boolean motionBlocking, String modernID, short blockStateID, short blockID) { this.solid = solid; this.air = air; this.motionBlocking = motionBlocking; this.modernID = modernID; this.blockStateID = blockStateID; this.blockID = blockID; } public SimpleBlock(boolean solid, boolean air, boolean motionBlocking, String modernID, Map properties) { this(solid, air, motionBlocking, modernID, transformID(modernID, properties)); } public SimpleBlock(boolean solid, boolean air, boolean motionBlocking, String modernID, Map properties, short blockID) { this(solid, air, motionBlocking, modernID, transformID(modernID, properties), blockID); } public SimpleBlock(SimpleBlock block) { this.solid = block.solid; this.air = block.air; this.motionBlocking = block.motionBlocking; this.modernID = block.modernID; this.blockStateID = block.blockStateID; this.blockID = block.blockID; } @Override public short getModernID() { return this.blockStateID; } @Override public String getModernStringID() { return this.modernID; } @Override public short getID(ProtocolVersion version) { return this.getBlockStateID(version); } @Override public short getBlockID(WorldVersion version) { return LEGACY_BLOCK_IDS_MAP.get(this.blockID).get(version); } @Override public short getBlockID(ProtocolVersion version) { return this.getBlockID(WorldVersion.from(version)); } @Override public boolean isSupportedOn(WorldVersion version) { return LEGACY_BLOCK_IDS_MAP.get(this.blockID).containsKey(version); } @Override public boolean isSupportedOn(ProtocolVersion version) { return this.isSupportedOn(WorldVersion.from(version)); } @Override public short getBlockStateID(ProtocolVersion version) { return MODERN_BLOCK_STATE_IDS_MAP.get(version).getOrDefault(this.blockStateID, this.blockStateID); } @Override public boolean isSolid() { return this.solid; } @Override public boolean isAir() { return this.air; } @Override public boolean isMotionBlocking() { return this.motionBlocking; } public static VirtualBlock fromModernID(String modernID) { String[] deserializedModernId = modernID.split("[\\[\\]]"); if (deserializedModernId.length < 2) { return fromModernID(modernID, Map.of()); } else { Map properties = new HashMap<>(); for (String property : deserializedModernId[1].split(",")) { String[] propertyKeyValue = property.split("="); properties.put(propertyKeyValue[0], propertyKeyValue[1]); } return fromModernID(deserializedModernId[0], properties); } } public static VirtualBlock fromModernID(String modernID, Map properties) { modernID = remapModernID(modernID); return solid(modernID, transformID(modernID, properties)); } private static short transformID(String modernID, Map properties) { Map defaultProperties = DEFAULT_PROPERTIES_MAP.get(modernID); if (defaultProperties == null || defaultProperties.isEmpty()) { return transformID(modernID, (Set) null); } else { Set propertiesSet = new HashSet<>(); defaultProperties.forEach((key, value) -> { if (properties != null) { value = properties.getOrDefault(key, value); } propertiesSet.add(key + "=" + value.toLowerCase(Locale.ROOT)); }); return transformID(modernID, propertiesSet); } } private static short transformID(String modernID, Set properties) { Map, Short> blockInfo = MODERN_BLOCK_STATE_STRING_MAP.get(modernID); if (blockInfo == null) { LimboAPI.getLogger().warn("Block " + modernID + " is not supported, and was replaced with air."); return AIR.getModernID(); } Short id; if (properties == null || properties.isEmpty()) { id = blockInfo.get(null); } else { id = blockInfo.get(properties); } if (id == null) { LimboAPI.getLogger().warn("Block " + modernID + " is not supported with " + properties + " properties, and was replaced with air."); return AIR.getModernID(); } return id; } private static String remapModernID(String modernID) { String strippedID = modernID.split("\\[")[0]; String remappedID = MODERN_ID_REMAP.get(strippedID); if (remappedID != null) { modernID = remappedID + modernID.substring(strippedID.length()); } return modernID; } @NonNull public static SimpleBlock solid(short id) { return solid(true, MODERN_BLOCK_STATE_PROTOCOL_ID_MAP.get(id), id); } @NonNull public static SimpleBlock solid(String modernID, short id) { return solid(true, remapModernID(modernID), id); } @NonNull public static SimpleBlock solid(boolean motionBlocking, short id) { return new SimpleBlock(true, false, motionBlocking, MODERN_BLOCK_STATE_PROTOCOL_ID_MAP.get(id), id); } @NonNull public static SimpleBlock solid(boolean motionBlocking, String modernID, short id) { return new SimpleBlock(true, false, motionBlocking, remapModernID(modernID), id); } @NonNull public static SimpleBlock nonSolid(short id) { return nonSolid(true, MODERN_BLOCK_STATE_PROTOCOL_ID_MAP.get(id), id); } @NonNull public static SimpleBlock nonSolid(String modernID, short id) { return nonSolid(true, remapModernID(modernID), id); } @NonNull public static SimpleBlock nonSolid(boolean motionBlocking, short id) { return new SimpleBlock(false, false, motionBlocking, MODERN_BLOCK_STATE_PROTOCOL_ID_MAP.get(id), id); } @NonNull public static SimpleBlock nonSolid(boolean motionBlocking, String modernID, short id) { return new SimpleBlock(false, false, motionBlocking, remapModernID(modernID), id); } @NonNull public static SimpleBlock fromLegacyID(short id) { if (LEGACY_BLOCK_STATE_IDS_MAP.containsKey(id)) { return LEGACY_BLOCK_STATE_IDS_MAP.get(id); } else { LimboAPI.getLogger().warn("Block #" + id + " is not supported, and was replaced with air."); return AIR; } } @Override public String toString() { return "SimpleBlock{" + "solid=" + this.solid + ", air=" + this.air + ", motionBlocking=" + this.motionBlocking + ", id=" + this.blockStateID + "}"; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/world/SimpleBlockEntity.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.world; import com.google.gson.Gson; import com.google.gson.internal.LinkedTreeMap; import com.velocitypowered.api.network.ProtocolVersion; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.EnumMap; import java.util.HashMap; import java.util.Map; import java.util.Objects; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.api.chunk.BlockEntityVersion; import net.elytrium.limboapi.api.chunk.VirtualBlockEntity; import net.kyori.adventure.nbt.CompoundBinaryTag; public class SimpleBlockEntity implements VirtualBlockEntity { private static final Gson GSON = new Gson(); private static final Map MODERN_ID_MAP = new HashMap<>(); private final String modernId; private final Map versionIDs = new EnumMap<>(BlockEntityVersion.class); public SimpleBlockEntity(String modernId) { this.modernId = modernId; } @Override public int getID(ProtocolVersion version) { return this.getID(BlockEntityVersion.from(version)); } @Override public int getID(BlockEntityVersion version) { return this.versionIDs.get(version); } @Override public boolean isSupportedOn(ProtocolVersion version) { return this.versionIDs.containsKey(BlockEntityVersion.from(version)); } @Override public boolean isSupportedOn(BlockEntityVersion version) { return this.versionIDs.containsKey(version); } @Override public String getModernID() { return this.modernId; } @Override public VirtualBlockEntity.Entry getEntry(int posX, int posY, int posZ, CompoundBinaryTag nbt) { return new Entry(posX, posY, posZ, nbt); } @SuppressWarnings("unchecked") public static void init() { LinkedTreeMap> blockEntitiesMapping = GSON.fromJson( new InputStreamReader( Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/blockentities_mapping.json")), StandardCharsets.UTF_8 ), LinkedTreeMap.class ); blockEntitiesMapping.forEach((modernId, protocols) -> { SimpleBlockEntity simpleBlockEntity = new SimpleBlockEntity(modernId); protocols.forEach((key, value) -> simpleBlockEntity.versionIDs.put(BlockEntityVersion.parse(key), Integer.parseInt(value))); MODERN_ID_MAP.put(modernId, simpleBlockEntity); }); } public static SimpleBlockEntity fromModernID(String id) { return MODERN_ID_MAP.get(id); } public class Entry implements VirtualBlockEntity.Entry { private final int posX; private final int posY; private final int posZ; private final CompoundBinaryTag nbt; public Entry(int posX, int posY, int posZ, CompoundBinaryTag nbt) { this.posX = posX; this.posY = posY; this.posZ = posZ; this.nbt = nbt; } @Override public VirtualBlockEntity getBlockEntity() { return SimpleBlockEntity.this; } @Override public int getPosX() { return this.posX; } @Override public int getPosY() { return this.posY; } @Override public int getPosZ() { return this.posZ; } @Override public CompoundBinaryTag getNbt() { return this.nbt; } @Override public int getID(ProtocolVersion version) { return SimpleBlockEntity.this.getID(version); } @Override public int getID(BlockEntityVersion version) { return SimpleBlockEntity.this.getID(version); } @Override public boolean isSupportedOn(ProtocolVersion version) { return SimpleBlockEntity.this.isSupportedOn(version); } @Override public boolean isSupportedOn(BlockEntityVersion version) { return SimpleBlockEntity.this.isSupportedOn(version); } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/world/SimpleItem.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.world; import com.google.gson.Gson; import com.google.gson.internal.LinkedTreeMap; import com.velocitypowered.api.network.ProtocolVersion; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.EnumMap; import java.util.HashMap; import java.util.Map; import java.util.Objects; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.api.material.Item; import net.elytrium.limboapi.api.material.VirtualItem; import net.elytrium.limboapi.api.material.WorldVersion; public class SimpleItem implements VirtualItem { private static final Gson GSON = new Gson(); private static final Map MODERN_ID_MAP = new HashMap<>(); private static final Map LEGACY_ID_MAP = new HashMap<>(); private final String modernId; private final Map versionIDs = new EnumMap<>(WorldVersion.class); public SimpleItem(String modernId) { this.modernId = modernId; } @Override public short getID(ProtocolVersion version) { return this.getID(WorldVersion.from(version)); } @Override public short getID(WorldVersion version) { Short result = this.versionIDs.get(version); if (result == null) { throw new IllegalArgumentException("Item " + this.modernId + " does not exists on " + version); } return result; } @Override public boolean isSupportedOn(ProtocolVersion version) { return this.isSupportedOn(WorldVersion.from(version)); } @Override public boolean isSupportedOn(WorldVersion version) { return this.versionIDs.containsKey(version); } public String getModernID() { return this.modernId; } @SuppressWarnings("unchecked") public static void init() { LinkedTreeMap> itemsMapping = GSON.fromJson( new InputStreamReader( Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/items_mapping.json")), StandardCharsets.UTF_8 ), LinkedTreeMap.class ); LinkedTreeMap modernItems = GSON.fromJson( new InputStreamReader( Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/items.json")), StandardCharsets.UTF_8 ), LinkedTreeMap.class ); LinkedTreeMap legacyItems = GSON.fromJson( new InputStreamReader( Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/legacyitems.json")), StandardCharsets.UTF_8 ), LinkedTreeMap.class ); LinkedTreeMap modernIdRemap = GSON.fromJson( new InputStreamReader( Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/modern_item_id_remap.json")), StandardCharsets.UTF_8 ), LinkedTreeMap.class ); modernItems.forEach((modernId, modernProtocolId) -> { SimpleItem simpleItem = new SimpleItem(modernId); itemsMapping.get(modernProtocolId).forEach((key, value) -> simpleItem.versionIDs.put(WorldVersion.parse(key), Short.parseShort(value))); MODERN_ID_MAP.put(modernId, simpleItem); String remapped = modernIdRemap.get(modernId); if (remapped != null) { if (MODERN_ID_MAP.containsKey(remapped)) { throw new IllegalStateException("Remapped id " + remapped + " (from " + modernId + ") already exists"); } MODERN_ID_MAP.put(remapped, simpleItem); } }); legacyItems.forEach((legacyProtocolId, modernId) -> LEGACY_ID_MAP.put(Integer.parseInt(legacyProtocolId), MODERN_ID_MAP.get(modernId))); } public static SimpleItem fromItem(Item item) { return LEGACY_ID_MAP.get(item.getLegacyID()); } public static SimpleItem fromLegacyID(int id) { return LEGACY_ID_MAP.get(id); } public static SimpleItem fromModernID(String id) { return MODERN_ID_MAP.get(id); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/world/SimpleTagManager.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.world; import com.google.gson.Gson; import com.google.gson.internal.LinkedTreeMap; import com.velocitypowered.api.network.ProtocolVersion; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.EnumMap; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; import net.elytrium.limboapi.LimboAPI; import net.elytrium.limboapi.api.material.WorldVersion; import net.elytrium.limboapi.protocol.packets.s2c.UpdateTagsPacket; public class SimpleTagManager { private static final Map FLUIDS = new HashMap<>(); private static final Map VERSION_MAP = new EnumMap<>(WorldVersion.class); @SuppressWarnings("unchecked") public static void init() { Gson gson = new Gson(); LinkedTreeMap fluids = gson.fromJson( new InputStreamReader( Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/fluids.json")), StandardCharsets.UTF_8 ), LinkedTreeMap.class ); fluids.forEach((id, protocolId) -> FLUIDS.put(id, Integer.valueOf(protocolId))); LinkedTreeMap>> tags = gson.fromJson( new InputStreamReader( Objects.requireNonNull(LimboAPI.class.getResourceAsStream("/mapping/tags.json")), StandardCharsets.UTF_8 ), LinkedTreeMap.class ); for (WorldVersion version : WorldVersion.values()) { VERSION_MAP.put(version, localGetTagsForVersion(tags, version)); } } public static UpdateTagsPacket getUpdateTagsPacket(ProtocolVersion version) { return VERSION_MAP.get(WorldVersion.from(version)); } public static UpdateTagsPacket getUpdateTagsPacket(WorldVersion version) { return VERSION_MAP.get(version); } private static UpdateTagsPacket localGetTagsForVersion(LinkedTreeMap>> defaultTags, WorldVersion version) { Map>> tags = new LinkedTreeMap<>(); defaultTags.forEach((tagType, defaultTagList) -> { LinkedTreeMap> tagList = new LinkedTreeMap<>(); switch (tagType) { case "minecraft:block": { defaultTagList.forEach((tagName, blockList) -> tagList.put(tagName, blockList.stream() .map(e -> SimpleBlock.fromModernID(e, Map.of())) .filter(e -> e.isSupportedOn(version)) .map(e -> (int) e.getBlockID(version)) .collect(Collectors.toList()))); break; } case "minecraft:fluid": { defaultTagList.forEach((tagName, fluidList) -> tagList.put(tagName, fluidList.stream().map(FLUIDS::get).collect(Collectors.toList()))); break; } case "minecraft:item": { defaultTagList.forEach((tagName, itemList) -> tagList.put(tagName, itemList.stream() .map(SimpleItem::fromModernID) .filter(item -> item.isSupportedOn(version)) .map(item -> (int) item.getID(version)) .collect(Collectors.toList()))); break; } case "minecraft:banner_pattern": case "minecraft:damage_type": { if (version.getMinSupportedVersion().noLessThan(ProtocolVersion.MINECRAFT_26_1)) { defaultTagList.forEach((tagName, itemList) -> tagList.put(tagName, List.of())); break; } else { return; } } default: { defaultTagList.forEach((tagName, entryList) -> { if (!entryList.isEmpty()) { throw new IllegalStateException("The " + tagType + " tag type is not supported yet."); } tagList.put(tagName, List.of()); }); break; } } tags.put(tagType, tagList); }); return new UpdateTagsPacket(tags); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/world/SimpleWorld.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.world; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.function.Function; import java.util.function.Supplier; import net.elytrium.limboapi.api.chunk.Dimension; import net.elytrium.limboapi.api.chunk.VirtualBiome; import net.elytrium.limboapi.api.chunk.VirtualBlock; import net.elytrium.limboapi.api.chunk.VirtualBlockEntity; import net.elytrium.limboapi.api.chunk.VirtualChunk; import net.elytrium.limboapi.api.chunk.VirtualWorld; import net.elytrium.limboapi.material.Biome; import net.elytrium.limboapi.server.world.chunk.SimpleChunk; import net.kyori.adventure.nbt.CompoundBinaryTag; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; public class SimpleWorld implements VirtualWorld { private final Map chunks = new HashMap<>(); private final List> distanceChunkMap = new ArrayList<>(); @NonNull private final Dimension dimension; private final VirtualBiome defaultBiome; private final double spawnX; private final double spawnY; private final double spawnZ; private final float yaw; private final float pitch; public SimpleWorld(@NonNull Dimension dimension, double posX, double posY, double posZ, float yaw, float pitch) { this.dimension = dimension; this.defaultBiome = Biome.of(dimension.getDefaultBiome()); this.spawnX = posX; this.spawnY = posY; this.spawnZ = posZ; this.yaw = yaw; this.pitch = pitch; this.getChunkOrNew((int) posX, (int) posZ); } @Override public void setBlock(int posX, int posY, int posZ, @Nullable VirtualBlock block) { this.getChunkOrNew(posX, posZ).setBlock(getChunkCoordinate(posX), posY, getChunkCoordinate(posZ), block); } @Override public void setBlockEntity(int posX, int posY, int posZ, @Nullable CompoundBinaryTag nbt, @Nullable VirtualBlockEntity blockEntity) { this.getChunkOrNew(posX, posZ).setBlockEntity(getChunkCoordinate(posX), posY, getChunkCoordinate(posZ), nbt, blockEntity); } @NonNull @Override public VirtualBlock getBlock(int posX, int posY, int posZ) { return this.chunkAction(posX, posZ, chunk -> chunk.getBlock(getChunkCoordinate(posX), posY, getChunkCoordinate(posZ)), () -> SimpleBlock.AIR); } @Override public void setBiome2d(int posX, int posZ, @NonNull VirtualBiome biome) { this.getChunkOrNew(posX, posZ).setBiome2D(getChunkCoordinate(posX), getChunkCoordinate(posZ), biome); } @Override public void setBiome3d(int posX, int posY, int posZ, @NonNull VirtualBiome biome) { this.getChunkOrNew(posX, posZ).setBiome3D(getChunkCoordinate(posX), posY, getChunkCoordinate(posZ), biome); } @Override public VirtualBiome getBiome(int posX, int posY, int posZ) { return this.chunkAction(posX, posZ, chunk -> chunk.getBiome(posX, posY, posZ), () -> Biome.PLAINS); } @Override public byte getBlockLight(int posX, int posY, int posZ) { return this.chunkAction(posX, posZ, chunk -> chunk.getBlockLight(getChunkCoordinate(posX), posY, getChunkCoordinate(posZ)), () -> (byte) 0); } @Override public void setBlockLight(int posX, int posY, int posZ, byte light) { this.getChunkOrNew(posX, posZ).setBlockLight(getChunkCoordinate(posX), posY, getChunkCoordinate(posZ), light); } @Override public void fillBlockLight(int level) { for (SimpleChunk chunk : this.chunks.values()) { chunk.fillBlockLight(level); } } @Override public void fillSkyLight(int level) { for (SimpleChunk chunk : this.chunks.values()) { chunk.fillSkyLight(level); } } @Override public List getChunks() { return ImmutableList.copyOf(this.chunks.values()); } @Override public List> getOrderedChunks() { return this.distanceChunkMap.stream() .map(Collections::unmodifiableList) .toList(); } private int getDistanceToSpawn(VirtualChunk chunk) { int diffX = getChunkXZ((int) this.spawnX) - chunk.getPosX(); int diffZ = getChunkXZ((int) this.spawnZ) - chunk.getPosZ(); return (int) Math.sqrt((diffX * diffX) + (diffZ * diffZ)); } @Nullable @Override public SimpleChunk getChunk(int posX, int posZ) { return this.chunks.get(getChunkIndex(getChunkXZ(posX), getChunkXZ(posZ))); } @Override public SimpleChunk getChunkOrNew(int posX, int posZ) { posX = getChunkXZ(posX); posZ = getChunkXZ(posZ); // Modern Sodium versions don't load chunks if their "neighbours" are unloaded. // We are fixing this problem there by generating all the "neighbours". for (int chunkX = posX - 1; chunkX <= posX + 1; ++chunkX) { for (int chunkZ = posZ - 1; chunkZ <= posZ + 1; ++chunkZ) { this.localCreateChunk(chunkX, chunkZ); } } return this.chunks.get(getChunkIndex(posX, posZ)); } private void localCreateChunk(int posX, int posZ) { long index = getChunkIndex(posX, posZ); if (!this.chunks.containsKey(index)) { SimpleChunk chunk = new SimpleChunk(posX, posZ, this.defaultBiome); this.chunks.put(index, chunk); int distance = this.getDistanceToSpawn(chunk); for (int i = this.distanceChunkMap.size(); i <= distance; i++) { this.distanceChunkMap.add(new LinkedList<>()); } this.distanceChunkMap.get(distance).add(chunk); } } @NonNull @Override public Dimension getDimension() { return this.dimension; } @Override public double getSpawnX() { return this.spawnX; } @Override public double getSpawnY() { return this.spawnY; } @Override public double getSpawnZ() { return this.spawnZ; } @Override public float getYaw() { return this.yaw; } @Override public float getPitch() { return this.pitch; } private T chunkAction(int posX, int posZ, Function function, Supplier ifNull) { SimpleChunk chunk = this.getChunk(posX, posZ); if (chunk == null) { return ifNull.get(); } return function.apply(chunk); } private static long getChunkIndex(int posX, int posZ) { return (long) posX << 32 | posZ & 0xFFFFFFFFL; } private static int getChunkXZ(int pos) { return pos >> 4; } private static int getChunkCoordinate(int pos) { return pos & 15; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/world/chunk/SimpleChunk.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.world.chunk; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import net.elytrium.limboapi.api.chunk.VirtualBiome; import net.elytrium.limboapi.api.chunk.VirtualBlock; import net.elytrium.limboapi.api.chunk.VirtualBlockEntity; import net.elytrium.limboapi.api.chunk.VirtualChunk; import net.elytrium.limboapi.api.chunk.data.ChunkSnapshot; import net.elytrium.limboapi.api.chunk.data.LightSection; import net.elytrium.limboapi.material.Biome; import net.elytrium.limboapi.server.world.SimpleBlock; import net.kyori.adventure.nbt.CompoundBinaryTag; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.common.value.qual.IntRange; public class SimpleChunk implements VirtualChunk { public static final int MAX_BLOCKS_PER_SECTION = 16 * 16 * 16; public static final int MAX_BIOMES_PER_SECTION = 4 * 4 * 4; private final int posX; private final int posZ; private final SimpleSection[] sections = new SimpleSection[16]; private final LightSection[] light = new LightSection[18]; private final VirtualBiome[] biomes = new VirtualBiome[1024]; private final List blockEntityEntries = new ArrayList<>(); public SimpleChunk(int posX, int posZ) { this(posX, posZ, Biome.PLAINS); } public SimpleChunk(int posX, int posZ, VirtualBiome defaultBiome) { this.posX = posX; this.posZ = posZ; for (int i = 0; i < this.light.length; ++i) { this.light[i] = new SimpleLightSection(); } Arrays.fill(this.biomes, defaultBiome); } @Override public void setBlock(int posX, int posY, int posZ, @Nullable VirtualBlock block) { this.getSection(posY).setBlockAt(posX, posY & 15, posZ, block); } @Override public void setBlockEntity(int posX, int posY, int posZ, @Nullable CompoundBinaryTag nbt, @Nullable VirtualBlockEntity blockEntity) { if (blockEntity == null) { this.blockEntityEntries.removeIf(entry -> entry.getPosX() == posX && entry.getPosY() == posY && entry.getPosZ() == posZ); return; } this.blockEntityEntries.add(blockEntity.getEntry(posX, posY, posZ, nbt)); } @Override public void setBlockEntity(VirtualBlockEntity.Entry blockEntityEntry) { this.blockEntityEntries.add(blockEntityEntry); } private SimpleSection getSection(int posY) { int sectionIndex = getSectionIndex(posY); SimpleSection section = this.sections[sectionIndex]; if (section == null) { section = new SimpleSection(); this.sections[sectionIndex] = section; } return section; } @NonNull @Override public VirtualBlock getBlock(int posX, int posY, int posZ) { SimpleSection section = this.sections[getSectionIndex(posY)]; if (section == null) { return SimpleBlock.AIR; } else { return section.getBlockAt(posX, posY & 15, posZ); } } @Override public void setBiome2D(int posX, int posZ, @NonNull VirtualBiome biome) { for (int posY = 0; posY < 256; posY += 4) { this.setBiome3D(posX, posY, posZ, biome); } } @Override public void setBiome3D(int posX, int posY, int posZ, @NonNull VirtualBiome biome) { this.biomes[getBiomeIndex(posX, posY, posZ)] = biome; } @NonNull @Override public VirtualBiome getBiome(int posX, int posY, int posZ) { return this.biomes[getBiomeIndex(posX, posY, posZ)]; } @Override public void setBlockLight(int posX, int posY, int posZ, byte light) { this.getLightSection(posY).setBlockLight(posX, posY & 15, posZ, light); } @Override public byte getBlockLight(int posX, int posY, int posZ) { return this.getLightSection(posY).getBlockLight(posX, posY & 15, posZ); } @Override public void setSkyLight(int posX, int posY, int posZ, byte light) { this.getLightSection(posY).setSkyLight(posX, posY & 15, posZ, light); } @Override public byte getSkyLight(int posX, int posY, int posZ) { return this.getLightSection(posY).getSkyLight(posX, posY & 15, posZ); } private LightSection getLightSection(int posY) { return this.light[posY < 0 ? 0 : getSectionIndex(posY) + 1]; } @Override public void fillBlockLight(@IntRange(from = 0, to = 15) int level) { for (LightSection lightSection : this.light) { lightSection.getBlockLight().fill(level); } } @Override public void fillSkyLight(@IntRange(from = 0, to = 15) int level) { for (LightSection lightSection : this.light) { lightSection.getSkyLight().fill(level); } } @Override public int getPosX() { return this.posX; } @Override public int getPosZ() { return this.posZ; } @Override public ChunkSnapshot getFullChunkSnapshot() { return this.createSnapshot(true, 0); } @Override public ChunkSnapshot getPartialChunkSnapshot(long previousUpdate) { return this.createSnapshot(false, previousUpdate); } private ChunkSnapshot createSnapshot(boolean full, long previousUpdate) { SimpleSection[] sectionsSnapshot = new SimpleSection[this.sections.length]; for (int i = 0; i < this.sections.length; ++i) { if (this.sections[i] != null && this.sections[i].getLastUpdate() > previousUpdate) { sectionsSnapshot[i] = this.sections[i].getSnapshot(); } } LightSection[] lightSnapshot = new LightSection[this.light.length]; for (int i = 0; i < lightSnapshot.length; ++i) { if (this.light[i].getLastUpdate() > previousUpdate) { lightSnapshot[i] = this.light[i].copy(); } } return new SimpleChunkSnapshot(this.posX, this.posZ, full, sectionsSnapshot, lightSnapshot, Arrays.copyOf(this.biomes, this.biomes.length), List.copyOf(this.blockEntityEntries)); } private static int getBiomeIndex(int posX, int posY, int posZ) { return (posY >> 2 & 63) << 4 | (posZ >> 2 & 3) << 2 | posX >> 2 & 3; } private static int getSectionIndex(int posY) { return posY >> 4; } @Override public String toString() { return "SimpleChunk{" + "posX=" + this.posX + ", posZ=" + this.posZ + '}'; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/world/chunk/SimpleChunkSnapshot.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.world.chunk; import java.util.List; import net.elytrium.limboapi.api.chunk.VirtualBiome; import net.elytrium.limboapi.api.chunk.VirtualBlock; import net.elytrium.limboapi.api.chunk.VirtualBlockEntity; import net.elytrium.limboapi.api.chunk.data.ChunkSnapshot; import net.elytrium.limboapi.api.chunk.data.LightSection; import net.elytrium.limboapi.server.world.SimpleBlock; public class SimpleChunkSnapshot implements ChunkSnapshot { private final int posX; private final int posZ; private final boolean fullChunk; private final SimpleSection[] sections; private final LightSection[] light; private final VirtualBiome[] biomes; private final List blockEntityEntries; public SimpleChunkSnapshot(int posX, int posZ, boolean fullChunk, SimpleSection[] sections, LightSection[] light, VirtualBiome[] biomes, List blockEntityEntries) { this.posX = posX; this.posZ = posZ; this.fullChunk = fullChunk; this.sections = sections; this.light = light; this.biomes = biomes; this.blockEntityEntries = blockEntityEntries; } @Override public VirtualBlock getBlock(int posX, int posY, int posZ) { SimpleSection section = this.sections[posY >> 4]; return section == null ? SimpleBlock.AIR : section.getBlockAt(posX, posY & 15, posZ); } @Override public int getPosX() { return this.posX; } @Override public int getPosZ() { return this.posZ; } @Override public boolean isFullChunk() { return this.fullChunk; } @Override public SimpleSection[] getSections() { return this.sections; } @Override public LightSection[] getLight() { return this.light; } @Override public VirtualBiome[] getBiomes() { return this.biomes; } @Override public List getBlockEntityEntries() { return this.blockEntityEntries; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/world/chunk/SimpleLightSection.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.world.chunk; import com.google.common.base.Preconditions; import net.elytrium.limboapi.api.chunk.data.LightSection; import net.elytrium.limboapi.api.mcprotocollib.NibbleArray3D; public class SimpleLightSection implements LightSection { private static final NibbleArray3D NO_LIGHT = new NibbleArray3D(SimpleChunk.MAX_BLOCKS_PER_SECTION); private static final NibbleArray3D ALL_LIGHT = new NibbleArray3D(SimpleChunk.MAX_BLOCKS_PER_SECTION, 15); private NibbleArray3D blockLight; private NibbleArray3D skyLight; private long lastUpdate; public SimpleLightSection() { this(NO_LIGHT, ALL_LIGHT, System.nanoTime()); } private SimpleLightSection(NibbleArray3D blockLight, NibbleArray3D skyLight, long lastUpdate) { this.blockLight = blockLight; this.skyLight = skyLight; this.lastUpdate = lastUpdate; } @Override public void setBlockLight(int posX, int posY, int posZ, byte light) { this.checkIndexes(posX, posY, posZ); Preconditions.checkArgument(light >= 0 && light <= 15, "light should be between 0 and 15"); if (this.blockLight == NO_LIGHT && light != 0) { this.blockLight = new NibbleArray3D(SimpleChunk.MAX_BLOCKS_PER_SECTION); } this.blockLight.set(posX, posY, posZ, light); this.lastUpdate = System.nanoTime(); } @Override public NibbleArray3D getBlockLight() { return this.blockLight; } @Override public byte getBlockLight(int posX, int posY, int posZ) { this.checkIndexes(posX, posY, posZ); return (byte) this.blockLight.get(posX, posY, posZ); } @Override public void setSkyLight(int posX, int posY, int posZ, byte light) { this.checkIndexes(posX, posY, posZ); Preconditions.checkArgument(light >= 0 && light <= 15, "light should be between 0 and 15"); if (this.skyLight == ALL_LIGHT && light != 15) { this.skyLight = new NibbleArray3D(SimpleChunk.MAX_BLOCKS_PER_SECTION); } this.skyLight.set(posX, posY, posZ, light); this.lastUpdate = System.nanoTime(); } @Override public NibbleArray3D getSkyLight() { return this.skyLight; } @Override public byte getSkyLight(int posX, int posY, int posZ) { this.checkIndexes(posX, posY, posZ); return (byte) this.skyLight.get(posX, posY, posZ); } private void checkIndexes(int posX, int posY, int posZ) { Preconditions.checkArgument(this.checkIndex(posX), "x should be between 0 and 15"); Preconditions.checkArgument(this.checkIndex(posY), "y should be between 0 and 15"); Preconditions.checkArgument(this.checkIndex(posZ), "z should be between 0 and 15"); } private boolean checkIndex(int pos) { return pos >= 0 && pos <= 15; } @Override public long getLastUpdate() { return this.lastUpdate; } @Override public SimpleLightSection copy() { NibbleArray3D skyLight = this.skyLight == ALL_LIGHT ? ALL_LIGHT : this.skyLight.copy(); NibbleArray3D blockLight = this.blockLight == NO_LIGHT ? NO_LIGHT : this.blockLight.copy(); return new SimpleLightSection(blockLight, skyLight, this.lastUpdate); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/server/world/chunk/SimpleSection.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.server.world.chunk; import com.google.common.base.Preconditions; import com.velocitypowered.api.network.ProtocolVersion; import net.elytrium.limboapi.api.chunk.VirtualBlock; import net.elytrium.limboapi.api.chunk.data.BlockSection; import net.elytrium.limboapi.api.chunk.data.BlockStorage; import net.elytrium.limboapi.protocol.data.BlockStorage19; import net.elytrium.limboapi.server.world.SimpleBlock; import org.checkerframework.checker.nullness.qual.Nullable; public class SimpleSection implements BlockSection { private final BlockStorage blocks; private long lastUpdate = System.nanoTime(); public SimpleSection() { this(new BlockStorage19(ProtocolVersion.MINECRAFT_1_17)); } public SimpleSection(BlockStorage blocks) { this.blocks = blocks; } public SimpleSection(BlockStorage blocks, long lastUpdate) { this.blocks = blocks; this.lastUpdate = lastUpdate; } @Override public void setBlockAt(int posX, int posY, int posZ, @Nullable VirtualBlock block) { this.checkIndexes(posX, posY, posZ); this.blocks.set(posX, posY, posZ, block == null ? SimpleBlock.AIR : block); this.lastUpdate = System.nanoTime(); } @Override public VirtualBlock getBlockAt(int posX, int posY, int posZ) { this.checkIndexes(posX, posY, posZ); return this.blocks.get(posX, posY, posZ); } private void checkIndexes(int posX, int posY, int posZ) { Preconditions.checkArgument(this.checkIndex(posX), "x should be between 0 and 15"); Preconditions.checkArgument(this.checkIndex(posY), "y should be between 0 and 15"); Preconditions.checkArgument(this.checkIndex(posZ), "z should be between 0 and 15"); } private boolean checkIndex(int pos) { return pos >= 0 && pos <= 15; } @Override public SimpleSection getSnapshot() { return new SimpleSection(this.blocks.copy(), this.lastUpdate); } @Override public long getLastUpdate() { return this.lastUpdate; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/utils/LambdaUtil.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.utils; import java.lang.invoke.LambdaMetafactory; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.lang.reflect.Field; import java.util.function.BiConsumer; import java.util.function.Function; public final class LambdaUtil { private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); public static Function getterOf(Field field) throws Throwable { MethodHandle handle = LOOKUP.unreflectGetter(field); MethodType type = handle.type(); //noinspection unchecked return (Function) LambdaMetafactory.metafactory( LOOKUP, "apply", MethodType.methodType(Function.class, MethodHandle.class), type.generic(), MethodHandles.exactInvoker(type), type ).getTarget().invokeExact(handle); } public static BiConsumer setterOf(Field f) throws Throwable { MethodHandle handle = LOOKUP.unreflectSetter(f); MethodType type = handle.type(); //noinspection unchecked return (BiConsumer) LambdaMetafactory.metafactory( LOOKUP, "accept", MethodType.methodType(BiConsumer.class, MethodHandle.class), type.generic().changeReturnType(void.class), MethodHandles.exactInvoker(type), type ).getTarget().invokeExact(handle); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/utils/OverlayIntObjectMap.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.utils; import com.google.common.collect.Iterables; import com.google.common.collect.Streams; import io.netty.util.collection.IntObjectMap; import java.util.Collection; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import net.elytrium.limboapi.api.utils.OverlayMap; import org.jetbrains.annotations.NotNull; public class OverlayIntObjectMap extends OverlayMap implements IntObjectMap { public OverlayIntObjectMap(Map parent, Map overlay) { super(parent, overlay); } @Override public K get(int key) { return super.get(key); } @Override public K put(int key, K value) { return super.put(key, value); } @Override public K remove(int key) { return super.remove(key); } @Override public Iterable> entries() { return Iterables.concat(((IntObjectMap) parent).entries(), ((IntObjectMap) overlay).entries()); } @Override public boolean containsKey(int key) { return super.containsKey(key); } @Override public Set keySet() { return Streams.concat(this.parent.keySet().stream(), this.overlay.keySet().stream()).collect(Collectors.toSet()); } @NotNull @Override public Collection values() { return Streams.concat(this.parent.values().stream(), this.overlay.values().stream()).collect(Collectors.toList()); } @NotNull @Override public Set> entrySet() { return Streams.concat(this.parent.entrySet().stream(), this.overlay.entrySet().stream()).collect(Collectors.toSet()); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/utils/OverlayObject2IntMap.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.utils; import com.google.common.collect.Streams; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntCollection; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.ObjectSet; import java.util.stream.Collectors; import net.elytrium.limboapi.api.utils.OverlayMap; import org.jetbrains.annotations.NotNull; public class OverlayObject2IntMap extends OverlayMap implements Object2IntMap { public OverlayObject2IntMap(Object2IntMap parent, Object2IntMap overlay) { super(parent, overlay); overlay.defaultReturnValue(parent.defaultReturnValue()); } @Override public int getInt(Object key) { int value = ((Object2IntMap) this.overlay).getInt(key); if (value == this.defaultReturnValue()) { value = ((Object2IntMap) this.parent).getInt(key); } return value; } @Override public int put(K key, int value) { return ((Object2IntMap) this.overlay).put(key, value); } @Override public void defaultReturnValue(int rv) { ((Object2IntMap) this.overlay).defaultReturnValue(rv); } @Override public int defaultReturnValue() { return ((Object2IntMap) this.overlay).defaultReturnValue(); } @Override public ObjectSet> object2IntEntrySet() { return new SetIsObjectSet<>( Streams .concat(((Object2IntMap) this.parent).object2IntEntrySet().stream(), ((Object2IntMap) this.overlay).object2IntEntrySet().stream()) .collect(Collectors.toSet())); } @NotNull @Override public ObjectSet keySet() { return new SetIsObjectSet<>( Streams .concat(((Object2IntMap) this.parent).keySet().stream(), ((Object2IntMap) this.overlay).keySet().stream()) .collect(Collectors.toSet())); } @Override public IntCollection values() { return Streams .concat(((Object2IntMap) this.parent).values().intStream(), ((Object2IntMap) this.overlay).values().intStream()) .boxed() .collect(Collectors.toCollection(IntArrayList::new)); } @Override public boolean containsValue(int value) { return false; } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/utils/ProtocolTools.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.utils; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; public class ProtocolTools { public static void writeContainerId(ByteBuf buf, ProtocolVersion version, int id) { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_21_2)) { ProtocolUtils.writeVarInt(buf, id); } else { buf.writeByte(id); } } public static int readContainerId(ByteBuf buf, ProtocolVersion version) { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_21_2)) { return ProtocolUtils.readVarInt(buf); } else { return buf.readUnsignedByte(); } } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/utils/ReloadListener.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.utils; import com.velocitypowered.api.event.Subscribe; import com.velocitypowered.api.event.proxy.ProxyReloadEvent; import net.elytrium.limboapi.LimboAPI; public class ReloadListener { private final LimboAPI plugin; public ReloadListener(LimboAPI plugin) { this.plugin = plugin; } @Subscribe public void onReload(ProxyReloadEvent event) { this.plugin.reloadPreparedPacketFactory(); this.plugin.reload(); } } ================================================ FILE: plugin/src/main/java/net/elytrium/limboapi/utils/SetIsObjectSet.java ================================================ /* * Copyright (C) 2021 - 2025 Elytrium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ package net.elytrium.limboapi.utils; import it.unimi.dsi.fastutil.objects.ObjectIterator; import it.unimi.dsi.fastutil.objects.ObjectSet; import java.util.Collection; import java.util.Iterator; import java.util.Set; import org.checkerframework.checker.nullness.qual.NonNull; public class SetIsObjectSet implements ObjectSet { private final Set set; public SetIsObjectSet(Set set) { this.set = set; } @Override public int size() { return this.set.size(); } @Override public boolean isEmpty() { return this.set.isEmpty(); } @Override public boolean contains(Object o) { return this.set.contains(o); } @Override public ObjectIterator iterator() { return new IteratorIsObjectIterator<>(this.set.iterator()); } @NonNull @Override public Object[] toArray() { return this.set.toArray(); } @NonNull @Override public T[] toArray(T @NonNull [] ts) { return this.set.toArray(ts); } @Override public boolean add(K k) { return this.set.add(k); } @Override public boolean remove(Object o) { return this.set.remove(o); } @Override public boolean containsAll(@NonNull Collection collection) { return this.set.containsAll(collection); } @Override public boolean addAll(@NonNull Collection collection) { return this.set.addAll(collection); } @Override public boolean removeAll(@NonNull Collection collection) { return this.set.removeAll(collection); } @Override public boolean retainAll(@NonNull Collection collection) { return this.set.retainAll(collection); } @Override public void clear() { this.set.clear(); } private static final class IteratorIsObjectIterator implements ObjectIterator { private final Iterator iterator; private IteratorIsObjectIterator(Iterator iterator) { this.iterator = iterator; } @Override public boolean hasNext() { return this.iterator.hasNext(); } @Override public K next() { return this.iterator.next(); } } } ================================================ FILE: plugin/src/main/resources/mapping/colors_main_map ================================================ [File too large to display: 16.0 MB] ================================================ FILE: plugin/src/main/resources/mapping/fluids.json ================================================ { "minecraft:empty": "0", "minecraft:flowing_water": "1", "minecraft:water": "2", "minecraft:flowing_lava": "3", "minecraft:lava": "4" } ================================================ FILE: plugin/src/main/resources/mapping/legacyitems.json ================================================ { "0": "minecraft:air", "1": "minecraft:stone", "2": "minecraft:short_grass", "3": "minecraft:dirt", "4": "minecraft:cobblestone", "5": "minecraft:oak_planks", "6": "minecraft:oak_sapling", "7": "minecraft:bedrock", "12": "minecraft:sand", "13": "minecraft:gravel", "14": "minecraft:gold_ore", "15": "minecraft:iron_ore", "16": "minecraft:coal_ore", "17": "minecraft:oak_log", "18": "minecraft:oak_leaves", "19": "minecraft:sponge", "20": "minecraft:glass", "21": "minecraft:lapis_ore", "22": "minecraft:lapis_block", "23": "minecraft:dispenser", "24": "minecraft:sandstone", "25": "minecraft:note_block", "27": "minecraft:powered_rail", "28": "minecraft:detector_rail", "29": "minecraft:sticky_piston", "30": "minecraft:cobweb", "31": "minecraft:tall_grass", "32": "minecraft:dead_bush", "33": "minecraft:piston", "35": "minecraft:white_wool", "37": "minecraft:dandelion", "38": "minecraft:poppy", "39": "minecraft:brown_mushroom", "40": "minecraft:red_mushroom", "41": "minecraft:gold_block", "42": "minecraft:iron_block", "45": "minecraft:bricks", "46": "minecraft:tnt", "47": "minecraft:bookshelf", "48": "minecraft:mossy_cobblestone", "49": "minecraft:obsidian", "50": "minecraft:torch", "52": "minecraft:spawner", "53": "minecraft:oak_stairs", "54": "minecraft:chest", "56": "minecraft:diamond_ore", "57": "minecraft:diamond_block", "58": "minecraft:crafting_table", "60": "minecraft:farmland", "61": "minecraft:furnace", "65": "minecraft:ladder", "66": "minecraft:rail", "67": "minecraft:cobblestone_stairs", "69": "minecraft:lever", "70": "minecraft:stone_pressure_plate", "72": "minecraft:oak_pressure_plate", "73": "minecraft:redstone_ore", "76": "minecraft:redstone_torch", "77": "minecraft:stone_button", "78": "minecraft:snow_block", "79": "minecraft:ice", "80": "minecraft:snow", "81": "minecraft:cactus", "82": "minecraft:clay", "84": "minecraft:jukebox", "85": "minecraft:oak_fence", "86": "minecraft:pumpkin", "87": "minecraft:netherrack", "88": "minecraft:soul_sand", "89": "minecraft:glowstone", "91": "minecraft:jack_o_lantern", "95": "minecraft:white_stained_glass", "96": "minecraft:oak_trapdoor", "98": "minecraft:stone_bricks", "99": "minecraft:brown_mushroom_block", "100": "minecraft:red_mushroom_block", "101": "minecraft:iron_bars", "102": "minecraft:glass_pane", "106": "minecraft:vine", "107": "minecraft:oak_fence_gate", "108": "minecraft:brick_stairs", "109": "minecraft:stone_brick_stairs", "110": "minecraft:mycelium", "111": "minecraft:lily_pad", "112": "minecraft:nether_brick", "113": "minecraft:nether_brick_fence", "114": "minecraft:nether_brick_stairs", "116": "minecraft:enchanting_table", "120": "minecraft:end_portal_frame", "121": "minecraft:end_stone", "122": "minecraft:dragon_egg", "123": "minecraft:redstone_lamp", "126": "minecraft:oak_slab", "128": "minecraft:sandstone_stairs", "129": "minecraft:emerald_ore", "130": "minecraft:ender_chest", "131": "minecraft:tripwire_hook", "133": "minecraft:emerald_block", "134": "minecraft:spruce_stairs", "135": "minecraft:birch_stairs", "136": "minecraft:jungle_stairs", "137": "minecraft:command_block", "138": "minecraft:beacon", "139": "minecraft:cobblestone_wall", "143": "minecraft:oak_button", "145": "minecraft:anvil", "146": "minecraft:trapped_chest", "147": "minecraft:light_weighted_pressure_plate", "148": "minecraft:heavy_weighted_pressure_plate", "151": "minecraft:daylight_detector", "152": "minecraft:redstone_block", "153": "minecraft:nether_quartz_ore", "154": "minecraft:hopper", "155": "minecraft:quartz_block", "156": "minecraft:quartz_stairs", "157": "minecraft:activator_rail", "158": "minecraft:dropper", "159": "minecraft:white_concrete", "160": "minecraft:white_stained_glass_pane", "161": "minecraft:acacia_leaves", "162": "minecraft:acacia_log", "163": "minecraft:acacia_stairs", "164": "minecraft:dark_oak_stairs", "165": "minecraft:slime_block", "166": "minecraft:barrier", "167": "minecraft:iron_trapdoor", "168": "minecraft:prismarine", "169": "minecraft:sea_lantern", "170": "minecraft:hay_block", "171": "minecraft:white_carpet", "172": "minecraft:brown_concrete", "173": "minecraft:coal_block", "174": "minecraft:packed_ice", "175": "minecraft:sunflower", "179": "minecraft:red_sandstone", "180": "minecraft:red_sandstone_stairs", "182": "minecraft:stone_slab", "183": "minecraft:spruce_fence_gate", "184": "minecraft:birch_fence_gate", "185": "minecraft:jungle_fence_gate", "186": "minecraft:dark_oak_fence_gate", "187": "minecraft:acacia_fence_gate", "188": "minecraft:spruce_fence", "189": "minecraft:birch_fence", "190": "minecraft:jungle_fence", "191": "minecraft:dark_oak_fence", "192": "minecraft:acacia_fence", "256": "minecraft:iron_shovel", "257": "minecraft:iron_pickaxe", "258": "minecraft:iron_axe", "259": "minecraft:flint_and_steel", "260": "minecraft:apple", "261": "minecraft:bow", "262": "minecraft:arrow", "263": "minecraft:coal", "264": "minecraft:diamond", "265": "minecraft:iron_ingot", "266": "minecraft:gold_ingot", "267": "minecraft:iron_sword", "268": "minecraft:wooden_sword", "269": "minecraft:wooden_shovel", "270": "minecraft:wooden_pickaxe", "271": "minecraft:wooden_axe", "272": "minecraft:stone_sword", "273": "minecraft:stone_shovel", "274": "minecraft:stone_pickaxe", "275": "minecraft:stone_axe", "276": "minecraft:diamond_sword", "277": "minecraft:diamond_shovel", "278": "minecraft:diamond_pickaxe", "279": "minecraft:diamond_axe", "280": "minecraft:stick", "281": "minecraft:bowl", "282": "minecraft:mushroom_stew", "283": "minecraft:golden_sword", "284": "minecraft:golden_shovel", "285": "minecraft:golden_pickaxe", "286": "minecraft:golden_axe", "287": "minecraft:string", "288": "minecraft:feather", "289": "minecraft:gunpowder", "290": "minecraft:wooden_hoe", "291": "minecraft:stone_hoe", "292": "minecraft:iron_hoe", "293": "minecraft:diamond_hoe", "294": "minecraft:golden_hoe", "295": "minecraft:wheat_seeds", "296": "minecraft:wheat", "297": "minecraft:bread", "298": "minecraft:leather_helmet", "299": "minecraft:leather_chestplate", "300": "minecraft:leather_leggings", "301": "minecraft:leather_boots", "302": "minecraft:chainmail_helmet", "303": "minecraft:chainmail_chestplate", "304": "minecraft:chainmail_leggings", "305": "minecraft:chainmail_boots", "306": "minecraft:iron_helmet", "307": "minecraft:iron_chestplate", "308": "minecraft:iron_leggings", "309": "minecraft:iron_boots", "310": "minecraft:diamond_helmet", "311": "minecraft:diamond_chestplate", "312": "minecraft:diamond_leggings", "313": "minecraft:diamond_boots", "314": "minecraft:golden_helmet", "315": "minecraft:golden_chestplate", "316": "minecraft:golden_leggings", "317": "minecraft:golden_boots", "318": "minecraft:flint", "319": "minecraft:porkchop", "320": "minecraft:cooked_porkchop", "321": "minecraft:painting", "322": "minecraft:golden_apple", "323": "minecraft:sign", "324": "minecraft:oak_door", "325": "minecraft:bucket", "326": "minecraft:water_bucket", "327": "minecraft:lava_bucket", "328": "minecraft:minecart", "329": "minecraft:saddle", "330": "minecraft:iron_door", "331": "minecraft:redstone", "332": "minecraft:snowball", "333": "minecraft:oak_boat", "334": "minecraft:leather", "335": "minecraft:milk_bucket", "336": "minecraft:brick", "337": "minecraft:clay_ball", "338": "minecraft:sugar_cane", "339": "minecraft:paper", "340": "minecraft:book", "341": "minecraft:slime_ball", "342": "minecraft:chest_minecart", "343": "minecraft:furnace_minecart", "344": "minecraft:egg", "345": "minecraft:compass", "346": "minecraft:fishing_rod", "347": "minecraft:clock", "348": "minecraft:glowstone_dust", "349": "minecraft:tropical_fish", "350": "minecraft:cooked_cod", "351": "minecraft:light_gray_dye", "352": "minecraft:bone", "353": "minecraft:sugar", "354": "minecraft:cake", "355": "minecraft:white_bed", "356": "minecraft:repeater", "357": "minecraft:cookie", "358": "minecraft:filled_map", "359": "minecraft:shears", "360": "minecraft:melon", "361": "minecraft:pumpkin_seeds", "362": "minecraft:melon_seeds", "363": "minecraft:beef", "364": "minecraft:cooked_beef", "365": "minecraft:chicken", "366": "minecraft:cooked_chicken", "367": "minecraft:rotten_flesh", "368": "minecraft:ender_pearl", "369": "minecraft:blaze_rod", "370": "minecraft:ghast_tear", "371": "minecraft:gold_nugget", "372": "minecraft:nether_wart", "373": "minecraft:potion", "374": "minecraft:glass_bottle", "375": "minecraft:spider_eye", "376": "minecraft:fermented_spider_eye", "377": "minecraft:blaze_powder", "378": "minecraft:magma_cream", "379": "minecraft:brewing_stand", "380": "minecraft:cauldron", "381": "minecraft:ender_eye", "382": "minecraft:glistering_melon_slice", "383": "minecraft:wolf_spawn_egg", "384": "minecraft:experience_bottle", "385": "minecraft:fire_charge", "386": "minecraft:writable_book", "387": "minecraft:written_book", "388": "minecraft:emerald", "389": "minecraft:item_frame", "390": "minecraft:flower_pot", "391": "minecraft:carrot", "392": "minecraft:potato", "393": "minecraft:baked_potato", "394": "minecraft:poisonous_potato", "395": "minecraft:map", "396": "minecraft:golden_carrot", "397": "minecraft:skeleton_skull", "398": "minecraft:carrot_on_a_stick", "399": "minecraft:nether_star", "400": "minecraft:pumpkin_pie", "401": "minecraft:firework_rocket", "402": "minecraft:firework_star", "403": "minecraft:enchanted_book", "404": "minecraft:comparator", "405": "minecraft:nether_bricks", "406": "minecraft:quartz", "407": "minecraft:tnt_minecart", "408": "minecraft:hopper_minecart", "409": "minecraft:prismarine_shard", "410": "minecraft:prismarine_crystals", "411": "minecraft:rabbit", "412": "minecraft:cooked_rabbit", "413": "minecraft:rabbit_stew", "414": "minecraft:rabbit_foot", "415": "minecraft:rabbit_hide", "416": "minecraft:armor_stand", "417": "minecraft:iron_horse_armor", "418": "minecraft:golden_horse_armor", "419": "minecraft:diamond_horse_armor", "420": "minecraft:lead", "421": "minecraft:name_tag", "422": "minecraft:command_block_minecart", "423": "minecraft:mutton", "424": "minecraft:cooked_mutton", "425": "minecraft:white_banner", "427": "minecraft:spruce_door", "428": "minecraft:birch_door", "429": "minecraft:jungle_door", "430": "minecraft:acacia_door", "431": "minecraft:dark_oak_door", "2256": "minecraft:music_disc_13", "2257": "minecraft:music_disc_cat", "2258": "minecraft:music_disc_blocks", "2259": "minecraft:music_disc_chirp", "2260": "minecraft:music_disc_far", "2261": "minecraft:music_disc_mall", "2262": "minecraft:music_disc_mellohi", "2263": "minecraft:music_disc_stal", "2264": "minecraft:music_disc_strad", "2265": "minecraft:music_disc_ward", "2266": "minecraft:music_disc_11", "2267": "minecraft:music_disc_wait" } ================================================ FILE: plugin/src/main/resources/mapping/modern_block_id_remap.json ================================================ { "minecraft:grass": "minecraft:short_grass", "minecraft:chain": "minecraft:iron_chain" } ================================================ FILE: plugin/src/main/resources/mapping/modern_item_id_remap.json ================================================ { "minecraft:turtle_scute": "minecraft:scute" } ================================================ FILE: settings.gradle.kts ================================================ dependencyResolutionManagement { repositories { mavenCentral() maven { name = "elytrium-repo" url = uri("https://maven.elytrium.net/repo/") } maven { name = "papermc-repo" url = uri("https://repo.papermc.io/repository/maven-public/") } } } enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") rootProject.name = "limboapi" include("api") include("plugin")