├── .editorconfig ├── .gitattributes ├── .github └── workflows │ └── build.yml ├── .gitignore ├── LICENSE.md ├── README.md ├── build-data ├── dev-imports.txt └── reobf-mappings-patch.tiny ├── build.gradle.kts ├── design └── architecture.svg ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── license ├── GPL-3.0.txt └── MIT.txt ├── logo.png ├── patches ├── api │ ├── 0001-Hide-irrelevant-compilation-warnings.patch │ ├── 0002-Hide-Javadoc-lint-warnings.patch │ ├── 0003-Fiddle-parameters-methods-and-fields-are-non-null-by.patch │ ├── 0004-Fiddle-branding-changes-License-License-file-changes.patch │ ├── 0005-Fiddle-branding-changes-License-Package-into-jar.patch │ ├── 0006-Define-Fiddle-namespace.patch │ ├── 0007-Configuration-Get-Fiddle-configuration-with-Bukkit-A.patch │ ├── 0008-Material-fixes-Remove-explicit-wall-sign-max-stack-s.patch │ ├── 0009-Material-fixes-Fix-LEGACY_ELYTRA-durability.patch │ ├── 0010-Material-fixes-Add-missing-value-to-isTransparent.patch │ ├── 0011-Material-fixes-Add-missing-value-to-isFuel.patch │ ├── 0012-Material-fixes-Add-missing-values-to-isOccluding.patch │ ├── 0013-Material-fixes-Add-missing-values-to-hasGravity.patch │ ├── 0014-Flag-for-vanilla-blocks-items-and-block-states-Bukki.patch │ ├── 0015-Modifiable-Bukkit-enums-Complete-legacy-conversion-C.patch │ ├── 0016-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0017-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0018-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0019-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0020-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0021-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0022-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0023-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0024-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0025-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0026-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0027-Modifiable-Bukkit-enums-Remember-original-order.patch │ ├── 0028-Modifiable-Bukkit-enums-Material-Expand-matching.patch │ ├── 0029-TODO-Backwards-plugin-compatibility-mode-Add-matchab.patch │ ├── 0030-Modifiable-Bukkit-enums-Extract-enum-implementation-.patch │ ├── 0031-Modifiable-Bukkit-enums-Extract-enum-implementation-.patch │ ├── 0032-Modifiable-Bukkit-enums-Inject-runtime-versions-Defi.patch │ └── 0033-Modifiable-Bukkit-enums-Inject-runtime-versions-Mate.patch └── server │ ├── 0001-Fiddle-project-setup.patch │ ├── 0002-Dev-import-deobfuscation-fixes.patch │ ├── 0003-Hide-irrelevant-compilation-warnings.patch │ ├── 0004-Fiddle-parameters-methods-and-fields-are-non-null-by.patch │ ├── 0005-Fiddle-branding-changes-Rename-server-brand.patch │ ├── 0006-Fiddle-branding-changes-Icon.patch │ ├── 0007-Fiddle-branding-changes-License-License-file-changes.patch │ ├── 0008-Fiddle-branding-changes-License-Package-into-jar.patch │ ├── 0009-Fiddle-branding-changes-Load-Bukkit-version-from-Fid.patch │ ├── 0010-Fiddle-branding-changes-Version-fetcher.patch │ ├── 0011-Define-Fiddle-namespace.patch │ ├── 0012-Configuration-Fiddle-configuration-files.patch │ ├── 0013-Configuration-Get-Fiddle-configuration-with-Bukkit-A.patch │ ├── 0014-Configuration-Include-Fiddle-configuration-in-timing.patch │ ├── 0015-Material-fixes-Add-missing-values-to-hasGravity.patch │ ├── 0016-Create-eula.txt-before-bootstrap.patch │ ├── 0017-Main-server-entry-point-can-be-exited-gracefully.patch │ ├── 0018-Require-confirming-Fiddle-permanence.patch │ ├── 0019-Ignore-system-files-and-directories.patch │ ├── 0020-Configuration-to-override-sent-feature-flags.patch │ ├── 0021-Gameplay-mechanics-Extend-stonecutter-recipes.patch │ ├── 0022-Gameplay-mechanics-Max-banner-patterns.patch │ ├── 0023-Flag-for-vanilla-blocks-items-and-block-states-Creat.patch │ ├── 0024-Flag-for-vanilla-blocks-items-and-block-states-Bukki.patch │ ├── 0025-Modded-registries-Support-passing-custom-registry-co.patch │ ├── 0026-Modded-registries-Create-class-for-block-item-and-bl.patch │ ├── 0027-Modded-registries-Apply-block-post-register-operatio.patch │ ├── 0028-Modded-registries-Register-item-blocks-from-item-reg.patch │ ├── 0029-Modded-registries-Vanilla-only-registries-Create-for.patch │ ├── 0030-Modded-registries-Vanilla-only-registries-Verify-num.patch │ ├── 0031-Create-unit-test-classes-for-Block-and-Item.patch │ ├── 0032-Cache-Block-and-Item-registry-key.patch │ ├── 0033-Cache-Block-Item-and-BlockState-registry-index.patch │ ├── 0034-Modifiable-Bukkit-enums-Complete-legacy-conversion-C.patch │ ├── 0035-Modifiable-Bukkit-enums-Complete-legacy-conversion-C.patch │ ├── 0036-Modifiable-Bukkit-enums-Complete-legacy-conversion-A.patch │ ├── 0037-Modifiable-Bukkit-enums-Complete-legacy-conversion-T.patch │ ├── 0038-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0039-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0040-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0041-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0042-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0043-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch │ ├── 0044-Modifiable-Bukkit-enums-Inject-runtime-versions-Add-.patch │ ├── 0045-Modifiable-Bukkit-enums-Inject-runtime-versions-Depe.patch │ ├── 0046-Modifiable-Bukkit-enums-Inject-runtime-versions-Comm.patch │ ├── 0047-Modifiable-Bukkit-enums-Inject-runtime-versions-Mate.patch │ ├── 0048-Modifiable-Bukkit-enums-Inject-runtime-versions-Mate.patch │ ├── 0049-Modifiable-Bukkit-enums-Material-Link-to-backing-imp.patch │ ├── 0050-Configuration-Settings-for-pack-creators.patch │ ├── 0051-Read-packs-Namespaced-key-validation.patch │ ├── 0052-Pack-definition.patch │ ├── 0053-Singleton-that-provides-a-list-of-the-packs.patch │ ├── 0054-Read-packs-Depend-on-7-Zip-JBinding.patch │ ├── 0055-Read-packs-Depend-on-Junrar.patch │ ├── 0056-PackException-class.patch │ ├── 0057-Read-packs-Named-JSON-element-utilities.patch │ ├── 0058-Read-packs-Parse-pack-meta-from-JSON.patch │ ├── 0059-Read-packs-Files-provider-Interface.patch │ ├── 0060-Read-packs-Files-provider-Implementation-for-packs-i.patch │ ├── 0061-Read-packs-Files-provider-Implementation-for-packs-i.patch │ ├── 0062-Read-packs-Files-provider-Store-in-pack-instance.patch │ ├── 0063-Read-packs-Flag-for-server-startup-phase.patch │ ├── 0064-Read-packs-Scan-for-and-open-pack-folders-and-archiv.patch │ ├── 0065-Read-packs-Prevent-duplicate-packs.patch │ ├── 0066-Read-packs-Content-Definitions-Abstract-model.patch │ ├── 0067-Read-packs-Content-Definitions-Abstract-JSON-parser.patch │ ├── 0068-Read-packs-Content-Definitions-with-parent-Abstract-.patch │ ├── 0069-Read-packs-Content-Definitions-with-parent-Abstract-.patch │ ├── 0070-Read-packs-Content-Blocks-and-items-Abstract-model.patch │ ├── 0071-Read-packs-Content-Blocks-and-items-Abstract-JSON-pa.patch │ ├── 0072-Read-packs-Content-Blocks-Model.patch │ ├── 0073-Read-packs-Content-Blocks-Note-block-instrument-from.patch │ ├── 0074-Read-packs-Content-Blocks-Map-color-from-resource-lo.patch │ ├── 0075-Read-packs-Content-Blocks-JSON-parser.patch │ ├── 0076-Read-packs-Content-Items-Model.patch │ ├── 0077-Read-packs-Content-Items-JSON-parser.patch │ ├── 0078-Read-packs-Content-Definitions-Scan-from-packs.patch │ ├── 0079-Read-packs-Content-Definitions-Array-of-all-types.patch │ ├── 0080-Read-packs-Content-Definitions-Implementation-to-rea.patch │ ├── 0081-Read-packs-Content-Definitions-Read-before-bootstrap.patch │ ├── 0082-Load-packs-Content-Definitions-Pass-read-definitions.patch │ ├── 0083-Load-packs-Content-Definitions-with-a-parent-Abstrac.patch │ ├── 0084-Load-packs-Content-Blocks-and-items-Register-Abstrac.patch │ ├── 0085-Load-packs-Content-Blocks-Register-Implementation.patch │ ├── 0086-Load-packs-Content-Blocks-Register-Call-after-vanill.patch │ ├── 0087-Load-packs-Content-Items-Register-Implementation.patch │ ├── 0088-Load-packs-Content-Items-Register-Call-after-vanilla.patch │ ├── 0089-Load-packs-Data-packs-Pack-resources-implementation.patch │ ├── 0090-Load-packs-Data-packs-Repository-source-implementati.patch │ ├── 0091-Load-packs-Data-packs-Include-Fiddle-source-in-pack-.patch │ ├── 0092-Broadcast-packets-based-on-player.patch │ ├── 0093-Client-perspective-For-players-Send-generated-resour.patch │ ├── 0094-Client-perspective-Wait-for-client-information.patch │ ├── 0095-Client-perspective-Define-client-perspectives.patch │ ├── 0096-Client-perspective-For-players-Store-and-get.patch │ ├── 0097-Client-perspective-For-players-Set-based-on-resource.patch │ ├── 0098-Client-perspective-Packets-are-modifiable.patch │ ├── 0099-Client-perspective-Expose-packet-target-client-prope.patch │ ├── 0100-Client-perspective-Expose-packet-target-client-prope.patch │ ├── 0101-Client-perspective-Localization-Convenience-methods-.patch │ ├── 0102-Client-perspective-Item-replacements-Convenience-met.patch │ ├── 0103-Client-perspective-Expose-packet-target-client-prope.patch │ ├── 0104-Client-perspective-Expose-packet-target-client-prope.patch │ ├── 0105-Client-perspective-Base-ids-on-perspective-Block-Pro.patch │ ├── 0106-Client-perspective-Base-ids-on-perspective-Item-Prov.patch │ ├── 0107-Client-perspective-Base-ids-on-perspective-Block-sta.patch │ ├── 0108-Client-perspective-Level-event-data-value-replacemen.patch │ ├── 0109-Client-perspective-Level-event-data-value-replacemen.patch │ ├── 0110-Client-perspective-Level-event-data-value-replacemen.patch │ ├── 0111-Client-perspective-Level-event-data-value-replacemen.patch │ ├── 0112-Client-perspective-Deep-replacements-Define-replacem.patch │ ├── 0113-Client-perspective-Deep-replacements-Define-replacem.patch │ ├── 0114-Client-perspective-Deep-replacements-Cache-client-pe.patch │ ├── 0115-Client-perspective-Item-replacements-Define-context-.patch │ ├── 0116-Client-perspective-Deep-replacements-Pass-replacemen.patch │ ├── 0117-Client-perspective-Deep-replacements-Define-and-impl.patch │ ├── 0118-Client-perspective-Deep-replacements-Invoke-replacem.patch │ ├── 0119-Client-perspective-Deep-replacements-Store-connectio.patch │ ├── 0120-Client-perspective-Deep-replacements-Method-to-send-.patch │ ├── 0121-Client-perspective-Localization-Store-server-side-tr.patch │ ├── 0122-Client-perspective-Localization-Send-replaceable-upd.patch │ ├── 0123-Client-perspective-Block-state-visualization-Define-.patch │ ├── 0124-Client-perspective-Block-state-visualization-Visuali.patch │ ├── 0125-Client-perspective-Block-state-visualization-BlockSt.patch │ ├── 0126-Client-perspective-Block-state-visualization-Level-e.patch │ ├── 0127-Client-perspective-Block-state-visualization-Level-e.patch │ ├── 0128-Client-perspective-Block-state-visualization-Level-e.patch │ ├── 0129-Client-perspective-Block-state-visualization-Apply-t.patch │ ├── 0130-Client-perspective-Block-state-visualization-Apply-t.patch │ ├── 0131-Client-perspective-Block-state-visualization-Apply-t.patch │ ├── 0132-Client-perspective-Block-state-visualization-Apply-t.patch │ ├── 0133-Client-perspective-Block-state-visualization-Apply-t.patch │ ├── 0134-Client-perspective-Block-state-visualization-Apply-t.patch │ ├── 0135-Client-perspective-Block-state-visualization-Apply-t.patch │ ├── 0136-Client-perspective-Block-state-visualization-Apply-t.patch │ ├── 0137-Client-perspective-Block-state-visualization-Apply-t.patch │ ├── 0138-Client-perspective-Block-state-visualization-Apply-t.patch │ ├── 0139-Client-perspective-Block-state-visualization-Determi.patch │ ├── 0140-Client-perspective-Item-replacements-Define-visual-h.patch │ ├── 0141-Client-perspective-Item-replacements-Item-field-for-.patch │ ├── 0142-Client-perspective-Item-replacements-Replace-method-.patch │ ├── 0143-Client-perspective-Item-replacements-Pass-context-of.patch │ ├── 0144-Client-perspective-Item-replacements-Pass-context-of.patch │ ├── 0145-Client-perspective-Item-replacements-Level-event-dat.patch │ ├── 0146-Client-perspective-Item-replacements-Level-event-dat.patch │ ├── 0147-Client-perspective-Item-replacements-Store-original-.patch │ ├── 0148-Client-perspective-Item-replacements-Send-replaceabl.patch │ ├── 0149-Client-perspective-Localization-Register-server-side.patch │ ├── 0150-Client-perspective-Item-replacements-Determine-and-s.patch │ └── 0151-TEMP-Test-removing-feature-flags-from-specific-conte.patch └── settings.gradle.kts /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.java] 2 | charset=utf-8 3 | end_of_line=lf 4 | insert_final_newline=true 5 | indent_style=space 6 | indent_size=4 7 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.sh text eol=lf 4 | gradlew text eol=lf 5 | *.bat text eol=crlf 6 | 7 | *.jar binary 8 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Here lie wyverns! 2 | # 3 | # This action builds a paperclip jar 4 | # if unit tests pass. 5 | 6 | name: Build Fiddle 7 | on: [ push ] 8 | jobs: 9 | build: 10 | # Only run if the last commit does not start with [ci-skip] 11 | if: ${{ !contains(github.event.commits[0].message, '[ci-skip]') }} 12 | runs-on: ubuntu-latest 13 | strategy: 14 | matrix: 15 | java: [17] 16 | fail-fast: true 17 | steps: 18 | - name: Checkout Git repository 19 | uses: actions/checkout@v4 20 | 21 | - name: Set up JDK ${{ matrix.java }} 22 | uses: actions/setup-java@v4 23 | with: 24 | java-version: ${{ matrix.java }} 25 | distribution: 'temurin' 26 | 27 | - name: Validate Gradle wrapper 28 | uses: gradle/wrapper-validation-action@v1 29 | - name: Setup Gradle 30 | uses: gradle/gradle-build-action@v2 31 | 32 | - name: Grant execute permission for gradlew 33 | run: chmod +x gradlew 34 | 35 | - name: Apply Patches 36 | run: | 37 | git config --global user.email "no-reply@github.com" 38 | git config --global user.name "Github Actions" 39 | ./gradlew applyPatches --stacktrace 40 | 41 | - name: Build 42 | run: ./gradlew build --stacktrace 43 | 44 | - name: Upload Test Results 45 | if: always() 46 | uses: actions/upload-artifact@v4 47 | with: 48 | name: Test Results (${{ matrix.java }}) 49 | path: | 50 | **/build/test-results/test/TEST-*.xml 51 | 52 | - name: Create Paperclip Jar 53 | run: ./gradlew createReobfPaperclipJar --stacktrace 54 | 55 | - name: Upload Paperclip Jar 56 | uses: actions/upload-artifact@v4 57 | with: 58 | name: Fiddle 59 | path: build/libs/fiddle-paperclip-*-reobf.jar -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle/ 2 | build/ 3 | 4 | # Eclipse stuff 5 | .classpath 6 | .project 7 | .settings/ 8 | 9 | # VSCode stuff 10 | .vscode/ 11 | 12 | # netbeans 13 | nbproject/ 14 | nbactions.xml 15 | 16 | # we use maven! 17 | build.xml 18 | 19 | # maven 20 | target/ 21 | dependency-reduced-pom.xml 22 | 23 | # vim 24 | .*.sw[a-p] 25 | 26 | # various other potential build files 27 | build/ 28 | bin/ 29 | dist/ 30 | manifest.mf 31 | 32 | /work/Temp/ 33 | work/1.* 34 | work/Minecraft 35 | work/BuildData 36 | work/Bukkit 37 | work/CraftBukkit 38 | work/Paperclip 39 | work/Spigot 40 | work/Spigot-Server 41 | work/Spigot-API 42 | work/*.jar 43 | work/test-server 44 | work/ForgeFlower 45 | 46 | # Mac filesystem dust 47 | .DS_Store/ 48 | .DS_Store 49 | 50 | # intellij 51 | *.iml 52 | *.ipr 53 | *.iws 54 | .idea/ 55 | out/ 56 | 57 | # JetBrains Fleet 58 | .fleet/ 59 | 60 | # Linux temp files 61 | *~ 62 | 63 | # other stuff 64 | run/ 65 | 66 | fiddle-server 67 | fiddle-api 68 | paper-api-generator 69 | 70 | !gradle/wrapper/gradle-wrapper.jar 71 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # Fiddle 2 | 3 | Paperweight files are licensed under [MIT](https://opensource.org/licenses/MIT) (included in `license/MIT.txt`). 4 | Patches are licensed under [GPL-3.0](https://www.gnu.org/licenses/gpl-3.0.html) (included in `license/GPL-3.0.txt`), unless indicated differently in their header (some patches are licensed under MIT). 5 | Executable binaries are licensed under GPL-3.0. 6 | -------------------------------------------------------------------------------- /build-data/dev-imports.txt: -------------------------------------------------------------------------------- 1 | # You can use this file to import files from minecraft libraries into the project 2 | # format: 3 | # 4 | # both fully qualified and a file based syntax are accepted for : 5 | # authlib com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java 6 | # datafixerupper com.mojang.datafixers.DataFixerBuilder 7 | # datafixerupper com/mojang/datafixers/util/Either.java 8 | # To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId: 9 | # minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter 10 | # minecraft net/minecraft/world/level/entity/LevelEntityGetter.java 11 | 12 | -------------------------------------------------------------------------------- /build-data/reobf-mappings-patch.tiny: -------------------------------------------------------------------------------- 1 | # We would like for paperweight to generate 100% perfect reobf mappings (and deobf mappings for that matter). 2 | # But unfortunately it's not quite there yet - and it may be some time before that happens. Generating perfect mappings 3 | # from Spigot's mappings is extremely difficult due to Spigot's bad tooling and bad mappings. To add insult to injury 4 | # we remap Spigot's _source code_ which is a lot more complex and error-prone than bytecode remapping. So with all that 5 | # said, this file exists to help fill in the gap. 6 | # 7 | # We will continue to improve paperweight and will work on fixing these issues so they don't come up in the first place, 8 | # but these mappings exist to prevent these issues from holding everything else in Paper up while we work through all 9 | # of these issues. Due to the complex nature of mappings generation and the debugging difficulty involved it may take 10 | # a significant amount of time for us to track down every possible issue, so this file will likely be around and in 11 | # use - at least in some capacity - for a long time. 12 | 13 | tiny 2 0 mojang+yarn spigot 14 | 15 | # CraftBukkit changes type 16 | c net/minecraft/server/level/ServerLevel net/minecraft/server/level/WorldServer 17 | f Lnet/minecraft/world/level/storage/PrimaryLevelData; serverLevelData K 18 | 19 | c net/minecraft/world/level/chunk/LevelChunk net/minecraft/world/level/chunk/Chunk 20 | f Lnet/minecraft/server/level/ServerLevel; level r 21 | 22 | # See mappings-patch.tiny 23 | c net/minecraft/server/level/ChunkMap net/minecraft/server/level/PlayerChunkMap 24 | f Lnet/minecraft/server/level/ChunkMap$ChunkDistanceManager; distanceManager F 25 | 26 | # Paper changes type 27 | c net/minecraft/core/MappedRegistry net/minecraft/core/RegistryMaterials 28 | f Lit/unimi/dsi/fastutil/objects/Reference2IntOpenHashMap; toId e 29 | 30 | # upstream makes a bunch of methods public that cause accidental overrides now 31 | c net/minecraft/world/entity/Display net/minecraft/world/entity/Display 32 | m ()I getInterpolationDelay getInterpolationDelay_ 33 | m (I)V setInterpolationDelay setInterpolationDelay_ 34 | m (I)V setInterpolationDuration setInterpolationDuration_ 35 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | group=org.fiddlemc.fiddle 2 | version=1.20.4-R0.1-SNAPSHOT 3 | 4 | mcVersion=1.20.4 5 | paperRef=31699ae9a8f3a57491e9c9276cffa5a51e9a5f60 6 | 7 | org.gradle.caching=true 8 | org.gradle.parallel=true 9 | org.gradle.vfs.watch=false -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FiddleMC/Fiddle/903e95043d116c4884b4eca9a89ab43aec331688/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 48 | echo. 49 | echo Please set the JAVA_HOME variable in your environment to match the 50 | echo location of your Java installation. 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 62 | echo. 63 | echo Please set the JAVA_HOME variable in your environment to match the 64 | echo location of your Java installation. 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /license/MIT.txt: -------------------------------------------------------------------------------- 1 | Below is the MIT License (MIT), 2 | which applies only to parts of Fiddle that are specifically and explicitly released under MIT. 3 | 4 | MIT License 5 | 6 | Copyright (c) 2022-2023 Respective authors of parts of Fiddle or FiddleMC software, or software included therein 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FiddleMC/Fiddle/903e95043d116c4884b4eca9a89ab43aec331688/logo.png -------------------------------------------------------------------------------- /patches/api/0001-Hide-irrelevant-compilation-warnings.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Fri, 29 Dec 2023 13:03:42 +0100 4 | Subject: [PATCH] Hide irrelevant compilation warnings 5 | 6 | Hides some compilation warnings. 7 | This is done because Paper code contains many instances that trigger these warnings, leading to them filling the terminal every time it is compiled, and making it harder to find errors among the wall of text. 8 | 9 | This patch has an analogous patch in `fiddle-server` with the same name. 10 | 11 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 12 | Fiddle - https://fiddlemc.org 13 | 14 | This patch is based on the following patch: 15 | "Hide irrelevant compilation warnings" 16 | By: Martijn Muijsers 17 | As part of: Gale (https://github.com/GaleMC/Gale) 18 | Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 19 | 20 | * Gale description * 21 | 22 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 23 | Gale - https://galemc.org 24 | 25 | diff --git a/build.gradle.kts b/build.gradle.kts 26 | index 9d817bf3f26ffd484945a00a6538970eca22ee20..86be891db21065934d5daa740c0db8503b011cec 100644 27 | --- a/build.gradle.kts 28 | +++ b/build.gradle.kts 29 | @@ -109,6 +109,15 @@ val generateApiVersioningFile by tasks.registering { 30 | } 31 | } 32 | 33 | +// Fiddle start - hide irrelevant compilation warnings 34 | +tasks.withType { 35 | + val compilerArgs = options.compilerArgs 36 | + compilerArgs.add("-Xlint:-module") 37 | + compilerArgs.add("-Xlint:-removal") 38 | + compilerArgs.add("-Xlint:-dep-ann") 39 | +} 40 | +// Fiddle end - hide irrelevant compilation warnings 41 | + 42 | tasks.jar { 43 | from(generateApiVersioningFile.map { it.outputs.files.singleFile }) { 44 | into("META-INF/maven/${project.group}/${project.name}") 45 | -------------------------------------------------------------------------------- /patches/api/0002-Hide-Javadoc-lint-warnings.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Fri, 29 Dec 2023 13:05:45 +0100 4 | Subject: [PATCH] Hide Javadoc lint warnings 5 | 6 | Hides lint warnings printed when Javadocs are generated. 7 | This is done because Paper code contains many instances that trigger these warnings, leading to them filling the terminal every time Javadocs are generated. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | This patch is based on the following patch: 13 | "Hide irrelevant compilation warnings" 14 | By: Martijn Muijsers 15 | As part of: Gale (https://github.com/GaleMC/Gale) 16 | Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 17 | 18 | * Gale description * 19 | 20 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 21 | Gale - https://galemc.org 22 | 23 | diff --git a/build.gradle.kts b/build.gradle.kts 24 | index 86be891db21065934d5daa740c0db8503b011cec..f4a10acc733570f8eee1590e2223b5d5da2c7119 100644 25 | --- a/build.gradle.kts 26 | +++ b/build.gradle.kts 27 | @@ -175,6 +175,8 @@ tasks.withType { 28 | into("build/docs/javadoc") 29 | } 30 | } 31 | + 32 | + options.addStringOption("Xdoclint:none", "-quiet") // Fiddle - Gale - hide Javadoc lint warnings 33 | } 34 | 35 | tasks.test { 36 | -------------------------------------------------------------------------------- /patches/api/0003-Fiddle-parameters-methods-and-fields-are-non-null-by.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 12 Feb 2024 20:04:02 +0100 4 | Subject: [PATCH] Fiddle parameters, methods and fields are non-null by default 5 | 6 | Adds a `package-info.java` for every Fiddle package, that declares all parameters, methods and fields to be non-null by default. 7 | 8 | This patch has an analogous patch in `fiddle-server` with the same name. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | diff --git a/src/main/java/org/fiddlemc/fiddle/material/package-info.java b/src/main/java/org/fiddlemc/fiddle/material/package-info.java 14 | new file mode 100644 15 | index 0000000000000000000000000000000000000000..e0972f48c084b68099d38e2d0ee0b9dbac79cc94 16 | --- /dev/null 17 | +++ b/src/main/java/org/fiddlemc/fiddle/material/package-info.java 18 | @@ -0,0 +1,4 @@ 19 | +@ParametersAreNonnullByDefault 20 | +package org.fiddlemc.fiddle.material; 21 | + 22 | +import javax.annotation.ParametersAreNonnullByDefault; 23 | diff --git a/src/main/java/org/fiddlemc/fiddle/package-info.java b/src/main/java/org/fiddlemc/fiddle/package-info.java 24 | new file mode 100644 25 | index 0000000000000000000000000000000000000000..e3cf3df0ded6e8996c80564e77482caf06f8189a 26 | --- /dev/null 27 | +++ b/src/main/java/org/fiddlemc/fiddle/package-info.java 28 | @@ -0,0 +1,4 @@ 29 | +@ParametersAreNonnullByDefault 30 | +package org.fiddlemc.fiddle; 31 | + 32 | +import javax.annotation.ParametersAreNonnullByDefault; 33 | diff --git a/src/test/java/org/fiddlemc/fiddle/material/package-info.java b/src/test/java/org/fiddlemc/fiddle/material/package-info.java 34 | new file mode 100644 35 | index 0000000000000000000000000000000000000000..e0972f48c084b68099d38e2d0ee0b9dbac79cc94 36 | --- /dev/null 37 | +++ b/src/test/java/org/fiddlemc/fiddle/material/package-info.java 38 | @@ -0,0 +1,4 @@ 39 | +@ParametersAreNonnullByDefault 40 | +package org.fiddlemc.fiddle.material; 41 | + 42 | +import javax.annotation.ParametersAreNonnullByDefault; 43 | diff --git a/src/test/java/org/fiddlemc/fiddle/package-info.java b/src/test/java/org/fiddlemc/fiddle/package-info.java 44 | new file mode 100644 45 | index 0000000000000000000000000000000000000000..e3cf3df0ded6e8996c80564e77482caf06f8189a 46 | --- /dev/null 47 | +++ b/src/test/java/org/fiddlemc/fiddle/package-info.java 48 | @@ -0,0 +1,4 @@ 49 | +@ParametersAreNonnullByDefault 50 | +package org.fiddlemc.fiddle; 51 | + 52 | +import javax.annotation.ParametersAreNonnullByDefault; 53 | -------------------------------------------------------------------------------- /patches/api/0004-Fiddle-branding-changes-License-License-file-changes.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 13 Jul 2023 20:30:22 +0200 4 | Subject: [PATCH] Fiddle branding changes - License - License file changes 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | * Renames `LICENCE.txt` to `LICENSE.txt`. 10 | * Replace `http://` URLs with `https://`. 11 | 12 | This patch has an analogous patch in `fiddle-server` with the same name. 13 | 14 | No license is given for license text files. 15 | License text files are copyright (©) their respective authors. 16 | Fiddle - https://fiddlemc.org 17 | 18 | This patch is based on the following patch: 19 | "Gale branding changes" 20 | By: Martijn Muijsers 21 | As part of: Gale (https://github.com/GaleMC/Gale) 22 | Licensed (except for image files) under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 23 | 24 | * Gale description * 25 | 26 | Gale - https://galemc.org 27 | 28 | diff --git a/LICENCE.txt b/LICENSE.txt 29 | similarity index 99% 30 | rename from LICENCE.txt 31 | rename to LICENSE.txt 32 | index 94a9ed024d3859793618152ea559a168bbcbb5e2..e60008693e017bec1b4eb49c84be3898e26fcf2a 100644 33 | --- a/LICENCE.txt 34 | +++ b/LICENSE.txt 35 | @@ -1,7 +1,7 @@ 36 | GNU GENERAL PUBLIC LICENSE 37 | Version 3, 29 June 2007 38 | 39 | - Copyright (C) 2007 Free Software Foundation, Inc. 40 | + Copyright (C) 2007 Free Software Foundation, Inc. 41 | Everyone is permitted to copy and distribute verbatim copies 42 | of this license document, but changing it is not allowed. 43 | 44 | @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found. 45 | GNU General Public License for more details. 46 | 47 | You should have received a copy of the GNU General Public License 48 | - along with this program. If not, see . 49 | + along with this program. If not, see . 50 | 51 | Also add information on how to contact you by electronic and paper mail. 52 | 53 | @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box". 54 | You should also get your employer (if you work as a programmer) or school, 55 | if any, to sign a "copyright disclaimer" for the program, if necessary. 56 | For more information on this, and how to apply and follow the GNU GPL, see 57 | -. 58 | +. 59 | 60 | The GNU General Public License does not permit incorporating your program 61 | into proprietary programs. If your program is a subroutine library, you 62 | may consider it more useful to permit linking proprietary applications with 63 | the library. If this is what you want to do, use the GNU Lesser General 64 | Public License instead of this License. But first, please read 65 | -. 66 | +. 67 | -------------------------------------------------------------------------------- /patches/api/0005-Fiddle-branding-changes-License-Package-into-jar.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Fri, 29 Dec 2023 12:56:43 +0100 4 | Subject: [PATCH] Fiddle branding changes - License - Package into jar 5 | 6 | Adds `LICENSE.txt` to built jar files. 7 | 8 | This patch has a parallel patch with the same purpose and name in `fiddle-server`. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | This patch is based on the following patch: 14 | "Gale branding changes" 15 | By: Martijn Muijsers 16 | As part of: Gale (https://github.com/GaleMC/Gale) 17 | Licensed (except for image files) under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 18 | 19 | * Gale description * 20 | 21 | Gale - https://galemc.org 22 | 23 | diff --git a/build.gradle.kts b/build.gradle.kts 24 | index f4a10acc733570f8eee1590e2223b5d5da2c7119..88ea1f3ef379916c034f45b346afc7d447aa870c 100644 25 | --- a/build.gradle.kts 26 | +++ b/build.gradle.kts 27 | @@ -127,6 +127,12 @@ tasks.jar { 28 | "Automatic-Module-Name" to "org.bukkit" 29 | ) 30 | } 31 | + 32 | + // Fiddle start - branding changes - license - package into jar 33 | + from("${project.projectDir}/LICENSE.txt") { 34 | + into("") 35 | + } 36 | + // Fiddle end - branding changes - license - package into jar 37 | } 38 | 39 | tasks.withType { 40 | -------------------------------------------------------------------------------- /patches/api/0006-Define-Fiddle-namespace.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 13 Jul 2023 18:06:17 +0200 4 | Subject: [PATCH] Define Fiddle namespace 5 | 6 | Adds a constant for the Fiddle namespace (for namespaced keys starting with `fiddle:`). 7 | Its value is also used for `ResourceLocation.FIDDLE_NAMESPACE`, which is defined in the "Define Fiddle namespace" patch in the `fiddle-server` module. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java 13 | index 8ac72cb0b05e2c493d98310f2e87c3714d15c5e3..8ebc1bc3e6739bcf10ca6d149b69f68f312f3104 100644 14 | --- a/src/main/java/org/bukkit/NamespacedKey.java 15 | +++ b/src/main/java/org/bukkit/NamespacedKey.java 16 | @@ -30,6 +30,14 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key, com.des 17 | * compatibility measures. 18 | */ 19 | public static final String BUKKIT = "bukkit"; 20 | + // Fiddle start - define Fiddle namespace 21 | + /** 22 | + * The namespace for Fiddle {@link NamespacedKey}s. 23 | + * This is for {@link NamespacedKey}s that are defined by and belong to Fiddle itself, 24 | + * not those of packs that are loaded by Fiddle (content in those packs uses its own namespaces). 25 | + */ 26 | + public static final String FIDDLE = "fiddle"; 27 | + // Fiddle end - define Fiddle namespace 28 | // 29 | private final String namespace; 30 | private final String key; 31 | -------------------------------------------------------------------------------- /patches/api/0007-Configuration-Get-Fiddle-configuration-with-Bukkit-A.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 23 Nov 2022 21:03:04 +0100 4 | Subject: [PATCH] Configuration - Get Fiddle configuration with Bukkit API 5 | 6 | Allows getting the Fiddle configuration using the Bukkit API. 7 | This is done by providing the abstract method `Server.getFiddleConfig()`, which is implemented in the "Configuration - Get Fiddle configuration with Bukkit API" patch in the `fiddle-server` module. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | This patch is based on the following patch: 13 | "Gale configuration" 14 | By: Martijn Muijsers 15 | As part of: Gale (https://github.com/GaleMC/Gale) 16 | Licensed under: MIT (https://opensource.org/licenses/MIT) 17 | 18 | * Gale description * 19 | 20 | License: MIT (https://opensource.org/licenses/MIT) 21 | Gale - https://galemc.org 22 | 23 | This patch is based on the following patch: 24 | "Timings v2" 25 | By: Aikar 26 | As part of: Paper (https://github.com/PaperMC/Paper) 27 | Licensed under: MIT (https://opensource.org/licenses/MIT) 28 | 29 | diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java 30 | index b4f8281d3797ec825a7671f38077cd65d5a1d76e..f3aed8bffafb283372c965e8f880ed00a88f1800 100644 31 | --- a/src/main/java/org/bukkit/Server.java 32 | +++ b/src/main/java/org/bukkit/Server.java 33 | @@ -2212,6 +2212,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi 34 | { 35 | throw new UnsupportedOperationException("Not supported yet."); 36 | } 37 | + 38 | + // Fiddle start - Fiddle configuration - API 39 | + @NotNull 40 | + public org.bukkit.configuration.file.YamlConfiguration getFiddleConfig() 41 | + { 42 | + throw new UnsupportedOperationException("Not supported yet."); 43 | + } 44 | + // Fiddle end - Fiddle configuration - API 45 | + 46 | // Paper end 47 | 48 | /** 49 | -------------------------------------------------------------------------------- /patches/api/0008-Material-fixes-Remove-explicit-wall-sign-max-stack-s.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 10 Jul 2023 22:05:08 +0200 4 | Subject: [PATCH] Material fixes - Remove explicit wall sign max stack sizes 5 | 6 | Removes the explicit stack sizes for the `Material` wall sign values. 7 | Wall signs only exist in block form, not in item form, so this value has no meaning and is removed for consistency: now all non-item `Material` values have the same `maxStack` value (which is the default value of 64). 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java 13 | index f9af60356da4668cec8b24e73f5747ab82e35a91..74a2e0503abcd662e9d412f98e0e9b4aa9a39f81 100644 14 | --- a/src/main/java/org/bukkit/Material.java 15 | +++ b/src/main/java/org/bukkit/Material.java 16 | @@ -3338,39 +3338,39 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla 17 | /** 18 | * BlockData: {@link WallSign} 19 | */ 20 | - OAK_WALL_SIGN(12984, 16, WallSign.class), 21 | + OAK_WALL_SIGN(12984, WallSign.class), // Fiddle - remove explicit wall sign max stack sizes 22 | /** 23 | * BlockData: {@link WallSign} 24 | */ 25 | - SPRUCE_WALL_SIGN(7352, 16, WallSign.class), 26 | + SPRUCE_WALL_SIGN(7352, WallSign.class), // Fiddle - remove explicit wall sign max stack sizes 27 | /** 28 | * BlockData: {@link WallSign} 29 | */ 30 | - BIRCH_WALL_SIGN(9887, 16, WallSign.class), 31 | + BIRCH_WALL_SIGN(9887, WallSign.class), // Fiddle - remove explicit wall sign max stack sizes 32 | /** 33 | * BlockData: {@link WallSign} 34 | */ 35 | - ACACIA_WALL_SIGN(20316, 16, WallSign.class), 36 | + ACACIA_WALL_SIGN(20316, WallSign.class), // Fiddle - remove explicit wall sign max stack sizes 37 | /** 38 | * BlockData: {@link WallSign} 39 | */ 40 | - CHERRY_WALL_SIGN(20188, 16, WallSign.class), 41 | + CHERRY_WALL_SIGN(20188, WallSign.class), // Fiddle - remove explicit wall sign max stack sizes 42 | /** 43 | * BlockData: {@link WallSign} 44 | */ 45 | - JUNGLE_WALL_SIGN(29629, 16, WallSign.class), 46 | + JUNGLE_WALL_SIGN(29629, WallSign.class), // Fiddle - remove explicit wall sign max stack sizes 47 | /** 48 | * BlockData: {@link WallSign} 49 | */ 50 | - DARK_OAK_WALL_SIGN(9508, 16, WallSign.class), 51 | + DARK_OAK_WALL_SIGN(9508, WallSign.class), // Fiddle - remove explicit wall sign max stack sizes 52 | /** 53 | * BlockData: {@link WallSign} 54 | */ 55 | - MANGROVE_WALL_SIGN(27203, 16, WallSign.class), 56 | + MANGROVE_WALL_SIGN(27203, WallSign.class), // Fiddle - remove explicit wall sign max stack sizes 57 | /** 58 | * BlockData: {@link WallSign} 59 | */ 60 | - BAMBOO_WALL_SIGN(18857, 16, WallSign.class), 61 | + BAMBOO_WALL_SIGN(18857, WallSign.class), // Fiddle - remove explicit wall sign max stack sizes 62 | /** 63 | * BlockData: {@link WallHangingSign} 64 | */ 65 | @@ -3663,11 +3663,11 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla 66 | /** 67 | * BlockData: {@link WallSign} 68 | */ 69 | - CRIMSON_WALL_SIGN(19242, 16, WallSign.class), 70 | + CRIMSON_WALL_SIGN(19242, WallSign.class), // Fiddle - remove explicit wall sign max stack sizes 71 | /** 72 | * BlockData: {@link WallSign} 73 | */ 74 | - WARPED_WALL_SIGN(13534, 16, WallSign.class), 75 | + WARPED_WALL_SIGN(13534, WallSign.class), // Fiddle - remove explicit wall sign max stack sizes 76 | POTTED_CRIMSON_FUNGUS(5548), 77 | POTTED_WARPED_FUNGUS(30800), 78 | POTTED_CRIMSON_ROOTS(13852), 79 | -------------------------------------------------------------------------------- /patches/api/0009-Material-fixes-Fix-LEGACY_ELYTRA-durability.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 10 Jul 2023 22:05:08 +0200 4 | Subject: [PATCH] Material fixes - Fix LEGACY_ELYTRA durability 5 | 6 | Corrects the `Material.getMaxDurability` value of `Material.LEGACY_ELYTRA`. 7 | 8 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 9 | Fiddle - https://fiddlemc.org 10 | 11 | diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java 12 | index 74a2e0503abcd662e9d412f98e0e9b4aa9a39f81..4bbe343223f3ebf90dd6b41a707e573d02e1f48b 100644 13 | --- a/src/main/java/org/bukkit/Material.java 14 | +++ b/src/main/java/org/bukkit/Material.java 15 | @@ -4643,7 +4643,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla 16 | @Deprecated 17 | LEGACY_SHIELD(442, 1, 336), 18 | @Deprecated 19 | - LEGACY_ELYTRA(443, 1, 431), 20 | + LEGACY_ELYTRA(443, 1, 432), // Fiddle - correct legacy elytra durability 21 | @Deprecated 22 | LEGACY_BOAT_SPRUCE(444, 1), 23 | @Deprecated 24 | -------------------------------------------------------------------------------- /patches/api/0010-Material-fixes-Add-missing-value-to-isTransparent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 10 Jul 2023 22:05:08 +0200 4 | Subject: [PATCH] Material fixes - Add missing value to isTransparent 5 | 6 | Adds the missing legacy value `LEGACY_BARRIER` to `Material.isTransparent`. 7 | 8 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 9 | Fiddle - https://fiddlemc.org 10 | 11 | diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java 12 | index 4bbe343223f3ebf90dd6b41a707e573d02e1f48b..e718d84401c732328854104fa37441ee0838a91b 100644 13 | --- a/src/main/java/org/bukkit/Material.java 14 | +++ b/src/main/java/org/bukkit/Material.java 15 | @@ -7469,6 +7469,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla 16 | case LEGACY_REDSTONE_COMPARATOR_OFF: 17 | case LEGACY_REDSTONE_COMPARATOR_ON: 18 | case LEGACY_ACTIVATOR_RAIL: 19 | + case LEGACY_BARRIER: // Fiddle - add missing Material values that are transparent 20 | case LEGACY_CARPET: 21 | case LEGACY_DOUBLE_PLANT: 22 | case LEGACY_END_ROD: 23 | -------------------------------------------------------------------------------- /patches/api/0011-Material-fixes-Add-missing-value-to-isFuel.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 10 Jul 2023 22:05:08 +0200 4 | Subject: [PATCH] Material fixes - Add missing value to isFuel 5 | 6 | Adds the missing legacy value `LEGACY_DEAD_BUSH` to `Material.isFuel`. 7 | 8 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 9 | Fiddle - https://fiddlemc.org 10 | 11 | diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java 12 | index e718d84401c732328854104fa37441ee0838a91b..b8a17db0ea90a12cbe16e2bd46a47c62bde3717c 100644 13 | --- a/src/main/java/org/bukkit/Material.java 14 | +++ b/src/main/java/org/bukkit/Material.java 15 | @@ -8379,6 +8379,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla 16 | case LEGACY_WOOD_STEP: 17 | case LEGACY_SAPLING: 18 | case LEGACY_STICK: 19 | + case LEGACY_DEAD_BUSH: // Fiddle - add missing Material values that are fuel 20 | case LEGACY_WOOD_BUTTON: 21 | case LEGACY_WOOL: 22 | case LEGACY_CARPET: 23 | -------------------------------------------------------------------------------- /patches/api/0012-Material-fixes-Add-missing-values-to-isOccluding.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 10 Jul 2023 22:05:08 +0200 4 | Subject: [PATCH] Material fixes - Add missing values to isOccluding 5 | 6 | Adds the missing legacy values for dyed shulker boxes to `Material.isOccluding`. 7 | 8 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 9 | Fiddle - https://fiddlemc.org 10 | 11 | diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java 12 | index b8a17db0ea90a12cbe16e2bd46a47c62bde3717c..3bdafd993fc894ec7865b26508386c6582e347ce 100644 13 | --- a/src/main/java/org/bukkit/Material.java 14 | +++ b/src/main/java/org/bukkit/Material.java 15 | @@ -8866,6 +8866,24 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla 16 | case LEGACY_NETHER_WART_BLOCK: 17 | case LEGACY_RED_NETHER_BRICK: 18 | case LEGACY_BONE_BLOCK: 19 | + // Fiddle start - add missing Material values that are occluding 20 | + case LEGACY_WHITE_SHULKER_BOX: 21 | + case LEGACY_ORANGE_SHULKER_BOX: 22 | + case LEGACY_MAGENTA_SHULKER_BOX: 23 | + case LEGACY_LIGHT_BLUE_SHULKER_BOX: 24 | + case LEGACY_YELLOW_SHULKER_BOX: 25 | + case LEGACY_LIME_SHULKER_BOX: 26 | + case LEGACY_PINK_SHULKER_BOX: 27 | + case LEGACY_GRAY_SHULKER_BOX: 28 | + case LEGACY_SILVER_SHULKER_BOX: 29 | + case LEGACY_CYAN_SHULKER_BOX: 30 | + case LEGACY_PURPLE_SHULKER_BOX: 31 | + case LEGACY_BLUE_SHULKER_BOX: 32 | + case LEGACY_BROWN_SHULKER_BOX: 33 | + case LEGACY_GREEN_SHULKER_BOX: 34 | + case LEGACY_RED_SHULKER_BOX: 35 | + case LEGACY_BLACK_SHULKER_BOX: 36 | + // Fiddle end - add missing Material values that are occluding 37 | case LEGACY_WHITE_GLAZED_TERRACOTTA: 38 | case LEGACY_ORANGE_GLAZED_TERRACOTTA: 39 | case LEGACY_MAGENTA_GLAZED_TERRACOTTA: 40 | -------------------------------------------------------------------------------- /patches/api/0013-Material-fixes-Add-missing-values-to-hasGravity.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 10 Jul 2023 22:05:08 +0200 4 | Subject: [PATCH] Material fixes - Add missing values to hasGravity 5 | 6 | Adds the following missing values to `Material.hasGravity`: 7 | * `POINTED_DRIPSTONE` 8 | * `SCAFFOLDING` 9 | * `SUSPICIOUS_GRAVEL` and `SUSPICIOUS_SAND` 10 | Also adds the following missing legacy value: 11 | * `LEGACY_DRAGON_EGG` 12 | 13 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 14 | Fiddle - https://fiddlemc.org 15 | 16 | diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java 17 | index 3bdafd993fc894ec7865b26508386c6582e347ce..9c49395c084acabe5bbf4d2b0421c93ab2dfddaf 100644 18 | --- a/src/main/java/org/bukkit/Material.java 19 | +++ b/src/main/java/org/bukkit/Material.java 20 | @@ -8935,15 +8935,22 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla 21 | case MAGENTA_CONCRETE_POWDER: 22 | case ORANGE_CONCRETE_POWDER: 23 | case PINK_CONCRETE_POWDER: 24 | + case POINTED_DRIPSTONE: // Fiddle - add missing Material values with gravity 25 | case PURPLE_CONCRETE_POWDER: 26 | case RED_CONCRETE_POWDER: 27 | case RED_SAND: 28 | case SAND: 29 | + // Fiddle start - add missing Material values with gravity 30 | + case SCAFFOLDING: 31 | + case SUSPICIOUS_GRAVEL: 32 | + case SUSPICIOUS_SAND: 33 | + // Fiddle end - add missing Material values with gravity 34 | case WHITE_CONCRETE_POWDER: 35 | case YELLOW_CONCRETE_POWDER: 36 | // ----- Legacy Separator ----- 37 | case LEGACY_SAND: 38 | case LEGACY_GRAVEL: 39 | + case LEGACY_DRAGON_EGG: // Fiddle - add missing Material values with gravity 40 | case LEGACY_ANVIL: 41 | case LEGACY_CONCRETE_POWDER: 42 | // 43 | -------------------------------------------------------------------------------- /patches/api/0014-Flag-for-vanilla-blocks-items-and-block-states-Bukki.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 3 Jan 2024 18:23:11 +0100 4 | Subject: [PATCH] Flag for vanilla blocks, items and block states - Bukkit API 5 | 6 | Allows getting whether a block, item or block state is present in vanilla. 7 | This is done by providing the abstract methods `UnsafeValues.isVanillaBlock()`, `UnsafeValues.isVanillaItem()` and `BlockData.isVanilla()`, which are implemented in the "Flag for vanilla blocks, items and block states - Bukkit API" patch in the `fiddle-server` module, 8 | and adding the `Material.isVanillaBlock()` and `Material.isVanillaItem()` aliases for the respective methods in `UnsafeValues`. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java 14 | index 9c49395c084acabe5bbf4d2b0421c93ab2dfddaf..67a67710736a023b1dfb01771f21576a76367f8e 100644 15 | --- a/src/main/java/org/bukkit/Material.java 16 | +++ b/src/main/java/org/bukkit/Material.java 17 | @@ -11584,4 +11584,23 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla 18 | public boolean isEnabledByFeature(@NotNull World world) { 19 | return Bukkit.getDataPackManager().isEnabledByFeature(this, world); 20 | } 21 | + 22 | + // Fiddle start - flags for vanilla content - API - block 23 | + /** 24 | + * @return Whether this {@link Material} is present in vanilla as a block. 25 | + */ 26 | + public boolean isVanillaBlock() { 27 | + return Bukkit.getUnsafe().isVanillaBlock(this); 28 | + } 29 | + // Fiddle end - flags for vanilla content - API - block 30 | + 31 | + // Fiddle start - flags for vanilla content - API - item 32 | + /** 33 | + * @return Whether this {@link Material} is present in vanilla as an item. 34 | + */ 35 | + public boolean isVanillaItem() { 36 | + return Bukkit.getUnsafe().isVanillaItem(this); 37 | + } 38 | + // Fiddle end - flags for vanilla content - API - item 39 | + 40 | } 41 | diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java 42 | index 9a65c4f614a6c358d74491794d7b25172a00bc11..58ca289b0492bffe0c47b3db90795bbd2d4a12a7 100644 43 | --- a/src/main/java/org/bukkit/UnsafeValues.java 44 | +++ b/src/main/java/org/bukkit/UnsafeValues.java 45 | @@ -300,4 +300,21 @@ public interface UnsafeValues { 46 | // Paper end - lifecycle event API 47 | 48 | @NotNull java.util.List computeTooltipLines(@NotNull ItemStack itemStack, @NotNull io.papermc.paper.inventory.tooltip.TooltipContext tooltipContext, @Nullable org.bukkit.entity.Player player); // Paper - expose itemstack tooltip lines 49 | + 50 | + // Fiddle start - flags for vanilla content - API - block 51 | + /** 52 | + * @param material A {@link Material} type. 53 | + * @return Whether the given {@link Material} is present in vanilla as a block. 54 | + */ 55 | + boolean isVanillaBlock(Material material); 56 | + // Fiddle end - flags for vanilla content - API - block 57 | + 58 | + // Fiddle start - flags for vanilla content - API - item 59 | + /** 60 | + * @param material A {@link Material} type. 61 | + * @return Whether the given {@link Material} is present in vanilla as an item. 62 | + */ 63 | + boolean isVanillaItem(Material material); 64 | + // Fiddle end - flags for vanilla content - API - item 65 | + 66 | } 67 | diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java 68 | index fb4c7cf0f67f3e4227d17f6702ae7b7bf1c110ab..00e44c57c29b47a564ad85dab224bfadbf0bada8 100644 69 | --- a/src/main/java/org/bukkit/block/data/BlockData.java 70 | +++ b/src/main/java/org/bukkit/block/data/BlockData.java 71 | @@ -314,4 +314,12 @@ public interface BlockData extends Cloneable { 72 | */ 73 | boolean isRandomlyTicked(); 74 | // Paper end - Tick API 75 | + 76 | + // Fiddle start - flags for vanilla content - API - block state 77 | + /** 78 | + * @return Whether this block state is present in vanilla. 79 | + */ 80 | + boolean isVanilla(); 81 | + // Fiddle end - flags for vanilla content - API - block state 82 | + 83 | } 84 | -------------------------------------------------------------------------------- /patches/api/0015-Modifiable-Bukkit-enums-Complete-legacy-conversion-C.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 8 Jan 2024 19:24:33 +0100 4 | Subject: [PATCH] Modifiable Bukkit enums - Complete legacy conversion - 5 | Conversion is explicitly for item or block - Expose Bukkit API 6 | 7 | Because converting legacy values is ambiguous when not indicating whether it concerns an item or block, 8 | the "Modifiable Bukkit enums - Complete legacy conversion - Conversion is explicitly for item or block" patch in the `fiddle-server` module 9 | requires that all such conversions explicitly indicate this. 10 | 11 | To communicate this to plugin authors, this patch deprecates the `UnsafeValues.fromLegacy` methods that do not have an `itemPriority` parameter, 12 | and adds a new method `fromLegacy(Material, boolean)` because it did not exist. 13 | 14 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 15 | Fiddle - https://fiddlemc.org 16 | 17 | diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java 18 | index 58ca289b0492bffe0c47b3db90795bbd2d4a12a7..c0d5c8737de452f87a8d0c168972b3c4b510bb10 100644 19 | --- a/src/main/java/org/bukkit/UnsafeValues.java 20 | +++ b/src/main/java/org/bukkit/UnsafeValues.java 21 | @@ -43,8 +43,23 @@ public interface UnsafeValues { 22 | void reportTimings(); // Paper 23 | Material toLegacy(Material material); 24 | 25 | + 26 | + // Fiddle start - modifiable Bukkit enums - Material - make legacy conversion complete 27 | + /** 28 | + * @deprecated Use {@link #fromLegacy(Material, boolean)} instead. 29 | + */ 30 | + @Deprecated 31 | + // Fiddle end - modifiable Bukkit enums - Material - make legacy conversion complete 32 | Material fromLegacy(Material material); 33 | 34 | + // Fiddle start - modifiable Bukkit enums - Material - make legacy conversion complete 35 | + Material fromLegacy(Material material, boolean itemPriority); 36 | + 37 | + /** 38 | + * @deprecated Use {@link #fromLegacy(MaterialData, boolean)} instead. 39 | + */ 40 | + @Deprecated 41 | + // Fiddle end - modifiable Bukkit enums - Material - make legacy conversion complete 42 | Material fromLegacy(MaterialData material); 43 | 44 | Material fromLegacy(MaterialData material, boolean itemPriority); 45 | -------------------------------------------------------------------------------- /patches/api/0017-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 13 Jul 2023 08:42:26 +0200 4 | Subject: [PATCH] Modifiable Bukkit enums - Remove hard-coded properties - 5 | Material - Name and key conversion utility 6 | 7 | Adds the `MaterialNameAndKeyConversion` utility class for the conversion of names and keys from and to `Material` instances. 8 | Does not fill it with anything yet, it will be populated in subsequent patches. 9 | 10 | * A reason for this utility is that some conversions from and to names and keys need to be modified, and additional helper methods may be useful, 11 | and this class can serve as a single place to be responsible for the entire conversion. 12 | * Another reason is that, just like hard-coded values, we would like to move function content out of the `Material` class 13 | and place it somewhere that can be called from `AbstractMaterial` so that it does not need to be re-implemented in the runtime injected `Material` class version. 14 | 15 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 16 | Fiddle - https://fiddlemc.org 17 | 18 | diff --git a/src/main/java/org/fiddlemc/fiddle/material/MaterialNameAndKeyConversion.java b/src/main/java/org/fiddlemc/fiddle/material/MaterialNameAndKeyConversion.java 19 | new file mode 100644 20 | index 0000000000000000000000000000000000000000..472e6f94da1726e4fde1eda4035dd91a50453f7d 21 | --- /dev/null 22 | +++ b/src/main/java/org/fiddlemc/fiddle/material/MaterialNameAndKeyConversion.java 23 | @@ -0,0 +1,24 @@ 24 | +// Fiddle start - modifiable Bukkit enums - Material - remove hard-coded properties - name and key conversion 25 | + 26 | +package org.fiddlemc.fiddle.material; 27 | + 28 | +import org.bukkit.Material; 29 | + 30 | +/** 31 | + * Do not use for any reason. 32 | + * This class is for internal purposes only. 33 | + *

34 | + * This class provides a number of implementations for the conversion of names and keys 35 | + * from and to {@link Material} instances. 36 | + *

37 | + * 38 | + * @apiNote Internal Use Only 39 | + */ 40 | +@org.jetbrains.annotations.ApiStatus.Internal 41 | +public final class MaterialNameAndKeyConversion { 42 | + 43 | + private MaterialNameAndKeyConversion() { 44 | + throw new RuntimeException(); 45 | + } 46 | + 47 | +} 48 | -------------------------------------------------------------------------------- /patches/api/0029-TODO-Backwards-plugin-compatibility-mode-Add-matchab.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 10 Jan 2024 20:54:42 +0100 4 | Subject: [PATCH] TODO Backwards plugin compatibility mode - Add matchable 5 | Material values 6 | 7 | Adds additional values can be matched on in `Material.matchMaterial`: 8 | the namespaced key and the namespaced key path of the `Material` if the backwards plugin compatibility mode were reversed. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | diff --git a/src/main/java/org/fiddlemc/fiddle/material/MaterialNameAndKeyConversion.java b/src/main/java/org/fiddlemc/fiddle/material/MaterialNameAndKeyConversion.java 14 | index 5a72421d3e60d493f0f2b6a0a3f75c078476d215..95b8664aafb176bb549d376b7e248cf3e792de76 100644 15 | --- a/src/main/java/org/fiddlemc/fiddle/material/MaterialNameAndKeyConversion.java 16 | +++ b/src/main/java/org/fiddlemc/fiddle/material/MaterialNameAndKeyConversion.java 17 | @@ -71,6 +71,9 @@ public final class MaterialNameAndKeyConversion { 18 | case 0 -> material.isLegacy() ? null : material.getKey().toString(); 19 | case 1 -> material.isLegacy() ? null : material.getKey().getKey(); 20 | case 2 -> material.name(); 21 | + // Fiddle start - backwards plugin compatibility mode - add matchable Material values 22 | + // TODO add a case 3 and 4: the namespaced key and namespaced key path of this Material if the backwards plugin compatibility mode were reversed 23 | + // Fiddle end - backwards plugin compatibility mode - add matchable Material values 24 | default -> throw new IllegalArgumentException("Invalid valueIndex: " + valueIndex); 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /patches/api/0030-Modifiable-Bukkit-enums-Extract-enum-implementation-.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 10 Jul 2023 22:05:08 +0200 4 | Subject: [PATCH] Modifiable Bukkit enums - Extract enum implementation - 5 | Create corresponding interfaces 6 | 7 | Creates interfaces (currently, only for `Material`) that are intended to provide base implementations for most enum properties. 8 | Such an interface, even if it itself references the target enum, can be loaded by a `ClassLoader` 9 | without the enum itself being loaded. 10 | 11 | This allows definining the enum at runtime, without having to re-provide implementations that are present in the interface, 12 | since these can be inherited by having the runtime enum definition implement the interface. 13 | 14 | The moving of the implementations of the enum to their corresponding interface is done in the 15 | "Modifiable Bukkit enums - Extract enum implementation - Move implementation" patch. 16 | 17 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 18 | Fiddle - https://fiddlemc.org 19 | 20 | diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java 21 | index 4c3591ac2badab50fee81afe4db2f5ca4e736ea2..80190abd184dddb08df8502adeb667d1809f8de0 100644 22 | --- a/src/main/java/org/bukkit/Material.java 23 | +++ b/src/main/java/org/bukkit/Material.java 24 | @@ -122,7 +122,7 @@ import org.jetbrains.annotations.Nullable; 25 | * An enum of all material IDs accepted by the official server and client 26 | */ 27 | @SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper 28 | -public enum Material implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper 29 | +public enum Material implements org.fiddlemc.fiddle.material.AbstractMaterial { // Paper // Fiddle - modifiable Bukkit enums - create corresponding interfaces - Material 30 | // 31 | AIR(9648, 0), 32 | STONE(22948), 33 | diff --git a/src/main/java/org/fiddlemc/fiddle/material/AbstractMaterial.java b/src/main/java/org/fiddlemc/fiddle/material/AbstractMaterial.java 34 | new file mode 100644 35 | index 0000000000000000000000000000000000000000..5e427faae4728a91c59e937cac3ceb5c1629722d 36 | --- /dev/null 37 | +++ b/src/main/java/org/fiddlemc/fiddle/material/AbstractMaterial.java 38 | @@ -0,0 +1,29 @@ 39 | +// Fiddle - modifiable Bukkit enums - create corresponding interfaces - Material 40 | + 41 | +package org.fiddlemc.fiddle.material; 42 | + 43 | +import org.bukkit.Keyed; 44 | +import org.bukkit.Material; 45 | +import org.bukkit.Translatable; 46 | +import org.jetbrains.annotations.NotNull; 47 | + 48 | +/** 49 | + * Do not use for any reason. 50 | + * This interface is for internal purposes only: 51 | + * use {@link Material} instead. 52 | + *

53 | + * An interface that provides default implementations for most {@link Material} methods. 54 | + * This interface, while it itself reference the {@link Material} class, can be loaded by a ClassLoader 55 | + * without the {@link Material} class being loaded. 56 | + *

57 | + * 58 | + * @apiNote Internal Use Only 59 | + */ 60 | +@org.jetbrains.annotations.ApiStatus.Internal 61 | +public interface AbstractMaterial extends Keyed, Translatable, net.kyori.adventure.translation.Translatable { 62 | + 63 | + int ordinal(); 64 | + 65 | + @NotNull String name(); 66 | + 67 | +} 68 | -------------------------------------------------------------------------------- /patches/api/0032-Modifiable-Bukkit-enums-Inject-runtime-versions-Defi.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 10 Jan 2024 20:20:56 +0100 4 | Subject: [PATCH] Modifiable Bukkit enums - Inject runtime versions - Define 5 | Fiddle enum name prefix 6 | 7 | Defines the prefix that will be used in the names of enum members added by Fiddle. 8 | 9 | Also adds a reference to it in the `Material.matchMaterial` documentation, as it is a relevant example of the possible matching. 10 | 11 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 12 | Fiddle - https://fiddlemc.org 13 | 14 | diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java 15 | index 297a9c95040b0d4f300b324a010cd3dc5b0577ff..65fbcd0bedb9917a3ea40f195f61e46975bdd1ba 100644 16 | --- a/src/main/java/org/bukkit/Material.java 17 | +++ b/src/main/java/org/bukkit/Material.java 18 | @@ -5112,7 +5112,7 @@ public enum Material implements org.fiddlemc.fiddle.material.AbstractMaterial { 19 | *
    20 | *
  1. The {@linkplain #getKey() namespaced key}, for example: "minecraft:stone_bricks" or "masonry:tuff_bricks"
  2. 21 | *
  3. The namespaced key path (part behind the : in a namespaced key), for example: "stone_bricks" or "tuff_bricks"
  4. 22 | - *
  5. The enum name, for example: "STONE_BRICKS"
  6. 23 | + *
  7. The enum name, for example: "STONE_BRICKS" or "{@linkplain org.fiddlemc.fiddle.material.FiddleEnumNamePrefix#PREFIX FIDDLE_}MASONRY_TUFF_BRICKS"
  8. 24 | *
25 | * In other words, first the given string will be checked case-sensitively against the namespaced key, 26 | * then case-sensitively against the namespaced key path, and so on. 27 | diff --git a/src/main/java/org/fiddlemc/fiddle/material/FiddleEnumNamePrefix.java b/src/main/java/org/fiddlemc/fiddle/material/FiddleEnumNamePrefix.java 28 | new file mode 100644 29 | index 0000000000000000000000000000000000000000..c2c19b7f657061878b5ecd66d3bc185c6d74fb23 30 | --- /dev/null 31 | +++ b/src/main/java/org/fiddlemc/fiddle/material/FiddleEnumNamePrefix.java 32 | @@ -0,0 +1,16 @@ 33 | +// Fiddle - modifiable Bukkit enums - inject runtime versions - define Fiddle enum name prefix 34 | + 35 | +package org.fiddlemc.fiddle.material; 36 | + 37 | +/** 38 | + * A utility class solely for holding the {@link #PREFIX} value. 39 | + */ 40 | +public final class FiddleEnumNamePrefix { 41 | + 42 | + private FiddleEnumNamePrefix() { 43 | + throw new RuntimeException(); 44 | + } 45 | + 46 | + public static final String PREFIX = "FIDDLE_"; 47 | + 48 | +} 49 | -------------------------------------------------------------------------------- /patches/api/0033-Modifiable-Bukkit-enums-Inject-runtime-versions-Mate.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 10 Jan 2024 20:36:05 +0100 4 | Subject: [PATCH] Modifiable Bukkit enums - Inject runtime versions - Material 5 | - Get key for Fiddle values 6 | 7 | Allows `Material.getKey()` to return the correct value for Fiddle values. 8 | 9 | This is done by adding a special case in the backing implementation of the `MaterialNameAndKeyConversion.keyCache`, 10 | that relies on a backing map. This backing map can be populated using the `registerFiddleEnumNameToNamespacedKey` method, 11 | which is called in the "Modifiable Bukkit enums - Inject runtime versions - Material - Register key for Fiddle values" patch in the `fiddle-server` module. 12 | 13 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 14 | Fiddle - https://fiddlemc.org 15 | 16 | diff --git a/src/main/java/org/fiddlemc/fiddle/material/MaterialNameAndKeyConversion.java b/src/main/java/org/fiddlemc/fiddle/material/MaterialNameAndKeyConversion.java 17 | index 95b8664aafb176bb549d376b7e248cf3e792de76..bbae3c95ffaf5697fd9509690d0953ce4b78badd 100644 18 | --- a/src/main/java/org/fiddlemc/fiddle/material/MaterialNameAndKeyConversion.java 19 | +++ b/src/main/java/org/fiddlemc/fiddle/material/MaterialNameAndKeyConversion.java 20 | @@ -21,12 +21,42 @@ public final class MaterialNameAndKeyConversion { 21 | throw new RuntimeException(); 22 | } 23 | 24 | + // Fiddle start - modifiable Bukkit enums - inject runtime versions - Material - keys for Fiddle values 25 | + private static @org.jetbrains.annotations.Nullable java.util.Map fiddleEnumNamesToNamespacedKey = new java.util.HashMap<>(0); 26 | + 27 | + public static void registerFiddleEnumNameToNamespacedKey(String enumName, String namespace, String path) { 28 | + if (fiddleEnumNamesToNamespacedKey == null) { 29 | + throw new IllegalStateException("Cannot register Fiddle enum name to namespaced key after the key cache has been filled"); 30 | + } 31 | + fiddleEnumNamesToNamespacedKey.put(enumName, new org.bukkit.NamespacedKey(namespace, path)); 32 | + } 33 | + // Fiddle end - modifiable Bukkit enums - inject runtime versions - Material - keys for Fiddle values 34 | + 35 | // Fiddle start - modifiable Bukkit enums - Material - remove hard-coded properties - key 36 | private static final CachedMaterialProperty keyCache = new CachedMaterialProperty<>( 37 | org.bukkit.NamespacedKey[]::new, 38 | - // Based on the original org.bukkit.Material constructor 39 | - material -> org.bukkit.NamespacedKey.minecraft(material.name().toLowerCase(java.util.Locale.ROOT)) 40 | - ); 41 | + // Fiddle start - modifiable Bukkit enums - inject runtime versions - Material - keys for Fiddle values 42 | + material -> { 43 | + if (fiddleEnumNamesToNamespacedKey != null) { 44 | + @org.jetbrains.annotations.Nullable org.bukkit.NamespacedKey fromFiddleEnumName = fiddleEnumNamesToNamespacedKey.get(material.name()); 45 | + if (fromFiddleEnumName != null) { 46 | + return fromFiddleEnumName; 47 | + } 48 | + } 49 | + // Based on the original org.bukkit.Material constructor 50 | + return org.bukkit.NamespacedKey.minecraft(material.name().toLowerCase(java.util.Locale.ROOT)); 51 | + } 52 | + ) { 53 | + 54 | + @Override 55 | + protected void initializeIfNecessary(boolean legacy) { 56 | + super.initializeIfNecessary(legacy); 57 | + // Clear the registered Fiddle enum names to namespaced keys 58 | + fiddleEnumNamesToNamespacedKey = null; 59 | + } 60 | + 61 | + }; 62 | + // Fiddle end - modifiable Bukkit enums - inject runtime versions - Material - keys for Fiddle values 63 | // Fiddle end - modifiable Bukkit enums - Material - remove hard-coded properties - key 64 | 65 | // Fiddle start - modifiable Bukkit enums - Material - remove hard-coded properties - getMaterial 66 | -------------------------------------------------------------------------------- /patches/server/0001-Fiddle-project-setup.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 24 Nov 2022 21:26:57 +0100 4 | Subject: [PATCH] Fiddle project setup 5 | 6 | Sets up the `fiddle-server` module build file correctly: 7 | * Remove Paper inter-module dependencies 8 | * Create a constant for the `fiddle-api` module name and depend on it 9 | * Re-add dependency on Paper MojangAPI (but externally this time) 10 | 11 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 12 | Fiddle - https://fiddlemc.org 13 | 14 | diff --git a/build.gradle.kts b/build.gradle.kts 15 | index 58da26ad2f128ba0b66f86820f60853f4be352f0..295855fca149e12c6bf976c6ff577084722c62c4 100644 16 | --- a/build.gradle.kts 17 | +++ b/build.gradle.kts 18 | @@ -12,9 +12,17 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { 19 | } 20 | val alsoShade: Configuration by configurations.creating 21 | 22 | +val apiProjectName = "fiddle-api" // Fiddle - project setup 23 | + 24 | dependencies { 25 | - implementation(project(":paper-api")) 26 | - implementation(project(":paper-mojangapi")) 27 | + // Fiddle start - project setup 28 | + // Depend on own API 29 | + implementation(project(":$apiProjectName")) 30 | + // Depend on Paper MojangAPI 31 | + implementation("io.papermc.paper:paper-mojangapi:1.20.3-R0.1-SNAPSHOT") { 32 | + exclude("io.papermc.paper", "paper-api") 33 | + } 34 | + // Fiddle end - project setup 35 | // Paper start 36 | implementation("org.jline:jline-terminal-jansi:3.21.0") 37 | implementation("net.minecrell:terminalconsoleappender:1.3.0") 38 | -------------------------------------------------------------------------------- /patches/server/0002-Dev-import-deobfuscation-fixes.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 12 Jul 2023 21:29:08 +0200 4 | Subject: [PATCH] Dev import deobfuscation fixes 5 | 6 | Contains all fixes to source code files after decompilation (that are then to be modified by Fiddle but not Paper), needed to make them function as intended again after re-compilation. 7 | 8 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 9 | Fiddle - https://fiddlemc.org 10 | 11 | diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundUpdateRecipesPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundUpdateRecipesPacket.java 12 | index ff6323bd5170359cf9c0d004aba68a792fa6a382..ddb04a1e7d50024ee2f3692bccf471509720f65e 100644 13 | --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundUpdateRecipesPacket.java 14 | +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundUpdateRecipesPacket.java 15 | @@ -44,9 +44,9 @@ public class ClientboundUpdateRecipesPacket implements Packet(resourceLocation2, recipe); 17 | } 18 | 19 | - public static > void toNetwork(FriendlyByteBuf buf, RecipeHolder recipe) { 20 | + public static > void toNetwork(FriendlyByteBuf buf, RecipeHolder recipe) { // Fiddle - dev import deobfuscation fixes 21 | buf.writeResourceLocation(BuiltInRegistries.RECIPE_SERIALIZER.getKey(recipe.value().getSerializer())); 22 | buf.writeResourceLocation(recipe.id()); 23 | - recipe.value().getSerializer().toNetwork(buf, recipe.value()); 24 | + ((net.minecraft.world.item.crafting.RecipeSerializer) recipe.value().getSerializer()).toNetwork(buf, recipe.value()); // Fiddle - dev import deobfuscation fixes 25 | } 26 | } 27 | diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java 28 | index 9a2de546dc2af2ad4bf5d32ca6583f0e1f3f70d8..4d5bc4d46fa90de1d89e15bd5dc053d22e07a3d9 100644 29 | --- a/src/main/java/net/minecraft/world/level/block/Blocks.java 30 | +++ b/src/main/java/net/minecraft/world/level/block/Blocks.java 31 | @@ -1215,7 +1215,7 @@ public class Blocks { 32 | } 33 | 34 | private static Boolean ocelotOrParrot(BlockState state, BlockGetter world, BlockPos pos, EntityType type) { 35 | - return (boolean)type == EntityType.OCELOT || type == EntityType.PARROT; 36 | + return type == EntityType.OCELOT || type == EntityType.PARROT; // Fiddle - dev import deobfuscation fixes 37 | } 38 | 39 | private static Block bed(DyeColor color) { 40 | -------------------------------------------------------------------------------- /patches/server/0003-Hide-irrelevant-compilation-warnings.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Tue, 29 Nov 2022 01:17:03 +0100 4 | Subject: [PATCH] Hide irrelevant compilation warnings 5 | 6 | Hides some compilation warnings. 7 | This is done because Paper code contains many instances that trigger these warnings, leading to them filling the terminal every time it is compiled, and making it harder to find errors among the wall of text. 8 | 9 | This patch has an analogous patch in `fiddle-api` with the same name. 10 | 11 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 12 | Fiddle - https://fiddlemc.org 13 | 14 | This patch is based on the following patch: 15 | "Hide irrelevant compilation warnings" 16 | By: Martijn Muijsers 17 | As part of: Gale (https://github.com/GaleMC/Gale) 18 | Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 19 | 20 | * Gale description * 21 | 22 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 23 | Gale - https://galemc.org 24 | 25 | diff --git a/build.gradle.kts b/build.gradle.kts 26 | index 76d18caa57c1ef9164d875bb9de74d53ca3334f8..da110b07ee815e8028f87783dc2e30ee16c96512 100644 27 | --- a/build.gradle.kts 28 | +++ b/build.gradle.kts 29 | @@ -65,6 +65,16 @@ dependencies { 30 | } 31 | 32 | val craftbukkitPackageVersion = "1_20_R3" // Paper 33 | + 34 | +// Fiddle start - hide irrelevant compilation warnings 35 | +tasks.withType { 36 | + val compilerArgs = options.compilerArgs 37 | + compilerArgs.add("-Xlint:-module") 38 | + compilerArgs.add("-Xlint:-removal") 39 | + compilerArgs.add("-Xlint:-dep-ann") 40 | +} 41 | +// Fiddle end - hide irrelevant compilation warnings 42 | + 43 | tasks.jar { 44 | archiveClassifier.set("dev") 45 | 46 | -------------------------------------------------------------------------------- /patches/server/0008-Fiddle-branding-changes-License-Package-into-jar.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Fri, 29 Dec 2023 12:23:23 +0100 4 | Subject: [PATCH] Fiddle branding changes - License - Package into jar 5 | 6 | Adds `LICENSE.txt` to built jar files. 7 | 8 | This patch has a parallel patch with the same purpose and name in `fiddle-api`. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | This patch is based on the following patch: 14 | "Gale branding changes" 15 | By: Martijn Muijsers 16 | As part of: Gale (https://github.com/GaleMC/Gale) 17 | Licensed (except for image files) under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 18 | 19 | * Gale description * 20 | 21 | Gale - https://galemc.org 22 | 23 | diff --git a/build.gradle.kts b/build.gradle.kts 24 | index 006420a7166426a091e5e6ec89d7b10d5f7c1490..83080dba1ead32117b3d2acd7f82c3aa274d9152 100644 25 | --- a/build.gradle.kts 26 | +++ b/build.gradle.kts 27 | @@ -231,3 +231,22 @@ tasks.registerRunTask("runDev") { 28 | classpath(runtimeClasspathForRunDev) 29 | jvmArgs("-DPaper.isRunDev=true") 30 | } 31 | + 32 | +// Fiddle start - branding changes - license - package into jar 33 | +tasks.register("copyLicense") { 34 | + from(layout.projectDirectory.file("LICENSE.txt")) 35 | + into(layout.buildDirectory.dir("tmp/copiedlicense")) 36 | +} 37 | + 38 | +tasks.processResources { 39 | + dependsOn("copyLicense") 40 | +} 41 | + 42 | +sourceSets { 43 | + main { 44 | + resources { 45 | + srcDir(layout.buildDirectory.dir("tmp/copiedlicense")) 46 | + } 47 | + } 48 | +} 49 | +// Fiddle end - branding changes - license - package into jar 50 | -------------------------------------------------------------------------------- /patches/server/0009-Fiddle-branding-changes-Load-Bukkit-version-from-Fid.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Fri, 29 Dec 2023 12:18:18 +0100 4 | Subject: [PATCH] Fiddle branding changes - Load Bukkit version from Fiddle 5 | pom.properties 6 | 7 | Looks up the Bukkit version that Fiddle was compiled against in the `pom.properties` for Fiddle, rather than that for Paper. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | This patch is based on the following patch: 13 | "Gale branding changes" 14 | By: Martijn Muijsers 15 | As part of: Gale (https://github.com/GaleMC/Gale) 16 | Licensed (except for image files) under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 17 | 18 | * Gale description * 19 | 20 | Gale - https://galemc.org 21 | 22 | diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java 23 | index 774556a62eb240da42e84db4502e2ed43495be17..1c09bc8e3df5eed8d3182d38a5c6ea73054dc381 100644 24 | --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java 25 | +++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java 26 | @@ -11,7 +11,7 @@ public final class Versioning { 27 | public static String getBukkitVersion() { 28 | String result = "Unknown-Version"; 29 | 30 | - InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties"); 31 | + InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.fiddlemc.fiddle/fiddle-api/pom.properties"); // Fiddle - branding changes - look up Bukkit version in Fiddle pom.properties 32 | Properties properties = new Properties(); 33 | 34 | if (stream != null) { 35 | -------------------------------------------------------------------------------- /patches/server/0011-Define-Fiddle-namespace.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 13 Jul 2023 18:08:05 +0200 4 | Subject: [PATCH] Define Fiddle namespace 5 | 6 | Adds a constant for the Fiddle namespace (for namespaced keys starting with `fiddle:`). 7 | Its value is based on `NamespacedKey.FIDDLE`, which is defined in the "Define Fiddle namespace" patch in the `fiddle-api` module. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java 13 | index 8921b1bc2c870222d145c73bac765169099763f1..ad8a5547b9aada223c5e87166c691dfd2be5552b 100644 14 | --- a/src/main/java/net/minecraft/resources/ResourceLocation.java 15 | +++ b/src/main/java/net/minecraft/resources/ResourceLocation.java 16 | @@ -27,6 +27,14 @@ public class ResourceLocation implements Comparable { 17 | public static final String DEFAULT_NAMESPACE = "minecraft"; 18 | public static final String REALMS_NAMESPACE = "realms"; 19 | public static final String PAPER_NAMESPACE = "paper"; // Paper 20 | + // Fiddle start - define Fiddle namespace 21 | + /** 22 | + * The namespace for Fiddle {@link ResourceLocation}s. 23 | + * This is for {@link ResourceLocation}s that are defined by and belong to Fiddle itself, 24 | + * not those of packs that are loaded by Fiddle (content in those packs uses its own namespaces). 25 | + */ 26 | + public static final String FIDDLE_NAMESPACE = org.bukkit.NamespacedKey.FIDDLE; 27 | + // Fiddle end - define Fiddle namespace 28 | private final String namespace; 29 | private final String path; 30 | 31 | -------------------------------------------------------------------------------- /patches/server/0013-Configuration-Get-Fiddle-configuration-with-Bukkit-A.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 1 Jun 2023 19:30:16 +0200 4 | Subject: [PATCH] Configuration - Get Fiddle configuration with Bukkit API 5 | 6 | Allows getting the Fiddle configuration using the Bukkit API. 7 | This is done by having `CraftServer` implement `Server.getFiddleConfig()`, which is defined in the "Configuration - Get Fiddle configuration with Bukkit API" patch in the `fiddle-api` module. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | This patch is based on the following patch: 13 | "Gale configuration" 14 | By: Martijn Muijsers 15 | As part of: Gale (https://github.com/GaleMC/Gale) 16 | Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 17 | 18 | * Gale description * 19 | 20 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 21 | Gale - https://galemc.org 22 | 23 | This patch is based on the following patch: 24 | "Paper config files" 25 | By: Jake Potrebic 26 | As part of: Paper (https://github.com/PaperMC/Paper) 27 | Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 28 | 29 | diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java 30 | index 72e11546902a6e37decb2b37811383a030045525..d1325d3e3ad3e946bd266fae91efa7b96d7d3ee7 100644 31 | --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java 32 | +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java 33 | @@ -3014,6 +3014,14 @@ public final class CraftServer implements Server { 34 | return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console); 35 | } 36 | 37 | + // Fiddle start - Fiddle configuration - API 38 | + @Override 39 | + public YamlConfiguration getFiddleConfig() 40 | + { 41 | + return org.fiddlemc.fiddle.configuration.FiddleConfigurations.get(null).createLegacyObject(CraftServer.this.console); 42 | + } 43 | + // Fiddle end - Fiddle configuration - API 44 | + 45 | @Override 46 | public void restart() { 47 | org.spigotmc.RestartCommand.restart(); 48 | -------------------------------------------------------------------------------- /patches/server/0014-Configuration-Include-Fiddle-configuration-in-timing.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Tue, 18 Jul 2023 20:11:18 +0200 4 | Subject: [PATCH] Configuration - Include Fiddle configuration in timings 5 | export 6 | 7 | Adds the content of the Fiddle configuration files to timings exports, just like the Bukkit, Spigot and Paper configurations. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | This patch is based on the following patch: 13 | "Gale configuration" 14 | By: Martijn Muijsers 15 | As part of: Gale (https://github.com/GaleMC/Gale) 16 | Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 17 | 18 | * Gale description * 19 | 20 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 21 | Gale - https://galemc.org 22 | 23 | This patch is based on the following patch: 24 | "Paper config files" 25 | By: Jake Potrebic 26 | As part of: Paper (https://github.com/PaperMC/Paper) 27 | Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 28 | 29 | diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java 30 | index 7620c72a4c243cbeea245203ce03a97cbfa7d922..81186ff818d983672ae67b0005fa45d6b2454776 100644 31 | --- a/src/main/java/co/aikar/timings/TimingsExport.java 32 | +++ b/src/main/java/co/aikar/timings/TimingsExport.java 33 | @@ -240,7 +240,10 @@ public class TimingsExport extends Thread { 34 | parent.put("config", createObject( 35 | pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)), 36 | pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)), 37 | - pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)) 38 | + // Fiddle start - Fiddle configuration - include in timings 39 | + pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)), 40 | + pair("fiddle", mapAsJSON(Bukkit.spigot().getFiddleConfig(), null)) 41 | + // Fiddle end - Fiddle configuration - include in timings 42 | )); 43 | 44 | new TimingsExport(listeners, parent, history).start(); 45 | -------------------------------------------------------------------------------- /patches/server/0015-Material-fixes-Add-missing-values-to-hasGravity.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 10 Jul 2023 22:05:08 +0200 4 | Subject: [PATCH] Material fixes - Add missing values to hasGravity 5 | 6 | Fixes the unit test for `Material.hasGravity`, as it was missing support for some falling blocks: 7 | * Blocks that were an instance of `FallingBlock` but not `Fallable` 8 | * Blocks that were an instance of `ScaffoldingBlock` 9 | 10 | This makes the unit test work for the missing `Material` values added in the "Material fixes - Add missing values to hasGravity" patch in the `fiddle-api` module. 11 | 12 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 13 | Fiddle - https://fiddlemc.org 14 | 15 | diff --git a/src/test/java/org/bukkit/PerMaterialTest.java b/src/test/java/org/bukkit/PerMaterialTest.java 16 | index 9dab4e713b9bc628872867c218fe0ebeca0b958f..d2f7d3d2a690a31c6dc926fc9e5f7b51bdbd9aab 100644 17 | --- a/src/test/java/org/bukkit/PerMaterialTest.java 18 | +++ b/src/test/java/org/bukkit/PerMaterialTest.java 19 | @@ -165,7 +165,10 @@ public class PerMaterialTest extends AbstractTestingBase { 20 | @EnumSource(value = Material.class, names = "LEGACY_.*", mode = EnumSource.Mode.MATCH_NONE) 21 | public void hasGravity(Material material) { 22 | if (material.isBlock()) { 23 | - assertThat(material.hasGravity(), is(CraftMagicNumbers.getBlock(material) instanceof FallingBlock)); 24 | + // Fiddle start - add missing Material values with gravity 25 | + var block = CraftMagicNumbers.getBlock(material); 26 | + assertThat(material.hasGravity(), is(block instanceof net.minecraft.world.level.block.Fallable || block instanceof net.minecraft.world.level.block.ScaffoldingBlock)); 27 | + // Fiddle end - add missing Material values with gravity 28 | } else { 29 | assertFalse(material.hasGravity()); 30 | } 31 | -------------------------------------------------------------------------------- /patches/server/0016-Create-eula.txt-before-bootstrap.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Fri, 14 Apr 2023 17:05:19 +0200 4 | Subject: [PATCH] Create eula.txt before bootstrap 5 | 6 | Moves the `eula.txt` file creation to before the server bootstrap (which includes, amongst others, `Bootstrap.bootStrap`). 7 | 8 | This makes sure the server owner first can deal with accepting the EULA before dealing with anything going wrong during bootstrapping when the server is first started (for example, because there are Fiddle packs with errors present already, or because a plugin causes an error during bootstrapping). 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java 14 | index 5664ff92d13767755241d3c5e3d77a8c76965d54..7e33bdeafcd1ac2c55dd56d5cb06743c2c053eab 100644 15 | --- a/src/main/java/net/minecraft/server/Main.java 16 | +++ b/src/main/java/net/minecraft/server/Main.java 17 | @@ -128,6 +128,11 @@ public class Main { 18 | JvmProfiler.INSTANCE.start(Environment.SERVER); 19 | } 20 | 21 | + // Fiddle start - create eula.txt before bootstrap 22 | + Path path2 = Paths.get("eula.txt"); 23 | + Eula eula = new Eula(path2); 24 | + // Fiddle end - create eula.txt before bootstrap 25 | + 26 | // Fiddle start - Fiddle configuration - load Fiddle global configuration before bootstrap 27 | var fiddleConfigurations = org.fiddlemc.fiddle.configuration.FiddleConfigurations.get(optionset); 28 | fiddleConfigurations.initializeGlobalConfiguration(null); 29 | @@ -141,8 +146,6 @@ public class Main { 30 | DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support 31 | 32 | dedicatedserversettings.forceSave(); 33 | - Path path2 = Paths.get("eula.txt"); 34 | - Eula eula = new Eula(path2); 35 | // Paper start - load config files early for access below if needed 36 | org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("bukkit-settings")); 37 | org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("spigot-settings")); 38 | -------------------------------------------------------------------------------- /patches/server/0017-Main-server-entry-point-can-be-exited-gracefully.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Fri, 9 Feb 2024 18:24:10 +0100 4 | Subject: [PATCH] Main server entry point can be exited gracefully 5 | 6 | This ends a `Throwable` catching try-clause around the code that follows the main server initialization procedures, 7 | so that if an exception occurs there, it is ignored. 8 | This is so that when the actual server initialization procedure crashes (printing an exception) or fails gracefully 9 | after logging an informative message, it is not followed by an unimportant stack trace (particularly of the post-processing 10 | code failing in some way as a result of the main server initialization having failed). This makes it easier for server 11 | owners to find the information that is relevant to the actual failure, since it will be at the end of the log. 12 | 13 | For example, this is relevant when the server initialization fails due to a lack of the confirmation that is made necessary 14 | by the "Require confirming Fiddle permanence" patch. 15 | 16 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 17 | Fiddle - https://fiddlemc.org 18 | 19 | diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java 20 | index ce341f42b3a5e17fb6d1f7de8057e73137ae2a6e..8a9b68705bfe61dbcdac91d64a0ec390b42c02f7 100644 21 | --- a/src/main/java/org/bukkit/craftbukkit/Main.java 22 | +++ b/src/main/java/org/bukkit/craftbukkit/Main.java 23 | @@ -327,6 +327,7 @@ public class Main { 24 | } catch (Throwable t) { 25 | t.printStackTrace(); 26 | } 27 | + try { // Fiddle - main entry point can be exited gracefully 28 | // Paper start 29 | // load some required classes to avoid errors during shutdown if jar is replaced 30 | // also to guarantee our version loads over plugins 31 | @@ -371,6 +372,10 @@ public class Main { 32 | tryPreloadClass(net.minecraft.util.ExceptionCollector.class.getName()); 33 | tryPreloadClass(io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.PlayerChunkLoaderData.class.getName()); 34 | // Paper end 35 | + // Fiddle start - main entry point can be exited gracefully 36 | + } catch (Throwable ignored) { 37 | + } 38 | + // Fiddle end - main entry point can be exited gracefully 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /patches/server/0024-Flag-for-vanilla-blocks-items-and-block-states-Bukki.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 3 Jan 2024 18:21:17 +0100 4 | Subject: [PATCH] Flag for vanilla blocks, items and block states - Bukkit API 5 | 6 | Implements Bukkit API for the flags added in "Flag for vanilla blocks, items and block states - Create". 7 | This is done by implementing `UnsafeValues.isVanillaBlock()`, `UnsafeValues.isVanillaItem()` and `BlockData.isVanilla()`, which are defined in the "Flag for vanilla blocks, items and block states - Bukkit API" patch in the `fiddle-api` module. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java 13 | index d6480b44f94f1a8d21eb5b5ded2956889883c560..2c12037457fe243a1bbf6e91a341f8290a5661c5 100644 14 | --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java 15 | +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java 16 | @@ -756,4 +756,12 @@ public class CraftBlockData implements BlockData { 17 | return this.state.isRandomlyTicking(); 18 | } 19 | // Paper end - Block tick API 20 | + 21 | + // Fiddle start - flags for vanilla content - API - block state 22 | + @Override 23 | + public boolean isVanilla() { 24 | + return this.state.isVanilla(); 25 | + } 26 | + // Fiddle end - flags for vanilla content - API - block state 27 | + 28 | } 29 | diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java 30 | index be3727c2c0c1fcb71d4af51caef02a27d6087fb9..c9741e4d0b5a228c0f3251a9af45e53b2c2da068 100644 31 | --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java 32 | +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java 33 | @@ -688,6 +688,22 @@ public final class CraftMagicNumbers implements UnsafeValues { 34 | } 35 | // Paper end - lifecycle event API 36 | 37 | + // Fiddle start - flags for vanilla content - API - block 38 | + @Override 39 | + public boolean isVanillaBlock(Material material) { 40 | + var block = CraftMagicNumbers.getBlock(material); 41 | + return block != null && block.isVanilla(); 42 | + } 43 | + // Fiddle end - flags for vanilla content - API - block 44 | + 45 | + // Fiddle start - flags for vanilla content - API - item 46 | + @Override 47 | + public boolean isVanillaItem(Material material) { 48 | + var item = CraftMagicNumbers.getItem(material); 49 | + return item != null && item.isVanilla(); 50 | + } 51 | + // Fiddle end - flags for vanilla content - API - item 52 | + 53 | /** 54 | * This helper class represents the different NBT Tags. 55 | *

56 | -------------------------------------------------------------------------------- /patches/server/0028-Modded-registries-Register-item-blocks-from-item-reg.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 3 Jan 2024 18:58:37 +0100 4 | Subject: [PATCH] Modded registries - Register item blocks from item registry 5 | 6 | Moves the pre-register operation of registering the blocks for a `BlockItem` with `BlockItem.registerBlocks`, from the `Items.registerItem` method to the `ItemRegistry.register` method. 7 | 8 | This means this operation is performed for all `BlockItem` instances that are registered, not only the vanilla items defined in `Items`. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | diff --git a/src/main/java/net/minecraft/world/item/Items.java b/src/main/java/net/minecraft/world/item/Items.java 14 | index 1cc0c79ea3df283a1713eb5ed24d47090b8613df..6f2e493b6cf06fcb17e2f0ae3117043bfdfdf454 100644 15 | --- a/src/main/java/net/minecraft/world/item/Items.java 16 | +++ b/src/main/java/net/minecraft/world/item/Items.java 17 | @@ -1364,10 +1364,6 @@ public class Items { 18 | 19 | public static Item registerItem(ResourceKey key, Item item) { 20 | item.setVanilla(); // Fiddle - flags for vanilla content - item 21 | - if (item instanceof BlockItem) { 22 | - ((BlockItem)item).registerBlocks(Item.BY_BLOCK, item); 23 | - } 24 | - 25 | return Registry.register(BuiltInRegistries.ITEM, key, item); 26 | } 27 | } 28 | diff --git a/src/main/java/org/fiddlemc/fiddle/registry/ItemRegistry.java b/src/main/java/org/fiddlemc/fiddle/registry/ItemRegistry.java 29 | index b8dfbb9de0ef985ded97354bc59f2f222c127714..fecbb98b829bd0be3489b5a717fd3645f9df14f9 100644 30 | --- a/src/main/java/org/fiddlemc/fiddle/registry/ItemRegistry.java 31 | +++ b/src/main/java/org/fiddlemc/fiddle/registry/ItemRegistry.java 32 | @@ -25,6 +25,13 @@ public final class ItemRegistry extends DefaultedMappedRegistry { 33 | // Register the entry 34 | var reference = super.register(key, entry, lifecycle); 35 | 36 | + // Fiddle start - modded registries - register item blocks from item registry 37 | + // Register the item by its blocks if applicable 38 | + if (entry instanceof net.minecraft.world.item.BlockItem blockItem) { 39 | + blockItem.registerBlocks(Item.BY_BLOCK, entry); 40 | + } 41 | + // Fiddle end - modded registries - register item blocks from item registry 42 | + 43 | // Return the reference 44 | return reference; 45 | 46 | -------------------------------------------------------------------------------- /patches/server/0030-Modded-registries-Vanilla-only-registries-Verify-num.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 3 Jan 2024 18:07:50 +0100 4 | Subject: [PATCH] Modded registries - Vanilla-only registries - Verify number 5 | of vanilla blocks, items and block states 6 | 7 | Adds a check after the freezing of the registries that verifies that the correct number of vanilla blocks and items have been registered, 8 | by comparing the size of the registries to their expected sizes. 9 | 10 | This is done to prevent the server from starting when modded blocks and items have been erroneously marked as vanilla. 11 | This would lead to problems when sending packets to clients that expect vanilla block and item ids. 12 | 13 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 14 | Fiddle - https://fiddlemc.org 15 | 16 | diff --git a/src/main/java/net/minecraft/server/WorldLoader.java b/src/main/java/net/minecraft/server/WorldLoader.java 17 | index 56533ed64026f8824a40057fdc488cd237a3187c..9c6933a8a49cc20ddb31a2bc65e1135bbdb09bac 100644 18 | --- a/src/main/java/net/minecraft/server/WorldLoader.java 19 | +++ b/src/main/java/net/minecraft/server/WorldLoader.java 20 | @@ -35,6 +35,17 @@ public class WorldLoader { 21 | WorldLoader.DataLoadOutput dataLoadOutput = loadContextSupplier.get(new WorldLoader.DataLoadContext(closeableResourceManager, worldDataConfiguration, frozen, frozen2)); 22 | LayeredRegistryAccess layeredRegistryAccess3 = layeredRegistryAccess2.replaceFrom(RegistryLayer.DIMENSIONS, dataLoadOutput.finalDimensions); 23 | RegistryAccess.Frozen frozen3 = layeredRegistryAccess3.getAccessForLoading(RegistryLayer.RELOADABLE); 24 | + // Fiddle start - modded registries - vanilla-only registries - verify number of vanilla blocks and items 25 | + if (net.minecraft.world.level.block.Block.VANILLA_ONLY_BLOCK_REGISTRY.size() != 1058) { 26 | + throw new IllegalStateException("The number of registered vanilla blocks is incorrect. The following " + net.minecraft.world.level.block.Block.VANILLA_ONLY_BLOCK_REGISTRY.size() + " blocks were registered as vanilla: " + java.util.stream.StreamSupport.stream(net.minecraft.world.level.block.Block.VANILLA_ONLY_BLOCK_REGISTRY.spliterator(), false).toList()); 27 | + } 28 | + if (net.minecraft.world.item.Item.VANILLA_ONLY_ITEM_REGISTRY.size() != 1312) { 29 | + throw new IllegalStateException("The number of registered vanilla items is incorrect. The following " + net.minecraft.world.item.Item.VANILLA_ONLY_ITEM_REGISTRY.size() + " items were registered as vanilla: " + java.util.stream.StreamSupport.stream(net.minecraft.world.item.Item.VANILLA_ONLY_ITEM_REGISTRY.spliterator(), false).toList()); 30 | + } 31 | + if (net.minecraft.world.level.block.Block.VANILLA_ONLY_BLOCK_STATE_REGISTRY.size() != 26644) { 32 | + throw new IllegalStateException("The number of registered vanilla block states is incorrect. The following " + net.minecraft.world.level.block.Block.VANILLA_ONLY_BLOCK_STATE_REGISTRY.size() + " block states were registered as vanilla: " + java.util.stream.StreamSupport.stream(net.minecraft.world.level.block.Block.VANILLA_ONLY_BLOCK_STATE_REGISTRY.spliterator(), false).toList()); 33 | + } 34 | + // Fiddle end - modded registries - vanilla-only registries - verify number of vanilla blocks and items 35 | return ReloadableServerResources.loadResources(closeableResourceManager, frozen3, worldDataConfiguration.enabledFeatures(), serverConfig.commandSelection(), serverConfig.functionCompilationLevel(), prepareExecutor, applyExecutor).whenComplete((dataPackContents, throwable) -> { 36 | if (throwable != null) { 37 | closeableResourceManager.close(); 38 | -------------------------------------------------------------------------------- /patches/server/0031-Create-unit-test-classes-for-Block-and-Item.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sun, 16 Jul 2023 13:01:20 +0200 4 | Subject: [PATCH] Create unit test classes for Block and Item 5 | 6 | Creates unit test classes `PerBlockTest` and `PerItemTest` for tests related to respectively the `Block` and `Item` classes. 7 | Does not add any tests: these are added in subsequent patches. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | diff --git a/src/test/java/org/fiddlemc/fiddle/block/PerBlockTest.java b/src/test/java/org/fiddlemc/fiddle/block/PerBlockTest.java 13 | new file mode 100644 14 | index 0000000000000000000000000000000000000000..d7d99910630a7e8267352b734bc2eee6c91982f6 15 | --- /dev/null 16 | +++ b/src/test/java/org/fiddlemc/fiddle/block/PerBlockTest.java 17 | @@ -0,0 +1,18 @@ 18 | +// Fiddle - tests related to net.minecraft.world.level.block.Block 19 | + 20 | +package org.fiddlemc.fiddle.block; 21 | + 22 | +import net.minecraft.core.registries.BuiltInRegistries; 23 | +import net.minecraft.world.level.block.Block; 24 | +import org.bukkit.support.AbstractTestingBase; 25 | +import org.junit.jupiter.api.Test; 26 | + 27 | +import static org.junit.jupiter.api.Assertions.*; 28 | + 29 | +public class PerBlockTest extends AbstractTestingBase { 30 | + 31 | + private Iterable getBlocks() { 32 | + return BuiltInRegistries.BLOCK; 33 | + } 34 | + 35 | +} 36 | diff --git a/src/test/java/org/fiddlemc/fiddle/item/PerItemTest.java b/src/test/java/org/fiddlemc/fiddle/item/PerItemTest.java 37 | new file mode 100644 38 | index 0000000000000000000000000000000000000000..911160beec65ff1d865e068f8ad817d6b533ebda 39 | --- /dev/null 40 | +++ b/src/test/java/org/fiddlemc/fiddle/item/PerItemTest.java 41 | @@ -0,0 +1,18 @@ 42 | +// Fiddle - tests related to net.minecraft.world.item.Item 43 | + 44 | +package org.fiddlemc.fiddle.item; 45 | + 46 | +import net.minecraft.core.registries.BuiltInRegistries; 47 | +import net.minecraft.world.item.Item; 48 | +import org.bukkit.support.AbstractTestingBase; 49 | +import org.junit.jupiter.api.Test; 50 | + 51 | +import static org.junit.jupiter.api.Assertions.*; 52 | + 53 | +public class PerItemTest extends AbstractTestingBase { 54 | + 55 | + private Iterable getItems() { 56 | + return BuiltInRegistries.ITEM; 57 | + } 58 | + 59 | +} 60 | -------------------------------------------------------------------------------- /patches/server/0035-Modifiable-Bukkit-enums-Complete-legacy-conversion-C.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 8 Jan 2024 19:26:23 +0100 4 | Subject: [PATCH] Modifiable Bukkit enums - Complete legacy conversion - 5 | Conversion is explicitly for item or block - Expose Bukkit API 6 | 7 | Has `CraftMagicNumbers` implement `UnsafeValues.fromLegacy(Material, boolean`), 8 | which is defined in the "Modifiable Bukkit enums - Complete legacy conversion - Conversion is explicitly for item or block - Expose Bukkit API" patch in the `fiddle-api` module. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java 14 | index 2b385909268285140b58c01b03f57e4422486612..6a8e622aa58fea296a293ab9b654f6194d28b71f 100644 15 | --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java 16 | +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java 17 | @@ -235,6 +235,13 @@ public final class CraftMagicNumbers implements UnsafeValues { 18 | return this.fromLegacy(material, false); // Fiddle - modifiable Bukkit enums - Material - make legacy conversion complete - conversion is explicitly for item or block 19 | } 20 | 21 | + // Fiddle end - modifiable Bukkit enums - Material - make legacy conversion complete 22 | + @Override 23 | + public Material fromLegacy(Material material, boolean itemPriority) { 24 | + return CraftLegacy.fromLegacy(material, itemPriority); 25 | + } 26 | + // Fiddle end - modifiable Bukkit enums - Material - make legacy conversion complete 27 | + 28 | @Override 29 | public Material fromLegacy(MaterialData material) { 30 | return this.fromLegacy(material, false); // Fiddle - modifiable Bukkit enums - Material - make legacy conversion complete - conversion is explicitly for item or block 31 | -------------------------------------------------------------------------------- /patches/server/0036-Modifiable-Bukkit-enums-Complete-legacy-conversion-A.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 8 Jan 2024 18:52:59 +0100 4 | Subject: [PATCH] Modifiable Bukkit enums - Complete legacy conversion - Add 5 | missing conversions 6 | 7 | Makes sure that every legacy `Material` can be converted to a non-legacy non-`AIR` (except if the original is `LEGACY_AIR`) `Material`. 8 | 9 | Specifically, fixes the following legacy conversions: 10 | * Skulls 11 | * Long grass and its variants 12 | 13 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 14 | Fiddle - https://fiddlemc.org 15 | 16 | diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java 17 | index d9f731d605add107c0235c8f8db009bb924fb8a2..d8397264eadaae9ea5e0f6865d9a10ed450a36b6 100644 18 | --- a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java 19 | +++ b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java 20 | @@ -424,6 +424,67 @@ public final class CraftLegacy { 21 | itemToMaterial.put(newMaterial, matData); 22 | } 23 | } 24 | + 25 | + // Fiddle start - modifiable Bukkit enums - Material - make legacy conversion complete - add LEGACY_SKULL 26 | + for (byte data = 0; data < 16; data++) { 27 | + var materialData = new MaterialData(Material.LEGACY_SKULL, data); 28 | + Item nonLegacyItem; 29 | + Block nonLegacyBlock; 30 | + switch (data) { 31 | + case 1 -> { 32 | + nonLegacyItem = Items.WITHER_SKELETON_SKULL; 33 | + nonLegacyBlock = Blocks.WITHER_SKELETON_SKULL; 34 | + } 35 | + case 2 -> { 36 | + nonLegacyItem = Items.ZOMBIE_HEAD; 37 | + nonLegacyBlock = Blocks.ZOMBIE_HEAD; 38 | + } 39 | + case 3 -> { 40 | + nonLegacyItem = Items.PLAYER_HEAD; 41 | + nonLegacyBlock = Blocks.PLAYER_HEAD; 42 | + } 43 | + case 4 -> { 44 | + nonLegacyItem = Items.CREEPER_HEAD; 45 | + nonLegacyBlock = Blocks.CREEPER_HEAD; 46 | + } 47 | + case 5 -> { 48 | + nonLegacyItem = Items.DRAGON_HEAD; 49 | + nonLegacyBlock = Blocks.DRAGON_HEAD; 50 | + } 51 | + default -> { 52 | + nonLegacyItem = Items.SKELETON_SKULL; 53 | + nonLegacyBlock = Blocks.SKELETON_SKULL; 54 | + } 55 | + } 56 | + materialToItem.put(materialData, nonLegacyItem); 57 | + materialToBlock.put(materialData, nonLegacyBlock); 58 | + } 59 | + // Fiddle end - modifiable Bukkit enums - Material - make legacy conversion complete - add LEGACY_SKULL 60 | + 61 | + // Fiddle start - modifiable Bukkit enums - Material - make legacy conversion complete - ensure correct LEGACY_LONG_GRASS 62 | + for (byte data = 0; data < 16; data++) { 63 | + var materialData = new MaterialData(Material.LEGACY_LONG_GRASS, data); 64 | + Item nonLegacyItem; 65 | + Block nonLegacyBlock; 66 | + switch (data) { 67 | + case 1 -> { 68 | + nonLegacyItem = Items.SHORT_GRASS; 69 | + nonLegacyBlock = Blocks.SHORT_GRASS; 70 | + } 71 | + case 2 -> { 72 | + nonLegacyItem = Items.FERN; 73 | + nonLegacyBlock = Blocks.FERN; 74 | + } 75 | + default -> { 76 | + nonLegacyItem = Items.DEAD_BUSH; 77 | + nonLegacyBlock = Blocks.DEAD_BUSH; 78 | + } 79 | + } 80 | + materialToItem.put(materialData, nonLegacyItem); 81 | + materialToBlock.put(materialData, nonLegacyBlock); 82 | + } 83 | + // Fiddle end - modifiable Bukkit enums - Material - make legacy conversion complete - ensure correct LEGACY_LONG_GRASS 84 | + 85 | } 86 | 87 | public static void main(String[] args) { 88 | -------------------------------------------------------------------------------- /patches/server/0041-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 10 Jul 2023 22:05:08 +0200 4 | Subject: [PATCH] Modifiable Bukkit enums - Remove hard-coded properties - 5 | Material - Key 6 | 7 | Adds a test for equality between `Material.getKey` and its original backing implementation. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | diff --git a/src/test/java/org/fiddlemc/fiddle/material/legacy/PerNonLegacyMaterialTest.java b/src/test/java/org/fiddlemc/fiddle/material/legacy/PerNonLegacyMaterialTest.java 13 | index f11b7d202160a598ab2d431960d02791f3abcb28..a7e3252b9e4c1d8a218500adc58744335cc636e3 100644 14 | --- a/src/test/java/org/fiddlemc/fiddle/material/legacy/PerNonLegacyMaterialTest.java 15 | +++ b/src/test/java/org/fiddlemc/fiddle/material/legacy/PerNonLegacyMaterialTest.java 16 | @@ -35,6 +35,15 @@ public class PerNonLegacyMaterialTest extends AbstractTestingBase { 17 | } 18 | } 19 | 20 | + // Fiddle start - modifiable Bukkit enums - Material - remove hard-coded properties - key 21 | + @Test 22 | + public void getKey() { 23 | + for (Material material : getMaterials()) { 24 | + assertEquals(org.bukkit.NamespacedKey.minecraft(material.name().toLowerCase(java.util.Locale.ROOT)), material.getKey(), "getKey is incorrect for " + material); 25 | + } 26 | + } 27 | + // Fiddle end - modifiable Bukkit enums - Material - remove hard-coded properties - key 28 | + 29 | // Fiddle start - modifiable Bukkit enums - Material - remove hard-coded properties - max stack size 30 | @Test 31 | public void getMaxStackSize() { 32 | -------------------------------------------------------------------------------- /patches/server/0043-Modifiable-Bukkit-enums-Remove-hard-coded-properties.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 10 Jul 2023 22:05:08 +0200 4 | Subject: [PATCH] Modifiable Bukkit enums - Remove hard-coded properties - 5 | Material - Id 6 | 7 | Adds a test for equality between `Material.getId` and its original backing implementation. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | diff --git a/src/test/java/org/fiddlemc/fiddle/material/legacy/PerLegacyMaterialTest.java b/src/test/java/org/fiddlemc/fiddle/material/legacy/PerLegacyMaterialTest.java 13 | index 022aef4cd7634687da9847565b0e12bc53c49477..3827b9eb00a00173ad6a65c8a12ad91d594e6586 100644 14 | --- a/src/test/java/org/fiddlemc/fiddle/material/legacy/PerLegacyMaterialTest.java 15 | +++ b/src/test/java/org/fiddlemc/fiddle/material/legacy/PerLegacyMaterialTest.java 16 | @@ -36,6 +36,16 @@ public class PerLegacyMaterialTest extends AbstractTestingBase { 17 | } 18 | } 19 | 20 | + // Fiddle start - modifiable Bukkit enums - Material - remove hard-coded properties - id 21 | + @Test 22 | + @SuppressWarnings("deprecation") 23 | + public void getId() { 24 | + for (Material material : getMaterials()) { 25 | + assertEquals(material.getIdLegacy(), material.getId(), "getId does not equal legacy getId for " + material); 26 | + } 27 | + } 28 | + // Fiddle end - modifiable Bukkit enums - Material - remove hard-coded properties - id 29 | + 30 | // Fiddle start - modifiable Bukkit enums - Material - remove hard-coded properties - max stack size 31 | @Test 32 | public void getMaxStackSize() { 33 | -------------------------------------------------------------------------------- /patches/server/0044-Modifiable-Bukkit-enums-Inject-runtime-versions-Add-.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 10 Jul 2023 22:05:08 +0200 4 | Subject: [PATCH] Modifiable Bukkit enums - Inject runtime versions - Add 5 | module opens 6 | 7 | Add module opens, to both the server JAR and to development runs, 8 | that are needed to perform internal operations on the system class loader. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | diff --git a/build.gradle.kts b/build.gradle.kts 14 | index 83080dba1ead32117b3d2acd7f82c3aa274d9152..8ba9e9577dbc8cc597183fe5647335cfa76891c5 100644 15 | --- a/build.gradle.kts 16 | +++ b/build.gradle.kts 17 | @@ -86,6 +86,7 @@ tasks.jar { 18 | val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper 19 | attributes( 20 | "Main-Class" to "org.bukkit.craftbukkit.Main", 21 | + "Add-Opens" to "java.base/java.lang", // Fiddle - modifiable Bukkit enums - inject runtime versions - add module opens to server jar 22 | "Implementation-Title" to "CraftBukkit", 23 | "Implementation-Version" to "git-Fiddle-$implementationVersion", // Fiddle - branding changes - rename server brand 24 | "Implementation-Vendor" to date, // Paper 25 | @@ -195,6 +196,7 @@ fun TaskContainer.registerRunTask( 26 | val memoryGb = providers.gradleProperty("paper.runMemoryGb").getOrElse("2") 27 | minHeapSize = "${memoryGb}G" 28 | maxHeapSize = "${memoryGb}G" 29 | + jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED") // Fiddle - modifiable Bukkit enums - inject runtime versions - add module opens to development runs 30 | 31 | doFirst { 32 | workingDir.mkdirs() 33 | -------------------------------------------------------------------------------- /patches/server/0045-Modifiable-Bukkit-enums-Inject-runtime-versions-Depe.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 12 Jul 2023 16:19:44 +0200 4 | Subject: [PATCH] Modifiable Bukkit enums - Inject runtime versions - Depend on 5 | ByteBuddy 6 | 7 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 8 | Fiddle - https://fiddlemc.org 9 | 10 | diff --git a/build.gradle.kts b/build.gradle.kts 11 | index e6da4f6be4b6776e88fd7c2c5d77ad4d30c4418b..a6642f9992bacca9d1b5f523062e10987e0c1f31 100644 12 | --- a/build.gradle.kts 13 | +++ b/build.gradle.kts 14 | @@ -62,6 +62,8 @@ dependencies { 15 | testImplementation("org.junit.jupiter:junit-jupiter:5.10.0") 16 | testImplementation("org.hamcrest:hamcrest:2.2") 17 | testImplementation("org.mockito:mockito-core:5.5.0") 18 | + 19 | + implementation("net.bytebuddy:byte-buddy:1.14.12") // Fiddle - modifiable Bukkit enums - inject runtime versions - depend on ByteBuddy 20 | } 21 | 22 | val craftbukkitPackageVersion = "1_20_R3" // Paper 23 | -------------------------------------------------------------------------------- /patches/server/0048-Modifiable-Bukkit-enums-Inject-runtime-versions-Mate.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 13 Jul 2023 19:54:12 +0200 4 | Subject: [PATCH] Modifiable Bukkit enums - Inject runtime versions - Material 5 | - Register key for Fiddle values 6 | 7 | Registers the namespaced keys of Fiddle `Material` instances so that they can be returned by `Material.getKey()`, 8 | by calling the corresponding method added by the "Modifiable Bukkit enums - Inject runtime versions - Material - Get key for Fiddle values" patch in the `fiddle-api` module. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java 14 | index b041da597f1cb13775d889a1ba94264908925224..4364c96c511ba2ea9bc66e6e3360730bc423bb0b 100644 15 | --- a/src/main/java/net/minecraft/server/Main.java 16 | +++ b/src/main/java/net/minecraft/server/Main.java 17 | @@ -237,6 +237,11 @@ public class Main { 18 | }).build()) 19 | .make() 20 | .load(ClassLoader.getSystemClassLoader(), net.bytebuddy.dynamic.loading.ClassLoadingStrategy.Default.INJECTION); 21 | + // Fiddle start - modifiable Bukkit enums - inject runtime versions - Material - keys for Fiddle values 22 | + for (var fiddleEnumName : fiddleEnumNames) { 23 | + org.fiddlemc.fiddle.material.MaterialNameAndKeyConversion.registerFiddleEnumNameToNamespacedKey(fiddleEnumName.left(), fiddleEnumName.right().getNamespace(), fiddleEnumName.right().getPath()); 24 | + } 25 | + // Fiddle end - modifiable Bukkit enums - inject runtime versions - Material - keys for Fiddle values 26 | // Fiddle end - modifiable Bukkit enums - inject runtime versions - Material 27 | 28 | dedicatedserversettings.forceSave(); 29 | -------------------------------------------------------------------------------- /patches/server/0049-Modifiable-Bukkit-enums-Material-Link-to-backing-imp.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 25 Jan 2024 19:44:49 +0100 4 | Subject: [PATCH] Modifiable Bukkit enums - Material - Link to backing 5 | implementation by namespaced key 6 | 7 | Determines the `Material` instance corresponding to a `Block` or `Item` by using 8 | the `matchMaterial` method with the namespaced key, rather than the `getMaterial` method that expects an enum name. 9 | 10 | This is needed as the namespaced key path of custom blocks does not equal their enum name, 11 | unless plugin backwards compatibility mode is enabled. 12 | 13 | This relies on the `Material.matchMaterial` supporting such namespaced key queries, which is implemented in the 14 | "Modifiable Bukkit enums - Material - Expand matching" in the `fiddle-api` module. 15 | 16 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 17 | Fiddle - https://fiddlemc.org 18 | 19 | diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java 20 | index 38d3bc7afb6dda6c44213511c990dc0561a828ff..039b60865a9f141704bcbc56215050f9b28fa083 100644 21 | --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java 22 | +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java 23 | @@ -302,11 +302,11 @@ public final class CraftMagicNumbers implements UnsafeValues { 24 | } 25 | // Paper end 26 | for (Block block : BuiltInRegistries.BLOCK) { 27 | - BLOCK_MATERIAL.put(block, Material.getMaterial(BuiltInRegistries.BLOCK.getKey(block).getPath().toUpperCase(Locale.ROOT))); 28 | + BLOCK_MATERIAL.put(block, Material.matchMaterial(block.keyInBlockRegistry.toString())); // Fiddle - load packs - blocks - load definitions 29 | } 30 | 31 | for (Item item : BuiltInRegistries.ITEM) { 32 | - ITEM_MATERIAL.put(item, Material.getMaterial(BuiltInRegistries.ITEM.getKey(item).getPath().toUpperCase(Locale.ROOT))); 33 | + ITEM_MATERIAL.put(item, Material.matchMaterial(item.keyInItemRegistry.toString())); // Fiddle - load packs - items - load definitions 34 | } 35 | 36 | for (Material material : Material.values()) { 37 | -------------------------------------------------------------------------------- /patches/server/0050-Configuration-Settings-for-pack-creators.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 17 May 2023 18:50:34 +0200 4 | Subject: [PATCH] Configuration - Settings for pack creators 5 | 6 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 7 | Fiddle - https://fiddlemc.org 8 | 9 | diff --git a/src/main/java/org/fiddlemc/fiddle/configuration/FiddleGlobalConfiguration.java b/src/main/java/org/fiddlemc/fiddle/configuration/FiddleGlobalConfiguration.java 10 | index e29648ac2431d229432502b8caf5a89770c0e838..441310c6fc222f1aba821eaebe475519c4d070d9 100644 11 | --- a/src/main/java/org/fiddlemc/fiddle/configuration/FiddleGlobalConfiguration.java 12 | +++ b/src/main/java/org/fiddlemc/fiddle/configuration/FiddleGlobalConfiguration.java 13 | @@ -134,4 +134,15 @@ public class FiddleGlobalConfiguration extends ConfigurationPart { 14 | } 15 | // Fiddle end - gameplay mechanics settings 16 | 17 | + // Fiddle start - settings for pack creators 18 | + public PackCreatorSettings packCreatorSettings; 19 | + public class PackCreatorSettings extends ConfigurationPart { 20 | + 21 | + public boolean enabled = true; 22 | + public boolean onlyForFolderPacks = true; 23 | + public boolean printDebugInformationToConsole = true; 24 | + 25 | + } 26 | + // Fiddle end - settings for pack creators 27 | + 28 | } 29 | -------------------------------------------------------------------------------- /patches/server/0053-Singleton-that-provides-a-list-of-the-packs.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 11 May 2023 19:55:10 +0200 4 | Subject: [PATCH] Singleton that provides a list of the packs 5 | 6 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 7 | Fiddle - https://fiddlemc.org 8 | 9 | diff --git a/src/main/java/org/fiddlemc/fiddle/pack/FiddlePacks.java b/src/main/java/org/fiddlemc/fiddle/pack/FiddlePacks.java 10 | new file mode 100644 11 | index 0000000000000000000000000000000000000000..490b6ab378b2b38382360d7d772159c9a8d114d4 12 | --- /dev/null 13 | +++ b/src/main/java/org/fiddlemc/fiddle/pack/FiddlePacks.java 14 | @@ -0,0 +1,44 @@ 15 | +// Fiddle - packs - singleton containing packs 16 | + 17 | +package org.fiddlemc.fiddle.pack; 18 | + 19 | +import java.util.ArrayList; 20 | +import java.util.Collections; 21 | +import java.util.List; 22 | + 23 | +/** 24 | + * A singleton containing all Fiddle packs that are loaded. 25 | + */ 26 | +public final class FiddlePacks { 27 | + 28 | + private FiddlePacks() { 29 | + throw new RuntimeException(); 30 | + } 31 | + 32 | + private static final List packs = new ArrayList<>(0); 33 | + private static final List packsUnmodifiableView = Collections.unmodifiableList(packs); 34 | + 35 | + /** 36 | + * Whether the pack registry is frozen (in other words, no more packs can be added). 37 | + */ 38 | + private static boolean frozen = false; 39 | + 40 | + public static void addPack(FiddlePack pack) { 41 | + if (frozen) { 42 | + throw new IllegalStateException("Tried adding a Fiddle pack after the registry was already frozen"); 43 | + } 44 | + packs.add(pack); 45 | + } 46 | + 47 | + public static void freeze() { 48 | + if (frozen) { 49 | + throw new IllegalStateException("Tried to freeze the Fiddle pack registry after it was already frozen"); 50 | + } 51 | + frozen = true; 52 | + } 53 | + 54 | + public static List getPacks() { 55 | + return packsUnmodifiableView; 56 | + } 57 | + 58 | +} 59 | -------------------------------------------------------------------------------- /patches/server/0054-Read-packs-Depend-on-7-Zip-JBinding.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Fri, 14 Apr 2023 18:00:01 +0200 4 | Subject: [PATCH] Read packs - Depend on 7-Zip-JBinding 5 | 6 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 7 | Fiddle - https://fiddlemc.org 8 | 9 | diff --git a/build.gradle.kts b/build.gradle.kts 10 | index a6642f9992bacca9d1b5f523062e10987e0c1f31..8c39e06c0902ec37fe7621f4b09ec1fdf29e77c9 100644 11 | --- a/build.gradle.kts 12 | +++ b/build.gradle.kts 13 | @@ -64,6 +64,14 @@ dependencies { 14 | testImplementation("org.mockito:mockito-core:5.5.0") 15 | 16 | implementation("net.bytebuddy:byte-buddy:1.14.12") // Fiddle - modifiable Bukkit enums - inject runtime versions - depend on ByteBuddy 17 | + // Fiddle start - read packs - depend on 7-Zip-JBinding 18 | + implementation("net.sf.sevenzipjbinding:sevenzipjbinding:16.02-2.01") 19 | + implementation("net.sf.sevenzipjbinding:sevenzipjbinding-all-platforms:16.02-2.01") 20 | + implementation("net.sf.sevenzipjbinding:sevenzipjbinding-linux-arm64:16.02-2.01") 21 | + implementation("net.sf.sevenzipjbinding:sevenzipjbinding-linux-armv5:16.02-2.01") 22 | + implementation("net.sf.sevenzipjbinding:sevenzipjbinding-linux-armv6:16.02-2.01") 23 | + implementation("net.sf.sevenzipjbinding:sevenzipjbinding-linux-armv71:16.02-2.01") 24 | + // Fiddle end - read packs - depend on 7-Zip-JBinding 25 | } 26 | 27 | val craftbukkitPackageVersion = "1_20_R3" // Paper 28 | -------------------------------------------------------------------------------- /patches/server/0055-Read-packs-Depend-on-Junrar.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Fri, 9 Feb 2024 18:50:12 +0100 4 | Subject: [PATCH] Read packs - Depend on Junrar 5 | 6 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 7 | Fiddle - https://fiddlemc.org 8 | 9 | diff --git a/build.gradle.kts b/build.gradle.kts 10 | index 9ce56741e92ed69d9ee9e3017d7fe9a9f7cc572b..3879b69a6055651d8262bfe76836e7641534cb3d 100644 11 | --- a/build.gradle.kts 12 | +++ b/build.gradle.kts 13 | @@ -72,6 +72,7 @@ dependencies { 14 | implementation("net.sf.sevenzipjbinding:sevenzipjbinding-linux-armv6:16.02-2.01") 15 | implementation("net.sf.sevenzipjbinding:sevenzipjbinding-linux-armv71:16.02-2.01") 16 | // Fiddle end - read packs - depend on 7-Zip-JBinding 17 | + implementation("com.github.junrar:junrar:7.5.5") // Fiddle - read packs - depend on Junrar 18 | } 19 | 20 | val craftbukkitPackageVersion = "1_20_R3" // Paper 21 | -------------------------------------------------------------------------------- /patches/server/0062-Read-packs-Files-provider-Store-in-pack-instance.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 15 May 2023 20:44:20 +0200 4 | Subject: [PATCH] Read packs - Files provider - Store in pack instance 5 | 6 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 7 | Fiddle - https://fiddlemc.org 8 | 9 | diff --git a/src/main/java/org/fiddlemc/fiddle/pack/FiddlePack.java b/src/main/java/org/fiddlemc/fiddle/pack/FiddlePack.java 10 | index 5c02751cbad3ce8048950df5102e90befdc9b0a3..6e832d49f2c575d8411f2fd854fd117659ca1ba9 100644 11 | --- a/src/main/java/org/fiddlemc/fiddle/pack/FiddlePack.java 12 | +++ b/src/main/java/org/fiddlemc/fiddle/pack/FiddlePack.java 13 | @@ -12,7 +12,7 @@ package org.fiddlemc.fiddle.pack; 14 | * @param developmentModeEnabled Whether development mode (additional settings for pack creators) is enabled 15 | * for this pack. 16 | */ 17 | -public record FiddlePack(FiddlePackMeta meta, boolean developmentModeEnabled) { 18 | +public record FiddlePack(org.fiddlemc.fiddle.pack.read.filesprovider.FiddlePackFilesProvider filesProvider, boolean developmentModeEnabled, FiddlePackMeta meta) { // Fiddle - read packs - pack files - store provider in pack instance 19 | 20 | @Override 21 | public String toString() { 22 | -------------------------------------------------------------------------------- /patches/server/0063-Read-packs-Flag-for-server-startup-phase.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Mon, 15 May 2023 20:59:39 +0200 4 | Subject: [PATCH] Read packs - Flag for server startup phase 5 | 6 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 7 | Fiddle - https://fiddlemc.org 8 | 9 | diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java 10 | index 4364c96c511ba2ea9bc66e6e3360730bc423bb0b..b605fdd91a3f6ee204ab7e710effff2e6a798c63 100644 11 | --- a/src/main/java/net/minecraft/server/Main.java 12 | +++ b/src/main/java/net/minecraft/server/Main.java 13 | @@ -421,6 +421,8 @@ public class Main { 14 | return; 15 | } 16 | 17 | + org.fiddlemc.fiddle.pack.read.StartupPackLoadPhase.endStartupLoadPhase(); // Fiddle - read packs - startup load phase - end after initial read 18 | + 19 | /* 20 | IRegistryCustom.Dimension iregistrycustom_dimension = worldstem.registries().compositeAccess(); 21 | 22 | diff --git a/src/main/java/org/fiddlemc/fiddle/pack/read/StartupPackLoadPhase.java b/src/main/java/org/fiddlemc/fiddle/pack/read/StartupPackLoadPhase.java 23 | new file mode 100644 24 | index 0000000000000000000000000000000000000000..52b835d658e76d2b0e930b75eb502f2104b53070 25 | --- /dev/null 26 | +++ b/src/main/java/org/fiddlemc/fiddle/pack/read/StartupPackLoadPhase.java 27 | @@ -0,0 +1,39 @@ 28 | +// Fiddle - read packs - startup load phase 29 | + 30 | +package org.fiddlemc.fiddle.pack.read; 31 | + 32 | +import joptsimple.OptionSet; 33 | +import net.minecraft.server.Main; 34 | +import org.fiddlemc.fiddle.pack.read.filesprovider.FiddlePackFilesProvider; 35 | + 36 | +/** 37 | + * A singleton that manages a {@linkplain #inStartupLoadPhase flag} for whether the server 38 | + * is loading packs as part of the startup phase of the server (as opposed to reloading specific parts of packs). 39 | + */ 40 | +public final class StartupPackLoadPhase { 41 | + 42 | + private StartupPackLoadPhase() { 43 | + throw new RuntimeException(); 44 | + } 45 | + 46 | + /** 47 | + * Whether the server is in the startup phase. 48 | + * While in this phase, the closing of file handles of clearing of caches 49 | + * (using {@link FiddlePackFilesProvider#closeHandlesAndClearCache()}) by any readers of parts of the packs 50 | + * (such as resource pack content or data pack content) is not necessary, since it will be done 51 | + * afterwards in the server startup (in {@link Main#main(OptionSet)}) as well. 52 | + */ 53 | + private static boolean inStartupLoadPhase = true; 54 | + 55 | + public static void endStartupLoadPhase() { 56 | + if (!inStartupLoadPhase) { 57 | + throw new IllegalStateException("Tried to end the Fiddle pack startup load phase after it had already been ended"); 58 | + } 59 | + inStartupLoadPhase = false; 60 | + } 61 | + 62 | + public static boolean isInStartupLoadPhase() { 63 | + return inStartupLoadPhase; 64 | + } 65 | + 66 | +} 67 | -------------------------------------------------------------------------------- /patches/server/0067-Read-packs-Content-Definitions-Abstract-JSON-parser.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Fri, 26 Jan 2024 19:00:46 +0100 4 | Subject: [PATCH] Read packs - Content - Definitions - Abstract JSON parser 5 | 6 | Adds the abstract `FiddleContentDefinitionParser` class, that is a base for parsers that parse JSON into `FiddleContentDefinition` instances. 7 | 8 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 9 | Fiddle - https://fiddlemc.org 10 | 11 | diff --git a/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/FiddleContentDefinitionParser.java b/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/FiddleContentDefinitionParser.java 12 | new file mode 100644 13 | index 0000000000000000000000000000000000000000..bd32bf67b579b1d02cce07bf0009bfeabb7f4079 14 | --- /dev/null 15 | +++ b/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/FiddleContentDefinitionParser.java 16 | @@ -0,0 +1,16 @@ 17 | +// Fiddle - read packs - content definitions - JSON parser 18 | + 19 | +package org.fiddlemc.fiddle.pack.read.fiddlecontent.definition; 20 | + 21 | +import net.minecraft.resources.ResourceLocation; 22 | +import org.fiddlemc.fiddle.pack.exception.PackException; 23 | +import org.fiddlemc.fiddle.pack.read.namedjson.NamedJsonObject; 24 | + 25 | +public interface FiddleContentDefinitionParser { 26 | + 27 | + T parse( 28 | + ResourceLocation resourceLocation, 29 | + NamedJsonObject json 30 | + ) throws PackException; 31 | + 32 | +} 33 | diff --git a/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/FiddleContentDefinitionType.java b/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/FiddleContentDefinitionType.java 34 | index 28e0cd0a0351dd4a70f43bbbb4afda98e905d219..98dc3ff82ce6592a4edb33ad00200de169d680bd 100644 35 | --- a/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/FiddleContentDefinitionType.java 36 | +++ b/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/FiddleContentDefinitionType.java 37 | @@ -26,14 +26,19 @@ public class FiddleContentDefinitionType { 38 | */ 39 | public final String textualName; 40 | 41 | - public FiddleContentDefinitionType(String contentSubNamespaceFolderName, String resourceLocationPathIdentifier) { 42 | - this(contentSubNamespaceFolderName, resourceLocationPathIdentifier, resourceLocationPathIdentifier); 43 | + // Fiddle start - read packs - content definitions - JSON parser 44 | + public final FiddleContentDefinitionParser parser; 45 | + 46 | + public FiddleContentDefinitionType(String contentSubNamespaceFolderName, String resourceLocationPathIdentifier, FiddleContentDefinitionParser parser) { 47 | + this(contentSubNamespaceFolderName, resourceLocationPathIdentifier, resourceLocationPathIdentifier, parser); 48 | + // Fiddle end - read packs - content definitions - JSON parser 49 | } 50 | 51 | - public FiddleContentDefinitionType(String contentSubNamespaceFolderName, String resourceLocationPathIdentifier, String textualName) { 52 | + public FiddleContentDefinitionType(String contentSubNamespaceFolderName, String resourceLocationPathIdentifier, String textualName, FiddleContentDefinitionParser parser) { // Fiddle - read packs - content definitions - JSON parser 53 | this.contentSubNamespaceFolderName = contentSubNamespaceFolderName; 54 | this.resourceLocationPathIdentifier = resourceLocationPathIdentifier; 55 | this.textualName = textualName; 56 | + this.parser = parser; // Fiddle - read packs - content definitions - JSON parser 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /patches/server/0069-Read-packs-Content-Definitions-with-parent-Abstract-.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 25 Jan 2024 21:10:14 +0100 4 | Subject: [PATCH] Read packs - Content - Definitions with parent - Abstract 5 | JSON parser 6 | 7 | Adds the abstract `FiddleContentDefinitionWithParentParser` class, that is a base for parsers that parse JSON into `FiddleContentDefinitionWithParent` instances. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | diff --git a/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/withparent/FiddleContentDefinitionWithParentParser.java b/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/withparent/FiddleContentDefinitionWithParentParser.java 13 | new file mode 100644 14 | index 0000000000000000000000000000000000000000..45454b36c5cdd3a341fd8c9ece025ae65d64516a 15 | --- /dev/null 16 | +++ b/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/withparent/FiddleContentDefinitionWithParentParser.java 17 | @@ -0,0 +1,63 @@ 18 | +// Fiddle - read packs - content definitions with parent - JSON parser 19 | + 20 | +package org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.withparent; 21 | + 22 | +import net.minecraft.resources.ResourceLocation; 23 | +import org.fiddlemc.fiddle.pack.exception.PackException; 24 | +import org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.FiddleContentDefinitionParser; 25 | +import org.fiddlemc.fiddle.pack.read.namedjson.NamedJsonElement; 26 | +import org.fiddlemc.fiddle.pack.read.namedjson.NamedJsonObject; 27 | +import org.jetbrains.annotations.Nullable; 28 | + 29 | +public abstract class FiddleContentDefinitionWithParentParser 30 | + implements FiddleContentDefinitionParser { 31 | + 32 | + public static final String parentJsonKey = "parent"; 33 | + 34 | + protected FiddleContentDefinitionWithParentParser() { 35 | + } 36 | + 37 | + protected abstract FiddleContentDefinitionBase[] getBases(); 38 | + 39 | + protected abstract T parse( 40 | + ResourceLocation resourceLocation, 41 | + NamedJsonObject definitionJson, 42 | + FiddleContentDefinitionParent parent 43 | + ) throws PackException; 44 | + 45 | + protected FiddleContentDefinitionParent createKeyParent(ResourceLocation resourceLocation) { 46 | + return new FiddleContentDefinitionKeyParent<>(resourceLocation); 47 | + } 48 | + 49 | + public @Nullable FiddleContentDefinitionBase getBaseByTypedResourceLocation(ResourceLocation resourceLocation) { 50 | + for (var base : this.getBases()) { 51 | + if (base.typedResourceLocation.equals(resourceLocation)) { 52 | + return base; 53 | + } 54 | + } 55 | + return null; 56 | + } 57 | + 58 | + private FiddleContentDefinitionParent getParentByTypedResourceLocation(ResourceLocation resourceLocation) { 59 | + var base = this.getBaseByTypedResourceLocation(resourceLocation); 60 | + if (base != null) { 61 | + return base; 62 | + } 63 | + return this.createKeyParent(resourceLocation); 64 | + } 65 | + 66 | + @Override 67 | + public final T parse( 68 | + ResourceLocation resourceLocation, 69 | + NamedJsonObject definitionJson 70 | + ) throws PackException { 71 | + // Parse the parent 72 | + var parentString = definitionJson.getAsString(parentJsonKey, true, NamedJsonElement.BlankStringParseResult.THROW_EXCEPTION, null); 73 | + var parentResourceLocation = new ResourceLocation(parentString); 74 | + var parent = this.getParentByTypedResourceLocation(parentResourceLocation); 75 | + 76 | + // Parse the rest 77 | + return this.parse(resourceLocation, definitionJson, parent); 78 | + } 79 | + 80 | +} 81 | -------------------------------------------------------------------------------- /patches/server/0073-Read-packs-Content-Blocks-Note-block-instrument-from.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 25 Jan 2024 22:30:39 +0100 4 | Subject: [PATCH] Read packs - Content - Blocks - Note block instrument from 5 | resource location 6 | 7 | Adds a mapping from resource locations to `NoteBlockInstrument` instances. 8 | 9 | This mapping is used to parse instruments from strings in the "Read packs - Content - Blocks - JSON parser" patch. 10 | 11 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 12 | Fiddle - https://fiddlemc.org 13 | 14 | diff --git a/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/block/NoteBlockInstrumentsByResourceLocation.java b/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/block/NoteBlockInstrumentsByResourceLocation.java 15 | new file mode 100644 16 | index 0000000000000000000000000000000000000000..8e5a165326633501584193382c6c29064e7f1790 17 | --- /dev/null 18 | +++ b/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/block/NoteBlockInstrumentsByResourceLocation.java 19 | @@ -0,0 +1,39 @@ 20 | +// Fiddle - read packs - blocks - get note block instrument by ResourceLocation 21 | + 22 | +package org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.block; 23 | + 24 | +import net.minecraft.resources.ResourceLocation; 25 | +import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; 26 | + 27 | +import java.util.HashMap; 28 | +import java.util.Map; 29 | + 30 | +/** 31 | + * Provides {@link NoteBlockInstrument}s {@linkplain #get by their namespaced key}. 32 | + *

33 | + * The namespaced key of a {@link NoteBlockInstrument} is not something that exists in Minecraft: 34 | + * they are not data-driven. However, to support a data-driven approach in configuring for example 35 | + * the note block instrument belonging to a block, we impose a namespaced key on each existing value, 36 | + * with the {@link ResourceLocation#DEFAULT_NAMESPACE}. 37 | + *

38 | + */ 39 | +public final class NoteBlockInstrumentsByResourceLocation { 40 | + 41 | + private NoteBlockInstrumentsByResourceLocation() { 42 | + throw new RuntimeException(); 43 | + } 44 | + 45 | + private static final Map BY_RESOURCE_LOCATION; 46 | + static { 47 | + var values = NoteBlockInstrument.values(); 48 | + BY_RESOURCE_LOCATION = new HashMap<>(values.length); 49 | + for (var instrument : values) { 50 | + BY_RESOURCE_LOCATION.put(new ResourceLocation(ResourceLocation.DEFAULT_NAMESPACE, instrument.getSerializedName()), instrument); 51 | + } 52 | + } 53 | + 54 | + public static NoteBlockInstrument get(ResourceLocation resourceLocation) { 55 | + return BY_RESOURCE_LOCATION.get(resourceLocation); 56 | + } 57 | + 58 | +} 59 | -------------------------------------------------------------------------------- /patches/server/0079-Read-packs-Content-Definitions-Array-of-all-types.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 25 Jan 2024 23:11:55 +0100 4 | Subject: [PATCH] Read packs - Content - Definitions - Array of all types 5 | 6 | Defines an array containing all `FiddleContentDefinitionType` instances. 7 | This is used in the "Read packs - Content - Definitions - Implementation to read all" patch. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | diff --git a/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/FiddleContentDefinitionTypes.java b/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/FiddleContentDefinitionTypes.java 13 | new file mode 100644 14 | index 0000000000000000000000000000000000000000..4d178b06772510c0a1a60b332c53ae5282691fec 15 | --- /dev/null 16 | +++ b/src/main/java/org/fiddlemc/fiddle/pack/read/fiddlecontent/definition/FiddleContentDefinitionTypes.java 17 | @@ -0,0 +1,22 @@ 18 | +// Fiddle - read packs - content definitions - array of all types 19 | + 20 | +package org.fiddlemc.fiddle.pack.read.fiddlecontent.definition; 21 | + 22 | +import org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.block.BlockDefinition; 23 | +import org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.item.ItemDefinition; 24 | + 25 | +/** 26 | + * A class that contains all {@link FiddleContentDefinitionType}s in {@link #VALUES}. 27 | + */ 28 | +public final class FiddleContentDefinitionTypes { 29 | + 30 | + private FiddleContentDefinitionTypes() { 31 | + throw new RuntimeException(); 32 | + } 33 | + 34 | + public static FiddleContentDefinitionType[] VALUES = { 35 | + BlockDefinition.TYPE, 36 | + ItemDefinition.TYPE 37 | + }; 38 | + 39 | +} 40 | -------------------------------------------------------------------------------- /patches/server/0081-Read-packs-Content-Definitions-Read-before-bootstrap.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 24 Jan 2024 23:32:37 +0100 4 | Subject: [PATCH] Read packs - Content - Definitions - Read before bootstrap 5 | 6 | Invokes the reading of all content definitions of all types from all packs before the server bootstrap is called. 7 | This relies on the `FiddleContentDefinitionReader` defined in the "Read packs - Content - Definitions - Implementation to read all" patch. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java 13 | index 89f95494d276f54fe753eb3caa35e2cc58c1ffa3..9f2c74ca4fbb740e298c88ae47a1a36a8436582f 100644 14 | --- a/src/main/java/net/minecraft/server/Main.java 15 | +++ b/src/main/java/net/minecraft/server/Main.java 16 | @@ -152,6 +152,16 @@ public class Main { 17 | } 18 | // Fiddle end - read packs - prevent duplicate packs 19 | 20 | + // Fiddle start - read packs - content definitions - read before bootstrap 21 | + org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.FiddleContentDefinitionsByType readContentDefinitions; 22 | + try { 23 | + readContentDefinitions = org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.FiddleContentDefinitionReader.readAndSortDefinitions(); 24 | + } catch (Exception e) { 25 | + LOGGER.error("Could not read block and item definitions", e); 26 | + return; 27 | + } 28 | + // Fiddle end - read packs - content definitions - read before bootstrap 29 | + 30 | io.papermc.paper.plugin.PluginInitializerManager.load(optionset); // Paper 31 | Bootstrap.bootStrap(); 32 | Bootstrap.validate(); 33 | -------------------------------------------------------------------------------- /patches/server/0082-Load-packs-Content-Definitions-Pass-read-definitions.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 24 Jan 2024 23:34:30 +0100 4 | Subject: [PATCH] Load packs - Content - Definitions - Pass read definitions to 5 | bootstrap 6 | 7 | Passes the definitions read before the bootstrap, in the "Read packs - Content - Definitions - Read before bootstrap" patch, 8 | to the bootstrap function, so that it can use it to perform the loading actions that must be done during the bootstrap procedure. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java 14 | index 438ae006a8e7da0e5124415b8350ebfd45ac6a10..f2a434720d1b9c56e68a1df9c7bc4ed6eb9cb38e 100644 15 | --- a/src/main/java/net/minecraft/server/Bootstrap.java 16 | +++ b/src/main/java/net/minecraft/server/Bootstrap.java 17 | @@ -43,6 +43,17 @@ public class Bootstrap { 18 | public Bootstrap() {} 19 | 20 | public static void bootStrap() { 21 | + // Fiddle start - load packs - content definitions - pass read definitions to bootstrap 22 | + try { 23 | + bootStrap(org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.FiddleContentDefinitionsByType.empty()); 24 | + } catch (org.fiddlemc.fiddle.pack.exception.PackException e) { 25 | + // This should never happen as we're not adding any content 26 | + throw new RuntimeException(e); 27 | + } 28 | + } 29 | + 30 | + public static void bootStrap(org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.FiddleContentDefinitionsByType readContentDefinitions) throws org.fiddlemc.fiddle.pack.exception.PackException { 31 | + // Fiddle end - load packs - content definitions - pass read definitions to bootstrap 32 | if (!Bootstrap.isBootstrapped) { 33 | // CraftBukkit start 34 | /*String name = Bootstrap.class.getSimpleName(); // Paper 35 | diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java 36 | index 9f2c74ca4fbb740e298c88ae47a1a36a8436582f..bea9d135e568ce9d709f29311bd10a7a3d26c8ff 100644 37 | --- a/src/main/java/net/minecraft/server/Main.java 38 | +++ b/src/main/java/net/minecraft/server/Main.java 39 | @@ -163,7 +163,7 @@ public class Main { 40 | // Fiddle end - read packs - content definitions - read before bootstrap 41 | 42 | io.papermc.paper.plugin.PluginInitializerManager.load(optionset); // Paper 43 | - Bootstrap.bootStrap(); 44 | + Bootstrap.bootStrap(readContentDefinitions); // Fiddle - load packs - content definitions - pass read definitions to bootstrap 45 | Bootstrap.validate(); 46 | Util.startTimerHackThread(); 47 | Path path1 = Paths.get("server.properties"); 48 | -------------------------------------------------------------------------------- /patches/server/0083-Load-packs-Content-Definitions-with-a-parent-Abstrac.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 25 Jan 2024 19:41:45 +0100 4 | Subject: [PATCH] Load packs - Content - Definitions with a parent - Abstract 5 | implementation 6 | 7 | This provides an abstract implementation for a loader of definitions with a parent (`FiddleContentDefinitionWithParent`). 8 | 9 | This is used in the patch "Load packs - Content - Blocks and items - Register - Abstract implementation`. 10 | 11 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 12 | Fiddle - https://fiddlemc.org 13 | 14 | diff --git a/src/main/java/org/fiddlemc/fiddle/pack/load/fiddlecontent/withparent/FiddleContentDefinitionWithParentLoader.java b/src/main/java/org/fiddlemc/fiddle/pack/load/fiddlecontent/withparent/FiddleContentDefinitionWithParentLoader.java 15 | new file mode 100644 16 | index 0000000000000000000000000000000000000000..bf3d5f2e49a8de5f5793bc6bfb9b1de2aea654fb 17 | --- /dev/null 18 | +++ b/src/main/java/org/fiddlemc/fiddle/pack/load/fiddlecontent/withparent/FiddleContentDefinitionWithParentLoader.java 19 | @@ -0,0 +1,37 @@ 20 | +// Fiddle - load packs - content definitions with parent - load - implementation 21 | + 22 | +package org.fiddlemc.fiddle.pack.load.fiddlecontent.withparent; 23 | + 24 | +import net.minecraft.resources.ResourceLocation; 25 | +import org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.withparent.FiddleContentDefinitionBase; 26 | +import org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.withparent.FiddleContentDefinitionKeyParent; 27 | +import org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.withparent.FiddleContentDefinitionParent; 28 | + 29 | +public abstract class FiddleContentDefinitionWithParentLoader { 30 | + 31 | + protected abstract boolean isKeyParentInvalid(FiddleContentDefinitionKeyParent keyParent); 32 | + 33 | + /** 34 | + * @return Whether the given parent is invalid. 35 | + * For example, this may be true if it represents another resource that isn't loaded yet. 36 | + */ 37 | + protected final boolean isParentInvalid(FiddleContentDefinitionParent parent) { 38 | + if (parent instanceof FiddleContentDefinitionKeyParent keyParent) { 39 | + //noinspection unchecked 40 | + return this.isKeyParentInvalid((FiddleContentDefinitionKeyParent) keyParent); 41 | + } else if (parent instanceof FiddleContentDefinitionBase) { 42 | + return false; 43 | + } 44 | + throw new UnsupportedOperationException("Unknown definition parent type: " + parent.getClass().getName()); 45 | + } 46 | + 47 | + /** 48 | + * Looks up an already existing resource by the resource location. 49 | + *

50 | + * This is used to let resources that depend on other resources inspect the latter's actual properties 51 | + * and functionality after they have been added. 52 | + *

53 | + */ 54 | + protected abstract Resource getResource(ResourceLocation resourceLocation); 55 | + 56 | +} 57 | -------------------------------------------------------------------------------- /patches/server/0086-Load-packs-Content-Blocks-Register-Call-after-vanill.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 25 Jan 2024 19:29:00 +0100 4 | Subject: [PATCH] Load packs - Content - Blocks - Register - Call after vanilla 5 | bootstrap 6 | 7 | This calls the block registration defined in the patch "Load packs - Content - Blocks - Register - Implementation" 8 | with the blocks passed to the bootstrap in the patch "Load packs - Content - Definitions - Pass read definitions to bootstrap" 9 | at the appropriate time after the vanilla blocks have been bootstrapped, but before any plugin bootstrap code is called. 10 | 11 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 12 | Fiddle - https://fiddlemc.org 13 | 14 | diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java 15 | index f2a434720d1b9c56e68a1df9c7bc4ed6eb9cb38e..6610e86ba19f439acd02f2f35af5e5c74461b5ca 100644 16 | --- a/src/main/java/net/minecraft/server/Bootstrap.java 17 | +++ b/src/main/java/net/minecraft/server/Bootstrap.java 18 | @@ -87,6 +87,7 @@ public class Bootstrap { 19 | EntitySelectorOptions.bootStrap(); 20 | DispenseItemBehavior.bootStrap(); 21 | CauldronInteraction.bootStrap(); 22 | + org.fiddlemc.fiddle.pack.load.fiddlecontent.block.BlockByDefinitionLoader.INSTANCE.register(readContentDefinitions.get(org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.block.BlockDefinition.TYPE)); // Fiddle - load packs - blocks - register - call after vanilla bootstrap 23 | // Paper start 24 | BuiltInRegistries.bootStrap(() -> { 25 | io.papermc.paper.world.worldgen.OptionallyFlatBedrockConditionSource.bootstrap(); // Paper - Flat bedrock generator settings 26 | -------------------------------------------------------------------------------- /patches/server/0088-Load-packs-Content-Items-Register-Call-after-vanilla.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 25 Jan 2024 19:29:59 +0100 4 | Subject: [PATCH] Load packs - Content - Items - Register - Call after vanilla 5 | bootstrap 6 | 7 | This calls the item registration defined in the patch "Load packs - Content - Items - Register - Implementation" 8 | with the items passed to the bootstrap in the patch "Load packs - Content - Definitions - Pass read definitions to bootstrap" 9 | at the appropriate time after the vanilla items have been bootstrapped, but before any plugin bootstrap code is called. 10 | 11 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 12 | Fiddle - https://fiddlemc.org 13 | 14 | diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java 15 | index 6610e86ba19f439acd02f2f35af5e5c74461b5ca..61d4e5d7d3b5757283ac770e288c3f0704758751 100644 16 | --- a/src/main/java/net/minecraft/server/Bootstrap.java 17 | +++ b/src/main/java/net/minecraft/server/Bootstrap.java 18 | @@ -88,6 +88,7 @@ public class Bootstrap { 19 | DispenseItemBehavior.bootStrap(); 20 | CauldronInteraction.bootStrap(); 21 | org.fiddlemc.fiddle.pack.load.fiddlecontent.block.BlockByDefinitionLoader.INSTANCE.register(readContentDefinitions.get(org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.block.BlockDefinition.TYPE)); // Fiddle - load packs - blocks - register - call after vanilla bootstrap 22 | + org.fiddlemc.fiddle.pack.load.fiddlecontent.item.ItemByDefinitionLoader.INSTANCE.register(readContentDefinitions.get(org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.item.ItemDefinition.TYPE)); // Fiddle - load packs - items - register - call after vanilla bootstrap 23 | // Paper start 24 | BuiltInRegistries.bootStrap(() -> { 25 | io.papermc.paper.world.worldgen.OptionallyFlatBedrockConditionSource.bootstrap(); // Paper - Flat bedrock generator settings 26 | -------------------------------------------------------------------------------- /patches/server/0091-Load-packs-Data-packs-Include-Fiddle-source-in-pack-.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 11 May 2023 18:36:07 +0200 4 | Subject: [PATCH] Load packs - Data packs - Include Fiddle source in pack 5 | repository 6 | 7 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 8 | Fiddle - https://fiddlemc.org 9 | 10 | diff --git a/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java b/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java 11 | index d92cd89373f8373c367ce422328b9836de09096d..f8fd49e16eb96e679017a296d614d0ca510f9ad8 100644 12 | --- a/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java 13 | +++ b/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java 14 | @@ -53,7 +53,7 @@ public class ServerPacksSource extends BuiltInPackSource { 15 | } 16 | 17 | public static PackRepository createPackRepository(Path dataPacksPath, DirectoryValidator symlinkFinder) { 18 | - return new PackRepository(new ServerPacksSource(symlinkFinder), new FolderRepositorySource(dataPacksPath, PackType.SERVER_DATA, PackSource.WORLD, symlinkFinder)); 19 | + return new PackRepository(new ServerPacksSource(symlinkFinder), new org.fiddlemc.fiddle.pack.load.data.FiddleRepositorySource(), new FolderRepositorySource(dataPacksPath, PackType.SERVER_DATA, PackSource.WORLD, symlinkFinder)); // Fiddle - load packs - data packs - repository source - include in pack repository 20 | } 21 | 22 | public static PackRepository createVanillaTrustedRepository() { 23 | -------------------------------------------------------------------------------- /patches/server/0092-Broadcast-packets-based-on-player.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 3 Jan 2024 22:57:43 +0100 4 | Subject: [PATCH] Broadcast packets based on player 5 | 6 | Adds a method analogous to `PlayerList.broadcast` that allows sending a different packet to each target player. 7 | 8 | Adds no usages of this method; those are added in subsequent patches. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java 14 | index 91feb12732564c90656da487664dbc12e55397fc..6132cadb92800f06bf7017e42b8bcd8d41ed6c6d 100644 15 | --- a/src/main/java/net/minecraft/server/players/PlayerList.java 16 | +++ b/src/main/java/net/minecraft/server/players/PlayerList.java 17 | @@ -1206,6 +1206,12 @@ public abstract class PlayerList { 18 | } 19 | 20 | public void broadcast(@Nullable net.minecraft.world.entity.player.Player player, double x, double y, double z, double distance, ResourceKey worldKey, Packet packet) { 21 | + // Fiddle start - broadcast packets based on player 22 | + this.broadcastDependentOnPlayer(player, x, y, z, distance, worldKey, targetPlayer -> packet); 23 | + } 24 | + 25 | + public void broadcastDependentOnPlayer(@Nullable net.minecraft.world.entity.player.Player player, double x, double y, double z, double distance, ResourceKey worldKey, Function> packet) { 26 | + // Fiddle end - broadcast packets based on player 27 | for (int i = 0; i < this.players.size(); ++i) { 28 | ServerPlayer entityplayer = (ServerPlayer) this.players.get(i); 29 | 30 | @@ -1221,7 +1227,7 @@ public abstract class PlayerList { 31 | double d6 = z - entityplayer.getZ(); 32 | 33 | if (d4 * d4 + d5 * d5 + d6 * d6 < distance * distance) { 34 | - entityplayer.connection.send(packet); 35 | + entityplayer.connection.send(packet.apply(entityplayer)); // Fiddle end - broadcast packets based on player 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /patches/server/0096-Client-perspective-For-players-Store-and-get.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sat, 29 Jul 2023 09:13:00 +0200 4 | Subject: [PATCH] Client perspective - For players - Store and get 5 | 6 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 7 | Fiddle - https://fiddlemc.org 8 | 9 | diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java 10 | index af63954c14eff664ced930da3ab03241cf9e9c43..a15e8420864b0cf9d8eb0d773a3818750128932b 100644 11 | --- a/src/main/java/net/minecraft/network/Connection.java 12 | +++ b/src/main/java/net/minecraft/network/Connection.java 13 | @@ -963,4 +963,21 @@ public class Connection extends SimpleChannelInboundHandler> { 14 | } 15 | } 16 | // Paper end - Optimize network 17 | + 18 | + // Fiddle start - client perspective - player - get from connection 19 | + /** 20 | + * @return The {@link org.fiddlemc.fiddle.packet.ClientPerspective} of this connection's {@linkplain #getPlayer() player}. 21 | + * This is null if the player is null. 22 | + * 23 | + * @see net.minecraft.server.level.ServerPlayer#getClientPerspective 24 | + */ 25 | + public final @Nullable org.fiddlemc.fiddle.packet.ClientPerspective getPlayerClientPerspective() { 26 | + var player = this.getPlayer(); 27 | + if (player == null) { 28 | + return null; 29 | + } 30 | + return player.getClientPerspective(); 31 | + } 32 | + // Fiddle end - client perspective - player - get from connection 33 | + 34 | } 35 | diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java 36 | index 18efaf7da221fa0bf758d5136592bb78179af7f9..6b3520b0a2b5a03e5be440b6bea96070fe0cb7a5 100644 37 | --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java 38 | +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java 39 | @@ -288,6 +288,8 @@ public class ServerPlayer extends Player { 40 | 41 | public boolean hasBeenPlacedIntoPlayerList = false; // Fiddle - client perspective - send resource pack 42 | 43 | + private @Nullable org.fiddlemc.fiddle.packet.ClientPerspective clientPerspective; // Fiddle - client perspective - player 44 | + 45 | public io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances getViewDistances() { 46 | return this.viewDistances.get(); 47 | } 48 | @@ -2759,4 +2761,26 @@ public class ServerPlayer extends Player { 49 | return (CraftPlayer) super.getBukkitEntity(); 50 | } 51 | // CraftBukkit end 52 | + 53 | + // Fiddle start - client perspective - player 54 | + /** 55 | + * @return The {@link org.fiddlemc.fiddle.packet.ClientPerspective} of this player. 56 | + * This is null if and only if it has not been {@linkplain #setClientPerspective initialized} yet. 57 | + */ 58 | + public final @Nullable org.fiddlemc.fiddle.packet.ClientPerspective getClientPerspective() { 59 | + return this.clientPerspective; 60 | + } 61 | + 62 | + /** 63 | + * @param clientPerspective The value to initialize this player's 64 | + * {@link org.fiddlemc.fiddle.packet.ClientPerspective} to. 65 | + */ 66 | + public final void setClientPerspective(org.fiddlemc.fiddle.packet.ClientPerspective clientPerspective) { 67 | + if (this.clientPerspective != null) { 68 | + throw new IllegalStateException("Tried to set Player.clientPerspective when it was already set"); 69 | + } 70 | + this.clientPerspective = clientPerspective; 71 | + } 72 | + // Fiddle end - client perspective - player 73 | + 74 | } 75 | -------------------------------------------------------------------------------- /patches/server/0097-Client-perspective-For-players-Set-based-on-resource.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Tue, 18 Jul 2023 22:42:43 +0200 4 | Subject: [PATCH] Client perspective - For players - Set based on resource pack 5 | status 6 | 7 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 8 | Fiddle - https://fiddlemc.org 9 | 10 | diff --git a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java 11 | index e9c569246ad6ec1d3f8b1d58974c77529542d387..38e5dfa10af92c008382d87eef92153d744d0e24 100644 12 | --- a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java 13 | +++ b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java 14 | @@ -128,6 +128,7 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis 15 | if (packet.action().isTerminal()) { 16 | // Fiddle start - client perspective - send resource pack 17 | if (this.currentTask != null && this.currentTask.type() == org.fiddlemc.fiddle.packet.resourcepack.FiddleResourcePackConfigurationTask.TYPE) { 18 | + player.setClientPerspective(player.getBukkitEntity().getResourcePackStatus() == org.bukkit.event.player.PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED ? org.fiddlemc.fiddle.packet.ClientPerspectiveCategory.JAVA_WITH_ENABLED_RESOURCE_PACK.mostLikelyPerspective : org.fiddlemc.fiddle.packet.ClientPerspectiveCategory.JAVA_DEFAULT.mostLikelyPerspective); // Fiddle - client perspective - player - set based on resource pack status 19 | this.finishCurrentTask(org.fiddlemc.fiddle.packet.resourcepack.FiddleResourcePackConfigurationTask.TYPE); 20 | } else { 21 | // Fiddle end - client perspective - send resource pack 22 | -------------------------------------------------------------------------------- /patches/server/0099-Client-perspective-Expose-packet-target-client-prope.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sat, 22 Jul 2023 15:06:25 +0200 4 | Subject: [PATCH] Client perspective - Expose packet target client properties - 5 | Packet can provide explicit connection 6 | 7 | Adds abstract methods in `Packet` that allow it to, based on some implementation, 8 | provide an explicit perspective and locale of the client it is poised to be sent to. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | diff --git a/src/main/java/net/minecraft/network/protocol/Packet.java b/src/main/java/net/minecraft/network/protocol/Packet.java 14 | index fbc6180cab00cc8733e7e9489be44c31fe618cfe..d99a276e877e128014d27c41577ad7c4f94454fb 100644 15 | --- a/src/main/java/net/minecraft/network/protocol/Packet.java 16 | +++ b/src/main/java/net/minecraft/network/protocol/Packet.java 17 | @@ -79,4 +79,33 @@ public interface Packet { 18 | } 19 | // Fiddle end - client perspective - packets are modifiable 20 | 21 | + // Fiddle start - client perspective - expose target client properties - packet can provide explicit connection 22 | + /** 23 | + * @return The {@link org.fiddlemc.fiddle.packet.ClientPerspective} of the receiving client of this packet, 24 | + * if explicitly known. 25 | + * This must be implemented for some instances of {@link Packet} 26 | + * for which the {@link org.fiddlemc.fiddle.packet.ClientPerspective} is needed 27 | + * at the time of {@linkplain #write(FriendlyByteBuf) writing the packet to a byte buffer}. 28 | + * @throws UnsupportedOperationException If there is no implementation for this method. 29 | + * The default implementation of this method in {@link Packet} always throws this exception. 30 | + * An exception being thrown from this method should never actually happen (because it is slow): 31 | + * this method must not be called when there is any chance of an exception 32 | + * (including a {@link NullPointerException} if an attempt is made to return a non-null value) being thrown. 33 | + * No exception from this method should be caught, because if one occurs, 34 | + * it indicates that there is code that needs this value, 35 | + * but it is not available early enough for the value to be available. 36 | + */ 37 | + default org.fiddlemc.fiddle.packet.ClientPerspective getExplicitTargetClientPerspective() throws UnsupportedOperationException { 38 | + throw new UnsupportedOperationException("Tried to call getExplicitTargetClientPerspective() on a " + Packet.class.getSimpleName() + " instance of type " + this.getClass().getName() + ", but no overriding implementation is available"); 39 | + } 40 | + 41 | + /** 42 | + * @return The same value as {@link #getExplicitTargetClientPerspective()}, except that it returns null 43 | + * where {@link #getExplicitTargetClientPerspective()} would otherwise throw an exception. 44 | + */ 45 | + default @org.jetbrains.annotations.Nullable org.fiddlemc.fiddle.packet.ClientPerspective getExplicitTargetClientPerspectiveOrNull() { 46 | + return null; 47 | + } 48 | + // Fiddle end - client perspective - expose target client properties - packet can provide explicit connection 49 | + 50 | } 51 | -------------------------------------------------------------------------------- /patches/server/0103-Client-perspective-Expose-packet-target-client-prope.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sat, 22 Jul 2023 15:06:25 +0200 4 | Subject: [PATCH] Client perspective - Expose packet target client properties - 5 | Implement for bundle packets 6 | 7 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 8 | Fiddle - https://fiddlemc.org 9 | 10 | diff --git a/src/main/java/net/minecraft/network/protocol/BundlePacket.java b/src/main/java/net/minecraft/network/protocol/BundlePacket.java 11 | index 0462cbff6eb3366077c1628c0c8a10e99c9fdf90..ecd10f0aaa29f442a8086954112bbac6b797f6a3 100644 12 | --- a/src/main/java/net/minecraft/network/protocol/BundlePacket.java 13 | +++ b/src/main/java/net/minecraft/network/protocol/BundlePacket.java 14 | @@ -3,10 +3,11 @@ package net.minecraft.network.protocol; 15 | import net.minecraft.network.FriendlyByteBuf; 16 | import net.minecraft.network.PacketListener; 17 | 18 | -public abstract class BundlePacket implements Packet { 19 | +public abstract class BundlePacket extends org.fiddlemc.fiddle.packet.PacketWithExplicitTargetClientConnection { // Fiddle - client perspective - packets are modifiable - expose target client properties - bundle 20 | protected Iterable> packets; // Fiddle - client perspective - packets are modifiable - bundle - private -> protected, non-final -> final 21 | 22 | protected BundlePacket(Iterable> packets) { 23 | + super(); // Fiddle - client perspective - packets are modifiable - expose target client properties - bundle 24 | this.packets = packets; 25 | } 26 | 27 | diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundBundlePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundBundlePacket.java 28 | index 801ef0521733fd4d4a89b71f68df9cb19bd267be..ae56dd8a23269e6a04c9b8d1991dfb31a992b8c1 100644 29 | --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundBundlePacket.java 30 | +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundBundlePacket.java 31 | @@ -38,7 +38,7 @@ public class ClientboundBundlePacket extends BundlePacket> packetsAsList) { 38 | // If this.mayBeSentToMultipleTargetClients os false and the packet iterable is an ArrayList, modify it in-place 39 | for (int i = 0; i < packetsAsList.size(); i++) { 40 | -------------------------------------------------------------------------------- /patches/server/0105-Client-perspective-Base-ids-on-perspective-Block-Pro.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 3 Jan 2024 21:00:41 +0100 4 | Subject: [PATCH] Client perspective - Base ids on perspective - Block - 5 | Provide 6 | 7 | Provides functionality to base `Block` ids (the ids they are identified by in packets sent to clients) on the target client's perspective. 8 | For clients that can understand the server-side block ids directly, the id is taken from the regular registry (`BuiltInRegistries.BLOCK`), and for those who do not, the ids are taken from the vanilla-only registry (`Block.VANILLA_ONLY_BLOCK_REGISTRY`). 9 | 10 | Does not add any usages of this functionality. 11 | 12 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 13 | Fiddle - https://fiddlemc.org 14 | 15 | diff --git a/src/main/java/org/fiddlemc/fiddle/packet/ClientPerspective.java b/src/main/java/org/fiddlemc/fiddle/packet/ClientPerspective.java 16 | index b97f5798056d3083cb0ba2e11c55544cff9dde81..eb26df34a458d48319fe7500322525661e06a0fb 100644 17 | --- a/src/main/java/org/fiddlemc/fiddle/packet/ClientPerspective.java 18 | +++ b/src/main/java/org/fiddlemc/fiddle/packet/ClientPerspective.java 19 | @@ -59,6 +59,43 @@ public class ClientPerspective { 20 | this.understandsServerSideTranslations = understandsServerSideTranslations; 21 | } 22 | 23 | + // Fiddle start - client perspective - base ids on perspective - provide - block 24 | + /** 25 | + * @return The {@link net.minecraft.core.IdMap} that 26 | + * {@linkplain net.minecraft.core.IdMap#getId provides} the ids for 27 | + * {@linkplain net.minecraft.world.level.block.Block blocks} 28 | + * that a client with this perspective interprets correctly. 29 | + */ 30 | + public net.minecraft.core.IdMap getPacketBlockIdMap() { 31 | + return understandsServerSideItemsAndBlocks ? net.minecraft.core.registries.BuiltInRegistries.BLOCK : net.minecraft.world.level.block.Block.VANILLA_ONLY_BLOCK_REGISTRY; 32 | + } 33 | + 34 | + /** 35 | + * @return The id provided by this perspective's {@link #getPacketBlockIdMap()}, 36 | + * for the given {@link net.minecraft.world.level.block.Block}. 37 | + * A null value will be interpreted as 38 | + * {@link net.minecraft.world.level.block.Blocks#AIR}. 39 | + *

40 | + * This is based on {@link #getPacketBlockIdMap()}, but uses the cached id for optimization instead. 41 | + *

42 | + */ 43 | + public int getPacketBlockId(@org.jetbrains.annotations.Nullable net.minecraft.world.level.block.Block block) { 44 | + var blockToQuery = block == null ? net.minecraft.world.level.block.Blocks.AIR : block; 45 | + return understandsServerSideItemsAndBlocks ? blockToQuery.indexInBlockRegistry : blockToQuery.indexInVanillaOnlyBlockRegistry; 46 | + } 47 | + 48 | + /** 49 | + * @return The single {@link #getPacketBlockId} value for the given 50 | + * {@link net.minecraft.world.level.block.Block}, if it is the same 51 | + * for all possible perspectives, or -1 otherwise. 52 | + */ 53 | + public static int getSinglePacketBlockId(@org.jetbrains.annotations.Nullable net.minecraft.world.level.block.Block block) { 54 | + var blockToQuery = block == null ? net.minecraft.world.level.block.Blocks.AIR : block; 55 | + int potentialSingleIndex = blockToQuery.indexInBlockRegistry; 56 | + return potentialSingleIndex == blockToQuery.indexInVanillaOnlyBlockRegistry ? potentialSingleIndex : -1; 57 | + } 58 | + // Fiddle end - client perspective - base ids on perspective - provide - block 59 | + 60 | @Override 61 | public int hashCode() { 62 | return this.category.ordinal(); 63 | -------------------------------------------------------------------------------- /patches/server/0106-Client-perspective-Base-ids-on-perspective-Item-Prov.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 3 Jan 2024 21:02:47 +0100 4 | Subject: [PATCH] Client perspective - Base ids on perspective - Item - Provide 5 | 6 | Provides functionality to base `Item` ids (the ids they are identified by in packets sent to clients) on the target client's perspective. 7 | For clients that can understand the server-side item ids directly, the id is taken from the regular registry (`BuiltInRegistries.ITEM`), and for those who do not, the ids are taken from the vanilla-only registry (`Item.VANILLA_ONLY_ITEM_REGISTRY`). 8 | 9 | Does not add any usages of this functionality, those are added in the "Client perspective - Base ids on perspective - Item - Apply to effect data value" patch. 10 | 11 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 12 | Fiddle - https://fiddlemc.org 13 | 14 | diff --git a/src/main/java/org/fiddlemc/fiddle/packet/ClientPerspective.java b/src/main/java/org/fiddlemc/fiddle/packet/ClientPerspective.java 15 | index eb26df34a458d48319fe7500322525661e06a0fb..9509fc70120390c17f0f4379ce96b9e6f57b716a 100644 16 | --- a/src/main/java/org/fiddlemc/fiddle/packet/ClientPerspective.java 17 | +++ b/src/main/java/org/fiddlemc/fiddle/packet/ClientPerspective.java 18 | @@ -96,6 +96,43 @@ public class ClientPerspective { 19 | } 20 | // Fiddle end - client perspective - base ids on perspective - provide - block 21 | 22 | + // Fiddle start - client perspective - base ids on perspective - provide - item 23 | + /** 24 | + * The {@link net.minecraft.core.IdMap} that 25 | + * {@linkplain net.minecraft.core.IdMap#getId provides} the ids for 26 | + * {@linkplain net.minecraft.world.item.Item items} 27 | + * that a client with this perspective interprets correctly. 28 | + */ 29 | + public net.minecraft.core.IdMap getPacketItemIdMap() { 30 | + return understandsServerSideItemsAndBlocks ? net.minecraft.core.registries.BuiltInRegistries.ITEM : net.minecraft.world.item.Item.VANILLA_ONLY_ITEM_REGISTRY; 31 | + } 32 | + 33 | + /** 34 | + * The id provided by this perspective's {@link #getPacketItemIdMap()}, 35 | + * for the given {@link net.minecraft.world.item.Item}. 36 | + * A null value will be interpreted as 37 | + * {@link net.minecraft.world.item.Items#AIR}. 38 | + *

39 | + * This is based on {@link #getPacketItemIdMap()}, but uses the cached id for optimization instead. 40 | + *

41 | + */ 42 | + public int getPacketItemId(@org.jetbrains.annotations.Nullable net.minecraft.world.item.Item item) { 43 | + var itemToQuery = item == null ? net.minecraft.world.item.Items.AIR : item; 44 | + return understandsServerSideItemsAndBlocks ? itemToQuery.indexInItemRegistry : itemToQuery.indexInVanillaOnlyItemRegistry; 45 | + } 46 | + 47 | + /** 48 | + * @return The single {@link #getPacketItemId} value for the given 49 | + * {@link net.minecraft.world.item.Item}, if it is the same 50 | + * for all possible perspectives, or -1 otherwise. 51 | + */ 52 | + public static int getSinglePacketItemId(@org.jetbrains.annotations.Nullable net.minecraft.world.item.Item item) { 53 | + var itemToQuery = item == null ? net.minecraft.world.item.Items.AIR : item; 54 | + int potentialSingleIndex = itemToQuery.indexInItemRegistry; 55 | + return potentialSingleIndex == itemToQuery.indexInVanillaOnlyItemRegistry ? potentialSingleIndex : -1; 56 | + } 57 | + // Fiddle end - client perspective - base ids on perspective - provide - item 58 | + 59 | @Override 60 | public int hashCode() { 61 | return this.category.ordinal(); 62 | -------------------------------------------------------------------------------- /patches/server/0107-Client-perspective-Base-ids-on-perspective-Block-sta.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Wed, 3 Jan 2024 21:04:16 +0100 4 | Subject: [PATCH] Client perspective - Base ids on perspective - Block state - 5 | Provide 6 | 7 | Provides functionality to base `BlockState` ids (the ids they are identified by in packets sent to clients) on the target client's perspective. 8 | For clients that can understand the server-side block state ids directly, the id is taken from the regular registry (`Block.BLOCK_STATE_REGISTRY`), and for those who do not, the ids are taken from the vanilla-only registry (`Block.VANILLA_ONLY_BLOCK_STATE_REGISTRY`). 9 | 10 | Does not add any usages of this functionality, those are added in the "Client perspective - Base ids on perspective - Block state - Apply to effect data value", "Base ids on perspective - Block state - Apply to level event data value" and "Client perspective - Base ids on perspective - Block state - Apply to block update packets" patches. 11 | 12 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 13 | Fiddle - https://fiddlemc.org 14 | 15 | diff --git a/src/main/java/org/fiddlemc/fiddle/packet/ClientPerspective.java b/src/main/java/org/fiddlemc/fiddle/packet/ClientPerspective.java 16 | index 9509fc70120390c17f0f4379ce96b9e6f57b716a..5fae2b39501b0908e25b558e2dce17f486a0b93a 100644 17 | --- a/src/main/java/org/fiddlemc/fiddle/packet/ClientPerspective.java 18 | +++ b/src/main/java/org/fiddlemc/fiddle/packet/ClientPerspective.java 19 | @@ -133,6 +133,44 @@ public class ClientPerspective { 20 | } 21 | // Fiddle end - client perspective - base ids on perspective - provide - item 22 | 23 | + // Fiddle start - client perspective - base ids on perspective - provide - block state 24 | + /** 25 | + * The {@link net.minecraft.core.IdMap} that 26 | + * {@linkplain net.minecraft.core.IdMap#getId provides} the ids for 27 | + * {@linkplain net.minecraft.world.level.block.state.BlockState block states} 28 | + * that a client with this perspective interprets correctly. 29 | + */ 30 | + public net.minecraft.core.IdMap getPacketBlockStateIdMap() { 31 | + return understandsServerSideItemsAndBlocks ? net.minecraft.world.level.block.Block.BLOCK_STATE_REGISTRY : net.minecraft.world.level.block.Block.VANILLA_ONLY_BLOCK_STATE_REGISTRY; 32 | + } 33 | + 34 | + /** 35 | + * The id provided by this perspective's {@link #getPacketBlockStateIdMap()}, 36 | + * for the given {@link net.minecraft.world.level.block.state.BlockState}. 37 | + * A null value will be interpreted as the 38 | + * {@linkplain net.minecraft.world.level.block.Block#defaultBlockState()} of 39 | + * {@link net.minecraft.world.level.block.Blocks#AIR}. 40 | + *

41 | + * This is based on {@link #getPacketBlockStateIdMap()}, but uses the cached id for optimization instead. 42 | + *

43 | + */ 44 | + public int getPacketBlockStateId(@org.jetbrains.annotations.Nullable net.minecraft.world.level.block.state.BlockState state) { 45 | + var stateToQuery = state == null ? net.minecraft.world.level.block.Blocks.AIR.defaultBlockState() : state; 46 | + return understandsServerSideItemsAndBlocks ? stateToQuery.indexInBlockStateRegistry : stateToQuery.indexInVanillaOnlyBlockStateRegistry; 47 | + } 48 | + 49 | + /** 50 | + * @return The single {@link #getPacketBlockStateId} value for the given 51 | + * {@link net.minecraft.world.level.block.state.BlockState}, if it is the same 52 | + * for all possible perspectives, or -1 otherwise. 53 | + */ 54 | + public static int getSinglePacketBlockStateId(@org.jetbrains.annotations.Nullable net.minecraft.world.level.block.state.BlockState state) { 55 | + var stateToQuery = state == null ? net.minecraft.world.level.block.Blocks.AIR.defaultBlockState() : state; 56 | + int potentialSingleIndex = stateToQuery.indexInBlockStateRegistry; 57 | + return potentialSingleIndex == stateToQuery.indexInVanillaOnlyBlockStateRegistry ? potentialSingleIndex : -1; 58 | + } 59 | + // Fiddle end - client perspective - base ids on perspective - provide - block state 60 | + 61 | @Override 62 | public int hashCode() { 63 | return this.category.ordinal(); 64 | -------------------------------------------------------------------------------- /patches/server/0109-Client-perspective-Level-event-data-value-replacemen.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sat, 10 Feb 2024 13:35:46 +0100 4 | Subject: [PATCH] Client perspective - Level event data value replacements - 5 | Adapt packet data when writing 6 | 7 | A `ClientboundLevelEventPacket` will be written to a buffer with the return value of `getData()` method instead of the `data` field, 8 | so that the method can be expanded to include adaptations based on the target connection of the packet. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelEventPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelEventPacket.java 14 | index dc5d118ff78137339335dceef9fb1d123bd96411..2c31c8d55d716b1660412218d5287da672ab45f6 100644 15 | --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelEventPacket.java 16 | +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelEventPacket.java 17 | @@ -43,7 +43,7 @@ public class ClientboundLevelEventPacket extends org.fiddlemc.fiddle.packet.Clon 18 | public void write(FriendlyByteBuf buf) { 19 | buf.writeInt(this.type); 20 | buf.writeBlockPos(this.pos); 21 | - buf.writeInt(this.data); 22 | + buf.writeInt(this.getData()); // Fiddle end - client perspective - store connection explicitly - allow written data to differ based on connection 23 | buf.writeBoolean(this.globalEvent); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /patches/server/0111-Client-perspective-Level-event-data-value-replacemen.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Thu, 4 Jan 2024 17:14:24 +0100 4 | Subject: [PATCH] Client perspective - Level event data value replacements - 5 | Craft effect data value can be generic 6 | 7 | As an expansion to the "Client perspective - Level event data value replacements - Data can be generic" patch, 8 | this also allows the value returned by `CraftEffect.getDataValue` to have any type. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | diff --git a/src/main/java/org/bukkit/craftbukkit/CraftEffect.java b/src/main/java/org/bukkit/craftbukkit/CraftEffect.java 14 | index 457e9093adb99d31ffc7f061d8c858f98c5d0572..8a5dd44bca94e678a42eb66a0a1400907c19a8c2 100644 15 | --- a/src/main/java/org/bukkit/craftbukkit/CraftEffect.java 16 | +++ b/src/main/java/org/bukkit/craftbukkit/CraftEffect.java 17 | @@ -13,8 +13,10 @@ import org.bukkit.craftbukkit.inventory.CraftItemType; 18 | import org.bukkit.potion.Potion; 19 | 20 | public class CraftEffect { 21 | - public static int getDataValue(Effect effect, T data) { 22 | - int datavalue; 23 | + // Fiddle start - client perspective - level event data value replacements - craft effect data value can be generic 24 | + public static Object getDataValue(Effect effect, T data) { 25 | + Object datavalue; 26 | + // Fiddle end - client perspective - level event data value replacements - craft effect data value can be generic 27 | switch (effect) { 28 | case PARTICLES_SCULK_CHARGE: // Paper - add missing effects 29 | case TRIAL_SPAWNER_DETECT_PLAYER: // Paper - add missing effects 30 | diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java 31 | index bfb178c69026e9759e9afaebb9da141b62d1f144..4b51ea9c99169c53a3a6f64f67a62c30443a2d63 100644 32 | --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java 33 | +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java 34 | @@ -1435,7 +1435,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { 35 | Preconditions.checkArgument(effect.getData() == null || effect == Effect.ELECTRIC_SPARK, "Wrong kind of data for the %s effect", effect); 36 | } 37 | 38 | - int datavalue = CraftEffect.getDataValue(effect, data); 39 | + var datavalue = CraftEffect.getDataValue(effect, data); // Fiddle - client perspective - level event data value replacements - craft effect data value can be generic 40 | this.playEffect(loc, effect, datavalue, radius); 41 | } 42 | 43 | diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 44 | index bc731fe740196472baca631f2956b28a743ec0a0..66e38fdc02e732364bddec503b8d27bd12a05395 100644 45 | --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 46 | +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 47 | @@ -851,7 +851,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { 48 | Preconditions.checkArgument(effect.getData() == null || effect == Effect.ELECTRIC_SPARK, "Wrong kind of data for the %s effect", effect); 49 | } 50 | 51 | - int datavalue = CraftEffect.getDataValue(effect, data); 52 | + var datavalue = CraftEffect.getDataValue(effect, data); // Fiddle - client perspective - level event data value replacements - craft effect data value can be generic 53 | this.playEffect(loc, effect, datavalue); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /patches/server/0114-Client-perspective-Deep-replacements-Cache-client-pe.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sat, 29 Jul 2023 11:01:29 +0200 4 | Subject: [PATCH] Client perspective - Deep replacements - Cache client 5 | perspective and settings supplier in FriendlyByteBuf 6 | 7 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 8 | Fiddle - https://fiddlemc.org 9 | 10 | diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java 11 | index 42ada45bc640b780581c908282939f3a9ccf2831..9edac88eaf09929a29591aac237587df44a2a738 100644 12 | --- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java 13 | +++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java 14 | @@ -102,6 +102,8 @@ public class FriendlyByteBuf extends ByteBuf { 15 | public @Nullable java.lang.ref.WeakReference> writingPacket; 16 | // Fiddle end - client perspective - packets are modifiable - store explicit perspective and locale - FriendlyByteBuf 17 | 18 | + private @Nullable org.fiddlemc.fiddle.packet.deepreplacement.DeepReplacementContext replacementContextSupplier; // Fiddle - client perspective - deep replacements - context - cache in FriendlyByteBuf 19 | + 20 | public FriendlyByteBuf(ByteBuf parent) { 21 | this.source = parent; 22 | } 23 | @@ -1758,4 +1760,13 @@ public class FriendlyByteBuf extends ByteBuf { 24 | } 25 | // Fiddle end - client perspective - packets are modifiable - expose target client properties - can be used by FriendlyByteBuf 26 | 27 | + // Fiddle start - client perspective - deep replacements - context - cache in FriendlyByteBuf 28 | + public org.fiddlemc.fiddle.packet.deepreplacement.DeepReplacementContext getDeepReplacementContext() { 29 | + if (this.replacementContextSupplier == null) { 30 | + this.replacementContextSupplier = org.fiddlemc.fiddle.packet.deepreplacement.DeepReplacementContext.forFriendlyByteBuf(this); 31 | + } 32 | + return this.replacementContextSupplier; 33 | + } 34 | + // Fiddle end - client perspective - deep replacements - context - cache in FriendlyByteBuf 35 | + 36 | } 37 | -------------------------------------------------------------------------------- /patches/server/0120-Client-perspective-Deep-replacements-Method-to-send-.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sun, 30 Jul 2023 18:08:52 +0200 4 | Subject: [PATCH] Client perspective - Deep replacements - Method to send 5 | updates 6 | 7 | Adds a method to send the necessary updates to a player when 8 | the way they observe deep replaceables may have changed. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java 14 | index 21b31b0cef30b38d9fcb0d990c3de34d26e260d6..11db6d28df1c60af1744833239915b3c1ad3f502 100644 15 | --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java 16 | +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java 17 | @@ -2783,4 +2783,32 @@ public class ServerPlayer extends Player { 18 | } 19 | // Fiddle end - client perspective - player 20 | 21 | + // Fiddle start - client perspective - deep replacements - send updates 22 | + /** 23 | + * Sends all necessary packets to this player to update any deep replaceable content 24 | + * after the content that the client should observe may have changed. 25 | + *
26 | + * This method should be called whenever something about the player or their client changes that influences 27 | + * deep replacements. 28 | + */ 29 | + public void sendUpdatesForDeepReplaceableContent(boolean itemsMayHaveChanged, boolean translationsMayHaveChanged) { 30 | + 31 | + // Items contain items, so we make sure that this implication is set correctly 32 | + itemsMayHaveChanged |= translationsMayHaveChanged; 33 | + 34 | + if (itemsMayHaveChanged) { 35 | + // Resend the player's own inventory contents 36 | + this.getBukkitEntity().updateInventory(); 37 | + } 38 | + 39 | + // TODO if itemsMayHaveChanged, re-send tracked entity synched data 40 | + // TODO if itemsMayHaveChanged, re-send all visible block entity data 41 | + // TODO if itemsMayHaveChanged, re-send contents of other inventory that player has open 42 | + // TODO if translationsMayHaveChanged, update title of inventory that player has open 43 | + // TODO if translationsMayHaveChanged, update other visible texts to player like boss bar text 44 | + // TODO if translationsMayHaveChanged, update book content if they have one open maybe? 45 | + 46 | + } 47 | + // Fiddle end - client perspective - deep replacements - send updates 48 | + 49 | } 50 | -------------------------------------------------------------------------------- /patches/server/0122-Client-perspective-Localization-Send-replaceable-upd.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sun, 23 Jul 2023 18:40:48 +0200 4 | Subject: [PATCH] Client perspective - Localization - Send replaceable updates 5 | after locale change 6 | 7 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 8 | Fiddle - https://fiddlemc.org 9 | 10 | diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java 11 | index 11db6d28df1c60af1744833239915b3c1ad3f502..3de1597e494b5504eff762cbc15d0e32f34abcb7 100644 12 | --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java 13 | +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java 14 | @@ -2148,7 +2148,10 @@ public class ServerPlayer extends Player { 15 | PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), this.getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT); 16 | this.server.server.getPluginManager().callEvent(event); 17 | } 18 | - if (this.language == null || !this.language.equals(clientOptions.language())) { // Paper 19 | + // Fiddle start - client perspective - localization - send update packets for replaceables after locale change 20 | + boolean localeChanged = this.language == null || !this.language.equals(clientOptions.language()); // Paper 21 | + if (localeChanged) { 22 | + // Fiddle end - client perspective - localization - send update packets for replaceables after locale change 23 | PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(this.getBukkitEntity(), clientOptions.language()); 24 | this.server.server.getPluginManager().callEvent(event); 25 | this.server.server.getPluginManager().callEvent(new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), this.language, clientOptions.language())); // Paper 26 | @@ -2160,6 +2163,12 @@ public class ServerPlayer extends Player { 27 | public void updateOptionsNoEvents(ClientInformation clientOptions) { 28 | // Paper end 29 | this.language = clientOptions.language(); 30 | + // Fiddle start - client perspective - localization - send update packets for replaceables after locale change 31 | + boolean localeChanged = this.language == null || !this.language.equals(clientOptions.language()); // Paper 32 | + if (localeChanged) { 33 | + this.sendUpdatesForDeepReplaceableContent(true, true); 34 | + } 35 | + // Fiddle end - client perspective - localization - send update packets for replaceables after locale change 36 | this.adventure$locale = java.util.Objects.requireNonNullElse(net.kyori.adventure.translation.Translator.parseLocale(this.language), java.util.Locale.US); // Paper 37 | this.requestedViewDistance = clientOptions.viewDistance(); 38 | this.chatVisibility = clientOptions.chatVisibility(); 39 | -------------------------------------------------------------------------------- /patches/server/0125-Client-perspective-Block-state-visualization-BlockSt.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Fri, 5 Jan 2024 18:05:16 +0100 4 | Subject: [PATCH] Client perspective - Block state visualization - BlockState 5 | field for visualization setupper 6 | 7 | Adds a field in `BlockState` to hold the visualization setupper for that state. 8 | 9 | Does not implement anything that sets or gets this value. 10 | 11 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 12 | Fiddle - https://fiddlemc.org 13 | 14 | diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockState.java b/src/main/java/net/minecraft/world/level/block/state/BlockState.java 15 | index d080b9759afe283d79227076eea3b075af37c0cd..9b3d7fa1801d267ee0eca0c6899c826a91d23a05 100644 16 | --- a/src/main/java/net/minecraft/world/level/block/state/BlockState.java 17 | +++ b/src/main/java/net/minecraft/world/level/block/state/BlockState.java 18 | @@ -71,4 +71,14 @@ public class BlockState extends BlockBehaviour.BlockStateBase { 19 | protected BlockState asState() { 20 | return this; 21 | } 22 | + 23 | + // Fiddle start - client perspective - block state visualization - BlockState field for visualization setupper 24 | + /** 25 | + * The {@linkplain org.fiddlemc.fiddle.packet.block.BlockStateVisualizationSetupper} 26 | + * that can set up the visualizations for this {@link BlockState}. 27 | + * If null, there exist no replacements for this state, and it is always sent to clients as-is. 28 | + */ 29 | + public @org.jetbrains.annotations.Nullable org.fiddlemc.fiddle.packet.block.BlockStateVisualizationSetupper visualizationSetupper = null; 30 | + // Fiddle end - client perspective - block state visualization - BlockState field for visualization setupper 31 | + 32 | } 33 | diff --git a/src/main/java/org/fiddlemc/fiddle/packet/block/OnePerCategoryBlockStateVisualizationSetupper.java b/src/main/java/org/fiddlemc/fiddle/packet/block/OnePerCategoryBlockStateVisualizationSetupper.java 34 | index 2b9fe6ea436d698bf5b8f420cb1302b5ec37b144..255f033ccb87e3e812e1ba7359d762ff05d5f181 100644 35 | --- a/src/main/java/org/fiddlemc/fiddle/packet/block/OnePerCategoryBlockStateVisualizationSetupper.java 36 | +++ b/src/main/java/org/fiddlemc/fiddle/packet/block/OnePerCategoryBlockStateVisualizationSetupper.java 37 | @@ -40,7 +40,10 @@ public final class OnePerCategoryBlockStateVisualizationSetupper implements Bloc 38 | /** 39 | * Always return false; 40 | *
41 | - * Could theoretically be true if all the possible replacements equal the given actual {@link BlockState}. 42 | + * 43 | + * Could theoretically be true if all the possible replacements equal the given actual {@link BlockState}, 44 | + * but in that case {@link BlockState#visualizationSetupper} should be set to null instead of to this setupper. 45 | + * 46 | */ 47 | @Override 48 | public @NotNull Boolean preCheckWhetherDefinitelyHasNoVisualizationDifferentThanItself( 49 | -------------------------------------------------------------------------------- /patches/server/0127-Client-perspective-Block-state-visualization-Level-e.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sat, 10 Feb 2024 10:59:19 +0100 4 | Subject: [PATCH] Client perspective - Block state visualization - Level event 5 | data - Block break particles 6 | 7 | Registers `LevelEvent.PARTICLES_DESTROY_BLOCK` as a level event type where the data represents a block state. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelEventPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelEventPacket.java 13 | index 77bf1cd34da27372ffd00c098e1e630236dc2caa..9a18265f7ab69077d4199f5013846511587a83a0 100644 14 | --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelEventPacket.java 15 | +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelEventPacket.java 16 | @@ -7,8 +7,10 @@ import net.minecraft.network.protocol.Packet; 17 | public class ClientboundLevelEventPacket extends org.fiddlemc.fiddle.packet.CloningPacketWithExplicitTargetClientConnection { // Fiddle - client perspective - level event data value replacements - store connection explicitly 18 | // Fiddle start - client perspective - block state visualization - level event data - data can be BlockState 19 | private final static int[] typesWhereDataIsBlockState = { 20 | + net.minecraft.world.level.block.LevelEvent.PARTICLES_DESTROY_BLOCK, // Fiddle - client perspective - block state visualization - level event data - block break particles 21 | }; 22 | private final static org.fiddlemc.fiddle.packet.block.BlockStateVisualizationSetupper.BlockStateVisualizationPurpose[] blockStateVisualizationPurposeForTypes = { 23 | + org.fiddlemc.fiddle.packet.block.BlockStateVisualizationSetupper.BlockStateVisualizationPurpose.PARTICLE, // Fiddle - client perspective - block state visualization - level event data - block break particles 24 | }; 25 | // Fiddle end - client perspective - block state visualization - level event data - data can be BlockState 26 | private final int type; 27 | -------------------------------------------------------------------------------- /patches/server/0128-Client-perspective-Block-state-visualization-Level-e.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sat, 10 Feb 2024 11:01:28 +0100 4 | Subject: [PATCH] Client perspective - Block state visualization - Level event 5 | data - Block brush completion 6 | 7 | Registers `LevelEvent.PARTICLES_AND_SOUND_BRUSH_BLOCK_COMPLETE` as a level event type where the data represents a block state. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelEventPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelEventPacket.java 13 | index 9a18265f7ab69077d4199f5013846511587a83a0..e447801333cf4ad744e2b4e22fa9404f7296aee2 100644 14 | --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelEventPacket.java 15 | +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelEventPacket.java 16 | @@ -8,9 +8,11 @@ public class ClientboundLevelEventPacket extends org.fiddlemc.fiddle.packet.Clon 17 | // Fiddle start - client perspective - block state visualization - level event data - data can be BlockState 18 | private final static int[] typesWhereDataIsBlockState = { 19 | net.minecraft.world.level.block.LevelEvent.PARTICLES_DESTROY_BLOCK, // Fiddle - client perspective - block state visualization - level event data - block break particles 20 | + net.minecraft.world.level.block.LevelEvent.PARTICLES_AND_SOUND_BRUSH_BLOCK_COMPLETE, // Fiddle - client perspective - block state visualization - level event data - block brush complete 21 | }; 22 | private final static org.fiddlemc.fiddle.packet.block.BlockStateVisualizationSetupper.BlockStateVisualizationPurpose[] blockStateVisualizationPurposeForTypes = { 23 | org.fiddlemc.fiddle.packet.block.BlockStateVisualizationSetupper.BlockStateVisualizationPurpose.PARTICLE, // Fiddle - client perspective - block state visualization - level event data - block break particles 24 | + org.fiddlemc.fiddle.packet.block.BlockStateVisualizationSetupper.BlockStateVisualizationPurpose.PARTICLE, // Fiddle - client perspective - block state visualization - level event data - block brush complete 25 | }; 26 | // Fiddle end - client perspective - block state visualization - level event data - data can be BlockState 27 | private final int type; 28 | -------------------------------------------------------------------------------- /patches/server/0132-Client-perspective-Block-state-visualization-Apply-t.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sat, 30 Dec 2023 21:26:58 +0100 4 | Subject: [PATCH] Client perspective - Block state visualization - Apply to 5 | chunk packets - Store connection explicitly in chunk packets 6 | 7 | Makes all instances of `ClientboundLevelChunkWithLightPacket` bound to a particular explicit target connection. 8 | This is done by making it a subclass of `PacketWithExplicitTargetClientConnection`. 9 | 10 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 11 | Fiddle - https://fiddlemc.org 12 | 13 | diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java 14 | index ff0e55b53062793d6e462870146471ad8884831b..d4d5116b46c63bcc1b2a86c1b75cd0c09d0a71fd 100644 15 | --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java 16 | +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java 17 | @@ -8,7 +8,7 @@ import net.minecraft.world.level.ChunkPos; 18 | import net.minecraft.world.level.chunk.LevelChunk; 19 | import net.minecraft.world.level.lighting.LevelLightEngine; 20 | 21 | -public class ClientboundLevelChunkWithLightPacket implements Packet { 22 | +public class ClientboundLevelChunkWithLightPacket extends org.fiddlemc.fiddle.packet.PacketWithExplicitTargetClientConnection { // Fiddle - client perspective - block state visualization - apply to chunk packets - store connection explicitly 23 | private final int x; 24 | private final int z; 25 | private final ClientboundLevelChunkPacketData chunkData; 26 | @@ -29,6 +29,7 @@ public class ClientboundLevelChunkWithLightPacket implements Packet 3 | Date: Sat, 30 Dec 2023 21:37:02 +0100 4 | Subject: [PATCH] Client perspective - Block state visualization - Apply to 5 | chunk packets - Do not multicast chunk packets for anti-x-ray 6 | 7 | Removes the mechanism by which constructed `ClientboundLevelChunkWithLightPacket` instances may be sent to multiple targets, if they all must or all must not have anti-x-ray applied. 8 | 9 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 10 | Fiddle - https://fiddlemc.org 11 | 12 | diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java 13 | index 4b51ea9c99169c53a3a6f64f67a62c30443a2d63..099942a8c4c7f9b3f295a2f6b1a645be36468013 100644 14 | --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java 15 | +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java 16 | @@ -531,14 +531,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { 17 | if (playersInRange.isEmpty()) return true; // Paper - rewrite player chunk loader 18 | 19 | // Paper start - Anti-Xray - Bypass 20 | - Map refreshPackets = new HashMap<>(); 21 | for (ServerPlayer player : playersInRange) { 22 | if (player.connection == null) continue; 23 | 24 | - Boolean shouldModify = chunk.getLevel().chunkPacketBlockController.shouldModify(player, chunk); 25 | - player.connection.send(refreshPackets.computeIfAbsent(shouldModify, s -> { // Use connection to prevent creating firing event 26 | - return new ClientboundLevelChunkWithLightPacket(chunk, this.world.getLightEngine(), null, null, (Boolean) s); 27 | - })); 28 | + // Fiddle start - client perspective - block state visualization - apply to chunk packets - do not cache for anti-x-ray 29 | + boolean shouldModify = chunk.getLevel().chunkPacketBlockController.shouldModify(player, chunk); 30 | + var packet = new ClientboundLevelChunkWithLightPacket(chunk, this.world.getLightEngine(), null, null, shouldModify); 31 | + player.connection.send(packet); // Use connection to prevent creating firing event 32 | + // Fiddle end - client perspective - block state visualization - apply to chunk packets - do not cache for anti-x-ray 33 | // Paper end 34 | } 35 | // Paper - rewrite player chunk loader 36 | -------------------------------------------------------------------------------- /patches/server/0136-Client-perspective-Block-state-visualization-Apply-t.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Fri, 5 Jan 2024 20:01:17 +0100 4 | Subject: [PATCH] Client perspective - Block state visualization - Apply to 5 | chunk packets - Store ChunkPacketInfo and chunk details 6 | 7 | Store the following values in the `ClientboundLevelChunkWithLightPacket` when they are passed to the constructor: 8 | * `ChunkPacketInfo` 9 | * `Chunk.getSectionsCount()` 10 | * `Chunk.getPos()` 11 | * `Chunk.getLevel()` 12 | 13 | These are used in the "Client perspective - Block state visualization - Apply to chunk packets - Call setup for all blocks in chunk packet" patch. 14 | 15 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 16 | Fiddle - https://fiddlemc.org 17 | 18 | diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java 19 | index 7e496a59eb37af014ca34791b22ab4fde77f4852..a02c0217fc221684d6b2a09b3a408a511f8cee19 100644 20 | --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java 21 | +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java 22 | @@ -13,6 +13,12 @@ public class ClientboundLevelChunkWithLightPacket extends org.fiddlemc.fiddle.pa 23 | private final int z; 24 | private final ClientboundLevelChunkPacketData chunkData; 25 | private final ClientboundLightUpdatePacketData lightData; 26 | + // Fiddle start - block state visualization - apply to chunk packets - store ChunkPacketInfo and chunk details 27 | + public @Nullable com.destroystokyo.paper.antixray.ChunkPacketInfoAntiXray chunkPacketInfo; 28 | + public int sectionsCount; 29 | + public @Nullable ChunkPos chunkPos; 30 | + public @Nullable net.minecraft.server.level.ServerLevel level; 31 | + // Fiddle end - block state visualization - apply to chunk packets - store ChunkPacketInfo and chunk details 32 | // Paper start - Async-Anti-Xray - Ready flag for the connection 33 | private volatile boolean ready; 34 | 35 | @@ -36,6 +42,12 @@ public class ClientboundLevelChunkWithLightPacket extends org.fiddlemc.fiddle.pa 36 | // Fiddle start - client perspective - block state visualization - apply to chunk packets - every ChunkPacketInfo is ChunkPacketInfoAntiXray 37 | boolean isChunkPacketInfoNeeded = modifyBlocks; 38 | var chunkPacketInfo = isChunkPacketInfoNeeded ? chunk.getLevel().chunkPacketBlockController.getChunkPacketInfo(this, chunk, modifyBlocks) : null; // No effective changes to this field except the type is inferred 39 | + // Fiddle start - block state visualization - apply to chunk packets - store ChunkPacketInfo and chunk details 40 | + this.chunkPacketInfo = chunkPacketInfo; 41 | + this.sectionsCount = chunk.getSectionsCount(); 42 | + this.chunkPos = chunk.getPos(); 43 | + this.level = (net.minecraft.server.level.ServerLevel) chunk.getLevel(); 44 | + // Fiddle end - block state visualization - apply to chunk packets - store ChunkPacketInfo and chunk details 45 | // Fiddle end - client perspective - block state visualization - apply to chunk packets - every ChunkPacketInfo is ChunkPacketInfoAntiXray 46 | this.chunkData = new ClientboundLevelChunkPacketData(this, chunk, chunkPacketInfo); // Fiddle - client perspective - block state visualization - apply to chunk packets - ClientboundLevelChunkPacketData has a reference to its ClientboundLevelChunkWithLightPacket 47 | // Paper end 48 | -------------------------------------------------------------------------------- /patches/server/0141-Client-perspective-Item-replacements-Item-field-for-.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sat, 22 Jul 2023 20:14:25 +0200 4 | Subject: [PATCH] Client perspective - Item replacements - Item field for 5 | visual handle 6 | 7 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 8 | Fiddle - https://fiddlemc.org 9 | 10 | diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java 11 | index 965144138d2764c4026cc7e90c87e8becd385f73..a96872dc4b6d65e76cd8b6d7d288a1df152e425f 100644 12 | --- a/src/main/java/net/minecraft/world/item/Item.java 13 | +++ b/src/main/java/net/minecraft/world/item/Item.java 14 | @@ -125,6 +125,21 @@ public class Item implements FeatureElement, ItemLike { 15 | public int indexInVanillaOnlyItemRegistry = -1; 16 | // Fiddle end - cache registry indices as fields - item 17 | 18 | + // Fiddle start - client perspective - item replacements - Item field for visual handle 19 | + /** 20 | + * One of the following: 21 | + *
    22 | + *
  • The {@link org.fiddlemc.fiddle.packet.item.ItemVisualHandleProvider} that provides the desired 23 | + * {@link org.fiddlemc.fiddle.packet.item.ItemVisualHandle}s for {@link ItemStack}s of this 24 | + * {@linkplain Item item type}.
  • 25 | + *
  • The desired {@link org.fiddlemc.fiddle.packet.item.ItemVisualHandle} of this item directly 26 | + * (if it is the same for all {@link ItemStack}s of this item type).
  • 27 | + *
  • Null if all {@link ItemStack}s of this item type can be sent unmodified to all possible clients.
  • 28 | + *
29 | + */ 30 | + public @org.jetbrains.annotations.Nullable Object visualHandleOrProvider = null; 31 | + // Fiddle end - client perspective - item replacements - Item field for visual handle 32 | + 33 | public static int getId(Item item) { 34 | return item == null ? 0 : BuiltInRegistries.ITEM.getId(item); 35 | } 36 | -------------------------------------------------------------------------------- /patches/server/0144-Client-perspective-Item-replacements-Pass-context-of.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sun, 23 Jul 2023 11:11:53 +0200 4 | Subject: [PATCH] Client perspective - Item replacements - Pass context of 5 | stonecutter recipe results 6 | 7 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 8 | Fiddle - https://fiddlemc.org 9 | 10 | diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeSerializer.java b/src/main/java/net/minecraft/world/item/crafting/RecipeSerializer.java 11 | index 6995abf9a50071961455c939199449b2be932e0e..fc7686f9b77ff31c2c0d4d7198a9e3eab9df5fb8 100644 12 | --- a/src/main/java/net/minecraft/world/item/crafting/RecipeSerializer.java 13 | +++ b/src/main/java/net/minecraft/world/item/crafting/RecipeSerializer.java 14 | @@ -25,7 +25,7 @@ public interface RecipeSerializer> { 15 | RecipeSerializer BLASTING_RECIPE = register("blasting", new SimpleCookingSerializer<>(BlastingRecipe::new, 100)); 16 | RecipeSerializer SMOKING_RECIPE = register("smoking", new SimpleCookingSerializer<>(SmokingRecipe::new, 100)); 17 | RecipeSerializer CAMPFIRE_COOKING_RECIPE = register("campfire_cooking", new SimpleCookingSerializer<>(CampfireCookingRecipe::new, 100)); 18 | - RecipeSerializer STONECUTTER = register("stonecutting", new SingleItemRecipe.Serializer<>(StonecutterRecipe::new)); 19 | + RecipeSerializer STONECUTTER = register("stonecutting", new StonecutterRecipe.Serializer()); // Fiddle - client perspective - item replacements - pass context of stonecutter recipe results 20 | RecipeSerializer SMITHING_TRANSFORM = register("smithing_transform", new SmithingTransformRecipe.Serializer()); 21 | RecipeSerializer SMITHING_TRIM = register("smithing_trim", new SmithingTrimRecipe.Serializer()); 22 | RecipeSerializer DECORATED_POT_RECIPE = register("crafting_decorated_pot", new SimpleCraftingRecipeSerializer<>(DecoratedPotRecipe::new)); 23 | diff --git a/src/main/java/net/minecraft/world/item/crafting/StonecutterRecipe.java b/src/main/java/net/minecraft/world/item/crafting/StonecutterRecipe.java 24 | index 2e55d00756bfa52daeff7324d305651668e2b01f..7f47976feb13f6e751225d207b118aca157a68ce 100644 25 | --- a/src/main/java/net/minecraft/world/item/crafting/StonecutterRecipe.java 26 | +++ b/src/main/java/net/minecraft/world/item/crafting/StonecutterRecipe.java 27 | @@ -47,4 +47,28 @@ public class StonecutterRecipe extends SingleItemRecipe { 28 | } 29 | // Fiddle end - gameplay mechanics - automatically extend stonecutter recipes 30 | 31 | + // Fiddle start - client perspective - item replacements - pass context of stonecutter recipe results 32 | + /** 33 | + * A {@link SingleItemRecipe.Serializer} that writes the {@link #result} 34 | + * of a stone cutter recipe to a {@link net.minecraft.network.FriendlyByteBuf} with its 35 | + * {@linkplain org.fiddlemc.fiddle.packet.item.ItemStackInPacketContext#STONECUTTER_RECIPE_RESULT distinguishing context}. 36 | + */ 37 | + public static class Serializer extends SingleItemRecipe.Serializer { 38 | + 39 | + protected Serializer() { 40 | + super(StonecutterRecipe::new); 41 | + } 42 | + 43 | + @Override 44 | + public void toNetwork(net.minecraft.network.FriendlyByteBuf buf, StonecutterRecipe recipe) { 45 | + // Based on SingleItemRecipe.Serializer#toNetwork 46 | + buf.writeUtf(recipe.group); 47 | + recipe.ingredient.toNetwork(buf); 48 | + // Use the distinguishing context 49 | + buf.writeItem(recipe.result, org.fiddlemc.fiddle.packet.item.ItemStackInPacketContext.STONECUTTER_RECIPE_RESULT); 50 | + } 51 | + 52 | + } 53 | + // Fiddle end - client perspective - item replacements - pass context of stonecutter recipe results 54 | + 55 | } 56 | -------------------------------------------------------------------------------- /patches/server/0148-Client-perspective-Item-replacements-Send-replaceabl.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sun, 30 Jul 2023 18:18:35 +0200 4 | Subject: [PATCH] Client perspective - Item replacements - Send replaceable 5 | updates after game mode change 6 | 7 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 8 | Fiddle - https://fiddlemc.org 9 | 10 | diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java 11 | index a7b217ddbcbf92513bd38101fdfca2075505e267..fdca32a8d8c32d546ec196acb7e0dad64319fdab 100644 12 | --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java 13 | +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java 14 | @@ -103,6 +103,13 @@ public class ServerPlayerGameMode { 15 | protected void setGameModeForPlayer(GameType gameMode, @Nullable GameType previousGameMode) { 16 | this.previousGameModeForPlayer = previousGameMode; 17 | this.gameModeForPlayer = gameMode; 18 | + // Fiddle start - client perspective - item replacements - send update packets for replaceables after game mode change 19 | + if (previousGameMode != gameMode) { 20 | + if (previousGameMode == GameType.CREATIVE || gameMode == GameType.CREATIVE) { 21 | + this.player.sendUpdatesForDeepReplaceableContent(true, false); 22 | + } 23 | + } 24 | + // Fiddle end - client perspective - item replacements - send update packets for replaceables after game mode change 25 | gameMode.updatePlayerAbilities(this.player.getAbilities()); 26 | } 27 | 28 | -------------------------------------------------------------------------------- /patches/server/0149-Client-perspective-Localization-Register-server-side.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sun, 23 Jul 2023 18:25:11 +0200 4 | Subject: [PATCH] Client perspective - Localization - Register server-side 5 | translations 6 | 7 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 8 | Fiddle - https://fiddlemc.org 9 | 10 | diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java 11 | index b3f92920b020b305d5e7e21acedd36c58acc9234..081d4ac40f02836f2d645cc11f5c2a24e09db1bf 100644 12 | --- a/src/main/java/net/minecraft/server/Main.java 13 | +++ b/src/main/java/net/minecraft/server/Main.java 14 | @@ -170,6 +170,7 @@ public class Main { 15 | DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support 16 | 17 | org.fiddlemc.fiddle.pack.load.fiddlecontent.block.BlockStateVisualizationLoader.determineAndStore(); // Fiddle - client perspective - block state visualization - determine and store desired setuppers 18 | + org.fiddlemc.fiddle.pack.load.assets.lang.TranslationLoader.registerServerSideTranslations(); // Fiddle - client perspective - localization - register server-side translations 19 | 20 | // Fiddle start - modifiable Bukkit enums - inject runtime versions - common utilities 21 | ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); 22 | diff --git a/src/main/java/org/fiddlemc/fiddle/pack/load/assets/lang/TranslationLoader.java b/src/main/java/org/fiddlemc/fiddle/pack/load/assets/lang/TranslationLoader.java 23 | new file mode 100644 24 | index 0000000000000000000000000000000000000000..15a029d27e2d96ddaa7a7e2eed264cab14be134a 25 | --- /dev/null 26 | +++ b/src/main/java/org/fiddlemc/fiddle/pack/load/assets/lang/TranslationLoader.java 27 | @@ -0,0 +1,31 @@ 28 | +// Fiddle - client perspective - localization - register server-side translations 29 | + 30 | +package org.fiddlemc.fiddle.pack.load.assets.lang; 31 | + 32 | +import net.minecraft.core.registries.BuiltInRegistries; 33 | +import org.fiddlemc.fiddle.packet.locale.ServerSideTranslations; 34 | + 35 | +/** 36 | + * A utility class to load the translations and store them in {@link ServerSideTranslations} 37 | + * so they can be used in packet replacements. 38 | + */ 39 | +public final class TranslationLoader { 40 | + 41 | + private TranslationLoader() { 42 | + throw new RuntimeException(); 43 | + } 44 | + 45 | + public static void registerServerSideTranslations() { 46 | + // TODO Another class should be able to read (consisting of call to scan and then call to parse) them from the resource pack, and then this should take those and use them 47 | + // The below is just a temp placeholder used for testing 48 | + for (var block : BuiltInRegistries.BLOCK) { 49 | + if (!block.isVanilla()) { 50 | + ServerSideTranslations.registerAddedTranslation("en_us", block.getDescriptionId(), "Fiddle " + block.keyInBlockRegistry.getPath()); 51 | + ServerSideTranslations.registerAddedTranslation("en_gb", block.getDescriptionId(), "Fiddle " + block.keyInBlockRegistry.getPath() + ", I say"); 52 | + ServerSideTranslations.registerAddedTranslation("zh_cn", block.getDescriptionId(), "小提琴 " + block.keyInBlockRegistry.getPath()); 53 | + } 54 | + } 55 | + ServerSideTranslations.registerVanillaTranslationReplacement("en_us", "block.minecraft.bookshelf", "Oak Bookshelf"); 56 | + } 57 | + 58 | +} 59 | -------------------------------------------------------------------------------- /patches/server/0150-Client-perspective-Item-replacements-Determine-and-s.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Sun, 23 Jul 2023 12:05:40 +0200 4 | Subject: [PATCH] Client perspective - Item replacements - Determine and store 5 | desired visual handles 6 | 7 | License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 8 | Fiddle - https://fiddlemc.org 9 | 10 | diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java 11 | index 081d4ac40f02836f2d645cc11f5c2a24e09db1bf..4366d74128605e3964415c507f506275847f0d66 100644 12 | --- a/src/main/java/net/minecraft/server/Main.java 13 | +++ b/src/main/java/net/minecraft/server/Main.java 14 | @@ -171,6 +171,7 @@ public class Main { 15 | 16 | org.fiddlemc.fiddle.pack.load.fiddlecontent.block.BlockStateVisualizationLoader.determineAndStore(); // Fiddle - client perspective - block state visualization - determine and store desired setuppers 17 | org.fiddlemc.fiddle.pack.load.assets.lang.TranslationLoader.registerServerSideTranslations(); // Fiddle - client perspective - localization - register server-side translations 18 | + org.fiddlemc.fiddle.pack.load.fiddlecontent.item.ItemVisualHandleLoader.determineAndStore(); // Fiddle end - client perspective - item replacements - determine and store desired visual handles 19 | 20 | // Fiddle start - modifiable Bukkit enums - inject runtime versions - common utilities 21 | ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); 22 | diff --git a/src/main/java/org/fiddlemc/fiddle/pack/load/fiddlecontent/item/ItemVisualHandleLoader.java b/src/main/java/org/fiddlemc/fiddle/pack/load/fiddlecontent/item/ItemVisualHandleLoader.java 23 | new file mode 100644 24 | index 0000000000000000000000000000000000000000..7114db6936767c2bd32286cd69e11475b2dc1021 25 | --- /dev/null 26 | +++ b/src/main/java/org/fiddlemc/fiddle/pack/load/fiddlecontent/item/ItemVisualHandleLoader.java 27 | @@ -0,0 +1,48 @@ 28 | +// Fiddle - client perspective - item replacements - determine and store desired visual handles 29 | + 30 | +package org.fiddlemc.fiddle.pack.load.fiddlecontent.item; 31 | + 32 | +import net.minecraft.core.registries.BuiltInRegistries; 33 | +import net.minecraft.world.item.BlockItem; 34 | +import net.minecraft.world.item.Item; 35 | +import net.minecraft.world.item.Items; 36 | +import net.minecraft.world.level.block.StairBlock; 37 | +import org.fiddlemc.fiddle.pack.read.fiddlecontent.definition.item.ItemDefinition; 38 | +import org.fiddlemc.fiddle.packet.item.ItemVisualHandle; 39 | +import org.fiddlemc.fiddle.packet.item.VanillaItemOverrideItemVisualHandle; 40 | + 41 | +import java.util.List; 42 | + 43 | +/** 44 | + * A utility class to determine and store the {@link ItemVisualHandle} of {@link Item}s, 45 | + * based on their actual runtime details (which will have been based on their {@link Item}s being 46 | + * {@linkplain ItemByDefinitionLoader#register(List) loaded} from their definitions), 47 | + * any relevant settings in their {@linkplain ItemDefinition definition} (such as specific strategy settings 48 | + * for the visuals) and the corresponding visual assets. 49 | + */ 50 | +public final class ItemVisualHandleLoader { 51 | + 52 | + private ItemVisualHandleLoader() { 53 | + throw new RuntimeException(); 54 | + } 55 | + 56 | + public static void determineAndStore() { 57 | + // TODO replace by actual implementation 58 | + for (var item : BuiltInRegistries.ITEM) { 59 | + if (!item.isVanilla()) { 60 | + Item replacement; 61 | + if (item instanceof BlockItem blockItem) { 62 | + if (blockItem.getBlock() instanceof StairBlock) { 63 | + replacement = Items.PRISMARINE_STAIRS; 64 | + } else { 65 | + replacement = Items.BLUE_WOOL; 66 | + } 67 | + } else { 68 | + replacement = Items.STICK; 69 | + } 70 | + item.visualHandleOrProvider = new VanillaItemOverrideItemVisualHandle(replacement, 0); 71 | + } 72 | + } 73 | + } 74 | + 75 | +} 76 | -------------------------------------------------------------------------------- /patches/server/0151-TEMP-Test-removing-feature-flags-from-specific-conte.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Martijn Muijsers 3 | Date: Fri, 16 Feb 2024 22:24:48 +0100 4 | Subject: [PATCH] TEMP Test removing feature flags from specific content 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java 8 | index f599f4cf574b77b3e9dbe3cc267a9a39127f547e..4330e75ff65067f580b01f7c758a4d7286eb89f8 100644 9 | --- a/src/main/java/net/minecraft/world/level/block/Blocks.java 10 | +++ b/src/main/java/net/minecraft/world/level/block/Blocks.java 11 | @@ -1045,7 +1045,7 @@ public class Blocks { 12 | public static final Block POLISHED_TUFF_STAIRS = register("polished_tuff_stairs", new StairBlock(POLISHED_TUFF.defaultBlockState(), BlockBehaviour.Properties.ofLegacyCopy(POLISHED_TUFF))); 13 | public static final Block POLISHED_TUFF_WALL = register("polished_tuff_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(POLISHED_TUFF).forceSolidOn())); 14 | public static final Block CHISELED_TUFF = register("chiseled_tuff", new Block(BlockBehaviour.Properties.ofLegacyCopy(TUFF).requiredFeatures(FeatureFlags.UPDATE_1_21))); 15 | - public static final Block TUFF_BRICKS = register("tuff_bricks", new Block(BlockBehaviour.Properties.ofLegacyCopy(TUFF).sound(SoundType.TUFF_BRICKS).requiredFeatures(FeatureFlags.UPDATE_1_21))); 16 | + public static final Block TUFF_BRICKS = register("tuff_bricks", new Block(BlockBehaviour.Properties.ofLegacyCopy(TUFF).sound(SoundType.TUFF_BRICKS).requiredFeatures())); 17 | public static final Block TUFF_BRICK_SLAB = register("tuff_brick_slab", new SlabBlock(BlockBehaviour.Properties.ofLegacyCopy(TUFF_BRICKS))); 18 | public static final Block TUFF_BRICK_STAIRS = register("tuff_brick_stairs", new StairBlock(TUFF_BRICKS.defaultBlockState(), BlockBehaviour.Properties.ofLegacyCopy(TUFF_BRICKS))); 19 | public static final Block TUFF_BRICK_WALL = register("tuff_brick_wall", new WallBlock(BlockBehaviour.Properties.ofLegacyCopy(TUFF_BRICKS).forceSolidOn())); 20 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | import java.util.Locale 2 | 3 | pluginManagement { 4 | repositories { 5 | gradlePluginPortal() 6 | maven("https://repo.papermc.io/repository/maven-public/") 7 | } 8 | } 9 | 10 | plugins { 11 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" 12 | } 13 | 14 | if (!file(".git").exists()) { 15 | // Fiddle start - build changes 16 | val errorText = """ 17 | 18 | =====================[ ERROR ]===================== 19 | The Fiddle project directory is not a properly cloned Git repository. 20 | 21 | In order to build Fiddle from source you must clone 22 | the Fiddle repository using Git, not download a code 23 | zip from GitHub. 24 | 25 | Built Fiddle jars are available for download at 26 | https://github.com/FiddleMC/Fiddle/actions 27 | 28 | See https://github.com/PaperMC/Paper/blob/master/CONTRIBUTING.md 29 | for further information on building and modifying Paper forks. 30 | =================================================== 31 | """.trimIndent() 32 | // Fiddle end - build changes 33 | error(errorText) 34 | } 35 | 36 | // Fiddle start - build changes 37 | rootProject.name = "fiddle" 38 | 39 | for (name in listOf("fiddle-api", "fiddle-server")) { 40 | // Fiddle end - build changes 41 | val projName = name.lowercase(Locale.ENGLISH) 42 | include(projName) 43 | findProject(":$projName")!!.projectDir = file(name) 44 | } 45 | --------------------------------------------------------------------------------