diff --git a/.editorconfig b/.editorconfig index b0747d3..4e9b813 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,7 +9,7 @@ ij_any_block_comment_at_first_column = false ij_any_line_comment_at_first_column = false ij_any_line_comment_add_space = true max_line_length = 120 -ij_visual_guides = 80 +ij_visual_guides = 16, 80 [*.tiny] indent_style=tab @@ -19,6 +19,7 @@ end_of_line=crlf [*.yml] indent_size=2 +ij_visual_guides = 8, 80 [*.patch] trim_trailing_whitespace=false diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 4701c19..9c1d33e 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -23,13 +23,13 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout action - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Validate Gradle Wrapper - uses: gradle/wrapper-validation-action@v1 + uses: gradle/actions/wrapper-validation@v4 - name: Set up JDK ${{ matrix.java }} ${{ matrix.jdk }} - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: ${{ matrix.java }} java-version: ${{ matrix.jdk }} diff --git a/.gitignore b/.gitignore index 4ffa844..e2c753c 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,4 @@ paper-api-generator compare.txt *.patch !patches/**/* +upstream diff --git a/build-data/dev-imports.txt b/build-data/dev-imports.txt index 1d9862a..9167438 100644 --- a/build-data/dev-imports.txt +++ b/build-data/dev-imports.txt @@ -12,3 +12,65 @@ # mc_data chat_type/chat.json # mc_data dimension_type/overworld.json # + +minecraft net/minecraft/server/commands/AdvancementCommands.java +minecraft net/minecraft/server/commands/AttributeCommand.java +minecraft net/minecraft/server/commands/BanListCommands.java +minecraft net/minecraft/server/commands/BossBarCommands.java +minecraft net/minecraft/server/commands/ChaseCommand.java +minecraft net/minecraft/server/commands/ClearInventoryCommands.java +minecraft net/minecraft/server/commands/CloneCommands.java +minecraft net/minecraft/server/commands/DamageCommand.java +minecraft net/minecraft/server/commands/DataPackCommand.java +minecraft net/minecraft/server/commands/DebugCommand.java +minecraft net/minecraft/server/commands/DebugConfigCommand.java +minecraft net/minecraft/server/commands/DebugMobSpawningCommand.java +minecraft net/minecraft/server/commands/DebugPathCommand.java +minecraft net/minecraft/server/commands/EmoteCommands.java +minecraft net/minecraft/server/commands/ExecuteCommand.java +minecraft net/minecraft/server/commands/ExperienceCommand.java +minecraft net/minecraft/server/commands/FillBiomeCommand.java +minecraft net/minecraft/server/commands/FillCommand.java +minecraft net/minecraft/server/commands/ForceLoadCommand.java +minecraft net/minecraft/server/commands/FunctionCommand.java +minecraft net/minecraft/server/commands/HelpCommand.java +minecraft net/minecraft/server/commands/ItemCommands.java +minecraft net/minecraft/server/commands/JfrCommand.java +minecraft net/minecraft/server/commands/KillCommand.java +minecraft net/minecraft/server/commands/LocateCommand.java +minecraft net/minecraft/server/commands/LookAt.java +minecraft net/minecraft/server/commands/MsgCommand.java +minecraft net/minecraft/server/commands/PardonCommand.java +minecraft net/minecraft/server/commands/PardonIpCommand.java +minecraft net/minecraft/server/commands/ParticleCommand.java +minecraft net/minecraft/server/commands/PerfCommand.java +minecraft net/minecraft/server/commands/PlaySoundCommand.java +minecraft net/minecraft/server/commands/PublishCommand.java +minecraft net/minecraft/server/commands/RaidCommand.java +minecraft net/minecraft/server/commands/RandomCommand.java +minecraft net/minecraft/server/commands/RecipeCommand.java +minecraft net/minecraft/server/commands/ReturnCommand.java +minecraft net/minecraft/server/commands/RideCommand.java +minecraft net/minecraft/server/commands/RotateCommand.java +minecraft net/minecraft/server/commands/SaveAllCommand.java +minecraft net/minecraft/server/commands/SaveOffCommand.java +minecraft net/minecraft/server/commands/SaveOnCommand.java +minecraft net/minecraft/server/commands/SayCommand.java +minecraft net/minecraft/server/commands/ScoreboardCommand.java +minecraft net/minecraft/server/commands/SeedCommand.java +minecraft net/minecraft/server/commands/ServerPackCommand.java +minecraft net/minecraft/server/commands/SetBlockCommand.java +minecraft net/minecraft/server/commands/SetPlayerIdleTimeoutCommand.java +minecraft net/minecraft/server/commands/SpawnArmorTrimsCommand.java +minecraft net/minecraft/server/commands/SpectateCommand.java +minecraft net/minecraft/server/commands/StopCommand.java +minecraft net/minecraft/server/commands/StopSoundCommand.java +minecraft net/minecraft/server/commands/TagCommand.java +minecraft net/minecraft/server/commands/TeamCommand.java +minecraft net/minecraft/server/commands/TeamMsgCommand.java +minecraft net/minecraft/server/commands/TellRawCommand.java +minecraft net/minecraft/server/commands/TitleCommand.java +minecraft net/minecraft/server/commands/TransferCommand.java +minecraft net/minecraft/server/commands/TriggerCommand.java +minecraft net/minecraft/server/commands/WardenSpawnTrackerCommand.java +minecraft net/minecraft/server/commands/WhitelistCommand.java diff --git a/gradle.properties b/gradle.properties index 49f78c0..07b35e4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,13 +17,13 @@ version = 1.21.3-R0.1-SNAPSHOT mcVersion = 1.21.3 jdkVersion = 21 -paperRepo = https://github.com/PaperMC/Paper -paperBranch = master +paperRepo = https://github.com/PaperMC/Paper-archive +paperBranch = ver/1.21.3 purpurRepo = https://github.com/PurpurMC/Purpur purpurBranch = ver/1.21.3 pufferfishRepo = https://github.com/pufferfish-gg/Pufferfish pufferfishBranch = ver/1.21 usePufferfish = false -paperCommit = be886cf4e7ba906a3e79d9d38835d35abf60a0ce -purpurCommit = c6802b0a27f1f8faac4ad30f902810fd0ed8051e +paperCommit = da7138233f6392e791d790d1c3407414c855f9c2 +purpurCommit = 16ce24aa7eb08232030e4570e027f7baefa5f3f9 diff --git a/initDev b/initDev index 3d76d4a..7d69124 100755 --- a/initDev +++ b/initDev @@ -3,70 +3,134 @@ # run below command in your terminal: # source ./initDev -export PROJECT_DIR=$(pwd) +PROJECT_DIR=$(pwd) -alias api="cd $PROJECT_DIR/*-API" -alias srv="cd $PROJECT_DIR/*-Server" +alias cl="clear;" -alias g="./gradlew" -alias c="clear;" +alias src="cd $PROJECT_DIR;" +alias ca="cd $PROJECT_DIR/*-API || exit 1; vs;" +alias cg="cd $PROJECT_DIR/paper-api-generator/generated || exit 1; vs;" +alias cs="cd $PROJECT_DIR/*-Server || exit 1; vs;" -alias ap="./gradlew --no-rebuild applyPatches" -alias aap="./gradlew --no-rebuild applyAPIPatches" -alias agp="./gradlew --no-rebuild applyGeneratedAPIPatches" -alias asp="./gradlew --no-rebuild applyServerPatches" +alias fa="ca __generate_fixup_patch" +alias fg="cg __generate_fixup_patch" +alias fs="cs __generate_fixup_patch" -alias rp="./gradlew --no-rebuild rebuildPatches" -alias rap="./gradlew --no-rebuild rebuildAPIPatches" -alias rgp="./gradlew --no-rebuild rebuildGeneratedAPIPatches" -alias rsp="./gradlew --no-rebuild rebuildServerPatches" +hash gradle 2>&1 && alias gradle="./gradlew" +alias gr="cd $PROJECT_DIR; gradle" +alias grc="gr --no-rebuild" -alias run="./gradlew runDevServer" -alias build="./gradlew build" -alias reobf="./gradlew createReobfPaperclipJar" -alias mojmap="./gradlew createMojmapPaperclipJar" +alias ap="grc applyPatches" +alias aap="grc applyAPIPatches" +alias agp="grc applyGeneratedAPIPatches" +alias asp="grc applyServerPatches" -alias lg="git log --oneline base..HEAD" -alias rc="git rebase --autosquash -i base" -alias rcc="git rebase --continue" +alias aap!="rm -rf $PROJECT_DIR/*-API; aap" +alias agp!="rm -rf $PROJECT_DIR/paper-api-generator/generated; agp" +alias asp!="rm -rf $PROJECT_DIR/*-Server; asp" -# generate Fixup patches for Server -function fs() { - cd ./*-Server || exit 1 +alias aapa="ca vpa" +alias aapc="ca vpc" +alias aapc="ca vps" +alias agpa="cg vpa" +alias agpc="cg vpc" +alias agpc="cg vps" +alias aspa="cs vpa" +alias aspc="cs vpc" +alias aspc="cs vps" + +alias rp="grc rebuildPatches" +alias rap="grc rebuildAPIPatches" +alias rgp="grc rebuildGeneratedAPIPatches" +alias rsp="grc rebuildServerPatches" + +alias mk="gr build" +alias mko="gr createReobfPaperclipJar" +alias mkm="gr createMojmapPaperclipJar" + + +alias va="git add" +alias va.="git add ." + +alias vl="git log --oneline base..HEAD" + +alias vr="git rebase --autosquash base" +alias vra="git rebase --abort" +alias vrc="va.; git rebase --continue" +alias vrs="git rebase --skip" + +alias vp="git am --show-current-patch" +alias vpa="git am --abort" +alias vpc="git am --continue" +alias vps="git am --skip" + +alias vm="git commit --fixup" +alias vs="git status" + +alias vc="git commit --verbose --no-interactive" +alias vcn="vc --no-message" +alias vcm="vc --message" + +alias vca="git commit --verbose --no-interactive --all" +alias vcan="git commit --verbose --no-interactive --all --no-message" +alias vcam="git commit --verbose --no-interactive --all --message" + +alias ve="git commit --verbose --no-interactive --amend" +alias ven="ve --no-message" +alias vem="ve --message" + +alias vea="git commit --verbose --no-interactive --all --amend" +alias vean="vea --no-message" +alias veam="vea --message" + +alias as="ca src" +alias al="ca vl" +alias ac="ca va.; vcm" +alias am="ca vm" +alias ae="ca ve" +alias aea="ca vea" +alias aean="ca vean" +alias aeam="ca veam" + +alias gs="cg src" +alias gl="cg vl" +alias gc="cg va.; vcm" +alias gm="cg vm" +alias ge="cg ve" +alias gea="cg vea" +alias gean="cg vean" +alias geam="cg veam" + +alias ss="cs src" +alias sl="cs vl" +alias sc="cs va.; vcm" +alias sm="cs vm" +alias se="cs ve" +alias sea="cs vea" +alias sean="cs vean" +alias seam="cs veam" + +function __generate_fixup_patch() { garg="." [[ "$1" == "-x" ]] && garg="--amend" git add . git commit "$garg" -m "fixup" git format-patch -1 - mv 0001-fixup.patch ../ + mv 0001-fixup.patch ../ -f cd ../ } -# generate Fixup patches for API -function fa() { - cd ./*-API || exit 1 - garg="." - [[ "$1" == "-x" ]] && garg="--amend" - - git add . - git commit "$garg" -m "fixup" - git format-patch -1 - mv 0001-fixup.patch ../ - - cd ../ -} - -# ReApply Server Patches -function rasp() { - rm -rf ./*-Server - ./gradlew applyServerPatches -} - # Commit Updated Upstream function cuu() { # shellcheck disable=SC2059 printf "Updated Upstream ($1)$(/bin/cat compare.txt)" | git commit -F - } +git update-index --assume-unchanged ./build-data/dev-imports.txt + +if [ ! -L "$PROJECT_DIR/upstream" ]; then + grc applyPatches + ln -dsf "$PROJECT_DIR/.gradle/caches/paperweight/upstreams/paper" "$PROJECT_DIR/upstream" +fi diff --git a/libs/api.versions.toml b/libs/api.versions.toml index 29a8665..6ce5cb2 100644 --- a/libs/api.versions.toml +++ b/libs/api.versions.toml @@ -1,33 +1,47 @@ [versions] -gson = "2.10.1" -joml = "1.10.5" -guava = "32.1.2-jre" -sentry = "5.4.0" -jspecify = "1.0.0" -fastutil = "8.5.6" -findbugs = "1.3.9" -slf4j-api = "2.0.9" brigadier = "1.2.9" -bungeechat = "1.20-R0.2" + +guava = "33.3.1-jre" +gson = "2.11.0" +bungeechat = "1.20-R0.2-deprecated+build.19" + +# snakeyaml +joml = "1.10.8" json-simple = "1.1.1" -annotations = "24.0.1" + +fastutil = "8.5.6" +# adventure +# log4j +slf4j-api = "2.0.9" +sentry = "5.4.0" + +# asm +# mvn + +annotations = "24.1.0" checkerqual = "3.21.0" +jspecify = "1.0.0" + [libraries] -joml = { group = "org.joml", name = "joml", version.ref = "joml" } -gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } -guava = { group = "com.google.guava", name = "guava", version.ref = "guava" } -sentry = { group = "io.sentry", name = "sentry", version.ref = "sentry" } -jspecify = { group = "org.jspecify", name = "jspecify", version.ref = "jspecify" } -fastutil = { group = "it.unimi.dsi", name = "fastutil", version.ref = "fastutil" } -findbugs = { group = "com.google.code.findbugs", name = "jsr305", version.ref = "findbugs" } brigadier = { group = "com.mojang", name = "brigadier", version.ref = "brigadier" } -slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j-api" } + +guava = { group = "com.google.guava", name = "guava", version.ref = "guava" } +gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } bungeechat = { group = "net.md-5", name = "bungeecord-chat", version.ref = "bungeechat" } + +joml = { group = "org.joml", name = "joml", version.ref = "joml" } jsonsimple = { group = "com.googlecode.json-simple", name = "json-simple", version.ref = "json-simple" } + +fastutil = { group = "it.unimi.dsi", name = "fastutil", version.ref = "fastutil" } +slf4j = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j-api" } +sentry = { group = "io.sentry", name = "sentry", version.ref = "sentry" } + annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" } checkerqual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checkerqual" } +jspecify = { group = "org.jspecify", name = "jspecify", version.ref = "jspecify" } + [bundles] -api = [ "jspecify", "guava", "gson", "joml", "fastutil", "slf4j-api", "sentry", "brigadier" ] +api = [ "brigadier", "guava", "gson", "joml", "fastutil", "slf4j", "sentry", "jspecify" ] annotations = [ "annotations", "checkerqual" ] diff --git a/libs/common.versions.toml b/libs/common.versions.toml index 51062d0..ed9f9e1 100644 --- a/libs/common.versions.toml +++ b/libs/common.versions.toml @@ -1,47 +1,73 @@ [versions] -asm = "9.7.1" -log4j = "2.19.0" -junit = "1.10.0" -mockito = "5.14.1" -jupiter = "5.10.0" -hamcrest = "2.2" -snakeyaml = "2.2" adventure = "4.17.0" +log4j = "2.19.0" +asm = "9.7.1" + +mvn = "3.9.6" +mvn-resolver = "1.9.18" + commons-lang2 = "2.6" commons-lang3 = "3.12.0" -maven-provider = "3.9.6" -maven-resolver = "1.9.18" + +snakeyaml = "2.2" + +junit = "1.10.0" +junit-jupiter = "5.10.0" +junit-pioneer = "2.2.0" + +hamcrest = "2.2" +mockito = "5.14.1" [libraries] -junit = { group = "org.junit.platform", name = "junit-platform-suite-engine", version.ref = "junit" } -mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" } -jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "jupiter" } -hamcrest = { group = "org.hamcrest", name = "hamcrest", version.ref = "hamcrest" } -snakeyaml = { group = "org.yaml", name = "snakeyaml", version.ref = "snakeyaml" } - -asm-head = { group = "org.ow2.asm", name = "asm", version.ref = "asm" } -asm-tree = { group = "org.ow2.asm", name = "asm-tree", version.ref = "asm" } -asm-commons = { group = "org.ow2.asm", name = "asm-commons", version.ref = "asm" } -log4j-api = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j" } -log4j-core = { group = "org.apache.logging.log4j", name = "log4j-core", version.ref = "log4j" } -log4j-iostreams = { group = "org.apache.logging.log4j", name = "log4j-iostreams", version.ref = "log4j" } -maven-provider = { group = "org.apache.maven", name = "maven-resolver-provider", version.ref = "maven-provider" } -maven-connector = { group = "org.apache.maven.resolver", name = "maven-resolver-connector-basic", version.ref = "maven-resolver" } -maven-transport = { group = "org.apache.maven.resolver", name = "maven-resolver-transport-http", version.ref = "maven-resolver" } -commons-lang2 = { group = "commons-lang", name = "commons-lang", version.ref = "commons-lang2" } -commons-lang3 = { group = "org.apache.commons", name = "commons-lang3", version.ref = "commons-lang3" } - adventure-bom = { group = "net.kyori", name = "adventure-bom", version.ref = "adventure" } adventure-api = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" } -adventure-slf4j = { group = "net.kyori", name = "adventure-text-logger-slf4j", version.ref = "adventure" } adventure-minimessage = { group = "net.kyori", name = "adventure-text-minimessage", version.ref = "adventure" } +adventure-logger-slf4j = { group = "net.kyori", name = "adventure-text-logger-slf4j", version.ref = "adventure" } adventure-serializer-gson = { group = "net.kyori", name = "adventure-text-serializer-gson", version.ref = "adventure" } adventure-serializer-ansi = { group = "net.kyori", name = "adventure-text-serializer-ansi", version.ref = "adventure" } adventure-serializer-plain = { group = "net.kyori", name = "adventure-text-serializer-plain", version.ref = "adventure" } adventure-serializer-legacy = { group = "net.kyori", name = "adventure-text-serializer-legacy", version.ref = "adventure" } +log4j = { group = "org.apache.logging.log4j", name = "log4j-core", version.ref = "log4j" } +log4j-api = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j" } +log4j-stream = { group = "org.apache.logging.log4j", name = "log4j-iostreams", version.ref = "log4j" } + +asm = { group = "org.ow2.asm", name = "asm", version.ref = "asm" } +asm-tree = { group = "org.ow2.asm", name = "asm-tree", version.ref = "asm" } +asm-commons = { group = "org.ow2.asm", name = "asm-commons", version.ref = "asm" } + +mvn = { group = "org.apache.maven", name = "maven-resolver-provider", version.ref = "mvn" } +mvn-connector = { group = "org.apache.maven.resolver", name = "maven-resolver-connector-basic", version.ref = "mvn-resolver" } +mvn-transport = { group = "org.apache.maven.resolver", name = "maven-resolver-transport-http", version.ref = "mvn-resolver" } + +commons-lang2 = { group = "commons-lang", name = "commons-lang", version.ref = "commons-lang2" } +commons-lang3 = { group = "org.apache.commons", name = "commons-lang3", version.ref = "commons-lang3" } + +snakeyaml = { group = "org.yaml", name = "snakeyaml", version.ref = "snakeyaml" } + +junit = { group = "org.junit.platform", name = "junit-platform-suite-engine", version.ref = "junit" } +junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit-jupiter" } +junit-pioneer = { group = "org.junit-pioneer", name = "junit-pioneer", version.ref = "junit-pioneer" } + +hamcrest = { group = "org.hamcrest", name = "hamcrest", version.ref = "hamcrest" } +mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" } + + [bundles] -asm = [ "asm-head", "asm-commons" ] -test = [ "jupiter", "hamcrest", "mockito", "asm-tree", "junit" ] -maven = [ "maven-connector", "maven-transport" ] -adventure = [ "adventure-api", "adventure-slf4j", "adventure-minimessage", "adventure-serializer-gson", "adventure-serializer-plain", "adventure-serializer-legacy" ] +asm = [ "asm", "asm-commons" ] +mvn = [ "mvn-connector", "mvn-transport" ] + +test = [ + "junit-jupiter", + "hamcrest", + "mockito", + "asm-tree" +] +adventure = [ + "adventure-api", + "adventure-minimessage", + "adventure-logger-slf4j", + "adventure-serializer-gson", + "adventure-serializer-plain", + "adventure-serializer-legacy" +] diff --git a/libs/server.versions.toml b/libs/server.versions.toml index 1dbea69..8be06bc 100644 --- a/libs/server.versions.toml +++ b/libs/server.versions.toml @@ -1,56 +1,89 @@ [versions] -art = "2.0.3" +jline = "3.27.1" tca = "1.3.0" -upnp = "1.0" -ansi = "1.0.3" -jansi = "3.21.0" -rhino = "1.7.14" -mysql = "9.1.0" -flare = "34637f3f87" -sqlite = "3.46.1.3" -pioneer = "2.2.0" -haproxy = "4.1.97.Final" -rewriter = "0.0.3" -srgutils = "1.0.9" -sparkapi = "0.1-20240720.200737-2" -sparknt = "1.10.105-SNAPSHOT" -velocity = "3.3.0-SNAPSHOT" -disruptor = "3.4.4" -simpleyaml = "1.8.4" -classgraph = "4.8.47" -mapping-io = "0.5.0" +# adventure +# log4j +netty = "4.1.97.Final" +# asm configurate = "4.2.0-SNAPSHOT" +# commons2 +sqlite = "3.46.1.3" +mysql = "9.1.0" +disruptor = "3.4.4" +velocity = "3.3.0-SNAPSHOT" + +# mvn + +# snakeyaml +simpleyaml = "1.8.4" + +rhino = "1.7.14" +upnp = "1.0" + +classgraph = "4.8.47" +# test (junit, hamcrest, mockito, asm-tree) +srgutils = "1.0.9" +art = "2.0.3" + +rewriter = "0.0.3" +spark-api = "0.1-20240720.200737-2" +spark = "1.10.119-SNAPSHOT" + [libraries] -art = { group = "net.neoforged", name = "AutoRenamingTool", version.ref = "art" } +jline-ffm = { group = "org.jline", name = "jline-terminal-ffm", version.ref = "jline" } +jline-jni = { group = "org.jline", name = "jline-terminal-jni", version.ref = "jline" } tca = { group = "net.minecrell", name = "terminalconsoleappender", version.ref="tca" } -ansi = { group = "net.kyori", name = "ansi", version.ref = "ansi" } -upnp = { group = "dev.omega24", name = "upnp4j", version.ref = "upnp" } -mysql = { group = "com.mysql", name = "mysql-connector-j", version.ref = "mysql" } -jansi = { group = "org.jline", name = "jline-terminal-jansi", version.ref = "jansi" } -flare = { group = "com.github.technove", name = "flare", version.ref = "flare" } +# adventure +# log4j +netty-haproxy = { group = "io.netty", name = "netty-codec-haproxy", version.ref = "netty" } +# asm +configurate-yaml = { group = "org.spongepowered", name = "configurate-yaml", version.ref = "configurate" } +# commons2 sqlite = { group = "org.xerial", name = "sqlite-jdbc", version.ref = "sqlite" } -pioneer = { group = "org.junit-pioneer", name = "junit-pioneer", version.ref = "pioneer" } -haproxy = { group = "io.netty", name = "netty-codec-haproxy", version.ref = "haproxy" } -srgutils = { group = "net.neoforged", name = "srgutils", version.ref = "srgutils" } -velocity = { group = "com.velocitypowered", name = "velocity-native", version.ref = "velocity" } +mysql = { group = "com.mysql", name = "mysql-connector-j", version.ref = "mysql" } disruptor = { group = "com.lmax", name = "disruptor", version.ref = "disruptor" } -mappingio = { group = "net.fabricmc", name = "mapping-io", version.ref = "mapping-io" } -classgraph = { group = "io.github.classgraph", name = "classgraph", version.ref = "classgraph" } +velocity-native = { group = "com.velocitypowered", name = "velocity-native", version.ref = "velocity" } + +# snakeyaml simpleyaml = { group = "com.github.carleslc.Simple-YAML", name = "Simple-Yaml", version.ref = "simpleyaml" } -configurate = { group = "org.spongepowered", name = "configurate-yaml", version.ref = "configurate" } -spark-api = { group = "me.lucko", name = "spark-api", version.ref = "sparkapi" } -spark-paper = { group = "me.lucko", name = "spark-paper", version.ref = "sparknt" } - -rhino-engine = { group = "org.mozilla", name = "rhino-engine", version.ref = "rhino" } rhino-runtime = { group = "org.mozilla", name = "rhino-runtime", version.ref = "rhino" } +rhino-engine = { group = "org.mozilla", name = "rhino-engine", version.ref = "rhino" } +upnp = { group = "dev.omega24", name = "upnp4j", version.ref = "upnp" } + +classgraph = { group = "io.github.classgraph", name = "classgraph", version.ref = "classgraph" } +# test (junit, hamcrest, mockito, asm-tree) +srgutils = { group = "net.neoforged", name = "srgutils", version.ref = "srgutils" } +art = { group = "net.neoforged", name = "AutoRenamingTool", version.ref = "art" } rewriter = { group = "io.papermc", name = "reflection-rewriter", version.ref = "rewriter" } rewriter-runtime = { group = "io.papermc", name = "reflection-rewriter-runtime", version.ref = "rewriter" } -rewriter-generator = { group = "io.papermc", name = "reflection-rewriter-proxy-generator", version.ref = "rewriter" } +rewriter-proxy = { group = "io.papermc", name = "reflection-rewriter-proxy-generator", version.ref = "rewriter" } + +spark-api = { group = "me.lucko", name = "spark-api", version.ref = "spark-api" } +spark = { group = "me.lucko", name = "spark-paper", version.ref = "spark" } + [bundles] runtime = [ "sqlite", "mysql", "disruptor" ] -implementation = [ "spark-api", "spark-paper", "jansi", "tca", "ansi", "upnp", "haproxy", "configurate", "mappingio", "rhino-engine", "rhino-runtime", "srgutils", "art", "rewriter", "rewriter-runtime", "rewriter-generator", "flare" ] -test = [ "classgraph", "pioneer" ] +test = [ "classgraph" ] + +implementation = [ + "jline-ffm", + "jline-jni", + "tca", + "netty-haproxy", + "configurate-yaml", + "velocity-native", + "rhino-runtime", + "rhino-engine", + "upnp", + "srgutils", + "art", + "rewriter", + "rewriter-runtime", + "rewriter-proxy", + "spark-api", + "spark" +] diff --git a/patches/api/0001-Purpur-API-Changes.patch b/patches/api/0001-Purpur-API-Changes.patch index 5e77c20..b915ed1 100644 --- a/patches/api/0001-Purpur-API-Changes.patch +++ b/patches/api/0001-Purpur-API-Changes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: granny -Date: Wed, 30 Oct 2024 13:25:01 +0900 +Date: Fri, 13 Dec 2024 07:03:22 +0900 Subject: [PATCH] Purpur API Changes PurpurMC @@ -567,10 +567,10 @@ index 652ff54e7c50412503725d628bfe72ed03059790..7196594e07af19a14c320d77df893978 * Gets the {@code ServerBuildInfo}. * diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 391a1e3e07657a404520c1462507a2c731f32b27..8f5fde63b195d08029305ee0172687df88ad0496 100644 +index 8ab94f8189ebd9d4158231871abdebec399deb2c..db453d04efb00baaeabb904a7bd1b99dd0a50735 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2945,4 +2945,127 @@ public final class Bukkit { +@@ -2968,4 +2968,127 @@ public final class Bukkit { public static Server.Spigot spigot() { return server.spigot(); } @@ -781,13 +781,13 @@ index 918a045165cdcde264bc24082b7afebb407271de..e98d6321c5f2cdde91b54f8a74cbcc04 + // Purpur end } diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 615eb24ffdd8f6d55ccd4f21760b809c1098bc68..fbbe9e52ed3437d2407e042f45b0a18abdd48fe1 100644 +index 028ac35df6c4d044d07b3869751736d418c1eb0e..95c1f331f364c5fafa100860f3c9674f18888714 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -5799,4 +5799,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - public BlockType asBlockType() { - return blockType.get(); +@@ -5840,4 +5840,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + return this.asItemType().getDefaultDataTypes(); } + // Paper end - data component API + + // Purpur start + public boolean isArmor() { @@ -826,7 +826,7 @@ index 615eb24ffdd8f6d55ccd4f21760b809c1098bc68..fbbe9e52ed3437d2407e042f45b0a18a + // Purpur end } diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java -index a028f2fe541491729856051780b33dba07832fb6..fc64902368a068481f16d5db99c94386caf6b60b 100644 +index 5622fe3165baad8138c22cfc016ed6c3834cf702..6d31b561d915180fcd473b317721064feed28f37 100644 --- a/src/main/java/org/bukkit/OfflinePlayer.java +++ b/src/main/java/org/bukkit/OfflinePlayer.java @@ -573,4 +573,106 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio @@ -937,7 +937,7 @@ index a028f2fe541491729856051780b33dba07832fb6..fc64902368a068481f16d5db99c94386 + // Purpur end - OfflinePlayer API } diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0b78564256ebc647ebac402e549d86ab6e307c8d..ddb1ff894910761a78b91a343f32e129f03a03c4 100644 +index ad816538b30079c62d5e1eb98c6f4b61e12e8d47..fcfad39173ecf2573a1ba77236bce8d9f73e02bb 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -2283,6 +2283,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -959,10 +959,10 @@ index 0b78564256ebc647ebac402e549d86ab6e307c8d..ddb1ff894910761a78b91a343f32e129 /** * Sends the component to the player * -@@ -2572,4 +2584,105 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -2607,4 +2619,105 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi */ - boolean isOwnedByCurrentRegion(@NotNull Entity entity); - // Paper end - Folia region threading API + void allowPausing(@NotNull org.bukkit.plugin.Plugin plugin, boolean value); + // Paper end - API to check if the server is sleeping + + // Purpur start + /** @@ -1066,10 +1066,10 @@ index 0b78564256ebc647ebac402e549d86ab6e307c8d..ddb1ff894910761a78b91a343f32e129 + // Purpur end } diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index ef32a937e6faf1e8a5d6b1207986715bae5a246c..36cf567973900d1e472616748926aecb9afcb42f 100644 +index bef54a6c8290e09cbaac20b03dde8dfb902c96b0..5f7de23e419175e55459df760c7190639ea39f18 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -4209,6 +4209,86 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -4246,6 +4246,86 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @Nullable public DragonBattle getEnderDragonBattle(); @@ -1252,7 +1252,7 @@ index e64bb57f74e6d6f78927be228825b3e0bdf41f48..c880d0010849ab733ad13bbd18fab3c8 ); this.versionMessage = Component.text() diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java b/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java -index 455ff52d90565838fe7640c3f045b27082a6c2f1..45f5493eebfecf56b7c0ef4659c078dfc62c0612 100644 +index 6fcc15d588239481136876d117ab346a8deac1dd..13b903e785a9ef5e513cb9d6483482133cc5f25b 100644 --- a/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java +++ b/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java @@ -227,6 +227,28 @@ public enum EnchantmentTarget { @@ -1285,7 +1285,7 @@ index 455ff52d90565838fe7640c3f045b27082a6c2f1..45f5493eebfecf56b7c0ef4659c078df /** diff --git a/src/main/java/org/bukkit/entity/Endermite.java b/src/main/java/org/bukkit/entity/Endermite.java -index 138d2530de2410f4a9424dabd3e5ce0cd1c1dcd2..10a8d64ad2da0be2c14f34c3e7d1957c6f2883d1 100644 +index 7b379fb21e800a766ad022705a12dff6d42279ab..10a8d64ad2da0be2c14f34c3e7d1957c6f2883d1 100644 --- a/src/main/java/org/bukkit/entity/Endermite.java +++ b/src/main/java/org/bukkit/entity/Endermite.java @@ -3,25 +3,21 @@ package org.bukkit.entity; @@ -1301,7 +1301,7 @@ index 138d2530de2410f4a9424dabd3e5ce0cd1c1dcd2..10a8d64ad2da0be2c14f34c3e7d1957c * @return player spawned status - * @deprecated this functionality no longer exists */ -- @Deprecated +- @Deprecated(since = "1.17") boolean isPlayerSpawned(); /** @@ -1314,12 +1314,12 @@ index 138d2530de2410f4a9424dabd3e5ce0cd1c1dcd2..10a8d64ad2da0be2c14f34c3e7d1957c * @param playerSpawned player spawned status - * @deprecated this functionality no longer exists */ -- @Deprecated +- @Deprecated(since = "1.17") void setPlayerSpawned(boolean playerSpawned); // Paper start /** diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index d0ae8a94db20281d3664d74718c65234eb2e5f83..b7d53973ac4e829a03821d59e0b3a28d6f6a4373 100644 +index 19272cff8d6d040e95b2644d70acdac606e06c16..076fe310d500ebb52e705a3a69e895061702f470 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java @@ -1172,4 +1172,55 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent @@ -1471,7 +1471,7 @@ index bcc6ba95bd21c7972865838c636a03f50b6c1f1a..c3fcd8dd7dbb1e1a18e17c014c1e6411 + // Purpur end } diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 68c08e7a212bc3e3885f9b5a4d9aef85fcb3b029..a22909446b7193b1de121bdd6d7b6fbf81dc3be4 100644 +index d21a228bbec0302e75c4db5aa1db54f321143587..a4acc3578e935cd1174474bd1f6ff14db4294fe7 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -1468,4 +1468,20 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource @@ -1521,7 +1521,7 @@ index bc84b892cae5fe7019a3ad481e9da79956efa1fe..48eb5b00c460cccde29d327cef1d63fc + // Purpur end } diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 95f0b3186e313c7fbd5c8531d52b82a69e525f94..a7f989121c493baff9d2b6910c39145a0e12477d 100644 +index fac4aec289e07231d80a9890653432f688355afa..6f7f1fc3db0237021fa1bd0f11fe56b2d6d4f84a 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -3911,4 +3911,123 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -1743,10 +1743,10 @@ index c73489f4b745bc84501ce94f0227b034d9768eae..a97129e71f16ec691759add664bdfd35 + // Purpur end } diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java -index ef5b2a0f18c1c126db0b0c4a4d2a57483680665a..e6c8ffc2583af754eaedc55160ef45c61c22e213 100644 +index d1a5424ff3b289f1c82449ef6d88eb52665df41b..f23b0c250f88926c147af0314b5c4d23c5f8dbae 100644 --- a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java +++ b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java -@@ -307,7 +307,8 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable { +@@ -308,7 +308,8 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable { WORLD_BORDER, /** * Damage caused when an entity contacts a block such as a Cactus, @@ -1774,7 +1774,7 @@ index 8fdfcbc7d20fe0af6b220ab94516247093637621..f6a8928408e11a5ae723366e4ea1280d * When a player gets bad omen after killing a patrol captain. * diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java -index 7184f80899206bedeac387e9f8a35482801efd4b..e4197c89c04b91732ce96981f8df0a0bdaee24ce 100644 +index 81118a91c2e22e02a1f774d1cc4d3e97064087ce..3ac1e4a821a5b48d3936222cbfddadd3b803deef 100644 --- a/src/main/java/org/bukkit/event/inventory/InventoryType.java +++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java @@ -164,7 +164,7 @@ public enum InventoryType { @@ -1834,7 +1834,7 @@ index f1f97a85ec713c05c882d7588f4a3e4a017f4795..813f6cd253322538bdf96eb323dd23a7 + // Purpur end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index b59222b8c262545d100a9fd28b3bf1d2a4cf4eb0..4414381ac942c040480d53b03565b160eb85c444 100644 +index 8c9654cd19af8b28fa276a55c5060eb389e60c1c..875124b06d87cd4163f0ab1d4dd75f939622f8aa 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java @@ -19,6 +19,13 @@ import org.bukkit.inventory.meta.ItemMeta; @@ -1851,10 +1851,10 @@ index b59222b8c262545d100a9fd28b3bf1d2a4cf4eb0..4414381ac942c040480d53b03565b160 /** * Represents a stack of items. -@@ -1137,4 +1144,482 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - return Bukkit.getUnsafe().computeTooltipLines(this, tooltipContext, player); +@@ -1318,4 +1325,482 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + return this.craftDelegate.matchesWithoutData(item, excludeTypes, ignoreCount); } - // Paper end - expose itemstack tooltip lines + // Paper end - data component API + + // Purpur start + /** @@ -2335,7 +2335,7 @@ index b59222b8c262545d100a9fd28b3bf1d2a4cf4eb0..4414381ac942c040480d53b03565b160 + // Purpur end } diff --git a/src/main/java/org/bukkit/inventory/RecipeChoice.java b/src/main/java/org/bukkit/inventory/RecipeChoice.java -index f1aa67997f904953742e8895e49341c2f73d44a2..993cf7995514fb0ef3c4388bb3ce49c3187ab251 100644 +index 922bb69b5f218e489a6dd5e0f207743c1f1d3d35..9b3e292be334d21eb978373f434bf3811ec4af2b 100644 --- a/src/main/java/org/bukkit/inventory/RecipeChoice.java +++ b/src/main/java/org/bukkit/inventory/RecipeChoice.java @@ -191,6 +191,7 @@ public interface RecipeChoice extends Predicate, Cloneable { @@ -2412,7 +2412,7 @@ index 3c1aa1e036bee08304c1cdca59f6a5bc0ba306c0..709fb2d1c7e3253034a651a9f68c0036 + // Purpur end } diff --git a/src/main/java/org/bukkit/map/MapPalette.java b/src/main/java/org/bukkit/map/MapPalette.java -index 55a46db9d73885ea967ac929013906b687e476bb..b99796629100c7d5fff1b7f84026001e0013b477 100644 +index 6995f9cc08d162e3adcd3a28f6bfa6d329661999..b9edb96fc5bac8793477657dbb45ccf98ab17f27 100644 --- a/src/main/java/org/bukkit/map/MapPalette.java +++ b/src/main/java/org/bukkit/map/MapPalette.java @@ -1,6 +1,7 @@ @@ -2488,7 +2488,7 @@ index 75b77cc4fe189b4b6baa1af3663dc492e992a266..30b98d1645c571ba5c18e5cc93b0bec3 permissions.put(lname, new PermissionAttachmentInfo(parent, lname, attachment, value)); diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index b878e7167cfcdea0e224c182b40abeadd339d3b3..6b6edf9007997d9672e4c850464c1b71cb55f6b4 100644 +index 001465eedafa51ac027a4db51cba6223edfe1171..2e6d62c4f3687e299c34e876c503b400e13be05a 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -597,7 +597,9 @@ public final class SimplePluginManager implements PluginManager { @@ -2514,7 +2514,7 @@ index b878e7167cfcdea0e224c182b40abeadd339d3b3..6b6edf9007997d9672e4c850464c1b71 callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event))); } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index eaefbb00e9993d54906cc8cf35cf753c0d6c7707..0c6ca7588fb3d6b6497ddf032fe75e5c6c9719e5 100644 +index b412aaf08901d169ac9fc89b36f9d6ccb95c53d3..e2b631fc160f13ea6e27b69f835bbdf83d6d3dec 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -55,6 +55,7 @@ public final class JavaPluginLoader implements PluginLoader { diff --git a/patches/api/0002-Use-Gradle-Version-Catalogs.patch b/patches/api/0002-Use-Gradle-Version-Catalogs.patch index e68e7c1..14aeeb1 100644 --- a/patches/api/0002-Use-Gradle-Version-Catalogs.patch +++ b/patches/api/0002-Use-Gradle-Version-Catalogs.patch @@ -5,24 +5,24 @@ Subject: [PATCH] Use Gradle Version Catalogs diff --git a/build.gradle.kts b/build.gradle.kts -index b0fd6c1804844f09428051952e3ac4e58f8c859c..51a3639e5d1c3fec24af53f1e829532adeb6a1fa 100644 +index b0fd6c1804844f09428051952e3ac4e58f8c859c..2b668f8a5c245d024e03c94b7d8872448f1929cf 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,11 +9,13 @@ java { withJavadocJar() } -+/* // Plazma - Use Gradle Versuib Catalogs ++/* // Plazma - Use Gradle Version Catalogs val annotationsVersion = "24.1.0" val bungeeCordChatVersion = "1.20-R0.2" val adventureVersion = "4.17.0" val slf4jVersion = "2.0.9" val log4jVersion = "2.17.1" -+ */ ++ */ // Plazma - Use Gradle Version Catalogs val apiAndDocs: Configuration by configurations.creating { attributes { attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION)) -@@ -39,57 +41,29 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider { +@@ -39,58 +41,30 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider { // Paper end - configure mockito agent that is needed in newer java versions dependencies { @@ -77,33 +77,35 @@ index b0fd6c1804844f09428051952e3ac4e58f8c859c..51a3639e5d1c3fec24af53f1e829532a - testImplementation("org.hamcrest:hamcrest:2.2") - testImplementation("org.mockito:mockito-core:5.14.1") - testImplementation("org.ow2.asm:asm-tree:9.7.1") +- mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Paper - configure mockito agent that is needed in newer java versions + // Plazma start - Use Gradle Version Catalogs -+ implementation(common.bundles.asm) -+ + api(api.bundles.api) -+ api(common.snakeyaml) -+ api(common.log4j.api) -+ api(common.maven.provider) -+ api(api.jsonsimple) { isTransitive = false } + api(api.bungeechat) { exclude("com.google.guava", "guava") } ++ api(common.snakeyaml) ++ api(api.jsonsimple) { isTransitive = false } + apiAndDocs(platform(common.adventure.bom)) + apiAndDocs(common.bundles.adventure) -+ -+ compileOnly(common.bundles.maven) ++ api(common.log4j.api) ++ ++ implementation(common.bundles.asm) ++ ++ api(common.mvn) ++ compileOnly(common.bundles.mvn) ++ + compileOnly(api.annotations) ++ testCompileOnly(api.annotations) ++ + compileOnlyApi(api.checkerqual) -+ -+ testImplementation(common.asm.tree) ++ testCompileOnly(api.checkerqual) ++ + testImplementation(common.commons.lang3) + testImplementation(common.bundles.test) -+ -+ testCompileOnly(api.annotations) -+ testCompileOnly(api.checkerqual) ++ mockitoAgent(common.mockito) { isTransitive = false } + // Plazma end - mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Paper - configure mockito agent that is needed in newer java versions } -@@ -175,27 +149,24 @@ tasks.withType { + // Paper start +@@ -175,27 +149,25 @@ tasks.withType { options.use() options.isDocFilesSubDirs = true options.links( @@ -114,7 +116,7 @@ index b0fd6c1804844f09428051952e3ac4e58f8c859c..51a3639e5d1c3fec24af53f1e829532a - // Paper start - add missing javadoc links - "https://javadoc.io/doc/org.joml/joml/1.10.5/index.html", - "https://www.javadoc.io/doc/com.google.code.gson/gson/2.10.1", - "https://jspecify.dev/docs/api/", +- "https://jspecify.dev/docs/api/", - // Paper end - // Paper start - "https://jd.advntr.dev/api/$adventureVersion/", @@ -129,6 +131,12 @@ index b0fd6c1804844f09428051952e3ac4e58f8c859c..51a3639e5d1c3fec24af53f1e829532a - // Paper end - "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.7.3", // Paper + // Plazma start - Use Gradle Version Catalogs ++ "https://guava.dev/releases/${api.guava.orNull?.version}/api/docs/", ++ "https://javadoc.io/doc/org.yaml/snakeyaml/${common.snakeyaml.orNull?.version}/", ++ "https://javadoc.io/doc/org.jetbrains/annotations/${api.annotations.orNull?.version}/", ++ "https://javadoc.io/doc/org.joml/joml/${api.joml.orNull?.version}/index.html", ++ "https://www.javadoc.io/doc/com.google.code.gson/gson/${api.gson.orNull?.version}", ++ "https://jspecify.dev/docs/api/", //diff on change + "https://jd.advntr.dev/api/${common.adventure.api.orNull?.version}/", + "https://jd.advntr.dev/key/${common.adventure.api.orNull?.version}/", + "https://jd.advntr.dev/text-minimessage/${common.adventure.api.orNull?.version}/", @@ -136,14 +144,10 @@ index b0fd6c1804844f09428051952e3ac4e58f8c859c..51a3639e5d1c3fec24af53f1e829532a + "https://jd.advntr.dev/text-serializer-legacy/${common.adventure.api.orNull?.version}/", + "https://jd.advntr.dev/text-serializer-plain/${common.adventure.api.orNull?.version}/", + "https://jd.advntr.dev/text-logger-slf4j/${common.adventure.api.orNull?.version}/", -+ "https://guava.dev/releases/${api.guava.orNull?.version}/api/docs/", + "https://javadoc.io/doc/org.yaml/snakeyaml/${common.snakeyaml.orNull?.version}/", -+ "https://javadoc.io/doc/org.jetbrains/annotations/${api.annotations.orNull?.version}/", -+ "https://javadoc.io/doc/org.joml/joml/${api.joml.orNull?.version}/index.html", -+ "https://www.javadoc.io/doc/com.google.code.gson/gson/${api.gson.orNull?.version}", -+ "https://javadoc.io/doc/org.slf4j/slf4j-api/${api.slf4j.api.orNull?.version}/", ++ "https://javadoc.io/doc/org.slf4j/slf4j-api/${api.slf4j.orNull?.version}/", + "https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/${common.log4j.api.orNull?.version}/", -+ "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/${common.maven.connector.orNull?.version}", ++ "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/${common.mvn.connector.orNull?.version}", + // Plazma end ) options.tags("apiNote:a:API Note:") diff --git a/patches/api/0007-Reduce-allocations.patch b/patches/api/0007-Reduce-allocations.patch index ad9ba22..bfe71e6 100644 --- a/patches/api/0007-Reduce-allocations.patch +++ b/patches/api/0007-Reduce-allocations.patch @@ -27,7 +27,7 @@ index c89d6c4c38e2390cb11ffba182f8741d3726cfd1..2451f466ae6f953b01ad2cbaeac7d163 * Executes the command with the given {@link CommandSourceStack} and arguments. * diff --git a/src/main/java/org/bukkit/Fluid.java b/src/main/java/org/bukkit/Fluid.java -index a3ff4fefaf50f3e99a69ba68cbe8e30c95dac5df..284b351e3628bf278afb43cc6f6bdf1e6b295366 100644 +index a3ff4fefaf50f3e99a69ba68cbe8e30c95dac5df..5bbecd907e222f9adcf726bccab63c9ef59f5c14 100644 --- a/src/main/java/org/bukkit/Fluid.java +++ b/src/main/java/org/bukkit/Fluid.java @@ -10,6 +10,7 @@ import org.jetbrains.annotations.NotNull; @@ -47,7 +47,7 @@ index a3ff4fefaf50f3e99a69ba68cbe8e30c95dac5df..284b351e3628bf278afb43cc6f6bdf1e } } diff --git a/src/main/java/org/bukkit/attribute/Attribute.java b/src/main/java/org/bukkit/attribute/Attribute.java -index 521f035409ee61a9ad73d39bec938f2938892570..4ca383b167326a2ccc21b2435eb96ff41c49cc31 100644 +index 521f035409ee61a9ad73d39bec938f2938892570..6e53135579426cb677bf34a0813db8268d550428 100644 --- a/src/main/java/org/bukkit/attribute/Attribute.java +++ b/src/main/java/org/bukkit/attribute/Attribute.java @@ -15,6 +15,7 @@ import org.jetbrains.annotations.NotNull; @@ -67,7 +67,7 @@ index 521f035409ee61a9ad73d39bec938f2938892570..4ca383b167326a2ccc21b2435eb96ff4 } } diff --git a/src/main/java/org/bukkit/block/Biome.java b/src/main/java/org/bukkit/block/Biome.java -index 464f8f81ba907a61588e4ab869e4f8269830195a..c5f1cc1660c69dfd827344cbafee08005121fb62 100644 +index 464f8f81ba907a61588e4ab869e4f8269830195a..6d50664e76e6e7ed98ca7b311fdb368886ab65a8 100644 --- a/src/main/java/org/bukkit/block/Biome.java +++ b/src/main/java/org/bukkit/block/Biome.java @@ -23,6 +23,7 @@ import org.jetbrains.annotations.NotNull; @@ -88,7 +88,7 @@ index 464f8f81ba907a61588e4ab869e4f8269830195a..c5f1cc1660c69dfd827344cbafee0800 // Paper start diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java -index 70904d6c43b93cb7b9d74d20666fac93a6b4996c..ce88fc3594a6b5e85009707e1319f7f87524dd5f 100644 +index 24b58ed80f3dd7c6b35bb18071000af845d18ba4..13ad0ba6320acd054a665d1749871a14cfd1a520 100644 --- a/src/main/java/org/bukkit/block/banner/PatternType.java +++ b/src/main/java/org/bukkit/block/banner/PatternType.java @@ -12,6 +12,8 @@ import org.jetbrains.annotations.NotNull; @@ -100,7 +100,7 @@ index 70904d6c43b93cb7b9d74d20666fac93a6b4996c..ce88fc3594a6b5e85009707e1319f7f8 PatternType BASE = getType("base"); PatternType SQUARE_BOTTOM_LEFT = getType("square_bottom_left"); PatternType SQUARE_BOTTOM_RIGHT = getType("square_bottom_right"); -@@ -130,6 +132,6 @@ public interface PatternType extends OldEnum, Keyed { +@@ -140,6 +142,6 @@ public interface PatternType extends OldEnum, Keyed { @NotNull @Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils static PatternType[] values() { @@ -109,7 +109,7 @@ index 70904d6c43b93cb7b9d74d20666fac93a6b4996c..ce88fc3594a6b5e85009707e1319f7f8 } } diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java -index 0a26fffe9b1e5080b5639767a03af11006108b4a..bcd12e352d8846826a678ff72742fc7038daf812 100644 +index 74384a56eebbce41d431db2507c55eddbcf50a41..ef3afe91312de1d0fb38d985e0421ceae59d7e57 100644 --- a/src/main/java/org/bukkit/command/Command.java +++ b/src/main/java/org/bukkit/command/Command.java @@ -58,6 +58,19 @@ public abstract class Command { @@ -133,7 +133,7 @@ index 0a26fffe9b1e5080b5639767a03af11006108b4a..bcd12e352d8846826a678ff72742fc70 * Executes the command, returning its success * diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java -index 43e306584988e39a6daca78c621a937acdce48a1..ec6dc4747c8bcdca1cf866ba135fb772e79a73d1 100644 +index a824ac90e78d3d7f90b01397270e54422d88e8b9..95df10ad8a53942de435cec7db57c1bb496097dc 100644 --- a/src/main/java/org/bukkit/enchantments/Enchantment.java +++ b/src/main/java/org/bukkit/enchantments/Enchantment.java @@ -15,6 +15,8 @@ import org.jetbrains.annotations.Nullable; @@ -147,14 +147,14 @@ index 43e306584988e39a6daca78c621a937acdce48a1..ec6dc4747c8bcdca1cf866ba135fb772 */ @@ -536,6 +538,6 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve @NotNull - @Deprecated + @Deprecated(since = "1.20.3") public static Enchantment[] values() { - return Lists.newArrayList(Registry.ENCHANTMENT).toArray(new Enchantment[0]); + return Lists.newArrayList(Registry.ENCHANTMENT).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations } } diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java -index fca4671c6976aee9e981ef344244f9322651d0c9..ef53ca228492434b1b8bc615a33690bb93dec72b 100644 +index fca4671c6976aee9e981ef344244f9322651d0c9..7dc1744fba576683155e7970832794c05ceff768 100644 --- a/src/main/java/org/bukkit/entity/Cat.java +++ b/src/main/java/org/bukkit/entity/Cat.java @@ -51,6 +51,7 @@ public interface Cat extends Tameable, Sittable, io.papermc.paper.entity.CollarC @@ -175,7 +175,7 @@ index fca4671c6976aee9e981ef344244f9322651d0c9..ef53ca228492434b1b8bc615a33690bb } diff --git a/src/main/java/org/bukkit/entity/Frog.java b/src/main/java/org/bukkit/entity/Frog.java -index f661a6b4797dd814a197e9245bcb2ddf2fca773f..6b3c10d378e9e80805d8cd2d8671b313bddd23e9 100644 +index f661a6b4797dd814a197e9245bcb2ddf2fca773f..58bf414cd753299abc54c45b3036d3fdbf9170dc 100644 --- a/src/main/java/org/bukkit/entity/Frog.java +++ b/src/main/java/org/bukkit/entity/Frog.java @@ -49,6 +49,7 @@ public interface Frog extends Animals { @@ -196,7 +196,7 @@ index f661a6b4797dd814a197e9245bcb2ddf2fca773f..6b3c10d378e9e80805d8cd2d8671b313 } } diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java -index 9c722a762c88a88bb5ef18c3b9eab8b371360dac..87c3e94a2b5e9205a9ad13a920ed7b9dfba03340 100644 +index 9c722a762c88a88bb5ef18c3b9eab8b371360dac..127bc2aab7fb36df206d53f3e6042bb6c920878e 100644 --- a/src/main/java/org/bukkit/entity/Villager.java +++ b/src/main/java/org/bukkit/entity/Villager.java @@ -170,6 +170,7 @@ public interface Villager extends AbstractVillager { @@ -234,7 +234,7 @@ index 9c722a762c88a88bb5ef18c3b9eab8b371360dac..87c3e94a2b5e9205a9ad13a920ed7b9d // Paper start diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java -index eb73f3224e7d2314c4209a3743a37bdae2395670..1b660fd1334847d8f8cd7eeff3d5ebd085fdfcfd 100644 +index 7f5682c80ff25142e7c8fa14e03b4a62fc5c01d3..5fbcdf637b1e0162276e668d9ebe4a8648a29b8a 100644 --- a/src/main/java/org/bukkit/map/MapCursor.java +++ b/src/main/java/org/bukkit/map/MapCursor.java @@ -286,6 +286,7 @@ public final class MapCursor { @@ -255,7 +255,7 @@ index eb73f3224e7d2314c4209a3743a37bdae2395670..1b660fd1334847d8f8cd7eeff3d5ebd0 } diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 11b973b70ce62a6e227d343bdef6dcb9ece3f97d..ccb4245b214444153cbca487ca98cb2ad65ccbae 100644 +index 2f8d3b7a5b25e323f892d2ec5eb7c3412a816ea4..22e358f7a83d84745c32ff9f04d79d51d8d92131 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -47,6 +47,7 @@ import org.jetbrains.annotations.Nullable; @@ -276,7 +276,7 @@ index 11b973b70ce62a6e227d343bdef6dcb9ece3f97d..ccb4245b214444153cbca487ca98cb2a Preconditions.checkArgument(directory != null, "Directory cannot be null"); Preconditions.checkArgument(directory.isDirectory(), "Directory must be a directory"); diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java -index 294ba70f1e446ec8d502e5c14f82ae52547aeb21..beb22bb6ca719ef11814e7cc80cc1aef7cb6f0ec 100644 +index e4cfdc80c9e49fc7992183022bdf2f36aae0d95a..0cd7987e935e2b7ede759af3db9af04366930e19 100644 --- a/src/main/java/org/bukkit/potion/PotionEffectType.java +++ b/src/main/java/org/bukkit/potion/PotionEffectType.java @@ -19,6 +19,7 @@ import org.jetbrains.annotations.Nullable; @@ -289,7 +289,7 @@ index 294ba70f1e446ec8d502e5c14f82ae52547aeb21..beb22bb6ca719ef11814e7cc80cc1aef * Increases movement speed. @@ -358,7 +359,7 @@ public abstract class PotionEffectType implements Keyed, Translatable, net.kyori @NotNull - @Deprecated + @Deprecated(since = "1.20.3") public static PotionEffectType[] values() { - return Lists.newArrayList(Registry.EFFECT).toArray(new PotionEffectType[0]); + return Lists.newArrayList(Registry.EFFECT).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations diff --git a/patches/server/0001-Purpur-Server-Changes.patch b/patches/server/0001-Purpur-Server-Changes.patch index 2c265e6..3f972ca 100644 --- a/patches/server/0001-Purpur-Server-Changes.patch +++ b/patches/server/0001-Purpur-Server-Changes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: granny -Date: Wed, 30 Oct 2024 13:25:10 +0900 +Date: Fri, 13 Dec 2024 07:03:31 +0900 Subject: [PATCH] Purpur Server Changes PurpurMC @@ -25,7 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/build.gradle.kts b/build.gradle.kts -index c209eb393670fd8d6c97ca65a801c8032b582a35..b4579fb919d8cc981edc4863b82abca531349f1e 100644 +index faf3e3fd72e8c915e7a4803dacbe1bb576c6663e..77602e4445b1b45a17e5552ac6a769e0ed46ebc7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,7 +25,7 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider { @@ -35,12 +35,19 @@ index c209eb393670fd8d6c97ca65a801c8032b582a35..b4579fb919d8cc981edc4863b82abca5 - implementation(project(":paper-api")) + implementation(project(":purpur-api")) // Pufferfish // Paper // Purpur // Paper start - implementation("org.jline:jline-terminal-jansi:3.21.0") - implementation("net.minecrell:terminalconsoleappender:1.3.0") -@@ -59,6 +59,10 @@ dependencies { + implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ + implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 +@@ -60,6 +60,17 @@ dependencies { runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18") runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18") ++ // Pufferfish start ++ implementation("org.yaml:snakeyaml:1.32") ++ implementation ("com.github.carleslc.Simple-YAML:Simple-Yaml:1.8.4") { // Purpur ++ exclude(group="org.yaml", module="snakeyaml") ++ } ++ // Pufferfish end ++ + implementation("org.mozilla:rhino-runtime:1.7.14") // Purpur + implementation("org.mozilla:rhino-engine:1.7.14") // Purpur + implementation("dev.omega24:upnp4j:1.0") // Purpur @@ -48,7 +55,22 @@ index c209eb393670fd8d6c97ca65a801c8032b582a35..b4579fb919d8cc981edc4863b82abca5 testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test testImplementation("org.junit.jupiter:junit-jupiter:5.10.2") testImplementation("org.junit.platform:junit-platform-suite-engine:1.10.0") -@@ -98,14 +102,14 @@ tasks.jar { +@@ -86,6 +97,14 @@ paperweight { + craftBukkitPackageVersion.set("v1_21_R2") // also needs to be updated in MappingEnvironment + } + ++ ++// Pufferfish Start ++tasks.withType { ++ val compilerArgs = options.compilerArgs ++ compilerArgs.add("--add-modules=jdk.incubator.vector") ++} ++// Pufferfish End ++ + tasks.jar { + archiveClassifier.set("dev") + +@@ -99,14 +118,14 @@ tasks.jar { val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", @@ -68,7 +90,7 @@ index c209eb393670fd8d6c97ca65a801c8032b582a35..b4579fb919d8cc981edc4863b82abca5 "Build-Number" to (build ?: ""), "Build-Time" to Instant.now().toString(), "Git-Branch" to gitBranch, // Paper -@@ -171,7 +175,7 @@ fun TaskContainer.registerRunTask( +@@ -172,7 +191,7 @@ fun TaskContainer.registerRunTask( name: String, block: JavaExec.() -> Unit ): TaskProvider = register(name) { @@ -168,6 +190,55 @@ index 0000000000000000000000000000000000000000..15a226e3854d731f7724025ea3459c8a + return new HighlightErrorConverter(formatters); + } +} +diff --git a/src/main/java/ca/spottedleaf/moonrise/common/list/IteratorSafeOrderedReferenceSet.java b/src/main/java/ca/spottedleaf/moonrise/common/list/IteratorSafeOrderedReferenceSet.java +index c21e00812f1aaa1279834a0562d360d6b89e146c..877d2095a066854939f260ca4b0b8c7b5abb620f 100644 +--- a/src/main/java/ca/spottedleaf/moonrise/common/list/IteratorSafeOrderedReferenceSet.java ++++ b/src/main/java/ca/spottedleaf/moonrise/common/list/IteratorSafeOrderedReferenceSet.java +@@ -18,7 +18,7 @@ public final class IteratorSafeOrderedReferenceSet { + + private final double maxFragFactor; + +- private int iteratorCount; ++ private final java.util.concurrent.atomic.AtomicInteger iteratorCount = new java.util.concurrent.atomic.AtomicInteger(); // Pufferfish - async mob spawning + + public IteratorSafeOrderedReferenceSet() { + this(16, 0.75f, 16, 0.2); +@@ -79,7 +79,7 @@ public final class IteratorSafeOrderedReferenceSet { + } + + public int createRawIterator() { +- ++this.iteratorCount; ++ this.iteratorCount.incrementAndGet(); // Pufferfish - async mob spawning + if (this.indexMap.isEmpty()) { + return -1; + } else { +@@ -100,7 +100,7 @@ public final class IteratorSafeOrderedReferenceSet { + } + + public void finishRawIterator() { +- if (--this.iteratorCount == 0) { ++ if (this.iteratorCount.decrementAndGet() == 0) { // Pufferfish - async mob spawning + if (this.getFragFactor() >= this.maxFragFactor) { + this.defrag(); + } +@@ -117,7 +117,7 @@ public final class IteratorSafeOrderedReferenceSet { + throw new IllegalStateException(); + } + this.listElements[index] = null; +- if (this.iteratorCount == 0 && this.getFragFactor() >= this.maxFragFactor) { ++ if (this.iteratorCount.get() == 0 && this.getFragFactor() >= this.maxFragFactor) { // Pufferfish - async mob spawning + this.defrag(); + } + //this.check(); +@@ -219,7 +219,7 @@ public final class IteratorSafeOrderedReferenceSet { + } + + public IteratorSafeOrderedReferenceSet.Iterator iterator(final int flags) { +- ++this.iteratorCount; ++ this.iteratorCount.incrementAndGet(); // Pufferfish - async mob spawning + return new BaseIterator<>(this, true, (flags & ITERATOR_FLAG_SEE_ADDITIONS) != 0 ? Integer.MAX_VALUE : this.listSize); + } + diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java index 4b002e8b75d117b726b0de274a76d3596fce015b..8cde30544e14f8fc2dac32966ae3c21f8cf3a551 100644 --- a/src/main/java/com/destroystokyo/paper/Metrics.java @@ -329,19 +400,880 @@ index 12b327eea95e0de9e9c39b7d039badee8ec46508..849ecc5af70901f1e40cb6c419f33f1c setListData(vector); } +diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishCommand.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishCommand.java +new file mode 100644 +index 0000000000000000000000000000000000000000..020368da69b9a492155f6de6297f74732f4ab6ea +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishCommand.java +@@ -0,0 +1,68 @@ ++package gg.pufferfish.pufferfish; ++ ++import java.io.IOException; ++import java.util.Collections; ++import java.util.List; ++import java.util.stream.Collectors; ++import java.util.stream.Stream; ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.format.NamedTextColor; ++import net.md_5.bungee.api.ChatColor; ++import net.minecraft.server.MinecraftServer; ++import org.bukkit.Bukkit; ++import org.bukkit.Location; ++import org.bukkit.command.Command; ++import org.bukkit.command.CommandSender; ++ ++public class PufferfishCommand extends Command { ++ ++ public PufferfishCommand() { ++ super("pufferfish"); ++ this.description = "Pufferfish related commands"; ++ this.usageMessage = "/pufferfish [reload | version]"; ++ this.setPermission("bukkit.command.pufferfish"); ++ } ++ ++ public static void init() { ++ MinecraftServer.getServer().server.getCommandMap().register("pufferfish", "Pufferfish", new PufferfishCommand()); ++ } ++ ++ @Override ++ public List tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException { ++ if (args.length == 1) { ++ return Stream.of("reload", "version") ++ .filter(arg -> arg.startsWith(args[0].toLowerCase())) ++ .collect(Collectors.toList()); ++ } ++ return Collections.emptyList(); ++ } ++ ++ @Override ++ public boolean execute(CommandSender sender, String commandLabel, String[] args) { ++ if (!testPermission(sender)) return true; ++ String prefix = ChatColor.of("#12fff6") + "" + ChatColor.BOLD + "Pufferfish » " + ChatColor.of("#e8f9f9"); ++ ++ if (args.length != 1) { ++ sender.sendMessage(prefix + "Usage: " + usageMessage); ++ args = new String[]{"version"}; ++ } ++ ++ if (args[0].equalsIgnoreCase("reload")) { ++ MinecraftServer console = MinecraftServer.getServer(); ++ try { ++ PufferfishConfig.load(); ++ } catch (IOException e) { ++ sender.sendMessage(Component.text("Failed to reload.", NamedTextColor.RED)); ++ e.printStackTrace(); ++ return true; ++ } ++ console.server.reloadCount++; ++ ++ Command.broadcastCommandMessage(sender, prefix + "Pufferfish configuration has been reloaded."); ++ } else if (args[0].equalsIgnoreCase("version")) { ++ Command.broadcastCommandMessage(sender, prefix + "This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")"); ++ } ++ ++ return true; ++ } ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +new file mode 100644 +index 0000000000000000000000000000000000000000..411c81a88b8a008b2aaf0ca62fb7ffa1dd9e32a4 +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +@@ -0,0 +1,281 @@ ++package gg.pufferfish.pufferfish; ++ ++import gg.pufferfish.pufferfish.simd.SIMDDetection; ++import java.io.File; ++import java.io.IOException; ++import java.util.Collections; ++import net.minecraft.core.registries.BuiltInRegistries; ++import net.minecraft.server.MinecraftServer; ++import org.apache.logging.log4j.Level; ++import org.bukkit.configuration.ConfigurationSection; ++import net.minecraft.world.entity.EntityType; ++import java.lang.reflect.Method; ++import java.lang.reflect.Modifier; ++import java.util.List; ++import net.minecraft.server.MinecraftServer; ++import org.apache.logging.log4j.Level; ++import org.bukkit.configuration.ConfigurationSection; ++import org.bukkit.configuration.MemoryConfiguration; ++import org.jetbrains.annotations.Nullable; ++import org.simpleyaml.configuration.comments.CommentType; ++import org.simpleyaml.configuration.file.YamlFile; ++import org.simpleyaml.exceptions.InvalidConfigurationException; ++ ++public class PufferfishConfig { ++ ++ private static final YamlFile config = new YamlFile(); ++ private static int updates = 0; ++ public static File pufferfishFile; // Purpur ++ ++ private static ConfigurationSection convertToBukkit(org.simpleyaml.configuration.ConfigurationSection section) { ++ ConfigurationSection newSection = new MemoryConfiguration(); ++ for (String key : section.getKeys(false)) { ++ if (section.isConfigurationSection(key)) { ++ newSection.set(key, convertToBukkit(section.getConfigurationSection(key))); ++ } else { ++ newSection.set(key, section.get(key)); ++ } ++ } ++ return newSection; ++ } ++ ++ public static ConfigurationSection getConfigCopy() { ++ return convertToBukkit(config); ++ } ++ ++ public static int getUpdates() { ++ return updates; ++ } ++ ++ public static void load() throws IOException { ++ File configFile = pufferfishFile; // Purpur ++ ++ if (configFile.exists()) { ++ try { ++ config.load(configFile); ++ } catch (InvalidConfigurationException e) { ++ throw new IOException(e); ++ } ++ } ++ ++ getString("info.version", "1.0"); ++ setComment("info", ++ "Pufferfish Configuration", ++ "Check out Pufferfish Host for maximum performance server hosting: https://pufferfish.host", ++ "Join our Discord for support: https://discord.gg/reZw4vQV9H", ++ "Download new builds at https://ci.pufferfish.host/job/Pufferfish"); ++ ++ for (Method method : PufferfishConfig.class.getDeclaredMethods()) { ++ if (Modifier.isStatic(method.getModifiers()) && Modifier.isPrivate(method.getModifiers()) && method.getParameterCount() == 0 && ++ method.getReturnType() == Void.TYPE && !method.getName().startsWith("lambda")) { ++ method.setAccessible(true); ++ try { ++ method.invoke(null); ++ } catch (Throwable t) { ++ MinecraftServer.LOGGER.warn("Failed to load configuration option from " + method.getName(), t); ++ } ++ } ++ } ++ ++ updates++; ++ ++ config.save(configFile); ++ ++ // Attempt to detect vectorization ++ try { ++ SIMDDetection.isEnabled = SIMDDetection.canEnable(PufferfishLogger.LOGGER); ++ SIMDDetection.versionLimited = SIMDDetection.getJavaVersion() < 17 || SIMDDetection.getJavaVersion() > 21; ++ } catch (NoClassDefFoundError | Exception ignored) { ++ ignored.printStackTrace(); ++ } ++ ++ if (SIMDDetection.isEnabled) { ++ PufferfishLogger.LOGGER.info("SIMD operations detected as functional. Will replace some operations with faster versions."); ++ } else if (SIMDDetection.versionLimited) { ++ PufferfishLogger.LOGGER.warning("Will not enable SIMD! These optimizations are only safely supported on Java 17-21."); ++ } else { ++ PufferfishLogger.LOGGER.warning("SIMD operations are available for your server, but are not configured!"); ++ PufferfishLogger.LOGGER.warning("To enable additional optimizations, add \"--add-modules=jdk.incubator.vector\" to your startup flags, BEFORE the \"-jar\"."); ++ PufferfishLogger.LOGGER.warning("If you have already added this flag, then SIMD operations are not supported on your JVM or CPU."); ++ PufferfishLogger.LOGGER.warning("Debug: Java: " + System.getProperty("java.version") + ", test run: " + SIMDDetection.testRun); ++ } ++ } ++ ++ private static void setComment(String key, String... comment) { ++ if (config.contains(key)) { ++ config.setComment(key, String.join("\n", comment), CommentType.BLOCK); ++ } ++ } ++ ++ private static void ensureDefault(String key, Object defaultValue, String... comment) { ++ if (!config.contains(key)) { ++ config.set(key, defaultValue); ++ config.setComment(key, String.join("\n", comment), CommentType.BLOCK); ++ } ++ } ++ ++ private static boolean getBoolean(String key, boolean defaultValue, String... comment) { ++ return getBoolean(key, null, defaultValue, comment); ++ } ++ ++ private static boolean getBoolean(String key, @Nullable String oldKey, boolean defaultValue, String... comment) { ++ ensureDefault(key, defaultValue, comment); ++ return config.getBoolean(key, defaultValue); ++ } ++ ++ private static int getInt(String key, int defaultValue, String... comment) { ++ return getInt(key, null, defaultValue, comment); ++ } ++ ++ private static int getInt(String key, @Nullable String oldKey, int defaultValue, String... comment) { ++ ensureDefault(key, defaultValue, comment); ++ return config.getInt(key, defaultValue); ++ } ++ ++ private static double getDouble(String key, double defaultValue, String... comment) { ++ return getDouble(key, null, defaultValue, comment); ++ } ++ ++ private static double getDouble(String key, @Nullable String oldKey, double defaultValue, String... comment) { ++ ensureDefault(key, defaultValue, comment); ++ return config.getDouble(key, defaultValue); ++ } ++ ++ private static String getString(String key, String defaultValue, String... comment) { ++ return getOldString(key, null, defaultValue, comment); ++ } ++ ++ private static String getOldString(String key, @Nullable String oldKey, String defaultValue, String... comment) { ++ ensureDefault(key, defaultValue, comment); ++ return config.getString(key, defaultValue); ++ } ++ ++ private static List getStringList(String key, List defaultValue, String... comment) { ++ return getStringList(key, null, defaultValue, comment); ++ } ++ ++ private static List getStringList(String key, @Nullable String oldKey, List defaultValue, String... comment) { ++ ensureDefault(key, defaultValue, comment); ++ return config.getStringList(key); ++ } ++ ++ public static String sentryDsn; ++ private static void sentry() { ++ String sentryEnvironment = System.getenv("SENTRY_DSN"); ++ String sentryConfig = getString("sentry-dsn", "", "Sentry DSN for improved error logging, leave blank to disable", "Obtain from https://sentry.io/"); ++ ++ sentryDsn = sentryEnvironment == null ? sentryConfig : sentryEnvironment; ++ if (sentryDsn != null && !sentryDsn.isBlank()) { ++ gg.pufferfish.pufferfish.sentry.SentryManager.init(); ++ } ++ } ++ ++ public static boolean enableBooks; ++ private static void books() { ++ enableBooks = getBoolean("enable-books", true, ++ "Whether or not books should be writeable.", ++ "Servers that anticipate being a target for duping may want to consider", ++ "disabling this option.", ++ "This can be overridden per-player with the permission pufferfish.usebooks"); ++ } ++ ++ public static boolean tpsCatchup; ++ private static void tpsCatchup() { ++ tpsCatchup = getBoolean("tps-catchup", true, ++ "If this setting is true, the server will run faster after a lag spike in", ++ "an attempt to maintain 20 TPS. This option (defaults to true per", ++ "spigot/paper) can cause mobs to move fast after a lag spike."); ++ } ++ ++ public static boolean enableSuffocationOptimization; ++ private static void suffocationOptimization() { ++ enableSuffocationOptimization = getBoolean("enable-suffocation-optimization", true, ++ "Optimizes the suffocation check by selectively skipping", ++ "the check in a way that still appears vanilla. This should", ++ "be left enabled on most servers, but is provided as a", ++ "configuration option if the vanilla deviation is undesirable."); ++ } ++ ++ public static boolean enableAsyncMobSpawning; ++ public static boolean asyncMobSpawningInitialized; ++ private static void asyncMobSpawning() { ++ boolean temp = getBoolean("enable-async-mob-spawning", true, ++ "Whether or not asynchronous mob spawning should be enabled.", ++ "On servers with many entities, this can improve performance by up to 15%. You must have", ++ "paper's per-player-mob-spawns setting set to true for this to work.", ++ "One quick note - this does not actually spawn mobs async (that would be very unsafe).", ++ "This just offloads some expensive calculations that are required for mob spawning."); ++ ++ // This prevents us from changing the value during a reload. ++ if (!asyncMobSpawningInitialized) { ++ asyncMobSpawningInitialized = true; ++ enableAsyncMobSpawning = temp; ++ } ++ } ++ ++ public static int maxProjectileLoadsPerTick; ++ public static int maxProjectileLoadsPerProjectile; ++ private static void projectileLoading() { ++ maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); ++ maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", 10, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed."); ++ ++ setComment("projectile", "Optimizes projectile settings"); ++ } ++ ++ ++ public static boolean dearEnabled; ++ public static int startDistance; ++ public static int startDistanceSquared; ++ public static int maximumActivationPrio; ++ public static int activationDistanceMod; ++ ++ private static void dynamicActivationOfBrains() throws IOException { ++ dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", false); // Purpur ++ startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12, ++ "This value determines how far away an entity has to be", ++ "from the player to start being effected by DEAR."); ++ startDistanceSquared = startDistance * startDistance; ++ maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", 20, ++ "This value defines how often in ticks, the furthest entity", ++ "will get their pathfinders and behaviors ticked. 20 = 1s"); ++ activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", 8, ++ "This value defines how much distance modifies an entity's", ++ "tick frequency. freq = (distanceToPlayer^2) / (2^value)", ++ "If you want further away entities to tick less often, use 7.", ++ "If you want further away entities to tick more often, try 9."); ++ ++ for (EntityType entityType : BuiltInRegistries.ENTITY_TYPE) { ++ entityType.dabEnabled = true; // reset all, before setting the ones to true ++ } ++ getStringList("dab.blacklisted-entities", "activation-range.blacklisted-entities", Collections.emptyList(), "A list of entities to ignore for activation") ++ .forEach(name -> EntityType.byString(name).ifPresentOrElse(entityType -> { ++ entityType.dabEnabled = false; ++ }, () -> MinecraftServer.LOGGER.warn("Unknown entity \"" + name + "\""))); ++ ++ setComment("dab", "Optimizes entity brains when", "they're far away from the player"); ++ } ++ ++ public static boolean throttleInactiveGoalSelectorTick; ++ private static void inactiveGoalSelectorThrottle() { ++ throttleInactiveGoalSelectorTick = getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", false, // Purpur ++ "Throttles the AI goal selector in entity inactive ticks.", ++ "This can improve performance by a few percent, but has minor gameplay implications."); ++ } ++ ++ public static boolean allowEndCrystalRespawn; ++ private static void allowEndCrystalRespawn() { ++ allowEndCrystalRespawn = getBoolean("allow-end-crystal-respawn", true, ++ "Allows end crystals to respawn the ender dragon.", ++ "On servers that expect end crystal fights in the end dimension, disabling this", ++ "will prevent the server from performing an expensive search to attempt respawning", ++ "the ender dragon whenever a player places an end crystal."); ++ } ++ ++ ++ public static boolean disableMethodProfiler; ++ private static void miscSettings() { ++ disableMethodProfiler = getBoolean("misc.disable-method-profiler", true); ++ setComment("misc", "Settings for things that don't belong elsewhere"); ++ } ++ ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java +new file mode 100644 +index 0000000000000000000000000000000000000000..53f2df00c6809618a9ee3d2ea72e85e8052fbcf1 +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java +@@ -0,0 +1,16 @@ ++package gg.pufferfish.pufferfish; ++ ++import java.util.logging.Level; ++import java.util.logging.Logger; ++import org.bukkit.Bukkit; ++ ++public class PufferfishLogger extends Logger { ++ public static final PufferfishLogger LOGGER = new PufferfishLogger(); ++ ++ private PufferfishLogger() { ++ super("Pufferfish", null); ++ ++ setParent(Bukkit.getLogger()); ++ setLevel(Level.ALL); ++ } ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishVersionFetcher.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishVersionFetcher.java +new file mode 100644 +index 0000000000000000000000000000000000000000..06323dcc745aed16123980fc559d7b65c42f1e1c +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishVersionFetcher.java +@@ -0,0 +1,132 @@ ++package gg.pufferfish.pufferfish; ++ ++import com.destroystokyo.paper.VersionHistoryManager; ++import com.destroystokyo.paper.util.VersionFetcher; ++import com.google.gson.Gson; ++import com.google.gson.JsonObject; ++import io.papermc.paper.ServerBuildInfo; ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.JoinConfiguration; ++import net.kyori.adventure.text.format.NamedTextColor; ++import net.kyori.adventure.text.format.TextDecoration; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++import java.io.IOException; ++import java.net.URI; ++import java.net.http.HttpClient; ++import java.net.http.HttpRequest; ++import java.net.http.HttpResponse; ++import java.nio.charset.StandardCharsets; ++import java.util.concurrent.TimeUnit; ++import java.util.logging.Level; ++import java.util.logging.Logger; ++ ++import static net.kyori.adventure.text.Component.text; ++import static net.kyori.adventure.text.format.NamedTextColor.GREEN; ++import static net.kyori.adventure.text.format.NamedTextColor.RED; ++ ++public class PufferfishVersionFetcher implements VersionFetcher { ++ ++ private static final Logger LOGGER = Logger.getLogger("PufferfishVersionFetcher"); ++ private static final HttpClient client = HttpClient.newHttpClient(); ++ ++ private static final URI JENKINS_URI = URI.create("https://ci.pufferfish.host/job/Pufferfish-1.21/lastSuccessfulBuild/buildNumber"); ++ private static final String GITHUB_FORMAT = "https://api.github.com/repos/pufferfish-gg/Pufferfish/compare/ver/1.21...%s"; ++ ++ private static final HttpResponse.BodyHandler JSON_OBJECT_BODY_HANDLER = responseInfo -> HttpResponse.BodySubscribers ++ .mapping( ++ HttpResponse.BodySubscribers.ofString(StandardCharsets.UTF_8), ++ string -> new Gson().fromJson(string, JsonObject.class) ++ ); ++ ++ @Override ++ public long getCacheTime() { ++ return TimeUnit.MINUTES.toMillis(30); ++ } ++ ++ @Override ++ public @NotNull Component getVersionMessage(final @NotNull String serverVersion) { ++ @NotNull Component component; ++ ++ if (ServerBuildInfo.buildInfo().buildNumber().isPresent()) { ++ component = this.fetchJenkinsVersion(ServerBuildInfo.buildInfo().buildNumber().getAsInt()); ++ } else if (ServerBuildInfo.buildInfo().gitCommit().isPresent()) { ++ component = this.fetchGithubVersion(ServerBuildInfo.buildInfo().gitCommit().get()); ++ } else { ++ component = text("Unknown server version.", RED); ++ } ++ ++ final @Nullable Component history = this.getHistory(); ++ return history != null ? Component ++ .join(JoinConfiguration.noSeparators(), component, Component.newline(), this.getHistory()) : component; ++ } ++ ++ private @NotNull Component fetchJenkinsVersion(final int versionNumber) { ++ final HttpRequest request = HttpRequest.newBuilder(JENKINS_URI).build(); ++ try { ++ final HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ++ if (response.statusCode() != 200) { ++ return text("Received invalid status code (" + response.statusCode() + ") from server.", RED); ++ } ++ ++ int latestVersionNumber; ++ try { ++ latestVersionNumber = Integer.parseInt(response.body()); ++ } catch (NumberFormatException e) { ++ LOGGER.log(Level.WARNING, "Received invalid response from Jenkins \"" + response.body() + "\"."); ++ return text("Received invalid response from server.", RED); ++ } ++ ++ final int versionDiff = latestVersionNumber - versionNumber; ++ return this.getResponseMessage(versionDiff); ++ } catch (IOException | InterruptedException e) { ++ LOGGER.log(Level.WARNING, "Failed to look up version from Jenkins", e); ++ return text("Failed to retrieve version from server.", RED); ++ } ++ } ++ ++ // Based off code contributed by Techcable in Paper/GH-65 ++ private @NotNull Component fetchGithubVersion(final @NotNull String hash) { ++ final URI uri = URI.create(String.format(GITHUB_FORMAT, hash)); ++ final HttpRequest request = HttpRequest.newBuilder(uri).build(); ++ try { ++ final HttpResponse response = client.send(request, JSON_OBJECT_BODY_HANDLER); ++ if (response.statusCode() != 200) { ++ return text("Received invalid status code (" + response.statusCode() + ") from server.", RED); ++ } ++ ++ final JsonObject obj = response.body(); ++ final int versionDiff = obj.get("behind_by").getAsInt(); ++ ++ return this.getResponseMessage(versionDiff); ++ } catch (IOException | InterruptedException e) { ++ LOGGER.log(Level.WARNING, "Failed to look up version from GitHub", e); ++ return text("Failed to retrieve version from server.", RED); ++ } ++ } ++ ++ private @NotNull Component getResponseMessage(final int versionDiff) { ++ return switch (Math.max(-1, Math.min(1, versionDiff))) { ++ case -1 -> text("You are running an unsupported version of Pufferfish.", RED); ++ case 0 -> text("You are on the latest version!", GREEN); ++ default -> text("You are running " + versionDiff + " version" + (versionDiff == 1 ? "" : "s") + " behind. " + ++ "Please update your server when possible to maintain stability and security, and to receive the latest optimizations.", ++ RED); ++ }; ++ } ++ ++ private @Nullable Component getHistory() { ++ final VersionHistoryManager.VersionData data = VersionHistoryManager.INSTANCE.getVersionData(); ++ if (data == null) { ++ return null; ++ } ++ ++ final String oldVersion = data.getOldVersion(); ++ if (oldVersion == null) { ++ return null; ++ } ++ ++ return Component.text("Previous version: " + oldVersion, NamedTextColor.GRAY, TextDecoration.ITALIC); ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java b/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java +new file mode 100644 +index 0000000000000000000000000000000000000000..731ef11c7a025ae95ed8a757b530d834733d0621 +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java +@@ -0,0 +1,135 @@ ++package gg.pufferfish.pufferfish.sentry; ++ ++import com.google.common.reflect.TypeToken; ++import com.google.gson.Gson; ++import io.sentry.Breadcrumb; ++import io.sentry.Sentry; ++import io.sentry.SentryEvent; ++import io.sentry.SentryLevel; ++import io.sentry.protocol.Message; ++import io.sentry.protocol.User; ++import java.util.Map; ++import org.apache.logging.log4j.Level; ++import org.apache.logging.log4j.LogManager; ++import org.apache.logging.log4j.Marker; ++import org.apache.logging.log4j.core.LogEvent; ++import org.apache.logging.log4j.core.Logger; ++import org.apache.logging.log4j.core.appender.AbstractAppender; ++import org.apache.logging.log4j.core.filter.AbstractFilter; ++ ++public class PufferfishSentryAppender extends AbstractAppender { ++ ++ private static final org.apache.logging.log4j.Logger logger = LogManager.getLogger(PufferfishSentryAppender.class); ++ private static final Gson GSON = new Gson(); ++ ++ public PufferfishSentryAppender() { ++ super("PufferfishSentryAdapter", new SentryFilter(), null); ++ } ++ ++ @Override ++ public void append(LogEvent logEvent) { ++ if (logEvent.getThrown() != null && logEvent.getLevel().isMoreSpecificThan(Level.WARN)) { ++ try { ++ logException(logEvent); ++ } catch (Exception e) { ++ logger.warn("Failed to log event with sentry", e); ++ } ++ } else { ++ try { ++ logBreadcrumb(logEvent); ++ } catch (Exception e) { ++ logger.warn("Failed to log event with sentry", e); ++ } ++ } ++ } ++ ++ private void logException(LogEvent e) { ++ SentryEvent event = new SentryEvent(e.getThrown()); ++ ++ Message sentryMessage = new Message(); ++ sentryMessage.setMessage(e.getMessage().getFormattedMessage()); ++ ++ event.setThrowable(e.getThrown()); ++ event.setLevel(getLevel(e.getLevel())); ++ event.setLogger(e.getLoggerName()); ++ event.setTransaction(e.getLoggerName()); ++ event.setExtra("thread_name", e.getThreadName()); ++ ++ boolean hasContext = e.getContextData() != null; ++ ++ if (hasContext && e.getContextData().containsKey("pufferfishsentry_playerid")) { ++ User user = new User(); ++ user.setId(e.getContextData().getValue("pufferfishsentry_playerid")); ++ user.setUsername(e.getContextData().getValue("pufferfishsentry_playername")); ++ event.setUser(user); ++ } ++ ++ if (hasContext && e.getContextData().containsKey("pufferfishsentry_pluginname")) { ++ event.setExtra("plugin.name", e.getContextData().getValue("pufferfishsentry_pluginname")); ++ event.setExtra("plugin.version", e.getContextData().getValue("pufferfishsentry_pluginversion")); ++ event.setTransaction(e.getContextData().getValue("pufferfishsentry_pluginname")); ++ } ++ ++ if (hasContext && e.getContextData().containsKey("pufferfishsentry_eventdata")) { ++ Map eventFields = GSON.fromJson((String) e.getContextData().getValue("pufferfishsentry_eventdata"), new TypeToken>() {}.getType()); ++ if (eventFields != null) { ++ event.setExtra("event", eventFields); ++ } ++ } ++ ++ Sentry.captureEvent(event); ++ } ++ ++ private void logBreadcrumb(LogEvent e) { ++ Breadcrumb breadcrumb = new Breadcrumb(); ++ ++ breadcrumb.setLevel(getLevel(e.getLevel())); ++ breadcrumb.setCategory(e.getLoggerName()); ++ breadcrumb.setType(e.getLoggerName()); ++ breadcrumb.setMessage(e.getMessage().getFormattedMessage()); ++ ++ Sentry.addBreadcrumb(breadcrumb); ++ } ++ ++ private SentryLevel getLevel(Level level) { ++ switch (level.getStandardLevel()) { ++ case TRACE: ++ case DEBUG: ++ return SentryLevel.DEBUG; ++ case WARN: ++ return SentryLevel.WARNING; ++ case ERROR: ++ return SentryLevel.ERROR; ++ case FATAL: ++ return SentryLevel.FATAL; ++ case INFO: ++ default: ++ return SentryLevel.INFO; ++ } ++ } ++ ++ private static class SentryFilter extends AbstractFilter { ++ ++ @Override ++ public Result filter(Logger logger, org.apache.logging.log4j.Level level, Marker marker, String msg, ++ Object... params) { ++ return this.filter(logger.getName()); ++ } ++ ++ @Override ++ public Result filter(Logger logger, org.apache.logging.log4j.Level level, Marker marker, Object msg, Throwable t) { ++ return this.filter(logger.getName()); ++ } ++ ++ @Override ++ public Result filter(LogEvent event) { ++ return this.filter(event == null ? null : event.getLoggerName()); ++ } ++ ++ private Result filter(String loggerName) { ++ return loggerName != null && loggerName.startsWith("gg.castaway.pufferfish.sentry") ? Result.DENY ++ : Result.NEUTRAL; ++ } ++ ++ } ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1b29210ad0bbb4ada150f23357f0c80d331c996d +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java +@@ -0,0 +1,40 @@ ++package gg.pufferfish.pufferfish.sentry; ++ ++import gg.pufferfish.pufferfish.PufferfishConfig; ++import io.sentry.Sentry; ++import org.apache.logging.log4j.LogManager; ++import org.apache.logging.log4j.Logger; ++ ++public class SentryManager { ++ ++ private static final Logger logger = LogManager.getLogger(SentryManager.class); ++ ++ private SentryManager() { ++ ++ } ++ ++ private static boolean initialized = false; ++ ++ public static synchronized void init() { ++ if (initialized) { ++ return; ++ } ++ try { ++ initialized = true; ++ ++ Sentry.init(options -> { ++ options.setDsn(PufferfishConfig.sentryDsn); ++ options.setMaxBreadcrumbs(100); ++ }); ++ ++ PufferfishSentryAppender appender = new PufferfishSentryAppender(); ++ appender.start(); ++ ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()).addAppender(appender); ++ logger.info("Sentry logging started!"); ++ } catch (Exception e) { ++ logger.warn("Failed to initialize sentry!", e); ++ initialized = false; ++ } ++ } ++ ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java b/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8e5323d5d9af25c8a85c4b34a6be76cfc54384cf +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java +@@ -0,0 +1,73 @@ ++package gg.pufferfish.pufferfish.util; ++ ++import com.google.common.collect.Queues; ++import gg.pufferfish.pufferfish.PufferfishLogger; ++import java.util.Queue; ++import java.util.concurrent.locks.Condition; ++import java.util.concurrent.locks.Lock; ++import java.util.concurrent.locks.ReentrantLock; ++import java.util.logging.Level; ++ ++public class AsyncExecutor implements Runnable { ++ ++ private final Queue jobs = Queues.newArrayDeque(); ++ private final Lock mutex = new ReentrantLock(); ++ private final Condition cond = mutex.newCondition(); ++ private final Thread thread; ++ private volatile boolean killswitch = false; ++ ++ public AsyncExecutor(String threadName) { ++ this.thread = new Thread(this, threadName); ++ } ++ ++ public void start() { ++ thread.start(); ++ } ++ ++ public void kill() { ++ killswitch = true; ++ cond.signalAll(); ++ } ++ ++ public void submit(Runnable runnable) { ++ mutex.lock(); ++ try { ++ jobs.offer(runnable); ++ cond.signalAll(); ++ } finally { ++ mutex.unlock(); ++ } ++ } ++ ++ @Override ++ public void run() { ++ while (!killswitch) { ++ try { ++ Runnable runnable = takeRunnable(); ++ if (runnable != null) { ++ runnable.run(); ++ } ++ } catch (InterruptedException e) { ++ Thread.currentThread().interrupt(); ++ } catch (Exception e) { ++ PufferfishLogger.LOGGER.log(Level.SEVERE, e, () -> "Failed to execute async job for thread " + thread.getName()); ++ } ++ } ++ } ++ ++ private Runnable takeRunnable() throws InterruptedException { ++ mutex.lock(); ++ try { ++ while (jobs.isEmpty() && !killswitch) { ++ cond.await(); ++ } ++ ++ if (jobs.isEmpty()) return null; // We've set killswitch ++ ++ return jobs.remove(); ++ } finally { ++ mutex.unlock(); ++ } ++ } ++ ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java b/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c1929840254a3e6d721816f4a20415bea1742580 +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java +@@ -0,0 +1,20 @@ ++package gg.pufferfish.pufferfish.util; ++ ++import java.util.Iterator; ++import org.jetbrains.annotations.NotNull; ++ ++public class IterableWrapper implements Iterable { ++ ++ private final Iterator iterator; ++ ++ public IterableWrapper(Iterator iterator) { ++ this.iterator = iterator; ++ } ++ ++ @NotNull ++ @Override ++ public Iterator iterator() { ++ return iterator; ++ } ++ ++} +diff --git a/src/main/java/gg/pufferfish/pufferfish/util/Long2ObjectOpenHashMapWrapper.java b/src/main/java/gg/pufferfish/pufferfish/util/Long2ObjectOpenHashMapWrapper.java +new file mode 100644 +index 0000000000000000000000000000000000000000..facd55463d44cb7e3d2ca6892982f5497b8dded1 +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/util/Long2ObjectOpenHashMapWrapper.java +@@ -0,0 +1,40 @@ ++package gg.pufferfish.pufferfish.util; ++ ++import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; ++import java.util.Map; ++import org.jetbrains.annotations.Nullable; ++ ++public class Long2ObjectOpenHashMapWrapper extends Long2ObjectOpenHashMap { ++ ++ private final Map backingMap; ++ ++ public Long2ObjectOpenHashMapWrapper(Map map) { ++ backingMap = map; ++ } ++ ++ @Override ++ public V put(Long key, V value) { ++ return backingMap.put(key, value); ++ } ++ ++ @Override ++ public V get(Object key) { ++ return backingMap.get(key); ++ } ++ ++ @Override ++ public V remove(Object key) { ++ return backingMap.remove(key); ++ } ++ ++ @Nullable ++ @Override ++ public V putIfAbsent(Long key, V value) { ++ return backingMap.putIfAbsent(key, value); ++ } ++ ++ @Override ++ public int size() { ++ return backingMap.size(); ++ } ++} diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java -index 790bad0494454ca12ee152e3de6da3da634d9b20..a6e5950b5875cafd734300cdfbf58f5d3736f3c8 100644 +index 790bad0494454ca12ee152e3de6da3da634d9b20..3099c21ee589acf6edff5903a23673adf489024f 100644 --- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java +++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java -@@ -31,6 +31,7 @@ public record ServerBuildInfoImpl( +@@ -31,6 +31,8 @@ public record ServerBuildInfoImpl( private static final String ATTRIBUTE_GIT_COMMIT = "Git-Commit"; private static final String BRAND_PAPER_NAME = "Paper"; ++ private static final String BRAND_PUFFERFISH_NAME = "Pufferfish"; // Purpur + private static final String BRAND_PURPUR_NAME = "Purpur"; // Purpur private static final String BUILD_DEV = "DEV"; -@@ -42,9 +43,9 @@ public record ServerBuildInfoImpl( +@@ -42,9 +44,9 @@ public record ServerBuildInfoImpl( this( getManifestAttribute(manifest, ATTRIBUTE_BRAND_ID) .map(Key::key) @@ -353,12 +1285,12 @@ index 790bad0494454ca12ee152e3de6da3da634d9b20..a6e5950b5875cafd734300cdfbf58f5d SharedConstants.getCurrentVersion().getId(), SharedConstants.getCurrentVersion().getName(), getManifestAttribute(manifest, ATTRIBUTE_BUILD_NUMBER) -@@ -61,7 +62,7 @@ public record ServerBuildInfoImpl( +@@ -61,7 +63,7 @@ public record ServerBuildInfoImpl( @Override public boolean isBrandCompatible(final @NotNull Key brandId) { - return brandId.equals(this.brandId); -+ return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID); // Purpur ++ return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID) || brandId.equals(BRAND_PUFFERFISH_ID); // Purpur } @Override @@ -491,10 +1423,10 @@ index f0fce4113fb07c64adbec029d177c236cbdcbae8..865dc183276720d54d31d2a54d1bb5c8 } diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -index 1029b6de6f36b08bf634b4056ef5701383f6f258..ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8 100644 +index c5644d8d64f12073e39bc6ed79c8714f4560ff89..47a2cba0db36b11548d06ec21f7c7d7c9a962d6e 100644 --- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -@@ -260,6 +260,7 @@ public class PaperConfigurations extends Configurations { -+ /*Profiler.get().push(() -> { // Purpur - return "/" + s; -- }); -+ });*/ // Purpur - ContextChain contextchain = this.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit // Paper - Add UnknownCommandEvent - - try { -@@ -377,7 +385,7 @@ public class Commands { - Commands.LOGGER.error("'/{}' threw an exception", s, exception); - } - } finally { -- Profiler.get().pop(); -+ //Profiler.get().pop(); // Purpur - } - - } -@@ -514,6 +522,7 @@ public class Commands { +@@ -515,6 +523,7 @@ public class Commands { private void runSync(ServerPlayer player, Collection bukkit, RootCommandNode rootcommandnode) { // Paper end - Perf: Async command map building new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, true).callEvent(); // Paper - Brigadier API @@ -693,7 +1595,7 @@ index 260350422fc724ba5cd5769cbb387b6007f36a84..647a3ac2aea4dadd638836f831cc3768 PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit)); event.getPlayer().getServer().getPluginManager().callEvent(event); -@@ -524,6 +533,7 @@ public class Commands { +@@ -525,6 +534,7 @@ public class Commands { } } // CraftBukkit end @@ -756,18 +1658,9 @@ index c8d39e6e1c570c9219f6066da273dc0130920519..b455c7e9d18bac3654daa8510f85cc21 + // Purpur end } diff --git a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java -index b0d26b0eadb2a43924629424a6c13198aace8f69..e7cc8105fff9cb952eabfd006e0a4e4638091019 100644 +index b0d26b0eadb2a43924629424a6c13198aace8f69..9f5c3ec2eae9b30bdb8dbcb328d7f701cb7aeb9d 100644 --- a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java +++ b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java -@@ -42,7 +42,7 @@ public class BuildContexts> { - ChainModifiers chainModifiers = flags; - List list = sources; - if (contextChain.getStage() != Stage.EXECUTE) { -- context.profiler().push(() -> "prepare " + this.commandInput); -+ //context.profiler().push(() -> "prepare " + this.commandInput); // Purpur - - try { - for (int i = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) { @@ -52,7 +52,7 @@ public class BuildContexts> { } @@ -777,14 +1670,7 @@ index b0d26b0eadb2a43924629424a6c13198aace8f69..e7cc8105fff9cb952eabfd006e0a4e46 customModifierExecutor.apply(baseSource, list, contextChain, chainModifiers, ExecutionControl.create(context, frame)); return; } -@@ -86,17 +86,17 @@ public class BuildContexts> { - } - } - } finally { -- context.profiler().pop(); -+ //context.profiler().pop(); // Purpur - } - } +@@ -92,11 +92,11 @@ public class BuildContexts> { if (list.isEmpty()) { if (chainModifiers.isReturn()) { @@ -798,28 +1684,6 @@ index b0d26b0eadb2a43924629424a6c13198aace8f69..e7cc8105fff9cb952eabfd006e0a4e46 ExecutionControl executionControl = ExecutionControl.create(context, frame); for (T executionCommandSource2 : list) { -diff --git a/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java b/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java -index e9775b4506909bee65a74964f0d5391a0513de1d..684f7f202305c09b1037c5d38a52a5ea7f00751b 100644 ---- a/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java -+++ b/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java -@@ -23,7 +23,7 @@ public class ExecuteCommand> implements Unbo - - @Override - public void execute(T executionCommandSource, ExecutionContext executionContext, Frame frame) { -- executionContext.profiler().push(() -> "execute " + this.commandInput); -+ //executionContext.profiler().push(() -> "execute " + this.commandInput); // Purpur - - try { - executionContext.incrementCost(); -@@ -37,7 +37,7 @@ public class ExecuteCommand> implements Unbo - } catch (CommandSyntaxException var9) { - executionCommandSource.handleError(var9, this.modifiers.isForked(), executionContext.tracer()); - } finally { -- executionContext.profiler().pop(); -+ //executionContext.profiler().pop(); // Purpur - } - } - } diff --git a/src/main/java/net/minecraft/commands/synchronization/ArgumentTypeInfos.java b/src/main/java/net/minecraft/commands/synchronization/ArgumentTypeInfos.java index 7b118a92a6eb779f800ae8f5d8f6e3c861fc4f6a..057a038e8dcacd7496a0b2373de2c20255a5c297 100644 --- a/src/main/java/net/minecraft/commands/synchronization/ArgumentTypeInfos.java @@ -935,7 +1799,7 @@ index 300929a406905f5ff1ede664d5b99fb0938d4d2e..a4e9ac0e07f08e0b6aa682e8c1587d9c throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.OUT_OF_ORDER_CHAT, org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes } else { diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 90ca25c4aaf92a5639839a7cdaee2ffcdb75efa7..f0d762bd140fad27ae73bcf3e61b640b9e3f2592 100644 +index 90ca25c4aaf92a5639839a7cdaee2ffcdb75efa7..ecaec3c7b5768771b00c4c33d48a76ba22653a79 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java @@ -120,6 +120,12 @@ public class Main { @@ -944,7 +1808,7 @@ index 90ca25c4aaf92a5639839a7cdaee2ffcdb75efa7..f0d762bd140fad27ae73bcf3e61b640b + // Purpur start - load config files early + org.bukkit.configuration.file.YamlConfiguration purpurConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("purpur-settings")); -+ org.purpurmc.purpur.PurpurConfig.clampEnchantLevels = purpurConfiguration.getBoolean("settings.enchantment.clamp-levels"); ++ org.purpurmc.purpur.PurpurConfig.clampEnchantLevels = purpurConfiguration.getBoolean("settings.enchantment.clamp-levels", true); + org.purpurmc.purpur.PurpurConfig.registerMinecraftDebugCommands = purpurConfiguration.getBoolean("settings.register-minecraft-debug-commands"); + // Purpur end - load config files early + @@ -952,7 +1816,7 @@ index 90ca25c4aaf92a5639839a7cdaee2ffcdb75efa7..f0d762bd140fad27ae73bcf3e61b640b Bootstrap.bootStrap(); Bootstrap.validate(); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 64b56abf8900d0424100da460fc68ac964394793..fa1c48a1f861b06e970bdc3499c14f19eea04772 100644 +index 4158473fd553a16fec23bcbcf9a278d413120600..23505b0f80d643d9ef569b49192f44e0373dfb5f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -314,6 +314,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; // Paper - don't store the vanilla dispatcher -@@ -324,10 +325,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { -+ //this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; // Purpur -+ /*this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur - this.stopRecordingMetrics(); -- }; -- this.onMetricsRecordingFinished = (path) -> { -- }; -+ };*/ // Purpur -+ //this.onMetricsRecordingFinished = (path) -> { // Purpur -+ //}; // Purpur - this.random = RandomSource.create(); - this.port = -1; - this.levels = Maps.newLinkedHashMap(); -@@ -1046,15 +1049,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping ++ public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("MobSpawning"); // Pufferfish - optimize mob spawning + + public static S spin(Function serverFactory) { + AtomicReference atomicreference = new AtomicReference(); +@@ -1054,6 +1058,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { - return false; -@@ -1336,9 +1375,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper - Add EntityMoveEvent net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers worldserver.updateLagCompensationTick(); // Paper - lag compensation + worldserver.hasRidableMoveEvent = org.purpurmc.purpur.event.entity.RidableMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur -- gameprofilerfiller.push(() -> { -+ /*gameprofilerfiller.push(() -> { // Purpur + gameprofilerfiller.push(() -> { String s = String.valueOf(worldserver); - - return s + " " + String.valueOf(worldserver.dimension().location()); -- }); -+ });*/ // Purpur - /* Drop global time updates - if (this.tickCount % 20 == 0) { -- gameprofilerfiller.push("timeSync"); -+ //gameprofilerfiller.push("timeSync"); // Purpur - this.synchronizeTime(worldserver); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } - // CraftBukkit end */ - -- gameprofilerfiller.push("tick"); -+ //gameprofilerfiller.push("tick"); // Purpur - - try { - worldserver.tick(shouldKeepTicking); -@@ -1878,27 +1922,27 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { this.executeBlocking(() -> { - this.saveDebugReport(path.resolve("server")); -@@ -2894,37 +2938,38 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop resultConsumer, Consumer dumpConsumer) { -- this.onMetricsRecordingStopped = (methodprofilerresults) -> { -+ /*this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur - this.stopRecordingMetrics(); - resultConsumer.accept(methodprofilerresults); - }; - this.onMetricsRecordingFinished = dumpConsumer; -- this.willStartRecordingMetrics = true; -+ this.willStartRecordingMetrics = true;*/ // Purpur - } - - public void stopRecordingMetrics() { -- this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; -+ //this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; // Purpur - } - - public void finishRecordingMetrics() { -- this.metricsRecorder.end(); -+ //this.metricsRecorder.end(); // Purpur - } - - public void cancelRecordingMetrics() { -- this.metricsRecorder.cancel(); -+ //this.metricsRecorder.cancel(); // Purpur - } - - public Path getWorldPath(LevelResource worldSavePath) { -@@ -2977,15 +3022,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> functions, ResourceLocation label) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - - Objects.requireNonNull(label); -- gameprofilerfiller.push(label::toString); -+ //gameprofilerfiller.push(label::toString); // Purpur - Iterator iterator = functions.iterator(); - - while (iterator.hasNext()) { -@@ -66,15 +66,15 @@ public class ServerFunctionManager { - this.execute(commandfunction, this.getGameLoopSender()); - } - -- Profiler.get().pop(); -+ //Profiler.get().pop(); // Purpur - } - - public void execute(CommandFunction function, CommandSourceStack source) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push(() -> { -+ /*gameprofilerfiller.push(() -> { // Purpur - return "function " + String.valueOf(function.id()); -- }); -+ });*/ // Purpur - - try { - InstantiatedFunction instantiatedfunction = function.instantiate((CompoundTag) null, this.getDispatcher()); -@@ -87,7 +87,7 @@ public class ServerFunctionManager { - } catch (Exception exception) { - ServerFunctionManager.LOGGER.warn("Failed to execute function {}", function.id(), exception); - } finally { -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } - - } diff --git a/src/main/java/net/minecraft/server/commands/EnchantCommand.java b/src/main/java/net/minecraft/server/commands/EnchantCommand.java index cf0a5943f457c532958f40b4989fa18f967abae6..2ab8ff8ca51eb841932ccca4a348acc0141264a8 100644 --- a/src/main/java/net/minecraft/server/commands/EnchantCommand.java @@ -1518,47 +2053,8 @@ index 0d9de4c61c7b26a6ff37c12fde629161fd0c3d5a..2f7897744f4aea718170698881773e90 if (flag && itemstack1.isEmpty()) { entityitem = entityplayer.drop(itemstack, false, false, false); // CraftBukkit - SPIGOT-2942: Add boolean to call event if (entityitem != null) { -diff --git a/src/main/java/net/minecraft/server/commands/PerfCommand.java b/src/main/java/net/minecraft/server/commands/PerfCommand.java -index 8c587f829c5e8c6b6df3150024c4ae704988c47b..8ac4d5dbe7f8febf4226f26a6b035282dcdf1b0f 100644 ---- a/src/main/java/net/minecraft/server/commands/PerfCommand.java -+++ b/src/main/java/net/minecraft/server/commands/PerfCommand.java -@@ -42,6 +42,7 @@ public class PerfCommand { - } - - private static int startProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException { -+ if (true) return removedMessage(source); // Purpur - MinecraftServer minecraftServer = source.getServer(); - if (minecraftServer.isRecordingMetrics()) { - throw ERROR_ALREADY_RUNNING.create(); -@@ -55,6 +56,7 @@ public class PerfCommand { - } - - private static int stopProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException { -+ if (true) return removedMessage(source); // Purpur - MinecraftServer minecraftServer = source.getServer(); - if (!minecraftServer.isRecordingMetrics()) { - throw ERROR_NOT_RUNNING.create(); -@@ -64,6 +66,18 @@ public class PerfCommand { - } - } - -+ // Purpur start -+ private static int removedMessage(CommandSourceStack source) { -+ if (true) { -+ net.kyori.adventure.text.minimessage.MiniMessage mm = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage(); -+ source.getSender().sendMessage(mm.deserialize("Purpur has removed Mojang's Profiler to save your performance. Please use /spark instead")); -+ source.getSender().sendMessage(mm.deserialize("For more information, view its documentation at")); -+ source.getSender().sendMessage(mm.deserialize("https://spark.lucko.me/docs/Command-Usage")); -+ } -+ return 0; -+ } -+ // Purpur end -+ - private static void saveResults(CommandSourceStack source, Path tempProfilingDirectory, MinecraftServer server) { - String string = String.format( - Locale.ROOT, "%s-%s-%s", Util.getFilenameFormattedDateTime(), server.getWorldData().getLevelName(), SharedConstants.getCurrentVersion().getId() diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 17a158ff6ce6520b69a5a0032ba4c05449dd0cf8..e9ad8e2ac267c46df80e884308df8bb12d0deeff 100644 +index 17a158ff6ce6520b69a5a0032ba4c05449dd0cf8..7a442fb4cf78bcb1268359ee41a6de138edb76b6 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -111,6 +111,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -1585,7 +2081,17 @@ index 17a158ff6ce6520b69a5a0032ba4c05449dd0cf8..e9ad8e2ac267c46df80e884308df8bb1 // Paper start - initialize global and world-defaults configuration this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess()); this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); -@@ -283,6 +293,30 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -236,6 +246,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark + com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics + com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now ++ gg.pufferfish.pufferfish.PufferfishConfig.pufferfishFile = (java.io.File) options.valueOf("pufferfish-settings"); // Purpur ++ gg.pufferfish.pufferfish.PufferfishConfig.load(); // Pufferfish ++ gg.pufferfish.pufferfish.PufferfishCommand.init(); // Pufferfish + + this.setPvpAllowed(dedicatedserverproperties.pvp); + this.setFlightAllowed(dedicatedserverproperties.allowFlight); +@@ -283,6 +296,30 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface if (true) throw new IllegalStateException("Failed to bind to port", ioexception); // Paper - Propagate failed to bind to port error return false; } @@ -1616,10 +2122,11 @@ index 17a158ff6ce6520b69a5a0032ba4c05449dd0cf8..e9ad8e2ac267c46df80e884308df8bb1 // CraftBukkit start // this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage)); // Spigot - moved up -@@ -356,6 +390,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -356,6 +393,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface DedicatedServer.LOGGER.info("JMX monitoring enabled"); } ++ if (gg.pufferfish.pufferfish.PufferfishConfig.enableAsyncMobSpawning) mobSpawnExecutor.start(); // Pufferfish + org.purpurmc.purpur.task.BossBarTask.startAll(); // Purpur + if (org.purpurmc.purpur.PurpurConfig.beeCountPayload) org.purpurmc.purpur.task.BeehiveTask.instance().register(); // Purpur return true; @@ -1787,175 +2294,115 @@ index 096c89bd01cec2abd151bf6fffc4847d1bcd548f..cd0a8a6a1be75cab8bbb8ee3ac17bb73 // Paper end - Improve ServerGUI this.values[this.vp++ & 0xFF] = (int)(l * 100L / Runtime.getRuntime().maxMemory()); this.repaint(); -diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..e16f22dd82b4315da34af3c9a189d9d5fec0fd2f 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkMap.java -+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -406,16 +406,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - } - - protected void tick(BooleanSupplier shouldKeepTicking) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("poi"); -+ //gameprofilerfiller.push("poi"); // Purpur - this.poiManager.tick(shouldKeepTicking); -- gameprofilerfiller.popPush("chunk_unload"); -+ //gameprofilerfiller.popPush("chunk_unload"); // Purpur - if (!this.level.noSave()) { - this.processUnloads(shouldKeepTicking); - } - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } - - public boolean hasWork() { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index aaaadb7be8abf867624a1ca83371595bef4ab633..b61d94d84702bbc2b30b7fa7e2b536c0b83dd758 100644 +index d021cd5b6136f0125076513977f430c6d4dd4f9f..1cb8c9d21eef27492efc4995525c198cbffd4b9b 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -439,38 +439,38 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - // CraftBukkit start - modelled on below - public void purgeUnload() { - if (true) return; // Paper - rewrite chunk system -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur +@@ -176,6 +176,9 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + // Paper end - chunk tick iteration optimisations -- gameprofilerfiller.push("purge"); -+ //gameprofilerfiller.push("purge"); // Purpur - this.distanceManager.purgeStaleTickets(); - this.runDistanceManagerUpdates(); -- gameprofilerfiller.popPush("unload"); -+ //gameprofilerfiller.popPush("unload"); // Purpur - this.chunkMap.tick(() -> true); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - this.clearCache(); - } - // CraftBukkit end - @Override - public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("purge"); -+ //gameprofilerfiller.push("purge"); // Purpur - if (this.level.tickRateManager().runsNormally() || !tickChunks || this.level.spigotConfig.unloadFrozenChunks) { // Spigot - this.distanceManager.purgeStaleTickets(); ++ public boolean firstRunSpawnCounts = true; // Pufferfish ++ public final java.util.concurrent.atomic.AtomicBoolean _pufferfish_spawnCountsReady = new java.util.concurrent.atomic.AtomicBoolean(false); // Pufferfish - optimize countmobs ++ + public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, int simulationDistance, boolean dsync, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory) { + this.level = world; + this.mainThreadProcessor = new ServerChunkCache.MainThreadExecutor(world); +@@ -504,6 +507,43 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + this.broadcastChangedChunks(gameprofilerfiller); + gameprofilerfiller.pop(); } - - this.runDistanceManagerUpdates(); -- gameprofilerfiller.popPush("chunks"); -+ //gameprofilerfiller.popPush("chunks"); // Purpur - if (tickChunks) { - ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getPlayerChunkLoader().tick(); // Paper - rewrite chunk system - this.tickChunks(); - this.chunkMap.tick(); - } - -- gameprofilerfiller.popPush("unload"); -+ //gameprofilerfiller.popPush("unload"); // Purpur - this.chunkMap.tick(shouldKeepTicking); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - this.clearCache(); ++ ++ // Pufferfish start - optimize mob spawning ++ if (gg.pufferfish.pufferfish.PufferfishConfig.enableAsyncMobSpawning) { ++ for (ServerPlayer player : this.level.players) { ++ // Paper start - per player mob spawning backoff ++ for (int ii = 0; ii < ServerPlayer.MOBCATEGORY_TOTAL_ENUMS; ii++) { ++ player.mobCounts[ii] = 0; ++ ++ int newBackoff = player.mobBackoffCounts[ii] - 1; // TODO make configurable bleed // TODO use nonlinear algorithm? ++ if (newBackoff < 0) { ++ newBackoff = 0; ++ } ++ player.mobBackoffCounts[ii] = newBackoff; ++ } ++ // Paper end - per player mob spawning backoff ++ } ++ if (firstRunSpawnCounts) { ++ firstRunSpawnCounts = false; ++ _pufferfish_spawnCountsReady.set(true); ++ } ++ if (_pufferfish_spawnCountsReady.getAndSet(false)) { ++ net.minecraft.server.MinecraftServer.getServer().mobSpawnExecutor.submit(() -> { ++ int mapped = distanceManager.getNaturalSpawnChunkCount(); ++ ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet.Iterator objectiterator = ++ level.entityTickList.entities.iterator(ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet.ITERATOR_FLAG_SEE_ADDITIONS); ++ try { ++ gg.pufferfish.pufferfish.util.IterableWrapper wrappedIterator = ++ new gg.pufferfish.pufferfish.util.IterableWrapper<>(objectiterator); ++ lastSpawnState = NaturalSpawner.createState(mapped, wrappedIterator, this::getFullChunk, null, true); ++ } finally { ++ objectiterator.finishedIterating(); ++ } ++ _pufferfish_spawnCountsReady.set(true); ++ }); ++ } ++ } ++ // Pufferfish end } -@@ -480,34 +480,34 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - - this.lastInhabitedUpdate = i; - if (!this.level.isDebug()) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("pollingChunks"); -+ //gameprofilerfiller.push("pollingChunks"); // Purpur - if (this.level.tickRateManager().runsNormally()) { - List list = this.tickingChunks; - - try { -- gameprofilerfiller.push("filteringTickingChunks"); -+ //gameprofilerfiller.push("filteringTickingChunks"); // Purpur - this.collectTickingChunks(list); -- gameprofilerfiller.popPush("shuffleChunks"); -+ //gameprofilerfiller.popPush("shuffleChunks"); // Purpur - // Paper start - chunk tick iteration optimisation - this.shuffleRandom.setSeed(this.level.random.nextLong()); - if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled - // Paper end - chunk tick iteration optimisation -- this.tickChunks(gameprofilerfiller, j, list); -- gameprofilerfiller.pop(); -+ this.tickChunks(null, j, list); // Purpur -+ //gameprofilerfiller.pop(); // Purpur - } finally { - list.clear(); - } - } - -- this.broadcastChangedChunks(gameprofilerfiller); -- gameprofilerfiller.pop(); -+ this.broadcastChangedChunks(null); // Purpur -+ //gameprofilerfiller.pop(); // Purpur - } - } - -- private void broadcastChangedChunks(ProfilerFiller profiler) { -- profiler.push("broadcast"); -+ private void broadcastChangedChunks(ProfilerFiller profiler) { // Purpur -+ //profiler.push("broadcast"); // Purpur - Iterator iterator = this.chunkHoldersToBroadcast.iterator(); - - while (iterator.hasNext()) { -@@ -520,7 +520,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - } - - this.chunkHoldersToBroadcast.clear(); -- profiler.pop(); -+ //profiler.pop(); // Purpur - } - - private void collectTickingChunks(List chunks) { -@@ -547,7 +547,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - } - - private void tickChunks(ProfilerFiller profiler, long timeDelta, List chunks) { -- profiler.popPush("naturalSpawnCount"); -+ //profiler.popPush("naturalSpawnCount"); // Purpur - int j = this.distanceManager.getNaturalSpawnChunkCount(); - // Paper start - Optional per player mob spawns + private void broadcastChangedChunks(ProfilerFiller profiler) { +@@ -553,6 +593,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon final int naturalSpawnChunkCount = j; -@@ -574,7 +574,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + NaturalSpawner.SpawnState spawnercreature_d; // moved down + if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled ++ if (!gg.pufferfish.pufferfish.PufferfishConfig.enableAsyncMobSpawning) { // Pufferfish - moved down when async processing + // re-set mob counts + for (ServerPlayer player : this.level.players) { + // Paper start - per player mob spawning backoff +@@ -567,13 +608,17 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + } + // Paper end - per player mob spawning backoff + } +- spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, null, true); ++ lastSpawnState = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, null, true); // Pufferfish - async mob spawning ++ } // Pufferfish - (endif) moved down when async processing + } else { +- spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false); ++ // Pufferfish start - async mob spawning ++ lastSpawnState = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false); ++ _pufferfish_spawnCountsReady.set(true); ++ // Pufferfish end + } // Paper end - Optional per player mob spawns - this.lastSpawnState = spawnercreature_d; -- profiler.popPush("spawnAndTick"); -+ //profiler.popPush("spawnAndTick"); // Purpur +- this.lastSpawnState = spawnercreature_d; ++ // this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously + profiler.popPush("spawnAndTick"); boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); - List list1; -@@ -612,7 +612,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -590,7 +635,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + // Paper end - PlayerNaturallySpawnCreaturesEvent + boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit + +- list1 = NaturalSpawner.getFilteredSpawningCategories(spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1, this.level); // CraftBukkit ++ list1 = NaturalSpawner.getFilteredSpawningCategories(lastSpawnState, this.spawnFriendlies, this.spawnEnemies, flag1, this.level); // CraftBukkit // Pufferfish + } else { + list1 = List.of(); + } +@@ -602,8 +647,8 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + ChunkPos chunkcoordintpair = chunk.getPos(); + + chunk.incrementInhabitedTime(timeDelta); +- if (!list1.isEmpty() && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair, true)) { // Spigot +- NaturalSpawner.spawnForChunk(this.level, chunk, spawnercreature_d, list1); ++ if (!list1.isEmpty() && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && (!gg.pufferfish.pufferfish.PufferfishConfig.enableAsyncMobSpawning || _pufferfish_spawnCountsReady.get()) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair, true)) { // Spigot // Pufferfish ++ NaturalSpawner.spawnForChunk(this.level, chunk, lastSpawnState, list1); // Pufferfish } - } - -- profiler.popPush("customSpawners"); -+ //profiler.popPush("customSpawners"); // Purpur - if (flag) { - this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); - } -@@ -810,7 +810,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - - @Override - protected void doRunTask(Runnable task) { -- Profiler.get().incrementCounter("runTask"); -+ //Profiler.get().incrementCounter("runTask"); // Purpur - super.doRunTask(task); - } + if (true) { // Paper - rewrite chunk system diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 90eb4927fa51ce3df86aa7b6c71f49150a03e337..d8717af85f539da807ddf866e17f1e643c83d3f6 100644 +index 90eb4927fa51ce3df86aa7b6c71f49150a03e337..c14ce846afb7364e541bfe01b73a06a94e48f55b 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -81,7 +81,7 @@ public class ServerEntity { @@ -1967,8 +2414,24 @@ index 90eb4927fa51ce3df86aa7b6c71f49150a03e337..d8717af85f539da807ddf866e17f1e64 public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer> consumer, Set trackedPlayers) { this.trackedPlayers = trackedPlayers; +@@ -207,6 +207,7 @@ public class ServerEntity { + boolean flag5 = i < -32768L || i > 32767L || j < -32768L || j > 32767L || k < -32768L || k > 32767L; + + if (!this.forceStateResync && !flag5 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.onGround()) { // Paper - fix desync when a player is added to the tracker ++ if (flag2 || flag3 || this.entity instanceof AbstractArrow) { // Pufferfish + if ((!flag2 || !flag) && !(this.entity instanceof AbstractArrow)) { + if (flag2) { + packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) i), (short) ((int) j), (short) ((int) k), this.entity.onGround()); +@@ -220,6 +221,7 @@ public class ServerEntity { + flag3 = true; + flag4 = true; + } ++ } // Pufferfish + } else { + this.wasOnGround = this.entity.onGround(); + this.teleportDelay = 0; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 3b6b6483bf855493948417f44f06427b625bc910..10d00d1d63d078d9462eca209420995de5f80eb8 100644 +index 585e2b43a0326f0b81597fa1234d3c67c76af550..6a359f1ed07aa7b9c78e470fb00661ea03eaec03 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -223,6 +223,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -1980,15 +2443,15 @@ index 3b6b6483bf855493948417f44f06427b625bc910..10d00d1d63d078d9462eca209420995d private final RandomSequences randomSequences; // CraftBukkit start -@@ -230,6 +232,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - public final UUID uuid; +@@ -231,6 +233,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent + private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current) + public boolean hasRidableMoveEvent = false; // Purpur public LevelChunk getChunkIfLoaded(int x, int z) { return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately -@@ -597,7 +600,24 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -604,7 +607,24 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // CraftBukkit end this.tickTime = flag1; this.server = minecraftserver; @@ -2014,7 +2477,7 @@ index 3b6b6483bf855493948417f44f06427b625bc910..10d00d1d63d078d9462eca209420995d this.serverLevelData = iworlddataserver; ChunkGenerator chunkgenerator = worlddimension.generator(); // CraftBukkit start -@@ -669,6 +689,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -676,6 +696,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler); // Paper end - rewrite chunk system this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit @@ -2022,28 +2485,7 @@ index 3b6b6483bf855493948417f44f06427b625bc910..10d00d1d63d078d9462eca209420995d } // Paper start -@@ -703,24 +724,24 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - } - - public void tick(BooleanSupplier shouldKeepTicking) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - - this.handlingTick = true; - TickRateManager tickratemanager = this.tickRateManager(); - boolean flag = tickratemanager.runsNormally(); - - if (flag) { -- gameprofilerfiller.push("world border"); -+ //gameprofilerfiller.push("world border"); // Purpur - this.getWorldBorder().tick(); -- gameprofilerfiller.popPush("weather"); -+ //gameprofilerfiller.popPush("weather"); // Purpur - this.advanceWeatherCycle(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } - +@@ -727,7 +748,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); long j; @@ -2052,98 +2494,37 @@ index 3b6b6483bf855493948417f44f06427b625bc910..10d00d1d63d078d9462eca209420995d // CraftBukkit start j = this.levelData.getDayTime() + 24000L; TimeSkipEvent event = new TimeSkipEvent(this.getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (j - j % 24000L) - this.getDayTime()); -@@ -745,30 +766,30 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - this.tickTime(); - } - -- gameprofilerfiller.push("tickPending"); -+ //gameprofilerfiller.push("tickPending"); // Purpur - if (!this.isDebug() && flag) { - j = this.getGameTime(); -- gameprofilerfiller.push("blockTicks"); -+ //gameprofilerfiller.push("blockTicks"); // Purpur - this.blockTicks.tick(j, paperConfig().environment.maxBlockTicks, this::tickBlock); // Paper - configurable max block ticks -- gameprofilerfiller.popPush("fluidTicks"); -+ //gameprofilerfiller.popPush("fluidTicks"); // Purpur - this.fluidTicks.tick(j, paperConfig().environment.maxFluidTicks, this::tickFluid); // Paper - configurable max fluid ticks -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } - -- gameprofilerfiller.popPush("raid"); -+ //gameprofilerfiller.popPush("raid"); // Purpur - if (flag) { - this.raids.tick(); - } - -- gameprofilerfiller.popPush("chunkSource"); -+ //gameprofilerfiller.popPush("chunkSource"); // Purpur - this.getChunkSource().tick(shouldKeepTicking, true); -- gameprofilerfiller.popPush("blockEvents"); -+ //gameprofilerfiller.popPush("blockEvents"); // Purpur - if (flag) { - this.runBlockEvents(); - } - - this.handlingTick = false; -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - boolean flag1 = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this - - if (flag1) { -@@ -776,20 +797,20 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - } - - if (flag1 || this.emptyTime++ < 300) { -- gameprofilerfiller.push("entities"); -+ //gameprofilerfiller.push("entities"); // Purpur - if (this.dragonFight != null && flag) { -- gameprofilerfiller.push("dragonFight"); -+ //gameprofilerfiller.push("dragonFight"); // Purpur - this.dragonFight.tick(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } +@@ -792,6 +813,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe org.spigotmc.ActivationRange.activateEntities(this); // Spigot this.entityTickList.forEach((entity) -> { ++ entity.activatedPriorityReset = false; // Pufferfish - DAB if (!entity.isRemoved()) { if (!tickratemanager.isEntityFrozen(entity)) { -- gameprofilerfiller.push("checkDespawn"); -+ //gameprofilerfiller.push("checkDespawn"); // Purpur - entity.checkDespawn(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - if (true) { // Paper - rewrite chunk system - Entity entity1 = entity.getVehicle(); - -@@ -801,20 +822,20 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - entity.stopRiding(); + gameprofilerfiller.push("checkDespawn"); +@@ -809,7 +831,20 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } -- gameprofilerfiller.push("tick"); -+ //gameprofilerfiller.push("tick"); // Purpur - this.guardEntityTick(this::tickNonPassenger, entity); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur + gameprofilerfiller.push("tick"); +- this.guardEntityTick(this::tickNonPassenger, entity); ++ // Pufferfish start - copied from this.guardEntityTick ++ try { ++ this.tickNonPassenger(entity); // Pufferfish - changed ++ } catch (Throwable throwable) { ++ if (throwable instanceof ThreadDeath) throw throwable; // Paper ++ // Paper start - Prevent tile entity and entity crashes ++ final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); ++ MinecraftServer.LOGGER.error(msg, throwable); ++ getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); ++ entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); ++ // Paper end ++ } ++ this.moonrise$midTickTasks(); // Paper - rewrite chunk system ++ // Pufferfish end + gameprofilerfiller.pop(); } } - } - }); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - this.tickBlockEntities(); - } - -- gameprofilerfiller.push("entityManagement"); -+ //gameprofilerfiller.push("entityManagement"); // Purpur - // Paper - rewrite chunk system -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } - - @Override -@@ -834,6 +855,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -841,6 +876,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.serverLevelData.getScheduledEvents().tick(this.server, i); Profiler.get().pop(); if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { @@ -2157,7 +2538,7 @@ index 3b6b6483bf855493948417f44f06427b625bc910..10d00d1d63d078d9462eca209420995d this.setDayTime(this.levelData.getDayTime() + 1L); } -@@ -842,7 +870,21 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -849,8 +891,22 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public void setDayTime(long timeOfDay) { this.serverLevelData.setDayTime(timeOfDay); @@ -2169,29 +2550,27 @@ index 3b6b6483bf855493948417f44f06427b625bc910..10d00d1d63d078d9462eca209420995d + this.serverLevelData.setDayTime((long) i); + this.forceTime = true; + // Purpur end -+ } -+ + } + + // Purpur start + public boolean isForceTime() { + return this.forceTime; - } ++ } + // Purpur end - ++ public void tickCustomSpawners(boolean spawnMonsters, boolean spawnAnimals) { Iterator iterator = this.customSpawners.iterator(); -@@ -920,9 +962,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - boolean flag = this.isRaining(); - int j = chunkcoordintpair.getMinBlockX(); - int k = chunkcoordintpair.getMinBlockZ(); -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur -- gameprofilerfiller.push("thunder"); -+ //gameprofilerfiller.push("thunder"); // Purpur - if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && simpleRandom.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder // Paper - optimise random ticking +@@ -930,7 +986,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + ProfilerFiller gameprofilerfiller = Profiler.get(); + + gameprofilerfiller.push("thunder"); +- if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && simpleRandom.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder // Paper - optimise random ticking ++ if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && /*simpleRandom.nextInt(this.spigotConfig.thunderChance) == 0*/ chunk.shouldDoLightning(this.simpleRandom)) { // Spigot // Paper - Option to disable thunder // Paper - optimise random ticking // Pufferfish - replace random with shouldDoLightning BlockPos blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15)); -@@ -931,10 +973,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + if (this.isRainingAt(blockposition)) { +@@ -938,10 +994,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper - Configurable spawn chances for skeleton horses if (flag1) { @@ -2212,31 +2591,7 @@ index 3b6b6483bf855493948417f44f06427b625bc910..10d00d1d63d078d9462eca209420995d entityhorseskeleton.setAge(0); entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()); this.addFreshEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit -@@ -951,7 +1001,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - } - } - -- gameprofilerfiller.popPush("iceandsnow"); -+ //gameprofilerfiller.popPush("iceandsnow"); // Purpur - - if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow - for (int l = 0; l < randomTickSpeed; ++l) { -@@ -961,12 +1011,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - } - } // Paper - Option to disable ice and snow - -- gameprofilerfiller.popPush("tickBlocks"); -+ //gameprofilerfiller.popPush("tickBlocks"); // Purpur - if (randomTickSpeed > 0) { - this.optimiseRandomTick(chunk, randomTickSpeed); // Paper - optimise random ticking - } - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } - - @VisibleForTesting -@@ -1015,7 +1065,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1022,7 +1086,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe return holder.is(PoiTypes.LIGHTNING_ROD); }, (blockposition1) -> { return blockposition1.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, blockposition1.getX(), blockposition1.getZ()) - 1; @@ -2245,7 +2600,7 @@ index 3b6b6483bf855493948417f44f06427b625bc910..10d00d1d63d078d9462eca209420995d return optional.map((blockposition1) -> { return blockposition1.above(1); -@@ -1064,11 +1114,27 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1071,11 +1135,27 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (this.canSleepThroughNights()) { if (!this.getServer().isSingleplayer() || this.getServer().isPublished()) { int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); @@ -2274,7 +2629,7 @@ index 3b6b6483bf855493948417f44f06427b625bc910..10d00d1d63d078d9462eca209420995d ichatmutablecomponent = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(i)); } -@@ -1208,6 +1274,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1215,6 +1295,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @VisibleForTesting public void resetWeatherCycle() { // CraftBukkit start @@ -2282,7 +2637,7 @@ index 3b6b6483bf855493948417f44f06427b625bc910..10d00d1d63d078d9462eca209420995d this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents // If we stop due to everyone sleeping we should reset the weather duration to some other random value. // Not that everyone ever manages to get the whole server to sleep at the same time.... -@@ -1215,6 +1282,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1222,6 +1303,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.serverLevelData.setRainTime(0); } // CraftBukkit end @@ -2290,58 +2645,7 @@ index 3b6b6483bf855493948417f44f06427b625bc910..10d00d1d63d078d9462eca209420995d this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents // CraftBukkit start // If we stop due to everyone sleeping we should reset the weather duration to some other random value. -@@ -1286,19 +1354,19 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - }*/ // Paper - comment out EAR 2 - // Spigot end - entity.setOldPosAndRot(); -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - - ++entity.tickCount; -- gameprofilerfiller.push(() -> { -+ /*gameprofilerfiller.push(() -> { // Purpur - return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); -- }); -- gameprofilerfiller.incrementCounter("tickNonPassenger"); -+ });*/ // Purpur -+ //gameprofilerfiller.incrementCounter("tickNonPassenger"); // Purpur - final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity); // Paper - EAR 2 - if (isActive) { // Paper - EAR 2 - entity.tick(); - entity.postTick(); // CraftBukkit - } else { entity.inactiveTick(); } // Paper - EAR 2 -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - Iterator iterator = entity.getPassengers().iterator(); - - while (iterator.hasNext()) { -@@ -1321,12 +1389,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - if (passenger instanceof Player || this.entityTickList.contains(passenger)) { - passenger.setOldPosAndRot(); - ++passenger.tickCount; -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push(() -> { -+ /*gameprofilerfiller.push(() -> { // Purpur - return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString(); -- }); -- gameprofilerfiller.incrementCounter("tickPassenger"); -+ });*/ // Purpur -+ //gameprofilerfiller.incrementCounter("tickPassenger"); // Purpur - // Paper start - EAR 2 - if (isActive) { - passenger.rideTick(); -@@ -1338,7 +1406,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - vehicle.positionRider(passenger); - } - // Paper end - EAR 2 -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - Iterator iterator = passenger.getPassengers().iterator(); - - while (iterator.hasNext()) { -@@ -2740,7 +2808,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2762,7 +2844,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // Spigot Start if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message // Paper start - Fix merchant inventory not closing on entity removal @@ -2351,7 +2655,7 @@ index 3b6b6483bf855493948417f44f06427b625bc910..10d00d1d63d078d9462eca209420995d } // Paper end - Fix merchant inventory not closing on entity removal diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index cffbd3300967e5d80b5973b35a76235bb2aa1b73..17f5640ab2b6880895b3b96ae06db8b0e3c03a02 100644 +index 5a8f396d47577f087abb415c972fd4f51e50faba..e6001fadc04b63b82e20652bbb16cb1db5cf44bd 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -329,6 +329,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple @@ -2426,27 +2730,7 @@ index cffbd3300967e5d80b5973b35a76235bb2aa1b73..17f5640ab2b6880895b3b96ae06db8b0 boolean flag = this.server.isDedicatedServer() && this.isPvpAllowed() && source.is(DamageTypeTags.IS_FALL); if (!flag && this.spawnInvulnerableTime > 0 && !source.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { -@@ -1643,15 +1673,15 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple - this.unsetRemoved(); - */ - // CraftBukkit end -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("moving"); -+ //gameprofilerfiller.push("moving"); // Purpur - if (worldserver != null && resourcekey == LevelStem.OVERWORLD && worldserver.getTypeKey() == LevelStem.NETHER) { // CraftBukkit - empty to fall through to null to event - this.enteredNetherPosition = this.position(); - } - -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("placing"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("placing"); // Purpur - // CraftBukkit start - this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds - LevelData worlddata = worldserver.getLevelData(); -@@ -1664,11 +1694,12 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -1664,6 +1694,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); this.unsetRemoved(); // CraftBukkit end @@ -2454,12 +2738,6 @@ index cffbd3300967e5d80b5973b35a76235bb2aa1b73..17f5640ab2b6880895b3b96ae06db8b0 this.setServerLevel(worldserver); this.connection.internalTeleport(PositionMoveRotation.of(teleportTarget), teleportTarget.relatives()); // CraftBukkit - use internal teleport without event this.connection.resetPosition(); - worldserver.addDuringTeleport(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - this.triggerDimensionChangeTriggers(worldserver1); - this.stopUsingItem(); - this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities())); @@ -1774,7 +1805,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple return entitymonster.isPreventingPlayerRest(this.serverLevel(), this); }); @@ -2546,7 +2824,7 @@ index cffbd3300967e5d80b5973b35a76235bb2aa1b73..17f5640ab2b6880895b3b96ae06db8b0 public void sendSystemMessage(Component message) { this.sendSystemMessage(message, false); } -@@ -2600,8 +2678,68 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -2597,8 +2675,68 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple public void resetLastActionTime() { this.lastActionTime = Util.getMillis(); @@ -2615,7 +2893,7 @@ index cffbd3300967e5d80b5973b35a76235bb2aa1b73..17f5640ab2b6880895b3b96ae06db8b0 public ServerStatsCounter getStats() { return this.stats; } -@@ -3308,4 +3446,50 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -3305,4 +3443,50 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple return (CraftPlayer) super.getBukkitEntity(); } // CraftBukkit end @@ -2727,7 +3005,7 @@ index e4b0dc3121101d54394a0c3a413dabf8103b2ea6..a8484b9659f175cc20985bf66082616c Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + String.valueOf(pos) + ", status: " + String.valueOf(this.generatingStep.targetStatus()) + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get())); hasSetFarWarned = true; diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index b0bc66dc7248aae691dcab68b925b52a1695e63f..49cb116fd55e6d5cd36b9773b39191e4ab06b7e0 100644 +index b0bc66dc7248aae691dcab68b925b52a1695e63f..7d276c191b391bca24948ddb36b8b7d0f1f03b03 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -80,11 +80,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -2775,14 +3053,7 @@ index b0bc66dc7248aae691dcab68b925b52a1695e63f..49cb116fd55e6d5cd36b9773b39191e4 } else if (identifier.equals(ServerCommonPacketListenerImpl.CUSTOM_UNREGISTER)) { try { String channels = payload.toString(com.google.common.base.Charsets.UTF_8); -@@ -255,12 +274,27 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack - } - - protected void keepConnectionAlive() { -- Profiler.get().push("keepAlive"); -+ //Profiler.get().push("keepAlive"); // Purpur - // Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings - // This should effectively place the keepalive handling back to "as it was" before 1.12.2 +@@ -261,6 +280,21 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack long currentTime = Util.getMillis(); long elapsedTime = currentTime - this.keepAliveTime; @@ -2804,17 +3075,8 @@ index b0bc66dc7248aae691dcab68b925b52a1695e63f..49cb116fd55e6d5cd36b9773b39191e4 if (!this.isSingleplayerOwner() && elapsedTime >= 15000L) { // Paper - use vanilla's 15000L between keep alive packets if (this.keepAlivePending && !this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause -@@ -273,7 +307,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack - } - // Paper end - give clients a longer time to respond to pings as per pre 1.12.2 timings - -- Profiler.get().pop(); -+ //Profiler.get().pop(); // Purpur - } - - private boolean checkIfClosed(long time) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d760b8764 100644 +index cd1b6b539a62fa5237d6dab2d1c09a2e631d9941..9ae16e24013ea5664d4ea6d52ed7dd188404890f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -342,6 +342,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2868,7 +3130,15 @@ index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d this.disconnect((Component) Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause return; } -@@ -1180,6 +1203,10 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1172,6 +1195,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + + @Override + public void handleEditBook(ServerboundEditBookPacket packet) { ++ if (!gg.pufferfish.pufferfish.PufferfishConfig.enableBooks && !this.player.getBukkitEntity().hasPermission("pufferfish.usebooks")) return; // Pufferfish + // Paper start - Book size limits + final io.papermc.paper.configuration.type.number.IntOr.Disabled pageMax = io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.pageMax; + if (!this.cserver.isPrimaryThread() && pageMax.enabled()) { +@@ -1180,6 +1204,10 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl final int maxBookPageSize = pageMax.intValue(); final double multiplier = Math.clamp(io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier, 0.3D, 1D); long byteAllowed = maxBookPageSize; @@ -2879,7 +3149,7 @@ index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d for (final String page : pageList) { final int byteLength = page.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; byteTotal += byteLength; -@@ -1204,7 +1231,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1204,7 +1232,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } if (byteTotal > byteAllowed) { @@ -2889,7 +3159,7 @@ index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d this.disconnectAsync(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause // Paper - add proper async disconnect return; } -@@ -1226,10 +1254,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1226,10 +1255,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl Objects.requireNonNull(list); optional.ifPresent(list::add); list.addAll(packet.pages()); @@ -2906,7 +3176,7 @@ index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d }; this.filterTextPacket((List) list).thenAcceptAsync(consumer, this.server); -@@ -1237,13 +1269,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1237,13 +1270,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } private void updateBookContents(List pages, int slotId) { @@ -2926,7 +3196,7 @@ index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d itemstack.set(DataComponents.WRITABLE_BOOK_CONTENT, new WritableBookContent(list1)); this.player.getInventory().setItem(slotId, CraftEventFactory.handleEditBookEvent(this.player, slotId, handItem, itemstack)); // CraftBukkit // Paper - Don't ignore result (see other callsite for handleEditBookEvent) -@@ -1251,6 +1288,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1251,6 +1289,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } private void signBook(FilteredText title, List pages, int slotId) { @@ -2938,7 +3208,7 @@ index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d ItemStack itemstack = this.player.getInventory().getItem(slotId); if (itemstack.has(DataComponents.WRITABLE_BOOK_CONTENT)) { -@@ -1258,10 +1300,10 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1258,10 +1301,10 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl itemstack1.remove(DataComponents.WRITABLE_BOOK_CONTENT); List> list1 = (List>) (List) pages.stream().map((filteredtext1) -> { // CraftBukkit - decompile error @@ -2951,7 +3221,7 @@ index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d CraftEventFactory.handleEditBookEvent(this.player, slotId, itemstack, itemstack1); // CraftBukkit this.player.getInventory().setItem(slotId, itemstack); // CraftBukkit - event factory updates the hand book } -@@ -1271,6 +1313,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1271,6 +1314,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl return this.player.isTextFilteringEnabled() ? Filterable.passThrough(message.filteredOrEmpty()) : Filterable.from(message); } @@ -2968,7 +3238,7 @@ index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d @Override public void handleEntityTagQuery(ServerboundEntityTagQueryPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); -@@ -1320,7 +1372,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1320,7 +1373,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleMovePlayer(ServerboundMovePlayerPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); @@ -2985,7 +3255,7 @@ index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d this.disconnect((Component) Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause } else { ServerLevel worldserver = this.player.serverLevel(); -@@ -1500,7 +1560,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1500,7 +1561,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl movedWrongly = true; if (event.getLogWarning()) // Paper end @@ -2994,7 +3264,7 @@ index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d } // Paper } -@@ -1568,6 +1628,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1568,6 +1629,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.lastYaw = to.getYaw(); this.lastPitch = to.getPitch(); @@ -3003,7 +3273,7 @@ index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d Location oldTo = to.clone(); PlayerMoveEvent event = new PlayerMoveEvent(player, from, to); this.cserver.getPluginManager().callEvent(event); -@@ -1613,6 +1675,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1613,6 +1676,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.tryResetCurrentImpulseContext(); } @@ -3017,7 +3287,7 @@ index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d this.player.checkMovementStatistics(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5); this.lastGoodX = this.player.getX(); this.lastGoodY = this.player.getY(); -@@ -1652,6 +1721,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1652,6 +1722,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } } @@ -3032,7 +3302,7 @@ index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d // Paper start - optimise out extra getCubes private boolean hasNewCollision(final ServerLevel world, final Entity entity, final AABB oldBox, final AABB newBox) { final List collisionsBB = new java.util.ArrayList<>(); -@@ -2025,6 +2102,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2025,6 +2103,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl boolean cancelled; if (movingobjectposition == null || movingobjectposition.getType() != HitResult.Type.BLOCK) { @@ -3040,7 +3310,7 @@ index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack, enumhand); cancelled = event.useItemInHand() == Event.Result.DENY; } else { -@@ -2808,6 +2886,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2808,6 +2887,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl AABB axisalignedbb = entity.getBoundingBox(); if (this.player.canInteractWithEntity(axisalignedbb, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(3.0D))) { // Paper - configurable lenience value for interact range @@ -3048,7 +3318,7 @@ index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..50bc64000f24aa2ae0df2ce7fc77f27d packet.dispatch(new ServerboundInteractPacket.Handler() { private void performInteraction(InteractionHand enumhand, ServerGamePacketListenerImpl.EntityInteraction playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit ItemStack itemstack = ServerGamePacketListenerImpl.this.player.getItemInHand(enumhand); -@@ -2821,6 +2900,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2821,6 +2901,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl ServerGamePacketListenerImpl.this.cserver.getPluginManager().callEvent(event); @@ -3082,26 +3352,8 @@ index 532f09089b8d6798999cf3f83e852df7479e450e..43c63d203859eaa0999937e2f9254c22 com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.processRequest(MinecraftServer.getServer(), this.connection); // Paper end } -diff --git a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java -index d2d82e4f22bfeac8881b6815e4bef56c254fded9..abc92e09b7bb636612f04ace8232947c8d454e68 100644 ---- a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java -+++ b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java -@@ -12,10 +12,10 @@ public interface ResourceManagerReloadListener extends PreparableReloadListener - PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor - ) { - return synchronizer.wait(Unit.INSTANCE).thenRunAsync(() -> { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("listener"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur -+ //profilerFiller.push("listener"); // Purpur - this.onResourceManagerReload(manager); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Purpur - }, applyExecutor); - } - diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 30de3d1a7792c38ae946f19cb0e14637919b5001..d823c9dc6d898f55e677dc320c84a4d8696671b1 100644 +index 1a956249828156fdc273888de59128c3d1a0b898..16999fa20c3621e016d1b0fadfb76f2fe03a2a69 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -419,6 +419,7 @@ public abstract class PlayerList { @@ -3232,238 +3484,6 @@ index 6c33002dc8bbb3759c3156302ab7d1f26ce5e8ee..c89fc375aff548a2b03eaf4da3b6a075 if (name.isEmpty() || name.length() > 16) { return false; } -diff --git a/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java b/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java -index bce2dac613d29083dd5fbb68739304cc5a6d4d27..600a7036b503f60cc9c95f189f73c2dbf020e2e1 100644 ---- a/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java -+++ b/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java -@@ -55,7 +55,7 @@ public class ActiveProfiler implements ProfileCollector { - this.started = true; - this.path = ""; - this.paths.clear(); -- this.push("root"); -+ //this.push("root"); // Purpur - } - } - -@@ -64,7 +64,7 @@ public class ActiveProfiler implements ProfileCollector { - if (!this.started) { - LOGGER.error("Profiler tick already ended - missing startTick()?"); - } else { -- this.pop(); -+ //this.pop(); // Purpur - this.started = false; - if (!this.path.isEmpty()) { - LOGGER.error( -@@ -93,7 +93,7 @@ public class ActiveProfiler implements ProfileCollector { - - @Override - public void push(Supplier locationGetter) { -- this.push(locationGetter.get()); -+ //this.push(locationGetter.get()); // Purpur - } - - @Override -@@ -132,14 +132,14 @@ public class ActiveProfiler implements ProfileCollector { - - @Override - public void popPush(String location) { -- this.pop(); -- this.push(location); -+ //this.pop(); // Purpur -+ //this.push(location); // Purpur - } - - @Override - public void popPush(Supplier locationGetter) { -- this.pop(); -- this.push(locationGetter); -+ //this.pop(); // Purpur -+ //this.push(locationGetter); // Purpur - } - - private ActiveProfiler.PathEntry getCurrentEntry() { -diff --git a/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java b/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java -index bc5c8879befe849ce81becf5e3fba6757b01cb70..ce81d6bd87f688a24003f2fbf6d5010ad6273917 100644 ---- a/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java -+++ b/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java -@@ -6,51 +6,68 @@ import net.minecraft.util.profiling.metrics.MetricCategory; - public interface ProfilerFiller { - String ROOT = "root"; - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - void startTick(); - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - void endTick(); - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - void push(String location); - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - void push(Supplier locationGetter); - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - void pop(); - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - void popPush(String location); - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - void popPush(Supplier locationGetter); - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - default void addZoneText(String label) { - } - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - default void addZoneValue(long value) { - } - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - default void setZoneColor(int color) { - } - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - default Zone zone(String name) { - this.push(name); - return new Zone(this); - } - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - default Zone zone(Supplier nameSupplier) { - this.push(nameSupplier); - return new Zone(this); - } - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - void markForCharting(MetricCategory type); - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - default void incrementCounter(String marker) { -- this.incrementCounter(marker, 1); -+ //this.incrementCounter(marker, 1); // Purpur - } - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - void incrementCounter(String marker, int num); - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - default void incrementCounter(Supplier markerGetter) { -- this.incrementCounter(markerGetter, 1); -+ //this.incrementCounter(markerGetter, 1); // Purpur - } - -+ @io.papermc.paper.annotation.DoNotUse // Purpur - void incrementCounter(Supplier markerGetter, int num); - - static ProfilerFiller combine(ProfilerFiller first, ProfilerFiller second) { -@@ -72,80 +89,80 @@ public interface ProfilerFiller { - - @Override - public void startTick() { -- this.first.startTick(); -- this.second.startTick(); -+ //this.first.startTick(); // Purpur -+ //this.second.startTick(); // Purpur - } - - @Override - public void endTick() { -- this.first.endTick(); -- this.second.endTick(); -+ //this.first.endTick(); // Purpur -+ //this.second.endTick(); // Purpur - } - - @Override - public void push(String location) { -- this.first.push(location); -- this.second.push(location); -+ //this.first.push(location); // Purpur -+ //this.second.push(location); // Purpur - } - - @Override - public void push(Supplier locationGetter) { -- this.first.push(locationGetter); -- this.second.push(locationGetter); -+ //this.first.push(locationGetter); // Purpur -+ //this.second.push(locationGetter); // Purpur - } - - @Override - public void markForCharting(MetricCategory type) { -- this.first.markForCharting(type); -- this.second.markForCharting(type); -+ //this.first.markForCharting(type); // Purpur -+ //this.second.markForCharting(type); // Purpur - } - - @Override - public void pop() { -- this.first.pop(); -- this.second.pop(); -+ //this.first.pop(); // Purpur -+ //this.second.pop(); // Purpur - } - - @Override - public void popPush(String location) { -- this.first.popPush(location); -- this.second.popPush(location); -+ //this.first.popPush(location); // Purpur -+ //this.second.popPush(location); // Purpur - } - - @Override - public void popPush(Supplier locationGetter) { -- this.first.popPush(locationGetter); -- this.second.popPush(locationGetter); -+ //this.first.popPush(locationGetter); // Purpur -+ //this.second.popPush(locationGetter); // Purpur - } - - @Override - public void incrementCounter(String marker, int num) { -- this.first.incrementCounter(marker, num); -- this.second.incrementCounter(marker, num); -+ //this.first.incrementCounter(marker, num); // Purpur -+ //this.second.incrementCounter(marker, num); // Purpur - } - - @Override - public void incrementCounter(Supplier markerGetter, int num) { -- this.first.incrementCounter(markerGetter, num); -- this.second.incrementCounter(markerGetter, num); -+ //this.first.incrementCounter(markerGetter, num); // Purpur -+ //this.second.incrementCounter(markerGetter, num); // Purpur - } - - @Override - public void addZoneText(String label) { -- this.first.addZoneText(label); -- this.second.addZoneText(label); -+ //this.first.addZoneText(label); // Purpur -+ //this.second.addZoneText(label); // Purpur - } - - @Override - public void addZoneValue(long value) { -- this.first.addZoneValue(value); -- this.second.addZoneValue(value); -+ //this.first.addZoneValue(value); // Purpur -+ //this.second.addZoneValue(value); // Purpur - } - - @Override - public void setZoneColor(int color) { -- this.first.setZoneColor(color); -- this.second.setZoneColor(color); -+ //this.first.setZoneColor(color); // Purpur -+ //this.second.setZoneColor(color); // Purpur - } - } - } diff --git a/src/main/java/net/minecraft/world/damagesource/CombatRules.java b/src/main/java/net/minecraft/world/damagesource/CombatRules.java index 064c1e33f3feee77837bb57887877ae1ca39548d..ffd009bca3fdbfd0b14df78072ef8d472a57cd65 100644 --- a/src/main/java/net/minecraft/world/damagesource/CombatRules.java @@ -3688,7 +3708,7 @@ index 303cefba51e19ac43b1f6188ad64ef480715ebaf..98ec88751b3e71c2e7aad633096b7f41 } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe90c60f59 100644 +index a15546e433ebba6c0de01bdaaef201a3d99a87b5..aa171a1afb9800e6ec84f6b4f1b28e44177752f7 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -177,7 +177,7 @@ import org.bukkit.plugin.PluginManager; @@ -3700,7 +3720,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe // CraftBukkit start private static final int CURRENT_LEVEL = 2; public boolean preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; keep initial motion on first setPositionRotation -@@ -344,6 +344,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -300,6 +300,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public double xOld; public double yOld; public double zOld; @@ -3708,7 +3728,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe public boolean noPhysics; private boolean wasOnFire; public final RandomSource random; -@@ -384,7 +385,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -340,7 +341,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess private final Set tags; private final double[] pistonDeltas; private long pistonDeltasGameTime; @@ -3717,15 +3737,18 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe private float eyeHeight; public boolean isInPowderSnow; public boolean wasInPowderSnow; -@@ -432,6 +433,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - private UUID originWorld; +@@ -389,6 +390,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public boolean freezeLocked = false; // Paper - Freeze Tick Lock API public boolean fixedPose = false; // Paper - Expand Pose API + private final int despawnTime; // Paper - entity despawn time limit ++ public boolean activatedPriorityReset = false; // Pufferfish - DAB ++ public int activatedPriority = gg.pufferfish.pufferfish.PufferfishConfig.maximumActivationPrio; // Pufferfish - DAB (golf score) ++ public final BlockPos.MutableBlockPos cachedBlockPos = new BlockPos.MutableBlockPos(); // Pufferfish - reduce entity allocations + public @Nullable Boolean immuneToFire = null; // Purpur - Fire immune API public void setOrigin(@javax.annotation.Nonnull Location location) { this.origin = location.toVector(); -@@ -611,6 +613,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -568,6 +573,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } } // Paper end - optimise entity tracker @@ -3753,7 +3776,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe public Entity(EntityType type, Level world) { this.id = Entity.ENTITY_COUNTER.incrementAndGet(); -@@ -619,7 +642,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -577,7 +603,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.bb = Entity.INITIAL_AABB; this.stuckSpeedMultiplier = Vec3.ZERO; this.nextStep = 1.0F; @@ -3762,28 +3785,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe this.remainingFireTicks = -this.getFireImmuneTicks(); this.fluidHeight = new Object2DoubleArrayMap(2); this.fluidOnEyes = new HashSet(); -@@ -925,9 +948,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - // CraftBukkit end - - public void baseTick() { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("entityBaseTick"); -+ //gameprofilerfiller.push("entityBaseTick"); // Purpur - if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Prevent entity loading causing async lookups - this.inBlockState = null; - if (this.isPassenger() && this.getVehicle().isRemoved()) { -@@ -996,7 +1019,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - } - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } - - public void setSharedFlagOnFire(boolean onFire) { -@@ -1010,6 +1033,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -974,6 +1000,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v) && (!(this instanceof Player player) || !player.getAbilities().invulnerable))) { // Paper end - Configurable nether ceiling damage @@ -3791,57 +3793,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe this.onBelowWorld(); } -@@ -1222,9 +1246,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - } - -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("move"); -+ //gameprofilerfiller.push("move"); // Purpur - if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7D) { - movement = movement.multiply(this.stuckSpeedMultiplier); - this.stuckSpeedMultiplier = Vec3.ZERO; -@@ -1233,7 +1257,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - // Paper start - ignore movement changes while inactive. - if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && type == MoverType.SELF) { - setDeltaMovement(Vec3.ZERO); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - return; - } - // Paper end -@@ -1254,8 +1278,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - this.setPos(this.getX() + vec3d1.x, this.getY() + vec3d1.y, this.getZ() + vec3d1.z); - } - -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("rest"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("rest"); // Purpur - boolean flag = !Mth.equal(movement.x, vec3d1.x); - boolean flag1 = !Mth.equal(movement.z, vec3d1.z); - -@@ -1277,7 +1301,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - - if (this.isRemoved()) { -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } else { - if (this.horizontalCollision) { - Vec3 vec3d2 = this.getDeltaMovement(); -@@ -1326,7 +1350,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - float f = this.getBlockSpeedFactor(); - - this.setDeltaMovement(this.getDeltaMovement().multiply((double) f, 1.0D, (double) f)); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } - } - // Paper start - detailed watchdog information -@@ -1971,7 +1995,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1935,7 +1962,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public boolean fireImmune() { @@ -3850,7 +3802,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe } public boolean causeFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource) { -@@ -2044,7 +2068,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2008,7 +2035,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return this.isInWater() || flag; } @@ -3859,7 +3811,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe Entity entity = this.getVehicle(); if (entity instanceof AbstractBoat abstractboat) { -@@ -2726,6 +2750,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2690,6 +2717,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess nbttagcompound.putBoolean("Paper.FreezeLock", true); } // Paper end @@ -3871,7 +3823,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe return nbttagcompound; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); -@@ -2874,6 +2903,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2838,6 +2870,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess freezeLocked = nbt.getBoolean("Paper.FreezeLock"); } // Paper end @@ -3883,7 +3835,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT"); -@@ -3125,6 +3159,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3089,6 +3126,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess if (this.isAlive() && this instanceof Leashable leashable) { if (leashable.getLeashHolder() == player) { if (!this.level().isClientSide()) { @@ -3891,7 +3843,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe // CraftBukkit start - fire PlayerUnleashEntityEvent // Paper start - Expand EntityUnleashEvent org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.hasInfiniteMaterials()); -@@ -3330,6 +3365,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3294,6 +3332,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.passengers = ImmutableList.copyOf(list); } @@ -3905,7 +3857,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe this.gameEvent(GameEvent.ENTITY_MOUNT, passenger); } } -@@ -3369,6 +3411,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3333,6 +3378,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return false; } // CraftBukkit end @@ -3920,7 +3872,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe if (this.passengers.size() == 1 && this.passengers.get(0) == entity) { this.passengers = ImmutableList.of(); } else { -@@ -3449,14 +3499,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3413,14 +3466,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return Vec3.directionFromRotation(this.getRotationVector()); } @@ -3939,28 +3891,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe } } else { this.portalProcess = new PortalProcessor(portal, pos.immutable()); -@@ -3472,9 +3525,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - this.processPortalCooldown(); - if (this.portalProcess != null) { - if (this.portalProcess.processPortalTeleportation(worldserver, this, this.canUsePortal(false))) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("portal"); -+ //gameprofilerfiller.push("portal"); // Purpur - this.setPortalCooldown(); - TeleportTransition teleporttransition = this.portalProcess.getPortalDestination(worldserver, this); - -@@ -3486,7 +3539,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - } - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } else if (this.portalProcess.hasExpired()) { - this.portalProcess = null; - } -@@ -3673,7 +3726,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3637,7 +3693,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public int getMaxAirSupply() { @@ -3969,32 +3900,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe } public int getAirSupply() { -@@ -4039,12 +4092,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - } - -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("teleportCrossDimension"); -+ //gameprofilerfiller.push("teleportCrossDimension"); // Purpur - entity = this.getType().create(world, EntitySpawnReason.DIMENSION_TRAVEL); - if (entity == null) { -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - return null; - } else { - // Paper start - Fix item duplication and teleport issues -@@ -4070,7 +4123,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - - world.resetEmptyTime(); - teleportTarget.postTeleportTransition().onTransition(entity); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - return entity; - } - } -@@ -4171,7 +4224,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4135,7 +4191,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // CraftBukkit end public boolean canUsePortal(boolean allowVehicles) { @@ -4003,7 +3909,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe } public boolean canTeleport(Level from, Level to) { -@@ -4759,6 +4812,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4723,6 +4779,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return Mth.lerp(delta, this.yRotO, this.yRot); } @@ -4016,7 +3922,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe // Paper start - optimise collisions public boolean updateFluidHeightAndDoFluidPushing(final TagKey fluid, final double flowScale) { if (this.touchingUnloadedChunk()) { -@@ -5160,7 +5219,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -5124,7 +5186,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public float maxUpStep() { @@ -4025,7 +3931,7 @@ index 8be1b051543cda2b2e9e3d337834757e53f442de..9451ee87538d72ba760d1a27003781fe } public void onExplosionHit(@Nullable Entity entity) {} -@@ -5361,4 +5420,44 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -5325,4 +5387,44 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return ((net.minecraft.server.level.ServerLevel) this.level).isPositionEntityTicking(this.blockPosition()); } // Paper end - Expose entity id counter @@ -4083,10 +3989,14 @@ index 6bf691fcc6486bde73bae30eff09142802c29eda..59c4d3753c7084e92402608b7fb3c4ad private EntitySelector() {} // Paper start - Affects Spawning API diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index c8c2394558952d7ca57d29874485251b8f2b3400..c1a870fd22b193388513aad0ac4f3ce0ad7c8195 100644 +index c8c2394558952d7ca57d29874485251b8f2b3400..1d50b03246d114c6583815205eeacb7ac8549aec 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -388,7 +388,8 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -385,10 +385,12 @@ public class EntityType implements FeatureElement, EntityTypeT + private final int clientTrackingRange; + private final int updateInterval; + private final String descriptionId; ++ public boolean dabEnabled = false; // Pufferfish @Nullable private Component description; private final Optional> lootTable; @@ -4096,7 +4006,7 @@ index c8c2394558952d7ca57d29874485251b8f2b3400..c1a870fd22b193388513aad0ac4f3ce0 private final float spawnDimensionsScale; private final FeatureFlagSet requiredFeatures; -@@ -404,6 +405,16 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -404,6 +406,16 @@ public class EntityType implements FeatureElement, EntityTypeT return EntityType.register(EntityType.vanillaEntityId(id), type); } @@ -4113,7 +4023,7 @@ index c8c2394558952d7ca57d29874485251b8f2b3400..c1a870fd22b193388513aad0ac4f3ce0 public static ResourceLocation getKey(EntityType type) { return BuiltInRegistries.ENTITY_TYPE.getKey(type); } -@@ -604,6 +615,16 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -604,6 +616,16 @@ public class EntityType implements FeatureElement, EntityTypeT return this.category; } @@ -4130,7 +4040,7 @@ index c8c2394558952d7ca57d29874485251b8f2b3400..c1a870fd22b193388513aad0ac4f3ce0 public String getDescriptionId() { return this.descriptionId; } -@@ -661,6 +682,12 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -661,6 +683,12 @@ public class EntityType implements FeatureElement, EntityTypeT entity.load(nbt); }, () -> { EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id")); @@ -4210,7 +4120,7 @@ index b851c3ee1426bc0a259bf6c4a662af0c9883dd71..3283228d7ebf98ce98780725a0a412be protected ParticleOptions getInkParticle() { return ParticleTypes.GLOW_SQUID_INK; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1b2ee0e85 100644 +index f36a075dbee2b96d01899e02460b1d8443e91749..f4604e543a980d6aeb485252da5a4e755aa12bfa 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -248,9 +248,9 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -4261,18 +4171,15 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 @Override protected void checkFallDamage(double heightDifference, boolean onGround, BlockState state, BlockPos landedPosition) { -@@ -452,9 +457,9 @@ public abstract class LivingEntity extends Entity implements Attackable { - } +@@ -467,7 +472,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - super.baseTick(); -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("livingEntityBaseTick"); -+ //gameprofilerfiller.push("livingEntityBaseTick"); // Purpur - if (this.fireImmune() || this.level().isClientSide) { - this.clearFire(); - } + if (world1 instanceof ServerLevel) { + worldserver1 = (ServerLevel) world1; +- if (this.isInWall()) { ++ if (shouldCheckForSuffocation() && this.isInWall()) { // Pufferfish - optimize suffocation + this.hurtServer(worldserver1, this.damageSources().inWall(), 1.0F); + } else if (flag && !this.level().getWorldBorder().isWithinBounds(this.getBoundingBox())) { + double d1 = this.level().getWorldBorder().getDistanceToBorder(this) + this.level().getWorldBorder().getDamageSafeZone(); @@ -475,6 +480,7 @@ public abstract class LivingEntity extends Entity implements Attackable { if (d1 < 0.0D) { d0 = this.level().getWorldBorder().getDamagePerBlock(); @@ -4299,16 +4206,27 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 } } -@@ -561,7 +567,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.yHeadRotO = this.yHeadRot; - this.yRotO = this.getYRot(); - this.xRotO = this.getXRot(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur +@@ -564,6 +570,19 @@ public abstract class LivingEntity extends Entity implements Attackable { + gameprofilerfiller.pop(); } ++ // Pufferfish start - optimize suffocation ++ public boolean couldPossiblyBeHurt(float amount) { ++ if ((float) this.invulnerableTime > (float) this.invulnerableDuration / 2.0F && amount <= this.lastHurt) { ++ return false; ++ } ++ return true; ++ } ++ ++ public boolean shouldCheckForSuffocation() { ++ return !gg.pufferfish.pufferfish.PufferfishConfig.enableSuffocationOptimization || (tickCount % 10 == 0 && couldPossiblyBeHurt(1.0F)); ++ } ++ // Pufferfish end ++ @Override -@@ -834,6 +840,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + protected float getBlockSpeedFactor() { + return Mth.lerp((float) this.getAttributeValue(Attributes.MOVEMENT_EFFICIENCY), super.getBlockSpeedFactor(), 1.0F); +@@ -834,6 +853,7 @@ public abstract class LivingEntity extends Entity implements Attackable { dataresult.resultOrPartial(logger::error).ifPresent((nbtbase) -> { nbt.put("Brain", nbtbase); }); @@ -4316,7 +4234,7 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 } @Override -@@ -922,6 +929,11 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -922,6 +942,11 @@ public abstract class LivingEntity extends Entity implements Attackable { this.brain = this.makeBrain(new Dynamic(NbtOps.INSTANCE, nbt.get("Brain"))); } @@ -4328,7 +4246,7 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 } // CraftBukkit start -@@ -1057,9 +1069,31 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1057,9 +1082,31 @@ public abstract class LivingEntity extends Entity implements Attackable { ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD); EntityType entitytypes = entity.getType(); @@ -4340,10 +4258,10 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 + } + else if (entitytypes == EntityType.ZOMBIE && itemstack.is(Items.ZOMBIE_HEAD)) { + d0 *= entity.level().purpurConfig.zombieHeadVisibilityPercent; - } ++ } + else if (entitytypes == EntityType.CREEPER && itemstack.is(Items.CREEPER_HEAD)) { + d0 *= entity.level().purpurConfig.creeperHeadVisibilityPercent; -+ } + } + else if ((entitytypes == EntityType.PIGLIN || entitytypes == EntityType.PIGLIN_BRUTE) && itemstack.is(Items.PIGLIN_HEAD)) { + d0 *= entity.level().purpurConfig.piglinHeadVisibilityPercent; + } @@ -4362,7 +4280,7 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 } return d0; -@@ -1115,6 +1149,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1115,6 +1162,7 @@ public abstract class LivingEntity extends Entity implements Attackable { while (iterator.hasNext()) { MobEffectInstance effect = iterator.next(); @@ -4370,7 +4288,7 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, effect, null, cause, EntityPotionEffectEvent.Action.CLEARED); if (event.isCancelled()) { continue; -@@ -1450,6 +1485,24 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1450,6 +1498,24 @@ public abstract class LivingEntity extends Entity implements Attackable { this.stopSleeping(); } @@ -4395,7 +4313,7 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 this.noActionTime = 0; if (amount < 0.0F) { amount = 0.0F; -@@ -1549,13 +1602,13 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1549,13 +1615,13 @@ public abstract class LivingEntity extends Entity implements Attackable { if (entity1 instanceof net.minecraft.world.entity.player.Player) { net.minecraft.world.entity.player.Player entityhuman = (net.minecraft.world.entity.player.Player) entity1; @@ -4411,7 +4329,7 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 LivingEntity entityliving2 = entitywolf.getOwner(); if (entityliving2 instanceof net.minecraft.world.entity.player.Player) { -@@ -1702,6 +1755,18 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1702,6 +1768,18 @@ public abstract class LivingEntity extends Entity implements Attackable { } } @@ -4430,16 +4348,16 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null; EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot); event.setCancelled(itemstack == null); -@@ -1867,7 +1932,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1873,7 +1951,7 @@ public abstract class LivingEntity extends Entity implements Attackable { boolean flag = false; if (this.dead && adversary instanceof WitherBoss) { // Paper - if (worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ if (worldserver.purpurConfig.witherBypassMobGriefing || worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur ++ if (worldserver.purpurConfig.witherBypassMobGriefing ^ worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur BlockPos blockposition = this.blockPosition(); BlockState iblockdata = Blocks.WITHER_ROSE.defaultBlockState(); -@@ -1904,6 +1969,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1910,6 +1988,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.dropEquipment(world); // CraftBukkit - from below if (this.shouldDropLoot() && world.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { @@ -4447,7 +4365,7 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 this.dropFromLootTable(world, damageSource, flag); // Paper start final boolean prev = this.clearEquipmentSlots; -@@ -1912,6 +1978,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1918,6 +1997,7 @@ public abstract class LivingEntity extends Entity implements Attackable { // Paper end this.dropCustomDeathLoot(world, damageSource, flag); this.clearEquipmentSlots = prev; // Paper @@ -4455,7 +4373,28 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 } // CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment org.bukkit.event.entity.EntityDeathEvent deathEvent = CraftEventFactory.callEntityDeathEvent(this, damageSource, this.drops, () -> { -@@ -3124,6 +3191,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -2120,6 +2200,20 @@ public abstract class LivingEntity extends Entity implements Attackable { + return this.lastClimbablePos; + } + ++ ++ // Pufferfish start ++ private boolean cachedOnClimable = false; ++ private BlockPos lastClimbingPosition = null; ++ ++ public boolean onClimableCached() { ++ if (!this.blockPosition().equals(this.lastClimbingPosition)) { ++ this.cachedOnClimable = this.onClimbable(); ++ this.lastClimbingPosition = this.blockPosition(); ++ } ++ return this.cachedOnClimable; ++ } ++ // Pufferfish end ++ + public boolean onClimbable() { + if (this.isSpectator()) { + return false; +@@ -3146,6 +3240,7 @@ public abstract class LivingEntity extends Entity implements Attackable { if (f > 0.0F) { this.playSound(this.getFallDamageSound((int) f), 1.0F, 1.0F); @@ -4463,98 +4402,9 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 this.hurt(this.damageSources().flyIntoWall(), f); } } -@@ -3316,12 +3384,12 @@ public abstract class LivingEntity extends Entity implements Attackable { - } - - this.run += (f3 - this.run) * 0.3F; -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("headTurn"); -+ //gameprofilerfiller.push("headTurn"); // Purpur - f2 = this.tickHeadTurn(f1, f2); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("rangeChecks"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("rangeChecks"); // Purpur - - // Paper start - stop large pitch and yaw changes from crashing the server - this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F; -@@ -3333,7 +3401,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F; - // Paper end - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - this.animStep += f2; - if (this.isFallFlying()) { - ++this.fallFlyTicks; -@@ -3563,21 +3631,21 @@ public abstract class LivingEntity extends Entity implements Attackable { - } - - this.setDeltaMovement(d0, d1, d2); -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("ai"); -+ //gameprofilerfiller.push("ai"); // Purpur - if (this.isImmobile()) { - this.jumping = false; - this.xxa = 0.0F; - this.zza = 0.0F; - } else if (this.isEffectiveAi()) { -- gameprofilerfiller.push("newAi"); -+ //gameprofilerfiller.push("newAi"); // Purpur - this.serverAiStep(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } - -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("jump"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("jump"); // Purpur - if (this.jumping && this.isAffectedByFluids()) { - double d3; - -@@ -3604,8 +3672,8 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.noJumpDelay = 0; - } - -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("travel"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("travel"); // Purpur - this.xxa *= 0.98F; - this.zza *= 0.98F; - if (this.isFallFlying()) { -@@ -3638,8 +3706,8 @@ public abstract class LivingEntity extends Entity implements Attackable { - } - - this.calculateEntityAnimation(this instanceof FlyingAnimal); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("freezing"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("freezing"); // Purpur - if (!this.level().isClientSide && !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API - int i = this.getTicksFrozen(); - -@@ -3660,18 +3728,20 @@ public abstract class LivingEntity extends Entity implements Attackable { - } - } - -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("push"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("push"); // Purpur - if (this.autoSpinAttackTicks > 0) { - --this.autoSpinAttackTicks; - this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox()); - } - +@@ -3692,8 +3787,10 @@ public abstract class LivingEntity extends Entity implements Attackable { this.pushEntities(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur + gameprofilerfiller.pop(); // Paper start - Add EntityMoveEvent - if (((ServerLevel) this.level()).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) { - if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) { @@ -4565,7 +4415,7 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 Location from = new Location(this.level().getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO); Location to = new Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone()); -@@ -3681,6 +3751,21 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3703,6 +3800,21 @@ public abstract class LivingEntity extends Entity implements Attackable { this.absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch()); } } @@ -4587,7 +4437,7 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 } // Paper end - Add EntityMoveEvent world = this.level(); -@@ -3690,6 +3775,34 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3712,6 +3824,34 @@ public abstract class LivingEntity extends Entity implements Attackable { } } @@ -4622,7 +4472,7 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 } public boolean isSensitiveToWater() { -@@ -3716,7 +3829,17 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3738,7 +3878,17 @@ public abstract class LivingEntity extends Entity implements Attackable { }).toList(); EquipmentSlot enumitemslot = (EquipmentSlot) Util.getRandom(list, this.random); @@ -4641,7 +4491,7 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 } this.gameEvent(GameEvent.ELYTRA_GLIDE); -@@ -3725,7 +3848,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3747,7 +3897,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } @@ -4650,7 +4500,7 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 if (!this.onGround() && !this.isPassenger() && !this.hasEffect(MobEffects.LEVITATION)) { Iterator iterator = EquipmentSlot.VALUES.iterator(); -@@ -4647,7 +4770,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -4669,7 +4819,7 @@ public abstract class LivingEntity extends Entity implements Attackable { if (equippable != null && equippable.dispensable()) { EquipmentSlot enumitemslot = equippable.slot(); @@ -4659,7 +4509,7 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 } else { return false; } -@@ -4672,6 +4795,12 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -4694,6 +4844,12 @@ public abstract class LivingEntity extends Entity implements Attackable { return equippable == null ? slot == EquipmentSlot.MAINHAND && this.canUseSlot(EquipmentSlot.MAINHAND) : slot == equippable.slot() && this.canUseSlot(equippable.slot()) && equippable.canBeEquippedBy(this.getType()); } @@ -4673,7 +4523,7 @@ index 6a3a8f0466998409a01223bc0c16d92b96e50118..57f6061475f58a54f068febeefba64a1 return slot != EquipmentSlot.HEAD && slot != EquipmentSlot.MAINHAND && slot != EquipmentSlot.OFFHAND ? SlotAccess.forEquipmentSlot(entity, slot, (itemstack) -> { return itemstack.isEmpty() || entity.getEquipmentSlotForItem(itemstack) == slot; diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index dbd321f3dc3cc80737830db63aed47a6935e8e89..ff9d23aef4658922692b43a859bd83632fe23612 100644 +index dbd321f3dc3cc80737830db63aed47a6935e8e89..7ca12a1128661ea36e2e33cda204c7d2df55a21c 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -148,6 +148,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -4695,7 +4545,26 @@ index dbd321f3dc3cc80737830db63aed47a6935e8e89..ff9d23aef4658922692b43a859bd8363 this.jumpControl = new JumpControl(this); this.bodyRotationControl = this.createBodyControl(); this.navigation = this.createNavigation(world); -@@ -334,6 +335,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -235,14 +236,16 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + return this.lookControl; + } + ++ int _pufferfish_inactiveTickDisableCounter = 0; // Pufferfish - throttle inactive goal selector ticking + // Paper start + @Override + public void inactiveTick() { + super.inactiveTick(); +- if (this.goalSelector.inactiveTick()) { ++ boolean isThrottled = gg.pufferfish.pufferfish.PufferfishConfig.throttleInactiveGoalSelectorTick && _pufferfish_inactiveTickDisableCounter++ % 20 != 0; // Pufferfish - throttle inactive goal selector ticking ++ if (this.goalSelector.inactiveTick(this.activatedPriority, true) && !isThrottled) { // Pufferfish - pass activated priroity // Pufferfish - throttle inactive goal selector ticking + this.goalSelector.tick(); + } +- if (this.targetSelector.inactiveTick()) { ++ if (this.targetSelector.inactiveTick(this.activatedPriority, true)) { // Pufferfish - pass activated priority + this.targetSelector.tick(); + } + } +@@ -334,6 +337,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab entityliving = null; } } @@ -4703,22 +4572,10 @@ index dbd321f3dc3cc80737830db63aed47a6935e8e89..ff9d23aef4658922692b43a859bd8363 this.target = entityliving; return true; // CraftBukkit end -@@ -369,17 +371,37 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - @Override - public void baseTick() { - super.baseTick(); -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("mobBaseTick"); -+ //gameprofilerfiller.push("mobBaseTick"); // Purpur - if (this.isAlive() && this.random.nextInt(1000) < this.ambientSoundTime++) { - this.resetAmbientSoundTime(); - this.playAmbientSound(); +@@ -378,8 +382,28 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur + gameprofilerfiller.pop(); + incrementTicksSinceLastInteraction(); // Purpur } @@ -4744,7 +4601,7 @@ index dbd321f3dc3cc80737830db63aed47a6935e8e89..ff9d23aef4658922692b43a859bd8363 @Override protected void playHurtSound(DamageSource damageSource) { this.resetAmbientSoundTime(); -@@ -547,6 +569,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -547,6 +571,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } nbt.putBoolean("Bukkit.Aware", this.aware); // CraftBukkit @@ -4752,7 +4609,7 @@ index dbd321f3dc3cc80737830db63aed47a6935e8e89..ff9d23aef4658922692b43a859bd8363 } @Override -@@ -624,6 +647,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -624,6 +649,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab this.aware = nbt.getBoolean("Bukkit.Aware"); } // CraftBukkit end @@ -4764,99 +4621,37 @@ index dbd321f3dc3cc80737830db63aed47a6935e8e89..ff9d23aef4658922692b43a859bd8363 } @Override -@@ -670,13 +698,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - @Override - public void aiStep() { - super.aiStep(); -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("looting"); -+ //gameprofilerfiller.push("looting"); // Purpur +@@ -676,7 +706,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab Level world = this.level(); if (world instanceof ServerLevel worldserver) { - if (this.canPickUpLoot() && this.isAlive() && !this.dead && worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ if (this.canPickUpLoot() && this.isAlive() && !this.dead && (worldserver.purpurConfig.entitiesPickUpLootBypassMobGriefing || worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // Purpur ++ if (this.canPickUpLoot() && this.isAlive() && !this.dead && (worldserver.purpurConfig.entitiesPickUpLootBypassMobGriefing ^ worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // Purpur Vec3i baseblockposition = this.getPickupReach(); List list = this.level().getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate((double) baseblockposition.getX(), (double) baseblockposition.getY(), (double) baseblockposition.getZ())); Iterator iterator = list.iterator(); -@@ -696,7 +724,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - } - } - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } - - protected Vec3i getPickupReach() { -@@ -918,44 +946,44 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - return; - } - // Paper end - Allow nerfed mobs to jump and float -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("sensing"); -+ //gameprofilerfiller.push("sensing"); // Purpur - this.sensing.tick(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - int i = this.tickCount + this.getId(); +@@ -927,16 +957,20 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab if (i % 2 != 0 && this.tickCount > 1) { -- gameprofilerfiller.push("targetSelector"); -+ //gameprofilerfiller.push("targetSelector"); // Purpur + gameprofilerfiller.push("targetSelector"); ++ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking this.targetSelector.tickRunningGoals(false); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("goalSelector"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("goalSelector"); // Purpur + gameprofilerfiller.pop(); + gameprofilerfiller.push("goalSelector"); ++ if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking this.goalSelector.tickRunningGoals(false); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur + gameprofilerfiller.pop(); } else { -- gameprofilerfiller.push("targetSelector"); -+ //gameprofilerfiller.push("targetSelector"); // Purpur + gameprofilerfiller.push("targetSelector"); ++ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking this.targetSelector.tick(); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("goalSelector"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("goalSelector"); // Purpur + gameprofilerfiller.pop(); + gameprofilerfiller.push("goalSelector"); ++ if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking this.goalSelector.tick(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur + gameprofilerfiller.pop(); } - -- gameprofilerfiller.push("navigation"); -+ //gameprofilerfiller.push("navigation"); // Purpur - this.navigation.tick(); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("mob tick"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("mob tick"); // Purpur - this.customServerAiStep((ServerLevel) this.level()); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("controls"); -- gameprofilerfiller.push("move"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("controls"); // Purpur -+ //gameprofilerfiller.push("move"); // Purpur - this.moveControl.tick(); -- gameprofilerfiller.popPush("look"); -+ //gameprofilerfiller.popPush("look"); // Purpur - this.lookControl.tick(); -- gameprofilerfiller.popPush("jump"); -+ //gameprofilerfiller.popPush("jump"); // Purpur - this.jumpControl.tick(); -- gameprofilerfiller.pop(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.pop(); // Purpur - this.sendDebugPackets(); - } - -@@ -1394,7 +1422,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1394,7 +1428,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab attributemodifiable.addPermanentModifier(new AttributeModifier(Mob.RANDOM_SPAWN_BONUS_ID, randomsource.triangle(0.0D, 0.11485000000000001D), AttributeModifier.Operation.ADD_MULTIPLIED_BASE)); } @@ -4865,7 +4660,7 @@ index dbd321f3dc3cc80737830db63aed47a6935e8e89..ff9d23aef4658922692b43a859bd8363 return entityData; } -@@ -1496,7 +1524,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1496,7 +1530,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab protected void onOffspringSpawnedFromEgg(Player player, Mob child) {} protected InteractionResult mobInteract(Player player, InteractionHand hand) { @@ -4874,7 +4669,7 @@ index dbd321f3dc3cc80737830db63aed47a6935e8e89..ff9d23aef4658922692b43a859bd8363 } public boolean isWithinRestriction() { -@@ -1735,23 +1763,15 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1735,23 +1769,15 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab this.playAttackSound(); } @@ -4901,7 +4696,7 @@ index dbd321f3dc3cc80737830db63aed47a6935e8e89..ff9d23aef4658922692b43a859bd8363 } @Override -@@ -1813,4 +1833,58 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1813,4 +1839,58 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab public float[] getArmorDropChances() { return this.armorDropChances; } @@ -4961,13 +4756,14 @@ index dbd321f3dc3cc80737830db63aed47a6935e8e89..ff9d23aef4658922692b43a859bd8363 + // Purpur end } diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java -index 94d04a20f97405e02d7cccaabadc7a7e86e336f7..06b890275d1a171d609b91a1d1a018c43b943ab2 100644 +index 94d04a20f97405e02d7cccaabadc7a7e86e336f7..861591694785a6ff16f839fa91781791c275de14 100644 --- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java +++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java -@@ -23,14 +23,21 @@ public class AttributeMap { +@@ -23,14 +23,23 @@ public class AttributeMap { private final Set attributesToSync = new ObjectOpenHashSet<>(); private final Set attributesToUpdate = new ObjectOpenHashSet<>(); private final AttributeSupplier supplier; ++ private final java.util.function.Function, AttributeInstance> createInstance; // Pufferfish + private final net.minecraft.world.entity.LivingEntity entity; // Purpur public AttributeMap(AttributeSupplier defaultAttributes) { @@ -4978,6 +4774,7 @@ index 94d04a20f97405e02d7cccaabadc7a7e86e336f7..06b890275d1a171d609b91a1d1a018c4 + this.entity = entity; + // Purpur end this.supplier = defaultAttributes; ++ this.createInstance = attributex -> this.supplier.createInstance(this::onAttributeModified, attributex); // Pufferfish } private void onAttributeModified(AttributeInstance instance) { @@ -4987,7 +4784,7 @@ index 94d04a20f97405e02d7cccaabadc7a7e86e336f7..06b890275d1a171d609b91a1d1a018c4 this.attributesToSync.add(instance); } } -@@ -44,7 +51,7 @@ public class AttributeMap { +@@ -44,12 +53,13 @@ public class AttributeMap { } public Collection getSyncableAttributes() { @@ -4995,9 +4792,16 @@ index 94d04a20f97405e02d7cccaabadc7a7e86e336f7..06b890275d1a171d609b91a1d1a018c4 + return this.attributes.values().stream().filter(attribute -> attribute.getAttribute().value().isClientSyncable() && (entity == null || entity.shouldSendAttribute(attribute.getAttribute().value()))).collect(Collectors.toList()); // Purpur } ++ @Nullable + public AttributeInstance getInstance(Holder attribute) { +- return this.attributes.computeIfAbsent(attribute, attributex -> this.supplier.createInstance(this::onAttributeModified, attributex)); ++ return this.attributes.computeIfAbsent(attribute, this.createInstance); // Pufferfish - cache lambda, as for some reason java allocates it anyways + } + + public boolean hasAttribute(Holder attribute) { diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java b/src/main/java/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java -index 386f9bca728055f7b75fb690b307ff4510068105..157fe8979c780300b6f72cbaa17729031e3b386d 100644 +index 386f9bca728055f7b75fb690b307ff4510068105..0bb08af954d224a2b4404615bee720ac4bdbac55 100644 --- a/src/main/java/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java +++ b/src/main/java/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java @@ -130,7 +130,7 @@ public class DefaultAttributes { @@ -5009,6 +4813,15 @@ index 386f9bca728055f7b75fb690b307ff4510068105..157fe8979c780300b6f72cbaa1772903 .put(EntityType.PIG, Pig.createAttributes().build()) .put(EntityType.PIGLIN, Piglin.createAttributes().build()) .put(EntityType.PIGLIN_BRUTE, PiglinBrute.createAttributes().build()) +@@ -161,7 +161,7 @@ public class DefaultAttributes { + .put(EntityType.VILLAGER, Villager.createAttributes().build()) + .put(EntityType.VINDICATOR, Vindicator.createAttributes().build()) + .put(EntityType.WARDEN, Warden.createAttributes().build()) +- .put(EntityType.WANDERING_TRADER, Mob.createMobAttributes().build()) ++ .put(EntityType.WANDERING_TRADER, net.minecraft.world.entity.npc.WanderingTrader.createAttributes().build()) // Purpur + .put(EntityType.WITCH, Witch.createAttributes().build()) + .put(EntityType.WITHER, WitherBoss.createAttributes().build()) + .put(EntityType.WITHER_SKELETON, AbstractSkeleton.createAttributes().build()) diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/RangedAttribute.java b/src/main/java/net/minecraft/world/entity/ai/attributes/RangedAttribute.java index f0703302e7dbbda88de8c648d20d87c55ed9b1e0..a913ebabaa5f443afa987b972355a8f8d1723c78 100644 --- a/src/main/java/net/minecraft/world/entity/ai/attributes/RangedAttribute.java @@ -5035,7 +4848,7 @@ index e1b6fe9ecda25f86431baf414f1bfd3a26a8b2bd..3d7578605812021bc84b99d4db1672a6 // Paper end - optimise POI access Path path = findPathToPois(entity, set); diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java b/src/main/java/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java -index 2ade08d1466660ee1787fa97908002ef56389712..8d4e206aa05b95b7bfec5d23496085cf55a3e1de 100644 +index 2ade08d1466660ee1787fa97908002ef56389712..018cc6ff39641157668fca09e64bcddf7d4d3a5c 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java @@ -41,17 +41,19 @@ public class HarvestFarmland extends Behavior { @@ -5050,7 +4863,7 @@ index 2ade08d1466660ee1787fa97908002ef56389712..8d4e206aa05b95b7bfec5d23496085cf protected boolean checkExtraStartConditions(ServerLevel world, Villager entity) { - if (!world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ if (!world.purpurConfig.villagerBypassMobGriefing && !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur ++ if (!world.purpurConfig.villagerBypassMobGriefing == !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur return false; - } else if (entity.getVillagerData().getProfession() != VillagerProfession.FARMER) { + } else if (entity.getVillagerData().getProfession() != VillagerProfession.FARMER && !(world.purpurConfig.villagerClericsFarmWarts && entity.getVillagerData().getProfession() == VillagerProfession.CLERIC)) { // Purpur @@ -5197,6 +5010,23 @@ index 0a608418f87b71d5d71706712e1f82da0d7e4d34..03e7ca83e4c28dfaa5b52bcb100bd542 world.addFreshEntityWithPassengers(entityvillager2, CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit end world.broadcastEntityEvent(entityvillager2, (byte) 12); +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java b/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java +index 758f62416ca9c02351348ac0d41deeb4624abc0e..69130969c9a434ec2361e573c9a1ec9f462dfda2 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java +@@ -36,7 +36,11 @@ public class VillagerPanicTrigger extends Behavior { + + @Override + protected void tick(ServerLevel world, Villager entity, long time) { +- if (time % 100L == 0L) { ++ // Pufferfish start ++ if (entity.nextGolemPanic < 0) entity.nextGolemPanic = time + 100; ++ if (--entity.nextGolemPanic < time) { ++ entity.nextGolemPanic = -1; ++ // Pufferfish end + entity.spawnGolemIfNeeded(world, time, 3); + } + } diff --git a/src/main/java/net/minecraft/world/entity/ai/control/MoveControl.java b/src/main/java/net/minecraft/world/entity/ai/control/MoveControl.java index c8fd5696de7c3623cdb4f498190a5c2708cf843e..e403d9dfeeaa3dcf53be790d761e7e922419efb0 100644 --- a/src/main/java/net/minecraft/world/entity/ai/control/MoveControl.java @@ -5245,7 +5075,7 @@ index fbfc2f2515ad709b2c1212aef9521e795547d66b..e77bd11af62682d5eca41f6c9e1aed30 this.lookAtCooldown--; this.getYRotD().ifPresent(yaw -> this.mob.yHeadRot = this.rotateTowards(this.mob.yHeadRot, yaw + 20.0F, this.yMaxRotSpeed)); diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java -index 7324da6b7dd2623ce394e3827ff77ef684a3b98b..4b7cfca51ced0f781561ecd68484de4adb23e082 100644 +index 7324da6b7dd2623ce394e3827ff77ef684a3b98b..d0ba8f74cd0d676640776c46df1913852f4a4a2e 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java @@ -33,7 +33,7 @@ public class BreakDoorGoal extends DoorInteractGoal { @@ -5253,12 +5083,12 @@ index 7324da6b7dd2623ce394e3827ff77ef684a3b98b..4b7cfca51ced0f781561ecd68484de4a @Override public boolean canUse() { - return !super.canUse() ? false : (!getServerLevel((Entity) this.mob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? false : this.isValidDifficulty(this.mob.level().getDifficulty()) && !this.isOpen()); -+ return !super.canUse() ? false : ((!this.mob.level().purpurConfig.zombieBypassMobGriefing && !getServerLevel((Entity) this.mob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) ? false : this.isValidDifficulty(this.mob.level().getDifficulty()) && !this.isOpen()); // Purpur ++ return !super.canUse() ? false : (!this.mob.level().purpurConfig.zombieBypassMobGriefing == !getServerLevel((Entity) this.mob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? false : this.isValidDifficulty(this.mob.level().getDifficulty()) && !this.isOpen()); // Purpur } @Override diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java -index 32bb591371fe78ba10a2bc52389ef33978cbc0eb..f3697510974be0c3cfdb0e2179d89c8109152829 100644 +index 32bb591371fe78ba10a2bc52389ef33978cbc0eb..13f5e5c199688954c263b9e3397e02c9f77bbb92 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java @@ -74,7 +74,7 @@ public class EatBlockGoal extends Goal { @@ -5266,7 +5096,7 @@ index 32bb591371fe78ba10a2bc52389ef33978cbc0eb..f3697510974be0c3cfdb0e2179d89c81 final BlockState blockState = this.level.getBlockState(blockposition); // Paper - fix wrong block state if (EatBlockGoal.IS_TALL_GRASS.test(blockState)) { // Paper - fix wrong block state - if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, blockState.getFluidState().createLegacyBlock(), !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - fix wrong block state -+ if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, blockState.getFluidState().createLegacyBlock(), !getServerLevel(this.level).purpurConfig.sheepBypassMobGriefing && !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - fix wrong block state // Purpur ++ if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, blockState.getFluidState().createLegacyBlock(), !getServerLevel(this.level).purpurConfig.sheepBypassMobGriefing == !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - fix wrong block state // Purpur this.level.destroyBlock(blockposition, false); } @@ -5275,62 +5105,29 @@ index 32bb591371fe78ba10a2bc52389ef33978cbc0eb..f3697510974be0c3cfdb0e2179d89c81 if (this.level.getBlockState(blockposition1).is(Blocks.GRASS_BLOCK)) { - if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.DIRT.defaultBlockState(), !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - Fix wrong block state -+ if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.DIRT.defaultBlockState(), !getServerLevel(this.level).purpurConfig.sheepBypassMobGriefing && !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - Fix wrong block state // Purpur ++ if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.DIRT.defaultBlockState(), !getServerLevel(this.level).purpurConfig.sheepBypassMobGriefing == !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - Fix wrong block state // Purpur this.level.levelEvent(2001, blockposition1, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState())); this.level.setBlock(blockposition1, Blocks.DIRT.defaultBlockState(), 2); } diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -index 29ae74339a4831ccef3d01e8054931715ba192ad..74c5914bc51cff128d4b86853316e5e51e02b416 100644 +index 29ae74339a4831ccef3d01e8054931715ba192ad..5a439e3b0fdc1010884634c1e046e49d8b9aee17 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -@@ -82,8 +82,8 @@ public class GoalSelector { +@@ -38,9 +38,12 @@ public class GoalSelector { } - public void tick() { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("goalCleanup"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur -+ //profilerFiller.push("goalCleanup"); // Purpur - - for (WrappedGoal wrappedGoal : this.availableGoals) { - if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { // Paper - Perf: optimize goal types by removing streams -@@ -92,8 +92,8 @@ public class GoalSelector { - } - - this.lockedFlags.entrySet().removeIf(entry -> !entry.getValue().isRunning()); -- profilerFiller.pop(); -- profilerFiller.push("goalUpdate"); -+ //profilerFiller.pop(); // Purpur -+ //profilerFiller.push("goalUpdate"); // Purpur - - for (WrappedGoal wrappedGoal2 : this.availableGoals) { - // Paper start -@@ -113,13 +113,13 @@ public class GoalSelector { - } - } - -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Purpur - this.tickRunningGoals(true); + // Paper start - EAR 2 +- public boolean inactiveTick() { ++ public boolean inactiveTick(int tickRate, boolean inactive) { // Pufferfish start ++ if (inactive && !gg.pufferfish.pufferfish.PufferfishConfig.dearEnabled) tickRate = 4; // reset to Paper's ++ tickRate = Math.min(tickRate, 3); + this.curRate++; +- return this.curRate % 3 == 0; // TODO newGoalRate was already unused in 1.20.4, check if this is correct ++ return this.curRate % tickRate == 0; // TODO newGoalRate was already unused in 1.20.4, check if this is correct ++ // Pufferfish end } - - public void tickRunningGoals(boolean tickAll) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("goalTick"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur -+ //profilerFiller.push("goalTick"); // Purpur - - for (WrappedGoal wrappedGoal : this.availableGoals) { - if (wrappedGoal.isRunning() && (tickAll || wrappedGoal.requiresUpdateEveryTick())) { -@@ -127,7 +127,7 @@ public class GoalSelector { - } - } - -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Purpur - } - - public Set getAvailableGoals() { + public boolean hasTasks() { + for (WrappedGoal task : this.availableGoals) { diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/LlamaFollowCaravanGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/LlamaFollowCaravanGoal.java index df695b444fa2a993d381e2f197182c3e91a68502..0f4f546cd0eda4bd82b47446ae23ac32da8a9556 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/LlamaFollowCaravanGoal.java @@ -5351,6 +5148,18 @@ index df695b444fa2a993d381e2f197182c3e91a68502..0f4f546cd0eda4bd82b47446ae23ac32 if (this.llama.inCaravan() && this.llama.getCaravanHead().isAlive() && this.firstIsLeashed(this.llama, 0)) { double d = this.llama.distanceToSqr(this.llama.getCaravanHead()); if (d > 676.0) { +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java +index aee0147649d458b87d92496eda0c1723ebe570d2..89e9ea999d2fbd81a1d74382ef3fcd675fc8b94e 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java +@@ -121,6 +121,7 @@ public abstract class MoveToBlockGoal extends Goal { + for (int m = 0; m <= l; m = m > 0 ? -m : 1 - m) { + for (int n = m < l && m > -l ? l : 0; n <= l; n = n > 0 ? -n : 1 - n) { + mutableBlockPos.setWithOffset(blockPos, m, k - 1, n); ++ if (!this.mob.level().hasChunkAt(mutableBlockPos)) continue; // Pufferfish - if this block isn't loaded, continue + if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) { + this.blockPos = mutableBlockPos; + this.mob.movingTarget = mutableBlockPos == BlockPos.ZERO ? null : mutableBlockPos.immutable(); // Paper diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java index 515c1f671cb2c3a7cc23053aedf404bbbe77af3e..42a1e5b9c08a9245dd0ce6d4025e3bb5d60feb62 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java @@ -5368,7 +5177,7 @@ index 515c1f671cb2c3a7cc23053aedf404bbbe77af3e..42a1e5b9c08a9245dd0ce6d4025e3bb5 if (this.mob.isUsingItem()) { if (!bl && this.seeTime < -60) { diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java -index 9d245d08be61d7edee9138196ae3bf52023e3993..d002acdac893e2744cde5f1145d29ac2c8ff6959 100644 +index 9d245d08be61d7edee9138196ae3bf52023e3993..771bb96032149a8573d1de14fa2ab19012c82000 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java @@ -41,7 +41,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal { @@ -5376,7 +5185,7 @@ index 9d245d08be61d7edee9138196ae3bf52023e3993..d002acdac893e2744cde5f1145d29ac2 @Override public boolean canUse() { - if (!getServerLevel((Entity) this.removerMob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ if (!getServerLevel((Entity) this.removerMob).purpurConfig.zombieBypassMobGriefing && !getServerLevel((Entity) this.removerMob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur ++ if (!getServerLevel(this.removerMob).purpurConfig.zombieBypassMobGriefing == !getServerLevel((Entity) this.removerMob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur return false; } else if (this.nextStartTick > 0) { --this.nextStartTick; @@ -5425,27 +5234,6 @@ index 84ab90dd1fe693da71732533ccff940c1007e1b6..179fdf7b7f68db610925a9d7b8887928 } @Override -diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index 48c0de870a5bbf647309e69361dfb10ab56c65ab..a5289b6c453c24cb7b8b3a301b72c3adf92c1d13 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -188,13 +188,13 @@ public abstract class PathNavigation { - } - } - // Paper end - EntityPathfindEvent -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("pathfind"); -+ //ProfilerFiller profilerFiller = Profiler.get(); -+ //profilerFiller.push("pathfind"); // Purpur - BlockPos blockPos = useHeadPos ? this.mob.blockPosition().above() : this.mob.blockPosition(); - int i = (int)(followRange + (float)range); - PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i)); - Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, positions, followRange, distance, this.maxVisitedNodesMultiplier); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Purpur - if (path != null && path.getTarget() != null) { - this.targetPos = path.getTarget(); - this.reachRange = distance; diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java index 92731b6b593289e9f583c9b705b219e81fcd8e73..9104d7010bda6f9f73b478c11490ef9c53f76da2 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java @@ -5486,24 +5274,6 @@ index a0e0692d17760f440fe81d52887284c787e562db..ab9bebc07b5228dbc0d3ba4b0f7d1bbe if (!list.isEmpty()) { brain.setMemory(MemoryModuleType.SECONDARY_JOB_SITE, list); } else { -diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java -index 116b1e251ffe68bae5c404d0823c2bc7c1afddf6..8f5a5db1a07fa6a95ecfacaab2f9de609202faf4 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java -+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java -@@ -28,10 +28,10 @@ public class Sensing { - } else if (this.unseen.contains(i)) { - return false; - } else { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("hasLineOfSight"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur -+ //profilerFiller.push("hasLineOfSight"); // Purpur - boolean bl = this.mob.hasLineOfSight(entity); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Purpur - if (bl) { - this.seen.add(i); - } else { diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java index 52982c1e6a4da36392569c791853279f5f9ac31a..b3d4c61b1769b6fcc98b7af854f774d24bf39d98 100644 --- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java @@ -5520,7 +5290,7 @@ index 52982c1e6a4da36392569c791853279f5f9ac31a..b3d4c61b1769b6fcc98b7af854f774d2 if (tester == null) { if (this.isCombat && (!target.canBeSeenAsEnemy() || world.getDifficulty() == Difficulty.PEACEFUL)) { diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java -index 60c2868f255d372226e0c1389caaa5477bbef41e..2d4fe19da8d53d47df36399531e78da2c961aecd 100644 +index 60c2868f255d372226e0c1389caaa5477bbef41e..c8ffbbccbf20ce911a3d75fa860d5a1452c5e590 100644 --- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java +++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java @@ -47,12 +47,59 @@ public class Bat extends AmbientCreature { @@ -5646,7 +5416,7 @@ index 60c2868f255d372226e0c1389caaa5477bbef41e..2d4fe19da8d53d47df36399531e78da2 b0 = 7; } else if (random.nextBoolean()) { return false; -@@ -242,6 +320,11 @@ public class Bat extends AmbientCreature { +@@ -242,13 +320,23 @@ public class Bat extends AmbientCreature { } } @@ -5656,8 +5426,21 @@ index 60c2868f255d372226e0c1389caaa5477bbef41e..2d4fe19da8d53d47df36399531e78da2 + private static int lastSpookyCheck = -ONE_HOUR; + public static boolean isHalloweenSeason(Level level) { return level.purpurConfig.forceHalloweenSeason || isHalloween(); } // Purpur private static boolean isHalloween() { ++ if (net.minecraft.server.MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) { LocalDate localdate = LocalDate.now(); int i = localdate.get(ChronoField.DAY_OF_MONTH); + int j = localdate.get(ChronoField.MONTH_OF_YEAR); + +- return j == 10 && i >= 20 || j == 11 && i <= 3; ++ isSpookySeason = j == 10 && i >= 20 || j == 11 && i <= 3; ++ lastSpookyCheck = net.minecraft.server.MinecraftServer.currentTick; ++ } ++ return isSpookySeason; + } ++ // Pufferfish end + + private void setupAnimationStates() { + if (this.isResting()) { diff --git a/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java b/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java index 9aedc62b1766f6a7db4da7eba55167d21d698791..9708ed3e00059fdf5d1d60e0c607d0ab153d1d3f 100644 --- a/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java @@ -6533,7 +6316,7 @@ index 5af4d590a9b0f17ba53c6959d9c18bd1269878a4..c1842894f96a567707992d8ff938dbf6 } diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java -index a9a8ebb2cebe668628d5bdb33fa1399e0ab1e08b..0e229955d9ea7036fab124fa7685df22280671f2 100644 +index a9a8ebb2cebe668628d5bdb33fa1399e0ab1e08b..ac044be03494c3d6bad6bbc22321445e04d430cc 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Fox.java +++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java @@ -144,6 +144,65 @@ public class Fox extends Animal implements VariantHolder { @@ -6726,7 +6509,7 @@ index a9a8ebb2cebe668628d5bdb33fa1399e0ab1e08b..0e229955d9ea7036fab124fa7685df22 protected void onReachedTarget() { - if (getServerLevel(Fox.this.level()).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ if (getServerLevel(Fox.this.level()).purpurConfig.foxBypassMobGriefing || getServerLevel(Fox.this.level()).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur ++ if (getServerLevel(Fox.this.level()).purpurConfig.foxBypassMobGriefing ^ getServerLevel(Fox.this.level()).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur BlockState iblockdata = Fox.this.level().getBlockState(this.blockPos); if (iblockdata.is(Blocks.SWEET_BERRY_BUSH)) { @@ -6841,7 +6624,7 @@ index e07b79ef172095c1800c88342b3ac8dc7703aea2..9a6471d2f1eb1c8af006b70b6bba0b66 } } diff --git a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java -index feeb7bc34ae02e44d7f13f0bae5d175ef924c53a..529b1bef6abcecdd2c08afafc6548aeee7db9203 100644 +index eea02ea0d99425a60575f5fa729782494d579080..6cbe80e13a590817d3ecf27d89202f10e2cd83dc 100644 --- a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java +++ b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java @@ -65,6 +65,43 @@ public class MushroomCow extends Cow implements Shearable, VariantHolder { - for (final ItemStack drop : drops) { + drops.forEach(drop -> { + ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY(1.0D), this.getZ(), drop); diff --git a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java index 0554ee499c452db6c1e6852f5022b1f197adb024..dee59cb4b87845c940ee089aa932aa69dd2539d6 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java @@ -7523,7 +7306,7 @@ index cdb74f86ee92ee143af29962a85d45ca585cee44..c5a39ea2ad0e5e5ac434d79c1a57e006 protected void defineSynchedData(SynchedEntityData.Builder builder) { super.defineSynchedData(builder); diff --git a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java -index 8cc6022507c97af62fb2b4455198bc35744137c9..d8fa11a297ea2a183cac67c76b378ca912dba1f9 100644 +index 8cc6022507c97af62fb2b4455198bc35744137c9..b3a0146ccfcda9fa33b91d33458086b510bb4d7b 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java +++ b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java @@ -88,6 +88,7 @@ public class Rabbit extends Animal implements VariantHolder { @@ -7694,7 +7477,7 @@ index 8cc6022507c97af62fb2b4455198bc35744137c9..d8fa11a297ea2a183cac67c76b378ca9 public boolean canUse() { if (this.nextStartTick <= 0) { - if (!getServerLevel((Entity) this.rabbit).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ if (!getServerLevel((Entity) this.rabbit).purpurConfig.rabbitBypassMobGriefing && !getServerLevel((Entity) this.rabbit).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur ++ if (!getServerLevel((Entity) this.rabbit).purpurConfig.rabbitBypassMobGriefing == !getServerLevel((Entity) this.rabbit).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur return false; } @@ -7737,7 +7520,7 @@ index 661997c39df777b6e332f0a5710e7f63a116a499..1a0c71ed6f3bd3d961f9b30ab29a62d6 public int getMaxSchoolSize() { return 5; diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java -index 432ad1c785e133ef18390108fd342be50ec4dddc..a13ce089bacfb6644eea81fbe7c6d640aedaea96 100644 +index 0b7f8b8d8cd119d83e67a2cee389bd6117ac4cf7..38f651ab5f8e25e6d653a86dcb9875990651542a 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java +++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java @@ -91,10 +91,49 @@ public class Sheep extends Animal implements Shearable { @@ -7791,7 +7574,7 @@ index 432ad1c785e133ef18390108fd342be50ec4dddc..a13ce089bacfb6644eea81fbe7c6d640 this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D)); this.goalSelector.addGoal(3, new TemptGoal(this, 1.1D, (itemstack) -> { diff --git a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java -index fd9f6c17448a4d87f940eb8f544ecb9669068582..d6dd771a868bdf012b6095e333ebb12fc6050478 100644 +index fd9f6c17448a4d87f940eb8f544ecb9669068582..13eecc676e33623e776d32495969f111bf6c0e44 100644 --- a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java +++ b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java @@ -50,17 +50,57 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM @@ -7881,7 +7664,7 @@ index fd9f6c17448a4d87f940eb8f544ecb9669068582..d6dd771a868bdf012b6095e333ebb12f } - if (!worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ if (!worldserver.purpurConfig.snowGolemBypassMobGriefing && !worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur ++ if (!worldserver.purpurConfig.snowGolemBypassMobGriefing == !worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur return; } @@ -8183,7 +7966,7 @@ index 8c4532a250f8679d729a35c17e9b5bd339264450..2b8336bd88641cfb29e94c8f01abfbdb } } diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java -index fc19bd326f00d1e8bd08ef6cc430c555337a6e3d..499e3294f8dd19fb3802f521cb7d24d0998c8aeb 100644 +index fb84ee1225cd762ef306d1fc3e1baed42c034a3c..420345f130a40c4f59a021a4bdce3e218dc87cde 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java +++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java @@ -103,6 +103,37 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder brainProvider() { return Brain.provider(Allay.MEMORY_TYPES, Allay.SENSOR_TYPES); -@@ -221,14 +262,15 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS - - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("allayBrain"); -+ //gameprofilerfiller.push("allayBrain"); // Purpur -+ //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Purpur - TODO: Pufferfish - this.getBrain().tick(world, this); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("allayActivityUpdate"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("allayActivityUpdate"); // Purpur - AllayAi.updateActivity(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - super.customServerAiStep(world); +@@ -219,11 +260,13 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS + return 0.4F; } ++ private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep(ServerLevel world) { + ProfilerFiller gameprofilerfiller = Profiler.get(); + + gameprofilerfiller.push("allayBrain"); ++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider + this.getBrain().tick(world, this); + gameprofilerfiller.pop(); + gameprofilerfiller.push("allayActivityUpdate"); diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java -index c1ef714096159608752d744b98f615cd45fe459a..84516dcfc6cd0fe16c26538ccb86fb5c85b44ffa 100644 +index c1ef714096159608752d744b98f615cd45fe459a..9ef53608f1608e88de7a7b3e96b43d8d2b4230ae 100644 --- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java +++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java @@ -82,6 +82,34 @@ public class Armadillo extends Animal { @@ -8523,28 +8299,8 @@ index c1ef714096159608752d744b98f615cd45fe459a..84516dcfc6cd0fe16c26538ccb86fb5c @Override protected void defineSynchedData(SynchedEntityData.Builder builder) { super.defineSynchedData(builder); -@@ -135,14 +163,14 @@ public class Armadillo extends Animal { - - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("armadilloBrain"); -+ //gameprofilerfiller.push("armadilloBrain"); // Purpur - ((Brain) this.brain).tick(world, this); // CraftBukkit - decompile error -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("armadilloActivityUpdate"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("armadilloActivityUpdate"); // Purpur - ArmadilloAi.updateActivity(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) { - this.forceDrops = true; // CraftBukkit - if (this.dropFromGiftLootTable(world, BuiltInLootTables.ARMADILLO_SHED, this::spawnAtLocation)) { diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index 31b10cd404b672d7ce21c2107d8f83e32de26ef4..c80d74caa393a31e09f2776cdb3cb950ef99e2ef 100644 +index 31b10cd404b672d7ce21c2107d8f83e32de26ef4..155f03818d91dbd4ef9f5549784472f2bffca5d8 100644 --- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java @@ -100,6 +100,44 @@ public class Axolotl extends Animal implements VariantHolder, B @@ -8592,28 +8348,21 @@ index 31b10cd404b672d7ce21c2107d8f83e32de26ef4..c80d74caa393a31e09f2776cdb3cb950 @Override public float getWalkTargetValue(BlockPos pos, LevelReader world) { return 0.0F; -@@ -294,14 +332,15 @@ public class Axolotl extends Animal implements VariantHolder, B +@@ -292,11 +330,13 @@ public class Axolotl extends Animal implements VariantHolder, B + return true; + } ++ private int behaviorTick = 0; // Pufferfish @Override protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + ProfilerFiller gameprofilerfiller = Profiler.get(); -- gameprofilerfiller.push("axolotlBrain"); -+ //gameprofilerfiller.push("axolotlBrain"); // Purpur -+ //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Purpur - TODO: Pufferfish + gameprofilerfiller.push("axolotlBrain"); ++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider this.getBrain().tick(world, this); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("axolotlActivityUpdate"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("axolotlActivityUpdate"); // Purpur - AxolotlAi.updateActivity(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - if (!this.isNoAi()) { - Optional optional = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS); - -@@ -520,14 +559,22 @@ public class Axolotl extends Animal implements VariantHolder, B + gameprofilerfiller.pop(); + gameprofilerfiller.push("axolotlActivityUpdate"); +@@ -520,14 +560,22 @@ public class Axolotl extends Animal implements VariantHolder, B private static class AxolotlMoveControl extends SmoothSwimmingMoveControl { private final Axolotl axolotl; @@ -8636,7 +8385,7 @@ index 31b10cd404b672d7ce21c2107d8f83e32de26ef4..c80d74caa393a31e09f2776cdb3cb950 if (!this.axolotl.isPlayingDead()) { super.tick(); } -@@ -542,9 +589,9 @@ public class Axolotl extends Animal implements VariantHolder, B +@@ -542,9 +590,9 @@ public class Axolotl extends Animal implements VariantHolder, B } @Override @@ -8649,7 +8398,7 @@ index 31b10cd404b672d7ce21c2107d8f83e32de26ef4..c80d74caa393a31e09f2776cdb3cb950 } diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -index f3c884ab9c09f04dd01cabf2ee9de3b5b620563d..56d97225a909fd55f0d8aec992d5b6d42687c948 100644 +index f3c884ab9c09f04dd01cabf2ee9de3b5b620563d..dbce71f45c008da883b6d244a06343d83ae25e7e 100644 --- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java @@ -87,6 +87,17 @@ public class Camel extends AbstractHorse { @@ -8670,28 +8419,6 @@ index f3c884ab9c09f04dd01cabf2ee9de3b5b620563d..56d97225a909fd55f0d8aec992d5b6d4 @Override public void addAdditionalSaveData(CompoundTag nbt) { super.addAdditionalSaveData(nbt); -@@ -143,16 +154,16 @@ public class Camel extends AbstractHorse { - - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("camelBrain"); -+ //gameprofilerfiller.push("camelBrain"); // Purpur - Brain behaviorcontroller = (Brain) this.getBrain(); // CraftBukkit - decompile error - - behaviorcontroller.tick(world, this); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("camelActivityUpdate"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("camelActivityUpdate"); // Purpur - CamelAi.updateActivity(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - super.customServerAiStep(world); - } - @@ -314,6 +325,23 @@ public class Camel extends AbstractHorse { return this.dashCooldown; } @@ -8717,7 +8444,7 @@ index f3c884ab9c09f04dd01cabf2ee9de3b5b620563d..56d97225a909fd55f0d8aec992d5b6d4 protected SoundEvent getAmbientSound() { return SoundEvents.CAMEL_AMBIENT; diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -index 36846ba6b6c7494c745ebd8b221479a9d02ff318..501a12398c56fe0df4e76a3bbce0f98c6c5aa6cb 100644 +index 36846ba6b6c7494c745ebd8b221479a9d02ff318..02581f47d1ca58c2b8abffc478adf48343585c8b 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java @@ -106,6 +106,8 @@ public class Frog extends Animal implements VariantHolder> { @@ -8788,27 +8515,20 @@ index 36846ba6b6c7494c745ebd8b221479a9d02ff318..501a12398c56fe0df4e76a3bbce0f98c } @Override -@@ -186,13 +240,14 @@ public class Frog extends Animal implements VariantHolder> { - - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("frogBrain"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur -+ //profilerFiller.push("frogBrain"); // Purpur -+ //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Purpur - TODO: Pufferfish - this.getBrain().tick(world, this); -- profilerFiller.pop(); -- profilerFiller.push("frogActivityUpdate"); -+ //profilerFiller.pop(); // Purpur -+ //profilerFiller.push("frogActivityUpdate"); // Purpur - FrogAi.updateActivity(this); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Purpur - super.customServerAiStep(world); +@@ -184,10 +238,12 @@ public class Frog extends Animal implements VariantHolder> { + .ifPresent(this::setVariant); } -@@ -384,7 +439,7 @@ public class Frog extends Animal implements VariantHolder> { ++ private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep(ServerLevel world) { + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("frogBrain"); ++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider + this.getBrain().tick(world, this); + profilerFiller.pop(); + profilerFiller.push("frogActivityUpdate"); +@@ -384,7 +440,7 @@ public class Frog extends Animal implements VariantHolder> { return world.getBlockState(pos.below()).is(BlockTags.FROGS_SPAWNABLE_ON) && isBrightEnoughToSpawn(world, pos); } @@ -8818,7 +8538,7 @@ index 36846ba6b6c7494c745ebd8b221479a9d02ff318..501a12398c56fe0df4e76a3bbce0f98c super(entity); } diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java -index 48ac8c3f6e00c3c2dc67b6c994be7c0ac6dfcf81..071d14cc6697587ec14f02c69c78df364e7d8a8f 100644 +index 48ac8c3f6e00c3c2dc67b6c994be7c0ac6dfcf81..7e92e8c4fec36c8838604f17cf366cc80e82b19b 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java @@ -51,13 +51,50 @@ public class Tadpole extends AbstractFish { @@ -8873,29 +8593,22 @@ index 48ac8c3f6e00c3c2dc67b6c994be7c0ac6dfcf81..071d14cc6697587ec14f02c69c78df36 @Override protected PathNavigation createNavigation(Level world) { return new WaterBoundPathNavigation(this, world); -@@ -85,14 +122,15 @@ public class Tadpole extends AbstractFish { - - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); - -- gameprofilerfiller.push("tadpoleBrain"); -+ //gameprofilerfiller.push("tadpoleBrain"); // Purpur -+ //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // // Purpur - TODO: Pufferfish - this.getBrain().tick(world, this); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("tadpoleActivityUpdate"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("tadpoleActivityUpdate"); // Purpur - TadpoleAi.updateActivity(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - super.customServerAiStep(world); +@@ -83,11 +120,13 @@ public class Tadpole extends AbstractFish { + return SoundEvents.TADPOLE_FLOP; } ++ private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep(ServerLevel world) { + ProfilerFiller gameprofilerfiller = Profiler.get(); + + gameprofilerfiller.push("tadpoleBrain"); ++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider + this.getBrain().tick(world, this); + gameprofilerfiller.pop(); + gameprofilerfiller.push("tadpoleActivityUpdate"); diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -index 76aca47d8638d5c37c57d3a59fa7f8ceaa5a53b4..ebf53d48b09918c7453f982a5e4f9a1584dfc544 100644 +index 76aca47d8638d5c37c57d3a59fa7f8ceaa5a53b4..d508cb2a61866c8fd7f381f8deb558ed86f7c845 100644 --- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java @@ -93,6 +93,38 @@ public class Goat extends Animal { @@ -8937,28 +8650,21 @@ index 76aca47d8638d5c37c57d3a59fa7f8ceaa5a53b4..ebf53d48b09918c7453f982a5e4f9a15 @Override protected Brain.Provider brainProvider() { return Brain.provider(Goat.MEMORY_TYPES, Goat.SENSOR_TYPES); -@@ -194,14 +226,15 @@ public class Goat extends Animal { - - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("goatBrain"); -+ //gameprofilerfiller.push("goatBrain"); // Purpur -+ //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Purpur - TODO: Pufferfish - this.getBrain().tick(world, this); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("goatActivityUpdate"); -+ //gameprofilerfiller.pop(); // Purpur -+ //gameprofilerfiller.push("goatActivityUpdate"); // Purpur - GoatAi.updateActivity(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - super.customServerAiStep(world); +@@ -192,11 +224,13 @@ public class Goat extends Animal { + return (Brain) super.getBrain(); // CraftBukkit - decompile error } -@@ -399,6 +432,7 @@ public class Goat extends Animal { ++ private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep(ServerLevel world) { + ProfilerFiller gameprofilerfiller = Profiler.get(); + + gameprofilerfiller.push("goatBrain"); ++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider + this.getBrain().tick(world, this); + gameprofilerfiller.pop(); + gameprofilerfiller.push("goatActivityUpdate"); +@@ -399,6 +433,7 @@ public class Goat extends Animal { // Paper start - Goat ram API public void ram(net.minecraft.world.entity.LivingEntity entity) { @@ -9512,7 +9218,7 @@ index e89638fc9c87b555651813f615b0ccba10d2a9d0..2b7b0d766ceba4b2261be2d8308170ae @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -index af2f6e690fc51d319b77d081466c2dc7a1d8fe19..3fb4f12095883ea4ec6e0d60e0600b9de6ed7be2 100644 +index af2f6e690fc51d319b77d081466c2dc7a1d8fe19..464a16df15d8759d66f94ad080d1ea28b3f6474c 100644 --- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java @@ -90,6 +90,34 @@ public class Sniffer extends Animal { @@ -9550,24 +9256,6 @@ index af2f6e690fc51d319b77d081466c2dc7a1d8fe19..3fb4f12095883ea4ec6e0d60e0600b9d @Override protected void defineSynchedData(SynchedEntityData.Builder builder) { super.defineSynchedData(builder); -@@ -467,13 +495,13 @@ public class Sniffer extends Animal { - - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("snifferBrain"); -+ //gameprofilerfiller.push("snifferBrain"); // Purpur - this.getBrain().tick(world, this); -- gameprofilerfiller.popPush("snifferActivityUpdate"); -+ //gameprofilerfiller.popPush("snifferActivityUpdate"); // Purpur - SnifferAi.updateActivity(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - super.customServerAiStep(world); - } - diff --git a/src/main/java/net/minecraft/world/entity/boss/EnderDragonPart.java b/src/main/java/net/minecraft/world/entity/boss/EnderDragonPart.java index 58f303ce22cba0840a577b09ec5c32b13717fa15..a8830f8434d7c9d1a15ddd403d1ea1dbe530ce54 100644 --- a/src/main/java/net/minecraft/world/entity/boss/EnderDragonPart.java @@ -9701,7 +9389,7 @@ index 7cb3d69a69e0e3ef4b7f9f9c8b1eb67edb5d116d..b1db1e92de3a88a0f0e0fdb42b0bf973 this.remove(Entity.RemovalReason.KILLED, EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause } diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -index 2df8bf818345246cc1f88b93e4a3b62e61772efb..e0e76b5abdb9650c3c50a3c8b49336977982fe67 100644 +index 2df8bf818345246cc1f88b93e4a3b62e61772efb..c9e3bb91ff506a35551a58f469ad2849e6058668 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java @@ -108,6 +108,7 @@ public class EnderDragon extends Mob implements Enemy { @@ -9869,7 +9557,7 @@ index 2df8bf818345246cc1f88b93e4a3b62e61772efb..e0e76b5abdb9650c3c50a3c8b4933697 if (!iblockdata.isAir() && !iblockdata.is(BlockTags.DRAGON_TRANSPARENT)) { - if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is(BlockTags.DRAGON_IMMUNE)) { -+ if ((world.purpurConfig.enderDragonBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && !iblockdata.is(BlockTags.DRAGON_IMMUNE)) { // Purpur ++ if ((world.purpurConfig.enderDragonBypassMobGriefing ^ world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && !iblockdata.is(BlockTags.DRAGON_IMMUNE)) { // Purpur // CraftBukkit start - Add blocks to list rather than destroying them // flag1 = worldserver.removeBlock(blockposition, false) || flag1; flag1 = true; @@ -9899,7 +9587,7 @@ index 2df8bf818345246cc1f88b93e4a3b62e61772efb..e0e76b5abdb9650c3c50a3c8b4933697 } } diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -index 244e38db508efa3eebebb6392c4ebb0805367baf..026e730f67c58caf385070d57a2e199fca966a46 100644 +index 244e38db508efa3eebebb6392c4ebb0805367baf..5e134b3cf939fe396c060797883613812ad73c31 100644 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java @@ -86,20 +86,60 @@ public class WitherBoss extends Monster implements RangedAttackMob { @@ -10095,7 +9783,21 @@ index 244e38db508efa3eebebb6392c4ebb0805367baf..026e730f67c58caf385070d57a2e199f } -@@ -261,6 +404,15 @@ public class WitherBoss extends Monster implements RangedAttackMob { +@@ -152,6 +295,13 @@ public class WitherBoss extends Monster implements RangedAttackMob { + this.bossEvent.setName(this.getDisplayName()); + } + ++ // Pufferfish start - optimize suffocation ++ @Override ++ public boolean shouldCheckForSuffocation() { ++ return true; ++ } ++ // Pufferfish end ++ + @Override + protected SoundEvent getAmbientSound() { + return SoundEvents.WITHER_AMBIENT; +@@ -261,6 +411,15 @@ public class WitherBoss extends Monster implements RangedAttackMob { @Override protected void customServerAiStep(ServerLevel world) { @@ -10111,7 +9813,7 @@ index 244e38db508efa3eebebb6392c4ebb0805367baf..026e730f67c58caf385070d57a2e199f int i; if (this.getInvulnerableTicks() > 0) { -@@ -277,7 +429,7 @@ public class WitherBoss extends Monster implements RangedAttackMob { +@@ -277,7 +436,7 @@ public class WitherBoss extends Monster implements RangedAttackMob { } // CraftBukkit end @@ -10120,7 +9822,7 @@ index 244e38db508efa3eebebb6392c4ebb0805367baf..026e730f67c58caf385070d57a2e199f // CraftBukkit start - Use relative location for far away sounds // worldserver.globalLevelEvent(1023, new BlockPosition(this), 0); int viewDistance = world.getCraftServer().getViewDistance() * 16; -@@ -302,7 +454,7 @@ public class WitherBoss extends Monster implements RangedAttackMob { +@@ -302,7 +461,7 @@ public class WitherBoss extends Monster implements RangedAttackMob { this.setInvulnerableTicks(i); if (this.tickCount % 10 == 0) { @@ -10129,16 +9831,16 @@ index 244e38db508efa3eebebb6392c4ebb0805367baf..026e730f67c58caf385070d57a2e199f } } else { -@@ -362,7 +514,7 @@ public class WitherBoss extends Monster implements RangedAttackMob { +@@ -362,7 +521,7 @@ public class WitherBoss extends Monster implements RangedAttackMob { if (this.destroyBlocksTick > 0) { --this.destroyBlocksTick; - if (this.destroyBlocksTick == 0 && world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ if (this.destroyBlocksTick == 0 && (world.purpurConfig.witherBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // Purpur ++ if (this.destroyBlocksTick == 0 && (world.purpurConfig.witherBypassMobGriefing ^ world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // Purpur boolean flag = false; j = Mth.floor(this.getBbWidth() / 2.0F + 1.0F); -@@ -389,8 +541,10 @@ public class WitherBoss extends Monster implements RangedAttackMob { +@@ -389,8 +548,10 @@ public class WitherBoss extends Monster implements RangedAttackMob { } } @@ -10151,7 +9853,7 @@ index 244e38db508efa3eebebb6392c4ebb0805367baf..026e730f67c58caf385070d57a2e199f } this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth()); -@@ -579,11 +733,11 @@ public class WitherBoss extends Monster implements RangedAttackMob { +@@ -579,11 +740,11 @@ public class WitherBoss extends Monster implements RangedAttackMob { } public int getAlternativeTarget(int headIndex) { @@ -10165,7 +9867,7 @@ index 244e38db508efa3eebebb6392c4ebb0805367baf..026e730f67c58caf385070d57a2e199f } public boolean isPowered() { -@@ -592,6 +746,7 @@ public class WitherBoss extends Monster implements RangedAttackMob { +@@ -592,6 +753,7 @@ public class WitherBoss extends Monster implements RangedAttackMob { @Override protected boolean canRide(Entity entity) { @@ -10561,7 +10263,7 @@ index e33fa82ca1332b95bb067fd621212d3026eee1b7..07db4557ab0d7a4a0f5432257bd18195 if (this.nextHeightOffsetChangeTick <= 0) { this.nextHeightOffsetChangeTick = 100; diff --git a/src/main/java/net/minecraft/world/entity/monster/Bogged.java b/src/main/java/net/minecraft/world/entity/monster/Bogged.java -index 18dae37d65552077aa3825c76f433bbd31152db9..52993da6868161105450491a81f5c32356fa17aa 100644 +index 975477663b6d76a69c006a89e440e21471b39b89..ca63ab37bc6b5b4cb5abf2848dae476b5d937f2a 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Bogged.java +++ b/src/main/java/net/minecraft/world/entity/monster/Bogged.java @@ -44,6 +44,29 @@ public class Bogged extends AbstractSkeleton implements Shearable { @@ -10985,7 +10687,7 @@ index 378694a38115c012978e1fea59d049d1ebd04110..a000304e3ac4c34b020f7457aa2589c8 return Guardian.createAttributes().add(Attributes.MOVEMENT_SPEED, 0.30000001192092896D).add(Attributes.ATTACK_DAMAGE, 8.0D).add(Attributes.MAX_HEALTH, 80.0D); } diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -index 48dcd2bc12ce1d08cc5195bff5460dc0dd9902d3..39ec4b00c6254824632b37ea9824ae9ff84cdb20 100644 +index 48dcd2bc12ce1d08cc5195bff5460dc0dd9902d3..476aaa0d9899eb56ea29b1fcf15565b58f78479d 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java @@ -92,12 +92,41 @@ public class EnderMan extends Monster implements NeutralMob { @@ -11067,7 +10769,27 @@ index 48dcd2bc12ce1d08cc5195bff5460dc0dd9902d3..39ec4b00c6254824632b37ea9824ae9f float f = this.getLightLevelDependentMagicValue(); if (f > 0.5F && world.canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper - EndermanEscapeEvent -@@ -383,6 +413,8 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -307,11 +337,17 @@ public class EnderMan extends Monster implements NeutralMob { + private boolean teleport(double x, double y, double z) { + BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(x, y, z); + +- while (blockposition_mutableblockposition.getY() > this.level().getMinY() && !this.level().getBlockState(blockposition_mutableblockposition).blocksMotion()) { ++ // Pufferfish start - single chunk lookup ++ net.minecraft.world.level.chunk.LevelChunk chunk = this.level().getChunkIfLoaded(blockposition_mutableblockposition); ++ if (chunk == null) { ++ return false; ++ } ++ // Pufferfish end ++ while (blockposition_mutableblockposition.getY() > this.level().getMinY() && !chunk.getBlockState(blockposition_mutableblockposition).blocksMotion()) { // Pufferfish + blockposition_mutableblockposition.move(Direction.DOWN); + } + +- BlockState iblockdata = this.level().getBlockState(blockposition_mutableblockposition); ++ BlockState iblockdata = chunk.getBlockState(blockposition_mutableblockposition); // Pufferfish + boolean flag = iblockdata.blocksMotion(); + boolean flag1 = iblockdata.getFluidState().is(FluidTags.WATER); + +@@ -383,6 +419,8 @@ public class EnderMan extends Monster implements NeutralMob { public boolean hurtServer(ServerLevel world, DamageSource source, float amount) { if (this.isInvulnerableTo(world, source)) { return false; @@ -11076,7 +10798,7 @@ index 48dcd2bc12ce1d08cc5195bff5460dc0dd9902d3..39ec4b00c6254824632b37ea9824ae9f } else { boolean flag = source.getDirectEntity() instanceof ThrownPotion; boolean flag1; -@@ -397,6 +429,7 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -397,6 +435,7 @@ public class EnderMan extends Monster implements NeutralMob { } else { flag1 = flag && this.hurtWithCleanWater(world, source, (ThrownPotion) source.getDirectEntity(), amount); @@ -11084,7 +10806,7 @@ index 48dcd2bc12ce1d08cc5195bff5460dc0dd9902d3..39ec4b00c6254824632b37ea9824ae9f if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper - EndermanEscapeEvent for (int i = 0; i < 64; ++i) { if (this.teleport()) { -@@ -441,7 +474,7 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -441,7 +480,7 @@ public class EnderMan extends Monster implements NeutralMob { @Override public boolean requiresCustomPersistence() { @@ -11093,7 +10815,7 @@ index 48dcd2bc12ce1d08cc5195bff5460dc0dd9902d3..39ec4b00c6254824632b37ea9824ae9f } private static class EndermanFreezeWhenLookedAt extends Goal { -@@ -488,7 +521,16 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -488,7 +527,16 @@ public class EnderMan extends Monster implements NeutralMob { @Override public boolean canUse() { @@ -11103,7 +10825,7 @@ index 48dcd2bc12ce1d08cc5195bff5460dc0dd9902d3..39ec4b00c6254824632b37ea9824ae9f + if (this.enderman.getCarriedBlock() == null) { + return false; + } -+ if (!getServerLevel((Entity) this.enderman).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !this.enderman.level().purpurConfig.endermanBypassMobGriefing) { ++ if (!getServerLevel((Entity) this.enderman).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) == !this.enderman.level().purpurConfig.endermanBypassMobGriefing) { + return false; + } + return this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0; @@ -11111,7 +10833,7 @@ index 48dcd2bc12ce1d08cc5195bff5460dc0dd9902d3..39ec4b00c6254824632b37ea9824ae9f } @Override -@@ -533,7 +575,16 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -533,7 +581,16 @@ public class EnderMan extends Monster implements NeutralMob { @Override public boolean canUse() { @@ -11121,7 +10843,7 @@ index 48dcd2bc12ce1d08cc5195bff5460dc0dd9902d3..39ec4b00c6254824632b37ea9824ae9f + if (this.enderman.getCarriedBlock() != null) { + return false; + } -+ if (!getServerLevel((Entity) this.enderman).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !this.enderman.level().purpurConfig.endermanBypassMobGriefing) { ++ if (!getServerLevel((Entity) this.enderman).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) == !this.enderman.level().purpurConfig.endermanBypassMobGriefing) { + return false; + } + return this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0; @@ -11214,7 +10936,7 @@ index 534e98dd7291e09dee1d0f77cbf221b15708590f..f8373fc9839fccb31e3dd090de70e2cd @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/Evoker.java b/src/main/java/net/minecraft/world/entity/monster/Evoker.java -index 6592baa53ecb4e364d1c1b6f64178fc86c59a982..732fa9c2bf22e488ba531c0f9fd2a7e08468ff63 100644 +index 6592baa53ecb4e364d1c1b6f64178fc86c59a982..e231bb33b7e6a00d7c1a6c3540b4b48cfd4c15e3 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Evoker.java +++ b/src/main/java/net/minecraft/world/entity/monster/Evoker.java @@ -53,10 +53,44 @@ public class Evoker extends SpellcasterIllager { @@ -11275,7 +10997,7 @@ index 6592baa53ecb4e364d1c1b6f64178fc86c59a982..732fa9c2bf22e488ba531c0f9fd2a7e0 ServerLevel worldserver = getServerLevel(Evoker.this.level()); - if (!worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ if (!worldserver.purpurConfig.evokerBypassMobGriefing && !worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur ++ if (!worldserver.purpurConfig.evokerBypassMobGriefing == !worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur return false; } else { List list = worldserver.getNearbyEntities(Sheep.class, this.wololoTargeting, Evoker.this, Evoker.this.getBoundingBox().inflate(16.0D, 4.0D, 16.0D)); @@ -12289,7 +12011,7 @@ index 3e8631c7bd1e7591051ca21c6ae7acd87d3c7529..85d5c84a8861905e4546901aa6707078 this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)); diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java -index c96fbfe448b3e7b722a8db0e1688276776abd94e..487f21c6e6ffc0dc9c0733241a8ded8c73a5ec8f 100644 +index c96fbfe448b3e7b722a8db0e1688276776abd94e..98c1934b4895a86cd8748edf906aaa721a87a123 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java +++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java @@ -77,15 +77,57 @@ public class Ravager extends Raider { @@ -12364,7 +12086,7 @@ index c96fbfe448b3e7b722a8db0e1688276776abd94e..487f21c6e6ffc0dc9c0733241a8ded8c ServerLevel worldserver = (ServerLevel) world; - if (this.horizontalCollision && worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ if (this.horizontalCollision && (worldserver.purpurConfig.ravagerBypassMobGriefing || worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // Purpur ++ if (this.horizontalCollision && (worldserver.purpurConfig.ravagerBypassMobGriefing ^ worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // Purpur boolean flag = false; AABB axisalignedbb = this.getBoundingBox().inflate(0.2D); Iterator iterator = BlockPos.betweenClosed(Mth.floor(axisalignedbb.minX), Mth.floor(axisalignedbb.minY), Mth.floor(axisalignedbb.minZ), Mth.floor(axisalignedbb.maxX), Mth.floor(axisalignedbb.maxY), Mth.floor(axisalignedbb.maxZ)).iterator(); @@ -12506,7 +12228,7 @@ index 6e0f2f6573ed6be9b91de960d55c269417ad8907..e3fefd52c83079fe3eab1a96dd81a183 public ShulkerLookControl(final Mob entity) { super(entity); diff --git a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java -index ff65cb8ea5233f2dd159f42ad53bc9d300cd604f..ece70d8303e563df416fc6703e6d7d2e23ee220a 100644 +index ff65cb8ea5233f2dd159f42ad53bc9d300cd604f..7a6ad611faf39eb8dd87bd498169571633c33769 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java +++ b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java @@ -44,14 +44,51 @@ public class Silverfish extends Monster { @@ -12561,12 +12283,18 @@ index ff65cb8ea5233f2dd159f42ad53bc9d300cd604f..ece70d8303e563df416fc6703e6d7d2e this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[0])).setAlertOthers()); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); } -@@ -170,7 +207,7 @@ public class Silverfish extends Monster { +@@ -165,12 +202,12 @@ public class Silverfish extends Monster { + + if (block instanceof InfestedBlock) { + // CraftBukkit start +- BlockState afterState = getServerLevel(world).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? iblockdata.getFluidState().createLegacyBlock() : ((InfestedBlock) block).hostStateByInfested(world.getBlockState(blockposition1)); // Paper - fix wrong block state ++ BlockState afterState = (getServerLevel(world).purpurConfig.silverfishBypassMobGriefing ^ getServerLevel(world).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) ? iblockdata.getFluidState().createLegacyBlock() : ((InfestedBlock) block).hostStateByInfested(world.getBlockState(blockposition1)); // Paper - fix wrong block state + if (!CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, afterState)) { // Paper - fix wrong block state continue; } // CraftBukkit end - if (getServerLevel(world).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ if (getServerLevel(world).purpurConfig.silverfishBypassMobGriefing || getServerLevel(world).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur ++ if (getServerLevel(world).purpurConfig.silverfishBypassMobGriefing ^ getServerLevel(world).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur world.destroyBlock(blockposition1, true, this.silverfish); } else { world.setBlock(blockposition1, ((InfestedBlock) block).hostStateByInfested(world.getBlockState(blockposition1)), 3); @@ -12575,7 +12303,7 @@ index ff65cb8ea5233f2dd159f42ad53bc9d300cd604f..ece70d8303e563df416fc6703e6d7d2e RandomSource randomsource = this.mob.getRandom(); - if (getServerLevel((Entity) this.mob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && randomsource.nextInt(reducedTickDelay(10)) == 0) { -+ if (getServerLevel((Entity) this.mob).purpurConfig.silverfishBypassMobGriefing || getServerLevel((Entity) this.mob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && randomsource.nextInt(reducedTickDelay(10)) == 0) { // Purpur ++ if (getServerLevel((Entity) this.mob).purpurConfig.silverfishBypassMobGriefing ^ getServerLevel((Entity) this.mob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && randomsource.nextInt(reducedTickDelay(10)) == 0) { // Purpur this.selectedDirection = Direction.getRandom(randomsource); BlockPos blockposition = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5D, this.mob.getZ()).relative(this.selectedDirection); BlockState iblockdata = this.mob.level().getBlockState(blockposition); @@ -13374,7 +13102,7 @@ index 37d3acda84a984bf4f1c44b3d27e2102839d3e8e..23fc36780a3e15260f8cb1001c8d6764 protected void registerGoals() { this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractPiglin.class, true)); diff --git a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java -index 35b0c5c322864e2f5ae5a412296072f268adcd05..f30ad422f19757664228f2064465fbcb22bb54f6 100644 +index 35b0c5c322864e2f5ae5a412296072f268adcd05..cb20c018c11a0e707c2083cf964bd5303d216edd 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java @@ -85,6 +85,39 @@ public class Zoglin extends Monster implements HoglinBase { @@ -13417,21 +13145,14 @@ index 35b0c5c322864e2f5ae5a412296072f268adcd05..f30ad422f19757664228f2064465fbcb @Override protected Brain.Provider brainProvider() { return Brain.provider(MEMORY_TYPES, SENSOR_TYPES); -@@ -248,10 +281,11 @@ public class Zoglin extends Monster implements HoglinBase { - - @Override +@@ -250,6 +283,7 @@ public class Zoglin extends Monster implements HoglinBase { protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("zoglinBrain"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur -+ //profilerFiller.push("zoglinBrain"); // Purpur + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("zoglinBrain"); + if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider this.getBrain().tick(world, this); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Purpur + profilerFiller.pop(); this.updateActivity(); - } - diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java index a12461907278cfbfa3b1c0aa74b9f07a31768b8a..85b03e0bf7436cb846df13c575ad78ac6a17a151 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java @@ -13808,32 +13529,95 @@ index 03e3cbe73119ca76417d4dd192e1560bdfc373ec..8c3271dcc8c9aa58e2e007eba282c11e } @Nullable -diff --git a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java -index a16fd9c4679e874ad2d499f3c00c2ddfd780a7a5..0bc771e20a9bab139cd3fc03ff40baabf787b2f7 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java -+++ b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java -@@ -235,12 +235,12 @@ public class Breeze extends Monster { - - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("breezeBrain"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur -+ //profilerFiller.push("breezeBrain"); // Purpur - this.getBrain().tick(world, this); -- profilerFiller.popPush("breezeActivityUpdate"); -+ //profilerFiller.popPush("breezeActivityUpdate"); // Purpur - BreezeAi.updateActivity(this); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Purpur - super.customServerAiStep(world); +diff --git a/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java b/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java +index 7b5f9284972b3a6bd8125891b23f73438e875c08..ea1655d2cbc631d80dd66f7e3e24998530df66a2 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java ++++ b/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java +@@ -63,6 +63,29 @@ public class Creaking extends Monster { + this.xpReward = 0; } ++ // Purpur start ++ @Override ++ public boolean isRidable() { ++ return level().purpurConfig.creakingRidable; ++ } ++ ++ @Override ++ public boolean dismountsUnderwater() { ++ return level().purpurConfig.useDismountsUnderwaterTag ? super.dismountsUnderwater() : !level().purpurConfig.creakingRidableInWater; ++ } ++ ++ @Override ++ public boolean isControllable() { ++ return level().purpurConfig.creakingControllable; ++ } ++ ++ @Override ++ protected void registerGoals() { ++ this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur ++ this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur ++ } ++ // Purpur end ++ + @Override + protected BodyRotationControl createBodyControl() { + return new Creaking.CreakingBodyRotationControl(this); +@@ -185,6 +208,14 @@ public class Creaking extends Monster { + return this.isActive() ? null : SoundEvents.CREAKING_AMBIENT; + } + ++ // Purpur start ++ @Override ++ public void initAttributes() { ++ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.creakingMaxHealth); ++ this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.creakingScale); ++ } ++ // Purpur end ++ + @Override + protected SoundEvent getHurtSound(DamageSource source) { + return SoundEvents.CREAKING_SWAY; +@@ -296,28 +327,28 @@ public class Creaking extends Monster { + } + } + +- class CreakingLookControl extends LookControl { ++ class CreakingLookControl extends org.purpurmc.purpur.controller.LookControllerWASD { // Purpur + public CreakingLookControl(final Creaking creaking) { + super(creaking); + } + + @Override +- public void tick() { ++ public void vanillaTick() { // Purpur + if (Creaking.this.canMove()) { +- super.tick(); ++ super.vanillaTick(); // Purpur + } + } + } + +- class CreakingMoveControl extends MoveControl { ++ class CreakingMoveControl extends org.purpurmc.purpur.controller.MoveControllerWASD { // Purpur + public CreakingMoveControl(final Creaking creaking) { + super(creaking); + } + + @Override +- public void tick() { ++ public void vanillaTick() { // Purpur + if (Creaking.this.canMove()) { +- super.tick(); ++ super.vanillaTick(); // Purpur + } + } + } diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 6ea90e54759dbeab025e0a1896ee834ea9986427..7afde99f81ec222ecbffbdcdad3aa6404e8221e0 100644 +index 92270912ef26924f611a1df7cb3d5b485b0a262d..6144613e834236ec0ebb12872ef9e47255b76b5b 100644 --- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -92,11 +92,49 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -71,11 +71,49 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { this.xpReward = 5; } @@ -13883,23 +13667,22 @@ index 6ea90e54759dbeab025e0a1896ee834ea9986427..7afde99f81ec222ecbffbdcdad3aa640 @Override public boolean canBeLeashed() { return true; -@@ -158,10 +196,11 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -138,11 +176,13 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { + return (Brain) super.getBrain(); // CraftBukkit - decompile error + } ++ private int behaviorTick; // Pufferfish @Override protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("hoglinBrain"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur -+ //profilerFiller.push("hoglinBrain"); // Purpur -+ //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Purpur - TODO: Pufferfish + ProfilerFiller gameprofilerfiller = Profiler.get(); + + gameprofilerfiller.push("hoglinBrain"); ++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider this.getBrain().tick(world, this); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Purpur + gameprofilerfiller.pop(); HoglinAi.updateActivity(this); - if (this.isConverting()) { - this.timeInOverworld++; diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java -index e04d2c5e75dc774fe893a552474fdb8045c32693..b53e4a312ea0dbbd16e948e61c3f6b836d46f3b8 100644 +index e04d2c5e75dc774fe893a552474fdb8045c32693..20608fb46a0af85739e3c0caa843c1a9d45c9659 100644 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java @@ -96,6 +96,39 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @@ -13942,28 +13725,26 @@ index e04d2c5e75dc774fe893a552474fdb8045c32693..b53e4a312ea0dbbd16e948e61c3f6b83 @Override public void addAdditionalSaveData(CompoundTag nbt) { super.addAdditionalSaveData(nbt); -@@ -306,11 +339,12 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -304,11 +337,13 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento + return !this.cannotHunt; + } ++ private int behaviorTick; // Pufferfish @Override protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + ProfilerFiller gameprofilerfiller = Profiler.get(); -- gameprofilerfiller.push("piglinBrain"); -+ //gameprofilerfiller.push("piglinBrain"); // Purpur -+ //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // // Purpur - TODO: Pufferfish + gameprofilerfiller.push("piglinBrain"); ++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider this.getBrain().tick(world, this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur + gameprofilerfiller.pop(); PiglinAi.updateActivity(this); - super.customServerAiStep(world); - } -@@ -405,7 +439,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -405,7 +440,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @Override public boolean wantsToPickUp(ServerLevel world, ItemStack stack) { - return world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, stack); -+ return (world.purpurConfig.piglinBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, stack); // Purpur ++ return (world.purpurConfig.piglinBypassMobGriefing ^ world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, stack); // Purpur } protected boolean canReplaceCurrentItem(ItemStack stack) { @@ -13992,7 +13773,7 @@ index e283b1296c1e831376bfe9491cbf02ed4b3fffe4..27a6de70530c2a1cbe2f77a7fb493038 piglin.getBrain().eraseMemory(MemoryModuleType.WALK_TARGET); piglin.getNavigation().stop(); diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java -index 24eaeb93284fe1a573026b85818a93a34fd9e1ec..719179fb232a4f39a2c1642cc0e9593f4dea4bb8 100644 +index 24eaeb93284fe1a573026b85818a93a34fd9e1ec..bc3b0eb21200eae7e419b2571871b36fc1e07c0f 100644 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java +++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java @@ -65,6 +65,39 @@ public class PiglinBrute extends AbstractPiglin { @@ -14035,23 +13816,16 @@ index 24eaeb93284fe1a573026b85818a93a34fd9e1ec..719179fb232a4f39a2c1642cc0e9593f public static AttributeSupplier.Builder createAttributes() { return Monster.createMonsterAttributes() .add(Attributes.MAX_HEALTH, 50.0) -@@ -115,10 +148,11 @@ public class PiglinBrute extends AbstractPiglin { - - @Override +@@ -117,6 +150,7 @@ public class PiglinBrute extends AbstractPiglin { protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("piglinBruteBrain"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur -+ //profilerFiller.push("piglinBruteBrain"); // Purpur + ProfilerFiller profilerFiller = Profiler.get(); + profilerFiller.push("piglinBruteBrain"); + if (getRider() == null || this.isControllable()) // Purpur - only use brain if no rider this.getBrain().tick(world, this); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Purpur + profilerFiller.pop(); PiglinBruteAi.updateActivity(this); - PiglinBruteAi.maybePlayActivitySound(this); - super.customServerAiStep(world); diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -index 6180019da58b19d2595da508aed3196af922d587..692261880d05daa75fc53dde31d0f2b95dc52746 100644 +index 6180019da58b19d2595da508aed3196af922d587..5a62fe9c4f0cee9e8b4a48564f76afec609335b1 100644 --- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java @@ -127,8 +127,32 @@ public class Warden extends Monster implements VibrationSystem { @@ -14087,19 +13861,21 @@ index 6180019da58b19d2595da508aed3196af922d587..692261880d05daa75fc53dde31d0f2b9 @Override public Packet getAddEntityPacket(ServerEntity entityTrackerEntry) { return new ClientboundAddEntityPacket(this, entityTrackerEntry, this.hasPose(Pose.EMERGING) ? 1 : 0); -@@ -279,9 +303,9 @@ public class Warden extends Monster implements VibrationSystem { +@@ -275,11 +299,13 @@ public class Warden extends Monster implements VibrationSystem { + + } + ++ private int behaviorTick = 0; // Pufferfish + @Override protected void customServerAiStep(ServerLevel world) { ProfilerFiller gameprofilerfiller = Profiler.get(); -- gameprofilerfiller.push("wardenBrain"); -+ //gameprofilerfiller.push("wardenBrain"); // Purpur + gameprofilerfiller.push("wardenBrain"); ++ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish this.getBrain().tick(world, this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur + gameprofilerfiller.pop(); super.customServerAiStep(world); - if ((this.tickCount + this.getId()) % 120 == 0) { - Warden.applyDarknessAround(world, this.position(), this, 20); -@@ -396,17 +420,14 @@ public class Warden extends Monster implements VibrationSystem { +@@ -396,17 +422,14 @@ public class Warden extends Monster implements VibrationSystem { @Contract("null->false") public boolean canTargetEntity(@Nullable Entity entity) { @@ -14174,25 +13950,24 @@ index b0236c7bf9441aa84d3795ffed05dd6099f29636..796dcc0dcf9022b455b8847e045266b8 } diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index b7a34f1c4d7b5ef3f7a843d152e33c839dcdedd5..b4ffad429ace965f16ebf47119c880b709b27f2e 100644 +index b7a34f1c4d7b5ef3f7a843d152e33c839dcdedd5..0ee456972923e90905732ffc5d77bb027cf6c0fc 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -141,6 +141,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -141,6 +141,10 @@ public class Villager extends AbstractVillager implements ReputationEventHandler }, MemoryModuleType.MEETING_POINT, (entityvillager, holder) -> { return holder.is(PoiTypes.MEETING); }); + private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur + private int notLobotomizedCount = 0; // Purpur ++ ++ public long nextGolemPanic = -1; // Pufferfish public Villager(EntityType entityType, Level world) { this(entityType, world, VillagerType.PLAINS); -@@ -154,6 +156,92 @@ public class Villager extends AbstractVillager implements ReputationEventHandler - this.getNavigation().setRequiredPathLength(48.0F); - this.setCanPickUpLoot(true); +@@ -156,6 +160,93 @@ public class Villager extends AbstractVillager implements ReputationEventHandler this.setVillagerData(this.getVillagerData().setType(type).setProfession(VillagerProfession.NONE)); -+ if (level().purpurConfig.villagerFollowEmeraldBlock) this.goalSelector.addGoal(3, new net.minecraft.world.entity.ai.goal.TemptGoal(this, 1.0D, TEMPT_ITEMS, false)); -+ } -+ + } + + // Purpur start + @Override + public boolean isRidable() { @@ -14212,6 +13987,7 @@ index b7a34f1c4d7b5ef3f7a843d152e33c839dcdedd5..b4ffad429ace965f16ebf47119c880b7 + @Override + protected void registerGoals() { + this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); ++ if (level().purpurConfig.villagerFollowEmeraldBlock) this.goalSelector.addGoal(3, new net.minecraft.world.entity.ai.goal.TemptGoal(this, 1.0D, TEMPT_ITEMS, false)); + } + + @Override @@ -14224,6 +14000,7 @@ index b7a34f1c4d7b5ef3f7a843d152e33c839dcdedd5..b4ffad429ace965f16ebf47119c880b7 + public void initAttributes() { + this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.villagerMaxHealth); + this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.villagerScale); ++ this.getAttribute(Attributes.TEMPT_RANGE).setBaseValue(this.level().purpurConfig.villagerTemptRange); // Purpur + } + + @Override @@ -14276,10 +14053,12 @@ index b7a34f1c4d7b5ef3f7a843d152e33c839dcdedd5..b4ffad429ace965f16ebf47119c880b7 + net.minecraft.world.level.block.Block top = level().getBlockState(pos.above()).getBlock(); + // only if both blocks have no collision + return !bottom.hasCollision && !top.hasCollision; - } - ++ } ++ @Override -@@ -190,7 +278,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + public Brain getBrain() { + return (Brain) super.getBrain(); // CraftBukkit - decompile error +@@ -190,7 +281,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler brain.addActivity(Activity.PLAY, VillagerGoalPackages.getPlayPackage(0.5F)); } else { brain.setSchedule(Schedule.VILLAGER_DEFAULT); @@ -14288,20 +14067,32 @@ index b7a34f1c4d7b5ef3f7a843d152e33c839dcdedd5..b4ffad429ace965f16ebf47119c880b7 } brain.addActivity(Activity.CORE, VillagerGoalPackages.getCorePackage(villagerprofession, 0.5F)); -@@ -250,13 +338,21 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -217,7 +308,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + } + + public static AttributeSupplier.Builder createAttributes() { +- return Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 0.5D); ++ return Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 0.5D).add(Attributes.TEMPT_RANGE, 10.0D); // Purpur - add TEMPT_RANGE + } + + public boolean assignProfessionWhenSpawned() { +@@ -245,17 +336,30 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + } + // Spigot End + ++ private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep(ServerLevel world) { // Paper start - EAR 2 this.customServerAiStep(world, false); } - protected void customServerAiStep(ServerLevel world, final boolean inactive) { + protected void customServerAiStep(ServerLevel world, boolean inactive) { // Purpur - not final // Paper end - EAR 2 -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + ProfilerFiller gameprofilerfiller = Profiler.get(); -- gameprofilerfiller.push("villagerBrain"); + gameprofilerfiller.push("villagerBrain"); - if (!inactive) this.getBrain().tick(world, this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.push("villagerBrain"); // Purpur + // Purpur start + if (this.level().purpurConfig.villagerLobotomizeEnabled) { + // treat as inactive if lobotomized @@ -14310,12 +14101,15 @@ index b7a34f1c4d7b5ef3f7a843d152e33c839dcdedd5..b4ffad429ace965f16ebf47119c880b7 + this.isLobotomized = false; + } + // Purpur end -+ if (!inactive && (getRider() == null || !this.isControllable())) this.getBrain().tick(world, this); // Purpur -+ //gameprofilerfiller.pop(); // Purpur ++ // Pufferfish start ++ if (!inactive && (getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) { ++ this.getBrain().tick(world, this); // Paper // Purpur ++ } ++ // Pufferfish end + gameprofilerfiller.pop(); if (this.assignProfessionWhenSpawned) { this.assignProfessionWhenSpawned = false; - } -@@ -312,7 +408,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -312,7 +416,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler if (!itemstack.is(Items.VILLAGER_SPAWN_EGG) && this.isAlive() && !this.isTrading() && !this.isSleeping()) { if (this.isBaby()) { this.setUnhappy(); @@ -14324,7 +14118,7 @@ index b7a34f1c4d7b5ef3f7a843d152e33c839dcdedd5..b4ffad429ace965f16ebf47119c880b7 } else { if (!this.level().isClientSide) { boolean flag = this.getOffers().isEmpty(); -@@ -326,9 +422,11 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -326,9 +430,11 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } if (flag) { @@ -14337,7 +14131,7 @@ index b7a34f1c4d7b5ef3f7a843d152e33c839dcdedd5..b4ffad429ace965f16ebf47119c880b7 this.startTrading(player); } -@@ -493,7 +591,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -493,7 +599,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler while (iterator.hasNext()) { MerchantOffer merchantrecipe = (MerchantOffer) iterator.next(); @@ -14346,7 +14140,7 @@ index b7a34f1c4d7b5ef3f7a843d152e33c839dcdedd5..b4ffad429ace965f16ebf47119c880b7 } } -@@ -726,7 +824,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -726,7 +832,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @Override public boolean canBreed() { @@ -14355,7 +14149,7 @@ index b7a34f1c4d7b5ef3f7a843d152e33c839dcdedd5..b4ffad429ace965f16ebf47119c880b7 } private boolean hungry() { -@@ -905,6 +1003,11 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -905,6 +1011,11 @@ public class Villager extends AbstractVillager implements ReputationEventHandler public boolean hasFarmSeeds() { return this.getInventory().hasAnyMatching((itemstack) -> { @@ -14367,7 +14161,7 @@ index b7a34f1c4d7b5ef3f7a843d152e33c839dcdedd5..b4ffad429ace965f16ebf47119c880b7 return itemstack.is(ItemTags.VILLAGER_PLANTABLE_SEEDS); }); } -@@ -962,6 +1065,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -962,6 +1073,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } public void spawnGolemIfNeeded(ServerLevel world, long time, int requiredCount) { @@ -14375,7 +14169,7 @@ index b7a34f1c4d7b5ef3f7a843d152e33c839dcdedd5..b4ffad429ace965f16ebf47119c880b7 if (this.wantsToSpawnGolem(time)) { AABB axisalignedbb = this.getBoundingBox().inflate(10.0D, 10.0D, 10.0D); List list = world.getEntitiesOfClass(Villager.class, axisalignedbb); -@@ -1026,6 +1130,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -1026,6 +1138,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @Override public void startSleeping(BlockPos pos) { @@ -14402,10 +14196,10 @@ index 8734ab1bd8299bbf43906d81a349c2a13e0981a7..3ca83269311cbc18c9ef3ce62cff6a2d "farmer", PoiTypes.FARMER, diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java -index 1e77cce428d9e53142aaa2cf780b7f862d536eca..959e10586cddaae2590d2d84f5fd809dad80889b 100644 +index 1e77cce428d9e53142aaa2cf780b7f862d536eca..42c91e52060fad4a7a598f9e9ef88fd0e0ff8475 100644 --- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java +++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java -@@ -72,6 +72,43 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill +@@ -72,6 +72,50 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill //this.setDespawnDelay(48000); // CraftBukkit - set default from MobSpawnerTrader // Paper - move back to MobSpawnerTrader - Vanilla behavior is that only traders spawned by it have this value set. } @@ -14434,8 +14228,15 @@ index 1e77cce428d9e53142aaa2cf780b7f862d536eca..959e10586cddaae2590d2d84f5fd809d + @Override + public void initAttributes() { + this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.wanderingTraderMaxHealth); ++ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.TEMPT_RANGE).setBaseValue(this.level().purpurConfig.wanderingTraderTemptRange); // Purpur + } + ++ // Purpur start ++ public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() { ++ return Mob.createMobAttributes().add(net.minecraft.world.entity.ai.attributes.Attributes.TEMPT_RANGE, 10.0D); ++ } ++ // Purpur end ++ + @Override + public boolean isSensitiveToWater() { + return this.level().purpurConfig.wanderingTraderTakeDamageFromWater; @@ -14449,7 +14250,7 @@ index 1e77cce428d9e53142aaa2cf780b7f862d536eca..959e10586cddaae2590d2d84f5fd809d @Override protected void registerGoals() { this.goalSelector.addGoal(0, new FloatGoal(this)); -@@ -79,7 +116,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill +@@ -79,7 +123,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill return this.canDrinkPotion && this.level().isNight() && !entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API })); this.goalSelector.addGoal(0, new UseItemGoal<>(this, new ItemStack(Items.MILK_BUCKET), SoundEvents.WANDERING_TRADER_REAPPEARED, (entityvillagertrader) -> { @@ -14458,7 +14259,7 @@ index 1e77cce428d9e53142aaa2cf780b7f862d536eca..959e10586cddaae2590d2d84f5fd809d })); this.goalSelector.addGoal(1, new TradeWithPlayerGoal(this)); this.goalSelector.addGoal(1, new AvoidEntityGoal<>(this, Zombie.class, 8.0F, 0.5D, 0.5D)); -@@ -92,6 +129,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill +@@ -92,6 +136,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill this.goalSelector.addGoal(1, new PanicGoal(this, 0.5D)); this.goalSelector.addGoal(1, new LookAtTradingPlayerGoal(this)); this.goalSelector.addGoal(2, new WanderingTrader.WanderToPositionGoal(this, 2.0D, 0.35D)); @@ -14466,7 +14267,7 @@ index 1e77cce428d9e53142aaa2cf780b7f862d536eca..959e10586cddaae2590d2d84f5fd809d this.goalSelector.addGoal(4, new MoveTowardsRestrictionGoal(this, 0.35D)); this.goalSelector.addGoal(8, new WaterAvoidingRandomStrollGoal(this, 0.35D)); this.goalSelector.addGoal(9, new InteractGoal(this, Player.class, 3.0F, 1.0F)); -@@ -120,11 +158,13 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill +@@ -120,11 +165,13 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill if (!this.level().isClientSide) { if (this.getOffers().isEmpty()) { @@ -14507,6 +14308,38 @@ index a728dcbf956f108f01c966c7531449a506a14a87..4c1378132201c1e5d1bc01f8c0cbba91 if (spawnplacementtype.isSpawnPositionOk(world, blockposition2, EntityType.WANDERING_TRADER)) { blockposition1 = blockposition2; +diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java +index 0990bcf65f484b9a019c91fcdae1783bac6388da..99feda30fb85a7615560b6e9a3701d5dfeb3e524 100644 +--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java ++++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java +@@ -649,6 +649,8 @@ public class Inventory implements Container, Nameable { + } + + public boolean contains(ItemStack stack) { ++ // Pufferfish start - don't allocate iterators ++ /* + Iterator iterator = this.compartments.iterator(); + + while (iterator.hasNext()) { +@@ -663,6 +665,18 @@ public class Inventory implements Container, Nameable { + } + } + } ++ */ ++ for (int i = 0; i < this.compartments.size(); i++) { ++ List list = this.compartments.get(i); ++ for (int j = 0; j < list.size(); j++) { ++ ItemStack itemstack1 = list.get(j); ++ ++ if (!itemstack1.isEmpty() && ItemStack.isSameItemSameComponents(itemstack1, stack)) { ++ return true; ++ } ++ } ++ } ++ // Pufferfish end + + return false; + } diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java index 61d412c4f1ebd55661cc3f0260468e3ac0efe0bb..c1d068fa99ec0fd5685bbb627a775e4d1587feab 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java @@ -14650,7 +14483,7 @@ index 61d412c4f1ebd55661cc3f0260468e3ac0efe0bb..c1d068fa99ec0fd5685bbb627a775e4d if (!this.isPassenger() && this.onGround() && !this.isInWater() && !this.isInPowderSnow) { if (this.getShoulderEntityLeft().isEmpty()) { diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -index accc246f441c8bf5e1a755cfc0db8f97c0c01c6b..f91519f73e766cf891351a95d76abb416da2f957 100644 +index 8ce573042ea87631eb6539f2a0d5036655c2b809..5006a59734c5fc7525fba86f7d74e74f8f1b54b0 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -80,6 +80,7 @@ public abstract class AbstractArrow extends Projectile { @@ -14684,7 +14517,7 @@ index accc246f441c8bf5e1a755cfc0db8f97c0c01c6b..f91519f73e766cf891351a95d76abb41 return SoundEvents.ARROW_HIT; } diff --git a/src/main/java/net/minecraft/world/entity/projectile/LargeFireball.java b/src/main/java/net/minecraft/world/entity/projectile/LargeFireball.java -index 2f00676f62478897ae4931ea06e047567c407535..6bd6113cabfae068aa421991f0a9016419f20349 100644 +index 2f00676f62478897ae4931ea06e047567c407535..55ea7f82fac9a3de6d7e0725a9b6ea08088bc85c 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/LargeFireball.java +++ b/src/main/java/net/minecraft/world/entity/projectile/LargeFireball.java @@ -23,13 +23,13 @@ public class LargeFireball extends Fireball { @@ -14692,14 +14525,14 @@ index 2f00676f62478897ae4931ea06e047567c407535..6bd6113cabfae068aa421991f0a90164 public LargeFireball(EntityType type, Level world) { super(type, world); - this.isIncendiary = (world instanceof ServerLevel worldserver) && worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit -+ this.isIncendiary = (world instanceof ServerLevel worldserver) && (worldserver.purpurConfig.fireballsBypassMobGriefing || worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)); // CraftBukkit // Purpur ++ this.isIncendiary = (world instanceof ServerLevel worldserver) && (worldserver.purpurConfig.fireballsBypassMobGriefing ^ worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)); // CraftBukkit // Purpur } public LargeFireball(Level world, LivingEntity owner, Vec3 velocity, int explosionPower) { super(EntityType.FIREBALL, owner, velocity, world); this.explosionPower = explosionPower; - this.isIncendiary = (world instanceof ServerLevel worldserver) && worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit -+ this.isIncendiary = (world instanceof ServerLevel worldserver) && (worldserver.purpurConfig.fireballsBypassMobGriefing || worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)); // CraftBukkit // Purpur ++ this.isIncendiary = (world instanceof ServerLevel worldserver) && (worldserver.purpurConfig.fireballsBypassMobGriefing ^ worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)); // CraftBukkit // Purpur } @Override @@ -14708,7 +14541,7 @@ index 2f00676f62478897ae4931ea06e047567c407535..6bd6113cabfae068aa421991f0a90164 if (world instanceof ServerLevel worldserver) { - boolean flag = worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); -+ boolean flag = worldserver.purpurConfig.fireballsBypassMobGriefing || worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // Purpur ++ boolean flag = worldserver.purpurConfig.fireballsBypassMobGriefing ^ worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // Purpur // CraftBukkit start - fire ExplosionPrimeEvent ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity()); @@ -14730,20 +14563,57 @@ index 958ea103cc80da7366cc33dc385b76d4f5c809f2..0b7f27a6cc6be58fa5b60002059c9fbb protected double getDefaultGravity() { return 0.06D; diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -index 6c2d4d6f3a36ab452dfd3c33f66e54f152906639..275347d563fbcffa896b6c1c9f7f51c8797c2379 100644 +index 6c2d4d6f3a36ab452dfd3c33f66e54f152906639..a7df9c2a3f210bc944cf76cdcc8d2a9484704bd1 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -@@ -480,7 +480,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { +@@ -58,6 +58,36 @@ public abstract class Projectile extends Entity implements TraceableEntity { + super(type, world); + } + ++ // Pufferfish start ++ private static int loadedThisTick = 0; ++ private static int loadedTick; ++ ++ private int loadedLifetime = 0; ++ @Override ++ public void setPos(double x, double y, double z) { ++ int currentTick = net.minecraft.server.MinecraftServer.currentTick; ++ if (loadedTick != currentTick) { ++ loadedTick = currentTick; ++ loadedThisTick = 0; ++ } ++ int previousX = Mth.floor(this.getX()) >> 4, previousZ = Mth.floor(this.getZ()) >> 4; ++ int newX = Mth.floor(x) >> 4, newZ = Mth.floor(z) >> 4; ++ if (previousX != newX || previousZ != newZ) { ++ boolean isLoaded = ((net.minecraft.server.level.ServerChunkCache) this.level().getChunkSource()).getChunkAtIfLoadedImmediately(newX, newZ) != null; ++ if (!isLoaded) { ++ if (Projectile.loadedThisTick > gg.pufferfish.pufferfish.PufferfishConfig.maxProjectileLoadsPerTick) { ++ if (++this.loadedLifetime > gg.pufferfish.pufferfish.PufferfishConfig.maxProjectileLoadsPerProjectile) { ++ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); // Purpur ++ } ++ return; ++ } ++ Projectile.loadedThisTick++; ++ } ++ } ++ super.setPos(x, y, z); ++ } ++ // Pufferfish end ++ + public void setOwner(@Nullable Entity entity) { + if (entity != null) { + this.ownerUUID = entity.getUUID(); +@@ -480,7 +510,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { public boolean mayInteract(ServerLevel world, BlockPos pos) { Entity entity = this.getOwner(); - return entity instanceof Player ? entity.mayInteract(world, pos) : entity == null || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); -+ return entity instanceof Player ? entity.mayInteract(world, pos) : entity == null || world.purpurConfig.projectilesBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); ++ return entity instanceof Player ? entity.mayInteract(world, pos) : entity == null || world.purpurConfig.projectilesBypassMobGriefing ^ world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); } public boolean mayBreak(ServerLevel world) { diff --git a/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java b/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java -index bb159ea4baf208aab6d6fcfbbddacd5b089b55c8..69dd29ed5e3cb37180b65183b0a83c8619d8e9a0 100644 +index bb159ea4baf208aab6d6fcfbbddacd5b089b55c8..588b07ec4501924a49264183b414a7fd64bb6550 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java +++ b/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java @@ -30,7 +30,7 @@ public class SmallFireball extends Fireball { @@ -14751,7 +14621,7 @@ index bb159ea4baf208aab6d6fcfbbddacd5b089b55c8..69dd29ed5e3cb37180b65183b0a83c86 // CraftBukkit start if (this.getOwner() != null && this.getOwner() instanceof Mob) { - this.isIncendiary = (world instanceof ServerLevel worldserver) && worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); -+ this.isIncendiary = (world instanceof ServerLevel worldserver) && (worldserver.purpurConfig.fireballsBypassMobGriefing || worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)); // Purpur ++ this.isIncendiary = (world instanceof ServerLevel worldserver) && (worldserver.purpurConfig.fireballsBypassMobGriefing ^ worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)); // Purpur } // CraftBukkit end } @@ -14875,7 +14745,7 @@ index 4c47b30867e30d84908abf93dbefc252bc8c3453..e63b408594b5d2673148e39c1deafc85 protected void defineSynchedData(SynchedEntityData.Builder builder) { builder.define(WitherSkull.DATA_DANGEROUS, false); diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java -index ab132041982df2a701e4baea8195873f31b4a5fb..4ef87acec025c6eb706fd8845663aa4f415efb29 100644 +index ab132041982df2a701e4baea8195873f31b4a5fb..722c1660cf6b93d0f9c05cafe587b1834c5c3a22 100644 --- a/src/main/java/net/minecraft/world/entity/raid/Raider.java +++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java @@ -345,7 +345,7 @@ public abstract class Raider extends PatrollingMonster { @@ -14883,7 +14753,7 @@ index ab132041982df2a701e4baea8195873f31b4a5fb..4ef87acec025c6eb706fd8845663aa4f private boolean cannotPickUpBanner() { - if (!getServerLevel(this.mob).getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items -+ if ((!this.mob.level().purpurConfig.pillagerBypassMobGriefing && !getServerLevel(this.mob).getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING)) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items // Purpur ++ if ((!this.mob.level().purpurConfig.pillagerBypassMobGriefing == !getServerLevel(this.mob).getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING)) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items // Purpur if (!this.mob.hasActiveRaid()) { return true; } else if (this.mob.getCurrentRaid().isOver()) { @@ -14959,39 +14829,50 @@ index 1fdbef16cd29c8fc74578ac3328f985eca61088d..56c265940208bc94f531a5af94f564b5 public static enum Status { diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -index cdc8606ffe5c75ee19d92e9f86f26b2a502d765e..b0e13160b185151e08f2e5430aa7e96977965a04 100644 +index cdc8606ffe5c75ee19d92e9f86f26b2a502d765e..b31940441596079aae1cd2a38b9d22be18358448 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -@@ -92,6 +92,7 @@ public abstract class AbstractMinecart extends VehicleEntity { +@@ -92,6 +92,10 @@ public abstract class AbstractMinecart extends VehicleEntity { private double flyingY = 0.95; private double flyingZ = 0.95; public Double maxSpeed; -+ public double storedMaxSpeed; // Purpur ++ // Purpur start ++ public double storedMaxSpeed; ++ public boolean isNewBehavior; ++ // Purpur end // CraftBukkit end public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API -@@ -103,6 +104,7 @@ public abstract class AbstractMinecart extends VehicleEntity { +@@ -100,8 +104,13 @@ public abstract class AbstractMinecart extends VehicleEntity { + this.blocksBuilding = true; + if (AbstractMinecart.useExperimentalMovement(world)) { + this.behavior = new NewMinecartBehavior(this); ++ this.isNewBehavior = true; // Purpur } else { this.behavior = new OldMinecartBehavior(this); ++ // Purpur start ++ this.isNewBehavior = false; ++ maxSpeed = storedMaxSpeed = world.purpurConfig.minecartMaxSpeed; ++ // Purpur end } -+ if (world != null) maxSpeed = storedMaxSpeed = world.purpurConfig.minecartMaxSpeed; // Purpur } - -@@ -289,6 +291,12 @@ public abstract class AbstractMinecart extends VehicleEntity { +@@ -289,6 +298,14 @@ public abstract class AbstractMinecart extends VehicleEntity { @Override public void tick() { + // Purpur start -+ if (storedMaxSpeed != level().purpurConfig.minecartMaxSpeed) { -+ maxSpeed = storedMaxSpeed = level().purpurConfig.minecartMaxSpeed; ++ if (!this.isNewBehavior) { ++ if (storedMaxSpeed != level().purpurConfig.minecartMaxSpeed) { ++ maxSpeed = storedMaxSpeed = level().purpurConfig.minecartMaxSpeed; ++ } + } + // Purpur end + // CraftBukkit start double prevX = this.getX(); double prevY = this.getY(); -@@ -426,16 +434,62 @@ public abstract class AbstractMinecart extends VehicleEntity { +@@ -426,16 +443,62 @@ public abstract class AbstractMinecart extends VehicleEntity { this.behavior.moveAlongTrack(world); } @@ -15885,7 +15766,7 @@ index 3ddd34e5d05fa1355a2affd329d72dea216cd0e4..770bdb3fb2426083ff6785f1c38ffe9d if (event.callEvent() && thrownEgg.attemptSpawn()) { if (event.shouldConsume()) { diff --git a/src/main/java/net/minecraft/world/item/EndCrystalItem.java b/src/main/java/net/minecraft/world/item/EndCrystalItem.java -index b62db8c7c8c57e43869ee239ebf4b02f112355d9..f60e39e56a5dab2de62ae9cfd7a30a70b4985c09 100644 +index b62db8c7c8c57e43869ee239ebf4b02f112355d9..e75930f26604b772a141a93c6f4b77828abc4503 100644 --- a/src/main/java/net/minecraft/world/item/EndCrystalItem.java +++ b/src/main/java/net/minecraft/world/item/EndCrystalItem.java @@ -27,7 +27,7 @@ public class EndCrystalItem extends Item { @@ -15897,6 +15778,15 @@ index b62db8c7c8c57e43869ee239ebf4b02f112355d9..f60e39e56a5dab2de62ae9cfd7a30a70 return InteractionResult.FAIL; } else { BlockPos blockposition1 = blockposition.above(); final BlockPos aboveBlockPosition = blockposition1; // Paper - OBFHELPER +@@ -57,7 +57,7 @@ public class EndCrystalItem extends Item { + world.gameEvent((Entity) context.getPlayer(), (Holder) GameEvent.ENTITY_PLACE, blockposition1); + EndDragonFight enderdragonbattle = ((ServerLevel) world).getDragonFight(); + +- if (enderdragonbattle != null) { ++ if (enderdragonbattle != null && gg.pufferfish.pufferfish.PufferfishConfig.allowEndCrystalRespawn) { // Pufferfish + enderdragonbattle.tryRespawn(aboveBlockPosition); // Paper - Perf: Do crystal-portal proximity check before entity lookup + } + } diff --git a/src/main/java/net/minecraft/world/item/EnderpearlItem.java b/src/main/java/net/minecraft/world/item/EnderpearlItem.java index b232390d8ee8e449e61c0ea7f3af60df507abb97..4039d300debadf29e6c544e8b4c950b7121a02d1 100644 --- a/src/main/java/net/minecraft/world/item/EnderpearlItem.java @@ -16224,7 +16114,7 @@ index fa9d2ae44fcdd06f8f33cd14ffca422b20a01451..ffbc71ca2a27800d7758e3db339bf06a com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), (org.bukkit.entity.Projectile) thrownPotion.projectile().getBukkitEntity()); if (event.callEvent() && thrownPotion.attemptSpawn()) { diff --git a/src/main/java/net/minecraft/world/item/TridentItem.java b/src/main/java/net/minecraft/world/item/TridentItem.java -index 8b9a93ef71164cce8a616735b71d96d37e83b1a8..d7eb680b977656556a618431b1511c1050f6db5e 100644 +index 8b9a93ef71164cce8a616735b71d96d37e83b1a8..23e04d0d68ffa0e07ab295e7121f8a4963f4914a 100644 --- a/src/main/java/net/minecraft/world/item/TridentItem.java +++ b/src/main/java/net/minecraft/world/item/TridentItem.java @@ -88,7 +88,7 @@ public class TridentItem extends Item implements ProjectileItem { @@ -16246,23 +16136,113 @@ index 8b9a93ef71164cce8a616735b71d96d37e83b1a8..d7eb680b977656556a618431b1511c10 if (event.shouldConsume()) stack.hurtWithoutBreaking(1, entityhuman); // Paper - PlayerLaunchProjectileEvent entitythrowntrident.pickupItemStack = stack.copy(); // SPIGOT-4511 update since damage call moved // CraftBukkit end -@@ -132,6 +135,16 @@ public class TridentItem extends Item implements ProjectileItem { +@@ -132,6 +135,18 @@ public class TridentItem extends Item implements ProjectileItem { f4 *= f / f6; f5 *= f / f6; org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerRiptideEvent(entityhuman, stack, f3, f4, f5); // CraftBukkit + + // Purpur start + List list = EquipmentSlot.VALUES.stream().filter((enumitemslot) -> LivingEntity.canGlideUsing(entityhuman.getItemBySlot(enumitemslot), enumitemslot)).toList(); -+ EquipmentSlot enumitemslot = net.minecraft.Util.getRandom(list, entityhuman.random); -+ ItemStack glideItem = entityhuman.getItemBySlot(enumitemslot); -+ if (glideItem.has(net.minecraft.core.component.DataComponents.GLIDER) && world.purpurConfig.elytraDamagePerTridentBoost > 0) { -+ glideItem.hurtAndBreak(world.purpurConfig.elytraDamagePerTridentBoost, entityhuman, enumitemslot); ++ if (!list.isEmpty()) { ++ EquipmentSlot enumitemslot = net.minecraft.Util.getRandom(list, entityhuman.random); ++ ItemStack glideItem = entityhuman.getItemBySlot(enumitemslot); ++ if (glideItem.has(net.minecraft.core.component.DataComponents.GLIDER) && world.purpurConfig.elytraDamagePerTridentBoost > 0) { ++ glideItem.hurtAndBreak(world.purpurConfig.elytraDamagePerTridentBoost, entityhuman, enumitemslot); ++ } + } + // Purpur end + entityhuman.push((double) f3, (double) f4, (double) f5); entityhuman.startAutoSpinAttack(20, 8.0F, stack); if (entityhuman.onGround()) { +diff --git a/src/main/java/net/minecraft/world/item/consume_effects/ClearAllStatusEffectsConsumeEffect.java b/src/main/java/net/minecraft/world/item/consume_effects/ClearAllStatusEffectsConsumeEffect.java +index 0651c2af040e3f248860cfb3c5effce91589380e..d884df481b4bbb978113a4ac7a1feac31cf2f951 100644 +--- a/src/main/java/net/minecraft/world/item/consume_effects/ClearAllStatusEffectsConsumeEffect.java ++++ b/src/main/java/net/minecraft/world/item/consume_effects/ClearAllStatusEffectsConsumeEffect.java +@@ -24,6 +24,12 @@ public record ClearAllStatusEffectsConsumeEffect() implements ConsumeEffect { + @Override + // CraftBukkit start + public boolean apply(Level world, ItemStack itemstack, LivingEntity entityliving, EntityPotionEffectEvent.Cause cause) { ++ // Purpur start ++ net.minecraft.world.effect.MobEffectInstance badOmen = entityliving.getEffect(net.minecraft.world.effect.MobEffects.BAD_OMEN); ++ if (!world.purpurConfig.milkCuresBadOmen && itemstack.is(net.minecraft.world.item.Items.MILK_BUCKET) && badOmen != null) { ++ return entityliving.removeAllEffects(cause) && entityliving.addEffect(badOmen); ++ } ++ // Purpur end + return entityliving.removeAllEffects(cause); + // CraftBukkit end + } +diff --git a/src/main/java/net/minecraft/world/item/crafting/Ingredient.java b/src/main/java/net/minecraft/world/item/crafting/Ingredient.java +index 812f919a7a7e309c8513f44104f092496037608f..10730b307971915f52b3e41068a864b8ee1352b4 100644 +--- a/src/main/java/net/minecraft/world/item/crafting/Ingredient.java ++++ b/src/main/java/net/minecraft/world/item/crafting/Ingredient.java +@@ -45,6 +45,7 @@ public final class Ingredient implements Predicate { + // CraftBukkit start + @Nullable + private List itemStacks; ++ public Predicate predicate; // Purpur + + public boolean isExact() { + return this.itemStacks != null; +@@ -100,6 +101,11 @@ public final class Ingredient implements Predicate { + + return false; + } ++ // Purpur start ++ if (predicate != null) { ++ return predicate.test(itemstack.asBukkitCopy()); ++ } ++ // Purpur end + // CraftBukkit end + List> list = this.items(); + +diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java +index 12f95bee2a69fd5df7c4a165537e01299e60c5f6..d7ce86752e4138cdd3844b3374609753aa20f9ea 100644 +--- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java ++++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java +@@ -31,8 +31,13 @@ public class ShapelessRecipe implements CraftingRecipe { + final List ingredients; + @Nullable + private PlacementInfo placementInfo; ++ private final boolean isBukkit; // Pufferfish + ++ // Pufferfish start + public ShapelessRecipe(String group, CraftingBookCategory category, ItemStack result, List ingredients) { ++ this(group, category, result, ingredients, false); ++ } ++ public ShapelessRecipe(String group, CraftingBookCategory category, ItemStack result, List ingredients, boolean isBukkit) { this.isBukkit = isBukkit; // Pufferfish end + this.group = group; + this.category = category; + this.result = result; +@@ -80,6 +85,28 @@ public class ShapelessRecipe implements CraftingRecipe { + } + + public boolean matches(CraftingInput input, Level world) { ++ // Pufferfish start ++ if (!this.isBukkit) { ++ java.util.List ingredients = com.google.common.collect.Lists.newArrayList(this.ingredients.toArray(new Ingredient[0])); ++ ++ inventory: for (int index = 0; index < input.size(); index++) { ++ ItemStack itemStack = input.getItem(index); ++ ++ if (!itemStack.isEmpty()) { ++ for (int i = 0; i < ingredients.size(); i++) { ++ if (ingredients.get(i).test(itemStack)) { ++ ingredients.remove(i); ++ continue inventory; ++ } ++ } ++ return false; ++ } ++ } ++ ++ return ingredients.isEmpty(); ++ } ++ // Pufferfish end ++ + // Paper start - Improve exact choice recipe ingredients & unwrap ternary + if (input.ingredientCount() != this.ingredients.size()) { + return false; diff --git a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java index f99b87cf70df7eaac13d46f4e0234b1e6483d342..73241113e50dc8be89ef8850d49d95ec31fb194f 100644 --- a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java @@ -16416,7 +16396,7 @@ index 5d7a6e4b73f032db356e7ec369b150013e940ee6..6b2cda6d578a0983b2401ea206292754 if (range < 0.0 || d < range * range) { return true; diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 022de445bbbb869c38be4972c98dcf1c665539ec..7493262c2879af196e5585b15faad69ae42764e3 100644 +index 0de2b79481352b52438dde284262019b29949ad8..34e8eb828be517d9ee3973597c74c5cac3d75c99 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -174,6 +174,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -16477,24 +16457,6 @@ index 022de445bbbb869c38be4972c98dcf1c665539ec..7493262c2879af196e5585b15faad69a public CraftWorld getWorld() { return this.world; } -@@ -226,7 +270,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - - @Override - public final List getEntitiesOfClass(final Class entityClass, final AABB boundingBox, final Predicate predicate) { -- Profiler.get().incrementCounter("getEntities"); -+ //Profiler.get().incrementCounter("getEntities"); // Purpur - final List ret = new java.util.ArrayList<>(); - - ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(entityClass, null, boundingBox, ret, predicate); -@@ -236,7 +280,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - - @Override - public final List moonrise$getHardCollidingEntities(final Entity entity, final AABB box, final Predicate predicate) { -- Profiler.get().incrementCounter("getEntities"); -+ //Profiler.get().incrementCounter("getEntities"); // Purpur - final List ret = new java.util.ArrayList<>(); - - ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getHardCollidingEntities(entity, box, ret, predicate); @@ -842,6 +886,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl // Paper end - getblock optimisations - cache world height/sections this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot @@ -16504,46 +16466,27 @@ index 022de445bbbb869c38be4972c98dcf1c665539ec..7493262c2879af196e5585b15faad69a this.generator = gen; this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env); -@@ -1440,9 +1486,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1487,16 +1533,16 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + public void guardEntityTick(Consumer tickConsumer, T entity) { + try { + tickConsumer.accept(entity); +- } catch (Throwable throwable) { ++ } catch (Throwable throwable) { // Pufferfish - diff on change ServerLevel.tick + if (throwable instanceof ThreadDeath) throw throwable; // Paper + // Paper start - Prevent block entity and entity crashes + final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); + MinecraftServer.LOGGER.error(msg, throwable); + getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent +- entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); ++ entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); // Pufferfish - diff on change ServerLevel.tick + // Paper end - Prevent block entity and entity crashes + } +- this.moonrise$midTickTasks(); // Paper - rewrite chunk system ++ this.moonrise$midTickTasks(); // Paper - rewrite chunk system // Pufferfish - diff on change ServerLevel.tick } - - protected void tickBlockEntities() { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur - -- gameprofilerfiller.push("blockEntities"); -+ //gameprofilerfiller.push("blockEntities"); // Purpur - this.tickingBlockEntities = true; - if (!this.pendingBlockEntityTickers.isEmpty()) { - this.blockEntityTickers.addAll(this.pendingBlockEntityTickers); -@@ -1480,7 +1526,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 - - this.tickingBlockEntities = false; -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - this.spigotConfig.currentPrimedTnt = 0; // Spigot - } - -@@ -1650,7 +1696,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - + // Paper start - Option to prevent armor stands from doing entity lookups @Override - public List getEntities(@Nullable Entity except, AABB box, Predicate predicate) { -- Profiler.get().incrementCounter("getEntities"); -+ //Profiler.get().incrementCounter("getEntities"); // Purpur - List list = Lists.newArrayList(); - - // Paper start - rewrite chunk system -@@ -1680,7 +1726,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - public void getEntities(final EntityTypeTest entityTypeTest, - final AABB boundingBox, final Predicate predicate, - final List into, final int maxCount) { -- Profiler.get().incrementCounter("getEntities"); -+ //Profiler.get().incrementCounter("getEntities"); // Purpur - - if (entityTypeTest instanceof net.minecraft.world.entity.EntityType byType) { - if (maxCount != Integer.MAX_VALUE) { -@@ -2031,4 +2077,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -2042,4 +2088,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl return this.id; } } @@ -16559,18 +16502,9 @@ index 022de445bbbb869c38be4972c98dcf1c665539ec..7493262c2879af196e5585b15faad69a + // Purpur end } diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 5297798c2be1ba85569c2b92ed221956bf75477a..7f936a7ba994ccb51c17168c798b42dde0877a5d 100644 +index c1b76a1ebc1eea7ab70cf61d8175a31794dd122a..dc15c15951e4ca30b8341d24f813259a77f41c77 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -@@ -211,7 +211,7 @@ public final class NaturalSpawner { - } - } - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } - - // Paper start - Add mobcaps commands @@ -280,7 +280,7 @@ public final class NaturalSpawner { blockposition_mutableblockposition.set(l, i, i1); double d0 = (double) l + 0.5D; @@ -17179,7 +17113,7 @@ index a59b23f4062fa896836dec72cbd5097411774ad1..c526ea13a726624adaa654f09ff84c89 int i = aenumdirection.length; diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java -index 1ada5ed825501666addacf527a513ab7bd4a3a58..4f64011262eef6a24a8e8595ace1e4d1d82923e5 100644 +index 1ada5ed825501666addacf527a513ab7bd4a3a58..33c27909290ff3ab483226cf65b1a1bc2e983cbc 100644 --- a/src/main/java/net/minecraft/world/level/block/CropBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java @@ -180,7 +180,7 @@ public class CropBlock extends BushBlock implements BonemealableBlock { @@ -17187,7 +17121,7 @@ index 1ada5ed825501666addacf527a513ab7bd4a3a58..4f64011262eef6a24a8e8595ace1e4d1 if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (world instanceof ServerLevel worldserver) { - if (entity instanceof Ravager && CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit -+ if (entity instanceof Ravager && world.purpurConfig.ravagerGriefableBlocks.contains(world.getBlockState(pos).getBlock()) && CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), (!world.purpurConfig.ravagerBypassMobGriefing && !worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)))) { // CraftBukkit // Purpur ++ if (entity instanceof Ravager && world.purpurConfig.ravagerGriefableBlocks.contains(world.getBlockState(pos).getBlock()) && CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !world.purpurConfig.ravagerBypassMobGriefing == !worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Purpur worldserver.destroyBlock(pos, true, entity); } } @@ -17312,18 +17246,18 @@ index 4aa14f975e1ceedf3d4a427e0daefb58b12fcafe..2dffc3990d9ae3d595d923239885e3a7 EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()), org.bukkit.PortalType.ENDER); // Paper - add portal type world.getCraftServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java -index ebb9baca7a65173f7c9fdf9bf47a8db876719625..d9a1ec9c6ccab71618a42121f049005cf821eb42 100644 +index 2a207fb2e1c26b562de42240e11c856bd2a23458..6ad4aa371607ab92616626285a7e71757c76a3db 100644 --- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java -@@ -88,7 +88,7 @@ public class EnderChestBlock extends AbstractChestBlock i - } else { +@@ -89,7 +89,7 @@ public class EnderChestBlock extends AbstractChestBlock i // Paper start - Fix InventoryOpenEvent cancellation - moved up; + playerEnderChestContainer.setActiveChest(enderChestBlockEntity); // Needs to happen before ChestMenu.threeRows as it is required for opening animations if (world instanceof ServerLevel serverLevel && player.openMenu( - new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE) + new SimpleMenuProvider((i, inventory, playerx) -> org.purpurmc.purpur.PurpurConfig.enderChestSixRows ? getEnderChestSixRows(i, inventory, player, playerEnderChestContainer) : ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE) // Purpur ).isPresent()) { // Paper end - Fix InventoryOpenEvent cancellation - moved up; - playerEnderChestContainer.setActiveChest(enderChestBlockEntity); + // Paper - Fix InventoryOpenEvent cancellation - moved up; @@ -104,6 +104,35 @@ public class EnderChestBlock extends AbstractChestBlock i } } @@ -17361,7 +17295,7 @@ index ebb9baca7a65173f7c9fdf9bf47a8db876719625..d9a1ec9c6ccab71618a42121f049005c public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new EnderChestBlockEntity(pos, state); diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java -index c3dba0c2c94f3804338f86621dc42405e380a6b3..6db97982972bfc67c828f574fb86391e1cdcd4a5 100644 +index c3dba0c2c94f3804338f86621dc42405e380a6b3..eaac00e2534aca4eab92c7b9f9248e04b35b47df 100644 --- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java @@ -112,7 +112,7 @@ public class FarmBlock extends Block { @@ -17369,7 +17303,7 @@ index c3dba0c2c94f3804338f86621dc42405e380a6b3..6db97982972bfc67c828f574fb86391e super.fallOn(world, state, pos, entity, fallDistance); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage. if (world instanceof ServerLevel worldserver) { - if (world.random.nextFloat() < fallDistance - 0.5F && entity instanceof LivingEntity && (entity instanceof Player || worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) { -+ if ((worldserver.purpurConfig.farmlandTrampleHeight >= 0D ? fallDistance >= worldserver.purpurConfig.farmlandTrampleHeight : world.random.nextFloat() < fallDistance - 0.5F) && entity instanceof LivingEntity && (entity instanceof Player || worldserver.purpurConfig.farmlandBypassMobGriefing || worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) { // Purpur ++ if ((worldserver.purpurConfig.farmlandTrampleHeight >= 0D ? fallDistance >= worldserver.purpurConfig.farmlandTrampleHeight : world.random.nextFloat() < fallDistance - 0.5F) && entity instanceof LivingEntity && (entity instanceof Player || worldserver.purpurConfig.farmlandBypassMobGriefing ^ worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) { // Purpur // CraftBukkit start - Interact soil org.bukkit.event.Cancellable cancellable; if (entity instanceof Player) { @@ -17701,7 +17635,7 @@ index 53cea36ec931de89e0060613acf87beb51dc16ec..fd5489993dca0f940da69e9163f78e5c if (dripChance < f1) { diff --git a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java -index 53f1a7ed6b4bd6e2d8460531226aabf249994c02..3e1dddab0500bb805e5accd0ece69c450bad478f 100644 +index 53f1a7ed6b4bd6e2d8460531226aabf249994c02..3760c3c9ab45d7152661edd5a48893e1b583fb95 100644 --- a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java @@ -76,7 +76,7 @@ public class PowderSnowBlock extends Block implements BucketPickup { @@ -17709,7 +17643,7 @@ index 53f1a7ed6b4bd6e2d8460531226aabf249994c02..3e1dddab0500bb805e5accd0ece69c45 // CraftBukkit start if (entity.isOnFire() && entity.mayInteract(worldserver, pos)) { - if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !(worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || entity instanceof Player))) { -+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !((worldserver.purpurConfig.powderSnowBypassMobGriefing || worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) || entity instanceof Player))) { // Purpur ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !((worldserver.purpurConfig.powderSnowBypassMobGriefing ^ worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) || entity instanceof Player))) { // Purpur return; } // CraftBukkit end @@ -17970,7 +17904,7 @@ index 547ea09ed84595286c97c128b3b96f6d387ae25f..d0f8a13f27132257ece6dadf736c2dc6 + // Purpur end } diff --git a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java -index 953ddb2ea6fd48e57712e30a6addf23e188e5312..3829dbae8542396f8360eae54f0ed18fbde4cd8c 100644 +index 953ddb2ea6fd48e57712e30a6addf23e188e5312..f1dfb23160ff70e0da4dd2af2d83e879527c6651 100644 --- a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java @@ -171,7 +171,7 @@ public class TurtleEggBlock extends Block { @@ -18011,7 +17945,7 @@ index 953ddb2ea6fd48e57712e30a6addf23e188e5312..3829dbae8542396f8360eae54f0ed18f + return true; + } + -+ return world.purpurConfig.turtleEggsBypassMobGriefing || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); ++ return world.purpurConfig.turtleEggsBypassMobGriefing ^ world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); + // Purpur end } } @@ -18542,7 +18476,7 @@ index 205e223c356634bd6bc6bd58c6f0b7fda61a6f5f..bea05cb928d540a2f19b51bb7352d032 } diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 99fd67a78539133adf78d65e2c520ff3dd260301..852bfe68ab722a5cbdd90dbd70501b751fe81a78 100644 +index 5b6fbfd1a7a2d87fb2b87d5d1e674206cdf9b280..dcf2dcece3e995ce4646b931329246be19a4e1c2 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java @@ -91,7 +91,7 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -18564,45 +18498,37 @@ index 99fd67a78539133adf78d65e2c520ff3dd260301..852bfe68ab722a5cbdd90dbd70501b75 protected final String descriptionId; diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 4640baec5bed6c2d53cc0f8ca1d273cc115abe9b..15c83c6f5f56d6a27911d3bbd326cef1c21b1e58 100644 +index 4640baec5bed6c2d53cc0f8ca1d273cc115abe9b..5c4843f6cfd13790a44fc0f928f1fbcef8a648ce 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -407,11 +407,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - if (LightEngine.hasDifferentLightProperties(iblockdata1, iblockdata)) { - ProfilerFiller gameprofilerfiller = Profiler.get(); +@@ -88,6 +88,18 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + private final LevelChunkTicks fluidTicks; + private LevelChunk.UnsavedListener unsavedListener; -- gameprofilerfiller.push("updateSkyLightSources"); -+ //gameprofilerfiller.push("updateSkyLightSources"); // Purpur - // Paper - rewrite chunk system -- gameprofilerfiller.popPush("queueCheckLight"); -+ //gameprofilerfiller.popPush("queueCheckLight"); // Purpur - this.level.getChunkSource().getLightEngine().checkBlock(blockposition); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Purpur - } ++ // Pufferfish start - instead of using a random every time the chunk is ticked, define when lightning strikes preemptively ++ private int lightningTick; ++ // shouldDoLightning compiles down to 29 bytes, which with the default of 35 byte inlining should guarantee an inline ++ public final boolean shouldDoLightning(net.minecraft.util.RandomSource random) { ++ if (this.lightningTick-- <= 0) { ++ this.lightningTick = random.nextInt(this.level.spigotConfig.thunderChance) << 1; ++ return true; ++ } ++ return false; ++ } ++ // Pufferfish end ++ + public LevelChunk(Level world, ChunkPos pos) { + this(world, pos, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, (LevelChunkSection[]) null, (LevelChunk.PostLoadProcessor) null, (BlendingData) null); + } +@@ -121,6 +133,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + this.debug = !empty && this.level.isDebug(); + this.defaultBlockState = empty ? VOID_AIR_BLOCKSTATE : AIR_BLOCKSTATE; + // Paper end - get block chunk optimisation ++ ++ this.lightningTick = java.util.concurrent.ThreadLocalRandom.current().nextInt(100000) << 1; // Pufferfish - initialize lightning tick // Purpur - any random will do + } - boolean flag3 = iblockdata1.hasBlockEntity(); -@@ -1058,9 +1058,9 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - - if (LevelChunk.this.isTicking(blockposition)) { - try { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); - -- gameprofilerfiller.push(this::getType); -+ //gameprofilerfiller.push(this::getType); - BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); - - if (this.blockEntity.getType().isValid(iblockdata)) { -@@ -1076,7 +1076,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - // Paper end - Remove the Block Entity if it's invalid - } - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); - } catch (Throwable throwable) { - if (throwable instanceof ThreadDeath) throw throwable; // Paper - // Paper start - Prevent block entity and entity crashes + // CraftBukkit start diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java index 356d010506fd21f3c752e4aa86c46c1106fdde3b..86e16dd6b905af31795fda8002f2e1f857ddcb9f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java @@ -18616,10 +18542,10 @@ index 356d010506fd21f3c752e4aa86c46c1106fdde3b..86e16dd6b905af31795fda8002f2e1f8 listTag.add(compoundTagx); } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 78922c3e9a69db1774dd846047b79e9523d7cf41..0dde7cd71a32e6c0cde6cbbaef585896a3d7dae7 100644 +index e40665cead218502b44dd49051a53326ed94f061..cf0f3a14584b9280211f88808cb1ddfb10105ec5 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -@@ -274,7 +274,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -289,7 +289,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise // Paper start private static void printOversizedLog(String msg, Path file, int x, int z) { @@ -18628,6 +18554,19 @@ index 78922c3e9a69db1774dd846047b79e9523d7cf41..0dde7cd71a32e6c0cde6cbbaef585896 } private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException { +diff --git a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java +index d8b4196adf955f8d414688dc451caac2d9c609d9..80a43def4912a3228cd95117d5c2aac68798b4ec 100644 +--- a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java ++++ b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java +@@ -9,7 +9,7 @@ import javax.annotation.Nullable; + import net.minecraft.world.entity.Entity; + + public class EntityTickList { +- private final ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet entities = new ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<>(); // Paper - rewrite chunk system ++ public final ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet entities = new ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<>(); // Paper - rewrite chunk system // Pufferfish - private->public + + private void ensureActiveIsNotIterated() { + // Paper - rewrite chunk system diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java index 021221da5d0315f6e371380a705ac6b3f6ac18d3..27eb9a365006884c85603dc6d9dd8eee009c98b3 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java @@ -18734,32 +18673,6 @@ index 552925ba47c7475e2e1ec2ded0966f28ed3e50a5..1e741f36b79585f33abe413beafe00cf // Paper start - Add BlockBreakBlockEvent @Override protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state, BlockPos source) { -diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -index cc7d94144e39f7dace7b569b4567def98396e8f9..91abbda59446d462979dddc4b380c6f24d0b4c92 100644 ---- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -@@ -58,9 +58,9 @@ public class PathFinder { - @Nullable - // Paper start - Perf: remove streams and optimize collection - private Path findPath(Node startNode, List> positions, float followRange, int distance, float rangeMultiplier) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("find_path"); -- profilerFiller.markForCharting(MetricCategory.PATH_FINDING); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur -+ //profilerFiller.push("find_path"); // Purpur -+ //profilerFiller.markForCharting(MetricCategory.PATH_FINDING); // Purpur - // Set set = positions.keySet(); - startNode.g = 0.0F; - startNode.h = this.getBestH(startNode, positions); // Paper - optimize collection -@@ -128,7 +128,7 @@ public class PathFinder { - if (best == null || comparator.compare(path, best) < 0) - best = path; - } -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Purpur - return best; - // Paper end - Perf: remove streams and optimize collection - } diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java index c84fd369d92932903c76bb2012602617d3e2d213..224896124706764412033c8726c822e116f2c0f1 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java @@ -18838,39 +18751,6 @@ index 6cf6d4ec7b9e43c7b2b4c0e2fb080964ff588130..e74866e5195a5eeae7666ad7be750eda + } + // Purpur } -diff --git a/src/main/java/net/minecraft/world/ticks/LevelTicks.java b/src/main/java/net/minecraft/world/ticks/LevelTicks.java -index 778e6476c86d823dc8efe603a95e589e8b2ea9d9..452fb3442221fd66debfe1e1d6e85ee17951e556 100644 ---- a/src/main/java/net/minecraft/world/ticks/LevelTicks.java -+++ b/src/main/java/net/minecraft/world/ticks/LevelTicks.java -@@ -79,20 +79,20 @@ public class LevelTicks implements LevelTickAccess { - } - - public void tick(long time, int maxTicks, BiConsumer ticker) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("collect"); -- this.collectTicks(time, maxTicks, profilerFiller); -- profilerFiller.popPush("run"); -- profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size()); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Purpur -+ //profilerFiller.push("collect"); // Purpur -+ this.collectTicks(time, maxTicks, null); // Purpur -+ //profilerFiller.popPush("run"); // Purpur -+ //profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size()); // Purpur - this.runCollectedTicks(ticker); -- profilerFiller.popPush("cleanup"); -+ //profilerFiller.popPush("cleanup"); // Purpur - this.cleanupAfterTick(); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Purpur - } - - private void collectTicks(long time, int maxTicks, ProfilerFiller profiler) { - this.sortContainersToTick(time); -- profiler.incrementCounter("containersToTick", this.containersToTick.size()); -+ //profiler.incrementCounter("containersToTick", this.containersToTick.size()); // Purpur - this.drainContainers(time, maxTicks); - this.rescheduleLeftoverContainers(); - } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java index 94ca0407303c4493ab4928b12ec6ecc75aaca549..a138e1b6b66d99f2035de054137a607aa6b7f0b9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java @@ -19110,10 +18990,10 @@ index 94ca0407303c4493ab4928b12ec6ecc75aaca549..a138e1b6b66d99f2035de054137a607a + // Purpur end - OfflinePlayer API } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index dfddcfb1fe1679adaecf75375757dca720e76ce1..51770b116695c9d60d43785ae56e249672227025 100644 +index ac8af406180bc680d46e8edc3da0fc2e5211345a..81922bf93f8a96e6cf05944ca98a82cc5945a6c6 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -414,6 +414,20 @@ public final class CraftServer implements Server { +@@ -426,6 +426,20 @@ public final class CraftServer implements Server { this.paperPluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(this, this.commandMap, pluginManager); this.pluginManager.paperPluginManager = this.paperPluginManager; // Paper end @@ -19134,7 +19014,7 @@ index dfddcfb1fe1679adaecf75375757dca720e76ce1..51770b116695c9d60d43785ae56e2496 CraftRegistry.setMinecraftRegistry(console.registryAccess()); -@@ -1074,6 +1088,7 @@ public final class CraftServer implements Server { +@@ -1086,6 +1100,7 @@ public final class CraftServer implements Server { org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot this.console.paperConfigurations.reloadConfigs(this.console); @@ -19142,7 +19022,7 @@ index dfddcfb1fe1679adaecf75375757dca720e76ce1..51770b116695c9d60d43785ae56e2496 for (ServerLevel world : this.console.getAllLevels()) { // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) -@@ -1089,6 +1104,7 @@ public final class CraftServer implements Server { +@@ -1101,6 +1116,7 @@ public final class CraftServer implements Server { } } world.spigotConfig.init(); // Spigot @@ -19150,7 +19030,7 @@ index dfddcfb1fe1679adaecf75375757dca720e76ce1..51770b116695c9d60d43785ae56e2496 } Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper -@@ -1106,6 +1122,7 @@ public final class CraftServer implements Server { +@@ -1118,6 +1134,7 @@ public final class CraftServer implements Server { org.spigotmc.SpigotConfig.registerCommands(); // Spigot io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper this.spark.registerCommandBeforePlugins(this); // Paper - spark @@ -19158,7 +19038,7 @@ index dfddcfb1fe1679adaecf75375757dca720e76ce1..51770b116695c9d60d43785ae56e2496 this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); -@@ -1614,6 +1631,58 @@ public final class CraftServer implements Server { +@@ -1626,6 +1643,58 @@ public final class CraftServer implements Server { return true; } @@ -19217,7 +19097,7 @@ index dfddcfb1fe1679adaecf75375757dca720e76ce1..51770b116695c9d60d43785ae56e2496 @Override public List getRecipesFor(ItemStack result) { Preconditions.checkArgument(result != null, "ItemStack cannot be null"); -@@ -3019,6 +3088,18 @@ public final class CraftServer implements Server { +@@ -3031,6 +3100,18 @@ public final class CraftServer implements Server { return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console); } @@ -19236,7 +19116,7 @@ index dfddcfb1fe1679adaecf75375757dca720e76ce1..51770b116695c9d60d43785ae56e2496 @Override public void restart() { org.spigotmc.RestartCommand.restart(); -@@ -3048,6 +3129,7 @@ public final class CraftServer implements Server { +@@ -3060,6 +3141,7 @@ public final class CraftServer implements Server { @Override public double[] getTPS() { return new double[] { @@ -19244,10 +19124,10 @@ index dfddcfb1fe1679adaecf75375757dca720e76ce1..51770b116695c9d60d43785ae56e2496 net.minecraft.server.MinecraftServer.getServer().tps1.getAverage(), net.minecraft.server.MinecraftServer.getServer().tps5.getAverage(), net.minecraft.server.MinecraftServer.getServer().tps15.getAverage() -@@ -3246,4 +3328,16 @@ public final class CraftServer implements Server { - return this.potionBrewer; +@@ -3270,4 +3352,16 @@ public final class CraftServer implements Server { + this.console.addPluginAllowingSleep(plugin.getName(), value); } - // Paper end + // Paper end - API to check if the server is sleeping + + // Purpur start + @Override @@ -19262,10 +19142,10 @@ index dfddcfb1fe1679adaecf75375757dca720e76ce1..51770b116695c9d60d43785ae56e2496 + // Purpur end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 3134fab97260897601d7c8e2810f11b8be86dbec..9a104c48bb1a92655b1feaab3e01a3be6ec7d942 100644 +index 57da11c0da7322e74810e7108e9c8000b0c36520..907fe00ab752ad124020755f211567af771b9d70 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2391,6 +2391,48 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2384,6 +2384,48 @@ public class CraftWorld extends CraftRegionAccessor implements World { return (this.getHandle().getDragonFight() == null) ? null : new CraftDragonBattle(this.getHandle().getDragonFight()); } @@ -19315,10 +19195,10 @@ index 3134fab97260897601d7c8e2810f11b8be86dbec..9a104c48bb1a92655b1feaab3e01a3be public Collection getStructures(int x, int z) { return this.getStructures(x, z, struct -> true); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index a7524d3853d5b67b6385d2b74832b9267503dfe6..b2d60b214b58d9a5fadf3629e5ebc358c904d1c6 100644 +index be0d38544395a9b3befb898bb961f34e32fe9509..430407b0cf06ba337c59cd576c7e40a8e5fe8229 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -176,6 +176,14 @@ public class Main { +@@ -176,6 +176,20 @@ public class Main { .describedAs("Jar file"); // Paper end @@ -19328,12 +19208,18 @@ index a7524d3853d5b67b6385d2b74832b9267503dfe6..b2d60b214b58d9a5fadf3629e5ebc358 + .ofType(File.class) + .defaultsTo(new File("purpur.yml")) + .describedAs("Yml file"); ++ ++ acceptsAll(asList("pufferfish", "pufferfish-settings"), "File for pufferfish settings") ++ .withRequiredArg() ++ .ofType(File.class) ++ .defaultsTo(new File("pufferfish.yml")) ++ .describedAs("Yml file"); + // Purpur end + // Paper start acceptsAll(asList("server-name"), "Name of the server") .withRequiredArg() -@@ -259,7 +267,7 @@ public class Main { +@@ -259,7 +273,7 @@ public class Main { System.setProperty(net.minecrell.terminalconsole.TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper } @@ -19551,7 +19437,7 @@ index ddabaed899c755925ad8618b78c33dacaf2126ac..51aee9a468f4ebfa9672fd9ce84883cf + // Purpur end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 4312290ad970f71e1dc25b707ab312c597a481a9..e0cbf2e2c17c87af23495e6365ff9378f7c861da 100644 +index e345cdbfab44a0f5da80d738798dbb4424b7ab5c..856f12eb276c214f2f57a58a89a4da9eea34db2d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -273,6 +273,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @@ -19692,7 +19578,7 @@ index 351f42842b780d053cd2e5bad9ae299449141b10..4860574e7fad7a9527dda599703c573c + // Purpur end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d0010dfd22463986bf3be9b3ee015ce92735753e..3ffd75c2547e1c113f65cf258ae6a9ce8d353fef 100644 +index d4e497961578bb693275cdf95915b60b2cc76eb7..63065a22ff359c142bab23fccacfd5ebd86f81a5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -583,10 +583,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -19712,7 +19598,7 @@ index d0010dfd22463986bf3be9b3ee015ce92735753e..3ffd75c2547e1c113f65cf258ae6a9ce if (this.getHandle().connection == null) return; // Paper - Updates are possible before the player has fully joined for (ServerPlayer player : (List) this.server.getHandle().players) { if (player.getBukkitEntity().canSee(this)) { -@@ -1433,6 +1438,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1435,6 +1440,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // Paper start - Teleport passenger API // Don't allow teleporting between worlds while keeping passengers if (ignorePassengers && entity.isVehicle() && location.getWorld() != this.getWorld()) { @@ -19720,7 +19606,7 @@ index d0010dfd22463986bf3be9b3ee015ce92735753e..3ffd75c2547e1c113f65cf258ae6a9ce return false; } -@@ -1454,6 +1460,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1456,6 +1462,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } if (entity.isVehicle() && !ignorePassengers) { // Paper - Teleport API @@ -19728,7 +19614,7 @@ index d0010dfd22463986bf3be9b3ee015ce92735753e..3ffd75c2547e1c113f65cf258ae6a9ce return false; } -@@ -2767,6 +2774,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2769,6 +2776,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return this.getHandle().getAbilities().walkingSpeed * 2f; } @@ -19757,7 +19643,7 @@ index d0010dfd22463986bf3be9b3ee015ce92735753e..3ffd75c2547e1c113f65cf258ae6a9ce private void validateSpeed(float value) { Preconditions.checkArgument(value <= 1f && value >= -1f, "Speed value (%s) need to be between -1f and 1f", value); } -@@ -3578,4 +3607,70 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3580,4 +3609,70 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundEntityEventPacket(((CraftEntity) target).getHandle(), effect.getData())); } // Paper end - entity effect API @@ -19910,7 +19796,7 @@ index ecd33b4add46acbe4e4f8879c0601220423d66ca..1506a8c0fa490726eb4a4ae14f3aa194 + // Purpur end } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index deba03eb37012c638e08e20cd1c98e9db190c790..1f22e7cf584bf7361f3ca078b9935a096d1acba6 100644 +index e37aaf77f94b97b736cc20ef070cefdff0400188..763d06265c7d0000e4c641c3aaba785bb0efb23e 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -602,6 +602,15 @@ public class CraftEventFactory { @@ -19972,7 +19858,7 @@ index 6d3f9d5dab6c9a2860ae31cae24310aa2d62da7c..4f29c579f94efe59a8c78520d75676fc case DISPENSER: case DROPPER: diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -index af1ae3dacb628da23f7d2988c6e76d3fb2d64103..4ee2d501f882279b48edb4b8bf0824587c276bf6 100644 +index c6159c70f7a37b9bffe268b91905ce848d1d2927..d02adaaa6fbdc1c0eff44cb4a1f1642f9575a821 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -84,7 +84,7 @@ public class CraftInventory implements Inventory { @@ -20042,13 +19928,13 @@ index 792cb6adf0c7a6335cc5985fce8bed2e0f1149af..5734c5caffda79383ae30df20c3defb5 + // Purpur end - Anvil API } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index 756c73a401437566258813946fa10c7caa8f2469..2b6f9fce59178525b1211f2133645a7991a146dd 100644 +index 78975412da0f0c2b802bfce6d30d56b26d8023e2..4ec6a07796023aab2f8f84f131f48108c235c852 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -@@ -526,4 +526,285 @@ public final class CraftItemStack extends ItemStack { - return this.pdcView; +@@ -658,4 +658,285 @@ public final class CraftItemStack extends ItemStack { } - // Paper end - pdc + + // Paper end - data component API + + // Purpur start + @Override @@ -20331,6 +20217,30 @@ index 756c73a401437566258813946fa10c7caa8f2469..2b6f9fce59178525b1211f2133645a79 + } + // Purpur end } +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java +index 3592091c6d1371224e82e1f95b003951ad2f8779..4fdc78a9c74b42a8894030221e0452493d68020e 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftRecipe.java +@@ -38,6 +38,7 @@ public interface CraftRecipe extends Recipe { + stack = Ingredient.of(((RecipeChoice.MaterialChoice) bukkit).getChoices().stream().map((mat) -> CraftItemType.bukkitToMinecraft(mat))); + } else if (bukkit instanceof RecipeChoice.ExactChoice) { + stack = Ingredient.ofStacks(((RecipeChoice.ExactChoice) bukkit).getChoices().stream().map((mat) -> CraftItemStack.asNMSCopy(mat)).toList()); ++ stack.predicate = ((RecipeChoice.ExactChoice) bukkit).getPredicate(); // Purpur + // Paper start - support "empty" choices - legacy method that spigot might incorrectly call + // Their impl of Ingredient.of() will error, ingredients need at least one entry. + // Callers running into this exception may have passed an incorrect empty() recipe choice to a non-empty slot or +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java +index 7c989318dc7ad89bb0d9143fcaac1e4bba6f5907..143a4d4efcc989ed4a4c73cc304e1978ad8f0699 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java +@@ -44,6 +44,6 @@ public class CraftShapelessRecipe extends ShapelessRecipe implements CraftRecipe + data.add(this.toNMS(i, true)); + } + +- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftRecipe.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.ShapelessRecipe(this.getGroup(), CraftRecipe.getCategory(this.getCategory()), CraftItemStack.asNMSCopy(this.getResult()), data))); ++ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftRecipe.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.ShapelessRecipe(this.getGroup(), CraftRecipe.getCategory(this.getCategory()), CraftItemStack.asNMSCopy(this.getResult()), data, true))); // Pufferfish + } + } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftAnvilView.java b/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftAnvilView.java index f86c95a13dff012de5db3e41ac261e9e8d44d9f3..1db0b790d824e419bb5fb6ab1f3003e120f9763b 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftAnvilView.java @@ -20427,7 +20337,7 @@ index cf0920e5f84b35647882fb963e9972af4e8427e0..e30c851acf49a425cd4fd409a6d5bbb2 + // Purpur - end } diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index 6fef86e47e37eab6721cfd67d494afb25a2ded68..c914e1e13c4f64f24efa5f825e58efb69632bfa6 100644 +index 1354ccfbf525e5e64483ac5f443cc2325ba63850..5e7b833fc9f37bc370c76e5c43e6c9919d6d20af 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -491,7 +491,7 @@ public class CraftScheduler implements BukkitScheduler { @@ -20440,7 +20350,7 @@ index 6fef86e47e37eab6721cfd67d494afb25a2ded68..c914e1e13c4f64f24efa5f825e58efb6 // (async tasks must live with race-conditions if they attempt to cancel between these few lines of code) } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 83020837e29ee627b1081daddb4bdee147b95af3..9bd91ddb964ff4d10a3a87ee50849ddf3c4d22e8 100644 +index 507f908916cbeb592496f963b46e4c2121a7b5e3..86ba02ba848ee20a2e2b52baab8986dd5a013f98 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -505,7 +505,7 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -21100,10 +21010,10 @@ index 0000000000000000000000000000000000000000..95cd1156766895546ef5574b33a60806 +} diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java new file mode 100644 -index 0000000000000000000000000000000000000000..742a46ef95a5e46e9c338cedcecaf008a7108c58 +index 0000000000000000000000000000000000000000..57ddb4e6a464567cc67e09ce06218cc25af4ddf9 --- /dev/null +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -@@ -0,0 +1,3419 @@ +@@ -0,0 +1,3438 @@ +package org.purpurmc.purpur; + +import net.minecraft.core.registries.BuiltInRegistries; @@ -21230,6 +21140,7 @@ index 0000000000000000000000000000000000000000..742a46ef95a5e46e9c338cedcecaf008 + public boolean boatEjectPlayersOnLand = false; + public boolean boatsDoFallDamage = false; + public boolean disableDropsOnCrammingDeath = false; ++ public boolean milkCuresBadOmen = true; + public double tridentLoyaltyVoidReturnHeight = 0.0D; + public boolean entitiesCanUsePortals = true; + public int raidCooldownSeconds = 0; @@ -21258,6 +21169,7 @@ index 0000000000000000000000000000000000000000..742a46ef95a5e46e9c338cedcecaf008 + boatEjectPlayersOnLand = getBoolean("gameplay-mechanics.boat.eject-players-on-land", boatEjectPlayersOnLand); + boatsDoFallDamage = getBoolean("gameplay-mechanics.boat.do-fall-damage", boatsDoFallDamage); + disableDropsOnCrammingDeath = getBoolean("gameplay-mechanics.disable-drops-on-cramming-death", disableDropsOnCrammingDeath); ++ milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen); + tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight); + entitiesCanUsePortals = getBoolean("gameplay-mechanics.entities-can-use-portals", entitiesCanUsePortals); + raidCooldownSeconds = getInt("gameplay-mechanics.raid-cooldown-seconds", raidCooldownSeconds); @@ -22324,7 +22236,7 @@ index 0000000000000000000000000000000000000000..742a46ef95a5e46e9c338cedcecaf008 + public double beeMaxHealth = 10.0D; + public double beeScale = 1.0D; + public int beeBreedingTicks = 6000; -+ public boolean beeTakeDamageFromWater = false; ++ public boolean beeTakeDamageFromWater = true; + public boolean beeCanWorkAtNight = false; + public boolean beeCanWorkInRain = false; + public boolean beeAlwaysDropExp = false; @@ -22544,6 +22456,19 @@ index 0000000000000000000000000000000000000000..742a46ef95a5e46e9c338cedcecaf008 + cowAlwaysDropExp = getBoolean("mobs.cow.always-drop-exp", cowAlwaysDropExp); + } + ++ public boolean creakingRidable = false; ++ public boolean creakingRidableInWater = true; ++ public boolean creakingControllable = true; ++ public double creakingMaxHealth = 1.0D; ++ public double creakingScale = 1.0D; ++ private void creakingSettings() { ++ creakingRidable = getBoolean("mobs.creaking.ridable", creakingRidable); ++ creakingRidableInWater = getBoolean("mobs.creaking.ridable-in-water", creakingRidableInWater); ++ creakingControllable = getBoolean("mobs.creaking.controllable", creakingControllable); ++ creakingMaxHealth = getDouble("mobs.creaking.attributes.max_health", creakingMaxHealth); ++ creakingScale = Mth.clamp(getDouble("mobs.creaking.attributes.scale", creakingScale), 0.0625D, 16.0D); ++ } ++ + public boolean creeperRidable = false; + public boolean creeperRidableInWater = true; + public boolean creeperControllable = true; @@ -24080,6 +24005,7 @@ index 0000000000000000000000000000000000000000..742a46ef95a5e46e9c338cedcecaf008 + public double villagerMaxHealth = 20.0D; + public double villagerScale = 1.0D; + public boolean villagerFollowEmeraldBlock = false; ++ public double villagerTemptRange = 10.0D; + public boolean villagerCanBeLeashed = false; + public boolean villagerCanBreed = true; + public int villagerBreedingTicks = 6000; @@ -24110,6 +24036,7 @@ index 0000000000000000000000000000000000000000..742a46ef95a5e46e9c338cedcecaf008 + villagerMaxHealth = getDouble("mobs.villager.attributes.max_health", villagerMaxHealth); + villagerScale = Mth.clamp(getDouble("mobs.villager.attributes.scale", villagerScale), 0.0625D, 16.0D); + villagerFollowEmeraldBlock = getBoolean("mobs.villager.follow-emerald-blocks", villagerFollowEmeraldBlock); ++ villagerTemptRange = getDouble("mobs.villager.attributes.tempt_range", villagerTemptRange); + villagerCanBeLeashed = getBoolean("mobs.villager.can-be-leashed", villagerCanBeLeashed); + villagerCanBreed = getBoolean("mobs.villager.can-breed", villagerCanBreed); + villagerBreedingTicks = getInt("mobs.villager.breeding-delay-ticks", villagerBreedingTicks); @@ -24169,6 +24096,7 @@ index 0000000000000000000000000000000000000000..742a46ef95a5e46e9c338cedcecaf008 + public double wanderingTraderMaxHealth = 20.0D; + public double wanderingTraderScale = 1.0D; + public boolean wanderingTraderFollowEmeraldBlock = false; ++ public double wanderingTraderTemptRange = 10.0D; + public boolean wanderingTraderCanBeLeashed = false; + public boolean wanderingTraderTakeDamageFromWater = false; + public boolean wanderingTraderAllowTrading = true; @@ -24185,6 +24113,7 @@ index 0000000000000000000000000000000000000000..742a46ef95a5e46e9c338cedcecaf008 + wanderingTraderMaxHealth = getDouble("mobs.wandering_trader.attributes.max_health", wanderingTraderMaxHealth); + wanderingTraderScale = Mth.clamp(getDouble("mobs.wandering_trader.attributes.scale", wanderingTraderScale), 0.0625D, 16.0D); + wanderingTraderFollowEmeraldBlock = getBoolean("mobs.wandering_trader.follow-emerald-blocks", wanderingTraderFollowEmeraldBlock); ++ wanderingTraderTemptRange = getDouble("mobs.wandering_trader.attributes.tempt_range", wanderingTraderTemptRange); + wanderingTraderCanBeLeashed = getBoolean("mobs.wandering_trader.can-be-leashed", wanderingTraderCanBeLeashed); + wanderingTraderTakeDamageFromWater = getBoolean("mobs.wandering_trader.takes-damage-from-water", wanderingTraderTakeDamageFromWater); + wanderingTraderAllowTrading = getBoolean("mobs.wandering_trader.allow-trading", wanderingTraderAllowTrading); @@ -25252,15 +25181,17 @@ index 0000000000000000000000000000000000000000..dd219518150ca90f89ad238904fd4095 +} diff --git a/src/main/java/org/purpurmc/purpur/controller/MoveControllerWASD.java b/src/main/java/org/purpurmc/purpur/controller/MoveControllerWASD.java new file mode 100644 -index 0000000000000000000000000000000000000000..21fd6ea2a482758a3016e3bc2cdebe2d89267481 +index 0000000000000000000000000000000000000000..ad85c1ff6cd5d5ce2262bdb367ce9c8a5b707170 --- /dev/null +++ b/src/main/java/org/purpurmc/purpur/controller/MoveControllerWASD.java -@@ -0,0 +1,89 @@ +@@ -0,0 +1,92 @@ +package org.purpurmc.purpur.controller; + ++import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.control.MoveControl; ++import net.minecraft.world.entity.player.Input; +import net.minecraft.world.entity.player.Player; +import org.purpurmc.purpur.event.entity.RidableSpacebarEvent; + @@ -25297,8 +25228,9 @@ index 0000000000000000000000000000000000000000..21fd6ea2a482758a3016e3bc2cdebe2d + } + + public void purpurTick(Player rider) { -+ float forward = rider.getForwardMot() * 0.5F; -+ float strafe = rider.getStrafeMot() * 0.25F; ++ Input lastClientInput = ((ServerPlayer) rider).getLastClientInput(); ++ float forward = (lastClientInput.forward() == lastClientInput.backward() ? 0.0F : lastClientInput.forward() ? 1.0F : -1.0F) * 0.5F; ++ float strafe = (lastClientInput.left() == lastClientInput.right() ? 0.0F : lastClientInput.left() ? 1.0F : -1.0F) * 0.25F; + + if (forward <= 0.0F) { + forward *= 0.5F; @@ -27088,10 +27020,21 @@ index 0000000000000000000000000000000000000000..129acb8ad139decc6b1c023cb10bc32d + // Paper end - lifecycle events +} diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index bd7c37123c70d2afdef252f39548725d4ef318ed..e047c0a4a8638588b4ac0d47c4c96899fac4abb7 100644 +index 1d438ef44cbe4d1eedfba36d8fe5d2ad53464921..9b1a16747aa23b18e4cff986efaac6ce64b6ddb9 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -199,6 +199,8 @@ public class ActivationRange +@@ -37,6 +37,10 @@ import net.minecraft.world.entity.projectile.ThrownTrident; + import net.minecraft.world.entity.raid.Raider; + import net.minecraft.world.level.Level; + import net.minecraft.world.phys.AABB; ++// Pufferfish start ++import net.minecraft.world.phys.Vec3; ++import java.util.List; ++// Pufferfish end + + public class ActivationRange + { +@@ -199,6 +203,8 @@ public class ActivationRange continue; } @@ -27100,7 +27043,57 @@ index bd7c37123c70d2afdef252f39548725d4ef318ed..e047c0a4a8638588b4ac0d47c4c96899 // Paper start int worldHeight = world.getHeight(); ActivationRange.maxBB = player.getBoundingBox().inflate( maxRange, worldHeight, maxRange ); -@@ -376,6 +378,7 @@ public class ActivationRange +@@ -221,6 +227,25 @@ public class ActivationRange + } + // Paper end - Configurable marker ticking + ActivationRange.activateEntity(entity); ++ ++ // Pufferfish start ++ if (gg.pufferfish.pufferfish.PufferfishConfig.dearEnabled && entity.getType().dabEnabled) { ++ if (!entity.activatedPriorityReset) { ++ entity.activatedPriorityReset = true; ++ entity.activatedPriority = gg.pufferfish.pufferfish.PufferfishConfig.maximumActivationPrio; ++ } ++ Vec3 playerVec = player.position(); ++ Vec3 entityVec = entity.position(); ++ double diffX = playerVec.x - entityVec.x, diffY = playerVec.y - entityVec.y, diffZ = playerVec.z - entityVec.z; ++ int squaredDistance = (int) (diffX * diffX + diffY * diffY + diffZ * diffZ); ++ entity.activatedPriority = squaredDistance > gg.pufferfish.pufferfish.PufferfishConfig.startDistanceSquared ? ++ Math.max(1, Math.min(squaredDistance >> gg.pufferfish.pufferfish.PufferfishConfig.activationDistanceMod, entity.activatedPriority)) : ++ 1; ++ } else { ++ entity.activatedPriority = 1; ++ } ++ // Pufferfish end ++ + } + // Paper end + } +@@ -236,12 +261,12 @@ public class ActivationRange + if ( MinecraftServer.currentTick > entity.activatedTick ) + { + if ( entity.defaultActivationState ) +- { ++ { // Pufferfish - diff on change + entity.activatedTick = MinecraftServer.currentTick; + return; + } + if ( entity.activationType.boundingBox.intersects( entity.getBoundingBox() ) ) +- { ++ { // Pufferfish - diff on change + entity.activatedTick = MinecraftServer.currentTick; + } + } +@@ -295,7 +320,7 @@ public class ActivationRange + if ( entity instanceof LivingEntity ) + { + LivingEntity living = (LivingEntity) entity; +- if ( living.onClimbable() || living.jumping || living.hurtTime > 0 || living.activeEffects.size() > 0 || living.isFreezing()) // Paper ++ if ( living.onClimableCached() || living.jumping || living.hurtTime > 0 || living.activeEffects.size() > 0 || living.isFreezing() ) // Paper // Pufferfish - use cached + { + return 1; // Paper + } +@@ -376,6 +401,7 @@ public class ActivationRange */ public static boolean checkIfActive(Entity entity) { diff --git a/patches/server/0002-mc-dev-fixes.patch b/patches/server/0002-mc-dev-fixes.patch index f00d0c7..989daf4 100644 --- a/patches/server/0002-mc-dev-fixes.patch +++ b/patches/server/0002-mc-dev-fixes.patch @@ -4,6 +4,56 @@ Date: Sat, 2 Nov 2024 15:26:27 +0900 Subject: [PATCH] mc dev fixes +diff --git a/src/main/java/net/minecraft/server/commands/DebugCommand.java b/src/main/java/net/minecraft/server/commands/DebugCommand.java +index 06568cc308e06b16f43ec7facd5e2c4e36f3fee9..f8cdd6911fe9d6402455b7368d0e98c25e9511ca 100644 +--- a/src/main/java/net/minecraft/server/commands/DebugCommand.java ++++ b/src/main/java/net/minecraft/server/commands/DebugCommand.java +@@ -271,5 +271,12 @@ public class DebugCommand { + public void close() { + IOUtils.closeQuietly((Writer)this.output); + } ++ ++ // Plazma start - Decompile fixes ++ @Override ++ public CommandSender getBukkitSender(final CommandSourceStack wrapper) { ++ return wrapper.getBukkitSender(); ++ } ++ // Plazma end - Decompile fixes + } + } +diff --git a/src/main/java/net/minecraft/server/commands/ReturnCommand.java b/src/main/java/net/minecraft/server/commands/ReturnCommand.java +index 9f82ca1fee2a319d52a4106c3581f5e9a9554a9e..f5c7748117342dedd9d600881143c206e429fe5b 100644 +--- a/src/main/java/net/minecraft/server/commands/ReturnCommand.java ++++ b/src/main/java/net/minecraft/server/commands/ReturnCommand.java +@@ -16,18 +16,18 @@ import net.minecraft.commands.execution.tasks.BuildContexts; + import net.minecraft.commands.execution.tasks.FallthroughTask; + + public class ReturnCommand { +- public static > void register(CommandDispatcher dispatcher) { +- dispatcher.register( +- (LiteralArgumentBuilder)LiteralArgumentBuilder.literal("return") +- .requires(source -> source.hasPermission(2)) +- .then( +- RequiredArgumentBuilder.argument("value", IntegerArgumentType.integer()) +- .executes(new ReturnCommand.ReturnValueCustomExecutor<>()) +- ) +- .then(LiteralArgumentBuilder.literal("fail").executes(new ReturnCommand.ReturnFailCustomExecutor<>())) +- .then(LiteralArgumentBuilder.literal("run").forward(dispatcher.getRoot(), new ReturnCommand.ReturnFromCommandCustomModifier<>(), false)) ++ ++ // Plazma start - Decompile fixes ++ public static void register(CommandDispatcher dispatcher) { ++ dispatcher.register(net.minecraft.commands.Commands.literal("return") ++ .requires(source -> source.hasPermission(2)) ++ .then(net.minecraft.commands.Commands.argument("value", IntegerArgumentType.integer()) ++ .executes(new ReturnCommand.ReturnValueCustomExecutor<>())) ++ .then(net.minecraft.commands.Commands.literal("fail").executes(new ReturnCommand.ReturnFailCustomExecutor<>())) ++ .then(net.minecraft.commands.Commands.literal("run").forward(dispatcher.getRoot(), new ReturnCommand.ReturnFromCommandCustomModifier<>(), false)) + ); + } ++ // Plazma end - Decompile fixes + + static class ReturnFailCustomExecutor> implements CustomCommandExecutor.CommandAdapter { + @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/AllayAi.java b/src/main/java/net/minecraft/world/entity/animal/allay/AllayAi.java index 3fc1ec01e1a77a169ec762a23f15b97f040ce5f8..b5464708c1fa949e7df8aed71126ccad72d66ee3 100644 --- a/src/main/java/net/minecraft/world/entity/animal/allay/AllayAi.java diff --git a/patches/server/0003-Minor-code-optimizations.patch b/patches/server/0003-Minor-code-optimizations.patch new file mode 100644 index 0000000..9ab49dd --- /dev/null +++ b/patches/server/0003-Minor-code-optimizations.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Fri, 13 Dec 2024 13:54:22 +0900 +Subject: [PATCH] Minor code optimizations + + +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index 34e8eb828be517d9ee3973597c74c5cac3d75c99..f8575f94a389d87d8043ae838720dbe2247235c4 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -1697,7 +1697,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + @Override + public List getEntities(@Nullable Entity except, AABB box, Predicate predicate) { + Profiler.get().incrementCounter("getEntities"); +- List list = Lists.newArrayList(); ++ //List list = Lists.newArrayList(); // Plazma - minor optimizations + + // Paper start - rewrite chunk system + final List ret = new java.util.ArrayList<>(); diff --git a/patches/server/0003-Build-System-Changes.patch b/patches/server/0004-Build-System-Changes.patch similarity index 79% rename from patches/server/0003-Build-System-Changes.patch rename to patches/server/0004-Build-System-Changes.patch index 3a88313..0522c48 100644 --- a/patches/server/0003-Build-System-Changes.patch +++ b/patches/server/0004-Build-System-Changes.patch @@ -5,16 +5,16 @@ Subject: [PATCH] Build System Changes diff --git a/build.gradle.kts b/build.gradle.kts -index b4579fb919d8cc981edc4863b82abca531349f1e..6734821658e7679f328336038587390a262f2b64 100644 +index 77602e4445b1b45a17e5552ac6a769e0ed46ebc7..f021047331c7eb3dac7f0d56af73a9056ffe826b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -25,64 +25,30 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider { - // Paper end - configure mockito agent that is needed in newer java versions +@@ -26,71 +26,34 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider { dependencies { -- implementation(project(":purpur-api")) // Pufferfish // Paper // Purpur + implementation(project(":purpur-api")) // Pufferfish // Paper // Purpur - // Paper start -- implementation("org.jline:jline-terminal-jansi:3.21.0") +- implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ +- implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 - implementation("net.minecrell:terminalconsoleappender:1.3.0") - implementation("net.kyori:adventure-text-serializer-ansi:4.17.0") // Keep in sync with adventureVersion from Paper-API build file - /* @@ -46,6 +46,13 @@ index b4579fb919d8cc981edc4863b82abca531349f1e..6734821658e7679f328336038587390a - runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18") - runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18") - +- // Pufferfish start +- implementation("org.yaml:snakeyaml:1.32") +- implementation ("com.github.carleslc.Simple-YAML:Simple-Yaml:1.8.4") { // Purpur +- exclude(group="org.yaml", module="snakeyaml") +- } +- // Pufferfish end +- - implementation("org.mozilla:rhino-runtime:1.7.14") // Purpur - implementation("org.mozilla:rhino-engine:1.7.14") // Purpur - implementation("dev.omega24:upnp4j:1.0") // Purpur @@ -55,30 +62,7 @@ index b4579fb919d8cc981edc4863b82abca531349f1e..6734821658e7679f328336038587390a - testImplementation("org.junit.platform:junit-platform-suite-engine:1.10.0") - testImplementation("org.hamcrest:hamcrest:2.2") - testImplementation("org.mockito:mockito-core:5.14.1") -+ // Plazma start - Build System Changes -+ implementation(project(":${rootProject.providers.gradleProperty("brandName").get().lowercase()}-api")) -+ implementation(common.snakeyaml) -+ implementation(common.asm.commons) -+ implementation(common.log4j.core) -+ implementation(common.log4j.iostreams) -+ implementation(common.commons.lang2) -+ implementation(common.adventure.serializer.ansi) -+ implementation(server.velocity) { isTransitive = false } -+ implementation(server.simpleyaml) { exclude(group="org.yaml", module="snakeyaml") } -+ implementation(server.bundles.implementation) -+ -+ log4jPlugins.annotationProcessorConfigurationName(common.log4j.core) -+ alsoShade(log4jPlugins.output) // diff on changes -+ runtimeOnly(log4jPlugins.output) // diff on changes -+ -+ runtimeOnly(common.maven.provider) -+ runtimeOnly(common.bundles.maven) -+ runtimeOnly(server.bundles.runtime) -+ -+ testImplementation(common.bundles.test) -+ testImplementation(server.bundles.test) -+ // Plazma end - Build System Changes - mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Paper - configure mockito agent that is needed in newer java versions +- mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Paper - configure mockito agent that is needed in newer java versions - testImplementation("org.ow2.asm:asm-tree:9.7.1") - testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest - implementation("net.neoforged:srgutils:1.0.9") // Paper - mappings handling @@ -91,12 +75,40 @@ index b4579fb919d8cc981edc4863b82abca531349f1e..6734821658e7679f328336038587390a - // Paper end - Remap reflection - // Paper start - spark - implementation("me.lucko:spark-api:0.1-20240720.200737-2") -- implementation("me.lucko:spark-paper:1.10.105-SNAPSHOT") +- implementation("me.lucko:spark-paper:1.10.119-SNAPSHOT") - // Paper end - spark ++ // Plazma start - Use Gradle Version Catalogs ++ implementation(server.bundles.implementation) ++ implementation(common.adventure.serializer.ansi) ++ implementation(common.log4j.stream) ++ ++ implementation(common.log4j) ++ log4jPlugins.annotationProcessorConfigurationName(common.log4j) ++ runtimeOnly(log4jPlugins.output) // diff on change ++ alsoShade(log4jPlugins.output) // diff on change ++ ++ runtimeOnly(server.bundles.runtime) ++ ++ implementation(common.bundles.asm) ++ implementation(common.commons.lang2) ++ implementation(server.velocity.native) { isTransitive = false } ++ ++ runtimeOnly(common.mvn) ++ runtimeOnly(common.bundles.mvn) ++ ++ implementation(common.snakeyaml) ++ implementation(server.simpleyaml) { exclude(group="org.yaml", module="snakeyaml") } ++ ++ testImplementation(server.classgraph) ++ testImplementation(common.bundles.test) ++ testImplementation(common.junit) ++ mockitoAgent(common.mockito) { isTransitive = false } ++ testImplementation(common.junit.pioneer) ++ // Plazma end - Use Gradle Version Catalogs } paperweight { -@@ -102,14 +68,14 @@ tasks.jar { +@@ -118,14 +81,14 @@ tasks.jar { val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", diff --git a/patches/server/0004-Fork-friendly-Rebranding.patch b/patches/server/0005-Fork-friendly-Rebranding.patch similarity index 93% rename from patches/server/0004-Fork-friendly-Rebranding.patch rename to patches/server/0005-Fork-friendly-Rebranding.patch index 7ee3bfb..5494caf 100644 --- a/patches/server/0004-Fork-friendly-Rebranding.patch +++ b/patches/server/0005-Fork-friendly-Rebranding.patch @@ -4,6 +4,19 @@ Date: Wed, 21 Dec 2022 19:31:24 +0900 Subject: [PATCH] Fork-friendly Rebranding +diff --git a/build.gradle.kts b/build.gradle.kts +index f021047331c7eb3dac7f0d56af73a9056ffe826b..41005f58fdd526907972185e728bbe1fa97171e9 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -25,7 +25,7 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider { + // Paper end - configure mockito agent that is needed in newer java versions + + dependencies { +- implementation(project(":purpur-api")) // Pufferfish // Paper // Purpur ++ implementation(project(":plazma-api")) // Pufferfish // Paper // Purpur // Plazma + // Plazma start - Use Gradle Version Catalogs + implementation(server.bundles.implementation) + implementation(common.adventure.serializer.ansi) diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java index 8cde30544e14f8fc2dac32966ae3c21f8cf3a551..8d5a52c5762c3d9b44dcdf00ae312e0bdc01fa1f 100644 --- a/src/main/java/com/destroystokyo/paper/Metrics.java @@ -127,20 +140,21 @@ index 0000000000000000000000000000000000000000..3af005ce2bbd30601917987d8c831db2 + +} diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java -index a6e5950b5875cafd734300cdfbf58f5d3736f3c8..a337e2c9576fb70a8ee9082e9b69719c804b286e 100644 +index 3099c21ee589acf6edff5903a23673adf489024f..a337e2c9576fb70a8ee9082e9b69719c804b286e 100644 --- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java +++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java -@@ -30,9 +30,6 @@ public record ServerBuildInfoImpl( +@@ -30,10 +30,6 @@ public record ServerBuildInfoImpl( private static final String ATTRIBUTE_GIT_BRANCH = "Git-Branch"; private static final String ATTRIBUTE_GIT_COMMIT = "Git-Commit"; - private static final String BRAND_PAPER_NAME = "Paper"; +- private static final String BRAND_PUFFERFISH_NAME = "Pufferfish"; // Purpur - private static final String BRAND_PURPUR_NAME = "Purpur"; // Purpur - private static final String BUILD_DEV = "DEV"; public ServerBuildInfoImpl() { -@@ -43,9 +40,9 @@ public record ServerBuildInfoImpl( +@@ -44,9 +40,9 @@ public record ServerBuildInfoImpl( this( getManifestAttribute(manifest, ATTRIBUTE_BRAND_ID) .map(Key::key) @@ -152,30 +166,28 @@ index a6e5950b5875cafd734300cdfbf58f5d3736f3c8..a337e2c9576fb70a8ee9082e9b69719c SharedConstants.getCurrentVersion().getId(), SharedConstants.getCurrentVersion().getName(), getManifestAttribute(manifest, ATTRIBUTE_BUILD_NUMBER) -@@ -62,7 +59,7 @@ public record ServerBuildInfoImpl( +@@ -63,7 +59,7 @@ public record ServerBuildInfoImpl( @Override public boolean isBrandCompatible(final @NotNull Key brandId) { -- return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID); // Purpur +- return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID) || brandId.equals(BRAND_PUFFERFISH_ID); // Purpur + return brandId.equals(this.brandId) || SUPPORTED_BRANDS.contains(brandId); // Purpur // Plazma - Fork-friendly Rebranding } @Override diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java -index 87e5f614ba988547a827486740db217e28585773..f5aac6cde46ca08a4d4792e38f514bb3d8188ae8 100644 +index 8cf720f08514e8e4f62f4ad196f1277bd761c6b2..cda2ca940e30506807a5d12b84dbf69529051e26 100644 --- a/src/main/java/io/papermc/paper/configuration/Configurations.java +++ b/src/main/java/io/papermc/paper/configuration/Configurations.java -@@ -113,9 +113,7 @@ public abstract class Configurations { - try { +@@ -112,7 +112,7 @@ public abstract class Configurations { loader.save(node); } catch (ConfigurateException ex) { -- if (ex.getCause() instanceof AccessDeniedException) { + if (ex.getCause() instanceof AccessDeniedException) { - LOGGER.warn("Could not save {}: Paper could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at https://docs.papermc.io/paper/configuration for more details.", filename, ex); -- } else throw ex; -+ if (ex.getCause() instanceof AccessDeniedException) LOGGER.warn("Could not save {}: {} could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at {} for more details.", filename, io.papermc.paper.ServerBrandConstants.BRAND_NAME, io.papermc.paper.ServerBrandConstants.CONFIG_REFERENCE, ex); else throw ex; // Plazma - Fork-friendly Rebranding ++ LOGGER.warn("Could not save {}: {} could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at {} for more details.", filename, io.papermc.paper.ServerBrandConstants.BRAND_NAME, io.papermc.paper.ServerBrandConstants.CONFIG_REFERENCE, ex); // Plazma - Fork-friendly Rebranding + } else throw ex; } } - diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java index 710477ae27ebc5afdf0012ef0867d05efd293c24..3a5e7546c5cc1fcec880cece3f0d0b04ec23cc18 100644 --- a/src/main/java/net/minecraft/CrashReport.java @@ -197,7 +209,7 @@ index 710477ae27ebc5afdf0012ef0867d05efd293c24..3a5e7546c5cc1fcec880cece3f0d0b04 public String getTitle() { diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index f0d762bd140fad27ae73bcf3e61b640b9e3f2592..3a9f7143505ba1a70bcd224ee8fef5c844a94ed1 100644 +index ecaec3c7b5768771b00c4c33d48a76ba22653a79..8f77566bef4b992013e3b65068cabe7ee1921951 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java @@ -108,6 +108,11 @@ public class Main { @@ -213,10 +225,10 @@ index f0d762bd140fad27ae73bcf3e61b640b9e3f2592..3a9f7143505ba1a70bcd224ee8fef5c8 Path path = (Path) optionset.valueOf("pidFile"); // CraftBukkit diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 1ad565ad881cb7efd4a3919c164f275006b4b789..b281048d9cb54d3acb53da8f722d00c1786f1fb6 100644 +index 23505b0f80d643d9ef569b49192f44e0373dfb5f..20f79bcd7613e426b6b1020f586773819f1ac9d0 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1277,7 +1277,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.server.getQueryPlugins()) { diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -index ee70e7a2f87ca31b1c2918148d585e90601d277b..568141881ffb26b425be452c79ecc146821ba1d9 100644 +index 05e16103af3fd276f0196ddf1a2e5b729b025c34..8f7e922ceca286b1a590181c301fbe9bff55c024 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java @@ -56,10 +56,10 @@ public class DedicatedServerProperties extends Settings { +@@ -37,27 +37,94 @@ public abstract class Configurations { public static final String WORLD_DEFAULTS = "__world_defaults__"; public static final ResourceLocation WORLD_DEFAULTS_KEY = ResourceLocation.fromNamespaceAndPath("configurations", WORLD_DEFAULTS); protected final Path globalFolder; @@ -123,7 +123,7 @@ index f5aac6cde46ca08a4d4792e38f514bb3d8188ae8..4ab13053dec8f05f84981b1bbb6ed06b protected ObjectMapper.Factory.Builder createObjectMapper() { return ObjectMapper.factoryBuilder() -@@ -68,17 +135,21 @@ public abstract class Configurations { +@@ -66,17 +133,21 @@ public abstract class Configurations { } protected YamlConfigurationLoader.Builder createLoaderBuilder() { @@ -148,7 +148,7 @@ index f5aac6cde46ca08a4d4792e38f514bb3d8188ae8..4ab13053dec8f05f84981b1bbb6ed06b } @MustBeInvokedByOverriders -@@ -96,7 +167,7 @@ public abstract class Configurations { +@@ -94,7 +165,7 @@ public abstract class Configurations { }; } @@ -157,7 +157,7 @@ index f5aac6cde46ca08a4d4792e38f514bb3d8188ae8..4ab13053dec8f05f84981b1bbb6ed06b return node -> { ObjectMapper.Factory factory = (ObjectMapper.Factory) Objects.requireNonNull(node.options().serializers().get(type)); ObjectMapper.Mutable mutable = (ObjectMapper.Mutable) factory.get(type); -@@ -106,7 +177,7 @@ public abstract class Configurations { +@@ -104,7 +175,7 @@ public abstract class Configurations { } public G initializeGlobalConfiguration(final RegistryAccess registryAccess) throws ConfigurateException { @@ -295,10 +295,10 @@ index f5aac6cde46ca08a4d4792e38f514bb3d8188ae8..4ab13053dec8f05f84981b1bbb6ed06b public static class ContextMap { diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d1f26aa4a 100644 +index 47a2cba0db36b11548d06ec21f7c7d7c9a962d6e..3f99ca451099d2c7baf12b7b603d8b30f520734c 100644 --- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -@@ -135,6 +135,7 @@ public class PaperConfigurations extends Configurations SPIGOT_WORLD_DEFAULTS = Suppliers.memoize(() -> new SpigotWorldConfig(RandomStringUtils.randomAlphabetic(255)) { @Override // override to ensure "verbose" is false -@@ -143,11 +144,68 @@ public class PaperConfigurations extends Configurations> SPIGOT_WORLD_CONFIG_CONTEXT_KEY = new ContextKey<>(new TypeToken>() {}, "spigot world config"); @@ -377,7 +377,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d @Override protected int globalConfigVersion() { -@@ -162,14 +220,11 @@ public class PaperConfigurations extends Configurations options @@ -438,7 +438,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d .serializers(serializers -> serializers .register(new TypeToken>() {}, new FastutilMapSerializer.SomethingToPrimitive>(Reference2IntOpenHashMap::new, Integer.TYPE)) .register(new TypeToken>() {}, new FastutilMapSerializer.SomethingToPrimitive>(Reference2LongOpenHashMap::new, Long.TYPE)) -@@ -256,12 +315,7 @@ public class PaperConfigurations extends Configurations WorldDataServer public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { @@ -656,7 +656,7 @@ index 10d00d1d63d078d9462eca209420995de5f80eb8..8bd80a4f2f0cb0c4f206bc7d3e70fbcf this.convertable = convertable_conversionsession; this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile()); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 7493262c2879af196e5585b15faad69ae42764e3..ad15fc9f329f5ea7fa0d0d88c937b2f36e0f2f3d 100644 +index f8575f94a389d87d8043ae838720dbe2247235c4..0da2014933fe441c4d3dc27c5fe10afa92ca1ec7 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -172,7 +172,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -708,10 +708,10 @@ index 7493262c2879af196e5585b15faad69ae42764e3..ad15fc9f329f5ea7fa0d0d88c937b2f3 this.playerBreedingCooldowns = this.getNewBreedingCooldownCache(); // Purpur this.generator = gen; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 51770b116695c9d60d43785ae56e249672227025..9f2fb39eb3bde43fe8de9f962a15bbd121625679 100644 +index 81922bf93f8a96e6cf05944ca98a82cc5945a6c6..655463a7d588ed88778d137b6fe5ac18951ff172 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1088,6 +1088,7 @@ public final class CraftServer implements Server { +@@ -1100,6 +1100,7 @@ public final class CraftServer implements Server { org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot this.console.paperConfigurations.reloadConfigs(this.console); @@ -719,7 +719,7 @@ index 51770b116695c9d60d43785ae56e249672227025..9f2fb39eb3bde43fe8de9f962a15bbd1 org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur for (ServerLevel world : this.console.getAllLevels()) { // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty -@@ -3100,6 +3101,13 @@ public final class CraftServer implements Server { +@@ -3112,6 +3113,13 @@ public final class CraftServer implements Server { } // Purpur end @@ -734,10 +734,10 @@ index 51770b116695c9d60d43785ae56e249672227025..9f2fb39eb3bde43fe8de9f962a15bbd1 public void restart() { org.spigotmc.RestartCommand.restart(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index f9ee08eae4a1e1c6490e4682901609c0e4d52579..a1b7bacf43d68aee60b3f5a7fd3b077ee0fcb354 100644 +index 75a062e1105c2f7cc631a6b8b201b0e08621e3c5..b75e2a9273e9562a3d07f68af927ad085c428589 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -191,6 +191,14 @@ public class Main { +@@ -197,6 +197,14 @@ public class Main { .defaultsTo("A " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Server") // Plazma - Fork-friendly Rebranding .describedAs("Name"); // Paper end @@ -1319,6 +1319,32 @@ index 0000000000000000000000000000000000000000..f2d3d51cb4b8fc7a5fd6db1a63289fff + int version = VERSION; + +} +diff --git a/src/main/java/plazma/Config.java b/src/main/java/plazma/Config.java +new file mode 100644 +index 0000000000000000000000000000000000000000..afa60976a6a0bbdd8ed5b9231df2aeeb669b231e +--- /dev/null ++++ b/src/main/java/plazma/Config.java +@@ -0,0 +1,20 @@ ++package plazma; ++ ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NonNull; ++import org.plazmamc.plazma.configurations.GlobalConfiguration; ++import org.plazmamc.plazma.configurations.PlazmaConfigurations; ++ ++public interface Config { ++ ++ @Contract(pure = true) ++ static boolean optimize() { ++ return PlazmaConfigurations.optimize(); ++ } ++ ++ @Contract(pure = true) ++ static @NonNull GlobalConfiguration get() { ++ return GlobalConfiguration.get(); ++ } ++ ++} diff --git a/src/test/java/org/bukkit/support/DummyServerHelper.java b/src/test/java/org/bukkit/support/DummyServerHelper.java index 309d371247adcddf0a1b370cc5faff3e6e01cb0f..285a90ff5cdc8cb28fafd4ea3dae306ae5b899c9 100644 --- a/src/test/java/org/bukkit/support/DummyServerHelper.java diff --git a/patches/server/0007-Setup-basic-configuration-sections.patch b/patches/server/0008-Setup-basic-configuration-sections.patch similarity index 93% rename from patches/server/0007-Setup-basic-configuration-sections.patch rename to patches/server/0008-Setup-basic-configuration-sections.patch index c5a820f..128126f 100644 --- a/patches/server/0007-Setup-basic-configuration-sections.patch +++ b/patches/server/0008-Setup-basic-configuration-sections.patch @@ -84,10 +84,10 @@ index 25c0f5d28107b45677aa7b19bc0d5238512d9826..ac0f038de0ce5cf6df0b730af69d3229 NodePath[] GLOBAL_PATHS = { diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index f2d3d51cb4b8fc7a5fd6db1a63289fff6d32a1ea..8dce68cf7769fcd5ea03be32621ccb6bab174697 100644 +index f2d3d51cb4b8fc7a5fd6db1a63289fff6d32a1ea..c222d58520b655b54b8975ec226a4ba948691cd4 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -@@ -19,4 +19,38 @@ public class WorldConfigurations extends ConfigurationPart { +@@ -19,4 +19,44 @@ public class WorldConfigurations extends ConfigurationPart { @Setting(Configuration.VERSION_FIELD) int version = VERSION; @@ -124,5 +124,11 @@ index f2d3d51cb4b8fc7a5fd6db1a63289fff6d32a1ea..8dce68cf7769fcd5ea03be32621ccb6b + + + } ++ ++ public Item item; ++ public class Item extends ConfigurationPart { ++ ++ ++ } + } diff --git a/patches/server/0008-Warn-on-startup.patch b/patches/server/0009-Warn-on-startup.patch similarity index 96% rename from patches/server/0008-Warn-on-startup.patch rename to patches/server/0009-Warn-on-startup.patch index 4c17cc2..1a70dab 100644 --- a/patches/server/0008-Warn-on-startup.patch +++ b/patches/server/0009-Warn-on-startup.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Warn on startup diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 3a9f7143505ba1a70bcd224ee8fef5c844a94ed1..e0885f53aa3d0ae95a40574806af70c865025a9d 100644 +index 8f77566bef4b992013e3b65068cabe7ee1921951..65fd553887ed9eb9c26e036c8009179a7baf5380 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java @@ -113,6 +113,18 @@ public class Main { diff --git a/patches/server/0009-Always-agree-EULA-on-development-mode.patch b/patches/server/0010-Always-agree-EULA-on-development-mode.patch similarity index 85% rename from patches/server/0009-Always-agree-EULA-on-development-mode.patch rename to patches/server/0010-Always-agree-EULA-on-development-mode.patch index 846e189..e6368f5 100644 --- a/patches/server/0009-Always-agree-EULA-on-development-mode.patch +++ b/patches/server/0010-Always-agree-EULA-on-development-mode.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Always agree EULA on development mode diff --git a/build.gradle.kts b/build.gradle.kts -index 6734821658e7679f328336038587390a262f2b64..787d3447f328c59deabb6b07b9f72f9fbce71cba 100644 +index 41005f58fdd526907972185e728bbe1fa97171e9..746ad8087192931400256c8a1ef71e966eaf6b1a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -151,7 +151,7 @@ fun TaskContainer.registerRunTask( +@@ -164,7 +164,7 @@ fun TaskContainer.registerRunTask( languageVersion.set(JavaLanguageVersion.of(21)) vendor.set(JvmVendorSpec.JETBRAINS) }) @@ -18,7 +18,7 @@ index 6734821658e7679f328336038587390a262f2b64..787d3447f328c59deabb6b07b9f72f9f if (rootProject.childProjects["test-plugin"] != null) { val testPluginJar = rootProject.project(":test-plugin").tasks.jar.flatMap { it.archiveFile } diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index e0885f53aa3d0ae95a40574806af70c865025a9d..3978c93a847c859c70446a6d6157fdb49c0bc74c 100644 +index 65fd553887ed9eb9c26e036c8009179a7baf5380..694b126df2c3d1d6fa40ee9731c28886caf1a4fc 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java @@ -179,6 +179,7 @@ public class Main { diff --git a/patches/server/0010-Add-more-metrics.patch b/patches/server/0011-Add-more-metrics.patch similarity index 100% rename from patches/server/0010-Add-more-metrics.patch rename to patches/server/0011-Add-more-metrics.patch diff --git a/patches/server/0011-Optimize-default-configurations.patch b/patches/server/0012-Optimize-default-configurations.patch similarity index 87% rename from patches/server/0011-Optimize-default-configurations.patch rename to patches/server/0012-Optimize-default-configurations.patch index b2e41fb..431da41 100644 --- a/patches/server/0011-Optimize-default-configurations.patch +++ b/patches/server/0012-Optimize-default-configurations.patch @@ -8,8 +8,45 @@ Subject: [PATCH] Optimize default configurations - AkiraDevelopment/SimplyMC - YouHaveTrouble/minecraft-exploits-and-how-to-fix-them +diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +index 411c81a88b8a008b2aaf0ca62fb7ffa1dd9e32a4..53dc2e3c22c5cb038b9a283112f265d362f187e3 100644 +--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java ++++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +@@ -61,7 +61,7 @@ public class PufferfishConfig { + getString("info.version", "1.0"); + setComment("info", + "Pufferfish Configuration", +- "Check out Pufferfish Host for maximum performance server hosting: https://pufferfish.host", ++ // "Check out Pufferfish Host for maximum performance server hosting: https://pufferfish.host", // Plazma - Sponsorblock + "Join our Discord for support: https://discord.gg/reZw4vQV9H", + "Download new builds at https://ci.pufferfish.host/job/Pufferfish"); + +@@ -216,7 +216,7 @@ public class PufferfishConfig { + public static int maxProjectileLoadsPerTick; + public static int maxProjectileLoadsPerProjectile; + private static void projectileLoading() { +- maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); ++ maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", plazma.Config.optimize() ? 8 : 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); // Plazma - Optimize default configurations + maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", 10, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed."); + + setComment("projectile", "Optimizes projectile settings"); +@@ -230,12 +230,12 @@ public class PufferfishConfig { + public static int activationDistanceMod; + + private static void dynamicActivationOfBrains() throws IOException { +- dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", false); // Purpur ++ dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", plazma.Config.optimize()); // Purpur // Plazma - Optimize default configurations + startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12, + "This value determines how far away an entity has to be", + "from the player to start being effected by DEAR."); + startDistanceSquared = startDistance * startDistance; +- maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", 20, ++ maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", plazma.Config.optimize() ? 7 : 8, // Plazma - Optimize default configurations + "This value defines how often in ticks, the furthest entity", + "will get their pathfinders and behaviors ticked. 20 = 1s"); + activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", 8, diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index cbd0f2c6636b8ae332f20a3cb763b06855dfe795..3b636760f32b9b5b277edb15782d6206567e012f 100644 +index 17e23ca4dd2bbfba49ea00aa2b719a95feb931be..a8e75eaadfcc6c8b2503776d7de197f756712819 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java @@ -147,7 +147,7 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -21,7 +58,7 @@ index cbd0f2c6636b8ae332f20a3cb763b06855dfe795..3b636760f32b9b5b277edb15782d6206 } public SpamLimiter spamLimiter; -@@ -189,7 +189,7 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -187,7 +187,7 @@ public class GlobalConfiguration extends ConfigurationPart { public Commands commands; public class Commands extends ConfigurationPart { @@ -30,7 +67,7 @@ index cbd0f2c6636b8ae332f20a3cb763b06855dfe795..3b636760f32b9b5b277edb15782d6206 public boolean fixTargetSelectorTagCompletion = true; public boolean timeCommandAffectsAllWorlds = false; } -@@ -255,7 +255,7 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -253,7 +253,7 @@ public class GlobalConfiguration extends ConfigurationPart { public BookSize bookSize; public class BookSize extends ConfigurationPart { @@ -39,7 +76,7 @@ index cbd0f2c6636b8ae332f20a3cb763b06855dfe795..3b636760f32b9b5b277edb15782d6206 public double totalMultiplier = 0.98D; // TODO this should probably be merged into the above inner class } public boolean resolveSelectorsInBooks = false; -@@ -266,7 +266,15 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -264,7 +264,15 @@ public class GlobalConfiguration extends ConfigurationPart { public class PacketLimiter extends ConfigurationPart { public Component kickMessage = Component.translatable("disconnect.exceeded_packet_rate", NamedTextColor.RED); public PacketLimit allPackets = new PacketLimit(7.0, 500.0, PacketLimit.ViolateAction.KICK); @@ -56,7 +93,7 @@ index cbd0f2c6636b8ae332f20a3cb763b06855dfe795..3b636760f32b9b5b277edb15782d6206 @ConfigSerializable public record PacketLimit(@Required double interval, @Required double maxPacketRate, ViolateAction action) { -@@ -334,7 +342,7 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -332,7 +340,7 @@ public class GlobalConfiguration extends ConfigurationPart { executor.setMaximumPoolSize(_chatExecutorMaxSize); } } @@ -66,10 +103,10 @@ index cbd0f2c6636b8ae332f20a3cb763b06855dfe795..3b636760f32b9b5b277edb15782d6206 public boolean loadPermissionsYmlBeforePlugins = true; @Constraints.Min(4) diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -index b7428b8c287980941eaa5c5d1f1d321955277a09..b6f818d568bdf32c32685e163ba1588c7a8e153d 100644 +index 82210667376fd466d5d4cdcb56b62f6165bd5cde..3c6e9ec236bfd851700ce7fae2599b725ec899eb 100644 --- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -@@ -100,12 +100,32 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -103,12 +103,32 @@ public class WorldConfiguration extends ConfigurationPart { public class AntiXray extends ConfigurationPart { public boolean enabled = false; @@ -105,7 +142,7 @@ index b7428b8c287980941eaa5c5d1f1d321955277a09..b6f818d568bdf32c32685e163ba1588c // Blocks.COPPER_ORE, Blocks.DEEPSLATE_COPPER_ORE, -@@ -132,7 +152,28 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -135,7 +155,28 @@ public class WorldConfiguration extends ConfigurationPart { Blocks.ENDER_CHEST // ); @@ -135,7 +172,7 @@ index b7428b8c287980941eaa5c5d1f1d321955277a09..b6f818d568bdf32c32685e163ba1588c } } -@@ -154,14 +195,14 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -157,14 +198,14 @@ public class WorldConfiguration extends ConfigurationPart { public ArmorStands armorStands; public class ArmorStands extends ConfigurationPart { @@ -153,7 +190,7 @@ index b7428b8c287980941eaa5c5d1f1d321955277a09..b6f818d568bdf32c32685e163ba1588c } public Sniffer sniffer; -@@ -406,7 +447,7 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -415,7 +456,7 @@ public class WorldConfiguration extends ConfigurationPart { public class Environment extends ConfigurationPart { public boolean disableThunder = false; public boolean disableIceAndSnow = false; @@ -162,7 +199,7 @@ index b7428b8c287980941eaa5c5d1f1d321955277a09..b6f818d568bdf32c32685e163ba1588c public boolean disableExplosionKnockback = false; public boolean generateFlatBedrock = false; public FrostedIce frostedIce; -@@ -462,7 +503,7 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -471,7 +512,7 @@ public class WorldConfiguration extends ConfigurationPart { public Fixes fixes; public class Fixes extends ConfigurationPart { @@ -171,7 +208,7 @@ index b7428b8c287980941eaa5c5d1f1d321955277a09..b6f818d568bdf32c32685e163ba1588c public boolean disableUnloadedChunkEnderpearlExploit = false; public boolean preventTntFromMovingInWater = false; public boolean splitOverstackedLoot = true; -@@ -490,9 +531,9 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -499,9 +540,9 @@ public class WorldConfiguration extends ConfigurationPart { public class Collisions extends ConfigurationPart { public boolean onlyPlayersCollide = false; public boolean allowVehicleCollisions = true; @@ -183,7 +220,7 @@ index b7428b8c287980941eaa5c5d1f1d321955277a09..b6f818d568bdf32c32685e163ba1588c public boolean allowPlayerCrammingDamage = false; } -@@ -500,18 +541,41 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -509,18 +550,41 @@ public class WorldConfiguration extends ConfigurationPart { public class Chunks extends ConfigurationPart { public AutosavePeriod autoSaveInterval = AutosavePeriod.def(); @@ -233,7 +270,7 @@ index b7428b8c287980941eaa5c5d1f1d321955277a09..b6f818d568bdf32c32685e163ba1588c }); public boolean flushRegionsOnSave = false; } -@@ -526,9 +590,9 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -535,9 +599,9 @@ public class WorldConfiguration extends ConfigurationPart { public TickRates tickRates; public class TickRates extends ConfigurationPart { @@ -245,7 +282,7 @@ index b7428b8c287980941eaa5c5d1f1d321955277a09..b6f818d568bdf32c32685e163ba1588c public int wetFarmland = 1; public int dryFarmland = 1; public Table, String, Integer> sensor = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "secondarypoisensor", 40)); -@@ -562,9 +626,9 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -571,9 +635,9 @@ public class WorldConfiguration extends ConfigurationPart { public class Misc extends ConfigurationPart { public int lightQueueSize = 20; @@ -270,7 +307,7 @@ index 24763d3d270c29c95e0b3e85111145234f660a62..80ddc627e02e3c749e6b074afa93d357 } diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 3978c93a847c859c70446a6d6157fdb49c0bc74c..a4ef13e8b91dcc4bea7b49c004af085357aba6ad 100644 +index 694b126df2c3d1d6fa40ee9731c28886caf1a4fc..822ecda5f4dc6cc8cd0cc4da577f27cdcc5c4967 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java @@ -164,7 +164,7 @@ public class Main { @@ -283,7 +320,7 @@ index 3978c93a847c859c70446a6d6157fdb49c0bc74c..a4ef13e8b91dcc4bea7b49c004af0853 File commandFile = (File) optionset.valueOf("commands-settings"); diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -index 568141881ffb26b425be452c79ecc146821ba1d9..067f91dd019be40cb09f8fa78cae587429488201 100644 +index 8f7e922ceca286b1a590181c301fbe9bff55c024..3dd5c7441bb300ca17d717af37edbefb89db4b2f 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java @@ -132,14 +132,14 @@ public class DedicatedServerProperties extends Settings +Date: Fri, 13 Dec 2024 13:08:37 +0900 +Subject: [PATCH] Add missing Pufferfish configurations + + +diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java +index 9ef53608f1608e88de7a7b3e96b43d8d2b4230ae..8500ac473581b90036578d66243c5313e2ce3ddf 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java ++++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java +@@ -161,11 +161,13 @@ public class Armadillo extends Animal { + return ArmadilloAi.makeBrain(this.brainProvider().makeBrain(dynamic)); + } + ++ private int behaviorTick; // Plazma - Add missing pufferfish configurations + @Override + protected void customServerAiStep(ServerLevel world) { + ProfilerFiller gameprofilerfiller = Profiler.get(); + + gameprofilerfiller.push("armadilloBrain"); ++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations + ((Brain) this.brain).tick(world, this); // CraftBukkit - decompile error + gameprofilerfiller.pop(); + gameprofilerfiller.push("armadilloActivityUpdate"); +diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +index dbce71f45c008da883b6d244a06343d83ae25e7e..d2f0b14a0014802605b601e62d0eebddf06d3737 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java ++++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +@@ -152,6 +152,7 @@ public class Camel extends AbstractHorse { + return pose == Pose.SITTING ? Camel.SITTING_DIMENSIONS.scale(this.getAgeScale()) : super.getDefaultDimensions(pose); + } + ++ private int behaviorTick = 0; // Plazma - Add missing pufferfish configurations + @Override + protected void customServerAiStep(ServerLevel world) { + ProfilerFiller gameprofilerfiller = Profiler.get(); +@@ -159,6 +160,7 @@ public class Camel extends AbstractHorse { + gameprofilerfiller.push("camelBrain"); + Brain behaviorcontroller = (Brain) this.getBrain(); // CraftBukkit - decompile error + ++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations + behaviorcontroller.tick(world, this); + gameprofilerfiller.pop(); + gameprofilerfiller.push("camelActivityUpdate"); +diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +index 464a16df15d8759d66f94ad080d1ea28b3f6474c..6061cd4fc38fef0895571ab767e495d5755f9fc8 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java ++++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +@@ -493,11 +493,13 @@ public class Sniffer extends Animal { + return Brain.provider(SnifferAi.MEMORY_TYPES, SnifferAi.SENSOR_TYPES); + } + ++ private int behaviorTick; // Plazma - Add missing pufferfish configurations + @Override + protected void customServerAiStep(ServerLevel world) { + ProfilerFiller gameprofilerfiller = Profiler.get(); + + gameprofilerfiller.push("snifferBrain"); ++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations + this.getBrain().tick(world, this); + gameprofilerfiller.popPush("snifferActivityUpdate"); + SnifferAi.updateActivity(this); diff --git a/patches/server/0014-Add-missing-purpur-configuration-options.patch b/patches/server/0016-Add-missing-Purpur-configuration-options.patch similarity index 90% rename from patches/server/0014-Add-missing-purpur-configuration-options.patch rename to patches/server/0016-Add-missing-Purpur-configuration-options.patch index 0273ed3..83c8547 100644 --- a/patches/server/0014-Add-missing-purpur-configuration-options.patch +++ b/patches/server/0016-Add-missing-Purpur-configuration-options.patch @@ -1,11 +1,11 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: AlphaKR93 Date: Sat, 25 Mar 2023 00:52:11 +0900 -Subject: [PATCH] Add missing purpur configuration options +Subject: [PATCH] Add missing Purpur configuration options diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java -index f60961bd5fdf6d1417e458b92e311c1a0a62463d..026cd57df33476841ed3a8f9fdc4d17a77e037b0 100644 +index 0a173040c56fea6d8f83998b7c66aa8daaf648f2..16b98cad477d7af2d9534cc189aae43a5adc8d58 100644 --- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java +++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java @@ -160,6 +160,18 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS @@ -28,7 +28,7 @@ index f60961bd5fdf6d1417e458b92e311c1a0a62463d..026cd57df33476841ed3a8f9fdc4d17a @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -index 56d97225a909fd55f0d8aec992d5b6d42687c948..39cdecc382a71ef643d382ac506249bbb8df3d34 100644 +index d2f0b14a0014802605b601e62d0eebddf06d3737..459a45f82c42b346a66bb1954e155a0970dcc30f 100644 --- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java @@ -96,6 +96,18 @@ public class Camel extends AbstractHorse { @@ -51,7 +51,7 @@ index 56d97225a909fd55f0d8aec992d5b6d42687c948..39cdecc382a71ef643d382ac506249bb @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -index 501a12398c56fe0df4e76a3bbce0f98c6c5aa6cb..94ca735513901a180d42ac1cfd48d841142a6ef5 100644 +index 02581f47d1ca58c2b8abffc478adf48343585c8b..bd04af6311ca64d81c8829e731ac39a6486ee789 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java @@ -163,6 +163,23 @@ public class Frog extends Animal implements VariantHolder> { @@ -79,7 +79,7 @@ index 501a12398c56fe0df4e76a3bbce0f98c6c5aa6cb..94ca735513901a180d42ac1cfd48d841 public int getPurpurBreedTime() { diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java -index 071d14cc6697587ec14f02c69c78df364e7d8a8f..cc5c172b2fccc5fc59337203ed2b6edb2abc0c22 100644 +index 7e92e8c4fec36c8838604f17cf366cc80e82b19b..1b0e80ae62b5c5d4e1fcac71b90f83f12fe4878a 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java @@ -93,6 +93,23 @@ public class Tadpole extends AbstractFish { @@ -107,7 +107,7 @@ index 071d14cc6697587ec14f02c69c78df364e7d8a8f..cc5c172b2fccc5fc59337203ed2b6edb @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -index 3fb4f12095883ea4ec6e0d60e0600b9de6ed7be2..f853730cee4fad2f3a5711e38918c65dcb1dc038 100644 +index 6061cd4fc38fef0895571ab767e495d5755f9fc8..0bc7856065fdc599890f18f5a4e2f6c2b3d94ba7 100644 --- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java @@ -116,6 +116,18 @@ public class Sniffer extends Animal { @@ -130,7 +130,7 @@ index 3fb4f12095883ea4ec6e0d60e0600b9de6ed7be2..f853730cee4fad2f3a5711e38918c65d @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -index 692261880d05daa75fc53dde31d0f2b95dc52746..9f542e4f0077a6abc89fdec1a4bf3e8f40203b2a 100644 +index 5a62fe9c4f0cee9e8b4a48564f76afec609335b1..79b090030b716029cc4cfc8bf9d81af0b2202313 100644 --- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java @@ -151,6 +151,23 @@ public class Warden extends Monster implements VibrationSystem { @@ -157,6 +157,15 @@ index 692261880d05daa75fc53dde31d0f2b95dc52746..9f542e4f0077a6abc89fdec1a4bf3e8f // Purpur end @Override +@@ -305,7 +322,7 @@ public class Warden extends Monster implements VibrationSystem { + ProfilerFiller gameprofilerfiller = Profiler.get(); + + gameprofilerfiller.push("wardenBrain"); +- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish ++ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Plazma - Add missing Purpur configurations + this.getBrain().tick(world, this); + gameprofilerfiller.pop(); + super.customServerAiStep(world); diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java index 1f4cc08e84a23213bb9786ea09ad77caeec2d336..f888f1dd2e3c228b0a370fe920b63d547bbba571 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java @@ -200,10 +209,10 @@ index 097f3c34d244b89e7dd9f8b6f2a3d8fdc67b36dc..3f4c94aada930e55dfe6a2dd6f3bfb51 org.bukkit.event.inventory.InventoryType.ENDER_CHEST.setDefaultSize(enderChestSixRows ? 54 : 27); enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows); diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 2198477c174f89fdaece5ffef8b40c8096a9c9a9..046af5afaf3e234fb7d14c4a9ae183cda8cb0b0c 100644 +index e55993e318b7f7292e22c4539bc2fd1447f67fa8..b67b6147e9175041539b01357dd8b1e94cfd6841 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -@@ -1133,7 +1133,13 @@ public class PurpurWorldConfig { +@@ -1135,7 +1135,13 @@ public class PurpurWorldConfig { public boolean allayControllable = true; public double allayMaxHealth = 20.0D; public double allayScale = 1.0D; @@ -217,7 +226,7 @@ index 2198477c174f89fdaece5ffef8b40c8096a9c9a9..046af5afaf3e234fb7d14c4a9ae183cd allayRidable = getBoolean("mobs.allay.ridable", allayRidable); allayRidableInWater = getBoolean("mobs.allay.ridable-in-water", allayRidableInWater); allayControllable = getBoolean("mobs.allay.controllable", allayControllable); -@@ -1288,7 +1294,13 @@ public class PurpurWorldConfig { +@@ -1290,7 +1296,13 @@ public class PurpurWorldConfig { public double camelMovementSpeedMin = 0.09D; public double camelMovementSpeedMax = 0.09D; public int camelBreedingTicks = 6000; @@ -231,7 +240,7 @@ index 2198477c174f89fdaece5ffef8b40c8096a9c9a9..046af5afaf3e234fb7d14c4a9ae183cd camelRidableInWater = getBoolean("mobs.camel.ridable-in-water", camelRidableInWater); camelMaxHealthMin = getDouble("mobs.camel.attributes.max_health.min", camelMaxHealthMin); camelMaxHealthMax = getDouble("mobs.camel.attributes.max_health.max", camelMaxHealthMax); -@@ -1740,7 +1752,15 @@ public class PurpurWorldConfig { +@@ -1755,7 +1767,15 @@ public class PurpurWorldConfig { public boolean frogControllable = true; public float frogRidableJumpHeight = 0.65F; public int frogBreedingTicks = 6000; @@ -247,7 +256,7 @@ index 2198477c174f89fdaece5ffef8b40c8096a9c9a9..046af5afaf3e234fb7d14c4a9ae183cd frogRidable = getBoolean("mobs.frog.ridable", frogRidable); frogRidableInWater = getBoolean("mobs.frog.ridable-in-water", frogRidableInWater); frogControllable = getBoolean("mobs.frog.controllable", frogControllable); -@@ -2752,7 +2772,13 @@ public class PurpurWorldConfig { +@@ -2767,7 +2787,13 @@ public class PurpurWorldConfig { public double snifferMaxHealth = 14.0D; public double snifferScale = 1.0D; public int snifferBreedingTicks = 6000; @@ -261,7 +270,7 @@ index 2198477c174f89fdaece5ffef8b40c8096a9c9a9..046af5afaf3e234fb7d14c4a9ae183cd snifferRidable = getBoolean("mobs.sniffer.ridable", snifferRidable); snifferRidableInWater = getBoolean("mobs.sniffer.ridable-in-water", snifferRidableInWater); snifferControllable = getBoolean("mobs.sniffer.controllable", snifferControllable); -@@ -2860,7 +2886,15 @@ public class PurpurWorldConfig { +@@ -2875,7 +2901,15 @@ public class PurpurWorldConfig { public boolean tadpoleRidable = false; public boolean tadpoleRidableInWater = true; public boolean tadpoleControllable = true; @@ -277,7 +286,7 @@ index 2198477c174f89fdaece5ffef8b40c8096a9c9a9..046af5afaf3e234fb7d14c4a9ae183cd tadpoleRidable = getBoolean("mobs.tadpole.ridable", tadpoleRidable); tadpoleRidableInWater = getBoolean("mobs.tadpole.ridable-in-water", tadpoleRidableInWater); tadpoleControllable = getBoolean("mobs.tadpole.controllable", tadpoleControllable); -@@ -3088,7 +3122,15 @@ public class PurpurWorldConfig { +@@ -3107,7 +3141,15 @@ public class PurpurWorldConfig { public boolean wardenRidable = false; public boolean wardenRidableInWater = true; public boolean wardenControllable = true; diff --git a/patches/server/0015-Add-option-to-change-nether-portal-size.patch b/patches/server/0017-Add-option-to-change-nether-portal-size.patch similarity index 96% rename from patches/server/0015-Add-option-to-change-nether-portal-size.patch rename to patches/server/0017-Add-option-to-change-nether-portal-size.patch index d5798c0..7a6f190 100644 --- a/patches/server/0015-Add-option-to-change-nether-portal-size.patch +++ b/patches/server/0017-Add-option-to-change-nether-portal-size.patch @@ -36,7 +36,7 @@ index acdff7b4a00d563739fd301c3633a266875296fa..1266aaf4bfcf53aa16d7b9bd697a0c48 // CraftBukkit start - return boolean, add entity diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index a8586f1bd161ad3470ae7f0590f1bba0cf627bd0..b3fccda131e51b03b1617b028f8d7488db342f24 100644 +index 779cdc523aab3afc529685f7e913bd6bb7336c51..665b77d5cdf81a73d28f93294ee590af746bdfbc 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -60,6 +60,26 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -67,7 +67,7 @@ index a8586f1bd161ad3470ae7f0590f1bba0cf627bd0..b3fccda131e51b03b1617b028f8d7488 } diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index 8dce68cf7769fcd5ea03be32621ccb6bab174697..e50118ec7a4c00bd367ca6c740214c53b0d60fc9 100644 +index c222d58520b655b54b8975ec226a4ba948691cd4..c703237d46b114227cf0d5cdff2e033839bc5f57 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -36,17 +36,6 @@ public class WorldConfigurations extends ConfigurationPart { diff --git a/patches/server/0016-Apply-various-optimizations.patch b/patches/server/0018-Apply-various-optimizations.patch similarity index 87% rename from patches/server/0016-Apply-various-optimizations.patch rename to patches/server/0018-Apply-various-optimizations.patch index 5d6c0de..0bf64a3 100644 --- a/patches/server/0016-Apply-various-optimizations.patch +++ b/patches/server/0018-Apply-various-optimizations.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Apply various optimizations Akarin - Swaps the predicate order of collision diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index d6d9dd17750d7028e13aad539e7b65a7561d9f4b..ae264484f99227f5535c428ebda4860fc8abcc72 100644 +index aa171a1afb9800e6ec84f6b4f1b28e44177752f7..eaf53f5f4c33ca7a7a988e7bd04b7033e16f9529 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2342,8 +2342,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2309,8 +2309,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public void playerTouch(Player player) {} public void push(Entity entity) { @@ -21,7 +21,7 @@ index d6d9dd17750d7028e13aad539e7b65a7561d9f4b..ae264484f99227f5535c428ebda4860f if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper - Collision option for requiring a player participant double d0 = entity.getX() - this.getX(); double d1 = entity.getZ() - this.getZ(); -@@ -2371,8 +2372,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2338,8 +2339,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess entity.push(d0, 0.0D, d1); } } diff --git a/patches/server/0017-Do-not-load-chunks-to-spawn-phantom.patch b/patches/server/0019-Do-not-load-chunks-to-spawn-phantom.patch similarity index 95% rename from patches/server/0017-Do-not-load-chunks-to-spawn-phantom.patch rename to patches/server/0019-Do-not-load-chunks-to-spawn-phantom.patch index 50b382a..9fda6d2 100644 --- a/patches/server/0017-Do-not-load-chunks-to-spawn-phantom.patch +++ b/patches/server/0019-Do-not-load-chunks-to-spawn-phantom.patch @@ -17,7 +17,7 @@ index 27eb9a365006884c85603dc6d9dd8eee009c98b3..958a48d05aba8e500c7b19a466dcca6f FluidState fluid = world.getFluidState(blockposition1); diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index e50118ec7a4c00bd367ca6c740214c53b0d60fc9..4d204a0dc976d96c98764092c8461b0e2b920fc1 100644 +index c703237d46b114227cf0d5cdff2e033839bc5f57..a976e2b960a5f3b7ecf6e42afcb1dd3bd140b8bd 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -31,6 +31,7 @@ public class WorldConfigurations extends ConfigurationPart { diff --git a/patches/server/0018-Add-option-to-disable-moved-to-quickly-check-for-spe.patch b/patches/server/0020-Add-option-to-disable-moved-to-quickly-check-for-spe.patch similarity index 87% rename from patches/server/0018-Add-option-to-disable-moved-to-quickly-check-for-spe.patch rename to patches/server/0020-Add-option-to-disable-moved-to-quickly-check-for-spe.patch index 0ddf693..40042f4 100644 --- a/patches/server/0018-Add-option-to-disable-moved-to-quickly-check-for-spe.patch +++ b/patches/server/0020-Add-option-to-disable-moved-to-quickly-check-for-spe.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add option to disable moved to quickly check for specific diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 61b19f52aeb371abdd29f41291099f35a9b4c258..dcb0a4461a2fca964e4d8390401e463648ed3351 100644 +index 9ae16e24013ea5664d4ea6d52ed7dd188404890f..91f161d27a45174b6f3c31440eea46ff81185203 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1694,7 +1694,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1695,7 +1695,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } } @@ -24,7 +24,7 @@ index 61b19f52aeb371abdd29f41291099f35a9b4c258..dcb0a4461a2fca964e4d8390401e4636 return false; } else if (this.player.isChangingDimension()) { diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index b3fccda131e51b03b1617b028f8d7488db342f24..6fd1f1c859a6e6cea780d9dfa9a2770d59ddfd04 100644 +index 665b77d5cdf81a73d28f93294ee590af746bdfbc..e2aa6b8ae63ed7f5a0882fcaf5a3fadc29f553f1 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -27,6 +27,7 @@ public class GlobalConfiguration extends ConfigurationPart { diff --git a/patches/server/0019-Configurable-cave-lava-sea-level.patch b/patches/server/0021-Configurable-cave-lava-sea-level.patch similarity index 97% rename from patches/server/0019-Configurable-cave-lava-sea-level.patch rename to patches/server/0021-Configurable-cave-lava-sea-level.patch index b31020d..66d9ed5 100644 --- a/patches/server/0019-Configurable-cave-lava-sea-level.patch +++ b/patches/server/0021-Configurable-cave-lava-sea-level.patch @@ -33,7 +33,7 @@ index 3f39d6c786d9dfdd9ad591e08ff05fcbb41a1df6..0346fd4ab7095d66c0eef5a440afbc7a @Override diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 6fd1f1c859a6e6cea780d9dfa9a2770d59ddfd04..af0ca8b0470c0e66cbc4cc0331219b71d0fa429f 100644 +index e2aa6b8ae63ed7f5a0882fcaf5a3fadc29f553f1..6648d50cea38c17714785a335e5bc25f98d2595e 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -35,6 +35,24 @@ public class GlobalConfiguration extends ConfigurationPart { diff --git a/patches/server/0020-Configurable-entity-sensor-tick.patch b/patches/server/0022-Configurable-entity-sensor-tick.patch similarity index 70% rename from patches/server/0020-Configurable-entity-sensor-tick.patch rename to patches/server/0022-Configurable-entity-sensor-tick.patch index 89ecebe..3b6318f 100644 --- a/patches/server/0020-Configurable-entity-sensor-tick.patch +++ b/patches/server/0022-Configurable-entity-sensor-tick.patch @@ -5,24 +5,24 @@ Subject: [PATCH] Configurable entity sensor tick diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index ff9d23aef4658922692b43a859bd83632fe23612..8e5ad4cd6c8f61661b87dc96ba914c0bcd199879 100644 +index 7ca12a1128661ea36e2e33cda204c7d2df55a21c..331a75fee26e3fe2532e8661db282a0c207ddf9b 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -949,10 +949,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur +@@ -951,10 +951,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + ProfilerFiller gameprofilerfiller = Profiler.get(); - //gameprofilerfiller.push("sensing"); // Purpur + gameprofilerfiller.push("sensing"); - this.sensing.tick(); + //this.sensing.tick(); // Plazma - moved down - //gameprofilerfiller.pop(); // Purpur + gameprofilerfiller.pop(); int i = this.tickCount + this.getId(); + if (i % this.level().plazmaConfig().entity.sensorTick == 0) this.sensing.tick(); // Plazma - Configurable entity sensor tick if (i % 2 != 0 && this.tickCount > 1) { - //gameprofilerfiller.push("targetSelector"); // Purpur - this.targetSelector.tickRunningGoals(false); + gameprofilerfiller.push("targetSelector"); + if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index 4d204a0dc976d96c98764092c8461b0e2b920fc1..33bcfec86f83ce6e0ec17436ad38da8aeced48be 100644 +index a976e2b960a5f3b7ecf6e42afcb1dd3bd140b8bd..9e408d6c1826d36a935b3e382e8eb0283f3d1580 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -28,6 +28,8 @@ public class WorldConfigurations extends ConfigurationPart { diff --git a/patches/server/0021-Variable-entity-wakeup-duration.patch b/patches/server/0023-Variable-entity-wakeup-duration.patch similarity index 94% rename from patches/server/0021-Variable-entity-wakeup-duration.patch rename to patches/server/0023-Variable-entity-wakeup-duration.patch index 94b603c..4af7221 100644 --- a/patches/server/0021-Variable-entity-wakeup-duration.patch +++ b/patches/server/0023-Variable-entity-wakeup-duration.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Variable entity wakeup duration diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index 33bcfec86f83ce6e0ec17436ad38da8aeced48be..b047af738236be3400d07d46c663017ed39b6f96 100644 +index 9e408d6c1826d36a935b3e382e8eb0283f3d1580..a371893777a2c2d1de22e7d52f2fd3f55b82d74d 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -37,6 +37,20 @@ public class WorldConfigurations extends ConfigurationPart { @@ -30,10 +30,10 @@ index 33bcfec86f83ce6e0ec17436ad38da8aeced48be..b047af738236be3400d07d46c663017e public Block block; diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index e047c0a4a8638588b4ac0d47c4c96899fac4abb7..14e62940aec1fe4c70b128f2811df6c09c701718 100644 +index 9b1a16747aa23b18e4cff986efaac6ce64b6ddb9..6a45bafaa1d7ddc0f80c0945e15c3d6c67f9f2b3 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -62,29 +62,37 @@ public class ActivationRange +@@ -66,29 +66,37 @@ public class ActivationRange net.minecraft.world.entity.schedule.Activity.PANIC }; diff --git a/patches/server/0022-Skip-event-if-no-listeners.patch b/patches/server/0024-Skip-event-if-no-listeners.patch similarity index 100% rename from patches/server/0022-Skip-event-if-no-listeners.patch rename to patches/server/0024-Skip-event-if-no-listeners.patch diff --git a/patches/server/0023-Add-entity-spawn-deadlock-timer.patch b/patches/server/0025-Add-entity-spawn-deadlock-timer.patch similarity index 97% rename from patches/server/0023-Add-entity-spawn-deadlock-timer.patch rename to patches/server/0025-Add-entity-spawn-deadlock-timer.patch index c348474..15168ea 100644 --- a/patches/server/0023-Add-entity-spawn-deadlock-timer.patch +++ b/patches/server/0025-Add-entity-spawn-deadlock-timer.patch @@ -61,7 +61,7 @@ index bb4411cfdf1bc7adc12c2f918d2eec830299f38b..357d484029fe338bea4f5770d13ccfc0 return nbt; } diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index b047af738236be3400d07d46c663017ed39b6f96..6c9c28ae5fbe62ba647e7790acccb377d1e62490 100644 +index a371893777a2c2d1de22e7d52f2fd3f55b82d74d..d366e8755ba91c329164c16659f6b07245577fba 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -51,6 +51,14 @@ public class WorldConfigurations extends ConfigurationPart { diff --git a/patches/server/0024-Lithium-HashedList.patch b/patches/server/0026-Lithium-HashedList.patch similarity index 100% rename from patches/server/0024-Lithium-HashedList.patch rename to patches/server/0026-Lithium-HashedList.patch diff --git a/patches/server/0025-Improve-SwingTime-ticking.patch b/patches/server/0027-Improve-SwingTime-ticking.patch similarity index 81% rename from patches/server/0025-Improve-SwingTime-ticking.patch rename to patches/server/0027-Improve-SwingTime-ticking.patch index 9d74e67..96f6ace 100644 --- a/patches/server/0025-Improve-SwingTime-ticking.patch +++ b/patches/server/0027-Improve-SwingTime-ticking.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Improve SwingTime ticking diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index d3d4e7e01afeb4ace5e487f9ef0926fd987c8ca4..6f999fcba6f72f2d31835c4ce5f6c17a69b0537c 100644 +index f4604e543a980d6aeb485252da5a4e755aa12bfa..f2753cf51634479e501c1a3e7931d6d9882bc801 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -2772,6 +2772,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -2821,6 +2821,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } protected void updateSwingTime() { diff --git a/patches/server/0026-Save-Json-list-asynchronously.patch b/patches/server/0028-Save-Json-list-asynchronously.patch similarity index 100% rename from patches/server/0026-Save-Json-list-asynchronously.patch rename to patches/server/0028-Save-Json-list-asynchronously.patch diff --git a/patches/server/0027-Use-Akair-s-flag-when-running-the-test-server-with-g.patch b/patches/server/0029-Use-Akair-s-flag-when-running-the-test-server-with-g.patch similarity index 91% rename from patches/server/0027-Use-Akair-s-flag-when-running-the-test-server-with-g.patch rename to patches/server/0029-Use-Akair-s-flag-when-running-the-test-server-with-g.patch index b1ebb0e..5c1ea1b 100644 --- a/patches/server/0027-Use-Akair-s-flag-when-running-the-test-server-with-g.patch +++ b/patches/server/0029-Use-Akair-s-flag-when-running-the-test-server-with-g.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Use Akair's flag when running the test server with gradle diff --git a/build.gradle.kts b/build.gradle.kts -index 787d3447f328c59deabb6b07b9f72f9fbce71cba..487cf26f8cf38b3df58df5591c029b4a7d639c00 100644 +index 746ad8087192931400256c8a1ef71e966eaf6b1a..14695f421c3751a1e75567aecf3685d901790011 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -151,7 +151,7 @@ fun TaskContainer.registerRunTask( +@@ -164,7 +164,7 @@ fun TaskContainer.registerRunTask( languageVersion.set(JavaLanguageVersion.of(21)) vendor.set(JvmVendorSpec.JETBRAINS) }) diff --git a/patches/server/0028-Use-Plazma-logo-instead-if-server-favicon-doesn-t-ex.patch b/patches/server/0030-Use-Plazma-logo-instead-if-server-favicon-doesn-t-ex.patch similarity index 96% rename from patches/server/0028-Use-Plazma-logo-instead-if-server-favicon-doesn-t-ex.patch rename to patches/server/0030-Use-Plazma-logo-instead-if-server-favicon-doesn-t-ex.patch index 98b7c80..000624d 100644 --- a/patches/server/0028-Use-Plazma-logo-instead-if-server-favicon-doesn-t-ex.patch +++ b/patches/server/0030-Use-Plazma-logo-instead-if-server-favicon-doesn-t-ex.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Use Plazma logo instead if server favicon doesn't exist diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c462d9f0c1997f8c49f6e80c4c87124d2a2533d8..e12225ae784f52e13195a759ccb19f8b4a909927 100644 +index 20266ef8f0974f47581e71175de4b01ea1a27bf0..54ef910938efb537a689dd5dbda119455bbf2a0e 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1622,29 +1622,32 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop loadStatusIcon() { diff --git a/patches/server/0029-Implement-FreedomChat.patch b/patches/server/0031-Implement-FreedomChat.patch similarity index 96% rename from patches/server/0029-Implement-FreedomChat.patch rename to patches/server/0031-Implement-FreedomChat.patch index dbf9bf4..98504f6 100644 --- a/patches/server/0029-Implement-FreedomChat.patch +++ b/patches/server/0031-Implement-FreedomChat.patch @@ -20,10 +20,10 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 4e583dde426f8345fb931be6135a1427ed635ab2..808cf602ee77d8156b032fb1a2bd1f5a3a2c2579 100644 +index 38752c9ba1726e3c38dd758287a920bc476ef88a..45fa867a22481bbba86e587767cfdb96d9691c49 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -684,6 +684,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -688,6 +688,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface // Paper start - Add setting for proxy online mode status return dedicatedserverproperties.enforceSecureProfile && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() @@ -32,7 +32,7 @@ index 4e583dde426f8345fb931be6135a1427ed635ab2..808cf602ee77d8156b032fb1a2bd1f5a // Paper end - Add setting for proxy online mode status } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 62a6fec0f4bf0f2a70740ba5cfd386857abe9531..503716bfa3d54c46534738d4209ef1a8ab50f7c3 100644 +index 8d7d050f12df83931bbb32f1832d7fcbc06317da..be4a5407fe9b692b72eb2b85e2dea160a0555bca 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -135,6 +135,7 @@ public abstract class PlayerList { @@ -52,7 +52,7 @@ index 62a6fec0f4bf0f2a70740ba5cfd386857abe9531..503716bfa3d54c46534738d4209ef1a8 player.loadGameTypes((CompoundTag) optional.orElse(null)); // CraftBukkit - decompile error ServerGamePacketListenerImpl playerconnection = new ServerGamePacketListenerImpl(this.server, connection, player, clientData); diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index af0ca8b0470c0e66cbc4cc0331219b71d0fa429f..97a2aebc9ba946e4532c66553d9a2e7e7b3139f2 100644 +index 6648d50cea38c17714785a335e5bc25f98d2595e..9e61505b8c34a3be20bcbe91ac98941729f5b64f 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -29,6 +29,15 @@ public class GlobalConfiguration extends ConfigurationPart { diff --git a/patches/server/0030-Reset-dirty-flag-when-loading-maps-from-the-disk.patch b/patches/server/0032-Reset-dirty-flag-when-loading-maps-from-the-disk.patch similarity index 94% rename from patches/server/0030-Reset-dirty-flag-when-loading-maps-from-the-disk.patch rename to patches/server/0032-Reset-dirty-flag-when-loading-maps-from-the-disk.patch index 6e4441b..8121bcb 100644 --- a/patches/server/0030-Reset-dirty-flag-when-loading-maps-from-the-disk.patch +++ b/patches/server/0032-Reset-dirty-flag-when-loading-maps-from-the-disk.patch @@ -19,7 +19,7 @@ index 26da9e7c25ef6a89482838010d8ed6bcf8c87511..71aa3b9c5604f832e764e0d7a93da467 } diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 97a2aebc9ba946e4532c66553d9a2e7e7b3139f2..2a1dceb5251c67d6a5c60e1b9fb3ef2931055673 100644 +index 9e61505b8c34a3be20bcbe91ac98941729f5b64f..d1d6ac9e3ad200228dc0ee08fd0152ccec38b397 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -114,6 +114,7 @@ public class GlobalConfiguration extends ConfigurationPart { diff --git a/patches/server/0031-Allow-throttling-hopper-checks-if-the-target-contain.patch b/patches/server/0033-Allow-throttling-hopper-checks-if-the-target-contain.patch similarity index 95% rename from patches/server/0031-Allow-throttling-hopper-checks-if-the-target-contain.patch rename to patches/server/0033-Allow-throttling-hopper-checks-if-the-target-contain.patch index c428532..0a63a2f 100644 --- a/patches/server/0031-Allow-throttling-hopper-checks-if-the-target-contain.patch +++ b/patches/server/0033-Allow-throttling-hopper-checks-if-the-target-contain.patch @@ -20,7 +20,7 @@ index 5ebbdb94d9b91c442ff60eb6872f740ebd790fa0..aeeb8af68ea43ae6c93952610918d77b } else { // Paper start - Perf: Optimize Hoppers diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index 6c9c28ae5fbe62ba647e7790acccb377d1e62490..0618db9893eda1fac0da6b771cc4d456b247d237 100644 +index d366e8755ba91c329164c16659f6b07245577fba..f21ed3431fd8472c78c15578bbd12214c499ceea 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -64,6 +64,12 @@ public class WorldConfigurations extends ConfigurationPart { diff --git a/patches/server/0032-Suppress-errors-from-dirty-attributes.patch b/patches/server/0034-Suppress-errors-from-dirty-attributes.patch similarity index 86% rename from patches/server/0032-Suppress-errors-from-dirty-attributes.patch rename to patches/server/0034-Suppress-errors-from-dirty-attributes.patch index 9d9382d..6bf487d 100644 --- a/patches/server/0032-Suppress-errors-from-dirty-attributes.patch +++ b/patches/server/0034-Suppress-errors-from-dirty-attributes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Suppress errors from dirty attributes diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index bf5633f387e268191e2a33be2dcec6c514c0766f..4653b25a818ebe18980864e6e450bd0ab8db99e9 100644 +index f2753cf51634479e501c1a3e7931d6d9882bc801..02288d8f3521756770351c02f623f9db02efd40c 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1377,7 +1377,8 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1390,7 +1390,8 @@ public abstract class LivingEntity extends Entity implements Attackable { } private void refreshDirtyAttributes() { @@ -18,7 +18,7 @@ index bf5633f387e268191e2a33be2dcec6c514c0766f..4653b25a818ebe18980864e6e450bd0a Iterator iterator = set.iterator(); while (iterator.hasNext()) { -@@ -1386,7 +1387,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1399,7 +1400,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.onAttributeUpdated(attributemodifiable.getAttribute()); } @@ -28,7 +28,7 @@ index bf5633f387e268191e2a33be2dcec6c514c0766f..4653b25a818ebe18980864e6e450bd0a protected void onAttributeUpdated(Holder attribute) { diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index 0618db9893eda1fac0da6b771cc4d456b247d237..bd795efde3b34371e54df881be39891a344d44fd 100644 +index f21ed3431fd8472c78c15578bbd12214c499ceea..9cfab16b9cdf40ccb709c0af66c406954560c0ef 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -29,6 +29,7 @@ public class WorldConfigurations extends ConfigurationPart { diff --git a/patches/server/0033-Implement-Rail-Optimazition.patch b/patches/server/0035-Implement-Rail-Optimazition.patch similarity index 99% rename from patches/server/0033-Implement-Rail-Optimazition.patch rename to patches/server/0035-Implement-Rail-Optimazition.patch index fbb390e..c128d26 100644 --- a/patches/server/0033-Implement-Rail-Optimazition.patch +++ b/patches/server/0035-Implement-Rail-Optimazition.patch @@ -354,7 +354,7 @@ index bd14c08defe8afc5ceca59d16a5b1dbad178f594..99dc44c569b6003b271ce2ea3f80cb19 boolean flag1 = world.hasNeighborSignal(pos) || this.findPoweredRailSignal(world, pos, state, true, 0) || this.findPoweredRailSignal(world, pos, state, false, 0); diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index bd795efde3b34371e54df881be39891a344d44fd..619cd178f6954563f7cd1c94c9eb8cbd78f3289b 100644 +index 9cfab16b9cdf40ccb709c0af66c406954560c0ef..0e27e4a1f767842d1dcd2ed235a6a45f120bf32e 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -72,6 +72,13 @@ public class WorldConfigurations extends ConfigurationPart { @@ -370,4 +370,4 @@ index bd795efde3b34371e54df881be39891a344d44fd..619cd178f6954563f7cd1c94c9eb8cbd + } - } + public Item item; diff --git a/patches/server/0034-Load-player-data-asynchronously.patch b/patches/server/0036-Load-player-data-asynchronously.patch similarity index 96% rename from patches/server/0034-Load-player-data-asynchronously.patch rename to patches/server/0036-Load-player-data-asynchronously.patch index 9c9cdad..f29a6c2 100644 --- a/patches/server/0034-Load-player-data-asynchronously.patch +++ b/patches/server/0036-Load-player-data-asynchronously.patch @@ -18,7 +18,7 @@ index 16069b9cbf6c7679c28a2e9a54e77d23cd10e541..bb10892f33ba0d7fc3959debef104507 private final byte[] challenge; final MinecraftServer server; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 503716bfa3d54c46534738d4209ef1a8ab50f7c3..14dd70f95ed6f6d4f24b509becf764aad60a3df1 100644 +index be4a5407fe9b692b72eb2b85e2dea160a0555bca..579f81ed04eeb6373b25e6794d3bf0c403891011 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -183,6 +183,16 @@ public abstract class PlayerList { @@ -56,7 +56,7 @@ index 503716bfa3d54c46534738d4209ef1a8ab50f7c3..14dd70f95ed6f6d4f24b509becf764aa // CraftBukkit start - Better rename detection if (optional.isPresent()) { diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 2a1dceb5251c67d6a5c60e1b9fb3ef2931055673..4a73bffae1531b42a2718cbe620fe2fc53139c45 100644 +index d1d6ac9e3ad200228dc0ee08fd0152ccec38b397..9e5477d15668488139e431b8289d1fcfac38048c 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -28,6 +28,7 @@ public class GlobalConfiguration extends ConfigurationPart { diff --git a/patches/server/0035-Configurable-RandomSource-factory-provider.patch b/patches/server/0037-Configurable-RandomSource-factory-provider.patch similarity index 99% rename from patches/server/0035-Configurable-RandomSource-factory-provider.patch rename to patches/server/0037-Configurable-RandomSource-factory-provider.patch index 400ee54..606ee49 100644 --- a/patches/server/0035-Configurable-RandomSource-factory-provider.patch +++ b/patches/server/0037-Configurable-RandomSource-factory-provider.patch @@ -240,10 +240,10 @@ index f1e0d3d7b1f458fcce83cf67762a16309123cdcb..6a8d5948f127ea87a0b4554ece4ad2c4 public boolean isIgnoreEntities() { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 9a104c48bb1a92655b1feaab3e01a3be6ec7d942..06a5dcfd89d43d9b09ac5932a75a33fc5c0216e6 100644 +index 907fe00ab752ad124020755f211567af771b9d70..e041752bbcba5cefce0dde8db917510129d29987 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -287,7 +287,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -288,7 +288,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { } // Paper end diff --git a/patches/server/0036-Optimize-advancement-criteria-triggering.patch b/patches/server/0038-Optimize-advancement-criteria-triggering.patch similarity index 95% rename from patches/server/0036-Optimize-advancement-criteria-triggering.patch rename to patches/server/0038-Optimize-advancement-criteria-triggering.patch index 51c0446..9e421c8 100644 --- a/patches/server/0036-Optimize-advancement-criteria-triggering.patch +++ b/patches/server/0038-Optimize-advancement-criteria-triggering.patch @@ -51,10 +51,10 @@ index ebbad97920df3d1645637e646a98e16cb04d361e..a149c949a042e1d1e504d9f5ce0bfa6d int j = 0; int k = 0; diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 4a73bffae1531b42a2718cbe620fe2fc53139c45..cac12ad98eb0fa4dcc1b0f7f21d1eadd14ef7456 100644 +index 9e5477d15668488139e431b8289d1fcfac38048c..68a0e7144942022f0665e3124d98add70376d4a4 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -128,4 +128,16 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -129,4 +129,16 @@ public class GlobalConfiguration extends ConfigurationPart { } diff --git a/patches/server/0037-Configurable-water-flowing-speed.patch b/patches/server/0039-Configurable-water-flowing-speed.patch similarity index 94% rename from patches/server/0037-Configurable-water-flowing-speed.patch rename to patches/server/0039-Configurable-water-flowing-speed.patch index 4ef136f..4e2e270 100644 --- a/patches/server/0037-Configurable-water-flowing-speed.patch +++ b/patches/server/0039-Configurable-water-flowing-speed.patch @@ -18,7 +18,7 @@ index 1e741f36b79585f33abe413beafe00cf5205d54f..028aea6640356ba80f5d682e3cc03b7f @Override diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index 619cd178f6954563f7cd1c94c9eb8cbd78f3289b..ef3dc8477b5547efa08a7fb60704f246e57fedfe 100644 +index 0e27e4a1f767842d1dcd2ed235a6a45f120bf32e..c1d4a96cf5be77f4460c54ed19622f527d42ca06 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java @@ -64,7 +64,9 @@ public class WorldConfigurations extends ConfigurationPart { diff --git a/patches/server/0038-cleanup-logs.patch b/patches/server/0040-cleanup-logs.patch similarity index 100% rename from patches/server/0038-cleanup-logs.patch rename to patches/server/0040-cleanup-logs.patch diff --git a/patches/server/0041-Completely-remove-Mojang-Profiler.patch b/patches/server/0041-Completely-remove-Mojang-Profiler.patch deleted file mode 100644 index a300769..0000000 --- a/patches/server/0041-Completely-remove-Mojang-Profiler.patch +++ /dev/null @@ -1,1358 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaKR93 -Date: Wed, 27 Sep 2023 17:52:52 +0900 -Subject: [PATCH] Completely remove Mojang Profiler - - -diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 647a3ac2aea4dadd638836f831cc3768d10c7b74..c3e1e9a8e82f23417138b91aa062a83ec3ef6f24 100644 ---- a/src/main/java/net/minecraft/commands/Commands.java -+++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -132,7 +132,7 @@ import net.minecraft.server.commands.WorldBorderCommand; - import net.minecraft.server.commands.data.DataCommands; - import net.minecraft.server.level.ServerPlayer; - import net.minecraft.tags.TagKey; --import net.minecraft.util.profiling.Profiler; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.util.profiling.jfr.JvmProfiler; - import net.minecraft.world.flag.FeatureFlagSet; - import net.minecraft.world.flag.FeatureFlags; -@@ -448,7 +448,7 @@ public class Commands { - int j = minecraftserver.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_FORK_COUNT); - - try { -- ExecutionContext executioncontext1 = new ExecutionContext<>(i, j, Profiler.get()); -+ ExecutionContext executioncontext1 = new ExecutionContext<>(i, j); // Plazma - Completely remove Mojang's profiler - - try { - Commands.CURRENT_EXECUTION_CONTEXT.set(executioncontext1); -diff --git a/src/main/java/net/minecraft/commands/execution/ExecutionContext.java b/src/main/java/net/minecraft/commands/execution/ExecutionContext.java -index f626a2f28f2aebb3237cebb6afef3c4fa1a6cb37..467e17bfce31d0919d603698c9d88a04b05033dc 100644 ---- a/src/main/java/net/minecraft/commands/execution/ExecutionContext.java -+++ b/src/main/java/net/minecraft/commands/execution/ExecutionContext.java -@@ -12,7 +12,7 @@ import net.minecraft.commands.ExecutionCommandSource; - import net.minecraft.commands.execution.tasks.BuildContexts; - import net.minecraft.commands.execution.tasks.CallFunction; - import net.minecraft.commands.functions.InstantiatedFunction; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import org.slf4j.Logger; - - public class ExecutionContext implements AutoCloseable { -@@ -20,7 +20,7 @@ public class ExecutionContext implements AutoCloseable { - private static final Logger LOGGER = LogUtils.getLogger(); - private final int commandLimit; - private final int forkLimit; -- private final ProfilerFiller profiler; -+ //private final ProfilerFiller profiler; // Plazma - Completely remove Mojang's Profiler - @Nullable - private TraceCallbacks tracer; - private int commandQuota; -@@ -29,10 +29,10 @@ public class ExecutionContext implements AutoCloseable { - private final List> newTopCommands = new ObjectArrayList<>(); - private int currentFrameDepth; - -- public ExecutionContext(int maxCommandChainLength, int maxCommandForkCount, ProfilerFiller profiler) { -+ public ExecutionContext(int maxCommandChainLength, int maxCommandForkCount/*, ProfilerFiller profiler*/) { // Plazma - Completely remove Mojang's Profiler - this.commandLimit = maxCommandChainLength; - this.forkLimit = maxCommandForkCount; -- this.profiler = profiler; -+ //this.profiler = profiler; // Plazma - Completely remove Mojang's Profiler - this.commandQuota = maxCommandChainLength; - } - -@@ -129,9 +129,11 @@ public class ExecutionContext implements AutoCloseable { - return this.tracer; - } - -+ /* // Plazma - Completely remove Mojang's Profiler - public ProfilerFiller profiler() { - return this.profiler; - } -+ */ // Plazma - Completely remove Mojang's Profiler - - public int forkLimit() { - return this.forkLimit; -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b62be89b9b3705a29b6c42a794d653c66b73f7eb..f53b15be673f788ecb0a3bd0fd59834de6c1ceb9 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -111,19 +111,19 @@ import net.minecraft.util.datafix.DataFixers; - import net.minecraft.util.debugchart.RemoteDebugSampleType; - import net.minecraft.util.debugchart.SampleLogger; - import net.minecraft.util.debugchart.TpsDebugDimensions; --import net.minecraft.util.profiling.EmptyProfileResults; --import net.minecraft.util.profiling.ProfileResults; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; --import net.minecraft.util.profiling.ResultField; --import net.minecraft.util.profiling.SingleTickProfiler; -+//import net.minecraft.util.profiling.EmptyProfileResults; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfileResults; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ResultField; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.SingleTickProfiler; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.util.profiling.jfr.JvmProfiler; - import net.minecraft.util.profiling.jfr.callback.ProfiledDuration; --import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder; --import net.minecraft.util.profiling.metrics.profiling.InactiveMetricsRecorder; --import net.minecraft.util.profiling.metrics.profiling.MetricsRecorder; --import net.minecraft.util.profiling.metrics.profiling.ServerMetricsSamplersProvider; --import net.minecraft.util.profiling.metrics.storage.MetricsPersister; -+//import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.metrics.profiling.InactiveMetricsRecorder; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.metrics.profiling.MetricsRecorder; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.metrics.profiling.ServerMetricsSamplersProvider; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.metrics.storage.MetricsPersister; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.util.thread.ReentrantBlockableEventLoop; - import net.minecraft.world.Difficulty; - import net.minecraft.world.RandomSequences; -@@ -229,13 +229,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop tickables = Lists.newArrayList(); -- private MetricsRecorder metricsRecorder; -- private Consumer onMetricsRecordingStopped; -- private Consumer onMetricsRecordingFinished; -- private boolean willStartRecordingMetrics; -- @Nullable -- private MinecraftServer.TimeProfiler debugCommandProfiler; -- private boolean debugCommandProfilerDelayStart; -+ //private MetricsRecorder metricsRecorder; // Plazma - Completely remove Mojang's Profiler -+ //private Consumer onMetricsRecordingStopped; // Plazma - Completely remove Mojang's Profiler -+ //private Consumer onMetricsRecordingFinished; // Plazma - Completely remove Mojang's Profiler -+ //private boolean willStartRecordingMetrics; // Plazma - Completely remove Mojang's Profiler -+ //@Nullable // Plazma - Completely remove Mojang's Profiler -+ //private MinecraftServer.TimeProfiler debugCommandProfiler; // Plazma - Completely remove Mojang's Profiler -+ //private boolean debugCommandProfilerDelayStart; - private ServerConnectionListener connection; - public final ChunkProgressListenerFactory progressListenerFactory; - @Nullable -@@ -1409,7 +1409,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % autosavePeriod == 0; - try { - this.isSaving = true; -@@ -1735,7 +1735,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { - entityplayer.connection.suspendFlushing(); -@@ -2932,6 +2932,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { -@@ -2957,12 +2958,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop resultConsumer, Consumer dumpConsumer) { -- /*this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur -+ this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur // Plazma - Completely remove Mojang's Profiler - this.stopRecordingMetrics(); - resultConsumer.accept(methodprofilerresults); - }; - this.onMetricsRecordingFinished = dumpConsumer; -- this.willStartRecordingMetrics = true;*/ // Purpur -+ this.willStartRecordingMetrics = true; // Purpur // Plazma - Completely remove Mojang's Profiler - } - - public void stopRecordingMetrics() { -@@ -2976,6 +2977,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop prepared, ResourceManager manager, ProfilerFiller profiler) { -+ protected void apply(Map prepared, ResourceManager manager) { // Plazma - Completely remove Mojang's Profiler - Builder builder = ImmutableMap.builder(); - - prepared.forEach((minecraftkey, advancement) -> { -diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java -index ebd4d2463f88535edd69a1b63a65a635a5592ca2..9523a2fa1e7019339bd166993ca04e1c0eab750b 100644 ---- a/src/main/java/net/minecraft/server/ServerFunctionManager.java -+++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java -@@ -16,8 +16,8 @@ import net.minecraft.commands.functions.CommandFunction; - import net.minecraft.commands.functions.InstantiatedFunction; - import net.minecraft.nbt.CompoundTag; - import net.minecraft.resources.ResourceLocation; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import org.slf4j.Logger; - - public class ServerFunctionManager { -diff --git a/src/main/java/net/minecraft/server/commands/DebugCommand.java b/src/main/java/net/minecraft/server/commands/DebugCommand.java -index 06568cc308e06b16f43ec7facd5e2c4e36f3fee9..fd288704150960750b4e1d09031cfae8730e8b11 100644 ---- a/src/main/java/net/minecraft/server/commands/DebugCommand.java -+++ b/src/main/java/net/minecraft/server/commands/DebugCommand.java -@@ -35,8 +35,9 @@ import net.minecraft.network.chat.Component; - import net.minecraft.resources.ResourceLocation; - import net.minecraft.server.MinecraftServer; - import net.minecraft.util.TimeUtil; --import net.minecraft.util.profiling.ProfileResults; -+//import net.minecraft.util.profiling.ProfileResults; // Plazma - Completely remove Mojang's Profiler - import org.apache.commons.io.IOUtils; -+import org.bukkit.command.CommandSender; - import org.slf4j.Logger; - - public class DebugCommand { -@@ -67,36 +68,22 @@ public class DebugCommand { - } - - private static int start(CommandSourceStack source) throws CommandSyntaxException { -- MinecraftServer minecraftServer = source.getServer(); -- if (minecraftServer.isTimeProfilerRunning()) { -- throw ERROR_ALREADY_RUNNING.create(); -- } else { -- minecraftServer.startTimeProfiler(); -- source.sendSuccess(() -> Component.translatable("commands.debug.started"), true); -- return 0; -- } -+ return removedMessage(source); // Plazma - Completely remove Mojang's Profiler - } - - private static int stop(CommandSourceStack source) throws CommandSyntaxException { -- MinecraftServer minecraftServer = source.getServer(); -- if (!minecraftServer.isTimeProfilerRunning()) { -- throw ERROR_NOT_RUNNING.create(); -- } else { -- ProfileResults profileResults = minecraftServer.stopTimeProfiler(); -- double d = (double)profileResults.getNanoDuration() / (double)TimeUtil.NANOSECONDS_PER_SECOND; -- double e = (double)profileResults.getTickDuration() / d; -- source.sendSuccess( -- () -> Component.translatable( -- "commands.debug.stopped", -- String.format(Locale.ROOT, "%.2f", d), -- profileResults.getTickDuration(), -- String.format(Locale.ROOT, "%.2f", e) -- ), -- true -- ); -- return (int)e; -- } -+ return removedMessage(source); // Plazma - Completely remove Mojang's Profiler -+ } -+ -+ // Plazma start - Completely remove Mojang's Profiler -+ private static int removedMessage(CommandSourceStack source) { -+ net.kyori.adventure.text.minimessage.MiniMessage mm = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage(); -+ source.getSender().sendMessage(mm.deserialize("Purpur has removed Mojang's Profiler to save your performance. Please use /spark instead")); -+ source.getSender().sendMessage(mm.deserialize("For more information, view its documentation at")); -+ source.getSender().sendMessage(mm.deserialize("https://spark.lucko.me/docs/Command-Usage")); -+ return 0; - } -+ // Plazma end - Completely remove Mojang's Profiler - - static class TraceCustomExecutor - extends CustomCommandExecutor.WithErrorHandling -@@ -267,6 +254,13 @@ public class DebugCommand { - return true; - } - -+ // Plazma start - fix build -+ @Override -+ public CommandSender getBukkitSender(final CommandSourceStack wrapper) { -+ return wrapper.getBukkitSender(); -+ } -+ // Plazma end - fix build -+ - @Override - public void close() { - IOUtils.closeQuietly((Writer)this.output); -diff --git a/src/main/java/net/minecraft/server/commands/PerfCommand.java b/src/main/java/net/minecraft/server/commands/PerfCommand.java -index 8ac4d5dbe7f8febf4226f26a6b035282dcdf1b0f..3d6f649ab1efcc71f70f055cff0854c933672526 100644 ---- a/src/main/java/net/minecraft/server/commands/PerfCommand.java -+++ b/src/main/java/net/minecraft/server/commands/PerfCommand.java -@@ -19,9 +19,9 @@ import net.minecraft.network.chat.Component; - import net.minecraft.server.MinecraftServer; - import net.minecraft.util.FileZipper; - import net.minecraft.util.TimeUtil; --import net.minecraft.util.profiling.EmptyProfileResults; --import net.minecraft.util.profiling.ProfileResults; --import net.minecraft.util.profiling.metrics.storage.MetricsPersister; -+//import net.minecraft.util.profiling.EmptyProfileResults; // Plazma - Completely remove Mojang's profiler -+//import net.minecraft.util.profiling.ProfileResults; // Plazma - Completely remove Mojang's profiler -+//import net.minecraft.util.profiling.metrics.storage.MetricsPersister; // Plazma - Completely remove Mojang's profiler - import org.apache.commons.io.FileUtils; - import org.slf4j.Logger; - -@@ -42,7 +42,8 @@ public class PerfCommand { - } - - private static int startProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException { -- if (true) return removedMessage(source); // Purpur -+ return removedMessage(source); // Purpur // Plazma - Completely remove Mojang's profiler -+ /* // Plazma - Completely remove Mojang's profiler - MinecraftServer minecraftServer = source.getServer(); - if (minecraftServer.isRecordingMetrics()) { - throw ERROR_ALREADY_RUNNING.create(); -@@ -53,10 +54,12 @@ public class PerfCommand { - source.sendSuccess(() -> Component.translatable("commands.perf.started"), false); - return 0; - } -+ */ // Plazma - Completely remove Mojang's profiler - } - - private static int stopProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException { -- if (true) return removedMessage(source); // Purpur -+ return removedMessage(source); // Purpur // Plazma - Completely remove Mojang's profiler -+ /* // Plazma - Completely remove Mojang's profiler - MinecraftServer minecraftServer = source.getServer(); - if (!minecraftServer.isRecordingMetrics()) { - throw ERROR_NOT_RUNNING.create(); -@@ -64,6 +67,7 @@ public class PerfCommand { - minecraftServer.finishRecordingMetrics(); - return 0; - } -+ */ // Plazma - Completely remove Mojang's profiler - } - - // Purpur start -@@ -78,6 +82,7 @@ public class PerfCommand { - } - // Purpur end - -+ /* // Plazma - Completely remove Mojang's profiler - private static void saveResults(CommandSourceStack source, Path tempProfilingDirectory, MinecraftServer server) { - String string = String.format( - Locale.ROOT, "%s-%s-%s", Util.getFilenameFormattedDateTime(), server.getWorldData().getLevelName(), SharedConstants.getCurrentVersion().getId() -@@ -118,4 +123,6 @@ public class PerfCommand { - ); - } - } -+ */ // Plazma - Completely remove Mojang's profiler -+ - } -diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 808cf602ee77d8156b032fb1a2bd1f5a3a2c2579..77244ec4257bfe3b0f1fdcaf189a0d34a6b84707 100644 ---- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -871,11 +871,13 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface - return this.settings.getProperties().serverResourcePackInfo; - } - -+ /* // Plazma - Completely remove Mojang's Profiler - @Override - public void endMetricsRecordingTick() { - super.endMetricsRecordingTick(); - this.debugSampleSubscriptionTracker.tick(this.getTickCount()); - } -+ */ // Plazma - Completely remove Mojang's Profiler - - @Override - public SampleLogger getTickTimeLogger() { -diff --git a/src/main/java/net/minecraft/server/level/ChunkGenerationTask.java b/src/main/java/net/minecraft/server/level/ChunkGenerationTask.java -index 7ea8c13c9993576c1408e710d3ceb9947b09090d..f49000bed3b273a170258ca3816b0b6d7b1e6bcf 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkGenerationTask.java -+++ b/src/main/java/net/minecraft/server/level/ChunkGenerationTask.java -@@ -5,8 +5,8 @@ import java.util.List; - import java.util.concurrent.CompletableFuture; - import javax.annotation.Nullable; - import net.minecraft.util.StaticCache2D; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.Zone; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.Zone; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.level.ChunkPos; - import net.minecraft.world.level.chunk.ChunkAccess; - import net.minecraft.world.level.chunk.status.ChunkDependencies; -@@ -113,8 +113,8 @@ public class ChunkGenerationTask { - } - - private void scheduleLayer(ChunkStatus targetStatus, boolean allowGeneration) { -- try (Zone zone = Profiler.get().zone("scheduleLayer")) { -- zone.addText(targetStatus::getName); -+ //try (Zone zone = Profiler.get().zone("scheduleLayer")) { // Plazma - Completely remove Mojang's Profiler -+ //zone.addText(targetStatus::getName); // Plazma - Completely remove Mojang's Profiler - int i = this.getRadiusForLayer(targetStatus, allowGeneration); - - for (int j = this.pos.x - i; j <= this.pos.x + i; j++) { -@@ -125,7 +125,7 @@ public class ChunkGenerationTask { - } - } - } -- } -+ //} // Plazma - Completely remove Mojang's Profiler - } - - private int getRadiusForLayer(ChunkStatus status, boolean generate) { -diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index e16f22dd82b4315da34af3c9a189d9d5fec0fd2f..bff50bec8433979d08d6b40c0c36fd3849ed37e5 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkMap.java -+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -65,8 +65,8 @@ import net.minecraft.server.network.ServerPlayerConnection; - import net.minecraft.util.CsvOutput; - import net.minecraft.util.Mth; - import net.minecraft.util.StaticCache2D; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's profiler - import net.minecraft.util.thread.BlockableEventLoop; - import net.minecraft.util.thread.ConsecutiveExecutor; - import net.minecraft.world.entity.Entity; -diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index b61d94d84702bbc2b30b7fa7e2b536c0b83dd758..e720e0dbaa8f90dccd298a1211afb8fb7b82f0e9 100644 ---- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java -+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -26,8 +26,8 @@ import net.minecraft.network.protocol.Packet; - import net.minecraft.server.MinecraftServer; - import net.minecraft.server.level.progress.ChunkProgressListener; - import net.minecraft.util.VisibleForDebug; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.util.thread.BlockableEventLoop; - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.ai.village.poi.PoiManager; -@@ -494,19 +494,19 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - this.shuffleRandom.setSeed(this.level.random.nextLong()); - if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled - // Paper end - chunk tick iteration optimisation -- this.tickChunks(null, j, list); // Purpur -+ this.tickChunks(j, list); // Purpur // Plazma - Completely remove Mojang's Profiler - //gameprofilerfiller.pop(); // Purpur - } finally { - list.clear(); - } - } - -- this.broadcastChangedChunks(null); // Purpur -+ this.broadcastChangedChunks(); // Purpur // Plazma - Completely remove Mojang's Profiler - //gameprofilerfiller.pop(); // Purpur - } - } - -- private void broadcastChangedChunks(ProfilerFiller profiler) { // Purpur -+ private void broadcastChangedChunks() { // Purpur // Plazma - Completely remove Mojang's Profiler - //profiler.push("broadcast"); // Purpur - Iterator iterator = this.chunkHoldersToBroadcast.iterator(); - -@@ -546,7 +546,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - // Paper end - chunk tick iteration optimisation - } - -- private void tickChunks(ProfilerFiller profiler, long timeDelta, List chunks) { -+ private void tickChunks(long timeDelta, List chunks) { // Plazma - Completely remove Mojang's Profiler - //profiler.popPush("naturalSpawnCount"); // Purpur - int j = this.distanceManager.getNaturalSpawnChunkCount(); - // Paper start - Optional per player mob spawns -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 8bd80a4f2f0cb0c4f206bc7d3e70fbcfe56188ee..4f692b4513cc837fa71bc713d03d70a6e6f01b9d 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -79,8 +79,8 @@ import net.minecraft.util.ProgressListener; - import net.minecraft.util.RandomSource; - import net.minecraft.util.Unit; - import net.minecraft.util.datafix.DataFixTypes; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.util.valueproviders.IntProvider; - import net.minecraft.util.valueproviders.UniformInt; - import net.minecraft.world.DifficultyInstance; -@@ -868,9 +868,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - long i = this.levelData.getGameTime() + 1L; - - this.serverLevelData.setGameTime(i); -- Profiler.get().push("scheduledFunctions"); -+ //Profiler.get().push("scheduledFunctions"); // Plazma - Completely remove Mojang's Profiler - this.serverLevelData.getScheduledEvents().tick(this.server, i); -- Profiler.get().pop(); -+ //Profiler.get().pop(); // Plazma - Completely remove Mojang's Profiler - if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { - // Purpur start - int incrementTicks = isDay() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks; -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 17f5640ab2b6880895b3b96ae06db8b0e3c03a02..646123393dc7d28d2bc184343e3233961482fa2b 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -102,8 +102,8 @@ import net.minecraft.tags.FluidTags; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; - import net.minecraft.util.Unit; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.damagesource.DamageTypes; - import net.minecraft.world.effect.MobEffectInstance; -diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 49cb116fd55e6d5cd36b9773b39191e4ab06b7e0..7a5c3210401e5833188f45619243afe5e08cd6a1 100644 ---- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -30,7 +30,7 @@ import net.minecraft.server.MinecraftServer; - import net.minecraft.server.level.ClientInformation; - import net.minecraft.server.level.ServerPlayer; - import net.minecraft.util.VisibleForDebug; --import net.minecraft.util.profiling.Profiler; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.util.thread.BlockableEventLoop; - import org.slf4j.Logger; - -diff --git a/src/main/java/net/minecraft/server/packs/resources/ProfiledReloadInstance.java b/src/main/java/net/minecraft/server/packs/resources/ProfiledReloadInstance.java -index 5a2b07340c63577f6d32c0658ce5f9b616c82f91..a5bb5f3fa3b5a232cdf9261c388bbb04a2d96b20 100644 ---- a/src/main/java/net/minecraft/server/packs/resources/ProfiledReloadInstance.java -+++ b/src/main/java/net/minecraft/server/packs/resources/ProfiledReloadInstance.java -@@ -9,8 +9,8 @@ import java.util.concurrent.TimeUnit; - import java.util.concurrent.atomic.AtomicLong; - import net.minecraft.Util; - import net.minecraft.util.Unit; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import org.slf4j.Logger; - - public class ProfiledReloadInstance extends SimpleReloadInstance { -@@ -51,12 +51,12 @@ public class ProfiledReloadInstance extends SimpleReloadInstance executor.execute(() -> { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push(string); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang's Profiler -+ //profilerFiller.push(string); // Plazma - Completely remove Mojang's Profiler - long l = Util.getNanos(); - runnable.run(); - atomicLong.addAndGet(Util.getNanos() - l); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Plazma - Completely remove Mojang's Profiler - }); - } - -diff --git a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java -index abc92e09b7bb636612f04ace8232947c8d454e68..7c8990a713bf986cbb4e65f52aa1a3fdea7b14af 100644 ---- a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java -+++ b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java -@@ -3,8 +3,8 @@ package net.minecraft.server.packs.resources; - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.Executor; - import net.minecraft.util.Unit; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - - public interface ResourceManagerReloadListener extends PreparableReloadListener { - @Override -diff --git a/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java -index eb54f0cc67ca25e0ff6e423bcbcebab294bd5d95..11e2efcf07ab5a758812c598468d2f4561fa5264 100644 ---- a/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java -+++ b/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java -@@ -15,7 +15,7 @@ import java.util.Map.Entry; - import net.minecraft.core.HolderLookup; - import net.minecraft.resources.FileToIdConverter; - import net.minecraft.resources.ResourceLocation; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import org.slf4j.Logger; - - public abstract class SimpleJsonResourceReloadListener extends SimplePreparableReloadListener> { -@@ -39,7 +39,7 @@ public abstract class SimpleJsonResourceReloadListener extends SimplePreparab - } - - @Override -- protected Map prepare(ResourceManager resourceManager, ProfilerFiller profilerFiller) { -+ protected Map prepare(ResourceManager resourceManager) { // Plazma - Completely remove Mojang's Profiler - Map map = new HashMap<>(); - scanDirectory(resourceManager, this.directory, this.ops, this.codec, map); - return map; -diff --git a/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java -index 0aaab6a2a10bf012c9d275f7cee2095c8fbb8809..4d986ee7bd823386c0ed0e54c1980c9c349bb791 100644 ---- a/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java -+++ b/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java -@@ -2,20 +2,20 @@ package net.minecraft.server.packs.resources; - - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.Executor; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - - public abstract class SimplePreparableReloadListener implements PreparableReloadListener { - @Override - public final CompletableFuture reload( - PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor - ) { -- return CompletableFuture.supplyAsync(() -> this.prepare(manager, Profiler.get()), prepareExecutor) -+ return CompletableFuture.supplyAsync(() -> this.prepare(manager), prepareExecutor) // Plazma - Completely remove Mojang's Profiler - .thenCompose(synchronizer::wait) -- .thenAcceptAsync(prepared -> this.apply((T)prepared, manager, Profiler.get()), applyExecutor); -+ .thenAcceptAsync(prepared -> this.apply(prepared, manager), applyExecutor); // Plazma - Completely remove Mojang's Profiler - } - -- protected abstract T prepare(ResourceManager manager, ProfilerFiller profiler); -+ protected abstract T prepare(ResourceManager manager); // Plazma - Completely remove Mojang's Profiler - -- protected abstract void apply(T prepared, ResourceManager manager, ProfilerFiller profiler); -+ protected abstract void apply(T prepared, ResourceManager manager); // Plazma - Completely remove Mojang's Profiler - } -diff --git a/src/main/java/net/minecraft/util/thread/AbstractConsecutiveExecutor.java b/src/main/java/net/minecraft/util/thread/AbstractConsecutiveExecutor.java -index 805532c7acc4ad81b83e305d669f5cee0e7597e9..699f69421a36c78bd0cd728e86fe0e20bb515de4 100644 ---- a/src/main/java/net/minecraft/util/thread/AbstractConsecutiveExecutor.java -+++ b/src/main/java/net/minecraft/util/thread/AbstractConsecutiveExecutor.java -@@ -7,13 +7,13 @@ import java.util.concurrent.Executor; - import java.util.concurrent.RejectedExecutionException; - import java.util.concurrent.atomic.AtomicReference; - import net.minecraft.Util; --import net.minecraft.util.profiling.metrics.MetricCategory; --import net.minecraft.util.profiling.metrics.MetricSampler; --import net.minecraft.util.profiling.metrics.MetricsRegistry; --import net.minecraft.util.profiling.metrics.ProfilerMeasured; -+//import net.minecraft.util.profiling.metrics.MetricCategory; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.metrics.MetricSampler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.metrics.MetricsRegistry; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.metrics.ProfilerMeasured; // Plazma - Completely remove Mojang's Profiler - import org.slf4j.Logger; - --public abstract class AbstractConsecutiveExecutor implements ProfilerMeasured, TaskScheduler, Runnable { -+public abstract class AbstractConsecutiveExecutor implements TaskScheduler, Runnable { // Plazma - Completely remove Mojang's Profiler - private static final Logger LOGGER = LogUtils.getLogger(); - private final AtomicReference status = new AtomicReference<>(AbstractConsecutiveExecutor.Status.SLEEPING); - private final StrictQueue queue; -@@ -24,7 +24,7 @@ public abstract class AbstractConsecutiveExecutor implements - this.executor = executor; - this.queue = queue; - this.name = name; -- MetricsRegistry.INSTANCE.add(this); -+ //MetricsRegistry.INSTANCE.add(this); // Plazma - Completely remove Mojang's Profiler - } - - private boolean canBeScheduled() { -@@ -108,10 +108,12 @@ public abstract class AbstractConsecutiveExecutor implements - return this.name; - } - -+ /* // Plazma - Completely remove Mojang's Profiler - @Override - public List profiledMetrics() { - return ImmutableList.of(MetricSampler.create(this.name + "-queue-size", MetricCategory.CONSECUTIVE_EXECUTORS, this::size)); - } -+ */ // Plazma - Completely remove Mojang's Profiler - - private boolean setRunning() { - return this.status.compareAndSet(AbstractConsecutiveExecutor.Status.SLEEPING, AbstractConsecutiveExecutor.Status.RUNNING); -diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -index 9b706276dc5b5f55b966c5472c6c4e864342b916..f91227bc1a7c650483c9b46b30ac06a9597997f2 100644 ---- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -+++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -@@ -15,13 +15,13 @@ import java.util.function.Supplier; - import javax.annotation.CheckReturnValue; - import net.minecraft.ReportedException; - import net.minecraft.SharedConstants; --import net.minecraft.util.profiling.metrics.MetricCategory; --import net.minecraft.util.profiling.metrics.MetricSampler; --import net.minecraft.util.profiling.metrics.MetricsRegistry; --import net.minecraft.util.profiling.metrics.ProfilerMeasured; -+//import net.minecraft.util.profiling.metrics.MetricCategory; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.metrics.MetricSampler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.metrics.MetricsRegistry; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.metrics.ProfilerMeasured; // Plazma - Completely remove Mojang's Profiler - import org.slf4j.Logger; - --public abstract class BlockableEventLoop implements ProfilerMeasured, TaskScheduler, Executor { -+public abstract class BlockableEventLoop implements TaskScheduler, Executor { // Plazma - Completely remove Mojang's Profiler - public static final long BLOCK_TIME_NANOS = 100000L; - private final String name; - private static final Logger LOGGER = LogUtils.getLogger(); -@@ -30,7 +30,7 @@ public abstract class BlockableEventLoop implements Profiler - - protected BlockableEventLoop(String name) { - this.name = name; -- MetricsRegistry.INSTANCE.add(this); -+ //MetricsRegistry.INSTANCE.add(this); // Plazma - Completely remove Mojang's Profiler - } - - protected abstract boolean shouldRun(R task); -@@ -160,10 +160,12 @@ public abstract class BlockableEventLoop implements Profiler - } - } - -+ /* // Plazma - Completely remove Mojang's Profiler - @Override - public List profiledMetrics() { - return ImmutableList.of(MetricSampler.create(this.name + "-pending-tasks", MetricCategory.EVENT_LOOPS, this::getPendingTasksCount)); - } -+ */ // Plazma - Completely remove Mojang's Profiler - - public static boolean isNonRecoverable(Throwable exception) { - return exception instanceof ReportedException reportedException -diff --git a/src/main/java/net/minecraft/util/thread/PriorityConsecutiveExecutor.java b/src/main/java/net/minecraft/util/thread/PriorityConsecutiveExecutor.java -index c67846e4d5583d79c6e9760c10d2581f0d54f45c..61f704fc25c45367185633708852ee4bc4084528 100644 ---- a/src/main/java/net/minecraft/util/thread/PriorityConsecutiveExecutor.java -+++ b/src/main/java/net/minecraft/util/thread/PriorityConsecutiveExecutor.java -@@ -3,12 +3,12 @@ package net.minecraft.util.thread; - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.Executor; - import java.util.function.Consumer; --import net.minecraft.util.profiling.metrics.MetricsRegistry; -+//import net.minecraft.util.profiling.metrics.MetricsRegistry; // Plazma - Completely remove Mojang's Profiler - - public class PriorityConsecutiveExecutor extends AbstractConsecutiveExecutor { - public PriorityConsecutiveExecutor(int priorityCount, Executor executor, String name) { - super(new StrictQueue.FixedPriorityQueue(priorityCount), executor, name); -- MetricsRegistry.INSTANCE.add(this); -+ //MetricsRegistry.INSTANCE.add(this); // Plazma - Completely remove Mojang's Profiler - } - - @Override -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index bc6ae8f1187e5ec896c4bc3ab98aef6a7ed9f98c..45b754bfbc5dc37a0c10dcb44125715d0d6606f8 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -84,8 +84,8 @@ import net.minecraft.tags.FluidTags; - import net.minecraft.tags.TagKey; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; - import net.minecraft.world.Nameable; -@@ -4061,16 +4061,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - entity.teleport(this.calculatePassengerTransition(teleportTarget, entity)); - } - -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang's Profiler - -- gameprofilerfiller.push("teleportSameDimension"); -+ //gameprofilerfiller.push("teleportSameDimension"); // Plazma - Completely remove Mojang's Profiler - this.teleportSetPosition(PositionMoveRotation.of(teleportTarget), teleportTarget.relatives()); - if (!teleportTarget.asPassenger()) { - this.sendTeleportTransitionToRidingPlayers(teleportTarget); - } - - teleportTarget.postTeleportTransition().onTransition(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang's Profiler - return this; - } - -diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index b1661d7a595e4680ff3e84f2549be01286e4bf8a..ab9f9953733531fa59f8992071d62850ad8506f6 100644 ---- a/src/main/java/net/minecraft/world/entity/LivingEntity.java -+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -73,8 +73,8 @@ import net.minecraft.tags.FluidTags; - import net.minecraft.tags.ItemTags; - import net.minecraft.tags.TagKey; - import net.minecraft.util.Mth; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.Difficulty; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.damagesource.CombatRules; -diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 8e5ad4cd6c8f61661b87dc96ba914c0bcd199879..d242eeb3dde8f379a7baad430f2c22ab3ca8a3c9 100644 ---- a/src/main/java/net/minecraft/world/entity/Mob.java -+++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -34,8 +34,8 @@ import net.minecraft.sounds.SoundEvent; - import net.minecraft.tags.TagKey; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.Difficulty; - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; -diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -index 74c5914bc51cff128d4b86853316e5e51e02b416..129c907e842f4f16ad13c490672bfec6eaba620e 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -+++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -@@ -7,8 +7,8 @@ import java.util.EnumSet; - import java.util.Map; - import java.util.Set; - import java.util.function.Predicate; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - - public class GoalSelector { - private static final WrappedGoal NO_GOAL = new WrappedGoal(Integer.MAX_VALUE, new Goal() { -diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index a5289b6c453c24cb7b8b3a301b72c3adf92c1d13..c7c6385c71c5bfae5818976008feececf5890654 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -10,8 +10,8 @@ import net.minecraft.core.Vec3i; - import net.minecraft.network.protocol.game.DebugPackets; - import net.minecraft.tags.BlockTags; - import net.minecraft.util.Mth; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.Mob; - import net.minecraft.world.entity.ai.attributes.Attributes; -diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java -index 8f5a5db1a07fa6a95ecfacaab2f9de609202faf4..8bd18b5bf660cb307b7d405a497906ae6608b6b4 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java -+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java -@@ -2,8 +2,8 @@ package net.minecraft.world.entity.ai.sensing; - - import it.unimi.dsi.fastutil.ints.IntOpenHashSet; - import it.unimi.dsi.fastutil.ints.IntSet; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.Mob; - -diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java -index 026cd57df33476841ed3a8f9fdc4d17a77e037b0..9ed118034e738f662a507553869526328b2a0795 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java -+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java -@@ -31,8 +31,8 @@ import net.minecraft.tags.GameEventTags; - import net.minecraft.tags.ItemTags; - import net.minecraft.tags.TagKey; - import net.minecraft.util.Mth; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; - import net.minecraft.world.SimpleContainer; -diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java -index 84516dcfc6cd0fe16c26538ccb86fb5c85b44ffa..b4ec352826aef4fa1e9d912eb26b3f2470d811e8 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java -+++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java -@@ -23,8 +23,8 @@ import net.minecraft.util.ByIdMap; - import net.minecraft.util.RandomSource; - import net.minecraft.util.StringRepresentable; - import net.minecraft.util.TimeUtil; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; - import net.minecraft.world.damagesource.DamageSource; -diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index c80d74caa393a31e09f2776cdb3cb950ef99e2ef..8a20f056bde735ac896282918c2bed036178fbc7 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -+++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -@@ -26,8 +26,8 @@ import net.minecraft.util.ByIdMap; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; - import net.minecraft.util.StringRepresentable; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; -diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -index 39cdecc382a71ef643d382ac506249bbb8df3d34..a8c68b4e17456221d601696571135a281eb1555e 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -@@ -17,8 +17,8 @@ import net.minecraft.sounds.SoundSource; - import net.minecraft.tags.BlockTags; - import net.minecraft.tags.ItemTags; - import net.minecraft.util.Mth; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; -diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -index 94ca735513901a180d42ac1cfd48d841142a6ef5..542cd59bb0eecac3845c3eefdd20e9105b1448c0 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -@@ -28,8 +28,8 @@ import net.minecraft.tags.ItemTags; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; - import net.minecraft.util.Unit; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.entity.AgeableMob; -diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java -index cc5c172b2fccc5fc59337203ed2b6edb2abc0c22..7b9e7d3595bd6add8f76c4d9bf9758c78ecce962 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java -+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java -@@ -12,8 +12,8 @@ import net.minecraft.server.level.ServerLevel; - import net.minecraft.sounds.SoundEvent; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.tags.ItemTags; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; - import net.minecraft.world.damagesource.DamageSource; -diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -index ebf53d48b09918c7453f982a5e4f9a1584dfc544..c1f79d16fd2fc1b5642d9be68df81465c4b2eb2b 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -@@ -20,8 +20,8 @@ import net.minecraft.tags.ItemTags; - import net.minecraft.tags.TagKey; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; -diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -index f853730cee4fad2f3a5711e38918c65dcb1dc038..cd1845f6d7552670ae29c7a5b087220f3b4fc0e9 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -@@ -30,8 +30,8 @@ import net.minecraft.tags.BlockTags; - import net.minecraft.tags.ItemTags; - import net.minecraft.util.ByIdMap; - import net.minecraft.util.Mth; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; - import net.minecraft.world.damagesource.DamageSource; -diff --git a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java -index f30ad422f19757664228f2064465fbcb22bb54f6..0cff4d4ee945ab5b6362648bf932af796d16a601 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java -@@ -15,8 +15,8 @@ import net.minecraft.network.syncher.SynchedEntityData; - import net.minecraft.server.level.ServerLevel; - import net.minecraft.sounds.SoundEvent; - import net.minecraft.sounds.SoundEvents; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.util.valueproviders.UniformInt; - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.damagesource.DamageSource; -diff --git a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java -index 0bc771e20a9bab139cd3fc03ff40baabf787b2f7..e60c2dbc2188ea32459b536b0e3f3fea36f70776 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java -+++ b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java -@@ -12,8 +12,8 @@ import net.minecraft.sounds.SoundEvent; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; - import net.minecraft.tags.EntityTypeTags; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.entity.AnimationState; - import net.minecraft.world.entity.Entity; -diff --git a/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java b/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java -index 7b5f9284972b3a6bd8125891b23f73438e875c08..6a17c30afc7863dfa55f1e07ea29b1fb0166adc7 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java -+++ b/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java -@@ -13,8 +13,8 @@ import net.minecraft.network.syncher.SynchedEntityData; - import net.minecraft.server.level.ServerLevel; - import net.minecraft.sounds.SoundEvent; - import net.minecraft.sounds.SoundEvents; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.entity.AnimationState; - import net.minecraft.world.entity.Entity; -@@ -121,10 +121,10 @@ public class Creaking extends Monster { - - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("creakingBrain"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang's Profiler -+ //profilerFiller.push("creakingBrain"); // Plazma - Completely remove Mojang's Profiler - this.getBrain().tick((ServerLevel)this.level(), this); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Plazma - Completely remove Mojang's Profiler - CreakingAi.updateActivity(this); - } - -diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 7afde99f81ec222ecbffbdcdad3aa6404e8221e0..8b91472441a17572d8bb47e42402c585b26aeeb6 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -16,8 +16,8 @@ import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; - import net.minecraft.tags.ItemTags; - import net.minecraft.util.RandomSource; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; -diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java -index b53e4a312ea0dbbd16e948e61c3f6b836d46f3b8..8e7c737263f55fdd4a2adbab4a9d208674a55639 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java -+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java -@@ -6,8 +6,8 @@ import java.util.List; - import javax.annotation.Nullable; - import net.minecraft.util.RandomSource; - import net.minecraft.util.VisibleForDebug; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; -diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java -index 719179fb232a4f39a2c1642cc0e9593f4dea4bb8..f5c5abbb919455709636d4037b8daa63a2c212e2 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java -+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java -@@ -8,8 +8,8 @@ import net.minecraft.server.level.ServerLevel; - import net.minecraft.sounds.SoundEvent; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.util.RandomSource; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.entity.EntitySpawnReason; -diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -index 9f542e4f0077a6abc89fdec1a4bf3e8f40203b2a..5350c7a6085edc4f8529f443091d52cb70c62efd 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -@@ -32,8 +32,8 @@ import net.minecraft.tags.TagKey; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; - import net.minecraft.util.Unit; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.effect.MobEffectInstance; -@@ -318,7 +318,7 @@ public class Warden extends Monster implements VibrationSystem { - - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang's Profiler - - //gameprofilerfiller.push("wardenBrain"); // Purpur - this.getBrain().tick(world, this); -diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index b4ffad429ace965f16ebf47119c880b709b27f2e..50bed3677f7e38d19ceda0dff0c499957312b2ad 100644 ---- a/src/main/java/net/minecraft/world/entity/npc/Villager.java -+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -38,8 +38,8 @@ import net.minecraft.stats.Stats; - import net.minecraft.tags.ItemTags; - import net.minecraft.util.Mth; - import net.minecraft.util.SpawnUtil; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.Difficulty; - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; -diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -index f6dd363ececf967d282f5ba713013085da1ddf37..fe53785fe4f7a16b90a9d862aac588ca23b61ef0 100644 ---- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -@@ -41,7 +41,7 @@ import net.minecraft.server.level.ServerLevel; - import net.minecraft.server.packs.resources.ResourceManager; - import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener; - import net.minecraft.server.packs.resources.SimplePreparableReloadListener; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - - public class RecipeManager extends SimplePreparableReloadListener implements RecipeAccess { - -@@ -94,7 +94,7 @@ public class RecipeManager extends SimplePreparableReloadListener imp - } - - @Override -- protected RecipeMap prepare(ResourceManager manager, ProfilerFiller profiler) { -+ protected RecipeMap prepare(ResourceManager manager) { // Plazma - Completely remove Mojang's Profiler - SortedMap> sortedmap = new TreeMap(); - - SimpleJsonResourceReloadListener.scanDirectory(manager, Registries.elementsDirPath(Registries.RECIPE), this.registries.createSerializationContext(JsonOps.INSTANCE), Recipe.CODEC, sortedmap); -@@ -109,7 +109,7 @@ public class RecipeManager extends SimplePreparableReloadListener imp - return RecipeMap.create(list); - } - -- protected void apply(RecipeMap prepared, ResourceManager manager, ProfilerFiller profiler) { -+ protected void apply(RecipeMap prepared, ResourceManager manager) { // Plazma - Completely remove Mojang's Profiler - this.recipes = prepared; - RecipeManager.LOGGER.info("Loaded {} recipes", prepared.values().size()); - } -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index ad15fc9f329f5ea7fa0d0d88c937b2f36e0f2f3d..d03a89d264cafb752e6a2f07558c119a0ee23253 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -35,8 +35,8 @@ import net.minecraft.util.AbortableIterationConsumer; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; - import net.minecraft.util.StringRepresentable; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.TickRateManager; - import net.minecraft.world.damagesource.DamageSource; -diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 7f936a7ba994ccb51c17168c798b42dde0877a5d..49e255a7825d6c38e3851c121ecc4e6a6e0402f8 100644 ---- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java -+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -@@ -24,8 +24,8 @@ import net.minecraft.tags.BlockTags; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; - import net.minecraft.util.VisibleForDebug; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.util.random.WeightedRandomList; - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.EntitySpawnReason; -@@ -163,9 +163,9 @@ public final class NaturalSpawner { - } - - public static void spawnForChunk(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, List spawnableGroups) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang's Profiler - -- gameprofilerfiller.push("spawner"); -+ //gameprofilerfiller.push("spawner"); // Plazma - Completely remove Mojang's Profiler - Iterator iterator = spawnableGroups.iterator(); - - while (iterator.hasNext()) { -diff --git a/src/main/java/net/minecraft/world/level/ServerExplosion.java b/src/main/java/net/minecraft/world/level/ServerExplosion.java -index 3c3d219c9339f64c23ec0b31783bf68a4423636c..ce3eb065081cfd7bc96ac95595f80bf5eb8bb263 100644 ---- a/src/main/java/net/minecraft/world/level/ServerExplosion.java -+++ b/src/main/java/net/minecraft/world/level/ServerExplosion.java -@@ -15,8 +15,8 @@ import net.minecraft.core.BlockPos; - import net.minecraft.core.Holder; - import net.minecraft.server.level.ServerLevel; - import net.minecraft.util.Mth; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.EntityType; -@@ -700,11 +700,11 @@ public class ServerExplosion implements Explosion { - - this.hurtEntities(); - if (this.interactsWithBlocks()) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang's Profiler - -- gameprofilerfiller.push("explosion_blocks"); -+ //gameprofilerfiller.push("explosion_blocks"); // Plazma - Completely remove Mojang's Profiler - this.interactWithBlocks(list); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang's Profiler - } - - if (this.fire) { -diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 15c83c6f5f56d6a27911d3bbd326cef1c21b1e58..6656cc0c9041d954d6d318cdefaef86ebee4c2bc 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -25,8 +25,8 @@ import net.minecraft.network.FriendlyByteBuf; - import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; - import net.minecraft.server.level.FullChunkStatus; - import net.minecraft.server.level.ServerLevel; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.entity.Entity; - import net.minecraft.world.level.ChunkPos; - import net.minecraft.world.level.Level; -@@ -405,7 +405,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - } - - if (LightEngine.hasDifferentLightProperties(iblockdata1, iblockdata)) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get();// Plazma - Completely remove Mojang's Profiler - - //gameprofilerfiller.push("updateSkyLightSources"); // Purpur - // Paper - rewrite chunk system -diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -index 91abbda59446d462979dddc4b380c6f24d0b4c92..f1aa182d7cc0ffac23ddb1f77335c61ca9f6f720 100644 ---- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -@@ -12,9 +12,9 @@ import java.util.function.Function; - import java.util.stream.Collectors; - import javax.annotation.Nullable; - import net.minecraft.core.BlockPos; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; --import net.minecraft.util.profiling.metrics.MetricCategory; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.metrics.MetricCategory; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.entity.Mob; - import net.minecraft.world.level.PathNavigationRegion; - -diff --git a/src/main/java/net/minecraft/world/ticks/LevelTicks.java b/src/main/java/net/minecraft/world/ticks/LevelTicks.java -index 452fb3442221fd66debfe1e1d6e85ee17951e556..eceb6110cd61c113d762e5c069108077421d03be 100644 ---- a/src/main/java/net/minecraft/world/ticks/LevelTicks.java -+++ b/src/main/java/net/minecraft/world/ticks/LevelTicks.java -@@ -23,8 +23,8 @@ import net.minecraft.Util; - import net.minecraft.core.BlockPos; - import net.minecraft.core.SectionPos; - import net.minecraft.core.Vec3i; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang's Profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang's Profiler - import net.minecraft.world.level.ChunkPos; - import net.minecraft.world.level.levelgen.structure.BoundingBox; - -@@ -81,7 +81,7 @@ public class LevelTicks implements LevelTickAccess { - public void tick(long time, int maxTicks, BiConsumer ticker) { - //ProfilerFiller profilerFiller = Profiler.get(); // Purpur - //profilerFiller.push("collect"); // Purpur -- this.collectTicks(time, maxTicks, null); // Purpur -+ this.collectTicks(time, maxTicks); // Purpur // Plazma - Completely remove Mojang's Profiler - //profilerFiller.popPush("run"); // Purpur - //profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size()); // Purpur - this.runCollectedTicks(ticker); -@@ -90,7 +90,7 @@ public class LevelTicks implements LevelTickAccess { - //profilerFiller.pop(); // Purpur - } - -- private void collectTicks(long time, int maxTicks, ProfilerFiller profiler) { -+ private void collectTicks(long time, int maxTicks) { // Plazma - Completely remove Mojang's Profiler - this.sortContainersToTick(time); - //profiler.incrementCounter("containersToTick", this.containersToTick.size()); // Purpur - this.drainContainers(time, maxTicks); diff --git a/patches/server/0039-Completely-remove-timings-implementation.patch b/patches/server/0041-Completely-remove-timings-implementation.patch similarity index 97% rename from patches/server/0039-Completely-remove-timings-implementation.patch rename to patches/server/0041-Completely-remove-timings-implementation.patch index d8d8ea6..987f1ee 100644 --- a/patches/server/0039-Completely-remove-timings-implementation.patch +++ b/patches/server/0041-Completely-remove-timings-implementation.patch @@ -48,7 +48,7 @@ index 097500a59336db1bbfffcd1aa4cff7a8586e46ec..844e340c331c6dd12eaaac247f871b04 @Override diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 5cd9b92bccf8446df2a9341a006e2e6bbcba7257..2ccf6415ec36a998904df6d5c4cae435b3e948e7 100644 +index 54ef910938efb537a689dd5dbda119455bbf2a0e..6e9766aff9a9f2b578f5b8a6b42e206fb7ad1bc6 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -3,7 +3,7 @@ package net.minecraft.server; diff --git a/patches/server/0042-Remove-persist-isClientSide-flag.patch b/patches/server/0042-Remove-persist-isClientSide-flag.patch index b7bda64..8c16eb6 100644 --- a/patches/server/0042-Remove-persist-isClientSide-flag.patch +++ b/patches/server/0042-Remove-persist-isClientSide-flag.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remove persist 'isClientSide' flag diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/BlockStarLightEngine.java b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/BlockStarLightEngine.java -index fa7b784a89626e8528c249d7889a598bd7ee3d49..f9eda740f1a3ffe1b0aaa52b79b7b890326691bf 100644 +index fa7b784a89626e8528c249d7889a598bd7ee3d49..bfb4d26549ce1d7e89a175dd9f2bf6b40adee5ef 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/BlockStarLightEngine.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/BlockStarLightEngine.java @@ -46,7 +46,7 @@ public final class BlockStarLightEngine extends StarLightEngine { @@ -13,12 +13,12 @@ index fa7b784a89626e8528c249d7889a598bd7ee3d49..f9eda740f1a3ffe1b0aaa52b79b7b890 @Override protected boolean canUseChunk(final ChunkAccess chunk) { - return chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT) && (this.isClientSide || chunk.isLightCorrect()); -+ return chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT) && (/*this.isClientSide ||*/ chunk.isLightCorrect()); // Plazma - Remove persist flag ++ return chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT) && (/*this.isClientSide ||*/ chunk.isLightCorrect()); // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/SkyStarLightEngine.java b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/SkyStarLightEngine.java -index f9aef289e9a2d6f63c98c72c56ef32b8793f57f4..7317853a208ff6ca8d686f8312629a053523770b 100644 +index f9aef289e9a2d6f63c98c72c56ef32b8793f57f4..7bd27bceb90b1f612a393dc55ecd455f00498fdb 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/SkyStarLightEngine.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/SkyStarLightEngine.java @@ -229,7 +229,7 @@ public final class SkyStarLightEngine extends StarLightEngine { @@ -26,12 +26,12 @@ index f9aef289e9a2d6f63c98c72c56ef32b8793f57f4..7317853a208ff6ca8d686f8312629a05 protected boolean canUseChunk(final ChunkAccess chunk) { // can only use chunks for sky stuff if their sections have been init'd - return chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT) && (this.isClientSide || chunk.isLightCorrect()); -+ return chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT) && (/*this.isClientSide ||*/ chunk.isLightCorrect()); // Plazma - Remove persist flag ++ return chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT) && (/*this.isClientSide ||*/ chunk.isLightCorrect()); // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightEngine.java b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightEngine.java -index 8aeb5fb87f94a35659347a09a638420699b52a6f..95218c6dc9ade3c0347f26564c9f319f0e88c102 100644 +index 8aeb5fb87f94a35659347a09a638420699b52a6f..ef40af5c6ac60fe00c05adcb664c811b28330819 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightEngine.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightEngine.java @@ -124,7 +124,7 @@ public abstract class StarLightEngine { @@ -39,7 +39,7 @@ index 8aeb5fb87f94a35659347a09a638420699b52a6f..95218c6dc9ade3c0347f26564c9f319f protected final boolean skylightPropagator; protected final int emittedLightMask; - protected final boolean isClientSide; -+ // protected final boolean isClientSide; // Plazma - Remove persist flag ++ // protected final boolean isClientSide; // Plazma - Remove persist 'isClientSide' flag protected final Level world; protected final int minLightSection; @@ -48,7 +48,7 @@ index 8aeb5fb87f94a35659347a09a638420699b52a6f..95218c6dc9ade3c0347f26564c9f319f this.skylightPropagator = skylightPropagator; this.emittedLightMask = skylightPropagator ? 0 : 0xF; - this.isClientSide = world.isClientSide; -+ // this.isClientSide = world.isClientSide; // Plazma - Remove persist flag ++ // this.isClientSide = world.isClientSide; // Plazma - Remove persist 'isClientSide' flag this.world = world; this.minLightSection = WorldUtil.getMinLightSection(world); this.maxLightSection = WorldUtil.getMaxLightSection(world); @@ -56,11 +56,11 @@ index 8aeb5fb87f94a35659347a09a638420699b52a6f..95218c6dc9ade3c0347f26564c9f319f Arrays.fill(this.nibbleCache, null); Arrays.fill(this.chunkCache, null); Arrays.fill(this.emptinessMapCache, null); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.isClientSide) { Arrays.fill(this.notifyUpdateCache, false); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } protected final BlockState getBlockState(final int worldX, final int worldY, final int worldZ) { @@ -68,7 +68,7 @@ index 8aeb5fb87f94a35659347a09a638420699b52a6f..95218c6dc9ade3c0347f26564c9f319f if (nibble != null) { nibble.set((worldX & 15) | ((worldZ & 15) << 4) | ((worldY & 15) << 8), level); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.isClientSide) { int cx1 = (worldX - 1) >> 4; int cx2 = (worldX + 1) >> 4; @@ -76,11 +76,11 @@ index 8aeb5fb87f94a35659347a09a638420699b52a6f..95218c6dc9ade3c0347f26564c9f319f } } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } } -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag protected final void postLightUpdate(final int worldX, final int worldY, final int worldZ) { if (this.isClientSide) { int cx1 = (worldX - 1) >> 4; @@ -88,14 +88,14 @@ index 8aeb5fb87f94a35659347a09a638420699b52a6f..95218c6dc9ade3c0347f26564c9f319f } } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag protected final void setLightLevel(final int sectionIndex, final int localIndex, final int worldX, final int worldY, final int worldZ, final int level) { final SWMRNibbleArray nibble = this.nibbleCache[sectionIndex]; if (nibble != null) { nibble.set(localIndex, level); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.isClientSide) { int cx1 = (worldX - 1) >> 4; int cx2 = (worldX + 1) >> 4; @@ -103,7 +103,7 @@ index 8aeb5fb87f94a35659347a09a638420699b52a6f..95218c6dc9ade3c0347f26564c9f319f } } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } } @@ -112,7 +112,7 @@ index 8aeb5fb87f94a35659347a09a638420699b52a6f..95218c6dc9ade3c0347f26564c9f319f currentNibble.set(localIndex, targetLevel); - this.postLightUpdate(offX, offY, offZ); -+ //this.postLightUpdate(offX, offY, offZ); // Plazma - Remove persist flag ++ //this.postLightUpdate(offX, offY, offZ); // Plazma - Remove persist 'isClientSide' flag if (targetLevel > 1) { if (queueLength >= queue.length) { @@ -121,7 +121,7 @@ index 8aeb5fb87f94a35659347a09a638420699b52a6f..95218c6dc9ade3c0347f26564c9f319f currentNibble.set(localIndex, targetLevel); - this.postLightUpdate(offX, offY, offZ); -+ //this.postLightUpdate(offX, offY, offZ); // Plazma - Remove persist flag ++ //this.postLightUpdate(offX, offY, offZ); // Plazma - Remove persist 'isClientSide' flag if (targetLevel > 1) { if (queueLength >= queue.length) { @@ -130,7 +130,7 @@ index 8aeb5fb87f94a35659347a09a638420699b52a6f..95218c6dc9ade3c0347f26564c9f319f currentNibble.set(localIndex, 0); - this.postLightUpdate(offX, offY, offZ); -+ //this.postLightUpdate(offX, offY, offZ); // Plazma - Remove persist flag ++ //this.postLightUpdate(offX, offY, offZ); // Plazma - Remove persist 'isClientSide' flag if (targetLevel > 0) { if (queueLength >= queue.length) { @@ -139,12 +139,12 @@ index 8aeb5fb87f94a35659347a09a638420699b52a6f..95218c6dc9ade3c0347f26564c9f319f currentNibble.set(localIndex, 0); - this.postLightUpdate(offX, offY, offZ); -+ //this.postLightUpdate(offX, offY, offZ); // Plazma - Remove persist flag ++ //this.postLightUpdate(offX, offY, offZ); // Plazma - Remove persist 'isClientSide' flag if (targetLevel > 0) { // we actually need to propagate 0 just in case we find a neighbour... if (queueLength >= queue.length) { diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java -index 571db5f9bf94745a8afe2cd313e593fb15db5e37..6dae15cb4e3f935591750f3ebbc58c8bde05c7ea 100644 +index 571db5f9bf94745a8afe2cd313e593fb15db5e37..43e42d265513feedc54f3780f37427a50d8f7df7 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java @@ -57,7 +57,7 @@ public final class StarLightInterface { @@ -152,7 +152,7 @@ index 571db5f9bf94745a8afe2cd313e593fb15db5e37..6dae15cb4e3f935591750f3ebbc58c8b private final LayerLightEventListener skyReader; private final LayerLightEventListener blockReader; - private final boolean isClientSide; -+ //private final boolean isClientSide; // Plazma - Remove persist flag ++ //private final boolean isClientSide; // Plazma - Remove persist 'isClientSide' flag public final int minSection; public final int maxSection; @@ -161,7 +161,7 @@ index 571db5f9bf94745a8afe2cd313e593fb15db5e37..6dae15cb4e3f935591750f3ebbc58c8b this.cachedSkyPropagators = hasSkyLight && lightAccess != null ? new ArrayDeque<>() : null; this.cachedBlockPropagators = hasBlockLight && lightAccess != null ? new ArrayDeque<>() : null; - this.isClientSide = !(this.world instanceof ServerLevel); -+ //this.isClientSide = !(this.world instanceof ServerLevel); // Plazma - Remove persist flag ++ //this.isClientSide = !(this.world instanceof ServerLevel); // Plazma - Remove persist 'isClientSide' flag if (this.world == null) { this.minSection = -4; this.maxSection = 19; @@ -170,7 +170,7 @@ index 571db5f9bf94745a8afe2cd313e593fb15db5e37..6dae15cb4e3f935591750f3ebbc58c8b public DataLayer getDataLayerData(final SectionPos pos) { final ChunkAccess chunk = StarLightInterface.this.getAnyChunkNow(pos.getX(), pos.getZ()); - if (chunk == null || (!StarLightInterface.this.isClientSide && !chunk.isLightCorrect()) || !chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT)) { -+ if (chunk == null || (/*!StarLightInterface.this.isClientSide &&*/ !chunk.isLightCorrect()) || !chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT)) { // Plazma - Remove persist flag ++ if (chunk == null || (/*!StarLightInterface.this.isClientSide &&*/ !chunk.isLightCorrect()) || !chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT)) { // Plazma - Remove persist 'isClientSide' flag return null; } @@ -179,7 +179,7 @@ index 571db5f9bf94745a8afe2cd313e593fb15db5e37..6dae15cb4e3f935591750f3ebbc58c8b final int maxLightSection = this.maxLightSection; - if (chunk == null || (!this.isClientSide && !chunk.isLightCorrect()) || !chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT)) { -+ if (chunk == null || (/*!this.isClientSide &&*/ !chunk.isLightCorrect()) || !chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT)) { // Plazma - Remove persist flag ++ if (chunk == null || (/*!this.isClientSide &&*/ !chunk.isLightCorrect()) || !chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT)) { // Plazma - Remove persist 'isClientSide' flag return 15; } @@ -187,16 +187,16 @@ index 571db5f9bf94745a8afe2cd313e593fb15db5e37..6dae15cb4e3f935591750f3ebbc58c8b return this.blockReader; } -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag public boolean isClientSide() { return this.isClientSide; } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag public ChunkAccess getAnyChunkNow(final int chunkX, final int chunkZ) { if (this.world == null) { diff --git a/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java b/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java -index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf1b9c3510 100644 +index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..2495456fae536d83afd8023f531aeb65ec10bf82 100644 --- a/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java +++ b/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java @@ -72,7 +72,7 @@ public interface CauldronInteraction { @@ -204,7 +204,7 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf if (potioncontents != null && potioncontents.is(Potions.WATER)) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent return InteractionResult.SUCCESS; @@ -213,7 +213,7 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf world.playSound((Player) null, blockposition, SoundEvents.BOTTLE_EMPTY, SoundSource.BLOCKS, 1.0F, 1.0F); world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PLACE, blockposition); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { @@ -222,7 +222,7 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf }); map1.put(Items.GLASS_BOTTLE, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_FILL)) { return InteractionResult.SUCCESS; @@ -231,7 +231,7 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf world.playSound((Player) null, blockposition, SoundEvents.BOTTLE_FILL, SoundSource.BLOCKS, 1.0F, 1.0F); world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PICKUP, blockposition); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; }); @@ -240,7 +240,7 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf if (potioncontents != null && potioncontents.is(Potions.WATER)) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent return InteractionResult.SUCCESS; @@ -249,7 +249,7 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf world.playSound((Player) null, blockposition, SoundEvents.BOTTLE_EMPTY, SoundSource.BLOCKS, 1.0F, 1.0F); world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PLACE, blockposition); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { @@ -258,7 +258,7 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf return InteractionResult.TRY_WITH_EMPTY_HAND; } else { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // Paper start - fire PlayerBucketFillEvent if (hitDirection != null) { org.bukkit.event.player.PlayerBucketEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerBucketFillEvent((net.minecraft.server.level.ServerLevel) world, player, pos, pos, hitDirection, stack, output.getItem(), hand); @@ -267,7 +267,7 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf world.playSound((Player) null, pos, soundEvent, SoundSource.BLOCKS, 1.0F, 1.0F); world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PICKUP, pos); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } @@ -276,7 +276,7 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf static InteractionResult emptyBucket(Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, BlockState state, SoundEvent soundEvent, @javax.annotation.Nullable net.minecraft.core.Direction hitDirection) { // Paper end - add hitDirection - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // Paper start - fire PlayerBucketEmptyEvent ItemStack output = new ItemStack(Items.BUCKET); if (hitDirection != null) { @@ -285,7 +285,7 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf world.playSound((Player) null, pos, soundEvent, SoundSource.BLOCKS, 1.0F, 1.0F); world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PLACE, pos); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } @@ -294,7 +294,7 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf return InteractionResult.TRY_WITH_EMPTY_HAND; } else { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (!LayeredCauldronBlock.lowerFillLevel(state, world, pos, player, CauldronLevelChangeEvent.ChangeReason.SHULKER_WASH)) { return InteractionResult.SUCCESS; @@ -303,7 +303,7 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf player.awardStat(Stats.CLEAN_SHULKER_BOX); // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } } @@ -312,7 +312,7 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf return InteractionResult.TRY_WITH_EMPTY_HAND; } else { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (!LayeredCauldronBlock.lowerFillLevel(state, world, pos, player, CauldronLevelChangeEvent.ChangeReason.BANNER_WASH)) { return InteractionResult.SUCCESS; @@ -321,7 +321,7 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf player.awardStat(Stats.CLEAN_BANNER); // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } @@ -330,7 +330,7 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf return InteractionResult.TRY_WITH_EMPTY_HAND; } else { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (!LayeredCauldronBlock.lowerFillLevel(state, world, pos, player, CauldronLevelChangeEvent.ChangeReason.ARMOR_WASH)) { return InteractionResult.SUCCESS; @@ -339,12 +339,12 @@ index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..720007c38a0fbdf91aebe041b1a352bf player.awardStat(Stats.CLEAN_ARMOR); // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -index c6490554a3025f4de3f3218178fad76cd1848a19..bc224ace5714b59c79b7b9f56ce129053f7bb71b 100644 +index c6490554a3025f4de3f3218178fad76cd1848a19..e65245ab6c6c6f3fcb425f963f12cade3618e8e9 100644 --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java @@ -542,7 +542,7 @@ public interface DispenseItemBehavior { @@ -352,7 +352,7 @@ index c6490554a3025f4de3f3218178fad76cd1848a19..bc224ace5714b59c79b7b9f56ce12905 if (!BoneMealItem.growCrop(stack, worldserver, blockposition) && !BoneMealItem.growWaterPlant(stack, worldserver, blockposition, (Direction) null)) { this.setSuccess(false); - } else if (!worldserver.isClientSide) { -+ } else /*if (!worldserver.isClientSide)*/ { // Plazma - Remove persist flag ++ } else /*if (!worldserver.isClientSide)*/ { // Plazma - Remove persist 'isClientSide' flag worldserver.levelEvent(1505, blockposition, 15); } // CraftBukkit start @@ -361,11 +361,11 @@ index c6490554a3025f4de3f3218178fad76cd1848a19..bc224ace5714b59c79b7b9f56ce12905 if (worldserver.isEmptyBlock(blockposition) && blockpumpkincarved.canSpawnGolem(worldserver, blockposition)) { - if (!worldserver.isClientSide) { -+ //if (!worldserver.isClientSide) { // Plazma - Remove persist flag ++ //if (!worldserver.isClientSide) { // Plazma - Remove persist 'isClientSide' flag worldserver.setBlock(blockposition, blockpumpkincarved.defaultBlockState(), 3); worldserver.gameEvent((Entity) null, (Holder) GameEvent.BLOCK_PLACE, blockposition); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag stack.shrink(1); this.setSuccess(true); @@ -374,17 +374,17 @@ index c6490554a3025f4de3f3218178fad76cd1848a19..bc224ace5714b59c79b7b9f56ce12905 } // Paper end - Call missing BlockDispenseEvent - if (!worldserver.isClientSide) { -+ //if (!worldserver.isClientSide) { // Plazma - Remove persist flag ++ //if (!worldserver.isClientSide) { // Plazma - Remove persist 'isClientSide' flag for (int k = 0; k < 5; ++k) { worldserver.sendParticles(ParticleTypes.SPLASH, (double) blockposition.getX() + worldserver.random.nextDouble(), (double) (blockposition.getY() + 1), (double) blockposition.getZ() + worldserver.random.nextDouble(), 1, 0.0D, 0.0D, 0.0D, 1.0D); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag worldserver.playSound((Player) null, blockposition, SoundEvents.BOTTLE_EMPTY, SoundSource.BLOCKS, 1.0F, 1.0F); worldserver.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PLACE, blockposition); diff --git a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java -index 65ed3d77a51b8299517e0c165403b0c5ac413475..0fde0acaba3a9b1450356cee1a0bc487cf5f6942 100644 +index 65ed3d77a51b8299517e0c165403b0c5ac413475..5c7dbb218b6a9a7ccb2c9dbab93a7d8be26ee3e6 100644 --- a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java @@ -60,7 +60,7 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior { @@ -392,7 +392,7 @@ index 65ed3d77a51b8299517e0c165403b0c5ac413475..0fde0acaba3a9b1450356cee1a0bc487 // CraftBukkit end - if (!worldserver.isClientSide()) { -+ //if (!worldserver.isClientSide()) { // Plazma - Remove persist flag ++ //if (!worldserver.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING)); this.setSuccess(ShearsDispenseItemBehavior.tryShearBeehive(worldserver, blockposition) || ShearsDispenseItemBehavior.tryShearLivingEntity(worldserver, blockposition, stack, bukkitBlock, craftItem)); // CraftBukkit @@ -401,12 +401,218 @@ index 65ed3d77a51b8299517e0c165403b0c5ac413475..0fde0acaba3a9b1450356cee1a0bc487 }); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return stack; } +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 6e9766aff9a9f2b578f5b8a6b42e206fb7ad1bc6..ad0e9c8f64e9ef925b3f12ac1570689c9450e21b 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -270,8 +270,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason), true); + i++; +- } ++ //} // Plazma - Remove persist 'isClientSide' flag + } + + if (i == 0) { +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +index 45fa867a22481bbba86e587767cfdb96d9691c49..5a9e2d55649679af44339afc8a1f84859ca73082 100644 +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +@@ -197,13 +197,13 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + DedicatedServer.LOGGER.info("Loading properties"); + DedicatedServerProperties dedicatedserverproperties = this.settings.getProperties(); + +- if (this.isSingleplayer()) { ++ /*if (this.isSingleplayer()) { // Plazma - Remove persist 'isClientSide' flag + this.setLocalIp("127.0.0.1"); +- } else { ++ } else {*/ // Plazma - Remove persist 'isClientSide' flag + this.setUsesAuthentication(dedicatedserverproperties.onlineMode); + this.setPreventProxyConnections(dedicatedserverproperties.preventProxyConnections); + this.setLocalIp(dedicatedserverproperties.serverIp); +- } ++ //} // Plazma - Remove persist 'isClientSide' flag + // Spigot start + this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage)); + org.spigotmc.SpigotConfig.init((java.io.File) this.options.valueOf("spigot-settings")); +@@ -839,10 +839,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + SkullBlockEntity.clear(); + } + ++ /* // Plazma - Remove persist 'isClientSide' flag + @Override + public boolean isSingleplayerOwner(GameProfile profile) { + return false; + } ++ */ // Plazma - Remove persist 'isClientSide' flag + + @Override + public int getScaledTrackingDistance(int initialDistance) { +@@ -875,11 +877,13 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + return this.settings.getProperties().serverResourcePackInfo; + } + ++ /* // Plazma - Remove persist 'isClientSide' flag + @Override + public void endMetricsRecordingTick() { + super.endMetricsRecordingTick(); + this.debugSampleSubscriptionTracker.tick(this.getTickCount()); + } ++ */ // Plazma - Remove persist 'isClientSide' flag + + @Override + public SampleLogger getTickTimeLogger() { +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index a4421517b8136bb974e197eaa6dd0d83c2fdd0de..3a8b566aa44df367c6edacf371c0b7a2bd2548b6 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -679,9 +679,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + this.prepareWeather(); + this.getWorldBorder().setAbsoluteMaxSize(minecraftserver.getAbsoluteMaxWorldSize()); + this.raids = (Raids) this.getDataStorage().computeIfAbsent(Raids.factory(this), Raids.getFileId(this.dimensionTypeRegistration())); +- if (!minecraftserver.isSingleplayer()) { ++ //if (!minecraftserver.isSingleplayer()) { // Plazma - Completely remove Mojang profiler + iworlddataserver.setGameType(minecraftserver.getDefaultGameType()); +- } ++ //} // Plazma - Completely remove Mojang profiler + + long l = minecraftserver.getWorldData().worldGenOptions().seed(); + +@@ -1149,43 +1149,37 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + + private void announceSleepStatus() { +- if (this.canSleepThroughNights()) { +- if (!this.getServer().isSingleplayer() || this.getServer().isPublished()) { +- int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); +- Component ichatmutablecomponent; +- +- if (this.sleepStatus.areEnoughSleeping(i)) { +- // Purpur start +- if (org.purpurmc.purpur.PurpurConfig.sleepSkippingNight.isBlank()) { +- return; +- } +- if (!org.purpurmc.purpur.PurpurConfig.sleepSkippingNight.equalsIgnoreCase("default")) { +- ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepSkippingNight)); +- } else +- ichatmutablecomponent = Component.translatable("sleep.skipping_night"); +- } else { +- if (org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.isBlank()) { +- return; +- } +- if (!org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.equalsIgnoreCase("default")) { +- ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent, +- net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("count", Integer.toString(this.sleepStatus.amountSleeping())), +- net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("total", Integer.toString(this.sleepStatus.sleepersNeeded(i))))); +- } else +- // Purpur end +- ichatmutablecomponent = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(i)); +- } ++ // Plazma start - Remove persist 'isClientSide' flag ++ if (!this.canSleepThroughNights()) return; + +- Iterator iterator = this.players.iterator(); +- +- while (iterator.hasNext()) { +- ServerPlayer entityplayer = (ServerPlayer) iterator.next(); ++ int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); ++ Component ichatmutablecomponent; + +- entityplayer.displayClientMessage(ichatmutablecomponent, true); +- } ++ if (this.sleepStatus.areEnoughSleeping(i)) { ++ // Purpur start ++ if (org.purpurmc.purpur.PurpurConfig.sleepSkippingNight.isBlank()) return; + ++ if (!org.purpurmc.purpur.PurpurConfig.sleepSkippingNight.equalsIgnoreCase("default")) { ++ ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepSkippingNight)); ++ } else { ++ ichatmutablecomponent = Component.translatable("sleep.skipping_night"); + } ++ } else { ++ if (org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.isBlank()) return; ++ if (!org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.equalsIgnoreCase("default")) { ++ ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent, ++ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("count", Integer.toString(this.sleepStatus.amountSleeping())), ++ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("total", Integer.toString(this.sleepStatus.sleepersNeeded(i))))); ++ } else { ++ // Purpur end ++ ichatmutablecomponent = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(i)); ++ } ++ } ++ ++ for (final ServerPlayer player : this.players) { ++ player.displayClientMessage(ichatmutablecomponent, true); + } ++ // Plazma end - Remove persist 'isClientSide' flag + } + + public void updateSleepingPlayerList() { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 646123393dc7d28d2bc184343e3233961482fa2b..c8a14bfce7df57900e45f0f4ac63d2af26d6c0b0 100644 +index e6001fadc04b63b82e20652bbb16cb1db5cf44bd..94ab672f4576a77a609093eab76b1c5e2abddde2 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1014,7 +1014,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple @@ -414,29 +620,284 @@ index 646123393dc7d28d2bc184343e3233961482fa2b..c8a14bfce7df57900e45f0f4ac63d2af } // Paper end - Configurable container update tick rate - if (!this.level().isClientSide && this.containerMenu != this.inventoryMenu && (this.isImmobile() || !this.containerMenu.stillValid(this))) { // Paper - Prevent opening inventories when frozen -+ if (/*!this.level().isClientSide &&*/ this.containerMenu != this.inventoryMenu && (this.isImmobile() || !this.containerMenu.stillValid(this))) { // Paper - Prevent opening inventories when frozen // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.containerMenu != this.inventoryMenu && (this.isImmobile() || !this.containerMenu.stillValid(this))) { // Paper - Prevent opening inventories when frozen // Plazma - Remove persist 'isClientSide' flag this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper - Inventory close reason this.containerMenu = this.inventoryMenu; } diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -index a8484b9659f175cc20985bf66082616ceb31df4d..0490acfc93327a95999339ea6856bd748c13f1af 100644 +index a8484b9659f175cc20985bf66082616ceb31df4d..abd93a93e6c9367c022259d1ab3895e2764ac702 100644 --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java @@ -432,10 +432,12 @@ public class WorldGenRegion implements WorldGenLevel { return this.level.getWorldBorder(); } -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag @Override public boolean isClientSide() { return false; } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag /** @deprecated */ @Deprecated +diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +index 7d276c191b391bca24948ddb36b8b7d0f1f03b03..a71c220ea1c464c193029adb1a0d3e5c237442af 100644 +--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +@@ -122,12 +122,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + this.onDisconnect(info, null); + } + public void onDisconnect(DisconnectionDetails info, @Nullable net.kyori.adventure.text.Component quitMessage) { ++ /* // Plazma - Remove persist 'isClientSide' flag + // Paper end - Fix kick event leave message not being sent + if (this.isSingleplayerOwner()) { + ServerCommonPacketListenerImpl.LOGGER.info("Stopping singleplayer server as player logged out"); + this.server.halt(false); + } +- ++ */ // Plazma - Remove persist 'isClientSide' flag + } + + @Override +@@ -154,7 +155,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + + this.latency = (this.latency * 3 + i) / 4; + this.keepAlivePending = false; +- } else if (!this.isSingleplayerOwner()) { ++ } else /*if (!this.isSingleplayerOwner())*/ { // Plazma - Remove persist 'isClientSide' flag + this.disconnectAsync(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, PlayerKickEvent.Cause.TIMEOUT); // Paper - add proper async disconnect + } + +@@ -295,7 +296,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + } else + // Purpur end + +- if (!this.isSingleplayerOwner() && elapsedTime >= 15000L) { // Paper - use vanilla's 15000L between keep alive packets ++ if (/*!this.isSingleplayerOwner() &&*/ elapsedTime >= 15000L) { // Paper - use vanilla's 15000L between keep alive packets // Plazma - Remove persist 'isClientSide' flag + if (this.keepAlivePending && !this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected + this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause + } else if (this.checkIfClosed(currentTime)) { // Paper +@@ -466,9 +467,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + } + // Paper end - add proper async disconnect + ++ /* // Plazma - Remove persist 'isClientSide' flag + protected boolean isSingleplayerOwner() { + return this.server.isSingleplayerOwner(this.playerProfile()); + } ++ */ // Plazma - Remove persist 'isClientSide' flag + + protected abstract GameProfile playerProfile(); + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 91f161d27a45174b6f3c31440eea46ff81185203..ef7bc59e6b340c88a5379f9f4724b1c82bda4ef7 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -590,7 +590,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + } + // Paper end - Prevent moving into unloaded chunks + +- if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { ++ if (d10 - d9 > Math.max(100.0D, Math.pow(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed, 2)) /*&& !this.isSingleplayerOwner()*/) { // Plazma - Remove persist 'isClientSide' flag + // CraftBukkit end + ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8}); + this.send(new ClientboundMoveVehiclePacket(entity)); +@@ -825,7 +825,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) { + // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async + // CraftBukkit start +- if (!this.tabSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { // Paper - configurable tab spam limits ++ if (!this.tabSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) /*&& !this.server.isSingleplayerOwner(this.player.getGameProfile())*/) { // Paper - configurable tab spam limits // Plazma - Remove persist 'isClientSide' flag + this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause // Paper - add proper async disconnect + return; + } +@@ -1702,9 +1702,10 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + + private boolean shouldCheckPlayerMovement0(boolean elytra) { + // Plazma end - Add option to bypass moved to quickly check ++ /* // Plazma - Remove persist 'isClientSide' flag + if (this.isSingleplayerOwner()) { + return false; +- } else if (this.player.isChangingDimension()) { ++ } else*/ if (this.player.isChangingDimension()) { // Plazma - Remove persist 'isClientSide' flag + return false; + } else { + GameRules gamerules = this.player.serverLevel().getGameRules(); +@@ -2654,7 +2655,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + } + // Spigot end + // this.chatSpamThrottler.increment(); +- if (!this.chatSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { ++ if (!this.chatSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) /*&& !this.server.isSingleplayerOwner(this.player.getGameProfile())*/) { // Plazma - Remove persist 'isClientSide' flag + // CraftBukkit end + this.disconnectAsync((Component) Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause // Paper - add proper async disconnect + } +@@ -3682,15 +3683,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + @Override + public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) { + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); ++ /* // Plazma - Remove persist 'isClientSide' flag + if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) { + // this.server.setDifficulty(packet.getDifficulty(), false); // Paper - per level difficulty; don't allow clients to change this + } ++ */ // Plazma - Remove persist 'isClientSide' flag + } + + @Override + public void handleLockDifficulty(ServerboundLockDifficultyPacket packet) { + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); +- if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) { ++ if (this.player.hasPermissions(2) /*|| this.isSingleplayerOwner()*/) { // Plazma - Remove persist 'isClientSide' flag + this.server.setDifficultyLocked(packet.isLocked()); + } + } +diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +index bb10892f33ba0d7fc3959debef1045073868f8b8..ab6a7d20f5473d8bffa7f8d136c1d55f17bbfaff 100644 +--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +@@ -181,48 +181,39 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, + } + // Paper end - Validate usernames + this.requestedUsername = packet.name(); +- GameProfile gameprofile = this.server.getSingleplayerProfile(); +- +- if (gameprofile != null && this.requestedUsername.equalsIgnoreCase(gameprofile.getName())) { +- this.startClientVerification(gameprofile); ++ // Plazma start - Remove persist 'isClientSide' flag ++ if (this.server.usesAuthentication() && !this.connection.isMemoryConnection()) { ++ this.state = ServerLoginPacketListenerImpl.State.KEY; ++ this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge, true)); + } else { +- if (this.server.usesAuthentication() && !this.connection.isMemoryConnection()) { +- this.state = ServerLoginPacketListenerImpl.State.KEY; +- this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge, true)); +- } else { +- // Paper start - Add Velocity IP Forwarding Support +- if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { +- this.velocityLoginMessageId = java.util.concurrent.ThreadLocalRandom.current().nextInt(); +- net.minecraft.network.FriendlyByteBuf buf = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.buffer()); +- buf.writeByte(com.destroystokyo.paper.proxy.VelocityProxy.MAX_SUPPORTED_FORWARDING_VERSION); +- net.minecraft.network.protocol.login.ClientboundCustomQueryPacket packet1 = new net.minecraft.network.protocol.login.ClientboundCustomQueryPacket(this.velocityLoginMessageId, new net.minecraft.network.protocol.login.ClientboundCustomQueryPacket.PlayerInfoChannelPayload(com.destroystokyo.paper.proxy.VelocityProxy.PLAYER_INFO_CHANNEL, buf)); +- this.connection.send(packet1); +- return; +- } +- // Paper end - Add Velocity IP Forwarding Support +- // CraftBukkit start +- // Paper start - Cache authenticator threads +- authenticatorPool.execute(new Runnable() { +- +- @Override +- public void run() { +- try { +- GameProfile gameprofile = ServerLoginPacketListenerImpl.this.createOfflineProfile(ServerLoginPacketListenerImpl.this.requestedUsername); // Spigot +- +- gameprofile = ServerLoginPacketListenerImpl.this.callPlayerPreLoginEvents(gameprofile); // Paper - Add more fields to AsyncPlayerPreLoginEvent +- ServerLoginPacketListenerImpl.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId()); +- ServerLoginPacketListenerImpl.this.startClientVerification(gameprofile); +- } catch (Exception ex) { +- ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!"); +- ServerLoginPacketListenerImpl.this.server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + ServerLoginPacketListenerImpl.this.requestedUsername, ex); +- } +- } +- }); +- // Paper end - Cache authenticator threads +- // CraftBukkit end ++ // Paper start - Add Velocity IP Forwarding Support ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { ++ this.velocityLoginMessageId = java.util.concurrent.ThreadLocalRandom.current().nextInt(); ++ net.minecraft.network.FriendlyByteBuf buf = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.buffer()); ++ buf.writeByte(com.destroystokyo.paper.proxy.VelocityProxy.MAX_SUPPORTED_FORWARDING_VERSION); ++ net.minecraft.network.protocol.login.ClientboundCustomQueryPacket packet1 = new net.minecraft.network.protocol.login.ClientboundCustomQueryPacket(this.velocityLoginMessageId, new net.minecraft.network.protocol.login.ClientboundCustomQueryPacket.PlayerInfoChannelPayload(com.destroystokyo.paper.proxy.VelocityProxy.PLAYER_INFO_CHANNEL, buf)); ++ this.connection.send(packet1); ++ return; + } ++ // Paper end - Add Velocity IP Forwarding Support ++ // CraftBukkit start ++ // Paper start - Cache authenticator threads ++ authenticatorPool.execute(() -> { ++ try { ++ GameProfile gameprofile = ServerLoginPacketListenerImpl.this.createOfflineProfile(ServerLoginPacketListenerImpl.this.requestedUsername); // Spigot + ++ gameprofile = ServerLoginPacketListenerImpl.this.callPlayerPreLoginEvents(gameprofile); // Paper - Add more fields to AsyncPlayerPreLoginEvent ++ ServerLoginPacketListenerImpl.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId()); ++ ServerLoginPacketListenerImpl.this.startClientVerification(gameprofile); ++ } catch (Exception ex) { ++ ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!"); ++ ServerLoginPacketListenerImpl.this.server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + ServerLoginPacketListenerImpl.this.requestedUsername, ex); ++ } ++ }); ++ // Paper end - Cache authenticator threads ++ // CraftBukkit end + } ++ // Plazma end - Remove persist 'isClientSide' flag + } + + void startClientVerification(GameProfile profile) { +@@ -318,21 +309,21 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, + // CraftBukkit end + ServerLoginPacketListenerImpl.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId()); + ServerLoginPacketListenerImpl.this.startClientVerification(gameprofile); +- } else if (ServerLoginPacketListenerImpl.this.server.isSingleplayer()) { ++ } /*else if (ServerLoginPacketListenerImpl.this.server.isSingleplayer()) { // Plazma - Remove persist 'isClientSide' flag + ServerLoginPacketListenerImpl.LOGGER.warn("Failed to verify username but will let them in anyway!"); + ServerLoginPacketListenerImpl.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(s1)); // Spigot +- } else { ++ }*/ else { // Plazma - Remove persist 'isClientSide' flag + ServerLoginPacketListenerImpl.this.disconnect(org.purpurmc.purpur.PurpurConfig.unverifiedUsername.equals("default") ? Component.translatable("multiplayer.disconnect.unverified_username") : io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.unverifiedUsername))); // Purpur + ServerLoginPacketListenerImpl.LOGGER.error("Username '{}' tried to join with an invalid session", s1); + } + } catch (AuthenticationUnavailableException authenticationunavailableexception) { +- if (ServerLoginPacketListenerImpl.this.server.isSingleplayer()) { ++ /*if (ServerLoginPacketListenerImpl.this.server.isSingleplayer()) { // Plazma - Remove persist 'isClientSide' flag + ServerLoginPacketListenerImpl.LOGGER.warn("Authentication servers are down but will let them in anyway!"); + ServerLoginPacketListenerImpl.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(s1)); // Spigot +- } else { ++ } else {*/ // Plazma - Remove persist 'isClientSide' flag + ServerLoginPacketListenerImpl.this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.authenticationServersDown)); // Paper - Configurable kick message + ServerLoginPacketListenerImpl.LOGGER.error("Couldn't verify username because servers are unavailable"); +- } ++ //} // Plazma - Remove persist 'isClientSide' flag + // CraftBukkit start - catch all exceptions + } catch (Exception exception) { + ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!"); +diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java +index 653856d0b8dcf2baf4cc77a276f17c8cc1fa717e..1f2958d21c279ecb377b7c90ba643ea83e217eca 100644 +--- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java ++++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java +@@ -275,7 +275,7 @@ public class OldUsersConverter { + + if (optional.isPresent()) { + return (UUID) optional.get(); +- } else if (!server.isSingleplayer() && server.usesAuthentication()) { ++ } else if (/*!server.isSingleplayer() &&*/ server.usesAuthentication()) { // Plazma - Remove persist 'isClientSide' flag + final List list = Lists.newArrayList(); + ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback() { + public void onProfileLookupSucceeded(GameProfile gameprofile) { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 579f81ed04eeb6373b25e6794d3bf0c403891011..e0b70bac3018dc39e6c8e47171060332ec2f63f2 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -517,7 +517,7 @@ public abstract class PlayerList { + CompoundTag nbttagcompound = this.server.getWorldData().getLoadedPlayerTag(); + Optional optional; + +- if (this.server.isSingleplayerOwner(player.getGameProfile()) && nbttagcompound != null) { ++ if (/*this.server.isSingleplayerOwner(player.getGameProfile()) &&*/ nbttagcompound != null) { // Plazma - Remove persist 'isClientSide' flag + optional = Optional.of(nbttagcompound); + player.load(nbttagcompound); + PlayerList.LOGGER.debug("loading single player"); +@@ -1176,7 +1176,7 @@ public abstract class PlayerList { + } + + public boolean isOp(GameProfile profile) { +- return this.ops.contains(profile) || this.server.isSingleplayerOwner(profile) && this.server.getWorldData().isAllowCommands() || this.allowCommandsForAllPlayers; ++ return this.ops.contains(profile) || /*this.server.isSingleplayerOwner(profile) &&*/ this.server.getWorldData().isAllowCommands() || this.allowCommandsForAllPlayers; // Plazma - Remove persist 'isClientSide' flag + } + + @Nullable diff --git a/src/main/java/net/minecraft/world/entity/AgeableMob.java b/src/main/java/net/minecraft/world/entity/AgeableMob.java -index 119856b22df5bbcd4e5bf5f95645156f774c6168..1d2b5bf25ffd995c2a5867df154cffb3019144f0 100644 +index 119856b22df5bbcd4e5bf5f95645156f774c6168..809b72d0eb69f21d0d71515259e5e2f9d01d6232 100644 --- a/src/main/java/net/minecraft/world/entity/AgeableMob.java +++ b/src/main/java/net/minecraft/world/entity/AgeableMob.java @@ -32,7 +32,7 @@ public abstract class AgeableMob extends PathfinderMob { @@ -444,7 +905,7 @@ index 119856b22df5bbcd4e5bf5f95645156f774c6168..1d2b5bf25ffd995c2a5867df154cffb3 { super.inactiveTick(); - if ( this.level().isClientSide || this.ageLocked ) -+ if ( /*this.level().isClientSide ||*/ this.ageLocked ) // Plazma - Remove persist flag ++ if ( /*this.level().isClientSide ||*/ this.ageLocked ) // Plazma - Remove persist 'isClientSide' flag { // CraftBukkit this.refreshDimensions(); } else @@ -453,7 +914,7 @@ index 119856b22df5bbcd4e5bf5f95645156f774c6168..1d2b5bf25ffd995c2a5867df154cffb3 public int getAge() { - return this.level().isClientSide ? ((Boolean) this.entityData.get(AgeableMob.DATA_BABY_ID) ? -1 : 1) : this.age; -+ return /*this.level().isClientSide ? ((Boolean) this.entityData.get(AgeableMob.DATA_BABY_ID) ? -1 : 1) :*/ this.age; // Plazma - Remove persist flag ++ return /*this.level().isClientSide ? ((Boolean) this.entityData.get(AgeableMob.DATA_BABY_ID) ? -1 : 1) :*/ this.age; // Plazma - Remove persist 'isClientSide' flag } public void ageUp(int age, boolean overGrow) { @@ -462,12 +923,12 @@ index 119856b22df5bbcd4e5bf5f95645156f774c6168..1d2b5bf25ffd995c2a5867df154cffb3 public void aiStep() { super.aiStep(); - if (this.level().isClientSide || this.ageLocked) { // CraftBukkit -+ if (/*this.level().isClientSide ||*/ this.ageLocked) { // CraftBukkit // Plazma - Remove persist flag ++ if (/*this.level().isClientSide ||*/ this.ageLocked) { // CraftBukkit // Plazma - Remove persist 'isClientSide' flag if (this.forcedAgeTimer > 0) { if (this.forcedAgeTimer % 4 == 0) { this.level().addParticle(ParticleTypes.HAPPY_VILLAGER, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 0.0D, 0.0D, 0.0D); diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java -index 7eba7c0e7b8d2795abbe96b3d86a9c1a3b6b74a6..22733e48c88cd1ed9db1b6a885dfc59713575ef6 100644 +index 7eba7c0e7b8d2795abbe96b3d86a9c1a3b6b74a6..629212c180be71daa0db77f3a247468efadb0608 100644 --- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java +++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java @@ -87,9 +87,9 @@ public class AreaEffectCloud extends Entity implements TraceableEntity { @@ -475,10 +936,10 @@ index 7eba7c0e7b8d2795abbe96b3d86a9c1a3b6b74a6..22733e48c88cd1ed9db1b6a885dfc597 public void setRadius(float radius) { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.getEntityData().set(AreaEffectCloud.DATA_RADIUS, Mth.clamp(radius, 0.0F, 32.0F)); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @@ -507,14 +968,14 @@ index 7eba7c0e7b8d2795abbe96b3d86a9c1a3b6b74a6..22733e48c88cd1ed9db1b6a885dfc597 private void serverTick(ServerLevel world) { if (this.tickCount >= this.waitTime + this.duration) { diff --git a/src/main/java/net/minecraft/world/entity/Display.java b/src/main/java/net/minecraft/world/entity/Display.java -index e6cbf4506c75046a89fad778e138b448fb4a29a9..a2dcbcc705d4219f9077e4011990e8a20bfc2b1c 100644 +index e6cbf4506c75046a89fad778e138b448fb4a29a9..adb30845aaf8f3f0f6ede5b8480ffcdd11b887db 100644 --- a/src/main/java/net/minecraft/world/entity/Display.java +++ b/src/main/java/net/minecraft/world/entity/Display.java @@ -147,6 +147,7 @@ public abstract class Display extends Entity { this.stopRiding(); } -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { if (this.updateStartTick) { this.updateStartTick = false; @@ -522,204 +983,288 @@ index e6cbf4506c75046a89fad778e138b448fb4a29a9..a2dcbcc705d4219f9077e4011990e8a2 } } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } protected abstract void updateRenderSubState(boolean shouldLerp, float lerpProgress); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 45b754bfbc5dc37a0c10dcb44125715d0d6606f8..50f3830209b3657bb340338387927a2ebb32e9a7 100644 +index eaf53f5f4c33ca7a7a988e7bd04b7033e16f9529..99d15d6beed3e3d165e71e0955074cc09b02a333 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -621,7 +621,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -581,7 +581,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // Purpur start - copied from Mob - API for any mob to burn daylight public boolean isSunBurnTick() { - if (this.level().isDay() && !this.level().isClientSide) { -+ if (this.level().isDay() /*&& !this.level().isClientSide*/) { // Plazma - Remove persist flag ++ if (this.level().isDay() /*&& !this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag float f = this.getLightLevelDependentMagicValue(); BlockPos blockposition = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ()); boolean flag = this.isInWaterRainOrBubble() || this.isInPowderSnow || this.wasInPowderSnow; -@@ -1007,9 +1007,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -974,9 +974,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } this.checkBelowWorld(); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.setSharedFlagOnFire(this.remainingFireTicks > 0); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag this.firstTick = false; world = this.level(); -@@ -1296,9 +1296,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1263,9 +1263,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess BlockPos blockposition = this.getOnPosLegacy(); BlockState iblockdata = this.level().getBlockState(blockposition); - if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { -+ //if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag this.checkFallDamage(vec3d1.y, this.onGround(), iblockdata, blockposition); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag if (this.isRemoved()) { - //gameprofilerfiller.pop(); // Purpur -@@ -1339,13 +1339,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + gameprofilerfiller.pop(); +@@ -1276,6 +1276,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + this.setDeltaMovement(flag ? 0.0D : vec3d2.x, vec3d2.y, flag1 ? 0.0D : vec3d2.z); + } + ++ /* // Plazma - Remove persist 'isClientSide' flag + if (this.isControlledByLocalInstance()) { + Block block = iblockdata.getBlock(); + +@@ -1283,6 +1284,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + block.updateEntityMovementAfterFallOn(this.level(), this); + } + } ++ */ // Plazma - Remove persist 'isClientSide' flag + + // CraftBukkit start + if (this.horizontalCollision && this.getBukkitEntity() instanceof Vehicle) { +@@ -1306,13 +1308,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // CraftBukkit end - if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { -+ //if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag Entity.MovementEmission entity_movementemission = this.getMovementEmission(); if (entity_movementemission.emitsAnything() && !this.isPassenger()) { this.applyMovementEmissionAndPlaySound(entity_movementemission, vec3d1, blockposition, iblockdata); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag float f = this.getBlockSpeedFactor(); -@@ -1475,7 +1475,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1442,9 +1444,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public void extinguishFire() { - if (!this.level().isClientSide && this.wasOnFire) { -+ if (/*!this.level().isClientSide &&*/ this.wasOnFire) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide && this.wasOnFire) { // Plazma - Remove persist 'isClientSide' flag this.playEntityOnFireExtinguishedSound(); - } +- } ++ //} // Plazma - Remove persist 'isClientSide' flag -@@ -3158,7 +3158,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + this.clearFire(); + } +@@ -3125,7 +3127,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public InteractionResult interact(Player player, InteractionHand hand) { if (this.isAlive() && this instanceof Leashable leashable) { if (leashable.getLeashHolder() == player) { - if (!this.level().isClientSide()) { -+ //if (!this.level().isClientSide()) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide()) { // Plazma - Remove persist 'isClientSide' flag if (hand == InteractionHand.OFF_HAND && (level().purpurConfig.villagerCanBeLeashed || level().purpurConfig.wanderingTraderCanBeLeashed) && this instanceof net.minecraft.world.entity.npc.AbstractVillager) return InteractionResult.CONSUME; // Purpur // CraftBukkit start - fire PlayerUnleashEntityEvent // Paper start - Expand EntityUnleashEvent -@@ -3171,7 +3171,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3138,7 +3140,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // CraftBukkit end leashable.dropLeash(true, event.isDropLeash()); // Paper - Expand EntityUnleashEvent this.gameEvent(GameEvent.ENTITY_INTERACT, player); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } -@@ -3179,7 +3179,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3146,7 +3148,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess ItemStack itemstack = player.getItemInHand(hand); if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) { - if (!this.level().isClientSide()) { -+ //if (!this.level().isClientSide()) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide()) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start - fire PlayerLeashEntityEvent if (CraftEventFactory.callPlayerLeashEntityEvent(this, player, player, hand).isCancelled()) { // ((ServerPlayer) player).resendItemInHands(); // SPIGOT-7615: Resend to fix client desync with used item // Paper - Fix inventory desync -@@ -3189,7 +3189,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3156,7 +3158,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // CraftBukkit end leashable.setLeashedTo(player, true); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag itemstack.shrink(1); return InteractionResult.SUCCESS; -@@ -3261,7 +3261,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3228,7 +3230,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return false; } else if (!entity.couldAcceptPassenger()) { return false; - } else if (!force && !this.level().isClientSide() && !entity.type.canSerialize()) { // SPIGOT-7947: Allow force riding all entities -+ } else if (!force && /*!this.level().isClientSide() &&*/ !entity.type.canSerialize()) { // SPIGOT-7947: Allow force riding all entities // Plazma - Remove persist flag ++ } else if (!force && /*!this.level().isClientSide() &&*/ !entity.type.canSerialize()) { // SPIGOT-7947: Allow force riding all entities // Plazma - Remove persist 'isClientSide' flag return false; } else { for (Entity entity1 = entity; entity1.vehicle != null; entity1 = entity1.vehicle) { -@@ -3356,7 +3356,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3323,7 +3325,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } else { List list = Lists.newArrayList(this.passengers); - if (!this.level().isClientSide && passenger instanceof Player && !(this.getFirstPassenger() instanceof Player)) { -+ if (/*!this.level().isClientSide &&*/ passenger instanceof Player && !(this.getFirstPassenger() instanceof Player)) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ passenger instanceof Player && !(this.getFirstPassenger() instanceof Player)) { // Plazma - Remove persist 'isClientSide' flag list.add(0, passenger); } else { list.add(passenger); -@@ -3571,7 +3571,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3527,20 +3529,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + + public void handleDamageEvent(DamageSource damageSource) {} + +- public void handleEntityEvent(byte status) { +- switch (status) { +- case 53: +- HoneyBlock.showSlideParticles(this); +- default: +- } +- } ++ public void handleEntityEvent(byte status) {} // Plazma - Remove persist 'isClientSide' flag + public void animateHurt(float yaw) {} public boolean isOnFire() { - boolean flag = this.level() != null && this.level().isClientSide; -+ boolean flag = this.level() != null; //&& this.level().isClientSide; // Plazma - Remove persist flag ++ // boolean flag = this.level() != null && this.level().isClientSide; // Plazma - Remove persist 'isClientSide' flag - return !this.fireImmune() && (this.remainingFireTicks > 0 || flag && this.getSharedFlag(0)); +- return !this.fireImmune() && (this.remainingFireTicks > 0 || flag && this.getSharedFlag(0)); ++ return !this.fireImmune() && (this.remainingFireTicks > 0 /*|| flag && this.getSharedFlag(0)*/); // Plazma - Remove persist 'isClientSide' flag } -@@ -3661,7 +3661,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + + public boolean isPassenger() { +@@ -3628,7 +3624,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public boolean isCurrentlyGlowing() { - return this.level().isClientSide() ? this.getSharedFlag(6) : this.hasGlowingTag; -+ return /*this.level().isClientSide() ? this.getSharedFlag(6) :*/ this.hasGlowingTag; // Plazma - Remove persist flag ++ return /*this.level().isClientSide() ? this.getSharedFlag(6) :*/ this.hasGlowingTag; // Plazma - Remove persist 'isClientSide' flag } public boolean isInvisible() { -@@ -4428,7 +4428,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4395,7 +4391,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.reapplyPosition(); boolean flag = entitysize1.width() <= 4.0F && entitysize1.height() <= 4.0F; - if (!this.level.isClientSide && !this.firstTick && !this.noPhysics && flag && (entitysize1.width() > entitysize.width() || entitysize1.height() > entitysize.height()) && !(this instanceof Player)) { -+ if (/*!this.level.isClientSide &&*/ !this.firstTick && !this.noPhysics && flag && (entitysize1.width() > entitysize.width() || entitysize1.height() > entitysize.height()) && !(this instanceof Player)) { // Plazma - Remove persist flag ++ if (/*!this.level.isClientSide &&*/ !this.firstTick && !this.noPhysics && flag && (entitysize1.width() > entitysize.width() || entitysize1.height() > entitysize.height()) && !(this instanceof Player)) { // Plazma - Remove persist 'isClientSide' flag this.fudgePositionAfterSizeChange(entitysize); } -@@ -4723,7 +4723,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4665,6 +4661,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } } - public boolean isEffectiveAi() { -- return !this.level().isClientSide; -+ return true; //!this.level().isClientSide; // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag + public boolean isControlledByOrIsLocalPlayer() { + if (this instanceof Player entityhuman) { + return entityhuman.isLocalPlayer(); +@@ -4682,6 +4679,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + return this.isEffectiveAi(); + } } ++ */ // Plazma - Remove persist 'isClientSide' flag + + public boolean isControlledByClient() { + net.minecraft.world.entity.LivingEntity entityliving = this.getControllingPassenger(); +@@ -4689,9 +4687,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + return entityliving != null && entityliving.isControlledByClient(); + } + ++ /* // Plazma - Remove persist 'isClientSide' flag + public boolean isEffectiveAi() { + return !this.level().isClientSide; + } ++ */ // Plazma - Remove persist 'isClientSide' flag protected static Vec3 getCollisionHorizontalEscapeVector(double vehicleWidth, double passengerWidth, float passengerYaw) { + double d2 = (vehicleWidth + passengerWidth + 9.999999747378752E-6D) / 2.0D; diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index c1a870fd22b193388513aad0ac4f3ce0ad7c8195..3f077f614ddce6906a5469db94b2d8be65f85490 100644 +index 1d50b03246d114c6583815205eeacb7ac8549aec..2ff0dc3823c1b0c4e2c26fbc7196f420286ed2e9 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -579,7 +579,7 @@ public class EntityType implements FeatureElement, EntityTypeT - MinecraftServer minecraftserver = world.getServer(); +@@ -577,23 +577,24 @@ public class EntityType implements FeatureElement, EntityTypeT + } - if (minecraftserver != null && entity != null) { + public static void updateCustomEntityTag(Level world, @Nullable Player player, @Nullable Entity entity, CustomData nbt) { +- MinecraftServer minecraftserver = world.getServer(); +- +- if (minecraftserver != null && entity != null) { - if (world.isClientSide || !entity.onlyOpCanSetNbt() || player != null && minecraftserver.getPlayerList().isOp(player.getGameProfile())) { -+ if (/*world.isClientSide ||*/ !entity.onlyOpCanSetNbt() || player != null && minecraftserver.getPlayerList().isOp(player.getGameProfile())) { // Plazma - Remove persist flag - // Paper start - filter out protected tags - if (player == null || !player.getBukkitEntity().hasPermission("minecraft.nbt.place")) { - nbt = nbt.update((compound) -> { +- // Paper start - filter out protected tags +- if (player == null || !player.getBukkitEntity().hasPermission("minecraft.nbt.place")) { +- nbt = nbt.update((compound) -> { +- for (net.minecraft.commands.arguments.NbtPathArgument.NbtPath tag : world.paperConfig().entities.spawning.filteredEntityTagNbtPaths) { +- tag.remove(compound); +- } +- }); +- } +- // Paper end - filter out protected tags ++ MinecraftServer server = world.getServer(); + +- nbt.loadInto(entity); +- } ++ // Plazma start - Remove persist 'isClientSide' flag & Apply some optimizations ++ if (server == null || entity == null) return; ++ if (entity.onlyOpCanSetNbt() && (player == null || !server.getPlayerList().isOp(player.getGameProfile()))) return; ++ ++ // Paper start - filter out protected tags ++ if (player == null || !player.getBukkitEntity().hasPermission("minecraft.nbt.place")) { ++ nbt = nbt.update((compound) -> { ++ for (net.minecraft.commands.arguments.NbtPathArgument.NbtPath tag : world.paperConfig().entities.spawning.filteredEntityTagNbtPaths) { ++ tag.remove(compound); ++ } ++ }); + } ++ // Paper end - filter out protected tags ++ ++ nbt.loadInto(entity); ++ // Plazma end - Remove persist 'isClientSide' flag & Apply some optimizations + } + + public boolean canSerialize() { diff --git a/src/main/java/net/minecraft/world/entity/Interaction.java b/src/main/java/net/minecraft/world/entity/Interaction.java -index 221d73676fe2fd240a47cf312c1179e049298cac..a5a9acb5a1446dd9d56bb3a61d56651270b3706d 100644 +index 221d73676fe2fd240a47cf312c1179e049298cac..bc991efa3d1845642df3741e650aa559c3f6edab 100644 --- a/src/main/java/net/minecraft/world/entity/Interaction.java +++ b/src/main/java/net/minecraft/world/entity/Interaction.java @@ -175,12 +175,14 @@ public class Interaction extends Entity implements Attackable, Targeting { @Override public InteractionResult interact(Player player, InteractionHand hand) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { return this.getResponse() ? InteractionResult.SUCCESS : InteractionResult.CONSUME; } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag this.interaction = new Interaction.PlayerAction(player.getUUID(), this.level().getGameTime()); return InteractionResult.CONSUME; - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/Leashable.java b/src/main/java/net/minecraft/world/entity/Leashable.java -index 5f880a8809f9c20bc8e8c0b2d48590bab02cf077..d6b892d9de2a0a2e98dbdd2720f037c2ef3f520c 100644 +index 5f880a8809f9c20bc8e8c0b2d48590bab02cf077..4b3270614918103703f9a89170004f5ddcba5091 100644 --- a/src/main/java/net/minecraft/world/entity/Leashable.java +++ b/src/main/java/net/minecraft/world/entity/Leashable.java @@ -276,6 +276,7 @@ public interface Leashable { if (leashable_a == null) { return null; } else { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (leashable_a.delayedLeashHolderId != 0 && entity.level().isClientSide) { Entity entity1 = entity.level().getEntity(leashable_a.delayedLeashHolderId); @@ -727,24 +1272,24 @@ index 5f880a8809f9c20bc8e8c0b2d48590bab02cf077..d6b892d9de2a0a2e98dbdd2720f037c2 leashable_a.setLeashHolder(entity1); } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag return leashable_a.leashHolder; } diff --git a/src/main/java/net/minecraft/world/entity/LightningBolt.java b/src/main/java/net/minecraft/world/entity/LightningBolt.java -index 12127b14babf646711d3a118416453c4f1ac1460..49f1d70616ab757580dd99b76a68c2d27722d4ac 100644 +index 12127b14babf646711d3a118416453c4f1ac1460..447bcaf2a13d0f6f2752de9862ae1276811a329d 100644 --- a/src/main/java/net/minecraft/world/entity/LightningBolt.java +++ b/src/main/java/net/minecraft/world/entity/LightningBolt.java @@ -88,10 +88,12 @@ public class LightningBolt extends Entity { public void tick() { super.tick(); if (!this.isEffect && this.life == 2) { // Paper - Properly handle lightning effects api -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide()) { this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.LIGHTNING_BOLT_THUNDER, SoundSource.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F, false); this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.LIGHTNING_BOLT_IMPACT, SoundSource.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F, false); } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag Difficulty enumdifficulty = this.level().getDifficulty(); if (enumdifficulty == Difficulty.NORMAL || enumdifficulty == Difficulty.HARD) { @@ -753,20 +1298,20 @@ index 12127b14babf646711d3a118416453c4f1ac1460..49f1d70616ab757580dd99b76a68c2d2 LightningBolt.clearCopperOnLightningStrike(this.level(), this.getStrikePosition(), this); // Paper - Call EntityChangeBlockEvent this.gameEvent(GameEvent.LIGHTNING_STRIKE); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } --this.life; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index ab9f9953733531fa59f8992071d62850ad8506f6..11a04ffe9bf0b82d4ecee64c885e4166f6e51313 100644 +index 02288d8f3521756770351c02f623f9db02efd40c..05f5932b771cef2739f9effb9993c3cb4bdb1960 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -460,7 +460,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - //ProfilerFiller gameprofilerfiller = Profiler.get(); // Purpur + ProfilerFiller gameprofilerfiller = Profiler.get(); - //gameprofilerfiller.push("livingEntityBaseTick"); // Purpur + gameprofilerfiller.push("livingEntityBaseTick"); - if (this.fireImmune() || this.level().isClientSide) { -+ if (this.fireImmune() /*|| this.level().isClientSide*/) { // Plazma - Remove persist flag ++ if (this.fireImmune() /*|| this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag this.clearFire(); } @@ -775,312 +1320,459 @@ index ab9f9953733531fa59f8992071d62850ad8506f6..11a04ffe9bf0b82d4ecee64c885e4166 } - if (!this.level().isClientSide && this.isPassenger() && this.getVehicle() != null && this.getVehicle().dismountsUnderwater()) { -+ if (/*!this.level().isClientSide &&*/ this.isPassenger() && this.getVehicle() != null && this.getVehicle().dismountsUnderwater()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.isPassenger() && this.getVehicle() != null && this.getVehicle().dismountsUnderwater()) { // Plazma - Remove persist 'isClientSide' flag this.stopRiding(); } } else if (this.getAirSupply() < this.getMaxAirSupply()) { -@@ -633,7 +633,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -646,7 +646,7 @@ public abstract class LivingEntity extends Entity implements Attackable { protected void tickDeath() { ++this.deathTime; - if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) { -+ if (this.deathTime >= 20 && /*!this.level().isClientSide() &&*/ !this.isRemoved()) { // Plazma - Remove persist flag ++ if (this.deathTime >= 20 /*&& !this.level().isClientSide()*/ && !this.isRemoved()) { // Plazma - Remove persist 'isClientSide' flag this.level().broadcastEntityEvent(this, (byte) 60); this.remove(Entity.RemovalReason.KILLED, EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause } -@@ -747,7 +747,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -760,7 +760,7 @@ public abstract class LivingEntity extends Entity implements Attackable { public void onEquipItem(EquipmentSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1, boolean silent) { // CraftBukkit end - if (!this.level().isClientSide() && !this.isSpectator()) { -+ if (/*!this.level().isClientSide() &&*/ !this.isSpectator()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide() &&*/ !this.isSpectator()) { // Plazma - Remove persist 'isClientSide' flag boolean flag = itemstack1.isEmpty() && itemstack.isEmpty(); if (!flag && !ItemStack.isSameItemSameComponents(itemstack, itemstack1) && !this.firstTick) { -@@ -862,7 +862,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -875,7 +875,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } } // Paper end - Friction API - if (nbt.contains("attributes", 9) && this.level() != null && !this.level().isClientSide) { -+ if (nbt.contains("attributes", 9) && this.level() != null /*&& !this.level().isClientSide*/) { // Plazma - Remove persist flag ++ if (nbt.contains("attributes", 9) && this.level() != null /*&& !this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag this.getAttributes().load(nbt.getList("attributes", 10)); } -@@ -970,7 +970,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -983,7 +983,7 @@ public abstract class LivingEntity extends Entity implements Attackable { if (!mobeffect.tick(this, () -> { this.onEffectUpdated(mobeffect, true, (Entity) null); })) { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, mobeffect, null, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.EXPIRATION); if (event.isCancelled()) { -@@ -979,7 +979,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -992,7 +992,7 @@ public abstract class LivingEntity extends Entity implements Attackable { // CraftBukkit end iterator.remove(); this.onEffectsRemoved(List.of(mobeffect)); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } else if (mobeffect.getDuration() % 600 == 0) { this.onEffectUpdated(mobeffect, false, (Entity) null); } -@@ -1000,10 +1000,10 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1013,10 +1013,10 @@ public abstract class LivingEntity extends Entity implements Attackable { // CraftBukkit end if (this.effectsDirty) { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.updateInvisibilityStatus(); this.updateGlowingStatus(); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag this.effectsDirty = false; } -@@ -1138,9 +1138,9 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1151,9 +1151,10 @@ public abstract class LivingEntity extends Entity implements Attackable { public boolean removeAllEffects(EntityPotionEffectEvent.Cause cause) { // CraftBukkit end -- if (this.level().isClientSide) { -+ /*if (this.level().isClientSide) { // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag + if (this.level().isClientSide) { return false; - } else if (this.activeEffects.isEmpty()) { -+ } else*/ if (this.activeEffects.isEmpty()) { // Plazma - Remove persist flag ++ } else*/ if (this.activeEffects.isEmpty()) { // Plazma - Remove persist 'isClientSide' flag return false; } else { // CraftBukkit start -@@ -1313,10 +1313,10 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1326,10 +1327,10 @@ public abstract class LivingEntity extends Entity implements Attackable { protected void onEffectAdded(MobEffectInstance effect, @Nullable Entity source) { this.effectsDirty = true; - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag ((MobEffect) effect.getEffect().value()).addAttributeModifiers(this.getAttributes(), effect.getAmplifier()); this.sendEffectToPassengers(effect); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } -@@ -1335,7 +1335,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1348,7 +1349,7 @@ public abstract class LivingEntity extends Entity implements Attackable { protected void onEffectUpdated(MobEffectInstance effect, boolean reapplyEffect, @Nullable Entity source) { this.effectsDirty = true; - if (reapplyEffect && !this.level().isClientSide) { -+ if (reapplyEffect /*&& !this.level().isClientSide*/) { // Plazma - Remove persist flag ++ if (reapplyEffect /*&& !this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag MobEffect mobeffectlist = (MobEffect) effect.getEffect().value(); mobeffectlist.removeAttributeModifiers(this.getAttributes()); -@@ -1343,15 +1343,15 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1356,15 +1357,15 @@ public abstract class LivingEntity extends Entity implements Attackable { this.refreshDirtyAttributes(); } - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.sendEffectToPassengers(effect); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } protected void onEffectsRemoved(Collection effects) { this.effectsDirty = true; - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag Iterator iterator = effects.iterator(); while (iterator.hasNext()) { -@@ -1372,7 +1372,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1385,7 +1386,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } this.refreshDirtyAttributes(); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } -@@ -1899,7 +1899,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1918,7 +1919,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.stopSleeping(); } - if (!this.level().isClientSide && this.hasCustomName()) { -+ if (/*!this.level().isClientSide &&*/ this.hasCustomName()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.hasCustomName()) { // Plazma - Remove persist 'isClientSide' flag if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot } -@@ -3067,12 +3067,14 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -2779,9 +2780,6 @@ public abstract class LivingEntity extends Entity implements Attackable { + case 52: + this.breakItem(this.getItemBySlot(EquipmentSlot.FEET)); + break; +- case 54: +- HoneyBlock.showJumpParticles(this); +- break; + case 55: + this.swapHandItems(); + break; +@@ -3092,7 +3090,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + public void travel(Vec3 movementInput) { +- if (this.isControlledByLocalInstance()) { ++ //if (this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag + FluidState fluid = this.level().getFluidState(this.blockPosition()); + + if ((this.isInWater() || this.isInLava()) && this.isAffectedByFluids() && !this.canStandOnFluid(fluid)) { +@@ -3103,7 +3101,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.travelInAir(movementInput); + } + +- } ++ //} // Plazma - Remove persist 'isClientSide' flag + } + + private void travelInAir(Vec3 movementInput) { +@@ -3116,12 +3114,14 @@ public abstract class LivingEntity extends Entity implements Attackable { if (mobeffect != null) { d0 += (0.05D * (double) (mobeffect.getAmplifier() + 1) - vec3d1.y) * 0.2D; -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag } else if (this.level().isClientSide && !this.level().hasChunkAt(blockposition)) { if (this.getY() > (double) this.level().getMinY()) { d0 = -0.1D; } else { d0 = 0.0D; } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } else { d0 -= this.getEffectiveGravity(); } -@@ -3150,11 +3152,11 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3199,11 +3199,11 @@ public abstract class LivingEntity extends Entity implements Attackable { this.setDeltaMovement(this.updateFallFlyingMovement(vec3d)); this.move(MoverType.SELF, this.getDeltaMovement()); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag double d1 = this.getDeltaMovement().horizontalDistance(); this.handleFallFlyingCollisions(d0, d1); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } -@@ -3313,7 +3315,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3253,12 +3253,12 @@ public abstract class LivingEntity extends Entity implements Attackable { + Vec3 vec3d1 = this.getRiddenInput(controllingPlayer, movementInput); + + this.tickRidden(controllingPlayer, vec3d1); +- if (this.isControlledByLocalInstance()) { ++ //if (this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag + this.setSpeed(this.getRiddenSpeed(controllingPlayer)); + this.travel(vec3d1); +- } else { ++ /*} else { // Plazma - Remove persist 'isClientSide' flag + this.setDeltaMovement(Vec3.ZERO); +- } ++ }*/ // Plazma - Remove persist 'isClientSide' flag + + } + +@@ -3362,7 +3362,7 @@ public abstract class LivingEntity extends Entity implements Attackable { super.tick(); this.updatingUsingItem(); this.updateSwimAmount(); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag int i = this.getArrowCount(); if (i > 0) { -@@ -3348,7 +3350,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3397,7 +3397,7 @@ public abstract class LivingEntity extends Entity implements Attackable { if (this.isSleeping() && !this.checkBedExists()) { this.stopSleeping(); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag if (!this.isRemoved()) { this.aiStep(); -@@ -3703,14 +3705,14 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3655,9 +3655,10 @@ public abstract class LivingEntity extends Entity implements Attackable { + if (this.lerpSteps > 0) { + this.lerpPositionAndRotationStep(this.lerpSteps, this.lerpX, this.lerpY, this.lerpZ, this.lerpYRot, this.lerpXRot); + --this.lerpSteps; +- } else if (!this.isEffectiveAi()) { ++ } /*else if (!this.isEffectiveAi()) { // Plazma - Remove persist 'isClientSide' flag + this.setDeltaMovement(this.getDeltaMovement().scale(0.98D)); + } ++ */ // Plazma - Remove persist 'isClientSide' flag + + if (this.lerpHeadSteps > 0) { + this.lerpHeadRotationStep(this.lerpHeadSteps, this.lerpYHeadRot); +@@ -3689,7 +3690,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.jumping = false; + this.xxa = 0.0F; + this.zza = 0.0F; +- } else if (this.isEffectiveAi()) { ++ } else /*if (this.isEffectiveAi())*/ { // Plazma - Remove persist 'isClientSide' flag + gameprofilerfiller.push("newAi"); + this.serverAiStep(); + gameprofilerfiller.pop(); +@@ -3752,14 +3753,14 @@ public abstract class LivingEntity extends Entity implements Attackable { this.travel(vec3d1); } - if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { -+ //if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { // Plazma - Remove persist flag ++ // if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag this.applyEffectsFromBlocks(); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag this.calculateEntityAnimation(this instanceof FlyingAnimal); - //gameprofilerfiller.pop(); // Purpur - //gameprofilerfiller.push("freezing"); // Purpur + gameprofilerfiller.pop(); + gameprofilerfiller.push("freezing"); - if (!this.level().isClientSide && !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API -+ if (/*!this.level().isClientSide &&*/ !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API // Plazma - Remove persist 'isClientSide' flag int i = this.getTicksFrozen(); if (this.isInPowderSnow && this.canFreeze()) { -@@ -3813,7 +3815,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3862,7 +3863,7 @@ public abstract class LivingEntity extends Entity implements Attackable { protected void updateFallFlying() { this.checkSlowFallDistance(); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (!this.canGlide()) { if (this.getSharedFlag(7) != false && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit this.setSharedFlag(7, false); -@@ -3846,7 +3848,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3895,7 +3896,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.gameEvent(GameEvent.ELYTRA_GLIDE); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } -@@ -3949,7 +3951,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3998,7 +3999,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.autoSpinAttackTicks = 0; } - if (!this.level().isClientSide && this.autoSpinAttackTicks <= 0) { -+ if (/*!this.level().isClientSide &&*/ this.autoSpinAttackTicks <= 0) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.autoSpinAttackTicks <= 0) { // Plazma - Remove persist 'isClientSide' flag this.setLivingEntityFlag(4, false); this.autoSpinAttackDmg = 0.0F; this.autoSpinAttackItemStack = null; -@@ -3978,7 +3980,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -4027,7 +4028,7 @@ public abstract class LivingEntity extends Entity implements Attackable { Entity entity = this.getVehicle(); super.stopRiding(suppressCancellation); // Paper - Force entity dismount during teleportation - if (entity != null && entity != this.getVehicle() && !this.level().isClientSide && entity.valid) { // Paper - don't process on world gen -+ if (entity != null && entity != this.getVehicle() /*&& !this.level().isClientSide*/ && entity.valid) { // Paper - don't process on world gen // Plazma - Remove persist flag ++ if (entity != null && entity != this.getVehicle() /*&& !this.level().isClientSide*/ && entity.valid) { // Paper - don't process on world gen // Plazma - Remove persist 'isClientSide' flag this.dismountVehicle(entity); } -@@ -4052,7 +4054,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -4101,7 +4102,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } public void take(Entity item, int count) { - if (!item.isRemoved() && !this.level().isClientSide && (item instanceof ItemEntity || item instanceof AbstractArrow || item instanceof ExperienceOrb)) { -+ if (!item.isRemoved() /*&& !this.level().isClientSide*/ && (item instanceof ItemEntity || item instanceof AbstractArrow || item instanceof ExperienceOrb)) { // Plazma - Remove persist flag ++ if (!item.isRemoved() /*&& !this.level().isClientSide*/ && (item instanceof ItemEntity || item instanceof AbstractArrow || item instanceof ExperienceOrb)) { // Plazma - Remove persist 'isClientSide' flag ((ServerLevel) this.level()).getChunkSource().broadcastAndSend(this, new ClientboundTakeItemEntityPacket(item.getId(), this.getId(), count)); // Paper - broadcast with collector as source } -@@ -4197,7 +4199,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -4246,7 +4247,7 @@ public abstract class LivingEntity extends Entity implements Attackable { // Paper start - lag compensate eating // we add 1 to the expected time to avoid lag compensating when we should not final boolean shouldLagCompensate = this.useItem.has(DataComponents.FOOD) && this.eatStartTime != -1 && (System.nanoTime() - this.eatStartTime) > ((1L + this.totalEatTimeTicks) * 50L * (1000L * 1000L)); - if ((--this.useItemRemaining == 0 || shouldLagCompensate) && !this.level().isClientSide && !stack.useOnRelease()) { -+ if ((--this.useItemRemaining == 0 || shouldLagCompensate) && /*!this.level().isClientSide &&*/ !stack.useOnRelease()) { // Plazma - Remove persist flag ++ if ((--this.useItemRemaining == 0 || shouldLagCompensate) /*&& !this.level().isClientSide*/ && !stack.useOnRelease()) { // Plazma - Remove persist 'isClientSide' flag this.useItemRemaining = 0; // Paper end - lag compensate eating this.completeUsingItem(); -@@ -4241,11 +4243,11 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -4290,11 +4291,11 @@ public abstract class LivingEntity extends Entity implements Attackable { this.useItemRemaining = this.totalEatTimeTicks = itemstack.getUseDuration(this); this.eatStartTime = System.nanoTime(); // Paper end - lag compensate eating - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.setLivingEntityFlag(1, true); this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND); this.gameEvent(GameEvent.ITEM_INTERACT_START); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } } -@@ -4253,6 +4255,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -4302,6 +4303,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @Override public void onSyncedDataUpdated(EntityDataAccessor data) { super.onSyncedDataUpdated(data); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (LivingEntity.SLEEPING_POS_ID.equals(data)) { if (this.level().isClientSide) { this.getSleepingPos().ifPresent(this::setPosToBed); -@@ -4271,6 +4274,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -4320,6 +4322,7 @@ public abstract class LivingEntity extends Entity implements Attackable { // Paper end - lag compensate eating } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } -@@ -4305,7 +4309,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -4354,61 +4357,52 @@ public abstract class LivingEntity extends Entity implements Attackable { } public void completeUsingItem() { - if (!this.level().isClientSide || this.isUsingItem()) { -+ //if (!this.level().isClientSide || this.isUsingItem()) { // Plazma - Remove persist flag - InteractionHand enumhand = this.getUsedItemHand(); +- InteractionHand enumhand = this.getUsedItemHand(); ++ // Plazma start - Remove persist 'isClientSide' flag & Apply some optimizations ++ InteractionHand enumhand = this.getUsedItemHand(); - if (!this.useItem.equals(this.getItemInHand(enumhand))) { -@@ -4359,7 +4363,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - } +- if (!this.useItem.equals(this.getItemInHand(enumhand))) { +- this.releaseUsingItem(); +- } else { +- if (!this.useItem.isEmpty() && this.isUsingItem()) { +- this.startUsingItem(this.getUsedItemHand(), true); // Paper - Prevent consuming the wrong itemstack +- // CraftBukkit start - fire PlayerItemConsumeEvent +- ItemStack itemstack; +- PlayerItemConsumeEvent event = null; // Paper +- if (this instanceof ServerPlayer entityPlayer) { +- org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.useItem); +- org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand); +- event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand); // Paper +- this.level().getCraftServer().getPluginManager().callEvent(event); ++ if (!this.useItem.equals(this.getItemInHand(enumhand))) { ++ this.releaseUsingItem(); ++ return; ++ } +- if (event.isCancelled()) { +- // Update client +- Consumable consumable = this.useItem.get(DataComponents.CONSUMABLE); +- if (consumable != null) { +- consumable.cancelUsingItem(entityPlayer, this.useItem); +- } +- entityPlayer.getBukkitEntity().updateInventory(); +- entityPlayer.getBukkitEntity().updateScaledHealth(); +- this.stopUsingItem(); // Paper - event is using an item, clear active item to reset its use +- return; +- } ++ if (this.useItem.isEmpty() || !this.isUsingItem()) return; + +- itemstack = (craftItem.equals(event.getItem())) ? this.useItem.finishUsingItem(this.level(), this) : CraftItemStack.asNMSCopy(event.getItem()).finishUsingItem(this.level(), this); +- } else { +- itemstack = this.useItem.finishUsingItem(this.level(), this); +- } +- // Paper start - save the default replacement item and change it if necessary +- final ItemStack defaultReplacement = itemstack; +- if (event != null && event.getReplacement() != null) { +- itemstack = CraftItemStack.asNMSCopy(event.getReplacement()); +- } +- // Paper end +- // CraftBukkit end ++ this.startUsingItem(this.getUsedItemHand(), true); // Paper - Prevent consuming the wrong itemstack + +- if (itemstack != this.useItem) { +- this.setItemInHand(enumhand, itemstack); +- } ++ // CraftBukkit start - fire PlayerItemConsumeEvent ++ ItemStack itemstack; ++ PlayerItemConsumeEvent event = null; // Paper ++ if (this instanceof ServerPlayer player) { ++ org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.useItem); ++ org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand); + +- this.stopUsingItem(); +- // Paper start +- if (this instanceof ServerPlayer) { +- ((ServerPlayer) this).getBukkitEntity().updateInventory(); +- } +- // Paper end +- } ++ event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand); // Paper ++ this.level().getCraftServer().getPluginManager().callEvent(event); + ++ if (event.isCancelled()) { ++ // Update client ++ Consumable consumable = this.useItem.get(DataComponents.CONSUMABLE); ++ if (consumable != null) consumable.cancelUsingItem(player, this.useItem); ++ ++ player.getBukkitEntity().updateInventory(); ++ player.getBukkitEntity().updateScaledHealth(); ++ this.stopUsingItem(); // Paper - event is using an item, clear active item to reset its use ++ return; } -- } -+ //} // Plazma - Remove persist flag ++ ++ itemstack = (craftItem.equals(event.getItem())) ? this.useItem.finishUsingItem(this.level(), this) : CraftItemStack.asNMSCopy(event.getItem()).finishUsingItem(this.level(), this); ++ } else { ++ itemstack = this.useItem.finishUsingItem(this.level(), this); + } ++ ++ if (event != null && event.getReplacement() != null) itemstack = CraftItemStack.asNMSCopy(event.getReplacement()); // Paper ++ // CraftBukkit end ++ ++ if (itemstack != this.useItem) this.setItemInHand(enumhand, itemstack); ++ this.stopUsingItem(); ++ ++ if (this instanceof ServerPlayer player) player.getBukkitEntity().updateInventory(); // Paper ++ // Plazma end - Remove persist 'isClientSide' flag & Apply some optimizations } public void handleExtraItemsCreatedOnUse(ItemStack stack) {} -@@ -4389,14 +4393,14 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -4438,14 +4432,14 @@ public abstract class LivingEntity extends Entity implements Attackable { } public void stopUsingItem() { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag boolean flag = this.isUsingItem(); this.setLivingEntityFlag(1, false); @@ -1088,49 +1780,62 @@ index ab9f9953733531fa59f8992071d62850ad8506f6..11a04ffe9bf0b82d4ecee64c885e4166 this.gameEvent(GameEvent.ITEM_INTERACT_FINISH); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag this.useItem = ItemStack.EMPTY; // Paper start - lag compensate eating -@@ -4834,7 +4838,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -4883,7 +4877,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @Override public boolean isCurrentlyGlowing() { - return !this.level().isClientSide() && this.hasEffect(MobEffects.GLOWING) || super.isCurrentlyGlowing(); -+ return /*!this.level().isClientSide() &&*/ this.hasEffect(MobEffects.GLOWING) || super.isCurrentlyGlowing(); // Plazma - Remove persist flag ++ return /*!this.level().isClientSide() &&*/ this.hasEffect(MobEffects.GLOWING) || super.isCurrentlyGlowing(); // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index d242eeb3dde8f379a7baad430f2c22ab3ca8a3c9..bf614fd82ab7ce9d988eaf602ba0348822b60ade 100644 +index 331a75fee26e3fe2532e8661db282a0c207ddf9b..997c5b3deed7c55e5685fba76bcbb53e10e66d9f 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -442,11 +442,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -444,11 +444,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } public void spawnAnim() { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.makePoofParticles(); } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag this.level().broadcastEntityEvent(this, (byte) 20); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } -@@ -463,7 +465,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -465,7 +467,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void tick() { super.tick(); - if (!this.level().isClientSide && this.tickCount % 5 == 0) { -+ if (/*!this.level().isClientSide &&*/ this.tickCount % 5 == 0) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.tickCount % 5 == 0) { // Plazma - Remove persist 'isClientSide' flag this.updateControlFlags(); } +@@ -1678,10 +1680,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + return flag1; + } + ++ /* // Plazma - Remove persist 'isClientSide' flag + @Override + public boolean isEffectiveAi() { + return super.isEffectiveAi() && !this.isNoAi(); + } ++ */ // Plazma - Remove persist 'isClientSide' flag + + public void setNoAi(boolean aiDisabled) { + byte b0 = (Byte) this.entityData.get(Mob.DATA_MOB_FLAGS_ID); diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java -index d002acdac893e2744cde5f1145d29ac2c8ff6959..d2c577b4de7d1551aeb1c5905a094d812610a3f9 100644 +index 771bb96032149a8573d1de14fa2ab19012c82000..f268c787d6ecef639633fbc7a36676fd184ae7cd 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java @@ -86,10 +86,10 @@ public class RemoveBlockGoal extends MoveToBlockGoal { @@ -1138,11 +1843,11 @@ index d002acdac893e2744cde5f1145d29ac2c8ff6959..d2c577b4de7d1551aeb1c5905a094d81 vec3d = this.removerMob.getDeltaMovement(); this.removerMob.setDeltaMovement(vec3d.x, 0.3D, vec3d.z); - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag d0 = 0.08D; ((ServerLevel) world).sendParticles(new ItemParticleOption(ParticleTypes.ITEM, new ItemStack(Items.EGG)), (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.7D, (double) blockposition1.getZ() + 0.5D, 3, ((double) randomsource.nextFloat() - 0.5D) * 0.08D, ((double) randomsource.nextFloat() - 0.5D) * 0.08D, ((double) randomsource.nextFloat() - 0.5D) * 0.08D, 0.15000000596046448D); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } if (this.ticksSinceReachedGoal % 2 == 0) { @@ -1151,7 +1856,7 @@ index d002acdac893e2744cde5f1145d29ac2c8ff6959..d2c577b4de7d1551aeb1c5905a094d81 // CraftBukkit end world.removeBlock(blockposition1, false); - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag for (int i = 0; i < 20; ++i) { d0 = randomsource.nextGaussian() * 0.02D; double d1 = randomsource.nextGaussian() * 0.02D; @@ -1160,12 +1865,12 @@ index d002acdac893e2744cde5f1145d29ac2c8ff6959..d2c577b4de7d1551aeb1c5905a094d81 this.playBreakSound(world, blockposition1); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } ++this.ticksSinceReachedGoal; diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java -index 2d4fe19da8d53d47df36399531e78da2c961aecd..4b91ef804c731c09b31c08abc2e1e5aa9644af1d 100644 +index c8ffbbccbf20ce911a3d75fa860d5a1452c5e590..0d3f4702c8bf3d66b01b42c5da1761e93e1d6ed2 100644 --- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java +++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java @@ -48,9 +48,9 @@ public class Bat extends AmbientCreature { @@ -1173,15 +1878,28 @@ index 2d4fe19da8d53d47df36399531e78da2c961aecd..4b91ef804c731c09b31c08abc2e1e5aa super(type, world); this.moveControl = new org.purpurmc.purpur.controller.FlyingWithSpacebarMoveControllerWASD(this, 0.075F); // Purpur - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.setResting(true); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } +diff --git a/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java b/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java +index 9708ed3e00059fdf5d1d60e0c607d0ab153d1d3f..b9410b8c039d182d8764029a27b9c98de0c17bb8 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java ++++ b/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java +@@ -100,7 +100,7 @@ public abstract class AbstractFish extends WaterAnimal implements Bucketable { + + @Override + public void travel(Vec3 movementInput) { +- if (this.isControlledByLocalInstance() && this.isInWater()) { ++ if (/*this.isControlledByLocalInstance() &&*/ this.isInWater()) { // Plazma - Remove persist 'isClientSide' flag + this.moveRelative(getRider() != null ? getSpeed() : 0.01F, movementInput); // Purpur + this.move(MoverType.SELF, this.getDeltaMovement()); + this.setDeltaMovement(this.getDeltaMovement().scale(0.9)); diff --git a/src/main/java/net/minecraft/world/entity/animal/Animal.java b/src/main/java/net/minecraft/world/entity/animal/Animal.java -index 9987d28ea145f6d0126cb4ea22001e0922fb51bd..168ca278d765e925103b92367010c76f2bd70d46 100644 +index 9987d28ea145f6d0126cb4ea22001e0922fb51bd..45663e0d5ee361972b6c3ed9d3c8c294f5f2af43 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Animal.java +++ b/src/main/java/net/minecraft/world/entity/animal/Animal.java @@ -158,7 +158,7 @@ public abstract class Animal extends AgeableMob { @@ -1189,7 +1907,7 @@ index 9987d28ea145f6d0126cb4ea22001e0922fb51bd..168ca278d765e925103b92367010c76f int i = this.getAge(); - if (!this.level().isClientSide && i == 0 && this.canFallInLove() && (this.level().purpurConfig.animalBreedingCooldownSeconds <= 0 || !this.level().hasBreedingCooldown(player.getUUID(), this.getClass()))) { // Purpur -+ if (/*!this.level().isClientSide &&*/ i == 0 && this.canFallInLove() && (this.level().purpurConfig.animalBreedingCooldownSeconds <= 0 || !this.level().hasBreedingCooldown(player.getUUID(), this.getClass()))) { // Purpur // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ i == 0 && this.canFallInLove() && (this.level().purpurConfig.animalBreedingCooldownSeconds <= 0 || !this.level().hasBreedingCooldown(player.getUUID(), this.getClass()))) { // Purpur // Plazma - Remove persist 'isClientSide' flag final ItemStack breedCopy = itemstack.copy(); // Paper - Fix EntityBreedEvent copying this.usePlayerItem(player, hand, itemstack); this.setInLove(player, breedCopy); // Paper - Fix EntityBreedEvent copying @@ -1197,16 +1915,16 @@ index 9987d28ea145f6d0126cb4ea22001e0922fb51bd..168ca278d765e925103b92367010c76f return InteractionResult.SUCCESS; } -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { return InteractionResult.CONSUME; } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } return super.mobInteract(player, hand); diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index dc8df0912c1d18176e18a8f4dc43c4f60f81b659..6c4cab8cabdd27b6dbd97a408a588f4ef9684654 100644 +index dc8df0912c1d18176e18a8f4dc43c4f60f81b659..6dec1720aea724baab541e26e14c9fa0646abdbf 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java @@ -576,7 +576,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @@ -1214,7 +1932,7 @@ index dc8df0912c1d18176e18a8f4dc43c4f60f81b659..6c4cab8cabdd27b6dbd97a408a588f4e public void aiStep() { super.aiStep(); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (this.stayOutOfHiveCountdown > 0) { --this.stayOutOfHiveCountdown; } @@ -1223,12 +1941,12 @@ index dc8df0912c1d18176e18a8f4dc43c4f60f81b659..6c4cab8cabdd27b6dbd97a408a588f4e this.hivePos = null; } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/animal/Bucketable.java b/src/main/java/net/minecraft/world/entity/animal/Bucketable.java -index 4eca5996a867086be22d22d99db81ab001467516..356cf16ad4188b7d195537cc75c63aa507699d25 100644 +index 4eca5996a867086be22d22d99db81ab001467516..dff6c0615defa87e7b4e01c0df2d0a5fdeb7ecbb 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bucketable.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bucketable.java @@ -118,9 +118,9 @@ public interface Bucketable { @@ -1236,15 +1954,15 @@ index 4eca5996a867086be22d22d99db81ab001467516..356cf16ad4188b7d195537cc75c63aa5 Level world = entity.level(); - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag CriteriaTriggers.FILLED_BUCKET.trigger((ServerPlayer) player, itemstack1); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag entity.discard(EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause return Optional.of(InteractionResult.SUCCESS); diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java -index 4aad4fdc80070f4000e929fff126714fc67050b0..521e5ee46883cf4ff11c8a6fc4d84c4f84378704 100644 +index 4aad4fdc80070f4000e929fff126714fc67050b0..721e450242a36b2c0998a78fa86a1cc40dcc9ee6 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Cat.java +++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java @@ -451,22 +451,22 @@ public class Cat extends TamableAnimal implements VariantHolder 0.03D) { Vec3 vec3d = this.getViewVector(0.0F); float f = Mth.cos(this.getYRot() * 0.017453292F) * 0.3F; @@ -1305,7 +2023,7 @@ index c1842894f96a567707992d8ff938dbf689dd0df6..d328e8a574a1f96e51e33059cd9e8f55 this.level().addParticle(ParticleTypes.DOLPHIN, this.getX() - vec3d.x * (double) f2 - (double) f, this.getY() - vec3d.y, this.getZ() - vec3d.z * (double) f2 - (double) f1, 0.0D, 0.0D, 0.0D); } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } } @@ -1314,15 +2032,24 @@ index c1842894f96a567707992d8ff938dbf689dd0df6..d328e8a574a1f96e51e33059cd9e8f55 if (!itemstack.isEmpty() && itemstack.is(ItemTags.FISHES)) { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.playSound(SoundEvents.DOLPHIN_EAT, 1.0F, 1.0F); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag if (this.isBaby()) { itemstack.consume(1, player); +@@ -472,7 +474,7 @@ public class Dolphin extends AgeableWaterCreature { + + @Override + public void travel(Vec3 movementInput) { +- if (this.isControlledByLocalInstance() && this.isInWater()) { ++ if (/*this.isControlledByLocalInstance() &&*/ this.isInWater()) { // Plazma - Remove persist 'isClientSide' flag + this.moveRelative(this.getSpeed(), movementInput); + this.move(MoverType.SELF, this.getDeltaMovement()); + this.setDeltaMovement(this.getDeltaMovement().scale(0.9D)); diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java -index 0e229955d9ea7036fab124fa7685df22280671f2..75baa4d94084576393bfedd5630bab2006c7ab9d 100644 +index ac044be03494c3d6bad6bbc22321445e04d430cc..f25ce3f42157d7303304c39e3b990f6648a441f9 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Fox.java +++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java @@ -257,7 +257,7 @@ public class Fox extends Animal implements VariantHolder { @@ -1330,21 +2057,54 @@ index 0e229955d9ea7036fab124fa7685df22280671f2..75baa4d94084576393bfedd5630bab20 @Override public void aiStep() { - if (!this.level().isClientSide && this.isAlive() && this.isEffectiveAi()) { -+ if (/*!this.level().isClientSide &&*/ this.isAlive() && this.isEffectiveAi()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.isAlive() /*&& this.isEffectiveAi()*/) { // Plazma - Remove persist 'isClientSide' flag ++this.ticksSinceEaten; ItemStack itemstack = this.getItemBySlot(EquipmentSlot.MAINHAND); -@@ -559,7 +559,7 @@ public class Fox extends Animal implements VariantHolder { +@@ -559,14 +559,16 @@ public class Fox extends Animal implements VariantHolder { } private void spitOutItem(ItemStack stack) { - if (!stack.isEmpty() && !this.level().isClientSide) { -+ if (!stack.isEmpty() /*&& !this.level().isClientSide*/) { // Plazma - Remove persist flag - ItemEntity entityitem = new ItemEntity(this.level(), this.getX() + this.getLookAngle().x, this.getY() + 1.0D, this.getZ() + this.getLookAngle().z, stack); +- ItemEntity entityitem = new ItemEntity(this.level(), this.getX() + this.getLookAngle().x, this.getY() + 1.0D, this.getZ() + this.getLookAngle().z, stack); ++ // Plazma start - Remove persist 'isClientSide' flag & Apply some optimizations ++ if (stack.isEmpty()) return; - entityitem.setPickUpDelay(40); +- entityitem.setPickUpDelay(40); +- entityitem.setThrower(this); +- this.playSound(SoundEvents.FOX_SPIT, 1.0F, 1.0F); +- this.spawnAtLocation((net.minecraft.server.level.ServerLevel) this.level(), entityitem); // Paper - Call EntityDropItemEvent +- } ++ ItemEntity entityitem = new ItemEntity(this.level(), this.getX() + this.getLookAngle().x, this.getY() + 1.0D, this.getZ() + this.getLookAngle().z, stack); ++ ++ entityitem.setPickUpDelay(40); ++ entityitem.setThrower(this); ++ this.playSound(SoundEvents.FOX_SPIT, 1.0F, 1.0F); ++ this.spawnAtLocation((net.minecraft.server.level.ServerLevel) this.level(), entityitem); // Paper - Call EntityDropItemEvent ++ // Plazma - Remove persist 'isClientSide' flag & Apply some optimizations + } + + private void dropItemStack(ItemStack stack) { +@@ -601,7 +603,7 @@ public class Fox extends Animal implements VariantHolder { + @Override + public void tick() { + super.tick(); +- if (this.isEffectiveAi()) { ++ //if (this.isEffectiveAi()) { // Plazma - Remove persist 'isClientSide' flag + boolean flag = this.isInWater(); + + if (flag || this.getTarget() != null || this.level().isThundering()) { +@@ -618,7 +620,7 @@ public class Fox extends Animal implements VariantHolder { + + this.level().levelEvent(2001, blockposition, Block.getId(iblockdata)); + } +- } ++ //} // Plazma - Remove persist 'isClientSide' flag + + this.interestedAngleO = this.interestedAngle; + if (this.isInterested()) { diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java -index 9a6471d2f1eb1c8af006b70b6bba0b668220fb00..0c085bc33a8f1a4ab299d9b6a13ac0f54c76b101 100644 +index 9a6471d2f1eb1c8af006b70b6bba0b668220fb00..cf071f48fb9b3acb7fabe4295de979dfca1079b4 100644 --- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java +++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java @@ -162,9 +162,9 @@ public class IronGolem extends AbstractGolem implements NeutralMob { @@ -1352,15 +2112,15 @@ index 9a6471d2f1eb1c8af006b70b6bba0b668220fb00..0c085bc33a8f1a4ab299d9b6a13ac0f5 } - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.updatePersistentAnger((ServerLevel) this.level(), true); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java -index dee59cb4b87845c940ee089aa932aa69dd2539d6..920f9494d970faedb570b76d445949938022d0a1 100644 +index dee59cb4b87845c940ee089aa932aa69dd2539d6..89527365aefb6077cf6b4f771ca47c054d0efb78 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java +++ b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java @@ -206,7 +206,7 @@ public class Ocelot extends Animal { @@ -1368,7 +2128,7 @@ index dee59cb4b87845c940ee089aa932aa69dd2539d6..920f9494d970faedb570b76d44594993 if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && player.distanceToSqr((Entity) this) < 9.0D) { this.usePlayerItem(player, hand, itemstack); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) { // CraftBukkit - added event call and isCancelled check this.setTrusting(true); this.spawnTrustingParticles(true); @@ -1377,12 +2137,12 @@ index dee59cb4b87845c940ee089aa932aa69dd2539d6..920f9494d970faedb570b76d44594993 this.level().broadcastEntityEvent(this, (byte) 40); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java -index 83372c86bd54eedd9b136ddfcbfc67d303058c0a..5997c826baecbc291575662917dc2f86aae18343 100644 +index 83372c86bd54eedd9b136ddfcbfc67d303058c0a..2df413fce51db6360c2a55fde72061135e0bd3a9 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Panda.java +++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java @@ -463,12 +463,12 @@ public class Panda extends Animal { @@ -1390,14 +2150,14 @@ index 83372c86bd54eedd9b136ddfcbfc67d303058c0a..5997c826baecbc291575662917dc2f86 if (this.isEating()) { this.addEatingParticles(); - if (!this.level().isClientSide && this.getEatCounter() > 80 && this.random.nextInt(20) == 1) { -+ if (/*!this.level().isClientSide &&*/ this.getEatCounter() > 80 && this.random.nextInt(20) == 1) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.getEatCounter() > 80 && this.random.nextInt(20) == 1) { // Plazma - Remove persist 'isClientSide' flag if (this.getEatCounter() > 100 && this.getItemBySlot(EquipmentSlot.MAINHAND).is(ItemTags.PANDA_EATS_FROM_GROUND)) { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); this.gameEvent(GameEvent.EAT); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag this.sit(false); } @@ -1406,7 +2166,7 @@ index 83372c86bd54eedd9b136ddfcbfc67d303058c0a..5997c826baecbc291575662917dc2f86 this.roll(false); } else { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag Vec3 vec3d = this.getDeltaMovement(); if (this.rollCounter == 1) { @@ -1415,7 +2175,7 @@ index 83372c86bd54eedd9b136ddfcbfc67d303058c0a..5997c826baecbc291575662917dc2f86 this.setDeltaMovement(0.0D, this.onGround() ? 0.27D : vec3d.y, 0.0D); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } } @@ -1424,12 +2184,50 @@ index 83372c86bd54eedd9b136ddfcbfc67d303058c0a..5997c826baecbc291575662917dc2f86 this.usePlayerItem(player, hand, itemstack); this.ageUp((int) ((float) (-this.getAge() / 20) * 0.1F), true); - } else if (!this.level().isClientSide && this.getAge() == 0 && this.canFallInLove()) { -+ } else if (/*!this.level().isClientSide &&*/ this.getAge() == 0 && this.canFallInLove()) { // Plazma - Remove persist flag ++ } else if (/*!this.level().isClientSide &&*/ this.getAge() == 0 && this.canFallInLove()) { // Plazma - Remove persist 'isClientSide' flag final ItemStack breedCopy = itemstack.copy(); // Paper - Fix EntityBreedEvent copying this.usePlayerItem(player, hand, itemstack); this.setInLove(player, breedCopy); // Paper - Fix EntityBreedEvent copying +@@ -880,25 +880,19 @@ public class Panda extends Animal { + + @Override + public boolean canUse() { +- if (super.canUse() && this.panda.getUnhappyCounter() == 0) { +- if (!this.canFindBamboo()) { +- if (this.unhappyCooldown <= this.panda.tickCount) { +- this.panda.setUnhappyCounter(32); +- this.unhappyCooldown = this.panda.tickCount + 600; +- if (this.panda.isEffectiveAi()) { +- Player entityhuman = this.level.getNearestPlayer(Panda.BREED_TARGETING, this.panda); +- +- this.panda.lookAtPlayerGoal.setTarget(entityhuman); +- } +- } ++ // Plazma start - Remove persist 'isClientSide' flag ++ if (!super.canUse() && this.panda.getUnhappyCounter() != 0) return false; ++ if (this.canFindBamboo()) return true; + +- return false; +- } else { +- return true; +- } +- } else { +- return false; +- } ++ if (this.unhappyCooldown > this.panda.tickCount) return false; ++ ++ this.panda.setUnhappyCounter(32); ++ this.unhappyCooldown = this.panda.tickCount + 600; ++ Player player = this.level.getNearestPlayer(Panda.BREED_TARGETING, this.panda); ++ ++ this.panda.lookAtPlayerGoal.setTarget(player); ++ return false; ++ // Plazma end - Remove persist 'isClientSide' flag + } + + private boolean canFindBamboo() { diff --git a/src/main/java/net/minecraft/world/entity/animal/Parrot.java b/src/main/java/net/minecraft/world/entity/animal/Parrot.java -index 28a9d267099f6c24f71dc5a11179d59c27265a88..c8f167856eb7ae7b0c67c233cf3620d1c4e9693e 100644 +index 28a9d267099f6c24f71dc5a11179d59c27265a88..a0a55f1da46f8e9be4e2a776678333eb5f8e42f6 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java +++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java @@ -329,22 +329,22 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder data) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (Pig.DATA_BOOST_TIME.equals(data) && this.level().isClientSide) { this.steering.onSynced(); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag super.onSyncedDataUpdated(data); } @@ -1480,22 +2278,22 @@ index 7895fca01c20da24a10ac6a642ebba87f73f2799..77788af1ea3e6a03a5395f0920dc2408 if (!flag && this.isSaddled() && !this.isVehicle() && !player.isSecondaryUseActive()) { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag player.startRiding(this); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/entity/animal/PolarBear.java b/src/main/java/net/minecraft/world/entity/animal/PolarBear.java -index 86c44912a363401bdd716c22d24dfd7e92cfd0be..901f72367d0a9908b685eab2dbd8d1d25e6e761b 100644 +index 86c44912a363401bdd716c22d24dfd7e92cfd0be..19726aff2672cbf59a474ffefd34d9b836d92db9 100644 --- a/src/main/java/net/minecraft/world/entity/animal/PolarBear.java +++ b/src/main/java/net/minecraft/world/entity/animal/PolarBear.java @@ -263,6 +263,7 @@ public class PolarBear extends Animal implements NeutralMob { @Override public void tick() { super.tick(); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { if (this.clientSideStandAnimation != this.clientSideStandAnimationO) { this.refreshDimensions(); @@ -1503,22 +2301,22 @@ index 86c44912a363401bdd716c22d24dfd7e92cfd0be..901f72367d0a9908b685eab2dbd8d1d2 this.clientSideStandAnimation = Mth.clamp(this.clientSideStandAnimation - 1.0F, 0.0F, 6.0F); } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag if (this.warningSoundTicks > 0) { this.warningSoundTicks--; } - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.updatePersistentAnger((ServerLevel)this.level(), true); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag // Purpur start if (isStanding() && --standTimer <= 0) { diff --git a/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java b/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java -index c5a39ea2ad0e5e5ac434d79c1a57e0068b8bc809..1fc94919fc4b185d653dcbad26761e233789f72a 100644 +index c5a39ea2ad0e5e5ac434d79c1a57e0068b8bc809..992f1a4e870c245823baaf34a7bb5e177fa68633 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java +++ b/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java @@ -127,7 +127,7 @@ public class Pufferfish extends AbstractFish { @@ -1526,12 +2324,12 @@ index c5a39ea2ad0e5e5ac434d79c1a57e0068b8bc809..1fc94919fc4b185d653dcbad26761e23 @Override public void tick() { - if (!this.level().isClientSide && this.isAlive() && this.isEffectiveAi()) { -+ if (/*!this.level().isClientSide &&*/ this.isAlive() && this.isEffectiveAi()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.isAlive() /*&& this.isEffectiveAi()*/) { // Plazma - Remove persist 'isClientSide' flag if (this.inflateCounter > 0) { boolean increase = true; // Paper - Add PufferFishStateChangeEvent if (this.getPuffState() == 0) { diff --git a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java -index d8fa11a297ea2a183cac67c76b378ca912dba1f9..082004a11174ecd492da4a59de226bdd94da914c 100644 +index b3a0146ccfcda9fa33b91d33458086b510bb4d7b..034dec437d6a6df5664185de77245bd17fcdd59b 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java +++ b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java @@ -226,9 +226,9 @@ public class Rabbit extends Animal implements VariantHolder { @@ -1539,42 +2337,46 @@ index d8fa11a297ea2a183cac67c76b378ca912dba1f9..082004a11174ecd492da4a59de226bdd } - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.level().broadcastEntityEvent(this, (byte) 1); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java -index a13ce089bacfb6644eea81fbe7c6d640aedaea96..429ee7a2541441701797c42c21573010f2d58a88 100644 +index 38f651ab5f8e25e6d653a86dcb9875990651542a..0503f936d0d7194f110069adabff984f51af0a3a 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java +++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java -@@ -159,9 +159,11 @@ public class Sheep extends Animal implements Shearable { +@@ -157,6 +157,7 @@ public class Sheep extends Animal implements Shearable { + super.customServerAiStep(world); + } ++ /* // Plazma - Remove persist 'isClientSide' flag @Override public void aiStep() { -+ /* // Plazma - Remove persist flag if (this.level().isClientSide) { - this.eatAnimationTick = Math.max(0, this.eatAnimationTick - 1); - } -+ */ // Plazma - Remove persist flag +@@ -165,6 +166,7 @@ public class Sheep extends Animal implements Shearable { super.aiStep(); } ++ */ // Plazma - Remove persist 'isClientSide' flag + + public static AttributeSupplier.Builder createAttributes() { + return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 8.0D).add(Attributes.MOVEMENT_SPEED, 0.23000000417232513D); diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java -index 36a56553702fa6e4a2ac92b3639c210c94faee73..3aac04f12d95120c054abbf51936ba6a69494f16 100644 +index 36a56553702fa6e4a2ac92b3639c210c94faee73..012c2dafb5a4fc420a7fec58b472374b933c0ded 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Squid.java +++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java @@ -168,16 +168,18 @@ public class Squid extends AgeableWaterCreature { this.oldTentacleAngle = this.tentacleAngle; this.tentacleMovement = this.tentacleMovement + this.tentacleSpeed; if ((double)this.tentacleMovement > Math.PI * 2) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.tentacleMovement = (float) (Math.PI * 2); } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag this.tentacleMovement -= (float) (Math.PI * 2); if (this.random.nextInt(10) == 0) { this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; @@ -1582,16 +2384,40 @@ index 36a56553702fa6e4a2ac92b3639c210c94faee73..3aac04f12d95120c054abbf51936ba6a this.level().broadcastEntityEvent(this, (byte)19); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } if (this.isInWaterOrBubble()) { +@@ -186,9 +188,9 @@ public class Squid extends AgeableWaterCreature { + float f = this.tentacleMovement / (float) Math.PI; + this.tentacleAngle = Mth.sin(f * f * (float) Math.PI) * (float) Math.PI * 0.25F; + if ((double)f > 0.75) { +- if (this.isControlledByLocalInstance()) { ++ //if (this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag + this.setDeltaMovement(this.movementVector); +- } ++ //} // Plazma - Remove persist 'isClientSide' flag + + this.rotateSpeed = 1.0F; + } else { +@@ -196,9 +198,9 @@ public class Squid extends AgeableWaterCreature { + } + } else { + this.tentacleAngle = 0.0F; +- if (this.isControlledByLocalInstance()) { ++ //if (this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag + this.setDeltaMovement(this.getDeltaMovement().scale(0.9)); +- } ++ //} // Plazma - Remove persist 'isClientSide' flag + + this.rotateSpeed *= 0.99F; + } @@ -211,7 +213,7 @@ public class Squid extends AgeableWaterCreature { this.xBodyRot = this.xBodyRot + (-((float)Mth.atan2(d, vec3.y)) * (180.0F / (float)Math.PI) - this.xBodyRot) * 0.1F; } else { this.tentacleAngle = Mth.abs(Mth.sin(this.tentacleMovement)) * (float) Math.PI * 0.25F; - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag double e = this.getDeltaMovement().y; if (this.hasEffect(MobEffects.LEVITATION)) { e = 0.05 * (double)(this.getEffect(MobEffects.LEVITATION).getAmplifier() + 1); @@ -1600,12 +2426,37 @@ index 36a56553702fa6e4a2ac92b3639c210c94faee73..3aac04f12d95120c054abbf51936ba6a this.setDeltaMovement(0.0, e * 0.98F, 0.0); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag this.xBodyRot = this.xBodyRot + (-90.0F - this.xBodyRot) * 0.02F; } +@@ -259,9 +261,9 @@ public class Squid extends AgeableWaterCreature { + + @Override + public void travel(Vec3 movementInput) { +- if (this.isControlledByLocalInstance()) { ++ //if (this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag + this.move(MoverType.SELF, this.getDeltaMovement()); +- } ++ //} // Plazma - Remove persist 'isClientSide' flag + } + + @Override +diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java +index c9e307452a097329c26893673055cfb72a43e4c7..388c0068905e2ad138d5125ba17734b1be3a58fb 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java ++++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java +@@ -360,7 +360,7 @@ public class Turtle extends Animal { + + @Override + public void travel(Vec3 movementInput) { +- if (this.isControlledByLocalInstance() && this.isInWater()) { ++ if (/*this.isControlledByLocalInstance() &&*/ this.isInWater()) { // Plazma - Remove persist 'isClientSide' flag + this.moveRelative(0.1F, movementInput); + this.move(MoverType.SELF, this.getDeltaMovement()); + this.setDeltaMovement(this.getDeltaMovement().scale(0.9D)); diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java -index 499e3294f8dd19fb3802f521cb7d24d0998c8aeb..d6953cc2cd43e740106983730b1ef4f0f8d532a0 100644 +index 420345f130a40c4f59a021a4bdce3e218dc87cde..14d3e09e8eca665d186f5d356158052b118c6848 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java +++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java @@ -370,16 +370,16 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder, B this.handleAirSupply(i); } -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide()) { this.tickAnimations(); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } +@@ -522,7 +524,7 @@ public class Axolotl extends Animal implements VariantHolder, B + + @Override + public void travel(Vec3 movementInput) { +- if (this.isControlledByLocalInstance() && this.isInWater()) { ++ if (/*this.isControlledByLocalInstance() &&*/ this.isInWater()) { // Plazma - Remove persist 'isClientSide' flag + this.moveRelative(this.getSpeed(), movementInput); + this.move(MoverType.SELF, this.getDeltaMovement()); + this.setDeltaMovement(this.getDeltaMovement().scale(0.9D)); diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -index a8c68b4e17456221d601696571135a281eb1555e..a40cf6f771187515fc9b408f910f36fe9148355a 100644 +index 459a45f82c42b346a66bb1954e155a0970dcc30f..c11f9111933ec2e033cffcdf930983d505c3acab 100644 --- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -@@ -193,9 +193,11 @@ public class Camel extends AbstractHorse { +@@ -195,9 +195,11 @@ public class Camel extends AbstractHorse { } } -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide()) { this.setupAnimationStates(); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag if (this.refuseToMove()) { this.clampHeadRotationToBody(); -@@ -442,9 +444,9 @@ public class Camel extends AbstractHorse { +@@ -444,9 +446,9 @@ public class Camel extends AbstractHorse { if (flag2) { this.level().addParticle(ParticleTypes.HAPPY_VILLAGER, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 0.0D, 0.0D, 0.0D); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.ageUp(10); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } if (!flag && !flag1 && !flag2) { -@@ -670,9 +672,9 @@ public class Camel extends AbstractHorse { +@@ -672,9 +674,9 @@ public class Camel extends AbstractHorse { @Override public void openCustomInventoryScreen(Player player) { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag player.openHorseInventory(this, this.inventory); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -index 542cd59bb0eecac3845c3eefdd20e9105b1448c0..62991c7d1c4d62669adeb30b56c94b0e7d998ab2 100644 +index bd04af6311ca64d81c8829e731ac39a6486ee789..17ba0c6060ab56ab97b133565ebf86320ab52e1b 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -@@ -270,9 +270,11 @@ public class Frog extends Animal implements VariantHolder> { +@@ -269,6 +269,7 @@ public class Frog extends Animal implements VariantHolder> { + super.customServerAiStep(world); + } ++ /* // Plazma - Remove persist 'isClientSide' flag @Override public void tick() { -+ /* // Plazma - Remove persist flag if (this.level().isClientSide()) { - this.swimIdleAnimationState.animateWhen(this.isInWaterOrBubble() && !this.walkAnimation.isMoving(), this.tickCount); - } -+ */ // Plazma - Remove persist flag +@@ -277,6 +278,7 @@ public class Frog extends Animal implements VariantHolder> { super.tick(); } ++ */ // Plazma - Remove persist 'isClientSide' flag + + @Override + public void onSyncedDataUpdated(EntityDataAccessor data) { +@@ -418,7 +420,7 @@ public class Frog extends Animal implements VariantHolder> { + + @Override + public void travel(Vec3 movementInput) { +- if (this.isControlledByLocalInstance() && this.isInWater()) { ++ if (/*this.isControlledByLocalInstance() &&*/ this.isInWater()) { // Plazma - Remove persist 'isClientSide' flag + this.moveRelative(this.getSpeed(), movementInput); + this.move(MoverType.SELF, this.getDeltaMovement()); + this.setDeltaMovement(this.getDeltaMovement().scale(0.9)); diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java -index 7b9e7d3595bd6add8f76c4d9bf9758c78ecce962..b935c8ce4c7f5711e36e05838e7f762558c4e4e7 100644 +index 1b0e80ae62b5c5d4e1fcac71b90f83f12fe4878a..4b9e57c271b5b4bdaa92f8da7e0770e2c1adba96 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java -@@ -158,7 +158,7 @@ public class Tadpole extends AbstractFish { +@@ -159,7 +159,7 @@ public class Tadpole extends AbstractFish { @Override public void aiStep() { super.aiStep(); - if (!this.level().isClientSide && !this.ageLocked) { // Paper -+ if (/*!this.level().isClientSide &&*/ !this.ageLocked) { // Paper // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ !this.ageLocked) { // Paper // Plazma - Remove persist 'isClientSide' flag this.setAge(this.age + 1); } diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java -index b258be16f32ffd58ac8406deac9423cb01ca9a5c..bd01db6e0f3e70f52f0e5d0a0dd59ec0c7798f14 100644 +index b258be16f32ffd58ac8406deac9423cb01ca9a5c..71c3f9fdbf8f364e5112c505f53c4be6fdc1ad21 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java @@ -491,9 +491,9 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, @@ -1838,10 +2734,10 @@ index b258be16f32ffd58ac8406deac9423cb01ca9a5c..bd01db6e0f3e70f52f0e5d0a0dd59ec0 protected void syncSaddleToClients() { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.setFlag(4, !this.inventory.getItem(0).isEmpty()); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override @@ -1850,7 +2746,7 @@ index b258be16f32ffd58ac8406deac9423cb01ca9a5c..bd01db6e0f3e70f52f0e5d0a0dd59ec0 @Override public void openCustomInventoryScreen(Player player) { - if (!this.level().isClientSide && (!this.isVehicle() || this.hasPassenger((Entity) player)) && this.isTamed()) { -+ if (/*!this.level().isClientSide &&*/ (!this.isVehicle() || this.hasPassenger((Entity) player)) && this.isTamed()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ (!this.isVehicle() || this.hasPassenger((Entity) player)) && this.isTamed()) { // Plazma - Remove persist 'isClientSide' flag player.openHorseInventory(this, this.inventory); } @@ -1859,7 +2755,7 @@ index b258be16f32ffd58ac8406deac9423cb01ca9a5c..bd01db6e0f3e70f52f0e5d0a0dd59ec0 } - return (InteractionResult) (!flag && !this.level().isClientSide ? InteractionResult.PASS : InteractionResult.SUCCESS_SERVER); -+ return (InteractionResult) (!flag /*&& !this.level().isClientSide*/ ? InteractionResult.PASS : InteractionResult.SUCCESS_SERVER); // Plazma - Remove persist flag ++ return !flag /*&& !this.level().isClientSide*/ ? InteractionResult.PASS : InteractionResult.SUCCESS_SERVER; // Plazma - Remove persist 'isClientSide' flag } protected boolean handleEating(Player player, ItemStack item) { @@ -1868,7 +2764,7 @@ index b258be16f32ffd58ac8406deac9423cb01ca9a5c..bd01db6e0f3e70f52f0e5d0a0dd59ec0 short0 = 60; b0 = 5; - if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) { -+ if (/*!this.level().isClientSide &&*/ this.isTamed() && this.getAge() == 0 && !this.isInLove()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.isTamed() && this.getAge() == 0 && !this.isInLove()) { // Plazma - Remove persist 'isClientSide' flag flag = true; this.setInLove(player, item.copy()); // Paper - Fix EntityBreedEvent copying } @@ -1877,7 +2773,7 @@ index b258be16f32ffd58ac8406deac9423cb01ca9a5c..bd01db6e0f3e70f52f0e5d0a0dd59ec0 short0 = 240; b0 = 10; - if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) { -+ if (/*!this.level().isClientSide &&*/ this.isTamed() && this.getAge() == 0 && !this.isInLove()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.isTamed() && this.getAge() == 0 && !this.isInLove()) { // Plazma - Remove persist 'isClientSide' flag flag = true; this.setInLove(player, item.copy()); // Paper - Fix EntityBreedEvent copying } @@ -1886,15 +2782,15 @@ index b258be16f32ffd58ac8406deac9423cb01ca9a5c..bd01db6e0f3e70f52f0e5d0a0dd59ec0 if (this.isBaby() && short0 > 0) { this.level().addParticle(ParticleTypes.HAPPY_VILLAGER, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 0.0D, 0.0D, 0.0D); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.ageUp(short0); flag = true; - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } - if (b0 > 0 && (flag || !this.isTamed()) && this.getTemper() < this.getMaxTemper() && !this.level().isClientSide) { -+ if (b0 > 0 && (flag || !this.isTamed()) && this.getTemper() < this.getMaxTemper() /*&& !this.level().isClientSide*/) { // Plazma - Remove persist flag ++ if (b0 > 0 && (flag || !this.isTamed()) && this.getTemper() < this.getMaxTemper() /*&& !this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag this.modifyTemper(b0); flag = true; } @@ -1903,30 +2799,74 @@ index b258be16f32ffd58ac8406deac9423cb01ca9a5c..bd01db6e0f3e70f52f0e5d0a0dd59ec0 this.setEating(false); this.setStanding(false); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag player.setYRot(this.getYRot()); player.setXRot(this.getXRot()); player.startRiding(this); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } +@@ -768,7 +768,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, + this.setFlag(64, false); + } + +- if (this.isEffectiveAi() && this.standCounter > 0 && ++this.standCounter > 20) { ++ if (/*this.isEffectiveAi() &&*/ this.standCounter > 0 && ++this.standCounter > 20) { // Plazma - Remove persist 'isClientSide' flag + this.standCounter = 0; + this.setStanding(false); + } @@ -868,10 +868,10 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, } private void openMouth() { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.mouthCounter = 1; this.setFlag(64, true); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag + + } + +@@ -898,10 +898,12 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, + } + + public void standIfPossible() { +- if (this.canPerformRearing() && this.isEffectiveAi()) { +- this.standCounter = 1; +- this.setStanding(true); +- } ++ // Plazma start - Remove persist 'isClientSide' flag ++ if (!this.canPerformRearing()) return; ++ ++ this.standCounter = 1; ++ this.setStanding(true); ++ // Plazma end - Remove persist 'isClientSide' flag + + } + +@@ -931,7 +933,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, + + this.setRot(vec2f.y, vec2f.x); + this.yRotO = this.yBodyRot = this.yHeadRot = this.getYRot(); +- if (this.isControlledByLocalInstance()) { ++ //if (this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag + if (movementInput.z <= 0.0D) { + this.gallopSoundCounter = 0; + } +@@ -944,7 +946,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, + + this.playerJumpPendingScale = 0.0F; + } +- } ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java -index 8401c7ae749f6300281cbd6b2bfc77f03d5eb9ea..8a543b36c1fae5accf5a2703063af67bfddf9854 100644 +index 8401c7ae749f6300281cbd6b2bfc77f03d5eb9ea..818aa1e29392321533c0eb83b953a1231d430c84 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java @@ -267,18 +267,18 @@ public class Llama extends AbstractChestedHorse implements VariantHolder 0) { this.level().addParticle(ParticleTypes.HAPPY_VILLAGER, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 0.0D, 0.0D, 0.0D); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.ageUp(b0); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag flag = true; } @@ -1945,15 +2885,15 @@ index 8401c7ae749f6300281cbd6b2bfc77f03d5eb9ea..8a543b36c1fae5accf5a2703063af67b if (b1 > 0 && (flag || !this.isTamed()) && this.getTemper() < this.getMaxTemper()) { flag = true; - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.modifyTemper(b1); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } if (flag && !this.isSilent()) { diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/TraderLlama.java b/src/main/java/net/minecraft/world/entity/animal/horse/TraderLlama.java -index 1d765ad53a9d8dd388106bc0cb02f4919a1f8173..561b2c855a5c4f99447c85b040e0a43e4233b268 100644 +index 1d765ad53a9d8dd388106bc0cb02f4919a1f8173..40437c169a06c7dbf4950afcb575dec8adef33fa 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/TraderLlama.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/TraderLlama.java @@ -138,9 +138,9 @@ public class TraderLlama extends Llama { @@ -1961,50 +2901,69 @@ index 1d765ad53a9d8dd388106bc0cb02f4919a1f8173..561b2c855a5c4f99447c85b040e0a43e public void aiStep() { super.aiStep(); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.maybeDespawn(); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -index cd1845f6d7552670ae29c7a5b087220f3b4fc0e9..5d6202615f33c78e6a7d96fb53a7fd29c08fc5ab 100644 +index 0bc7856065fdc599890f18f5a4e2f6c2b3d94ba7..a108cba43a7272f53cd53b885dc03874fbf27ba4 100644 --- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -@@ -433,9 +433,11 @@ public class Sniffer extends Animal { +@@ -404,9 +404,11 @@ public class Sniffer extends Animal { + @Override + public void tick() { + switch (this.getState().ordinal()) { ++ /* // Plazma - Remove persist 'isClientSide' flag + case 4: + this.playSearchingSound(); + break; ++ */ // Plazma - Remove persist 'isClientSide' flag + case 5: + this.emitDiggingParticles(this.diggingAnimationState).dropSeed(); + } +@@ -432,12 +434,14 @@ public class Sniffer extends Animal { + this.level().playSound((Player) null, (Entity) this, SoundEvents.SNIFFER_EAT, SoundSource.NEUTRAL, 1.0F, Mth.randomBetween(this.level().random, 0.8F, 1.2F)); } ++ /* // Plazma - Remove persist 'isClientSide' flag private void playSearchingSound() { -+ /* // Plazma - Remove persist flag if (this.level().isClientSide() && this.tickCount % 20 == 0) { this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.SNIFFER_SEARCHING, this.getSoundSource(), 1.0F, 1.0F, false); } -+ */ // Plazma - Remove persist flag } - -diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -index e0e76b5abdb9650c3c50a3c8b49336977982fe67..da0754457087a4a6b3c76db87d0aa818ca927fd4 100644 ---- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -@@ -223,9 +223,11 @@ public class EnderDragon extends Mob implements Enemy { ++ */ // Plazma - Remove persist 'isClientSide' flag @Override - public void onFlap() { -+ /* // Plazma - Remove persist flag - if (this.level().isClientSide && !this.isSilent()) { - this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.ENDER_DRAGON_FLAP, this.getSoundSource(), 5.0F, 0.8F + this.random.nextFloat() * 0.3F, false); - } -+ */ // Plazma - Remove persist flag - + protected void playStepSound(BlockPos pos, BlockState state) { +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +index c9e3bb91ff506a35551a58f469ad2849e6058668..d779f62ef6cd4f396225317b24c601e0536a9a94 100644 +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +@@ -221,6 +221,7 @@ public class EnderDragon extends Mob implements Enemy { + return f1 <= -0.3F && f >= -0.3F; } ++ /* // Plazma - Remove persist 'isClientSide' flag + @Override + public void onFlap() { + if (this.level().isClientSide && !this.isSilent()) { +@@ -228,6 +229,7 @@ public class EnderDragon extends Mob implements Enemy { + } + + } ++ */ // Plazma - Remove persist 'isClientSide' flag + + @Override + protected void defineSynchedData(SynchedEntityData.Builder builder) { @@ -269,6 +271,7 @@ public class EnderDragon extends Mob implements Enemy { // Purpur end this.processFlappingMovement(); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.setHealth(this.getHealth()); if (!this.isSilent() && !this.phaseManager.getCurrentPhase().isSitting() && --this.growlTime < 0) { @@ -2012,7 +2971,7 @@ index e0e76b5abdb9650c3c50a3c8b49336977982fe67..da0754457087a4a6b3c76db87d0aa818 this.growlTime = 200 + this.random.nextInt(200); } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag if (this.dragonFight == null) { Level world = this.level(); @@ -2021,10 +2980,10 @@ index e0e76b5abdb9650c3c50a3c8b49336977982fe67..da0754457087a4a6b3c76db87d0aa818 } - if (!this.level().isClientSide()) { -+ //if (!this.level().isClientSide()) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide()) { // Plazma - Remove persist 'isClientSide' flag this.applyEffectsFromBlocks(); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag this.yBodyRot = this.getYRot(); Vec3[] avec3d = new Vec3[this.subEntities.length]; @@ -2032,16 +2991,16 @@ index e0e76b5abdb9650c3c50a3c8b49336977982fe67..da0754457087a4a6b3c76db87d0aa818 @Override public void onSyncedDataUpdated(EntityDataAccessor data) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (EnderDragon.DATA_PHASE.equals(data) && this.level().isClientSide) { this.phaseManager.setPhase(EnderDragonPhase.getById((Integer) this.getEntityData().get(EnderDragon.DATA_PHASE))); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag super.onSyncedDataUpdated(data); } diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager.java -index 5ed84f4199698dfe41abd7b9fc804bc3419078ef..58462e24d8490b71d5be8b3f3b3fdffb47552952 100644 +index 5ed84f4199698dfe41abd7b9fc804bc3419078ef..e17304fd16632d2f478cf89f90ca2da3537fefd8 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager.java @@ -43,11 +43,11 @@ public class EnderDragonPhaseManager { @@ -2049,59 +3008,77 @@ index 5ed84f4199698dfe41abd7b9fc804bc3419078ef..58462e24d8490b71d5be8b3f3b3fdffb this.currentPhase = this.getPhase(type); - if (!this.dragon.level().isClientSide) { -+ //if (!this.dragon.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.dragon.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.dragon.getEntityData().set(EnderDragon.DATA_PHASE, type.getId()); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag - EnderDragonPhaseManager.LOGGER.debug("Dragon is now in phase {} on the {}", type, this.dragon.level().isClientSide ? "client" : "server"); -+ EnderDragonPhaseManager.LOGGER.debug("Dragon is now in phase {} on the {}", type, /*this.dragon.level().isClientSide ? "client" :*/ "server"); // Plazma - Remove persist flag ++ EnderDragonPhaseManager.LOGGER.debug("Dragon is now in phase {} on the {}", type, /*this.dragon.level().isClientSide ? "client" :*/ "server"); // Plazma - Remove persist 'isClientSide' flag this.currentPhase.begin(); } } diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -index 026e730f67c58caf385070d57a2e199fca966a46..7c862d730d8062303046519a9601c62fe284e1ba 100644 +index 5e134b3cf939fe396c060797883613812ad73c31..05fb8b26369f7703c6a97f1764a71bd4c3fe1058 100644 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -314,7 +314,7 @@ public class WitherBoss extends Monster implements RangedAttackMob { +@@ -321,7 +321,7 @@ public class WitherBoss extends Monster implements RangedAttackMob { public void aiStep() { Vec3 vec3d = this.getDeltaMovement().multiply(1.0D, 0.6D, 1.0D); - if (!this.level().isClientSide && this.getAlternativeTarget(0) > 0) { -+ if (/*!this.level().isClientSide &&*/ this.getAlternativeTarget(0) > 0) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.getAlternativeTarget(0) > 0) { // Plazma - Remove persist 'isClientSide' flag Entity entity = this.level().getEntity(this.getAlternativeTarget(0)); if (entity != null) { diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index 037586c0fdb42a02660aba89dd741a647c67e52b..b6123d17e9fdd237e432cc90db57a8efe7d8bb12 100644 +index 037586c0fdb42a02660aba89dd741a647c67e52b..6230b5acc495b998e508a937d1e4c3889a3746c2 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -387,8 +387,8 @@ public class ArmorStand extends LivingEntity { +@@ -161,10 +161,12 @@ public class ArmorStand extends LivingEntity { + return !this.isMarker() && !this.isNoGravity(); + } + ++ /* // Plazma - Remove persist 'isClientSide' flag + @Override + public boolean isEffectiveAi() { + return super.isEffectiveAi() && this.hasPhysics(); + } ++ */ // Plazma - Remove persist 'isClientSide' flag + + @Override + protected void defineSynchedData(SynchedEntityData.Builder builder) { +@@ -387,8 +389,10 @@ public class ArmorStand extends LivingEntity { if (!this.isMarker() && !itemstack.is(Items.NAME_TAG)) { if (player.isSpectator()) { return InteractionResult.SUCCESS; -- } else if (player.level().isClientSide) { -- return InteractionResult.SUCCESS_SERVER; -+ //} else if (player.level().isClientSide) { // Plazma - Remove persist flag -+ // return InteractionResult.SUCCESS_SERVER; // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag + } else if (player.level().isClientSide) { + return InteractionResult.SUCCESS_SERVER; ++ */ // Plazma - Remove persist 'isClientSide' flag } else { net.minecraft.world.entity.EquipmentSlot enumitemslot = this.getEquipmentSlotForItem(itemstack); -@@ -572,10 +572,12 @@ public class ArmorStand extends LivingEntity { +@@ -571,15 +575,8 @@ public class ArmorStand extends LivingEntity { + @Override public void handleEntityEvent(byte status) { - if (status == 32) { -+ /* // Plazma - Remove persist flag - if (this.level().isClientSide) { - this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.ARMOR_STAND_HIT, this.getSoundSource(), 0.3F, 1.0F, false); - this.lastHit = this.level().getGameTime(); - } -+ */ // Plazma - Remove persist flag - } else { - super.handleEntityEvent(status); - } +- if (status == 32) { +- if (this.level().isClientSide) { +- this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.ARMOR_STAND_HIT, this.getSoundSource(), 0.3F, 1.0F, false); +- this.lastHit = this.level().getGameTime(); +- } +- } else { +- super.handleEntityEvent(status); +- } +- ++ if (status == 32) return; // Plazma - Remove persist 'isClientSide' flag ++ super.handleEntityEvent(status); // Plazma - Remove persist 'isClientSide' flag + } + + @Override diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java -index bd5e034ce58ebe53d2121209d76ae60134ce72fe..06c4ba6ff12d9e8579b568b82506a58de482a9c8 100644 +index bd5e034ce58ebe53d2121209d76ae60134ce72fe..27f7a0abf77e94f15ff5f42e54e979377c94e63c 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java @@ -419,7 +419,7 @@ public class ItemFrame extends HangingEntity { @@ -2109,66 +3086,183 @@ index bd5e034ce58ebe53d2121209d76ae60134ce72fe..06c4ba6ff12d9e8579b568b82506a58d if (this.fixed) { return InteractionResult.PASS; - } else if (!player.level().isClientSide) { -+ } //else if (!player.level().isClientSide) { // Plazma - Remove persist flag ++ } else /*if (!player.level().isClientSide)*/ { // Plazma - Remove persist 'isClientSide' flag if (!flag) { if (flag1 && !this.isRemoved()) { MapItemSavedData worldmap = MapItem.getSavedData(itemstack, this.level()); -@@ -454,9 +454,11 @@ public class ItemFrame extends HangingEntity { +@@ -454,9 +454,9 @@ public class ItemFrame extends HangingEntity { this.gameEvent(GameEvent.BLOCK_CHANGE, player); return InteractionResult.SUCCESS; } -+ /* // Plazma - Remove persist flag - } else { +- } else { ++ } /*else { // Plazma - Remove persist 'isClientSide' flag return (InteractionResult) (!flag && !flag1 ? InteractionResult.PASS : InteractionResult.SUCCESS); - } -+ */ // Plazma - Remove persist flag +- } ++ }*/ // Plazma - Remove persist 'isClientSide' flag } public SoundEvent getRotateItemSound() { diff --git a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java -index d3a7953a3f42a0020342845e9107c6991637b050..7f0d040d645a096891bc8d251b69522796404aec 100644 +index d3a7953a3f42a0020342845e9107c6991637b050..650af7be38e9ba8e81ac991689ffa0a444e7f94b 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java +++ b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java -@@ -75,9 +75,11 @@ public class LeashFenceKnotEntity extends BlockAttachedEntity { +@@ -75,80 +75,72 @@ public class LeashFenceKnotEntity extends BlockAttachedEntity { @Override public InteractionResult interact(Player player, InteractionHand hand) { -+ /* // Plazma - Remove persist flag - if (this.level().isClientSide) { - return InteractionResult.SUCCESS; - } else { -+ */ // Plazma - Remove persist flag - boolean flag = false; - List list = LeadItem.leashableInArea(this.level(), this.getPos(), (leashable) -> { - Entity entity = leashable.getLeashHolder(); -@@ -148,7 +150,7 @@ public class LeashFenceKnotEntity extends BlockAttachedEntity { +- if (this.level().isClientSide) { +- return InteractionResult.SUCCESS; +- } else { +- boolean flag = false; +- List list = LeadItem.leashableInArea(this.level(), this.getPos(), (leashable) -> { +- Entity entity = leashable.getLeashHolder(); +- +- return entity == player || entity == this; +- }); +- Iterator iterator = list.iterator(); +- +- while (iterator.hasNext()) { +- Leashable leashable = (Leashable) iterator.next(); +- +- if (leashable.getLeashHolder() == player) { +- // CraftBukkit start +- if (leashable instanceof Entity leashed) { +- if (CraftEventFactory.callPlayerLeashEntityEvent(leashed, this, player, hand).isCancelled()) { +- ((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(leashed, leashable.getLeashHolder())); +- flag = true; // Also set true when the event is cancelled otherwise it tries to unleash the entities +- continue; +- } +- } +- // CraftBukkit end +- leashable.setLeashedTo(this, true); +- flag = true; +- } ++ // Plazma start - Remove persist 'isClientSide' flag & Apply some optimizations ++ boolean flag = false; ++ List list = LeadItem.leashableInArea(this.level(), this.getPos(), (leashable) -> { ++ Entity entity = leashable.getLeashHolder(); ++ ++ return entity == player || entity == this; ++ }); ++ ++ Iterator iterator = list.iterator(); ++ while (iterator.hasNext()) { ++ Leashable leashable = (Leashable) iterator.next(); ++ ++ if (leashable.getLeashHolder() != player) continue; ++ ++ // CraftBukkit start ++ if (leashable instanceof Entity entity && CraftEventFactory.callPlayerLeashEntityEvent(entity, this, player, hand).isCancelled()) { ++ ((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(leashed, leashable.getLeashHolder())); ++ flag = true; // Also set true when the event is cancelled otherwise it tries to unleash the entities ++ continue; + } ++ // CraftBukkit end + +- boolean flag1 = false; ++ leashable.setLeashedTo(this, true); ++ flag = true; ++ } + +- if (!flag) { +- // CraftBukkit start - Move below +- // this.discard(); +- boolean die = true; +- // CraftBukkit end +- if (true || player.getAbilities().instabuild) { // CraftBukkit - Process for non-creative as well +- Iterator iterator1 = list.iterator(); +- +- while (iterator1.hasNext()) { +- Leashable leashable1 = (Leashable) iterator1.next(); +- +- if (leashable1.isLeashed() && leashable1.getLeashHolder() == this) { +- // CraftBukkit start +- boolean dropLeash = !player.hasInfiniteMaterials(); +- if (leashable1 instanceof Entity leashed) { +- // Paper start - Expand EntityUnleashEvent +- org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(leashed, player, hand, dropLeash); +- dropLeash = event.isDropLeash(); +- if (event.isCancelled()) { +- // Paper end - Expand EntityUnleashEvent +- die = false; +- continue; +- } +- } +- leashable1.dropLeash(true, dropLeash); // false -> survival mode boolean // Paper - Expand EntityUnleashEvent +- // CraftBukkit end +- flag1 = true; +- } +- } +- // CraftBukkit start +- if (die) { +- this.discard(EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause ++ boolean flag1 = false; ++ if (!flag) { ++ // CraftBukkit start - Move below ++ // this.discard(); ++ boolean die = true; ++ // CraftBukkit end ++ ++ Iterator iterator1 = list.iterator(); ++ while (iterator1.hasNext()) { ++ Leashable leashable = (Leashable) iterator1.next(); ++ ++ if (!leashable.isLeashed() || leashable.getLeashHolder() != this) continue; ++ ++ // CraftBukkit start ++ boolean dropLeash = !player.hasInfiniteMaterials(); ++ if (leashable instanceof Entity entity) { ++ // Paper start - Expand EntityUnleashEvent ++ org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(entity, player, hand, dropLeash); ++ if (event.isCancelled()) { ++ die = false; ++ continue; + } +- // CraftBukkit end ++ ++ dropLeash = event.isDropLeash(); ++ // Paper end - Expand EntityUnleashEvent + } +- } + +- if (flag || flag1) { +- this.gameEvent(GameEvent.BLOCK_ATTACH, player); ++ leashable.dropLeash(true, dropLeash); // false -> survival mode boolean // Paper - Expand EntityUnleashEvent ++ // CraftBukkit end ++ ++ flag1 = true; } - return InteractionResult.SUCCESS; -- } -+ //} // Plazma - Remove persist flag +- return InteractionResult.SUCCESS; ++ if (die) this.discard(EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause + } ++ ++ if (flag || flag1) this.gameEvent(GameEvent.BLOCK_ATTACH, player); ++ ++ return InteractionResult.SUCCESS; ++ // Plazma end - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index c63cf322e0d00b5ec9929db8c22d4a392049160f..43061792322597ad9b6a677e58d2f1ce0a916a8c 100644 +index c63cf322e0d00b5ec9929db8c22d4a392049160f..8c5dff4e24c1366d583ba9c7c2c15ea166a24933 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -178,14 +178,16 @@ public class ItemEntity extends Entity implements TraceableEntity { this.applyGravity(); } -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.noPhysics = false; } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag this.noPhysics = !this.level().noCollision(this, this.getBoundingBox().deflate(1.0E-7D)); if (this.noPhysics) { this.moveTowardsClosestSpace(this.getX(), (this.getBoundingBox().minY + this.getBoundingBox().maxY) / 2.0D, this.getZ()); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag if (!this.onGround() || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) { // Paper - Diff on change; ActivationRange immunity this.move(MoverType.SELF, this.getDeltaMovement()); @@ -2177,69 +3271,199 @@ index c63cf322e0d00b5ec9929db8c22d4a392049160f..43061792322597ad9b6a677e58d2f1ce int i = flag ? 2 : 40; - if (this.tickCount % i == 0 && !this.level().isClientSide && this.isMergable()) { -+ if (this.tickCount % i == 0 /*&& !this.level().isClientSide*/ && this.isMergable()) { // Plazma - Remove persist flag ++ if (this.tickCount % i == 0 && /*!this.level().isClientSide &&*/ this.isMergable()) { // Plazma - Remove persist 'isClientSide' flag this.mergeWithNeighbours(); } -@@ -224,16 +226,16 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -224,15 +226,15 @@ public class ItemEntity extends Entity implements TraceableEntity { // CraftBukkit end */ this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing(); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag double d0 = this.getDeltaMovement().subtract(vec3d).lengthSqr(); if (d0 > 0.01D) { this.hasImpulse = true; } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag - if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate -- // CraftBukkit start - fire ItemDespawnEvent -+ if (/*!this.level().isClientSide &&*/ this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate -+ // CraftBukkit start - fire ItemDespawnEvent // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate // Plazma - Remove persist 'isClientSide' flag + // CraftBukkit start - fire ItemDespawnEvent if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { this.age = 0; - return; @@ -257,7 +259,7 @@ public class ItemEntity extends Entity implements TraceableEntity { } // Paper end - remove anti tick skipping measures / wall time - copied from above - if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate -+ if (/*!this.level().isClientSide &&*/ this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start - fire ItemDespawnEvent if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { this.age = 0; -@@ -496,7 +498,7 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -496,87 +498,78 @@ public class ItemEntity extends Entity implements TraceableEntity { @Override public void playerTouch(net.minecraft.world.entity.player.Player player) { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag - ItemStack itemstack = this.getItem(); - Item item = itemstack.getItem(); - int i = itemstack.getCount(); -@@ -576,7 +578,7 @@ public class ItemEntity extends Entity implements TraceableEntity { - player.onItemPickup(this); +- ItemStack itemstack = this.getItem(); +- Item item = itemstack.getItem(); +- int i = itemstack.getCount(); +- +- // CraftBukkit start - fire PlayerPickupItemEvent +- int canHold = player.getInventory().canHold(itemstack); +- int remaining = i - canHold; +- boolean flyAtPlayer = false; // Paper +- +- // Paper start - PlayerAttemptPickupItemEvent +- if (this.pickupDelay <= 0) { +- PlayerAttemptPickupItemEvent attemptEvent = new PlayerAttemptPickupItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); +- this.level().getCraftServer().getPluginManager().callEvent(attemptEvent); +- +- flyAtPlayer = attemptEvent.getFlyAtPlayer(); +- if (attemptEvent.isCancelled()) { +- if (flyAtPlayer) { +- player.take(this, i); +- } ++ // Plazma start - Remove persist 'isClientSide' flag & Apply some optimizations ++ ItemStack itemstack = this.getItem(); ++ Item item = itemstack.getItem(); ++ int i = itemstack.getCount(); + +- return; +- } +- } +- // Paper end - PlayerAttemptPickupItemEvent +- +- if (this.pickupDelay <= 0 && canHold > 0) { +- itemstack.setCount(canHold); +- // Call legacy event +- PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); +- playerEvent.setCancelled(!playerEvent.getPlayer().getCanPickupItems()); +- this.level().getCraftServer().getPluginManager().callEvent(playerEvent); +- flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper +- if (playerEvent.isCancelled()) { +- itemstack.setCount(i); // SPIGOT-5294 - restore count +- // Paper start +- if (flyAtPlayer) { +- player.take(this, i); +- } +- // Paper end +- return; +- } ++ // CraftBukkit start - fire PlayerPickupItemEvent ++ int canHold = player.getInventory().canHold(itemstack); ++ int remaining = i - canHold; ++ boolean flyAtPlayer = false; // Paper + +- // Call newer event afterwards +- EntityPickupItemEvent entityEvent = new EntityPickupItemEvent((Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); +- entityEvent.setCancelled(!entityEvent.getEntity().getCanPickupItems()); +- this.level().getCraftServer().getPluginManager().callEvent(entityEvent); +- if (entityEvent.isCancelled()) { +- itemstack.setCount(i); // SPIGOT-5294 - restore count +- return; +- } ++ // Paper start - PlayerAttemptPickupItemEvent ++ if (this.pickupDelay <= 0) { ++ PlayerAttemptPickupItemEvent attemptEvent = new PlayerAttemptPickupItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); ++ this.level().getCraftServer().getPluginManager().callEvent(attemptEvent); + +- // Update the ItemStack if it was changed in the event +- ItemStack current = this.getItem(); +- if (!itemstack.equals(current)) { +- itemstack = current; +- } else { +- itemstack.setCount(canHold + remaining); // = i +- } ++ flyAtPlayer = attemptEvent.getFlyAtPlayer(); ++ if (attemptEvent.isCancelled()) { ++ if (flyAtPlayer) player.take(this, i); + +- // Possibly < 0; fix here so we do not have to modify code below +- this.pickupDelay = 0; +- } else if (this.pickupDelay == 0) { +- // ensure that the code below isn't triggered if canHold says we can't pick the items up +- this.pickupDelay = -1; ++ return; + } +- // CraftBukkit end ++ } ++ // Paper end - PlayerAttemptPickupItemEvent ++ ++ if (this.pickupDelay <= 0 && canHold > 0) { ++ itemstack.setCount(canHold); ++ // Call legacy event ++ PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); ++ playerEvent.setCancelled(!playerEvent.getPlayer().getCanPickupItems()); ++ this.level().getCraftServer().getPluginManager().callEvent(playerEvent); ++ flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper ++ if (playerEvent.isCancelled()) { ++ itemstack.setCount(i); // SPIGOT-5294 - restore count ++ if (flyAtPlayer) player.take(this, i); // Paper + +- if (this.pickupDelay == 0 && (this.target == null || this.target.equals(player.getUUID())) && player.getInventory().add(itemstack)) { +- if (flyAtPlayer) // Paper - PlayerPickupItemEvent +- player.take(this, i); +- if (itemstack.isEmpty()) { +- this.discard(EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause +- itemstack.setCount(i); +- } ++ return; ++ } ++ ++ // Call newer event afterwards ++ EntityPickupItemEvent entityEvent = new EntityPickupItemEvent((Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); ++ entityEvent.setCancelled(!entityEvent.getEntity().getCanPickupItems()); ++ this.level().getCraftServer().getPluginManager().callEvent(entityEvent); ++ if (entityEvent.isCancelled()) { ++ itemstack.setCount(i); // SPIGOT-5294 - restore count ++ return; ++ } ++ ++ // Update the ItemStack if it was changed in the event ++ ItemStack current = this.getItem(); ++ if (!itemstack.equals(current)) itemstack = current; ++ else itemstack.setCount(canHold + remaining); // = i ++ ++ // Possibly < 0; fix here so we do not have to modify code below ++ this.pickupDelay = 0; ++ } else if (this.pickupDelay == 0) { ++ // ensure that the code below isn't triggered if canHold says we can't pick the items up ++ this.pickupDelay = -1; ++ } ++ // CraftBukkit end ++ ++ if (this.pickupDelay == 0 && (this.target == null || this.target.equals(player.getUUID())) && player.getInventory().add(itemstack)) { ++ if (flyAtPlayer) player.take(this, i); // Paper - PlayerPickupItemEvent + +- player.awardStat(Stats.ITEM_PICKED_UP.get(item), i); +- player.onItemPickup(this); ++ if (itemstack.isEmpty()) { ++ this.discard(EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause ++ itemstack.setCount(i); } -- } -+ //} // Plazma - Remove persist flag ++ player.awardStat(Stats.ITEM_PICKED_UP.get(item), i); ++ player.onItemPickup(this); + } ++ // Plazma end - Remove persist 'isClientSide' flag & Apply some optimizations } @Override -@@ -596,7 +598,7 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -596,7 +589,7 @@ public class ItemEntity extends Entity implements TraceableEntity { public Entity teleport(TeleportTransition teleportTarget) { Entity entity = super.teleport(teleportTarget); - if (!this.level().isClientSide && entity instanceof ItemEntity entityitem) { -+ if (/*!this.level().isClientSide &&*/ entity instanceof ItemEntity entityitem) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ entity instanceof ItemEntity entityitem) { // Plazma - Remove persist 'isClientSide' flag entityitem.mergeWithNeighbours(); } diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java -index 287ba483614e79e78022e703ef891f59f41ac455..d8d14da11254a67544ef4035ba29a455e70c9dac 100644 +index 287ba483614e79e78022e703ef891f59f41ac455..1273d5027d806f655e7c5e2d65b7a8e0182de185 100644 --- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java @@ -123,16 +123,18 @@ public class PrimedTnt extends Entity implements TraceableEntity { @@ -2247,24 +3471,24 @@ index 287ba483614e79e78022e703ef891f59f41ac455..d8d14da11254a67544ef4035ba29a455 // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event // this.discard(); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.explode(); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause // CraftBukkit end } else { this.updateInWaterStateAndDoFluidPushing(); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5D, this.getZ(), 0.0D, 0.0D, 0.0D); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } // Paper start - Option to prevent TNT from moving in water diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java -index 39d02cf0e31832e30c4f034b0b5385e3e0057e60..4a389323d2ba15b282217ec54c52f5c278f79ff6 100644 +index 39d02cf0e31832e30c4f034b0b5385e3e0057e60..41c6b60a9d0210b7f2c660cc03999be9c9bc344e 100644 --- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java @@ -148,7 +148,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo @@ -2272,7 +3496,7 @@ index 39d02cf0e31832e30c4f034b0b5385e3e0057e60..4a389323d2ba15b282217ec54c52f5c2 public void reassessWeaponGoal() { - if (this.level() != null && !this.level().isClientSide) { -+ if (this.level() != null /*&& !this.level().isClientSide*/) { // Plazma - Remove persist flag ++ if (this.level() != null /*&& !this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag this.goalSelector.removeGoal(this.meleeGoal); this.goalSelector.removeGoal(this.bowGoal); ItemStack itemstack = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)); @@ -2281,22 +3505,22 @@ index 39d02cf0e31832e30c4f034b0b5385e3e0057e60..4a389323d2ba15b282217ec54c52f5c2 public void setItemSlot(EquipmentSlot slot, ItemStack stack, boolean silent) { // Paper - Fix silent equipment change super.setItemSlot(slot, stack, silent); // Paper - Fix silent equipment change - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.reassessWeaponGoal(); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/monster/Blaze.java b/src/main/java/net/minecraft/world/entity/monster/Blaze.java -index 07db4557ab0d7a4a0f5432257bd18195d2de7255..cac9e15f1a36fa187b09d908be19e72729cb8c40 100644 +index 07db4557ab0d7a4a0f5432257bd18195d2de7255..b6278a2914a96ef4db03d3f6d0620d376268af82 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Blaze.java +++ b/src/main/java/net/minecraft/world/entity/monster/Blaze.java @@ -135,6 +135,7 @@ public class Blaze extends Monster { this.setDeltaMovement(this.getDeltaMovement().multiply(1.0, 0.6, 1.0)); } -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { if (this.random.nextInt(24) == 0 && !this.isSilent()) { this.level() @@ -2304,12 +3528,12 @@ index 07db4557ab0d7a4a0f5432257bd18195d2de7255..cac9e15f1a36fa187b09d908be19e727 this.level().addParticle(ParticleTypes.LARGE_SMOKE, this.getRandomX(0.5), this.getRandomY(), this.getRandomZ(0.5), 0.0, 0.0, 0.0); } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag super.aiStep(); } diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java -index 38cbe2fce9c36195aa9bea2af26d14364b216825..058ca0f7b85754950ddbb014958c1b90f15f8549 100644 +index 38cbe2fce9c36195aa9bea2af26d14364b216825..3b2560ee1bb8c415eada619fc057d35ccb0e2ab0 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java +++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java @@ -356,7 +356,7 @@ public class Creeper extends Monster { @@ -2317,7 +3541,7 @@ index 38cbe2fce9c36195aa9bea2af26d14364b216825..058ca0f7b85754950ddbb014958c1b90 this.level().playSound(player, this.getX(), this.getY(), this.getZ(), soundeffect, this.getSoundSource(), 1.0F, this.random.nextFloat() * 0.4F + 0.8F); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.entityIgniter = player; // CraftBukkit this.ignite(); if (itemstack.getMaxDamage() == 0) { // CraftBukkit - fix MC-264285: unbreakable flint and steels are completely consumed when igniting a creeper @@ -2326,45 +3550,55 @@ index 38cbe2fce9c36195aa9bea2af26d14364b216825..058ca0f7b85754950ddbb014958c1b90 itemstack.hurtAndBreak(1, player, getSlotForHand(hand)); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java -index 949207eda199c874f2f14074b5a4fff5462b86b9..de3d91891000c599950e31da595c254a3b421e7a 100644 +index 949207eda199c874f2f14074b5a4fff5462b86b9..19bc362ff8e28cd0e26ba357dda425bac24c5a56 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java +++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java -@@ -290,7 +290,7 @@ public class Drowned extends Zombie implements RangedAttackMob { +@@ -279,7 +279,7 @@ public class Drowned extends Zombie implements RangedAttackMob { + + @Override + public void travel(Vec3 movementInput) { +- if (this.isControlledByLocalInstance() && this.isUnderWater() && this.wantsToSwim()) { ++ if (/*this.isControlledByLocalInstance() &&*/ this.isUnderWater() && this.wantsToSwim()) { // Plazma - Remove persist 'isClientSide' flag + this.moveRelative(0.01F, movementInput); + this.move(MoverType.SELF, this.getDeltaMovement()); + this.setDeltaMovement(this.getDeltaMovement().scale(0.9)); +@@ -290,15 +290,15 @@ public class Drowned extends Zombie implements RangedAttackMob { @Override public void updateSwimming() { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag - if (this.isEffectiveAi() && this.isUnderWater() && this.wantsToSwim()) { +- if (this.isEffectiveAi() && this.isUnderWater() && this.wantsToSwim()) { ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag ++ if (/*this.isEffectiveAi() &&*/ this.isUnderWater() && this.wantsToSwim()) { // Plazma - Remove persist 'isClientSide' flag this.navigation = this.waterNavigation; this.setSwimming(true); -@@ -298,7 +298,7 @@ public class Drowned extends Zombie implements RangedAttackMob { + } else { this.navigation = this.groundNavigation; this.setSwimming(false); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -index 39ec4b00c6254824632b37ea9824ae9ff84cdb20..fbf08c9041e07f49f1fc2f869ea2f5ba795bc7ff 100644 +index 476aaa0d9899eb56ea29b1fcf15565b58f78479d..d57f6b312341f6d83788bbb294cc65ee47361373 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java @@ -228,9 +228,11 @@ public class EnderMan extends Monster implements NeutralMob { @Override public void onSyncedDataUpdated(EntityDataAccessor data) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (EnderMan.DATA_CREEPY.equals(data) && this.hasBeenStaredAt() && this.level().isClientSide) { this.playStareSound(); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag super.onSyncedDataUpdated(data); } @@ -2372,20 +3606,20 @@ index 39ec4b00c6254824632b37ea9824ae9ff84cdb20..fbf08c9041e07f49f1fc2f869ea2f5ba @Override public void aiStep() { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { for (int i = 0; i < 2; ++i) { this.level().addParticle(ParticleTypes.PORTAL, this.getRandomX(0.5D), this.getRandomY() - 0.25D, this.getRandomZ(0.5D), (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D); } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag this.jumping = false; - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.updatePersistentAnger((ServerLevel) this.level(), true); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag super.aiStep(); } @@ -2394,25 +3628,25 @@ index 39ec4b00c6254824632b37ea9824ae9ff84cdb20..fbf08c9041e07f49f1fc2f869ea2f5ba public boolean teleport() { - if (!this.level().isClientSide() && this.isAlive()) { -+ if (/*!this.level().isClientSide() &&*/ this.isAlive()) { ++ if (/*!this.level().isClientSide() &&*/ this.isAlive()) { // Plazma - Remove persist 'isClientSide' flag double d0 = this.getX() + (this.random.nextDouble() - 0.5D) * 64.0D; double d1 = this.getY() + (double) (this.random.nextInt(64) - 32); double d2 = this.getZ() + (this.random.nextDouble() - 0.5D) * 64.0D; diff --git a/src/main/java/net/minecraft/world/entity/monster/Endermite.java b/src/main/java/net/minecraft/world/entity/monster/Endermite.java -index f8373fc9839fccb31e3dd090de70e2cd7c9e6cfc..57158457f7d0e6a785df9fe19204d73d6b918e79 100644 +index f8373fc9839fccb31e3dd090de70e2cd7c9e6cfc..063954513b5c69047298a98224d7e099e18588bf 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Endermite.java +++ b/src/main/java/net/minecraft/world/entity/monster/Endermite.java @@ -152,11 +152,13 @@ public class Endermite extends Monster { @Override public void aiStep() { super.aiStep(); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { for (int i = 0; i < 2; ++i) { this.level().addParticle(ParticleTypes.PORTAL, this.getRandomX(0.5D), this.getRandomY(), this.getRandomZ(0.5D), (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D); } } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag if (!this.isPersistenceRequired()) { ++this.life; } @@ -2421,40 +3655,35 @@ index f8373fc9839fccb31e3dd090de70e2cd7c9e6cfc..57158457f7d0e6a785df9fe19204d73d this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/monster/Guardian.java b/src/main/java/net/minecraft/world/entity/monster/Guardian.java -index da833bf35342f771ecccd5dcac4fe87f72d047b0..25a954f5a7286584d95d67994f328f22c25681f1 100644 +index da833bf35342f771ecccd5dcac4fe87f72d047b0..dee45687c0630cdd98e3083eeff9670a364aa50b 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Guardian.java +++ b/src/main/java/net/minecraft/world/entity/monster/Guardian.java -@@ -165,7 +165,8 @@ public class Guardian extends Monster { +@@ -165,6 +165,7 @@ public class Guardian extends Monster { public LivingEntity getActiveAttackTarget() { if (!this.hasActiveAttackTarget()) { return null; -- } else if (this.level().isClientSide) { -+ -+ } /*else if (this.level().isClientSide) { // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag + } else if (this.level().isClientSide) { if (this.clientSideCachedAttackTarget != null) { return this.clientSideCachedAttackTarget; - } else { -@@ -179,8 +180,9 @@ public class Guardian extends Monster { +@@ -178,6 +179,7 @@ public class Guardian extends Monster { + return null; } } ++ */ // Plazma - Remove persist 'isClientSide' flag } else { -+ */ // Plazma - Remove persist flag return this.getTarget(); -- } -+ //} // Plazma - Remove persist flag - } - - @Override + } @@ -226,6 +228,7 @@ public class Guardian extends Monster { @Override public void aiStep() { if (this.isAlive()) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.clientSideTailAnimationO = this.clientSideTailAnimation; Vec3 vec3d; @@ -2462,39 +3691,61 @@ index da833bf35342f771ecccd5dcac4fe87f72d047b0..25a954f5a7286584d95d67994f328f22 } } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag if (this.isInWaterOrBubble()) { this.setAirSupply(300); +@@ -367,7 +371,7 @@ public class Guardian extends Monster { + + @Override + public void travel(Vec3 movementInput) { +- if (this.isControlledByLocalInstance() && this.isInWater()) { ++ if (/*this.isControlledByLocalInstance() &&*/ this.isInWater()) { // Plazma - Remove persist 'isClientSide' flag + this.moveRelative(getRider() != null && this.isControllable() ? getSpeed() : 0.1F, movementInput); // Purpur + this.move(MoverType.SELF, this.getDeltaMovement()); + this.setDeltaMovement(this.getDeltaMovement().scale(0.9D)); diff --git a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java -index 2ca241344efc6320d2018bdc772f74470080eeed..24b712b8f2671b8e3ba9ba1114798ad696d154e0 100644 +index 2ca241344efc6320d2018bdc772f74470080eeed..0397a6e7d5031aba20dd2e243f8f143078c68fed 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java +++ b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java -@@ -127,6 +127,7 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob { +@@ -124,6 +124,7 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob { + return super.finalizeSpawn(world, difficulty, spawnReason, entityData); + } + ++ /* // Plazma - Remove persist 'isClientSide' flag @Override public void aiStep() { super.aiStep(); -+ /* // Plazma - Remove persist flag - if (this.level().isClientSide && this.isInvisible()) { - --this.clientSideIllusionTicks; - if (this.clientSideIllusionTicks < 0) { -@@ -161,6 +162,7 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob { - this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.ILLUSIONER_MIRROR_MOVE, this.getSoundSource(), 1.0F, 1.0F, false); - } +@@ -163,6 +164,7 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob { } -+ */ // Plazma - Remove persist flag } ++ */ // Plazma - Remove persist 'isClientSide' flag + @Override + public SoundEvent getCelebrateSound() { +diff --git a/src/main/java/net/minecraft/world/entity/monster/MagmaCube.java b/src/main/java/net/minecraft/world/entity/monster/MagmaCube.java +index 63caf20256a3deae98b9cd9f54650def172f0e57..ccb32a521160ffaf45b947422819629da7f82ddb 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/MagmaCube.java ++++ b/src/main/java/net/minecraft/world/entity/monster/MagmaCube.java +@@ -139,7 +139,7 @@ public class MagmaCube extends Slime { + + @Override + protected boolean isDealsDamage() { +- return this.isEffectiveAi(); ++ return true; //this.isEffectiveAi(); // Plazma - Remove persist 'isClientSide' flag + } + + @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -index cda6cb5b10b895bab48d2212f259ba4ca40e1ed6..e973d8de70ec1269e663a5b6713545235468f293 100644 +index cda6cb5b10b895bab48d2212f259ba4ca40e1ed6..80647c433bd94450db2b6d48d6d5b952a8dd9a6c 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java @@ -232,6 +232,7 @@ public class Phantom extends FlyingMob implements Enemy { @Override public void tick() { super.tick(); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { float f = Mth.cos((float) (this.getUniqueFlapTickOffset() + this.tickCount) * 7.448451F * 0.017453292F + 3.1415927F); float f1 = Mth.cos((float) (this.getUniqueFlapTickOffset() + this.tickCount + 1) * 7.448451F * 0.017453292F + 3.1415927F); @@ -2502,12 +3753,25 @@ index cda6cb5b10b895bab48d2212f259ba4ca40e1ed6..e973d8de70ec1269e663a5b671354523 this.level().addParticle(ParticleTypes.MYCELIUM, this.getX() + (double) f3, this.getY() + (double) f5, this.getZ() + (double) f4, 0.0D, 0.0D, 0.0D); this.level().addParticle(ParticleTypes.MYCELIUM, this.getX() - (double) f3, this.getY() + (double) f5, this.getZ() - (double) f4, 0.0D, 0.0D, 0.0D); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag if (level().purpurConfig.phantomFlamesOnSwoop && attackPhase == AttackPhase.SWOOP) shoot(); // Purpur } +diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java +index 98c1934b4895a86cd8748edf906aaa721a87a123..991d3eb79770c5809e92768bc8e51d42aab69e2e 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java +@@ -57,7 +57,7 @@ public class Ravager extends Raider { + return Ravager.ROAR_TARGET_WITH_GRIEFING.test(entity) && !entity.getType().equals(EntityType.ARMOR_STAND); + }; + private static final Predicate ROAR_TARGET_ON_CLIENT = (entityliving) -> { +- return !(entityliving instanceof Ravager) && entityliving.isAlive() && entityliving.isControlledByLocalInstance(); ++ return !(entityliving instanceof Ravager) && entityliving.isAlive(); //&& entityliving.isControlledByLocalInstance(); // Plazma - Remove persist 'isClientSide' flag + }; + private static final double BASE_MOVEMENT_SPEED = 0.3D; + private static final double ATTACK_MOVEMENT_SPEED = 0.35D; diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java -index e3fefd52c83079fe3eab1a96dd81a183f718192b..7a5279a21d05a4de232c67afb9891d90feabe232 100644 +index e3fefd52c83079fe3eab1a96dd81a183f718192b..2282b7d57a14c16f65afae7d084f0d42a6078165 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java +++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java @@ -229,7 +229,7 @@ public class Shulker extends AbstractGolem implements VariantHolder 0) { --this.clientSideTeleportInterpolation; @@ -2531,7 +3795,7 @@ index e3fefd52c83079fe3eab1a96dd81a183f718192b..7a5279a21d05a4de232c67afb9891d90 this.clientOldAttachPosition = null; } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } @@ -2539,12 +3803,12 @@ index e3fefd52c83079fe3eab1a96dd81a183f718192b..7a5279a21d05a4de232c67afb9891d90 @Override public boolean startRiding(Entity entity, boolean force) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide()) { this.clientOldAttachPosition = null; this.clientSideTeleportInterpolation = 0; } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag this.setAttachFace(Direction.DOWN); return super.startRiding(entity, force); @@ -2552,11 +3816,11 @@ index e3fefd52c83079fe3eab1a96dd81a183f718192b..7a5279a21d05a4de232c67afb9891d90 public void stopRiding(boolean suppressCancellation) { super.stopRiding(suppressCancellation); // Paper end - Force entity dismount during teleportation -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.clientOldAttachPosition = this.blockPosition(); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag this.yBodyRotO = 0.0F; this.yBodyRot = 0.0F; @@ -2564,7 +3828,7 @@ index e3fefd52c83079fe3eab1a96dd81a183f718192b..7a5279a21d05a4de232c67afb9891d90 if (!blockposition1.equals(blockposition)) { this.entityData.set(Shulker.DATA_PEEK_ID, (byte) 0); this.hasImpulse = true; -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide && !this.isPassenger() && !blockposition1.equals(this.clientOldAttachPosition)) { this.clientOldAttachPosition = blockposition; this.clientSideTeleportInterpolation = 6; @@ -2572,7 +3836,7 @@ index e3fefd52c83079fe3eab1a96dd81a183f718192b..7a5279a21d05a4de232c67afb9891d90 this.yOld = this.getY(); this.zOld = this.getZ(); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } } @@ -2581,7 +3845,7 @@ index e3fefd52c83079fe3eab1a96dd81a183f718192b..7a5279a21d05a4de232c67afb9891d90 public void setRawPeekAmount(int peekAmount) { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.getAttribute(Attributes.ARMOR).removeModifier(Shulker.COVERED_ARMOR_MODIFIER_ID); if (peekAmount == 0) { this.getAttribute(Attributes.ARMOR).addPermanentModifier(Shulker.COVERED_ARMOR_MODIFIER); @@ -2590,12 +3854,12 @@ index e3fefd52c83079fe3eab1a96dd81a183f718192b..7a5279a21d05a4de232c67afb9891d90 this.gameEvent(GameEvent.CONTAINER_OPEN); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag this.entityData.set(Shulker.DATA_PEEK_ID, (byte) peekAmount); } diff --git a/src/main/java/net/minecraft/world/entity/monster/Skeleton.java b/src/main/java/net/minecraft/world/entity/monster/Skeleton.java -index 3cbe4c1ed514936a00e0181cb1e647fbb58032bb..9154bc868896ce7eb6fb11e107bffeaf5c89df60 100644 +index 3cbe4c1ed514936a00e0181cb1e647fbb58032bb..68db77482c699c03440990025e48a0ec434b55e1 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Skeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/Skeleton.java @@ -94,7 +94,7 @@ public class Skeleton extends AbstractSkeleton { @@ -2603,12 +3867,12 @@ index 3cbe4c1ed514936a00e0181cb1e647fbb58032bb..9154bc868896ce7eb6fb11e107bffeaf @Override public void tick() { - if (!this.level().isClientSide && this.isAlive() && !this.isNoAi()) { -+ if (/*!this.level().isClientSide &&*/ this.isAlive() && !this.isNoAi()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.isAlive() && !this.isNoAi()) { // Plazma - Remove persist 'isClientSide' flag if (this.isInPowderSnow) { if (this.isFreezeConverting()) { --this.conversionTime; diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java -index dad4ef9c672eb4247142de5d045678795951164c..c3c7dfde9715f6aa12410cfbaf4650c8b477462e 100644 +index dad4ef9c672eb4247142de5d045678795951164c..70afe8a5b54ddac660455bc4af4c30caeca487bb 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Slime.java +++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java @@ -303,7 +303,7 @@ public class Slime extends Mob implements Enemy { @@ -2616,12 +3880,21 @@ index dad4ef9c672eb4247142de5d045678795951164c..c3c7dfde9715f6aa12410cfbaf4650c8 int i = this.getSize(); - if (!this.level().isClientSide && i > 1 && this.isDeadOrDying()) { -+ if (/*!this.level().isClientSide &&*/ i > 1 && this.isDeadOrDying()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ i > 1 && this.isDeadOrDying()) { // Plazma - Remove persist 'isClientSide' flag float f = this.getDimensions(this.getPose()).width(); float f1 = f / 2.0F; int j = i / 2; +@@ -391,7 +391,7 @@ public class Slime extends Mob implements Enemy { + } + + protected boolean isDealsDamage() { +- return !this.isTiny() && this.isEffectiveAi(); ++ return !this.isTiny(); //&& this.isEffectiveAi(); // Plazma - Remove persist 'isClientSide' flag + } + + protected float getAttackDamage() { diff --git a/src/main/java/net/minecraft/world/entity/monster/SpellcasterIllager.java b/src/main/java/net/minecraft/world/entity/monster/SpellcasterIllager.java -index 4b6b842d411e433237b376df378da96afe7e484c..5ed02b7b8a5d6a13b94a808449117ebb0527a8ed 100644 +index 4b6b842d411e433237b376df378da96afe7e484c..985a770042c7b790413ee2e7b49c9888b9f78863 100644 --- a/src/main/java/net/minecraft/world/entity/monster/SpellcasterIllager.java +++ b/src/main/java/net/minecraft/world/entity/monster/SpellcasterIllager.java @@ -56,7 +56,7 @@ public abstract class SpellcasterIllager extends AbstractIllager { @@ -2629,7 +3902,7 @@ index 4b6b842d411e433237b376df378da96afe7e484c..5ed02b7b8a5d6a13b94a808449117ebb public boolean isCastingSpell() { - return this.level().isClientSide ? (Byte) this.entityData.get(SpellcasterIllager.DATA_SPELL_CASTING_ID) > 0 : this.spellCastingTickCount > 0; -+ return /*this.level().isClientSide ? (Byte) this.entityData.get(SpellcasterIllager.DATA_SPELL_CASTING_ID) > 0 :*/ this.spellCastingTickCount > 0; // Plazma - Remove persist flag ++ return /*this.level().isClientSide ? (Byte) this.entityData.get(SpellcasterIllager.DATA_SPELL_CASTING_ID) > 0 :*/ this.spellCastingTickCount > 0; // Plazma - Remove persist 'isClientSide' flag } public void setIsCastingSpell(SpellcasterIllager.IllagerSpell spell) { @@ -2638,28 +3911,28 @@ index 4b6b842d411e433237b376df378da96afe7e484c..5ed02b7b8a5d6a13b94a808449117ebb public SpellcasterIllager.IllagerSpell getCurrentSpell() { - return !this.level().isClientSide ? this.currentSpell : SpellcasterIllager.IllagerSpell.byId((Byte) this.entityData.get(SpellcasterIllager.DATA_SPELL_CASTING_ID)); -+ return /*!this.level().isClientSide ?*/ this.currentSpell; //: SpellcasterIllager.IllagerSpell.byId((Byte) this.entityData.get(SpellcasterIllager.DATA_SPELL_CASTING_ID)); // Plazma - Remove persist flag ++ return /*!this.level().isClientSide ?*/ this.currentSpell /*: SpellcasterIllager.IllagerSpell.byId((Byte) this.entityData.get(SpellcasterIllager.DATA_SPELL_CASTING_ID))*/; // Plazma - Remove persist 'isClientSide' flag } @Override -@@ -80,6 +80,7 @@ public abstract class SpellcasterIllager extends AbstractIllager { +@@ -77,6 +77,7 @@ public abstract class SpellcasterIllager extends AbstractIllager { + + } + ++ /* // Plazma - Remove persist 'isClientSide' flag @Override public void tick() { super.tick(); -+ /* // Plazma - Remove persist flag - if (this.level().isClientSide && this.isCastingSpell()) { - SpellcasterIllager.IllagerSpell entityillagerwizard_spell = this.getCurrentSpell(); - float f = (float) entityillagerwizard_spell.spellColor[0]; -@@ -94,6 +95,7 @@ public abstract class SpellcasterIllager extends AbstractIllager { - this.level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, f, f1, f2), this.getX() + (double) f4 * d0, this.getY() + d1, this.getZ() + (double) f5 * d0, 0.0D, 0.0D, 0.0D); - this.level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, f, f1, f2), this.getX() - (double) f4 * d0, this.getY() + d1, this.getZ() - (double) f5 * d0, 0.0D, 0.0D, 0.0D); +@@ -96,6 +97,7 @@ public abstract class SpellcasterIllager extends AbstractIllager { } -+ */ // Plazma - Remove persist flag } ++ */ // Plazma - Remove persist 'isClientSide' flag + protected int getSpellCastingTime() { + return this.spellCastingTickCount; diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java -index 1669acbcf97bee0fa6b0ee91cf53217c53cf55d8..651cc3297a86ff298f72b28a9fb623a0922adad8 100644 +index 1669acbcf97bee0fa6b0ee91cf53217c53cf55d8..74f8903541d5288f2a50769ffc5ef88e0c9aad1b 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Spider.java +++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java @@ -116,9 +116,9 @@ public class Spider extends Monster { @@ -2667,26 +3940,26 @@ index 1669acbcf97bee0fa6b0ee91cf53217c53cf55d8..651cc3297a86ff298f72b28a9fb623a0 public void tick() { super.tick(); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.setClimbing(this.horizontalCollision && (this.level().paperConfig().entities.behavior.allowSpiderWorldBorderClimbing || !(ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isCollidingWithBorder(this.level().getWorldBorder(), this.getBoundingBox().inflate(ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_EPSILON)) && this.level().getWorldBorder().isInsideCloseToBorder(this, this.getBoundingBox())))); // Paper - Add config option for spider worldborder climbing (Inflate by +EPSILON as collision will just barely place us outside border) - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/monster/Strider.java b/src/main/java/net/minecraft/world/entity/monster/Strider.java -index c3b5b34a54de945071692293645b8a8865aed961..d414158e1222f9a4f73a33abcf96f994aee4efde 100644 +index c3b5b34a54de945071692293645b8a8865aed961..c09e49f928e32a3dc6c557f01d92c455d9bfc8c6 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Strider.java +++ b/src/main/java/net/minecraft/world/entity/monster/Strider.java @@ -142,9 +142,11 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { @Override public void onSyncedDataUpdated(EntityDataAccessor data) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (Strider.DATA_BOOST_TIME.equals(data) && this.level().isClientSide) { this.steering.onSynced(); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag super.onSyncedDataUpdated(data); } @@ -2695,15 +3968,15 @@ index c3b5b34a54de945071692293645b8a8865aed961..d414158e1222f9a4f73a33abcf96f994 if (!flag && this.isSaddled() && !this.isVehicle() && !player.isSecondaryUseActive()) { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag player.startRiding(this); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java -index 313228811d1eff478887511f99b49706efc49774..db175aadc107bde53d211d969a0351cf3d19ce0a 100644 +index 313228811d1eff478887511f99b49706efc49774..0ca6762a36ed6e8a6f494ec0e9239c79ffe088b8 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Witch.java +++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java @@ -144,7 +144,7 @@ public class Witch extends Raider implements RangedAttackMob { @@ -2711,12 +3984,12 @@ index 313228811d1eff478887511f99b49706efc49774..db175aadc107bde53d211d969a0351cf @Override public void aiStep() { - if (!this.level().isClientSide && this.isAlive()) { -+ if (/*!this.level().isClientSide &&*/ this.isAlive()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.isAlive()) { // Plazma - Remove persist 'isClientSide' flag this.healRaidersGoal.decrementCooldown(); if (this.healRaidersGoal.getCooldown() <= 0) { this.attackPlayersGoal.setCanAttack(true); diff --git a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java -index 0cff4d4ee945ab5b6362648bf932af796d16a601..dbbe0e965c3c072e3c19bb2d23295d7d0386eab5 100644 +index cb20c018c11a0e707c2083cf964bd5303d216edd..3eb20ffc4a0446b2d0580de40b42eca53b53ec03 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java @@ -292,7 +292,7 @@ public class Zoglin extends Monster implements HoglinBase { @@ -2724,7 +3997,7 @@ index 0cff4d4ee945ab5b6362648bf932af796d16a601..dbbe0e965c3c072e3c19bb2d23295d7d public void setBaby(boolean baby) { this.getEntityData().set(DATA_BABY_ID, baby); - if (!this.level().isClientSide && baby) { -+ if (/*!this.level().isClientSide &&*/ baby) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ baby) { // Plazma - Remove persist 'isClientSide' flag this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(0.5); } } @@ -2732,19 +4005,19 @@ index 0cff4d4ee945ab5b6362648bf932af796d16a601..dbbe0e965c3c072e3c19bb2d23295d7d @Override protected SoundEvent getAmbientSound() { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { return null; } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag return this.brain.hasMemoryValue(MemoryModuleType.ATTACK_TARGET) ? SoundEvents.ZOGLIN_ANGRY : SoundEvents.ZOGLIN_AMBIENT; - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 85b03e0bf7436cb846df13c575ad78ac6a17a151..94f2f27abdf5e48835bd134ac164a163fb78dc41 100644 +index 85b03e0bf7436cb846df13c575ad78ac6a17a151..6628efb0ec59e68810152a64309bc5f610181392 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java @@ -249,7 +249,7 @@ public class Zombie extends Monster { @@ -2752,7 +4025,7 @@ index 85b03e0bf7436cb846df13c575ad78ac6a17a151..94f2f27abdf5e48835bd134ac164a163 public void setBaby(boolean baby) { this.getEntityData().set(Zombie.DATA_BABY_ID, baby); - if (this.level() != null && !this.level().isClientSide) { -+ if (this.level() != null /*&& !this.level().isClientSide*/) { // Plazma - Remove persist flag ++ if (this.level() != null /*&& !this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED); attributemodifiable.removeModifier(this.babyModifier.id()); // Paper - Make baby speed configurable @@ -2761,12 +4034,12 @@ index 85b03e0bf7436cb846df13c575ad78ac6a17a151..94f2f27abdf5e48835bd134ac164a163 @Override public void tick() { - if (!this.level().isClientSide && this.isAlive() && !this.isNoAi()) { -+ if (/*!this.level().isClientSide &&*/ this.isAlive() && !this.isNoAi()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.isAlive() && !this.isNoAi()) { // Plazma - Remove persist 'isClientSide' flag if (this.isUnderWaterConverting()) { --this.conversionTime; // Paper - remove anti tick skipping measures / wall time if (this.conversionTime < 0) { diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java -index 6f6b32bf7f68d05e4173c31f2e631a409b858a05..36583ccfb6694b07e4c852d31d00f399f677a674 100644 +index 6f6b32bf7f68d05e4173c31f2e631a409b858a05..27f1eaa5e7d11a6aae3f2af07942dbcee60d5216 100644 --- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java +++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java @@ -207,7 +207,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { @@ -2774,7 +4047,7 @@ index 6f6b32bf7f68d05e4173c31f2e631a409b858a05..36583ccfb6694b07e4c852d31d00f399 @Override public void tick() { - if (!this.level().isClientSide && this.isAlive() && this.isConverting()) { -+ if (/*!this.level().isClientSide &&*/ this.isAlive() && this.isConverting()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.isAlive() && this.isConverting()) { // Plazma - Remove persist 'isClientSide' flag int i = this.getConversionProgress(); // CraftBukkit start - Use wall time instead of ticks for villager conversion int elapsedTicks = MinecraftServer.currentTick - this.lastTick; @@ -2783,80 +4056,81 @@ index 6f6b32bf7f68d05e4173c31f2e631a409b858a05..36583ccfb6694b07e4c852d31d00f399 if (this.hasEffect(MobEffects.WEAKNESS) && level().purpurConfig.zombieVillagerCureEnabled) { // Purpur itemstack.consume(1, player); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.startConverting(player.getUUID(), this.random.nextInt(level().purpurConfig.zombieVillagerCuringTimeMax - level().purpurConfig.zombieVillagerCuringTimeMin + 1) + level().purpurConfig.zombieVillagerCuringTimeMin); // Purpur - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS_SERVER; } else { diff --git a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java -index e60c2dbc2188ea32459b536b0e3f3fea36f70776..fe26b92a04e95feed129e66edcee9218a5a357e4 100644 +index 489644b66266257828fd216e4298bd6d33f7777b..2e39c65304fff182ee63e18f16b677b490af2837 100644 --- a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java +++ b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java -@@ -89,6 +89,7 @@ public class Breeze extends Monster { +@@ -87,6 +87,7 @@ public class Breeze extends Monster { @Override public void onSyncedDataUpdated(EntityDataAccessor data) { -+ /* // Plazma - Remove persist flag - if (this.level().isClientSide() && DATA_POSE.equals(data)) { ++ /* // Plazma - Remove persist 'isClientSide' flag + if (this.level().isClientSide() && Breeze.DATA_POSE.equals(data)) { this.resetAnimations(); - Pose pose = this.getPose(); -@@ -103,6 +104,7 @@ public class Breeze extends Monster { + Pose entitypose = this.getPose(); +@@ -102,6 +103,7 @@ public class Breeze extends Monster { this.slide.startIfStopped(this.tickCount); } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag super.onSyncedDataUpdated(data); } diff --git a/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java b/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java -index 6a17c30afc7863dfa55f1e07ea29b1fb0166adc7..f6d8ac1f9d6c5a25b79ed8b679d1c541c8470788 100644 +index ea1655d2cbc631d80dd66f7e3e24998530df66a2..833667dfaff7f8de638238981adbf0b4a839ea04 100644 --- a/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java +++ b/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java -@@ -134,7 +134,7 @@ public class Creaking extends Monster { +@@ -157,7 +157,7 @@ public class Creaking extends Monster { this.attackAnimationRemainingTicks--; } - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag boolean bl = this.entityData.get(CAN_MOVE); boolean bl2 = this.checkCanMove(); if (bl2 != bl) { -@@ -148,7 +148,7 @@ public class Creaking extends Monster { +@@ -171,11 +171,12 @@ public class Creaking extends Monster { } this.entityData.set(CAN_MOVE, bl2); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag super.aiStep(); } -@@ -156,9 +156,11 @@ public class Creaking extends Monster { + ++ /* // Plazma - Remove persist 'isClientSide' flag @Override public void tick() { super.tick(); -+ /* // Plazma - Remove persist flag - if (this.level().isClientSide) { +@@ -183,6 +184,7 @@ public class Creaking extends Monster { this.setupAnimationStates(); } -+ */ // Plazma - Remove persist flag } ++ */ // Plazma - Remove persist 'isClientSide' flag private void setupAnimationStates() { + this.attackAnimationState.animateWhen(this.attackAnimationRemainingTicks > 0, this.tickCount); diff --git a/src/main/java/net/minecraft/world/entity/monster/creaking/CreakingTransient.java b/src/main/java/net/minecraft/world/entity/monster/creaking/CreakingTransient.java -index b57818cbe9ac6a2095da8a2ee6ccbd4c1804a502..ebc0e152a4b821b30fe1d371749a70a07928a728 100644 +index b57818cbe9ac6a2095da8a2ee6ccbd4c1804a502..c7e217a5ec2cb6d261ae9804ae125961f344a418 100644 --- a/src/main/java/net/minecraft/world/entity/monster/creaking/CreakingTransient.java +++ b/src/main/java/net/minecraft/world/entity/monster/creaking/CreakingTransient.java @@ -44,9 +44,10 @@ public class CreakingTransient extends Creaking { @Override public boolean hurtServer(ServerLevel world, DamageSource source, float amount) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { return super.hurtServer(world, source, amount); - } else if (source.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { -+ } else*/ if (source.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { // Plazma - Remove persist flag ++ } else*/ if (source.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { // Plazma - Remove persist 'isClientSide' flag return super.hurtServer(world, source, amount); } else if (!this.isInvulnerableTo(world, source) && this.invulnerabilityAnimationRemainingTicks <= 0) { this.invulnerabilityAnimationRemainingTicks = 8; @@ -2865,7 +4139,7 @@ index b57818cbe9ac6a2095da8a2ee6ccbd4c1804a502..ebc0e152a4b821b30fe1d371749a70a0 @Override public void tick() { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag label18: { if (this.homePos != null) { @@ -2874,32 +4148,32 @@ index b57818cbe9ac6a2095da8a2ee6ccbd4c1804a502..ebc0e152a4b821b30fe1d371749a70a0 return; } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag super.tick(); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.setupAnimationStates(); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 8b91472441a17572d8bb47e42402c585b26aeeb6..290d7fc32c9ce9ed91f9c288dc0d0f294275b997 100644 +index 6144613e834236ec0ebb12872ef9e47255b76b5b..28ca4b511ea37f6fd0eefc7a8d449c85075b855d 100644 --- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -389,7 +389,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -373,7 +373,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { @Override protected SoundEvent getAmbientSound() { -- return this.level().isClientSide ? null : HoglinAi.getSoundForCurrentActivity(this).orElse(null); -+ return /*this.level().isClientSide ? null :*/ HoglinAi.getSoundForCurrentActivity(this).orElse(null); // Plazma - Remove persist flag +- return this.level().isClientSide ? null : (SoundEvent) HoglinAi.getSoundForCurrentActivity(this).orElse(null); // CraftBukkit - decompile error ++ return /*this.level().isClientSide ? null :*/ (SoundEvent) HoglinAi.getSoundForCurrentActivity(this).orElse(null); // CraftBukkit - decompile error // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java -index 8e7c737263f55fdd4a2adbab4a9d208674a55639..a25f50c93de3a5040f78ec358e9e5b50f264ce5d 100644 +index 20608fb46a0af85739e3c0caa843c1a9d45c9659..938b4025122f6d27382086445bc8f231f325b864 100644 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java @@ -312,14 +312,14 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @@ -2907,7 +4181,7 @@ index 8e7c737263f55fdd4a2adbab4a9d208674a55639..a25f50c93de3a5040f78ec358e9e5b50 public void setBaby(boolean baby) { this.getEntityData().set(Piglin.DATA_BABY_ID, baby); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED); attributemodifiable.removeModifier(Piglin.SPEED_MODIFIER_BABY.id()); @@ -2915,28 +4189,28 @@ index 8e7c737263f55fdd4a2adbab4a9d208674a55639..a25f50c93de3a5040f78ec358e9e5b50 attributemodifiable.addTransientModifier(Piglin.SPEED_MODIFIER_BABY); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } -@@ -484,7 +484,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -485,7 +485,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @Override protected SoundEvent getAmbientSound() { - return this.level().isClientSide ? null : (SoundEvent) PiglinAi.getSoundForCurrentActivity(this).orElse(null); // CraftBukkit - Decompile error -+ return /*this.level().isClientSide ? null :*/ (SoundEvent) PiglinAi.getSoundForCurrentActivity(this).orElse(null); // CraftBukkit - Decompile error // Plazma - Remove persist flag ++ return /*this.level().isClientSide ? null :*/ (SoundEvent) PiglinAi.getSoundForCurrentActivity(this).orElse(null); // CraftBukkit - Decompile error // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -index 5350c7a6085edc4f8529f443091d52cb70c62efd..bcc1f2e8ad66eb826617f17d98fb43649fc8deb2 100644 +index 79b090030b716029cc4cfc8bf9d81af0b2202313..6cce132f43ce7aad6f5ee2b351855c9b57b8f0c1 100644 --- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java @@ -287,6 +287,7 @@ public class Warden extends Monster implements VibrationSystem { } super.tick(); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide()) { if (this.tickCount % this.getHeartBeatDelay() == 0) { this.heartAnimation = 10; @@ -2944,23 +4218,23 @@ index 5350c7a6085edc4f8529f443091d52cb70c62efd..bcc1f2e8ad66eb826617f17d98fb4364 this.clientDiggingParticles(this.diggingAnimationState); } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java -index 6c74cf1dea99b3b967b8c3d76f405f823c881fb9..693da8fd0425829e02da9e30edfc5ecc0ed6a65c 100644 +index 6c74cf1dea99b3b967b8c3d76f405f823c881fb9..e57f95fb70c7482587acc134982caa22f7c67071 100644 --- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java +++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java @@ -124,16 +124,18 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa @Override public MerchantOffers getOffers() { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { throw new IllegalStateException("Cannot load Villager offers on the client"); } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag if (this.offers == null) { this.offers = new MerchantOffers(); this.updateTrades(); @@ -2968,7 +4242,7 @@ index 6c74cf1dea99b3b967b8c3d76f405f823c881fb9..693da8fd0425829e02da9e30edfc5ecc return this.offers; - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override @@ -2977,7 +4251,7 @@ index 6c74cf1dea99b3b967b8c3d76f405f823c881fb9..693da8fd0425829e02da9e30edfc5ecc @Override public void notifyTradeUpdated(ItemStack stack) { - if (!this.level().isClientSide && this.ambientSoundTime > -this.getAmbientSoundInterval() + 20) { -+ if (/*!this.level().isClientSide &&*/ this.ambientSoundTime > -this.getAmbientSoundInterval() + 20) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.ambientSoundTime > -this.getAmbientSoundInterval() + 20) { // Plazma - Remove persist 'isClientSide' flag this.ambientSoundTime = -this.getAmbientSoundInterval(); this.makeSound(this.getTradeUpdatedSound(!stack.isEmpty())); } @@ -2986,14 +4260,14 @@ index 6c74cf1dea99b3b967b8c3d76f405f823c881fb9..693da8fd0425829e02da9e30edfc5ecc public void addAdditionalSaveData(CompoundTag nbt) { super.addAdditionalSaveData(nbt); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag MerchantOffers merchantrecipelist = this.getOffers(); if (!merchantrecipelist.isEmpty()) { nbt.put("Offers", (Tag) MerchantOffers.CODEC.encodeStart(this.registryAccess().createSerializationContext(NbtOps.INSTANCE), merchantrecipelist).getOrThrow()); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag this.writeInventoryToTag(nbt, this.registryAccess()); } @@ -3001,101 +4275,117 @@ index 6c74cf1dea99b3b967b8c3d76f405f823c881fb9..693da8fd0425829e02da9e30edfc5ecc return this.getPosition(delta).add(vec3d.yRot(-f1)); } -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag @Override public boolean isClientSide() { return this.level().isClientSide; } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index 50bed3677f7e38d19ceda0dff0c499957312b2ad..917a0c10de0a7fd4b0635bce24164e5b446e116e 100644 +index 0ee456972923e90905732ffc5d77bb027cf6c0fc..68353a8b2a01fbf873c3751f3887dc0ec35c8327 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -410,7 +410,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -323,13 +323,13 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + if (this.getUnhappyCounter() > 0) { + this.setUnhappyCounter(this.getUnhappyCounter() - 1); + } +- if (this.isEffectiveAi()) { ++ //if (this.isEffectiveAi()) { // Plazma - Remove persist 'isClientSide' flag + if (this.level().spigotConfig.tickInactiveVillagers) { + this.customServerAiStep(this.level().getMinecraftWorld()); + } else { + this.customServerAiStep(this.level().getMinecraftWorld(), true); + } +- } ++ //} // Plazma - Remove persist 'isClientSide' flag + maybeDecayGossip(); + // Paper end + super.inactiveTick(); +@@ -418,7 +418,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler this.setUnhappy(); return tryRide(player, hand, InteractionResult.SUCCESS); // Purpur } else { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag boolean flag = this.getOffers().isEmpty(); if (hand == InteractionHand.MAIN_HAND) { -@@ -428,7 +428,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -436,7 +436,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler if (level().purpurConfig.villagerRidable && itemstack.isEmpty()) return tryRide(player, hand); // Purpur if (this.level().purpurConfig.villagerAllowTrading) // Purpur this.startTrading(player); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } -@@ -439,9 +439,9 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -447,9 +447,9 @@ public class Villager extends AbstractVillager implements ReputationEventHandler public void setUnhappy() { this.setUnhappyCounter(40); - if (!this.level().isClientSide()) { -+ //if (!this.level().isClientSide()) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide()) { // Plazma - Remove persist 'isClientSide' flag this.makeSound(SoundEvents.VILLAGER_NO); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } -@@ -469,7 +469,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -477,7 +477,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } private void resetSpecialPrices() { - if (!this.level().isClientSide()) { -+ //if (!this.level().isClientSide()) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide()) { // Plazma - Remove persist 'isClientSide' flag Iterator iterator = this.getOffers().iterator(); while (iterator.hasNext()) { -@@ -478,7 +478,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -486,7 +486,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler merchantrecipe.resetSpecialPriceDiff(); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java -index 959e10586cddaae2590d2d84f5fd809dad80889b..8bb0b86aa95b252fafe5720037de06d4ba5476e9 100644 +index 42c91e52060fad4a7a598f9e9ef88fd0e0ff8475..c348f049c0d51fc98d3b2dfbdde679fb94037a2e 100644 --- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java +++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java -@@ -156,7 +156,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill +@@ -163,7 +163,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill player.awardStat(Stats.TALKED_TO_VILLAGER); } - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (this.getOffers().isEmpty()) { return tryRide(player, hand, InteractionResult.CONSUME); // Purpur } -@@ -165,7 +165,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill +@@ -172,7 +172,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill this.setTradingPlayer(player); this.openTradingScreen(player, this.getDisplayName(), 1); } // Purpur - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { -@@ -298,9 +298,9 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill +@@ -305,9 +305,9 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill @Override public void aiStep() { super.aiStep(); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.maybeDespawn(); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index c1d068fa99ec0fd5685bbb627a775e4d1587feab..47778aefdf05948845fa20514776e011b931d984 100644 +index c1d068fa99ec0fd5685bbb627a775e4d1587feab..f92b72ee0172cd878baef69b9710dbaf7e5c4495 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -238,7 +238,7 @@ public abstract class Player extends LivingEntity { @@ -3103,7 +4393,7 @@ index c1d068fa99ec0fd5685bbb627a775e4d1587feab..47778aefdf05948845fa20514776e011 this.setUUID(gameProfile.getId()); this.gameProfile = gameProfile; - this.inventoryMenu = new InventoryMenu(this.inventory, !world.isClientSide, this); -+ this.inventoryMenu = new InventoryMenu(this.inventory, this); // Plazma - Remove persist flag ++ this.inventoryMenu = new InventoryMenu(this.inventory, this); // Plazma - Remove persist 'isClientSide' flag this.containerMenu = this.inventoryMenu; this.moveTo((double) pos.getX() + 0.5D, (double) (pos.getY() + 1), (double) pos.getZ() + 0.5D, yaw, 0.0F); this.rotOffs = 180.0F; @@ -3112,7 +4402,7 @@ index c1d068fa99ec0fd5685bbb627a775e4d1587feab..47778aefdf05948845fa20514776e011 } - if (!this.level().isClientSide && this.level().isDay()) { -+ if (/*!this.level().isClientSide &&*/ this.level().isDay()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.level().isDay()) { // Plazma - Remove persist 'isClientSide' flag this.stopSleepInBed(false, true); } } else if (this.sleepCounter > 0) { @@ -3121,7 +4411,7 @@ index c1d068fa99ec0fd5685bbb627a775e4d1587feab..47778aefdf05948845fa20514776e011 this.updateIsUnderwater(); super.tick(); - if (!this.level().isClientSide && this.containerMenu != null && !this.containerMenu.stillValid(this)) { -+ if (/*!this.level().isClientSide &&*/ this.containerMenu != null && !this.containerMenu.stillValid(this)) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.containerMenu != null && !this.containerMenu.stillValid(this)) { // Plazma - Remove persist 'isClientSide' flag this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper - Inventory close reason this.containerMenu = this.inventoryMenu; } @@ -3130,7 +4420,7 @@ index c1d068fa99ec0fd5685bbb627a775e4d1587feab..47778aefdf05948845fa20514776e011 @Override public void rideTick() { - if (!this.level().isClientSide && this.wantsToStopRiding() && this.isPassenger()) { -+ if (/*!this.level().isClientSide &&*/ this.wantsToStopRiding() && this.isPassenger()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.wantsToStopRiding() && this.isPassenger()) { // Plazma - Remove persist 'isClientSide' flag this.stopRiding(); // CraftBukkit start - SPIGOT-7316: no longer passenger, dismount and return if (!this.isPassenger()) { @@ -3139,7 +4429,7 @@ index c1d068fa99ec0fd5685bbb627a775e4d1587feab..47778aefdf05948845fa20514776e011 this.playShoulderEntityAmbientSound(this.getShoulderEntityLeft()); this.playShoulderEntityAmbientSound(this.getShoulderEntityRight()); - if (!this.level().isClientSide && (this.fallDistance > 0.5F || this.isInWater()) || this.abilities.flying || this.isSleeping() || this.isInPowderSnow) { -+ if (/*!this.level().isClientSide &&*/ (this.fallDistance > 0.5F || this.isInWater()) || this.abilities.flying || this.isSleeping() || this.isInPowderSnow) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ (this.fallDistance > 0.5F || this.isInWater()) || this.abilities.flying || this.isSleeping() || this.isInPowderSnow) { // Plazma - Remove persist 'isClientSide' flag if (!this.level().paperConfig().entities.behavior.parrotsAreUnaffectedByPlayerMovement) // Paper - Add option to make parrots stay this.removeEntitiesOnShoulder(); } @@ -3148,11 +4438,11 @@ index c1d068fa99ec0fd5685bbb627a775e4d1587feab..47778aefdf05948845fa20514776e011 this.autoSpinAttackDmg = riptideAttackDamage; this.autoSpinAttackItemStack = stack; - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.removeEntitiesOnShoulder(); this.setLivingEntityFlag(4, true); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @@ -3160,11 +4450,11 @@ index c1d068fa99ec0fd5685bbb627a775e4d1587feab..47778aefdf05948845fa20514776e011 @Nullable public ItemEntity drop(ItemStack itemstack, boolean flag, boolean flag1, boolean callEvent) { // CraftBukkit end -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (!itemstack.isEmpty() && this.level().isClientSide) { this.swing(InteractionHand.MAIN_HAND); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag return null; } @@ -3173,10 +4463,10 @@ index c1d068fa99ec0fd5685bbb627a775e4d1587feab..47778aefdf05948845fa20514776e011 protected void hurtCurrentlyUsedShield(float amount) { if (this.useItem.is(Items.SHIELD)) { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.awardStat(Stats.ITEM_USED.get(this.useItem.getItem())); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag if (amount >= 3.0F) { int i = 1 + Mth.floor(amount); @@ -3185,16 +4475,28 @@ index c1d068fa99ec0fd5685bbb627a775e4d1587feab..47778aefdf05948845fa20514776e011 } - if (!this.level().isClientSide && !itemstack.isEmpty() && object instanceof LivingEntity) { -+ if (/*!this.level().isClientSide &&*/ !itemstack.isEmpty() && object instanceof LivingEntity) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ !itemstack.isEmpty() && object instanceof LivingEntity) { // Plazma - Remove persist 'isClientSide' flag if (flag5) { itemstack.postHurtEnemy((LivingEntity) object, this); } -@@ -1895,14 +1897,14 @@ public abstract class Player extends LivingEntity { +@@ -1555,9 +1557,11 @@ public abstract class Player extends LivingEntity { + + } + ++ /* // Plazma - Remove persist 'isClientSide' flag + public boolean isLocalPlayer() { + return false; + } ++ */ // Plazma - Remove persist 'isClientSide' flag + + public GameProfile getGameProfile() { + return this.gameProfile; +@@ -1895,14 +1899,14 @@ public abstract class Player extends LivingEntity { public void causeFoodExhaustion(float f, EntityExhaustionEvent.ExhaustionReason reason) { // CraftBukkit end if (!this.abilities.invulnerable) { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start EntityExhaustionEvent event = CraftEventFactory.callPlayerExhaustionEvent(this, reason, f); if (!event.isCancelled()) { @@ -3202,21 +4504,21 @@ index c1d068fa99ec0fd5685bbb627a775e4d1587feab..47778aefdf05948845fa20514776e011 } // CraftBukkit end - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } } -@@ -2098,7 +2100,7 @@ public abstract class Player extends LivingEntity { +@@ -2098,7 +2102,7 @@ public abstract class Player extends LivingEntity { private Entity respawnEntityOnShoulder0(CompoundTag nbttagcompound) { // CraftBukkit void->boolean // Paper end - release entity api - return entity - overload - if (!this.level().isClientSide && !nbttagcompound.isEmpty()) { -+ if (/*!this.level().isClientSide &&*/ !nbttagcompound.isEmpty()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ !nbttagcompound.isEmpty()) { // Plazma - Remove persist 'isClientSide' flag return EntityType.create(nbttagcompound, this.level(), EntitySpawnReason.LOAD).map((entity) -> { // CraftBukkit if (entity instanceof TamableAnimal) { ((TamableAnimal) entity).setOwnerUUID(this.uuid); diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -index f91519f73e766cf891351a95d76abb416da2f957..fa4d7af5b1c7ace5f537fe9c95ecce456c1af5a8 100644 +index 5006a59734c5fc7525fba86f7d74e74f8f1b54b0..3d4d1a247e14f97ddeab3c532341d0e8e89dc2e3 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -229,13 +229,13 @@ public abstract class AbstractArrow extends Projectile { @@ -3224,14 +4526,14 @@ index f91519f73e766cf891351a95d76abb416da2f957..fa4d7af5b1c7ace5f537fe9c95ecce45 if (this.isInGround() && flag) { - if (!this.level().isClientSide()) { -+ //if (!this.level().isClientSide()) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide()) { // Plazma - Remove persist 'isClientSide' flag if (this.lastState != iblockdata && this.shouldFall()) { this.startFalling(); } else { this.tickDespawn(); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag ++this.inGroundTime; if (this.isAlive()) { @@ -3240,7 +4542,7 @@ index f91519f73e766cf891351a95d76abb416da2f957..fa4d7af5b1c7ace5f537fe9c95ecce45 LivingEntity entityliving1 = (LivingEntity) entity; - if (!this.level().isClientSide && this.getPierceLevel() <= 0) { -+ if (/*!this.level().isClientSide &&*/ this.getPierceLevel() <= 0) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.getPierceLevel() <= 0) { // Plazma - Remove persist 'isClientSide' flag entityliving1.setArrowCount(entityliving1.getArrowCount() + 1); } @@ -3249,7 +4551,7 @@ index f91519f73e766cf891351a95d76abb416da2f957..fa4d7af5b1c7ace5f537fe9c95ecce45 } - if (!this.level().isClientSide && entity1 instanceof ServerPlayer) { -+ if (/*!this.level().isClientSide &&*/ entity1 instanceof ServerPlayer) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ entity1 instanceof ServerPlayer) { // Plazma - Remove persist 'isClientSide' flag ServerPlayer entityplayer = (ServerPlayer) entity1; if (this.piercedAndKilledEntities != null) { @@ -3258,7 +4560,7 @@ index f91519f73e766cf891351a95d76abb416da2f957..fa4d7af5b1c7ace5f537fe9c95ecce45 @Override public void playerTouch(Player player) { - if (!this.level().isClientSide && (this.isInGround() || this.isNoPhysics()) && this.shakeTime <= 0) { -+ if (/*!this.level().isClientSide &&*/ (this.isInGround() || this.isNoPhysics()) && this.shakeTime <= 0) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ (this.isInGround() || this.isNoPhysics()) && this.shakeTime <= 0) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start ItemStack itemstack = this.getPickupItem(); if (this.pickup == Pickup.ALLOWED && !itemstack.isEmpty() && player.getInventory().canHold(itemstack) > 0) { @@ -3267,12 +4569,12 @@ index f91519f73e766cf891351a95d76abb416da2f957..fa4d7af5b1c7ace5f537fe9c95ecce45 public boolean isNoPhysics() { - return !this.level().isClientSide ? this.noPhysics : ((Byte) this.entityData.get(AbstractArrow.ID_FLAGS) & 2) != 0; -+ return /*!this.level().isClientSide ?*/ this.noPhysics; //: ((Byte) this.entityData.get(AbstractArrow.ID_FLAGS) & 2) != 0; // Plazma - Remove persist flag ++ return /*!this.level().isClientSide ?*/ this.noPhysics /*: ((Byte) this.entityData.get(AbstractArrow.ID_FLAGS) & 2) != 0*/; // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java -index a84dccc59f9dc5298b18f263dc779c30c9b7ddab..383f18b784a786c193549dc0dcc6527e4925e1a4 100644 +index a84dccc59f9dc5298b18f263dc779c30c9b7ddab..c496d825b42bb88e96e7e6aecbe2b3f2461e4238 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java @@ -77,7 +77,7 @@ public abstract class AbstractHurtingProjectile extends Projectile { @@ -3280,19 +4582,19 @@ index a84dccc59f9dc5298b18f263dc779c30c9b7ddab..383f18b784a786c193549dc0dcc6527e this.applyInertia(); - if (!this.level().isClientSide && (entity != null && entity.isRemoved() || !this.level().hasChunkAt(this.blockPosition()))) { -+ if (/*!this.level().isClientSide &&*/ (entity != null && entity.isRemoved() || !this.level().hasChunkAt(this.blockPosition()))) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ (entity != null && entity.isRemoved() || !this.level().hasChunkAt(this.blockPosition()))) { // Plazma - Remove persist 'isClientSide' flag this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause } else { HitResult movingobjectposition = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType()); diff --git a/src/main/java/net/minecraft/world/entity/projectile/Arrow.java b/src/main/java/net/minecraft/world/entity/projectile/Arrow.java -index 50ebe1bfad07f75a12431438cbdc5b909502b201..65dfcbb06c8cb382b68e6ae25ed04de085c65bf6 100644 +index 50ebe1bfad07f75a12431438cbdc5b909502b201..1efc431401de9678b5a949462cc4617974aba3d9 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Arrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Arrow.java @@ -74,6 +74,7 @@ public class Arrow extends AbstractArrow { @Override public void tick() { super.tick(); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { if (this.isInGround()) { if (this.inGroundTime % 5 == 0) { @@ -3301,12 +4603,12 @@ index 50ebe1bfad07f75a12431438cbdc5b909502b201..65dfcbb06c8cb382b68e6ae25ed04de0 this.makeParticle(2); } - } else if (this.isInGround() && this.inGroundTime != 0 && !this.getPotionContents().equals(PotionContents.EMPTY) && this.inGroundTime >= 600) { -+ } else*/ if (this.isInGround() && this.inGroundTime != 0 && !this.getPotionContents().equals(PotionContents.EMPTY) && this.inGroundTime >= 600) { // Plazma - Remove persist flag ++ } else*/ if (this.isInGround() && this.inGroundTime != 0 && !this.getPotionContents().equals(PotionContents.EMPTY) && this.inGroundTime >= 600) { // Plazma - Remove persist 'isClientSide' flag this.level().broadcastEntityEvent(this, (byte) 0); this.setPickupItemStack(new ItemStack(Items.ARROW)); } diff --git a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java -index c68ddccd5fbe27f6a62cedbdc2337f1b6e4d3273..a338c7be3a663cdf9411f8e2d35a4efcc1a780d8 100644 +index c68ddccd5fbe27f6a62cedbdc2337f1b6e4d3273..2f08a7ee8ddfbe4eb70b163e57918c6edc91ff02 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java +++ b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java @@ -34,7 +34,7 @@ public class DragonFireball extends AbstractHurtingProjectile { @@ -3314,7 +4616,7 @@ index c68ddccd5fbe27f6a62cedbdc2337f1b6e4d3273..a338c7be3a663cdf9411f8e2d35a4efc super.onHit(hitResult); if (hitResult.getType() != HitResult.Type.ENTITY || !this.ownedBy(((EntityHitResult) hitResult).getEntity())) { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag List list = this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D)); AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ()); Entity entity = this.getOwner(); @@ -3323,19 +4625,19 @@ index c68ddccd5fbe27f6a62cedbdc2337f1b6e4d3273..a338c7be3a663cdf9411f8e2d35a4efc } else entityareaeffectcloud.discard(null); // Paper - EnderDragon Events this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java b/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java -index ccc72a2cf02a633655b95f961be310879d8f904f..60f53842285c567b50221a5b6717f6fe8f323010 100644 +index ccc72a2cf02a633655b95f961be310879d8f904f..d56fbb70b9060ce8e012d4aa18db382d755bf59f 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java +++ b/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java @@ -90,6 +90,7 @@ public class EvokerFangs extends Entity implements TraceableEntity { @Override public void tick() { super.tick(); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { if (this.clientSideAttackStarted) { --this.lifeTicks; @@ -3344,12 +4646,12 @@ index ccc72a2cf02a633655b95f961be310879d8f904f..60f53842285c567b50221a5b6717f6fe } } - } else if (--this.warmupDelayTicks < 0) { -+ } else*/ if (--this.warmupDelayTicks < 0) { // Plazma - Remove persist flag ++ } else*/ if (--this.warmupDelayTicks < 0) { // Plazma - Remove persist 'isClientSide' flag if (this.warmupDelayTicks == -8) { List list = this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox().inflate(0.2D, 0.0D, 0.2D)); Iterator iterator = list.iterator(); diff --git a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java -index fd1f5de7dc151dfd187d23e022b2c5435ed8accc..c5808875ac064b408962ab3d706de8d47713ed48 100644 +index fd1f5de7dc151dfd187d23e022b2c5435ed8accc..bb4d1b5d76769dfcbdfc49b49ca9d0973a720cc4 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java +++ b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java @@ -129,7 +129,7 @@ public class EyeOfEnder extends Entity implements ItemSupplier { @@ -3357,7 +4659,7 @@ index fd1f5de7dc151dfd187d23e022b2c5435ed8accc..c5808875ac064b408962ab3d706de8d4 this.setXRot(Projectile.lerpRotation(this.xRotO, (float) (Mth.atan2(vec3d.y, d3) * 57.2957763671875D))); this.setYRot(Projectile.lerpRotation(this.yRotO, (float) (Mth.atan2(vec3d.x, vec3d.z) * 57.2957763671875D))); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag double d4 = this.tx - d0; double d5 = this.tz - d2; float f = (float) Math.sqrt(d4 * d4 + d5 * d5); @@ -3366,7 +4668,7 @@ index fd1f5de7dc151dfd187d23e022b2c5435ed8accc..c5808875ac064b408962ab3d706de8d4 vec3d = new Vec3(Math.cos((double) f1) * d6, d7 + ((double) i - d7) * 0.014999999664723873D, Math.sin((double) f1) * d6); this.setDeltaMovement(vec3d); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag float f2 = 0.25F; @@ -3379,7 +4681,7 @@ index fd1f5de7dc151dfd187d23e022b2c5435ed8accc..c5808875ac064b408962ab3d706de8d4 this.setPos(d0, d1, d2); ++this.life; - if (this.life > 80 && !this.level().isClientSide) { -+ if (this.life > 80 /*&& !this.level().isClientSide*/) { // Plazma - Remove persist flag ++ if (this.life > 80 /*&& !this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag this.playSound(SoundEvents.ENDER_EYE_DEATH, 1.0F, 1.0F); this.discard(this.surviveAfterDeath ? EntityRemoveEvent.Cause.DROP : EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause if (this.surviveAfterDeath) { @@ -3387,27 +4689,27 @@ index fd1f5de7dc151dfd187d23e022b2c5435ed8accc..c5808875ac064b408962ab3d706de8d4 this.level().levelEvent(2003, this.blockPosition(), 0); } } -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag } else { this.setPosRaw(d0, d1, d2); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -index 8a4e7e1c0c4919d2ee34121c14f9665b9ad95273..26fd45a5f5170ab8e08bd8024e765990a235e2cb 100644 +index 8a4e7e1c0c4919d2ee34121c14f9665b9ad95273..f07ad352ea991752625a5c6bdf6ae9cccaa83ddf 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java @@ -188,9 +188,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { } ++this.life; -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide && this.life % 2 < 2) { this.level().addParticle(ParticleTypes.FIREWORK, this.getX(), this.getY(), this.getZ(), this.random.nextGaussian() * 0.05D, -this.getDeltaMovement().y * 0.5D, this.random.nextGaussian() * 0.05D); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag if (this.life > this.lifetime) { Level world = this.level(); @@ -3415,18 +4717,18 @@ index 8a4e7e1c0c4919d2ee34121c14f9665b9ad95273..26fd45a5f5170ab8e08bd8024e765990 @Override public void handleEntityEvent(byte status) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (status == 17 && this.level().isClientSide) { Vec3 vec3d = this.getDeltaMovement(); this.level().createFireworks(this.getX(), this.getY(), this.getZ(), vec3d.x, vec3d.y, vec3d.z, this.getExplosions()); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag super.handleEntityEvent(status); } diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -index 4daa69c6be6d48563e30343a7e40e4da9ec7e5ad..b54ca13d4bb614629fe1407c410ef0af0ed79a3a 100644 +index 4daa69c6be6d48563e30343a7e40e4da9ec7e5ad..eb96b2fc32056275d3b9fe8e33162744a7b1870b 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java @@ -175,7 +175,7 @@ public class FishingHook extends Projectile { @@ -3434,7 +4736,7 @@ index 4daa69c6be6d48563e30343a7e40e4da9ec7e5ad..b54ca13d4bb614629fe1407c410ef0af if (entityhuman == null) { this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause - } else if (this.level().isClientSide || !this.shouldStopFishing(entityhuman)) { -+ } else if (/*this.level().isClientSide ||*/ !this.shouldStopFishing(entityhuman)) { // Plazma - Remove persist flag ++ } else if (/*this.level().isClientSide ||*/ !this.shouldStopFishing(entityhuman)) { // Plazma - Remove persist 'isClientSide' flag if (this.onGround()) { ++this.life; if (this.life >= 1200) { @@ -3443,10 +4745,10 @@ index 4daa69c6be6d48563e30343a7e40e4da9ec7e5ad..b54ca13d4bb614629fe1407c410ef0af } - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.catchingFish(blockposition); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } else { this.outOfWaterTime = Math.min(10, this.outOfWaterTime + 1); } @@ -3455,10 +4757,10 @@ index 4daa69c6be6d48563e30343a7e40e4da9ec7e5ad..b54ca13d4bb614629fe1407c410ef0af protected void onHitEntity(EntityHitResult entityHitResult) { super.onHitEntity(entityHitResult); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.setHookedEntity(entityHitResult.getEntity()); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @@ -3467,7 +4769,7 @@ index 4daa69c6be6d48563e30343a7e40e4da9ec7e5ad..b54ca13d4bb614629fe1407c410ef0af net.minecraft.world.entity.player.Player entityhuman = this.getPlayerOwner(); - if (!this.level().isClientSide && entityhuman != null && !this.shouldStopFishing(entityhuman)) { -+ if (/*!this.level().isClientSide &&*/ entityhuman != null && !this.shouldStopFishing(entityhuman)) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ entityhuman != null && !this.shouldStopFishing(entityhuman)) { // Plazma - Remove persist 'isClientSide' flag int i = 0; if (this.hookedIn != null) { @@ -3475,16 +4777,16 @@ index 4daa69c6be6d48563e30343a7e40e4da9ec7e5ad..b54ca13d4bb614629fe1407c410ef0af @Override public void handleEntityEvent(byte status) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (status == 31 && this.level().isClientSide && this.hookedIn instanceof net.minecraft.world.entity.player.Player && ((net.minecraft.world.entity.player.Player) this.hookedIn).isLocalPlayer()) { this.pullEntity(this.hookedIn); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag super.handleEntityEvent(status); } diff --git a/src/main/java/net/minecraft/world/entity/projectile/LlamaSpit.java b/src/main/java/net/minecraft/world/entity/projectile/LlamaSpit.java -index 0b7f27a6cc6be58fa5b60002059c9fbb3b1b7b67..a18c2b39c4fd730611f2d6ca752fcdd079686f2b 100644 +index 0b7f27a6cc6be58fa5b60002059c9fbb3b1b7b67..8b8977d9aadd929e2b1b4d8a1b76aa4f0b30352b 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/LlamaSpit.java +++ b/src/main/java/net/minecraft/world/entity/projectile/LlamaSpit.java @@ -91,9 +91,9 @@ public class LlamaSpit extends Projectile { @@ -3492,37 +4794,37 @@ index 0b7f27a6cc6be58fa5b60002059c9fbb3b1b7b67..a18c2b39c4fd730611f2d6ca752fcdd0 protected void onHitBlock(BlockHitResult blockHitResult) { super.onHitBlock(blockHitResult); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -index 275347d563fbcffa896b6c1c9f7f51c8797c2379..4f011862e00a85407f133c62ec172856e55ec242 100644 +index a7df9c2a3f210bc944cf76cdcc8d2a9484704bd1..4c65d1b1b1330b286dd32eb81bdf889c39a35166 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -@@ -353,7 +353,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { +@@ -383,7 +383,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { public boolean deflect(ProjectileDeflection deflection, @Nullable Entity deflector, @Nullable Entity owner, boolean fromAttack) { deflection.deflect(this, deflector, this.random); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag // Paper start - Fix PickupStatus getting reset if (this instanceof AbstractArrow arrow) { arrow.setOwner(owner, false); -@@ -362,7 +362,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { +@@ -392,7 +392,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { } // Paper end - Fix PickupStatus getting reset this.onDeflection(deflector, fromAttack); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return true; } diff --git a/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java b/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java -index 347b1cab11529cb5399e607626c84bc985d5c513..7f615753401a3b500257678ea5c3f30163b4e560 100644 +index 347b1cab11529cb5399e607626c84bc985d5c513..f65bd1693d3395357da07bceaf1e2480ad3db9f8 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java @@ -226,7 +226,7 @@ public class ShulkerBullet extends Projectile { @@ -3530,7 +4832,7 @@ index 347b1cab11529cb5399e607626c84bc985d5c513..7f615753401a3b500257678ea5c3f301 Vec3 vec3d; - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (this.finalTarget == null && this.targetId != null) { this.finalTarget = ((ServerLevel) this.level()).getEntity(this.targetId); if (this.finalTarget == null) { @@ -3539,7 +4841,7 @@ index 347b1cab11529cb5399e607626c84bc985d5c513..7f615753401a3b500257678ea5c3f301 movingobjectposition = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag vec3d = this.getDeltaMovement(); this.setPos(this.position().add(vec3d)); @@ -3547,16 +4849,16 @@ index 347b1cab11529cb5399e607626c84bc985d5c513..7f615753401a3b500257678ea5c3f301 } ProjectileUtil.rotateTowardsMovement(this, 0.5F); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.level().addParticle(ParticleTypes.END_ROD, this.getX() - vec3d.x, this.getY() - vec3d.y + 0.15D, this.getZ() - vec3d.z, 0.0D, 0.0D, 0.0D); - } else if (this.finalTarget != null && !this.finalTarget.isRemoved()) { -+ } else*/ if (this.finalTarget != null && !this.finalTarget.isRemoved()) { // Plazma - Remove persist flag ++ } else*/ if (this.finalTarget != null && !this.finalTarget.isRemoved()) { // Plazma - Remove persist 'isClientSide' flag if (this.flightSteps > 0) { --this.flightSteps; if (this.flightSteps == 0) { diff --git a/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java b/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java -index 69dd29ed5e3cb37180b65183b0a83c8619d8e9a0..5f58d4c560cad8e78c38a2d2205b398def556c50 100644 +index 588b07ec4501924a49264183b414a7fd64bb6550..5bdd243b96042e301eed0d232b569b2a94e394e3 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java +++ b/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java @@ -90,9 +90,9 @@ public class SmallFireball extends Fireball { @@ -3564,15 +4866,15 @@ index 69dd29ed5e3cb37180b65183b0a83c8619d8e9a0..5f58d4c560cad8e78c38a2d2205b398d protected void onHit(HitResult hitResult) { super.onHit(hitResult); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java -index 0db58e7d63a5c1b43a2224c247979f23a1d3f899..8220c0ff5d51d7e7604edb0e04b30735a08b3126 100644 +index 0db58e7d63a5c1b43a2224c247979f23a1d3f899..43e3bd03eb8378a80d1cd9a7804ac013c4333ea2 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java @@ -68,7 +68,7 @@ public class Snowball extends ThrowableItemProjectile { @@ -3580,7 +4882,7 @@ index 0db58e7d63a5c1b43a2224c247979f23a1d3f899..8220c0ff5d51d7e7604edb0e04b30735 super.onHitBlock(blockHitResult); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag net.minecraft.core.BlockPos blockposition = blockHitResult.getBlockPos(); net.minecraft.core.BlockPos blockposition1 = blockposition.relative(blockHitResult.getDirection()); @@ -3589,7 +4891,7 @@ index 0db58e7d63a5c1b43a2224c247979f23a1d3f899..8220c0ff5d51d7e7604edb0e04b30735 } } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } // Purpur end @@ -3597,32 +4899,36 @@ index 0db58e7d63a5c1b43a2224c247979f23a1d3f899..8220c0ff5d51d7e7604edb0e04b30735 protected void onHit(HitResult hitResult) { super.onHit(hitResult); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.level().broadcastEntityEvent(this, (byte) 3); this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/net/minecraft/world/entity/projectile/SpectralArrow.java b/src/main/java/net/minecraft/world/entity/projectile/SpectralArrow.java -index 85b3cdaaa1a90ad4e712955d3c8bfe3f7758b6a9..13aea64c6f73b44cfe9bf377e7c442d8e37238c7 100644 +index 85b3cdaaa1a90ad4e712955d3c8bfe3f7758b6a9..969667fb486befd1dedac9b89db95a854fee85ac 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/SpectralArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/SpectralArrow.java -@@ -30,9 +30,11 @@ public class SpectralArrow extends AbstractArrow { +@@ -27,6 +27,7 @@ public class SpectralArrow extends AbstractArrow { + super(EntityType.SPECTRAL_ARROW, x, y, z, world, stack, shotFrom); + } + ++ /* // Plazma - Remove persist 'isClientSide' flag @Override public void tick() { super.tick(); -+ /* // Plazma - Remove persist flag - if (this.level().isClientSide && !this.isInGround()) { - this.level().addParticle(ParticleTypes.INSTANT_EFFECT, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D); +@@ -35,6 +36,7 @@ public class SpectralArrow extends AbstractArrow { } -+ */ // Plazma - Remove persist flag } ++ */ // Plazma - Remove persist 'isClientSide' flag + @Override + protected void doPostHurtEffects(LivingEntity target) { diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java -index 155c2bbd35adacb7c3668fbe81a7c454e5102c8b..9a227935de879cf4babe3730c3bbd276a9fce7ec 100644 +index 155c2bbd35adacb7c3668fbe81a7c454e5102c8b..ad30bae96d147e0d2aa4f3ae5469fbf74e3010af 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java @@ -57,7 +57,7 @@ public class ThrownEgg extends ThrowableItemProjectile { @@ -3630,7 +4936,7 @@ index 155c2bbd35adacb7c3668fbe81a7c454e5102c8b..9a227935de879cf4babe3730c3bbd276 protected void onHit(HitResult hitResult) { super.onHit(hitResult); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start boolean hatching = this.random.nextInt(8) == 0; if (true) { @@ -3639,12 +4945,12 @@ index 155c2bbd35adacb7c3668fbe81a7c454e5102c8b..9a227935de879cf4babe3730c3bbd276 this.level().broadcastEntityEvent(this, (byte) 3); this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java -index 9d79b193fe2a737a20d1709548b2cd6c454ff27b..2a44d5e5a5b56184234cc8a6c656211608aefca4 100644 +index 9d79b193fe2a737a20d1709548b2cd6c454ff27b..15662c7161e8fe9b4a4a88d75c15908140014a33 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java @@ -78,7 +78,7 @@ public class ThrownPotion extends ThrowableItemProjectile { @@ -3652,7 +4958,7 @@ index 9d79b193fe2a737a20d1709548b2cd6c454ff27b..2a44d5e5a5b56184234cc8a6c6562116 protected void onHitBlock(BlockHitResult blockHitResult) { super.onHitBlock(blockHitResult); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag ItemStack itemstack = this.getItem(); Direction enumdirection = blockHitResult.getDirection(); BlockPos blockposition = blockHitResult.getBlockPos(); @@ -3661,12 +4967,12 @@ index 9d79b193fe2a737a20d1709548b2cd6c454ff27b..2a44d5e5a5b56184234cc8a6c6562116 } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java -index e63b408594b5d2673148e39c1deafc8510537bee..112140145a4a5a1c375f1036022c2414fef65e1f 100644 +index e63b408594b5d2673148e39c1deafc8510537bee..7365dcde9d134bceeaed0b0fc16ea34c163966f1 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java +++ b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java @@ -100,7 +100,7 @@ public class WitherSkull extends AbstractHurtingProjectile { @@ -3674,7 +4980,7 @@ index e63b408594b5d2673148e39c1deafc8510537bee..112140145a4a5a1c375f1036022c2414 protected void onHit(HitResult hitResult) { super.onHit(hitResult); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start // this.level().explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, World.a.MOB); ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.level().purpurConfig.witherExplosionRadius, false); // Purpur @@ -3683,12 +4989,12 @@ index e63b408594b5d2673148e39c1deafc8510537bee..112140145a4a5a1c375f1036022c2414 // CraftBukkit end this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java b/src/main/java/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java -index a325a223d06e155c01f664562db0edd0b180e356..a2212c93feca40fb7a7643a88b5447c49c4e7c34 100644 +index a325a223d06e155c01f664562db0edd0b180e356..7fed147928ae3710808101ef3f9408af470452da 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java +++ b/src/main/java/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java @@ -108,23 +108,23 @@ public abstract class AbstractWindCharge extends AbstractHurtingProjectile imple @@ -3696,7 +5002,7 @@ index a325a223d06e155c01f664562db0edd0b180e356..a2212c93feca40fb7a7643a88b5447c4 protected void onHitBlock(BlockHitResult blockHitResult) { super.onHitBlock(blockHitResult); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag Vec3i baseblockposition = blockHitResult.getDirection().getUnitVec3i(); Vec3 vec3d = Vec3.atLowerCornerOf(baseblockposition).multiply(0.25D, 0.25D, 0.25D); Vec3 vec3d1 = blockHitResult.getLocation().add(vec3d); @@ -3704,7 +5010,7 @@ index a325a223d06e155c01f664562db0edd0b180e356..a2212c93feca40fb7a7643a88b5447c4 this.explode(vec3d1); this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @@ -3712,10 +5018,10 @@ index a325a223d06e155c01f664562db0edd0b180e356..a2212c93feca40fb7a7643a88b5447c4 protected void onHit(HitResult hitResult) { super.onHit(hitResult); - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @@ -3724,12 +5030,12 @@ index a325a223d06e155c01f664562db0edd0b180e356..a2212c93feca40fb7a7643a88b5447c4 @Override public void tick() { - if (!this.level().isClientSide && this.getBlockY() > this.level().getMaxY() + 30) { -+ if (/*!this.level().isClientSide &&*/ this.getBlockY() > this.level().getMaxY() + 30) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.getBlockY() > this.level().getMaxY() + 30) { // Plazma - Remove persist 'isClientSide' flag this.explode(this.position()); this.discard(EntityRemoveEvent.Cause.OUT_OF_WORLD); // CraftBukkit - add Bukkit remove cause } else { diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java -index 56c265940208bc94f531a5af94f564b59f35ebf3..137234a6c50d35d2e470bdd0020fec2364cb0ca6 100644 +index 56c265940208bc94f531a5af94f564b59f35ebf3..fd8658223cf52bbedfe37585383686c6a5219a7d 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java @@ -178,13 +178,13 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { @@ -3737,14 +5043,14 @@ index 56c265940208bc94f531a5af94f564b59f35ebf3..137234a6c50d35d2e470bdd0020fec23 @Override public void onAboveBubbleCol(boolean drag) { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.isAboveBubbleColumn = true; this.bubbleColumnDirectionIsDown = drag; if (this.getBubbleTime() == 0) { this.setBubbleTime(60); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag this.level().addParticle(ParticleTypes.SPLASH, this.getX() + (double) this.random.nextFloat(), this.getY() + 0.7D, this.getZ() + (double) this.random.nextFloat(), 0.0D, 0.0D, 0.0D); if (this.random.nextInt(20) == 0) { @@ -3753,77 +5059,91 @@ index 56c265940208bc94f531a5af94f564b59f35ebf3..137234a6c50d35d2e470bdd0020fec23 } - if (!this.level().isClientSide && this.outOfControlTicks >= 60.0F) { -+ if (/*!this.level().isClientSide &&*/ this.outOfControlTicks >= 60.0F) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.outOfControlTicks >= 60.0F) { // Plazma - Remove persist 'isClientSide' flag this.ejectPassengers(); } -@@ -315,10 +315,12 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { +@@ -309,21 +309,25 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { + + super.tick(); + this.tickLerp(); +- if (this.isControlledByLocalInstance()) { ++ //if (this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag + if (!(this.getFirstPassenger() instanceof Player)) { + this.setPaddleState(false, false); } this.floatBoat(); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.controlBoat(); this.level().sendPacketToServer(new ServerboundPaddleBoatPacket(this.getPaddleState(0), this.getPaddleState(1))); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag this.move(MoverType.SELF, this.getDeltaMovement()); ++ /* // Plazma - Remove persist 'isClientSide' flag } else { -@@ -367,7 +369,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { + this.setDeltaMovement(Vec3.ZERO); + } ++ */ // Plazma - Remove persist 'isClientSide' flag + + // CraftBukkit start + org.bukkit.Server server = this.level().getCraftServer(); +@@ -367,7 +371,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { List list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntitySelector.pushableBy(this)); if (!list.isEmpty()) { - boolean flag = !this.level().isClientSide && !(this.getControllingPassenger() instanceof Player); -+ boolean flag = /*!this.level().isClientSide &&*/ !(this.getControllingPassenger() instanceof Player); // Plazma - Remove persist flag ++ boolean flag = /*!this.level().isClientSide &&*/ !(this.getControllingPassenger() instanceof Player); // Plazma - Remove persist 'isClientSide' flag Iterator iterator = list.iterator(); while (iterator.hasNext()) { -@@ -388,6 +390,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { +@@ -388,6 +392,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { private void tickBubbleColumn() { int i; -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { i = this.getBubbleTime(); if (i > 0) { -@@ -400,6 +403,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { +@@ -400,6 +405,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { this.bubbleAngleO = this.bubbleAngle; this.bubbleAngle = 10.0F * (float) Math.sin((double) (0.5F * (float) this.level().getGameTime())) * this.bubbleMultiplier; } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag if (!this.isAboveBubbleColumn) { this.setBubbleTime(0); } -@@ -426,7 +430,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { +@@ -426,7 +432,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { this.isAboveBubbleColumn = false; } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } -@@ -839,7 +843,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { +@@ -839,7 +845,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { public InteractionResult interact(Player player, InteractionHand hand) { InteractionResult enuminteractionresult = super.interact(player, hand); - return (InteractionResult) (enuminteractionresult != InteractionResult.PASS ? enuminteractionresult : (!player.isSecondaryUseActive() && this.outOfControlTicks < 60.0F && (this.level().isClientSide || player.startRiding(this)) ? InteractionResult.SUCCESS : InteractionResult.PASS)); -+ return (InteractionResult) (enuminteractionresult != InteractionResult.PASS ? enuminteractionresult : (!player.isSecondaryUseActive() && this.outOfControlTicks < 60.0F && (/*this.level().isClientSide ||*/ player.startRiding(this)) ? InteractionResult.SUCCESS : InteractionResult.PASS)); // Plazma - Remove persist flag ++ return (InteractionResult) (enuminteractionresult != InteractionResult.PASS ? enuminteractionresult : (!player.isSecondaryUseActive() && this.outOfControlTicks < 60.0F && (/*this.level().isClientSide ||*/ player.startRiding(this)) ? InteractionResult.SUCCESS : InteractionResult.PASS)); // Plazma - Remove persist 'isClientSide' flag } @Override -@@ -851,7 +855,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { +@@ -851,7 +857,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { @Override public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { // CraftBukkit end - if (!this.level().isClientSide && entity_removalreason.shouldDestroy() && this.isLeashed()) { -+ if (/*!this.level().isClientSide &&*/ entity_removalreason.shouldDestroy() && this.isLeashed()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ entity_removalreason.shouldDestroy() && this.isLeashed()) { // Plazma - Remove persist 'isClientSide' flag this.dropLeash(true, true); } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java -index f888f1dd2e3c228b0a370fe920b63d547bbba571..fa97779d631caaabd7ba7b74f9b620e72f3c7dc8 100644 +index f888f1dd2e3c228b0a370fe920b63d547bbba571..6ab21ca26499e7d98da87f7dfefd385239caf996 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java @@ -86,7 +86,7 @@ public abstract class AbstractChestBoat extends AbstractBoat implements HasCusto @@ -3831,34 +5151,103 @@ index f888f1dd2e3c228b0a370fe920b63d547bbba571..fa97779d631caaabd7ba7b74f9b620e7 public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { // CraftBukkit end - if (!this.level().isClientSide && entity_removalreason.shouldDestroy()) { -+ if (/*!this.level().isClientSide &&*/ entity_removalreason.shouldDestroy()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ entity_removalreason.shouldDestroy()) { // Plazma - Remove persist 'isClientSide' flag Containers.dropContents(this.level(), (Entity) this, (Container) this); } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -index b0e13160b185151e08f2e5430aa7e96977965a04..34ab7b50c0510268aee5e24599ebb04a8d958b33 100644 +index b31940441596079aae1cd2a38b9d22be18358448..4c16ccf8dc8b6558d113bb40241506c1565141f4 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java -@@ -639,7 +639,7 @@ public abstract class AbstractMinecart extends VehicleEntity { +@@ -648,51 +648,44 @@ public abstract class AbstractMinecart extends VehicleEntity { @Override public void push(Entity entity) { - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag - if (!entity.noPhysics && !this.noPhysics) { - if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper - Collision option for requiring a player participant - if (!this.hasPassenger(entity)) { -@@ -683,7 +683,7 @@ public abstract class AbstractMinecart extends VehicleEntity { +- if (!entity.noPhysics && !this.noPhysics) { +- if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper - Collision option for requiring a player participant +- if (!this.hasPassenger(entity)) { +- // CraftBukkit start +- VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity()); +- this.level().getCraftServer().getPluginManager().callEvent(collisionEvent); +- +- if (collisionEvent.isCancelled()) { +- return; +- } +- // CraftBukkit end +- double d0 = entity.getX() - this.getX(); +- double d1 = entity.getZ() - this.getZ(); +- double d2 = d0 * d0 + d1 * d1; +- +- if (d2 >= 9.999999747378752E-5D) { +- d2 = Math.sqrt(d2); +- d0 /= d2; +- d1 /= d2; +- double d3 = 1.0D / d2; +- +- if (d3 > 1.0D) { +- d3 = 1.0D; +- } ++ // Plazma start - Remove persist 'isClientSide' flag ++ if (entity.noPhysics || this.noPhysics) return; ++ if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper - Collision option for requiring a player participant ++ if (!this.hasPassenger(entity)) return; - } - } -- } -+ //} // Plazma - Remove persist flag +- d0 *= d3; +- d1 *= d3; +- d0 *= 0.10000000149011612D; +- d1 *= 0.10000000149011612D; +- d0 *= 0.5D; +- d1 *= 0.5D; +- if (entity instanceof AbstractMinecart) { +- AbstractMinecart entityminecartabstract = (AbstractMinecart) entity; +- +- this.pushOtherMinecart(entityminecartabstract, d0, d1); +- } else { +- this.push(-d0, 0.0D, -d1); +- entity.push(d0 / 4.0D, 0.0D, d1 / 4.0D); +- } +- } ++ // CraftBukkit start ++ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity()); ++ this.level().getCraftServer().getPluginManager().callEvent(collisionEvent); ++ if (collisionEvent.isCancelled()) return; ++ // CraftBukkit end + +- } +- } ++ double dX = entity.getX() - this.getX(); ++ double dZ = entity.getZ() - this.getZ(); ++ double dL = dX * dX + dZ * dZ; // deltaLength ++ if (dL < 9.999999747378752E-5D) return; ++ ++ dL = Math.sqrt(dL); ++ dX /= dL; ++ dZ /= dL; ++ ++ double dLp = 1.0D / dL; // deltaLength%p ++ if (dLp > 1.0D) dLp = 1.0D; ++ ++ dX *= dLp; ++ dZ *= dLp; ++ dX *= 0.10000000149011612D; ++ dZ *= 0.10000000149011612D; ++ dX *= 0.5D; ++ dZ *= 0.5D; ++ ++ if (entity instanceof AbstractMinecart entityminecartabstract) { ++ this.pushOtherMinecart(entityminecartabstract, dX, dZ); ++ return; + } ++ ++ this.push(-dX, 0.0D, -dZ); ++ entity.push(dX / 4.0D, 0.0D, dZ / 4.0D); ++ // Plazma end - Remove persist 'isClientSide' flag } private void pushOtherMinecart(AbstractMinecart entity, double xDiff, double zDiff) { diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java -index d528e8e4aea266c495377365f01e314001eb1970..2c6bd8b3ff4ee8bf4fc868576ef0919e3d1eefa6 100644 +index d528e8e4aea266c495377365f01e314001eb1970..fb1c8f1133809ce3f25b50da889f3539ebc0bdaa 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java @@ -138,7 +138,7 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme @@ -3866,7 +5255,7 @@ index d528e8e4aea266c495377365f01e314001eb1970..2c6bd8b3ff4ee8bf4fc868576ef0919e public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { // CraftBukkit end - if (!this.level().isClientSide && entity_removalreason.shouldDestroy()) { -+ if (/*!this.level().isClientSide &&*/ entity_removalreason.shouldDestroy()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ entity_removalreason.shouldDestroy()) { // Plazma - Remove persist 'isClientSide' flag Containers.dropContents(this.level(), (Entity) this, (Container) this); } @@ -3939,7 +5328,7 @@ index 38c7cb9a4112b7bb98942aa05533f54b3a0827c4..0ef2244e291ee2683c0ae76ad5622c8a if (this.hasFuel() && this.random.nextInt(4) == 0) { this.level().addParticle(ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 0.8, this.getZ(), 0.0, 0.0, 0.0); diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java -index d81a6874e8b25f098df619f84c359e146c7f64de..b938049afaf276bc6a7f77edf2eb5261cd3bb620 100644 +index d81a6874e8b25f098df619f84c359e146c7f64de..10bf3173b970f02029e680955b622104c1ae1c0f 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java @@ -93,7 +93,7 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper @@ -3947,12 +5336,12 @@ index d81a6874e8b25f098df619f84c359e146c7f64de..b938049afaf276bc6a7f77edf2eb5261 private void tryConsumeItems() { - if (!this.level().isClientSide && this.isAlive() && this.isEnabled() && !this.consumedItemThisFrame && this.suckInItems()) { -+ if (/*!this.level().isClientSide &&*/ this.isAlive() && this.isEnabled() && !this.consumedItemThisFrame && this.suckInItems()) { // Plazma - Remove persist flag ++ if (/*!this.level().isClientSide &&*/ this.isAlive() && this.isEnabled() && !this.consumedItemThisFrame && this.suckInItems()) { // Plazma - Remove persist 'isClientSide' flag this.consumedItemThisFrame = true; this.setChanged(); } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java -index 0652494dc5f3d999116d4380032dea0e7402caec..2f30454e01ff4eb1f6bc19b5ba51741c45bc21f1 100644 +index 0652494dc5f3d999116d4380032dea0e7402caec..63d208dbdde9cda9b0ad284f187c0cc542f88d82 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java @@ -169,12 +169,12 @@ public class MinecartTNT extends AbstractMinecart { @@ -3960,18 +5349,18 @@ index 0652494dc5f3d999116d4380032dea0e7402caec..2f30454e01ff4eb1f6bc19b5ba51741c public void primeFuse() { this.fuse = 80; - if (!this.level().isClientSide) { -+ //if (!this.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.level().broadcastEntityEvent(this, (byte) 10); if (!this.isSilent()) { this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.TNT_PRIMED, SoundSource.BLOCKS, 1.0F, 1.0F); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java -index e0ee1c10960d24d2369d16f22431a8e02a5570aa..c7182d7786aca90aa5032a5eef3aac7ffb691510 100644 +index e0ee1c10960d24d2369d16f22431a8e02a5570aa..139f066a1b3644dac927ac0a74632e92153bdd2d 100644 --- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java +++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java @@ -71,14 +71,14 @@ public class BeaconMenu extends AbstractContainerMenu { @@ -3979,7 +5368,7 @@ index e0ee1c10960d24d2369d16f22431a8e02a5570aa..c7182d7786aca90aa5032a5eef3aac7f public void removed(Player player) { super.removed(player); - if (!player.level().isClientSide) { -+ //if (!player.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!player.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag ItemStack itemstack = this.paymentSlot.remove(this.paymentSlot.getMaxStackSize()); if (!itemstack.isEmpty()) { @@ -3987,12 +5376,12 @@ index e0ee1c10960d24d2369d16f22431a8e02a5570aa..c7182d7786aca90aa5032a5eef3aac7f } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/inventory/InventoryMenu.java b/src/main/java/net/minecraft/world/inventory/InventoryMenu.java -index 5685a3aeef1f7c5a1edebce0eae5cfb0ed179df6..7009c3916c614bcf11263ec21f3de4159e052df0 100644 +index 5685a3aeef1f7c5a1edebce0eae5cfb0ed179df6..9fcbfa64aef0d11998f8c85fa79a7a48a5413568 100644 --- a/src/main/java/net/minecraft/world/inventory/InventoryMenu.java +++ b/src/main/java/net/minecraft/world/inventory/InventoryMenu.java @@ -42,18 +42,16 @@ public class InventoryMenu extends AbstractCraftingMenu { @@ -4006,7 +5395,7 @@ index 5685a3aeef1f7c5a1edebce0eae5cfb0ed179df6..7009c3916c614bcf11263ec21f3de415 // CraftBukkit end - public InventoryMenu(Inventory inventory, boolean onServer, final Player owner) { -+ public InventoryMenu(Inventory inventory, final Player owner) { // Plazma - Remove persist flag ++ public InventoryMenu(Inventory inventory, final Player owner) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start super((MenuType) null, 0, 2, 2, inventory); // CraftBukkit - save player this.setTitle(Component.translatable("container.crafting")); // SPIGOT-4722: Allocate title for player inventory @@ -4020,15 +5409,15 @@ index 5685a3aeef1f7c5a1edebce0eae5cfb0ed179df6..7009c3916c614bcf11263ec21f3de415 super.removed(player); this.resultSlots.clearContent(); - if (!player.level().isClientSide) { -+ //if (!player.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!player.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.clearContainer(player, this.craftSlots); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/inventory/MerchantMenu.java b/src/main/java/net/minecraft/world/inventory/MerchantMenu.java -index 6a529b5e289c416c0ebdc0260086ec039777aa40..c5b20e917cac20922ab8320899e330340c8ca64d 100644 +index 6a529b5e289c416c0ebdc0260086ec039777aa40..22cbe82a4afab9efd2776600e0e67ac65396c73a 100644 --- a/src/main/java/net/minecraft/world/inventory/MerchantMenu.java +++ b/src/main/java/net/minecraft/world/inventory/MerchantMenu.java @@ -174,7 +174,7 @@ public class MerchantMenu extends AbstractContainerMenu { @@ -4036,7 +5425,7 @@ index 6a529b5e289c416c0ebdc0260086ec039777aa40..c5b20e917cac20922ab8320899e33034 private void playTradeSound() { - if (!this.trader.isClientSide() && this.trader instanceof Entity) { // CraftBukkit - SPIGOT-5035 -+ if (/*!this.trader.isClientSide() &&*/ this.trader instanceof Entity) { // CraftBukkit - SPIGOT-5035 // Plazma - Remove persist flag ++ if (/*!this.trader.isClientSide() &&*/ this.trader instanceof Entity) { // CraftBukkit - SPIGOT-5035 // Plazma - Remove persist 'isClientSide' flag Entity entity = (Entity) this.trader; entity.level().playLocalSound(entity.getX(), entity.getY(), entity.getZ(), this.trader.getNotifyTradeSound(), SoundSource.NEUTRAL, 1.0F, 1.0F, false); @@ -4045,7 +5434,7 @@ index 6a529b5e289c416c0ebdc0260086ec039777aa40..c5b20e917cac20922ab8320899e33034 super.removed(player); this.trader.setTradingPlayer((Player) null); - if (!this.trader.isClientSide()) { -+ //if (!this.trader.isClientSide()) { // Plazma - Remove persist flag ++ //if (!this.trader.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag if (player.isAlive() && (!(player instanceof ServerPlayer) || !((ServerPlayer) player).hasDisconnected())) { if (player instanceof ServerPlayer) { player.getInventory().placeItemBackInInventory(this.tradeContainer.removeItemNoUpdate(0)); @@ -4054,12 +5443,12 @@ index 6a529b5e289c416c0ebdc0260086ec039777aa40..c5b20e917cac20922ab8320899e33034 } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } public void tryMoveItems(int recipeIndex) { diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java -index d58619d1d63a03598b8740dd789d4b6f2c93f8d0..0c311c271c74df4424ccd8882749e83246a1f581 100644 +index d58619d1d63a03598b8740dd789d4b6f2c93f8d0..1a989b55cc7f411b7d3270e537bf711396be0864 100644 --- a/src/main/java/net/minecraft/world/item/BlockItem.java +++ b/src/main/java/net/minecraft/world/item/BlockItem.java @@ -221,8 +221,8 @@ public class BlockItem extends Item { @@ -4068,13 +5457,13 @@ index d58619d1d63a03598b8740dd789d4b6f2c93f8d0..0c311c271c74df4424ccd8882749e832 if (tileentity != null) { - if (!world.isClientSide && tileentity.onlyOpCanSetNbt() && (player == null || !(player.canUseGameMasterBlocks() || (player.getAbilities().instabuild && player.getBukkitEntity().hasPermission("minecraft.nbt.place"))))) { // Spigot - add permission - if (!(!world.isClientSide && world.purpurConfig.silkTouchEnabled && tileentity instanceof net.minecraft.world.level.block.entity.SpawnerBlockEntity && player.getBukkitEntity().hasPermission("purpur.drop.spawners"))) -+ if (/*!world.isClientSide &&*/ tileentity.onlyOpCanSetNbt() && (player == null || !(player.canUseGameMasterBlocks() || (player.getAbilities().instabuild && player.getBukkitEntity().hasPermission("minecraft.nbt.place"))))) { // Spigot - add permission // Plazma - Remove persist flag -+ if (!(/*!world.isClientSide &&*/ world.purpurConfig.silkTouchEnabled && tileentity instanceof net.minecraft.world.level.block.entity.SpawnerBlockEntity && player.getBukkitEntity().hasPermission("purpur.drop.spawners"))) // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ tileentity.onlyOpCanSetNbt() && (player == null || !(player.canUseGameMasterBlocks() || (player.getAbilities().instabuild && player.getBukkitEntity().hasPermission("minecraft.nbt.place"))))) { // Spigot - add permission // Plazma - Remove persist 'isClientSide' flag ++ if (!(/*!world.isClientSide &&*/ world.purpurConfig.silkTouchEnabled && tileentity instanceof net.minecraft.world.level.block.entity.SpawnerBlockEntity && player.getBukkitEntity().hasPermission("purpur.drop.spawners"))) // Plazma - Remove persist 'isClientSide' flag return false; } diff --git a/src/main/java/net/minecraft/world/item/BoatItem.java b/src/main/java/net/minecraft/world/item/BoatItem.java -index 78d41d57df9cb61b295f1f54db1e1d62c13db701..08e7f71bb8a92a4233e837946703a3c667e97a5a 100644 +index 78d41d57df9cb61b295f1f54db1e1d62c13db701..86f2a6eac07f8886ee1674fb984c0b986dcad060 100644 --- a/src/main/java/net/minecraft/world/item/BoatItem.java +++ b/src/main/java/net/minecraft/world/item/BoatItem.java @@ -79,7 +79,7 @@ public class BoatItem extends Item { @@ -4082,7 +5471,7 @@ index 78d41d57df9cb61b295f1f54db1e1d62c13db701..08e7f71bb8a92a4233e837946703a3c6 return InteractionResult.FAIL; } else { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), user, abstractboat, hand).isCancelled()) { return InteractionResult.FAIL; @@ -4091,12 +5480,12 @@ index 78d41d57df9cb61b295f1f54db1e1d62c13db701..08e7f71bb8a92a4233e837946703a3c6 world.gameEvent((Entity) user, (Holder) GameEvent.ENTITY_PLACE, movingobjectpositionblock.getLocation()); itemstack.consume(1, user); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag user.awardStat(Stats.ITEM_USED.get(this)); return InteractionResult.SUCCESS; diff --git a/src/main/java/net/minecraft/world/item/BoneMealItem.java b/src/main/java/net/minecraft/world/item/BoneMealItem.java -index c7d4a09c11f933494ab047921660451c6c1c7280..dfc368f197e1c5349c0ae5ae5b51d399e413bd92 100644 +index c7d4a09c11f933494ab047921660451c6c1c7280..69125b16efeee7554ca48fd28b97aca5a98d62fe 100644 --- a/src/main/java/net/minecraft/world/item/BoneMealItem.java +++ b/src/main/java/net/minecraft/world/item/BoneMealItem.java @@ -46,10 +46,10 @@ public class BoneMealItem extends Item { @@ -4104,11 +5493,11 @@ index c7d4a09c11f933494ab047921660451c6c1c7280..dfc368f197e1c5349c0ae5ae5b51d399 if (BoneMealItem.growCrop(itemactioncontext.getItemInHand(), world, blockposition)) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (itemactioncontext.getPlayer() != null) itemactioncontext.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH); // CraftBukkit - SPIGOT-7518 world.levelEvent(1505, blockposition, 15); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { @@ -4117,16 +5506,16 @@ index c7d4a09c11f933494ab047921660451c6c1c7280..dfc368f197e1c5349c0ae5ae5b51d399 if (flag && BoneMealItem.growWaterPlant(itemactioncontext.getItemInHand(), world, blockposition1, itemactioncontext.getClickedFace())) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (itemactioncontext.getPlayer() != null) itemactioncontext.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH); // CraftBukkit - SPIGOT-7518 world.levelEvent(1505, blockposition1, 15); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java -index 6aa8ee091d3a7d2826d08ab9a03f970ef71a81ea..7c2fc04c8cd70dea0964dbee3f07e06b40b8bc5c 100644 +index 6aa8ee091d3a7d2826d08ab9a03f970ef71a81ea..a7694884434e702f1ac43c3c8426b47d6663c286 100644 --- a/src/main/java/net/minecraft/world/item/BucketItem.java +++ b/src/main/java/net/minecraft/world/item/BucketItem.java @@ -94,9 +94,9 @@ public class BucketItem extends Item implements DispensibleContainerItem { @@ -4134,10 +5523,10 @@ index 6aa8ee091d3a7d2826d08ab9a03f970ef71a81ea..7c2fc04c8cd70dea0964dbee3f07e06b ItemStack itemstack2 = ItemUtils.createFilledResult(itemstack, user, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag CriteriaTriggers.FILLED_BUCKET.trigger((ServerPlayer) user, itemstack1); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS.heldItemTransformedTo(itemstack2); } @@ -4146,7 +5535,7 @@ index 6aa8ee091d3a7d2826d08ab9a03f970ef71a81ea..7c2fc04c8cd70dea0964dbee3f07e06b } - if (!world.isClientSide && flag && !iblockdata.liquid()) { -+ if (/*!world.isClientSide &&*/ flag && !iblockdata.liquid()) { // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ flag && !iblockdata.liquid()) { // Plazma - Remove persist 'isClientSide' flag world.destroyBlock(blockposition, true); } @@ -4180,7 +5569,7 @@ index f1999d904ac66f5349346ad8157f5401fb395e11..23f6fa49af0c124b75188d4a69af30fd boolean bl = remainingUseTicks == i; if (bl || remainingUseTicks < i - 10 && remainingUseTicks % 2 == 0) { diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java -index 86204c2ab5bbd5d45ddb1d626f844d91ccae6b4f..32979a0196f43fbcbe7306f8db2026d5a03ac185 100644 +index 86204c2ab5bbd5d45ddb1d626f844d91ccae6b4f..6ffbe9d3be2ef3cb9c8f08db0373379856cc748b 100644 --- a/src/main/java/net/minecraft/world/item/CrossbowItem.java +++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java @@ -222,7 +222,7 @@ public class CrossbowItem extends ProjectileWeaponItem { @@ -4188,7 +5577,7 @@ index 86204c2ab5bbd5d45ddb1d626f844d91ccae6b4f..32979a0196f43fbcbe7306f8db2026d5 @Override public void onUseTick(Level world, LivingEntity user, ItemStack stack, int remainingUseTicks) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag CrossbowItem.ChargingSounds chargingSounds = this.getChargingSounds(stack); float f = (float)(stack.getUseDuration(user) - remainingUseTicks) / (float)getChargeDuration(stack, user); if (f < 0.2F) { @@ -4197,12 +5586,12 @@ index 86204c2ab5bbd5d45ddb1d626f844d91ccae6b4f..32979a0196f43fbcbe7306f8db2026d5 .ifPresent(sound -> world.playSound(null, user.getX(), user.getY(), user.getZ(), sound.value(), SoundSource.PLAYERS, 0.5F, 1.0F)); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/item/DebugStickItem.java b/src/main/java/net/minecraft/world/item/DebugStickItem.java -index 97fc76c9b93e61445fe73390d088a6e512b2cb47..e481ba350ffa57fb30cc7ba2f0302e0553ae773d 100644 +index 97fc76c9b93e61445fe73390d088a6e512b2cb47..d4245a0103fcb89895c9e355e34ea966f0221df9 100644 --- a/src/main/java/net/minecraft/world/item/DebugStickItem.java +++ b/src/main/java/net/minecraft/world/item/DebugStickItem.java @@ -29,9 +29,9 @@ public class DebugStickItem extends Item { @@ -4210,10 +5599,10 @@ index 97fc76c9b93e61445fe73390d088a6e512b2cb47..e481ba350ffa57fb30cc7ba2f0302e05 @Override public boolean canAttackBlock(BlockState state, Level world, BlockPos pos, Player miner) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.handleInteraction(miner, state, world, pos, false, miner.getItemInHand(InteractionHand.MAIN_HAND)); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return false; } @@ -4222,12 +5611,12 @@ index 97fc76c9b93e61445fe73390d088a6e512b2cb47..e481ba350ffa57fb30cc7ba2f0302e05 Level world = context.getLevel(); - if (!world.isClientSide && entityhuman != null) { -+ if (/*!world.isClientSide &&*/ entityhuman != null) { // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ entityhuman != null) { // Plazma - Remove persist 'isClientSide' flag BlockPos blockposition = context.getClickedPos(); if (!this.handleInteraction(entityhuman, world.getBlockState(blockposition), world, blockposition, true, context.getItemInHand())) { diff --git a/src/main/java/net/minecraft/world/item/DyeItem.java b/src/main/java/net/minecraft/world/item/DyeItem.java -index a3e82a50b0cfd02d2b8e27074e1f97557bb1c9bb..81bcbb55017a55da1cf422bc3ae7a71727738bcd 100644 +index a3e82a50b0cfd02d2b8e27074e1f97557bb1c9bb..6fb374632d9b90df013fe07fafcc79c96e29adda 100644 --- a/src/main/java/net/minecraft/world/item/DyeItem.java +++ b/src/main/java/net/minecraft/world/item/DyeItem.java @@ -30,7 +30,7 @@ public class DyeItem extends Item implements SignApplicator { @@ -4235,7 +5624,7 @@ index a3e82a50b0cfd02d2b8e27074e1f97557bb1c9bb..81bcbb55017a55da1cf422bc3ae7a717 if (entitysheep.isAlive() && !entitysheep.isSheared() && entitysheep.getColor() != this.dyeColor) { entitysheep.level().playSound(user, (Entity) entitysheep, SoundEvents.DYE_USE, SoundSource.PLAYERS, 1.0F, 1.0F); - if (!user.level().isClientSide) { -+ //if (!user.level().isClientSide) { // Plazma - Remove persist flag ++ //if (!user.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start byte bColor = (byte) this.dyeColor.getId(); SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByWoolData(bColor), (org.bukkit.entity.Player) user.getBukkitEntity()); @@ -4244,7 +5633,7 @@ index a3e82a50b0cfd02d2b8e27074e1f97557bb1c9bb..81bcbb55017a55da1cf422bc3ae7a717 // CraftBukkit end stack.shrink(1); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } @@ -4273,18 +5662,18 @@ index 588b6c94bb9a3372e1e5e32e177379dcc7709a84..ad95332084072c1c932ad1dd077346d9 } } diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java -index c71a426c47e0ebc57ecb8c9c1d171737a084ccab..995f71c43794e53873e7afa2328d9112882d6a83 100644 +index c71a426c47e0ebc57ecb8c9c1d171737a084ccab..05264c4f0d2f13758d5726ab8b145d20fed4187c 100644 --- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java +++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java @@ -41,9 +41,11 @@ public class EnderEyeItem extends Item { BlockState iblockdata = world.getBlockState(blockposition); if (iblockdata.is(Blocks.END_PORTAL_FRAME) && !(Boolean) iblockdata.getValue(EndPortalFrameBlock.HAS_EYE)) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return InteractionResult.SUCCESS; } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag BlockState iblockdata1 = (BlockState) iblockdata.setValue(EndPortalFrameBlock.HAS_EYE, true); // Paper start if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(context.getPlayer(), blockposition, iblockdata1)) { @@ -4293,12 +5682,12 @@ index c71a426c47e0ebc57ecb8c9c1d171737a084ccab..995f71c43794e53873e7afa2328d9112 return InteractionResult.SUCCESS; - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } else { return InteractionResult.PASS; } diff --git a/src/main/java/net/minecraft/world/item/FishingRodItem.java b/src/main/java/net/minecraft/world/item/FishingRodItem.java -index 801a513d67637136a15307a98fc6bbec9d202b00..49d91eb7f4acf73a9b38140fc1267abb81cccf59 100644 +index 801a513d67637136a15307a98fc6bbec9d202b00..e079c3392997ac8a2d7d915cadd8ece189eb5054 100644 --- a/src/main/java/net/minecraft/world/item/FishingRodItem.java +++ b/src/main/java/net/minecraft/world/item/FishingRodItem.java @@ -30,11 +30,11 @@ public class FishingRodItem extends Item { @@ -4306,12 +5695,12 @@ index 801a513d67637136a15307a98fc6bbec9d202b00..49d91eb7f4acf73a9b38140fc1267abb if (user.fishing != null) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag int i = user.fishing.retrieve(hand, itemstack); // Paper - Add hand parameter to PlayerFishEvent itemstack.hurtAndBreak(i, user, LivingEntity.getSlotForHand(hand)); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag world.playSound((Player) null, user.getX(), user.getY(), user.getZ(), SoundEvents.FISHING_BOBBER_RETRIEVE, SoundSource.NEUTRAL, 1.0F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); user.gameEvent(GameEvent.ITEM_INTERACT_FINISH); @@ -4340,7 +5729,7 @@ index a8188a10d3569c9aef16d64f6e56db367769af61..9e42239f6dc236c304e7cd61c1aa8f98 } } diff --git a/src/main/java/net/minecraft/world/item/HangingEntityItem.java b/src/main/java/net/minecraft/world/item/HangingEntityItem.java -index 44a7cee7df2927a923455e8cedaab59307b42506..2a1f8362d77d4497435cf38f94cc39bca827220b 100644 +index 44a7cee7df2927a923455e8cedaab59307b42506..267c30b20e1dba9f7c13bf770f4e8d3c28c6808e 100644 --- a/src/main/java/net/minecraft/world/item/HangingEntityItem.java +++ b/src/main/java/net/minecraft/world/item/HangingEntityItem.java @@ -83,7 +83,7 @@ public class HangingEntityItem extends Item { @@ -4348,7 +5737,7 @@ index 44a7cee7df2927a923455e8cedaab59307b42506..2a1f8362d77d4497435cf38f94cc39bc if (((HangingEntity) object).survives()) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start - fire HangingPlaceEvent Player who = (context.getPlayer() == null) ? null : (Player) context.getPlayer().getBukkitEntity(); org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); @@ -4357,12 +5746,12 @@ index 44a7cee7df2927a923455e8cedaab59307b42506..2a1f8362d77d4497435cf38f94cc39bc world.gameEvent((Entity) entityhuman, (Holder) GameEvent.ENTITY_PLACE, ((HangingEntity) object).position()); world.addFreshEntity((Entity) object); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag itemstack.shrink(1); return InteractionResult.SUCCESS; diff --git a/src/main/java/net/minecraft/world/item/HoeItem.java b/src/main/java/net/minecraft/world/item/HoeItem.java -index 0936bdc945f73c7750c20a34276aead2921eeb61..c8fc5d8662297926689cdd78786f5416b4960dfd 100644 +index 0936bdc945f73c7750c20a34276aead2921eeb61..0b530ae9aa19a2f6917fc8a25a64a6287eebf554 100644 --- a/src/main/java/net/minecraft/world/item/HoeItem.java +++ b/src/main/java/net/minecraft/world/item/HoeItem.java @@ -63,12 +63,12 @@ public class HoeItem extends DiggerItem { @@ -4370,13 +5759,13 @@ index 0936bdc945f73c7750c20a34276aead2921eeb61..c8fc5d8662297926689cdd78786f5416 Player player = context.getPlayer(); if (!TILLABLES.containsKey(clickedBlock)) level.playSound(null, blockPos, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound - if (!level.isClientSide) { -+ //if (!level.isClientSide) { // Plazma - Remove persist flag ++ //if (!level.isClientSide) { // Plazma - Remove persist 'isClientSide' flag consumer.accept(context); if (player != null) { context.getItemInHand().hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand())); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { @@ -4394,7 +5783,7 @@ index 3d948c8d325bcef7f4cfc0045f9991acb3aa2f7c..7fc8fcab93be9076391a2981d028831c } diff --git a/src/main/java/net/minecraft/world/item/ItemUtils.java b/src/main/java/net/minecraft/world/item/ItemUtils.java -index 0c4074ed8b4fd9d6fcb838e8843d66f6f286ed5d..9c6fc26c597e1f3050601eed40f1f0c9823df9ac 100644 +index 0c4074ed8b4fd9d6fcb838e8843d66f6f286ed5d..c2c075c9372d34ba94af8367709af0993d359309 100644 --- a/src/main/java/net/minecraft/world/item/ItemUtils.java +++ b/src/main/java/net/minecraft/world/item/ItemUtils.java @@ -40,7 +40,7 @@ public class ItemUtils { @@ -4402,7 +5791,7 @@ index 0c4074ed8b4fd9d6fcb838e8843d66f6f286ed5d..9c6fc26c597e1f3050601eed40f1f0c9 public static void onContainerDestroyed(ItemEntity itemEntity, Iterable contents) { Level level = itemEntity.level(); - if (!level.isClientSide) { -+ //if (!level.isClientSide) { // Plazma - Remove persist flag ++ //if (!level.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // Paper start - call EntityDropItemEvent contents.forEach(stack -> { ItemEntity droppedItem = new ItemEntity(level, itemEntity.getX(), itemEntity.getY(), itemEntity.getZ(), stack); @@ -4411,7 +5800,7 @@ index 0c4074ed8b4fd9d6fcb838e8843d66f6f286ed5d..9c6fc26c597e1f3050601eed40f1f0c9 }); // Paper end - call EntityDropItemEvent - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/net/minecraft/world/item/JukeboxPlayable.java b/src/main/java/net/minecraft/world/item/JukeboxPlayable.java @@ -4459,7 +5848,7 @@ index f378bbd2fec6b74020417728c45d48d13c9d1a98..48eab51b8e050daa21f4834d946fccc5 return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/item/LeadItem.java b/src/main/java/net/minecraft/world/item/LeadItem.java -index 7c910d96edac066d4634bc6f6049a72238884ae9..9ed61a5aa79810ab6d3f65c446fb83f03292de20 100644 +index 7c910d96edac066d4634bc6f6049a72238884ae9..6d12dce8e50ce73602341fd7d78e314146151501 100644 --- a/src/main/java/net/minecraft/world/item/LeadItem.java +++ b/src/main/java/net/minecraft/world/item/LeadItem.java @@ -39,7 +39,7 @@ public class LeadItem extends Item { @@ -4467,12 +5856,12 @@ index 7c910d96edac066d4634bc6f6049a72238884ae9..9ed61a5aa79810ab6d3f65c446fb83f0 Player entityhuman = context.getPlayer(); - if (!world.isClientSide && entityhuman != null) { -+ if (/*!world.isClientSide &&*/ entityhuman != null) { // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ entityhuman != null) { // Plazma - Remove persist 'isClientSide' flag return LeadItem.bindPlayerMobs(entityhuman, world, blockposition, context.getHand()); // CraftBukkit - Pass hand } } diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java -index c2f3c8b3d8eeb609b6d6067c4fb404aefbf94ec5..8114d61638c49ae91aacd3a3455a0b28cf311ac0 100644 +index c2f3c8b3d8eeb609b6d6067c4fb404aefbf94ec5..8c455ac7dcb126e2b2932eba980454513947fac2 100644 --- a/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java @@ -269,7 +269,7 @@ public class MapItem extends Item { @@ -4480,7 +5869,7 @@ index c2f3c8b3d8eeb609b6d6067c4fb404aefbf94ec5..8114d61638c49ae91aacd3a3455a0b28 @Override public void inventoryTick(ItemStack stack, Level world, Entity entity, int slot, boolean selected) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag MapItemSavedData mapItemSavedData = getSavedData(stack, world); if (mapItemSavedData != null) { if (entity instanceof Player player) { @@ -4489,7 +5878,7 @@ index c2f3c8b3d8eeb609b6d6067c4fb404aefbf94ec5..8114d61638c49ae91aacd3a3455a0b28 } } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override @@ -4498,18 +5887,18 @@ index c2f3c8b3d8eeb609b6d6067c4fb404aefbf94ec5..8114d61638c49ae91aacd3a3455a0b28 BlockState blockState = context.getLevel().getBlockState(context.getClickedPos()); if (blockState.is(BlockTags.BANNERS)) { - if (!context.getLevel().isClientSide) { -+ //if (!context.getLevel().isClientSide) { // Plazma - Remove persist flag ++ //if (!context.getLevel().isClientSide) { // Plazma - Remove persist 'isClientSide' flag MapItemSavedData mapItemSavedData = getSavedData(context.getItemInHand(), context.getLevel()); if (mapItemSavedData != null && !mapItemSavedData.toggleBanner(context.getLevel(), context.getClickedPos())) { return InteractionResult.FAIL; } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/item/NameTagItem.java b/src/main/java/net/minecraft/world/item/NameTagItem.java -index 20fece9908382f40b4082f7b1fb7d41914ae31be..92d7515131713cf8dbcf1fc7c9a3c111b17a8e54 100644 +index 20fece9908382f40b4082f7b1fb7d41914ae31be..4df7168ccb37ebde8e9d39145379298b986621c8 100644 --- a/src/main/java/net/minecraft/world/item/NameTagItem.java +++ b/src/main/java/net/minecraft/world/item/NameTagItem.java @@ -17,7 +17,7 @@ public class NameTagItem extends Item { @@ -4517,12 +5906,12 @@ index 20fece9908382f40b4082f7b1fb7d41914ae31be..92d7515131713cf8dbcf1fc7c9a3c111 Component component = stack.get(DataComponents.CUSTOM_NAME); if (component != null && entity.getType().canSerialize()) { - if (!user.level().isClientSide && entity.isAlive()) { -+ if (/*!user.level().isClientSide &&*/ entity.isAlive()) { // Plazma - Remove persist flag ++ if (/*!user.level().isClientSide &&*/ entity.isAlive()) { // Plazma - Remove persist 'isClientSide' flag // Paper start - Add PlayerNameEntityEvent io.papermc.paper.event.player.PlayerNameEntityEvent event = new io.papermc.paper.event.player.PlayerNameEntityEvent(((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity(), entity.getBukkitLivingEntity(), io.papermc.paper.adventure.PaperAdventure.asAdventure(stack.getHoverName()), true); if (!event.callEvent()) return InteractionResult.PASS; diff --git a/src/main/java/net/minecraft/world/item/PotionItem.java b/src/main/java/net/minecraft/world/item/PotionItem.java -index f19bd2c25d3c84d9f16cad38ac5c32736f0f3a8d..cb48f2d81db156fcb3842788488120f999f058be 100644 +index f19bd2c25d3c84d9f16cad38ac5c32736f0f3a8d..a4d6781bb0e3173f30601bd6f1cef6d9a0cf2934 100644 --- a/src/main/java/net/minecraft/world/item/PotionItem.java +++ b/src/main/java/net/minecraft/world/item/PotionItem.java @@ -51,7 +51,7 @@ public class PotionItem extends Item { @@ -4530,7 +5919,7 @@ index f19bd2c25d3c84d9f16cad38ac5c32736f0f3a8d..cb48f2d81db156fcb3842788488120f9 player.setItemInHand(context.getHand(), ItemUtils.createFilledResult(itemStack, player, new ItemStack(Items.GLASS_BOTTLE))); player.awardStat(Stats.ITEM_USED.get(itemStack.getItem())); - if (!level.isClientSide) { -+ //if (!level.isClientSide) { // Plazma - Remove persist flag ++ //if (!level.isClientSide) { // Plazma - Remove persist 'isClientSide' flag ServerLevel serverLevel = (ServerLevel)level; for (int i = 0; i < 5; i++) { @@ -4539,7 +5928,7 @@ index f19bd2c25d3c84d9f16cad38ac5c32736f0f3a8d..cb48f2d81db156fcb3842788488120f9 ); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag level.playSound(null, blockPos, SoundEvents.BOTTLE_EMPTY, SoundSource.BLOCKS, 1.0F, 1.0F); level.gameEvent(null, GameEvent.FLUID_PLACE, blockPos); @@ -4587,7 +5976,7 @@ index 374d51da03ce47ff744b64b8cfe98ad6d72ebdb4..90259b0156f32a6c2693ba750d055df1 } diff --git a/src/main/java/net/minecraft/world/item/ShovelItem.java b/src/main/java/net/minecraft/world/item/ShovelItem.java -index d10c4705cc9e7faabd4a5619e1da107231bdb37e..a8af31771082a3d06c8703c66c2af05c6be8be34 100644 +index d10c4705cc9e7faabd4a5619e1da107231bdb37e..43e0a8c66e0b56094c4846c36932a9ed76d139b0 100644 --- a/src/main/java/net/minecraft/world/item/ShovelItem.java +++ b/src/main/java/net/minecraft/world/item/ShovelItem.java @@ -55,9 +55,9 @@ public class ShovelItem extends DiggerItem { @@ -4595,10 +5984,10 @@ index d10c4705cc9e7faabd4a5619e1da107231bdb37e..a8af31771082a3d06c8703c66c2af05c } else if (blockState.getBlock() instanceof CampfireBlock && blockState.getValue(CampfireBlock.LIT)) { afterAction = () -> { // Paper - if (!level.isClientSide()) { -+ //if (!level.isClientSide()) { // Plazma - Remove persist flag ++ //if (!level.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag level.levelEvent(null, 1009, blockPos, 0); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag CampfireBlock.dowse(context.getPlayer(), level, blockPos, blockState); }; // Paper @@ -4607,7 +5996,7 @@ index d10c4705cc9e7faabd4a5619e1da107231bdb37e..a8af31771082a3d06c8703c66c2af05c if (blockState3 != null) { - if (!level.isClientSide) { -+ //if (!level.isClientSide) { // Plazma - Remove persist flag ++ //if (!level.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // Paper start if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(context.getPlayer(), blockPos, blockState3)) { return InteractionResult.PASS; @@ -4616,12 +6005,12 @@ index d10c4705cc9e7faabd4a5619e1da107231bdb37e..a8af31771082a3d06c8703c66c2af05c context.getItemInHand().hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand())); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/item/SignItem.java b/src/main/java/net/minecraft/world/item/SignItem.java -index fcc78491cef1cf1535888c4ed43c3b71fb597848..d2cb2a6e61ca4aebc56e87e4916e2bf84b243219 100644 +index fcc78491cef1cf1535888c4ed43c3b71fb597848..2b160d620624187d1d96068b8095844f623505bb 100644 --- a/src/main/java/net/minecraft/world/item/SignItem.java +++ b/src/main/java/net/minecraft/world/item/SignItem.java @@ -27,7 +27,7 @@ public class SignItem extends StandingAndWallBlockItem { @@ -4629,7 +6018,7 @@ index fcc78491cef1cf1535888c4ed43c3b71fb597848..d2cb2a6e61ca4aebc56e87e4916e2bf8 boolean flag = super.updateCustomBlockEntityTag(pos, world, player, stack, state); - if (!world.isClientSide && !flag && player != null) { -+ if (/*!world.isClientSide &&*/ !flag && player != null) { // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ !flag && player != null) { // Plazma - Remove persist 'isClientSide' flag BlockEntity tileentity = world.getBlockEntity(pos); if (tileentity instanceof SignBlockEntity) { @@ -4650,18 +6039,18 @@ index 867b1326eaaa4a0ff7c5773e0098ebf68a55c519..d856dfd4a59de600291f2cdc139ce553 world.gameEvent(player, GameEvent.FLUID_PLACE, pos); world.playSound(player, pos, this.placeSound, SoundSource.BLOCKS, 1.0F, 1.0F); diff --git a/src/main/java/net/minecraft/world/item/SpawnEggItem.java b/src/main/java/net/minecraft/world/item/SpawnEggItem.java -index e0e746d6c78421b40777125ba49f0a04809f5415..fd4ac008b5677cbe18995566e10678f35dc07e66 100644 +index e0e746d6c78421b40777125ba49f0a04809f5415..5d89be2a176bd48c9c0e287f118976f2d65b2261 100644 --- a/src/main/java/net/minecraft/world/item/SpawnEggItem.java +++ b/src/main/java/net/minecraft/world/item/SpawnEggItem.java @@ -57,9 +57,11 @@ public class SpawnEggItem extends Item { public InteractionResult useOn(UseOnContext context) { Level world = context.getLevel(); -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return InteractionResult.SUCCESS; } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag ItemStack itemstack = context.getItemInHand(); BlockPos blockposition = context.getClickedPos(); Direction enumdirection = context.getClickedFace(); @@ -4670,7 +6059,7 @@ index e0e746d6c78421b40777125ba49f0a04809f5415..fd4ac008b5677cbe18995566e10678f3 return InteractionResult.SUCCESS; } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override @@ -4679,10 +6068,10 @@ index e0e746d6c78421b40777125ba49f0a04809f5415..fd4ac008b5677cbe18995566e10678f3 if (movingobjectpositionblock.getType() != HitResult.Type.BLOCK) { return InteractionResult.PASS; - } else if (world.isClientSide) { -+ } /*else if (world.isClientSide) { // Plazma - Remove persist flag ++ } /*else if (world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag BlockPos blockposition = movingobjectpositionblock.getBlockPos(); if (!(world.getBlockState(blockposition).getBlock() instanceof LiquidBlock)) { @@ -4691,12 +6080,12 @@ index e0e746d6c78421b40777125ba49f0a04809f5415..fd4ac008b5677cbe18995566e10678f3 return InteractionResult.FAIL; } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } public boolean spawnsEntity(ItemStack stack, EntityType type) { diff --git a/src/main/java/net/minecraft/world/item/component/Consumable.java b/src/main/java/net/minecraft/world/item/component/Consumable.java -index 6be5e7b0ce975702ae7c337a06faa59ff3414d64..b493028c1a5b668d77caffe42097704bacfb1e19 100644 +index 6be5e7b0ce975702ae7c337a06faa59ff3414d64..a992094d5b40c3b56b14182cfcb9884ee52604cc 100644 --- a/src/main/java/net/minecraft/world/item/component/Consumable.java +++ b/src/main/java/net/minecraft/world/item/component/Consumable.java @@ -73,7 +73,7 @@ public record Consumable(float consumeSeconds, ItemUseAnimation animation, Holde @@ -4704,7 +6093,7 @@ index 6be5e7b0ce975702ae7c337a06faa59ff3414d64..b493028c1a5b668d77caffe42097704b consumablelistener.onConsume(world, user, stack, this); }); - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start EntityPotionEffectEvent.Cause cause; if (stack.is(Items.MILK_BUCKET)) { @@ -4713,7 +6102,7 @@ index 6be5e7b0ce975702ae7c337a06faa59ff3414d64..b493028c1a5b668d77caffe42097704b // CraftBukkit end }); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag user.gameEvent(this.animation == ItemUseAnimation.DRINK ? GameEvent.DRINK : GameEvent.EAT); stack.consume(1, user); @@ -4734,7 +6123,7 @@ index 1263f84cfe3b9f6ff7b33f04528a3f01ded8b670..9ff0b7fd831ae7a318f1106303e27d0f if (stack.getCount() <= 1) { ItemStack itemStack2 = itemStack.isEmpty() ? stack : itemStack.copyAndClear(); diff --git a/src/main/java/net/minecraft/world/item/trading/Merchant.java b/src/main/java/net/minecraft/world/item/trading/Merchant.java -index 716b30dcd7e63c66736c448dd136c9f74dc7fe43..f1e8e2dd64ad999710bd4633d8ef42bea47122be 100644 +index 716b30dcd7e63c66736c448dd136c9f74dc7fe43..bebad1479b39e08e636b10a6e3c5f0d36d8c7756 100644 --- a/src/main/java/net/minecraft/world/item/trading/Merchant.java +++ b/src/main/java/net/minecraft/world/item/trading/Merchant.java @@ -52,7 +52,7 @@ public interface Merchant { @@ -4742,12 +6131,12 @@ index 716b30dcd7e63c66736c448dd136c9f74dc7fe43..f1e8e2dd64ad999710bd4633d8ef42be } - boolean isClientSide(); -+ //boolean isClientSide(); // Plazma - Remove persist flag ++ //boolean isClientSide(); // Plazma - Remove persist 'isClientSide' flag org.bukkit.craftbukkit.inventory.CraftMerchant getCraftMerchant(); // CraftBukkit } diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java -index 5cb39f95bd2d45b6c18554605f01d2ebf6473428..a8ff985d19e9356acc886e170b38174f761b8146 100644 +index 5cb39f95bd2d45b6c18554605f01d2ebf6473428..d581534e7b1a5ab95a76f7394bf82f2f066c863b 100644 --- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java +++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java @@ -117,7 +117,7 @@ public abstract class BaseCommandBlock implements CommandSource { @@ -4755,7 +6144,7 @@ index 5cb39f95bd2d45b6c18554605f01d2ebf6473428..a8ff985d19e9356acc886e170b38174f public boolean performCommand(Level world) { - if (!world.isClientSide && world.getGameTime() != this.lastExecution) { -+ if (/*!world.isClientSide &&*/ world.getGameTime() != this.lastExecution) { // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ world.getGameTime() != this.lastExecution) { // Plazma - Remove persist 'isClientSide' flag if ("Searge".equalsIgnoreCase(this.command)) { this.lastOutput = Component.literal("#itzlipofutzli"); this.successCount = 1; @@ -4763,32 +6152,32 @@ index 5cb39f95bd2d45b6c18554605f01d2ebf6473428..a8ff985d19e9356acc886e170b38174f if (!player.canUseGameMasterBlocks() && (!player.isCreative() || !player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission return InteractionResult.PASS; } else { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (player.getCommandSenderWorld().isClientSide) { player.openMinecartCommandBlock(this); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 357d484029fe338bea4f5770d13ccfc0dce4432e..2385c7273e89e45502086b1d5fbe1ac8070dbee0 100644 +index 357d484029fe338bea4f5770d13ccfc0dce4432e..5865b715c1f91ad16a7c0d5918bc8e43579b7790 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -364,9 +364,11 @@ public abstract class BaseSpawner { public boolean onEventTriggered(Level world, int status) { if (status == 1) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { this.spawnDelay = this.minSpawnDelay; } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag return true; } else { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index d03a89d264cafb752e6a2f07558c119a0ee23253..e94ab488b4d7ef26021be3b97c71831eeef505f4 100644 +index 0da2014933fe441c4d3dc27c5fe10afa92ca1ec7..a44cb5609b3d467ba24d4814ff2d1840f49d37ed 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -137,7 +137,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -4796,7 +6185,7 @@ index d03a89d264cafb752e6a2f07558c119a0ee23253..e94ab488b4d7ef26021be3b97c71831e private final Holder dimensionTypeRegistration; public final WritableLevelData levelData; - public final boolean isClientSide; -+ //public final boolean isClientSide; // Plazma - Remove persist flag ++ //public final boolean isClientSide; // Plazma - Remove persist 'isClientSide' flag private final WorldBorder worldBorder; private final BiomeManager biomeManager; private final ResourceKey dimension; @@ -4805,7 +6194,7 @@ index d03a89d264cafb752e6a2f07558c119a0ee23253..e94ab488b4d7ef26021be3b97c71831e this.dimension = resourcekey; - this.isClientSide = flag; -+ //this.isClientSide = flag; // Plazma - Remove persist flag ++ //this.isClientSide = flag; // Plazma - Remove persist 'isClientSide' flag if (dimensionmanager.coordinateScale() != 1.0D) { this.worldBorder = new WorldBorder() { // CraftBukkit - decompile error @Override @@ -4813,12 +6202,12 @@ index d03a89d264cafb752e6a2f07558c119a0ee23253..e94ab488b4d7ef26021be3b97c71831e return true; } // Paper end - Cancel hit for vanished players -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag @Override public boolean isClientSide() { return this.isClientSide; } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag @Nullable @Override @@ -4827,7 +6216,7 @@ index d03a89d264cafb752e6a2f07558c119a0ee23253..e94ab488b4d7ef26021be3b97c71831e if (this.isOutsideBuildHeight(pos)) { return false; - } else if (!this.isClientSide && this.isDebug()) { -+ } else if (/*!this.isClientSide &&*/ this.isDebug()) { // Plazma - Remove persist flag ++ } else if (/*!this.isClientSide &&*/ this.isDebug()) { // Plazma - Remove persist 'isClientSide' flag return false; } else { LevelChunk chunk = this.getChunkAt(pos); @@ -4836,14 +6225,14 @@ index d03a89d264cafb752e6a2f07558c119a0ee23253..e94ab488b4d7ef26021be3b97c71831e } - if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && (this.isClientSide || chunk == null || (chunk.getFullStatus() != null && chunk.getFullStatus().isOrAfter(FullChunkStatus.FULL)))) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement // Paper - rewrite chunk system - change from ticking to full -+ if ((i & 2) != 0 && (/*!this.isClientSide ||*/ (i & 4) == 0) && (/*this.isClientSide ||*/ chunk == null || (chunk.getFullStatus() != null && chunk.getFullStatus().isOrAfter(FullChunkStatus.FULL)))) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement // Paper - rewrite chunk system - change from ticking to full // Plazma - Remove persist flag ++ if ((i & 2) != 0 && (/*!this.isClientSide ||*/ (i & 4) == 0) && (/*this.isClientSide ||*/ chunk == null || (chunk.getFullStatus() != null && chunk.getFullStatus().isOrAfter(FullChunkStatus.FULL)))) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement // Paper - rewrite chunk system - change from ticking to full // Plazma - Remove persist 'isClientSide' flag this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i); } if ((i & 1) != 0) { this.blockUpdated(blockposition, iblockdata1.getBlock()); - if (!this.isClientSide && iblockdata.hasAnalogOutputSignal()) { -+ if (/*!this.isClientSide &&*/ iblockdata.hasAnalogOutputSignal()) { // Plazma - Remove persist flag ++ if (/*!this.isClientSide &&*/ iblockdata.hasAnalogOutputSignal()) { // Plazma - Remove persist 'isClientSide' flag this.updateNeighbourForOutputSignal(blockposition, newBlock.getBlock()); } } @@ -4852,12 +6241,12 @@ index d03a89d264cafb752e6a2f07558c119a0ee23253..e94ab488b4d7ef26021be3b97c71831e // Paper end - Perf: Optimize capturedTileEntities lookup // CraftBukkit end - return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && !ca.spottedleaf.moonrise.common.util.TickThread.isTickThread() ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, LevelChunk.EntityCreationType.IMMEDIATE)); // Paper - rewrite chunk system -+ return this.isOutsideBuildHeight(blockposition) ? null : (/*!this.isClientSide &&*/ !ca.spottedleaf.moonrise.common.util.TickThread.isTickThread() ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, LevelChunk.EntityCreationType.IMMEDIATE)); // Paper - rewrite chunk system // Plazma - Remove persist flag ++ return this.isOutsideBuildHeight(blockposition) ? null : (/*!this.isClientSide &&*/ !ca.spottedleaf.moonrise.common.util.TickThread.isTickThread() ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, LevelChunk.EntityCreationType.IMMEDIATE)); // Paper - rewrite chunk system // Plazma - Remove persist 'isClientSide' flag } public void setBlockEntity(BlockEntity blockEntity) { diff --git a/src/main/java/net/minecraft/world/level/LevelReader.java b/src/main/java/net/minecraft/world/level/LevelReader.java -index ade435de0af4ee3566fa4a490df53cddd2f6531c..4da719032b95d98840df81a52635e04ef334d33b 100644 +index ade435de0af4ee3566fa4a490df53cddd2f6531c..98e4c19e448d2afd6bc76b454fe46bf99455c766 100644 --- a/src/main/java/net/minecraft/world/level/LevelReader.java +++ b/src/main/java/net/minecraft/world/level/LevelReader.java @@ -76,7 +76,7 @@ public interface LevelReader extends ca.spottedleaf.moonrise.patches.chunk_syste @@ -4865,12 +6254,12 @@ index ade435de0af4ee3566fa4a490df53cddd2f6531c..4da719032b95d98840df81a52635e04e Holder getUncachedNoiseBiome(int biomeX, int biomeY, int biomeZ); - boolean isClientSide(); -+ //boolean isClientSide(); // Plazma - Remove persist flag ++ //boolean isClientSide(); // Plazma - Remove persist 'isClientSide' flag int getSeaLevel(); diff --git a/src/main/java/net/minecraft/world/level/block/AbstractCandleBlock.java b/src/main/java/net/minecraft/world/level/block/AbstractCandleBlock.java -index 53e85641cbbc49ad7e588741acc4227828c8dca1..e10f3bacd330847622107454f9f1769a97d2a787 100644 +index 53e85641cbbc49ad7e588741acc4227828c8dca1..3f0e466578188bf5dbdeb905908fea4f663292a2 100644 --- a/src/main/java/net/minecraft/world/level/block/AbstractCandleBlock.java +++ b/src/main/java/net/minecraft/world/level/block/AbstractCandleBlock.java @@ -46,7 +46,7 @@ public abstract class AbstractCandleBlock extends Block { @@ -4878,7 +6267,7 @@ index 53e85641cbbc49ad7e588741acc4227828c8dca1..e10f3bacd330847622107454f9f1769a @Override protected void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { - if (!world.isClientSide && projectile.isOnFire() && this.canBeLit(state)) { -+ if (/*!world.isClientSide &&*/ projectile.isOnFire() && this.canBeLit(state)) { // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ projectile.isOnFire() && this.canBeLit(state)) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, hit.getBlockPos(), projectile).isCancelled()) { return; @@ -4948,7 +6337,7 @@ index 8a900fd00b97a6c068ef76ec1d17abffaaef15b6..61f50cfe860b59570b0a2ae5c2789edc } } diff --git a/src/main/java/net/minecraft/world/level/block/AnvilBlock.java b/src/main/java/net/minecraft/world/level/block/AnvilBlock.java -index f9a2d2d4f798efa0d691996ec5ff7fe00260b36c..3e37b1458cc050f7e6d91087790856a93d86bc71 100644 +index f9a2d2d4f798efa0d691996ec5ff7fe00260b36c..dd64b024d30df7685f5819843f2279cd7329bd52 100644 --- a/src/main/java/net/minecraft/world/level/block/AnvilBlock.java +++ b/src/main/java/net/minecraft/world/level/block/AnvilBlock.java @@ -108,11 +108,11 @@ public class AnvilBlock extends FallingBlock { @@ -4956,17 +6345,17 @@ index f9a2d2d4f798efa0d691996ec5ff7fe00260b36c..3e37b1458cc050f7e6d91087790856a9 @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(Stats.INTERACT_WITH_ANVIL); } // Paper - Fix InventoryOpenEvent cancellation - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java -index 0cf4133849ed8ff6d4038cc41ede9d3645b31da1..29e98ac0cff092db07aa6838e59bb41885313ee5 100644 +index 0cf4133849ed8ff6d4038cc41ede9d3645b31da1..af52ca942bbdd588017759017ff466216e0f3d18 100644 --- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java @@ -186,9 +186,9 @@ public abstract class BaseFireBlock extends Block { @@ -4974,15 +6363,15 @@ index 0cf4133849ed8ff6d4038cc41ede9d3645b31da1..29e98ac0cff092db07aa6838e59bb418 @Override public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { - if (!world.isClientSide()) { -+ //if (!world.isClientSide()) { // Plazma - Remove persist flag ++ //if (!world.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag world.levelEvent((Player) null, 1009, pos, 0); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return super.playerWillDestroy(world, pos, state, player); } diff --git a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java -index 9afa811579ac2e556b5c5c23b3b49587439dfadc..16c5918a0df7b2de0282caaed16ef550d0868a56 100644 +index 9afa811579ac2e556b5c5c23b3b49587439dfadc..98912bd1d29e7946430de6577efe28b56bef6cde 100644 --- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java @@ -78,14 +78,14 @@ public abstract class BasePressurePlateBlock extends Block { @@ -4990,7 +6379,7 @@ index 9afa811579ac2e556b5c5c23b3b49587439dfadc..16c5918a0df7b2de0282caaed16ef550 protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag int i = this.getSignalForState(state); if (i == 0) { @@ -4998,12 +6387,12 @@ index 9afa811579ac2e556b5c5c23b3b49587439dfadc..16c5918a0df7b2de0282caaed16ef550 } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } private void checkPressed(@Nullable Entity entity, Level world, BlockPos pos, BlockState state, int output) { diff --git a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java -index f9a55f76fed8609bca167b2ea37464e8079de0c0..b67900e4ce4e973feb8789682cd0804da2af9cd2 100644 +index f9a55f76fed8609bca167b2ea37464e8079de0c0..dbba3e6d9d1d631b8bc5c15e6032685be2aad28f 100644 --- a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java @@ -79,7 +79,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl @@ -5011,7 +6400,7 @@ index f9a55f76fed8609bca167b2ea37464e8079de0c0..b67900e4ce4e973feb8789682cd0804d @Override protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) { - if (!world.isClientSide && world.getBlockState(pos).is(this)) { -+ if (/*!world.isClientSide &&*/ world.getBlockState(pos).is(this)) { // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ world.getBlockState(pos).is(this)) { // Plazma - Remove persist 'isClientSide' flag RailShape railShape = state.getValue(this.getShapeProperty()); if (shouldBeRemoved(pos, world, railShape)) { dropResources(state, world, pos); @@ -5019,20 +6408,20 @@ index f9a55f76fed8609bca167b2ea37464e8079de0c0..b67900e4ce4e973feb8789682cd0804d } protected BlockState updateDir(Level world, BlockPos pos, BlockState state, boolean forceUpdate) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return state; } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag RailShape railShape = state.getValue(this.getShapeProperty()); return new RailState(world, pos, state).place(world.hasNeighborSignal(pos), forceUpdate, railShape).getState(); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/BeaconBlock.java b/src/main/java/net/minecraft/world/level/block/BeaconBlock.java -index debe8dbf1d5f3e58774903c5fcdcea672274ea61..60436689d577b5ae42bddfe198fdcdb960bd63d0 100644 +index debe8dbf1d5f3e58774903c5fcdcea672274ea61..25473693bc8404b45912402bb1d47fb1e8e18109 100644 --- a/src/main/java/net/minecraft/world/level/block/BeaconBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BeaconBlock.java @@ -46,7 +46,7 @@ public class BeaconBlock extends BaseEntityBlock implements BeaconBeamBlock { @@ -5040,23 +6429,23 @@ index debe8dbf1d5f3e58774903c5fcdcea672274ea61..60436689d577b5ae42bddfe198fdcdb9 @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide && world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity && player.openMenu(beaconBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation -+ if (/*!world.isClientSide &&*/ world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity && player.openMenu(beaconBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity && player.openMenu(beaconBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation // Plazma - Remove persist 'isClientSide' flag player.awardStat(Stats.INTERACT_WITH_BEACON); } diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java -index c130d316e87f1f896d33ab43831063a89e3bef2b..3c410e221e09e75e6d7a8bf9af12df4e7889f0c7 100644 +index c130d316e87f1f896d33ab43831063a89e3bef2b..bd8784d80665ca8f45ca78c9c792e4e79fb78a55 100644 --- a/src/main/java/net/minecraft/world/level/block/BedBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java @@ -84,9 +84,11 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return InteractionResult.SUCCESS_SERVER; } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag if (state.getValue(BedBlock.PART) != BedPart.HEAD) { pos = pos.relative((Direction) state.getValue(BedBlock.FACING)); state = world.getBlockState(pos); @@ -5065,7 +6454,7 @@ index c130d316e87f1f896d33ab43831063a89e3bef2b..3c410e221e09e75e6d7a8bf9af12df4e return InteractionResult.SUCCESS_SERVER; } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } // CraftBukkit start @@ -5074,7 +6463,7 @@ index c130d316e87f1f896d33ab43831063a89e3bef2b..3c410e221e09e75e6d7a8bf9af12df4e @Override public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { - if (!world.isClientSide && player.isCreative()) { -+ if (/*!world.isClientSide &&*/ player.isCreative()) { // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ player.isCreative()) { // Plazma - Remove persist 'isClientSide' flag BedPart blockpropertybedpart = (BedPart) state.getValue(BedBlock.PART); if (blockpropertybedpart == BedPart.FOOT) { @@ -5083,7 +6472,7 @@ index c130d316e87f1f896d33ab43831063a89e3bef2b..3c410e221e09e75e6d7a8bf9af12df4e public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { super.setPlacedBy(world, pos, state, placer, itemStack); - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag BlockPos blockposition1 = pos.relative((Direction) state.getValue(BedBlock.FACING)); world.setBlock(blockposition1, (BlockState) state.setValue(BedBlock.PART, BedPart.HEAD), 3); @@ -5092,12 +6481,12 @@ index c130d316e87f1f896d33ab43831063a89e3bef2b..3c410e221e09e75e6d7a8bf9af12df4e world.blockUpdated(pos, Blocks.AIR); state.updateNeighbourShapes(world, pos, 3); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java -index 6c0ea0bde1c36edda92807e317ed37f8b1bdac6a..04e4771ec6acc2451a66e9f00015181079c83166 100644 +index 6c0ea0bde1c36edda92807e317ed37f8b1bdac6a..8840bea07f0b43b8919604a0492ee7669aa00442 100644 --- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java @@ -96,7 +96,7 @@ public class BeehiveBlock extends BaseEntityBlock { @@ -5105,7 +6494,7 @@ index 6c0ea0bde1c36edda92807e317ed37f8b1bdac6a..04e4771ec6acc2451a66e9f000151810 public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool, boolean includeDrops, boolean dropExp) { // Paper - fix drops not preventing stats/food exhaustion super.playerDestroy(world, player, pos, state, blockEntity, tool, includeDrops, dropExp); // Paper - fix drops not preventing stats/food exhaustion - if (!world.isClientSide && blockEntity instanceof BeehiveBlockEntity tileentitybeehive) { -+ if (/*!world.isClientSide &&*/ blockEntity instanceof BeehiveBlockEntity tileentitybeehive) { // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ blockEntity instanceof BeehiveBlockEntity tileentitybeehive) { // Plazma - Remove persist 'isClientSide' flag if (!EnchantmentHelper.hasTag(tool, EnchantmentTags.PREVENTS_BEE_SPAWNS_WHEN_MINING)) { tileentitybeehive.emptyAllLivingFromHive(player, state, BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY); world.updateNeighbourForOutputSignal(pos, this); @@ -5114,7 +6503,7 @@ index 6c0ea0bde1c36edda92807e317ed37f8b1bdac6a..04e4771ec6acc2451a66e9f000151810 } - if (!world.isClientSide() && flag) { -+ if (/*!world.isClientSide() &&*/ flag) { // Plazma - Remove persist flag ++ if (/*!world.isClientSide() &&*/ flag) { // Plazma - Remove persist 'isClientSide' flag player.awardStat(Stats.ITEM_USED.get(item)); } } @@ -5123,12 +6512,12 @@ index 6c0ea0bde1c36edda92807e317ed37f8b1bdac6a..04e4771ec6acc2451a66e9f000151810 @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return world.isClientSide ? null : createTickerHelper(type, BlockEntityType.BEEHIVE, BeehiveBlockEntity::serverTick); -+ return /*world.isClientSide ? null :*/ createTickerHelper(type, BlockEntityType.BEEHIVE, BeehiveBlockEntity::serverTick); // Plazma - Remove persist flag ++ return /*world.isClientSide ? null :*/ createTickerHelper(type, BlockEntityType.BEEHIVE, BeehiveBlockEntity::serverTick); // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/BellBlock.java b/src/main/java/net/minecraft/world/level/block/BellBlock.java -index 104d228633110746dde42b187ad23d1b2406b5ee..47a884dacb03b6d37d33092047f71042480a5d31 100644 +index 104d228633110746dde42b187ad23d1b2406b5ee..73615c055c5ed16dd025808560ee8d83ec85bb4b 100644 --- a/src/main/java/net/minecraft/world/level/block/BellBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BellBlock.java @@ -144,7 +144,7 @@ public class BellBlock extends BaseEntityBlock { @@ -5136,7 +6525,7 @@ index 104d228633110746dde42b187ad23d1b2406b5ee..47a884dacb03b6d37d33092047f71042 BlockEntity tileentity = world.getBlockEntity(pos); - if (!world.isClientSide && tileentity instanceof BellBlockEntity) { -+ if (/*!world.isClientSide &&*/ tileentity instanceof BellBlockEntity) { // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ tileentity instanceof BellBlockEntity) { // Plazma - Remove persist 'isClientSide' flag if (direction == null) { direction = (Direction) world.getBlockState(pos).getValue(BellBlock.FACING); } @@ -5145,12 +6534,12 @@ index 104d228633110746dde42b187ad23d1b2406b5ee..47a884dacb03b6d37d33092047f71042 @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return createTickerHelper(type, BlockEntityType.BELL, world.isClientSide ? BellBlockEntity::clientTick : BellBlockEntity::serverTick); -+ return createTickerHelper(type, BlockEntityType.BELL, /*world.isClientSide ? BellBlockEntity::clientTick :*/ BellBlockEntity::serverTick); // Plazma - Remove persist flag ++ return createTickerHelper(type, BlockEntityType.BELL, /*world.isClientSide ? BellBlockEntity::clientTick :*/ BellBlockEntity::serverTick); // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java -index 2535e6d71b690f8dfde41a7d9cb76b6f010f5aa7..4184a205174969e7a2756cdc463848ae8e8f6c68 100644 +index 2535e6d71b690f8dfde41a7d9cb76b6f010f5aa7..bf4c5d6f2b7c24a7f439f9026e4056663c7462d3 100644 --- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java @@ -181,7 +181,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone @@ -5158,7 +6547,7 @@ index 2535e6d71b690f8dfde41a7d9cb76b6f010f5aa7..4184a205174969e7a2756cdc463848ae protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (state.getValue(BigDripleafBlock.TILT) == Tilt.NONE && BigDripleafBlock.canEntityTilt(pos, entity) && !world.hasNeighborSignal(pos)) { // CraftBukkit start - tilt dripleaf org.bukkit.event.Cancellable cancellable; @@ -5167,12 +6556,12 @@ index 2535e6d71b690f8dfde41a7d9cb76b6f010f5aa7..4184a205174969e7a2756cdc463848ae } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index 1748aea6613e0c8081f70092c9431e7e04907383..7a36f6d7bb3c162d4a8ec57dcf69a2f53ccaf6d8 100644 +index 1748aea6613e0c8081f70092c9431e7e04907383..872756eedbb1a594cd76b249ef0db05fbf1d46c8 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java @@ -191,9 +191,9 @@ public class Block extends BlockBehaviour implements ItemLike { @@ -5180,15 +6569,15 @@ index 1748aea6613e0c8081f70092c9431e7e04907383..7a36f6d7bb3c162d4a8ec57dcf69a2f5 if (newState != state) { if (newState.isAir()) { - if (!world.isClientSide()) { -+ //if (!world.isClientSide()) { // Plazma - Remove persist flag ++ //if (!world.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag world.destroyBlock(pos, (flags & 32) == 0, (Entity) null, maxUpdateDepth); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } else { world.setBlock(pos, newState, flags & -33, maxUpdateDepth); } diff --git a/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java b/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java -index cbaa6fc04eb8d765e0dd8238f2b82eed196d13c7..98ab989a4fbeaa20c79369f02ab1e0604bdbd817 100644 +index cbaa6fc04eb8d765e0dd8238f2b82eed196d13c7..4f869ab05d3f31e1b8e4faf7ade79b4499934197 100644 --- a/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java @@ -63,7 +63,7 @@ public class BrewingStandBlock extends BaseEntityBlock { @@ -5196,7 +6585,7 @@ index cbaa6fc04eb8d765e0dd8238f2b82eed196d13c7..98ab989a4fbeaa20c79369f02ab1e060 @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return world.isClientSide ? null : createTickerHelper(type, BlockEntityType.BREWING_STAND, BrewingStandBlockEntity::serverTick); -+ return /*world.isClientSide ? null :*/ createTickerHelper(type, BlockEntityType.BREWING_STAND, BrewingStandBlockEntity::serverTick); // Plazma - Remove persist flag ++ return /*world.isClientSide ? null :*/ createTickerHelper(type, BlockEntityType.BREWING_STAND, BrewingStandBlockEntity::serverTick); // Plazma - Remove persist 'isClientSide' flag } @Override @@ -5205,12 +6594,12 @@ index cbaa6fc04eb8d765e0dd8238f2b82eed196d13c7..98ab989a4fbeaa20c79369f02ab1e060 @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide && world.getBlockEntity(pos) instanceof BrewingStandBlockEntity brewingStandBlockEntity && player.openMenu(brewingStandBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation -+ if (/*!world.isClientSide &&*/ world.getBlockEntity(pos) instanceof BrewingStandBlockEntity brewingStandBlockEntity && player.openMenu(brewingStandBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ world.getBlockEntity(pos) instanceof BrewingStandBlockEntity brewingStandBlockEntity && player.openMenu(brewingStandBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation // Plazma - Remove persist 'isClientSide' flag player.awardStat(Stats.INTERACT_WITH_BREWINGSTAND); } diff --git a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java -index c65016cba376a41c267fb4b6499ec0a263851558..fc3cedff3843b1d78bacd081df91fc1bbb64ee47 100644 +index c65016cba376a41c267fb4b6499ec0a263851558..0e9e4a5a6666b6536411fbebc45c2a174c02d7c2 100644 --- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java @@ -52,7 +52,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup { @@ -5218,7 +6607,7 @@ index c65016cba376a41c267fb4b6499ec0a263851558..fc3cedff3843b1d78bacd081df91fc1b if (blockState.isAir()) { entity.onAboveBubbleCol(state.getValue(DRAG_DOWN)); - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag ServerLevel serverLevel = (ServerLevel)world; for (int i = 0; i < 2; i++) { @@ -5227,12 +6616,12 @@ index c65016cba376a41c267fb4b6499ec0a263851558..fc3cedff3843b1d78bacd081df91fc1b ); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } else { entity.onInsideBubbleColumn(state.getValue(DRAG_DOWN)); } diff --git a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java -index 061a8f8b58d9fa7959333e2f59d3b7ee03cbf92d..09ca0a1db57df5276e2d7cb673622a199cef1df7 100644 +index 061a8f8b58d9fa7959333e2f59d3b7ee03cbf92d..bb2efe06e04d9628f4e1a159e668e48d4e44d704 100644 --- a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java @@ -209,7 +209,7 @@ public class ButtonBlock extends FaceAttachedHorizontalDirectionalBlock { @@ -5240,19 +6629,19 @@ index 061a8f8b58d9fa7959333e2f59d3b7ee03cbf92d..09ca0a1db57df5276e2d7cb673622a19 protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (!world.isClientSide && this.type.canButtonBeActivatedByArrows() && !(Boolean) state.getValue(ButtonBlock.POWERED)) { -+ if (/*!world.isClientSide &&*/ this.type.canButtonBeActivatedByArrows() && !(Boolean) state.getValue(ButtonBlock.POWERED)) { // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ this.type.canButtonBeActivatedByArrows() && !(Boolean) state.getValue(ButtonBlock.POWERED)) { // Plazma - Remove persist 'isClientSide' flag this.checkPressed(state, world, pos); } } diff --git a/src/main/java/net/minecraft/world/level/block/CakeBlock.java b/src/main/java/net/minecraft/world/level/block/CakeBlock.java -index 3563a241c0b697dc0167cf7b1aa73fef7d1e7934..6da5775490457745fecc6f24889c880ee20a8088 100644 +index 3563a241c0b697dc0167cf7b1aa73fef7d1e7934..b25560f11a5004d122253c7c9b86e2a4967890c7 100644 --- a/src/main/java/net/minecraft/world/level/block/CakeBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CakeBlock.java @@ -86,6 +86,7 @@ public class CakeBlock extends Block { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { if (CakeBlock.eat(world, pos, state, player).consumesAction()) { return InteractionResult.SUCCESS; @@ -5260,7 +6649,7 @@ index 3563a241c0b697dc0167cf7b1aa73fef7d1e7934..6da5775490457745fecc6f24889c880e return InteractionResult.CONSUME; } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag return CakeBlock.eat(world, pos, state, player); } @@ -5287,20 +6676,20 @@ index ddd1504ed9516f8f247cd63c42d5d1db0c01ce67..38fee8cda4b95a5bb9dd02ca6eca776c @Nullable diff --git a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java -index 2ee2b1485f848ac5270bc3f7e1e5b1bc3029b0bb..c910191864cb9c65ce827b8fe34f4b791193bf97 100644 +index 2ee2b1485f848ac5270bc3f7e1e5b1bc3029b0bb..0e6dafeef9bc405aaa6150ffbf41a8f33b174777 100644 --- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java @@ -183,11 +183,13 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB } public static void dowse(@Nullable Entity entity, LevelAccessor world, BlockPos pos, BlockState state) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide()) { for (int i = 0; i < 20; ++i) { CampfireBlock.makeParticles((Level) world, pos, (Boolean) state.getValue(CampfireBlock.SIGNAL_FIRE), true); } } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag BlockEntity tileentity = world.getBlockEntity(pos); @@ -5309,15 +6698,15 @@ index 2ee2b1485f848ac5270bc3f7e1e5b1bc3029b0bb..c910191864cb9c65ce827b8fe34f4b79 if (flag) { - if (!world.isClientSide()) { -+ //if (!world.isClientSide()) { // Plazma - Remove persist flag ++ //if (!world.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag world.playSound((Player) null, pos, SoundEvents.GENERIC_EXTINGUISH_FIRE, SoundSource.BLOCKS, 1.0F, 1.0F); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag CampfireBlock.dowse((Entity) null, world, pos, state); } diff --git a/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java b/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java -index 9e7066ec9fa5a0a852f6e38052887a47be98cb55..cf930352658cd06916993e5e5c0add5c5e1a543e 100644 +index 9e7066ec9fa5a0a852f6e38052887a47be98cb55..06006f5a55e0543d06a99cbeb1a6b6360f5c1dde 100644 --- a/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java @@ -31,11 +31,11 @@ public class CartographyTableBlock extends Block { @@ -5325,17 +6714,17 @@ index 9e7066ec9fa5a0a852f6e38052887a47be98cb55..cf930352658cd06916993e5e5c0add5c @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(Stats.INTERACT_WITH_CARTOGRAPHY_TABLE); } // Paper - Fix InventoryOpenEvent cancellation - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java -index 663eb96b8227f000448957b5d8ea13ca78cee329..a9a22bbf234557d781e661aa99e37a2d3b44836c 100644 +index 663eb96b8227f000448957b5d8ea13ca78cee329..7f79265f30cadca3a7ffc8d6793b7f3f37f4bb76 100644 --- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java @@ -333,7 +333,7 @@ public class ChestBlock extends AbstractChestBlock implements @@ -5343,7 +6732,7 @@ index 663eb96b8227f000448957b5d8ea13ca78cee329..a9a22bbf234557d781e661aa99e37a2d @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return world.isClientSide ? createTickerHelper(type, this.blockEntityType(), ChestBlockEntity::lidAnimateTick) : null; -+ return /*world.isClientSide ? createTickerHelper(type, this.blockEntityType(), ChestBlockEntity::lidAnimateTick) :*/ null; // Plazma - Remove persist flag ++ return /*world.isClientSide ? createTickerHelper(type, this.blockEntityType(), ChestBlockEntity::lidAnimateTick) :*/ null; // Plazma - Remove persist 'isClientSide' flag } public static boolean isChestBlockedAt(LevelAccessor world, BlockPos pos) { @@ -5397,7 +6786,7 @@ index 5a95ecd7e94652d2af3eb42ee9cf61913fb95a69..dd90935c1e6bc2904f84cfa0ef04829c } } diff --git a/src/main/java/net/minecraft/world/level/block/CommandBlock.java b/src/main/java/net/minecraft/world/level/block/CommandBlock.java -index fb5777b6a729a465c2482c5f89ced2bc79b425bc..a295d37c274cea79794bf529fac60421c333a49b 100644 +index fb5777b6a729a465c2482c5f89ced2bc79b425bc..1ebc28e28137431b11b6e7d9b305019a9d6a5f81 100644 --- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java @@ -66,7 +66,7 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { @@ -5405,7 +6794,7 @@ index fb5777b6a729a465c2482c5f89ced2bc79b425bc..a295d37c274cea79794bf529fac60421 @Override protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag BlockEntity tileentity = world.getBlockEntity(pos); if (tileentity instanceof CommandBlockEntity) { @@ -5414,12 +6803,12 @@ index fb5777b6a729a465c2482c5f89ced2bc79b425bc..a295d37c274cea79794bf529fac60421 } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } private void setPoweredAndUpdate(Level world, BlockPos pos, CommandBlockEntity blockEntity, boolean powered) { diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java -index ed3a310d56a0cca8c4c11c3768ac2056cd11edea..cb19d28823a701720cd1998310dfc8cc8f50919f 100644 +index ed3a310d56a0cca8c4c11c3768ac2056cd11edea..f5b498bf68d351e42f5db5ae28aab4923847e3a5 100644 --- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java @@ -271,7 +271,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { @@ -5427,7 +6816,7 @@ index ed3a310d56a0cca8c4c11c3768ac2056cd11edea..cb19d28823a701720cd1998310dfc8cc // Purpur start - sneak to bulk process composter private static @Nullable BlockState process(int level, Player player, BlockState state, Level world, BlockPos pos, ItemStack stack) { - if (level < 7 && !world.isClientSide) { -+ if (level < 7 /*&& !world.isClientSide*/) { // Plazma - Remove persist flag ++ if (level < 7 /*&& !world.isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag BlockState iblockdata1 = ComposterBlock.addItem(player, state, world, pos, stack); // Paper start - handle cancelled events if (iblockdata1 == null) { @@ -5436,14 +6825,14 @@ index ed3a310d56a0cca8c4c11c3768ac2056cd11edea..cb19d28823a701720cd1998310dfc8cc } // CraftBukkit end - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag Vec3 vec3d = Vec3.atLowerCornerWithOffset(pos, 0.5D, 1.01D, 0.5D).offsetRandom(world.random, 0.7F); ItemEntity entityitem = new ItemEntity(world, vec3d.x(), vec3d.y(), vec3d.z(), new ItemStack(Items.BONE_MEAL)); entityitem.setDefaultPickUpDelay(); world.addFreshEntity(entityitem); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag BlockState iblockdata1 = ComposterBlock.empty(user, state, world, pos); @@ -5461,7 +6850,7 @@ index 71798bea02c49a0dc0a0b330370b956e8d3f4608..98b00c05c340e76580c0d42ed4146f94 @Override diff --git a/src/main/java/net/minecraft/world/level/block/CrafterBlock.java b/src/main/java/net/minecraft/world/level/block/CrafterBlock.java -index 0e609b1e3abd50b415d8376dc550375a8a0251b6..958fc7b4d3683fc1d5b9ab25f3a11199b0024376 100644 +index 0e609b1e3abd50b415d8376dc550375a8a0251b6..4942f6e95e9c44cb441d68e819f7aca93908660a 100644 --- a/src/main/java/net/minecraft/world/level/block/CrafterBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CrafterBlock.java @@ -109,7 +109,7 @@ public class CrafterBlock extends BaseEntityBlock { @@ -5469,7 +6858,7 @@ index 0e609b1e3abd50b415d8376dc550375a8a0251b6..958fc7b4d3683fc1d5b9ab25f3a11199 @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return world.isClientSide ? null : createTickerHelper(type, BlockEntityType.CRAFTER, CrafterBlockEntity::serverTick); -+ return /*world.isClientSide ? null :*/ createTickerHelper(type, BlockEntityType.CRAFTER, CrafterBlockEntity::serverTick); // Plazma - Remove persist flag ++ return /*world.isClientSide ? null :*/ createTickerHelper(type, BlockEntityType.CRAFTER, CrafterBlockEntity::serverTick); // Plazma - Remove persist 'isClientSide' flag } private void setBlockEntityTriggered(@Nullable BlockEntity blockEntity, boolean triggered) { @@ -5478,7 +6867,7 @@ index 0e609b1e3abd50b415d8376dc550375a8a0251b6..958fc7b4d3683fc1d5b9ab25f3a11199 @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag BlockEntity tileentity = world.getBlockEntity(pos); if (tileentity instanceof CrafterBlockEntity) { @@ -5487,12 +6876,12 @@ index 0e609b1e3abd50b415d8376dc550375a8a0251b6..958fc7b4d3683fc1d5b9ab25f3a11199 player.openMenu(crafterblockentity); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java b/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java -index 6a2123cd808fa79f3cdb1cb56632d29bfe99058d..a30b764564ffe30cc465d579873505412409d33a 100644 +index 6a2123cd808fa79f3cdb1cb56632d29bfe99058d..55e4863038b958eda589d0c6e2ea1db0694377aa 100644 --- a/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java @@ -30,11 +30,11 @@ public class CraftingTableBlock extends Block { @@ -5500,12 +6889,12 @@ index 6a2123cd808fa79f3cdb1cb56632d29bfe99058d..a30b764564ffe30cc465d57987350541 @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(Stats.INTERACT_WITH_CRAFTING_TABLE); } // Paper - Fix InventoryOpenEvent cancellation - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } @@ -5531,7 +6920,7 @@ index b0bf44dcb81e6c63b9eac45ced9906bb231ea07b..4d03e6a8b4582b1fecc81e88ee11829b public static boolean canSummonCreaking(Level world) { diff --git a/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java b/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java -index 7fd7f20d524fa980ed8ff8e0ca8adb9af203ccda..c413e000c2285e8cb234ff349dd68162ced139db 100644 +index 7fd7f20d524fa980ed8ff8e0ca8adb9af203ccda..8be7464b07d91cae1336f182bc18e33cb9301409 100644 --- a/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java @@ -85,13 +85,13 @@ public class DaylightDetectorBlock extends BaseEntityBlock { @@ -5539,14 +6928,14 @@ index 7fd7f20d524fa980ed8ff8e0ca8adb9af203ccda..c413e000c2285e8cb234ff349dd68162 return super.useWithoutItem(state, world, pos, player, hit); } else { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag BlockState iblockdata1 = (BlockState) state.cycle(DaylightDetectorBlock.INVERTED); world.setBlock(pos, iblockdata1, 2); world.gameEvent((Holder) GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(player, iblockdata1)); DaylightDetectorBlock.updateSignalStrength(iblockdata1, world, pos); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } @@ -5555,23 +6944,23 @@ index 7fd7f20d524fa980ed8ff8e0ca8adb9af203ccda..c413e000c2285e8cb234ff349dd68162 @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return !world.isClientSide && world.dimensionType().hasSkyLight() ? createTickerHelper(type, BlockEntityType.DAYLIGHT_DETECTOR, DaylightDetectorBlock::tickEntity) : null; -+ return /*!world.isClientSide &&*/ world.dimensionType().hasSkyLight() ? createTickerHelper(type, BlockEntityType.DAYLIGHT_DETECTOR, DaylightDetectorBlock::tickEntity) : null; // Plazma - Remove persist flag ++ return /*!world.isClientSide &&*/ world.dimensionType().hasSkyLight() ? createTickerHelper(type, BlockEntityType.DAYLIGHT_DETECTOR, DaylightDetectorBlock::tickEntity) : null; // Plazma - Remove persist 'isClientSide' flag } private static void tickEntity(Level world, BlockPos pos, BlockState state, DaylightDetectorBlockEntity blockEntity) { diff --git a/src/main/java/net/minecraft/world/level/block/DecoratedPotBlock.java b/src/main/java/net/minecraft/world/level/block/DecoratedPotBlock.java -index 3ec6ed1e9ba25165a7deb2f767b8d064d1f89d5f..71f87a0605f4a389d0f23f08f21596e9939d2f4f 100644 +index 3ec6ed1e9ba25165a7deb2f767b8d064d1f89d5f..bbc52c7187cf313a0152aa0359954f50d411b274 100644 --- a/src/main/java/net/minecraft/world/level/block/DecoratedPotBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DecoratedPotBlock.java @@ -99,9 +99,11 @@ public class DecoratedPotBlock extends BaseEntityBlock implements SimpleWaterlog BlockEntity tileentity = world.getBlockEntity(pos); if (tileentity instanceof DecoratedPotBlockEntity decoratedpotblockentity) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return InteractionResult.SUCCESS; } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag ItemStack itemstack1 = decoratedpotblockentity.getTheItem(); if (!stack.isEmpty() && (itemstack1.isEmpty() || ItemStack.isSameItemSameComponents(itemstack1, stack) && itemstack1.getCount() < itemstack1.getMaxStackSize())) { @@ -5580,12 +6969,12 @@ index 3ec6ed1e9ba25165a7deb2f767b8d064d1f89d5f..71f87a0605f4a389d0f23f08f21596e9 return InteractionResult.TRY_WITH_EMPTY_HAND; } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } else { return InteractionResult.PASS; } diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java -index fa1c4defd0d4e4cd888eb26eed131539d0ed573f..7d34a47ac2e01cfda109f726f7156ebbf40aa1a8 100644 +index fa1c4defd0d4e4cd888eb26eed131539d0ed573f..cf8b8eaed8932d53ddafae24148d20013ebd784e 100644 --- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java @@ -53,11 +53,11 @@ public class DetectorRailBlock extends BaseRailBlock { @@ -5593,17 +6982,17 @@ index fa1c4defd0d4e4cd888eb26eed131539d0ed573f..7d34a47ac2e01cfda109f726f7156ebb protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (!(Boolean) state.getValue(DetectorRailBlock.POWERED)) { this.checkPressed(world, pos, state); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java -index 5a6c153fa2873aecba0d0d02be2cc2a514f445e3..5c04f3500d31ac3851a25390ee32de5ab1abd359 100644 +index 5a6c153fa2873aecba0d0d02be2cc2a514f445e3..a6af04d32e69c4a7fcb4d12f98fb12abefa3b9b8 100644 --- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java @@ -74,7 +74,7 @@ public class DispenserBlock extends BaseEntityBlock { @@ -5611,7 +7000,7 @@ index 5a6c153fa2873aecba0d0d02be2cc2a514f445e3..5c04f3500d31ac3851a25390ee32de5a @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag BlockEntity tileentity = world.getBlockEntity(pos); if (tileentity instanceof DispenserBlockEntity) { @@ -5620,12 +7009,12 @@ index 5a6c153fa2873aecba0d0d02be2cc2a514f445e3..5c04f3500d31ac3851a25390ee32de5a } // Paper - Fix InventoryOpenEvent cancellation } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/DoorBlock.java b/src/main/java/net/minecraft/world/level/block/DoorBlock.java -index daf865c20cc193a12db0d98e3c0472eefdf635c2..60751592b22daf9bf5939e02ae8b66b345c0156a 100644 +index daf865c20cc193a12db0d98e3c0472eefdf635c2..c5472944127e0179a647cac2f8748e917b545ead 100644 --- a/src/main/java/net/minecraft/world/level/block/DoorBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DoorBlock.java @@ -114,7 +114,7 @@ public class DoorBlock extends Block { @@ -5633,12 +7022,12 @@ index daf865c20cc193a12db0d98e3c0472eefdf635c2..60751592b22daf9bf5939e02ae8b66b3 @Override public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { - if (!world.isClientSide && (player.isCreative() || !player.hasCorrectToolForDrops(state))) { -+ if (/*!world.isClientSide &&*/ (player.isCreative() || !player.hasCorrectToolForDrops(state))) { // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ (player.isCreative() || !player.hasCorrectToolForDrops(state))) { // Plazma - Remove persist 'isClientSide' flag DoublePlantBlock.preventDropFromBottomPart(world, pos, state, player); } diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java -index 4fe83bd0f355549847b66afb7e61f6f2a6d97016..b81d1937489659bcc15e36554b04a55745b6ba23 100644 +index 4fe83bd0f355549847b66afb7e61f6f2a6d97016..47b1f716e7a130402cb74229afa65893278c8a0c 100644 --- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java @@ -86,13 +86,13 @@ public class DoublePlantBlock extends BushBlock { @@ -5646,26 +7035,26 @@ index 4fe83bd0f355549847b66afb7e61f6f2a6d97016..b81d1937489659bcc15e36554b04a557 @Override public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (player.isCreative()) { DoublePlantBlock.preventDropFromBottomPart(world, pos, state, player); } else { dropResources(state, world, pos, (BlockEntity) null, player, player.getMainHandItem()); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return super.playerWillDestroy(world, pos, state, player); } diff --git a/src/main/java/net/minecraft/world/level/block/DragonEggBlock.java b/src/main/java/net/minecraft/world/level/block/DragonEggBlock.java -index b6799db00e157892dd4339a01d2ca36092c8e491..1bf54b0c38bcebf98912c519bf976d6df1e62e30 100644 +index b6799db00e157892dd4339a01d2ca36092c8e491..74a42da0cf747670761d7f19484fa00471130866 100644 --- a/src/main/java/net/minecraft/world/level/block/DragonEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DragonEggBlock.java @@ -66,6 +66,7 @@ public class DragonEggBlock extends FallingBlock { blockposition1 = new BlockPos(event.getToBlock().getX(), event.getToBlock().getY(), event.getToBlock().getZ()); // CraftBukkit end -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { for (int j = 0; j < 128; ++j) { double d0 = world.random.nextDouble(); @@ -5673,16 +7062,16 @@ index b6799db00e157892dd4339a01d2ca36092c8e491..1bf54b0c38bcebf98912c519bf976d6d world.addParticle(ParticleTypes.PORTAL, d1, d2, d3, (double) f, (double) f1, (double) f2); } } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag world.setBlock(blockposition1, state, 2); world.removeBlock(pos, false); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return; } diff --git a/src/main/java/net/minecraft/world/level/block/EnchantingTableBlock.java b/src/main/java/net/minecraft/world/level/block/EnchantingTableBlock.java -index ce6a9e15ae0114623e79b5d8c244c2c490a3f74e..bae42ecac77e4c03d2b2116e5ea72a64b5666f7e 100644 +index ce6a9e15ae0114623e79b5d8c244c2c490a3f74e..0075b481aa17c1c5ee5b591fc0efe1745d815735 100644 --- a/src/main/java/net/minecraft/world/level/block/EnchantingTableBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EnchantingTableBlock.java @@ -93,14 +93,14 @@ public class EnchantingTableBlock extends BaseEntityBlock { @@ -5690,21 +7079,21 @@ index ce6a9e15ae0114623e79b5d8c244c2c490a3f74e..bae42ecac77e4c03d2b2116e5ea72a64 @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return world.isClientSide ? createTickerHelper(type, BlockEntityType.ENCHANTING_TABLE, EnchantingTableBlockEntity::bookAnimationTick) : null; -+ return /*world.isClientSide ? createTickerHelper(type, BlockEntityType.ENCHANTING_TABLE, EnchantingTableBlockEntity::bookAnimationTick) :*/ null; // Plazma - Remove persist flag ++ return /*world.isClientSide ? createTickerHelper(type, BlockEntityType.ENCHANTING_TABLE, EnchantingTableBlockEntity::bookAnimationTick) :*/ null; // Plazma - Remove persist 'isClientSide' flag } @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag player.openMenu(state.getMenuProvider(world, pos)); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java -index abb75f9389167a1f51a2c50831664d50181749de..e5c5e20b0f2b2094faae2955a886f06ef6771eff 100644 +index abb75f9389167a1f51a2c50831664d50181749de..fdebf1f4ae72001c24b20dd973ca7dd54e30df3d 100644 --- a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java @@ -47,7 +47,7 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal { @@ -5712,19 +7101,21 @@ index abb75f9389167a1f51a2c50831664d50181749de..e5c5e20b0f2b2094faae2955a886f06e @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return createTickerHelper(type, BlockEntityType.END_GATEWAY, world.isClientSide ? TheEndGatewayBlockEntity::beamAnimationTick : TheEndGatewayBlockEntity::portalTick); -+ return createTickerHelper(type, BlockEntityType.END_GATEWAY, /*world.isClientSide ? TheEndGatewayBlockEntity::beamAnimationTick :*/ TheEndGatewayBlockEntity::portalTick); // Plazma - Remove persist flag ++ return createTickerHelper(type, BlockEntityType.END_GATEWAY, /*world.isClientSide ? TheEndGatewayBlockEntity::beamAnimationTick :*/ TheEndGatewayBlockEntity::portalTick); // Plazma - Remove persist 'isClientSide' flag } @Override -@@ -100,7 +100,7 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal { +@@ -100,8 +100,8 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal { // Paper end - call EntityPortalEnterEvent BlockEntity tileentity = world.getBlockEntity(pos); - if (!world.isClientSide && tileentity instanceof TheEndGatewayBlockEntity) { -+ if (/*!world.isClientSide &&*/ tileentity instanceof TheEndGatewayBlockEntity) { // Plazma - Remove persist flag - TheEndGatewayBlockEntity tileentityendgateway = (TheEndGatewayBlockEntity) tileentity; +- TheEndGatewayBlockEntity tileentityendgateway = (TheEndGatewayBlockEntity) tileentity; ++ if (/*!world.isClientSide &&*/ tileentity instanceof TheEndGatewayBlockEntity tileentity) { // Plazma - Remove persist 'isClientSide' flag + minor improvement ++ //TheEndGatewayBlockEntity tileentityendgateway = (TheEndGatewayBlockEntity) tileentity; // Plazma - Remove persist 'isClientSide' flag + minor improvement if (!tileentityendgateway.isCoolingDown()) { + // Purpur start diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java index 2dffc3990d9ae3d595d923239885e3a7d8ec04f3..487197df3a9d24f03a21f5fddd5f87d393646596 100644 --- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java @@ -5739,7 +7130,7 @@ index 2dffc3990d9ae3d595d923239885e3a7d8ec04f3..487197df3a9d24f03a21f5fddd5f87d3 if (world.paperConfig().misc.disableEndCredits) entityplayer.seenCredits = true; // Paper - Option to disable end credits diff --git a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java -index d9a1ec9c6ccab71618a42121f049005cf821eb42..35efb8d3fa528645a52f09e091c00d4a6434ab52 100644 +index 6ad4aa371607ab92616626285a7e71757c76a3db..4834e3e9990a9be1a9441191c42f238dd024dfdf 100644 --- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java @@ -141,7 +141,7 @@ public class EnderChestBlock extends AbstractChestBlock i @@ -5747,7 +7138,7 @@ index d9a1ec9c6ccab71618a42121f049005cf821eb42..35efb8d3fa528645a52f09e091c00d4a @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return world.isClientSide ? createTickerHelper(type, BlockEntityType.ENDER_CHEST, EnderChestBlockEntity::lidAnimateTick) : null; -+ return /*world.isClientSide ? createTickerHelper(type, BlockEntityType.ENDER_CHEST, EnderChestBlockEntity::lidAnimateTick) :*/ null; // Plazma - Remove persist flag ++ return /*world.isClientSide ? createTickerHelper(type, BlockEntityType.ENDER_CHEST, EnderChestBlockEntity::lidAnimateTick) :*/ null; // Plazma - Remove persist 'isClientSide' flag } @Override @@ -5805,7 +7196,7 @@ index 59c000612bbf7beb7208af48001d3b1e5111ebd4..4256ad5b20b63b1792cde46c20e63451 return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java -index 5c360c6768582c1a35431739613e9b406875cc21..6849fbd73110bc9a36d7b40879da7589da677c5b 100644 +index 5c360c6768582c1a35431739613e9b406875cc21..3536d74b4d422e6548d73bcba6d943684c5462b5 100644 --- a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java +++ b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java @@ -49,9 +49,9 @@ public class HoneyBlock extends HalfTransparentBlock { @@ -5820,7 +7211,7 @@ index 5c360c6768582c1a35431739613e9b406875cc21..6849fbd73110bc9a36d7b40879da7589 if (entity.causeFallDamage(fallDistance, 0.2F, world.damageSources().fall())) { entity.playSound(this.soundType.getFallSound(), this.soundType.getVolume() * 0.5F, this.soundType.getPitch() * 0.75F); -@@ -117,7 +117,7 @@ public class HoneyBlock extends HalfTransparentBlock { +@@ -117,12 +117,13 @@ public class HoneyBlock extends HalfTransparentBlock { entity.playSound(SoundEvents.HONEY_BLOCK_SLIDE, 1.0F, 1.0F); } @@ -5829,20 +7220,17 @@ index 5c360c6768582c1a35431739613e9b406875cc21..6849fbd73110bc9a36d7b40879da7589 world.broadcastEntityEvent(entity, (byte)53); } } -@@ -132,6 +132,7 @@ public class HoneyBlock extends HalfTransparentBlock { } - private static void showParticles(Entity entity, int count) { -+ /* // Plazma - Remove persist 'isClientSide' flag - if (entity.level().isClientSide) { - BlockState blockState = Blocks.HONEY_BLOCK.defaultBlockState(); - -@@ -140,5 +141,6 @@ public class HoneyBlock extends HalfTransparentBlock { - .addParticle(new BlockParticleOption(ParticleTypes.BLOCK, blockState), entity.getX(), entity.getY(), entity.getZ(), 0.0, 0.0, 0.0); ++ /* // Plazma - Remove persist 'isClientSide' flag + public static void showSlideParticles(Entity entity) { + showParticles(entity, 5); + } +@@ -141,4 +142,5 @@ public class HoneyBlock extends HalfTransparentBlock { } } -+ */ // Plazma - Remove persist 'isClientSide' flag } ++ */ // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java index 005a2a66a6e8a492acfa7ba91117884cda08562d..39ac1d40b69ba3909cd9b26f62f3b4e872d3e612 100644 @@ -6068,7 +7456,7 @@ index fd5489993dca0f940da69e9163f78e5c2e6ee063..cd049a28ff2d4f748b154feb99b64e45 @Override diff --git a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java -index 3e1dddab0500bb805e5accd0ece69c450bad478f..2e523b637d776b6d21a78ee5fca5b0c17be6a434 100644 +index 3760c3c9ab45d7152661edd5a48893e1b583fb95..b946858d3ccc38972d86608e020302ac05b053a8 100644 --- a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java @@ -62,6 +62,7 @@ public class PowderSnowBlock extends Block implements BucketPickup { @@ -6134,7 +7522,7 @@ index e9c7f5d2c7072568e0d451f43125816e27138872..2fc7bdc0362f2f5a21e3459375d8d06b return (InteractionResult) (stack.getItem() instanceof BlockItem && (new BlockPlaceContext(player, hand, stack, hit)).canPlace() ? InteractionResult.PASS : InteractionResult.SUCCESS); } diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java -index 09b8f5335cb7651d90f4d1ca61b2ec5aa324e443..c8994f476b06e52e56f668d1af77b28d9275233d 100644 +index 21f2c61023fadcce30452a02f067cd5d87e5d8dc..1250126ce9ba5d5aec30d855c7e11bf158d57c1c 100644 --- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java @@ -371,7 +371,7 @@ public class RedStoneWireBlock extends Block { @@ -6143,10 +7531,10 @@ index 09b8f5335cb7651d90f4d1ca61b2ec5aa324e443..c8994f476b06e52e56f668d1af77b28d protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { - if (!oldState.is(state.getBlock()) && !world.isClientSide) { + if (!oldState.is(state.getBlock()) /*&& !world.isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag - this.updateSurroundingRedstone(world, pos, state, null, true); // Paper - Optimize redstone - - for (Direction direction : Direction.Plane.VERTICAL) { -@@ -386,14 +386,14 @@ public class RedStoneWireBlock extends Block { + // Paper start - optimize redstone - replace call to updatePowerStrength + if (world.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { + world.getWireHandler().onWireAdded(pos, state); // Alternate Current +@@ -392,7 +392,7 @@ public class RedStoneWireBlock extends Block { protected void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) { if (!moved && !state.is(newState.getBlock())) { super.onRemove(state, world, pos, newState, moved); @@ -6155,24 +7543,25 @@ index 09b8f5335cb7651d90f4d1ca61b2ec5aa324e443..c8994f476b06e52e56f668d1af77b28d for (Direction direction : Direction.values()) { world.updateNeighborsAt(pos.relative(direction), this); } - - this.updateSurroundingRedstone(world, pos, state, null, false); // Paper - Optimize redstone +@@ -404,7 +404,7 @@ public class RedStoneWireBlock extends Block { + this.updateSurroundingRedstone(world, pos, state, null, false); // Vanilla/Eigencraft + } this.updateNeighborsOfNeighboringWires(world, pos); - } + //} // Plazma - Remove persist 'isClientSide' flag } } -@@ -414,7 +414,7 @@ public class RedStoneWireBlock extends Block { +@@ -425,7 +425,7 @@ public class RedStoneWireBlock extends Block { @Override protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag - if (sourceBlock != this || !useExperimentalEvaluator(world)) { - if (state.canSurvive(world, pos)) { - this.updateSurroundingRedstone(world, pos, state, wireOrientation, false); // Paper - Optimize redstone -@@ -423,7 +423,7 @@ public class RedStoneWireBlock extends Block { + // Paper start - optimize redstone (Alternate Current) + // Alternate Current handles breaking of redstone wires in the WireHandler. + if (world.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { +@@ -440,7 +440,7 @@ public class RedStoneWireBlock extends Block { world.removeBlock(pos, false); } } @@ -6598,7 +7987,7 @@ index 74cce7874809dcbce2718ec3840bb6bb3127e871..b7e8431198be8ed5a7f221e43d5a92a0 @Override diff --git a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java -index 3829dbae8542396f8360eae54f0ed18fbde4cd8c..098dd670e0f6ff86ae0d72ccdc30127ab52d1d5e 100644 +index f1dfb23160ff70e0da4dd2af2d83e879527c6651..63c60e461a3db8f8b6084e074c0b201adbdec051 100644 --- a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java @@ -162,7 +162,7 @@ public class TurtleEggBlock extends Block { @@ -6638,7 +8027,7 @@ index 3a7126883f11ac5a647947eaf060df15536a6cb2..b26ee54d48908199e5fcd4bda415f29f private static BlockPattern getOrCreateWitherFull() { diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -index 2d190b3a6378b8cbadfa65510df1ccfbd5882ef8..b6887d2660fed6bbfdc345114101c5f432e0ce69 100644 +index 2d190b3a6378b8cbadfa65510df1ccfbd5882ef8..69ef5c805d802575a639027fd40064d92fcfe89d 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java @@ -154,7 +154,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name @@ -6646,7 +8035,7 @@ index 2d190b3a6378b8cbadfa65510df1ccfbd5882ef8..b6887d2660fed6bbfdc345114101c5f4 break; case 1: - if (!BeaconBlockEntity.this.level.isClientSide && !BeaconBlockEntity.this.beamSections.isEmpty()) { -+ if (/*!BeaconBlockEntity.this.level.isClientSide &&*/ !BeaconBlockEntity.this.beamSections.isEmpty()) { // Plazma - Remove persist flag ++ if (/*!BeaconBlockEntity.this.level.isClientSide &&*/ !BeaconBlockEntity.this.beamSections.isEmpty()) { // Plazma - Remove persist 'isClientSide' flag BeaconBlockEntity.playSound(BeaconBlockEntity.this.level, BeaconBlockEntity.this.worldPosition, SoundEvents.BEACON_POWER_SELECT); } @@ -6655,7 +8044,7 @@ index 2d190b3a6378b8cbadfa65510df1ccfbd5882ef8..b6887d2660fed6bbfdc345114101c5f4 blockEntity.beamSections = blockEntity.checkingBeamSections; - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag boolean flag1 = blockEntity.levels > 0; if (!flag && flag1) { @@ -6664,7 +8053,7 @@ index 2d190b3a6378b8cbadfa65510df1ccfbd5882ef8..b6887d2660fed6bbfdc345114101c5f4 BeaconBlockEntity.playSound(world, pos, SoundEvents.BEACON_DEACTIVATE); } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } } @@ -6673,12 +8062,12 @@ index 2d190b3a6378b8cbadfa65510df1ccfbd5882ef8..b6887d2660fed6bbfdc345114101c5f4 private static void applyEffects(Level world, BlockPos pos, int beaconLevel, @Nullable Holder primaryEffect, @Nullable Holder secondaryEffect, @Nullable BeaconBlockEntity blockEntity) { // Paper end - Custom beacon ranges - if (!world.isClientSide && primaryEffect != null) { -+ if (/*!world.isClientSide &&*/ primaryEffect != null) { // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ primaryEffect != null) { // Plazma - Remove persist 'isClientSide' flag double d0 = (double) (beaconLevel * 10 + 10); byte b0 = BeaconBlockEntity.getAmplification(beaconLevel, primaryEffect, secondaryEffect); diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java -index 946c9dbfabf154db53d811906fd98d17992167d1..d5465a018a2f19875e21e069da6523b6514b6a1e 100644 +index 946c9dbfabf154db53d811906fd98d17992167d1..6a46eb93692028bd28ae1329de9c9b208878abb7 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java @@ -119,7 +119,7 @@ public class BellBlockEntity extends BlockEntity { @@ -6686,7 +8075,7 @@ index 946c9dbfabf154db53d811906fd98d17992167d1..d5465a018a2f19875e21e069da6523b6 } - if (!this.level.isClientSide) { -+ //if (!this.level.isClientSide) { // Plazma - Remove persist flag ++ //if (!this.level.isClientSide) { // Plazma - Remove persist 'isClientSide' flag Iterator iterator = this.nearbyEntities.iterator(); while (iterator.hasNext()) { @@ -6695,12 +8084,12 @@ index 946c9dbfabf154db53d811906fd98d17992167d1..d5465a018a2f19875e21e069da6523b6 } } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag this.nearbyEntities.removeIf(e -> !e.isAlive()); // Paper - Fix bell block entity memory leak } diff --git a/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java -index 853263b4dd28a5b7620dde17c13412193036eda9..74b9678f09a8e5e2dad705a9f3d6bac265c3d6bb 100644 +index 853263b4dd28a5b7620dde17c13412193036eda9..e84cf74aa58d1d7ed15b7fc5b6d1633ddce525ea 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java @@ -223,7 +223,7 @@ public class DecoratedPotBlockEntity extends BlockEntity implements Randomizable @@ -6708,23 +8097,23 @@ index 853263b4dd28a5b7620dde17c13412193036eda9..74b9678f09a8e5e2dad705a9f3d6bac2 public void wobble(DecoratedPotBlockEntity.WobbleStyle wobbleType) { - if (this.level != null && !this.level.isClientSide()) { -+ if (this.level != null /*&& !this.level.isClientSide()*/) { // Plazma - Remove persist flag ++ if (this.level != null /*&& !this.level.isClientSide()*/) { // Plazma - Remove persist 'isClientSide' flag this.level.blockEvent(this.getBlockPos(), this.getBlockState().getBlock(), 1, wobbleType.ordinal()); } } diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index aeeb8af68ea43ae6c93952610918d77b1593ed54..80f072d830c0c4e90d957926ef0ad3ba89d2b55a 100644 +index aeeb8af68ea43ae6c93952610918d77b1593ed54..82606b6a0aac46588322f036e824da621aa2e6c4 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java @@ -194,9 +194,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen // Paper end - Perf: Optimize Hoppers private static boolean tryMoveItems(Level world, BlockPos pos, BlockState state, HopperBlockEntity blockEntity, BooleanSupplier booleansupplier) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return false; } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag if (!blockEntity.isOnCooldown() && (Boolean) state.getValue(HopperBlock.ENABLED)) { boolean flag = false; @@ -6733,12 +8122,12 @@ index aeeb8af68ea43ae6c93952610918d77b1593ed54..80f072d830c0c4e90d957926ef0ad3ba return false; - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } private boolean inventoryFull() { diff --git a/src/main/java/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java -index c3bbe5e9e0cc37f3f22fc1d839fa2652966f1266..5054c8b0d2618d2f2bdb26d7338ecbe118733b0b 100644 +index c3bbe5e9e0cc37f3f22fc1d839fa2652966f1266..e32c4aadf1b36e27e8cb9dba039ea1c41f49ad55 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java @@ -93,7 +93,7 @@ public class JukeboxBlockEntity extends BlockEntity implements ContainerSingleIt @@ -6746,23 +8135,23 @@ index c3bbe5e9e0cc37f3f22fc1d839fa2652966f1266..5054c8b0d2618d2f2bdb26d7338ecbe1 public void popOutTheItem() { - if (this.level != null && !this.level.isClientSide) { -+ if (this.level != null /*&& !this.level.isClientSide*/) { // Plazma - Remove persist flag ++ if (this.level != null /*&& !this.level.isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag BlockPos blockposition = this.getBlockPos(); ItemStack itemstack = this.getTheItem(); diff --git a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java -index 0147a7be5fd147ffa9bd42a90e85a324bc317a81..734ad47b383463930ff7b577f0b7f79f69e2e721 100644 +index 0147a7be5fd147ffa9bd42a90e85a324bc317a81..49d4b147e41d8f436947ca4d5ac22ea7cbd854dc 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java @@ -151,9 +151,11 @@ public class StructureBlockEntity extends BlockEntity { if (!player.canUseGameMasterBlocks()) { return false; } else { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (player.getCommandSenderWorld().isClientSide) { player.openStructureBlock(this); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag return true; } @@ -6771,12 +8160,12 @@ index 0147a7be5fd147ffa9bd42a90e85a324bc317a81..734ad47b383463930ff7b577f0b7f79f public boolean isStructureLoadable() { - if (this.mode == StructureMode.LOAD && !this.level.isClientSide && this.structureName != null) { -+ if (this.mode == StructureMode.LOAD && /*!this.level.isClientSide &&*/ this.structureName != null) { // Plazma - Remove persist flag ++ if (this.mode == StructureMode.LOAD && /*!this.level.isClientSide &&*/ this.structureName != null) { // Plazma - Remove persist 'isClientSide' flag ServerLevel serverLevel = (ServerLevel)this.level; StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager(); diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -index 68fd5d3f6553af8af867e34946cb8b3f852da985..c7ee1db51a4a05627282b77697549e96e7d65ecd 100644 +index 68fd5d3f6553af8af867e34946cb8b3f852da985..2f9597e6601d6e21187fdab5536a7c48617c4865 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java @@ -122,11 +122,11 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { @@ -6784,17 +8173,17 @@ index 68fd5d3f6553af8af867e34946cb8b3f852da985..c7ee1db51a4a05627282b77697549e96 public static void triggerCooldown(Level world, BlockPos pos, BlockState state, TheEndGatewayBlockEntity blockEntity) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag blockEntity.teleportCooldown = 40; world.blockEvent(pos, state.getBlock(), 1, 0); setChanged(world, pos, state); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java -index 4045ae665450f6e3f5630cb25cc53be850afd1a8..15c9e4c1ed7b62987b112c3a1d342d9227f05dc7 100644 +index 4045ae665450f6e3f5630cb25cc53be850afd1a8..ddc6b6b26dec60cc6a4111cf00fa0284ee582ad5 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java @@ -134,7 +134,7 @@ public class VaultBlockEntity extends BlockEntity { @@ -6802,7 +8191,7 @@ index 4045ae665450f6e3f5630cb25cc53be850afd1a8..15c9e4c1ed7b62987b112c3a1d342d92 @Nullable public VaultServerData getServerData() { - return this.level != null && !this.level.isClientSide ? this.serverData : null; -+ return this.level != null /*&& !this.level.isClientSide*/ ? this.serverData : null; // Plazma - Remove persist flag ++ return this.level != null /*&& !this.level.isClientSide*/ ? this.serverData : null; // Plazma - Remove persist 'isClientSide' flag } public VaultSharedData getSharedData() { @@ -6820,7 +8209,7 @@ index b696597540d998c52ec3207ffd8bf658fde59215..a030a22057d35ebb6d84cb43cff12a2f return InteractionResult.CONSUME; } else { diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -index 4b51472502d08ea357da437afeb4b581979e9cff..0a1c659c12a56331d88b951478ee98823feaad9c 100644 +index 4b51472502d08ea357da437afeb4b581979e9cff..fb5e18b7be62ff07af65229b1a38b6d6e0c1d8c9 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java @@ -108,24 +108,24 @@ public class PistonBaseBlock extends DirectionalBlock { @@ -6828,20 +8217,20 @@ index 4b51472502d08ea357da437afeb4b581979e9cff..0a1c659c12a56331d88b951478ee9882 @Override public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.checkIfExtend(world, pos, state); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @Override protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) { - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.checkIfExtend(world, pos, state); - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } @@ -6849,7 +8238,7 @@ index 4b51472502d08ea357da437afeb4b581979e9cff..0a1c659c12a56331d88b951478ee9882 protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { if (!oldState.is(state.getBlock())) { - if (!world.isClientSide && world.getBlockEntity(pos) == null) { -+ if (/*!world.isClientSide &&*/ world.getBlockEntity(pos) == null) { // Plazma - Remove persist flag ++ if (/*!world.isClientSide &&*/ world.getBlockEntity(pos) == null) { // Plazma - Remove persist 'isClientSide' flag this.checkIfExtend(world, pos, state); } @@ -6858,7 +8247,7 @@ index 4b51472502d08ea357da437afeb4b581979e9cff..0a1c659c12a56331d88b951478ee9882 BlockState iblockdata1 = (BlockState) state.setValue(PistonBaseBlock.EXTENDED, true); - if (!world.isClientSide) { -+ //if (!world.isClientSide) { // Plazma - Remove persist flag ++ //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag boolean flag = this.getNeighborSignal(world, pos, enumdirection); if (flag && (type == 1 || type == 2)) { @@ -6867,7 +8256,7 @@ index 4b51472502d08ea357da437afeb4b581979e9cff..0a1c659c12a56331d88b951478ee9882 return false; } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag if (type == 0) { if (!this.moveBlocks(world, pos, enumdirection, true)) { @@ -6885,7 +8274,7 @@ index c5c297b1081c9ddbb3bd0a0947401041aa8fec7d..ca409b4e49d9b7842a0d35fef10f8f53 if (this.isFittingBase(state, world.getBlockState(blockPos))) { world.destroyBlock(blockPos, false); diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -index e1c9a961064887070b29207efd7af47884f8dc29..ff65c8e73581e162729217d5f44aeaeaa7c5b8f3 100644 +index e1c9a961064887070b29207efd7af47884f8dc29..6feb7f915dac585916ac02a7f4a83b4783543cc9 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java @@ -272,7 +272,7 @@ public class PistonMovingBlockEntity extends BlockEntity { @@ -6893,7 +8282,7 @@ index e1c9a961064887070b29207efd7af47884f8dc29..ff65c8e73581e162729217d5f44aeaea public void finalTick() { - if (this.level != null && (this.progressO < 1.0F || this.level.isClientSide)) { -+ if (this.level != null && (this.progressO < 1.0F /*|| this.level.isClientSide*/)) { // Plazma - Remove persist flag ++ if (this.level != null && (this.progressO < 1.0F /*|| this.level.isClientSide*/)) { // Plazma - Remove persist 'isClientSide' flag this.progress = 1.0F; this.progressO = this.progress; this.level.removeBlockEntity(this.worldPosition); @@ -6901,11 +8290,11 @@ index e1c9a961064887070b29207efd7af47884f8dc29..ff65c8e73581e162729217d5f44aeaea blockEntity.lastTicked = world.getGameTime(); blockEntity.progressO = blockEntity.progress; if (blockEntity.progressO >= 1.0F) { -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide && blockEntity.deathTicks < 5) { blockEntity.deathTicks++; } else { -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag world.removeBlockEntity(pos); blockEntity.setRemoved(); if (world.getBlockState(pos).is(Blocks.MOVING_PISTON)) { @@ -6914,88 +8303,88 @@ index e1c9a961064887070b29207efd7af47884f8dc29..ff65c8e73581e162729217d5f44aeaea } } - } -+ //} // Plazma - Remove persist flag ++ //} // Plazma - Remove persist 'isClientSide' flag } else { float f = blockEntity.progress + 0.5F; moveCollidedEntities(world, pos, f, blockEntity); diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 6656cc0c9041d954d6d318cdefaef86ebee4c2bc..f8542422c40a4caba798ab53d0274c61e2a2f765 100644 +index 5c4843f6cfd13790a44fc0f928f1fbcef8a648ce..3b3915c4f93f7e35392255c1352e236208a2b447 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -416,7 +416,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -430,7 +430,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p boolean flag3 = iblockdata1.hasBlockEntity(); - if (!this.level.isClientSide && !this.level.isBlockPlaceCancelled) { // Paper - prevent calling cleanup logic when undoing a block place upon a cancelled BlockPlaceEvent -+ if (/*!this.level.isClientSide &&*/ !this.level.isBlockPlaceCancelled) { // Paper - prevent calling cleanup logic when undoing a block place upon a cancelled BlockPlaceEvent // Plazma - Remove persist flag ++ if (/*!this.level.isClientSide &&*/ !this.level.isBlockPlaceCancelled) { // Paper - prevent calling cleanup logic when undoing a block place upon a cancelled BlockPlaceEvent // Plazma - Remove persist 'isClientSide' flag iblockdata1.onRemove(this.level, blockposition, iblockdata, flag); } else if (!iblockdata1.is(block) && flag3) { this.removeBlockEntity(blockposition); -@@ -426,7 +426,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -440,7 +440,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p return null; } else { // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled. - if (!this.level.isClientSide && doPlace && (!this.level.captureBlockStates || block instanceof net.minecraft.world.level.block.BaseEntityBlock)) { -+ if (/*!this.level.isClientSide &&*/ doPlace && (!this.level.captureBlockStates || block instanceof net.minecraft.world.level.block.BaseEntityBlock)) { // Plazma - Remove persist flag ++ if (/*!this.level.isClientSide &&*/ doPlace && (!this.level.captureBlockStates || block instanceof net.minecraft.world.level.block.BaseEntityBlock)) { // Plazma - Remove persist 'isClientSide' flag iblockdata.onPlace(this.level, blockposition, iblockdata1, flag); } -@@ -528,7 +528,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -542,7 +542,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p } private boolean isInLevel() { - return this.loaded || this.level.isClientSide(); -+ return this.loaded; // || this.level.isClientSide(); // Plazma - Remove persist flag ++ return this.loaded; //|| this.level.isClientSide(); // Plazma - Remove persist 'isClientSide' flag } boolean isTicking(BlockPos pos) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java -index 54debe9da0a26aea02c964fdc7efb372e07974c0..b7b689373cef3d4b39ac5768a682fd8750192edd 100644 +index 54debe9da0a26aea02c964fdc7efb372e07974c0..2e630167b1d21bc67a88e725a5e451bcf34441fb 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java @@ -128,9 +128,11 @@ public class CraftMerchantCustom implements CraftMerchant { public void overrideOffers(MerchantOffers offers) { } -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag @Override public boolean isClientSide() { return false; } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java -index 37458e8fd5d57acbf90a6bea4e66797cb07f69fa..f6681aeeaa70a62f50611cf320d6121b98e77003 100644 +index 37458e8fd5d57acbf90a6bea4e66797cb07f69fa..313e3202e5f1acbdf9aba0826139c3e94de9de0a 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java @@ -322,10 +322,12 @@ public abstract class DelegatedGeneratorAccess implements WorldGenLevel { return this.handle.getUncachedNoiseBiome(biomeX, biomeY, biomeZ); } -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag @Override public boolean isClientSide() { return this.handle.isClientSide(); } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag @Override public int getSeaLevel() { diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java -index e8a73d34dbb372581b03018aade170a31c266099..655506771a7fed9281054cce726dd4fc54041fcb 100644 +index e8a73d34dbb372581b03018aade170a31c266099..6f540ae099e51e91e5cb86d7b938369f8292a47b 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java @@ -163,10 +163,12 @@ public class DummyGeneratorAccess implements WorldGenLevel { throw new UnsupportedOperationException("Not supported yet."); } -+ /* // Plazma - Remove persist flag ++ /* // Plazma - Remove persist 'isClientSide' flag @Override public boolean isClientSide() { return false; } -+ */ // Plazma - Remove persist flag ++ */ // Plazma - Remove persist 'isClientSide' flag @Override public int getSeaLevel() { diff --git a/patches/server/0044-Process-pathfinding-asynchronously.patch b/patches/server/0043-Process-pathfinding-asynchronously.patch similarity index 97% rename from patches/server/0044-Process-pathfinding-asynchronously.patch rename to patches/server/0043-Process-pathfinding-asynchronously.patch index 109f427..4723c8d 100644 --- a/patches/server/0044-Process-pathfinding-asynchronously.patch +++ b/patches/server/0043-Process-pathfinding-asynchronously.patch @@ -764,7 +764,7 @@ index f73b559b8e60859020f762dab88b67b8c912bf8f..d218604447afbde96dc4af33ba90a876 } diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index c7c6385c71c5bfae5818976008feececf5890654..b54c7b274c5c4eefc8c0170b89a6c7d7d02f5f08 100644 +index 48c0de870a5bbf647309e69361dfb10ab56c65ab..99e31c8e8488ce7138c5385575cbbabe0bd7394e 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java @@ -168,6 +168,7 @@ public abstract class PathNavigation { @@ -778,7 +778,7 @@ index c7c6385c71c5bfae5818976008feececf5890654..b54c7b274c5c4eefc8c0170b89a6c7d7 @@ -195,6 +196,23 @@ public abstract class PathNavigation { PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i)); Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, positions, followRange, distance, this.maxVisitedNodesMultiplier); - //profilerFiller.pop(); // Purpur + profilerFiller.pop(); + // Plazma start - Process pathfinding asynchronously + if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) { + if (!positions.isEmpty()) this.targetPos = positions.iterator().next(); @@ -894,7 +894,7 @@ index 9104d7010bda6f9f73b478c11490ef9c53f76da2..a53950a6e4cb2e672b6f130461fa6306 // Paper end - optimise POI access if (path != null && path.canReach()) { diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index 6c4cab8cabdd27b6dbd97a408a588f4ef9684654..32a1bb3ea64099c4583607ee246b8cadb77c4d44 100644 +index 6dec1720aea724baab541e26e14c9fa0646abdbf..bf4a3bc730709f41a5089dfe4c6342b08057ef02 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java @@ -1206,7 +1206,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @@ -916,10 +916,10 @@ index 6c4cab8cabdd27b6dbd97a408a588f4ef9684654..32a1bb3ea64099c4583607ee246b8cad } } diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -index 62991c7d1c4d62669adeb30b56c94b0e7d998ab2..2077ccca3f6f942ec7daa06759ce0532b11a00a5 100644 +index 17ba0c6060ab56ab97b133565ebf86320ab52e1b..305fe2c13ae2d81b99ff36f8ef18e24c23255eae 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -@@ -505,10 +505,23 @@ public class Frog extends Animal implements VariantHolder> { +@@ -506,10 +506,23 @@ public class Frog extends Animal implements VariantHolder> { return nodeType != PathType.WATER_BORDER && super.canCutCorner(nodeType); } @@ -944,7 +944,7 @@ index 62991c7d1c4d62669adeb30b56c94b0e7d998ab2..2077ccca3f6f942ec7daa06759ce0532 } } diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java -index de3d91891000c599950e31da595c254a3b421e7a..a73d7a1ea1ef7a98a114b7d10de6b2946c092f76 100644 +index 19bc362ff8e28cd0e26ba357dda425bac24c5a56..e4784d37c4b93c34325eb72cfbaa640c63d0c3c1 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java +++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java @@ -308,7 +308,7 @@ public class Drowned extends Zombie implements RangedAttackMob { @@ -957,7 +957,7 @@ index de3d91891000c599950e31da595c254a3b421e7a..a73d7a1ea1ef7a98a114b7d10de6b294 if (blockPos != null) { double d = this.distanceToSqr((double)blockPos.getX(), (double)blockPos.getY(), (double)blockPos.getZ()); diff --git a/src/main/java/net/minecraft/world/entity/monster/Strider.java b/src/main/java/net/minecraft/world/entity/monster/Strider.java -index d414158e1222f9a4f73a33abcf96f994aee4efde..dec0fd7d0b704c20df03b3c17fae1af921217e11 100644 +index c09e49f928e32a3dc6c557f01d92c455d9bfc8c6..bf507bcb8746298ca96e50686cdf1bd91c91e4c1 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Strider.java +++ b/src/main/java/net/minecraft/world/entity/monster/Strider.java @@ -610,10 +610,23 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { @@ -985,10 +985,10 @@ index d414158e1222f9a4f73a33abcf96f994aee4efde..dec0fd7d0b704c20df03b3c17fae1af9 } diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -index bcc1f2e8ad66eb826617f17d98fb43649fc8deb2..421a255dcb9843b34e8b0e39b65ee9b1bbd3ed0d 100644 +index 6cce132f43ce7aad6f5ee2b351855c9b57b8f0c1..4102dc4c8b63a1d00a8417aa303521590202f9a6 100644 --- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -@@ -636,6 +636,15 @@ public class Warden extends Monster implements VibrationSystem { +@@ -638,6 +638,15 @@ public class Warden extends Monster implements VibrationSystem { protected PathFinder createPathFinder(int range) { this.nodeEvaluator = new WalkNodeEvaluator(); this.nodeEvaluator.setCanPassDoors(true); @@ -1026,11 +1026,11 @@ index d9d0fff9962131808d54cca20f209df50b8e4af1..420dd323790e72aa12c942d31a94bcb8 public void write(FriendlyByteBuf buf) { buf.writeCollection(this.targetNodes, (bufx, node) -> node.writeToStream(bufx)); diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -index f1aa182d7cc0ffac23ddb1f77335c61ca9f6f720..bc98944d37d5eb96a58092c31d7cb108249b7701 100644 +index cc7d94144e39f7dace7b569b4567def98396e8f9..95e71c471904fc54003180632dc85398ae06d241 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -@@ -17,6 +17,7 @@ import net.minecraft.core.BlockPos; - //import net.minecraft.util.profiling.metrics.MetricCategory; // Plazma - Completely remove Mojang's Profiler +@@ -17,6 +17,7 @@ import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.util.profiling.metrics.MetricCategory; import net.minecraft.world.entity.Mob; import net.minecraft.world.level.PathNavigationRegion; +import dev.kaiijumc.kaiiju.path.*; // Plazma - Process pathfinding asynchronously @@ -1083,9 +1083,9 @@ index f1aa182d7cc0ffac23ddb1f77335c61ca9f6f720..bc98944d37d5eb96a58092c31d7cb108 - @Nullable - // Paper start - Perf: remove streams and optimize collection - private Path findPath(Node startNode, List> positions, float followRange, int distance, float rangeMultiplier) { -- //ProfilerFiller profilerFiller = Profiler.get(); // Purpur -- //profilerFiller.push("find_path"); // Purpur -- //profilerFiller.markForCharting(MetricCategory.PATH_FINDING); // Purpur +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("find_path"); +- profilerFiller.markForCharting(MetricCategory.PATH_FINDING); - // Set set = positions.keySet(); - startNode.g = 0.0F; - startNode.h = this.getBestH(startNode, positions); // Paper - optimize collection @@ -1187,7 +1187,7 @@ index f1aa182d7cc0ffac23ddb1f77335c61ca9f6f720..bc98944d37d5eb96a58092c31d7cb108 + } finally { + this.nodeEvaluator.done(); } -- //profilerFiller.pop(); // Purpur +- profilerFiller.pop(); - return best; - // Paper end - Perf: remove streams and optimize collection } @@ -1298,7 +1298,7 @@ index 1c83926923f50fb4da1a83dc91614c20a831555f..aec2d0f9a957be65d031957dbff874d8 Command.broadcastCommandMessage(sender, text("Successfully reloaded Plazma configuration files.", NamedTextColor.GREEN)); diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index cac12ad98eb0fa4dcc1b0f7f21d1eadd14ef7456..ab4ff76efbe4077691a0fde4043160ecbc4bc7dc 100644 +index 68a0e7144942022f0665e3124d98add70376d4a4..e85e7b22e7b2e59897d4c35e2e5150c0a26235c6 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -70,6 +70,26 @@ public class GlobalConfiguration extends ConfigurationPart { diff --git a/patches/server/0043-minor-code-improvements.patch b/patches/server/0043-minor-code-improvements.patch deleted file mode 100644 index a59501b..0000000 --- a/patches/server/0043-minor-code-improvements.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaKR93 -Date: Sat, 2 Nov 2024 15:10:12 +0900 -Subject: [PATCH] minor code improvements - - -diff --git a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java -index e5c5e20b0f2b2094faae2955a886f06ef6771eff..f19ab0a7daa671727675c2d03b3c77b287062f75 100644 ---- a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java -@@ -100,8 +100,8 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal { - // Paper end - call EntityPortalEnterEvent - BlockEntity tileentity = world.getBlockEntity(pos); - -- if (/*!world.isClientSide &&*/ tileentity instanceof TheEndGatewayBlockEntity) { // Plazma - Remove persist flag -- TheEndGatewayBlockEntity tileentityendgateway = (TheEndGatewayBlockEntity) tileentity; -+ if (/*!world.isClientSide &&*/ tileentity instanceof TheEndGatewayBlockEntity tileentityendgateway) { // Plazma - Remove persist flag // Plazma - minor code improvements -+ //TheEndGatewayBlockEntity tileentityendgateway = (TheEndGatewayBlockEntity) tileentity; // Plazma - minor code improvements - - if (!tileentityendgateway.isCoolingDown()) { - // Purpur start diff --git a/patches/server/0045-Implement-alternative-noise-chunk-generator.patch b/patches/server/0044-Implement-alternative-noise-chunk-generator.patch similarity index 99% rename from patches/server/0045-Implement-alternative-noise-chunk-generator.patch rename to patches/server/0044-Implement-alternative-noise-chunk-generator.patch index 9bf3761..ac5f218 100644 --- a/patches/server/0045-Implement-alternative-noise-chunk-generator.patch +++ b/patches/server/0044-Implement-alternative-noise-chunk-generator.patch @@ -218,7 +218,7 @@ index 0e6dfe2635ea5f5e410049b05f94f5083b2f18a4..584311a00c5037a6d5bc05b1261969aa return null; } diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index ab4ff76efbe4077691a0fde4043160ecbc4bc7dc..2e1cf5f79556250aa22df3ade66393fe6a947659 100644 +index e85e7b22e7b2e59897d4c35e2e5150c0a26235c6..dc300e14e1bd03b4e855a360f1deda1cd7d6f7f0 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -45,6 +45,8 @@ public class GlobalConfiguration extends ConfigurationPart { diff --git a/patches/server/0047-Reduce-allocations.patch b/patches/server/0045-Reduce-allocations.patch similarity index 96% rename from patches/server/0047-Reduce-allocations.patch rename to patches/server/0045-Reduce-allocations.patch index 539b5a1..0f19238 100644 --- a/patches/server/0047-Reduce-allocations.patch +++ b/patches/server/0045-Reduce-allocations.patch @@ -95,7 +95,7 @@ index db92261a6cb3758391108361096417c61bc82cdc..70ffa0853e04bd1684a36621143c3656 public SortedList(final E[] elements, final Comparator comparator) { diff --git a/src/main/java/ca/spottedleaf/moonrise/common/misc/NearbyPlayers.java b/src/main/java/ca/spottedleaf/moonrise/common/misc/NearbyPlayers.java -index bb44de17a37082e57f2292a4f470740be1d09b11..34c4d6cff702683d488a3ba0f59b513e279413af 100644 +index 7e440b4a46b040365df7317035e577d93e7d855d..fd30799510b8230e11de10376ff9f781262e8282 100644 --- a/src/main/java/ca/spottedleaf/moonrise/common/misc/NearbyPlayers.java +++ b/src/main/java/ca/spottedleaf/moonrise/common/misc/NearbyPlayers.java @@ -156,7 +156,7 @@ public final class NearbyPlayers { @@ -165,10 +165,10 @@ index 58d9187adc188b693b6becc400f766e069bf1bf5..a3d186c80840fdb628a48181df219c46 public ServerEntityLookup(final ServerLevel world, final LevelCallback worldCallback) { super(world, worldCallback); diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java -index f3c453773e0413276935ca653b60bbe64fa4b169..1983a3802d96def1dbb53445ebf219290342cc29 100644 +index b0bfe655922877676948d9b6ff3fa5a6ebb7a640..742594c95a6ea88f8e6e899e448277bc6f57ded7 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java -@@ -919,9 +919,10 @@ public final class ChunkTaskScheduler { +@@ -921,9 +921,10 @@ public final class ChunkTaskScheduler { } } @@ -194,7 +194,7 @@ index eafa4e6d55cd0f9314ac0f2b96a7f48fbb5e1a4c..19c55571d3478532845d87d0053e4100 public static final record ChunkCompletion(ChunkAccess chunk, ChunkStatus genStatus) {}; private static final VarHandle CHUNK_COMPLETION_ARRAY_HANDLE = ConcurrentUtil.getArrayHandle(ChunkCompletion[].class); diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightEngine.java b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightEngine.java -index 95218c6dc9ade3c0347f26564c9f319f0e88c102..2bcf46ade808cb9db05f07777adf36f19408b192 100644 +index ef40af5c6ac60fe00c05adcb664c811b28330819..097b9c5f8f81fdc547b379dcf5e68ddf6d7bbca4 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightEngine.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightEngine.java @@ -1094,6 +1094,7 @@ public abstract class StarLightEngine { @@ -346,10 +346,10 @@ index 1e9873d7b258ce1f0b2437cb1e487157a16f6834..94f1337bb63a505641b66e6cbf0cc288 public CrashReportCategory(String title) { this.title = title; diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index ccfe9ef24dce9f34613692adb13738d3ad0e7aac..c2c5606bd02598b011eb998b034b03f515b29331 100644 +index 1360aa8202542d3d0f32247f1123575fc2c38ff1..c9c1a2bd96804835250ff3b921277e4fe6191bcc 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -576,7 +576,7 @@ public class Util { +@@ -592,7 +592,7 @@ public class Util { } else if (futures.size() == 1) { return futures.get(0).thenApply(List::of); } else { @@ -479,7 +479,7 @@ index a2920b8a9eff77d9c5d1d7f70ad3abdacba8f0fa..80a28985e072334d960fe5a674d9bb08 protected CipherBase(Cipher cipher) { this.cipher = cipher; diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 56e47c5709c765943407d2065b25bd512d1f9388..902faff84d17d3a251745ceb7b047340fb7b5faa 100644 +index 44a31f6f44885598ee06e88b940b84b1e89e5430..01158f1f4aa13cefb46c0ed7cce55dbbde89b521 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -326,7 +326,7 @@ public class Connection extends SimpleChannelInboundHandler> { @@ -609,10 +609,10 @@ index 8dd9375f2ad2c65a773a3195aeff1f977e09e7e0..89cfe5a4e1554dd722ca98ec8c896e85 private ChunkMap getChunkMap() { return (ChunkMap)this.playerProvider; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index b7f3ba9fe334362227c1c1624ad7922d624993f3..575fa1395477bad8e264f18648811b02376afe0b 100644 +index 3a8b566aa44df367c6edacf371c0b7a2bd2548b6..20d9cd87fcbdd666231746ca1b364cde7016b5d6 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1349,7 +1349,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1364,7 +1364,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public static List getCurrentlyTickingEntities() { Entity ticking = currentlyTickingEntity.get(); @@ -622,7 +622,7 @@ index b7f3ba9fe334362227c1c1624ad7922d624993f3..575fa1395477bad8e264f18648811b02 return ret; } diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index bb10892f33ba0d7fc3959debef1045073868f8b8..b717afedc81765b8990f04a6c8c3795c00b746f0 100644 +index ab6a7d20f5473d8bffa7f8d136c1d55f17bbfaff..dce1796f0a7dbc69596b0348f42fe8d5fec1d2fa 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -172,12 +172,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -640,7 +640,7 @@ index bb10892f33ba0d7fc3959debef1045073868f8b8..b717afedc81765b8990f04a6c8c3795c } // Paper end - Validate usernames this.requestedUsername = packet.name(); -@@ -275,7 +275,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -266,7 +266,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @Override public void handleKey(ServerboundKeyPacket packet) { @@ -649,7 +649,7 @@ index bb10892f33ba0d7fc3959debef1045073868f8b8..b717afedc81765b8990f04a6c8c3795c final String s; -@@ -456,7 +456,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -447,7 +447,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @Override public void handleLoginAcknowledgement(ServerboundLoginAcknowledgedPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.server); // CraftBukkit @@ -715,7 +715,7 @@ index a371f685534bf161f476ccea431fec6a80aca9c1..d2addf2453fa35779f0197f54a102e06 } diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index 32a1bb3ea64099c4583607ee246b8cadb77c4d44..e7b79aa92afbee2c4f3b18fc30b36cb47fea357b 100644 +index bf4a3bc730709f41a5089dfe4c6342b08057ef02..b8ac4ff028dc839a7f1d0c1b9922b0507dc384db 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java @@ -257,7 +257,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @@ -728,7 +728,7 @@ index 32a1bb3ea64099c4583607ee246b8cadb77c4d44..e7b79aa92afbee2c4f3b18fc30b36cb4 this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true)); } diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java -index 0c085bc33a8f1a4ab299d9b6a13ac0f54c76b101..727e0d9fb297923088c6622f137b1e97807c1849 100644 +index cf071f48fb9b3acb7fabe4295de979dfca1079b4..fb663d60f6245f16fb4a09ce7c6fa65badfa1e36 100644 --- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java +++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java @@ -119,7 +119,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob { @@ -741,7 +741,7 @@ index 0c085bc33a8f1a4ab299d9b6a13ac0f54c76b101..727e0d9fb297923088c6622f137b1e97 this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Mob.class, 5, false, false, (entityliving, worldserver) -> { return entityliving instanceof Enemy && !(entityliving instanceof Creeper); diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java -index 5997c826baecbc291575662917dc2f86aae18343..ba3ff61e1accbe299a49bcc93b2cdbfeeafc55c6 100644 +index 2df413fce51db6360c2a55fde72061135e0bd3a9..ae5d66afa5573596df9c322d9bb5c270777e8b8b 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Panda.java +++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java @@ -338,7 +338,7 @@ public class Panda extends Animal { @@ -754,7 +754,7 @@ index 5997c826baecbc291575662917dc2f86aae18343..ba3ff61e1accbe299a49bcc93b2cdbfe public static AttributeSupplier.Builder createAttributes() { diff --git a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java -index 082004a11174ecd492da4a59de226bdd94da914c..c2b81c8c43fdd14dcf5347e6683636da5687830a 100644 +index 034dec437d6a6df5664185de77245bd17fcdd59b..67788747c84174054bfc2f66a4596837e08dd046 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java +++ b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java @@ -458,7 +458,7 @@ public class Rabbit extends Animal implements VariantHolder { @@ -767,7 +767,7 @@ index 082004a11174ecd492da4a59de226bdd94da914c..c2b81c8c43fdd14dcf5347e6683636da this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Wolf.class, true)); this.getAttribute(Attributes.ATTACK_DAMAGE).addOrUpdateTransientModifier(new AttributeModifier(Rabbit.EVIL_ATTACK_POWER_MODIFIER, 5.0D, AttributeModifier.Operation.ADD_VALUE)); diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java -index d6953cc2cd43e740106983730b1ef4f0f8d532a0..2f448e3895d3e7c5c60c953c6302cb24656549fd 100644 +index 14d3e09e8eca665d186f5d356158052b118c6848..02927b6face86a9825a97b767c8de85838a79725 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java +++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java @@ -247,7 +247,7 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder(this, Animal.class, false, Wolf.PREY_SELECTOR)); // Purpur - moved to updatePathfinders() this.targetSelector.addGoal(6, new NonTameRandomTargetGoal<>(this, Turtle.class, false, Turtle.BABY_ON_LAND_SELECTOR)); diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java -index 61a939bdebeed51a839c93d31038e4395a9484c3..947c492f2350aa76bbf85e2679f6e3096444617c 100644 +index a660d8bfa1294cd44dfa89f4c15bd339ffcccecf..dc833fe4aed149a4edbf668af4bc12937f6a4850 100644 --- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java +++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java @@ -88,7 +88,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS @@ -807,7 +807,7 @@ index 48826eb0a960f7af6dd2ef184a8aed744a1d8f83..495a24d4e6705902c36032227bdfa359 public static final EnderDragonPhase STRAFE_PLAYER = create(DragonStrafePlayerPhase.class, "StrafePlayer"); public static final EnderDragonPhase LANDING_APPROACH = create(DragonLandingApproachPhase.class, "LandingApproach"); diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -index 7c862d730d8062303046519a9601c62fe284e1ba..8ef1beb34e4439a62be222a8ad7d2f58df6f328b 100644 +index 05fb8b26369f7703c6a97f1764a71bd4c3fe1058..82b31ced06d883a817b6d7036f8fce8481b463b9 100644 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java @@ -258,7 +258,7 @@ public class WitherBoss extends Monster implements RangedAttackMob { @@ -820,7 +820,7 @@ index 7c862d730d8062303046519a9601c62fe284e1ba..8ef1beb34e4439a62be222a8ad7d2f58 } diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java -index 4a389323d2ba15b282217ec54c52f5c278f79ff6..47d40d10c1b1514e6d56b994cc34b124b7fb5ce1 100644 +index 41c6b60a9d0210b7f2c660cc03999be9c9bc344e..8acafd4f4d2dec45fb18f89a0be5c4a584c44904 100644 --- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java @@ -81,7 +81,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo @@ -833,7 +833,7 @@ index 4a389323d2ba15b282217ec54c52f5c278f79ff6..47d40d10c1b1514e6d56b994cc34b124 this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true)); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR)); diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java -index 058ca0f7b85754950ddbb014958c1b90f15f8549..275e874a27afdb6b708d7edb8317f8b26f3e2711 100644 +index 3b2560ee1bb8c415eada619fc057d35ccb0e2ab0..82ccbcef029066a1b48c0844e974380d89059910 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java +++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java @@ -154,7 +154,7 @@ public class Creeper extends Monster { @@ -846,7 +846,7 @@ index 058ca0f7b85754950ddbb014958c1b90f15f8549..275e874a27afdb6b708d7edb8317f8b2 public static AttributeSupplier.Builder createAttributes() { diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -index fbf08c9041e07f49f1fc2f869ea2f5ba795bc7ff..1f9a24cc958675d4ad5d6fe9fd1ff515d0bdb4d2 100644 +index d57f6b312341f6d83788bbb294cc65ee47361373..aff74f0ca5a8a007b919151194f8ef578ce6fda4 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java @@ -136,7 +136,7 @@ public class EnderMan extends Monster implements NeutralMob { @@ -859,7 +859,7 @@ index fbf08c9041e07f49f1fc2f869ea2f5ba795bc7ff..1f9a24cc958675d4ad5d6fe9fd1ff515 this.targetSelector.addGoal(4, new ResetUniversalAngerTargetGoal<>(this, false)); } diff --git a/src/main/java/net/minecraft/world/entity/monster/Endermite.java b/src/main/java/net/minecraft/world/entity/monster/Endermite.java -index 57158457f7d0e6a785df9fe19204d73d6b918e79..6326c74849b648622eda886a3adb0db45b8c750c 100644 +index 063954513b5c69047298a98224d7e099e18588bf..be9a5957b076268d79445d6daf7ae0deac32f6eb 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Endermite.java +++ b/src/main/java/net/minecraft/world/entity/monster/Endermite.java @@ -90,7 +90,7 @@ public class Endermite extends Monster { @@ -872,7 +872,7 @@ index 57158457f7d0e6a785df9fe19204d73d6b918e79..6326c74849b648622eda886a3adb0db4 } diff --git a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java -index ece70d8303e563df416fc6703e6d7d2e23ee220a..25110321e35656e30017e7affceff1960991da37 100644 +index 7a6ad611faf39eb8dd87bd498169571633c33769..2a3edfeab8306efe013084de44e1c372fffe98d6 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java +++ b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java @@ -89,7 +89,7 @@ public class Silverfish extends Monster { @@ -885,7 +885,7 @@ index ece70d8303e563df416fc6703e6d7d2e23ee220a..25110321e35656e30017e7affceff196 } diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java -index 651cc3297a86ff298f72b28a9fb623a0922adad8..3cb5d615833767122ae8b92294e44ffdf4ac21b3 100644 +index 74f8903541d5288f2a50769ffc5ef88e0c9aad1b..b58cef316e85edde6200fe870144334a19ef193d 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Spider.java +++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java @@ -97,7 +97,7 @@ public class Spider extends Monster { @@ -898,7 +898,7 @@ index 651cc3297a86ff298f72b28a9fb623a0922adad8..3cb5d615833767122ae8b92294e44ffd this.targetSelector.addGoal(3, new Spider.SpiderTargetGoal<>(this, IronGolem.class)); } diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 94f2f27abdf5e48835bd134ac164a163fb78dc41..a3141438b5fa64318a1d515de296ce59e18b0ce9 100644 +index 6628efb0ec59e68810152a64309bc5f610181392..badde720a15f3a9a0c0c8b6b66b387b3b1aabd64 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java @@ -170,7 +170,7 @@ public class Zombie extends Monster { @@ -960,7 +960,7 @@ index 2490a42c9c35c7e080279ef8566288a28362d167..34d6eaebfe03716c8cbbb5395024b0da String[] strings = new String[pattern.size() - l - k]; diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java -index cb19d28823a701720cd1998310dfc8cc8f50919f..5be6a615182fe7cf46be6a3b9683333c4e98f7b7 100644 +index f5b498bf68d351e42f5db5ae28aab4923847e3a5..73f5ccf83285d5514907160e3cc5f5c1cde73d6b 100644 --- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java @@ -462,7 +462,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { @@ -1004,7 +1004,7 @@ index 4e56398a6fb8b97199f4c74ebebc1055fb718dcf..84faa524b57e1877ed6006be6784b07b } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index 6a465d9b12c92b5385c394fef7456630be97c04d..d0be5fd43b59a8b4dd3ac2fab1c6580936318be0 100644 +index 16f07007a0f73ec0c6f421c9b082518e87e8cc7b..c08c0096eeac2d184256c703f38b230d7ad8ee9f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java @@ -426,7 +426,7 @@ public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patche @@ -1148,7 +1148,7 @@ index 8a4f95049c63afb28bef6719c77b7a7092e75aae..f295205e3093f8c3c4ed4c1cf6ac3aaf System.out.println("Starting server"); Thread runThread = new Thread(() -> { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 48ad261eec1b74fad5a4fc1516b75fd2aaecd528..024465e1c1232f839db00432379ca8f42b7ff78b 100644 +index 63065a22ff359c142bab23fccacfd5ebd86f81a5..b788c9c1b162ea5b71754a1061565531b8cf1548 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -520,7 +520,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0048-Hashed-rcon-password.patch b/patches/server/0046-Hashed-rcon-password.patch similarity index 99% rename from patches/server/0048-Hashed-rcon-password.patch rename to patches/server/0046-Hashed-rcon-password.patch index 1ca1a4b..a7e38ba 100644 --- a/patches/server/0048-Hashed-rcon-password.patch +++ b/patches/server/0046-Hashed-rcon-password.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Hashed rcon password diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -index 067f91dd019be40cb09f8fa78cae587429488201..765eb86e66125a517f14a568958281bd57c1bc63 100644 +index 3dd5c7441bb300ca17d717af37edbefb89db4b2f..df367fbb8c582614aaf2087aa37d5e47247af810 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java @@ -73,7 +73,6 @@ public class DedicatedServerProperties extends Settings -Date: Mon, 4 Nov 2024 15:20:40 +0900 -Subject: [PATCH] Option to use better RNG - - -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index e94ab488b4d7ef26021be3b97c71831eeef505f4..82ed63aa458b6b628be7163a6b1f1f47d1a69ce4 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -125,7 +125,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - public final Thread thread; - private final boolean isDebug; - private int skyDarken; -- protected int randValue = RandomSource.create().nextInt(); -+ protected long randValue; - protected final int addend = 1013904223; - protected float oRainLevel; - public float rainLevel; -@@ -134,7 +134,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - public final RandomSource random = RandomSource.create(); - /** @deprecated */ - @Deprecated -- private final RandomSource threadSafeRandom = RandomSource.createThreadSafe(); -+ private final @Nullable RandomSource threadSafeRandom; - private final Holder dimensionTypeRegistration; - public final WritableLevelData levelData; - //public final boolean isClientSide; // Plazma - Remove persist flag -@@ -909,6 +909,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot - this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config - this.plazmaConfig = plazmaWorldConfigurationCreator.apply(this.spigotConfig); // Plazma - Configurable Plazma -+ this.randValue = plazmaConfig.misc.useBetterRandomAlgorithm ? RandomSource.create().nextLong() : RandomSource.create().nextInt(); // Plazma - Option to use better RNG -+ this.threadSafeRandom = plazmaConfig.misc.useBetterRandomAlgorithm ? null : RandomSource.createThreadSafe(); // Plazma - Option to use better RNG - this.purpurConfig = new org.purpurmc.purpur.PurpurWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // Purpur - this.playerBreedingCooldowns = this.getNewBreedingCooldownCache(); // Purpur - this.generator = gen; -@@ -1472,15 +1474,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - } - - public void playSound(@Nullable Player source, double x, double y, double z, SoundEvent sound, SoundSource category, float volume, float pitch) { -- this.playSeededSound(source, x, y, z, sound, category, volume, pitch, this.threadSafeRandom.nextLong()); -+ long seed = this.threadSafeRandom == null ? this.randValue++ : this.threadSafeRandom.nextLong(); -+ this.playSeededSound(source, x, y, z, sound, category, volume, pitch, seed); - } - - public void playSound(@Nullable Player source, double x, double y, double z, Holder sound, SoundSource category, float volume, float pitch) { -- this.playSeededSound(source, x, y, z, sound, category, volume, pitch, this.threadSafeRandom.nextLong()); -+ long seed = this.threadSafeRandom == null ? this.randValue++ : this.threadSafeRandom.nextLong(); -+ this.playSeededSound(source, x, y, z, sound, category, volume, pitch, seed); - } - - public void playSound(@Nullable Player source, Entity entity, SoundEvent sound, SoundSource category, float volume, float pitch) { -- this.playSeededSound(source, entity, BuiltInRegistries.SOUND_EVENT.wrapAsHolder(sound), category, volume, pitch, this.threadSafeRandom.nextLong()); -+ long seed = this.threadSafeRandom == null ? this.randValue++ : this.threadSafeRandom.nextLong(); -+ this.playSeededSound(source, entity, BuiltInRegistries.SOUND_EVENT.wrapAsHolder(sound), category, volume, pitch, seed); - } - - public void playLocalSound(BlockPos pos, SoundEvent sound, SoundSource category, float volume, float pitch, boolean useDistance) { -@@ -2047,8 +2052,19 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - public abstract RecipeAccess recipeAccess(); - - public BlockPos getBlockRandomPos(int x, int y, int z, int l) { -+ // Plazma start - Option to use better RNG -+ if (this.threadSafeRandom == null) { -+ this.randValue = (((long)(x ^ 16691) << 32 | ((z ^ 19391) & (1L << 32) - 1)) << 8 | ((this.randValue + 2319389831L) * 11 & 0xFF)); -+ long i1 = Long.reverse(randValue * randValue << 39); -+ long i2 = Long.reverse(randValue * randValue << 41); -+ long i3 = Long.reverse(randValue * randValue << 23); -+ -+ return new BlockPos(x + ((int) i1 & 15), y + ((int) i2 & l), z + ((int) i3 & 15)); -+ } -+ // Plazma end - Option to use better RNG -+ - this.randValue = this.randValue * 3 + 1013904223; -- int i1 = this.randValue >> 2; -+ int i1 = (int) (this.randValue >> 2); // Plazma - Option to use better RNG - - return new BlockPos(x + (i1 & 15), y + (i1 >> 16 & l), z + (i1 >> 8 & 15)); - } -diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index ef3dc8477b5547efa08a7fb60704f246e57fedfe..6b68ce9b5961cd298eaf2fca478cb8197f2128ee 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -@@ -22,6 +22,7 @@ public class WorldConfigurations extends ConfigurationPart { - public Miscellaneous misc; - public class Miscellaneous extends ConfigurationPart { - -+ public boolean useBetterRandomAlgorithm = false; - - } - diff --git a/patches/server/0047-Add-option-to-allow-shoot-fireball.patch b/patches/server/0047-Add-option-to-allow-shoot-fireball.patch new file mode 100644 index 0000000..87cd1ea --- /dev/null +++ b/patches/server/0047-Add-option-to-allow-shoot-fireball.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Fri, 13 Dec 2024 11:14:49 +0900 +Subject: [PATCH] Add option to allow shoot fireball + + +diff --git a/src/main/java/net/minecraft/world/item/FireChargeItem.java b/src/main/java/net/minecraft/world/item/FireChargeItem.java +index 641eb27097740219199ce61ed3e6aa5f42a51b1c..c5973b9182d25d7eb03ba3d91ec7a325cae5fa00 100644 +--- a/src/main/java/net/minecraft/world/item/FireChargeItem.java ++++ b/src/main/java/net/minecraft/world/item/FireChargeItem.java +@@ -30,6 +30,27 @@ public class FireChargeItem extends Item implements ProjectileItem { + super(settings); + } + ++ // Plazma start - Option to shoot fireballs ++ @Override ++ public InteractionResult use(Level world, Player user, net.minecraft.world.InteractionHand hand) { ++ if (!world.plazmaConfig().item.allowShootFireballs) { ++ super.use(world, user, hand); ++ return InteractionResult.PASS; ++ } ++ ++ ItemStack itemStack = user.getItemInHand(hand); ++ Vec3 vec = user.getDirection().getUnitVec3().multiply(10, 10, 10); ++ ++ SmallFireball fireball = new SmallFireball(world, user, vec); ++ fireball.setItem(itemStack); ++ fireball.shootFromRotation(user, user.getXRot(), user.getYRot(), 0.0F, 1.5F, 1.0F); ++ world.addFreshEntity(fireball); ++ ++ itemStack.shrink(1); ++ return InteractionResult.SUCCESS; ++ } ++ // Plazma end - Option to shoot fireballs ++ + @Override + public InteractionResult useOn(UseOnContext context) { + Level world = context.getLevel(); +diff --git a/src/main/java/net/minecraft/world/item/Items.java b/src/main/java/net/minecraft/world/item/Items.java +index 580bd63fdbf9555f867362d3c1f39f41fd750089..bfde7c2d386d94913bde5452b903f2f2ee7ac672 100644 +--- a/src/main/java/net/minecraft/world/item/Items.java ++++ b/src/main/java/net/minecraft/world/item/Items.java +@@ -1698,7 +1698,7 @@ public class Items { + ExperienceBottleItem::new, + new Item.Properties().rarity(Rarity.UNCOMMON).component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true) + ); +- public static final Item FIRE_CHARGE = registerItem("fire_charge", FireChargeItem::new); ++ public static final Item FIRE_CHARGE = registerItem("fire_charge", FireChargeItem::new, new Item.Properties().useCooldown(org.plazmamc.plazma.configurations.GlobalConfiguration.get().item.fireCharge.cooldown())); + public static final Item WIND_CHARGE = registerItem("wind_charge", WindChargeItem::new, new Item.Properties().useCooldown(0.5F)); + public static final Item WRITABLE_BOOK = registerItem( + "writable_book", WritableBookItem::new, new Item.Properties().stacksTo(1).component(DataComponents.WRITABLE_BOOK_CONTENT, WritableBookContent.EMPTY) +diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +index dc300e14e1bd03b4e855a360f1deda1cd7d6f7f0..2e1cf5f79556250aa22df3ade66393fe6a947659 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +@@ -146,7 +146,6 @@ public class GlobalConfiguration extends ConfigurationPart { + + } + +- + public ConsoleLogs consoleLogs; + public class ConsoleLogs extends ConfigurationPart { + +diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +index c1d4a96cf5be77f4460c54ed19622f527d42ca06..7591e21bfd90edff05639bb6a027c3fe8c1c36c3 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +@@ -86,6 +86,7 @@ public class WorldConfigurations extends ConfigurationPart { + public Item item; + public class Item extends ConfigurationPart { + ++ public boolean allowShootFireballs = false; + + } + diff --git a/patches/server/0040-Remove-Mojang-Profiler-codes.patch b/patches/server/0048-Remove-Mojang-Profiler-codes.patch similarity index 96% rename from patches/server/0040-Remove-Mojang-Profiler-codes.patch rename to patches/server/0048-Remove-Mojang-Profiler-codes.patch index 8a91ebc..6e4feca 100644 --- a/patches/server/0040-Remove-Mojang-Profiler-codes.patch +++ b/patches/server/0048-Remove-Mojang-Profiler-codes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remove Mojang Profiler codes diff --git a/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java b/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java -index 600a7036b503f60cc9c95f189f73c2dbf020e2e1..aacfd9b8d71a47a75eefa3a0f87636e58a5b6370 100644 +index bce2dac613d29083dd5fbb68739304cc5a6d4d27..aacfd9b8d71a47a75eefa3a0f87636e58a5b6370 100644 --- a/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java +++ b/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java @@ -1,206 +1,3 @@ @@ -66,7 +66,7 @@ index 600a7036b503f60cc9c95f189f73c2dbf020e2e1..aacfd9b8d71a47a75eefa3a0f87636e5 - this.started = true; - this.path = ""; - this.paths.clear(); -- //this.push("root"); // Purpur +- this.push("root"); - } - } - @@ -75,7 +75,7 @@ index 600a7036b503f60cc9c95f189f73c2dbf020e2e1..aacfd9b8d71a47a75eefa3a0f87636e5 - if (!this.started) { - LOGGER.error("Profiler tick already ended - missing startTick()?"); - } else { -- //this.pop(); // Purpur +- this.pop(); - this.started = false; - if (!this.path.isEmpty()) { - LOGGER.error( @@ -104,7 +104,7 @@ index 600a7036b503f60cc9c95f189f73c2dbf020e2e1..aacfd9b8d71a47a75eefa3a0f87636e5 - - @Override - public void push(Supplier locationGetter) { -- //this.push(locationGetter.get()); // Purpur +- this.push(locationGetter.get()); - } - - @Override @@ -143,14 +143,14 @@ index 600a7036b503f60cc9c95f189f73c2dbf020e2e1..aacfd9b8d71a47a75eefa3a0f87636e5 - - @Override - public void popPush(String location) { -- //this.pop(); // Purpur -- //this.push(location); // Purpur +- this.pop(); +- this.push(location); - } - - @Override - public void popPush(Supplier locationGetter) { -- //this.pop(); // Purpur -- //this.push(locationGetter); // Purpur +- this.pop(); +- this.push(locationGetter); - } - - private ActiveProfiler.PathEntry getCurrentEntry() { @@ -841,10 +841,10 @@ index fe8a8ee1f88c58a9fe730c4c0cc5fc4e3651e9f8..09d2768bd51e0bd8917e870387fd1877 -} +@Deprecated(forRemoval = true) interface Profiler {} // Plazma - Completely remove Mojang's Profiler diff --git a/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java b/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java -index ce81d6bd87f688a24003f2fbf6d5010ad6273917..1bce6008d63c371c666db13633902e303142127f 100644 +index bc5c8879befe849ce81becf5e3fba6757b01cb70..1bce6008d63c371c666db13633902e303142127f 100644 --- a/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java +++ b/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java -@@ -1,168 +1,3 @@ +@@ -1,151 +1,3 @@ package net.minecraft.util.profiling; -import java.util.function.Supplier; @@ -853,68 +853,51 @@ index ce81d6bd87f688a24003f2fbf6d5010ad6273917..1bce6008d63c371c666db13633902e30 -public interface ProfilerFiller { - String ROOT = "root"; - -- @io.papermc.paper.annotation.DoNotUse // Purpur - void startTick(); - -- @io.papermc.paper.annotation.DoNotUse // Purpur - void endTick(); - -- @io.papermc.paper.annotation.DoNotUse // Purpur - void push(String location); - -- @io.papermc.paper.annotation.DoNotUse // Purpur - void push(Supplier locationGetter); - -- @io.papermc.paper.annotation.DoNotUse // Purpur - void pop(); - -- @io.papermc.paper.annotation.DoNotUse // Purpur - void popPush(String location); - -- @io.papermc.paper.annotation.DoNotUse // Purpur - void popPush(Supplier locationGetter); - -- @io.papermc.paper.annotation.DoNotUse // Purpur - default void addZoneText(String label) { - } - -- @io.papermc.paper.annotation.DoNotUse // Purpur - default void addZoneValue(long value) { - } - -- @io.papermc.paper.annotation.DoNotUse // Purpur - default void setZoneColor(int color) { - } - -- @io.papermc.paper.annotation.DoNotUse // Purpur - default Zone zone(String name) { - this.push(name); - return new Zone(this); - } - -- @io.papermc.paper.annotation.DoNotUse // Purpur - default Zone zone(Supplier nameSupplier) { - this.push(nameSupplier); - return new Zone(this); - } - -- @io.papermc.paper.annotation.DoNotUse // Purpur - void markForCharting(MetricCategory type); - -- @io.papermc.paper.annotation.DoNotUse // Purpur - default void incrementCounter(String marker) { -- //this.incrementCounter(marker, 1); // Purpur +- this.incrementCounter(marker, 1); - } - -- @io.papermc.paper.annotation.DoNotUse // Purpur - void incrementCounter(String marker, int num); - -- @io.papermc.paper.annotation.DoNotUse // Purpur - default void incrementCounter(Supplier markerGetter) { -- //this.incrementCounter(markerGetter, 1); // Purpur +- this.incrementCounter(markerGetter, 1); - } - -- @io.papermc.paper.annotation.DoNotUse // Purpur - void incrementCounter(Supplier markerGetter, int num); - - static ProfilerFiller combine(ProfilerFiller first, ProfilerFiller second) { @@ -936,80 +919,80 @@ index ce81d6bd87f688a24003f2fbf6d5010ad6273917..1bce6008d63c371c666db13633902e30 - - @Override - public void startTick() { -- //this.first.startTick(); // Purpur -- //this.second.startTick(); // Purpur +- this.first.startTick(); +- this.second.startTick(); - } - - @Override - public void endTick() { -- //this.first.endTick(); // Purpur -- //this.second.endTick(); // Purpur +- this.first.endTick(); +- this.second.endTick(); - } - - @Override - public void push(String location) { -- //this.first.push(location); // Purpur -- //this.second.push(location); // Purpur +- this.first.push(location); +- this.second.push(location); - } - - @Override - public void push(Supplier locationGetter) { -- //this.first.push(locationGetter); // Purpur -- //this.second.push(locationGetter); // Purpur +- this.first.push(locationGetter); +- this.second.push(locationGetter); - } - - @Override - public void markForCharting(MetricCategory type) { -- //this.first.markForCharting(type); // Purpur -- //this.second.markForCharting(type); // Purpur +- this.first.markForCharting(type); +- this.second.markForCharting(type); - } - - @Override - public void pop() { -- //this.first.pop(); // Purpur -- //this.second.pop(); // Purpur +- this.first.pop(); +- this.second.pop(); - } - - @Override - public void popPush(String location) { -- //this.first.popPush(location); // Purpur -- //this.second.popPush(location); // Purpur +- this.first.popPush(location); +- this.second.popPush(location); - } - - @Override - public void popPush(Supplier locationGetter) { -- //this.first.popPush(locationGetter); // Purpur -- //this.second.popPush(locationGetter); // Purpur +- this.first.popPush(locationGetter); +- this.second.popPush(locationGetter); - } - - @Override - public void incrementCounter(String marker, int num) { -- //this.first.incrementCounter(marker, num); // Purpur -- //this.second.incrementCounter(marker, num); // Purpur +- this.first.incrementCounter(marker, num); +- this.second.incrementCounter(marker, num); - } - - @Override - public void incrementCounter(Supplier markerGetter, int num) { -- //this.first.incrementCounter(markerGetter, num); // Purpur -- //this.second.incrementCounter(markerGetter, num); // Purpur +- this.first.incrementCounter(markerGetter, num); +- this.second.incrementCounter(markerGetter, num); - } - - @Override - public void addZoneText(String label) { -- //this.first.addZoneText(label); // Purpur -- //this.second.addZoneText(label); // Purpur +- this.first.addZoneText(label); +- this.second.addZoneText(label); - } - - @Override - public void addZoneValue(long value) { -- //this.first.addZoneValue(value); // Purpur -- //this.second.addZoneValue(value); // Purpur +- this.first.addZoneValue(value); +- this.second.addZoneValue(value); - } - - @Override - public void setZoneColor(int color) { -- //this.first.setZoneColor(color); // Purpur -- //this.second.setZoneColor(color); // Purpur +- this.first.setZoneColor(color); +- this.second.setZoneColor(color); - } - } -} diff --git a/patches/server/0049-Completely-remove-Mojang-profiler.patch b/patches/server/0049-Completely-remove-Mojang-profiler.patch new file mode 100644 index 0000000..43d76bb --- /dev/null +++ b/patches/server/0049-Completely-remove-Mojang-profiler.patch @@ -0,0 +1,2922 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Fri, 13 Dec 2024 13:54:02 +0900 +Subject: [PATCH] Completely remove Mojang profiler + + +diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java +index 8d82425ccbc30b3f4a59767ca72bf37311ddeda0..731592a7eeb1434c8568b722314fba64b8b83050 100644 +--- a/src/main/java/net/minecraft/commands/Commands.java ++++ b/src/main/java/net/minecraft/commands/Commands.java +@@ -132,7 +132,7 @@ import net.minecraft.server.commands.WorldBorderCommand; + import net.minecraft.server.commands.data.DataCommands; + import net.minecraft.server.level.ServerPlayer; + import net.minecraft.tags.TagKey; +-import net.minecraft.util.profiling.Profiler; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler + import net.minecraft.util.profiling.jfr.JvmProfiler; + import net.minecraft.world.flag.FeatureFlagSet; + import net.minecraft.world.flag.FeatureFlags; +@@ -353,9 +353,11 @@ public class Commands { + // Paper end + CommandSourceStack commandlistenerwrapper = (CommandSourceStack) parseresults.getContext().getSource(); + ++ /* // Plazma - Completely remove Mojang profiler + Profiler.get().push(() -> { + return "/" + s; + }); ++ */ // Plazma - Completely remove Mojang profiler + ContextChain contextchain = this.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit // Paper - Add UnknownCommandEvent + + try { +@@ -384,9 +386,9 @@ public class Commands { + commandlistenerwrapper.sendFailure(Component.literal(Util.describeError(exception))); + Commands.LOGGER.error("'/{}' threw an exception", s, exception); + } +- } finally { ++ } /*finally { // Plazma - Completely remove Mojang profiler + Profiler.get().pop(); +- } ++ }*/ // Plazma - Completely remove Mojang profiler + + } + +@@ -448,7 +450,7 @@ public class Commands { + int j = minecraftserver.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_FORK_COUNT); + + try { +- ExecutionContext executioncontext1 = new ExecutionContext<>(i, j, Profiler.get()); ++ ExecutionContext executioncontext1 = new ExecutionContext<>(i, j/*, Profiler.get()*/); + + try { + Commands.CURRENT_EXECUTION_CONTEXT.set(executioncontext1); +diff --git a/src/main/java/net/minecraft/commands/execution/ExecutionContext.java b/src/main/java/net/minecraft/commands/execution/ExecutionContext.java +index f626a2f28f2aebb3237cebb6afef3c4fa1a6cb37..316fad1e5af6f9bbc1f8b8c8ff0422ded29afedd 100644 +--- a/src/main/java/net/minecraft/commands/execution/ExecutionContext.java ++++ b/src/main/java/net/minecraft/commands/execution/ExecutionContext.java +@@ -12,7 +12,7 @@ import net.minecraft.commands.ExecutionCommandSource; + import net.minecraft.commands.execution.tasks.BuildContexts; + import net.minecraft.commands.execution.tasks.CallFunction; + import net.minecraft.commands.functions.InstantiatedFunction; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import org.slf4j.Logger; + + public class ExecutionContext implements AutoCloseable { +@@ -20,7 +20,7 @@ public class ExecutionContext implements AutoCloseable { + private static final Logger LOGGER = LogUtils.getLogger(); + private final int commandLimit; + private final int forkLimit; +- private final ProfilerFiller profiler; ++ //private final ProfilerFiller profiler; // Plazma - Completely remove Mojang profiler + @Nullable + private TraceCallbacks tracer; + private int commandQuota; +@@ -29,10 +29,10 @@ public class ExecutionContext implements AutoCloseable { + private final List> newTopCommands = new ObjectArrayList<>(); + private int currentFrameDepth; + +- public ExecutionContext(int maxCommandChainLength, int maxCommandForkCount, ProfilerFiller profiler) { ++ public ExecutionContext(int maxCommandChainLength, int maxCommandForkCount/*, ProfilerFiller profiler*/) { // Plazma - Completely remove Mojang profiler + this.commandLimit = maxCommandChainLength; + this.forkLimit = maxCommandForkCount; +- this.profiler = profiler; ++ //this.profiler = profiler; // Plazma - Completely remove Mojang profiler + this.commandQuota = maxCommandChainLength; + } + +@@ -129,9 +129,11 @@ public class ExecutionContext implements AutoCloseable { + return this.tracer; + } + ++ /* // Plazma - Completely remove Mojang profiler + public ProfilerFiller profiler() { + return this.profiler; + } ++ */ // Plazma - Completely remove Mojang profiler + + public int forkLimit() { + return this.forkLimit; +diff --git a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java +index 9f5c3ec2eae9b30bdb8dbcb328d7f701cb7aeb9d..16de7288702aa7e4b0225d4eb1f3cd81289d9176 100644 +--- a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java ++++ b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java +@@ -42,52 +42,48 @@ public class BuildContexts> { + ChainModifiers chainModifiers = flags; + List list = sources; + if (contextChain.getStage() != Stage.EXECUTE) { +- context.profiler().push(() -> "prepare " + this.commandInput); ++ // Plazma start - Completely remove Mojang profiler ++ for (int i = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) { ++ CommandContext commandContext = contextChain.getTopContext(); ++ if (commandContext.isForked()) { ++ chainModifiers = chainModifiers.setForked(); ++ } + +- try { +- for (int i = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) { +- CommandContext commandContext = contextChain.getTopContext(); +- if (commandContext.isForked()) { +- chainModifiers = chainModifiers.setForked(); +- } ++ RedirectModifier redirectModifier = commandContext.getRedirectModifier(); ++ if (redirectModifier instanceof CustomModifierExecutor customModifierExecutor) { // Purpur - decompile error ++ customModifierExecutor.apply(baseSource, list, contextChain, chainModifiers, ExecutionControl.create(context, frame)); ++ return; ++ } + +- RedirectModifier redirectModifier = commandContext.getRedirectModifier(); +- if (redirectModifier instanceof CustomModifierExecutor customModifierExecutor) { // Purpur - decompile error +- customModifierExecutor.apply(baseSource, list, contextChain, chainModifiers, ExecutionControl.create(context, frame)); +- return; +- } ++ if (redirectModifier != null) { ++ context.incrementCost(); ++ boolean bl = chainModifiers.isForked(); ++ List list2 = new ObjectArrayList<>(); ++ ++ for (T executionCommandSource : list) { ++ try { ++ Collection collection = ContextChain.runModifier( ++ commandContext, executionCommandSource, (contextx, successful, returnValue) -> { ++ }, bl ++ ); ++ if (list2.size() + collection.size() >= i) { ++ baseSource.handleError(ERROR_FORK_LIMIT_REACHED.create(i), bl, context.tracer()); ++ return; ++ } + +- if (redirectModifier != null) { +- context.incrementCost(); +- boolean bl = chainModifiers.isForked(); +- List list2 = new ObjectArrayList<>(); +- +- for (T executionCommandSource : list) { +- try { +- Collection collection = ContextChain.runModifier( +- commandContext, executionCommandSource, (contextx, successful, returnValue) -> { +- }, bl +- ); +- if (list2.size() + collection.size() >= i) { +- baseSource.handleError(ERROR_FORK_LIMIT_REACHED.create(i), bl, context.tracer()); +- return; +- } +- +- list2.addAll(collection); +- } catch (CommandSyntaxException var20) { +- executionCommandSource.handleError(var20, bl, context.tracer()); +- if (!bl) { +- return; +- } ++ list2.addAll(collection); ++ } catch (CommandSyntaxException var20) { ++ executionCommandSource.handleError(var20, bl, context.tracer()); ++ if (!bl) { ++ return; + } + } +- +- list = list2; + } ++ ++ list = list2; + } +- } finally { +- context.profiler().pop(); + } ++ // Plazma end - Completely remove Mojang profiler + } + + if (list.isEmpty()) { +diff --git a/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java b/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java +index e9775b4506909bee65a74964f0d5391a0513de1d..a72bf8986d7f93dc0b3d8830c17745cfe93001be 100644 +--- a/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java ++++ b/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java +@@ -23,7 +23,7 @@ public class ExecuteCommand> implements Unbo + + @Override + public void execute(T executionCommandSource, ExecutionContext executionContext, Frame frame) { +- executionContext.profiler().push(() -> "execute " + this.commandInput); ++ //executionContext.profiler().push(() -> "execute " + this.commandInput); // Plazma - Completely remove Mojang profiler + + try { + executionContext.incrementCost(); +@@ -36,8 +36,9 @@ public class ExecuteCommand> implements Unbo + } + } catch (CommandSyntaxException var9) { + executionCommandSource.handleError(var9, this.modifiers.isForked(), executionContext.tracer()); +- } finally { ++ } /*finally { // Plazma - Completely remove Mojang profiler + executionContext.profiler().pop(); + } ++ */ // Plazma - Completely remove Mojang profiler + } + } +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index ad0e9c8f64e9ef925b3f12ac1570689c9450e21b..e63e6d885054cd926508f9999c8a4eed712d4891 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -111,19 +111,19 @@ import net.minecraft.util.datafix.DataFixers; + import net.minecraft.util.debugchart.RemoteDebugSampleType; + import net.minecraft.util.debugchart.SampleLogger; + import net.minecraft.util.debugchart.TpsDebugDimensions; +-import net.minecraft.util.profiling.EmptyProfileResults; +-import net.minecraft.util.profiling.ProfileResults; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; +-import net.minecraft.util.profiling.ResultField; +-import net.minecraft.util.profiling.SingleTickProfiler; ++//import net.minecraft.util.profiling.EmptyProfileResults; // Plazma - Completely remove Mojang profilers ++//import net.minecraft.util.profiling.ProfileResults; // Plazma - Completely remove Mojang profilers ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profilers ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profilers ++//import net.minecraft.util.profiling.ResultField; // Plazma - Completely remove Mojang profilers ++//import net.minecraft.util.profiling.SingleTickProfiler; // Plazma - Completely remove Mojang profilers + import net.minecraft.util.profiling.jfr.JvmProfiler; + import net.minecraft.util.profiling.jfr.callback.ProfiledDuration; +-import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder; +-import net.minecraft.util.profiling.metrics.profiling.InactiveMetricsRecorder; +-import net.minecraft.util.profiling.metrics.profiling.MetricsRecorder; +-import net.minecraft.util.profiling.metrics.profiling.ServerMetricsSamplersProvider; +-import net.minecraft.util.profiling.metrics.storage.MetricsPersister; ++//import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder; // Plazma - Completely remove Mojang profilers ++//import net.minecraft.util.profiling.metrics.profiling.InactiveMetricsRecorder; // Plazma - Completely remove Mojang profilers ++//import net.minecraft.util.profiling.metrics.profiling.MetricsRecorder; // Plazma - Completely remove Mojang profilers ++//import net.minecraft.util.profiling.metrics.profiling.ServerMetricsSamplersProvider; // Plazma - Completely remove Mojang profilers ++//import net.minecraft.util.profiling.metrics.storage.MetricsPersister; // Plazma - Completely remove Mojang profilers + import net.minecraft.util.thread.ReentrantBlockableEventLoop; + import net.minecraft.world.Difficulty; + import net.minecraft.world.RandomSequences; +@@ -229,13 +229,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop tickables = Lists.newArrayList(); +- private MetricsRecorder metricsRecorder; +- private Consumer onMetricsRecordingStopped; +- private Consumer onMetricsRecordingFinished; +- private boolean willStartRecordingMetrics; +- @Nullable +- private MinecraftServer.TimeProfiler debugCommandProfiler; +- private boolean debugCommandProfilerDelayStart; ++ //private MetricsRecorder metricsRecorder; // Plazma - Completely remove Mojang profilers ++ //private Consumer onMetricsRecordingStopped; // Plazma - Completely remove Mojang profilers ++ //private Consumer onMetricsRecordingFinished; // Plazma - Completely remove Mojang profilers ++ //private boolean willStartRecordingMetrics; // Plazma - Completely remove Mojang profilers ++ //@Nullable // Plazma - Completely remove Mojang profilers ++ //private MinecraftServer.TimeProfiler debugCommandProfiler; // Plazma - Completely remove Mojang profilers ++ //private boolean debugCommandProfilerDelayStart; // Plazma - Completely remove Mojang profilers + private ServerConnectionListener connection; + public final ChunkProgressListenerFactory progressListenerFactory; + @Nullable +@@ -434,12 +434,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { + this.stopRecordingMetrics(); + }; ++ */ // Plazma - Completely remove Mojang profilers ++ /* // Plazma - Completely remove Mojang profilers + this.onMetricsRecordingFinished = (path) -> { + }; ++ */ // Plazma - Completely remove Mojang profilers + this.random = RandomSource.create(); + this.port = -1; + this.levels = Maps.newLinkedHashMap(); +@@ -1054,9 +1058,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { + return false; +@@ -1380,7 +1388,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % autosavePeriod == 0; + try { + this.isSaving = true; +@@ -1741,10 +1755,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { + entityplayer.connection.suspendFlushing(); +@@ -1868,9 +1882,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Purpur + ++ /* // Plazma - Completely remove Mojang profilers + gameprofilerfiller.push(() -> { + String s = String.valueOf(worldserver); + + return s + " " + String.valueOf(worldserver.dimension().location()); + }); ++ */ // Plazma - Completely remove Mojang profilers + /* Drop global time updates + if (this.tickCount % 20 == 0) { + gameprofilerfiller.push("timeSync"); +@@ -1922,7 +1938,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop prepared, ResourceManager manager, ProfilerFiller profiler) { ++ protected void apply(Map prepared, ResourceManager manager/*, ProfilerFiller profiler*/) { // Plazma - Completely remove Mojang profiler + Builder builder = ImmutableMap.builder(); + + prepared.forEach((minecraftkey, advancement) -> { +diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java +index 0b348f701b61c7b7ed0190eff8b2d73f3a3d5c74..c7f64b3aed44591d282760785ee9c83b93bd6e32 100644 +--- a/src/main/java/net/minecraft/server/ServerFunctionManager.java ++++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java +@@ -16,8 +16,8 @@ import net.minecraft.commands.functions.CommandFunction; + import net.minecraft.commands.functions.InstantiatedFunction; + import net.minecraft.nbt.CompoundTag; + import net.minecraft.resources.ResourceLocation; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import org.slf4j.Logger; + + public class ServerFunctionManager { +@@ -54,10 +54,10 @@ public class ServerFunctionManager { + } + + private void executeTagFunctions(Collection> functions, ResourceLocation label) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + + Objects.requireNonNull(label); +- gameprofilerfiller.push(label::toString); ++ //gameprofilerfiller.push(label::toString); // Plazma - Completely remove Mojang profiler + Iterator iterator = functions.iterator(); + + while (iterator.hasNext()) { +@@ -66,15 +66,17 @@ public class ServerFunctionManager { + this.execute(commandfunction, this.getGameLoopSender()); + } + +- Profiler.get().pop(); ++ //Profiler.get().pop(); // Plazma - Completely remove Mojang profiler + } + + public void execute(CommandFunction function, CommandSourceStack source) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + ++ /* // Plazma - Completely remove Mojang profiler + gameprofilerfiller.push(() -> { + return "function " + String.valueOf(function.id()); + }); ++ */ // Plazma - Completely remove Mojang profiler + + try { + InstantiatedFunction instantiatedfunction = function.instantiate((CompoundTag) null, this.getDispatcher()); +@@ -86,9 +88,9 @@ public class ServerFunctionManager { + ; + } catch (Exception exception) { + ServerFunctionManager.LOGGER.warn("Failed to execute function {}", function.id(), exception); +- } finally { ++ } /*finally { // Plazma - Completely remove Mojang profiler + gameprofilerfiller.pop(); +- } ++ }*/ // Plazma - Completely remove Mojang profiler + + } + +diff --git a/src/main/java/net/minecraft/server/commands/DebugCommand.java b/src/main/java/net/minecraft/server/commands/DebugCommand.java +index f8cdd6911fe9d6402455b7368d0e98c25e9511ca..23927255476bb9776c54139d11a386cb69489bc5 100644 +--- a/src/main/java/net/minecraft/server/commands/DebugCommand.java ++++ b/src/main/java/net/minecraft/server/commands/DebugCommand.java +@@ -35,8 +35,9 @@ import net.minecraft.network.chat.Component; + import net.minecraft.resources.ResourceLocation; + import net.minecraft.server.MinecraftServer; + import net.minecraft.util.TimeUtil; +-import net.minecraft.util.profiling.ProfileResults; ++//import net.minecraft.util.profiling.ProfileResults; // Plazma - Completely remove Mojang profiler + import org.apache.commons.io.IOUtils; ++import org.bukkit.command.CommandSender; + import org.slf4j.Logger; + + public class DebugCommand { +@@ -52,8 +53,8 @@ public class DebugCommand { + dispatcher.register( + Commands.literal("debug") + .requires(source -> source.hasPermission(3)) +- .then(Commands.literal("start").executes(context -> start(context.getSource()))) +- .then(Commands.literal("stop").executes(context -> stop(context.getSource()))) ++ //.then(Commands.literal("start").executes(context -> start(context.getSource()))) // Plazma - Completely remove Mojang profiler ++ //.then(Commands.literal("stop").executes(context -> stop(context.getSource()))) // Plazma - Completely remove Mojang profiler + .then( + Commands.literal("function") + .requires(source -> source.hasPermission(3)) +@@ -66,6 +67,7 @@ public class DebugCommand { + ); + } + ++ /* // Plazma - Completely remove Mojang profiler + private static int start(CommandSourceStack source) throws CommandSyntaxException { + MinecraftServer minecraftServer = source.getServer(); + if (minecraftServer.isTimeProfilerRunning()) { +@@ -97,6 +99,7 @@ public class DebugCommand { + return (int)e; + } + } ++ */ // Plazma - Completely remove Mojang profiler + + static class TraceCustomExecutor + extends CustomCommandExecutor.WithErrorHandling +diff --git a/src/main/java/net/minecraft/server/commands/PerfCommand.java b/src/main/java/net/minecraft/server/commands/PerfCommand.java +index 8c587f829c5e8c6b6df3150024c4ae704988c47b..818c6730aeed88438cd77289a8aa5c5726a1fe0f 100644 +--- a/src/main/java/net/minecraft/server/commands/PerfCommand.java ++++ b/src/main/java/net/minecraft/server/commands/PerfCommand.java +@@ -19,9 +19,9 @@ import net.minecraft.network.chat.Component; + import net.minecraft.server.MinecraftServer; + import net.minecraft.util.FileZipper; + import net.minecraft.util.TimeUtil; +-import net.minecraft.util.profiling.EmptyProfileResults; +-import net.minecraft.util.profiling.ProfileResults; +-import net.minecraft.util.profiling.metrics.storage.MetricsPersister; ++//import net.minecraft.util.profiling.EmptyProfileResults; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfileResults; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.metrics.storage.MetricsPersister; // Plazma - Completely remove Mojang profiler + import org.apache.commons.io.FileUtils; + import org.slf4j.Logger; + +@@ -36,11 +36,12 @@ public class PerfCommand { + dispatcher.register( + Commands.literal("perf") + .requires(source -> source.hasPermission(4)) +- .then(Commands.literal("start").executes(context -> startProfilingDedicatedServer(context.getSource()))) +- .then(Commands.literal("stop").executes(context -> stopProfilingDedicatedServer(context.getSource()))) ++ //.then(Commands.literal("start").executes(context -> startProfilingDedicatedServer(context.getSource()))) // Plazma - Completely remove Mojang profiler ++ //.then(Commands.literal("stop").executes(context -> stopProfilingDedicatedServer(context.getSource()))) // Plazma - Completely remove Mojang profiler + ); + } + ++ /* // Plazma - Completely remove Mojang profiler + private static int startProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException { + MinecraftServer minecraftServer = source.getServer(); + if (minecraftServer.isRecordingMetrics()) { +@@ -104,4 +105,5 @@ public class PerfCommand { + ); + } + } ++ */ // Plazma - Completely remove Mojang profiler + } +diff --git a/src/main/java/net/minecraft/server/level/ChunkGenerationTask.java b/src/main/java/net/minecraft/server/level/ChunkGenerationTask.java +index 7ea8c13c9993576c1408e710d3ceb9947b09090d..6db0eb0c3f7190840c39bd5ca1027f60c40948f4 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkGenerationTask.java ++++ b/src/main/java/net/minecraft/server/level/ChunkGenerationTask.java +@@ -5,8 +5,8 @@ import java.util.List; + import java.util.concurrent.CompletableFuture; + import javax.annotation.Nullable; + import net.minecraft.util.StaticCache2D; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.Zone; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.Zone; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.level.ChunkPos; + import net.minecraft.world.level.chunk.ChunkAccess; + import net.minecraft.world.level.chunk.status.ChunkDependencies; +@@ -67,7 +67,7 @@ public class ChunkGenerationTask { + chunkStatus = ChunkStatus.getStatusList().get(this.scheduledStatus.getIndex() + 1); + } + +- this.scheduleLayer(chunkStatus, this.needsGeneration); ++ //this.scheduleLayer(chunkStatus, this.needsGeneration); // Plazma - Completely remove Mojang profiler + this.scheduledStatus = chunkStatus; + } + +@@ -112,6 +112,7 @@ public class ChunkGenerationTask { + return this.cache.get(this.pos.x, this.pos.z); + } + ++ /* // Plazma - Completely remove Mojang profiler + private void scheduleLayer(ChunkStatus targetStatus, boolean allowGeneration) { + try (Zone zone = Profiler.get().zone("scheduleLayer")) { + zone.addText(targetStatus::getName); +@@ -127,6 +128,7 @@ public class ChunkGenerationTask { + } + } + } ++ */ // Plazma - Completely remove Mojang profiler + + private int getRadiusForLayer(ChunkStatus status, boolean generate) { + ChunkPyramid chunkPyramid = generate ? ChunkPyramid.GENERATION_PYRAMID : ChunkPyramid.LOADING_PYRAMID; +diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java +index cfeeddf2cb4ff50dbc29c6913e78ca1dee076790..af7d150e77001c514e306b4fb1369aae0569d494 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +@@ -65,8 +65,8 @@ import net.minecraft.server.network.ServerPlayerConnection; + import net.minecraft.util.CsvOutput; + import net.minecraft.util.Mth; + import net.minecraft.util.StaticCache2D; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; ++//import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.util.thread.BlockableEventLoop; + import net.minecraft.util.thread.ConsecutiveExecutor; + import net.minecraft.world.entity.Entity; +@@ -406,16 +406,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + } + + protected void tick(BooleanSupplier shouldKeepTicking) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("poi"); ++ //gameprofilerfiller.push("poi"); // Plazma - Completely remove Mojang profiler + this.poiManager.tick(shouldKeepTicking); +- gameprofilerfiller.popPush("chunk_unload"); ++ //gameprofilerfiller.popPush("chunk_unload"); // Plazma - Completely remove Mojang profiler + if (!this.level.noSave()) { + this.processUnloads(shouldKeepTicking); + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + + public boolean hasWork() { +diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +index 1cb8c9d21eef27492efc4995525c198cbffd4b9b..e1957ad2a804f1272ccd458560bd7bde4ed0fe53 100644 +--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java ++++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +@@ -26,8 +26,8 @@ import net.minecraft.network.protocol.Packet; + import net.minecraft.server.MinecraftServer; + import net.minecraft.server.level.progress.ChunkProgressListener; + import net.minecraft.util.VisibleForDebug; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.util.thread.BlockableEventLoop; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.ai.village.poi.PoiManager; +@@ -442,38 +442,38 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + // CraftBukkit start - modelled on below + public void purgeUnload() { + if (true) return; // Paper - rewrite chunk system +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("purge"); ++ //gameprofilerfiller.push("purge"); // Plazma - Completely remove Mojang profiler + this.distanceManager.purgeStaleTickets(); + this.runDistanceManagerUpdates(); +- gameprofilerfiller.popPush("unload"); ++ //gameprofilerfiller.popPush("unload"); // Plazma - Completely remove Mojang profiler + this.chunkMap.tick(() -> true); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + this.clearCache(); + } + // CraftBukkit end + + @Override + public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("purge"); ++ //gameprofilerfiller.push("purge"); // Plazma - Completely remove Mojang profiler + if (this.level.tickRateManager().runsNormally() || !tickChunks || this.level.spigotConfig.unloadFrozenChunks) { // Spigot + this.distanceManager.purgeStaleTickets(); + } + + this.runDistanceManagerUpdates(); +- gameprofilerfiller.popPush("chunks"); ++ //gameprofilerfiller.popPush("chunks"); // Plazma - Completely remove Mojang profiler + if (tickChunks) { + ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getPlayerChunkLoader().tick(); // Paper - rewrite chunk system + this.tickChunks(); + this.chunkMap.tick(); + } + +- gameprofilerfiller.popPush("unload"); ++ //gameprofilerfiller.popPush("unload"); // Plazma - Completely remove Mojang profiler + this.chunkMap.tick(shouldKeepTicking); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + this.clearCache(); + } + +@@ -483,29 +483,29 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + + this.lastInhabitedUpdate = i; + if (!this.level.isDebug()) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("pollingChunks"); ++ //gameprofilerfiller.push("pollingChunks"); // Plazma - Completely remove Mojang profiler + if (this.level.tickRateManager().runsNormally()) { + List list = this.tickingChunks; + + try { +- gameprofilerfiller.push("filteringTickingChunks"); ++ //gameprofilerfiller.push("filteringTickingChunks"); // Plazma - Completely remove Mojang profiler + this.collectTickingChunks(list); +- gameprofilerfiller.popPush("shuffleChunks"); ++ //gameprofilerfiller.popPush("shuffleChunks"); // Plazma - Completely remove Mojang profiler + // Paper start - chunk tick iteration optimisation + this.shuffleRandom.setSeed(this.level.random.nextLong()); + if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled + // Paper end - chunk tick iteration optimisation +- this.tickChunks(gameprofilerfiller, j, list); +- gameprofilerfiller.pop(); ++ this.tickChunks(/*gameprofilerfiller,*/ j, list); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } finally { + list.clear(); + } + } + +- this.broadcastChangedChunks(gameprofilerfiller); +- gameprofilerfiller.pop(); ++ this.broadcastChangedChunks(/*gameprofilerfiller*/); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + + // Pufferfish start - optimize mob spawning +@@ -546,8 +546,8 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + // Pufferfish end + } + +- private void broadcastChangedChunks(ProfilerFiller profiler) { +- profiler.push("broadcast"); ++ private void broadcastChangedChunks(/*ProfilerFiller profiler*/) { // Plazma - Completely remove Mojang profiler ++ //profiler.push("broadcast"); // Plazma - Completely remove Mojang profiler + Iterator iterator = this.chunkHoldersToBroadcast.iterator(); + + while (iterator.hasNext()) { +@@ -560,7 +560,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + } + + this.chunkHoldersToBroadcast.clear(); +- profiler.pop(); ++ //profiler.pop(); // Plazma - Completely remove Mojang profiler + } + + private void collectTickingChunks(List chunks) { +@@ -586,8 +586,8 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + // Paper end - chunk tick iteration optimisation + } + +- private void tickChunks(ProfilerFiller profiler, long timeDelta, List chunks) { +- profiler.popPush("naturalSpawnCount"); ++ private void tickChunks(/*ProfilerFiller profiler,*/ long timeDelta, List chunks) { // Plazma - Completely remove Mojang profiler ++ //profiler.popPush("naturalSpawnCount"); // Plazma - Completely remove Mojang profiler + int j = this.distanceManager.getNaturalSpawnChunkCount(); + // Paper start - Optional per player mob spawns + final int naturalSpawnChunkCount = j; +@@ -619,7 +619,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + // Paper end - Optional per player mob spawns + + // this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously +- profiler.popPush("spawnAndTick"); ++ //profiler.popPush("spawnAndTick"); // Plazma - Completely remove Mojang profiler + boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit + int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); + List list1; +@@ -656,7 +656,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + } + } + +- profiler.popPush("customSpawners"); ++ //profiler.popPush("customSpawners"); // Plazma - Completely remove Mojang profiler + if (flag) { + this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); + } +@@ -854,7 +854,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + + @Override + protected void doRunTask(Runnable task) { +- Profiler.get().incrementCounter("runTask"); ++ //Profiler.get().incrementCounter("runTask"); // Plazma - Completely remove Mojang profiler + super.doRunTask(task); + } + +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index 20d9cd87fcbdd666231746ca1b364cde7016b5d6..14188b6e317dca2bbf98896951605f2e3742506f 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -79,8 +79,8 @@ import net.minecraft.util.ProgressListener; + import net.minecraft.util.RandomSource; + import net.minecraft.util.Unit; + import net.minecraft.util.datafix.DataFixTypes; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.util.valueproviders.IntProvider; + import net.minecraft.util.valueproviders.UniformInt; + import net.minecraft.world.DifficultyInstance; +@@ -748,18 +748,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + + public void tick(BooleanSupplier shouldKeepTicking) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + + this.handlingTick = true; + TickRateManager tickratemanager = this.tickRateManager(); + boolean flag = tickratemanager.runsNormally(); + + if (flag) { +- gameprofilerfiller.push("world border"); ++ //gameprofilerfiller.push("world border"); // Plazma - Completely remove Mojang profiler + this.getWorldBorder().tick(); +- gameprofilerfiller.popPush("weather"); ++ //gameprofilerfiller.popPush("weather"); // Plazma - Completely remove Mojang profiler + this.advanceWeatherCycle(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + + int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); +@@ -790,30 +790,30 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + this.tickTime(); + } + +- gameprofilerfiller.push("tickPending"); ++ //gameprofilerfiller.push("tickPending"); // Plazma - Completely remove Mojang profiler + if (!this.isDebug() && flag) { + j = this.getGameTime(); +- gameprofilerfiller.push("blockTicks"); ++ //gameprofilerfiller.push("blockTicks"); // Plazma - Completely remove Mojang profiler + this.blockTicks.tick(j, paperConfig().environment.maxBlockTicks, this::tickBlock); // Paper - configurable max block ticks +- gameprofilerfiller.popPush("fluidTicks"); ++ //gameprofilerfiller.popPush("fluidTicks"); // Plazma - Completely remove Mojang profiler + this.fluidTicks.tick(j, paperConfig().environment.maxFluidTicks, this::tickFluid); // Paper - configurable max fluid ticks +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + +- gameprofilerfiller.popPush("raid"); ++ //gameprofilerfiller.popPush("raid"); // Plazma - Completely remove Mojang profiler + if (flag) { + this.raids.tick(); + } + +- gameprofilerfiller.popPush("chunkSource"); ++ //gameprofilerfiller.popPush("chunkSource"); // Plazma - Completely remove Mojang profiler + this.getChunkSource().tick(shouldKeepTicking, true); +- gameprofilerfiller.popPush("blockEvents"); ++ //gameprofilerfiller.popPush("blockEvents"); // Plazma - Completely remove Mojang profiler + if (flag) { + this.runBlockEvents(); + } + + this.handlingTick = false; +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + boolean flag1 = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this + + if (flag1) { +@@ -821,11 +821,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + + if (flag1 || this.emptyTime++ < 300) { +- gameprofilerfiller.push("entities"); ++ //gameprofilerfiller.push("entities"); // Plazma - Completely remove Mojang profiler + if (this.dragonFight != null && flag) { +- gameprofilerfiller.push("dragonFight"); ++ //gameprofilerfiller.push("dragonFight"); // Plazma - Completely remove Mojang profiler + this.dragonFight.tick(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + + org.spigotmc.ActivationRange.activateEntities(this); // Spigot +@@ -833,9 +833,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + entity.activatedPriorityReset = false; // Pufferfish - DAB + if (!entity.isRemoved()) { + if (!tickratemanager.isEntityFrozen(entity)) { +- gameprofilerfiller.push("checkDespawn"); ++ //gameprofilerfiller.push("checkDespawn"); // Plazma - Completely remove Mojang profiler + entity.checkDespawn(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + if (true) { // Paper - rewrite chunk system + Entity entity1 = entity.getVehicle(); + +@@ -847,7 +847,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + entity.stopRiding(); + } + +- gameprofilerfiller.push("tick"); ++ //gameprofilerfiller.push("tick"); // Plazma - Completely remove Mojang profiler + // Pufferfish start - copied from this.guardEntityTick + try { + this.tickNonPassenger(entity); // Pufferfish - changed +@@ -862,18 +862,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + this.moonrise$midTickTasks(); // Paper - rewrite chunk system + // Pufferfish end +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + } + } + }); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + this.tickBlockEntities(); + } + +- gameprofilerfiller.push("entityManagement"); ++ //gameprofilerfiller.push("entityManagement"); // Plazma - Completely remove Mojang profiler + // Paper - rewrite chunk system +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + + @Override +@@ -889,9 +889,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + long i = this.levelData.getGameTime() + 1L; + + this.serverLevelData.setGameTime(i); +- Profiler.get().push("scheduledFunctions"); ++ //Profiler.get().push("scheduledFunctions"); // Plazma - Completely remove Mojang profiler + this.serverLevelData.getScheduledEvents().tick(this.server, i); +- Profiler.get().pop(); ++ //Profiler.get().pop(); // Plazma - Completely remove Mojang profiler + if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { + // Purpur start + int incrementTicks = isDay() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks; +@@ -1000,9 +1000,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + boolean flag = this.isRaining(); + int j = chunkcoordintpair.getMinBlockX(); + int k = chunkcoordintpair.getMinBlockZ(); +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("thunder"); ++ //gameprofilerfiller.push("thunder"); // Plazma - Completely remove Mojang profiler + if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && /*simpleRandom.nextInt(this.spigotConfig.thunderChance) == 0*/ chunk.shouldDoLightning(this.simpleRandom)) { // Spigot // Paper - Option to disable thunder // Paper - optimise random ticking // Pufferfish - replace random with shouldDoLightning + BlockPos blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15)); + +@@ -1039,7 +1039,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + } + +- gameprofilerfiller.popPush("iceandsnow"); ++ //gameprofilerfiller.popPush("iceandsnow"); // Plazma - Completely remove Mojang profiler + + if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow + for (int l = 0; l < randomTickSpeed; ++l) { +@@ -1049,12 +1049,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + } // Paper - Option to disable ice and snow + +- gameprofilerfiller.popPush("tickBlocks"); ++ //gameprofilerfiller.popPush("tickBlocks"); // Plazma - Completely remove Mojang profiler + if (randomTickSpeed > 0) { + this.optimiseRandomTick(chunk, randomTickSpeed); // Paper - optimise random ticking + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + + @VisibleForTesting +@@ -1386,19 +1386,21 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + }*/ // Paper - comment out EAR 2 + // Spigot end + entity.setOldPosAndRot(); +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + + ++entity.tickCount; ++ /* // Plazma - Completely remove Mojang profiler + gameprofilerfiller.push(() -> { + return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); + }); +- gameprofilerfiller.incrementCounter("tickNonPassenger"); ++ */ // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.incrementCounter("tickNonPassenger"); // Plazma - Completely remove Mojang profiler + final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity); // Paper - EAR 2 + if (isActive) { // Paper - EAR 2 + entity.tick(); + entity.postTick(); // CraftBukkit + } else { entity.inactiveTick(); } // Paper - EAR 2 +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + Iterator iterator = entity.getPassengers().iterator(); + + while (iterator.hasNext()) { +@@ -1421,12 +1423,14 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + if (passenger instanceof Player || this.entityTickList.contains(passenger)) { + passenger.setOldPosAndRot(); + ++passenger.tickCount; +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + ++ /* // Plazma - Completely remove Mojang profiler + gameprofilerfiller.push(() -> { + return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString(); + }); +- gameprofilerfiller.incrementCounter("tickPassenger"); ++ */ // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.incrementCounter("tickPassenger"); + // Paper start - EAR 2 + if (isActive) { + passenger.rideTick(); +@@ -1438,7 +1442,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + vehicle.positionRider(passenger); + } + // Paper end - EAR 2 +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); + Iterator iterator = passenger.getPassengers().iterator(); + + while (iterator.hasNext()) { +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java +index 94ab672f4576a77a609093eab76b1c5e2abddde2..755f9e3e00a38b276be3d6d757c411eaf27e385f 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +@@ -102,8 +102,8 @@ import net.minecraft.tags.FluidTags; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; + import net.minecraft.util.Unit; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.damagesource.DamageTypes; + import net.minecraft.world.effect.MobEffectInstance; +@@ -1673,15 +1673,15 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple + this.unsetRemoved(); + */ + // CraftBukkit end +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("moving"); ++ //gameprofilerfiller.push("moving"); // Plazma - Completely remove Mojang profiler + if (worldserver != null && resourcekey == LevelStem.OVERWORLD && worldserver.getTypeKey() == LevelStem.NETHER) { // CraftBukkit - empty to fall through to null to event + this.enteredNetherPosition = this.position(); + } + +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("placing"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("placing"); // Plazma - Completely remove Mojang profiler + // CraftBukkit start + this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds + LevelData worlddata = worldserver.getLevelData(); +@@ -1699,7 +1699,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple + this.connection.internalTeleport(PositionMoveRotation.of(teleportTarget), teleportTarget.relatives()); // CraftBukkit - use internal teleport without event + this.connection.resetPosition(); + worldserver.addDuringTeleport(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove mojang profiler + this.triggerDimensionChangeTriggers(worldserver1); + this.stopUsingItem(); + this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities())); +diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +index a71c220ea1c464c193029adb1a0d3e5c237442af..f034a030e9402a4ea03028dfbba931b08e5687ae 100644 +--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +@@ -30,7 +30,7 @@ import net.minecraft.server.MinecraftServer; + import net.minecraft.server.level.ClientInformation; + import net.minecraft.server.level.ServerPlayer; + import net.minecraft.util.VisibleForDebug; +-import net.minecraft.util.profiling.Profiler; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler + import net.minecraft.util.thread.BlockableEventLoop; + import org.slf4j.Logger; + +@@ -275,7 +275,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + } + + protected void keepConnectionAlive() { +- Profiler.get().push("keepAlive"); ++ //Profiler.get().push("keepAlive"); // Plazma - Completely remove Mojang profiler + // Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings + // This should effectively place the keepalive handling back to "as it was" before 1.12.2 + long currentTime = Util.getMillis(); +@@ -308,7 +308,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + } + // Paper end - give clients a longer time to respond to pings as per pre 1.12.2 timings + +- Profiler.get().pop(); ++ //Profiler.get().pop(); // Plazma - Completely remove Mojang profiler + } + + private boolean checkIfClosed(long time) { +diff --git a/src/main/java/net/minecraft/server/packs/resources/ProfiledReloadInstance.java b/src/main/java/net/minecraft/server/packs/resources/ProfiledReloadInstance.java +index 5a2b07340c63577f6d32c0658ce5f9b616c82f91..9245d2010c8d0579fe58f7eab4acd7ed1891d8dc 100644 +--- a/src/main/java/net/minecraft/server/packs/resources/ProfiledReloadInstance.java ++++ b/src/main/java/net/minecraft/server/packs/resources/ProfiledReloadInstance.java +@@ -9,8 +9,8 @@ import java.util.concurrent.TimeUnit; + import java.util.concurrent.atomic.AtomicLong; + import net.minecraft.Util; + import net.minecraft.util.Unit; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import org.slf4j.Logger; + + public class ProfiledReloadInstance extends SimpleReloadInstance { +@@ -51,12 +51,12 @@ public class ProfiledReloadInstance extends SimpleReloadInstance executor.execute(() -> { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push(string); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler ++ //profilerFiller.push(string); // Plazma - Completely remove Mojang profiler + long l = Util.getNanos(); + runnable.run(); + atomicLong.addAndGet(Util.getNanos() - l); +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler + }); + } + +diff --git a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java +index d2d82e4f22bfeac8881b6815e4bef56c254fded9..3e307274084df5304e801acdde2ae3b8f75ce8d6 100644 +--- a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java ++++ b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java +@@ -3,8 +3,8 @@ package net.minecraft.server.packs.resources; + import java.util.concurrent.CompletableFuture; + import java.util.concurrent.Executor; + import net.minecraft.util.Unit; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + + public interface ResourceManagerReloadListener extends PreparableReloadListener { + @Override +@@ -12,10 +12,10 @@ public interface ResourceManagerReloadListener extends PreparableReloadListener + PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor + ) { + return synchronizer.wait(Unit.INSTANCE).thenRunAsync(() -> { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("listener"); ++ //ProfilerFiller profilerFiller = Profiler.get(); ++ //profilerFiller.push("listener"); + this.onResourceManagerReload(manager); +- profilerFiller.pop(); ++ //profilerFiller.pop(); + }, applyExecutor); + } + +diff --git a/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java +index eb54f0cc67ca25e0ff6e423bcbcebab294bd5d95..c907e7a244f3eaeb264846f477ada086eb29994c 100644 +--- a/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java ++++ b/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java +@@ -15,7 +15,7 @@ import java.util.Map.Entry; + import net.minecraft.core.HolderLookup; + import net.minecraft.resources.FileToIdConverter; + import net.minecraft.resources.ResourceLocation; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import org.slf4j.Logger; + + public abstract class SimpleJsonResourceReloadListener extends SimplePreparableReloadListener> { +@@ -39,7 +39,7 @@ public abstract class SimpleJsonResourceReloadListener extends SimplePreparab + } + + @Override +- protected Map prepare(ResourceManager resourceManager, ProfilerFiller profilerFiller) { ++ protected Map prepare(ResourceManager resourceManager/*, ProfilerFiller profilerFiller*/) { // Plazma - Completely remove Mojang profiler + Map map = new HashMap<>(); + scanDirectory(resourceManager, this.directory, this.ops, this.codec, map); + return map; +diff --git a/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java +index 0aaab6a2a10bf012c9d275f7cee2095c8fbb8809..524417d6726249a06371918155a94add2d421b98 100644 +--- a/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java ++++ b/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java +@@ -2,20 +2,20 @@ package net.minecraft.server.packs.resources; + + import java.util.concurrent.CompletableFuture; + import java.util.concurrent.Executor; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + + public abstract class SimplePreparableReloadListener implements PreparableReloadListener { + @Override + public final CompletableFuture reload( + PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor + ) { +- return CompletableFuture.supplyAsync(() -> this.prepare(manager, Profiler.get()), prepareExecutor) ++ return CompletableFuture.supplyAsync(() -> this.prepare(manager/*, Profiler.get()*/), prepareExecutor) // Plazma - Completely remove Mojang profiler + .thenCompose(synchronizer::wait) +- .thenAcceptAsync(prepared -> this.apply((T)prepared, manager, Profiler.get()), applyExecutor); ++ .thenAcceptAsync(prepared -> this.apply((T)prepared, manager/*, Profiler.get()*/), applyExecutor); // Plazma - Completely remove Mojang profiler + } + +- protected abstract T prepare(ResourceManager manager, ProfilerFiller profiler); ++ protected abstract T prepare(ResourceManager manager/*, ProfilerFiller profiler*/); // Plazma - Completely remove Mojang profiler + +- protected abstract void apply(T prepared, ResourceManager manager, ProfilerFiller profiler); ++ protected abstract void apply(T prepared, ResourceManager manager/*, ProfilerFiller profiler*/); // Plazma - Completely remove Mojang profiler + } +diff --git a/src/main/java/net/minecraft/util/thread/AbstractConsecutiveExecutor.java b/src/main/java/net/minecraft/util/thread/AbstractConsecutiveExecutor.java +index 805532c7acc4ad81b83e305d669f5cee0e7597e9..f37e42621b50d183c17efdda14211736fc7968c9 100644 +--- a/src/main/java/net/minecraft/util/thread/AbstractConsecutiveExecutor.java ++++ b/src/main/java/net/minecraft/util/thread/AbstractConsecutiveExecutor.java +@@ -7,13 +7,13 @@ import java.util.concurrent.Executor; + import java.util.concurrent.RejectedExecutionException; + import java.util.concurrent.atomic.AtomicReference; + import net.minecraft.Util; +-import net.minecraft.util.profiling.metrics.MetricCategory; +-import net.minecraft.util.profiling.metrics.MetricSampler; +-import net.minecraft.util.profiling.metrics.MetricsRegistry; +-import net.minecraft.util.profiling.metrics.ProfilerMeasured; ++//import net.minecraft.util.profiling.metrics.MetricCategory; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.metrics.MetricSampler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.metrics.MetricsRegistry; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.metrics.ProfilerMeasured; // Plazma - Completely remove Mojang profiler + import org.slf4j.Logger; + +-public abstract class AbstractConsecutiveExecutor implements ProfilerMeasured, TaskScheduler, Runnable { ++public abstract class AbstractConsecutiveExecutor implements /*ProfilerMeasured,*/ TaskScheduler, Runnable { // Plazma - Completely remove Mojang profiler + private static final Logger LOGGER = LogUtils.getLogger(); + private final AtomicReference status = new AtomicReference<>(AbstractConsecutiveExecutor.Status.SLEEPING); + private final StrictQueue queue; +@@ -24,7 +24,7 @@ public abstract class AbstractConsecutiveExecutor implements + this.executor = executor; + this.queue = queue; + this.name = name; +- MetricsRegistry.INSTANCE.add(this); ++ //MetricsRegistry.INSTANCE.add(this); // Plazma - Completely remove Mojang profiler + } + + private boolean canBeScheduled() { +@@ -108,10 +108,12 @@ public abstract class AbstractConsecutiveExecutor implements + return this.name; + } + ++ /* // Plazma - Completely remove Mojang profiler + @Override + public List profiledMetrics() { + return ImmutableList.of(MetricSampler.create(this.name + "-queue-size", MetricCategory.CONSECUTIVE_EXECUTORS, this::size)); + } ++ */ // Plazma - Completely remove Mojang profiler + + private boolean setRunning() { + return this.status.compareAndSet(AbstractConsecutiveExecutor.Status.SLEEPING, AbstractConsecutiveExecutor.Status.RUNNING); +diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java +index 9b706276dc5b5f55b966c5472c6c4e864342b916..d8efe335be1808422abef6d7ba094c9a3a4f3be3 100644 +--- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java ++++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java +@@ -15,13 +15,13 @@ import java.util.function.Supplier; + import javax.annotation.CheckReturnValue; + import net.minecraft.ReportedException; + import net.minecraft.SharedConstants; +-import net.minecraft.util.profiling.metrics.MetricCategory; +-import net.minecraft.util.profiling.metrics.MetricSampler; +-import net.minecraft.util.profiling.metrics.MetricsRegistry; +-import net.minecraft.util.profiling.metrics.ProfilerMeasured; ++//import net.minecraft.util.profiling.metrics.MetricCategory; ++//import net.minecraft.util.profiling.metrics.MetricSampler; ++//import net.minecraft.util.profiling.metrics.MetricsRegistry; ++//import net.minecraft.util.profiling.metrics.ProfilerMeasured; + import org.slf4j.Logger; + +-public abstract class BlockableEventLoop implements ProfilerMeasured, TaskScheduler, Executor { ++public abstract class BlockableEventLoop implements /*ProfilerMeasured,*/ TaskScheduler, Executor { // Plazma - Completely remove Mojang profiler + public static final long BLOCK_TIME_NANOS = 100000L; + private final String name; + private static final Logger LOGGER = LogUtils.getLogger(); +@@ -30,7 +30,7 @@ public abstract class BlockableEventLoop implements Profiler + + protected BlockableEventLoop(String name) { + this.name = name; +- MetricsRegistry.INSTANCE.add(this); ++ //MetricsRegistry.INSTANCE.add(this); // Plazma - Completely remove Mojang profiler + } + + protected abstract boolean shouldRun(R task); +@@ -160,10 +160,12 @@ public abstract class BlockableEventLoop implements Profiler + } + } + ++ /* // Plazma - Completely remove Mojang profiler + @Override + public List profiledMetrics() { + return ImmutableList.of(MetricSampler.create(this.name + "-pending-tasks", MetricCategory.EVENT_LOOPS, this::getPendingTasksCount)); + } ++ */ // Plazma - Completely remove Mojang profiler + + public static boolean isNonRecoverable(Throwable exception) { + return exception instanceof ReportedException reportedException +diff --git a/src/main/java/net/minecraft/util/thread/PriorityConsecutiveExecutor.java b/src/main/java/net/minecraft/util/thread/PriorityConsecutiveExecutor.java +index c67846e4d5583d79c6e9760c10d2581f0d54f45c..fdace9b3dedcd2c0879ea4ef30657d9d0e37ad7e 100644 +--- a/src/main/java/net/minecraft/util/thread/PriorityConsecutiveExecutor.java ++++ b/src/main/java/net/minecraft/util/thread/PriorityConsecutiveExecutor.java +@@ -3,12 +3,12 @@ package net.minecraft.util.thread; + import java.util.concurrent.CompletableFuture; + import java.util.concurrent.Executor; + import java.util.function.Consumer; +-import net.minecraft.util.profiling.metrics.MetricsRegistry; ++//import net.minecraft.util.profiling.metrics.MetricsRegistry; // Plazma - Completely remove Mojang profiler + + public class PriorityConsecutiveExecutor extends AbstractConsecutiveExecutor { + public PriorityConsecutiveExecutor(int priorityCount, Executor executor, String name) { + super(new StrictQueue.FixedPriorityQueue(priorityCount), executor, name); +- MetricsRegistry.INSTANCE.add(this); ++ //MetricsRegistry.INSTANCE.add(this); // Plazma - Completely remove Mojang profiler + } + + @Override +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 99d15d6beed3e3d165e71e0955074cc09b02a333..9a3170a65539eb5b66a7461feca9cb44c35a2de5 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -84,8 +84,8 @@ import net.minecraft.tags.FluidTags; + import net.minecraft.tags.TagKey; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.Nameable; +@@ -915,9 +915,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + // CraftBukkit end + + public void baseTick() { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("entityBaseTick"); ++ //gameprofilerfiller.push("entityBaseTick"); // Plazma - Completely remove Mojang profiler + if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Prevent entity loading causing async lookups + this.inBlockState = null; + if (this.isPassenger() && this.getVehicle().isRemoved()) { +@@ -986,7 +986,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + + public void setSharedFlagOnFire(boolean onFire) { +@@ -1213,9 +1213,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + } + +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("move"); ++ //gameprofilerfiller.push("move"); // Plazma - Completely remove Mojang profiler + if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7D) { + movement = movement.multiply(this.stuckSpeedMultiplier); + this.stuckSpeedMultiplier = Vec3.ZERO; +@@ -1224,7 +1224,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + // Paper start - ignore movement changes while inactive. + if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && type == MoverType.SELF) { + setDeltaMovement(Vec3.ZERO); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + return; + } + // Paper end +@@ -1245,8 +1245,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + this.setPos(this.getX() + vec3d1.x, this.getY() + vec3d1.y, this.getZ() + vec3d1.z); + } + +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("rest"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("rest"); // Plazma - Completely remove Mojang profiler + boolean flag = !Mth.equal(movement.x, vec3d1.x); + boolean flag1 = !Mth.equal(movement.z, vec3d1.z); + +@@ -1267,9 +1267,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + this.checkFallDamage(vec3d1.y, this.onGround(), iblockdata, blockposition); + //} // Plazma - Remove persist 'isClientSide' flag + +- if (this.isRemoved()) { +- gameprofilerfiller.pop(); +- } else { ++ if (!this.isRemoved()) { // Plazma - Completely remove Mojang profiler + if (this.horizontalCollision) { + Vec3 vec3d2 = this.getDeltaMovement(); + +@@ -1319,7 +1317,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + float f = this.getBlockSpeedFactor(); + + this.setDeltaMovement(this.getDeltaMovement().multiply((double) f, 1.0D, (double) f)); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + } + // Paper start - detailed watchdog information +@@ -3494,9 +3492,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + this.processPortalCooldown(); + if (this.portalProcess != null) { + if (this.portalProcess.processPortalTeleportation(worldserver, this, this.canUsePortal(false))) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("portal"); ++ //gameprofilerfiller.push("portal"); // Plazma - Completely remove Mojang profiler + this.setPortalCooldown(); + TeleportTransition teleporttransition = this.portalProcess.getPortalDestination(worldserver, this); + +@@ -3508,7 +3506,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } else if (this.portalProcess.hasExpired()) { + this.portalProcess = null; + } +@@ -4024,16 +4022,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + entity.teleport(this.calculatePassengerTransition(teleportTarget, entity)); + } + +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("teleportSameDimension"); ++ //gameprofilerfiller.push("teleportSameDimension"); // Plazma - Completely remove Mojang profiler + this.teleportSetPosition(PositionMoveRotation.of(teleportTarget), teleportTarget.relatives()); + if (!teleportTarget.asPassenger()) { + this.sendTeleportTransitionToRidingPlayers(teleportTarget); + } + + teleportTarget.postTeleportTransition().onTransition(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + return this; + } + +@@ -4055,12 +4053,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + } + +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("teleportCrossDimension"); ++ //gameprofilerfiller.push("teleportCrossDimension"); // Plazma - Completely remove Mojang profiler + entity = this.getType().create(world, EntitySpawnReason.DIMENSION_TRAVEL); + if (entity == null) { +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + return null; + } else { + // Paper start - Fix item duplication and teleport issues +@@ -4086,7 +4084,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + + world.resetEmptyTime(); + teleportTarget.postTeleportTransition().onTransition(entity); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + return entity; + } + } +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index 05f5932b771cef2739f9effb9993c3cb4bdb1960..9cd39ccca746c96809e3e1862e25240714662fb2 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -73,8 +73,8 @@ import net.minecraft.tags.FluidTags; + import net.minecraft.tags.ItemTags; + import net.minecraft.tags.TagKey; + import net.minecraft.util.Mth; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.Difficulty; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.damagesource.CombatRules; +@@ -457,9 +457,9 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + super.baseTick(); +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("livingEntityBaseTick"); ++ //gameprofilerfiller.push("livingEntityBaseTick"); // Plazma - Completely remove Mojang profiler + if (this.fireImmune() /*|| this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag + this.clearFire(); + } +@@ -567,7 +567,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.yHeadRotO = this.yHeadRot; + this.yRotO = this.getYRot(); + this.xRotO = this.getXRot(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + + // Pufferfish start - optimize suffocation +@@ -3435,12 +3435,12 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + this.run += (f3 - this.run) * 0.3F; +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("headTurn"); ++ //gameprofilerfiller.push("headTurn"); // Plazma - Completely remove Mojang profiler + f2 = this.tickHeadTurn(f1, f2); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("rangeChecks"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("rangeChecks"); // Plazma - Completely remove Mojang profiler + + // Paper start - stop large pitch and yaw changes from crashing the server + this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F; +@@ -3452,7 +3452,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F; + // Paper end + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + this.animStep += f2; + if (this.isFallFlying()) { + ++this.fallFlyTicks; +@@ -3683,21 +3683,21 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + this.setDeltaMovement(d0, d1, d2); +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("ai"); ++ //gameprofilerfiller.push("ai"); // Plazma - Completely remove Mojang profiler + if (this.isImmobile()) { + this.jumping = false; + this.xxa = 0.0F; + this.zza = 0.0F; + } else /*if (this.isEffectiveAi())*/ { // Plazma - Remove persist 'isClientSide' flag +- gameprofilerfiller.push("newAi"); ++ //gameprofilerfiller.push("newAi"); // Plazma - Completely remove Mojang profiler + this.serverAiStep(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("jump"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("jump"); // Plazma - Completely remove Mojang profiler + if (this.jumping && this.isAffectedByFluids()) { + double d3; + +@@ -3724,8 +3724,8 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.noJumpDelay = 0; + } + +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("travel"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("travel"); // Plazma - Completely remove Mojang profiler + this.xxa *= 0.98F; + this.zza *= 0.98F; + if (this.isFallFlying()) { +@@ -3758,8 +3758,8 @@ public abstract class LivingEntity extends Entity implements Attackable { + //} // Plazma - Remove persist 'isClientSide' flag + + this.calculateEntityAnimation(this instanceof FlyingAnimal); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("freezing"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("freezing"); // Plazma - Completely remove Mojang profiler + if (/*!this.level().isClientSide &&*/ !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API // Plazma - Remove persist 'isClientSide' flag + int i = this.getTicksFrozen(); + +@@ -3780,15 +3780,15 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + } + +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("push"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("push"); // Plazma - Completely remove Mojang profiler + if (this.autoSpinAttackTicks > 0) { + --this.autoSpinAttackTicks; + this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox()); + } + + this.pushEntities(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + // Paper start - Add EntityMoveEvent + // Purpur start + if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) { +diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java +index 997c5b3deed7c55e5685fba76bcbb53e10e66d9f..c32d248bed500bdd161b8c1aaee3bd3b46ac8fe1 100644 +--- a/src/main/java/net/minecraft/world/entity/Mob.java ++++ b/src/main/java/net/minecraft/world/entity/Mob.java +@@ -34,8 +34,8 @@ import net.minecraft.sounds.SoundEvent; + import net.minecraft.tags.TagKey; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.Difficulty; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.InteractionHand; +@@ -373,15 +373,15 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + @Override + public void baseTick() { + super.baseTick(); +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("mobBaseTick"); ++ //gameprofilerfiller.push("mobBaseTick"); // Plazma - Completely remove Mojang profiler + if (this.isAlive() && this.random.nextInt(1000) < this.ambientSoundTime++) { + this.resetAmbientSoundTime(); + this.playAmbientSound(); + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + incrementTicksSinceLastInteraction(); // Purpur + } + +@@ -702,9 +702,9 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + @Override + public void aiStep() { + super.aiStep(); +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("looting"); ++ //gameprofilerfiller.push("looting"); // Plazma - Completely remove Mojang profiler + Level world = this.level(); + + if (world instanceof ServerLevel worldserver) { +@@ -728,7 +728,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + } + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + + protected Vec3i getPickupReach() { +@@ -950,49 +950,49 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + return; + } + // Paper end - Allow nerfed mobs to jump and float +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("sensing"); ++ //gameprofilerfiller.push("sensing"); // Plazma - Completely remove Mojang profiler + //this.sensing.tick(); // Plazma - moved down +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + int i = this.tickCount + this.getId(); + + if (i % this.level().plazmaConfig().entity.sensorTick == 0) this.sensing.tick(); // Plazma - Configurable entity sensor tick + if (i % 2 != 0 && this.tickCount > 1) { +- gameprofilerfiller.push("targetSelector"); ++ //gameprofilerfiller.push("targetSelector"); // Plazma - Completely remove Mojang profiler + if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.targetSelector.tickRunningGoals(false); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("goalSelector"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("goalSelector"); // Plazma - Completely remove Mojang profiler + if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.goalSelector.tickRunningGoals(false); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } else { +- gameprofilerfiller.push("targetSelector"); ++ //gameprofilerfiller.push("targetSelector"); // Plazma - Completely remove Mojang profiler + if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.targetSelector.tick(); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("goalSelector"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("goalSelector"); // Plazma - Completely remove Mojang profiler + if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking + this.goalSelector.tick(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + +- gameprofilerfiller.push("navigation"); ++ //gameprofilerfiller.push("navigation"); // Plazma - Completely remove Mojang profiler + this.navigation.tick(); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("mob tick"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("mob tick"); // Plazma - Completely remove Mojang profiler + this.customServerAiStep((ServerLevel) this.level()); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("controls"); +- gameprofilerfiller.push("move"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("controls"); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("move"); // Plazma - Completely remove Mojang profiler + this.moveControl.tick(); +- gameprofilerfiller.popPush("look"); ++ //gameprofilerfiller.popPush("look"); // Plazma - Completely remove Mojang profiler + this.lookControl.tick(); +- gameprofilerfiller.popPush("jump"); ++ //gameprofilerfiller.popPush("jump"); // Plazma - Completely remove Mojang profiler + this.jumpControl.tick(); +- gameprofilerfiller.pop(); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + this.sendDebugPackets(); + } + +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java +index 5a439e3b0fdc1010884634c1e046e49d8b9aee17..e04f1f946e0b37ea1362aa2af7ff4232cc73c123 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java +@@ -7,8 +7,8 @@ import java.util.EnumSet; + import java.util.Map; + import java.util.Set; + import java.util.function.Predicate; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + + public class GoalSelector { + private static final WrappedGoal NO_GOAL = new WrappedGoal(Integer.MAX_VALUE, new Goal() { +@@ -85,8 +85,8 @@ public class GoalSelector { + } + + public void tick() { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("goalCleanup"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler ++ //profilerFiller.push("goalCleanup"); // Plazma - Completely remove Mojang profiler + + for (WrappedGoal wrappedGoal : this.availableGoals) { + if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { // Paper - Perf: optimize goal types by removing streams +@@ -95,8 +95,8 @@ public class GoalSelector { + } + + this.lockedFlags.entrySet().removeIf(entry -> !entry.getValue().isRunning()); +- profilerFiller.pop(); +- profilerFiller.push("goalUpdate"); ++ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler ++ //profilerFiller.push("goalUpdate"); // Plazma - Completely remove Mojang profiler + + for (WrappedGoal wrappedGoal2 : this.availableGoals) { + // Paper start +@@ -116,13 +116,13 @@ public class GoalSelector { + } + } + +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler + this.tickRunningGoals(true); + } + + public void tickRunningGoals(boolean tickAll) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("goalTick"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler ++ //profilerFiller.push("goalTick"); // Plazma - Completely remove Mojang profiler + + for (WrappedGoal wrappedGoal : this.availableGoals) { + if (wrappedGoal.isRunning() && (tickAll || wrappedGoal.requiresUpdateEveryTick())) { +@@ -130,7 +130,7 @@ public class GoalSelector { + } + } + +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler + } + + public Set getAvailableGoals() { +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +index 99e31c8e8488ce7138c5385575cbbabe0bd7394e..ac4d7310f50340da668c0e6d63982f99d71f7e05 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +@@ -10,8 +10,8 @@ import net.minecraft.core.Vec3i; + import net.minecraft.network.protocol.game.DebugPackets; + import net.minecraft.tags.BlockTags; + import net.minecraft.util.Mth; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.Mob; + import net.minecraft.world.entity.ai.attributes.Attributes; +@@ -189,13 +189,13 @@ public abstract class PathNavigation { + } + } + // Paper end - EntityPathfindEvent +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("pathfind"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler ++ //profilerFiller.push("pathfind"); // Plazma - Completely remove Mojang profiler + BlockPos blockPos = useHeadPos ? this.mob.blockPosition().above() : this.mob.blockPosition(); + int i = (int)(followRange + (float)range); + PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i)); + Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, positions, followRange, distance, this.maxVisitedNodesMultiplier); +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler + // Plazma start - Process pathfinding asynchronously + if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) { + if (!positions.isEmpty()) this.targetPos = positions.iterator().next(); +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java +index 116b1e251ffe68bae5c404d0823c2bc7c1afddf6..24aa626c1ccd12c6a00d004ac3af46980d3042f2 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java +@@ -2,8 +2,8 @@ package net.minecraft.world.entity.ai.sensing; + + import it.unimi.dsi.fastutil.ints.IntOpenHashSet; + import it.unimi.dsi.fastutil.ints.IntSet; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.Mob; + +@@ -28,10 +28,10 @@ public class Sensing { + } else if (this.unseen.contains(i)) { + return false; + } else { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("hasLineOfSight"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler ++ //profilerFiller.push("hasLineOfSight"); // Plazma - Completely remove Mojang profiler + boolean bl = this.mob.hasLineOfSight(entity); +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler + if (bl) { + this.seen.add(i); + } else { +diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java +index dc833fe4aed149a4edbf668af4bc12937f6a4850..8be1ea2c4825c1647cedadc5f3258fb98242d81c 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java ++++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java +@@ -31,8 +31,8 @@ import net.minecraft.tags.GameEventTags; + import net.minecraft.tags.ItemTags; + import net.minecraft.tags.TagKey; + import net.minecraft.util.Mth; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.SimpleContainer; +@@ -275,15 +275,15 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS + private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("allayBrain"); ++ //gameprofilerfiller.push("allayBrain"); // Plazma - Completely remove Mojang profiler + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider + this.getBrain().tick(world, this); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("allayActivityUpdate"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("allayActivityUpdate"); // Plazma - Completely remove Mojang profiler + AllayAi.updateActivity(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + super.customServerAiStep(world); + } + +diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java +index 7ac1ecd192e65a87a30acba509947f93cccfd709..191e42503a8a257b7f07c2a50eb6c23368e916af 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java ++++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java +@@ -23,8 +23,8 @@ import net.minecraft.util.ByIdMap; + import net.minecraft.util.RandomSource; + import net.minecraft.util.StringRepresentable; + import net.minecraft.util.TimeUtil; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.damagesource.DamageSource; +@@ -164,15 +164,15 @@ public class Armadillo extends Animal { + private int behaviorTick; // Plazma - Add missing pufferfish configurations + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("armadilloBrain"); ++ //gameprofilerfiller.push("armadilloBrain"); // Plazma - Completely remove Mojang profiler + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations + ((Brain) this.brain).tick(world, this); // CraftBukkit - decompile error +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("armadilloActivityUpdate"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("armadilloActivityUpdate"); // Plazma - Completely remove Mojang profiler + ArmadilloAi.updateActivity(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) { + this.forceDrops = true; // CraftBukkit + if (this.dropFromGiftLootTable(world, BuiltInLootTables.ARMADILLO_SHED, this::spawnAtLocation)) { +diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +index ee9be9de7d64c9354b579dc22954058873e7ab5e..33718841e1d97185ba59142bcc484adcb488fc56 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java ++++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +@@ -26,8 +26,8 @@ import net.minecraft.util.ByIdMap; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; + import net.minecraft.util.StringRepresentable; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; +@@ -335,15 +335,15 @@ public class Axolotl extends Animal implements VariantHolder, B + private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("axolotlBrain"); ++ //gameprofilerfiller.push("axolotlBrain"); // Plazma - Completely remove Mojang profiler + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider + this.getBrain().tick(world, this); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("axolotlActivityUpdate"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("axolotlActivityUpdate"); // Plazma - Completely remove Mojang profiler + AxolotlAi.updateActivity(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + if (!this.isNoAi()) { + Optional optional = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS); + +diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +index c11f9111933ec2e033cffcdf930983d505c3acab..81265ee1f2523ba9236f25aa4904892dad1c6132 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java ++++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +@@ -17,8 +17,8 @@ import net.minecraft.sounds.SoundSource; + import net.minecraft.tags.BlockTags; + import net.minecraft.tags.ItemTags; + import net.minecraft.util.Mth; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; +@@ -167,17 +167,17 @@ public class Camel extends AbstractHorse { + private int behaviorTick = 0; // Plazma - Add missing pufferfish configurations + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("camelBrain"); ++ //gameprofilerfiller.push("camelBrain"); // Plazma - Completely remove Mojang profiler + Brain behaviorcontroller = (Brain) this.getBrain(); // CraftBukkit - decompile error + + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations + behaviorcontroller.tick(world, this); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("camelActivityUpdate"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("camelActivityUpdate"); // Plazma - Completely remove Mojang profiler + CamelAi.updateActivity(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + super.customServerAiStep(world); + } + +diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +index 305fe2c13ae2d81b99ff36f8ef18e24c23255eae..8a228f3cbaf706bc02ee142b11fdebfa3192e3e8 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java ++++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +@@ -28,8 +28,8 @@ import net.minecraft.tags.ItemTags; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; + import net.minecraft.util.Unit; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.AgeableMob; +@@ -258,14 +258,14 @@ public class Frog extends Animal implements VariantHolder> { + private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("frogBrain"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler ++ //profilerFiller.push("frogBrain"); // Plazma - Completely remove Mojang profiler + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider + this.getBrain().tick(world, this); +- profilerFiller.pop(); +- profilerFiller.push("frogActivityUpdate"); ++ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler ++ //profilerFiller.push("frogActivityUpdate"); // Plazma - Completely remove Mojang profiler + FrogAi.updateActivity(this); +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler + super.customServerAiStep(world); + } + +diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java +index 4b9e57c271b5b4bdaa92f8da7e0770e2c1adba96..d41526c5cc223162f0298ff1ccf65acc1dfdcbca 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java ++++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java +@@ -12,8 +12,8 @@ import net.minecraft.server.level.ServerLevel; + import net.minecraft.sounds.SoundEvent; + import net.minecraft.sounds.SoundEvents; + import net.minecraft.tags.ItemTags; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.damagesource.DamageSource; +@@ -140,15 +140,15 @@ public class Tadpole extends AbstractFish { + private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("tadpoleBrain"); ++ //gameprofilerfiller.push("tadpoleBrain"); // Plazma - Completely remove Mojang profiler + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider + this.getBrain().tick(world, this); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("tadpoleActivityUpdate"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("tadpoleActivityUpdate"); // Plazma - Completely remove Mojang profiler + TadpoleAi.updateActivity(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + super.customServerAiStep(world); + } + +diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +index d508cb2a61866c8fd7f381f8deb558ed86f7c845..d911c311b28e80843d3e162553093fe54168a0c6 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java ++++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +@@ -20,8 +20,8 @@ import net.minecraft.tags.ItemTags; + import net.minecraft.tags.TagKey; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; +@@ -227,15 +227,15 @@ public class Goat extends Animal { + private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("goatBrain"); ++ //gameprofilerfiller.push("goatBrain"); // Plazma - Completely remove Mojang profiler + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider + this.getBrain().tick(world, this); +- gameprofilerfiller.pop(); +- gameprofilerfiller.push("goatActivityUpdate"); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler ++ //gameprofilerfiller.push("goatActivityUpdate"); // Plazma - Completely remove Mojang profiler + GoatAi.updateActivity(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + super.customServerAiStep(world); + } + +diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +index a108cba43a7272f53cd53b885dc03874fbf27ba4..83d0b7587919a607e44e86b3b8d8806265889455 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java ++++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +@@ -30,8 +30,8 @@ import net.minecraft.tags.BlockTags; + import net.minecraft.tags.ItemTags; + import net.minecraft.util.ByIdMap; + import net.minecraft.util.Mth; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.damagesource.DamageSource; +@@ -512,14 +512,14 @@ public class Sniffer extends Animal { + private int behaviorTick; // Plazma - Add missing pufferfish configurations + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("snifferBrain"); ++ //gameprofilerfiller.push("snifferBrain"); // Plazma - Completely remove Mojang profiler + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations + this.getBrain().tick(world, this); +- gameprofilerfiller.popPush("snifferActivityUpdate"); ++ //gameprofilerfiller.popPush("snifferActivityUpdate"); // Plazma - Completely remove Mojang profiler + SnifferAi.updateActivity(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + super.customServerAiStep(world); + } + +diff --git a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java +index 650af7be38e9ba8e81ac991689ffa0a444e7f94b..f2c623498de9a6f165b45686ec255640332932e3 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java +@@ -91,7 +91,7 @@ public class LeashFenceKnotEntity extends BlockAttachedEntity { + + // CraftBukkit start + if (leashable instanceof Entity entity && CraftEventFactory.callPlayerLeashEntityEvent(entity, this, player, hand).isCancelled()) { +- ((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(leashed, leashable.getLeashHolder())); ++ ((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(entity, leashable.getLeashHolder())); + flag = true; // Also set true when the event is cancelled otherwise it tries to unleash the entities + continue; + } +diff --git a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java +index 3eb20ffc4a0446b2d0580de40b42eca53b53ec03..18325bcb3274e746b913dbacf28663b4d32786a9 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java +@@ -15,8 +15,8 @@ import net.minecraft.network.syncher.SynchedEntityData; + import net.minecraft.server.level.ServerLevel; + import net.minecraft.sounds.SoundEvent; + import net.minecraft.sounds.SoundEvents; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.util.valueproviders.UniformInt; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.damagesource.DamageSource; +@@ -281,11 +281,11 @@ public class Zoglin extends Monster implements HoglinBase { + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("zoglinBrain"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler ++ //profilerFiller.push("zoglinBrain"); // Plazma - Completely remove Mojang profiler + if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider + this.getBrain().tick(world, this); +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler + this.updateActivity(); + } + +diff --git a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java +index 2e39c65304fff182ee63e18f16b677b490af2837..b5bbec8bc4a228844abad7a90142656482faff63 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java ++++ b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java +@@ -12,8 +12,8 @@ import net.minecraft.sounds.SoundEvent; + import net.minecraft.sounds.SoundEvents; + import net.minecraft.sounds.SoundSource; + import net.minecraft.tags.EntityTypeTags; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.AnimationState; + import net.minecraft.world.entity.Entity; +@@ -238,13 +238,13 @@ public class Breeze extends Monster { + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("breezeBrain"); ++ //gameprofilerfiller.push("breezeBrain"); // Plazma - Completely remove Mojang profiler + this.getBrain().tick(world, this); +- gameprofilerfiller.popPush("breezeActivityUpdate"); ++ //gameprofilerfiller.popPush("breezeActivityUpdate"); // Plazma - Completely remove Mojang profiler + BreezeAi.updateActivity(this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + super.customServerAiStep(world); + } + +diff --git a/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java b/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java +index 833667dfaff7f8de638238981adbf0b4a839ea04..60571ab800bad67e7b5f97b09e8610752df81b21 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java ++++ b/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java +@@ -13,8 +13,8 @@ import net.minecraft.network.syncher.SynchedEntityData; + import net.minecraft.server.level.ServerLevel; + import net.minecraft.sounds.SoundEvent; + import net.minecraft.sounds.SoundEvents; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.AnimationState; + import net.minecraft.world.entity.Entity; +@@ -144,10 +144,10 @@ public class Creaking extends Monster { + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("creakingBrain"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler ++ //profilerFiller.push("creakingBrain"); // Plazma - Completely remove Mojang profiler + this.getBrain().tick((ServerLevel)this.level(), this); +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler + CreakingAi.updateActivity(this); + } + +diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +index 28ca4b511ea37f6fd0eefc7a8d449c85075b855d..840f62cdb2a691bcfb5c27f00745cebfeb97df96 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java ++++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +@@ -16,8 +16,8 @@ import net.minecraft.sounds.SoundEvents; + import net.minecraft.sounds.SoundSource; + import net.minecraft.tags.ItemTags; + import net.minecraft.util.RandomSource; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; +@@ -179,12 +179,12 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { + private int behaviorTick; // Pufferfish + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("hoglinBrain"); ++ //gameprofilerfiller.push("hoglinBrain"); // Plazma - Completely remove Mojang profiler + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider + this.getBrain().tick(world, this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + HoglinAi.updateActivity(this); + if (this.isConverting()) { + ++this.timeInOverworld; +diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java +index 938b4025122f6d27382086445bc8f231f325b864..8fc0279ab108189f70daec0dd57a6ffd0a7b5711 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java ++++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java +@@ -6,8 +6,8 @@ import java.util.List; + import javax.annotation.Nullable; + import net.minecraft.util.RandomSource; + import net.minecraft.util.VisibleForDebug; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; ++//import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; +@@ -340,12 +340,12 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento + private int behaviorTick; // Pufferfish + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("piglinBrain"); ++ //gameprofilerfiller.push("piglinBrain"); // Plazma - Completely remove Mojang profiler + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider + this.getBrain().tick(world, this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + PiglinAi.updateActivity(this); + super.customServerAiStep(world); + } +diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java +index bc3b0eb21200eae7e419b2571871b36fc1e07c0f..7134120e8f22904c222ac31b763f67fc12a970ee 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java ++++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java +@@ -8,8 +8,8 @@ import net.minecraft.server.level.ServerLevel; + import net.minecraft.sounds.SoundEvent; + import net.minecraft.sounds.SoundEvents; + import net.minecraft.util.RandomSource; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; ++//import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.EntitySpawnReason; +@@ -148,11 +148,11 @@ public class PiglinBrute extends AbstractPiglin { + + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("piglinBruteBrain"); ++ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler ++ //profilerFiller.push("piglinBruteBrain"); // Plazma - Completely remove Mojang profiler + if (getRider() == null || this.isControllable()) // Purpur - only use brain if no rider + this.getBrain().tick(world, this); +- profilerFiller.pop(); ++ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler + PiglinBruteAi.updateActivity(this); + PiglinBruteAi.maybePlayActivitySound(this); + super.customServerAiStep(world); +diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +index 4102dc4c8b63a1d00a8417aa303521590202f9a6..56d880a05cc8f799e43384bc8bee04d3f829bae2 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java ++++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +@@ -32,8 +32,8 @@ import net.minecraft.tags.TagKey; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; + import net.minecraft.util.Unit; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; ++//import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.effect.MobEffectInstance; +@@ -321,12 +321,12 @@ public class Warden extends Monster implements VibrationSystem { + private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep(ServerLevel world) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("wardenBrain"); ++ //gameprofilerfiller.push("wardenBrain"); // Plazma - Completely remove Mojang profiler + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Plazma - Add missing Purpur configurations + this.getBrain().tick(world, this); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + super.customServerAiStep(world); + if ((this.tickCount + this.getId()) % 120 == 0) { + Warden.applyDarknessAround(world, this.position(), this, 20); +diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java +index 68353a8b2a01fbf873c3751f3887dc0ec35c8327..98068cfb9124e8a7cf0691f691a7b16dbdfec194 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java +@@ -38,8 +38,8 @@ import net.minecraft.stats.Stats; + import net.minecraft.tags.ItemTags; + import net.minecraft.util.Mth; + import net.minecraft.util.SpawnUtil; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; ++//import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.Difficulty; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.InteractionHand; +@@ -344,9 +344,9 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + } + protected void customServerAiStep(ServerLevel world, boolean inactive) { // Purpur - not final + // Paper end - EAR 2 +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("villagerBrain"); ++ //gameprofilerfiller.push("villagerBrain"); // Plazma - Completely remove Mojang profiler + // Purpur start + if (this.level().purpurConfig.villagerLobotomizeEnabled) { + // treat as inactive if lobotomized +@@ -360,7 +360,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + this.getBrain().tick(world, this); // Paper // Purpur + } + // Pufferfish end +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + if (this.assignProfessionWhenSpawned) { + this.assignProfessionWhenSpawned = false; + } +diff --git a/src/main/java/net/minecraft/world/item/Items.java b/src/main/java/net/minecraft/world/item/Items.java +index bfde7c2d386d94913bde5452b903f2f2ee7ac672..580bd63fdbf9555f867362d3c1f39f41fd750089 100644 +--- a/src/main/java/net/minecraft/world/item/Items.java ++++ b/src/main/java/net/minecraft/world/item/Items.java +@@ -1698,7 +1698,7 @@ public class Items { + ExperienceBottleItem::new, + new Item.Properties().rarity(Rarity.UNCOMMON).component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true) + ); +- public static final Item FIRE_CHARGE = registerItem("fire_charge", FireChargeItem::new, new Item.Properties().useCooldown(org.plazmamc.plazma.configurations.GlobalConfiguration.get().item.fireCharge.cooldown())); ++ public static final Item FIRE_CHARGE = registerItem("fire_charge", FireChargeItem::new); + public static final Item WIND_CHARGE = registerItem("wind_charge", WindChargeItem::new, new Item.Properties().useCooldown(0.5F)); + public static final Item WRITABLE_BOOK = registerItem( + "writable_book", WritableBookItem::new, new Item.Properties().stacksTo(1).component(DataComponents.WRITABLE_BOOK_CONTENT, WritableBookContent.EMPTY) +diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java +index f6dd363ececf967d282f5ba713013085da1ddf37..5c11433dcfc858b13f1f056ddcf92ac1cf71ef65 100644 +--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java ++++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java +@@ -41,7 +41,7 @@ import net.minecraft.server.level.ServerLevel; + import net.minecraft.server.packs.resources.ResourceManager; + import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener; + import net.minecraft.server.packs.resources.SimplePreparableReloadListener; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.ProfilerFiller; + + public class RecipeManager extends SimplePreparableReloadListener implements RecipeAccess { + +@@ -94,7 +94,7 @@ public class RecipeManager extends SimplePreparableReloadListener imp + } + + @Override +- protected RecipeMap prepare(ResourceManager manager, ProfilerFiller profiler) { ++ protected RecipeMap prepare(ResourceManager manager/*, ProfilerFiller profiler*/) { // Plazma - Completely remove Mojang profiler + SortedMap> sortedmap = new TreeMap(); + + SimpleJsonResourceReloadListener.scanDirectory(manager, Registries.elementsDirPath(Registries.RECIPE), this.registries.createSerializationContext(JsonOps.INSTANCE), Recipe.CODEC, sortedmap); +@@ -109,7 +109,7 @@ public class RecipeManager extends SimplePreparableReloadListener imp + return RecipeMap.create(list); + } + +- protected void apply(RecipeMap prepared, ResourceManager manager, ProfilerFiller profiler) { ++ protected void apply(RecipeMap prepared, ResourceManager manager/*, ProfilerFiller profiler*/) { // Plazma - Completely remove Mojang profiler + this.recipes = prepared; + RecipeManager.LOGGER.info("Loaded {} recipes", prepared.values().size()); + } +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index a44cb5609b3d467ba24d4814ff2d1840f49d37ed..332c1d890eefb0c705200a61b8bc7369457bc3af 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -35,8 +35,8 @@ import net.minecraft.util.AbortableIterationConsumer; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; + import net.minecraft.util.StringRepresentable; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profilers ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profilers + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.TickRateManager; + import net.minecraft.world.damagesource.DamageSource; +@@ -275,7 +275,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + + @Override + public final List getEntitiesOfClass(final Class entityClass, final AABB boundingBox, final Predicate predicate) { +- Profiler.get().incrementCounter("getEntities"); ++ //Profiler.get().incrementCounter("getEntities"); // Plazma - Completely remove Mojang profilers + final List ret = new java.util.ArrayList<>(); + + ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(entityClass, null, boundingBox, ret, predicate); +@@ -285,7 +285,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + + @Override + public final List moonrise$getHardCollidingEntities(final Entity entity, final AABB box, final Predicate predicate) { +- Profiler.get().incrementCounter("getEntities"); ++ //Profiler.get().incrementCounter("getEntities"); // Plazma - Completely remove Mojang profilers + final List ret = new java.util.ArrayList<>(); + + ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getHardCollidingEntities(entity, box, ret, predicate); +@@ -1511,9 +1511,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + } + + protected void tickBlockEntities() { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profilers + +- gameprofilerfiller.push("blockEntities"); ++ //gameprofilerfiller.push("blockEntities"); // Plazma - Completely remove Mojang profilers + this.tickingBlockEntities = true; + if (!this.pendingBlockEntityTickers.isEmpty()) { + this.blockEntityTickers.addAll(this.pendingBlockEntityTickers); +@@ -1551,7 +1551,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 + + this.tickingBlockEntities = false; +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profilers + this.spigotConfig.currentPrimedTnt = 0; // Spigot + } + +@@ -1721,7 +1721,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + + @Override + public List getEntities(@Nullable Entity except, AABB box, Predicate predicate) { +- Profiler.get().incrementCounter("getEntities"); ++ //Profiler.get().incrementCounter("getEntities"); // Plazma - Completely remove Mojang profilers + //List list = Lists.newArrayList(); // Plazma - minor optimizations + + // Paper start - rewrite chunk system +@@ -1751,7 +1751,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + public void getEntities(final EntityTypeTest entityTypeTest, + final AABB boundingBox, final Predicate predicate, + final List into, final int maxCount) { +- Profiler.get().incrementCounter("getEntities"); ++ //Profiler.get().incrementCounter("getEntities"); // Plazma - Completely remove Mojang profilers + + if (entityTypeTest instanceof net.minecraft.world.entity.EntityType byType) { + if (maxCount != Integer.MAX_VALUE) { +diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +index dc15c15951e4ca30b8341d24f813259a77f41c77..ff61aee501131c4141c79354f408d89bfdda21cd 100644 +--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java ++++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +@@ -24,8 +24,8 @@ import net.minecraft.tags.BlockTags; + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; + import net.minecraft.util.VisibleForDebug; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; ++//import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.util.random.WeightedRandomList; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntitySpawnReason; +@@ -163,9 +163,9 @@ public final class NaturalSpawner { + } + + public static void spawnForChunk(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, List spawnableGroups) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("spawner"); ++ //gameprofilerfiller.push("spawner"); // Plazma - Completely remove Mojang profiler + Iterator iterator = spawnableGroups.iterator(); + + while (iterator.hasNext()) { +@@ -211,7 +211,7 @@ public final class NaturalSpawner { + } + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + + // Paper start - Add mobcaps commands +diff --git a/src/main/java/net/minecraft/world/level/ServerExplosion.java b/src/main/java/net/minecraft/world/level/ServerExplosion.java +index 3c3d219c9339f64c23ec0b31783bf68a4423636c..58af43be0743ccafc23755b1d4eb4e6fd3d3b3a6 100644 +--- a/src/main/java/net/minecraft/world/level/ServerExplosion.java ++++ b/src/main/java/net/minecraft/world/level/ServerExplosion.java +@@ -15,8 +15,8 @@ import net.minecraft.core.BlockPos; + import net.minecraft.core.Holder; + import net.minecraft.server.level.ServerLevel; + import net.minecraft.util.Mth; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; ++//import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityType; +@@ -700,11 +700,11 @@ public class ServerExplosion implements Explosion { + + this.hurtEntities(); + if (this.interactsWithBlocks()) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("explosion_blocks"); ++ //gameprofilerfiller.push("explosion_blocks"); // Plazma - Completely remove Mojang profiler + this.interactWithBlocks(list); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + + if (this.fire) { +diff --git a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java +index fdebf1f4ae72001c24b20dd973ca7dd54e30df3d..fdee785aec86592e8289eb3f2a8571ca5aa256b5 100644 +--- a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java +@@ -100,7 +100,7 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal { + // Paper end - call EntityPortalEnterEvent + BlockEntity tileentity = world.getBlockEntity(pos); + +- if (/*!world.isClientSide &&*/ tileentity instanceof TheEndGatewayBlockEntity tileentity) { // Plazma - Remove persist 'isClientSide' flag + minor improvement ++ if (/*!world.isClientSide &&*/ tileentity instanceof TheEndGatewayBlockEntity tileentityendgateway) { // Plazma - Remove persist 'isClientSide' flag + minor improvement + //TheEndGatewayBlockEntity tileentityendgateway = (TheEndGatewayBlockEntity) tileentity; // Plazma - Remove persist 'isClientSide' flag + minor improvement + + if (!tileentityendgateway.isCoolingDown()) { +diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +index 3b3915c4f93f7e35392255c1352e236208a2b447..3c92e6b52394eed3ac66d44973288e4de2c133cc 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -25,8 +25,8 @@ import net.minecraft.network.FriendlyByteBuf; + import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; + import net.minecraft.server.level.FullChunkStatus; + import net.minecraft.server.level.ServerLevel; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; ++//import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.level.ChunkPos; + import net.minecraft.world.level.Level; +@@ -419,13 +419,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + } + + if (LightEngine.hasDifferentLightProperties(iblockdata1, iblockdata)) { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push("updateSkyLightSources"); ++ //gameprofilerfiller.push("updateSkyLightSources"); // Plazma - Completely remove Mojang profiler + // Paper - rewrite chunk system +- gameprofilerfiller.popPush("queueCheckLight"); ++ //gameprofilerfiller.popPush("queueCheckLight"); // Plazma - Completely remove Mojang profiler + this.level.getChunkSource().getLightEngine().checkBlock(blockposition); +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } + + boolean flag3 = iblockdata1.hasBlockEntity(); +@@ -1072,9 +1072,9 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + + if (LevelChunk.this.isTicking(blockposition)) { + try { +- ProfilerFiller gameprofilerfiller = Profiler.get(); ++ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler + +- gameprofilerfiller.push(this::getType); ++ //gameprofilerfiller.push(this::getType); // Plazma - Completely remove Mojang profiler + BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); + + if (this.blockEntity.getType().isValid(iblockdata)) { +@@ -1090,7 +1090,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + // Paper end - Remove the Block Entity if it's invalid + } + +- gameprofilerfiller.pop(); ++ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler + } catch (Throwable throwable) { + if (throwable instanceof ThreadDeath) throw throwable; // Paper + // Paper start - Prevent block entity and entity crashes +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java +index 95e71c471904fc54003180632dc85398ae06d241..376d7715daee8fd97757746d6a6f1c665558c8b8 100644 +--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java +@@ -12,9 +12,9 @@ import java.util.function.Function; + import java.util.stream.Collectors; + import javax.annotation.Nullable; + import net.minecraft.core.BlockPos; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; +-import net.minecraft.util.profiling.metrics.MetricCategory; ++//import net.minecraft.util.profiling.Profiler; ++//import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.metrics.MetricCategory; + import net.minecraft.world.entity.Mob; + import net.minecraft.world.level.PathNavigationRegion; + import dev.kaiijumc.kaiiju.path.*; // Plazma - Process pathfinding asynchronously +diff --git a/src/main/java/net/minecraft/world/ticks/LevelTicks.java b/src/main/java/net/minecraft/world/ticks/LevelTicks.java +index 778e6476c86d823dc8efe603a95e589e8b2ea9d9..fe3ba3e7fb5c2711edfa7c78441a590b08a68aa3 100644 +--- a/src/main/java/net/minecraft/world/ticks/LevelTicks.java ++++ b/src/main/java/net/minecraft/world/ticks/LevelTicks.java +@@ -23,8 +23,8 @@ import net.minecraft.Util; + import net.minecraft.core.BlockPos; + import net.minecraft.core.SectionPos; + import net.minecraft.core.Vec3i; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; ++//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler ++//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler + import net.minecraft.world.level.ChunkPos; + import net.minecraft.world.level.levelgen.structure.BoundingBox; + +@@ -79,20 +79,20 @@ public class LevelTicks implements LevelTickAccess { + } + + public void tick(long time, int maxTicks, BiConsumer ticker) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("collect"); +- this.collectTicks(time, maxTicks, profilerFiller); +- profilerFiller.popPush("run"); +- profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size()); ++ //ProfilerFiller profilerFiller = Profiler.get(); ++ //profilerFiller.push("collect"); ++ this.collectTicks(time, maxTicks/*, profilerFiller*/); // Plazma - Completely remove Mojang profiler ++ //profilerFiller.popPush("run"); ++ //profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size()); + this.runCollectedTicks(ticker); +- profilerFiller.popPush("cleanup"); ++ //profilerFiller.popPush("cleanup"); + this.cleanupAfterTick(); +- profilerFiller.pop(); ++ //profilerFiller.pop(); + } + +- private void collectTicks(long time, int maxTicks, ProfilerFiller profiler) { ++ private void collectTicks(long time, int maxTicks/*, ProfilerFiller profiler*/) { // Plazma - Completely remove Mojang profiler + this.sortContainersToTick(time); +- profiler.incrementCounter("containersToTick", this.containersToTick.size()); ++ //profiler.incrementCounter("containersToTick", this.containersToTick.size()); + this.drainContainers(time, maxTicks); + this.rescheduleLeftoverContainers(); + } diff --git a/patches/server/0050-Port-minor-SparklyPaper-patches.patch b/patches/server/0050-Port-minor-SparklyPaper-patches.patch new file mode 100644 index 0000000..0034c7c --- /dev/null +++ b/patches/server/0050-Port-minor-SparklyPaper-patches.patch @@ -0,0 +1,116 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Fri, 13 Dec 2024 21:10:27 +0900 +Subject: [PATCH] Port minor SparklyPaper patches + + +diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java +index c14ce846afb7364e541bfe01b73a06a94e48f55b..3b11cc112e98cea1067ecdfe20d894f8ba753b93 100644 +--- a/src/main/java/net/minecraft/server/level/ServerEntity.java ++++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +@@ -58,6 +58,7 @@ import org.bukkit.event.player.PlayerVelocityEvent; + + public class ServerEntity { + ++ public static boolean PLAZMA_DISTANCE_SQR = false; // Plazma - Port Minor SparklyPaper patches; Skip distanceToSqr if the delta is the same + private static final Logger LOGGER = LogUtils.getLogger(); + private static final int TOLERANCE_LEVEL_ROTATION = 1; + private static final double TOLERANCE_LEVEL_POSITION = 7.62939453125E-6D; +@@ -232,6 +233,7 @@ public class ServerEntity { + + if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) { + Vec3 vec3d1 = this.entity.getDeltaMovement(); ++ if (PLAZMA_DISTANCE_SQR || vec3d1 != this.lastSentMovement) { // Plazma - Port Minor SparklyPaper patches; Skip distanceToSqr if the delta is the same + double d0 = vec3d1.distanceToSqr(this.lastSentMovement); + + if (d0 > 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) { +@@ -246,6 +248,7 @@ public class ServerEntity { + this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement)); + } + } ++ } // Plazma - Port Minor SparklyPaper patches; Skip distanceToSqr if the delta is the same + } + + if (packet1 != null) { +diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java +index da7e1a69ecb4e6b3be2d8544ac406aa519bd196e..ce56fdd0bbe1c95146c88594c68a6a399f01218e 100644 +--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java ++++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java +@@ -90,12 +90,14 @@ public class ServerStatsCounter extends StatsCounter { + this.dirty.add(stat); + } + ++ /* // Plazma - Port Minor SparklyPaper patches; Skip dirty stats copy when requesting player stats + private Set> getDirty() { + Set> set = Sets.newHashSet(this.dirty); + + this.dirty.clear(); + return set; + } ++ */ // Plazma - Port Minor SparklyPaper patches; Skip dirty stats copy when requesting player stats + + public void parseLocal(DataFixer dataFixer, String json) { + try { +@@ -242,14 +244,12 @@ public class ServerStatsCounter extends StatsCounter { + } + + public void sendStats(ServerPlayer player) { +- Object2IntMap> object2intmap = new Object2IntOpenHashMap(); +- Iterator iterator = this.getDirty().iterator(); ++ // Plazma start - Port Minor SparklyPaper patches; Skip dirty stats copy when requesting player stats ++ Object2IntMap> object2intmap = new Object2IntOpenHashMap<>(); ++ for (final Stat stat : this.dirty) object2intmap.put(stat, this.getValue(stat)); + +- while (iterator.hasNext()) { +- Stat statistic = (Stat) iterator.next(); +- +- object2intmap.put(statistic, this.getValue(statistic)); +- } ++ this.dirty.clear(); ++ // Plazma end - Port Minor SparklyPaper patches; Skip dirty stats copy when requesting player stats + + player.connection.send(new ClientboundAwardStatsPacket(object2intmap)); + } +diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java +index 8c455ac7dcb126e2b2932eba980454513947fac2..ecf9153b0eadb264d79fe9a809918bb13cd6d4b8 100644 +--- a/src/main/java/net/minecraft/world/item/MapItem.java ++++ b/src/main/java/net/minecraft/world/item/MapItem.java +@@ -276,7 +276,12 @@ public class MapItem extends Item { + mapItemSavedData.tickCarriedBy(player, stack); + } + +- if (!mapItemSavedData.locked && (selected || entity instanceof Player && ((Player)entity).getOffhandItem() == stack)) { ++ // Plazma start - Port Minor SparklyPaper patches; Skip map update if the craft renderer is null ++ if (!mapItemSavedData.locked ++ && (!world.plazmaConfig().item.skipMapUpdateIfCraftRenderIsNull || mapItemSavedData.mapView.getRenderers().stream().anyMatch(renderer -> renderer instanceof org.bukkit.craftbukkit.map.CraftMapRenderer)) ++ && (selected || entity instanceof Player player && player.getOffhandItem() == stack) ++ ) { ++ // Plazma end - Port Minor SparklyPaper patches; Skip map update if the craft renderer is null + this.update(world, entity, mapItemSavedData); + } + } +diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java +index 8149b9c51b78eb5c689b7218a2ca3aab60e73bcf..125a4f13dbe98976c4cf94bb523463a51bd4f8dd 100644 +--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java ++++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java +@@ -145,7 +145,7 @@ public class CraftMapColorCache implements MapPalette.MapColorCache { + } + + @Override +- public boolean isCached() { ++ public synchronized boolean isCached() { // Plazma - Port Minor SparklyPaper patches; Fix concurrency issues when using "imageToBytes" in multiple threads + return this.cached || (!this.running.get() && this.initCache().isDone()); + } + +diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +index 7591e21bfd90edff05639bb6a027c3fe8c1c36c3..bab5f682b8aeaa6dfcda7f07499ae297cbcbe23e 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +@@ -87,6 +87,7 @@ public class WorldConfigurations extends ConfigurationPart { + public class Item extends ConfigurationPart { + + public boolean allowShootFireballs = false; ++ public boolean skipMapUpdateIfCraftRenderIsNull = true; + + } + diff --git a/patches/server/0051-SparklyPaper-Optimize-framed-map-tracker-ticking.patch b/patches/server/0051-SparklyPaper-Optimize-framed-map-tracker-ticking.patch new file mode 100644 index 0000000..8b2768e --- /dev/null +++ b/patches/server/0051-SparklyPaper-Optimize-framed-map-tracker-ticking.patch @@ -0,0 +1,317 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Fri, 13 Dec 2024 21:00:07 +0900 +Subject: [PATCH] SparklyPaper - Optimize framed map tracker ticking + + +diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java +index 3b11cc112e98cea1067ecdfe20d894f8ba753b93..f33e7f7fdee160b7397b1156c179a5c95816307a 100644 +--- a/src/main/java/net/minecraft/server/level/ServerEntity.java ++++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +@@ -129,33 +129,31 @@ public class ServerEntity { + + Entity entity = this.entity; + +- if (!this.trackedPlayers.isEmpty() && entity instanceof ItemFrame entityitemframe) { // Paper - Perf: Only tick item frames if players can see it +- if (true || this.tickCount % 10 == 0) { // CraftBukkit - Moved below, should always enter this block +- ItemStack itemstack = entityitemframe.getItem(); +- +- if (this.level.paperConfig().maps.itemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig().maps.itemFrameCursorUpdateInterval == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable +- MapId mapid = entityitemframe.cachedMapId; // Paper - Perf: Cache map ids on item frames +- MapItemSavedData worldmap = MapItem.getSavedData(mapid, this.level); +- +- if (worldmap != null) { +- Iterator iterator = this.trackedPlayers.iterator(); // CraftBukkit +- +- while (iterator.hasNext()) { +- ServerPlayer entityplayer = iterator.next().getPlayer(); // CraftBukkit +- +- worldmap.tickCarriedBy(entityplayer, itemstack); +- Packet packet = worldmap.getUpdatePacket(mapid, entityplayer); ++ // Plazma start - Optimize framed map tracker ticking ++ if (!this.trackedPlayers.isEmpty() && entity instanceof ItemFrame frame && frame.cachedMapId != null) { // Paper - Perf: Only tick item frames if players can see it ++ if (this.level.paperConfig().maps.itemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig().maps.itemFrameCursorUpdateInterval == 0) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable ++ MapId id = frame.cachedMapId; // Paper - Perf: Cache map ids on item frames ++ MapItemSavedData data = MapItem.getSavedData(id, this.level); ++ ++ if (data != null) for (final ServerPlayerConnection trackedPlayer : this.trackedPlayers) { ++ if (!data.hasContextualRenderer) { ++ // Pass in a "random" player when a non-contextual plugin renderer is added to make sure it is called ++ final Packet updatePacket = data.framedUpdatePacket(id, data.hasPluginRenderer ? com.google.common.collect.Iterables.getFirst(this.trackedPlayers, null).getPlayer() : null); ++ ++ if (updatePacket != null) ++ for (ServerPlayerConnection connection : this.trackedPlayers) connection.send(updatePacket); ++ } else { ++ ServerPlayer player = trackedPlayer.getPlayer(); // CraftBukkit ++ Packet packet = data.getUpdatePacket(id, player); + +- if (packet != null) { +- entityplayer.connection.send(packet); +- } +- } ++ if (packet != null) player.connection.send(packet); + } + } +- +- this.sendDirtyEntityData(); + } ++ ++ this.sendDirtyEntityData(); + } ++ // Plazma end - Optimize framed map tracker ticking + + if (this.forceStateResync || this.tickCount % this.updateInterval == 0 || this.entity.hasImpulse || this.entity.getEntityData().isDirty()) { // Paper - fix desync when a player is added to the tracker + byte b0 = Mth.packDegrees(this.entity.getYRot()); +@@ -426,6 +424,16 @@ public class ServerEntity { + } + } + ++ // Plazma start - Optimize framed map tracker adding ++ if (this.entity instanceof ItemFrame frame && frame.cachedMapId != null) { ++ MapItemSavedData mapData = MapItem.getSavedData(frame.cachedMapId, this.level); ++ if (mapData == null) return; ++ ++ mapData.addFrameDecoration(frame); ++ final Packet mapPacket = mapData.fullUpdatePacket(frame.cachedMapId, mapData.hasPluginRenderer ? player : null); ++ if (mapPacket != null) sender.accept((Packet) mapPacket); ++ } ++ // Plazma end - Optimize framed map tracker adding + } + + public Vec3 getPositionBase() { +diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +index 27f7a0abf77e94f15ff5f42e54e979377c94e63c..d1b8edccf3d7418a4aceba8491491b3a339b645a 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +@@ -175,6 +175,16 @@ public class ItemFrame extends HangingEntity { + this.setItem(ItemStack.fromBukkitCopy(event.getItemStack()), false); + } + // Paper end - Add PlayerItemFrameChangeEvent ++ // Plazma start - Optimize framed map tracker ticking ++ final ItemStack item = this.getItem(); ++ if (item.is(Items.FILLED_MAP)) { ++ final MapItemSavedData data = MapItem.getSavedData(item, this.level()); ++ if (data != null) { ++ data.addFrameDecoration(this); ++ data.markAllDirty(); ++ } ++ } ++ // Plazma end - Optimize framed map tracker ticking + this.dropItem(world, source.getEntity(), false); + this.gameEvent(GameEvent.BLOCK_CHANGE, source.getEntity()); + this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F); +diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +index 71aa3b9c5604f832e764e0d7a93da467ffe7dee1..e1440d1fc32229867e1f1543961fdfcec99a36fd 100644 +--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java ++++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +@@ -80,12 +80,22 @@ public class MapItemSavedData extends SavedData { + public final Map decorations = Maps.newLinkedHashMap(); + private final Map frameMarkers = Maps.newHashMap(); + private int trackedDecorationCount; +- private org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper ++ private final org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper // Plazma - Improve code styling + public boolean isExplorerMap; // Purpur ++ // Plazma start - Optimize framed map tracker ticking; Shared between all players tracking this map inside an item frame ++ public boolean dirtyColorData; ++ public int minDirtyX; ++ public int minDirtyY; ++ public int maxDirtyX; ++ public int maxDirtyY; ++ public boolean dirtyFrameDecorations; ++ public boolean hasPluginRenderer; ++ public boolean hasContextualRenderer; ++ // Plazma end - Optimize framed map tracker ticking; Shared between all players tracking this map inside an item frame + + // CraftBukkit start + public final CraftMapView mapView; +- private CraftServer server; ++ private final CraftServer server; // Plazma - Improve code styling + public UUID uniqueId = null; + public MapId id; + // CraftBukkit end +@@ -372,7 +382,7 @@ public class MapItemSavedData extends SavedData { + --this.trackedDecorationCount; + } + +- if (mapicon != null) this.setDecorationsDirty(); // Paper - only mark dirty if a change occurs ++ if (mapicon != null && mapicon.renderOnFrame()) this.dirtyFrameDecorations = true; // Plazma - Optimize framed map tracker ticking + } + + public static void addTargetDecoration(ItemStack stack, BlockPos pos, String id, Holder decorationType) { +@@ -409,6 +419,7 @@ public class MapItemSavedData extends SavedData { + } + + this.setDecorationsDirty(); ++ if (mapicon.renderOnFrame()) this.dirtyFrameDecorations = true; // Plazma - Optimize framed map tracker ticking + } + + } +@@ -480,14 +491,23 @@ public class MapItemSavedData extends SavedData { + + public void setColorsDirty(int x, int z) { + this.setDirty(); +- Iterator iterator = this.carriedBy.iterator(); +- +- while (iterator.hasNext()) { +- MapItemSavedData.HoldingPlayer worldmap_worldmaphumantracker = (MapItemSavedData.HoldingPlayer) iterator.next(); +- +- worldmap_worldmaphumantracker.markColorsDirty(x, z); +- } +- ++ // Plazma start - Optimize framed map tracker ticking ++ if (this.dirtyColorData) { ++ this.minDirtyX = Math.min(this.minDirtyX, x); ++ this.minDirtyY = Math.min(this.minDirtyY, z); ++ this.maxDirtyX = Math.max(this.maxDirtyX, x); ++ this.maxDirtyY = Math.max(this.maxDirtyY, z); ++ } else { ++ this.dirtyColorData = true; ++ this.minDirtyX = x; ++ this.minDirtyY = z; ++ this.maxDirtyX = x; ++ this.maxDirtyY = z; ++ } // diff on change ++ for (final HoldingPlayer tracker : this.carriedBy) { ++ tracker.markColorsDirty(x, z); ++ } // diff on change ++ // Plazma end - Optimize framed map tracker ticking + } + + public void setDecorationsDirty() { +@@ -563,6 +583,7 @@ public class MapItemSavedData extends SavedData { + this.removeDecoration(MapItemSavedData.getFrameKey(id)); + this.frameMarkers.remove(MapFrame.frameId(pos)); + this.setDirty(); ++ this.dirtyFrameDecorations = true; // Plazma - Optimize framed map tracker ticking + } + + public boolean updateColor(int x, int z, byte color) { +@@ -776,4 +797,86 @@ public class MapItemSavedData extends SavedData { + + } + } ++ ++ // Plazma start - Optimize framed map tracker ticking ++ public final @Nullable Packet framedUpdatePacket(MapId id, @Nullable Player player) { ++ return createUpdatePacket(id, player, false); ++ } ++ ++ public final @Nullable Packet fullUpdatePacket(MapId id, @Nullable Player player) { ++ return createUpdatePacket(id, player, true); ++ } ++ ++ public final @Nullable Packet createUpdatePacket(MapId id, @Nullable Player player, boolean full) { ++ if (!dirtyColorData && !dirtyFrameDecorations && (player == null || server.getCurrentTick() % 5 != 0) && !full) ++ // Periodically send update packets if a renderer is added ++ return null; ++ ++ final org.bukkit.craftbukkit.map.RenderData render = player != null ++ ? this.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) player.getBukkitEntity()) ++ : this.vanillaRender; ++ ++ final MapPatch patch; ++ if (full) { ++ patch = createPatch(render.buffer, 0, 0, 127, 127); ++ } else if (dirtyColorData) { ++ dirtyColorData = false; ++ patch = createPatch(render.buffer, this.minDirtyX, this.minDirtyY, this.maxDirtyX, this.maxDirtyY); ++ } else { ++ patch = null; ++ } ++ ++ Collection decorations = null; ++ if (dirtyFrameDecorations || full || hasPluginRenderer) { // Always add decorations when a plugin renderer is added ++ dirtyFrameDecorations = false; ++ decorations = new java.util.ArrayList<>(); ++ ++ if (player == null) { ++ // Using the vanilla renderer, add in vanilla decorations ++ for (MapDecoration decoration : this.decorations.values()) { ++ // Skip sending decorations that are not rendered, i.e., player decorations. ++ // Skipping player decorations also allows sending the same update packet to all tracking players, the only issue ++ // being that it causes a slight flicker of the player decoration for anyone holding and looking at the map. ++ if (decoration.renderOnFrame()) decorations.add(decoration); ++ } ++ } ++ ++ for (final org.bukkit.map.MapCursor cursor : render.cursors) { ++ if (cursor.isVisible()) continue; ++ decorations.add(new MapDecoration(CraftMapCursor.CraftType.bukkitToMinecraftHolder(cursor.getType()), cursor.getX(), cursor.getY(), cursor.getDirection(), Optional.ofNullable(PaperAdventure.asVanilla(cursor.caption())))); ++ } ++ } ++ ++ return new ClientboundMapItemDataPacket(id, this.scale, this.locked, decorations, patch); ++ } ++ ++ private MapPatch createPatch(byte[] buffer, int minDirtyX, int minDirtyY, int maxDirtyX, int maxDirtyY) { ++ int xL = maxDirtyX + 1 - minDirtyX; ++ int yL = maxDirtyY + 1 - minDirtyY; ++ byte[] bytes = new byte[xL * yL]; ++ ++ for (int i = 0; i < xL; ++i) for (int j = 0; j < yL; ++j) ++ bytes[i + j * xL] = buffer[minDirtyX + i + (minDirtyY + j) * 128]; ++ ++ return new MapItemSavedData.MapPatch(minDirtyX, minDirtyY, xL, yL, bytes); ++ } ++ ++ public void addFrameDecoration(net.minecraft.world.entity.decoration.ItemFrame frame) { ++ if (this.trackedDecorationCount >= frame.level().paperConfig().maps.itemFrameCursorLimit || this.frameMarkers.containsKey(MapFrame.frameId(frame.getPos()))) ++ return; ++ ++ MapFrame mapFrame = new MapFrame(frame.getPos(), frame.getDirection().get2DDataValue() * 90, frame.getId()); ++ this.addDecoration(MapDecorationTypes.FRAME, frame.level(), "frame-" + frame.getId(), frame.getPos().getX(), frame.getPos().getZ(), mapFrame.getRotation(), null); ++ this.frameMarkers.put(mapFrame.getId(), mapFrame); ++ } ++ ++ public void markAllDirty() { ++ this.dirtyColorData = true; ++ this.minDirtyX = 0; ++ this.minDirtyY = 0; ++ this.maxDirtyX = 127; ++ this.maxDirtyY = 127; ++ this.dirtyFrameDecorations = true; ++ } ++ // Plazma end - Optimize framed map tracker ticking + } +diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java +index a15cdf64575841edfe30f2b2c522f8fdfe2caae3..d8e8faf38a2fc6ae9846a6a0d2868d0a1418afef 100644 +--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java ++++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java +@@ -97,11 +97,15 @@ public final class CraftMapView implements MapView { + + @Override + public void addRenderer(MapRenderer renderer) { +- if (!this.renderers.contains(renderer)) { +- this.renderers.add(renderer); +- this.canvases.put(renderer, new HashMap()); +- renderer.initialize(this); +- } ++ // Plazma start - Optimize framed map tracker ticking ++ if (this.renderers.contains(renderer)) return; ++ ++ this.renderers.add(renderer); ++ this.canvases.put(renderer, new HashMap<>()); ++ this.worldMap.hasPluginRenderer |= !(renderer instanceof CraftMapRenderer); ++ this.worldMap.hasContextualRenderer |= renderer.isContextual(); ++ renderer.initialize(this); ++ // Plazma end - Optimize framed map tracker ticking + } + + @Override +@@ -116,6 +120,16 @@ public final class CraftMapView implements MapView { + } + } + this.canvases.remove(renderer); ++ // Plazma start - Optimize framed map tracker ticking ++ this.worldMap.hasPluginRenderer = !(this.renderers.size() == 1 && this.renderers.getFirst() instanceof CraftMapRenderer); ++ if (!renderer.isContextual()) return true; ++ ++ // Re-check all renderers ++ boolean contextualFound = false; ++ for (final MapRenderer mapRenderer : this.renderers) contextualFound |= mapRenderer.isContextual(); ++ ++ this.worldMap.hasContextualRenderer = contextualFound; ++ // Plazma end - Optimize framed map tracker ticking + return true; + } else { + return false; diff --git a/patches/server/0052-SparklyPaper-Skip-executeTick-check-if-there-s-no-ta.patch b/patches/server/0052-SparklyPaper-Skip-executeTick-check-if-there-s-no-ta.patch new file mode 100644 index 0000000..ebdccb6 --- /dev/null +++ b/patches/server/0052-SparklyPaper-Skip-executeTick-check-if-there-s-no-ta.patch @@ -0,0 +1,137 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Fri, 13 Dec 2024 21:18:55 +0900 +Subject: [PATCH] SparklyPaper - Skip executeTick check if there's no task to + be run + + +diff --git a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java +index c03608fec96b51e1867f43d8f42e5aefb1520e46..9bb01accce426fafbddc1965a61257a73af8f152 100644 +--- a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java ++++ b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java +@@ -36,8 +36,9 @@ public final class EntityScheduler { + * The Entity. Note that it is the CraftEntity, since only that class properly tracks world transfers. + */ + public final CraftEntity entity; ++ public final net.minecraft.server.MinecraftServer server; // Plazma - Skip executeTick check if there is no any task to be run + +- private static final record ScheduledTask(Consumer run, Consumer retired) {} ++ private record ScheduledTask(Consumer run, Consumer retired) {} // Plazma - minor code improvement + + private long tickCount = 0L; + private static final long RETIRED_TICK_COUNT = -1L; +@@ -46,7 +47,8 @@ public final class EntityScheduler { + + private final ArrayDeque currentlyExecuting = new ArrayDeque<>(); + +- public EntityScheduler(final CraftEntity entity) { ++ public EntityScheduler(final net.minecraft.server.MinecraftServer server, final CraftEntity entity) { // Plazma - Skip executeTick check if there is no any task to be run ++ this.server = Validate.notNull(server); // Plazma - Skip executeTick check if there is no any task to be run + this.entity = Validate.notNull(entity); + } + +@@ -61,15 +63,15 @@ public final class EntityScheduler { + * @throws IllegalStateException If the scheduler is already retired. + */ + public void retire() { ++ final Entity thisEntity = this.entity.getHandleRaw(); // Plazma - Skip executeTick check if there is no any task to be run + synchronized (this.stateLock) { + if (this.tickCount == RETIRED_TICK_COUNT) { + throw new IllegalStateException("Already retired"); + } + this.tickCount = RETIRED_TICK_COUNT; ++ this.server.entitiesWithScheduledTasks.remove(thisEntity); // Plazma - Skip executeTick check if there is no any task to be run + } + +- final Entity thisEntity = this.entity.getHandleRaw(); +- + // correctly handle and order retiring while running executeTick + for (int i = 0, len = this.currentlyExecuting.size(); i < len; ++i) { + final ScheduledTask task = this.currentlyExecuting.pollFirst(); +@@ -124,9 +126,8 @@ public final class EntityScheduler { + if (this.tickCount == RETIRED_TICK_COUNT) { + return false; + } +- this.oneTimeDelayed.computeIfAbsent(this.tickCount + Math.max(1L, delay), (final long keyInMap) -> { +- return new ArrayList<>(); +- }).add(task); ++ this.server.entitiesWithScheduledTasks.add(this.entity.getHandleRaw()); // Plazma - Skip executeTick check if there is no any task to be run ++ this.oneTimeDelayed.computeIfAbsent(this.tickCount + Math.max(1L, delay), ignored -> new ArrayList<>()).add(task); // Plazma - Skip executeTick check if there is no any task to be run + } + + return true; +@@ -143,6 +144,13 @@ public final class EntityScheduler { + TickThread.ensureTickThread(thisEntity, "May not tick entity scheduler asynchronously"); + final List toRun; + synchronized (this.stateLock) { ++ // Plazma start - Skip executeTick check if there is no any task to be run ++ if (this.currentlyExecuting.isEmpty() && this.oneTimeDelayed.isEmpty()) { ++ this.server.entitiesWithScheduledTasks.remove(thisEntity); ++ return; ++ } ++ // Plazma end - Skip executeTick check if there is no any task to be run ++ + if (this.tickCount == RETIRED_TICK_COUNT) { + throw new IllegalStateException("Ticking retired scheduler"); + } +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index e63e6d885054cd926508f9999c8a4eed712d4891..022c4c01ab015a2a6135baa5dbe442fa7a1b4615 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -337,6 +337,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping ++ public final Set entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // Plazma - Skip executeTick check if there is no any task to be run + public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("MobSpawning"); // Pufferfish - optimize mob spawning + + public static S spin(Function serverFactory) { +@@ -1869,17 +1870,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { +- for (final Entity entity : level.getEntities().getAll()) { +- if (entity.isRemoved()) { +- continue; +- } +- final org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw(); +- if (bukkit != null) { +- bukkit.taskScheduler.executeTick(); +- } +- } +- }); ++ // Plazma start - Skip executeTick check if there is no any task to be run ++ for (final Entity entity : entitiesWithScheduledTasks) { ++ if (entity.isRemoved()) continue; ++ ++ final org.bukkit.craftbukkit.entity.CraftEntity craftEntity = entity.getBukkitEntityRaw(); ++ if (craftEntity == null) return; ++ ++ craftEntity.taskScheduler.executeTick(); ++ } ++ // Plazma end - Skip executeTick check if there is no any task to be run + // Paper end - Folia scheduler API + io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper + //gameprofilerfiller.push("commandFunctions"); // Plazma - Completely remove Mojang profilers +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +index 51aee9a468f4ebfa9672fd9ce84883cf080859e3..94bdeaf15a73228ff92b50a22bc3aca41658de8d 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +@@ -72,7 +72,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { + private final CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftEntity.DATA_TYPE_REGISTRY); + protected net.kyori.adventure.pointer.Pointers adventure$pointers; // Paper - implement pointers + // Paper start - Folia shedulers +- public final io.papermc.paper.threadedregions.EntityScheduler taskScheduler = new io.papermc.paper.threadedregions.EntityScheduler(this); ++ public final io.papermc.paper.threadedregions.EntityScheduler taskScheduler; // Plazma - Skip executeTick check if there is no any task to be run + private final io.papermc.paper.threadedregions.scheduler.FoliaEntityScheduler apiScheduler = new io.papermc.paper.threadedregions.scheduler.FoliaEntityScheduler(this); + + @Override +@@ -85,6 +85,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { + this.server = server; + this.entity = entity; + this.entityType = CraftEntityType.minecraftToBukkit(entity.getType()); ++ this.taskScheduler = new io.papermc.paper.threadedregions.EntityScheduler(this.entity.getServer(), this); // Plazma - Skip executeTick check if there is no any task to be run + } + + // Purpur start - API for any mob to burn daylight diff --git a/patches/server/0053-SparklyPaper-MSPT-by-World.patch b/patches/server/0053-SparklyPaper-MSPT-by-World.patch new file mode 100644 index 0000000..f5ac535 --- /dev/null +++ b/patches/server/0053-SparklyPaper-MSPT-by-World.patch @@ -0,0 +1,177 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Fri, 13 Dec 2024 23:36:03 +0900 +Subject: [PATCH] SparklyPaper - MSPT by World + + +diff --git a/src/main/java/io/papermc/paper/command/MSPTCommand.java b/src/main/java/io/papermc/paper/command/MSPTCommand.java +index 8b5293b0c696ef21d0101493ffa41b60bf0bc86b..bf3a6e8e35fe9869dfa56a97dd5d820296de9721 100644 +--- a/src/main/java/io/papermc/paper/command/MSPTCommand.java ++++ b/src/main/java/io/papermc/paper/command/MSPTCommand.java +@@ -25,6 +25,29 @@ import static net.kyori.adventure.text.format.NamedTextColor.YELLOW; + public final class MSPTCommand extends Command { + private static final DecimalFormat DF = new DecimalFormat("########0.0"); + private static final Component SLASH = text("/"); ++ // Plazma start - MSPT by world ++ private static final Component COMMA = text(", ", YELLOW); ++ private static final Component HEADER = text().color(YELLOW).append( ++ text("("), ++ text("avg", GRAY), ++ text("/"), ++ text("min", GRAY), ++ text("/"), ++ text("max", GRAY), ++ text(")") ++ ).append( ++ text(" from last 1s"), ++ text(",", GRAY), ++ text(" 5s"), ++ text(",", GRAY), ++ text(" 10s"), ++ text(",", GRAY), ++ text(" 30s"), ++ text(",", GRAY), ++ text(" 1m"), ++ text(":", YELLOW) ++ ).build(); ++ // Plazma end - MSPT by world + + public MSPTCommand(final String name) { + super(name); +@@ -45,39 +68,44 @@ public final class MSPTCommand extends Command { + MinecraftServer server = MinecraftServer.getServer(); + + List times = new ArrayList<>(); ++ // Plazma start - MSPT by world ++ times.addAll(eval(server.tickTimes1s.getTimes())); + times.addAll(eval(server.tickTimes5s.getTimes())); + times.addAll(eval(server.tickTimes10s.getTimes())); ++ times.addAll(eval(server.tickTimes30s.getTimes())); + times.addAll(eval(server.tickTimes60s.getTimes())); + +- sender.sendMessage(text().content("Server tick times ").color(GOLD) +- .append(text().color(YELLOW) +- .append( +- text("("), +- text("avg", GRAY), +- text("/"), +- text("min", GRAY), +- text("/"), +- text("max", GRAY), +- text(")") +- ) +- ).append( +- text(" from last 5s"), +- text(",", GRAY), +- text(" 10s"), +- text(",", GRAY), +- text(" 1m"), +- text(":", YELLOW) +- ) +- ); +- sender.sendMessage(text().content("◴ ").color(GOLD) +- .append(text().color(GRAY) +- .append( +- times.get(0), SLASH, times.get(1), SLASH, times.get(2), text(", ", YELLOW), +- times.get(3), SLASH, times.get(4), SLASH, times.get(5), text(", ", YELLOW), +- times.get(6), SLASH, times.get(7), SLASH, times.get(8) +- ) +- ) +- ); ++ sender.sendMessage(text().content("Server tick times ").color(GOLD).append(HEADER)); ++ sender.sendMessage(text().content("◴ ").color(GOLD).append(text().color(GRAY).append( ++ times.get(0), SLASH, times.get(1), SLASH, times.get(2), COMMA, ++ times.get(3), SLASH, times.get(4), SLASH, times.get(5), COMMA, ++ times.get(6), SLASH, times.get(7), SLASH, times.get(8), COMMA, ++ times.get(9), SLASH, times.get(10), SLASH, times.get(11), COMMA, ++ times.get(12), SLASH, times.get(13), SLASH, times.get(14) ++ ))); ++ ++ sender.sendMessage(text()); ++ sender.sendMessage(text().content("World tick times ").color(GOLD).append(HEADER)); ++ for (net.minecraft.server.level.ServerLevel serverLevel : server.getAllLevels()) { ++ List worldTimes = new ArrayList<>(); ++ worldTimes.addAll(eval(serverLevel.tickTimes1s.getTimes())); ++ worldTimes.addAll(eval(serverLevel.tickTimes5s.getTimes())); ++ worldTimes.addAll(eval(serverLevel.tickTimes10s.getTimes())); ++ worldTimes.addAll(eval(serverLevel.tickTimes30s.getTimes())); ++ worldTimes.addAll(eval(serverLevel.tickTimes60s.getTimes())); ++ ++ sender.sendMessage(text().content("◴ " + serverLevel.getWorld().getName() + ": ").color(GOLD).append( ++ text().color(GRAY).append( ++ worldTimes.get(0), SLASH, worldTimes.get(1), SLASH, worldTimes.get(2), COMMA, ++ worldTimes.get(3), SLASH, worldTimes.get(4), SLASH, worldTimes.get(5), COMMA, ++ worldTimes.get(6), SLASH, worldTimes.get(7), SLASH, worldTimes.get(8), COMMA, ++ worldTimes.get(9), SLASH, worldTimes.get(10), SLASH, worldTimes.get(11), COMMA, ++ worldTimes.get(12), SLASH, worldTimes.get(13), SLASH, worldTimes.get(14) ++ )) ++ ); ++ } ++ // Plazma end - MSPT by world ++ + return true; + } + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 022c4c01ab015a2a6135baa5dbe442fa7a1b4615..26c5cb68b464305fde43e2e0e1a415a2425483ea 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -264,8 +264,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop WorldDataServer + public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { + // Plazma start - Configurable Plazma diff --git a/patches/server/0054-SparklyPaper-Optimize-farm-check.patch b/patches/server/0054-SparklyPaper-Optimize-farm-check.patch new file mode 100644 index 0000000..8feb98c --- /dev/null +++ b/patches/server/0054-SparklyPaper-Optimize-farm-check.patch @@ -0,0 +1,275 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Fri, 13 Dec 2024 23:36:36 +0900 +Subject: [PATCH] SparklyPaper - Optimize farm check + + +diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java +index 33c27909290ff3ab483226cf65b1a1bc2e983cbc..df4bb6a77775fe7aab3f47c13c9755a7374d0761 100644 +--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java +@@ -77,35 +77,52 @@ public class CropBlock extends BushBlock implements BonemealableBlock { + + @Override + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { +- if (world.getRawBrightness(pos, 0) >= 9) { +- int i = this.getAge(state); +- +- if (i < this.getMaxAge()) { +- float f = CropBlock.getGrowthSpeed(this, world, pos); +- +- // Spigot start +- int modifier; +- if (this == Blocks.BEETROOTS) { +- modifier = world.spigotConfig.beetrootModifier; +- } else if (this == Blocks.CARROTS) { +- modifier = world.spigotConfig.carrotModifier; +- } else if (this == Blocks.POTATOES) { +- modifier = world.spigotConfig.potatoModifier; +- // Paper start - Fix Spigot growth modifiers +- } else if (this == Blocks.TORCHFLOWER_CROP) { +- modifier = world.spigotConfig.torchFlowerModifier; +- // Paper end - Fix Spigot growth modifiers +- } else { +- modifier = world.spigotConfig.wheatModifier; +- } +- +- if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution +- // Spigot end +- CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2); // CraftBukkit +- } ++ // Plazma start - Optimize farm check ++ if (world.getRawBrightness(pos, 0) < 9) return; ++// PLAZMA - REMOVE THIS ++ int age = this.getAge(state); ++ if (age >= this.getMaxAge()) return; ++// PLAZMA - REMOVE THIS ++ // Spigot start ++ int modifier = switch (this) { ++ case BeetrootBlock ignored -> world.spigotConfig.beetrootModifier; ++ case CarrotBlock ignored -> world.spigotConfig.carrotModifier; ++ case PotatoBlock ignored -> world.spigotConfig.potatoModifier; ++ case TorchflowerCropBlock ignored -> world.spigotConfig.torchFlowerModifier; ++ default -> world.spigotConfig.wheatModifier; ++ }; ++ ++ if (world.plazmaConfig().block.optimizedFarmCheck.enabled) { ++ final BlockPos below = pos.below(); ++ final BlockState belowState = world.getBlockState(below); ++ ++ boolean isMoist = false; ++ float growthSpeed = world.plazmaConfig().block.optimizedFarmCheck.growthSpeed.base; ++ if (belowState.is(Blocks.FARMLAND) && belowState.getValue(FarmBlock.MOISTURE) > 0) { ++ growthSpeed = world.plazmaConfig().block.optimizedFarmCheck.growthSpeed.moist; ++ isMoist = true; ++ } ++// PLAZMA - REMOVE THIS ++ if (world.plazmaConfig().block.optimizedFarmCheck.skipMiddleAges) { ++ growthSpeed /= getMaxAge(); ++ age = getMaxAge() - 1; ++ } ++// PLAZMA - REMOVE THIS ++ if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / growthSpeed) + 1))))) { ++ if (!CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(age + 1), 2)) return; ++ if ((age + 1) != getMaxAge() || !isMoist || FarmBlock.isNearWater(world, below)) return; ++// PLAZMA - REMOVE THIS ++ CraftEventFactory.handleMoistureChangeEvent(world, below, state.setValue(FarmBlock.MOISTURE, 0), 2); + } + } +- ++// PLAZMA - REMOVE THIS ++ float growthSpeed = CropBlock.getGrowthSpeed(this, world, pos); // Plazma - moved down ++// PLAZMA - REMOVE THIS ++ if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / growthSpeed) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution ++ // Spigot end ++ CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(age + 1), 2); // CraftBukkit ++ } ++ // Plazma end - Optimize farm check + } + + public void growCrops(Level world, BlockPos pos, BlockState state) { +diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java +index eaac00e2534aca4eab92c7b9f9248e04b35b47df..14f807b6214529d909fd93cc7ce28eb712975f8c 100644 +--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java +@@ -92,20 +92,29 @@ public class FarmBlock extends Block { + + @Override + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { +- int i = (Integer) state.getValue(FarmBlock.MOISTURE); +- if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks +- if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks +- +- if (!FarmBlock.isNearWater(world, pos) && !world.isRainingAt(pos.above())) { +- if (i > 0) { +- org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, pos, (BlockState) state.setValue(FarmBlock.MOISTURE, i - 1), 2); // CraftBukkit +- } else if (!FarmBlock.shouldMaintainFarmland(world, pos)) { +- FarmBlock.turnToDirt((Entity) null, state, world, pos); +- } +- } else if (i < 7) { +- org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, pos, (BlockState) state.setValue(FarmBlock.MOISTURE, 7), 2); // CraftBukkit +- } +- ++ // Plazma start - Optimize farm check ++ int moistLevel = state.getValue(MOISTURE); ++ if (world.plazmaConfig().block.optimizedFarmCheck.enabled) { ++ if (moistLevel != 0) return; ++// PLAZMA - REMOVE THIS ++ if (isNearWater(world, pos)) ++ CraftEventFactory.handleMoistureChangeEvent(world, pos, state.setValue(MOISTURE, 7), 2); ++ else ++ turnToDirt(null, state, world, pos); ++ return; ++ } // diff on change ++// PLAZMA - REMOVE THIS ++ if (moistLevel > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks ++ if (moistLevel == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks ++// PLAZMA - REMOVE THIS ++ if (!isNearWater(world, pos) && !world.isRainingAt(pos.above())) { ++ if (moistLevel > 0) ++ CraftEventFactory.handleMoistureChangeEvent(world, pos, state.setValue(MOISTURE, moistLevel - 1), 2); // CraftBukkit ++ else if (!shouldMaintainFarmland(world, pos)) ++ turnToDirt(null, state, world, pos); ++ } else if (moistLevel < 7) ++ CraftEventFactory.handleMoistureChangeEvent(world, pos, state.setValue(MOISTURE, 7), 2); // CraftBukkit ++ // Plazma end - Optimize farm check + } + + @Override +@@ -169,7 +178,7 @@ public class FarmBlock extends Block { + return world.getBlockState(pos.above()).is(BlockTags.MAINTAINS_FARMLAND); + } + +- private static boolean isNearWater(LevelReader world, BlockPos pos) { ++ static boolean isNearWater(LevelReader world, BlockPos pos) { // Plazma - AT (private -> package-private) + // Paper start - Perf: remove abstract block iteration + int xOff = pos.getX(); + int yOff = pos.getY(); +diff --git a/src/main/java/net/minecraft/world/level/block/StemBlock.java b/src/main/java/net/minecraft/world/level/block/StemBlock.java +index 76109aceb24a4719d49c1a55e3621cf2a63bbe16..00b3275305b5f1c2ea2516dcad3c7c62f06db49f 100644 +--- a/src/main/java/net/minecraft/world/level/block/StemBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/StemBlock.java +@@ -72,38 +72,66 @@ public class StemBlock extends BushBlock implements BonemealableBlock { + + @Override + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { +- if (world.getRawBrightness(pos, 0) >= 9) { +- float f = CropBlock.getGrowthSpeed(this, world, pos); +- +- if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution +- int i = (Integer) state.getValue(StemBlock.AGE); +- +- if (i < 7) { +- state = (BlockState) state.setValue(StemBlock.AGE, i + 1); +- CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit +- } else { +- Direction enumdirection = Direction.Plane.HORIZONTAL.getRandomDirection(random); +- BlockPos blockposition1 = pos.relative(enumdirection); +- BlockState iblockdata1 = world.getBlockState(blockposition1.below()); +- +- if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) { +- Registry iregistry = world.registryAccess().lookupOrThrow(Registries.BLOCK); +- Optional optional = iregistry.getOptional(this.fruit); +- Optional optional1 = iregistry.getOptional(this.attachedStem); +- +- if (optional.isPresent() && optional1.isPresent()) { +- // CraftBukkit start +- if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) { +- return; +- } +- // CraftBukkit end +- world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection)); +- } +- } +- } ++ if (world.getRawBrightness(pos, 0) < 9) return; ++// PLAZMA - REMOVE THIS ++ if (world.plazmaConfig().block.optimizedFarmCheck.enabled) { ++ final BlockPos below = pos.below(); ++ final BlockState belowState = world.getBlockState(below); ++// PLAZMA - REMOVE THIS ++ boolean isMoist = false; ++ float growthSpeed = world.plazmaConfig().block.optimizedFarmCheck.growthSpeed.base; ++ if (belowState.is(Blocks.FARMLAND) && belowState.getValue(BlockStateProperties.MOISTURE) > 0) { ++ growthSpeed = world.plazmaConfig().block.optimizedFarmCheck.growthSpeed.moist; ++ isMoist = true; + } +- ++// PLAZMA - REMOVE THIS ++ if (random.nextFloat() >= ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / growthSpeed) + 1))))) return; ++// PLAZMA - REMOVE THIS ++ int age = state.getValue(StemBlock.AGE); ++ if (age < 7) { ++ CraftEventFactory.handleBlockGrowEvent(world, pos, state.setValue(StemBlock.AGE, age + 1), 2); ++ return; ++ } ++// PLAZMA - REMOVE THIS ++ final Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(random); ++ final BlockPos blockPos = pos.relative(direction); ++ final BlockState belowState1 = world.getBlockState(blockPos.below()); ++ if (!world.getBlockState(blockPos).isAir() || (!belowState1.is(Blocks.FARMLAND) && !belowState1.is(BlockTags.DIRT))) return; ++// PLAZMA - REMOVE THIS ++ final Registry registry = world.registryAccess().lookupOrThrow(Registries.BLOCK); ++ final Optional fruit = registry.getOptional(this.fruit); ++ final Optional stem = registry.getOptional(this.attachedStem); ++ if (fruit.isEmpty() || stem.isEmpty()) return; ++// PLAZMA - REMOVE THIS ++ if (!CraftEventFactory.handleBlockGrowEvent(world, blockPos, fruit.get().defaultBlockState())) return; // CraftBukkit ++ if (isMoist && !FarmBlock.isNearWater(world, blockPos)) ++ CraftEventFactory.handleMoistureChangeEvent(world, blockPos, belowState1.setValue(BlockStateProperties.MOISTURE, 0), 2); ++// PLAZMA - REMOVE THIS ++ world.setBlockAndUpdate(pos, stem.get().defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, direction)); ++ return; ++ } ++// PLAZMA - REMOVE THIS ++ if (random.nextFloat() >= ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / CropBlock.getGrowthSpeed(this, world, pos)) + 1))))) return; // Spigot - SPIGOT-7159: Better modifier resolution ++// PLAZMA - REMOVE THIS ++ final int age = state.getValue(StemBlock.AGE); ++ if (age < 7) { ++ state = state.setValue(StemBlock.AGE, age + 1); ++ CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit ++ return; + } ++// PLAZMA - REMOVE THIS ++ final Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(random); ++ final BlockPos blockPos = pos.relative(direction); ++ final BlockState belowState = world.getBlockState(blockPos.below()); ++ if (!world.getBlockState(blockPos).isAir() || (!belowState.is(Blocks.FARMLAND) && !belowState.is(BlockTags.DIRT))) return; ++// PLAZMA - REMOVE THIS ++ final Registry registry = world.registryAccess().lookupOrThrow(Registries.BLOCK); ++ final Optional fruit = registry.getOptional(this.fruit); ++ final Optional stem = registry.getOptional(this.attachedStem); ++ if (fruit.isEmpty() || stem.isEmpty()) return; ++// PLAZMA - REMOVE THIS ++ if (!CraftEventFactory.handleBlockGrowEvent(world, blockPos, fruit.get().defaultBlockState())) return; // CraftBukkit ++ world.setBlockAndUpdate(pos, stem.get().defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, direction)); + } + + @Override +diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +index bab5f682b8aeaa6dfcda7f07499ae297cbcbe23e..f822b544d98602be85bf0c54a6040a5907b1906e 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +@@ -81,6 +81,22 @@ public class WorldConfigurations extends ConfigurationPart { + + } + ++ public OptimizedFarmCheck optimizedFarmCheck; ++ public class OptimizedFarmCheck extends ConfigurationPart { ++ ++ public boolean enabled = OPTIMIZE; ++ public boolean skipMiddleAges = false; ++ ++ public GrowthSpeed growthSpeed; ++ public class GrowthSpeed extends ConfigurationPart { ++ ++ public float base = 1.0f; ++ public float moist = 5.0f; ++ ++ } ++ ++ } ++ + } + + public Item item; diff --git a/patches/server/0055-SparklyPaper-Optimize-season-check.patch b/patches/server/0055-SparklyPaper-Optimize-season-check.patch new file mode 100644 index 0000000..984f3e0 --- /dev/null +++ b/patches/server/0055-SparklyPaper-Optimize-season-check.patch @@ -0,0 +1,146 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Fri, 13 Dec 2024 23:37:17 +0900 +Subject: [PATCH] SparklyPaper - Optimize season check + + +diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java +index 0d3f4702c8bf3d66b01b42c5da1761e93e1d6ed2..a749adca6c758c0008ab8b27f307ac4570c82652 100644 +--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java ++++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java +@@ -324,15 +324,19 @@ public class Bat extends AmbientCreature { + private static boolean isSpookySeason = false; + private static final int ONE_HOUR = 20 * 60 * 60; + private static int lastSpookyCheck = -ONE_HOUR; +- public static boolean isHalloweenSeason(Level level) { return level.purpurConfig.forceHalloweenSeason || isHalloween(); } // Purpur ++ ++ public static boolean isHalloweenSeason(Level level) { ++ return level.purpurConfig.forceHalloweenSeason || net.sparklypower.sparklypaper.HalloweenManager.isInSeason() || isHalloween(); ++ } ++ + private static boolean isHalloween() { + if (net.minecraft.server.MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) { +- LocalDate localdate = LocalDate.now(); +- int i = localdate.get(ChronoField.DAY_OF_MONTH); +- int j = localdate.get(ChronoField.MONTH_OF_YEAR); ++ LocalDate now = LocalDate.now(); ++ int day = now.getDayOfMonth(); ++ int month = now.getMonth().getValue(); + +- isSpookySeason = j == 10 && i >= 20 || j == 11 && i <= 3; +- lastSpookyCheck = net.minecraft.server.MinecraftServer.currentTick; ++ isSpookySeason = month == 10 && day >= 20 || month == 11 && day <= 3; ++ lastSpookyCheck = net.minecraft.server.MinecraftServer.currentTick; + } + return isSpookySeason; + } +diff --git a/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java b/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java +new file mode 100644 +index 0000000000000000000000000000000000000000..530bac5a415c8597ae76ec603c1d8158535c66d0 +--- /dev/null ++++ b/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java +@@ -0,0 +1,82 @@ ++package net.sparklypower.sparklypaper; ++ ++import com.mojang.logging.LogUtils; ++import org.jetbrains.annotations.Nullable; ++import org.slf4j.Logger; ++import java.time.LocalDateTime; ++import java.time.Month; ++import java.time.ZoneOffset; ++import java.util.concurrent.CountDownLatch; ++import java.util.concurrent.Executors; ++import java.util.concurrent.ScheduledExecutorService; ++import java.util.concurrent.TimeUnit; ++import java.util.concurrent.atomic.AtomicBoolean; ++ ++public final class HalloweenManager { ++ ++ private static final Logger LOGGER = LogUtils.getLogger(); ++ public static @Nullable net.sparklypower.sparklypaper.HalloweenManager INSTANCE; ++ ++ private long seasonStartEpoch = 0L; ++ private long seasonEndEpoch = 0L; ++ ++ private final ScheduledExecutorService EXECUTOR = Executors.newSingleThreadScheduledExecutor(runnable -> { ++ final Thread thread = new Thread(runnable); ++ thread.setName("halloween-timer-updater"); ++ thread.setPriority(1); ++ return thread; ++ }); ++ ++ public HalloweenManager() { ++ final AtomicBoolean first = new AtomicBoolean(true); ++ final CountDownLatch LATCH = new CountDownLatch(1); ++ ++ try { ++ EXECUTOR.scheduleAtFixedRate(() -> { ++ updateEpoch(); ++ if (first.get()) LATCH.countDown(); ++ first.set(false); ++ }, 0L, 90L, TimeUnit.DAYS); ++ ++ LATCH.await(); ++ } catch (InterruptedException e) { ++ LOGGER.error("Interrupted while waiting for HalloweenManager to start", e); ++ } ++ } ++ ++ public @Nullable HalloweenManager close() { ++ EXECUTOR.shutdownNow(); ++ return null; ++ } ++ ++ public static boolean isInSeason() { ++ return INSTANCE != null && INSTANCE.isSeason(); ++ } ++ ++ private boolean isSeason() { ++ return this.seasonStartEpoch <= System.currentTimeMillis() && System.currentTimeMillis() < this.seasonEndEpoch; ++ } ++ ++ private void updateEpoch() { ++ LOGGER.info("Updating Spooky Season and Halloween Time"); ++ this.seasonStartEpoch = millisFromDate(20, 10, false); ++ this.seasonEndEpoch = millisFromDate(3, 11, true); ++ LOGGER.info("Updated Spooky Season and Halloween Time!"); ++ } ++ ++ private static long millisFromDate(int day, int month, boolean endOfMonth) { ++ LocalDateTime target = LocalDateTime.of( ++ LocalDateTime.now().getYear(), ++ Month.of(month), ++ day, ++ endOfMonth ? 23 : 0, ++ endOfMonth ? 59 : 0, ++ endOfMonth ? 59 : 0, ++ endOfMonth ? 999_999_999 : 0 ++ ); ++ ++ return (LocalDateTime.now().isAfter(target) ? target.plusYears(1) : target) ++ .atZone(ZoneOffset.systemDefault()).toInstant().toEpochMilli(); ++ } ++ ++} +diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +index 2e1cf5f79556250aa22df3ade66393fe6a947659..b5b252c79b9508200d9d0bd15f0469b0cb0fd3b3 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +@@ -143,6 +143,17 @@ public class GlobalConfiguration extends ConfigurationPart { + public class Miscellaneous extends ConfigurationPart { + + public boolean resetDirtyWhenLoadingMapsFromDisk = false; ++ public boolean optimizeHalloweenCheck = OPTIMIZE; ++ ++ @PostProcess ++ void post() { ++ net.sparklypower.sparklypaper.HalloweenManager manager = net.sparklypower.sparklypaper.HalloweenManager.INSTANCE; ++ ++ if (manager == null && this.optimizeHalloweenCheck) ++ net.sparklypower.sparklypaper.HalloweenManager.INSTANCE = new net.sparklypower.sparklypaper.HalloweenManager(); ++ else if (manager != null && !this.optimizeHalloweenCheck) ++ net.sparklypower.sparklypaper.HalloweenManager.INSTANCE = manager.close(); ++ } + + } + diff --git a/patches/server/0056-SparklyPaper-Optimize-tickingBlockEntity.patch b/patches/server/0056-SparklyPaper-Optimize-tickingBlockEntity.patch new file mode 100644 index 0000000..93d78ec --- /dev/null +++ b/patches/server/0056-SparklyPaper-Optimize-tickingBlockEntity.patch @@ -0,0 +1,218 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Fri, 13 Dec 2024 23:52:46 +0900 +Subject: [PATCH] SparklyPaper - Optimize tickingBlockEntity + + +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index 332c1d890eefb0c705200a61b8bc7369457bc3af..ca7d4efd7b813c58169d251b23cf6a6fa71c9cee 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -1526,28 +1526,42 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + + int tickedEntities = 0; // Paper - rewrite chunk system + +- int tilesThisCycle = 0; +- var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet(); // Paper - Fix MC-117075; use removeAll ++ // Plazma start - Optimize tickingBlockEntity ++ int shouldTickBlocksAtLastResult = -1; ++ long shouldTickBlocksAtChunkPos = 0L; ++ final it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet toRemove = ++ new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>(); // Paper - Fix MC-117075; use removeAll ++ + toRemove.add(null); // Paper - Fix MC-117075 + for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters +- this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0; +- TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition); +- // Spigot end +- +- if (tickingblockentity.isRemoved()) { +- // Spigot start +- tilesThisCycle--; +- toRemove.add(tickingblockentity); // Paper - Fix MC-117075; use removeAll +- // Spigot end +- } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) { +- tickingblockentity.tick(); +- // Paper start - rewrite chunk system +- if ((++tickedEntities & 7) == 0) { +- ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)(Level)(Object)this).moonrise$midTickTasks(); ++ TickingBlockEntity tickingEntity = this.blockEntityTickers.get(this.tileTickPosition); ++ ++ if (tickingEntity.isRemoved()) { ++ toRemove.add(tickingEntity); // Paper - Fix MC-117075; use removeAll ++ continue; ++ } ++ ++ if (flag) { ++ long pos = tickingEntity.getChunkCoordinateKey(); ++ ++ boolean shouldTick; ++ if (shouldTickBlocksAtChunkPos == pos && shouldTickBlocksAtLastResult != -1) { ++ shouldTick = shouldTickBlocksAtLastResult == 1; ++ } else { ++ shouldTick = this.shouldTickBlocksAt(pos); ++ shouldTickBlocksAtLastResult = shouldTick ? 1 : 0; ++ shouldTickBlocksAtChunkPos = pos; + } +- // Paper end - rewrite chunk system ++ ++ if (!shouldTick) continue; ++ ++ tickingEntity.tick(); ++ if ((++tickedEntities & 7) != 0) continue; ++ ++ this.moonrise$midTickTasks(); + } + } ++ // Plazma end - Optimize tickingBlockEntity + this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 + + this.tickingBlockEntities = false; +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java +index 28e3b73507b988f7234cbf29c4024c88180d0aef..de15cbda0c180e0d071ce7ac41d2fd1aeca60985 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java +@@ -10,4 +10,6 @@ public interface TickingBlockEntity { + BlockPos getPos(); + + String getType(); ++ ++ long getChunkCoordinateKey(); // Plazma - Optimize tickingBlockEntity + } +diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +index 3c92e6b52394eed3ac66d44973288e4de2c133cc..2966caede97e01b5ad15a0d56232a0f5526685e2 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -75,6 +75,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + public String getType() { + return ""; + } ++ ++ @Override public long getChunkCoordinateKey() { return 0; } // Plazma - Optimize tickingBlockEntity; + }; + private final Map tickersInLevel; + public boolean loaded; +@@ -995,7 +997,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + } + + private TickingBlockEntity createTicker(T blockEntity, BlockEntityTicker blockEntityTicker) { +- return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, blockEntityTicker); ++ return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, blockEntityTicker, this.coordinateKey); // Plazma - Optimize tickingBlockEntity + } + + @FunctionalInterface +@@ -1049,8 +1051,15 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + return this.ticker.getType(); + } + ++ @Override // Plazma - minor code improvement + public String toString() { +- return String.valueOf(this.ticker) + " "; ++ return this.ticker + " "; // Plazma - minor code improvement ++ } ++ ++ // Plazma start - Optimize tickingBlockEntity ++ @Override ++ public long getChunkCoordinateKey() { ++ return this.ticker.getChunkCoordinateKey(); + } + } + +@@ -1059,51 +1068,45 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + private final T blockEntity; + private final BlockEntityTicker ticker; + private boolean loggedInvalidBlockState; ++ private final long chunkCoordinateKey; + +- BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker) { +- this.blockEntity = (T) tileentity; // CraftBukkit - decompile error +- this.ticker = blockentityticker; ++ BoundTickingBlockEntity(final T blockEntity, final BlockEntityTicker ticker, final long chunkCoordinateKey) { ++ this.blockEntity = blockEntity; ++ this.ticker = ticker; ++ this.chunkCoordinateKey = chunkCoordinateKey; + } + + @Override + public void tick() { +- if (!this.blockEntity.isRemoved() && this.blockEntity.hasLevel()) { +- BlockPos blockposition = this.blockEntity.getBlockPos(); ++ if (this.blockEntity.isRemoved() || !this.blockEntity.hasLevel()) return; + +- if (LevelChunk.this.isTicking(blockposition)) { +- try { +- //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler +- +- //gameprofilerfiller.push(this::getType); // Plazma - Completely remove Mojang profiler +- BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); ++ BlockPos pos = this.blockEntity.getBlockPos(); ++ if (!LevelChunk.this.isTicking(pos)) return; + +- if (this.blockEntity.getType().isValid(iblockdata)) { +- this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity); +- this.loggedInvalidBlockState = false; +- // Paper start - Remove the Block Entity if it's invalid +- } else { +- LevelChunk.this.removeBlockEntity(this.getPos()); +- if (!this.loggedInvalidBlockState) { +- this.loggedInvalidBlockState = true; +- LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata}); +- } +- // Paper end - Remove the Block Entity if it's invalid +- } ++ try { ++ BlockState state = LevelChunk.this.getBlockState(pos); + +- //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler +- } catch (Throwable throwable) { +- if (throwable instanceof ThreadDeath) throw throwable; // Paper +- // Paper start - Prevent block entity and entity crashes +- final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); +- net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable); +- net.minecraft.world.level.chunk.LevelChunk.this.level.getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent +- LevelChunk.this.removeBlockEntity(this.getPos()); +- // Paper end - Prevent block entity and entity crashes +- // Spigot start ++ if (this.blockEntity.getType().isValid(state)) { ++ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), state, this.blockEntity); ++ this.loggedInvalidBlockState = false; ++ // Paper start - Remove the Block Entity if it's invalid ++ } else { ++ LevelChunk.this.removeBlockEntity(this.getPos()); ++ if (!this.loggedInvalidBlockState) { ++ this.loggedInvalidBlockState = true; ++ LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", LogUtils.defer(this::getType), LogUtils.defer(this::getPos), state); + } ++ // Paper end - Remove the Block Entity if it's invalid + } ++ } catch (Throwable throwable) { ++ if (throwable instanceof ThreadDeath) throw throwable; // Paper ++ // Paper start - Prevent block entity and entity crashes ++ final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); ++ net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable); ++ LevelChunk.this.level.getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent ++ LevelChunk.this.removeBlockEntity(this.getPos()); ++ // Paper end - Prevent block entity and entity crashes + } +- + } + + @Override +@@ -1121,10 +1124,15 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + return BlockEntityType.getKey(this.blockEntity.getType()).toString(); + } + ++ @Override + public String toString() { +- String s = this.getType(); ++ return "Level ticker for " + this.getType() + "@" + this.getPos(); ++ } + +- return "Level ticker for " + s + "@" + String.valueOf(this.getPos()); ++ @Override ++ public long getChunkCoordinateKey() { ++ return this.chunkCoordinateKey; + } ++ // Plazma end - Optimize tickingBlockEntity + } + } diff --git a/patches/server/0057-Implement-CarpetFixes.patch b/patches/server/0057-Implement-CarpetFixes.patch new file mode 100644 index 0000000..8176e99 --- /dev/null +++ b/patches/server/0057-Implement-CarpetFixes.patch @@ -0,0 +1,227 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Sat, 14 Dec 2024 00:29:15 +0900 +Subject: [PATCH] Implement CarpetFixes + + +diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java +index 0503f936d0d7194f110069adabff984f51af0a3a..0ca88636cca9b8f93cddf8bc58038e626e171df8 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java ++++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java +@@ -379,19 +379,22 @@ public class Sheep extends Animal implements Shearable { + } + + private DyeColor getOffspringColor(ServerLevel world, Sheep firstParent, Sheep secondParent) { +- DyeColor enumcolor = firstParent.getColor(); +- DyeColor enumcolor1 = secondParent.getColor(); +- CraftingInput craftinginput = Sheep.makeCraftInput(enumcolor, enumcolor1); +- Optional optional = world.recipeAccess().getRecipeFor(RecipeType.CRAFTING, craftinginput, world).map((recipeholder) -> { // CraftBukkit - decompile error +- return ((CraftingRecipe) recipeholder.value()).assemble(craftinginput, world.registryAccess()); +- }).map(ItemStack::getItem); +- +- Objects.requireNonNull(DyeItem.class); +- optional = optional.filter(DyeItem.class::isInstance); +- Objects.requireNonNull(DyeItem.class); +- return (DyeColor) optional.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> { +- return world.random.nextBoolean() ? enumcolor : enumcolor1; +- }); ++ // Plazma start - Implement CarpetFixes ++ final DyeColor firstColor = firstParent.getColor(); ++ final DyeColor secondColor = secondParent.getColor(); ++// PLAZMA - REMOVE THIS ++ if (world.plazmaConfig().carpetFixes.preparedSheepChildColor) { ++ final DyeColor color = org.plazmamc.plazma.util.CarpetFixes.properDyeMixin(firstColor, secondColor); ++ if (color != null) return color; ++ return world.random.nextBoolean() ? firstColor : secondColor; ++ } ++// PLAZMA - REMOVE THIS ++ final CraftingInput input = Sheep.makeCraftInput(firstColor, secondColor); ++// PLAZMA - REMOVE THIS ++ Optional result = world.recipeAccess().getRecipeFor(RecipeType.CRAFTING, input, world).map((recipeholder) -> recipeholder.value().assemble(input, world.registryAccess())).map(ItemStack::getItem); ++ result = result.filter(DyeItem.class::isInstance); ++ return result.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> world.random.nextBoolean() ? firstColor : secondColor); ++ // Plazma end - Implement CarpetFixes + } + + private static CraftingInput makeCraftInput(DyeColor firstColor, DyeColor secondColor) { +diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java +index 90f8360f547ce709fd13ee34f8e67d8bfa94b498..4e5fb377696c0a98a56f9ea11d0116b28399c8f6 100644 +--- a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java ++++ b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java +@@ -9,6 +9,8 @@ import net.minecraft.util.Mth; + + public class BiomeManager { + public static final int CHUNK_CENTER_QUART = QuartPos.fromBlock(8); ++ public static boolean PLAZMA_CARPET_FIXES = false; // Plazma - Implement CarpetFixes ++ private static final double MAX_OFFSET = 0.450_000_000_1; // Plazma - Implement CarpetFixes + private static final int ZOOM_BITS = 2; + private static final int ZOOM = 4; + private static final int ZOOM_MASK = 3; +@@ -29,6 +31,79 @@ public class BiomeManager { + } + + public Holder getBiome(BlockPos pos) { ++ // Plazma start - Implement CarpetFixes ++ if (PLAZMA_CARPET_FIXES) { ++ final int x2 = pos.getX() - 2; ++ final int y2 = pos.getY() - 2; ++ final int z2 = pos.getZ() - 2; ++ ++ final int x = x2 >> 2; ++ final int y = y2 >> 2; ++ final int z = z2 >> 2; ++ ++ final double qX = (x2 & 3) / 4.0D; ++ final double qY = (y2 & 3) / 4.0D; ++ final double qZ = (z2 & 3) / 4.0D; ++ ++ int minX = 0; ++ double minD = Double.POSITIVE_INFINITY; ++ for (int bX = 0; bX < 8; ++bX) { ++ final boolean x0 = (bX & 4) == 0; ++ final boolean y0 = (bX & 2) == 0; ++ final boolean z0 = (bX & 1) == 0; ++ ++ final double x1 = x0 ? qX : qX - 1.0D; ++ final double y1 = y0 ? qY : qY - 1.0D; ++ final double z1 = z0 ? qZ : qZ - 1.0D; ++ ++ double maxQY = 0.0D; ++ double maxQZ = 0.0D; ++ if (bX != 0) { ++ final double maxQX = Mth.square(Math.max(x1 + MAX_OFFSET, Math.abs(x1 - MAX_OFFSET))); ++ maxQY = Mth.square(Math.max(y1 + MAX_OFFSET, Math.abs(y1 - MAX_OFFSET))); ++ maxQZ = Mth.square(Math.max(z1 + MAX_OFFSET, Math.abs(z1 - MAX_OFFSET))); ++ ++ if (minD < maxQY + maxQZ + maxQX) continue; ++ } ++ ++ int pX = x0 ? x : x + 1; ++ int pY = y0 ? y : y + 1; ++ int pZ = z0 ? z : z + 1; ++ ++ long seed = this.biomeZoomSeed; ++ seed = LinearCongruentialGenerator.next(seed, pX); ++ seed = LinearCongruentialGenerator.next(seed, pY); ++ seed = LinearCongruentialGenerator.next(seed, pZ); ++ seed = LinearCongruentialGenerator.next(seed, pX); ++ seed = LinearCongruentialGenerator.next(seed, pY); ++ seed = LinearCongruentialGenerator.next(seed, pZ); ++ ++ double dX = getFiddle(seed); ++ double sX = Mth.square(x1 + dX); ++ if (bX != 0 && minD < sX + maxQY + maxQZ) continue; ++ ++ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed); ++ double dY = getFiddle(seed); ++ double sY = Mth.square(y1 + dY); ++ if (bX != 0 && minD < sX + sY + maxQZ) continue; ++ ++ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed); ++ double dZ = getFiddle(seed); ++ double bD = sX + sY + Mth.square(z1 + dZ); ++ ++ if (minD <= bD) continue; ++ minX = bX; ++ minD = bD; ++ } ++ ++ return this.noiseBiomeSource.getNoiseBiome( ++ (minX & 4) == 0 ? x : x + 1, ++ (minX & 2) == 0 ? y : y + 1, ++ (minX & 1) == 0 ? z : z + 1 ++ ); ++ } ++ // Plazma end - Implement CarpetFixes ++ + int i = pos.getX() - 2; + int j = pos.getY() - 2; + int k = pos.getZ() - 2; +diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +index b5b252c79b9508200d9d0bd15f0469b0cb0fd3b3..3bc5d3f1ed3d46ae1dc8f4b3207b78bf94911fdd 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +@@ -178,4 +178,16 @@ public class GlobalConfiguration extends ConfigurationPart { + + } + ++ public CarpetFixes carpetFixes; ++ public class CarpetFixes extends ConfigurationPart { ++ ++ boolean optimizeBiomeAccess = OPTIMIZE; ++ ++ @PostProcess ++ void post() { ++ net.minecraft.world.level.biome.BiomeManager.PLAZMA_CARPET_FIXES = this.optimizeBiomeAccess; ++ } ++ ++ } ++ + } +diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +index f822b544d98602be85bf0c54a6040a5907b1906e..ee7655924358642d4fc58c261decd808ff7f8019 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +@@ -107,4 +107,11 @@ public class WorldConfigurations extends ConfigurationPart { + + } + ++ public CarpetFixes carpetFixes; ++ public class CarpetFixes extends ConfigurationPart { ++ ++ public boolean preparedSheepChildColor = OPTIMIZE; ++ ++ } ++ + } +diff --git a/src/main/java/org/plazmamc/plazma/util/CarpetFixes.java b/src/main/java/org/plazmamc/plazma/util/CarpetFixes.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a5b0ce75a0ffa65e357cde2d55b7a0f116a2afad +--- /dev/null ++++ b/src/main/java/org/plazmamc/plazma/util/CarpetFixes.java +@@ -0,0 +1,45 @@ ++package org.plazmamc.plazma.util; ++ ++import net.minecraft.world.item.DyeColor; ++ ++public interface CarpetFixes { ++ ++ static DyeColor properDyeMixin(DyeColor firstColor, DyeColor secondColor) { ++ if (firstColor.equals(secondColor)) return firstColor; ++ ++ return switch (firstColor) { ++ case WHITE -> switch (secondColor) { ++ case BLUE -> DyeColor.LIGHT_BLUE; ++ case GRAY -> DyeColor.LIGHT_GRAY; ++ case BLACK -> DyeColor.GRAY; ++ case GREEN -> DyeColor.LIME; ++ case RED -> DyeColor.PINK; ++ default -> null; ++ }; ++ case BLUE -> switch (secondColor) { ++ case WHITE -> DyeColor.LIGHT_BLUE; ++ case GREEN -> DyeColor.CYAN; ++ case RED -> DyeColor.PURPLE; ++ default -> null; ++ }; ++ case RED -> switch (secondColor) { ++ case YELLOW -> DyeColor.ORANGE; ++ case WHITE -> DyeColor.PINK; ++ case BLUE -> DyeColor.PURPLE; ++ default -> null; ++ }; ++ case GREEN -> switch (secondColor) { ++ case BLUE -> DyeColor.CYAN; ++ case WHITE -> DyeColor.LIME; ++ default -> null; ++ }; ++ case YELLOW -> secondColor.equals(DyeColor.RED) ? DyeColor.ORANGE : null; ++ case PURPLE -> secondColor.equals(DyeColor.PINK) ? DyeColor.MAGENTA : null; ++ case PINK -> secondColor.equals(DyeColor.PURPLE) ? DyeColor.MAGENTA : null; ++ case GRAY -> secondColor.equals(DyeColor.WHITE) ? DyeColor.LIGHT_GRAY : null; ++ case BLACK -> secondColor.equals(DyeColor.WHITE) ? DyeColor.GRAY : null; ++ default -> null; ++ }; ++ } ++ ++} diff --git a/patches/work/0044-TickControl-System.patch b/patches/server/0058-Ticking-Controller.patch similarity index 65% rename from patches/work/0044-TickControl-System.patch rename to patches/server/0058-Ticking-Controller.patch index fc8d67a..c35367c 100644 --- a/patches/work/0044-TickControl-System.patch +++ b/patches/server/0058-Ticking-Controller.patch @@ -1,39 +1,23 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: AlphaKR93 -Date: Sun, 27 Oct 2024 15:07:43 +0900 -Subject: [PATCH] TickControl System - -Based on snackbag/TT20 -Copyright (C) 2024 snackbag, Licensed under AGPL v3.0 - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see . +Date: Sat, 14 Dec 2024 00:39:05 +0900 +Subject: [PATCH] Ticking Controller diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 5cd9b92bc..6773081b6 100644 +index 26c5cb68b464305fde43e2e0e1a415a2425483ea..ef1b47ebb8d79fbe177d4ad08e07bd182657c5d3 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1668,6 +1668,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop it.accelerate.randomTick, false); // Plazma - TickControl system ++ int k = org.plazmamc.plazma.util.TickingController.calc(this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING), it -> it.accelerate.randomTick, false); // Plazma - TickControl system List list1; if (flag && (this.spawnEnemies || this.spawnFriendlies)) { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index d5662fd0b..48ea65f67 100644 +index 137138aa1e42d4f12ed0bc54bc25918d29120333..b1bdd91eb821dee6c20bed9adb019eda2e8395d7 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -879,7 +879,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -908,7 +908,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.setDayTime(this.preciseTime); } else // Purpur end - this.setDayTime(this.levelData.getDayTime() + 1L); + // Plazma start - TickControl System -+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.accelerate.dayTime) -+ this.setDayTime(this.levelData.getDayTime() + org.plazmamc.plazma.util.TickControl.missedTicks() + 1L); -+ else -+ this.setDayTime(this.levelData.getDayTime() + 1L); ++ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.accelerate.dayTime) ++ this.setDayTime(this.levelData.getDayTime() + org.plazmamc.plazma.util.TickingController.missedTicks() + 1L); ++ else ++ this.setDayTime(this.levelData.getDayTime() + 1L); + // Plazma end - TickControl System } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 4653b25a8..9e9dd4ae1 100644 +index 9cd39ccca746c96809e3e1862e25240714662fb2..5f8415f510bb13f9ffe16c869cf8b010c5cbb5e8 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -562,6 +562,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } this.tickEffects(); -+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.delay.potionEffect) for (int i = 0; i < org.plazmamc.plazma.util.TickControl.missedTicks(); i++) this.tickEffects(); // Plazma - TickControl System ++ if (plazma.Config.get().tickControl.delay.potionEffect) for (int i = 0; i < org.plazmamc.plazma.util.TickingController.missedTicks(); i++) this.tickEffects(); // Plazma - TickControl System this.animStepO = this.animStep; this.yBodyRotO = this.yBodyRot; this.yHeadRotO = this.yHeadRot; diff --git a/src/main/java/net/minecraft/world/entity/PortalProcessor.java b/src/main/java/net/minecraft/world/entity/PortalProcessor.java -index b4a824996..1e6b32ad6 100644 +index b4a8249964786d484aa0767d0e73d71d2156f0e8..49505d04c737c41e4229d80a7b96d4ed0b68d083 100644 --- a/src/main/java/net/minecraft/world/entity/PortalProcessor.java +++ b/src/main/java/net/minecraft/world/entity/PortalProcessor.java @@ -24,7 +24,7 @@ public class PortalProcessor { @@ -100,35 +84,35 @@ index b4a824996..1e6b32ad6 100644 } } -@@ -41,6 +41,14 @@ public class PortalProcessor { - this.portalTime = Math.max(this.portalTime - 4, 0); +@@ -33,6 +33,14 @@ public class PortalProcessor { + return this.portal.getPortalDestination(world, entity, this.entryPosition); } + // Plazma start - TickControl System + private int increaseTick() { -+ if (!org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.delay.portalUse) -+ this.portalTime += org.plazmamc.plazma.util.TickControl.missedTicks(); ++ if (!plazma.Config.get().tickControl.delay.portalUse) ++ this.portalTime += org.plazmamc.plazma.util.TickingController.missedTicks(); + return this.portalTime++; + } + // Plazma end - TickControl System + - public boolean hasExpired() { - return this.portalTime <= 0; + public Portal.Transition getPortalLocalTransition() { + return this.portal.getLocalTransition(); } diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index 89d89a1b0..7c4228c0b 100644 +index 8c5dff4e24c1366d583ba9c7c2c15ea166a24933..96f34e3cd6fcb44f503ce25a3479997ed84c7ce7 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -158,6 +158,7 @@ public class ItemEntity extends Entity implements TraceableEntity { if (this.getItem().isEmpty()) { this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause } else { -+ if (this.pickupDelay > 0 && org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.delay.itemPickup) this.pickupDelay = Math.max(this.pickupDelay - org.plazmamc.plazma.util.TickControl.missedTicks(), 0); // Plazma - TickControl System ++ if (this.pickupDelay > 0 && plazma.Config.get().tickControl.delay.itemPickup) this.pickupDelay = Math.max(this.pickupDelay - org.plazmamc.plazma.util.TickingController.missedTicks(), 0); // Plazma - TickControl System super.tick(); // Paper start - remove anti tick skipping measures / wall time - revert to vanilla if (this.pickupDelay > 0 && this.pickupDelay != 32767) { diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index c1d068fa9..27361bde0 100644 +index f92b72ee0172cd878baef69b9710dbaf7e5c4495..7865f5375ab3938e326a76766517785821efe19a 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -302,6 +302,11 @@ public abstract class Player extends LivingEntity { @@ -136,15 +120,15 @@ index c1d068fa9..27361bde0 100644 this.sleepCounter = 100; } + // Plazma start - TickControl System -+ else if (this.sleepCounter < 100 && org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.delay.sleep && org.plazmamc.plazma.util.TickControl.missedTicks() > 0) { -+ this.sleepCounter += org.plazmamc.plazma.util.TickControl.missedTicks(); ++ else if (this.sleepCounter < 100 && plazma.Config.get().tickControl.delay.sleep && org.plazmamc.plazma.util.TickingController.missedTicks() > 0) { ++ this.sleepCounter += org.plazmamc.plazma.util.TickingController.missedTicks(); + } + // Plazma end - TickControl System - if (!this.level().isClientSide && this.level().isDay()) { + if (/*!this.level().isClientSide &&*/ this.level().isDay()) { // Plazma - Remove persist 'isClientSide' flag this.stopSleepInBed(false, true); diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java -index 3d948c8d3..0c77997e0 100644 +index 7fc8fcab93be9076391a2981d028831cbd02a3d2..dccc95834b4cf625b7f5ce88916cbf9a865d87a4 100644 --- a/src/main/java/net/minecraft/world/item/Item.java +++ b/src/main/java/net/minecraft/world/item/Item.java @@ -260,7 +260,7 @@ public class Item implements FeatureElement, ItemLike { @@ -152,12 +136,12 @@ index 3d948c8d3..0c77997e0 100644 public int getUseDuration(ItemStack stack, LivingEntity user) { Consumable consumable = stack.get(DataComponents.CONSUMABLE); - return consumable != null ? consumable.consumeTicks() : 0; -+ return consumable != null ? org.plazmamc.plazma.util.TickControl.calc(consumable.eatDurationTicks(), it -> it.delay.itemUse, true) : 0; // Plazma - TickControl System ++ return consumable != null ? org.plazmamc.plazma.util.TickingController.calc(consumable.consumeTicks(), it -> it.delay.itemUse, true) : 0; // Plazma - TickControl System } public boolean releaseUsing(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks) { diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 852bfe68a..3cb943ea4 100644 +index dcf2dcece3e995ce4646b931329246be19a4e1c2..b99945c052d62e293bd3e516c7e9e407d358bbb7 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java @@ -336,13 +336,14 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -173,7 +157,7 @@ index 852bfe68a..3cb943ea4 100644 - } + // Plazma start - TickControl system + if (f == -1.0F) return 0.0F; -+ return org.plazmamc.plazma.util.TickControl.calc( ++ return org.plazmamc.plazma.util.TickingController.calc( + player.getDestroySpeed(state) / f / (player.hasCorrectToolForDrops(state) ? 30 : 100), + it -> it.delay.blockBreak, + false @@ -183,69 +167,69 @@ index 852bfe68a..3cb943ea4 100644 protected void spawnAfterBreak(BlockState state, ServerLevel world, BlockPos pos, ItemStack tool, boolean dropExperience) {} diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 9cc1a79dd25c63af6986e721ceff5560cf56b7d1..c45224e142905921305da51139d5fd3f51583cca 100644 +index 2966caede97e01b5ad15a0d56232a0f5526685e2..f1baa2a5ba541fb4a99500b2c79326dec1cd0128 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -1036,8 +1036,18 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - this.chunkCoordinateKey = chunkCoordinateKey; // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity +@@ -1076,8 +1076,18 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + this.chunkCoordinateKey = chunkCoordinateKey; } + // Plazma start - TickControl System -+ private void tickTicker(BlockState iblockdata) { -+ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity); ++ private void tickTicker(BlockState state) { ++ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), state, this.blockEntity); + -+ if (!org.plazmamc.plazma.util.TickControl.shouldTickAgain(iblockdata.getBlock())) return; -+ for (int i = 0; i < org.plazmamc.plazma.util.TickControl.missedTicks(); i++) -+ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity); ++ if (!org.plazmamc.plazma.util.TickingController.shouldTickAgain(state.getBlock())) return; ++ for (int i = 0; i < org.plazmamc.plazma.util.TickingController.missedTicks(); i++) ++ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), state, this.blockEntity); + } + // Plazma end - TickControl System + @Override - public void tick() { + public final void tick() { // Plazma - TickControl System (make final) - if (!this.blockEntity.isRemoved() && this.blockEntity.hasLevel()) { - BlockPos blockposition = this.blockEntity.getBlockPos(); + if (this.blockEntity.isRemoved() || !this.blockEntity.hasLevel()) return; -@@ -1050,7 +1060,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); + BlockPos pos = this.blockEntity.getBlockPos(); +@@ -1087,7 +1097,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + BlockState state = LevelChunk.this.getBlockState(pos); - if (this.blockEntity.getType().isValid(iblockdata)) { -- this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity); -+ this.tickTicker(iblockdata); // Plazma - TickControl System - this.loggedInvalidBlockState = false; - // Paper start - Remove the Block Entity if it's invalid - } else { + if (this.blockEntity.getType().isValid(state)) { +- this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), state, this.blockEntity); ++ this.tickTicker(state); // Plazma - TickControl System + this.loggedInvalidBlockState = false; + // Paper start - Remove the Block Entity if it's invalid + } else { diff --git a/src/main/java/net/minecraft/world/level/material/LavaFluid.java b/src/main/java/net/minecraft/world/level/material/LavaFluid.java -index 2d492d849ff73a738dfbcb16507feb89bf19a962..67206b9c754dfe90002e0bcf6995eae60b852acd 100644 +index 6e643c1a7f7e71cfd20603facaf224985ee81716..cbbbcf8a915a4146eb63e29ba5dd91354ac7228b 100644 --- a/src/main/java/net/minecraft/world/level/material/LavaFluid.java +++ b/src/main/java/net/minecraft/world/level/material/LavaFluid.java -@@ -180,7 +180,7 @@ public abstract class LavaFluid extends FlowingFluid { +@@ -181,7 +181,7 @@ public abstract class LavaFluid extends FlowingFluid { @Override public int getTickDelay(LevelReader world) { - return world.dimensionType().ultraWarm() ? world.getWorldBorder().world.purpurConfig.lavaSpeedNether : world.getWorldBorder().world.purpurConfig.lavaSpeedNotNether; // Purpur -+ return org.plazmamc.plazma.util.TickControl.calc(world.dimensionType().ultraWarm() ? world.getWorldBorder().world.purpurConfig.lavaSpeedNether : world.getWorldBorder().world.purpurConfig.lavaSpeedNotNether, it -> it.delay.lavaFluid, true); // Purpur // Plazma - TickControl system ++ return org.plazmamc.plazma.util.TickingController.calc(world.dimensionType().ultraWarm() ? world.getWorldBorder().world.purpurConfig.lavaSpeedNether : world.getWorldBorder().world.purpurConfig.lavaSpeedNotNether, it -> it.delay.lavaFluid, true); // Purpur // Plazma - TickControl system } @Override diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java -index 0fc89b33864000a262ec5369708f7aedeaf6dc0b..5055730053d9d9c1da0a5252654c936c75d04fb6 100644 +index 028aea6640356ba80f5d682e3cc03b7f82f5b9c7..d788849dc5a568d455cd83ca5b6e1b4ba1a9161f 100644 --- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java +++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java -@@ -122,7 +122,7 @@ public abstract class WaterFluid extends FlowingFluid { +@@ -123,7 +123,7 @@ public abstract class WaterFluid extends FlowingFluid { @Override public int getTickDelay(LevelReader world) { - return world.getWorldBorder().world.plazmaConfig().block.waterFlowingTick; // Plazma - Configurable water flowing speed -+ return org.plazmamc.plazma.util.TickControl.calc(world.getWorldBorder().world.plazmaConfig().block.waterFlowingTick, it -> it.delay.waterFluid, true); // Plazma - Configurable water flowing speed; TickControl System ++ return org.plazmamc.plazma.util.TickingController.calc(world.getWorldBorder().world.plazmaConfig().block.waterFlowingTick, it -> it.delay.waterFluid, true); // Plazma - Configurable water flowing speed // Plazma - TickControl System } @Override diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 49bce6e28e12f3729cab5628cf3e0f508a56d0d7..2a88a25793e6d963a9a08e615a72c6ed1677a18b 100644 +index 3bc5d3f1ed3d46ae1dc8f4b3207b78bf94911fdd..3a94005e24a6a695ac4c94ace1bc9c454180139b 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -146,4 +146,39 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -190,4 +190,39 @@ public class GlobalConfiguration extends ConfigurationPart { } @@ -279,18 +263,18 @@ index 49bce6e28e12f3729cab5628cf3e0f508a56d0d7..2a88a25793e6d963a9a08e615a72c6ed + + @PostProcess + void post() { -+ org.plazmamc.plazma.util.TickControl.post(this); ++ org.plazmamc.plazma.util.TickingController.post(this); + } + + } + } -diff --git a/src/main/java/org/plazmamc/plazma/util/TickControl.java b/src/main/java/org/plazmamc/plazma/util/TickControl.java +diff --git a/src/main/java/org/plazmamc/plazma/util/TickingController.java b/src/main/java/org/plazmamc/plazma/util/TickingController.java new file mode 100644 -index 0000000000000000000000000000000000000000..c8db7b9f590a34b38448a970baaa79dd73eab8d8 +index 0000000000000000000000000000000000000000..0e71a47a639a1a3dd0918c5a403ed827aca67966 --- /dev/null -+++ b/src/main/java/org/plazmamc/plazma/util/TickControl.java -@@ -0,0 +1,57 @@ ++++ b/src/main/java/org/plazmamc/plazma/util/TickingController.java +@@ -0,0 +1,56 @@ +package org.plazmamc.plazma.util; + +import net.minecraft.world.level.block.Block; @@ -301,14 +285,13 @@ index 0000000000000000000000000000000000000000..c8db7b9f590a34b38448a970baaa79dd + +import static net.minecraft.server.MinecraftServer.getServer; + -+public final class TickControl { ++public final class TickingController { + -+ -+ private static @Nullable TickControl INSTANCE; ++ private static @Nullable TickingController INSTANCE; + private final GlobalConfiguration.TickControl configuration; + private int missedTicks = 0; + -+ private TickControl(GlobalConfiguration.TickControl configuration) { ++ private TickingController(GlobalConfiguration.TickControl configuration) { + this.configuration = configuration; + } + @@ -324,7 +307,7 @@ index 0000000000000000000000000000000000000000..c8db7b9f590a34b38448a970baaa79dd + return; + } + -+ INSTANCE = new TickControl(configuration); ++ INSTANCE = new TickingController(configuration); + } + + public static float calc(float original, @NonNull Function isAffected, boolean swap) { diff --git a/patches/server/0059-Add-option-to-disable-beacon-effect-ambient.patch b/patches/server/0059-Add-option-to-disable-beacon-effect-ambient.patch new file mode 100644 index 0000000..9dbd19e --- /dev/null +++ b/patches/server/0059-Add-option-to-disable-beacon-effect-ambient.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Sat, 14 Dec 2024 01:03:07 +0900 +Subject: [PATCH] Add option to disable beacon effect ambient + + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +index 69ef5c805d802575a639027fd40064d92fcfe89d..31d6bf6c1bcca32ce8a8a8810807dec4d5000ab9 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +@@ -368,24 +368,20 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name + } + } + +- private static void applyEffect(List list, @Nullable Holder holder, int j, int b0, boolean isPrimary, BlockPos worldPosition) { // Paper - BeaconEffectEvent +- if (!list.isEmpty()) { // Paper - BeaconEffectEvent +- Iterator iterator = list.iterator(); ++ private static void applyEffect(List list, @Nullable Holder holder, int j, int b0, boolean isPrimary, BlockPos worldPosition) { // Paper - BeaconEffectEvent ++ if (list.isEmpty()) return; + +- Player entityhuman; ++ // Paper start - BeaconEffectEvent ++ org.bukkit.craftbukkit.block.CraftBlock block = org.bukkit.craftbukkit.block.CraftBlock.at(list.getFirst().level(), worldPosition); ++ PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffectInstance(holder, j, b0, true, !(block).getCraftWorld().getHandle().plazmaConfig().entity.disableBeaconEffectAmbient, true)); ++ // Paper end - BeaconEffectEvent ++ ++ for (final Player player : list) { + // Paper start - BeaconEffectEvent +- org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(((Player) list.get(0)).level(), worldPosition); +- PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffectInstance(holder, j, b0, true, true)); ++ BeaconEffectEvent event = new BeaconEffectEvent(block, effect, (org.bukkit.entity.Player) player.getBukkitEntity(), isPrimary); ++ if (CraftEventFactory.callEvent(event).isCancelled()) continue; ++ player.addEffect(new MobEffectInstance(CraftPotionUtil.fromBukkit(event.getEffect())), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON); + // Paper end - BeaconEffectEvent +- +- while (iterator.hasNext()) { +- // Paper start - BeaconEffectEvent +- entityhuman = (ServerPlayer) iterator.next(); +- BeaconEffectEvent event = new BeaconEffectEvent(block, effect, (org.bukkit.entity.Player) entityhuman.getBukkitEntity(), isPrimary); +- if (CraftEventFactory.callEvent(event).isCancelled()) continue; +- entityhuman.addEffect(new MobEffectInstance(CraftPotionUtil.fromBukkit(event.getEffect())), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON); +- // Paper end - BeaconEffectEvent +- } + } + } + +diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +index ee7655924358642d4fc58c261decd808ff7f8019..943ef13e5a94e225725d2b390ec11bee677a6cf4 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java +@@ -30,6 +30,7 @@ public class WorldConfigurations extends ConfigurationPart { + + public int sensorTick = 1; + public boolean suppressErrorsFromDirtyAttributes = OPTIMIZE; ++ public boolean disableBeaconEffectAmbient = false; + + public Phantom phantom; + public class Phantom extends ConfigurationPart { diff --git a/patches/unapplied/server/0011-Optimize-default-configurations.patch b/patches/unapplied/server/0011-Optimize-default-configurations.patch index 4668f11..7874aa8 100644 --- a/patches/unapplied/server/0011-Optimize-default-configurations.patch +++ b/patches/unapplied/server/0011-Optimize-default-configurations.patch @@ -1,62 +1,4 @@ -diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java -index 8f1645573780d12bf29d441d31eab1b76cd9e70f..8e35f7fbe3629ab05c16f52d72a3cd7343cf835f 100644 ---- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java -+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java -@@ -64,7 +64,7 @@ public class PufferfishConfig { - getString("info.version", "1.0"); - setComment("info", - "Pufferfish Configuration", -- "Check out Pufferfish Host for maximum performance server hosting: https://pufferfish.host", -+ // "Check out Pufferfish Host for maximum performance server hosting: https://pufferfish.host", // Plazma - Sponsorblock - "Join our Discord for support: https://discord.gg/reZw4vQV9H", - "Download new builds at https://ci.pufferfish.host/job/Pufferfish"); - -@@ -219,7 +219,7 @@ public class PufferfishConfig { - public static int maxProjectileLoadsPerTick; - public static int maxProjectileLoadsPerProjectile; - private static void projectileLoading() { -- maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); -+ maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); // Plazma - Optimize default configurations - maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", 10, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed."); - - setComment("projectile", "Optimizes projectile settings"); -@@ -233,12 +233,12 @@ public class PufferfishConfig { - public static int activationDistanceMod; - - private static void dynamicActivationOfBrains() throws IOException { -- dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", false); // Purpur -+ dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize()); // Purpur // Plazma - Optimize default configurations - startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12, - "This value determines how far away an entity has to be", - "from the player to start being effected by DEAR."); - startDistanceSquared = startDistance * startDistance; -- maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", 20, -+ maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 7 : 8, // Plazma - Optimize default configurations - "This value defines how often in ticks, the furthest entity", - "will get their pathfinders and behaviors ticked. 20 = 1s"); - activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", 8, -@@ -261,8 +261,18 @@ public class PufferfishConfig { - public static Map projectileTimeouts; - private static void projectileTimeouts() { - // Set some defaults -- getInt("entity_timeouts.SNOWBALL", -1); -- getInt("entity_timeouts.LLAMA_SPIT", -1); -+ // Plazma start - Optimize default configurations -+ if (org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize()) { -+ getInt("entity_timeouts.ARROW", 200); -+ getInt("entity_timeouts.EGG", 200); -+ getInt("entity_timeouts.ENDER_PEARL", 200); -+ getInt("entity_timeouts.SNOWBALL", 200); -+ getInt("entity_timeouts.LLAMA_SPIT", 200); -+ } else { -+ getInt("entity_timeouts.SNOWBALL", -1); -+ getInt("entity_timeouts.LLAMA_SPIT", -1); -+ } -+ // Plazma end - Optimize default configurations - setComment("entity_timeouts", - "These values define a entity's maximum lifespan. If an", - "entity is in this list and it has survived for longer than", diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java index c867796f6..ecced2072 100644 --- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java @@ -69,4 +11,4 @@ index c867796f6..ecced2072 100644 + public Map despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? (net.minecraft.server.MinecraftServer.getServer().server.getSimulationDistance() * 16) + 8 : category.getDespawnDistance()))); // Plazma - Optimize default configurations @MergeMap public Reference2IntMap ticksPerSpawn = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1))); - \ No newline at end of file + diff --git a/patches/unapplied/server/0032-Add-some-missing-Pufferfish-configurations.patch b/patches/unapplied/server/0032-Add-some-missing-Pufferfish-configurations.patch deleted file mode 100644 index 18d4b3b..0000000 --- a/patches/unapplied/server/0032-Add-some-missing-Pufferfish-configurations.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaKR93 -Date: Wed, 15 May 2024 14:30:55 +0900 -Subject: [PATCH] Add some missing Pufferfish configurations - - -diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java -index 5b024bc6166a9034eeba729bf3a53236446a03de..d4d6e9f0d8bf15315412ce5193e45c147b047575 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java -+++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java -@@ -161,9 +161,11 @@ public class Armadillo extends Animal { - return ArmadilloAi.makeBrain(this.brainProvider().makeBrain(dynamic)); - } - -+ private int behaviorTick; // Plazma - Add missing pufferfish configurations - @Override - protected void customServerAiStep() { - //this.level().getProfiler().push("armadilloBrain"); // Purpur -+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations - ((Brain) this.brain).tick((ServerLevel) this.level(), this); // CraftBukkit - decompile error - //this.level().getProfiler().pop(); // Purpur - //this.level().getProfiler().push("armadilloActivityUpdate"); // Purpur -diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -index 00803dcc2d990046013b8a175af20359883a15fe..6781c9cda8118842e24712f335de6e5b817af82c 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -@@ -164,11 +164,12 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl - return pose == Pose.SITTING ? Camel.SITTING_DIMENSIONS.scale(this.getAgeScale()) : super.getDefaultDimensions(pose); - } - -+ private int behaviorTick = 0; // Plazma - Add missing pufferfish configurations - @Override - protected void customServerAiStep() { - //this.level().getProfiler().push("camelBrain"); // Purpur - Brain behaviorcontroller = (Brain) this.getBrain(); // CraftBukkit - decompile error -- -+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations - behaviorcontroller.tick((ServerLevel) this.level(), this); - //this.level().getProfiler().pop(); // Purpur - //this.level().getProfiler().push("camelActivityUpdate"); // Purpur -diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -index bc931f54d1087f2515b8185368ade3e8dd55a00d..65ce4ccbb91ff87762da5f9ef53e6d069149abd8 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -@@ -515,9 +515,11 @@ public class Sniffer extends Animal { - return Brain.provider(SnifferAi.MEMORY_TYPES, SnifferAi.SENSOR_TYPES); - } - -+ private int behaviorTick; // Plazma - Add missing pufferfish configurations - @Override - protected void customServerAiStep() { - //this.level().getProfiler().push("snifferBrain"); // Purpur -+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations - this.getBrain().tick((ServerLevel) this.level(), this); - //this.level().getProfiler().popPush("snifferActivityUpdate"); // Purpur - SnifferAi.updateActivity(this); -diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -index 78a5631753e5bdc16b786ac6951c8d39c4337767..7b1bf1449c2e1f1e2ea2a9f258624b128eb80918 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -@@ -320,7 +320,7 @@ public class Warden extends Monster implements VibrationSystem { - - //worldserver.getProfiler().push("wardenBrain"); // Purpur - //if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - TODO: Move to Ridables patch -- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish -+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Plazma - Add missing pufferfish configurations - this.getBrain().tick(worldserver, this); - //this.level().getProfiler().pop(); // Purpur - super.customServerAiStep(); diff --git a/patches/unapplied/server/dropped/0008-Port-SparklyPaper-patches.patch b/patches/unapplied/server/dropped/0008-Port-SparklyPaper-patches.patch deleted file mode 100644 index 6abf6d5..0000000 --- a/patches/unapplied/server/dropped/0008-Port-SparklyPaper-patches.patch +++ /dev/null @@ -1,32 +0,0 @@ - -diff --git a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java -index f164256d59b761264876ca0c85f812d101bfd5de..deaeb134c47da8710afa747bf980bd00aab846d6 100644 ---- a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java -+++ b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java -@@ -106,6 +106,13 @@ public final class NearbyPlayers { - return chunk == null ? null : chunk.players[type.ordinal()]; - } - -+ // Plazma start - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks -+ public ReferenceList getPlayers(final long nearbyCoordKey, final NearbyMapType type) { -+ final TrackedChunk chunk = this.byChunk.get(nearbyCoordKey); -+ return chunk == null ? null : chunk.players[type.ordinal()]; -+ } -+ // Plazma end - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks -+ - public ReferenceList getPlayersByChunk(final int chunkX, final int chunkZ, final NearbyMapType type) { - final TrackedChunk chunk = this.byChunk.get(CoordinateUtils.getChunkKey(chunkX, chunkZ)); - -diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 5eb7bcf492ee354ef775cd8d09c7ca2bdfeb7ce2..697cb18bce2f2470a0a2347ba6709e1449b360fd 100644 ---- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java -+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -615,7 +615,7 @@ public class ServerChunkCache extends ChunkSource { - - // Paper start - optimise chunk tick iteration - com.destroystokyo.paper.util.maplist.ReferenceList playersNearby -- = nearbyPlayers.getPlayers(chunkcoordintpair, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE); -+ = nearbyPlayers.getPlayers(chunk1.nearbyPlayersCoordinateKey, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE); - if (playersNearby == null) { - continue; - } \ No newline at end of file diff --git a/patches/unapplied/server/dropped/0038-Improve-biome-temperature-cache.patch b/patches/unapplied/server/dropped/0038-Improve-biome-temperature-cache.patch deleted file mode 100644 index 08aecda..0000000 --- a/patches/unapplied/server/dropped/0038-Improve-biome-temperature-cache.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaKR93 -Date: Wed, 15 May 2024 14:31:47 +0900 -Subject: [PATCH] Improve biome temperature cache - - -diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java -index f9fbfb63f19decb3b15284306d7edda072e609af..81b996679f396f18a8f5948311f1069be0806756 100644 ---- a/src/main/java/net/minecraft/world/level/biome/Biome.java -+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java -@@ -118,7 +118,7 @@ public final class Biome { - public float getTemperature(BlockPos blockPos) { - long l = blockPos.asLong(); - // Pufferfish start -- gg.airplane.structs.Long2FloatAgingCache cache = this.temperatureCache.get(); -+ gg.airplane.structs.Long2FloatAgingCache cache = temperatureCache.get(); // Plazma - Improve biome temperature cache - float f = cache.getValue(l); - if (!Float.isNaN(f)) { - return f; diff --git a/patches/unapplied/server/dropped/0041-CarpetFixes-Configuration.patch b/patches/unapplied/server/dropped/0041-CarpetFixes-Configuration.patch deleted file mode 100644 index bec61e8..0000000 --- a/patches/unapplied/server/dropped/0041-CarpetFixes-Configuration.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: IPECTER -Date: Wed, 6 Sep 2023 15:40:34 +0900 -Subject: [PATCH] CarpetFixes-Configuration - - -diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 525fe30b6abba295709fca3d10f9b24679112571..49d5292697fdc6f23874557dd2db9d1fcda750f3 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -76,4 +76,12 @@ public class GlobalConfiguration extends ConfigurationPart { - public int timerTimeOut = 0; - - } -+ -+ public CarpetFixes carpetFixes; -+ -+ public class CarpetFixes extends ConfigurationPart { -+ -+ public boolean enabled = DO_OPTIMIZE; -+ -+ } - } -diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -index 7d5bfd3a5aa5135596f3f1ae7c504a51b02798ef..b0deec445b5ea3cd3e4802eca04e99818b539bd8 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -@@ -131,4 +131,12 @@ public class LevelConfigurations extends ConfigurationPart { - } - - } -+ -+ public CarpetFixes carpetFixes; -+ -+ public class CarpetFixes extends ConfigurationPart { -+ -+ public boolean enabled = DO_OPTIMIZE; -+ -+ } - } diff --git a/patches/unapplied/server/dropped/0042-CarpetFixes-Optimizations-BiomeManager.patch b/patches/unapplied/server/dropped/0042-CarpetFixes-Optimizations-BiomeManager.patch deleted file mode 100644 index 2847f75..0000000 --- a/patches/unapplied/server/dropped/0042-CarpetFixes-Optimizations-BiomeManager.patch +++ /dev/null @@ -1,179 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: IPECTER -Date: Wed, 6 Sep 2023 15:53:37 +0900 -Subject: [PATCH] CarpetFixes-Optimizations-BiomeManager - -Original: fxmorin/carpet-fixes -Copyright (C) 2023 fxmorin - -Optimized getBiome call: Reduce the number of calls to the mess of -LinearCongruentialGenerator#next(long, long) which is pretty heavy on performance. - -We are able to do this by skipping around 370 of 512 possible calls to getBiome() by predicting the outcome -before doing the seed mixing. This seems to be around 25% - 75% faster depending on the use case. -We can predict much faster than the seed mixing. - -diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java -index 5695c5116c8a338b2e41aafcb2dc9f2146856970..b2291854b9803fe01d40e8a1d76d6ff358cea114 100644 ---- a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java -+++ b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java -@@ -12,6 +12,7 @@ public class BiomeManager { - private static final int ZOOM_BITS = 2; - private static final int ZOOM = 4; - private static final int ZOOM_MASK = 3; -+ private static final double maxOffset = 0.4500000001D; // Plazma - CarpetFixes - private final BiomeManager.NoiseBiomeSource noiseBiomeSource; - private final long biomeZoomSeed; - -@@ -29,39 +30,104 @@ public class BiomeManager { - } - - public Holder getBiome(BlockPos pos) { -- int i = pos.getX() - 2; -- int j = pos.getY() - 2; -- int k = pos.getZ() - 2; -- int l = i >> 2; -- int m = j >> 2; -- int n = k >> 2; -- double d = (double)(i & 3) / 4.0D; -- double e = (double)(j & 3) / 4.0D; -- double f = (double)(k & 3) / 4.0D; -- int o = 0; -- double g = Double.POSITIVE_INFINITY; -- -- for(int p = 0; p < 8; ++p) { -- boolean bl = (p & 4) == 0; -- boolean bl2 = (p & 2) == 0; -- boolean bl3 = (p & 1) == 0; -- int q = bl ? l : l + 1; -- int r = bl2 ? m : m + 1; -- int s = bl3 ? n : n + 1; -- double h = bl ? d : d - 1.0D; -- double t = bl2 ? e : e - 1.0D; -- double u = bl3 ? f : f - 1.0D; -- double v = getFiddledDistance(this.biomeZoomSeed, q, r, s, h, t, u); -- if (g > v) { -- o = p; -- g = v; -+ // Plazma start - CarpetFixes - Optimized getBiome call -+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().carpetFixes.optimizedBiomeAccess()) { -+ int xMinus2 = pos.getX() - 2; -+ int yMinus2 = pos.getY() - 2; -+ int zMinus2 = pos.getZ() - 2; -+ int x = xMinus2 >> 2; // BlockPos to BiomePos -+ int y = yMinus2 >> 2; -+ int z = zMinus2 >> 2; -+ double quartX = (double) (xMinus2 & 3) / 4.0D; // quartLocal divided by 4 -+ double quartY = (double) (yMinus2 & 3) / 4.0D; // 0/4, 1/4, 2/4, 3/4 -+ double quartZ = (double) (zMinus2 & 3) / 4.0D; // [0, 0.25, 0.5, 0.75] -+ int smallestX = 0; -+ double smallestDist = Double.POSITIVE_INFINITY; -+ for (int biomeX = 0; biomeX < 8; ++biomeX) { -+ boolean everyOtherQuad = (biomeX & 4) == 0; // 1 1 1 1 0 0 0 0 -+ boolean everyOtherPair = (biomeX & 2) == 0; // 1 1 0 0 1 1 0 0 -+ boolean everyOther = (biomeX & 1) == 0; // 1 0 1 0 1 0 1 0 -+ double quartXX = everyOtherQuad ? quartX : quartX - 1.0D; //[-1.0,-0.75,-0.5,-0.25,0.0,0.25,0.5,0.75] -+ double quartYY = everyOtherPair ? quartY : quartY - 1.0D; -+ double quartZZ = everyOther ? quartZ : quartZ - 1.0D; -+ -+ //This code block is new -+ double maxQuartYY = 0.0D, maxQuartZZ = 0.0D; -+ if (biomeX != 0) { -+ maxQuartYY = Mth.square(Math.max(quartYY + maxOffset, Math.abs(quartYY - maxOffset))); -+ maxQuartZZ = Mth.square(Math.max(quartZZ + maxOffset, Math.abs(quartZZ - maxOffset))); -+ double maxQuartXX = Mth.square(Math.max(quartXX + maxOffset, Math.abs(quartXX - maxOffset))); -+ if (smallestDist < maxQuartXX + maxQuartYY + maxQuartZZ) continue; -+ } -+ -+ int xx = everyOtherQuad ? x : x + 1; -+ int yy = everyOtherPair ? y : y + 1; -+ int zz = everyOther ? z : z + 1; -+ -+ //I transferred the code from method_38106 to here, so I could call continue halfway through -+ long seed = LinearCongruentialGenerator.next(this.biomeZoomSeed, xx); -+ seed = LinearCongruentialGenerator.next(seed, yy); -+ seed = LinearCongruentialGenerator.next(seed, zz); -+ seed = LinearCongruentialGenerator.next(seed, xx); -+ seed = LinearCongruentialGenerator.next(seed, yy); -+ seed = LinearCongruentialGenerator.next(seed, zz); -+ double offsetX = getFiddle(seed); -+ double sqrX = Mth.square(quartXX + offsetX); -+ if (biomeX != 0 && smallestDist < sqrX + maxQuartYY + maxQuartZZ) continue; //skip the rest of the loop -+ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed); -+ double offsetY = getFiddle(seed); -+ double sqrY = Mth.square(quartYY + offsetY); -+ if (biomeX != 0 && smallestDist < sqrX + sqrY + maxQuartZZ) continue; // skip the rest of the loop -+ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed); -+ double offsetZ = getFiddle(seed); -+ double biomeDist = sqrX + sqrY + Mth.square(quartZZ + offsetZ); -+ -+ if (smallestDist > biomeDist) { -+ smallestX = biomeX; -+ smallestDist = biomeDist; -+ } - } -- } -+ return this.noiseBiomeSource.getNoiseBiome( -+ (smallestX & 4) == 0 ? x : x + 1, -+ (smallestX & 2) == 0 ? y : y + 1, -+ (smallestX & 1) == 0 ? z : z + 1 -+ ); -+ } else { -+ int i = pos.getX() - 2; -+ int j = pos.getY() - 2; -+ int k = pos.getZ() - 2; -+ int l = i >> 2; -+ int m = j >> 2; -+ int n = k >> 2; -+ double d = (double) (i & 3) / 4.0D; -+ double e = (double) (j & 3) / 4.0D; -+ double f = (double) (k & 3) / 4.0D; -+ int o = 0; -+ double g = Double.POSITIVE_INFINITY; -+ -+ for (int p = 0; p < 8; ++p) { -+ boolean bl = (p & 4) == 0; -+ boolean bl2 = (p & 2) == 0; -+ boolean bl3 = (p & 1) == 0; -+ int q = bl ? l : l + 1; -+ int r = bl2 ? m : m + 1; -+ int s = bl3 ? n : n + 1; -+ double h = bl ? d : d - 1.0D; -+ double t = bl2 ? e : e - 1.0D; -+ double u = bl3 ? f : f - 1.0D; -+ double v = getFiddledDistance(this.biomeZoomSeed, q, r, s, h, t, u); -+ if (g > v) { -+ o = p; -+ g = v; -+ } -+ } - -- int w = (o & 4) == 0 ? l : l + 1; -- int x = (o & 2) == 0 ? m : m + 1; -- int y = (o & 1) == 0 ? n : n + 1; -- return this.noiseBiomeSource.getNoiseBiome(w, x, y); -+ int w = (o & 4) == 0 ? l : l + 1; -+ int x = (o & 2) == 0 ? m : m + 1; -+ int y = (o & 1) == 0 ? n : n + 1; -+ return this.noiseBiomeSource.getNoiseBiome(w, x, y); -+ } -+ // Plazma end - } - - public Holder getNoiseBiomeAtPosition(double x, double y, double z) { -diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 49d5292697fdc6f23874557dd2db9d1fcda750f3..d329f77ab19ac781506c26909591fa4ae9dabb1e 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -82,6 +82,11 @@ public class GlobalConfiguration extends ConfigurationPart { - public class CarpetFixes extends ConfigurationPart { - - public boolean enabled = DO_OPTIMIZE; -+ boolean optimizedBiomeAccess = true; -+ -+ public boolean optimizedBiomeAccess() { -+ return enabled && optimizedBiomeAccess; -+ } - - } - } diff --git a/patches/unapplied/server/dropped/0043-CarpetFixes-Optimizations-RecipeManager.patch b/patches/unapplied/server/dropped/0043-CarpetFixes-Optimizations-RecipeManager.patch deleted file mode 100644 index e1cc77b..0000000 --- a/patches/unapplied/server/dropped/0043-CarpetFixes-Optimizations-RecipeManager.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: IPECTER -Date: Wed, 6 Sep 2023 16:23:56 +0900 -Subject: [PATCH] CarpetFixes-Optimizations-RecipeManager - -Original: fxmorin/carpet-fixes -Copyright (C) 2023 fxmorin - -RecipeManager optimization. -Optimized by taking out streams & doing extra early checks to quickly remove unrelated recipes - -diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -index 9ffb6999171f602f0b113dac40e0130410cad870..49b5fece692cd5da99ed21d7fd0864cea1609495 100644 ---- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -@@ -103,13 +103,38 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { - } - - public > Optional getRecipeFor(RecipeType type, C inventory, Level world) { -- // CraftBukkit start -- Optional recipe = this.byType(type).values().stream().filter((irecipe) -> { -- return irecipe.matches(inventory, world); -- }).findFirst(); -- inventory.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found -- // CraftBukkit end -- return recipe; -+ // Plazma start - CarpetFixes - Optimized RecipeManager -+ if (world.plazmaLevelConfiguration().carpetFixes.optimizedRecipeManager() && type == RecipeType.CRAFTING) { -+ int slots = 0; -+ int count; -+ //compare size to quickly remove recipes that are not even close. Plus remove streams -+ for (int slot = 0; slot < inventory.getContainerSize(); slot++) -+ if (!inventory.getItem(slot).isEmpty()) slots++; -+ for (Recipe recipe : this.byType(type).values()) { -+ count = 0; -+ if (recipe instanceof CustomRecipe) { -+ if (recipe.matches(inventory, world)) { -+ return (Optional) Optional.of(recipe); -+ } -+ } else { -+ for (Ingredient ingredient : recipe.getIngredients()) -+ if (ingredient != Ingredient.EMPTY) count++; -+ if (count == slots && recipe.matches(inventory, world)) { -+ return (Optional) Optional.of(recipe); -+ } -+ } -+ } -+ return Optional.empty(); -+ } else { -+ // CraftBukkit start -+ Optional recipe = this.byType(type).values().stream().filter((irecipe) -> { -+ return irecipe.matches(inventory, world); -+ }).findFirst(); -+ inventory.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found -+ // CraftBukkit end -+ return recipe; -+ } -+ // Plazma end - } - - public > Optional> getRecipeFor(RecipeType type, C inventory, Level world, @Nullable ResourceLocation id) { -@@ -134,7 +159,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { - } - - public > List getAllRecipesFor(RecipeType type) { -- return List.copyOf(this.byType(type).values()); -+ return org.plazmamc.plazma.configurations.GlobalConfiguration.get().carpetFixes.optimizedRecipeManager() ? (List) new java.util.ArrayList<>(this.byType(type).values()) : List.copyOf(this.byType(type).values()); // Plazma start - CarpetFixes - Optimized RecipeManager - } - - public > List getRecipesFor(RecipeType type, C inventory, Level world) { -diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index d329f77ab19ac781506c26909591fa4ae9dabb1e..36511f71fcf3a8a5da746dd087003861a4f0a8f4 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -83,10 +83,15 @@ public class GlobalConfiguration extends ConfigurationPart { - - public boolean enabled = DO_OPTIMIZE; - boolean optimizedBiomeAccess = true; -+ boolean optimizedRecipeManager = true; - - public boolean optimizedBiomeAccess() { - return enabled && optimizedBiomeAccess; - } - -+ public boolean optimizedRecipeManager() { -+ return enabled && optimizedRecipeManager; -+ } -+ - } - } -diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -index b0deec445b5ea3cd3e4802eca04e99818b539bd8..e089a881600b61060bae1135b89703f6c0b5c7e8 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -@@ -137,6 +137,11 @@ public class LevelConfigurations extends ConfigurationPart { - public class CarpetFixes extends ConfigurationPart { - - public boolean enabled = DO_OPTIMIZE; -+ boolean optimizedRecipeManager = true; -+ -+ public boolean optimizedRecipeManager() { -+ return enabled && optimizedRecipeManager; -+ } - - } - } diff --git a/patches/unapplied/server/dropped/0044-CarpetFixes-Optimizations-Sheep.patch b/patches/unapplied/server/dropped/0044-CarpetFixes-Optimizations-Sheep.patch deleted file mode 100644 index 16ad697..0000000 --- a/patches/unapplied/server/dropped/0044-CarpetFixes-Optimizations-Sheep.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: IPECTER -Date: Wed, 6 Sep 2023 16:35:34 +0900 -Subject: [PATCH] CarpetFixes-Optimizations-Sheep - -Original: fxmorin/carpet-fixes -Copyright (C) 2023 fxmorin - -The game determines the child sheep's color by getting a wool block from the parents, putting them in a crafting -recipe, getting the output wool and getting the color from that. -I don't know in what world we would consider a data-driven method with that much overhead as a smart idea. Instead, -we used a prebaked list of all the possible colors and combinations, however this means that you can't use a -datapack to change it. - -diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java -index 54de1f782e45cb3e3b1442aeb56b6e8547b065c0..3b873dd76c0f10a7f29206e46c1bf9b230555170 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java -+++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java -@@ -432,19 +432,27 @@ public class Sheep extends Animal implements Shearable { - } - - private DyeColor getOffspringColor(Animal firstParent, Animal secondParent) { -+ // Plazma start - CarpetFixes - Optimized sheep child color - DyeColor enumcolor = ((Sheep) firstParent).getColor(); - DyeColor enumcolor1 = ((Sheep) secondParent).getColor(); -- CraftingContainer inventorycrafting = Sheep.makeContainer(enumcolor, enumcolor1); -- Optional optional = this.level().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, inventorycrafting, this.level()).map((recipecrafting) -> { // CraftBukkit - decompile error -- return recipecrafting.assemble(inventorycrafting, this.level().registryAccess()); -- }).map(ItemStack::getItem); -- -- Objects.requireNonNull(DyeItem.class); -- optional = optional.filter(DyeItem.class::isInstance); -- Objects.requireNonNull(DyeItem.class); -- return (DyeColor) optional.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> { -- return this.level().random.nextBoolean() ? enumcolor : enumcolor1; -- }); -+ if (this.level().plazmaLevelConfiguration().carpetFixes.optimizedSheepChildColor()) { -+ DyeColor col = org.plazmamc.plazma.util.CarpetFixesUtils.properDyeMixin(enumcolor, enumcolor1); -+ if (col == null) col = this.level().random.nextBoolean() ? enumcolor : enumcolor1; -+ return col; -+ } else { -+ CraftingContainer inventorycrafting = Sheep.makeContainer(enumcolor, enumcolor1); -+ Optional optional = this.level().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, inventorycrafting, this.level()).map((recipecrafting) -> { // CraftBukkit - decompile error -+ return recipecrafting.assemble(inventorycrafting, this.level().registryAccess()); -+ }).map(ItemStack::getItem); -+ -+ Objects.requireNonNull(DyeItem.class); -+ optional = optional.filter(DyeItem.class::isInstance); -+ Objects.requireNonNull(DyeItem.class); -+ return (DyeColor) optional.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> { -+ return this.level().random.nextBoolean() ? enumcolor : enumcolor1; -+ }); -+ } -+ // Plazma end - } - - private static CraftingContainer makeContainer(DyeColor firstColor, DyeColor secondColor) { -diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -index e089a881600b61060bae1135b89703f6c0b5c7e8..29d451f55dabc15478e9c32d2c37bd0ea2d9bebc 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java -@@ -138,10 +138,15 @@ public class LevelConfigurations extends ConfigurationPart { - - public boolean enabled = DO_OPTIMIZE; - boolean optimizedRecipeManager = true; -+ boolean optimizedSheepChildColor = false; - - public boolean optimizedRecipeManager() { - return enabled && optimizedRecipeManager; - } - -+ public boolean optimizedSheepChildColor() { -+ return enabled && optimizedSheepChildColor; -+ } -+ - } - } -diff --git a/src/main/java/org/plazmamc/plazma/util/CarpetFixesUtils.java b/src/main/java/org/plazmamc/plazma/util/CarpetFixesUtils.java -new file mode 100644 -index 0000000000000000000000000000000000000000..aae3cf170bca4b3e6cdd0a964967dfafe2759f65 ---- /dev/null -+++ b/src/main/java/org/plazmamc/plazma/util/CarpetFixesUtils.java -@@ -0,0 +1,48 @@ -+package org.plazmamc.plazma.util; -+ -+import net.minecraft.world.item.DyeColor; -+ -+public class CarpetFixesUtils { -+ -+ //If I was actually implementing this, the color values would have been binary in order for fast calculations. -+ //Never do this in a production build, although this is better than using the RecipeManager xD -+ public static DyeColor properDyeMixin(DyeColor col1, DyeColor col2) { -+ if (col1.equals(col2)) return col1; -+ switch(col1) { -+ case WHITE -> { -+ switch(col2) { -+ case BLUE -> {return DyeColor.LIGHT_BLUE;} -+ case GRAY -> {return DyeColor.LIGHT_GRAY;} -+ case BLACK -> {return DyeColor.GRAY;} -+ case GREEN -> {return DyeColor.LIME;} -+ case RED -> {return DyeColor.PINK;} -+ } -+ } -+ case BLUE -> { -+ switch(col2) { -+ case WHITE -> {return DyeColor.LIGHT_BLUE;} -+ case GREEN -> {return DyeColor.CYAN;} -+ case RED -> {return DyeColor.PURPLE;} -+ } -+ } -+ case RED -> { -+ switch(col2) { -+ case YELLOW -> {return DyeColor.ORANGE;} -+ case WHITE -> {return DyeColor.PINK;} -+ case BLUE -> {return DyeColor.PURPLE;} -+ } -+ }case GREEN -> { -+ switch(col2) { -+ case BLUE -> {return DyeColor.CYAN;} -+ case WHITE -> {return DyeColor.LIME;} -+ } -+ } -+ case YELLOW -> {if (col2.equals(DyeColor.RED)) return DyeColor.ORANGE;} -+ case PURPLE -> {if (col2.equals(DyeColor.PINK)) return DyeColor.MAGENTA;} -+ case PINK -> {if (col2.equals(DyeColor.PURPLE)) return DyeColor.MAGENTA;} -+ case GRAY -> {if (col2.equals(DyeColor.WHITE)) return DyeColor.LIGHT_GRAY;} -+ case BLACK -> {if (col2.equals(DyeColor.WHITE)) return DyeColor.GRAY;} -+ } -+ return null; -+ } -+} diff --git a/patches/unapplied/sparklypaper/api/0001-Add-ClientboundPacketPreDispatchEvent.patch b/patches/unapplied/sparklypaper/api/0001-Add-ClientboundPacketPreDispatchEvent.patch new file mode 100644 index 0000000..50a4d55 --- /dev/null +++ b/patches/unapplied/sparklypaper/api/0001-Add-ClientboundPacketPreDispatchEvent.patch @@ -0,0 +1,91 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Mon, 10 Jun 2024 12:27:08 -0300 +Subject: [PATCH] Add ClientboundPacketPreDispatchEvent + + +diff --git a/src/main/java/net/sparklypower/sparklypaper/event/packet/ClientboundPacketPreDispatchEvent.java b/src/main/java/net/sparklypower/sparklypaper/event/packet/ClientboundPacketPreDispatchEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..9a279ad0b0f9b63f5f3a37977076e0bb805cd56d +--- /dev/null ++++ b/src/main/java/net/sparklypower/sparklypaper/event/packet/ClientboundPacketPreDispatchEvent.java +@@ -0,0 +1,79 @@ ++package net.sparklypower.sparklypaper.event.packet; ++ ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called before a packet is dispatched to a connection. ++ *

++ * Compared to other solutions like ProtocolLib, this has the advantage that this is called eariler on the packet sending cycle, before the packet is added to the packet queue, allowing for ++ * main thread access of resources without worrying about race conditions. ++ *

++ * The asynchronously state of this event is undefined, the event may be called on an async or on a sync thread, depending on where the packet was sent. ++ */ ++public class ClientboundPacketPreDispatchEvent extends Event implements Cancellable { ++ private static final HandlerList handlers = new HandlerList(); ++ private boolean isCancelled = false; ++ private final Player player; ++ private Object packet; ++ ++ public ClientboundPacketPreDispatchEvent(boolean isAsync, @Nullable Player player, @NotNull Object packet) { ++ super(isAsync); ++ this.player = player; ++ this.packet = packet; ++ } ++ ++ /** ++ * Gets the player associated with this packet. ++ *

++ * Depending on which phase the packet is from, the player may be null ++ * ++ * @return the player associated with this packet ++ */ ++ @Nullable ++ public Player getPlayer() { ++ return player; ++ } ++ ++ /** ++ * Gets the packet associated with this event. ++ * ++ * @return the packet associated with this event ++ */ ++ @NotNull ++ public Object getPacket() { ++ return packet; ++ } ++ ++ /** ++ * Sets the packet associated with this event. ++ */ ++ public void setPacket(@NotNull Object packet) { ++ this.packet = packet; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return handlers; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return isCancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.isCancelled = cancel; ++ } ++} diff --git a/patches/unapplied/sparklypaper/api/0002-Add-PlayerBlockDestroySpeedEvent.patch b/patches/unapplied/sparklypaper/api/0002-Add-PlayerBlockDestroySpeedEvent.patch new file mode 100644 index 0000000..76be6a2 --- /dev/null +++ b/patches/unapplied/sparklypaper/api/0002-Add-PlayerBlockDestroySpeedEvent.patch @@ -0,0 +1,76 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Mon, 10 Jun 2024 14:38:59 -0300 +Subject: [PATCH] Add PlayerBlockDestroySpeedEvent + + +diff --git a/src/main/java/net/sparklypower/sparklypaper/event/block/PlayerBlockDestroySpeedEvent.java b/src/main/java/net/sparklypower/sparklypaper/event/block/PlayerBlockDestroySpeedEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d5e097dad04ed62088aade42ba59866029369326 +--- /dev/null ++++ b/src/main/java/net/sparklypower/sparklypaper/event/block/PlayerBlockDestroySpeedEvent.java +@@ -0,0 +1,64 @@ ++package net.sparklypower.sparklypaper.event.block; ++ ++import org.bukkit.block.Block; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.block.BlockEvent; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when the block destroy speed is calculated for a block that a player is breaking. ++ *

++ * Useful for custom blocks to override a server side block destroy speed to fix desynchronization issues between the server and the client. (Example: Chiseled bookshelves on the server side that are overriden by target blocks on the client side) ++ *

++ * Keep in mind that you should use this event to synchronize the block destroy speed between the server and the client! Not keeping both destroy speeds in sync will cause desync issues! ++ */ ++public class PlayerBlockDestroySpeedEvent extends BlockEvent { ++ private static final HandlerList handlers = new HandlerList(); ++ private final Player player; ++ private float destroySpeed; ++ ++ public PlayerBlockDestroySpeedEvent(@NotNull Player player, @NotNull Block block, float destroySpeed) { ++ super(block); ++ this.player = player; ++ this.destroySpeed = destroySpeed; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return handlers; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++ ++ /** ++ * Gets the Player that is breaking the block involved in this event. ++ * ++ * @return The Player that is breaking the block involved in this event ++ */ ++ @NotNull ++ public Player getPlayer() { ++ return player; ++ } ++ ++ /** ++ * Gets the block destroy speed of the block involved in this event. ++ * ++ * @return the block destroy speed of the block involved in this event. ++ */ ++ public float getDestroySpeed() { ++ return destroySpeed; ++ } ++ ++ /** ++ * Sets the block destroy speed of the block involved in this event. ++ */ ++ public void setDestroySpeed(float destroySpeed) { ++ this.destroySpeed = destroySpeed; ++ } ++} diff --git a/patches/unapplied/sparklypaper/api/0003-Add-CraftItemRecipeEvent.patch b/patches/unapplied/sparklypaper/api/0003-Add-CraftItemRecipeEvent.patch new file mode 100644 index 0000000..e25f248 --- /dev/null +++ b/patches/unapplied/sparklypaper/api/0003-Add-CraftItemRecipeEvent.patch @@ -0,0 +1,83 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Tue, 25 Jun 2024 02:54:47 -0300 +Subject: [PATCH] Add CraftItemRecipeEvent + +Used when a player OR a crafter block crafts an item, as an alternative to PrepareItemCraftEvent and CraftItemEvent, because both events are not triggered when a item is crafted from a crafter + +diff --git a/src/main/java/net/sparklypower/sparklypaper/event/inventory/CraftItemRecipeEvent.java b/src/main/java/net/sparklypower/sparklypaper/event/inventory/CraftItemRecipeEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..129e5244fd0928fc21d9aa7d4bc28e89c1408be0 +--- /dev/null ++++ b/src/main/java/net/sparklypower/sparklypaper/event/inventory/CraftItemRecipeEvent.java +@@ -0,0 +1,70 @@ ++package net.sparklypower.sparklypaper.event.inventory; ++ ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++import org.bukkit.inventory.*; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called when the recipe of an Item is completed inside a crafting matrix. ++ * ++ * This is an alternate version of [org.bukkit.event.inventory.CraftItemEvent], where this one is called for player crafting items and crafters. ++ */ ++public class CraftItemRecipeEvent extends Event implements Cancellable { ++ private static final HandlerList handlers = new HandlerList(); ++ private final Recipe recipe; ++ private final ItemStack @Nullable [] matrix; ++ private ItemStack result; ++ private boolean isCancelled = false; ++ ++ public CraftItemRecipeEvent(@NotNull ItemStack @Nullable [] matrix, @NotNull Recipe recipe, @Nullable ItemStack result) { ++ this.matrix = matrix; ++ this.recipe = recipe; ++ this.result = result; ++ } ++ ++ public void setResult(@Nullable ItemStack result) { ++ this.result = result; ++ } ++ ++ @Nullable ++ public ItemStack getResult() { ++ return result; ++ } ++ ++ /** ++ * @return A copy of the current recipe on the crafting matrix. ++ */ ++ @NotNull ++ public Recipe getRecipe() { ++ return recipe; ++ } ++ ++ public @Nullable ItemStack[] getCraftingMatrix() { ++ return matrix; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return isCancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.isCancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return handlers; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++} ++ diff --git a/patches/unapplied/sparklypaper/api/0004-SPARKLYPOWER-Add-custom-blocks.patch b/patches/unapplied/sparklypaper/api/0004-SPARKLYPOWER-Add-custom-blocks.patch new file mode 100644 index 0000000..a086f72 --- /dev/null +++ b/patches/unapplied/sparklypaper/api/0004-SPARKLYPOWER-Add-custom-blocks.patch @@ -0,0 +1,61 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Wed, 12 Jun 2024 11:53:27 -0300 +Subject: [PATCH] SPARKLYPOWER Add custom blocks + + +diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java +index 41eaa8159f8c028faa118300e95f6a0fb9cfe989..5b5ddb19b39d5201da422f9b10e2491ab9334925 100644 +--- a/src/main/java/com/destroystokyo/paper/MaterialTags.java ++++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java +@@ -83,6 +83,7 @@ public class MaterialTags { + */ + public static final MaterialSetTag CONCRETES = new MaterialSetTag(keyFor("concretes")) + .endsWith("_CONCRETE") ++ .notStartsWith("SPARKLYPOWER_") // SparklyPaper - custom blocks + .ensureSize("CONCRETES", 16).lock(); + + /** +@@ -161,6 +162,7 @@ public class MaterialTags { + .endsWith("TERRACOTTA") + .not(Material.TERRACOTTA) + .notEndsWith("GLAZED_TERRACOTTA") ++ .notStartsWith("SPARKLYPOWER_") // SparklyPaper - custom blocks + .ensureSize("STAINED_TERRACOTTA", 16).lock(); + + /** +@@ -168,6 +170,7 @@ public class MaterialTags { + */ + public static final MaterialSetTag TERRACOTTA = new MaterialSetTag(keyFor("terracotta")) + .endsWith("TERRACOTTA") ++ .notStartsWith("SPARKLYPOWER_") // SparklyPaper - custom blocks + .ensureSize("TERRACOTTA", 33).lock(); + + /** +diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java +index 028ac35df6c4d044d07b3869751736d418c1eb0e..dd9795e0725275b0fe5a3f4ecfd4d587a23f963f 100644 +--- a/src/main/java/org/bukkit/Material.java ++++ b/src/main/java/org/bukkit/Material.java +@@ -3843,6 +3843,22 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + BIG_DRIPLEAF_STEM(13167, Dripleaf.class), + POTTED_AZALEA_BUSH(20430), + POTTED_FLOWERING_AZALEA_BUSH(10609), ++ // SparklyPaper start - SparklyPower Survival custom blocks ++ // The IDs themselves doesn't have any correlation with anything, Spigot invented that for backwards compatibility ++ SPARKLYPOWER_RAINBOW_WOOL(13003), ++ SPARKLYPOWER_RAINBOW_CONCRETE(13004), ++ SPARKLYPOWER_RAINBOW_TERRACOTTA(13005), ++ SPARKLYPOWER_ASPHALT_SERVER(13006), ++ /** ++ * BlockData: {@link Slab} ++ */ ++ SPARKLYPOWER_ASPHALT_SERVER_SLAB(13007, Slab.class), ++ SPARKLYPOWER_ASPHALT_PLAYER(13008), ++ /** ++ * BlockData: {@link Slab} ++ */ ++ SPARKLYPOWER_ASPHALT_PLAYER_SLAB(13009, Slab.class), ++ // SparklyPaper end + // ----- Legacy Separator ----- + @Deprecated(since = "1.13") + LEGACY_AIR(0, 0), diff --git a/patches/unapplied/sparklypaper/removed/server/0003-Optimize-entity-coordinate-key.patch b/patches/unapplied/sparklypaper/removed/server/0003-Optimize-entity-coordinate-key.patch new file mode 100644 index 0000000..9f04fc4 --- /dev/null +++ b/patches/unapplied/sparklypaper/removed/server/0003-Optimize-entity-coordinate-key.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kevin Raneri +Date: Tue, 9 Nov 2021 14:33:16 -0500 +Subject: [PATCH] Optimize entity coordinate key + +When executing getCoordinateKey for entities (a hotpath), the JVM is +required to repeatedly cast doubles to longs. The performance impact of +this depends on the CPU architecture, but generally switching between +FPU and ALU incurs a significant performance hit. The casted/rounded +data is already available in the blockPosition struct, so we use that +instead of re-doing the casting. + +diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java +index 1d6b3fe2ce240af4ede61588795456b046eee6c9..cdcb1bff7913bfe86fed008271016a3175b6df90 100644 +--- a/src/main/java/io/papermc/paper/util/MCUtil.java ++++ b/src/main/java/io/papermc/paper/util/MCUtil.java +@@ -215,7 +215,7 @@ public final class MCUtil { + } + + public static long getCoordinateKey(final Entity entity) { +- return ((long)(MCUtil.fastFloor(entity.getZ()) >> 4) << 32) | ((MCUtil.fastFloor(entity.getX()) >> 4) & 0xFFFFFFFFL); ++ return ((long)(entity.blockPosition.getZ() >> 4) << 32) | ((entity.blockPosition.getX() >> 4) & 0xFFFFFFFFL); // Pufferfish - eliminate double->long cast in hotpath + } + + public static long getCoordinateKey(final ChunkPos pair) { +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 4ee843dfd826772c9157ca421d8fe1f36f814b51..41ce41e92f3722e7ffb3423c90663d7a677bf277 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -311,7 +311,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + public double yo; + public double zo; + private Vec3 position; +- private BlockPos blockPosition; ++ public BlockPos blockPosition; // Pufferfish - private->public + private ChunkPos chunkPosition; + private Vec3 deltaMovement; + private float yRot; diff --git a/patches/unapplied/sparklypaper/removed/server/0009-Avoid-unnecessary-ItemFrame-getItem-calls.patch b/patches/unapplied/sparklypaper/removed/server/0009-Avoid-unnecessary-ItemFrame-getItem-calls.patch new file mode 100644 index 0000000..c6a34f0 --- /dev/null +++ b/patches/unapplied/sparklypaper/removed/server/0009-Avoid-unnecessary-ItemFrame-getItem-calls.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Sat, 18 Nov 2023 21:04:53 -0300 +Subject: [PATCH] Avoid unnecessary ItemFrame#getItem() calls + +When ticking a item frame, on each tick, it checks if the item on the item frame is a map and, if it is, it adds the map to be carried by the entity player + +However, the "getItem()" call is a bit expensive, especially because this is only really used if the item in the item frame is a map + +We can avoid this call by checking if the "cachedMapId" is not null + +diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java +index aedf24ba0d64de855a59869052cbc2704e7dc134..f49585cfd485eed504e91887599ff25c3238c8fd 100644 +--- a/src/main/java/net/minecraft/server/level/ServerEntity.java ++++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +@@ -115,13 +115,14 @@ public class ServerEntity { + ItemFrame entityitemframe = (ItemFrame) entity; + + if (true || this.tickCount % 10 == 0) { // CraftBukkit - Moved below, should always enter this block +- ItemStack itemstack = entityitemframe.getItem(); +- +- if (this.level.paperConfig().maps.itemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig().maps.itemFrameCursorUpdateInterval == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable ++ if (this.level.paperConfig().maps.itemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig().maps.itemFrameCursorUpdateInterval == 0 && entityitemframe.cachedMapId != null) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable // SparklyPaper - avoid unnecessary ItemFrame#getItem() calls + Integer integer = entityitemframe.cachedMapId; // Paper + MapItemSavedData worldmap = MapItem.getSavedData(integer, this.level); + + if (worldmap != null) { ++ // SparklyPaper start - avoid unnecessary ItemFrame#getItem() calls ++ ItemStack itemstack = entityitemframe.getItem(); ++ if (itemstack.getItem() instanceof MapItem) { // fail-safe, what if the cached map ID is present but the item isn't a MapItem? (this should NEVER happen but, who knows) + Iterator iterator = this.trackedPlayers.iterator(); // CraftBukkit + + while (iterator.hasNext()) { +@@ -134,6 +135,7 @@ public class ServerEntity { + entityplayer.connection.send(packet); + } + } ++ } // SparklyPaper end + } + } + +diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +index 759ecd79534a7706f7d4a63eb9dacbefcfe54674..07739c3d74074b2668466250f944dfbe22d4dc86 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +@@ -50,7 +50,8 @@ public class ItemFrame extends HangingEntity { + public static final int NUM_ROTATIONS = 8; + public float dropChance; + public boolean fixed; +- public Integer cachedMapId; // Paper ++ @Nullable // SparklyPaper - avoid unnecessary ItemFrame#getItem() calls ++ public Integer cachedMapId = null; // Paper // SparklyPaper - avoid unnecessary ItemFrame#getItem() calls + + public ItemFrame(EntityType type, Level world) { + super(type, world); diff --git a/patches/unapplied/sparklypaper/removed/server/0016-Only-check-thundering-once-per-world-instead-for-eve.patch b/patches/unapplied/sparklypaper/removed/server/0016-Only-check-thundering-once-per-world-instead-for-eve.patch new file mode 100644 index 0000000..de6fada --- /dev/null +++ b/patches/unapplied/sparklypaper/removed/server/0016-Only-check-thundering-once-per-world-instead-for-eve.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Sun, 22 Oct 2023 12:27:26 -0300 +Subject: [PATCH] Only check thundering once per world instead for every chunk + +For some reason the isThundering check is consuming ~3% of CPU time when profiled so, instead of checking the thunder every chunk, we can cache the result and reuse on the same chunk tick + +diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +index c02ffd419236980cd063741612e99d739d97ec94..daa5948cc7b86a719a313ea595f135cd00b6a3cc 100644 +--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java ++++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +@@ -599,6 +599,7 @@ public class ServerChunkCache extends ChunkSource { + } + // Paper end - optimise chunk tick iteration + ++ this.level.isCurrentlyThundering = this.level.isThundering_old(); // SparklyPaper - Only check thundering once per world instead for every chunk + int chunksTicked = 0; // Paper + // Paper start - optimise chunk tick iteration + io.papermc.paper.util.player.NearbyPlayers nearbyPlayers = this.chunkMap.getNearbyPlayers(); // Paper - optimise chunk tick iteration +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index 9388dd9b34bb8148ce8b5f7e24122fa4bd1bafa8..0210226d2185803a18c0020d7985c1fccb798953 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -184,6 +184,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + private int tileTickPosition; + public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions + public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here ++ public boolean isCurrentlyThundering; // SparklyPaper - Only check if the world is currently thundering once instead for every chunk + + // Paper start - fix and optimise world upgrading + // copied from below +@@ -1614,7 +1615,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + this.rainLevel = f1; + } + ++ // SparklyPaper start - Only check thundering once per world instead for every chunk + public boolean isThundering() { ++ return isCurrentlyThundering; ++ } ++ public boolean isThundering_old() { ++ // SparklyPaper end + return this.dimensionType().hasSkyLight() && !this.dimensionType().hasCeiling() ? (double) this.getThunderLevel(1.0F) > 0.9D : false; + } + diff --git a/patches/unapplied/sparklypaper/removed/server/0017-Optimize-heavy-EntityLookup.ArrayIterable.-init-call.patch b/patches/unapplied/sparklypaper/removed/server/0017-Optimize-heavy-EntityLookup.ArrayIterable.-init-call.patch new file mode 100644 index 0000000..b9e4f06 --- /dev/null +++ b/patches/unapplied/sparklypaper/removed/server/0017-Optimize-heavy-EntityLookup.ArrayIterable.-init-call.patch @@ -0,0 +1,106 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Sat, 28 Oct 2023 19:02:12 -0300 +Subject: [PATCH] Optimize heavy EntityLookup.ArrayIterable.() calls on + tickChunks + +For some reason, on SparklyPower allocating an ArrayIterable is expensive, taking around ~2.5% of tick time (I have no idea why tho), because tickChunks() only uses this for the NaturalSpawner, let's avoid the array allocation by passing thru the raw array data + size + +diff --git a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java +index 15ee41452992714108efe53b708b5a4e1da7c1ff..f5a5796dda9e0e05ed9afc069c241dedd9aaffa0 100644 +--- a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java ++++ b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java +@@ -198,6 +198,12 @@ public final class EntityLookup implements LevelEntityGetter { + return Arrays.copyOf(this.accessibleEntities.getRawData(), this.accessibleEntities.size(), Entity[].class); + } + ++ // SparklyPaper start - Optimize heavy EntityLookup$ArrayIterable.() calls on tickChunks ++ public EntityList getAccessibleEntities() { ++ return this.accessibleEntities; ++ } ++ // SparklyPaper end ++ + @Override + public void get(final EntityTypeTest filter, final AbortableIterationConsumer action) { + final Int2ReferenceOpenHashMap entityCopy; +diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +index f8270b78ab0d561e55301e989d80fe7b4118337a..e51d06140153e7f9a6e41b20addf02ec94e0f72c 100644 +--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java ++++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +@@ -545,9 +545,9 @@ public class ServerChunkCache extends ChunkSource { + } + // Paper end - per player mob spawning backoff + } +- spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, null, true); ++ spawnercreature_d = NaturalSpawner.createState(l, this.level.getEntityLookup().getAccessibleEntities().getRawData(), this.level.getEntityLookup().getAccessibleEntities().size(), this::getFullChunk, null, true); // SparklyPaper - Optimize heavy EntityLookup$ArrayIterable.() calls on tickChunks + } else { +- spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false); ++ spawnercreature_d = NaturalSpawner.createState(l, this.level.getEntityLookup().getAccessibleEntities().getRawData(), this.level.getEntityLookup().getAccessibleEntities().size(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false); // SparklyPaper - Optimize heavy EntityLookup$ArrayIterable.() calls on tickChunks + } + // Paper end + this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings +diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +index 9c2d62feff1816f5729060c6192269a5b2d34153..78bcb0af0735fe0ccf68ed06d8dc78d6e8c37064 100644 +--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java ++++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +@@ -74,7 +74,60 @@ public final class NaturalSpawner { + return createState(spawningChunkCount, entities, chunkSource, densityCapper, false); + } + ++ // SparklyPaper start - Optimize heavy EntityLookup$ArrayIterable.() calls on tickChunks ++ public static NaturalSpawner.SpawnState createState(int spawningChunkCount, Entity[] entities, int count, NaturalSpawner.ChunkGetter chunkSource, LocalMobCapCalculator densityCapper, boolean countMobs) { ++ PotentialCalculator spawnercreatureprobabilities = new PotentialCalculator(); ++ Object2IntOpenHashMap object2intopenhashmap = new Object2IntOpenHashMap(); ++ ++ for (int index = 0; count > index; index++) { ++ Entity entity = entities[index]; ++ ++ if (entity instanceof Mob) { ++ Mob entityinsentient = (Mob) entity; ++ ++ if (entityinsentient.isPersistenceRequired() || entityinsentient.requiresCustomPersistence()) { ++ continue; ++ } ++ } ++ ++ MobCategory enumcreaturetype = entity.getType().getCategory(); ++ ++ if (enumcreaturetype != MobCategory.MISC) { ++ // Paper start - Only count natural spawns ++ if (!entity.level().paperConfig().entities.spawning.countAllMobsForSpawning && ++ !(entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL || ++ entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) { ++ continue; ++ } ++ // Paper end ++ BlockPos blockposition = entity.blockPosition(); ++ ++ chunkSource.query(ChunkPos.asLong(blockposition), (chunk) -> { ++ MobSpawnSettings.MobSpawnCost biomesettingsmobs_b = NaturalSpawner.getRoughBiome(blockposition, chunk).getMobSettings().getMobSpawnCost(entity.getType()); ++ ++ if (biomesettingsmobs_b != null) { ++ spawnercreatureprobabilities.addCharge(entity.blockPosition(), biomesettingsmobs_b.charge()); ++ } ++ ++ if (densityCapper != null && entity instanceof Mob) { // Paper ++ densityCapper.addMob(chunk.getPos(), enumcreaturetype); ++ } ++ ++ object2intopenhashmap.addTo(enumcreaturetype, 1); ++ // Paper start ++ if (countMobs) { ++ chunk.level.getChunkSource().chunkMap.updatePlayerMobTypeMap(entity); ++ } ++ // Paper end ++ }); ++ } ++ } ++ ++ return new NaturalSpawner.SpawnState(spawningChunkCount, object2intopenhashmap, spawnercreatureprobabilities, densityCapper); ++ } ++ + public static NaturalSpawner.SpawnState createState(int spawningChunkCount, Iterable entities, NaturalSpawner.ChunkGetter chunkSource, LocalMobCapCalculator densityCapper, boolean countMobs) { ++ // SparklyPaper end + // Paper end + PotentialCalculator spawnercreatureprobabilities = new PotentialCalculator(); + Object2IntOpenHashMap object2intopenhashmap = new Object2IntOpenHashMap(); diff --git a/patches/unapplied/sparklypaper/removed/server/0019-BlockEntityTickersList-optimization-tests.patch b/patches/unapplied/sparklypaper/removed/server/0019-BlockEntityTickersList-optimization-tests.patch new file mode 100644 index 0000000..6f4e43f --- /dev/null +++ b/patches/unapplied/sparklypaper/removed/server/0019-BlockEntityTickersList-optimization-tests.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Fri, 24 Nov 2023 23:37:24 -0300 +Subject: [PATCH] BlockEntityTickersList optimization tests + + +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index 94eac6837c06e6fd192c108632f1e365a008d6ad..3588657da9969b4207bbeb8109bc101384c03398 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -1274,8 +1274,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + // Iterator iterator = this.blockEntityTickers.iterator(); + int tilesThisCycle = 0; + // SparklyPaper start - optimize tickBlockEntities +- // var toRemove = new it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet(net.minecraft.Util.identityStrategy()); // Paper - use removeAll +- // toRemove.add(null); ++ var toRemoveOld = new it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet(net.minecraft.Util.identityStrategy()); // Paper - use removeAll ++ toRemoveOld.add(null); + var toRemove = new java.util.HashSet(); // For some reason, Java's HashSet seems to be faster than fastutil's only if we are removing HUGE amounts of tile entities, idk why + var startSearchFromIndex = -1; + var shouldTickBlocksAtLastResult = -1; // -1 = undefined +@@ -1301,13 +1301,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + // Spigot start + tilesThisCycle--; + // SparklyPaper start - optimize tickBlockEntities +- // toRemove.add(tickingblockentity); // Paper - use removeAll ++ toRemoveOld.add(tickingblockentity); // Paper - use removeAll + toRemove.add(tileTickPosition); + if (startSearchFromIndex == -1) + startSearchFromIndex = tileTickPosition; + // SparklyPaper end + // Spigot end +- // } else if (this.shouldTickBlocksAt(tickingblockentity.getPos())) { // SparklyPaper start - optimize tickBlockEntities ++ // } else if (this.shouldTickBlocksAt(tickingblockentity.getPos())) { // SparklyPaper start - optimize tickBlockEntities + } else { + long chunkPos = tickingblockentity.getChunkCoordinateKey(); + boolean shouldTick; +@@ -1319,18 +1319,47 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + shouldTickBlocksAtChunkPos = chunkPos; + } + if (shouldTick) { +- tickingblockentity.tick(); +- // Paper start - execute chunk tasks during tick +- if ((this.tileTickPosition & 7) == 0) { +- // MinecraftServer.getServer().executeMidTickTasks(); // SparklyPaper - parallel world ticking (only run mid-tick at the end of each tick / fixes concurrency bugs related to executeMidTickTasks) +- } +- // Paper end - execute chunk tasks during tick ++ tickingblockentity.tick(); ++ // Paper start - execute chunk tasks during tick ++ if ((this.tileTickPosition & 7) == 0) { ++ // MinecraftServer.getServer().executeMidTickTasks(); // SparklyPaper - parallel world ticking (only run mid-tick at the end of each tick / fixes concurrency bugs related to executeMidTickTasks) ++ } ++ // Paper end - execute chunk tasks during tick + } // SparklyPaper end + } + } + // SparklyPaper start - optimize tickBlockEntities +- // this.blockEntityTickers.removeAll(toRemove); +- this.blockEntityTickers.removeAllByIndex(startSearchFromIndex, toRemove); // We don't need to care about if the startSearchFromIndex can be -1 here, since if it is -1, then the toRemove list is empty and the call will fast fail ++ java.util.ArrayList oldList = new java.util.ArrayList<>(this.blockEntityTickers); ++ long diffOld = 0; ++ long diffNew = 0; ++ if (toRemoveOld.size() != 1) { // the old one always have null as the first element ++ var startOld = System.nanoTime(); ++ oldList.removeAll(toRemoveOld); ++ var endOld = System.nanoTime(); ++ diffOld = endOld - startOld; ++ System.out.println("Old version deleted " + toRemoveOld.size() + " elements, took " + diffOld + "ns"); ++ } ++ if (startSearchFromIndex != -1) { ++ var start = System.nanoTime(); ++ this.blockEntityTickers.removeAllByIndex(startSearchFromIndex, toRemove); // We don't need to care about if the startSearchFromIndex can be -1 here, since if it is -1, then the toRemove list is empty and the call will fast fail ++ var end = System.nanoTime(); ++ System.out.println("(current tick: " + this.getServer().getTickCount() + ") startSearchFromIndex: " + startSearchFromIndex + " - toRemove: " + toRemove); ++ diffNew = end - start; ++ System.out.println("New version deleted " + toRemove.size() + " elements, took " + diffNew + "ns"); ++ } ++ if (toRemove.size() != 0) { ++ System.out.println("Equals? " + oldList.equals(this.blockEntityTickers)); ++ String winner = "Unknown"; ++ long perfIncrease = 0; ++ if (diffOld > diffNew) { ++ winner = "New Version"; ++ perfIncrease = diffOld - diffNew; ++ } else { ++ winner = "Old Version"; ++ perfIncrease = diffNew - diffOld; ++ } ++ System.out.println("Who won? " + winner + ", by " + perfIncrease + "ns"); ++ } + // SparklyPaper end + this.timings.tileEntityTick.stopTiming(); // Spigot + this.tickingBlockEntities = false; diff --git a/patches/unapplied/sparklypaper/server/0012-Revert-Fix-MC-117075-Block-entity-unload-lag-spike.patch b/patches/unapplied/sparklypaper/server/0012-Revert-Fix-MC-117075-Block-entity-unload-lag-spike.patch new file mode 100644 index 0000000..2cdcbf7 --- /dev/null +++ b/patches/unapplied/sparklypaper/server/0012-Revert-Fix-MC-117075-Block-entity-unload-lag-spike.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Sun, 18 Feb 2024 14:22:37 -0300 +Subject: [PATCH] Revert "Fix MC-117075: Block entity unload lag spike" + +This reverts commit f3453b204569ea865cc1d1302edb6d125e7f0cb3. + +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index 8433caa61a973d81a5eedc44428926e999c21a03..db9eb10c33848ca5b342bf00e4a05738210d26b0 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -1458,8 +1458,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + int tickedEntities = 0; // Paper - rewrite chunk system + + int tilesThisCycle = 0; +- var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet(); // Paper - Fix MC-117075; use removeAll +- toRemove.add(null); // Paper - Fix MC-117075 + for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters + this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0; + TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition); +@@ -1468,7 +1466,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + if (tickingblockentity.isRemoved()) { + // Spigot start + tilesThisCycle--; +- toRemove.add(tickingblockentity); // Paper - Fix MC-117075; use removeAll ++ this.blockEntityTickers.remove(this.tileTickPosition--); + // Spigot end + } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) { + tickingblockentity.tick(); +@@ -1479,7 +1477,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + // Paper end - rewrite chunk system + } + } +- this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 + + this.tickingBlockEntities = false; + gameprofilerfiller.pop(); diff --git a/patches/unapplied/sparklypaper/server/0014-Optimize-tickBlockEntities.patch b/patches/unapplied/sparklypaper/server/0014-Optimize-tickBlockEntities.patch new file mode 100644 index 0000000..60a29a2 --- /dev/null +++ b/patches/unapplied/sparklypaper/server/0014-Optimize-tickBlockEntities.patch @@ -0,0 +1,123 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Sun, 26 Nov 2023 13:11:10 -0300 +Subject: [PATCH] Optimize tickBlockEntities + +We cache the last `shouldTickBlocksAt` result, because the `shouldTickBlocksAt` is expensive because it requires pulling chunk holder info from an map for each block entity (even if the block entities are on the same chunk!) every single time. So, if the last chunk position is the same as our cached value, we use the last cached `shouldTickBlocksAt` result! + +We could use a map for caching, but here's why this is way better than using a map: The block entity ticking list is sorted by chunks! Well, sort of... It is sorted by chunk when the chunk has been loaded, newly placed blocks will be appended to the end of the list until the chunk unloads and loads again. Most block entities are things that players placed to be there for a long time anyway (like hoppers, etc) + +But here's the thing: We don't care if we have a small performance penalty if the players have placed new block entities, the small performance hit of when a player placed new block entities is so small ('tis just a long comparsion after all), that the performance boost from already placed block entities is bigger, this helps a lot if your server has a lot of chunks with multiple block entities, and the block entities will be automatically sorted after the chunk is unloaded and loaded again, so it ain't that bad. + +And finally, we also cache the chunk's coordinate key when creating the block entity, which is actually "free" because we just reuse the already cached chunk coordinate key from the chunk! + +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index 1e20c525cd0c75079fe971ae830120c69fee362e..97b31dffbaf965e86ad706a1bba7586cd3514ead 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -1458,6 +1458,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + int tickedEntities = 0; // Paper - rewrite chunk system + + int tilesThisCycle = 0; ++ // SparklyPaper start - optimize tickBlockEntities ++ int shouldTickBlocksAtLastResult = -1; // -1 = undefined ++ long shouldTickBlocksAtChunkPos = 0L; ++ // SparklyPaper end + for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters + this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0; + TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition); +@@ -1468,13 +1472,25 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + tilesThisCycle--; + this.blockEntityTickers.markAsRemoved(this.tileTickPosition); // this.blockEntityTickers.remove(this.tileTickPosition--); // SparklyPaper - optimize block entity removals + // Spigot end +- } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) { ++ // } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) { // SparklyPaper start - optimize tickBlockEntities ++ } else if (flag) { ++ long chunkPos = tickingblockentity.getChunkCoordinateKey(); ++ boolean shouldTick; ++ if (shouldTickBlocksAtChunkPos == chunkPos && shouldTickBlocksAtLastResult != -1) { ++ shouldTick = shouldTickBlocksAtLastResult == 1; ++ } else { ++ shouldTick = this.shouldTickBlocksAt(chunkPos); ++ shouldTickBlocksAtLastResult = shouldTick ? 1 : 0; ++ shouldTickBlocksAtChunkPos = chunkPos; ++ } ++ if (shouldTick) { + tickingblockentity.tick(); + // Paper start - rewrite chunk system + if ((++tickedEntities & 7) == 0) { + ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)(Level)(Object)this).moonrise$midTickTasks(); + } + // Paper end - rewrite chunk system ++ } // SparklyPaper end + } + } + this.blockEntityTickers.removeMarkedEntries(); // SparklyPaper - optimize block entity removals +diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +index 4640baec5bed6c2d53cc0f8ca1d273cc115abe9b..b4c16fe7c9215b5610b7e7488c29b497b5357ecc 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -75,6 +75,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + public String getType() { + return ""; + } ++ ++ // SparklyPaper start - optimize tickBlockEntities ++ @Override ++ public long getChunkCoordinateKey() { ++ return 0; ++ } ++ // SparklyPaper end + }; + private final Map tickersInLevel; + public boolean loaded; +@@ -981,7 +988,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + } + + private TickingBlockEntity createTicker(T blockEntity, BlockEntityTicker blockEntityTicker) { +- return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, blockEntityTicker); ++ return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, blockEntityTicker, this.coordinateKey); // SparklyPaper - optimize tickBlockEntities + } + + @FunctionalInterface +@@ -1038,6 +1045,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + public String toString() { + return String.valueOf(this.ticker) + " "; + } ++ ++ // SparklyPaper start - optimize tickBlockEntities ++ @Override ++ public long getChunkCoordinateKey() { ++ return this.ticker.getChunkCoordinateKey(); ++ } ++ // SparklyPaper end + } + + private class BoundTickingBlockEntity implements TickingBlockEntity { +@@ -1045,10 +1059,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + private final T blockEntity; + private final BlockEntityTicker ticker; + private boolean loggedInvalidBlockState; ++ private final long chunkCoordinateKey; // SparklyPaper - optimize tickBlockEntities + +- BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker) { ++ BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker, long chunkCoordinateKey) { // SparklyPaper - optimize tickBlockEntities + this.blockEntity = (T) tileentity; // CraftBukkit - decompile error + this.ticker = blockentityticker; ++ this.chunkCoordinateKey = chunkCoordinateKey; // SparklyPaper - optimize tickBlockEntities + } + + @Override +@@ -1112,5 +1128,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + + return "Level ticker for " + s + "@" + String.valueOf(this.getPos()); + } ++ ++ // SparklyPaper start - optimize tickBlockEntities ++ @Override ++ public long getChunkCoordinateKey() { ++ return this.chunkCoordinateKey; ++ } ++ // SparklyPaper end + } + } diff --git a/patches/unapplied/sparklypaper/server/0017-Add-ClientboundPacketPreDispatchEvent.patch b/patches/unapplied/sparklypaper/server/0017-Add-ClientboundPacketPreDispatchEvent.patch new file mode 100644 index 0000000..92056a1 --- /dev/null +++ b/patches/unapplied/sparklypaper/server/0017-Add-ClientboundPacketPreDispatchEvent.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Mon, 10 Jun 2024 12:22:15 -0300 +Subject: [PATCH] Add ClientboundPacketPreDispatchEvent + + +diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java +index 3e550f8e7cd4f4e16f499a8a2a4b95420270f07a..3bcff05a99662c28cc490579162a1f05b55b1cda 100644 +--- a/src/main/java/net/minecraft/network/Connection.java ++++ b/src/main/java/net/minecraft/network/Connection.java +@@ -450,6 +450,18 @@ public class Connection extends SimpleChannelInboundHandler> { + return; + } + ++ // SparklyPaper start - Add ClientboundPacketPreDispatchEvent ++ net.minecraft.server.level.ServerPlayer serverPlayer = this.getPlayer(); ++ org.bukkit.craftbukkit.entity.CraftPlayer craftPlayer = null; ++ if (serverPlayer != null) ++ craftPlayer = serverPlayer.getBukkitEntity(); ++ net.sparklypower.sparklypaper.event.packet.ClientboundPacketPreDispatchEvent event = new net.sparklypower.sparklypaper.event.packet.ClientboundPacketPreDispatchEvent(!org.bukkit.Bukkit.isPrimaryThread(), craftPlayer, packet); ++ org.bukkit.Bukkit.getPluginManager().callEvent(event); ++ if (event.isCancelled()) ++ return; ++ packet = (Packet) event.getPacket(); ++ // SparklyPaper end ++ + packet.onPacketDispatch(this.getPlayer()); + if (connected && (InnerUtil.canSendImmediate(this, packet) + || (io.papermc.paper.util.MCUtil.isMainThread() && packet.isReady() && this.pendingActions.isEmpty() diff --git a/patches/unapplied/sparklypaper/server/0018-Helpful-NMS-packet-changes.patch b/patches/unapplied/sparklypaper/server/0018-Helpful-NMS-packet-changes.patch new file mode 100644 index 0000000..af26ebc --- /dev/null +++ b/patches/unapplied/sparklypaper/server/0018-Helpful-NMS-packet-changes.patch @@ -0,0 +1,144 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Mon, 10 Jun 2024 13:06:30 -0300 +Subject: [PATCH] Helpful NMS packet changes + +Some nice changes to the packet internals to make packet sending and manipulation easier for us to avoid Reflection and JVM internals (ooo theUnsafe spooky) usage + +diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundAddEntityPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundAddEntityPacket.java +index f66e40326c510aa3267542b1a24ed75d1ed6d3f1..797640c4f26abb32a480a611820bbcd72e43d1ac 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundAddEntityPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundAddEntityPacket.java +@@ -22,7 +22,7 @@ public class ClientboundAddEntityPacket implements Packet type; ++ public EntityType type; // SparklyPaper - Helpful NMS packet changes: remove final and make public + private final double x; + private final double y; + private final double z; +@@ -180,6 +180,32 @@ public class ClientboundAddEntityPacket implements Packet blockEntitiesData; + // Paper start - Handle oversized block entities in chunks + private final java.util.List> extraPackets = new java.util.ArrayList<>(); +diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundRotateHeadPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundRotateHeadPacket.java +index ab44c24ce5f4570dee9d84b4216299bedfa800d8..99fbb958b82a3398564febb1e87e3ef4efca5b1a 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundRotateHeadPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundRotateHeadPacket.java +@@ -20,6 +20,13 @@ public class ClientboundRotateHeadPacket implements Packet STREAM_CODEC = Packet.codec(ClientboundSectionBlocksUpdatePacket::write, ClientboundSectionBlocksUpdatePacket::new); + private static final int POS_IN_SECTION_BITS = 12; +- private final SectionPos sectionPos; +- private final short[] positions; +- private final BlockState[] states; ++ public SectionPos sectionPos; // SparklyPaper - Helpful NMS packet changes: remove final and make public ++ public short[] positions; // SparklyPaper - Helpful NMS packet changes: remove final and make public ++ public BlockState[] states; // SparklyPaper - Helpful NMS packet changes: remove final and make public + + public ClientboundSectionBlocksUpdatePacket(SectionPos sectionPos, ShortSet positions, LevelChunkSection section) { + this.sectionPos = sectionPos; +diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetCameraPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetCameraPacket.java +index 799f5a8c69f295216997d52fb4bc6c56d3a18115..633f10f17eebd43e8dc7c878b9101decf31190a9 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetCameraPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetCameraPacket.java +@@ -18,6 +18,12 @@ public class ClientboundSetCameraPacket implements Packet DATA_TEXT_ID = SynchedEntityData.defineId(Display.TextDisplay.class, EntityDataSerializers.COMPONENT); ++ public static final EntityDataAccessor DATA_TEXT_ID = SynchedEntityData.defineId(Display.TextDisplay.class, EntityDataSerializers.COMPONENT); // SparklyPaper - Helpful NMS packet changes: make public + public static final EntityDataAccessor DATA_LINE_WIDTH_ID = SynchedEntityData.defineId(Display.TextDisplay.class, EntityDataSerializers.INT); + public static final EntityDataAccessor DATA_BACKGROUND_COLOR_ID = SynchedEntityData.defineId( + Display.TextDisplay.class, EntityDataSerializers.INT diff --git a/patches/unapplied/sparklypaper/server/0019-Add-PlayerBlockDestroySpeedEvent.patch b/patches/unapplied/sparklypaper/server/0019-Add-PlayerBlockDestroySpeedEvent.patch new file mode 100644 index 0000000..f1391c2 --- /dev/null +++ b/patches/unapplied/sparklypaper/server/0019-Add-PlayerBlockDestroySpeedEvent.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Mon, 10 Jun 2024 14:39:10 -0300 +Subject: [PATCH] Add PlayerBlockDestroySpeedEvent + + +diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +index 99fd67a78539133adf78d65e2c520ff3dd260301..96640ae707c9babe1c4f4895f39d4d7cfc71a765 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java ++++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +@@ -336,6 +336,14 @@ public abstract class BlockBehaviour implements FeatureElement { + protected float getDestroyProgress(BlockState state, Player player, BlockGetter world, BlockPos pos) { + float f = state.getDestroySpeed(world, pos); + ++ // SparklyPaper start - Add PlayerBlockDestroySpeedEvent ++ // *Technically* it seems that all getDestroyProgress calls use a LevelAccessor, but anyway... ++ if (world instanceof LevelAccessor) { ++ net.sparklypower.sparklypaper.event.block.PlayerBlockDestroySpeedEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerBlockDestroySpeedEvent(player, (LevelAccessor) world, pos, f); ++ f = event.getDestroySpeed(); ++ } ++ // SparklyPaper end ++ + if (f == -1.0F) { + return 0.0F; + } else { +diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +index e37aaf77f94b97b736cc20ef070cefdff0400188..a46f0c810ee2b9679c0530e5e6d3505b3d1f661c 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -2271,4 +2271,13 @@ public class CraftEventFactory { + return event; + } + // Paper end - add EntityFertilizeEggEvent ++ ++ // SparklyPaper start - add PlayerBlockDestroySpeedEvent ++ public static net.sparklypower.sparklypaper.event.block.PlayerBlockDestroySpeedEvent callPlayerBlockDestroySpeedEvent(net.minecraft.world.entity.player.Player player, LevelAccessor world, BlockPos blockPos, float destroySpeed) { ++ org.bukkit.block.Block block = CraftBlock.at(world, blockPos); ++ net.sparklypower.sparklypaper.event.block.PlayerBlockDestroySpeedEvent event = new net.sparklypower.sparklypaper.event.block.PlayerBlockDestroySpeedEvent((Player) player.getBukkitEntity(), block, destroySpeed); ++ event.callEvent(); ++ return event; ++ } ++ // SparklyPaper end + } diff --git a/patches/unapplied/sparklypaper/server/0020-Add-CraftItemRecipeEvent.patch b/patches/unapplied/sparklypaper/server/0020-Add-CraftItemRecipeEvent.patch new file mode 100644 index 0000000..0a04232 --- /dev/null +++ b/patches/unapplied/sparklypaper/server/0020-Add-CraftItemRecipeEvent.patch @@ -0,0 +1,80 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Tue, 25 Jun 2024 02:52:32 -0300 +Subject: [PATCH] Add CraftItemRecipeEvent + +Used when a player OR a crafter block crafts an item, as an alternative to PrepareItemCraftEvent and CraftItemEvent, because both events are not triggered when a item is crafted from a crafter + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..01a67fde6c823cac52a6b09720f09acc825d3f86 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -3218,6 +3218,21 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + } else { + event = new CraftItemEvent(recipe, inventory, type, packet.getSlotNum(), click, action); + } ++ // SparklyPaper start - add CraftItemRecipeEvent ++ // We will pigback a bit on the current implementation ++ net.sparklypower.sparklypaper.event.inventory.CraftItemRecipeEvent craftItemRecipeEvent = new net.sparklypower.sparklypaper.event.inventory.CraftItemRecipeEvent( ++ ((CraftingInventory) top).getMatrix(), // We cannot use the top inventory directly because (it seems) that the first slot is the "result" slot ++ recipe, ++ event.getCurrentItem() ++ ); ++ if (craftItemRecipeEvent.callEvent()) { ++ event.setCurrentItem(craftItemRecipeEvent.getResult()); ++ } else { ++ event.setCancelled(true); ++ cancelled = true; ++ event.setCurrentItem(craftItemRecipeEvent.getResult()); ++ } ++ // SparklyPaper end + } + } + +diff --git a/src/main/java/net/minecraft/world/level/block/CrafterBlock.java b/src/main/java/net/minecraft/world/level/block/CrafterBlock.java +index 0e609b1e3abd50b415d8376dc550375a8a0251b6..8dbac20e32b70879eeee1c3563948e36c2eae342 100644 +--- a/src/main/java/net/minecraft/world/level/block/CrafterBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/CrafterBlock.java +@@ -203,6 +203,13 @@ public class CrafterBlock extends BaseEntityBlock { + } + itemstack = CraftItemStack.asNMSCopy(event.getResult()); + // CraftBukkit end ++ // SparklyPaper - add CraftItemRecipeEvent ++ net.sparklypower.sparklypaper.event.inventory.CraftItemRecipeEvent sparklyEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callCraftItemRecipeEvent(crafterblockentity, recipeholder.toBukkitRecipe(), itemstack); ++ if (sparklyEvent.isCancelled()) { ++ return; ++ } ++ itemstack = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(sparklyEvent.getResult()); ++ // SparklyPaper end + if (itemstack.isEmpty()) { + world.levelEvent(1050, pos, 0); + } else { +diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +index a46f0c810ee2b9679c0530e5e6d3505b3d1f661c..85926a55066ac793b2e4cfe3502f9ab201df91a3 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -1471,6 +1471,24 @@ public class CraftEventFactory { + Bukkit.getPluginManager().callEvent(crafterCraftEvent); + return crafterCraftEvent; + } ++ ++ // SparklyPaper start - add CraftItemRecipeEvent ++ public static net.sparklypower.sparklypaper.event.inventory.CraftItemRecipeEvent callCraftItemRecipeEvent(net.minecraft.world.inventory.CraftingContainer container, Recipe recipe, ItemStack result) { ++ org.bukkit.inventory.ItemStack[] matrix = new org.bukkit.inventory.ItemStack[container.getItems().size()]; ++ int i = 0; ++ for (ItemStack item : container.getItems()) { ++ matrix[i] = CraftItemStack.asCraftMirror(item); ++ i++; ++ } ++ org.bukkit.inventory.ItemStack bukkitResult = CraftItemStack.asCraftMirror(result); ++ ++ net.sparklypower.sparklypaper.event.inventory.CraftItemRecipeEvent event = new net.sparklypower.sparklypaper.event.inventory.CraftItemRecipeEvent(matrix, recipe, bukkitResult); ++ Bukkit.getPluginManager().callEvent(event); ++ ++ return event; ++ } ++ // SparklyPaper end ++ + // Paper start + @Deprecated + public static com.destroystokyo.paper.event.entity.ProjectileCollideEvent callProjectileCollideEvent(Entity entity, EntityHitResult position) { diff --git a/patches/unapplied/sparklypaper/server/0023-Parallel-world-ticking.patch b/patches/unapplied/sparklypaper/server/0023-Parallel-world-ticking.patch new file mode 100644 index 0000000..913ae99 --- /dev/null +++ b/patches/unapplied/sparklypaper/server/0023-Parallel-world-ticking.patch @@ -0,0 +1,1897 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Tue, 7 Nov 2023 01:34:14 -0300 +Subject: [PATCH] Parallel world ticking + +"mom can we have folia?" "we already have folia at home" folia at home: + +diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java +index 217d1f908a36a5177ba3cbb80a33f73d4dab0fa0..aec59213525039d6cf38ab8c3acfd45116c75eed 100644 +--- a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java ++++ b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java +@@ -14,6 +14,7 @@ import java.util.concurrent.atomic.AtomicInteger; + public class TickThread extends Thread { + + private static final Logger LOGGER = LoggerFactory.getLogger(TickThread.class); ++ public static final boolean HARD_THROW = !Boolean.getBoolean("sparklypaper.disableHardThrow"); // SparklyPaper - parallel world ticking - THIS SHOULD NOT BE DISABLED SINCE IT CAN CAUSE DATA CORRUPTION!!! Anyhow, for production servers, if you want to make a test run to see if the server could crash, you can test it with this disabled + + /** + * @deprecated +@@ -22,52 +23,121 @@ public class TickThread extends Thread { + public static void ensureTickThread(final String reason) { + if (!isTickThread()) { + LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); +- throw new IllegalStateException(reason); ++ if (HARD_THROW) ++ throw new IllegalStateException(reason); + } + } + + public static void ensureTickThread(final Level world, final BlockPos pos, final String reason) { + if (!isTickThreadFor(world, pos)) { +- LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); +- throw new IllegalStateException(reason); ++ LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason + " @ world " + world.getWorld().getName() + " blockPos: " + pos + " - " + getTickThreadInformation(world.getServer()), new Throwable()); ++ if (HARD_THROW) ++ throw new IllegalStateException(reason); + } + } + + public static void ensureTickThread(final Level world, final ChunkPos pos, final String reason) { + if (!isTickThreadFor(world, pos)) { +- LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); +- throw new IllegalStateException(reason); ++ LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason + " @ world " + world.getWorld().getName() + " chunkPos: " + pos + " - " + getTickThreadInformation(world.getServer()), new Throwable()); ++ if (HARD_THROW) ++ throw new IllegalStateException(reason); + } + } + + public static void ensureTickThread(final Level world, final int chunkX, final int chunkZ, final String reason) { + if (!isTickThreadFor(world, chunkX, chunkZ)) { +- LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); +- throw new IllegalStateException(reason); ++ LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason + " @ world " + world.getWorld().getName() + " chunkX: " + chunkX + " chunkZ: " + chunkZ + " - " + getTickThreadInformation(world.getServer()), new Throwable()); ++ if (HARD_THROW) ++ throw new IllegalStateException(reason); + } + } + + public static void ensureTickThread(final Entity entity, final String reason) { + if (!isTickThreadFor(entity)) { +- LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); +- throw new IllegalStateException(reason); ++ LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason + " @ entity " + entity.getStringUUID() + " - " + getTickThreadInformation(entity.getServer()), new Throwable()); ++ if (HARD_THROW) ++ throw new IllegalStateException(reason); + } + } + + public static void ensureTickThread(final Level world, final AABB aabb, final String reason) { + if (!isTickThreadFor(world, aabb)) { +- LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); +- throw new IllegalStateException(reason); ++ LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason + " @ world " + world.getWorld().getName() + " aabb: " + aabb + " - " + getTickThreadInformation(world.getServer()), new Throwable()); ++ if (HARD_THROW) ++ throw new IllegalStateException(reason); + } + } + + public static void ensureTickThread(final Level world, final double blockX, final double blockZ, final String reason) { + if (!isTickThreadFor(world, blockX, blockZ)) { +- LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); +- throw new IllegalStateException(reason); ++ LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason + " @ world " + world.getWorld().getName() + " blockX: " + blockX + " blockZ: " + blockZ + " - " + getTickThreadInformation(world.getServer()), new Throwable()); ++ if (HARD_THROW) ++ throw new IllegalStateException(reason); + } + } + ++ // SparklyPaper - parallel world ticking ++ // This is an additional method to check if the tick thread is bound to a specific world because, by default, Paper's isTickThread methods do not provide this information ++ // Because we only tick worlds in parallel (instead of regions), we can use this for our checks ++ public static void ensureTickThread(final net.minecraft.server.level.ServerLevel world, final String reason) { ++ if (!isTickThreadFor(world)) { ++ LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason + " @ world " + world.getWorld().getName() + " - " + getTickThreadInformation(world.getServer()), new Throwable()); ++ if (HARD_THROW) ++ throw new IllegalStateException(reason); ++ } ++ } ++ ++ // SparklyPaper - parallel world ticking ++ // This is an additional method to check if it is a tick thread but ONLY a tick thread ++ public static void ensureOnlyTickThread(final String reason) { ++ boolean isTickThread = isTickThread(); ++ boolean isServerLevelTickThread = isServerLevelTickThread(); ++ if (!isTickThread || isServerLevelTickThread) { ++ LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread ONLY tick thread check: " + reason, new Throwable()); ++ if (HARD_THROW) ++ throw new IllegalStateException(reason); ++ } ++ } ++ ++ // SparklyPaper - parallel world ticking ++ // This is an additional method to check if the tick thread is bound to a specific world or if it is an async thread. ++ public static void ensureTickThreadOrAsyncThread(final net.minecraft.server.level.ServerLevel world, final String reason) { ++ boolean isValidTickThread = isTickThreadFor(world); ++ boolean isAsyncThread = !isTickThread(); ++ boolean isValid = isAsyncThread || isValidTickThread; ++ if (!isValid) { ++ LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread or async thread check: " + reason + " @ world " + world.getWorld().getName() + " - " + getTickThreadInformation(world.getServer()), new Throwable()); ++ if (HARD_THROW) ++ throw new IllegalStateException(reason); ++ } ++ } ++ ++ public static String getTickThreadInformation(net.minecraft.server.MinecraftServer minecraftServer) { ++ StringBuilder sb = new StringBuilder(); ++ Thread currentThread = Thread.currentThread(); ++ sb.append("Is tick thread? "); ++ sb.append(currentThread instanceof TickThread); ++ sb.append("; Is server level tick thread? "); ++ sb.append(currentThread instanceof ServerLevelTickThread); ++ if (currentThread instanceof ServerLevelTickThread serverLevelTickThread) { ++ sb.append("; Currently ticking level: "); ++ if (serverLevelTickThread.currentlyTickingServerLevel != null) { ++ sb.append(serverLevelTickThread.currentlyTickingServerLevel.getWorld().getName()); ++ } else { ++ sb.append("null"); ++ } ++ } ++ sb.append("; Is iterating over levels? "); ++ sb.append(minecraftServer.isIteratingOverLevels); ++ sb.append("; Are we going to hard throw? "); ++ sb.append(HARD_THROW); ++ return sb.toString(); ++ } ++ ++ public static boolean isServerLevelTickThread() { ++ return Thread.currentThread() instanceof ServerLevelTickThread; ++ } ++ + public final int id; /* We don't override getId as the spec requires that it be unique (with respect to all other threads) */ + + private static final AtomicInteger ID_GENERATOR = new AtomicInteger(); +@@ -102,42 +172,111 @@ public class TickThread extends Thread { + } + + public static boolean isTickThreadFor(final Level world, final BlockPos pos) { +- return isTickThread(); ++ Thread currentThread = Thread.currentThread(); ++ ++ if (currentThread instanceof ServerLevelTickThread serverLevelTickThread) { ++ return serverLevelTickThread.currentlyTickingServerLevel == world; ++ } else return currentThread instanceof TickThread; + } + + public static boolean isTickThreadFor(final Level world, final ChunkPos pos) { +- return isTickThread(); ++ Thread currentThread = Thread.currentThread(); ++ ++ if (currentThread instanceof ServerLevelTickThread serverLevelTickThread) { ++ return serverLevelTickThread.currentlyTickingServerLevel == world; ++ } else return currentThread instanceof TickThread; + } + + public static boolean isTickThreadFor(final Level world, final Vec3 pos) { +- return isTickThread(); ++ Thread currentThread = Thread.currentThread(); ++ ++ if (currentThread instanceof ServerLevelTickThread serverLevelTickThread) { ++ return serverLevelTickThread.currentlyTickingServerLevel == world; ++ } else return currentThread instanceof TickThread; + } + + public static boolean isTickThreadFor(final Level world, final int chunkX, final int chunkZ) { +- return isTickThread(); ++ Thread currentThread = Thread.currentThread(); ++ ++ if (currentThread instanceof ServerLevelTickThread serverLevelTickThread) { ++ return serverLevelTickThread.currentlyTickingServerLevel == world; ++ } else return currentThread instanceof TickThread; + } + + public static boolean isTickThreadFor(final Level world, final AABB aabb) { +- return isTickThread(); ++ Thread currentThread = Thread.currentThread(); ++ ++ if (currentThread instanceof ServerLevelTickThread serverLevelTickThread) { ++ return serverLevelTickThread.currentlyTickingServerLevel == world; ++ } else return currentThread instanceof TickThread; + } + + public static boolean isTickThreadFor(final Level world, final double blockX, final double blockZ) { +- return isTickThread(); ++ Thread currentThread = Thread.currentThread(); ++ ++ if (currentThread instanceof ServerLevelTickThread serverLevelTickThread) { ++ return serverLevelTickThread.currentlyTickingServerLevel == world; ++ } else return currentThread instanceof TickThread; + } + + public static boolean isTickThreadFor(final Level world, final Vec3 position, final Vec3 deltaMovement, final int buffer) { +- return isTickThread(); ++ Thread currentThread = Thread.currentThread(); ++ ++ if (currentThread instanceof ServerLevelTickThread serverLevelTickThread) { ++ return serverLevelTickThread.currentlyTickingServerLevel == world; ++ } else return currentThread instanceof TickThread; + } + + public static boolean isTickThreadFor(final Level world, final int fromChunkX, final int fromChunkZ, final int toChunkX, final int toChunkZ) { +- return isTickThread(); ++ Thread currentThread = Thread.currentThread(); ++ ++ if (currentThread instanceof ServerLevelTickThread serverLevelTickThread) { ++ return serverLevelTickThread.currentlyTickingServerLevel == world; ++ } else return currentThread instanceof TickThread; + } + + public static boolean isTickThreadFor(final Level world, final int chunkX, final int chunkZ, final int radius) { +- return isTickThread(); ++ Thread currentThread = Thread.currentThread(); ++ ++ if (currentThread instanceof ServerLevelTickThread serverLevelTickThread) { ++ return serverLevelTickThread.currentlyTickingServerLevel == world; ++ } else return currentThread instanceof TickThread; ++ } ++ ++ // SparklyPaper - parallel world ticking ++ // This is an additional method to check if the tick thread is bound to a specific world because, by default, Paper's isTickThread methods do not provide this information ++ // Because we only tick worlds in parallel (instead of regions), we can use this for our checks ++ public static boolean isTickThreadFor(final Level world) { ++ Thread currentThread = Thread.currentThread(); ++ ++ if (currentThread instanceof ServerLevelTickThread serverLevelTickThread) { ++ return serverLevelTickThread.currentlyTickingServerLevel == world; ++ } else return currentThread instanceof TickThread; + } + + public static boolean isTickThreadFor(final Entity entity) { +- return isTickThread(); ++ if (entity == null) { ++ return true; ++ } ++ ++ Thread currentThread = Thread.currentThread(); ++ ++ if (currentThread instanceof ServerLevelTickThread serverLevelTickThread) { ++ return serverLevelTickThread.currentlyTickingServerLevel == entity.level(); ++ } else return currentThread instanceof TickThread; ++ } ++ ++ // SparklyPaper start - parallel world ticking ++ public static class ServerLevelTickThread extends TickThread { ++ public ServerLevelTickThread(String name) { ++ super(name); ++ } ++ ++ public ServerLevelTickThread(Runnable run, String name) { ++ super(run, name); ++ } ++ ++ public net.minecraft.server.level.ServerLevel currentlyTickingServerLevel; + } ++ // SparklyPaper end + } +diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java +index 91a6f57f35fc1553159cca138a0619e703b2b014..dd49dd779f4aa45b27614b581b347b608b1ac64f 100644 +--- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java ++++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java +@@ -1030,7 +1030,7 @@ public final class ChunkHolderManager { + if (changedFullStatus.isEmpty()) { + return; + } +- if (!TickThread.isTickThread()) { ++ if (!TickThread.isTickThreadFor(world)) { // SparklyPaper - parallel world ticking + this.taskScheduler.scheduleChunkTask(() -> { + final ArrayDeque pendingFullLoadUpdate = ChunkHolderManager.this.pendingFullLoadUpdate; + for (int i = 0, len = changedFullStatus.size(); i < len; ++i) { +@@ -1056,7 +1056,7 @@ public final class ChunkHolderManager { + + // note: never call while inside the chunk system, this will absolutely break everything + public void processUnloads() { +- TickThread.ensureTickThread("Cannot unload chunks off-main"); ++ TickThread.ensureTickThread(world, "Cannot unload chunks off-main"); // SparklyPaper - parallel world ticking + + if (BLOCK_TICKET_UPDATES.get() == Boolean.TRUE) { + throw new IllegalStateException("Cannot unload chunks recursively"); +@@ -1338,7 +1338,7 @@ public final class ChunkHolderManager { + + List changedFullStatus = null; + +- final boolean isTickThread = TickThread.isTickThread(); ++ final boolean isTickThread = TickThread.isTickThreadFor(world); + + boolean ret = false; + final boolean canProcessFullUpdates = processFullUpdates & isTickThread; +diff --git a/src/main/java/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java +index ddb264443f2e38b6348226016f9139727c588898..5a5451dda717656e02f11c71646f7afeeb0c2232 100644 +--- a/src/main/java/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java +@@ -54,7 +54,7 @@ public class BoatDispenseItemBehavior extends DefaultDispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + + BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d1, d2 + d4, d3)); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + worldserver.getCraftServer().getPluginManager().callEvent(event); + } + +diff --git a/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java +index 8aae1d113e84dfad9f2b6f0bcd203ca6c68bc5ce..7fca48f233e98b63a5d8c9094561380866f3d0a2 100644 +--- a/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java +@@ -87,7 +87,7 @@ public class DefaultDispenseItemBehavior implements DispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); + + BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), CraftVector.toBukkit(entityitem.getDeltaMovement())); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + world.getCraftServer().getPluginManager().callEvent(event); + } + +diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +index 0d12605dc84dad49faa18bf1fd058c3c168623ee..1a240c6ac7980df94fc40ce8fc6c3c6096db8eef 100644 +--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +@@ -111,7 +111,7 @@ public interface DispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + + BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + worldserver.getCraftServer().getPluginManager().callEvent(event); + } + +@@ -170,7 +170,7 @@ public interface DispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + + BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + worldserver.getCraftServer().getPluginManager().callEvent(event); + } + +@@ -225,7 +225,7 @@ public interface DispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + + BlockDispenseArmorEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) list.get(0).getBukkitEntity()); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + world.getCraftServer().getPluginManager().callEvent(event); + } + +@@ -280,7 +280,7 @@ public interface DispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + + BlockDispenseArmorEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) entityhorsechestedabstract.getBukkitEntity()); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + world.getCraftServer().getPluginManager().callEvent(event); + } + +@@ -354,7 +354,7 @@ public interface DispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack.copyWithCount(1)); // Paper - single item in event + + BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(x, y, z)); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + worldserver.getCraftServer().getPluginManager().callEvent(event); + } + +@@ -419,7 +419,7 @@ public interface DispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack.copyWithCount(1)); // Paper - single item in event + + BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + worldserver.getCraftServer().getPluginManager().callEvent(event); + } + +@@ -457,7 +457,7 @@ public interface DispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); // Paper - ignore stack size on damageable items + + BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + worldserver.getCraftServer().getPluginManager().callEvent(event); + } + +@@ -519,7 +519,7 @@ public interface DispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack.copyWithCount(1)); // Paper - single item in event + + BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + worldserver.getCraftServer().getPluginManager().callEvent(event); + } + +@@ -548,8 +548,8 @@ public interface DispenseItemBehavior { + // CraftBukkit start + worldserver.captureTreeGeneration = false; + if (worldserver.capturedBlockStates.size() > 0) { +- TreeType treeType = SaplingBlock.treeType; +- SaplingBlock.treeType = null; ++ TreeType treeType = SaplingBlock.treeTypeRT.get(); // SparklyPaper - parallel world ticking ++ SaplingBlock.treeTypeRT.set(null); // SparklyPaper - parallel world ticking + Location location = CraftLocation.toBukkit(blockposition, worldserver.getWorld()); + List blocks = new java.util.ArrayList<>(worldserver.capturedBlockStates.values()); + worldserver.capturedBlockStates.clear(); +@@ -588,7 +588,7 @@ public interface DispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + + BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D)); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + worldserver.getCraftServer().getPluginManager().callEvent(event); + } + +@@ -631,7 +631,7 @@ public interface DispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack.copyWithCount(1)); // Paper - single item in event + + BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + worldserver.getCraftServer().getPluginManager().callEvent(event); + } + +@@ -680,7 +680,7 @@ public interface DispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack.copyWithCount(1)); // Paper - single item in event + + BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + worldserver.getCraftServer().getPluginManager().callEvent(event); + } + +@@ -742,7 +742,7 @@ public interface DispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack.copyWithCount(1)); // Paper - only single item in event + + BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + worldserver.getCraftServer().getPluginManager().callEvent(event); + } + +@@ -824,7 +824,7 @@ public interface DispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); // Paper - ignore stack size on damageable items + + BlockDispenseEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) list.get(0).getBukkitEntity()); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { + world.getCraftServer().getPluginManager().callEvent(event); + } + +diff --git a/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java +index bf8c511739265c6a9cd277752e844481598f8966..d087b35b212e8bda1f6d8be35ed73fc759718c5e 100644 +--- a/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java +@@ -50,7 +50,7 @@ public class EquipmentDispenseItemBehavior extends DefaultDispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + + BlockDispenseArmorEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) entityliving.getBukkitEntity()); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { + world.getCraftServer().getPluginManager().callEvent(event); + } + +diff --git a/src/main/java/net/minecraft/core/dispenser/MinecartDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/MinecartDispenseItemBehavior.java +index 3588896b7413be73ade6b3f8fd111d02c48ec550..913ef6c348af35053c93a37bc0ec719563740d56 100644 +--- a/src/main/java/net/minecraft/core/dispenser/MinecartDispenseItemBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/MinecartDispenseItemBehavior.java +@@ -74,7 +74,7 @@ public class MinecartDispenseItemBehavior extends DefaultDispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + + BlockDispenseEvent event = new BlockDispenseEvent(block2, craftItem.clone(), new org.bukkit.util.Vector(vec3d1.x, vec3d1.y, vec3d1.z)); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { + worldserver.getCraftServer().getPluginManager().callEvent(event); + } + +diff --git a/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java +index 54c72cf472e06e214eb61bd8615a0bb27690c807..e4bce6bd878be3405691062db2f05492f67cfafb 100644 +--- a/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java +@@ -43,7 +43,7 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + + BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ())); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { + worldserver.getCraftServer().getPluginManager().callEvent(event); + } + +diff --git a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java +index 65ed3d77a51b8299517e0c165403b0c5ac413475..f999c33552c611df733da93dcb9699b15fa54a92 100644 +--- a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java +@@ -41,7 +41,7 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); // Paper - ignore stack size on damageable items + + BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + worldserver.getCraftServer().getPluginManager().callEvent(event); + } + +diff --git a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java +index 8f9fde5489c0e1d0a91203536caddec5a9c96f6c..84617a7d6fae4a67f07d50a8e9410e359725b675 100644 +--- a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java +@@ -37,7 +37,7 @@ public class ShulkerBoxDispenseBehavior extends OptionalDispenseItemBehavior { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack.copyWithCount(1)); // Paper - single item in event + + BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); +- if (!DispenserBlock.eventFired) { ++ if (!DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + pointer.level().getCraftServer().getPluginManager().callEvent(event); + } + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index e168e5f433da40f3bdd5821451c3f3572b69a48c..2a9f9e37fcaf70bff89f5adfbf54a0d95a14bb3a 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -3,9 +3,6 @@ package net.minecraft.server; + import com.google.common.base.Preconditions; + import com.google.common.base.Splitter; + import com.google.common.collect.ImmutableList; +-import co.aikar.timings.Timings; +-import com.destroystokyo.paper.event.server.PaperServerListPingEvent; +-import com.google.common.base.Stopwatch; + import com.google.common.collect.Lists; + import com.google.common.collect.Maps; + import com.google.common.collect.Sets; +@@ -16,66 +13,22 @@ import com.mojang.datafixers.DataFixer; + import com.mojang.jtracy.DiscontinuousFrame; + import com.mojang.jtracy.TracyClient; + import com.mojang.logging.LogUtils; ++import com.mojang.serialization.Dynamic; ++import com.mojang.serialization.Lifecycle; + import it.unimi.dsi.fastutil.longs.LongIterator; + import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import it.unimi.dsi.fastutil.objects.ObjectArraySet; +-import java.awt.image.BufferedImage; +-import java.io.BufferedWriter; +-import java.io.ByteArrayOutputStream; +-import java.io.IOException; +-import java.lang.management.ManagementFactory; +-import java.lang.management.ThreadInfo; +-import java.lang.management.ThreadMXBean; +-import java.net.Proxy; +-import java.nio.file.FileStore; +-import java.nio.file.Files; +-import java.nio.file.LinkOption; +-import java.nio.file.Path; +-import java.security.KeyPair; +-import java.util.ArrayList; +-import java.util.Arrays; +-import java.util.Collection; +-import java.util.Collections; +-import java.util.Comparator; +-import java.util.Iterator; +-import java.util.List; +-import java.util.Locale; +-import java.util.Map; +-import java.util.Map.Entry; +-import java.util.Objects; +-import java.util.Optional; +-import java.util.Set; +-import java.util.UUID; +-import java.util.concurrent.CompletableFuture; +-import java.util.concurrent.Executor; +-import java.util.concurrent.atomic.AtomicReference; +-import java.util.concurrent.locks.LockSupport; +-import java.util.function.BooleanSupplier; +-import java.util.function.Consumer; +-import java.util.function.Function; +-import java.util.stream.Collectors; +-import java.util.stream.Stream; +-import javax.annotation.Nullable; +-import javax.imageio.ImageIO; +-import net.minecraft.CrashReport; +-import net.minecraft.CrashReportCategory; +-import net.minecraft.FileUtil; +-import net.minecraft.ReportType; +-import net.minecraft.ReportedException; +-import net.minecraft.SharedConstants; +-import net.minecraft.SystemReport; +-import net.minecraft.Util; ++import joptsimple.OptionSet; ++import net.minecraft.*; + import net.minecraft.commands.CommandSource; + import net.minecraft.commands.CommandSourceStack; + import net.minecraft.commands.Commands; +-import net.minecraft.core.BlockPos; +-import net.minecraft.core.HolderGetter; +-import net.minecraft.core.LayeredRegistryAccess; +-import net.minecraft.core.Registry; +-import net.minecraft.core.RegistryAccess; ++import net.minecraft.core.*; + import net.minecraft.core.registries.Registries; + import net.minecraft.data.worldgen.features.MiscOverworldFeatures; + import net.minecraft.gametest.framework.GameTestTicker; ++import net.minecraft.nbt.NbtException; ++import net.minecraft.nbt.ReportedNbtException; + import net.minecraft.network.chat.ChatDecorator; + import net.minecraft.network.chat.ChatType; + import net.minecraft.network.chat.Component; +@@ -86,6 +39,14 @@ import net.minecraft.network.protocol.status.ServerStatus; + import net.minecraft.obfuscate.DontObfuscate; + import net.minecraft.resources.ResourceKey; + import net.minecraft.resources.ResourceLocation; ++import net.minecraft.server.bossevents.CustomBossEvents; ++import net.minecraft.server.dedicated.DedicatedServer; ++import net.minecraft.server.dedicated.DedicatedServerProperties; ++import net.minecraft.server.level.*; ++import net.minecraft.server.level.progress.ChunkProgressListener; ++import net.minecraft.server.level.progress.ChunkProgressListenerFactory; ++import net.minecraft.server.network.ServerConnectionListener; ++import net.minecraft.server.network.TextFilter; + import net.minecraft.server.packs.PackType; + import net.minecraft.server.packs.repository.Pack; + import net.minecraft.server.packs.repository.PackRepository; +@@ -98,25 +59,12 @@ import net.minecraft.server.players.PlayerList; + import net.minecraft.server.players.ServerOpListEntry; + import net.minecraft.server.players.UserWhiteList; + import net.minecraft.tags.TagLoader; +-import net.minecraft.util.Crypt; +-import net.minecraft.util.CryptException; +-import net.minecraft.util.ModCheck; +-import net.minecraft.util.Mth; +-import net.minecraft.util.NativeModuleLister; +-import net.minecraft.util.ProgressListener; +-import net.minecraft.util.RandomSource; +-import net.minecraft.util.SignatureValidator; +-import net.minecraft.util.TimeUtil; ++import net.minecraft.util.*; + import net.minecraft.util.datafix.DataFixers; + import net.minecraft.util.debugchart.RemoteDebugSampleType; + import net.minecraft.util.debugchart.SampleLogger; + import net.minecraft.util.debugchart.TpsDebugDimensions; +-import net.minecraft.util.profiling.EmptyProfileResults; +-import net.minecraft.util.profiling.ProfileResults; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; +-import net.minecraft.util.profiling.ResultField; +-import net.minecraft.util.profiling.SingleTickProfiler; ++import net.minecraft.util.profiling.*; + import net.minecraft.util.profiling.jfr.JvmProfiler; + import net.minecraft.util.profiling.jfr.callback.ProfiledDuration; + import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder; +@@ -136,15 +84,7 @@ import net.minecraft.world.flag.FeatureFlagSet; + import net.minecraft.world.flag.FeatureFlags; + import net.minecraft.world.item.alchemy.PotionBrewing; + import net.minecraft.world.item.crafting.RecipeManager; +-import net.minecraft.world.level.ChunkPos; +-import net.minecraft.world.level.CustomSpawner; +-import net.minecraft.world.level.DataPackConfig; +-import net.minecraft.world.level.ForcedChunksSavedData; +-import net.minecraft.world.level.GameRules; +-import net.minecraft.world.level.GameType; +-import net.minecraft.world.level.Level; +-import net.minecraft.world.level.LevelSettings; +-import net.minecraft.world.level.WorldDataConfiguration; ++import net.minecraft.world.level.*; + import net.minecraft.world.level.biome.BiomeManager; + import net.minecraft.world.level.block.Block; + import net.minecraft.world.level.block.entity.FuelValues; +@@ -152,55 +92,46 @@ import net.minecraft.world.level.border.WorldBorder; + import net.minecraft.world.level.chunk.storage.ChunkIOErrorReporter; + import net.minecraft.world.level.chunk.storage.RegionStorageInfo; + import net.minecraft.world.level.dimension.LevelStem; +-import net.minecraft.world.level.levelgen.WorldOptions; ++import net.minecraft.world.level.levelgen.*; + import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +-import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager; +-import net.minecraft.world.level.storage.WorldData; +-import org.slf4j.Logger; +- +-// CraftBukkit start +-import com.mojang.serialization.Dynamic; +-import com.mojang.serialization.Lifecycle; +-import java.io.File; +-import java.util.Random; +-// import jline.console.ConsoleReader; // Paper +-import joptsimple.OptionSet; +-import net.minecraft.nbt.NbtException; +-import net.minecraft.nbt.ReportedNbtException; +-import net.minecraft.server.bossevents.CustomBossEvents; +-import net.minecraft.server.dedicated.DedicatedServer; +-import net.minecraft.server.dedicated.DedicatedServerProperties; +-import net.minecraft.server.level.DemoMode; +-import net.minecraft.server.level.PlayerRespawnLogic; +-import net.minecraft.server.level.ServerChunkCache; +-import net.minecraft.server.level.ServerLevel; +-import net.minecraft.server.level.ServerPlayer; +-import net.minecraft.server.level.ServerPlayerGameMode; +-import net.minecraft.server.level.progress.ChunkProgressListener; +-import net.minecraft.server.level.progress.ChunkProgressListenerFactory; +-import net.minecraft.server.network.ServerConnectionListener; +-import net.minecraft.server.network.TextFilter; +-import net.minecraft.world.level.levelgen.Heightmap; +-import net.minecraft.world.level.levelgen.PatrolSpawner; +-import net.minecraft.world.level.levelgen.PhantomSpawner; +-import net.minecraft.world.level.levelgen.WorldDimensions; + import net.minecraft.world.level.levelgen.presets.WorldPresets; +-import net.minecraft.world.level.storage.CommandStorage; +-import net.minecraft.world.level.storage.DimensionDataStorage; +-import net.minecraft.world.level.storage.LevelData; +-import net.minecraft.world.level.storage.LevelDataAndDimensions; +-import net.minecraft.world.level.storage.LevelResource; +-import net.minecraft.world.level.storage.LevelStorageSource; +-import net.minecraft.world.level.storage.LevelSummary; +-import net.minecraft.world.level.storage.PlayerDataStorage; +-import net.minecraft.world.level.storage.PrimaryLevelData; +-import net.minecraft.world.level.storage.ServerLevelData; ++import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager; ++import net.minecraft.world.level.storage.*; + import net.minecraft.world.level.validation.ContentValidationException; + import net.minecraft.world.phys.Vec2; + import net.minecraft.world.phys.Vec3; + import org.bukkit.Bukkit; + import org.bukkit.craftbukkit.CraftRegistry; + import org.bukkit.event.server.ServerLoadEvent; ++import org.slf4j.Logger; ++ ++import javax.annotation.Nullable; ++import javax.imageio.ImageIO; ++import java.awt.image.BufferedImage; ++import java.io.BufferedWriter; ++import java.io.ByteArrayOutputStream; ++import java.io.File; ++import java.io.IOException; ++import java.lang.management.ManagementFactory; ++import java.lang.management.ThreadInfo; ++import java.lang.management.ThreadMXBean; ++import java.net.Proxy; ++import java.nio.file.FileStore; ++import java.nio.file.Files; ++import java.nio.file.LinkOption; ++import java.nio.file.Path; ++import java.security.KeyPair; ++import java.util.*; ++import java.util.Map.Entry; ++import java.util.concurrent.CompletableFuture; ++import java.util.concurrent.Executor; ++import java.util.concurrent.atomic.AtomicReference; ++import java.util.concurrent.locks.LockSupport; ++import java.util.function.BooleanSupplier; ++import java.util.function.Consumer; ++import java.util.function.Function; ++import java.util.stream.Collectors; ++import java.util.stream.Stream; + // CraftBukkit end + + +@@ -335,6 +266,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping + public final Set entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // SparklyPaper - skip EntityScheduler's executeTick checks if there isn't any tasks to be run (concurrent because plugins may schedule tasks async) + public net.sparklypower.sparklypaper.HalloweenManager halloweenManager = new net.sparklypower.sparklypaper.HalloweenManager(); // SparklyPaper - Spooky month optimizations ++ // SparklyPaper - parallel world ticking ++ public java.util.concurrent.Semaphore serverLevelTickingSemaphore = null; ++ // SparklyPaper end + + public static S spin(Function serverFactory) { + AtomicReference atomicreference = new AtomicReference(); +@@ -1866,50 +1800,71 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper - BlockPhysicsEvent +- worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent +- net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers +- worldserver.updateLagCompensationTick(); // Paper - lag compensation ++ // SparklyPaper start - parallel world ticking ++ java.util.ArrayDeque> tasks = new java.util.ArrayDeque<>(); ++ try { ++ while (iterator.hasNext()) { ++ ServerLevel worldserver = (ServerLevel) iterator.next(); ++ worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent ++ worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent ++ net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers ++ worldserver.updateLagCompensationTick(); // Paper - lag compensation + +- gameprofilerfiller.push(() -> { +- String s = String.valueOf(worldserver); ++ gameprofilerfiller.push(() -> { ++ String s = String.valueOf(worldserver); + +- return s + " " + String.valueOf(worldserver.dimension().location()); +- }); +- /* Drop global time updates +- if (this.tickCount % 20 == 0) { +- gameprofilerfiller.push("timeSync"); +- this.synchronizeTime(worldserver); ++ return s + " " + String.valueOf(worldserver.dimension().location()); ++ }); ++ /* Drop global time updates ++ if (this.tickCount % 20 == 0) { ++ gameprofilerfiller.push("timeSync"); ++ this.synchronizeTime(worldserver); ++ gameprofilerfiller.pop(); ++ } ++ // CraftBukkit end */ ++ ++ gameprofilerfiller.push("tick"); ++ ++ serverLevelTickingSemaphore.acquire(); ++ tasks.add( ++ worldserver.tickExecutor.submit(() -> { ++ try { ++ ca.spottedleaf.moonrise.common.util.TickThread.ServerLevelTickThread currentThread = (ca.spottedleaf.moonrise.common.util.TickThread.ServerLevelTickThread) Thread.currentThread(); ++ currentThread.currentlyTickingServerLevel = worldserver; ++ ++ long i = Util.getNanos(); // SparklyPaper - track world's MSPT ++ worldserver.tick(shouldKeepTicking); ++ // SparklyPaper start - track world's MSPT ++ long j = Util.getNanos() - i; ++ ++ // These are from the "tickServer" function ++ worldserver.tickTimes5s.add(this.tickCount, j); ++ worldserver.tickTimes10s.add(this.tickCount, j); ++ worldserver.tickTimes60s.add(this.tickCount, j); ++ // SparklyPaper end ++ } catch (Throwable throwable) { ++ CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world"); ++ ++ worldserver.fillReportDetails(crashreport); ++ throw new ReportedException(crashreport); ++ } finally { ++ serverLevelTickingSemaphore.release(); ++ } ++ }, worldserver) ++ ); ++ ++ gameprofilerfiller.pop(); + gameprofilerfiller.pop(); ++ worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions + } +- // CraftBukkit end */ +- +- gameprofilerfiller.push("tick"); + +- try { +- long i = Util.getNanos(); // SparklyPaper - track world's MSPT +- worldserver.tick(shouldKeepTicking); +- // SparklyPaper start - track world's MSPT +- long j = Util.getNanos() - i; +- +- // These are from the "tickServer" function +- worldserver.tickTimes5s.add(this.tickCount, j); +- worldserver.tickTimes10s.add(this.tickCount, j); +- worldserver.tickTimes60s.add(this.tickCount, j); +- // SparklyPaper end +- } catch (Throwable throwable) { +- CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world"); +- +- worldserver.fillReportDetails(crashreport); +- throw new ReportedException(crashreport); ++ while (!tasks.isEmpty()) { ++ tasks.pop().get(); + } +- +- gameprofilerfiller.pop(); +- gameprofilerfiller.pop(); +- worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions ++ } catch (java.lang.InterruptedException | java.util.concurrent.ExecutionException e) { ++ throw new RuntimeException(e); // Propagate exception + } ++ // SparklyPaper end + this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked + + gameprofilerfiller.popPush("connection"); +@@ -2003,6 +1958,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop, ServerLevel> oldLevels = this.levels; + Map, ServerLevel> newLevels = Maps.newLinkedHashMap(oldLevels); + newLevels.remove(level.dimension()); ++ level.tickExecutor.shutdown(); // SparklyPaper - parallel world ticking (We remove it in here instead of ServerLevel.close() because ServerLevel.close() is never called!) + this.levels = Collections.unmodifiableMap(newLevels); + } + // CraftBukkit end +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +index e49e8e98ebbd3c8ba8a784f1626132699209b4e3..d952d42b8faee38f9d55fe578c0308916d31680c 100644 +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +@@ -243,6 +243,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + return false; + } + net.sparklypower.sparklypaper.SparklyPaperCommands.INSTANCE.registerCommands(this); ++ serverLevelTickingSemaphore = new java.util.concurrent.Semaphore(net.sparklypower.sparklypaper.configs.SparklyPaperConfigUtils.INSTANCE.getConfig().getParallelWorldTicking().getThreads()); // SparklyPaper - parallel world ticking ++ DedicatedServer.LOGGER.info("Using " + serverLevelTickingSemaphore.availablePermits() + " permits for parallel world ticking"); // SparklyPaper - parallel world ticking + // SparklyPaper end + // SparklyPaper start - Spooky month optimizations + halloweenManager.startHalloweenEpochTask(); +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index ba899bcf05b967db784b7435895d6ff7b72b40f2..f750d015bf8ffb533713f298a9d1df13de60693e 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -200,7 +200,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + private final MinecraftServer server; + public final PrimaryLevelData serverLevelData; // CraftBukkit - type + private int lastSpawnChunkRadius; +- final EntityTickList entityTickList = new EntityTickList(); ++ final EntityTickList entityTickList = new EntityTickList(this); + // Paper - rewrite chunk system + private final GameEventDispatcher gameEventDispatcher; + public boolean noSave; +@@ -224,6 +224,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + private final StructureCheck structureCheck; + private final boolean tickTime; + private final RandomSequences randomSequences; ++ public java.util.concurrent.ExecutorService tickExecutor; // SparklyPaper - parallel world ticking + + // CraftBukkit start + public final LevelStorageSource.LevelStorageAccess convertable; +@@ -682,6 +683,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler); + // Paper end - rewrite chunk system + this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit ++ this.tickExecutor = java.util.concurrent.Executors.newSingleThreadExecutor(new net.sparklypower.sparklypaper.ServerLevelTickExecutorThreadFactory(getWorld().getName())); // SparklyPaper - parallel world ticking + } + + // Paper start +@@ -1251,7 +1253,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + // Paper start - rewrite chunk system + if ((++this.tickedBlocksOrFluids & 7L) != 0L) { +- ((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this.server).moonrise$executeMidTickTasks(); ++ // ((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this.server).moonrise$executeMidTickTasks(); // SparklyPaper - parallel world ticking (only run mid-tick at the end of each tick / fixes concurrency bugs related to executeMidTickTasks) // Paper + } + // Paper end - rewrite chunk system + +@@ -1265,7 +1267,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + // Paper start - rewrite chunk system + if ((++this.tickedBlocksOrFluids & 7L) != 0L) { +- ((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this.server).moonrise$executeMidTickTasks(); ++ // ((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this.server).moonrise$executeMidTickTasks(); // SparklyPaper - parallel world ticking (only run mid-tick at the end of each tick / fixes concurrency bugs related to executeMidTickTasks) // Paper + } + // Paper end - rewrite chunk system + +@@ -1558,6 +1560,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + + private void addPlayer(ServerPlayer player) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this, "Cannot add player off-main"); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + Entity entity = (Entity) this.getEntities().get(player.getUUID()); + + if (entity != null) { +@@ -1571,7 +1574,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + + // CraftBukkit start + private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { +- org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this, "Cannot add entity off-main"); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + entity.generation = false; // Paper - Don't fire sync event during generation; Reset flag if it was added during a ServerLevel generation process + // Paper start - extra debug info + if (entity.valid) { +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java +index 5a8f396d47577f087abb415c972fd4f51e50faba..f58331b6be3a26e76082d16894d3eb4d5982f318 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +@@ -359,6 +359,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple + return this.viewDistanceHolder; + } + // Paper end - rewrite chunk system ++ public boolean hasTickedAtLeastOnceInNewWorld = false; // SparklyPaper - parallel world ticking (fixes bug in DreamResourceReset where the inventory is opened AFTER the player has changed worlds, if you click with the quick tp torch in a chest, because the inventory is opened AFTER the player has teleported) + + public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) { + super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); +@@ -986,6 +987,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple + + @Override + public void tick() { ++ hasTickedAtLeastOnceInNewWorld = true; // SparklyPaper - parallel world ticking (see: PARALLEL_NOTES.md - Opening an inventory after a world switch) + // CraftBukkit start + if (this.joining) { + this.joining = false; +@@ -1629,6 +1631,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple + teleportTarget.postTeleportTransition().onTransition(this); + return this; + } else { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureOnlyTickThread("Cannot change dimension of a player off-main, from world " + serverLevel().getWorld().getName() + " to world " + worldserver.getWorld().getName()); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + // CraftBukkit start + /* + this.isChangingDimension = true; +@@ -1996,6 +1999,12 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple + return OptionalInt.empty(); + } else { + // CraftBukkit start ++ // SparklyPaper start - parallel world ticking (see: PARALLEL_NOTES.md - Opening an inventory after a world switch) ++ if (!hasTickedAtLeastOnceInNewWorld) { ++ MinecraftServer.LOGGER.warn("Ignoring request to open container " + container + " because we haven't ticked in the current world yet!", new Throwable()); ++ return OptionalInt.empty(); ++ } ++ // SparklyPaper end + this.containerMenu = container; + if (!this.isImmobile()) this.connection.send(new ClientboundOpenScreenPacket(container.containerId, container.getType(), Objects.requireNonNullElseGet(title, container::getTitle))); // Paper - Add titleOverride to InventoryOpenEvent + // CraftBukkit end +@@ -2059,6 +2068,11 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple + } + @Override + public void closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) { ++ // SparklyPaper start - parallel world ticking (debugging) ++ if (net.sparklypower.sparklypaper.configs.SparklyPaperConfigUtils.INSTANCE.getLogContainerCreationStacktraces()) { ++ MinecraftServer.LOGGER.warn("Closing " + this.getBukkitEntity().getName() + " inventory that was created at", this.containerMenu.containerCreationStacktrace); ++ } ++ // SparklyPaper end + CraftEventFactory.handleInventoryCloseEvent(this, reason); // CraftBukkit + // Paper end - Inventory close reason + this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId)); +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 1a956249828156fdc273888de59128c3d1a0b898..6484a87853eb2a907f729365edadc39e87e395bb 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -137,7 +137,7 @@ public abstract class PlayerList { + private static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z"); + private final MinecraftServer server; + public final List players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety +- private final Map playersByUUID = Maps.newHashMap(); ++ private final Map playersByUUID = Maps.newHashMap(); // SparklyPaper - parallel world ticking (we don't need to replace the original map because we never iterate on top of this map) + private final UserBanList bans; + private final IpBanList ipBans; + private final ServerOpList ops; +@@ -158,7 +158,7 @@ public abstract class PlayerList { + + // CraftBukkit start + private CraftServer cserver; +- private final Map playersByName = new java.util.HashMap<>(); ++ private final Map playersByName = new java.util.HashMap<>(); // SparklyPaper - parallel world ticking (we don't need to replace the original map because we never iterate on top of this map) + public @Nullable String collideRuleTeamName; // Paper - Configurable player collision + + public PlayerList(MinecraftServer server, LayeredRegistryAccess registryManager, PlayerDataStorage saveHandler, int maxPlayers) { +@@ -182,6 +182,7 @@ public abstract class PlayerList { + abstract public void loadAndSaveFiles(); // Paper - fix converting txt to json file; moved from DedicatedPlayerList constructor + + public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureOnlyTickThread("Cannot place new player off-main"); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + player.isRealPlayer = true; // Paper + player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed + GameProfile gameprofile = player.getGameProfile(); +@@ -769,6 +770,13 @@ public abstract class PlayerList { + } + + public ServerPlayer respawn(ServerPlayer entityplayer, boolean flag, Entity.RemovalReason entity_removalreason, RespawnReason reason, Location location) { ++ System.out.println("respawning player - current player container is " + entityplayer.containerMenu + " but their inventory is " + entityplayer.inventoryMenu); ++ // SparklyPaper - parallel world ticking (additional concurrency issues logs) ++ if (location != null) ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureOnlyTickThread("Cannot respawn player off-main, from world " + entityplayer.serverLevel().getWorld().getName() + " to world " + location.getWorld().getName()); ++ else ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureOnlyTickThread("Cannot respawn player off-main, respawning in world " + entityplayer.serverLevel().getWorld().getName()); ++ // SparklyPaper end + entityplayer.stopRiding(); // CraftBukkit + this.players.remove(entityplayer); + this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot +@@ -781,6 +789,7 @@ public abstract class PlayerList { + ServerPlayer entityplayer1 = entityplayer; + Level fromWorld = entityplayer.level(); + entityplayer.wonGame = false; ++ entityplayer.hasTickedAtLeastOnceInNewWorld = false; // SparklyPaper - parallel world ticking (see: PARALLEL_NOTES.md - Opening an inventory after a world switch) + // CraftBukkit end + + entityplayer1.connection = entityplayer.connection; +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index a15546e433ebba6c0de01bdaaef201a3d99a87b5..3e440c7ce88d7ebd50eba488c629bfa0bd0d242f 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -882,7 +882,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + // CraftBukkit start + public void postTick() { + // No clean way to break out of ticking once the entity has been copied to a new world, so instead we move the portalling later in the tick cycle +- if (!(this instanceof ServerPlayer) && this.isAlive()) { // Paper - don't attempt to teleport dead entities ++ if (false && !(this instanceof ServerPlayer) && this.isAlive()) { // Paper - don't attempt to teleport dead entities // SparklyPaper - parallel world ticking (see issue #9, this is executed in the server level tick for non-player entities) + this.handlePortal(); + } + } +@@ -3986,6 +3986,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + + private Entity teleportCrossDimension(ServerLevel world, TeleportTransition teleportTarget) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(world, "Cannot teleport entity to another world off-main, from world " + level.getWorld().getName() + " to world " + world.getWorld().getName()); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + List list = this.getPassengers(); + List list1 = new ArrayList(list.size()); + +diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +index 4680f77a275d8d2b226018db89a571ac25998dd8..42b00ada65878545e464aa169698288982d46def 100644 +--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java ++++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +@@ -106,8 +106,14 @@ public abstract class AbstractContainerMenu { + this.title = title; + } + // CraftBukkit end ++ public Throwable containerCreationStacktrace; // SparklyPaper - parallel world ticking (debugging) + + protected AbstractContainerMenu(@Nullable MenuType type, int syncId) { ++ // SparklyPaper - parallel world ticking (debugging) ++ if (net.sparklypower.sparklypaper.configs.SparklyPaperConfigUtils.INSTANCE.getLogContainerCreationStacktraces()) { ++ this.containerCreationStacktrace = new Throwable(); ++ } ++ // SparklyPaper end + this.carried = ItemStack.EMPTY; + this.remoteSlots = NonNullList.create(); + this.remoteDataSlots = new IntArrayList(); +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index 33e7d2884195677c4d6340d8b84c1dd85c636ec1..02a719aaf7c860efbb51aed7d21cc83e14aef602 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -445,8 +445,8 @@ public final class ItemStack implements DataComponentHolder { + if (enuminteractionresult.consumesAction() && world.captureTreeGeneration && world.capturedBlockStates.size() > 0) { + world.captureTreeGeneration = false; + Location location = CraftLocation.toBukkit(blockposition, world.getWorld()); +- TreeType treeType = SaplingBlock.treeType; +- SaplingBlock.treeType = null; ++ TreeType treeType = SaplingBlock.treeTypeRT.get(); // SparklyPaper - parallel world ticking ++ SaplingBlock.treeTypeRT.set(null); // SparklyPaper - parallel world ticking + List blocks = new java.util.ArrayList<>(world.capturedBlockStates.values()); + world.capturedBlockStates.clear(); + StructureGrowEvent structureEvent = null; +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index 39d5633ae7cdb8609f5840de5ba26237d501d8a2..856aab98edbd67c68d33e529d0199c0506b11da8 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -175,6 +175,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + + public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray + public net.sparklypower.sparklypaper.configs.SparklyPaperConfig.SparklyPaperWorldConfig sparklyPaperConfig; // SparklyPaper ++ public com.destroystokyo.paper.util.RedstoneWireTurbo turbo = new com.destroystokyo.paper.util.RedstoneWireTurbo((net.minecraft.world.level.block.RedStoneWireBlock) net.minecraft.world.level.block.Blocks.REDSTONE_WIRE); // SparklyPaper - parallel world ticking (moved to world) + public static BlockPos lastPhysicsProblem; // Spigot + private org.spigotmc.TickLimiter entityLimiter; + private org.spigotmc.TickLimiter tileLimiter; +@@ -1088,6 +1089,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + + @Override + public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread((ServerLevel)this, pos, "Updating block asynchronously"); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + // CraftBukkit start - tree generation + if (this.captureTreeGeneration) { + // Paper start - Protect Bedrock and End Portal/Frames from being destroyed +@@ -1487,7 +1489,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + tickingblockentity.tick(); + // Paper start - rewrite chunk system + if ((++tickedEntities & 7) == 0) { +- ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)(Level)(Object)this).moonrise$midTickTasks(); ++ // ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)(Level)(Object)this).moonrise$midTickTasks(); // SparklyPaper - parallel world ticking (only run mid-tick at the end of each tick / fixes concurrency bugs related to executeMidTickTasks) + } + // Paper end - rewrite chunk system + } // SparklyPaper end +@@ -1511,7 +1513,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); + // Paper end - Prevent block entity and entity crashes + } +- this.moonrise$midTickTasks(); // Paper - rewrite chunk system ++ // this.moonrise$midTickTasks(); // Paper - rewrite chunk system // SparklyPaper - parallel world ticking (only run mid-tick at the end of each tick / fixes concurrency bugs related to executeMidTickTasks) + } + // Paper start - Option to prevent armor stands from doing entity lookups + @Override +@@ -1569,6 +1571,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + + @Nullable + public BlockEntity getBlockEntity(BlockPos blockposition, boolean validate) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThreadOrAsyncThread((ServerLevel) this, "Cannot read world asynchronously"); // SparklyPaper start - parallel world ticking + // Paper start - Perf: Optimize capturedTileEntities lookup + net.minecraft.world.level.block.entity.BlockEntity blockEntity; + if (!this.capturedTileEntities.isEmpty() && (blockEntity = this.capturedTileEntities.get(blockposition)) != null) { +@@ -1580,6 +1583,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + } + + public void setBlockEntity(BlockEntity blockEntity) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread((ServerLevel) this, "Cannot modify world asynchronously"); // SparklyPaper start - parallel world ticking + BlockPos blockposition = blockEntity.getBlockPos(); + + if (!this.isOutsideBuildHeight(blockposition)) { +@@ -1665,6 +1669,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + + @Override + public List getEntities(@Nullable Entity except, AABB box, Predicate predicate) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread((ServerLevel)this, box, "Cannot getEntities asynchronously"); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + Profiler.get().incrementCounter("getEntities"); + List list = Lists.newArrayList(); + +@@ -1991,8 +1996,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + public abstract RecipeAccess recipeAccess(); + + public BlockPos getBlockRandomPos(int x, int y, int z, int l) { +- this.randValue = this.randValue * 3 + 1013904223; +- int i1 = this.randValue >> 2; ++ int i1 = this.random.nextInt() >> 2; // SparklyPaper - parallel world ticking + + return new BlockPos(x + (i1 & 15), y + (i1 >> 16 & l), z + (i1 >> 8 & 15)); + } +diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java +index 5a6c153fa2873aecba0d0d02be2cc2a514f445e3..1f8f05c02072cdfc69be0b2d7d33fd9d363a9539 100644 +--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java +@@ -52,7 +52,8 @@ public class DispenserBlock extends BaseEntityBlock { + private static final DefaultDispenseItemBehavior DEFAULT_BEHAVIOR = new DefaultDispenseItemBehavior(); + public static final Map DISPENSER_REGISTRY = new IdentityHashMap(); + private static final int TRIGGER_DURATION = 4; +- public static boolean eventFired = false; // CraftBukkit ++ // public static boolean eventFired = false; // CraftBukkit // SparklyPaper - parallel world ticking ++ public static ThreadLocal eventFired = ThreadLocal.withInitial(() -> Boolean.FALSE); // SparklyPaper - parallel world ticking + + @Override + public MapCodec codec() { +@@ -109,7 +110,7 @@ public class DispenserBlock extends BaseEntityBlock { + + if (idispensebehavior != DispenseItemBehavior.NOOP) { + if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - Add BlockPreDispenseEvent +- DispenserBlock.eventFired = false; // CraftBukkit - reset event status ++ DispenserBlock.eventFired.set(Boolean.FALSE); // CraftBukkit - reset event status // SparklyPaper - parallel world ticking + tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack)); + } + +diff --git a/src/main/java/net/minecraft/world/level/block/FungusBlock.java b/src/main/java/net/minecraft/world/level/block/FungusBlock.java +index ba5fff8892593a921f57cd55ad60cd6744ab4cf1..21b11b120a240ac39ef5d18a3401cb268dbfe6b1 100644 +--- a/src/main/java/net/minecraft/world/level/block/FungusBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/FungusBlock.java +@@ -76,9 +76,9 @@ public class FungusBlock extends BushBlock implements BonemealableBlock { + this.getFeature(world).ifPresent((holder) -> { + // CraftBukkit start + if (this == Blocks.WARPED_FUNGUS) { +- SaplingBlock.treeType = org.bukkit.TreeType.WARPED_FUNGUS; ++ SaplingBlock.treeTypeRT.set(org.bukkit.TreeType.WARPED_FUNGUS); // SparklyPaper - parallel world ticking + } else if (this == Blocks.CRIMSON_FUNGUS) { +- SaplingBlock.treeType = org.bukkit.TreeType.CRIMSON_FUNGUS; ++ SaplingBlock.treeTypeRT.set(org.bukkit.TreeType.CRIMSON_FUNGUS); // SparklyPaper - parallel world ticking + } + // CraftBukkit end + ((ConfiguredFeature) holder.value()).place(world, world.getChunkSource().getGenerator(), random, pos); +diff --git a/src/main/java/net/minecraft/world/level/block/MushroomBlock.java b/src/main/java/net/minecraft/world/level/block/MushroomBlock.java +index 7900856c9e86afe907c00c9ac31bec93ece50abe..4e6adc7a8fd97613cb75d40fa38d504494bbe53b 100644 +--- a/src/main/java/net/minecraft/world/level/block/MushroomBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/MushroomBlock.java +@@ -105,7 +105,7 @@ public class MushroomBlock extends BushBlock implements BonemealableBlock { + return false; + } else { + world.removeBlock(pos, false); +- SaplingBlock.treeType = (this == Blocks.BROWN_MUSHROOM) ? TreeType.BROWN_MUSHROOM : TreeType.RED_MUSHROOM; // CraftBukkit ++ SaplingBlock.treeTypeRT.set((this == Blocks.BROWN_MUSHROOM) ? TreeType.BROWN_MUSHROOM : TreeType.RED_MUSHROOM); // CraftBukkit // SparklyPaper - parallel world ticking + if (((ConfiguredFeature) ((Holder) optional.get()).value()).place(world, world.getChunkSource().getGenerator(), random, pos)) { + return true; + } else { +diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java +index 21f2c61023fadcce30452a02f067cd5d87e5d8dc..056bd2cb7898f691940cdcb85d124948ac49c7d1 100644 +--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java +@@ -292,7 +292,7 @@ public class RedStoneWireBlock extends Block { + + // Paper start - Optimize redstone (Eigencraft) + // The bulk of the new functionality is found in RedstoneWireTurbo.java +- com.destroystokyo.paper.util.RedstoneWireTurbo turbo = new com.destroystokyo.paper.util.RedstoneWireTurbo(this); ++ // com.destroystokyo.paper.util.RedstoneWireTurbo turbo = new com.destroystokyo.paper.util.RedstoneWireTurbo(this); // SparklyPaper - parallel world ticking (moved to world) + + /* + * Modified version of pre-existing updateSurroundingRedstone, which is called from +@@ -308,7 +308,7 @@ public class RedStoneWireBlock extends Block { + if (orientation != null) { + source = pos.relative(orientation.getFront().getOpposite()); + } +- turbo.updateSurroundingRedstone(worldIn, pos, state, source); ++ worldIn.turbo.updateSurroundingRedstone(worldIn, pos, state, source); // turbo.updateSurroundingRedstone(worldIn, pos, state, source); // SparklyPaper - parallel world ticking + return; + } + updatePowerStrength(worldIn, pos, state, orientation, blockAdded); +@@ -336,7 +336,7 @@ public class RedStoneWireBlock extends Block { + // [Space Walker] suppress shape updates and emit those manually to + // bypass the new neighbor update stack. + if (level.setBlock(pos, state, Block.UPDATE_KNOWN_SHAPE | Block.UPDATE_CLIENTS)) { +- turbo.updateNeighborShapes(level, pos, state); ++ level.turbo.updateNeighborShapes(level, pos, state); + } + } + } +diff --git a/src/main/java/net/minecraft/world/level/block/SaplingBlock.java b/src/main/java/net/minecraft/world/level/block/SaplingBlock.java +index d262a5a6da57ef9ba9a6fe0dfbc88f577105e74f..15db3fb971a944e856b3cde86035d290673c0c1a 100644 +--- a/src/main/java/net/minecraft/world/level/block/SaplingBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/SaplingBlock.java +@@ -35,7 +35,7 @@ public class SaplingBlock extends BushBlock implements BonemealableBlock { + protected static final float AABB_OFFSET = 6.0F; + protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D); + protected final TreeGrower treeGrower; +- public static TreeType treeType; // CraftBukkit ++ public static final ThreadLocal treeTypeRT = new ThreadLocal<>(); // CraftBukkit // SparklyPaper - parallel world ticking (from Folia) + + @Override + public MapCodec codec() { +@@ -73,8 +73,8 @@ public class SaplingBlock extends BushBlock implements BonemealableBlock { + this.treeGrower.growTree(world, world.getChunkSource().getGenerator(), pos, state, random); + world.captureTreeGeneration = false; + if (world.capturedBlockStates.size() > 0) { +- TreeType treeType = SaplingBlock.treeType; +- SaplingBlock.treeType = null; ++ TreeType treeType = SaplingBlock.treeTypeRT.get(); // SparklyPaper - parallel world ticking ++ SaplingBlock.treeTypeRT.set(null); // SparklyPaper - parallel world ticking + Location location = CraftLocation.toBukkit(pos, world.getWorld()); + java.util.List blocks = new java.util.ArrayList<>(world.capturedBlockStates.values()); + world.capturedBlockStates.clear(); +diff --git a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java +index 1f29b2419914ca9257db6553f01b7e7ec49bfc18..8297c5be8c35fc6762c433aa072a78bf5fd666da 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java +@@ -82,6 +82,12 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co + return canUnlock(player, lock, containerName, null); + } + public static boolean canUnlock(Player player, LockCode lock, Component containerName, @Nullable BlockEntity blockEntity) { ++ // SparklyPaper - parallel world ticking (see: PARALLEL_NOTES.md - Opening an inventory after a world switch) ++ if (player instanceof net.minecraft.server.level.ServerPlayer serverPlayer && blockEntity != null && blockEntity.getLevel() != serverPlayer.serverLevel()) { ++ net.minecraft.server.MinecraftServer.LOGGER.warn("Player " + serverPlayer.getScoreboardName() + " (" + serverPlayer.getStringUUID() + ") attempted to open a BlockEntity @ " + blockEntity.getLevel().getWorld().getName() + " " + blockEntity.getBlockPos().getX() + ", " + blockEntity.getBlockPos().getY() + ", " + blockEntity.getBlockPos().getZ() + " while they were in a different world " + serverPlayer.level().getWorld().getName() + " than the block themselves!"); ++ return false; ++ } ++ // SparklyPaper end + if (player instanceof net.minecraft.server.level.ServerPlayer serverPlayer && blockEntity != null && blockEntity.getLevel() != null && blockEntity.getLevel().getBlockEntity(blockEntity.getBlockPos()) == blockEntity) { + final org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(blockEntity.getLevel(), blockEntity.getBlockPos()); + net.kyori.adventure.text.Component lockedMessage = net.kyori.adventure.text.Component.translatable("container.isLocked", io.papermc.paper.adventure.PaperAdventure.asAdventure(containerName)); +diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java +index 4729befa12732a9fd65cce243b33b3b479026c41..a8113ee6b5a2e74182ba973231912ca636db5039 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java +@@ -46,9 +46,9 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi + // Paper end - Fix NPE in SculkBloomEvent world access + + public static void serverTick(Level world, BlockPos pos, BlockState state, SculkCatalystBlockEntity blockEntity) { +- org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverride = blockEntity.getBlockPos(); // CraftBukkit - SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep. ++ org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverrideRT.set(blockEntity.getBlockPos()); // SparklyPaper - parallel world ticking // CraftBukkit - SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep. + blockEntity.catalystListener.getSculkSpreader().updateCursors(world, pos, world.getRandom(), true); +- org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverride = null; // CraftBukkit ++ org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverrideRT.set(null); // SparklyPaper - parallel world ticking // CraftBukkit + } + + @Override +diff --git a/src/main/java/net/minecraft/world/level/block/grower/TreeGrower.java b/src/main/java/net/minecraft/world/level/block/grower/TreeGrower.java +index 2fec480b6ca12a95013d920852db58722579caf1..5566c6a2992ac3aa0a9f9cd62f87d401c0a73179 100644 +--- a/src/main/java/net/minecraft/world/level/block/grower/TreeGrower.java ++++ b/src/main/java/net/minecraft/world/level/block/grower/TreeGrower.java +@@ -175,55 +175,57 @@ public final class TreeGrower { + // CraftBukkit start + private void setTreeType(Holder> holder) { + ResourceKey> worldgentreeabstract = holder.unwrapKey().get(); ++ TreeType treeType; // SparklyPaper - parallel world ticking + if (worldgentreeabstract == TreeFeatures.OAK || worldgentreeabstract == TreeFeatures.OAK_BEES_005) { +- SaplingBlock.treeType = TreeType.TREE; ++ treeType = TreeType.TREE; + } else if (worldgentreeabstract == TreeFeatures.HUGE_RED_MUSHROOM) { +- SaplingBlock.treeType = TreeType.RED_MUSHROOM; ++ treeType = TreeType.RED_MUSHROOM; + } else if (worldgentreeabstract == TreeFeatures.HUGE_BROWN_MUSHROOM) { +- SaplingBlock.treeType = TreeType.BROWN_MUSHROOM; ++ treeType = TreeType.BROWN_MUSHROOM; + } else if (worldgentreeabstract == TreeFeatures.JUNGLE_TREE) { +- SaplingBlock.treeType = TreeType.COCOA_TREE; ++ treeType = TreeType.COCOA_TREE; + } else if (worldgentreeabstract == TreeFeatures.JUNGLE_TREE_NO_VINE) { +- SaplingBlock.treeType = TreeType.SMALL_JUNGLE; ++ treeType = TreeType.SMALL_JUNGLE; + } else if (worldgentreeabstract == TreeFeatures.PINE) { +- SaplingBlock.treeType = TreeType.TALL_REDWOOD; ++ treeType = TreeType.TALL_REDWOOD; + } else if (worldgentreeabstract == TreeFeatures.SPRUCE) { +- SaplingBlock.treeType = TreeType.REDWOOD; ++ treeType = TreeType.REDWOOD; + } else if (worldgentreeabstract == TreeFeatures.ACACIA) { +- SaplingBlock.treeType = TreeType.ACACIA; ++ treeType = TreeType.ACACIA; + } else if (worldgentreeabstract == TreeFeatures.BIRCH || worldgentreeabstract == TreeFeatures.BIRCH_BEES_005) { +- SaplingBlock.treeType = TreeType.BIRCH; ++ treeType = TreeType.BIRCH; + } else if (worldgentreeabstract == TreeFeatures.SUPER_BIRCH_BEES_0002) { +- SaplingBlock.treeType = TreeType.TALL_BIRCH; ++ treeType = TreeType.TALL_BIRCH; + } else if (worldgentreeabstract == TreeFeatures.SWAMP_OAK) { +- SaplingBlock.treeType = TreeType.SWAMP; ++ treeType = TreeType.SWAMP; + } else if (worldgentreeabstract == TreeFeatures.FANCY_OAK || worldgentreeabstract == TreeFeatures.FANCY_OAK_BEES_005) { +- SaplingBlock.treeType = TreeType.BIG_TREE; ++ treeType = TreeType.BIG_TREE; + } else if (worldgentreeabstract == TreeFeatures.JUNGLE_BUSH) { +- SaplingBlock.treeType = TreeType.JUNGLE_BUSH; ++ treeType = TreeType.JUNGLE_BUSH; + } else if (worldgentreeabstract == TreeFeatures.DARK_OAK) { +- SaplingBlock.treeType = TreeType.DARK_OAK; ++ treeType = TreeType.DARK_OAK; + } else if (worldgentreeabstract == TreeFeatures.MEGA_SPRUCE) { +- SaplingBlock.treeType = TreeType.MEGA_REDWOOD; ++ treeType = TreeType.MEGA_REDWOOD; + } else if (worldgentreeabstract == TreeFeatures.MEGA_PINE) { +- SaplingBlock.treeType = TreeType.MEGA_PINE; ++ treeType = TreeType.MEGA_PINE; + } else if (worldgentreeabstract == TreeFeatures.MEGA_JUNGLE_TREE) { +- SaplingBlock.treeType = TreeType.JUNGLE; ++ treeType = TreeType.JUNGLE; + } else if (worldgentreeabstract == TreeFeatures.AZALEA_TREE) { +- SaplingBlock.treeType = TreeType.AZALEA; ++ treeType = TreeType.AZALEA; + } else if (worldgentreeabstract == TreeFeatures.MANGROVE) { +- SaplingBlock.treeType = TreeType.MANGROVE; ++ treeType = TreeType.MANGROVE; + } else if (worldgentreeabstract == TreeFeatures.TALL_MANGROVE) { +- SaplingBlock.treeType = TreeType.TALL_MANGROVE; ++ treeType = TreeType.TALL_MANGROVE; + } else if (worldgentreeabstract == TreeFeatures.CHERRY || worldgentreeabstract == TreeFeatures.CHERRY_BEES_005) { +- SaplingBlock.treeType = TreeType.CHERRY; ++ treeType = TreeType.CHERRY; + } else if (worldgentreeabstract == TreeFeatures.PALE_OAK) { +- SaplingBlock.treeType = TreeType.PALE_OAK; ++ treeType = TreeType.PALE_OAK; + } else if (worldgentreeabstract == TreeFeatures.PALE_OAK_CREAKING) { +- SaplingBlock.treeType = TreeType.PALE_OAK_CREAKING; ++ treeType = TreeType.PALE_OAK_CREAKING; + } else { + throw new IllegalArgumentException("Unknown tree generator " + worldgentreeabstract); + } ++ SaplingBlock.treeTypeRT.set(treeType); // SparklyPaper - parallel world ticking + } + // CraftBukkit end + +diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +index b4c16fe7c9215b5610b7e7488c29b497b5357ecc..9771f4ff6083868442fa142ef5c6c9a31397407f 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -382,6 +382,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + + @Nullable + public BlockState setBlockState(BlockPos blockposition, BlockState iblockdata, boolean flag, boolean doPlace) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this.level, blockposition, "Updating block asynchronously"); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + // CraftBukkit end + int i = blockposition.getY(); + LevelChunkSection chunksection = this.getSection(this.getSectionIndex(i)); +diff --git a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java +index d8b4196adf955f8d414688dc451caac2d9c609d9..56089483da1313d2da90c1921af33c2d81024680 100644 +--- a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java ++++ b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java +@@ -10,17 +10,26 @@ import net.minecraft.world.entity.Entity; + + public class EntityTickList { + private final ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet entities = new ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<>(); // Paper - rewrite chunk system ++ // SparklyPaper start - parallel world ticking ++ // Used to track async entity additions/removals/loops ++ private final net.minecraft.server.level.ServerLevel serverLevel; ++ public EntityTickList(net.minecraft.server.level.ServerLevel serverLevel) { ++ this.serverLevel = serverLevel; ++ } ++ // SparklyPaper end + + private void ensureActiveIsNotIterated() { + // Paper - rewrite chunk system + } + + public void add(Entity entity) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(entity, "Asynchronous entity ticklist addition"); // Paper // SparklyPaper - parallel world ticking (additional concurrency issues logs) + this.ensureActiveIsNotIterated(); + this.entities.add(entity); // Paper - rewrite chunk system + } + + public void remove(Entity entity) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(entity, "Asynchronous entity ticklist removal"); // Paper // SparklyPaper - parallel world ticking (additional concurrency issues logs) + this.ensureActiveIsNotIterated(); + this.entities.remove(entity); // Paper - rewrite chunk system + } +@@ -30,7 +39,7 @@ public class EntityTickList { + } + + public void forEach(Consumer action) { +- // Paper start - rewrite chunk system ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverLevel, "Asynchronous entity ticklist iteration"); // Paper // SparklyPaper - parallel world ticking (additional concurrency issues logs) + // To ensure nothing weird happens with dimension travelling, do not iterate over new entries... + // (by dfl iterator() is configured to not iterate over new entries) + final ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet.Iterator iterator = this.entities.iterator(); +diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapIndex.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapIndex.java +index 84f4664950e0cef7bd823bfc74f37cefce620d9e..b0c3b64da7aed676a5614c442948bbe96c3d2d73 100644 +--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapIndex.java ++++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapIndex.java +@@ -34,17 +34,21 @@ public class MapIndex extends SavedData { + + @Override + public CompoundTag save(CompoundTag nbt, HolderLookup.Provider registries) { ++ synchronized (this.usedAuxIds) { // SparklyPaper start - make map data thread-safe + for (Entry entry : this.usedAuxIds.object2IntEntrySet()) { +- nbt.putInt(entry.getKey(), entry.getIntValue()); ++ nbt.putInt(entry.getKey(), entry.getIntValue()); + } ++ } // SparklyPaper end - make map data thread-safe + + return nbt; + } + + public MapId getFreeAuxValueForMap() { ++ synchronized (this.usedAuxIds) { // SparklyPaper start - make map data thread-safe + int i = this.usedAuxIds.getInt("map") + 1; + this.usedAuxIds.put("map", i); + this.setDirty(); + return new MapId(i); ++ } // SparklyPaper end - make map data thread-safe + } + } +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index 57da11c0da7322e74810e7108e9c8000b0c36520..71709c8a8c5cec6403ec92badde412427c8f276b 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -459,7 +459,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { + } + + private boolean unloadChunk0(int x, int z, boolean save) { +- org.spigotmc.AsyncCatcher.catchOp("chunk unload"); // Spigot ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this.world, x, z, "Cannot unload chunk asynchronously"); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + if (!this.isChunkLoaded(x, z)) { + return true; + } +@@ -482,6 +482,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { + if (!unloadChunk0(x, z, false)) { + return false; + } ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this.world, x, z, "Cannot regenerate chunk asynchronously"); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + warnUnsafeChunk("regenerating a faraway chunk", x, z); // Paper + + final long chunkKey = ChunkCoordIntPair.pair(x, z); +@@ -503,6 +504,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { + + @Override + public boolean refreshChunk(int x, int z) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this.world, x, z, "Cannot refresh chunk asynchronously"); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z)); + if (playerChunk == null) return false; + +@@ -563,7 +565,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { + + @Override + public boolean loadChunk(int x, int z, boolean generate) { +- org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this.getHandle(), x, z, "May not sync load chunks asynchronously"); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + warnUnsafeChunk("loading a faraway chunk", x, z); // Paper + ChunkAccess chunk = this.world.getChunkSource().getChunk(x, z, generate || isChunkGenerated(x, z) ? ChunkStatus.FULL : ChunkStatus.EMPTY, true); // Paper + +@@ -815,6 +817,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { + + @Override + public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this.world, loc.getX(), loc.getZ(), "Cannot generate tree asynchronously"); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + this.world.captureTreeGeneration = true; + this.world.captureBlockStates = true; + boolean grownTree = this.generateTree(loc, type); +@@ -930,6 +933,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { + } + public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source, Consumer configurator) { + // Paper end - expand explosion API ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this.world, x, z, "Cannot create explosion asynchronously"); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + net.minecraft.world.level.Level.ExplosionInteraction explosionType; + if (!breakBlocks) { + explosionType = net.minecraft.world.level.Level.ExplosionInteraction.NONE; // Don't break blocks +@@ -1021,6 +1025,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { + + @Override + public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this.world, x >> 4, z >> 4, "Cannot retrieve chunk asynchronously"); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + warnUnsafeChunk("getting a faraway chunk", x >> 4, z >> 4); // Paper + // Transient load for this tick + return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z); +@@ -1051,6 +1056,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { + @Override + public void setBiome(int x, int y, int z, Holder bb) { + BlockPos pos = new BlockPos(x, 0, z); ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this.world, pos, "Cannot retrieve chunk asynchronously"); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + if (this.world.hasChunkAt(pos)) { + net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkAt(pos); + +@@ -2327,6 +2333,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { + + @Override + public void sendGameEvent(Entity sourceEntity, org.bukkit.GameEvent gameEvent, Vector position) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this.world, position.getX(), position.getZ(), "Cannot send game event asynchronously"); // SparklyPaper - parallel world ticking (additional concurrency issues logs) + getHandle().gameEvent(sourceEntity != null ? ((CraftEntity) sourceEntity).getHandle(): null, net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT.get(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(gameEvent.getKey())).orElseThrow(), org.bukkit.craftbukkit.util.CraftVector.toBlockPos(position)); + } + // Paper end +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +index 5cb69d0b822e11a99a96aef4f59986d083b079f4..78f9c3f3b068f638570942961ad41969abc9c028 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +@@ -75,6 +75,11 @@ public class CraftBlock implements Block { + } + + public net.minecraft.world.level.block.state.BlockState getNMS() { ++ // Folia start - parallel world ticking ++ if (world instanceof ServerLevel serverWorld) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot read world asynchronously"); ++ } ++ // Folia end - parallel world ticking + return this.world.getBlockState(this.position); + } + +@@ -157,6 +162,11 @@ public class CraftBlock implements Block { + } + + private void setData(final byte data, int flag) { ++ // SparklyPaper start - parallel world ticking ++ if (world instanceof ServerLevel serverWorld) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot modify world asynchronously"); ++ } ++ // SparklyPaper end - parallel world ticking + this.world.setBlock(this.position, CraftMagicNumbers.getBlock(this.getType(), data), flag); + } + +@@ -198,6 +208,12 @@ public class CraftBlock implements Block { + } + + public static boolean setTypeAndData(LevelAccessor world, BlockPos position, net.minecraft.world.level.block.state.BlockState old, net.minecraft.world.level.block.state.BlockState blockData, boolean applyPhysics) { ++ // SparklyPaper start - parallel world ticking ++ if (world instanceof ServerLevel serverWorld) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot modify world asynchronously"); ++ } ++ // SparklyPaper end - parallel world ticking ++ + // SPIGOT-611: need to do this to prevent glitchiness. Easier to handle this here (like /setblock) than to fix weirdness in tile entity cleanup + if (old.hasBlockEntity() && blockData.getBlock() != old.getBlock()) { // SPIGOT-3725 remove old tile entity if block changes + // SPIGOT-4612: faster - just clear tile +@@ -343,18 +359,33 @@ public class CraftBlock implements Block { + + @Override + public Biome getBiome() { ++ // SparklyPaper start - parallel world ticking ++ if (world instanceof ServerLevel serverWorld) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot read world asynchronously"); ++ } ++ // SparklyPaper end - parallel world ticking + return this.getWorld().getBiome(this.getX(), this.getY(), this.getZ()); + } + + // Paper start + @Override + public Biome getComputedBiome() { ++ // SparklyPaper start - parallel world ticking ++ if (world instanceof ServerLevel serverWorld) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot read world asynchronously"); ++ } ++ // SparklyPaper end - parallel world ticking + return this.getWorld().getComputedBiome(this.getX(), this.getY(), this.getZ()); + } + // Paper end + + @Override + public void setBiome(Biome bio) { ++ // SparklyPaper start - parallel world ticking ++ if (world instanceof ServerLevel serverWorld) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot modify world asynchronously"); ++ } ++ // SparklyPaper end - parallel world ticking + this.getWorld().setBiome(this.getX(), this.getY(), this.getZ(), bio); + } + +@@ -402,6 +433,11 @@ public class CraftBlock implements Block { + + @Override + public boolean isBlockFaceIndirectlyPowered(BlockFace face) { ++ // SparklyPaper start - parallel world ticking ++ if (world instanceof ServerLevel serverWorld) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot read world asynchronously"); ++ } ++ // SparklyPaper end - parallel world ticking + int power = this.world.getMinecraftWorld().getSignal(this.position, CraftBlock.blockFaceToNotch(face)); + + Block relative = this.getRelative(face); +@@ -414,6 +450,11 @@ public class CraftBlock implements Block { + + @Override + public int getBlockPower(BlockFace face) { ++ // SparklyPaper start - parallel world ticking ++ if (world instanceof ServerLevel serverWorld) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot read world asynchronously"); ++ } ++ // SparklyPaper end - parallel world ticking + int power = 0; + net.minecraft.world.level.Level world = this.world.getMinecraftWorld(); + int x = this.getX(); +@@ -484,6 +525,11 @@ public class CraftBlock implements Block { + + @Override + public boolean breakNaturally() { ++ // SparklyPaper start - parallel world ticking ++ if (world instanceof ServerLevel serverWorld) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot modify world asynchronously"); ++ } ++ // SparklyPaper end - parallel world ticking + return this.breakNaturally(null); + } + +@@ -543,6 +589,11 @@ public class CraftBlock implements Block { + + @Override + public boolean applyBoneMeal(BlockFace face) { ++ // SparklyPaper start - parallel world ticking ++ if (world instanceof ServerLevel serverWorld) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot modify world asynchronously"); ++ } ++ // SparklyPaper end - parallel world ticking + Direction direction = CraftBlock.blockFaceToNotch(face); + BlockFertilizeEvent event = null; + ServerLevel world = this.getCraftWorld().getHandle(); +@@ -554,8 +605,8 @@ public class CraftBlock implements Block { + world.captureTreeGeneration = false; + + if (world.capturedBlockStates.size() > 0) { +- TreeType treeType = SaplingBlock.treeType; +- SaplingBlock.treeType = null; ++ TreeType treeType = SaplingBlock.treeTypeRT.get(); // SparklyPaper - parallel world ticking ++ SaplingBlock.treeTypeRT.set(null); // SparklyPaper - parallel world ticking + List blocks = new ArrayList<>(world.capturedBlockStates.values()); + world.capturedBlockStates.clear(); + StructureGrowEvent structureEvent = null; +@@ -644,6 +695,11 @@ public class CraftBlock implements Block { + + @Override + public RayTraceResult rayTrace(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode) { ++ // SparklyPaper start - parallel world ticking ++ if (world instanceof ServerLevel serverWorld) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot read world asynchronously"); ++ } ++ // SparklyPaper end - parallel world ticking + Preconditions.checkArgument(start != null, "Location start cannot be null"); + Preconditions.checkArgument(this.getWorld().equals(start.getWorld()), "Location start cannot be a different world"); + start.checkFinite(); +@@ -685,6 +741,11 @@ public class CraftBlock implements Block { + + @Override + public boolean canPlace(BlockData data) { ++ // SparklyPaper start - parallel world ticking ++ if (world instanceof ServerLevel serverWorld) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot read world asynchronously"); ++ } ++ // SparklyPaper end - parallel world ticking + Preconditions.checkArgument(data != null, "BlockData cannot be null"); + net.minecraft.world.level.block.state.BlockState iblockdata = ((CraftBlockData) data).getState(); + net.minecraft.world.level.Level world = this.world.getMinecraftWorld(); +@@ -719,6 +780,11 @@ public class CraftBlock implements Block { + + @Override + public void tick() { ++ // SparklyPaper start - parallel world ticking ++ if (world instanceof ServerLevel serverWorld) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot modify world asynchronously"); ++ } ++ // SparklyPaper end - parallel world ticking + final ServerLevel level = this.world.getMinecraftWorld(); + this.getNMS().tick(level, this.position, level.random); + } +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +index 04ae258a2f8e98421340d29d5cceedec045171b7..3e90f16d303a8f3d1e2b01e7cbd62cbd991d3f06 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +@@ -25,7 +25,7 @@ public abstract class CraftBlockEntityState extends Craft + private final T tileEntity; + private final T snapshot; + public boolean snapshotDisabled; // Paper +- public static boolean DISABLE_SNAPSHOT = false; // Paper ++ public static ThreadLocal DISABLE_SNAPSHOT = ThreadLocal.withInitial(() -> Boolean.FALSE); // SparklyPaper - parallel world ticking + + public CraftBlockEntityState(World world, T tileEntity) { + super(world, tileEntity.getBlockPos(), tileEntity.getBlockState()); +@@ -34,8 +34,8 @@ public abstract class CraftBlockEntityState extends Craft + + try { // Paper - Show blockstate location if we failed to read it + // Paper start +- this.snapshotDisabled = DISABLE_SNAPSHOT; +- if (DISABLE_SNAPSHOT) { ++ this.snapshotDisabled = DISABLE_SNAPSHOT.get(); // SparklyPaper - parallel world ticking ++ if (DISABLE_SNAPSHOT.get()) { // SparklyPaper - parallel world ticking + this.snapshot = this.tileEntity; + } else { + this.snapshot = this.createSnapshot(tileEntity); +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java +index fa63a6cfcfcc4eee4503a82d85333c139c8c8b2b..9856860ee2987738bbcad5d752670e30f569ba74 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java +@@ -215,6 +215,12 @@ public class CraftBlockState implements BlockState { + LevelAccessor access = this.getWorldHandle(); + CraftBlock block = this.getBlock(); + ++ // SparklyPaper start - parallel world ticking ++ if (access instanceof net.minecraft.server.level.ServerLevel serverWorld) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot modify world asynchronously"); ++ } ++ // SparklyPaper end - parallel world ticking ++ + if (block.getType() != this.getType()) { + if (!force) { + return false; +@@ -350,6 +356,7 @@ public class CraftBlockState implements BlockState { + + @Override + public java.util.Collection getDrops(org.bukkit.inventory.ItemStack item, org.bukkit.entity.Entity entity) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(world.getHandle(), position, "Cannot modify world asynchronously"); // SparklyPaper - parallel world ticking + this.requirePlaced(); + net.minecraft.world.item.ItemStack nms = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item); + +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java +index 56453454cbd4b9e9270fc833f8ab38d5fa7a3763..ad507c36d89ce8639fbedbb1df0da66bdc96affa 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java +@@ -249,8 +249,8 @@ public final class CraftBlockStates { + net.minecraft.world.level.block.state.BlockState blockData = craftBlock.getNMS(); + BlockEntity tileEntity = craftBlock.getHandle().getBlockEntity(blockPosition); + // Paper start - block state snapshots +- boolean prev = CraftBlockEntityState.DISABLE_SNAPSHOT; +- CraftBlockEntityState.DISABLE_SNAPSHOT = !useSnapshot; ++ boolean prev = CraftBlockEntityState.DISABLE_SNAPSHOT.get(); // SparklyPaper - parallel world ticking ++ CraftBlockEntityState.DISABLE_SNAPSHOT.set(!useSnapshot); // SparklyPaper - parallel world ticking + try { + // Paper end + CraftBlockState blockState = CraftBlockStates.getBlockState(world, blockPosition, blockData, tileEntity); +@@ -258,7 +258,7 @@ public final class CraftBlockStates { + return blockState; + // Paper start + } finally { +- CraftBlockEntityState.DISABLE_SNAPSHOT = prev; ++ CraftBlockEntityState.DISABLE_SNAPSHOT.set(prev); // SparklyPaper - parallel world ticking + } + // Paper end + } +diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +index 85926a55066ac793b2e4cfe3502f9ab201df91a3..122bcd352c01ba1a635c34a148bab25548301ee6 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -951,7 +951,7 @@ public class CraftEventFactory { + return CraftEventFactory.handleBlockSpreadEvent(world, source, target, block, 2); + } + +- public static BlockPos sourceBlockOverride = null; // SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep. ++ public static final ThreadLocal sourceBlockOverrideRT = new ThreadLocal<>(); // SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep. // SparklyPaper - parallel world ticking (this is from Folia, fixes concurrency bugs with sculk catalysts) + + public static boolean handleBlockSpreadEvent(LevelAccessor world, BlockPos source, BlockPos target, net.minecraft.world.level.block.state.BlockState block, int flag) { + // Suppress during worldgen +@@ -963,7 +963,7 @@ public class CraftEventFactory { + CraftBlockState state = CraftBlockStates.getBlockState(world, target, flag); + state.setData(block); + +- BlockSpreadEvent event = new BlockSpreadEvent(state.getBlock(), CraftBlock.at(world, CraftEventFactory.sourceBlockOverride != null ? CraftEventFactory.sourceBlockOverride : source), state); ++ BlockSpreadEvent event = new BlockSpreadEvent(state.getBlock(), CraftBlock.at(world, CraftEventFactory.sourceBlockOverrideRT.get() != null ? CraftEventFactory.sourceBlockOverrideRT.get() : source), state); // SparklyPaper - parallel world ticking + Bukkit.getPluginManager().callEvent(event); + + if (!event.isCancelled()) { +@@ -2247,7 +2247,7 @@ public class CraftEventFactory { + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemStack.copyWithCount(1)); + + org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(bukkitBlock, craftItem.clone(), CraftVector.toBukkit(to)); +- if (!net.minecraft.world.level.block.DispenserBlock.eventFired) { ++ if (!net.minecraft.world.level.block.DispenserBlock.eventFired.get()) { // SparklyPaper - parallel world ticking + if (!event.callEvent()) { + return itemStack; + } +diff --git a/src/main/kotlin/net/sparklypower/sparklypaper/ServerLevelTickExecutorThreadFactory.kt b/src/main/kotlin/net/sparklypower/sparklypaper/ServerLevelTickExecutorThreadFactory.kt +new file mode 100644 +index 0000000000000000000000000000000000000000..9a40afbd7e5085179dc016c900ecb60e98250daf +--- /dev/null ++++ b/src/main/kotlin/net/sparklypower/sparklypaper/ServerLevelTickExecutorThreadFactory.kt +@@ -0,0 +1,20 @@ ++package net.sparklypower.sparklypaper ++ ++import ca.spottedleaf.moonrise.common.util.TickThread ++import java.util.concurrent.ThreadFactory ++ ++class ServerLevelTickExecutorThreadFactory(private val worldName: String) : ThreadFactory { ++ override fun newThread(p0: Runnable): Thread { ++ val tickThread = TickThread.ServerLevelTickThread(p0, "serverlevel-tick-worker [$worldName]") ++ ++ if (tickThread.isDaemon) { ++ tickThread.isDaemon = false ++ } ++ ++ if (tickThread.priority != 5) { ++ tickThread.priority = 5 ++ } ++ ++ return tickThread ++ } ++} +\ No newline at end of file +diff --git a/src/main/kotlin/net/sparklypower/sparklypaper/configs/SparklyPaperConfigUtils.kt b/src/main/kotlin/net/sparklypower/sparklypaper/configs/SparklyPaperConfigUtils.kt +index 072b5811acf9ecc58e3bba7f74dc0dcf8556e848..ddb2fec6ff1604577705477237bdc6a7b2702328 100644 +--- a/src/main/kotlin/net/sparklypower/sparklypaper/configs/SparklyPaperConfigUtils.kt ++++ b/src/main/kotlin/net/sparklypower/sparklypaper/configs/SparklyPaperConfigUtils.kt +@@ -23,6 +23,7 @@ object SparklyPaperConfigUtils { + ) + + lateinit var config: SparklyPaperConfig ++ val logContainerCreationStacktraces = java.lang.Boolean.getBoolean("sparklypaper.logContainerCreationStacktraces") + + fun init(configFile: File) { + // Write default config if the file doesn't exist diff --git a/patches/work/.gitkeep b/patches/work/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/patches/work/0033-Port-SparklyPaper-patches.patch b/patches/work/0033-Port-SparklyPaper-patches.patch deleted file mode 100644 index c10a1ce..0000000 --- a/patches/work/0033-Port-SparklyPaper-patches.patch +++ /dev/null @@ -1,909 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaKR93 -Date: Thu, 25 Jan 2024 17:13:09 +0900 -Subject: [PATCH] Port SparklyPaper patches - -SparklyPower -Copyright (C) 2024 SparklyPower - -Based on commit: 29212936a832106c4d68e2a2017acbea2fdd3cc4 - -diff --git a/src/main/java/io/papermc/paper/command/MSPTCommand.java b/src/main/java/io/papermc/paper/command/MSPTCommand.java -index 8b5293b0c696ef21d0101493ffa41b60bf0bc86b..03be23690a94a14d7343526acad67ccf53b85c70 100644 ---- a/src/main/java/io/papermc/paper/command/MSPTCommand.java -+++ b/src/main/java/io/papermc/paper/command/MSPTCommand.java -@@ -78,6 +78,47 @@ public final class MSPTCommand extends Command { - ) - ) - ); -+ -+ // Plazma start - Port SparklyPaper patches; Track World specific MSPT -+ sender.sendMessage(text()); -+ sender.sendMessage(text().content("World tick times ").color(GOLD) -+ .append(text().color(YELLOW) -+ .append( -+ text("("), -+ text("avg", GRAY), -+ text("/"), -+ text("min", GRAY), -+ text("/"), -+ text("max", GRAY), -+ text(")") -+ ) -+ ).append( -+ text(" from last 5s"), -+ text(",", GRAY), -+ text(" 10s"), -+ text(",", GRAY), -+ text(" 1m"), -+ text(":", YELLOW) -+ ) -+ ); -+ for (net.minecraft.server.level.ServerLevel level: server.getAllLevels()) { -+ List worldTimes = new ArrayList<>(); -+ worldTimes.addAll(eval(level.tickTimes5s.getTimes())); -+ worldTimes.addAll(eval(level.tickTimes10s.getTimes())); -+ worldTimes.addAll(eval(level.tickTimes60s.getTimes())); -+ -+ sender.sendMessage(text().content("◴ " + level.getWorld().getName() + ": ").color(GOLD) -+ .append(text().color(GRAY) -+ .append( -+ worldTimes.get(0), SLASH, worldTimes.get(1), SLASH, worldTimes.get(2), text(", ", YELLOW), -+ worldTimes.get(3), SLASH, worldTimes.get(4), SLASH, worldTimes.get(5), text(", ", YELLOW), -+ worldTimes.get(6), SLASH, worldTimes.get(7), SLASH, worldTimes.get(8) -+ ) -+ ) -+ ); -+ } -+ // Plazma end - Port SparklyPaper patches; Track World specific MSPT -+ - return true; - } - -diff --git a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java -index c03608fec96b51e1867f43d8f42e5aefb1520e46..93180066224345c0332fb33744f84204f15bba29 100644 ---- a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java -+++ b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java -@@ -41,6 +41,7 @@ public final class EntityScheduler { - - private long tickCount = 0L; - private static final long RETIRED_TICK_COUNT = -1L; -+ private static final net.minecraft.server.MinecraftServer SERVER = net.minecraft.server.MinecraftServer.getServer(); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run - private final Object stateLock = new Object(); - private final Long2ObjectOpenHashMap> oneTimeDelayed = new Long2ObjectOpenHashMap<>(); - -@@ -61,15 +62,15 @@ public final class EntityScheduler { - * @throws IllegalStateException If the scheduler is already retired. - */ - public void retire() { -+ final Entity thisEntity = this.entity.getHandleRaw(); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run - synchronized (this.stateLock) { - if (this.tickCount == RETIRED_TICK_COUNT) { - throw new IllegalStateException("Already retired"); - } - this.tickCount = RETIRED_TICK_COUNT; -+ SERVER.entitiesWithScheduledTasks.remove(thisEntity); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run - } - -- final Entity thisEntity = this.entity.getHandleRaw(); -- - // correctly handle and order retiring while running executeTick - for (int i = 0, len = this.currentlyExecuting.size(); i < len; ++i) { - final ScheduledTask task = this.currentlyExecuting.pollFirst(); -@@ -124,6 +125,7 @@ public final class EntityScheduler { - if (this.tickCount == RETIRED_TICK_COUNT) { - return false; - } -+ SERVER.entitiesWithScheduledTasks.add(this.entity.getHandleRaw()); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run - this.oneTimeDelayed.computeIfAbsent(this.tickCount + Math.max(1L, delay), (final long keyInMap) -> { - return new ArrayList<>(); - }).add(task); -@@ -143,6 +145,12 @@ public final class EntityScheduler { - TickThread.ensureTickThread(thisEntity, "May not tick entity scheduler asynchronously"); - final List toRun; - synchronized (this.stateLock) { -+ // Plazma start - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run -+ if (this.currentlyExecuting.isEmpty() && this.oneTimeDelayed.isEmpty()) { -+ SERVER.entitiesWithScheduledTasks.remove(thisEntity); -+ return; -+ } -+ // Plazma end - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run - if (this.tickCount == RETIRED_TICK_COUNT) { - throw new IllegalStateException("Ticking retired scheduler"); - } -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 94eb4e0686d8235f06ea7950c178cdec8bd6e037..118832d94f96d7624f9faee35b9da0aeb9d9ded8 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -327,6 +327,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run - - public static S spin(Function serverFactory) { - AtomicReference atomicreference = new AtomicReference(); -@@ -1776,17 +1777,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { -- for (final Entity entity : level.moonrise$getEntityLookup().getAllCopy()) { // Paper - rewrite chunk system -- if (entity.isRemoved()) { -- continue; -- } -- final org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw(); -- if (bukkit != null) { -- bukkit.taskScheduler.executeTick(); -- } -- } -- }); -+ // Plazma start - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run -+ for (final Entity entity : entitiesWithScheduledTasks) { -+ if (entity.isRemoved() || entity.getBukkitEntityRaw() == null) continue; -+ entity.getBukkitEntityRaw().taskScheduler.executeTick(); -+ } -+ // Plazma end - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run - // Paper end - Folia scheduler API - io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper - //this.profiler.push("commandFunctions"); // Purpur -@@ -1852,8 +1848,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> trackedDataValues; - // CraftBukkit start - public final Set trackedPlayers; // Purpur - private -> public -+ public static boolean skipSqrWhenNoDeltaChanges = false; // Plazma - SparklyPaper port; Skip distanceToSqr if the delta movement hasn't changed - - public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer> consumer, Set trackedPlayers) { - this.trackedPlayers = trackedPlayers; -@@ -218,20 +219,21 @@ public class ServerEntity { - - if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) { - Vec3 vec3d1 = this.entity.getDeltaMovement(); -- double d0 = vec3d1.distanceToSqr(this.lastSentMovement); -- -- if (d0 > 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) { -- this.lastSentMovement = vec3d1; -- Entity entity1 = this.entity; -- -- if (entity1 instanceof AbstractHurtingProjectile) { -- AbstractHurtingProjectile entityfireball = (AbstractHurtingProjectile) entity1; -- -- this.broadcast.accept(new ClientboundBundlePacket(List.of(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement), new ClientboundProjectilePowerPacket(entityfireball.getId(), entityfireball.accelerationPower)))); -- } else { -- this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement)); -- } -- } -+ // Plazma start - SparklyPaper port; Skip distanceToSqr if the delta movement hasn't changed -+ if (!skipSqrWhenNoDeltaChanges && vec3d1 != this.lastSentMovement) { -+ double d0 = vec3d1.distanceToSqr(this.lastSentMovement); -+ if (d0 > 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) { -+ this.lastSentMovement = vec3d1; -+ Entity entity1 = this.entity; -+ if (entity1 instanceof AbstractHurtingProjectile) { -+ AbstractHurtingProjectile entityfireball = (AbstractHurtingProjectile) entity1; -+ this.broadcast.accept(new ClientboundBundlePacket(List.of(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement), new ClientboundProjectilePowerPacket(entityfireball.getId(), entityfireball.accelerationPower)))); -+ } else { -+ this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement)); -+ } -+ } // diff on changes -+ } // diff on changes -+ // Plazma end - SparklyPaper port; Skip distanceToSqr if the delta movement hasn't changed - } - - if (packet1 != null) { -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index dfcd3989ffbd4aa5dc9368a34b95c1c2748c23a2..f5f944899d860d8363db43d430f3daab96e0d774 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -233,6 +233,12 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. - private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current) - public boolean hasRidableMoveEvent = false; // Purpur - -+ // Plazma start - Port SparklyPaper patches; Track World specific MSPT -+ public final MinecraftServer.TickTimes tickTimes5s = new MinecraftServer.TickTimes(100); -+ public final MinecraftServer.TickTimes tickTimes10s = new MinecraftServer.TickTimes(200); -+ public final MinecraftServer.TickTimes tickTimes60s = new MinecraftServer.TickTimes(1200); -+ // Plazma end - Port SparklyPaper patches; Track World specific MSPT -+ - public LevelChunk getChunkIfLoaded(int x, int z) { - return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately - } -diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java -index fb7342f7a5008a283c3400c6313c637de8210dfa..8b068f6b4c52cdba60a7fbe21bc1f7a86891800a 100644 ---- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java -+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java -@@ -90,12 +90,14 @@ public class ServerStatsCounter extends StatsCounter { - this.dirty.add(stat); - } - -+ /* // Plazma - Port SparklyPaper patches; Skip dirty stats copy when requesting player stats - private Set> getDirty() { - Set> set = Sets.newHashSet(this.dirty); - - this.dirty.clear(); - return set; - } -+ */ // Plazma - Port SparklyPaper patches; Skip dirty stats copy when requesting player stats - - public void parseLocal(DataFixer dataFixer, String json) { - try { -@@ -243,7 +245,7 @@ public class ServerStatsCounter extends StatsCounter { - - public void sendStats(ServerPlayer player) { - Object2IntMap> object2intmap = new Object2IntOpenHashMap(); -- Iterator iterator = this.getDirty().iterator(); -+ Iterator> iterator = this.dirty.iterator(); // Plazma - SparklyPaper port; Skip dirty stats copy when requesting player stats - - while (iterator.hasNext()) { - Stat statistic = (Stat) iterator.next(); -@@ -251,6 +253,7 @@ public class ServerStatsCounter extends StatsCounter { - object2intmap.put(statistic, this.getValue(statistic)); - } - -+ this.dirty.clear(); // Plazma - SparklyPaper port; Skip dirty stats copy when requesting player stats - player.connection.send(new ClientboundAwardStatsPacket(object2intmap)); - } - } -diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java -index 36e5a6462675ceb3cef236c451321b1656d9fcc0..bdc2391aed4fedc2e15a0b51a6930a2d85905c90 100644 ---- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java -+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java -@@ -307,7 +307,7 @@ public class Bat extends AmbientCreature { - int i = world.getMaxLocalRawBrightness(pos); - byte b0 = 4; - -- if (Bat.isHalloweenSeason(world.getMinecraftWorld())) { // Purpur -+ if (isSpookySeason(world.getMinecraftWorld())) { // Purpur // Plazma - Port SparklyPaper patches; Optimize Spooky Season - b0 = 7; - } else if (random.nextBoolean()) { - return false; -@@ -321,7 +321,24 @@ public class Bat extends AmbientCreature { - private static boolean isSpookySeason = false; - private static final int ONE_HOUR = 20 * 60 * 60; - private static int lastSpookyCheck = -ONE_HOUR; -- public static boolean isHalloweenSeason(Level level) { return level.purpurConfig.forceHalloweenSeason || isHalloween(); } // Purpur -+ // Plazma start - Port SparklyPaper patches; Optimize Spooky Season -+ private static boolean isSpookySeason(Level level) { -+ if (level.purpurConfig.forceHalloweenSeason) return true; -+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.spookyOptimize) -+ return net.sparklypower.sparklypaper.HalloweenManager.isSpookySeason() -+ || net.sparklypower.sparklypaper.HalloweenManager.isHalloween(); -+ return isHalloween(); -+ } -+ -+ public static boolean isHalloweenSeason(Level level) { -+ if (level.purpurConfig.forceHalloweenSeason) return true; -+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.spookyOptimize) -+ return net.sparklypower.sparklypaper.HalloweenManager.isHalloween(); -+ return isHalloween(); -+ } -+ -+ @SuppressWarnings("RedundantExplicitChronoField") -+ // Plazma end - Port SparklyPaper patches; Optimize Spooky Season - private static boolean isHalloween() { - if (net.minecraft.server.MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) { - LocalDate localdate = LocalDate.now(); -diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java -index 608390ed36710a419de1542b80340dd3fcc7299c..043f068345ca3c50209c1c3cc1feb6277a3da61a 100644 ---- a/src/main/java/net/minecraft/world/item/MapItem.java -+++ b/src/main/java/net/minecraft/world/item/MapItem.java -@@ -268,11 +268,13 @@ public class MapItem extends ComplexItem { - } - } - -+ public static boolean skipTickWhenCraftNotPresent = false; // Plazma - SparklyPaper port; Skip map item ticking if the craft map renderer is not present - @Override - public void inventoryTick(ItemStack stack, Level world, Entity entity, int slot, boolean selected) { - if (!world.isClientSide) { - MapItemSavedData mapItemSavedData = getSavedData(stack, world); - if (mapItemSavedData != null) { -+ if (skipTickWhenCraftNotPresent && mapItemSavedData.mapView.getRenderers().stream().noneMatch(mapRenderer -> mapRenderer.getClass() == org.bukkit.craftbukkit.map.CraftMapRenderer.class)) return; // Plazma - SparklyPaper port; Skip map item ticking if the craft map renderer is not present - if (entity instanceof Player player) { - mapItemSavedData.tickCarriedBy(player, stack); - } -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 253d47418b4e9cbce74584c2461d12e17effd7bb..f3c44a2ddc52661984cc07b2ee23b3a3431a4b0a 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -1456,6 +1456,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - int tickedEntities = 0; // Paper - rewrite chunk system - - int tilesThisCycle = 0; -+ int shouldTickBlocksAtLastResult = -1; // Plazma - Port SparklyPaper patches; Optimize tickingBlockEntities -+ long shouldTickBlocksAtChunkPos = 0; // Plazma - Port SparklyPaper patches; Optimize tickingBlockEntities - var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet(); // Paper - Fix MC-117075; use removeAll - toRemove.add(null); // Paper - Fix MC-117075 - for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters -@@ -1468,14 +1470,28 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - tilesThisCycle--; - toRemove.add(tickingblockentity); // Paper - Fix MC-117075; use removeAll - // Spigot end -- } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) { -- tickingblockentity.tick(); -- // Paper start - rewrite chunk system -- if ((++tickedEntities & 7) == 0) { -- ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)(Level)(Object)this).moonrise$midTickTasks(); -- } -- // Paper end - rewrite chunk system -- } -+ // Plazma start - Port SparklyPaper patches; Optimize tickingBlockEntities -+ } else if (flag) { -+ long chunkPos = tickingblockentity.getChunkCoordinateKey(); -+ boolean shouldTick; -+ if (shouldTickBlocksAtChunkPos == chunkPos && shouldTickBlocksAtLastResult != -1) -+ shouldTick = shouldTickBlocksAtLastResult == 1; -+ else { -+ shouldTick = this.shouldTickBlocksAt(chunkPos); -+ shouldTickBlocksAtLastResult = shouldTick ? 1 : 0; -+ shouldTickBlocksAtChunkPos = chunkPos; -+ } // diff on changes -+ -+ if (shouldTick) { -+ tickingblockentity.tick(); -+ // Paper start - execute chunk tasks during tick -+ if ((++tickedEntities & 7) == 0) { -+ ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)(Level)(Object)this).moonrise$midTickTasks(); -+ } -+ // Paper end - execute chunk tasks during tick -+ } // diff on changes -+ } // diff on changes -+ // Plazma end - Port SparklyPaper patches; Optimize tickingBlockEntities - } - this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 - -diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java -index 5a190834baef60c7b61074393f8856a933902d81..366ae05a060b5b12b85521a4b8aed1907f3f044a 100644 ---- a/src/main/java/net/minecraft/world/level/block/CropBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java -@@ -77,35 +77,57 @@ public class CropBlock extends BushBlock implements BonemealableBlock { - - @Override - protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { -- if (world.getRawBrightness(pos, 0) >= 9) { -- int i = this.getAge(state); -- -- if (i < this.getMaxAge()) { -- float f = CropBlock.getGrowthSpeed(this, world, pos); -- -- // Spigot start -- int modifier; -- if (this == Blocks.BEETROOTS) { -- modifier = world.spigotConfig.beetrootModifier; -- } else if (this == Blocks.CARROTS) { -- modifier = world.spigotConfig.carrotModifier; -- } else if (this == Blocks.POTATOES) { -- modifier = world.spigotConfig.potatoModifier; -- // Paper start - Fix Spigot growth modifiers -- } else if (this == Blocks.TORCHFLOWER_CROP) { -- modifier = world.spigotConfig.torchFlowerModifier; -- // Paper end - Fix Spigot growth modifiers -- } else { -- modifier = world.spigotConfig.wheatModifier; -- } -+ // Plazma start - Port SparklyPaper patches; Optimize Farm checks -+ if (world.getRawBrightness(pos, 0) < 9) return; -+ -+ int age = this.getAge(state); -+ if (age >= this.getMaxAge()) return; -+ -+ final int modifier; -+ if (this == Blocks.BEETROOTS) { -+ modifier = world.spigotConfig.beetrootModifier; -+ } else if (this == Blocks.CARROTS) { -+ modifier = world.spigotConfig.carrotModifier; -+ } else if (this == Blocks.POTATOES) { -+ modifier = world.spigotConfig.potatoModifier; -+ } else if (this == Blocks.TORCHFLOWER_CROP) { -+ modifier = world.spigotConfig.torchFlowerModifier; -+ } else { -+ modifier = world.spigotConfig.wheatModifier; -+ } - -- if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution -- // Spigot end -- CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2); // CraftBukkit -- } -+ if (world.plazmaConfig().block.optimizeFarmCheck.enabled) { -+ BlockPos current = pos.below(); -+ BlockState currentState = world.getBlockState(current); -+ -+ boolean moist; -+ float growthSpeed; -+ if (currentState.is(Blocks.FARMLAND) && currentState.getValue(FarmBlock.MOISTURE) > 0) { -+ moist = true; -+ growthSpeed = world.plazmaConfig().block.optimizeFarmCheck.growthSpeed.moist; -+ } else { -+ moist = false; -+ growthSpeed = world.plazmaConfig().block.optimizeFarmCheck.growthSpeed.normal; - } -+ -+ if (world.plazmaConfig().block.optimizeFarmCheck.skipMiddleAgingStageForCrops) { -+ growthSpeed = growthSpeed / getMaxAge(); -+ age = getMaxAge() - 1; -+ } -+ -+ if (random.nextFloat() >= (modifier / (100.0f * Math.floor((25.0F / growthSpeed) + 1)))) return; -+ if (!CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(age + 1), 2)) return; -+ if (!moist || age + 1 != this.getMaxAge() || FarmBlock.isNearWater(world, current)) return; -+ -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, current, currentState.setValue(FarmBlock.MOISTURE, 0), 2); -+ return; - } - -+ float growthSpeed = CropBlock.getGrowthSpeed(this, world, pos); -+ -+ if (random.nextFloat() < (modifier / (100.0f * Math.floor((25.0F / growthSpeed) + 1)))) -+ CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(age + 1), 2); -+ // Plazma end - Port SparklyPaper patches; Optimize Farm checks - } - - public void growCrops(Level world, BlockPos pos, BlockState state) { -diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java -index d0ec0722496ed931b48c4e7076fddbb1ed36e111..b91afbc90c138ebb7f8722934f59f953642196c9 100644 ---- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java -@@ -92,7 +92,19 @@ public class FarmBlock extends Block { - - @Override - protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { -- int i = (Integer) state.getValue(FarmBlock.MOISTURE); -+ // Plazma start - Port SparklyPaper patches; Optimize Farm checks -+ int i = state.getValue(FarmBlock.MOISTURE); -+ if (world.plazmaConfig().block.optimizeFarmCheck.enabled) { -+ if (i != 0) return; -+ -+ if (isNearWater(world, pos)) -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, pos, state.setValue(MOISTURE, 7), 2); -+ else -+ turnToDirt(null, state, world, pos); -+ -+ return; -+ } -+ // Plazma end - Port SparklyPaper patches; Optimize Farm checks - if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks - if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks - -@@ -167,7 +179,7 @@ public class FarmBlock extends Block { - return world.getBlockState(pos.above()).is(BlockTags.MAINTAINS_FARMLAND); - } - -- private static boolean isNearWater(LevelReader world, BlockPos pos) { -+ static boolean isNearWater(LevelReader world, BlockPos pos) { // Plazma - AT (private -> package) - // Paper start - Perf: remove abstract block iteration - int xOff = pos.getX(); - int yOff = pos.getY(); -diff --git a/src/main/java/net/minecraft/world/level/block/StemBlock.java b/src/main/java/net/minecraft/world/level/block/StemBlock.java -index 924d80eb41d9a71d1e521c40742557251cf51832..4a30e1e6eac4b0e3dc2147a74e73e05fa76f5db2 100644 ---- a/src/main/java/net/minecraft/world/level/block/StemBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/StemBlock.java -@@ -72,38 +72,82 @@ public class StemBlock extends BushBlock implements BonemealableBlock { - - @Override - protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { -- if (world.getRawBrightness(pos, 0) >= 9) { -- float f = CropBlock.getGrowthSpeed(this, world, pos); -- -- if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution -- int i = (Integer) state.getValue(StemBlock.AGE); -- -- if (i < 7) { -- state = (BlockState) state.setValue(StemBlock.AGE, i + 1); -- CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit -- } else { -- Direction enumdirection = Direction.Plane.HORIZONTAL.getRandomDirection(random); -- BlockPos blockposition1 = pos.relative(enumdirection); -- BlockState iblockdata1 = world.getBlockState(blockposition1.below()); -- -- if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) { -- Registry iregistry = world.registryAccess().registryOrThrow(Registries.BLOCK); -- Optional optional = iregistry.getOptional(this.fruit); -- Optional optional1 = iregistry.getOptional(this.attachedStem); -- -- if (optional.isPresent() && optional1.isPresent()) { -- // CraftBukkit start -- if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) { -- return; -- } -- // CraftBukkit end -- world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection)); -- } -- } -- } -+ // Plazma start - Port SparklyPaper patches; Optimize Farm checks -+ if (world.getRawBrightness(pos, 0) < 9) return; -+ -+ int modifier = this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier; -+ -+ if (world.plazmaConfig().block.optimizeFarmCheck.enabled) { -+ final BlockPos current = pos.below(); -+ final BlockState currentState = world.getBlockState(current); -+ -+ final boolean moist; -+ final float growthSpeed; -+ if (currentState.is(Blocks.FARMLAND) && currentState.getValue(FarmBlock.MOISTURE) > 0) { -+ moist = true; -+ growthSpeed = world.plazmaConfig().block.optimizeFarmCheck.growthSpeed.moist; -+ } else { -+ moist = false; -+ growthSpeed = world.plazmaConfig().block.optimizeFarmCheck.growthSpeed.normal; - } - -+ if (random.nextFloat() >= (modifier / (100.0f * Math.floor((25.0F / growthSpeed) + 1)))) return; -+ -+ int age = state.getValue(AGE); -+ -+ if (age < 7) { -+ CraftEventFactory.handleMoistureChangeEvent(world, pos, state.setValue(AGE, age + 1), 2); -+ return; -+ } -+ -+ Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(random); -+ BlockPos pos1 = pos.relative(direction); -+ BlockState state1 = world.getBlockState(pos1.below()); -+ -+ if (!world.getBlockState(pos1).isAir() || (!state1.is(Blocks.FARMLAND) && !state1.is(BlockTags.DIRT))) -+ return; -+ -+ Registry registry = world.registryAccess().registryOrThrow(Registries.BLOCK); -+ Optional fruit = registry.getOptional(this.fruit); -+ Optional stem = registry.getOptional(this.attachedStem); -+ -+ if (fruit.isEmpty() || stem.isEmpty()) return; -+ if (!CraftEventFactory.handleBlockGrowEvent(world, pos1, fruit.get().defaultBlockState())) return; -+ if (moist && !FarmBlock.isNearWater(world, current)) -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, current, currentState.setValue(FarmBlock.MOISTURE, 0), 2); -+ -+ world.setBlockAndUpdate(pos, stem.get().defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, direction)); -+ return; - } -+ -+ float f = CropBlock.getGrowthSpeed(this, world, pos); -+ -+ if (random.nextFloat() >= (modifier / (100.0f * Math.floor((25.0F / f) + 1)))) return; -+ -+ int age = state.getValue(StemBlock.AGE); -+ -+ if (age < 7) { -+ CraftEventFactory.handleBlockGrowEvent(world, pos, state.setValue(StemBlock.AGE, age + 1), 2); -+ return; -+ } -+ -+ Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(random); -+ BlockPos pos1 = pos.relative(direction); -+ BlockState state1 = world.getBlockState(pos1.below()); -+ -+ if (!world.getBlockState(pos1).isAir() || (!state1.is(Blocks.FARMLAND) && !state1.is(BlockTags.DIRT))) return; -+ -+ Registry registry = world.registryAccess().registryOrThrow(Registries.BLOCK); -+ Optional fruit = registry.getOptional(this.fruit); -+ Optional stem = registry.getOptional(this.attachedStem); -+ -+ if (fruit.isEmpty() || stem.isEmpty()) return; -+ -+ if (!CraftEventFactory.handleBlockGrowEvent(world, pos1, fruit.get().defaultBlockState())) -+ return; -+ -+ world.setBlockAndUpdate(pos, stem.get().defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, direction)); -+ // Plazma end - Port SparklyPaper patches; Optimize Farm checks - } - - @Override -diff --git a/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java -index 28e3b73507b988f7234cbf29c4024c88180d0aef..6239c171ca996f3f5c23060f728a62236bc8b6d5 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java -@@ -10,4 +10,6 @@ public interface TickingBlockEntity { - BlockPos getPos(); - - String getType(); -+ -+ long getChunkCoordinateKey(); // Plazma - Port SparklyPaper patches; Optimize tickingBlockEntities - } -diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index 75c8125e20b70433fe9d143a3193d821043327c3..80511433c184c6918c8d2e7cff6ca257e8fbf676 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -66,6 +66,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom - protected volatile boolean unsaved; - private volatile boolean isLightCorrect; - protected final ChunkPos chunkPos; public final long coordinateKey; public final int locX; public final int locZ; // Paper - cache coordinate key -+ public final long nearbyPlayersCoordinateKey; // Plazma - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks - private long inhabitedTime; - /** @deprecated */ - @Nullable -@@ -144,6 +145,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom - public ChunkAccess(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor heightLimitView, Registry biomeRegistry, long inhabitedTime, @Nullable LevelChunkSection[] sectionArray, @Nullable BlendingData blendingData) { - this.locX = pos.x; this.locZ = pos.z; // Paper - reduce need for field lookups - this.chunkPos = pos; this.coordinateKey = ChunkPos.asLong(locX, locZ); // Paper - cache long key -+ this.nearbyPlayersCoordinateKey = ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(locX, locZ); // Plazma - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks - this.upgradeData = upgradeData; - this.levelHeightAccessor = heightLimitView; - this.sections = new LevelChunkSection[heightLimitView.getSectionsCount()]; -diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index a4578ae22409edb686d0bcbac8cbc1a2e1d7b988..9cc1a79dd25c63af6986e721ceff5560cf56b7d1 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -74,6 +74,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - public String getType() { - return ""; - } -+ -+ @Override public long getChunkCoordinateKey() { return 0; } // Plazma - Port SparklyPaper patches; Optimize tickingBlockEntities - }; - private final Map tickersInLevel; - public boolean loaded; -@@ -966,7 +968,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - } - - private TickingBlockEntity createTicker(T blockEntity, BlockEntityTicker blockEntityTicker) { -- return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, blockEntityTicker); -+ return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, blockEntityTicker, this.coordinateKey); // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity - } - - @FunctionalInterface -@@ -1017,6 +1019,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - public String toString() { - return String.valueOf(this.ticker) + " "; - } -+ -+ @Override public long getChunkCoordinateKey() { return this.ticker.getChunkCoordinateKey(); } // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity - } - - private class BoundTickingBlockEntity implements TickingBlockEntity { -@@ -1024,10 +1028,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - private final T blockEntity; - private final BlockEntityTicker ticker; - private boolean loggedInvalidBlockState; -+ private final long chunkCoordinateKey; // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity - -- BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker) { -+ BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker, long chunkCoordinateKey) { // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity - this.blockEntity = (T) tileentity; // CraftBukkit - decompile error - this.ticker = blockentityticker; -+ this.chunkCoordinateKey = chunkCoordinateKey; // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity - } - - @Override -@@ -1095,5 +1101,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - - return "Level ticker for " + s + "@" + String.valueOf(this.getPos()); - } -+ -+ @Override public long getChunkCoordinateKey() { return this.chunkCoordinateKey; } // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity - } - } -diff --git a/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java b/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java -new file mode 100644 -index 0000000000000000000000000000000000000000..f8c26e26025d7a7b5489ed5b3274ba734db27a1d ---- /dev/null -+++ b/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java -@@ -0,0 +1,78 @@ -+package net.sparklypower.sparklypaper; -+ -+import com.mojang.logging.LogUtils; -+import it.unimi.dsi.fastutil.Pair; -+import net.minecraft.world.level.Level; -+import org.slf4j.Logger; -+import java.time.LocalDateTime; -+import java.time.Month; -+import java.time.ZoneOffset; -+import java.util.concurrent.CountDownLatch; -+import java.util.concurrent.Executors; -+import java.util.concurrent.ScheduledExecutorService; -+import java.util.concurrent.ScheduledFuture; -+import java.util.concurrent.TimeUnit; -+import java.util.concurrent.atomic.AtomicBoolean; -+ -+import static org.plazmamc.plazma.configurations.GlobalConfiguration.get; -+ -+public class HalloweenManager { -+ -+ private static final Logger LOGGER = LogUtils.getClassLogger(); -+ private static final ScheduledExecutorService EXECUTOR = Executors.newSingleThreadScheduledExecutor(factory -> { -+ Thread thread = new Thread(factory); -+ thread.setName("halloween-timer-updater"); -+ thread.setPriority(1); -+ return thread; -+ }); -+ -+ private static ScheduledFuture future; -+ private static Pair spookyEpoch; -+ private static Pair halloweenEpoch; -+ -+ private static long getEpochMillisAtDate(Month month, int day, boolean start) { -+ LocalDateTime now = LocalDateTime.now(); -+ LocalDateTime target = LocalDateTime.of( -+ now.getYear(), month, day, start ? 0 : 23, start ? 0 : 59, start ? 0 : 59, start ? 0 : 999_999_999 -+ ); -+ -+ if (now.isAfter(target)) target = target.plusYears(1); -+ return target.atZone(ZoneOffset.systemDefault()).toInstant().toEpochMilli(); -+ } -+ -+ private static void syncEpoch() { -+ LOGGER.info("Updating Spooky Season and Halloween epoch..."); -+ spookyEpoch = Pair.of( -+ getEpochMillisAtDate(Month.OCTOBER, 20, true), -+ getEpochMillisAtDate(Month.NOVEMBER, 3, false) -+ ); -+ halloweenEpoch = Pair.of( -+ getEpochMillisAtDate(Month.OCTOBER, 31, true), -+ getEpochMillisAtDate(Month.OCTOBER, 31, false) -+ ); -+ LOGGER.info("Successfully updated Spooky Season and Halloween epoch"); -+ } -+ -+ public static void syncConfiguration() { -+ if (get().entity.spookyOptimize && future == null) { -+ startSyncEpochTask(); -+ } else if (!get().entity.spookyOptimize && future != null) { -+ future.cancel(true); -+ future = null; -+ } -+ } -+ -+ public static void startSyncEpochTask() { -+ if (!get().entity.spookyOptimize) return; -+ future = EXECUTOR.scheduleAtFixedRate(HalloweenManager::syncEpoch, 0, 90, TimeUnit.DAYS); -+ } -+ -+ public static boolean isSpookySeason() { -+ return spookyEpoch.first() <= System.currentTimeMillis() && System.currentTimeMillis() <= spookyEpoch.second(); -+ } -+ -+ public static boolean isHalloween() { -+ return halloweenEpoch.first() <= System.currentTimeMillis() && System.currentTimeMillis() <= halloweenEpoch.second(); -+ } -+ -+} -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 173e4a075078af67f030750c9a6294ab3f796677..92ad49e0ff5dc17bc8e181578ff93bc96e3503ef 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -978,7 +978,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - public void sendMultiBlockChange(final Map blockChanges) { - if (this.getHandle().connection == null) return; - -- Map> sectionMap = new HashMap<>(); -+ Map> sectionMap = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(); // Plazma - Port SparklyPaper patches; Optimize canSee checks - - for (Map.Entry entry : blockChanges.entrySet()) { - BlockData blockData = entry.getValue(); -@@ -2259,9 +2259,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - - @Override - public boolean canSee(org.bukkit.entity.Entity entity) { -- return this.equals(entity) || entity.isVisibleByDefault() ^ this.invertedVisibilityEntities.containsKey(entity.getUniqueId()); // SPIGOT-7312: Can always see self -+ return this.equals(entity) || this.chunkMapCanSee(entity); // SPIGOT-7312: Can always see self // Plazma - Port SparklyPaper patches; Optimize canSee check - } - -+ // Plazma start - Port SparklyPaper patches; Optimize canSee check (The check in ChunkMap#updatePlayer already rejects if it is the same entity, so we don't need to check it twice, especially because CraftPlayer's equals check is a bit expensive) -+ public boolean chunkMapCanSee(org.bukkit.entity.Entity entity) { -+ return entity.isVisibleByDefault() ^ (!invertedVisibilityEntities.isEmpty() && this.invertedVisibilityEntities.containsKey(entity.getUniqueId())); -+ } -+ // Plazma end - Port SparklyPaper patches; Optimize canSee check -+ - public boolean canSeePlayer(UUID uuid) { - org.bukkit.entity.Entity entity = this.getServer().getPlayer(uuid); - -diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java -index 8149b9c51b78eb5c689b7218a2ca3aab60e73bcf..b9a303f6280a2f6ad3616da152922a4f4a504281 100644 ---- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java -+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java -@@ -145,7 +145,7 @@ public class CraftMapColorCache implements MapPalette.MapColorCache { - } - - @Override -- public boolean isCached() { -+ public synchronized boolean isCached() { // Plazma - Fix concurrency issues when using "imageToBytes" in multiple threads - return this.cached || (!this.running.get() && this.initCache().isDone()); - } - -diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 451723377d505f1fe15ddd4ac535ca61fa253f17..7ccf554610bd00b602eb7be11df7028d2f6a7008 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -68,6 +68,8 @@ public class GlobalConfiguration extends ConfigurationPart { - public Entity entity; - public class Entity extends ConfigurationPart { - -+ boolean skipSqrWhenNoDeltaChanges = OPTIMIZE; -+ public boolean spookyOptimize = OPTIMIZE; - - public AsyncPathProcess asyncPathProcess; - public class AsyncPathProcess extends ConfigurationPart { -@@ -91,6 +93,7 @@ public class GlobalConfiguration extends ConfigurationPart { - - @PostProcess - public void post() { -+ net.minecraft.server.level.ServerEntity.skipSqrWhenNoDeltaChanges = this.skipSqrWhenNoDeltaChanges; - } - - } -@@ -98,9 +101,11 @@ public class GlobalConfiguration extends ConfigurationPart { - public World world; - public class World extends ConfigurationPart { - -+ boolean skipTickWhenCraftNotPresent = OPTIMIZE; - - @PostProcess - public void post() { -+ net.minecraft.world.item.MapItem.skipTickWhenCraftNotPresent = this.skipTickWhenCraftNotPresent; - } - - } -diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index e5989010aa752c23eda58a6df87aa6925f45671a..00ab417a8b7da0457b6f8e18e4f877373774672e 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -@@ -89,7 +89,22 @@ public class WorldConfigurations extends ConfigurationPart { - - public Block block; - public class Block extends ConfigurationPart { -- -+ -+ public OptimizeFarmCheck optimizeFarmCheck; -+ public class OptimizeFarmCheck extends ConfigurationPart { -+ -+ public boolean enabled = OPTIMIZE; -+ public boolean skipMiddleAgingStageForCrops = true; -+ -+ public GrowthSpeed growthSpeed; -+ public class GrowthSpeed extends ConfigurationPart { -+ -+ public int normal = 1; -+ public int moist = 4; -+ -+ } -+ -+ } - - } - diff --git a/patches/work/0034-Add-more-MSPT.patch b/patches/work/0034-Add-more-MSPT.patch deleted file mode 100644 index 25e17c4..0000000 --- a/patches/work/0034-Add-more-MSPT.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaKR93 -Date: Sun, 5 May 2024 00:01:03 +0900 -Subject: [PATCH] Add more MSPT - - -diff --git a/src/main/java/io/papermc/paper/command/MSPTCommand.java b/src/main/java/io/papermc/paper/command/MSPTCommand.java -index 03be23690a94a14d7343526acad67ccf53b85c70..416c0a736edf47f76a37be0bc5fe8678cf89cdb3 100644 ---- a/src/main/java/io/papermc/paper/command/MSPTCommand.java -+++ b/src/main/java/io/papermc/paper/command/MSPTCommand.java -@@ -45,8 +45,10 @@ public final class MSPTCommand extends Command { - MinecraftServer server = MinecraftServer.getServer(); - - List times = new ArrayList<>(); -+ times.addAll(eval(server.tickTimes1s.getTimes())); // Plazma - Add more MSPT - times.addAll(eval(server.tickTimes5s.getTimes())); - times.addAll(eval(server.tickTimes10s.getTimes())); -+ times.addAll(eval(server.tickTimes30s.getTimes())); // Plazma - Add more MSPT - times.addAll(eval(server.tickTimes60s.getTimes())); - - sender.sendMessage(text().content("Server tick times ").color(GOLD) -@@ -61,12 +63,18 @@ public final class MSPTCommand extends Command { - text(")") - ) - ).append( -- text(" from last 5s"), -+ // Plazma start - Add more MSPT -+ text(" from last 1s"), -+ text(",", GRAY), -+ text(" 5s"), - text(",", GRAY), - text(" 10s"), - text(",", GRAY), -+ text(" 30s"), -+ text(",", GRAY), - text(" 1m"), - text(":", YELLOW) -+ // Plazma end - Add more MSPT - ) - ); - sender.sendMessage(text().content("◴ ").color(GOLD) -@@ -74,7 +82,11 @@ public final class MSPTCommand extends Command { - .append( - times.get(0), SLASH, times.get(1), SLASH, times.get(2), text(", ", YELLOW), - times.get(3), SLASH, times.get(4), SLASH, times.get(5), text(", ", YELLOW), -- times.get(6), SLASH, times.get(7), SLASH, times.get(8) -+ // Plazma start - Add more MSPT -+ times.get(6), SLASH, times.get(7), SLASH, times.get(8), text(", ", YELLOW), -+ times.get(9), SLASH, times.get(10), SLASH, times.get(11), text(", ", YELLOW), -+ times.get(12), SLASH, times.get(13), SLASH, times.get(14), text(", ", YELLOW) -+ // Plazma end - Add more MSPT - ) - ) - ); -@@ -93,18 +105,26 @@ public final class MSPTCommand extends Command { - text(")") - ) - ).append( -- text(" from last 5s"), -+ // Plazma start - Add more MSPT -+ text(" from last 1s"), -+ text(",", GRAY), -+ text(" 5s"), - text(",", GRAY), - text(" 10s"), - text(",", GRAY), -+ text(" 30s"), -+ text(",", GRAY), - text(" 1m"), - text(":", YELLOW) -+ // Plazma end - Add more MSPT - ) - ); - for (net.minecraft.server.level.ServerLevel level: server.getAllLevels()) { - List worldTimes = new ArrayList<>(); -+ worldTimes.addAll(eval(level.tickTimes1s.getTimes())); // Plazma - Add more MSPT - worldTimes.addAll(eval(level.tickTimes5s.getTimes())); - worldTimes.addAll(eval(level.tickTimes10s.getTimes())); -+ worldTimes.addAll(eval(level.tickTimes30s.getTimes())); // Plazma - Add more MSPT - worldTimes.addAll(eval(level.tickTimes60s.getTimes())); - - sender.sendMessage(text().content("◴ " + level.getWorld().getName() + ": ").color(GOLD) -@@ -112,7 +132,11 @@ public final class MSPTCommand extends Command { - .append( - worldTimes.get(0), SLASH, worldTimes.get(1), SLASH, worldTimes.get(2), text(", ", YELLOW), - worldTimes.get(3), SLASH, worldTimes.get(4), SLASH, worldTimes.get(5), text(", ", YELLOW), -- worldTimes.get(6), SLASH, worldTimes.get(7), SLASH, worldTimes.get(8) -+ // Plazma start - Add more MSPT -+ worldTimes.get(6), SLASH, worldTimes.get(7), SLASH, worldTimes.get(8), text(", ", YELLOW), -+ worldTimes.get(9), SLASH, worldTimes.get(10), SLASH, worldTimes.get(11), text(", ", YELLOW), -+ worldTimes.get(12), SLASH, worldTimes.get(13), SLASH, worldTimes.get(14), text(", ", YELLOW) -+ // Plazma end - Add more MSPT - ) - ) - ); -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 118832d94f96d7624f9faee35b9da0aeb9d9ded8..1c3bb7cd27d97e54cbe74465bd8a7c5faeafdf4a 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -259,8 +259,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop -Date: Wed, 21 Aug 2024 16:16:22 +0900 -Subject: [PATCH] Implement-CarpetFixes - - -diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java -index 658f7943d275267d3fc556572831cc095259d12e..8ad02b079c729320f5968eee5e6284371d11250e 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java -+++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java -@@ -460,17 +460,25 @@ public class Sheep extends Animal implements Shearable { - private DyeColor getOffspringColor(Animal firstParent, Animal secondParent) { - DyeColor enumcolor = ((Sheep) firstParent).getColor(); - DyeColor enumcolor1 = ((Sheep) secondParent).getColor(); -- CraftingContainer inventorycrafting = Sheep.makeContainer(enumcolor, enumcolor1); -- Optional optional = this.level().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, inventorycrafting, this.level()).map((recipeholder) -> { // CraftBukkit - decompile error -- return ((CraftingRecipe) recipeholder.value()).assemble(inventorycrafting, this.level().registryAccess()); -- }).map(ItemStack::getItem); -- -- Objects.requireNonNull(DyeItem.class); -- optional = optional.filter(DyeItem.class::isInstance); -- Objects.requireNonNull(DyeItem.class); -- return (DyeColor) optional.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> { -- return this.level().random.nextBoolean() ? enumcolor : enumcolor1; -- }); -+ // Plazma start - Implement CarpetFixes -+ if (this.level().plazmaConfig().carpetFixes.preparedSheepChildColor()) { -+ DyeColor col = org.plazmamc.plazma.util.CarpetFixesUtils.properDyeMixin(enumcolor, enumcolor1); -+ if (col == null) col = this.level().random.nextBoolean() ? enumcolor : enumcolor1; -+ return col; -+ } else { -+ CraftingContainer inventorycrafting = Sheep.makeContainer(enumcolor, enumcolor1); -+ Optional optional = this.level().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, inventorycrafting, this.level()).map((recipeholder) -> { // CraftBukkit - decompile error -+ return ((CraftingRecipe) recipeholder.value()).assemble(inventorycrafting, this.level().registryAccess()); -+ }).map(ItemStack::getItem); -+ -+ Objects.requireNonNull(DyeItem.class); -+ optional = optional.filter(DyeItem.class::isInstance); -+ Objects.requireNonNull(DyeItem.class); -+ return (DyeColor) optional.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> { -+ return this.level().random.nextBoolean() ? enumcolor : enumcolor1; -+ }); -+ } -+ // Plazma end - } - - private static CraftingContainer makeContainer(DyeColor firstColor, DyeColor secondColor) { -diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -index 681e3fcd759a26578e054f88e8048e392312b84b..253819783d577c4c2abe737e0c76ac88121387db 100644 ---- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -@@ -137,7 +137,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { - } - - public > List> getAllRecipesFor(RecipeType type) { -- return List.copyOf(this.byType(type).values()); -+ return org.plazmamc.plazma.configurations.GlobalConfiguration.get().carpetFixes.fasterRecipeList() ? new java.util.ArrayList<>(this.byType(type).values()) : List.copyOf(this.byType(type).values()); // Plazma - Implement CarpetFixes - } - - public > List> getRecipesFor(RecipeType type, C inventory, Level world) { -diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java -index 01352cc83b25eb0e30b7e0ff521fc7c1b3d5155b..e6544cf89bc5e85d9b7fb9b278ffc765c5268f37 100644 ---- a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java -+++ b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java -@@ -12,6 +12,7 @@ public class BiomeManager { - private static final int ZOOM_BITS = 2; - private static final int ZOOM = 4; - private static final int ZOOM_MASK = 3; -+ private static final double maxOffset = 0.4500000001D; // Plazma - Implement CarpetFixes - private final BiomeManager.NoiseBiomeSource noiseBiomeSource; - private final long biomeZoomSeed; - -@@ -29,39 +30,104 @@ public class BiomeManager { - } - - public Holder getBiome(BlockPos pos) { -- int i = pos.getX() - 2; -- int j = pos.getY() - 2; -- int k = pos.getZ() - 2; -- int l = i >> 2; -- int m = j >> 2; -- int n = k >> 2; -- double d = (double)(i & 3) / 4.0; -- double e = (double)(j & 3) / 4.0; -- double f = (double)(k & 3) / 4.0; -- int o = 0; -- double g = Double.POSITIVE_INFINITY; -- -- for (int p = 0; p < 8; p++) { -- boolean bl = (p & 4) == 0; -- boolean bl2 = (p & 2) == 0; -- boolean bl3 = (p & 1) == 0; -- int q = bl ? l : l + 1; -- int r = bl2 ? m : m + 1; -- int s = bl3 ? n : n + 1; -- double h = bl ? d : d - 1.0; -- double t = bl2 ? e : e - 1.0; -- double u = bl3 ? f : f - 1.0; -- double v = getFiddledDistance(this.biomeZoomSeed, q, r, s, h, t, u); -- if (g > v) { -- o = p; -- g = v; -+ // Plazma start - Implement CarpetFixes -+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().carpetFixes.optimizedBiomeAccess()) { -+ int xMinus2 = pos.getX() - 2; -+ int yMinus2 = pos.getY() - 2; -+ int zMinus2 = pos.getZ() - 2; -+ int x = xMinus2 >> 2; // BlockPos to BiomePos -+ int y = yMinus2 >> 2; -+ int z = zMinus2 >> 2; -+ double quartX = (double) (xMinus2 & 3) / 4.0D; // quartLocal divided by 4 -+ double quartY = (double) (yMinus2 & 3) / 4.0D; // 0/4, 1/4, 2/4, 3/4 -+ double quartZ = (double) (zMinus2 & 3) / 4.0D; // [0, 0.25, 0.5, 0.75] -+ int smallestX = 0; -+ double smallestDist = Double.POSITIVE_INFINITY; -+ for (int biomeX = 0; biomeX < 8; ++biomeX) { -+ boolean everyOtherQuad = (biomeX & 4) == 0; // 1 1 1 1 0 0 0 0 -+ boolean everyOtherPair = (biomeX & 2) == 0; // 1 1 0 0 1 1 0 0 -+ boolean everyOther = (biomeX & 1) == 0; // 1 0 1 0 1 0 1 0 -+ double quartXX = everyOtherQuad ? quartX : quartX - 1.0D; //[-1.0,-0.75,-0.5,-0.25,0.0,0.25,0.5,0.75] -+ double quartYY = everyOtherPair ? quartY : quartY - 1.0D; -+ double quartZZ = everyOther ? quartZ : quartZ - 1.0D; -+ -+ //This code block is new -+ double maxQuartYY = 0.0D, maxQuartZZ = 0.0D; -+ if (biomeX != 0) { -+ maxQuartYY = Mth.square(Math.max(quartYY + maxOffset, Math.abs(quartYY - maxOffset))); -+ maxQuartZZ = Mth.square(Math.max(quartZZ + maxOffset, Math.abs(quartZZ - maxOffset))); -+ double maxQuartXX = Mth.square(Math.max(quartXX + maxOffset, Math.abs(quartXX - maxOffset))); -+ if (smallestDist < maxQuartXX + maxQuartYY + maxQuartZZ) continue; -+ } -+ -+ int xx = everyOtherQuad ? x : x + 1; -+ int yy = everyOtherPair ? y : y + 1; -+ int zz = everyOther ? z : z + 1; -+ -+ //I transferred the code from method_38106 to here, so I could call continue halfway through -+ long seed = LinearCongruentialGenerator.next(this.biomeZoomSeed, xx); -+ seed = LinearCongruentialGenerator.next(seed, yy); -+ seed = LinearCongruentialGenerator.next(seed, zz); -+ seed = LinearCongruentialGenerator.next(seed, xx); -+ seed = LinearCongruentialGenerator.next(seed, yy); -+ seed = LinearCongruentialGenerator.next(seed, zz); -+ double offsetX = getFiddle(seed); -+ double sqrX = Mth.square(quartXX + offsetX); -+ if (biomeX != 0 && smallestDist < sqrX + maxQuartYY + maxQuartZZ) continue; //skip the rest of the loop -+ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed); -+ double offsetY = getFiddle(seed); -+ double sqrY = Mth.square(quartYY + offsetY); -+ if (biomeX != 0 && smallestDist < sqrX + sqrY + maxQuartZZ) continue; // skip the rest of the loop -+ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed); -+ double offsetZ = getFiddle(seed); -+ double biomeDist = sqrX + sqrY + Mth.square(quartZZ + offsetZ); -+ -+ if (smallestDist > biomeDist) { -+ smallestX = biomeX; -+ smallestDist = biomeDist; -+ } -+ } -+ return this.noiseBiomeSource.getNoiseBiome( -+ (smallestX & 4) == 0 ? x : x + 1, -+ (smallestX & 2) == 0 ? y : y + 1, -+ (smallestX & 1) == 0 ? z : z + 1 -+ ); -+ } else { -+ int i = pos.getX() - 2; -+ int j = pos.getY() - 2; -+ int k = pos.getZ() - 2; -+ int l = i >> 2; -+ int m = j >> 2; -+ int n = k >> 2; -+ double d = (double) (i & 3) / 4.0; -+ double e = (double) (j & 3) / 4.0; -+ double f = (double) (k & 3) / 4.0; -+ int o = 0; -+ double g = Double.POSITIVE_INFINITY; -+ -+ for (int p = 0; p < 8; p++) { -+ boolean bl = (p & 4) == 0; -+ boolean bl2 = (p & 2) == 0; -+ boolean bl3 = (p & 1) == 0; -+ int q = bl ? l : l + 1; -+ int r = bl2 ? m : m + 1; -+ int s = bl3 ? n : n + 1; -+ double h = bl ? d : d - 1.0; -+ double t = bl2 ? e : e - 1.0; -+ double u = bl3 ? f : f - 1.0; -+ double v = getFiddledDistance(this.biomeZoomSeed, q, r, s, h, t, u); -+ if (g > v) { -+ o = p; -+ g = v; -+ } - } -- } - -- int w = (o & 4) == 0 ? l : l + 1; -- int x = (o & 2) == 0 ? m : m + 1; -- int y = (o & 1) == 0 ? n : n + 1; -- return this.noiseBiomeSource.getNoiseBiome(w, x, y); -+ int w = (o & 4) == 0 ? l : l + 1; -+ int x = (o & 2) == 0 ? m : m + 1; -+ int y = (o & 1) == 0 ? n : n + 1; -+ return this.noiseBiomeSource.getNoiseBiome(w, x, y); -+ } -+ // Plazma end - } - - public Holder getNoiseBiomeAtPosition(double x, double y, double z) { -diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index 98f26e3de66a881163e84295e9156c7f362bf7cb..9af184b55fd32d16194b669c42bfbf9b18e96e26 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -@@ -109,4 +109,21 @@ public class GlobalConfiguration extends ConfigurationPart { - - } - -+ public CarpetFixes carpetFixes; -+ public class CarpetFixes extends ConfigurationPart { -+ -+ public boolean enabled = OPTIMIZE; -+ boolean optimizedBiomeAccess = true; -+ boolean fasterRecipeList = true; -+ -+ public boolean optimizedBiomeAccess() { -+ return enabled && optimizedBiomeAccess; -+ } -+ -+ public boolean fasterRecipeList() { -+ return enabled && fasterRecipeList; -+ } -+ -+ } -+ - } -diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index 6a0cfec24618227d9a5ddc6c71e37d1986147799..9d6d4400be8bf189308cbd0cb14afa1ff0191a57 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -@@ -90,4 +90,16 @@ public class WorldConfigurations extends ConfigurationPart { - - } - -+ public CarpetFixes carpetFixes; -+ public class CarpetFixes extends ConfigurationPart { -+ -+ public boolean enabled = OPTIMIZE; -+ boolean preparedSheepChildColor = true; -+ -+ public boolean preparedSheepChildColor() { -+ return enabled && preparedSheepChildColor; -+ } -+ -+ } -+ - } -diff --git a/src/main/java/org/plazmamc/plazma/util/CarpetFixesUtils.java b/src/main/java/org/plazmamc/plazma/util/CarpetFixesUtils.java -new file mode 100644 -index 0000000000000000000000000000000000000000..5d6deb61ef10039a551849e9b83798916f1dc58c ---- /dev/null -+++ b/src/main/java/org/plazmamc/plazma/util/CarpetFixesUtils.java -@@ -0,0 +1,48 @@ -+package org.plazmamc.plazma.util; -+ -+import net.minecraft.world.item.DyeColor; -+ -+public class CarpetFixesUtils { -+ -+ //If I was actually implementing this, the color values would have been binary in order for fast calculations. -+ //Never do this in a production build, although this is better than using the RecipeManager xD -+ public static DyeColor properDyeMixin(DyeColor col1, DyeColor col2) { -+ if (col1.equals(col2)) return col1; -+ switch(col1) { -+ case WHITE -> { -+ switch(col2) { -+ case BLUE -> {return DyeColor.LIGHT_BLUE;} -+ case GRAY -> {return DyeColor.LIGHT_GRAY;} -+ case BLACK -> {return DyeColor.GRAY;} -+ case GREEN -> {return DyeColor.LIME;} -+ case RED -> {return DyeColor.PINK;} -+ } -+ } -+ case BLUE -> { -+ switch(col2) { -+ case WHITE -> {return DyeColor.LIGHT_BLUE;} -+ case GREEN -> {return DyeColor.CYAN;} -+ case RED -> {return DyeColor.PURPLE;} -+ } -+ } -+ case RED -> { -+ switch(col2) { -+ case YELLOW -> {return DyeColor.ORANGE;} -+ case WHITE -> {return DyeColor.PINK;} -+ case BLUE -> {return DyeColor.PURPLE;} -+ } -+ }case GREEN -> { -+ switch(col2) { -+ case BLUE -> {return DyeColor.CYAN;} -+ case WHITE -> {return DyeColor.LIME;} -+ } -+ } -+ case YELLOW -> {if (col2.equals(DyeColor.RED)) return DyeColor.ORANGE;} -+ case PURPLE -> {if (col2.equals(DyeColor.PINK)) return DyeColor.MAGENTA;} -+ case PINK -> {if (col2.equals(DyeColor.PURPLE)) return DyeColor.MAGENTA;} -+ case GRAY -> {if (col2.equals(DyeColor.WHITE)) return DyeColor.LIGHT_GRAY;} -+ case BLACK -> {if (col2.equals(DyeColor.WHITE)) return DyeColor.GRAY;} -+ } -+ return null; -+ } -+} -\ No newline at end of file diff --git a/patches/work/0041-Blazingly-simple-farm-checks.patch b/patches/work/0041-Blazingly-simple-farm-checks.patch deleted file mode 100644 index a7046fc..0000000 --- a/patches/work/0041-Blazingly-simple-farm-checks.patch +++ /dev/null @@ -1,282 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?IPECTER=20=EC=9D=B4=ED=8C=A9=ED=84=B0?= - <80433772+IPECTER@users.noreply.github.com> -Date: Sun, 25 Aug 2024 05:21:35 +0900 -Subject: [PATCH] Blazingly-simple-farm-checks - - -diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java -index 2077cb5dcf2352c9d5b502744aeb9a66df256939..e5db5467863e7e408e3ca23dbaed3879d9b31110 100644 ---- a/src/main/java/net/minecraft/world/level/block/CropBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java -@@ -81,28 +81,81 @@ public class CropBlock extends BushBlock implements BonemealableBlock { - int i = this.getAge(state); - - if (i < this.getMaxAge()) { -- float f = CropBlock.getGrowthSpeed(this, world, pos); -- -- // Spigot start -- int modifier; -- if (this == Blocks.BEETROOTS) { -- modifier = world.spigotConfig.beetrootModifier; -- } else if (this == Blocks.CARROTS) { -- modifier = world.spigotConfig.carrotModifier; -- } else if (this == Blocks.POTATOES) { -- modifier = world.spigotConfig.potatoModifier; -- // Paper start - Fix Spigot growth modifiers -- } else if (this == Blocks.TORCHFLOWER_CROP) { -- modifier = world.spigotConfig.torchFlowerModifier; -- // Paper end - Fix Spigot growth modifiers -+ // Plazma start - Blazingly simple farm checks -+ if (world.plazmaConfig().blazinglySimpleFarmChecks.enabled) { -+ // These checks are similar to getGrowthSpeed, but we have "inlined" them because we want to access stuff like the farm block data later on -+ // Is the block below us moisturised? -+ BlockPos farmlandBelowTheCurrentBlock = pos.below(); -+ BlockState farmlandBelowTheCurrentBlockData = world.getBlockState(farmlandBelowTheCurrentBlock); -+ double f = world.plazmaConfig().blazinglySimpleFarmChecks.defaultGrowthSpeed; -+ boolean isCurrentFarmlandStateMoist = false; -+ if (farmlandBelowTheCurrentBlockData.is(Blocks.FARMLAND)) { -+ if ((Integer) farmlandBelowTheCurrentBlockData.getValue(FarmBlock.MOISTURE) > 0) { -+ // If we are currently moist, increase the speed! -+ f = world.plazmaConfig().blazinglySimpleFarmChecks.moistGrowthSpeed; -+ isCurrentFarmlandStateMoist = true; -+ } -+ } -+ // If we are skipping the middle aging stages, we need to change the growth speed and the next stage accordingly -+ if (world.plazmaConfig().blazinglySimpleFarmChecks.skipMiddleAgingStagesForCrops) { -+ f = f / getMaxAge(); -+ i = getMaxAge() - 1; -+ } -+ -+ // Spigot start -+ int modifier; -+ if (this == Blocks.BEETROOTS) { -+ modifier = world.spigotConfig.beetrootModifier; -+ } else if (this == Blocks.CARROTS) { -+ modifier = world.spigotConfig.carrotModifier; -+ } else if (this == Blocks.POTATOES) { -+ modifier = world.spigotConfig.potatoModifier; -+ // Paper start -+ } else if (this == Blocks.TORCHFLOWER_CROP) { -+ modifier = world.spigotConfig.torchFlowerModifier; -+ // Paper end -+ } else { -+ modifier = world.spigotConfig.wheatModifier; -+ } -+ -+ if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution -+ // Spigot end -+ if (!CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2)) { -+ return; -+ } -+ -+ // Now that we know that the crop will grow... is the next stage the crop's max age? If yes, we are going to check if the farm land is moist! -+ if (i + 1 == getMaxAge() && isCurrentFarmlandStateMoist && !FarmBlock.isNearWater(world, farmlandBelowTheCurrentBlock)) { -+ // Whoops, farm land ain't moist! -+ // From FarmBlock, set the moisture to 0 -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, farmlandBelowTheCurrentBlock, (BlockState) farmlandBelowTheCurrentBlockData.setValue(FarmBlock.MOISTURE, 0), 2); // CraftBukkit -+ } -+ } - } else { -- modifier = world.spigotConfig.wheatModifier; -- } -+ float f = CropBlock.getGrowthSpeed(this, world, pos); -+ -+ // Spigot start -+ int modifier; -+ if (this == Blocks.BEETROOTS) { -+ modifier = world.spigotConfig.beetrootModifier; -+ } else if (this == Blocks.CARROTS) { -+ modifier = world.spigotConfig.carrotModifier; -+ } else if (this == Blocks.POTATOES) { -+ modifier = world.spigotConfig.potatoModifier; -+ // Paper start - Fix Spigot growth modifiers -+ } else if (this == Blocks.TORCHFLOWER_CROP) { -+ modifier = world.spigotConfig.torchFlowerModifier; -+ // Paper end - Fix Spigot growth modifiers -+ } else { -+ modifier = world.spigotConfig.wheatModifier; -+ } - -- if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution -- // Spigot end -- CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2); // CraftBukkit -+ if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution -+ // Spigot end -+ CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2); // CraftBukkit -+ } - } -+ // Plazma end - } - } - -diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java -index 0c39126ce51439cce05747161aba43bce33a12d8..2016e3d7832ba75331697c46803f8e4142bf01ee 100644 ---- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java -@@ -92,6 +92,19 @@ public class FarmBlock extends Block { - @Override - public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { - int i = (Integer) state.getValue(FarmBlock.MOISTURE); -+ // Plazma start - Blazingly simple farm checks -+ if (world.plazmaConfig().blazinglySimpleFarmChecks.enabled) { -+ if (i == 0) { // We only care about non-moisturised farm blocks -+ if (FarmBlock.isNearWater(world, pos)) { -+ // Make it MOIST! -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, pos, (BlockState) state.setValue(FarmBlock.MOISTURE, 7), 2); // CraftBukkit -+ } else if (!FarmBlock.shouldMaintainFarmland(world, pos)) { -+ FarmBlock.turnToDirt((Entity) null, state, world, pos); -+ } -+ } -+ return; -+ } -+ // Plazma end - if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks - if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks - -@@ -166,7 +179,7 @@ public class FarmBlock extends Block { - return world.getBlockState(pos.above()).is(BlockTags.MAINTAINS_FARMLAND); - } - -- private static boolean isNearWater(LevelReader world, BlockPos pos) { -+ public static boolean isNearWater(LevelReader world, BlockPos pos) { // Plazma - Blazingly simple farm checks - private -> public - // Paper start - Perf: remove abstract block iteration - int xOff = pos.getX(); - int yOff = pos.getY(); -diff --git a/src/main/java/net/minecraft/world/level/block/StemBlock.java b/src/main/java/net/minecraft/world/level/block/StemBlock.java -index 121a872cd750a87b779895687ae1abf5bb77b088..53e55b51c53995e2ec9314e1fc656dd5cd22dd67 100644 ---- a/src/main/java/net/minecraft/world/level/block/StemBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/StemBlock.java -@@ -73,36 +73,87 @@ public class StemBlock extends BushBlock implements BonemealableBlock { - @Override - public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { - if (world.getRawBrightness(pos, 0) >= 9) { -- float f = CropBlock.getGrowthSpeed(this, world, pos); -- -- if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution -- int i = (Integer) state.getValue(StemBlock.AGE); -- -- if (i < 7) { -- state = (BlockState) state.setValue(StemBlock.AGE, i + 1); -- CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit -- } else { -- Direction enumdirection = Direction.Plane.HORIZONTAL.getRandomDirection(random); -- BlockPos blockposition1 = pos.relative(enumdirection); -- BlockState iblockdata1 = world.getBlockState(blockposition1.below()); -- -- if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) { -- Registry iregistry = world.registryAccess().registryOrThrow(Registries.BLOCK); -- Optional optional = iregistry.getOptional(this.fruit); -- Optional optional1 = iregistry.getOptional(this.attachedStem); -- -- if (optional.isPresent() && optional1.isPresent()) { -- // CraftBukkit start -- if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) { -- return; -+ // Plazma start - Blazingly simple farm checks -+ if (world.plazmaConfig().blazinglySimpleFarmChecks.enabled) { -+ // These checks are similar to getGrowthSpeed, but we have "inlined" them because we want to access stuff like the farm block data later on -+ // Is the block below us moisturised? -+ BlockPos farmlandBelowTheCurrentBlock = pos.below(); -+ BlockState farmlandBelowTheCurrentBlockData = world.getBlockState(farmlandBelowTheCurrentBlock); -+ double f = world.plazmaConfig().blazinglySimpleFarmChecks.defaultGrowthSpeed; -+ boolean isCurrentFarmlandStateMoist = false; -+ if (farmlandBelowTheCurrentBlockData.is(Blocks.FARMLAND)) { -+ if ((Integer) farmlandBelowTheCurrentBlockData.getValue(FarmBlock.MOISTURE) > 0) { -+ // If we are currently moist, increase the speed! -+ f = world.plazmaConfig().blazinglySimpleFarmChecks.moistGrowthSpeed; -+ isCurrentFarmlandStateMoist = true; -+ } -+ } -+ -+ if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution -+ int i = (Integer) state.getValue(StemBlock.AGE); -+ -+ if (i < 7) { -+ state = (BlockState) state.setValue(StemBlock.AGE, i + 1); -+ CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit -+ } else { -+ Direction enumdirection = Direction.Plane.HORIZONTAL.getRandomDirection(random); -+ BlockPos blockposition1 = pos.relative(enumdirection); -+ BlockState iblockdata1 = world.getBlockState(blockposition1.below()); -+ -+ if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) { -+ Registry iregistry = world.registryAccess().registryOrThrow(Registries.BLOCK); -+ Optional optional = iregistry.getOptional(this.fruit); -+ Optional optional1 = iregistry.getOptional(this.attachedStem); -+ -+ if (optional.isPresent() && optional1.isPresent()) { -+ // CraftBukkit start -+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) { -+ return; -+ } -+ // CraftBukkit end -+ // Now that we know that the crop will grow... is the next stage the crop's max age? If yes, we are going to check if the farm land is moist! -+ if (isCurrentFarmlandStateMoist && !FarmBlock.isNearWater(world, farmlandBelowTheCurrentBlock)) { -+ // Whoops, farm land ain't moist! -+ // From FarmBlock, set the moisture to 0 -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, farmlandBelowTheCurrentBlock, (BlockState) farmlandBelowTheCurrentBlockData.setValue(FarmBlock.MOISTURE, 0), 2); // CraftBukkit -+ } -+ world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection)); -+ } -+ } -+ } -+ } -+ } else { -+ float f = CropBlock.getGrowthSpeed(this, world, pos); -+ -+ if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution -+ int i = (Integer) state.getValue(StemBlock.AGE); -+ -+ if (i < 7) { -+ state = (BlockState) state.setValue(StemBlock.AGE, i + 1); -+ CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit -+ } else { -+ Direction enumdirection = Direction.Plane.HORIZONTAL.getRandomDirection(random); -+ BlockPos blockposition1 = pos.relative(enumdirection); -+ BlockState iblockdata1 = world.getBlockState(blockposition1.below()); -+ -+ if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) { -+ Registry iregistry = world.registryAccess().registryOrThrow(Registries.BLOCK); -+ Optional optional = iregistry.getOptional(this.fruit); -+ Optional optional1 = iregistry.getOptional(this.attachedStem); -+ -+ if (optional.isPresent() && optional1.isPresent()) { -+ // CraftBukkit start -+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) { -+ return; -+ } -+ // CraftBukkit end -+ world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection)); - } -- // CraftBukkit end -- world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection)); - } - } - } - } -- -+ // Plazma end - } - } - -diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -index 9d6d4400be8bf189308cbd0cb14afa1ff0191a57..f96305be3b6e7c33d553764bdf4d8f2635939f9d 100644 ---- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java -@@ -102,4 +102,15 @@ public class WorldConfigurations extends ConfigurationPart { - - } - -+ public BlazinglySimpleFarmChecks blazinglySimpleFarmChecks; -+ public class BlazinglySimpleFarmChecks extends ConfigurationPart { -+ -+ public boolean enabled = OPTIMIZE;ㅈ -+ public double defaultGrowthSpeed = 1.0; -+ public double moistGrowthSpeed = 5.0; -+ public boolean skipMiddleAgingStagesForCrops = false; -+ -+ -+ } -+ - } diff --git a/upstream b/upstream deleted file mode 120000 index a5542ab..0000000 --- a/upstream +++ /dev/null @@ -1 +0,0 @@ -.gradle/caches/paperweight/upstreams/paper \ No newline at end of file