Compare commits
42 Commits
dev/1.21.1
...
1.21.4-16d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16df7dce12 | ||
|
|
8a01b9ad39 | ||
|
|
27a2e2a129 | ||
|
|
3b9b3813b4 | ||
|
|
9b4a6d60ac | ||
|
|
6055cc7367 | ||
|
|
9edeb2a539 | ||
|
|
207f96891a | ||
|
|
9baaa0a236 | ||
|
|
99c167504b | ||
|
|
2b5bedf14b | ||
|
|
38e4a96ab7 | ||
|
|
c7134597cb | ||
|
|
b1c6c29458 | ||
|
|
eeae6bc62c | ||
|
|
852529973b | ||
|
|
43af4d5432 | ||
|
|
b428505e23 | ||
|
|
e4b448c6df | ||
|
|
db4f0f7e1b | ||
|
|
bb144df37b | ||
|
|
21d1ee350a | ||
|
|
4a76009af8 | ||
|
|
1445e4683d | ||
|
|
fa959bf213 | ||
|
|
4a40f56920 | ||
|
|
9360a5adbd | ||
|
|
ea34494c03 | ||
|
|
1526790e77 | ||
|
|
af556ab869 | ||
|
|
4e8d54e073 | ||
|
|
f8559b9ca6 | ||
|
|
bc5a83c69c | ||
|
|
6a8df3771b | ||
|
|
ff4fdcc7d1 | ||
|
|
94ae8e3ce0 | ||
|
|
f1dfac26d8 | ||
|
|
5d9dfc3e17 | ||
|
|
ca44ba98a5 | ||
|
|
27298b865c | ||
|
|
bcea80b4d1 | ||
|
|
d20e0b1940 |
@@ -1,72 +1,69 @@
|
||||
name: Luminol CI - dev/1.21.1
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "dev/1.21.1" ]
|
||||
pull_request:
|
||||
branches: [ "de/1.21.1" ]
|
||||
|
||||
permissions: write-all
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
environment: default
|
||||
steps:
|
||||
- name: Checkout Git Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/actions/wrapper-validation@v3
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
with:
|
||||
gradle-version: 8.7
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: '21'
|
||||
- name: Configure Git User Details
|
||||
run: git config --global user.email "ci@luminolmc.com" && git config --global user.name "LuminolMC CI"
|
||||
- name: Apply Patches
|
||||
run: gradle applyPatches
|
||||
- name: CreateJar
|
||||
run: gradle createMojmapBundlerJar createMojmapPaperclipJar
|
||||
- name: Publish to repo
|
||||
run: |
|
||||
export MAVEN_REPO_USER=${{ secrets.MAVEN_REPO_USER }}
|
||||
export MAVEN_REPO_PASSWORD=${{ secrets.MAVEN_REPO_PASSWORD }}
|
||||
./gradlew publish -PpublishDevBundle=true
|
||||
- name: SetENV
|
||||
run: sh scripts/SetENV.sh
|
||||
- name: Upload Artifact
|
||||
uses: "actions/upload-artifact@v4"
|
||||
with:
|
||||
name: "${{ env.project_id_b }} CI Artifacts"
|
||||
path: "build/libs/*.jar"
|
||||
- name: Create Release
|
||||
if: "!contains(github.event.commits[0].message, '[release skip]')"
|
||||
uses: ncipollo/release-action@v1.14.0
|
||||
with:
|
||||
tag: ${{ env.tag }}
|
||||
name: ${{ env.project_id_b }} ${{ env.mcversion }} - ${{ env.commit_id }}
|
||||
body: |
|
||||
📦Version: `${{ env.mcversion }}` | Commit ${{ env.commit_id }} [](https://github.com/LuminolMC/${{ env.project_id }}/download/${{ env.tag }}/${{ env.jar }})
|
||||
This release is automatically compiled by GitHub Actions
|
||||
### Commit Message
|
||||
${{ env.commit_msg }}
|
||||
artifacts: |
|
||||
${{ env.jar_dir }}
|
||||
${{ env.jar_dir_bundler }}
|
||||
generateReleaseNotes: true
|
||||
prerelease: ${{ env.pre }}
|
||||
makeLatest: ${{ env.make_latest }}
|
||||
token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
- name: Push to API
|
||||
if: "!contains(github.event.commits[0].message, '[release skip]')"
|
||||
continue-on-error: true
|
||||
env:
|
||||
secret_v2: ${{ secrets.API_KEY }}
|
||||
tag: ${{ env.tag }}
|
||||
project_id: ${{ env.project_id }}
|
||||
run: sh scripts/PushToAPI.sh
|
||||
name: Luminol CI - dev/1.21.4
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "dev/1.21.4" ]
|
||||
pull_request:
|
||||
branches: [ "de/1.21.4" ]
|
||||
|
||||
permissions: write-all
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
environment: default
|
||||
steps:
|
||||
- name: Checkout Git Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: '22'
|
||||
- name: Configure Git User Details
|
||||
run: git config --global user.email "ci@luminolmc.com" && git config --global user.name "LuminolMC CI"
|
||||
- name: Apply Patches
|
||||
run: gradle applyPatches
|
||||
- name: CreateJar
|
||||
run: gradle createMojmapBundlerJar createMojmapPaperclipJar
|
||||
- name: Publish to repo
|
||||
continue-on-error: true
|
||||
run: |
|
||||
export MAVEN_REPO_USER=${{ secrets.MAVEN_REPO_USER }}
|
||||
export MAVEN_REPO_PASSWORD=${{ secrets.MAVEN_REPO_PASSWORD }}
|
||||
./gradlew publish -PpublishDevBundle=true
|
||||
- name: SetENV
|
||||
run: sh scripts/SetENV.sh
|
||||
- name: Upload Artifact
|
||||
uses: "actions/upload-artifact@v4"
|
||||
with:
|
||||
name: "${{ env.project_id_b }} CI Artifacts"
|
||||
path: "build/libs/*.jar"
|
||||
- name: Create Release
|
||||
if: "!contains(github.event.commits[0].message, '[release skip]')"
|
||||
uses: ncipollo/release-action@v1.14.0
|
||||
with:
|
||||
tag: ${{ env.tag }}
|
||||
name: ${{ env.project_id_b }} ${{ env.mcversion }} - ${{ env.commit_id }}
|
||||
body: |
|
||||
📦Version: `${{ env.mcversion }}` | Commit ${{ env.commit_id }} [](https://github.com/LuminolMC/${{ env.project_id }}/download/${{ env.tag }}/${{ env.jar }})
|
||||
This release is automatically compiled by GitHub Actions
|
||||
### Commit Message
|
||||
${{ env.commit_msg }}
|
||||
artifacts: |
|
||||
${{ env.jar_dir }}
|
||||
${{ env.jar_dir_bundler }}
|
||||
generateReleaseNotes: true
|
||||
prerelease: ${{ env.pre }}
|
||||
makeLatest: ${{ env.make_latest }}
|
||||
token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
- name: Push to API
|
||||
if: "!contains(github.event.commits[0].message, '[release skip]')"
|
||||
continue-on-error: true
|
||||
env:
|
||||
secret_v2: ${{ secrets.API_KEY }}
|
||||
tag: ${{ env.tag }}
|
||||
project_id: ${{ env.project_id }}
|
||||
run: sh scripts/PushToAPI.sh
|
||||
10
README.md
10
README.md
@@ -33,12 +33,12 @@
|
||||
```kotlin
|
||||
repositories {
|
||||
maven {
|
||||
url = "https://maven.nostal.ink/repository/maven-snapshots/"
|
||||
url = "https://maven.moliatopia.icu/repository/maven-snapshots/"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("me.earthme.luminol:luminol-api:1.21.1-R0.1-20241001.135225-1")
|
||||
compileOnly("me.earthme.luminol:luminol-api:1.21.3-R0.1-20241201.004037-1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -47,8 +47,8 @@ dependencies {
|
||||
```xml
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>nostal</id>
|
||||
<url>https://maven.nostal.ink/repository/maven-snapshots/</url>
|
||||
<id>moliatopia</id>
|
||||
<url>https://maven.moliatopia.icu/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
@@ -56,7 +56,7 @@ dependencies {
|
||||
<dependency>
|
||||
<groupId>me.earthme.luminol</groupId>
|
||||
<artifactId>luminol-api</artifactId>
|
||||
<version>1.21.1-R0.1-20241001.135225-1</version>
|
||||
<version>1.21.3-R0.1-20241201.004037-1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
18
README_EN.md
18
README_EN.md
@@ -34,12 +34,12 @@ For gradle:
|
||||
```kotlin
|
||||
repositories {
|
||||
maven {
|
||||
url = "https://maven.nostal.ink/repository/maven-snapshots/"
|
||||
url = "https://maven.moliatopia.icu/repository/maven-snapshots/"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("me.earthme.luminol:luminol-api:1.21.1-R0.1-20241001.135225-1")
|
||||
compileOnly("me.earthme.luminol:luminol-api:1.21.3-R0.1-20241201.004037-1")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -48,17 +48,17 @@ For maven
|
||||
```xml
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>nostal</id>
|
||||
<url>https://maven.nostal.ink/repository/maven-snapshots/</url>
|
||||
<id>moliatopia</id>
|
||||
<url>https://maven.moliatopia.icu/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>me.earthme.luminol</groupId>
|
||||
<artifactId>luminol-api</artifactId>
|
||||
<version>1.21.1-R0.1-20241001.135225-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.earthme.luminol</groupId>
|
||||
<artifactId>luminol-api</artifactId>
|
||||
<version>1.21.3-R0.1-20241201.004037-1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
plugins {
|
||||
java
|
||||
`maven-publish`
|
||||
id("io.papermc.paperweight.patcher") version "1.7.3"
|
||||
id("io.papermc.paperweight.patcher") version "1.7.7"
|
||||
}
|
||||
|
||||
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
||||
@@ -45,22 +45,14 @@ subprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven(paperMavenPublicUrl)
|
||||
maven("https://oss.sonatype.org/content/groups/public/")
|
||||
maven("https://ci.emc.gs/nexus/content/groups/aikar/")
|
||||
maven("https://repo.aikar.co/content/groups/aikar")
|
||||
maven("https://repo.md-5.net/content/repositories/releases/")
|
||||
maven("https://hub.spigotmc.org/nexus/content/groups/public/")
|
||||
maven("https://jitpack.io")
|
||||
maven("https://repo.codemc.io/repository/maven-public/")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
paperweight {
|
||||
serverProject.set(project(":luminol-server"))
|
||||
|
||||
remapRepo.set("https://maven.fabricmc.net/")
|
||||
decompileRepo.set("https://maven.quiltmc.org/")
|
||||
remapRepo.set(paperMavenPublicUrl)
|
||||
decompileRepo.set(paperMavenPublicUrl)
|
||||
|
||||
useStandardUpstream("folia") {
|
||||
url.set(github("PaperMC", "Folia"))
|
||||
@@ -101,7 +93,7 @@ allprojects {
|
||||
repositories {
|
||||
maven {
|
||||
name = "moliaMavenRepo"
|
||||
url = uri("https://maven.nostal.ink/repository/maven-snapshots/")
|
||||
url = uri("https://maven.moliatopia.icu/repository/maven-snapshots/")
|
||||
|
||||
credentials.username = System.getenv("MAVEN_REPO_USER")
|
||||
credentials.password = System.getenv("MAVEN_REPO_PASSWORD")
|
||||
@@ -119,4 +111,3 @@ publishing {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
group = me.earthme.luminol
|
||||
version = 1.21.1-R0.1-SNAPSHOT
|
||||
version = 1.21.4-R0.1-SNAPSHOT
|
||||
|
||||
foliaCommit = 2e7bc0721af95196c85500c7bb136aeea0bc12ce
|
||||
foliaCommit = 8af1aef1f14630ede6575a72632e7f943d8fb903
|
||||
|
||||
org.gradle.caching = true
|
||||
org.gradle.parallel = true
|
||||
org.gradle.vfs.watch = false
|
||||
org.gradle.jvmargs = -Xmx3G
|
||||
|
||||
mcVersion = 1.21.1
|
||||
mcVersion = 1.21.4
|
||||
GroupMCV = 1.21
|
||||
preVersion = true
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
7
gradlew
vendored
7
gradlew
vendored
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -84,7 +86,8 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
2
gradlew.bat
vendored
2
gradlew.bat
vendored
@@ -13,6 +13,8 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
|
||||
@@ -16,10 +16,10 @@ index bc8b5bc17706250b8535b1b309134843d2ce2bb1..1cfe84ad1094e3c4fab96487f328be53
|
||||
+ long getChunkHotAvg(); // KioCG
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 8086acceacbceb2c5a7228fff005e41a86d37008..16ab3c58adcd801d052d93cbf27279d01404cdfd 100644
|
||||
index 95f0b3186e313c7fbd5c8531d52b82a69e525f94..ce98b3de2fe935de4c280f7af9940499d6f09926 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -3871,4 +3871,6 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -3911,4 +3911,6 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
void sendEntityEffect(org.bukkit.@NotNull EntityEffect effect, @NotNull Entity target);
|
||||
// Paper end - entity effect API
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] FoliaPR Add TPS From Region
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 63eb35aebc4551355ea1ea5cd1305d93502f0dbc..de5922397c7d424715e812819b14030639211846 100644
|
||||
index 5ce98e09e9bfcae45896401c69578aa879222893..dacb9342f21ba045b97f004c6c9970adbc2b9eb5 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2405,6 +2405,28 @@ public final class Bukkit {
|
||||
@@ -2429,6 +2429,28 @@ public final class Bukkit {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -38,10 +38,10 @@ index 63eb35aebc4551355ea1ea5cd1305d93502f0dbc..de5922397c7d424715e812819b140306
|
||||
* Get the advancement specified by this key.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 8a7ba7d14f20b8169854daaf26e8f4da4563f166..11025aaab88f109f03cd6cda897fc80488cee060 100644
|
||||
index a92bd4da6788f1331a4838ab5760baec2dc6e8ec..32ec411df95dbce73700ce47fb24737f1f508bb5 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2058,6 +2058,24 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2076,6 +2076,24 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
double getAverageTickTime();
|
||||
// Paper end
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Pufferfish SIMD Utilities
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index e7c96be769fde8375b9a1b128cc7ce474144d16d..73e0b4a9af5803198e42fa74af5b05654d9a934a 100644
|
||||
index 571534b42cd9c33d6a7bb6fe3bf3a28e33f8e5de..1aa76451f9129b578d6887b1239966eb67f5ee1b 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -131,6 +131,13 @@ val generateApiVersioningFile by tasks.registering {
|
||||
@@ -150,6 +150,13 @@ val generateApiVersioningFile by tasks.registering {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ index e7c96be769fde8375b9a1b128cc7ce474144d16d..73e0b4a9af5803198e42fa74af5b0565
|
||||
tasks.jar {
|
||||
from(generateApiVersioningFile.map { it.outputs.files.singleFile }) {
|
||||
into("META-INF/maven/${project.group}/${project.name}")
|
||||
@@ -190,6 +197,7 @@ tasks.withType<Javadoc> {
|
||||
@@ -209,6 +216,7 @@ tasks.withType<Javadoc> {
|
||||
into("build/docs/javadoc")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Fri, 29 Nov 2024 23:32:23 +0800
|
||||
Date: Sat, 30 Nov 2024 12:34:50 +0800
|
||||
Subject: [PATCH] Disable timings warn msg and commands
|
||||
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
|
||||
index 7760c779e97a0e95d5c3d255b25d949ac20df235..e1b5dcf0d54d3eaa489949f12874ade0e32cdf2f 100644
|
||||
index 89017af09ce32e7a66014fc3aeb50155921252a5..b862779b48176dd7e67a2f1a3e7f24bc8c84e993 100644
|
||||
--- a/src/main/java/co/aikar/timings/Timings.java
|
||||
+++ b/src/main/java/co/aikar/timings/Timings.java
|
||||
@@ -147,7 +147,7 @@ public final class Timings {
|
||||
public static void setTimingsEnabled(boolean enabled) {
|
||||
enabled = false; // Folia - region threading - disable timings
|
||||
timingsEnabled = enabled;
|
||||
- warnAboutDeprecationOnEnable();
|
||||
+ // warnAboutDeprecationOnEnable(); // Luminol - Disable timings warn msg and commands
|
||||
reset();
|
||||
if (enabled && !warnedAboutDeprecationOnEnable) {
|
||||
- Bukkit.getLogger().severe(PlainTextComponentSerializer.plainText().serialize(deprecationMessage()));
|
||||
+ // Bukkit.getLogger().severe(PlainTextComponentSerializer.plainText().serialize(deprecationMessage())); // Luminol - Disable timings warn msg and commands
|
||||
warnedAboutDeprecationOnEnable = true;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
index 5df19bd701c67506689fc7f49d91f99ebfbc83f0..baf0cbd2f995ebe2e4382244eff6e15ec125d790 100644
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -31,12 +31,12 @@ index 5df19bd701c67506689fc7f49d91f99ebfbc83f0..baf0cbd2f995ebe2e4382244eff6e15e
|
||||
|
||||
public void setFallbackCommands() {
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index 065352b383d6398382b4f14641859dbfe2e6a355..adb9734f6977583a0cf4a8d81d0c36d463456a0f 100644
|
||||
index 9611e8e254b4fa9579dc9ffd5198182c43819c56..170fefdc50605c0c4d742a606c18d871966e6e72 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -965,7 +965,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
* @param use True if per event timing code should be used
|
||||
@@ -966,7 +966,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public void useTimings(boolean use) {
|
||||
- co.aikar.timings.Timings.setTimingsEnabled(use); // Paper
|
||||
+ // co.aikar.timings.Timings.setTimingsEnabled(use); // Paper // Luminol - Disable timings warn msg and commands
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Mon, 1 Jan 2024 07:59:27 +0000
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 4 Dec 2024 23:04:00 +0800
|
||||
Subject: [PATCH] Fix build
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index eb2f9941b24af591f1e56339b97f5284a765cf81..32bfe781e5298e5ad1bd2ed4471fb824c49f0ab4 100644
|
||||
index 8d2b5fec6fe27dca3ce01ba1ce50506179fc3b4d..dd6cc4972a209e58313a2b6c6fe87c3605fe34ae 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -13,7 +13,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||
val alsoShade: Configuration by configurations.creating
|
||||
@@ -25,7 +25,7 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider {
|
||||
// Paper end - configure mockito agent that is needed in newer java versions
|
||||
|
||||
dependencies {
|
||||
- implementation(project(":folia-api")) // Folia
|
||||
+ implementation(project(":luminol-api")) // Folia // Luminol
|
||||
implementation("ca.spottedleaf:concurrentutil:0.0.2") // Paper - Add ConcurrentUtil dependency
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Rebrand to Luminol
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 28726c59088d98923b9ecb3221ca254385d142fd..f07a002ab51a4aadfea65c3258406edc19b5078e 100644
|
||||
index dd6cc4972a209e58313a2b6c6fe87c3605fe34ae..17d2d18d7898e4f0898cc18c930b7cb26f826f2a 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -85,14 +85,14 @@ tasks.jar {
|
||||
@@ -100,14 +100,14 @@ tasks.jar {
|
||||
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
@@ -29,10 +29,10 @@ index 28726c59088d98923b9ecb3221ca254385d142fd..f07a002ab51a4aadfea65c3258406edc
|
||||
"Build-Time" to Instant.now().toString(),
|
||||
"Git-Branch" to gitBranch, // Paper
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
index cb60d58d4a7556dd896f31d0cd249f860bb3ef84..b52a805150e95d7d27403d3c18088b335a355011 100644
|
||||
index f5ff71e31516327be71924926938f1c9f0e503df..1ea251a202dc6386a110ee515d3329902f14e08e 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
@@ -593,7 +593,7 @@ public class Metrics {
|
||||
@@ -592,7 +592,7 @@ public class Metrics {
|
||||
boolean logFailedRequests = config.getBoolean("logFailedRequests", false);
|
||||
// Only start Metrics, if it's enabled in the config
|
||||
if (config.getBoolean("enabled", true)) {
|
||||
@@ -41,7 +41,7 @@ index cb60d58d4a7556dd896f31d0cd249f860bb3ef84..b52a805150e95d7d27403d3c18088b33
|
||||
|
||||
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
|
||||
String minecraftVersion = Bukkit.getVersion();
|
||||
@@ -611,7 +611,7 @@ public class Metrics {
|
||||
@@ -610,7 +610,7 @@ public class Metrics {
|
||||
} else {
|
||||
paperVersion = "unknown";
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 31 Jul 2024 11:49:53 +0800
|
||||
Date: Wed, 4 Dec 2024 23:07:13 +0800
|
||||
Subject: [PATCH] Empty config file base
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index de5a43db5f0c7c507c492db8789ad2d4a4cff3c8..f657ee64810d1c02a967b9262b95fbc65eb3fce2 100644
|
||||
index 17d2d18d7898e4f0898cc18c930b7cb26f826f2a..017dc1ff0a7c6f7c50a57bf615fc31947ed49639 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -14,6 +14,7 @@ val alsoShade: Configuration by configurations.creating
|
||||
@@ -26,6 +26,7 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider {
|
||||
|
||||
dependencies {
|
||||
implementation(project(":luminol-api")) // Folia // Luminol
|
||||
+ implementation("com.electronwill.night-config:toml:3.6.6") // Luminol - Night config
|
||||
implementation("ca.spottedleaf:concurrentutil:0.0.2") // Paper - Add ConcurrentUtil dependency
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
|
||||
diff --git a/src/main/java/me/earthme/luminol/commands/LuminolConfigCommand.java b/src/main/java/me/earthme/luminol/commands/LuminolConfigCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5c8745dffa80cf47e856d04d283937bda86881f8
|
||||
@@ -192,10 +192,10 @@ index 0000000000000000000000000000000000000000..9f6896711907ac30fe0c00130207b970
|
||||
+}
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/LuminolConfig.java b/src/main/java/me/earthme/luminol/config/LuminolConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..976cc572861174787b37992388a03ab01f8703a4
|
||||
index 0000000000000000000000000000000000000000..fcacd381e4a5875ed0c542a9e6c1804fae823435
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/LuminolConfig.java
|
||||
@@ -0,0 +1,220 @@
|
||||
@@ -0,0 +1,221 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
@@ -275,6 +275,7 @@ index 0000000000000000000000000000000000000000..976cc572861174787b37992388a03ab0
|
||||
+ loadAllModules();
|
||||
+ }catch (Exception e){
|
||||
+ logger.error("Failed to load config modules!",e);
|
||||
+ throw new RuntimeException(e);
|
||||
+ }
|
||||
+
|
||||
+ configFileInstance.save();
|
||||
@@ -576,10 +577,10 @@ index 0000000000000000000000000000000000000000..de94c8e39f0ae0da80d5a79af63413e2
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 301d7fa29fce2997a5881b3852896eff5af33672..0755e8f460f59e2dbc00cac73026bb441c04e9ea 100644
|
||||
index 78f33298e809a7f6d079d9f2c64e2caa47a1b25a..e3c8deea68ef49bcd07359e243a12afb57cbcf52 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -226,6 +226,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -223,6 +223,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
|
||||
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
|
||||
// Paper end - initialize global and world-defaults configuration
|
||||
|
||||
@@ -47,10 +47,10 @@ index 0000000000000000000000000000000000000000..94e7c8910e3623163528a844fd7a08b3
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 511992c31d70e806bba68737048ca760bef1def0..5bd02c4f65327b9b848b08e61820c262e0a71731 100644
|
||||
index 1676c4abb3f6f71bb7b25351aa58b4e127786fca..8cc0c01a19fc71753d7c3ed4fa7e9992aaf93b5a 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -2032,7 +2032,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2121,7 +2121,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Fri, 25 Oct 2024 00:05:33 +0800
|
||||
Date: Sat, 30 Nov 2024 11:26:36 +0800
|
||||
Subject: [PATCH] Add config for unsafe teleportation
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..ea374875f529b30db17e8b8cb07b99a6
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 5d6b1a63a2a213f8a4e81c5e574847007a82007b..77ff2a526a1d2b9307dfc696f9862bfda7407475 100644
|
||||
index a498cdbe42df3161c35b2a1652dfa63693366bd6..76e8eca1229430742c6c2557d481fb98c570a8bc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -69,7 +69,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -43,9 +43,9 @@ index 5d6b1a63a2a213f8a4e81c5e574847007a82007b..77ff2a526a1d2b9307dfc696f9862bfd
|
||||
protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS);
|
||||
public boolean autoExpire = true; // Paper - Expand FallingBlock API
|
||||
|
||||
@@ -419,7 +419,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -430,7 +430,7 @@ public class FallingBlockEntity extends Entity {
|
||||
boolean flag = (resourcekey1 == Level.END || resourcekey == Level.END) && resourcekey1 != resourcekey;
|
||||
Entity entity = super.changeDimension(teleportTarget);
|
||||
Entity entity = super.teleport(teleportTarget);
|
||||
|
||||
- this.forceTickAfterTeleportToDuplicate = entity != null && flag && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation; // Paper
|
||||
+ this.forceTickAfterTeleportToDuplicate = entity != null && flag && (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation || me.earthme.luminol.config.modules.fixes.UnsafeTeleportationConfig.enabled); // Paper // Luminol - Unsafe teleportation
|
||||
@@ -53,10 +53,10 @@ index 5d6b1a63a2a213f8a4e81c5e574847007a82007b..77ff2a526a1d2b9307dfc696f9862bfd
|
||||
}
|
||||
}
|
||||
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 e1c071e0b25c4678bf08313b6c60cf895a54aa02..13c3527cd4852356ce8f39c739d1c5015ef69b16 100644
|
||||
index 45b8ac1418864ea32bd625b0d57fcec288ea5b0c..96dfc7062c2b0d371717c2042bf7c8e8b32e8716 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
@@ -71,7 +71,11 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal {
|
||||
@@ -76,7 +76,11 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal {
|
||||
if (event.isCancelled()) return; // Paper - make cancellable
|
||||
// CraftBukkit end
|
||||
// Folia - region threading - do not show credits
|
||||
@@ -1,45 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 31 Jul 2024 12:01:17 +0800
|
||||
Subject: [PATCH] Add config for void trading
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/fixes/VoidTradingFixConfig.java b/src/main/java/me/earthme/luminol/config/modules/fixes/VoidTradingFixConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..22f3c6c70e4287f1bdd0b18f87f57efeb20140a2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/fixes/VoidTradingFixConfig.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package me.earthme.luminol.config.modules.fixes;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class VoidTradingFixConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ public static boolean enabled = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.FIXES;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "allow_void_trading";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 90d78ddf8518c0df307cdaa8b7cfb5549491c6e5..94d855f14c91ca164f1728be1df4e83dfed8b005 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2816,7 +2816,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
// 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
|
||||
- if (entity.getBukkitEntity() instanceof org.bukkit.inventory.Merchant merchant && merchant.getTrader() != null) {
|
||||
+ if (!me.earthme.luminol.config.modules.fixes.VoidTradingFixConfig.enabled && (entity.getBukkitEntity() instanceof org.bukkit.inventory.Merchant merchant && merchant.getTrader() != null)) { // Luminol - Add config for void trading
|
||||
merchant.getTrader().closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED);
|
||||
}
|
||||
// Paper end - Fix merchant inventory not closing on entity removal
|
||||
@@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..0e6bfc03be660415c333024b56ac6565
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index de5263b0261ed2f8f97b9525936be8067ddb79b2..dfac4257d8de1a607ff952a1b27f61f3b4329516 100644
|
||||
index 20fe53cc8e9edfc7b7d50f23379e0044e520c84d..eeb094265756e5440c0cdd0784f725f7de536493 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -570,7 +570,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -590,7 +590,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.bb = Entity.INITIAL_AABB;
|
||||
this.stuckSpeedMultiplier = Vec3.ZERO;
|
||||
this.nextStep = 1.0F;
|
||||
@@ -53,7 +53,7 @@ index 479e6e2aa88a22ef7f8fccb06add6806f5b71d9d..22dae23a0c2fa4c85befd670637b1e59
|
||||
buf.writeCollection(this.entries, (buf2, entry) -> entry.write(buf2));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
index aafeb9c61ddba6a8671f0238eda47b227619f1af..dc00ad0cc7f0c5c069a8d15dfdc926f2a1487319 100644
|
||||
index a523a83aec3a6ecbec4d60a187edc0c0167d15b4..324df3cce3f5a1ab6b4d2acfbb8e80aa551870d7 100644
|
||||
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
@@ -129,6 +129,16 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
@@ -117,15 +117,17 @@ index 0000000000000000000000000000000000000000..aafb2f5052c7c8e5971a47308253badb
|
||||
+}
|
||||
diff --git a/src/main/java/me/earthme/luminol/functions/GlobalServerTpsBar.java b/src/main/java/me/earthme/luminol/functions/GlobalServerTpsBar.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..026807e0851d67c6d57e81f573ac1bf8fedc6109
|
||||
index 0000000000000000000000000000000000000000..de2f03d6e771c09e8da2da454b7ec4a16c0a17ab
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/functions/GlobalServerTpsBar.java
|
||||
@@ -0,0 +1,224 @@
|
||||
@@ -0,0 +1,214 @@
|
||||
+package me.earthme.luminol.functions;
|
||||
+
|
||||
+import com.google.common.collect.Maps;
|
||||
+import com.mojang.logging.LogUtils;
|
||||
+import io.papermc.paper.threadedregions.ThreadedRegionizer;
|
||||
+import io.papermc.paper.threadedregions.TickData;
|
||||
+import io.papermc.paper.threadedregions.TickRegionScheduler;
|
||||
+import io.papermc.paper.threadedregions.TickRegions;
|
||||
+import io.papermc.paper.threadedregions.scheduler.ScheduledTask;
|
||||
+import me.earthme.luminol.config.modules.misc.TpsBarConfig;
|
||||
@@ -134,8 +136,6 @@ index 0000000000000000000000000000000000000000..026807e0851d67c6d57e81f573ac1bf8
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
+import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.entity.Player;
|
||||
@@ -146,46 +146,37 @@ index 0000000000000000000000000000000000000000..026807e0851d67c6d57e81f573ac1bf8
|
||||
+
|
||||
+public class GlobalServerTpsBar {
|
||||
+ protected static final NullPlugin NULL_PLUGIN = new NullPlugin();
|
||||
+ protected static final Map<UUID,BossBar> uuid2Bossbars = new HashMap<>();
|
||||
+ protected static volatile ScheduledTask tpsbarTask = null;
|
||||
+ protected static final Map<UUID, BossBar> uuid2Bossbars = Maps.newConcurrentMap();
|
||||
+ protected static final Map<UUID, ScheduledTask> scheduledTasks = new HashMap<>();
|
||||
+
|
||||
+ protected static volatile ScheduledTask scannerTask = null;
|
||||
+ private static final Logger logger = LogUtils.getLogger();
|
||||
+
|
||||
+ public static void init(){
|
||||
+ cancelBarUpdateTask();
|
||||
+
|
||||
+ Bukkit.getGlobalRegionScheduler().runAtFixedRate(NULL_PLUGIN,c -> {
|
||||
+ tpsbarTask = c;
|
||||
+ scannerTask = Bukkit.getGlobalRegionScheduler().runAtFixedRate(NULL_PLUGIN, unused -> {
|
||||
+ try {
|
||||
+ update();
|
||||
+ cleanUp();
|
||||
+ }catch (Exception e){
|
||||
+ logger.error(e.getLocalizedMessage());
|
||||
+ }
|
||||
+ },1,TpsBarConfig.updateInterval);
|
||||
+ }
|
||||
+
|
||||
+ public static void removeAllBars(){
|
||||
+ for (Map.Entry<UUID,BossBar> barEntry : uuid2Bossbars.entrySet()){
|
||||
+ final UUID playerUUID = barEntry.getKey();
|
||||
+ final BossBar tpsBar = barEntry.getValue();
|
||||
+
|
||||
+ final Player targetPlayer = Bukkit.getPlayer(playerUUID);{
|
||||
+ if (targetPlayer != null){
|
||||
+ targetPlayer.hideBossBar(tpsBar);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ uuid2Bossbars.clear();
|
||||
+ }, 1, TpsBarConfig.updateInterval);
|
||||
+ }
|
||||
+
|
||||
+ public static void cancelBarUpdateTask(){
|
||||
+ removeAllBars();
|
||||
+
|
||||
+ if (tpsbarTask == null || tpsbarTask.isCancelled()){
|
||||
+ if (scannerTask == null || scannerTask.isCancelled()){
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ tpsbarTask.cancel();
|
||||
+ scannerTask.cancel();
|
||||
+
|
||||
+ for (ScheduledTask task : scheduledTasks.values()) {
|
||||
+ if (!task.isCancelled()) {
|
||||
+ task.cancel();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isPlayerVisible(Player player){
|
||||
@@ -197,63 +188,62 @@ index 0000000000000000000000000000000000000000..026807e0851d67c6d57e81f573ac1bf8
|
||||
+ }
|
||||
+
|
||||
+ private static void update(){
|
||||
+ updateBarValues();
|
||||
+ cleanUpPlayers();
|
||||
+ }
|
||||
+
|
||||
+ private static void cleanUpPlayers(){
|
||||
+ final List<UUID> toRemove = new ArrayList<>();
|
||||
+
|
||||
+ for (Map.Entry<UUID,BossBar> bossBarEntry : uuid2Bossbars.entrySet()){
|
||||
+ final UUID uuid = bossBarEntry.getKey();
|
||||
+ boolean shouldRemove = true;
|
||||
+
|
||||
+ final Player target = Bukkit.getPlayer(uuid);
|
||||
+ if (target != null){
|
||||
+ shouldRemove = !isPlayerVisible(target);
|
||||
+ }
|
||||
+
|
||||
+ if (shouldRemove){
|
||||
+ toRemove.add(uuid);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (UUID uuid : toRemove){
|
||||
+ final BossBar removed = uuid2Bossbars.remove(uuid);
|
||||
+ if (removed != null){
|
||||
+ final Player targetPlayer = Bukkit.getPlayer(uuid);
|
||||
+ if (targetPlayer != null){
|
||||
+ targetPlayer.hideBossBar(removed);
|
||||
+ }
|
||||
+ }
|
||||
+ for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
+ scheduledTasks.computeIfAbsent(player.getUniqueId(), unused -> createBossBarForPlayer(player));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void updateBarValues(){
|
||||
+ for (Player apiPlayer : Bukkit.getOnlinePlayers()){
|
||||
+ final ServerPlayer nmsPlayer = ((CraftPlayer) apiPlayer).getHandle();
|
||||
+ final ThreadedRegionizer.ThreadedRegion<TickRegions.TickRegionData, TickRegions.TickRegionSectionData> region = ((ServerLevel) nmsPlayer.level()).regioniser.getRegionAtUnsynchronised(nmsPlayer.moonrise$getSectionX(),nmsPlayer.moonrise$getSectionZ());
|
||||
+ private static void cleanUp() {
|
||||
+ final List<UUID> toCleanUp = new ArrayList<>();
|
||||
+
|
||||
+ if (region == null){
|
||||
+ continue;
|
||||
+ for (Map.Entry<UUID, ScheduledTask> toCheck : scheduledTasks.entrySet()) {
|
||||
+ if (toCheck.getValue().isCancelled()) {
|
||||
+ toCleanUp.add(toCheck.getKey());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (UUID uuid : toCleanUp) {
|
||||
+ scheduledTasks.remove(uuid);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static ScheduledTask createBossBarForPlayer(@NotNull Player apiPlayer) {
|
||||
+ final UUID playerUUID = apiPlayer.getUniqueId();
|
||||
+
|
||||
+ return apiPlayer.getScheduler().runAtFixedRate(NULL_PLUGIN, (n) -> {
|
||||
+ if (!isPlayerVisible(apiPlayer)) {
|
||||
+ final BossBar removed = uuid2Bossbars.remove(playerUUID);
|
||||
+
|
||||
+ if (removed != null) {
|
||||
+ apiPlayer.hideBossBar(removed);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ final ThreadedRegionizer.ThreadedRegion<TickRegions.TickRegionData, TickRegions.TickRegionSectionData> region = TickRegionScheduler.getCurrentRegion();
|
||||
+ final TickData.TickReportData reportData = region.getData().getRegionSchedulingHandle().getTickReport5s(System.nanoTime());
|
||||
+
|
||||
+ BossBar targetBossbar = uuid2Bossbars.get(nmsPlayer.getUUID());
|
||||
+
|
||||
+ if (targetBossbar == null && isPlayerVisible(apiPlayer)){
|
||||
+ targetBossbar = BossBar.bossBar(Component.text(""),0.0F, BossBar.Color.valueOf(TpsBarConfig.tpsColors.get(3)), BossBar.Overlay.NOTCHED_20);
|
||||
+ uuid2Bossbars.put(nmsPlayer.getUUID(),targetBossbar);
|
||||
+ apiPlayer.showBossBar(targetBossbar);
|
||||
+ }
|
||||
+ BossBar targetBossbar = uuid2Bossbars.computeIfAbsent(
|
||||
+ playerUUID,
|
||||
+ unused -> BossBar.bossBar(Component.text(""),0.0F, BossBar.Color.valueOf(TpsBarConfig.tpsColors.get(3)), BossBar.Overlay.NOTCHED_20)
|
||||
+ );
|
||||
+
|
||||
+ if (reportData != null && targetBossbar != null){
|
||||
+ apiPlayer.showBossBar(targetBossbar);
|
||||
+
|
||||
+ if (reportData != null){
|
||||
+ final TickData.SegmentData tpsData = reportData.tpsData().segmentAll();
|
||||
+ final double mspt = reportData.timePerTickData().segmentAll().average() / 1.0E6;
|
||||
+ updateTpsBar(tpsData.average(),mspt,targetBossbar,apiPlayer);
|
||||
+
|
||||
+ updateTpsBar(tpsData.average(), mspt, targetBossbar, apiPlayer);
|
||||
+ }
|
||||
+ }
|
||||
+ }, () -> {
|
||||
+ final BossBar removed = uuid2Bossbars.remove(playerUUID); // Auto clean up it
|
||||
+
|
||||
+ if (removed != null) {
|
||||
+ apiPlayer.hideBossBar(removed);
|
||||
+ }
|
||||
+ }, 1, TpsBarConfig.updateInterval);
|
||||
+ }
|
||||
+
|
||||
+ private static void updateTpsBar(double tps, double mspt, @NotNull BossBar bar, @NotNull Player player){
|
||||
@@ -346,10 +336,10 @@ index 0000000000000000000000000000000000000000..026807e0851d67c6d57e81f573ac1bf8
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 0755e8f460f59e2dbc00cac73026bb441c04e9ea..690d0f59daf8c4630c3d70b6fb690c2e1cedd402 100644
|
||||
index e3c8deea68ef49bcd07359e243a12afb57cbcf52..279bc6eede3a1ae77b810f0553efe36adeeefaa4 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -855,6 +855,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -802,6 +802,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
|
||||
@Override
|
||||
public void stopServer() {
|
||||
@@ -358,10 +348,10 @@ index 0755e8f460f59e2dbc00cac73026bb441c04e9ea..690d0f59daf8c4630c3d70b6fb690c2e
|
||||
//Util.shutdownExecutors(); // Paper - moved into super
|
||||
SkullBlockEntity.clear();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index e4a68f43c1a48fe8193623c646eb40bc5f664c76..59a4937363a2404fe0b852b0ac851ef0c9c528ce 100644
|
||||
index 23f852ede94bce4d000c8fcaa8fba5d4800b533c..0752d13febc5f1831ae58f7216fba89e1290c780 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -303,7 +303,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -327,7 +327,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
||||
public @Nullable String clientBrandName = null; // Paper - Brand support
|
||||
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event
|
||||
@@ -371,10 +361,10 @@ index e4a68f43c1a48fe8193623c646eb40bc5f664c76..59a4937363a2404fe0b852b0ac851ef0
|
||||
private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
|
||||
private final ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder viewDistanceHolder = new ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 12a2da086f249b3dbd61e5749b9856a2fce9ac7b..b954a5a3d8c589a0261202f21f1430c8790e874a 100644
|
||||
index b0e93050839ce00b057e3a9bf3bdf8dd5e0662cf..c39e9ea1ce46864623a6d15027ce337611e6b712 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2393,6 +2393,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2414,6 +2414,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
handle.expToDrop = data.getInt("expToDrop");
|
||||
handle.keepLevel = data.getBoolean("keepLevel");
|
||||
}
|
||||
@@ -384,7 +374,7 @@ index 12a2da086f249b3dbd61e5749b9856a2fce9ac7b..b954a5a3d8c589a0261202f21f1430c8
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2414,6 +2417,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2435,6 +2438,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
data.putLong("lastPlayed", System.currentTimeMillis());
|
||||
data.putString("lastKnownName", handle.getScoreboardName());
|
||||
|
||||
@@ -115,15 +115,14 @@ index 0000000000000000000000000000000000000000..b632c4a636974535bf001f010de1dcb6
|
||||
+}
|
||||
diff --git a/src/main/java/me/earthme/luminol/functions/GlobalServerMemoryBar.java b/src/main/java/me/earthme/luminol/functions/GlobalServerMemoryBar.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..47809d78392fe0cb30ad68ca1c331784f1843269
|
||||
index 0000000000000000000000000000000000000000..3535cf03e7855b4d8b312ccf3a7b0564ea753019
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/functions/GlobalServerMemoryBar.java
|
||||
@@ -0,0 +1,186 @@
|
||||
@@ -0,0 +1,171 @@
|
||||
+package me.earthme.luminol.functions;
|
||||
+
|
||||
+import com.google.common.collect.Maps;
|
||||
+import com.mojang.logging.LogUtils;
|
||||
+import io.papermc.paper.threadedregions.ThreadedRegionizer;
|
||||
+import io.papermc.paper.threadedregions.TickRegions;
|
||||
+import io.papermc.paper.threadedregions.scheduler.ScheduledTask;
|
||||
+import me.earthme.luminol.config.modules.misc.MembarConfig;
|
||||
+import me.earthme.luminol.utils.NullPlugin;
|
||||
@@ -131,8 +130,6 @@ index 0000000000000000000000000000000000000000..47809d78392fe0cb30ad68ca1c331784
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
+import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.entity.Player;
|
||||
@@ -145,46 +142,36 @@ index 0000000000000000000000000000000000000000..47809d78392fe0cb30ad68ca1c331784
|
||||
+
|
||||
+public class GlobalServerMemoryBar {
|
||||
+ protected static final NullPlugin NULL_PLUGIN = new NullPlugin();
|
||||
+ protected static final Map<UUID, BossBar> uuid2Bossbars = new HashMap<>();
|
||||
+ protected static volatile ScheduledTask membarTask = null;
|
||||
+ protected static final Map<UUID, BossBar> uuid2Bossbars = Maps.newConcurrentMap();
|
||||
+ protected static final Map<UUID, ScheduledTask> scheduledTasks = new HashMap<>();
|
||||
+ protected static volatile ScheduledTask scannerTask = null;
|
||||
+ private static final Logger logger = LogUtils.getLogger();
|
||||
+
|
||||
+ public static void init(){
|
||||
+ cancelBarUpdateTask();
|
||||
+
|
||||
+ Bukkit.getGlobalRegionScheduler().runAtFixedRate(NULL_PLUGIN, c -> {
|
||||
+ membarTask = c;
|
||||
+ scannerTask = Bukkit.getGlobalRegionScheduler().runAtFixedRate(NULL_PLUGIN, unused -> {
|
||||
+ try {
|
||||
+ update();
|
||||
+ }catch (Exception e){
|
||||
+ logger.error(e.getLocalizedMessage());
|
||||
+ }
|
||||
+ },1, MembarConfig.updateInterval);
|
||||
+ }, 1, MembarConfig.updateInterval);
|
||||
+ }
|
||||
+
|
||||
+ public static void removeAllBars(){
|
||||
+ for (Map.Entry<UUID,BossBar> barEntry : uuid2Bossbars.entrySet()){
|
||||
+ final UUID playerUUID = barEntry.getKey();
|
||||
+ final BossBar memBar = barEntry.getValue();
|
||||
+
|
||||
+ final Player targetPlayer = Bukkit.getPlayer(playerUUID);{
|
||||
+ if (targetPlayer != null){
|
||||
+ targetPlayer.hideBossBar(memBar);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ uuid2Bossbars.clear();
|
||||
+ }
|
||||
+
|
||||
+ public static void cancelBarUpdateTask(){
|
||||
+ removeAllBars();
|
||||
+
|
||||
+ if (membarTask == null || membarTask.isCancelled()){
|
||||
+ if (scannerTask == null || scannerTask.isCancelled()){
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ membarTask.cancel();
|
||||
+ scannerTask.cancel();
|
||||
+
|
||||
+ for (ScheduledTask task : scheduledTasks.values()) {
|
||||
+ if (!task.isCancelled()) {
|
||||
+ task.cancel();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isPlayerVisible(Player player){
|
||||
@@ -196,66 +183,64 @@ index 0000000000000000000000000000000000000000..47809d78392fe0cb30ad68ca1c331784
|
||||
+ }
|
||||
+
|
||||
+ private static void update(){
|
||||
+ updateBarValues();
|
||||
+ cleanUpPlayers();
|
||||
+ doUpdate();
|
||||
+ cleanUp();
|
||||
+ }
|
||||
+
|
||||
+ private static void cleanUpPlayers(){
|
||||
+ final List<UUID> toRemove = new ArrayList<>();
|
||||
+ private static void cleanUp(){
|
||||
+ final List<UUID> toCleanUp = new ArrayList<>();
|
||||
+
|
||||
+ for (Map.Entry<UUID,BossBar> bossBarEntry : uuid2Bossbars.entrySet()){
|
||||
+ final UUID uuid = bossBarEntry.getKey();
|
||||
+ boolean shouldRemove = true;
|
||||
+
|
||||
+ final Player target = Bukkit.getPlayer(uuid);
|
||||
+ if (target != null){
|
||||
+ shouldRemove = !isPlayerVisible(target);
|
||||
+ }
|
||||
+
|
||||
+ if (shouldRemove){
|
||||
+ toRemove.add(uuid);
|
||||
+ for (Map.Entry<UUID, ScheduledTask> toCheck : scheduledTasks.entrySet()) {
|
||||
+ if (toCheck.getValue().isCancelled()) {
|
||||
+ toCleanUp.add(toCheck.getKey());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (UUID uuid : toRemove){
|
||||
+ final BossBar removed = uuid2Bossbars.remove(uuid);
|
||||
+ if (removed != null){
|
||||
+ final Player targetPlayer = Bukkit.getPlayer(uuid);
|
||||
+ if (targetPlayer != null){
|
||||
+ targetPlayer.hideBossBar(removed);
|
||||
+ for (UUID uuid : toCleanUp) {
|
||||
+ scheduledTasks.remove(uuid);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void doUpdate(){
|
||||
+ for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
+ scheduledTasks.computeIfAbsent(player.getUniqueId(), unused -> createBossBarForPlayer(player));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static ScheduledTask createBossBarForPlayer(Player apiPlayer) {
|
||||
+ return apiPlayer.getScheduler().runAtFixedRate(NULL_PLUGIN, (unused) -> {
|
||||
+ final UUID playerUUID = apiPlayer.getUniqueId();
|
||||
+
|
||||
+ if (!isPlayerVisible(apiPlayer)) {
|
||||
+ final BossBar removed = uuid2Bossbars.remove(playerUUID);
|
||||
+
|
||||
+ if (removed != null) {
|
||||
+ apiPlayer.hideBossBar(removed);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void updateBarValues(){
|
||||
+ MemoryUsage heap = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
|
||||
+
|
||||
+ long used = heap.getUsed();
|
||||
+ long xmx = heap.getMax();
|
||||
+
|
||||
+
|
||||
+
|
||||
+ for (Player apiPlayer : Bukkit.getOnlinePlayers()){
|
||||
+ final ServerPlayer nmsPlayer = ((CraftPlayer) apiPlayer).getHandle();
|
||||
+ final ThreadedRegionizer.ThreadedRegion<TickRegions.TickRegionData, TickRegions.TickRegionSectionData> region = ((ServerLevel) nmsPlayer.level()).regioniser.getRegionAtUnsynchronised(nmsPlayer.moonrise$getSectionX(),nmsPlayer.moonrise$getSectionZ());
|
||||
+
|
||||
+ if (region == null){
|
||||
+ continue;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ BossBar targetBossbar = uuid2Bossbars.get(nmsPlayer.getUUID());
|
||||
+ MemoryUsage heap = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
|
||||
+
|
||||
+ if (targetBossbar == null && isPlayerVisible(apiPlayer)){
|
||||
+ targetBossbar = BossBar.bossBar(Component.text(""),0.0F, BossBar.Color.valueOf(MembarConfig.memColors.get(3)), BossBar.Overlay.NOTCHED_20);
|
||||
+ uuid2Bossbars.put(nmsPlayer.getUUID(),targetBossbar);
|
||||
+ apiPlayer.showBossBar(targetBossbar);
|
||||
+ }
|
||||
+ long used = heap.getUsed();
|
||||
+ long xmx = heap.getMax();
|
||||
+
|
||||
+ if (targetBossbar != null){
|
||||
+ updateMembar(targetBossbar,used,xmx);
|
||||
+ BossBar targetBossbar = uuid2Bossbars.computeIfAbsent(
|
||||
+ playerUUID,
|
||||
+ (unused1) -> BossBar.bossBar(Component.text(""),0.0F, BossBar.Color.valueOf(MembarConfig.memColors.get(3)), BossBar.Overlay.NOTCHED_20)
|
||||
+ );
|
||||
+
|
||||
+ apiPlayer.showBossBar(targetBossbar);
|
||||
+
|
||||
+ updateMembar(targetBossbar, used, xmx);
|
||||
+ }, () -> {
|
||||
+ final BossBar removed = uuid2Bossbars.remove(apiPlayer.getUniqueId());
|
||||
+
|
||||
+ if (removed != null) {
|
||||
+ apiPlayer.hideBossBar(removed);
|
||||
+ }
|
||||
+ }
|
||||
+ }, 1, MembarConfig.updateInterval);
|
||||
+ }
|
||||
+
|
||||
+ private static void updateMembar(@NotNull BossBar bar, long used, long xmx){
|
||||
@@ -276,7 +261,7 @@ index 0000000000000000000000000000000000000000..47809d78392fe0cb30ad68ca1c331784
|
||||
+ final String content = "<%s><text></%s>";
|
||||
+ final String replaced = String.format(content,colorString,colorString);
|
||||
+
|
||||
+ return MiniMessage.miniMessage().deserialize(replaced,Placeholder.parsed("text", String.format("%.2f", (double)max / (1024 * 1024))));
|
||||
+ return MiniMessage.miniMessage().deserialize(replaced,Placeholder.parsed("text", String.format("%.2f", max / (1024 * 1024))));
|
||||
+ }
|
||||
+
|
||||
+ private static @NotNull Component getMemoryComponent(long used,long max){
|
||||
@@ -306,10 +291,10 @@ index 0000000000000000000000000000000000000000..47809d78392fe0cb30ad68ca1c331784
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 690d0f59daf8c4630c3d70b6fb690c2e1cedd402..8bd9baba560051e681277b8cea9d1374ea3ee825 100644
|
||||
index 279bc6eede3a1ae77b810f0553efe36adeeefaa4..4ff5105d32c41a8ea145e7833ea6a3cee0108031 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -856,6 +856,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -803,6 +803,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@Override
|
||||
public void stopServer() {
|
||||
me.earthme.luminol.functions.GlobalServerTpsBar.cancelBarUpdateTask(); //Luminol - Tpsbar
|
||||
@@ -318,10 +303,10 @@ index 690d0f59daf8c4630c3d70b6fb690c2e1cedd402..8bd9baba560051e681277b8cea9d1374
|
||||
//Util.shutdownExecutors(); // Paper - moved into super
|
||||
SkullBlockEntity.clear();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 59a4937363a2404fe0b852b0ac851ef0c9c528ce..023ffc81f9363eb2fc7c3b3382c843b064c889e3 100644
|
||||
index 0752d13febc5f1831ae58f7216fba89e1290c780..93c038ba1fd216fd11ab8b5cec5807453f34e152 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -304,6 +304,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -328,6 +328,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
public @Nullable String clientBrandName = null; // Paper - Brand support
|
||||
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event
|
||||
public volatile boolean isTpsBarVisible = false; //Luminol - Tps bar
|
||||
@@ -330,10 +315,10 @@ index 59a4937363a2404fe0b852b0ac851ef0c9c528ce..023ffc81f9363eb2fc7c3b3382c843b0
|
||||
private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
|
||||
private final ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder viewDistanceHolder = new ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index b954a5a3d8c589a0261202f21f1430c8790e874a..77576c06ffc0a677b1bfb63d48d39fba2aa2050d 100644
|
||||
index c39e9ea1ce46864623a6d15027ce337611e6b712..1872b19dfefb40e6673fd2b8ddb8d3c384020073 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2396,6 +2396,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2417,6 +2417,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
//Luminol start - Tpsbar
|
||||
getHandle().isTpsBarVisible = data.getBoolean("tpsbarVisible");
|
||||
//Luminol end
|
||||
@@ -343,7 +328,7 @@ index b954a5a3d8c589a0261202f21f1430c8790e874a..77576c06ffc0a677b1bfb63d48d39fba
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2420,6 +2423,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2441,6 +2444,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
//Luminol start - Tpsbar
|
||||
data.putBoolean("tpsbarVisible",handle.isTpsBarVisible);
|
||||
//Luminol end
|
||||
83
patches/server/0010-Add-config-for-username-check.patch
Normal file
83
patches/server/0010-Add-config-for-username-check.patch
Normal file
@@ -0,0 +1,83 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Wed, 7 Feb 2024 04:50:10 +0000
|
||||
Subject: [PATCH] Add config for username check
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
||||
index 8849862b45ccbbc635a1c316e9870bca81e55c04..774521cf327592adeef67f3fb8f6334e0b7de799 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
||||
@@ -294,8 +294,8 @@ public class CraftPlayerProfile implements PlayerProfile, SharedPlayerProfile {
|
||||
}
|
||||
|
||||
private static GameProfile createAuthLibProfile(UUID uniqueId, String name) {
|
||||
- Preconditions.checkArgument(name == null || name.length() <= 16, "Name cannot be longer than 16 characters");
|
||||
- Preconditions.checkArgument(name == null || StringUtil.isValidPlayerName(name), "The name of the profile contains invalid characters: %s", name);
|
||||
+ Preconditions.checkArgument(name == null || name.length() <= 16 || !me.earthme.luminol.config.modules.misc.UsernameCheckConfig.enabled, "Name cannot be longer than 16 characters");
|
||||
+ Preconditions.checkArgument(name == null || StringUtil.isValidPlayerName(name) || !me.earthme.luminol.config.modules.misc.UsernameCheckConfig.enabled, "The name of the profile contains invalid characters: %s", name);
|
||||
return new GameProfile(
|
||||
uniqueId != null ? uniqueId : Util.NIL_UUID,
|
||||
name != null ? name : ""
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/misc/UsernameCheckConfig.java b/src/main/java/me/earthme/luminol/config/modules/misc/UsernameCheckConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c7e4724cc4ab8d911bcaf0106c098b266c843bb1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/UsernameCheckConfig.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class UsernameCheckConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ public static boolean enabled = true;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.MISC;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "username_checks";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index 227d62a69a453d49c28568ecb41ecef85a35405b..d1f70437eb43dd536e7b3dac7a770525eff55318 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -178,7 +178,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
public void handleHello(ServerboundHelloPacket packet) {
|
||||
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]);
|
||||
// Paper start - Validate usernames
|
||||
- if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
||||
+ if (me.earthme.luminol.config.modules.misc.UsernameCheckConfig.enabled //Luminol - Add config for username check
|
||||
+ && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
||||
&& io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation
|
||||
&& !this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation) {
|
||||
Validate.validState(StringUtil.isReasonablePlayerName(packet.name()), "Invalid characters in username", new Object[0]);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
|
||||
index f58dec12326734c61f4bc2298a87fb38f1ac1dc4..249ecfb1b1830befa43ba172c65527b077bb8f4e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
|
||||
@@ -42,7 +42,7 @@ public final class CraftPlayerProfile implements PlayerProfile, com.destroystoky
|
||||
Preconditions.checkArgument(isValidSkullProfile, "The skull profile is missing a name or textures!");
|
||||
// Paper start - Validate
|
||||
Preconditions.checkArgument(gameProfile.getName().length() <= 16, "The name of the profile is longer than 16 characters");
|
||||
- Preconditions.checkArgument(net.minecraft.util.StringUtil.isValidPlayerName(gameProfile.getName()), "The name of the profile contains invalid characters: %s", gameProfile.getName());
|
||||
+ Preconditions.checkArgument(!me.earthme.luminol.config.modules.misc.UsernameCheckConfig.enabled || net.minecraft.util.StringUtil.isValidPlayerName(gameProfile.getName()), "The name of the profile contains invalid characters: %s", gameProfile.getName()); // Luminol - Add config for username checks
|
||||
final PropertyMap properties = gameProfile.getProperties();
|
||||
Preconditions.checkArgument(properties.size() <= 16, "The profile contains more than 16 properties");
|
||||
for (final Property property : properties.values()) {
|
||||
@@ -79,7 +79,7 @@ public final class CraftPlayerProfile implements PlayerProfile, com.destroystoky
|
||||
Preconditions.checkArgument((uniqueId != null) || !StringUtils.isBlank(name), "uniqueId is null or name is blank");
|
||||
}
|
||||
Preconditions.checkArgument(name == null || name.length() <= 16, "The name of the profile is longer than 16 characters"); // Paper - Validate
|
||||
- Preconditions.checkArgument(name == null || net.minecraft.util.StringUtil.isValidPlayerName(name), "The name of the profile contains invalid characters: %s", name); // Paper - Validate
|
||||
+ Preconditions.checkArgument(!me.earthme.luminol.config.modules.misc.UsernameCheckConfig.enabled || name == null || net.minecraft.util.StringUtil.isValidPlayerName(name), "The name of the profile contains invalid characters: %s", name); // Paper - Validate // Luminol - Add config for username checks
|
||||
this.uniqueId = uniqueId;
|
||||
this.name = name;
|
||||
}
|
||||
@@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..502b93c7bda9e8577a1901a8777b7cf9
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 8bd9baba560051e681277b8cea9d1374ea3ee825..79b79a5d41dc3568ae6a3d7701e6ac6b91045e36 100644
|
||||
index 4ff5105d32c41a8ea145e7833ea6a3cee0108031..295504dab771c8bb8c668545fe5d62eae0561b76 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -300,7 +300,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -297,7 +297,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord";
|
||||
String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/";
|
||||
// Paper end - Add Velocity IP Forwarding Support
|
||||
@@ -1,46 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Wed, 7 Feb 2024 04:50:10 +0000
|
||||
Subject: [PATCH] Add config for username check
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/misc/UsernameCheckConfig.java b/src/main/java/me/earthme/luminol/config/modules/misc/UsernameCheckConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c7e4724cc4ab8d911bcaf0106c098b266c843bb1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/UsernameCheckConfig.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class UsernameCheckConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ public static boolean enabled = true;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.MISC;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "username_checks";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index 8098b1a447a7c054e15edc09d2fa50e48f73e926..b6a65bdddc8eaf64931d9aa3f4801dc8e128801b 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -178,7 +178,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
public void handleHello(ServerboundHelloPacket packet) {
|
||||
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]);
|
||||
// Paper start - Validate usernames
|
||||
- if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
||||
+ if (me.earthme.luminol.config.modules.misc.UsernameCheckConfig.enabled //Luminol - Add config for username check
|
||||
+ && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
||||
&& io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation
|
||||
&& !this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation) {
|
||||
Validate.validState(StringUtil.isReasonablePlayerName(packet.name()), "Invalid characters in username", new Object[0]);
|
||||
@@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..e45ce3abf49684c911678abcefd69586
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java b/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java
|
||||
index 2fa51c3a70f43cd23b8f494fc643d66cecfda7d2..2c541f300ea1657e2d75d0eeb36809aaf437b205 100644
|
||||
index 6a7d7fad990fc44fdda6849d43dad141e61f7f37..dd470577fe314154b5a3677851eef95ebd151721 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java
|
||||
@@ -9,12 +9,15 @@ import java.time.Duration;
|
||||
@@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..0fd71151a85dd87c2294033e2e7512ac
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 4bb14874912557008fab7361754f2d2eb98fc5aa..38725e383cce13e372dacfa59f8668235ff6e3a5 100644
|
||||
index 456f15e44e41d65338c0346594be2b0042b84005..5127d0ef0c85b8f57d412d36eaca00153c4fe7b3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1468,7 +1468,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
@@ -1538,7 +1538,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
try {
|
||||
tickConsumer.accept(entity);
|
||||
} catch (Throwable throwable) {
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Add config to disable async catchers
|
||||
|
||||
|
||||
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 7d626bec6f0a4497026de6c0311e27cf95cfd757..2760e66046a37327d279a5bcdfb56a5b073b82a5 100644
|
||||
index 301cc1c0d91f5e755f74ace60dbe5551240b496d..2befb04b18cbdcc854437dfc534832ae02e70ee6 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
||||
@@ -26,49 +26,49 @@ public class TickThread extends Thread {
|
||||
@@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..3eafc59cc015569d3da8b1d8c4bfd046
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
|
||||
index b8a571fcc44f67ac8f6089e039a8620bf6c40603..c973535eba031f102c6cae8f9b75547ba3a95376 100644
|
||||
index ccf476d1ed22cf992e3cbca6a375d36f85a82fa8..81f69938ccc72522090c4bee1a941c0de8054feb 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 {
|
||||
@@ -0,0 +1,25 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Fri, 6 Dec 2024 23:53:03 +0800
|
||||
Subject: [PATCH] Add fix for off region adult following ai behavior
|
||||
|
||||
Might fix: https://github.com/PaperMC/Folia/issues/245
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
|
||||
index 0ff878a8cfcd6a3e08575b7537d9b7e2b817908f..742662da3497b0042fa0fb6ff3456fc62692473d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
|
||||
@@ -33,6 +33,13 @@ public class BabyFollowAdult {
|
||||
} else {
|
||||
LivingEntity entityageable1 = (AgeableMob) behaviorbuilder_b.get(memoryaccessor); // CraftBukkit - type
|
||||
|
||||
+ // Luminol start - Fix off world entity following which caused async issue
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(entityageable1)) {
|
||||
+ memoryaccessor.erase();
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Luminol end
|
||||
+
|
||||
if (entityageable.closerThan(entityageable1, (double) (executionRange.getMaxValue() + 1)) && !entityageable.closerThan(entityageable1, (double) executionRange.getMinValue())) {
|
||||
// CraftBukkit start
|
||||
EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(entityageable, entityageable1, EntityTargetEvent.TargetReason.FOLLOW_LEADER);
|
||||
@@ -1,45 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Tue, 31 Dec 2024 21:23:37 +0800
|
||||
Subject: [PATCH] Add config for watchdog timeout
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/FoliaWatchdogThread.java b/src/main/java/io/papermc/paper/threadedregions/FoliaWatchdogThread.java
|
||||
index 258d82ab2c78482e1561343e8e1f81fc33f1895e..967107c0f4a18a29877883ccddb4d7962f4b5788 100644
|
||||
--- a/src/main/java/io/papermc/paper/threadedregions/FoliaWatchdogThread.java
|
||||
+++ b/src/main/java/io/papermc/paper/threadedregions/FoliaWatchdogThread.java
|
||||
@@ -65,7 +65,7 @@ public final class FoliaWatchdogThread extends Thread {
|
||||
|
||||
for (final RunningTick tick : ticks) {
|
||||
final long elapsed = now - tick.lastPrint;
|
||||
- if (elapsed <= TimeUnit.SECONDS.toNanos(5L)) {
|
||||
+ if (elapsed <= TimeUnit.MILLISECONDS.toNanos(me.earthme.luminol.config.modules.misc.FoliaWatchogConfig.tickRegionTimeOutMs)) { // Luminol - Add config for watchdog timeout
|
||||
continue;
|
||||
}
|
||||
tick.lastPrint = now;
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/misc/FoliaWatchogConfig.java b/src/main/java/me/earthme/luminol/config/modules/misc/FoliaWatchogConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..de58b5bf9dedf35bc56a9211d0769b988704a7fe
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/FoliaWatchogConfig.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class FoliaWatchogConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "tick_region_time_out_ms")
|
||||
+ public static int tickRegionTimeOutMs = 5000;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.MISC;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "folia_watchdog";
|
||||
+ }
|
||||
+}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -36,10 +36,10 @@ index 0000000000000000000000000000000000000000..01f8c6ff3662569be5a4ff998bcd4fbb
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 023ffc81f9363eb2fc7c3b3382c843b064c889e3..d57fd6e4aacb611526a741fbd98165f124b7b8ef 100644
|
||||
index 93c038ba1fd216fd11ab8b5cec5807453f34e152..c72bda7413d9a7ce763743d0efbd85257262477e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -929,9 +929,24 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -1162,9 +1162,24 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
}
|
||||
|
||||
Entity entity = this.getCamera();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Wed, 7 Feb 2024 06:34:15 +0000
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sat, 30 Nov 2024 11:36:43 +0800
|
||||
Subject: [PATCH] Teleport async if entity was moving to another region at once
|
||||
|
||||
|
||||
@@ -39,10 +39,10 @@ index 0000000000000000000000000000000000000000..0e51d465db3554ac80d00c6b85cc1f01
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 537fc5c169ab2e519277b95d456aab51b5b7fbb5..25a5f36ff19ff3f9cea051a1a6bf671b6288b799 100644
|
||||
index 8e1a75e56cc373a9ec9b563666af0864eee99479..4fdbdd1c5c937c20026afe555fa1c8371b4eaa16 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1125,6 +1125,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1181,6 +1181,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
// Paper end - detailed watchdog information
|
||||
|
||||
@@ -50,10 +50,10 @@ index 537fc5c169ab2e519277b95d456aab51b5b7fbb5..25a5f36ff19ff3f9cea051a1a6bf671b
|
||||
+ private volatile boolean preventMoving = false;
|
||||
+ //Luminol end
|
||||
+
|
||||
public void move(MoverType movementType, Vec3 movement) {
|
||||
public void move(MoverType type, Vec3 movement) {
|
||||
final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity
|
||||
// Paper start - detailed watchdog information
|
||||
@@ -1135,6 +1139,32 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1191,6 +1195,32 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.moveStartZ = this.getZ();
|
||||
this.moveVector = movement;
|
||||
}
|
||||
|
||||
@@ -75,10 +75,10 @@ index d1a9b62d3304916275dd6b4c4e783cf1563b5e21..7d90e57b59ca1be1cc64ff6b53c64ea1
|
||||
if (optional.isEmpty()) {
|
||||
return true;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
|
||||
index 1e7f11e5dda502fde6ca122f3edb2d2a161f3469..e57b5a3fddb890efc0245be5efb57c91d1e05f87 100644
|
||||
index f3f98e6276dda3bc4f290fc2d80569f7e1e7ef66..edc127c94a54aed42120a5b4cc7036b5ddc8c656 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
|
||||
@@ -226,7 +226,7 @@ public class PoiManager extends SectionStorage<PoiSection> implements ca.spotted
|
||||
@@ -212,7 +212,7 @@ public class PoiManager extends SectionStorage<PoiSection, PoiSection.Packed> im
|
||||
|
||||
public Stream<PoiRecord> getInSquare(Predicate<Holder<PoiType>> typePredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) {
|
||||
int i = Math.floorDiv(radius, 16) + 1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Tue, 6 Aug 2024 17:53:07 +0800
|
||||
Date: Sat, 30 Nov 2024 11:41:53 +0800
|
||||
Subject: [PATCH] Force disable builtin spark plugin
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ index 48604e7f96adc9e226e034054c5e2bad0b024eb5..99f0c1e4d3437154a1062b0a8f94b7a0
|
||||
return;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index b6489f9da0bf08e5801be1ce668a422610d2b393..db48812e886bc0110a1e098a98a67a5291e8eed3 100644
|
||||
index 04f68856cb3d982f1644d26f5ae57587b6e36ff2..55bac6e6cccce6e0282936ac78bbe82628daa655 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -777,8 +777,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -809,8 +809,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// Paper end - Configurable player collision
|
||||
|
||||
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
|
||||
@@ -32,47 +32,66 @@ index b6489f9da0bf08e5801be1ce668a422610d2b393..db48812e886bc0110a1e098a98a67a52
|
||||
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins
|
||||
io.papermc.paper.command.brigadier.PaperCommands.INSTANCE.setValid(); // Paper - reset invalid state for event fire below
|
||||
io.papermc.paper.plugin.lifecycle.event.LifecycleEventRunner.INSTANCE.callReloadableRegistrarEvent(io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents.COMMANDS, io.papermc.paper.command.brigadier.PaperCommands.INSTANCE, org.bukkit.plugin.Plugin.class, io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent.Cause.INITIAL); // Paper - call commands event for regular plugins
|
||||
@@ -1092,7 +1092,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
MinecraftServer.LOGGER.info("Stopping server");
|
||||
@@ -1126,7 +1126,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
|
||||
MinecraftTimings.stopServer(); // Paper
|
||||
- this.server.spark.disable(); // Paper - spark
|
||||
+ if (false) this.server.spark.disable(); // Paper - spark // Luminol - Force disable builtin spark
|
||||
// CraftBukkit start
|
||||
if (this.server != null) {
|
||||
- this.server.spark.disable(); // Paper - spark
|
||||
+ if (false) this.server.spark.disable(); // Paper - spark // Luminol - Force disable builtin spark
|
||||
this.server.disablePlugins();
|
||||
@@ -1308,7 +1308,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// tasks are default scheduled at -1 + delay, and first tick will tick at 1
|
||||
final long actualDoneTimeMs = System.currentTimeMillis() - org.bukkit.craftbukkit.Main.BOOT_TIME.toEpochMilli(); // Paper - Add total time
|
||||
LOGGER.info("Done ({})! For help, type \"help\"", String.format(java.util.Locale.ROOT, "%.3fs", actualDoneTimeMs / 1000.00D)); // Paper - Add total time
|
||||
this.server.waitForAsyncTasksShutdown(); // Paper - Wait for Async Tasks during shutdown
|
||||
}
|
||||
@@ -1323,7 +1323,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.statusIcon = (ServerStatus.Favicon) this.loadStatusIcon().orElse(null); // CraftBukkit - decompile error
|
||||
this.status = this.buildServerStatus();
|
||||
|
||||
- this.server.spark.enableBeforePlugins(); // Paper - spark
|
||||
+ if (false) this.server.spark.enableBeforePlugins(); // Paper - spark // Luminol - Force disable builtin spark
|
||||
org.spigotmc.WatchdogThread.tick();
|
||||
// Paper end - Improved Watchdog Support
|
||||
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
|
||||
@@ -1671,7 +1671,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
BooleanSupplier shouldKeepTicking = () -> {
|
||||
return scheduledEnd - System.nanoTime() > targetBuffer;
|
||||
// Folia start - region threading
|
||||
if (true) {
|
||||
io.papermc.paper.threadedregions.RegionizedServer.getInstance().init(); // Folia - region threading - only after loading worlds
|
||||
@@ -1728,7 +1728,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
if (this.emptyTicks >= j) {
|
||||
- this.server.spark.tickStart(); // Paper - spark
|
||||
+ if (false)this.server.spark.tickStart(); // Paper - spark // Luminol - Force disable builtin spark
|
||||
if (this.emptyTicks == j) {
|
||||
MinecraftServer.LOGGER.info("Server empty for {} seconds, pausing", this.pauseWhileEmptySeconds());
|
||||
this.autoSave();
|
||||
@@ -1747,7 +1747,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// Paper end - avoid issues with certain tasks not processing during sleep
|
||||
// Folia - region threading
|
||||
this.tickConnection();
|
||||
- this.server.spark.tickEnd(((double)(System.nanoTime() - lastTick) / 1000000D)); // Paper - spark
|
||||
+ if (false) this.server.spark.tickEnd(((double)(System.nanoTime() - lastTick) / 1000000D)); // Paper - spark // Luminol - Force disable builtin spark
|
||||
+ // Paper end - Server Tick Events
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1772,7 +1773,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
};
|
||||
- this.server.spark.tickStart(); // Paper - spark
|
||||
+ if (false)this.server.spark.tickStart(); // Paper - spark // Luminol - Force disable builtin spark
|
||||
new com.destroystokyo.paper.event.server.ServerTickStartEvent((int)region.getCurrentTick()).callEvent(); // Paper
|
||||
// Folia end - region threading
|
||||
co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper
|
||||
@@ -1757,7 +1757,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
long endTime = System.nanoTime();
|
||||
|
||||
- this.server.spark.tickStart(); // Paper - spark
|
||||
+ if (false) this.server.spark.tickStart(); // Paper - spark // Luminol - Force disable builtin spark
|
||||
new com.destroystokyo.paper.event.server.ServerTickStartEvent((int)region.getCurrentTick()).callEvent(); // Paper - Server Tick Events // Folia - region threading
|
||||
// Folia start - region threading
|
||||
if (region != null) {
|
||||
@@ -1843,7 +1844,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
long remaining = scheduledEnd - endTime; // Folia - region ticking
|
||||
new com.destroystokyo.paper.event.server.ServerTickEndEvent((int)io.papermc.paper.threadedregions.RegionizedServer.getCurrentTick(), ((double)(endTime - startTime) / 1000000D), remaining).callEvent(); // Folia - region ticking
|
||||
// Paper end - Server Tick Events
|
||||
- this.server.spark.tickEnd(((double)(endTime - startTime) / 1000000D)); // Paper - spark // Folia - region ticking
|
||||
+ if (false) this.server.spark.tickEnd(((double)(endTime - startTime) / 1000000D)); // Paper - spark // Folia - region ticking // Luminol - Force disable builtin spark
|
||||
// Paper end - Server Tick Events
|
||||
this.profiler.push("tallying");
|
||||
gameprofilerfiller.push("tallying");
|
||||
// Folia - region threading
|
||||
gameprofilerfiller.pop();
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 79b79a5d41dc3568ae6a3d7701e6ac6b91045e36..cd28f741343c443ff4728fc0aa5526b6d66d2d9b 100644
|
||||
index 295504dab771c8bb8c668545fe5d62eae0561b76..49b4ef6457743b5f955bff70694378d4975e44a7 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -228,7 +228,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -225,7 +225,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
// Paper end - initialize global and world-defaults configuration
|
||||
me.earthme.luminol.config.LuminolConfig.loadConfig(); //Luminol - load config file
|
||||
me.earthme.luminol.config.LuminolConfig.setupLatch(); //Luminol - load config file
|
||||
@@ -81,7 +100,7 @@ index 79b79a5d41dc3568ae6a3d7701e6ac6b91045e36..cd28f741343c443ff4728fc0aa5526b6
|
||||
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
|
||||
if (this.convertOldUsers()) {
|
||||
this.getProfileCache().save(false); // Paper
|
||||
@@ -238,7 +238,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -235,7 +235,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
|
||||
thread.start(); // Paper - Enhance console tab completions for brigadier commands; start console thread after MinecraftServer.console & PaperConfig are initialized
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
|
||||
@@ -91,10 +110,10 @@ index 79b79a5d41dc3568ae6a3d7701e6ac6b91045e36..cd28f741343c443ff4728fc0aa5526b6
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index dee23b4b96b7f2c6af54a6affe385b183479f8cc..07c6f858596e4926397b467ef5e22cab7e7f999b 100644
|
||||
index 567e12e24ece2cd823b73e7337b10eb89995da21..20cf4ce4f73f681bdbe092d4693812800c953be9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -309,7 +309,7 @@ public final class CraftServer implements Server {
|
||||
@@ -312,7 +312,7 @@ public final class CraftServer implements Server {
|
||||
public static Exception excessiveVelEx; // Paper - Velocity warnings
|
||||
private final io.papermc.paper.logging.SysoutCatcher sysoutCatcher = new io.papermc.paper.logging.SysoutCatcher(); // Paper
|
||||
private final io.papermc.paper.potion.PaperPotionBrewer potionBrewer; // Paper - Custom Potion Mixes
|
||||
@@ -103,7 +122,7 @@ index dee23b4b96b7f2c6af54a6affe385b183479f8cc..07c6f858596e4926397b467ef5e22cab
|
||||
|
||||
// Paper start - Folia region threading API
|
||||
private final io.papermc.paper.threadedregions.scheduler.FoliaRegionScheduler regionizedScheduler = new io.papermc.paper.threadedregions.scheduler.FoliaRegionScheduler(); // Folia - region threading
|
||||
@@ -482,7 +482,7 @@ public final class CraftServer implements Server {
|
||||
@@ -490,7 +490,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
this.potionBrewer = new io.papermc.paper.potion.PaperPotionBrewer(console); // Paper - custom potion mixes
|
||||
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
|
||||
@@ -112,7 +131,7 @@ index dee23b4b96b7f2c6af54a6affe385b183479f8cc..07c6f858596e4926397b467ef5e22cab
|
||||
}
|
||||
|
||||
public boolean getCommandBlockOverride(String command) {
|
||||
@@ -1146,7 +1146,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1154,7 +1154,7 @@ public final class CraftServer implements Server {
|
||||
this.reloadData();
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
@@ -121,7 +140,7 @@ index dee23b4b96b7f2c6af54a6affe385b183479f8cc..07c6f858596e4926397b467ef5e22cab
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
@@ -1175,7 +1175,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1183,7 +1183,7 @@ public final class CraftServer implements Server {
|
||||
this.loadPlugins();
|
||||
this.enablePlugins(PluginLoadOrder.STARTUP);
|
||||
this.enablePlugins(PluginLoadOrder.POSTWORLD);
|
||||
@@ -1,151 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 31 Jul 2024 12:33:32 +0800
|
||||
Subject: [PATCH] Prevent teleportAsync calling during moving event being
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/fixes/FoliaTeleportAsyncFixConfig.java b/src/main/java/me/earthme/luminol/config/modules/fixes/FoliaTeleportAsyncFixConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8f1449545d6d217b46a9ffae705123daefe55b25
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/fixes/FoliaTeleportAsyncFixConfig.java
|
||||
@@ -0,0 +1,24 @@
|
||||
+package me.earthme.luminol.config.modules.fixes;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class FoliaTeleportAsyncFixConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled", comments =
|
||||
+ "A fix which fixed some bugs of teleportAsync " +
|
||||
+ "that caused by plugins(such as Residence)")
|
||||
+ public static boolean enabled = false;
|
||||
+ @ConfigInfo(baseName = "throw_on_detected")
|
||||
+ public static boolean throwOnDetected = true;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.FIXES;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "folia.prevent_teleportasync_call_during_moving";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index d57fd6e4aacb611526a741fbd98165f124b7b8ef..8cfaa94da67bcdd5c3d30479379d384c20b4a1ac 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -335,6 +335,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
}
|
||||
// Paper end - rewrite chunk system
|
||||
|
||||
+ //Luminol start - Prevent teleportAsync calling during moving event being handled
|
||||
+ public boolean handlingMoveEvent = false;
|
||||
+ //Luminol end
|
||||
+
|
||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
|
||||
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
||||
this.chatVisibility = ChatVisiblity.FULL;
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 18d9e92f2fdc2cb25229005ffc08bffe555e0583..f0e063afa941aae051e950808fa7435e52d39456 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -695,7 +695,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
|
||||
Location oldTo = to.clone();
|
||||
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
|
||||
+ this.player.handlingMoveEvent = true; //Luminol - Prevent teleportAsync calling during moving event being handled
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
+ this.player.handlingMoveEvent = false; //Luminol - Prevent teleportAsync calling during moving event being handled
|
||||
|
||||
// If the event is cancelled we move the player back to their old location.
|
||||
if (event.isCancelled()) {
|
||||
@@ -1609,7 +1611,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
|
||||
Location oldTo = to.clone();
|
||||
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
|
||||
+ this.player.handlingMoveEvent = true; //Luminol - Prevent teleportAsync calling during moving event being handled
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
+ this.player.handlingMoveEvent = false; //Luminol - Prevent teleportAsync calling during moving event being handled
|
||||
|
||||
// If the event is cancelled we move the player back to their old location.
|
||||
if (event.isCancelled()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 25a5f36ff19ff3f9cea051a1a6bf671b6288b799..bacc88b735619998927c59ce7b828bfff7574fa8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -4075,6 +4075,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
java.util.function.Consumer<Entity> teleportComplete) {
|
||||
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this, "Cannot teleport entity async");
|
||||
|
||||
+ //Luminol start - Prevent teleportAsync calling during moving event being handled
|
||||
+ if (this instanceof ServerPlayer player && me.earthme.luminol.config.modules.fixes.FoliaTeleportAsyncFixConfig.enabled){
|
||||
+ if (player.handlingMoveEvent){
|
||||
+ if (me.earthme.luminol.config.modules.fixes.FoliaTeleportAsyncFixConfig.throwOnDetected){
|
||||
+ throw new IllegalStateException("Player " + player.getScoreboardName() + " is trying to teleport to " + pos + " during move event handling!");
|
||||
+ }
|
||||
+ MinecraftServer.LOGGER.warn("Player {} is trying to teleport to {} during move event handling!",player.getScoreboardName(),pos);
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ //Luminol end
|
||||
+
|
||||
if (!ServerLevel.isInSpawnableBounds(new BlockPos(ca.spottedleaf.moonrise.common.util.CoordinateUtils.getBlockX(pos), ca.spottedleaf.moonrise.common.util.CoordinateUtils.getBlockY(pos), ca.spottedleaf.moonrise.common.util.CoordinateUtils.getBlockZ(pos)))) {
|
||||
return false;
|
||||
}
|
||||
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 a38ce400550893f63640e3bb5bb801ab40f06266..236e87790fe9357d948af40d411af56d958132c9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
@@ -375,7 +375,21 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
||||
this.level().getCraftServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle));
|
||||
|
||||
if (!from.equals(to)) {
|
||||
+ //Luminol start - Prevent teleportAsync calling during moving event being handled
|
||||
+ for (Entity passenger : this.getPassengers()) {
|
||||
+ if (passenger instanceof net.minecraft.server.level.ServerPlayer player){
|
||||
+ player.handlingMoveEvent = true;
|
||||
+ }
|
||||
+ }
|
||||
+ //Luminol end
|
||||
this.level().getCraftServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleMoveEvent(vehicle, from, to));
|
||||
+ //Luminol start - Prevent teleportAsync calling during moving event being handled
|
||||
+ for (Entity passenger : this.getPassengers()) {
|
||||
+ if (passenger instanceof net.minecraft.server.level.ServerPlayer player){
|
||||
+ player.handlingMoveEvent = false;
|
||||
+ }
|
||||
+ }
|
||||
+ //Luminol end
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (this.getMinecartType() == AbstractMinecart.Type.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
index f1955afc8e367f80ead85bd5ad3b8d66c255565a..19c19532947f785c8538f5bbdc6a88f6e09efbab 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
@@ -374,8 +374,22 @@ public class Boat extends VehicleEntity implements Leashable, VariantHolder<Boat
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle));
|
||||
|
||||
if (this.lastLocation != null && !this.lastLocation.equals(to)) {
|
||||
+ //Luminol start - Prevent teleportAsync calling during moving event being handled
|
||||
+ for (Entity passenger : this.getPassengers()) {
|
||||
+ if (passenger instanceof net.minecraft.server.level.ServerPlayer player){
|
||||
+ player.handlingMoveEvent = true;
|
||||
+ }
|
||||
+ }
|
||||
+ //Luminol end
|
||||
VehicleMoveEvent event = new VehicleMoveEvent(vehicle, this.lastLocation, to);
|
||||
server.getPluginManager().callEvent(event);
|
||||
+ //Luminol start - Prevent teleportAsync calling during moving event being handled
|
||||
+ for (Entity passenger : this.getPassengers()) {
|
||||
+ if (passenger instanceof net.minecraft.server.level.ServerPlayer player){
|
||||
+ player.handlingMoveEvent = false;
|
||||
+ }
|
||||
+ }
|
||||
+ //Luminol end
|
||||
}
|
||||
this.lastLocation = vehicle.getLocation();
|
||||
// CraftBukkit end
|
||||
@@ -1,123 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Fri, 2 Aug 2024 22:22:18 +0800
|
||||
Subject: [PATCH] Try optimizing the task dispatching
|
||||
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/concurrentutil/scheduler/SchedulerThreadPool.java b/src/main/java/ca/spottedleaf/concurrentutil/scheduler/SchedulerThreadPool.java
|
||||
index 8197ccb1c4e5878dbd8007b5fb514640765ec8e4..81db3c6f330729cb353b198badc86fe29e76bafc 100644
|
||||
--- a/src/main/java/ca/spottedleaf/concurrentutil/scheduler/SchedulerThreadPool.java
|
||||
+++ b/src/main/java/ca/spottedleaf/concurrentutil/scheduler/SchedulerThreadPool.java
|
||||
@@ -366,6 +366,12 @@ public class SchedulerThreadPool {
|
||||
"scheduled_state=" + this.scheduled.get() + ","
|
||||
+ "}";
|
||||
}
|
||||
+
|
||||
+ // Luminol start
|
||||
+ protected boolean flushExtraTask(){
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Luminol end
|
||||
}
|
||||
|
||||
private static final class TickThreadRunner implements Runnable {
|
||||
@@ -526,7 +532,7 @@ public class SchedulerThreadPool {
|
||||
if (diff <= 0L) {
|
||||
break;
|
||||
}
|
||||
- LockSupport.parkNanos(startState, diff);
|
||||
+ if (!me.earthme.luminol.config.modules.experiment.ExtraOptimizationConfig.enabled || !startStateTask.flushExtraTask()) LockSupport.parkNanos(startState, 1_000); // Luminol - Optimize task dispatching
|
||||
if (this.scheduler.halted) {
|
||||
return;
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/ThreadedRegionizer.java b/src/main/java/io/papermc/paper/threadedregions/ThreadedRegionizer.java
|
||||
index ce388e0ef231d7d73f75f5778c58eb40f6402f0f..7f8473a6db78dc652e0ccfdb7cc038126f1e61ea 100644
|
||||
--- a/src/main/java/io/papermc/paper/threadedregions/ThreadedRegionizer.java
|
||||
+++ b/src/main/java/io/papermc/paper/threadedregions/ThreadedRegionizer.java
|
||||
@@ -682,7 +682,7 @@ public final class ThreadedRegionizer<R extends ThreadedRegionizer.ThreadedRegio
|
||||
|
||||
public final long id;
|
||||
|
||||
- private int state;
|
||||
+ public int state; // Luminol - Optimize task dispatching
|
||||
|
||||
private final Long2ReferenceOpenHashMap<ThreadedRegionSection<R, S>> sectionByKey = new Long2ReferenceOpenHashMap<>();
|
||||
private final ReferenceOpenHashSet<ThreadedRegionSection<R, S>> deadSections = new ReferenceOpenHashSet<>();
|
||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java b/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||
index 056fb1ca7b07d5e713dcbd951830b14fc9025f4c..4bfa83a6683970657eaaaaa265855f0d2e79a3a9 100644
|
||||
--- a/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||
+++ b/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||
@@ -364,6 +364,47 @@ public final class TickRegionScheduler {
|
||||
return !this.markNotTicking() || this.cancelled.get() ? null : Boolean.valueOf(ret);
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public boolean flushExtraTask(){
|
||||
+ if (this.cancelled.get()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (!this.tryMarkTicking()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (this.cancelled.get()) {
|
||||
+ this.markNotTicking();
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (this.region != null) {
|
||||
+ TickRegionScheduler.setTickingRegion(this.region.region);
|
||||
+ }
|
||||
+
|
||||
+ try {
|
||||
+ if (this.region == null){
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (this.region.region.getData().getTaskQueueData().executeChunkTask()){
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (this.region.region.getData().getTaskQueueData().executeTickTask()){
|
||||
+ return true;
|
||||
+ }
|
||||
+ }finally {
|
||||
+ this.markNotTicking();
|
||||
+ if (this.region != null) {
|
||||
+ TickRegionScheduler.setTickingRegion(null);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public final boolean runTick() {
|
||||
// Remember, we are supposed use setScheduledStart if we return true here, otherwise
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/experiment/ExtraOptimizationConfig.java b/src/main/java/me/earthme/luminol/config/modules/experiment/ExtraOptimizationConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d908123da05c620586a1defcead423cc519113e9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/experiment/ExtraOptimizationConfig.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package me.earthme.luminol.config.modules.experiment;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class ExtraOptimizationConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ public static boolean enabled = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.EXPERIMENT;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "run_extra_tasks_during_waiting";
|
||||
+ }
|
||||
+}
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Mon, 5 Aug 2024 14:48:18 +0800
|
||||
Date: Sat, 30 Nov 2024 11:48:36 +0800
|
||||
Subject: [PATCH] Kaiiju Vanilla end portal teleportation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index bacc88b735619998927c59ce7b828bfff7574fa8..87c2bb5794cf87a5f048779633de0d0bf2f16d5d 100644
|
||||
index 4fdbdd1c5c937c20026afe555fa1c8371b4eaa16..64e081f993c2c844f83af227380b8a957eaabad4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -109,6 +109,7 @@ import net.minecraft.world.level.block.Rotation;
|
||||
@@ -114,6 +114,7 @@ import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.border.WorldBorder;
|
||||
@@ -16,9 +16,9 @@ index bacc88b735619998927c59ce7b828bfff7574fa8..87c2bb5794cf87a5f048779633de0d0b
|
||||
import net.minecraft.world.level.entity.EntityAccess;
|
||||
import net.minecraft.world.level.entity.EntityInLevelCallback;
|
||||
import net.minecraft.world.level.gameevent.DynamicGameEventListener;
|
||||
@@ -4230,13 +4231,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -4458,13 +4459,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
targetPos, 16, // load 16 blocks to be safe from block physics
|
||||
ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.HIGH,
|
||||
ca.spottedleaf.concurrentutil.util.Priority.HIGH,
|
||||
(chunks) -> {
|
||||
- net.minecraft.world.level.levelgen.feature.EndPlatformFeature.createEndPlatform(destination, targetPos.below(), true, null);
|
||||
+ //net.minecraft.world.level.levelgen.feature.EndPlatformFeature.createEndPlatform(destination, targetPos.below(), true, null); // Kaiiju - Vanilla end teleportation - moved down
|
||||
@@ -31,13 +31,13 @@ index bacc88b735619998927c59ce7b828bfff7574fa8..87c2bb5794cf87a5f048779633de0d0b
|
||||
// the portal obsidian is placed at targetPos.y - 2, so if we want to place the entity
|
||||
// on the obsidian, we need to spawn at targetPos.y - 1
|
||||
portalInfoCompletable.complete(
|
||||
new net.minecraft.world.level.portal.DimensionTransition(
|
||||
new net.minecraft.world.level.portal.TeleportTransition(
|
||||
- destination, Vec3.atBottomCenterOf(targetPos.below()), Vec3.ZERO, 90.0f, 0.0f,
|
||||
+ destination, finalPos, this.getDeltaMovement(), 90.0f, 0.0f, // Kaiiju - Vanilla end teleportation
|
||||
DimensionTransition.PLAY_PORTAL_SOUND.then(DimensionTransition.PLACE_PORTAL_TICKET),
|
||||
TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET),
|
||||
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL
|
||||
)
|
||||
@@ -4433,6 +4439,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -4660,6 +4666,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
if (!this.canPortalAsync(destination, takePassengers)) {
|
||||
return false;
|
||||
}
|
||||
@@ -48,8 +48,8 @@ index bacc88b735619998927c59ce7b828bfff7574fa8..87c2bb5794cf87a5f048779633de0d0b
|
||||
|
||||
Vec3 initialPosition = this.position();
|
||||
ChunkPos initialPositionChunk = new ChunkPos(
|
||||
@@ -4497,9 +4507,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
info.postDimensionTransition().onTransition(teleported);
|
||||
@@ -4724,9 +4734,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
info.postTeleportTransition().onTransition(teleported);
|
||||
}
|
||||
|
||||
- if (teleportComplete != null) {
|
||||
@@ -1,20 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Tue, 6 Aug 2024 21:06:31 +0800
|
||||
Subject: [PATCH] Check allow before getting block state while tripwire state
|
||||
updating
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
index 76aca266d3f3222502ff4c196228f08fcd88c5f8..82a6d0e3620aea26cd32296128488e13b6d43f44 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
@@ -202,7 +202,7 @@ public class TripWireHookBlock extends Block {
|
||||
BlockState iblockdata4 = aiblockdata[l];
|
||||
|
||||
if (iblockdata4 != null) {
|
||||
- if (world.getBlockState(blockposition2).is(Blocks.TRIPWIRE) || io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowTripwireDisarmingExploits) { // Paper - Fix tripwire disarming not working as intended
|
||||
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowTripwireDisarmingExploits || world.getBlockState(blockposition2).is(Blocks.TRIPWIRE)) { // Paper - Fix tripwire disarming not working as intended // Luminol - check allow first
|
||||
world.setBlock(blockposition2, (BlockState) iblockdata4.trySetValue(TripWireHookBlock.ATTACHED, flag4), 3);
|
||||
}
|
||||
}
|
||||
330
patches/server/0025-Kaiiju-Entity-tick-and-removal-limiter.patch
Normal file
330
patches/server/0025-Kaiiju-Entity-tick-and-removal-limiter.patch
Normal file
@@ -0,0 +1,330 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 4 Dec 2024 23:39:18 +0800
|
||||
Subject: [PATCH] Kaiiju Entity tick and removal limiter
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 8f23bf19618382ccf5fd10a0b17b57cd445dea58..4b79f96103c98896332113ffe5f0e22cf08ffdd1 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -27,6 +27,7 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider {
|
||||
dependencies {
|
||||
implementation(project(":luminol-api")) // Folia // Luminol
|
||||
implementation("com.electronwill.night-config:toml:3.6.6") // Luminol - Night config
|
||||
+ implementation("io.github.classgraph:classgraph:4.8.158") // Kaiiju - Entity throttling & Removal
|
||||
implementation("ca.spottedleaf:concurrentutil:0.0.2") // Paper - Add ConcurrentUtil dependency
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityLimits.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityLimits.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..40e80fc685a42bbaeea3e6e64754121178cc7d22
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityLimits.java
|
||||
@@ -0,0 +1,141 @@
|
||||
+package dev.kaiijumc.kaiiju;
|
||||
+
|
||||
+import java.io.File;
|
||||
+import java.io.IOException;
|
||||
+import java.util.Map;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.logging.Level;
|
||||
+
|
||||
+import com.google.common.base.Throwables;
|
||||
+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
+import io.github.classgraph.ClassGraph;
|
||||
+import io.github.classgraph.ClassInfo;
|
||||
+import io.github.classgraph.ScanResult;
|
||||
+import org.slf4j.Logger;
|
||||
+
|
||||
+import com.mojang.logging.LogUtils;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.configuration.InvalidConfigurationException;
|
||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||
+
|
||||
+@SuppressWarnings("unused")
|
||||
+public class KaiijuEntityLimits {
|
||||
+ private static final Logger LOGGER = LogUtils.getLogger();
|
||||
+ private static final File CONFIG_FOLDER = new File("luminol_config");
|
||||
+
|
||||
+ protected static final String HEADER =
|
||||
+ "Per region entity limits for Kaiiju.\n"
|
||||
+ + "If there are more of particular entity type in a region than limit, entity ticking will be throttled.\n"
|
||||
+ + "Example: for Wither limit 100 & 300 Withers in a region -> 100 Withers tick every tick & every Wither ticks every 3 ticks.\n"
|
||||
+ + "Available entities: GlowSquid, Ambient, Bat, Animal, Bee, Cat, Chicken, Cod, Cow, Dolphin, Fish, FishSchool, Fox, Golem, IronGolem, "
|
||||
+ + "MushroomCow, Ocelot, Panda, Parrot, Perchable, Pig, PolarBear, PufferFish, Rabbit, Salmon, Sheep, Snowman, Squid, TropicalFish, Turtle, "
|
||||
+ + "WaterAnimal, Wolf, Allay, Axolotl, Camel, Frog, Tadpole, Goat, Horse, HorseAbstract, HorseChestedAbstract, HorseDonkey, HorseMule, "
|
||||
+ + "HorseSkeleton, HorseZombie, Llama, LlamaTrader, Sniffer, EnderCrystal, EnderDragon, Wither, ArmorStand, Hanging, ItemFrame, Leash, "
|
||||
+ + "Painting, GlowItemFrame, FallingBlock, Item, TNTPrimed, Blaze, CaveSpider, Creeper, Drowned, Enderman, Endermite, Evoker, Ghast, "
|
||||
+ + "GiantZombie, Guardian, GuardianElder, IllagerAbstract, IllagerIllusioner, IllagerWizard, MagmaCube, Monster, MonsterPatrolling, Phantom, "
|
||||
+ + "PigZombie, Pillager, Ravager, Shulker, Silverfish, Skeleton, SkeletonAbstract, SkeletonStray, SkeletonWither, Slime, Spider, Strider, Vex, "
|
||||
+ + "Vindicator, Witch, Zoglin, Zombie, ZombieHusk, ZombieVillager, Hoglin, Piglin, PiglinAbstract, PiglinBrute, Warden, Villager, "
|
||||
+ + "VillagerTrader, Arrow, DragonFireball, Egg, EnderPearl, EnderSignal, EvokerFangs, Fireball, FireballFireball, Fireworks, FishingHook, "
|
||||
+ + "LargeFireball, LlamaSpit, Potion, Projectile, ProjectileThrowable, ShulkerBullet, SmallFireball, Snowball, SpectralArrow, ThrownExpBottle, "
|
||||
+ + "ThrownTrident, TippedArrow, WitherSkull, Raider, ChestBoat, Boat, MinecartAbstract, MinecartChest, MinecartCommandBlock, MinecartContainer, "
|
||||
+ + "MinecartFurnace, MinecartHopper, MinecartMobSpawner, MinecartRideable, MinecartTNT\n";
|
||||
+ protected static final File ENTITY_LIMITS_FILE = new File(CONFIG_FOLDER, "kaiiju_entity_limits.yml");
|
||||
+ public static YamlConfiguration entityLimitsConfig;
|
||||
+ public static boolean enabled = false;
|
||||
+
|
||||
+ protected static Map<Class<? extends Entity>, EntityLimit> entityLimits;
|
||||
+
|
||||
+ static final String ENTITY_PREFIX = "Entity";
|
||||
+
|
||||
+ public static void init() {
|
||||
+ init(true);
|
||||
+ }
|
||||
+
|
||||
+ private static void init(boolean setup) {
|
||||
+ entityLimitsConfig = new YamlConfiguration();
|
||||
+
|
||||
+ if (ENTITY_LIMITS_FILE.exists()) {
|
||||
+ try {
|
||||
+ entityLimitsConfig.load(ENTITY_LIMITS_FILE);
|
||||
+ } catch (InvalidConfigurationException ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not load kaiiju_entity_limits.yml, please correct your syntax errors", ex);
|
||||
+ throw Throwables.propagate(ex);
|
||||
+ } catch (IOException ignore) {}
|
||||
+ } else {
|
||||
+ if (setup) {
|
||||
+ entityLimitsConfig.options().header(HEADER);
|
||||
+ entityLimitsConfig.options().copyDefaults(true);
|
||||
+ entityLimitsConfig.set("enabled", enabled);
|
||||
+ entityLimitsConfig.set("Axolotl.limit", 1000);
|
||||
+ entityLimitsConfig.set("Axolotl.removal", 2000);
|
||||
+ try {
|
||||
+ entityLimitsConfig.save(ENTITY_LIMITS_FILE);
|
||||
+ } catch (IOException ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not save " + ENTITY_LIMITS_FILE, ex);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ enabled = entityLimitsConfig.getBoolean("enabled");
|
||||
+
|
||||
+ entityLimits = new Object2ObjectOpenHashMap<>();
|
||||
+ try (ScanResult scanResult = new ClassGraph().enableAllInfo().acceptPackages("net.minecraft.world.entity").scan()) {
|
||||
+ Map<String, ClassInfo> entityClasses = new HashMap<>();
|
||||
+ for (ClassInfo classInfo : scanResult.getAllClasses()) {
|
||||
+ Class<?> entityClass = Class.forName(classInfo.getName());
|
||||
+ if (Entity.class.isAssignableFrom(entityClass)) {
|
||||
+ String entityName = extractEntityName(entityClass.getSimpleName());
|
||||
+ entityClasses.put(entityName, classInfo);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (String key : entityLimitsConfig.getKeys(false)) {
|
||||
+ if (key.equals("enabled")) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (!entityClasses.containsKey(key)) {
|
||||
+ LOGGER.error("Unknown entity '" + key + "' in kaiiju-entity-limits.yml, skipping");
|
||||
+ continue;
|
||||
+ }
|
||||
+ int limit = entityLimitsConfig.getInt(key + ".limit");
|
||||
+ int removal = entityLimitsConfig.getInt(key + ".removal");
|
||||
+
|
||||
+ if (limit < 1) {
|
||||
+ LOGGER.error(key + " has a limit less than the minimum of 1, ignoring");
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (removal <= limit && removal != -1) {
|
||||
+ LOGGER.error(key + " has a removal limit that is less than or equal to its limit, setting removal to limit * 10");
|
||||
+ removal = limit * 10;
|
||||
+ }
|
||||
+
|
||||
+ entityLimits.put((Class<? extends Entity>) Class.forName(entityClasses.get(key).getName()), new EntityLimit(limit, removal));
|
||||
+ }
|
||||
+ } catch (ClassNotFoundException e) {
|
||||
+ e.printStackTrace();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static EntityLimit getEntityLimit(Entity entity) {
|
||||
+ return entityLimits.get(entity.getClass());
|
||||
+ }
|
||||
+
|
||||
+ private static String extractEntityName(String input) {
|
||||
+ int prefixLength = ENTITY_PREFIX.length();
|
||||
+
|
||||
+ if (input.length() <= prefixLength || !input.startsWith(ENTITY_PREFIX)) {
|
||||
+ return input;
|
||||
+ } else {
|
||||
+ return input.substring(prefixLength);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public record EntityLimit(int limit, int removal) {
|
||||
+ @Override
|
||||
+ public String toString() {
|
||||
+ return "EntityLimit{limit=" + limit + ", removal=" + removal + "}";
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityThrottler.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityThrottler.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..eb690efacf083e4ff3e321578b12c534e6a40196
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityThrottler.java
|
||||
@@ -0,0 +1,84 @@
|
||||
+package dev.kaiijumc.kaiiju;
|
||||
+
|
||||
+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
+import io.papermc.paper.threadedregions.RegionizedWorldData;
|
||||
+
|
||||
+public class KaiijuEntityThrottler {
|
||||
+ private static class TickInfo {
|
||||
+ int currentTick;
|
||||
+ int continueFrom;
|
||||
+ int toTick;
|
||||
+ int toRemove;
|
||||
+ }
|
||||
+
|
||||
+ public static class EntityThrottlerReturn {
|
||||
+ public boolean skip;
|
||||
+ public boolean remove;
|
||||
+ }
|
||||
+
|
||||
+ private final Object2ObjectOpenHashMap<KaiijuEntityLimits.EntityLimit, TickInfo> entityLimitTickInfoMap = new Object2ObjectOpenHashMap<>();
|
||||
+
|
||||
+ public void tickLimiterStart() {
|
||||
+ for (TickInfo tickInfo : entityLimitTickInfoMap.values()) {
|
||||
+ tickInfo.currentTick = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public EntityThrottlerReturn tickLimiterShouldSkip(Entity entity) {
|
||||
+ EntityThrottlerReturn retVal = new EntityThrottlerReturn();
|
||||
+ if (entity.isRemoved()) return retVal;
|
||||
+ KaiijuEntityLimits.EntityLimit entityLimit = KaiijuEntityLimits.getEntityLimit(entity);
|
||||
+
|
||||
+ if (entityLimit != null) {
|
||||
+ TickInfo tickInfo = entityLimitTickInfoMap.computeIfAbsent(entityLimit, el -> {
|
||||
+ TickInfo newTickInfo = new TickInfo();
|
||||
+ newTickInfo.toTick = entityLimit.limit();
|
||||
+ return newTickInfo;
|
||||
+ });
|
||||
+
|
||||
+ tickInfo.currentTick++;
|
||||
+ if (tickInfo.currentTick <= tickInfo.toRemove && entityLimit.removal() > 0) {
|
||||
+ retVal.skip = false;
|
||||
+ retVal.remove = true;
|
||||
+ return retVal;
|
||||
+ }
|
||||
+
|
||||
+ if (tickInfo.currentTick < tickInfo.continueFrom) {
|
||||
+ retVal.skip = true;
|
||||
+ return retVal;
|
||||
+ }
|
||||
+ if (tickInfo.currentTick - tickInfo.continueFrom < tickInfo.toTick) {
|
||||
+ retVal.skip = false;
|
||||
+ return retVal;
|
||||
+ }
|
||||
+ retVal.skip = true;
|
||||
+ return retVal;
|
||||
+ } else {
|
||||
+ retVal.skip = false;
|
||||
+ return retVal;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void tickLimiterFinish(RegionizedWorldData regionizedWorldData) {
|
||||
+ for (var entry : entityLimitTickInfoMap.entrySet()) {
|
||||
+ KaiijuEntityLimits.EntityLimit entityLimit = entry.getKey();
|
||||
+ TickInfo tickInfo = entry.getValue();
|
||||
+
|
||||
+ int additionals = 0;
|
||||
+ int nextContinueFrom = tickInfo.continueFrom + tickInfo.toTick;
|
||||
+ if (nextContinueFrom >= tickInfo.currentTick) {
|
||||
+ additionals = entityLimit.limit() - (tickInfo.currentTick - tickInfo.continueFrom);
|
||||
+ nextContinueFrom = 0;
|
||||
+ }
|
||||
+ tickInfo.continueFrom = nextContinueFrom;
|
||||
+ tickInfo.toTick = entityLimit.limit() + additionals;
|
||||
+
|
||||
+ if (tickInfo.toRemove == 0 && tickInfo.currentTick > entityLimit.removal()) {
|
||||
+ tickInfo.toRemove = tickInfo.currentTick - entityLimit.removal();
|
||||
+ } else if (tickInfo.toRemove != 0) {
|
||||
+ tickInfo.toRemove = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/RegionizedWorldData.java b/src/main/java/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
index 1b741d4bccfd45beeec43300f44770516c0d850e..3c37ad27488486f9bb0f972369ccaee2284df673 100644
|
||||
--- a/src/main/java/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
+++ b/src/main/java/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
@@ -354,6 +354,7 @@ public final class RegionizedWorldData {
|
||||
private final IteratorSafeOrderedReferenceSet<Mob> navigatingMobs = new IteratorSafeOrderedReferenceSet<>();
|
||||
public final ReferenceList<Entity> trackerEntities = new ReferenceList<>(EMPTY_ENTITY_ARRAY); // Moonrise - entity tracker
|
||||
public final ReferenceList<Entity> trackerUnloadedEntities = new ReferenceList<>(EMPTY_ENTITY_ARRAY); // Moonrise - entity tracker
|
||||
+ public final dev.kaiijumc.kaiiju.KaiijuEntityThrottler entityThrottler = new dev.kaiijumc.kaiiju.KaiijuEntityThrottler(); // Kaiiju
|
||||
|
||||
// block ticking
|
||||
private final ObjectLinkedOpenHashSet<BlockEventData> blockEvents = new ObjectLinkedOpenHashSet<>();
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/misc/KaiijuEntityLimiterConfig.java b/src/main/java/me/earthme/luminol/config/modules/misc/KaiijuEntityLimiterConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..038d9ab60cfac7e40e7c0c0644fa0a0d035eac01
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/KaiijuEntityLimiterConfig.java
|
||||
@@ -0,0 +1,23 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
+import dev.kaiijumc.kaiiju.KaiijuEntityLimits;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class KaiijuEntityLimiterConfig implements IConfigModule {
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.MISC;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "kaiiju_entity_limiter";
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onLoaded(CommentedFileConfig configInstance) {
|
||||
+ KaiijuEntityLimits.init();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 07037eb601f9dcae2cad5f3e3d5f9a0ac142b68a..5503d506c595296ecad09a3ce4497a365f216af5 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -811,6 +811,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
}
|
||||
|
||||
profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.ACTIVATE_ENTITIES); try { // Folia - profiler
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuEntityLimits.enabled) regionizedWorldData.entityThrottler.tickLimiterStart(); // Kaiiju
|
||||
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
||||
} finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.ACTIVATE_ENTITIES); } // Folia - profiler
|
||||
profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.ENTITY_TICK); try { // Folia - profiler
|
||||
@@ -832,6 +833,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
entity.stopRiding();
|
||||
}
|
||||
|
||||
+ // Kaiiju start
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuEntityLimits.enabled) {
|
||||
+ dev.kaiijumc.kaiiju.KaiijuEntityThrottler.EntityThrottlerReturn throttle = regionizedWorldData.entityThrottler.tickLimiterShouldSkip(entity);
|
||||
+ if (throttle.remove && !entity.hasCustomName()) entity.remove(Entity.RemovalReason.DISCARDED);
|
||||
+ if (throttle.skip) return;
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
gameprofilerfiller.push("tick");
|
||||
this.guardEntityTick(this::tickNonPassenger, entity);
|
||||
gameprofilerfiller.pop();
|
||||
@@ -839,6 +847,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
}
|
||||
}
|
||||
});
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuEntityLimits.enabled) regionizedWorldData.entityThrottler.tickLimiterFinish(regionizedWorldData); // Kaiiju
|
||||
} finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.ENTITY_TICK); } // Folia - profiler
|
||||
gameprofilerfiller.pop();
|
||||
profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.TILE_ENTITY); try { // Folia - profiler
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 31 Jul 2024 12:41:14 +0800
|
||||
Date: Sat, 30 Nov 2024 11:50:09 +0800
|
||||
Subject: [PATCH] Petal Reduce sensor work
|
||||
|
||||
|
||||
@@ -33,15 +33,15 @@ index 0000000000000000000000000000000000000000..dd45cf1fde5ee4cf8347064f106c64b8
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 1cb0029739a487d930e4f10371c82d3a03a46de4..a98d47cb24b2664a497863fc0676b2ef95a89ab2 100644
|
||||
index e48728723e9f765099fc1cea8e6a2baa48d7fc75..6b66d73daa0145829cd964403e7958335ef0aa9a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -940,12 +940,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@@ -930,12 +930,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
return;
|
||||
}
|
||||
// Paper end - Allow nerfed mobs to jump and float
|
||||
+ int i = this.tickCount + this.getId(); //Luminol - Petal - Move up
|
||||
ProfilerFiller gameprofilerfiller = this.level().getProfiler();
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
gameprofilerfiller.push("sensing");
|
||||
- this.sensing.tick();
|
||||
@@ -1,22 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Sauve <paul@technove.co>
|
||||
Date: Mon, 26 Apr 2021 10:52:56 -0500
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sat, 30 Nov 2024 11:52:43 +0800
|
||||
Subject: [PATCH] Pufferfish Cache climbing check for activation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 9b8fd458c851d72901568845d973330ed58260a9..33ecd65a2787741cc0611ad3100a1bf9d2ce0338 100644
|
||||
index 73af15d18180b4df3fa0614b323f2397f5543db5..dcdc5ca699832b3c26b33a27f684a4c7dea103b9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -157,7 +157,6 @@ import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
-import co.aikar.timings.MinecraftTimings; // Paper
|
||||
|
||||
public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
@@ -2084,6 +2083,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2154,6 +2154,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return this.lastClimbablePos;
|
||||
}
|
||||
|
||||
@@ -38,10 +30,10 @@ index 9b8fd458c851d72901568845d973330ed58260a9..33ecd65a2787741cc0611ad3100a1bf9
|
||||
if (this.isSpectator()) {
|
||||
return false;
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index d12f9586602769bd0c692f1cf5820b008cb4bc51..2d26c8109cb942d1856455fd0239290ee1142eb3 100644
|
||||
index f2f5eb1a443ac411539e1c87eec60e76682b82fa..cbe785f5fab22630e8a80519664791e2ac621b9f 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -307,7 +307,7 @@ public class ActivationRange
|
||||
@@ -304,7 +304,7 @@ public class ActivationRange
|
||||
if ( entity instanceof LivingEntity )
|
||||
{
|
||||
LivingEntity living = (LivingEntity) entity;
|
||||
@@ -1,25 +1,25 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Sauve <paul@technove.co>
|
||||
Date: Thu, 4 Feb 2021 23:33:52 -0600
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sat, 30 Nov 2024 11:53:29 +0800
|
||||
Subject: [PATCH] Pufferfish Reduce chunk loading & lookups
|
||||
|
||||
|
||||
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 828c51477cd8f35d591367b30bf4feef6a250292..ace4959f818bf56882b290d109b8b97f2c145631 100644
|
||||
index 2a394381a4ad46359359ba402b65c62b331480b4..4e4dab5bc202f6f421dcff98f0e36e8e70378b49 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
@@ -320,11 +320,17 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
@@ -306,11 +306,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().getMinBuildHeight() && !this.level().getBlockState(blockposition_mutableblockposition).blocksMotion()) {
|
||||
- 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().getMinBuildHeight() && !chunk.getBlockState(blockposition_mutableblockposition).blocksMotion()) { // Pufferfish
|
||||
+ while (blockposition_mutableblockposition.getY() > this.level().getMinY() && !chunk.getBlockState(blockposition_mutableblockposition).blocksMotion()) { // Pufferfish
|
||||
blockposition_mutableblockposition.move(Direction.DOWN);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 31 Jul 2024 13:10:52 +0800
|
||||
Date: Sat, 30 Nov 2024 11:54:17 +0800
|
||||
Subject: [PATCH] Pufferfish Fix Paper#6045, block goal shouldn't load chunks
|
||||
|
||||
|
||||
@@ -1,237 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Sauve <paul@technove.co>
|
||||
Date: Wed, 14 Apr 2021 22:58:15 -0500
|
||||
Subject: [PATCH] Pufferfish Improve fluid direction caching
|
||||
|
||||
|
||||
diff --git a/src/main/java/gg/airplane/structs/FluidDirectionCache.java b/src/main/java/gg/airplane/structs/FluidDirectionCache.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..aa8467b9dda1f7707e41f50ac7b3e9d7343723ec
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/airplane/structs/FluidDirectionCache.java
|
||||
@@ -0,0 +1,136 @@
|
||||
+package gg.airplane.structs;
|
||||
+
|
||||
+import it.unimi.dsi.fastutil.HashCommon;
|
||||
+
|
||||
+/**
|
||||
+ * This is a replacement for the cache used in FluidTypeFlowing.
|
||||
+ * The requirements for the previous cache were:
|
||||
+ * - Store 200 entries
|
||||
+ * - Look for the flag in the cache
|
||||
+ * - If it exists, move to front of cache
|
||||
+ * - If it doesn't exist, remove last entry in cache and insert in front
|
||||
+ *
|
||||
+ * This class accomplishes something similar, however has a few different
|
||||
+ * requirements put into place to make this more optimize:
|
||||
+ *
|
||||
+ * - maxDistance is the most amount of entries to be checked, instead
|
||||
+ * of having to check the entire list.
|
||||
+ * - In combination with that, entries are all tracked by age and how
|
||||
+ * frequently they're used. This enables us to remove old entries,
|
||||
+ * without constantly shifting any around.
|
||||
+ *
|
||||
+ * Usage of the previous map would have to reset the head every single usage,
|
||||
+ * shifting the entire map. Here, nothing happens except an increment when
|
||||
+ * the cache is hit, and when it needs to replace an old element only a single
|
||||
+ * element is modified.
|
||||
+ */
|
||||
+public class FluidDirectionCache<T> {
|
||||
+
|
||||
+ private static class FluidDirectionEntry<T> {
|
||||
+ private final T data;
|
||||
+ private final boolean flag;
|
||||
+ private int uses = 0;
|
||||
+ private int age = 0;
|
||||
+
|
||||
+ private FluidDirectionEntry(T data, boolean flag) {
|
||||
+ this.data = data;
|
||||
+ this.flag = flag;
|
||||
+ }
|
||||
+
|
||||
+ public int getValue() {
|
||||
+ return this.uses - (this.age >> 1); // age isn't as important as uses
|
||||
+ }
|
||||
+
|
||||
+ public void incrementUses() {
|
||||
+ this.uses = this.uses + 1 & Integer.MAX_VALUE;
|
||||
+ }
|
||||
+
|
||||
+ public void incrementAge() {
|
||||
+ this.age = this.age + 1 & Integer.MAX_VALUE;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private final FluidDirectionEntry[] entries;
|
||||
+ private final int mask;
|
||||
+ private final int maxDistance; // the most amount of entries to check for a value
|
||||
+
|
||||
+ public FluidDirectionCache(int size) {
|
||||
+ int arraySize = HashCommon.nextPowerOfTwo(size);
|
||||
+ this.entries = new FluidDirectionEntry[arraySize];
|
||||
+ this.mask = arraySize - 1;
|
||||
+ this.maxDistance = Math.min(arraySize, 4);
|
||||
+ }
|
||||
+
|
||||
+ public Boolean getValue(T data) {
|
||||
+ FluidDirectionEntry curr;
|
||||
+ int pos;
|
||||
+
|
||||
+ if ((curr = this.entries[pos = HashCommon.mix(data.hashCode()) & this.mask]) == null) {
|
||||
+ return null;
|
||||
+ } else if (data.equals(curr.data)) {
|
||||
+ curr.incrementUses();
|
||||
+ return curr.flag;
|
||||
+ }
|
||||
+
|
||||
+ int checked = 1; // start at 1 because we already checked the first spot above
|
||||
+
|
||||
+ while ((curr = this.entries[pos = (pos + 1) & this.mask]) != null) {
|
||||
+ if (data.equals(curr.data)) {
|
||||
+ curr.incrementUses();
|
||||
+ return curr.flag;
|
||||
+ } else if (++checked >= this.maxDistance) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ public void putValue(T data, boolean flag) {
|
||||
+ FluidDirectionEntry<T> curr;
|
||||
+ int pos;
|
||||
+
|
||||
+ if ((curr = this.entries[pos = HashCommon.mix(data.hashCode()) & this.mask]) == null) {
|
||||
+ this.entries[pos] = new FluidDirectionEntry<>(data, flag); // add
|
||||
+ return;
|
||||
+ } else if (data.equals(curr.data)) {
|
||||
+ curr.incrementUses();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ int checked = 1; // start at 1 because we already checked the first spot above
|
||||
+
|
||||
+ while ((curr = this.entries[pos = (pos + 1) & this.mask]) != null) {
|
||||
+ if (data.equals(curr.data)) {
|
||||
+ curr.incrementUses();
|
||||
+ return;
|
||||
+ } else if (++checked >= this.maxDistance) {
|
||||
+ this.forceAdd(data, flag);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ this.entries[pos] = new FluidDirectionEntry<>(data, flag); // add
|
||||
+ }
|
||||
+
|
||||
+ private void forceAdd(T data, boolean flag) {
|
||||
+ int expectedPos = HashCommon.mix(data.hashCode()) & this.mask;
|
||||
+
|
||||
+ int toRemovePos = expectedPos;
|
||||
+ FluidDirectionEntry entryToRemove = this.entries[toRemovePos];
|
||||
+
|
||||
+ for (int i = expectedPos + 1; i < expectedPos + this.maxDistance; i++) {
|
||||
+ int pos = i & this.mask;
|
||||
+ FluidDirectionEntry entry = this.entries[pos];
|
||||
+ if (entry.getValue() < entryToRemove.getValue()) {
|
||||
+ toRemovePos = pos;
|
||||
+ entryToRemove = entry;
|
||||
+ }
|
||||
+
|
||||
+ entry.incrementAge(); // use this as a mechanism to age the other entries
|
||||
+ }
|
||||
+
|
||||
+ // remove the least used/oldest entry
|
||||
+ this.entries[toRemovePos] = new FluidDirectionEntry(data, flag);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
index 1c0712295695727ee9c4d430d4157b8e17cbd71f..6785baf574f233ed1c3bea8d406be8a524d9ff82 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
@@ -45,6 +45,8 @@ public abstract class FlowingFluid extends Fluid {
|
||||
public static final BooleanProperty FALLING = BlockStateProperties.FALLING;
|
||||
public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL_FLOWING;
|
||||
private static final int CACHE_SIZE = 200;
|
||||
+ // Pufferfish start - use our own cache
|
||||
+ /*
|
||||
private static final ThreadLocal<Object2ByteLinkedOpenHashMap<Block.BlockStatePairKey>> OCCLUSION_CACHE = ThreadLocal.withInitial(() -> {
|
||||
Object2ByteLinkedOpenHashMap<Block.BlockStatePairKey> object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap<Block.BlockStatePairKey>(200) {
|
||||
protected void rehash(int i) {}
|
||||
@@ -53,6 +55,14 @@ public abstract class FlowingFluid extends Fluid {
|
||||
object2bytelinkedopenhashmap.defaultReturnValue((byte) 127);
|
||||
return object2bytelinkedopenhashmap;
|
||||
});
|
||||
+ */
|
||||
+
|
||||
+ private static final ThreadLocal<gg.airplane.structs.FluidDirectionCache<Block.BlockStatePairKey>> localFluidDirectionCache = ThreadLocal.withInitial(() -> {
|
||||
+ // Pufferfish todo - mess with this number for performance
|
||||
+ // with 2048 it seems very infrequent on a small world that it has to remove old entries
|
||||
+ return new gg.airplane.structs.FluidDirectionCache<>(2048);
|
||||
+ });
|
||||
+ // Pufferfish end
|
||||
private final Map<FluidState, VoxelShape> shapes = Maps.newIdentityHashMap();
|
||||
|
||||
public FlowingFluid() {}
|
||||
@@ -240,6 +250,8 @@ public abstract class FlowingFluid extends Fluid {
|
||||
}
|
||||
|
||||
private boolean canPassThroughWall(Direction face, BlockGetter world, BlockPos pos, BlockState state, BlockPos fromPos, BlockState fromState) {
|
||||
+ // Pufferfish start - modify to use our cache
|
||||
+ /*
|
||||
Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap;
|
||||
|
||||
if (!state.getBlock().hasDynamicShape() && !fromState.getBlock().hasDynamicShape()) {
|
||||
@@ -247,9 +259,16 @@ public abstract class FlowingFluid extends Fluid {
|
||||
} else {
|
||||
object2bytelinkedopenhashmap = null;
|
||||
}
|
||||
+ */
|
||||
+ gg.airplane.structs.FluidDirectionCache<Block.BlockStatePairKey> cache = null;
|
||||
+
|
||||
+ if (!state.getBlock().hasDynamicShape() && !fromState.getBlock().hasDynamicShape()) {
|
||||
+ cache = localFluidDirectionCache.get();
|
||||
+ }
|
||||
|
||||
Block.BlockStatePairKey block_a;
|
||||
|
||||
+ /*
|
||||
if (object2bytelinkedopenhashmap != null) {
|
||||
block_a = new Block.BlockStatePairKey(state, fromState, face);
|
||||
byte b0 = object2bytelinkedopenhashmap.getAndMoveToFirst(block_a);
|
||||
@@ -260,11 +279,22 @@ public abstract class FlowingFluid extends Fluid {
|
||||
} else {
|
||||
block_a = null;
|
||||
}
|
||||
+ */
|
||||
+ if (cache != null) {
|
||||
+ block_a = new Block.BlockStatePairKey(state, fromState, face);
|
||||
+ Boolean flag = cache.getValue(block_a);
|
||||
+ if (flag != null) {
|
||||
+ return flag;
|
||||
+ }
|
||||
+ } else {
|
||||
+ block_a = null;
|
||||
+ }
|
||||
|
||||
VoxelShape voxelshape = state.getCollisionShape(world, pos);
|
||||
VoxelShape voxelshape1 = fromState.getCollisionShape(world, fromPos);
|
||||
boolean flag = !Shapes.mergedFaceOccludes(voxelshape, voxelshape1, face);
|
||||
|
||||
+ /*
|
||||
if (object2bytelinkedopenhashmap != null) {
|
||||
if (object2bytelinkedopenhashmap.size() == 200) {
|
||||
object2bytelinkedopenhashmap.removeLastByte();
|
||||
@@ -272,6 +302,11 @@ public abstract class FlowingFluid extends Fluid {
|
||||
|
||||
object2bytelinkedopenhashmap.putAndMoveToFirst(block_a, (byte) (flag ? 1 : 0));
|
||||
}
|
||||
+ */
|
||||
+ if (cache != null) {
|
||||
+ cache.putValue(block_a, flag);
|
||||
+ }
|
||||
+ // Pufferfish end
|
||||
|
||||
return flag;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Wed, 7 Feb 2024 05:45:24 +0000
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sat, 30 Nov 2024 11:54:58 +0800
|
||||
Subject: [PATCH] Pufferfish Reduce projectile chunk loading
|
||||
|
||||
|
||||
@@ -33,10 +33,10 @@ index 0000000000000000000000000000000000000000..12683ec5a5102e45b6171fea0b833ba5
|
||||
+ }
|
||||
+}
|
||||
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 0e831070fe7a9ac58de4b25b74a53b38334c695a..2f0a40134ef2fcccf407a5381994c3454040097e 100644
|
||||
index a6bcf7b57b804af74f75c0b24ff48ee2714c3b73..7ccd7d6dc61948210ecb9c3acee8f1740e389106 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
@@ -52,6 +52,40 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
@@ -58,6 +58,40 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
super(type, world);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 31 Jul 2024 13:13:07 +0800
|
||||
Date: Sat, 30 Nov 2024 11:59:05 +0800
|
||||
Subject: [PATCH] Pufferfish Only check for spooky season once an hour
|
||||
|
||||
|
||||
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 dc27ddf5131e7398a5390a5187261d4c7fb6ccaa..39cc49b746b0a775fde5d173dd4f712ab4a84a97 100644
|
||||
index 60c2868f255d372226e0c1389caaa5477bbef41e..4f2993214f1789251742fe106bc7acad5b37440b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
@@ -239,13 +239,25 @@ public class Bat extends AmbientCreature {
|
||||
@@ -242,13 +242,25 @@ public class Bat extends AmbientCreature {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 4 Aug 2024 21:39:59 +0800
|
||||
Date: Sat, 30 Nov 2024 12:05:17 +0800
|
||||
Subject: [PATCH] Pufferfish Optimize suffocation
|
||||
|
||||
|
||||
@@ -31,19 +31,19 @@ index 0000000000000000000000000000000000000000..3e48cd297b4869e5c89b6abc43c726d3
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 33ecd65a2787741cc0611ad3100a1bf9d2ce0338..8c155060f5a347e784b9d4ece506e983fdc4057b 100644
|
||||
index dcdc5ca699832b3c26b33a27f684a4c7dea103b9..f537fd0a6bf689b5804924950d1b7acf51664f33 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -463,7 +463,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
boolean flag = this instanceof net.minecraft.world.entity.player.Player;
|
||||
@@ -480,7 +480,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
if (!this.level().isClientSide) {
|
||||
if (world1 instanceof ServerLevel) {
|
||||
worldserver1 = (ServerLevel) world1;
|
||||
- if (this.isInWall()) {
|
||||
+ if (shouldCheckForSuffocation() && this.isInWall()) { // Pufferfish - optimize suffocation
|
||||
this.hurt(this.damageSources().inWall(), 1.0F);
|
||||
this.hurtServer(worldserver1, this.damageSources().inWall(), 1.0F);
|
||||
} else if (flag && !this.level().getWorldBorder().isWithinBounds(this.getBoundingBox())) {
|
||||
double d0 = this.level().getWorldBorder().getDistanceToBorder(this) + this.level().getWorldBorder().getDamageSafeZone();
|
||||
@@ -1427,6 +1427,19 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
double d1 = this.level().getWorldBorder().getDistanceToBorder(this) + this.level().getWorldBorder().getDamageSafeZone();
|
||||
@@ -1456,6 +1456,19 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return this.getHealth() <= 0.0F;
|
||||
}
|
||||
|
||||
@@ -61,13 +61,13 @@ index 33ecd65a2787741cc0611ad3100a1bf9d2ce0338..8c155060f5a347e784b9d4ece506e983
|
||||
+ // Pufferfish end
|
||||
+
|
||||
@Override
|
||||
public boolean hurt(DamageSource source, float amount) {
|
||||
if (this.isInvulnerableTo(source)) {
|
||||
public boolean hurtServer(ServerLevel world, DamageSource source, float amount) {
|
||||
if (this.isInvulnerableTo(world, source)) {
|
||||
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 d3b4d492aee380dc17f4232d90eaae4f07bb9f86..82921c56c49edb0ca07425da563aa4876d4e6fb1 100644
|
||||
index bd9e10f79eaf0d23908229b3ebc2227946a14843..2ce65ef77e4b28e1fd5ac7bd6a304cc115b8aca2 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
|
||||
@@ -154,6 +154,13 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
@@ -151,6 +151,13 @@ public class WitherBoss extends Monster implements RangedAttackMob {
|
||||
this.bossEvent.setName(this.getDisplayName());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 4 Aug 2024 21:53:48 +0800
|
||||
Date: Wed, 4 Dec 2024 23:49:02 +0800
|
||||
Subject: [PATCH] Pufferfish Dynamic Activation of Brain
|
||||
|
||||
|
||||
@@ -71,47 +71,47 @@ index 0000000000000000000000000000000000000000..af5893ba1f738ec9827d7b714682c314
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 94d855f14c91ca164f1728be1df4e83dfed8b005..3ebea71bbc6ced0d0a325c519436a0199666fafb 100644
|
||||
index 5503d506c595296ecad09a3ce4497a365f216af5..98aef7a3cfc759e4415df3a56b5fe01eb50b0428 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -805,6 +805,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
this.timings.entityTick.startTiming(); // Spigot
|
||||
@@ -816,6 +816,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
} finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.ACTIVATE_ENTITIES); } // Folia - profiler
|
||||
profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.ENTITY_TICK); try { // Folia - profiler
|
||||
regionizedWorldData.forEachTickingEntity((entity) -> { // Folia - regionised ticking
|
||||
+ entity.activatedPriorityReset = false; // Pufferfish - DAB
|
||||
if (!entity.isRemoved()) {
|
||||
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
|
||||
entity.discard();
|
||||
if (!tickratemanager.isEntityFrozen(entity)) {
|
||||
gameprofilerfiller.push("checkDespawn");
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 261bcb9cbb8bda07037f40883ddc5381948c66e1..6497ecce4a826776c487e0e2fcb077f21e02ecda 100644
|
||||
index bd3f0c807c36ecfb8a89a0ca68ffa0c3640b7423..821fcf2bd1dacda191d7c8c17199069ebb9e73d3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -430,6 +430,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
private UUID originWorld;
|
||||
@@ -390,6 +390,8 @@ 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 = me.earthme.luminol.config.modules.optimizations.EntityDABConfig.maximumActivationPrio; // Pufferfish - DAB (golf score)
|
||||
|
||||
public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||
this.origin = location.toVector();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
index 293ec464b1cb4db1734d0c059e59f60bfeb2b7eb..5d3e5262d9b7565ddf045ce9f97ec1904e7b0291 100644
|
||||
index 635c9c7a8c8307c2bc845a8e1f24aacb526a3c92..c824e8a540dccffd848ae0a0624ce034b78f7db6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
@@ -316,6 +316,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||
private final boolean canSpawnFarFromPlayer;
|
||||
@@ -385,6 +385,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||
private final int clientTrackingRange;
|
||||
private final int updateInterval;
|
||||
private final String descriptionId;
|
||||
+ public boolean dabEnabled = false; // Pufferfish
|
||||
@Nullable
|
||||
private String descriptionId;
|
||||
@Nullable
|
||||
private Component description;
|
||||
private final Optional<ResourceKey<LootTable>> lootTable;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index a98d47cb24b2664a497863fc0676b2ef95a89ab2..121e9cbeb07a41febac0086f5fce5a172a4ad15e 100644
|
||||
index 6b66d73daa0145829cd964403e7958335ef0aa9a..80756e96faed0e0ca239f58f63522b9f15822c07 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -244,10 +244,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@@ -235,10 +235,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@Override
|
||||
public void inactiveTick() {
|
||||
super.inactiveTick();
|
||||
@@ -124,7 +124,7 @@ index a98d47cb24b2664a497863fc0676b2ef95a89ab2..121e9cbeb07a41febac0086f5fce5a17
|
||||
this.targetSelector.tick();
|
||||
}
|
||||
}
|
||||
@@ -949,16 +949,20 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@@ -939,16 +939,20 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
|
||||
if (i % 2 != 0 && this.tickCount > 1) {
|
||||
gameprofilerfiller.push("targetSelector");
|
||||
@@ -145,31 +145,14 @@ index a98d47cb24b2664a497863fc0676b2ef95a89ab2..121e9cbeb07a41febac0086f5fce5a17
|
||||
this.goalSelector.tick();
|
||||
gameprofilerfiller.pop();
|
||||
}
|
||||
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<Villager> {
|
||||
|
||||
@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/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
||||
index 9bdbf3e9453bc3ce96d52d04b8cde0d05f7356d8..f2da2efb694ee7750720670938cce98720ba2666 100644
|
||||
index 29ae74339a4831ccef3d01e8054931715ba192ad..dd08eb5d44de5a482df538bca18a2255bb93a81f 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
|
||||
@@ -43,9 +43,12 @@ public class GoalSelector {
|
||||
@@ -38,9 +38,12 @@ public class GoalSelector {
|
||||
}
|
||||
|
||||
// Paper start
|
||||
// Paper start - EAR 2
|
||||
- public boolean inactiveTick() {
|
||||
+ public boolean inactiveTick(int tickRate, boolean inactive) { // Pufferfish start
|
||||
+ if (inactive && !me.earthme.luminol.config.modules.optimizations.EntityDABConfig.dearEnabled) tickRate = 4; // reset to Paper's
|
||||
@@ -182,140 +165,153 @@ index 9bdbf3e9453bc3ce96d52d04b8cde0d05f7356d8..f2da2efb694ee7750720670938cce987
|
||||
public boolean hasTasks() {
|
||||
for (WrappedGoal task : this.availableGoals) {
|
||||
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 69986f75d3cf729204cca0c7e5428536af31f695..98a759dbe46e2ead39af0f340c9b73c8f4ddce1e 100644
|
||||
index b86f638390d386c838318a4d9b6571ac5514df8f..f4788104b1bb73810fdf0dc7f5311d5b078a81d5 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
|
||||
@@ -217,9 +217,11 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
|
||||
@@ -223,11 +223,13 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
|
||||
return 0.4F;
|
||||
}
|
||||
|
||||
+ private int behaviorTick = 0; // Pufferfish
|
||||
@Override
|
||||
protected void customServerAiStep() {
|
||||
this.level().getProfiler().push("allayBrain");
|
||||
protected void customServerAiStep(ServerLevel world) {
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
gameprofilerfiller.push("allayBrain");
|
||||
+ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
|
||||
this.getBrain().tick((ServerLevel) this.level(), this);
|
||||
this.level().getProfiler().pop();
|
||||
this.level().getProfiler().push("allayActivityUpdate");
|
||||
this.getBrain().tick(world, this);
|
||||
gameprofilerfiller.pop();
|
||||
gameprofilerfiller.push("allayActivityUpdate");
|
||||
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 01a0731e92d39c8718538244e34a271fb8717fc2..44937570f8e968ba4fe2822f69ca8f09679da89d 100644
|
||||
index 31b10cd404b672d7ce21c2107d8f83e32de26ef4..cb47876a13cb1990bb0ab4cff1bbe57b3b2d0a5e 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
|
||||
@@ -269,9 +269,11 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder<Axolo
|
||||
@@ -292,11 +292,13 @@ public class Axolotl extends Animal implements VariantHolder<Axolotl.Variant>, B
|
||||
return true;
|
||||
}
|
||||
|
||||
+ private int behaviorTick = 0; // Pufferfish
|
||||
@Override
|
||||
protected void customServerAiStep() {
|
||||
this.level().getProfiler().push("axolotlBrain");
|
||||
protected void customServerAiStep(ServerLevel world) {
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
gameprofilerfiller.push("axolotlBrain");
|
||||
+ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
|
||||
this.getBrain().tick((ServerLevel) this.level(), this);
|
||||
this.level().getProfiler().pop();
|
||||
this.level().getProfiler().push("axolotlActivityUpdate");
|
||||
this.getBrain().tick(world, this);
|
||||
gameprofilerfiller.pop();
|
||||
gameprofilerfiller.push("axolotlActivityUpdate");
|
||||
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 816977990639ec0559b652fc9666afd5046f0a5d..714703519965e8dae42be7442f292b581cc7c049 100644
|
||||
index ca04e5d829331551a2c2f44e223ff05c6ce04e76..db91b8018591fe248efda417fcde7fd2071c4cb6 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
|
||||
@@ -181,9 +181,11 @@ public class Frog extends Animal implements VariantHolder<Holder<FrogVariant>> {
|
||||
@@ -184,10 +184,12 @@ public class Frog extends Animal implements VariantHolder<Holder<FrogVariant>> {
|
||||
.ifPresent(this::setVariant);
|
||||
}
|
||||
|
||||
+ private int behaviorTick = 0; // Pufferfish
|
||||
@Override
|
||||
protected void customServerAiStep() {
|
||||
this.level().getProfiler().push("frogBrain");
|
||||
protected void customServerAiStep(ServerLevel world) {
|
||||
ProfilerFiller profilerFiller = Profiler.get();
|
||||
profilerFiller.push("frogBrain");
|
||||
+ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
|
||||
this.getBrain().tick((ServerLevel)this.level(), this);
|
||||
this.level().getProfiler().pop();
|
||||
this.level().getProfiler().push("frogActivityUpdate");
|
||||
this.getBrain().tick(world, this);
|
||||
profilerFiller.pop();
|
||||
profilerFiller.push("frogActivityUpdate");
|
||||
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 43046f4a0cff620834ac4647efdcde227185b2ff..90393485ebcf8a4c8c74802fff942b1af8cfbf00 100644
|
||||
index 48ac8c3f6e00c3c2dc67b6c994be7c0ac6dfcf81..cf326ef35bac732e7addf75537963593d5b268ae 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
|
||||
@@ -83,9 +83,11 @@ public class Tadpole extends AbstractFish {
|
||||
@@ -83,11 +83,13 @@ public class Tadpole extends AbstractFish {
|
||||
return SoundEvents.TADPOLE_FLOP;
|
||||
}
|
||||
|
||||
+ private int behaviorTick = 0; // Pufferfish
|
||||
@Override
|
||||
protected void customServerAiStep() {
|
||||
this.level().getProfiler().push("tadpoleBrain");
|
||||
protected void customServerAiStep(ServerLevel world) {
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
gameprofilerfiller.push("tadpoleBrain");
|
||||
+ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
|
||||
this.getBrain().tick((ServerLevel) this.level(), this);
|
||||
this.level().getProfiler().pop();
|
||||
this.level().getProfiler().push("tadpoleActivityUpdate");
|
||||
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 376bcbc189008464f4d518c1e07643431ba96306..07bdea8a7d6706839a758afe0242202c7e841416 100644
|
||||
index 76aca47d8638d5c37c57d3a59fa7f8ceaa5a53b4..fb92cd4b0c15b614c0c06d2867039aee1a6212a2 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
|
||||
@@ -190,9 +190,11 @@ public class Goat extends Animal {
|
||||
@@ -192,11 +192,13 @@ public class Goat extends Animal {
|
||||
return (Brain<Goat>) super.getBrain(); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
+ private int behaviorTick = 0; // Pufferfish
|
||||
@Override
|
||||
protected void customServerAiStep() {
|
||||
this.level().getProfiler().push("goatBrain");
|
||||
protected void customServerAiStep(ServerLevel world) {
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
gameprofilerfiller.push("goatBrain");
|
||||
+ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
|
||||
this.getBrain().tick((ServerLevel) this.level(), this);
|
||||
this.level().getProfiler().pop();
|
||||
this.level().getProfiler().push("goatActivityUpdate");
|
||||
this.getBrain().tick(world, this);
|
||||
gameprofilerfiller.pop();
|
||||
gameprofilerfiller.push("goatActivityUpdate");
|
||||
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 d5e0c493f4c348724958193795ceb987765a465f..7de73564bc73d6504e18977e97a2ef5f46189e15 100644
|
||||
index 92270912ef26924f611a1df7cb3d5b485b0a262d..9c20651b74157582e60793ceba8adde2c354f2a8 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
|
||||
@@ -153,9 +153,11 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
|
||||
return (Brain<Hoglin>)super.getBrain();
|
||||
@@ -138,11 +138,13 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
|
||||
return (Brain<Hoglin>) super.getBrain(); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
+ private int behaviorTick; // Pufferfish
|
||||
@Override
|
||||
protected void customServerAiStep() {
|
||||
this.level().getProfiler().push("hoglinBrain");
|
||||
protected void customServerAiStep(ServerLevel world) {
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
gameprofilerfiller.push("hoglinBrain");
|
||||
+ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
|
||||
this.getBrain().tick((ServerLevel)this.level(), this);
|
||||
this.level().getProfiler().pop();
|
||||
this.getBrain().tick(world, this);
|
||||
gameprofilerfiller.pop();
|
||||
HoglinAi.updateActivity(this);
|
||||
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 bc58323801ee16fe9b63c21332144ec002a902f2..b2ae7088f90bf3cd04a59c6ddfdba60c58c6e1c8 100644
|
||||
index 2121d2a2e1aa1d0f0390cc515317096431f6dcb0..74ab50723056fef2a96dcc9e2de0e58526738011 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
|
||||
@@ -293,9 +293,11 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
|
||||
@@ -307,11 +307,13 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
|
||||
return !this.cannotHunt;
|
||||
}
|
||||
|
||||
+ private int behaviorTick; // Pufferfish
|
||||
@Override
|
||||
protected void customServerAiStep() {
|
||||
this.level().getProfiler().push("piglinBrain");
|
||||
protected void customServerAiStep(ServerLevel world) {
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
gameprofilerfiller.push("piglinBrain");
|
||||
+ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
|
||||
this.getBrain().tick((ServerLevel) this.level(), this);
|
||||
this.level().getProfiler().pop();
|
||||
this.getBrain().tick(world, this);
|
||||
gameprofilerfiller.pop();
|
||||
PiglinAi.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 38bf417a9ad4647f4af24d969f3bf4fed9c4bad7..40bbd80b1ed4afede6f0769e7f3fcfc61200452f 100644
|
||||
index c47ed605f0822effd58df4f875297ed015e1e57e..4331ada8bed7ade7b53fd8ba000c1c1b34fa4331 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
|
||||
@@ -272,11 +272,13 @@ public class Warden extends Monster implements VibrationSystem {
|
||||
@@ -275,11 +275,13 @@ public class Warden extends Monster implements VibrationSystem {
|
||||
|
||||
}
|
||||
|
||||
+ private int behaviorTick = 0; // Pufferfish
|
||||
@Override
|
||||
protected void customServerAiStep() {
|
||||
ServerLevel worldserver = (ServerLevel) this.level();
|
||||
protected void customServerAiStep(ServerLevel world) {
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
worldserver.getProfiler().push("wardenBrain");
|
||||
gameprofilerfiller.push("wardenBrain");
|
||||
+ if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
|
||||
this.getBrain().tick(worldserver, this);
|
||||
this.level().getProfiler().pop();
|
||||
super.customServerAiStep();
|
||||
this.getBrain().tick(world, this);
|
||||
gameprofilerfiller.pop();
|
||||
super.customServerAiStep(world);
|
||||
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 91728a992a29bc22e46a260750d5dd88e629bfd1..3f4e4b612e127e51b240bca8776f6fc3743bd2d7 100644
|
||||
index 07f50048e9748b28178847ad470b8b2ce37e0eea..8fbf0df15716940622144fb2d4423f74264580f7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -143,6 +143,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@@ -142,6 +142,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
return holder.is(PoiTypes.MEETING);
|
||||
});
|
||||
|
||||
@@ -324,33 +320,33 @@ index 91728a992a29bc22e46a260750d5dd88e629bfd1..3f4e4b612e127e51b240bca8776f6fc3
|
||||
public Villager(EntityType<? extends Villager> entityType, Level world) {
|
||||
this(entityType, world, VillagerType.PLAINS);
|
||||
}
|
||||
@@ -246,6 +248,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@@ -245,6 +247,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
}
|
||||
// Spigot End
|
||||
|
||||
+ private int behaviorTick = 0; // Pufferfish
|
||||
@Override
|
||||
@Deprecated // Paper
|
||||
protected void customServerAiStep() {
|
||||
protected void customServerAiStep(ServerLevel world) {
|
||||
// Paper start - EAR 2
|
||||
@@ -255,7 +258,11 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
protected void customServerAiStep(final boolean inactive) {
|
||||
// Paper end
|
||||
this.level().getProfiler().push("villagerBrain");
|
||||
- if (!inactive) this.getBrain().tick((ServerLevel) this.level(), this); // Paper
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
gameprofilerfiller.push("villagerBrain");
|
||||
- if (!inactive) this.getBrain().tick(world, this);
|
||||
+ // Pufferfish start
|
||||
+ if (!inactive && this.behaviorTick++ % this.activatedPriority == 0) {
|
||||
+ this.getBrain().tick((ServerLevel) this.level(), this); // Paper
|
||||
+ }
|
||||
+ // Pufferfish end
|
||||
this.level().getProfiler().pop();
|
||||
gameprofilerfiller.pop();
|
||||
if (this.assignProfessionWhenSpawned) {
|
||||
this.assignProfessionWhenSpawned = false;
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index 2d26c8109cb942d1856455fd0239290ee1142eb3..c17e9782850fd88b9a46d31bf9075624ffc11709 100644
|
||||
index cbe785f5fab22630e8a80519664791e2ac621b9f..820145408fa2150820c4c14ea55bee23e7e9a366 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -38,6 +38,10 @@ import co.aikar.timings.MinecraftTimings;
|
||||
import net.minecraft.world.entity.schedule.Activity;
|
||||
@@ -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
|
||||
@@ -360,7 +356,7 @@ index 2d26c8109cb942d1856455fd0239290ee1142eb3..c17e9782850fd88b9a46d31bf9075624
|
||||
|
||||
public class ActivationRange
|
||||
{
|
||||
@@ -232,6 +236,24 @@ public class ActivationRange
|
||||
@@ -230,6 +234,25 @@ public class ActivationRange
|
||||
}
|
||||
// Paper end - Configurable marker ticking
|
||||
ActivationRange.activateEntity(entity, bbByType); // Folia - threaded regions
|
||||
@@ -382,6 +378,7 @@ index 2d26c8109cb942d1856455fd0239290ee1142eb3..c17e9782850fd88b9a46d31bf9075624
|
||||
+ entity.activatedPriority = 1;
|
||||
+ }
|
||||
+ // Pufferfish end
|
||||
+
|
||||
}
|
||||
// Paper end
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 31 Jul 2024 13:10:18 +0800
|
||||
Subject: [PATCH] Pufferfish Early return optimization for target finding
|
||||
|
||||
|
||||
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 aecb0ad814586bfc5e56755ee14379a69388b38c..6381ef1385f85f0f576ad55b3b58dd62c0823f1c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
|
||||
@@ -76,9 +76,18 @@ public class TargetingConditions {
|
||||
}
|
||||
|
||||
if (this.range > 0.0) {
|
||||
- double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0;
|
||||
- double e = Math.max((this.useFollowRange ? this.getFollowRange(baseEntity) : this.range) * d, 2.0); // Paper - Fix MC-145656
|
||||
+ // Pufferfish start - check range before getting visibility
|
||||
+ // d = invisibility percent, e = follow range adjusted for invisibility, f = distance
|
||||
double f = baseEntity.distanceToSqr(targetEntity.getX(), targetEntity.getY(), targetEntity.getZ());
|
||||
+ double followRangeRaw = this.useFollowRange ? this.getFollowRange(baseEntity) : this.range;
|
||||
+
|
||||
+ if (f > followRangeRaw * followRangeRaw) { // the actual follow range will always be this value or smaller, so if the distance is larger then it never will return true after getting invis
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0;
|
||||
+ double e = Math.max((followRangeRaw) * d, 2.0D); // Paper - Fix MC-145656
|
||||
+ // Pufferfish end
|
||||
if (f > e * e) {
|
||||
return false;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 4 Aug 2024 21:41:52 +0800
|
||||
Date: Wed, 4 Dec 2024 23:50:22 +0800
|
||||
Subject: [PATCH] Pufferfish Throttle goal selector during inactive ticking
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..acc032f727e605e79b688efb4873ff47
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 121e9cbeb07a41febac0086f5fce5a172a4ad15e..84281b92b2c02c70702d43ebcf7afa85914e03fb 100644
|
||||
index 80756e96faed0e0ca239f58f63522b9f15822c07..4e587a5c59eb271ed31c5584bd665953ae82aa8a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -240,11 +240,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@@ -231,11 +231,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
return this.lookControl;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Tue, 6 Aug 2024 14:31:20 +0800
|
||||
Date: Wed, 4 Dec 2024 23:51:17 +0800
|
||||
Subject: [PATCH] Pufferfish SIMD Utilities
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 7b11c45914392c01b4d28b104f80e6ed34eb9955..5ea6cccfde29132356548e847be4a1720b64998d 100644
|
||||
index 4b79f96103c98896332113ffe5f0e22cf08ffdd1..fbf51f738e98ac6e8358a7fa81b7fc545469a5a6 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -77,6 +77,14 @@ paperweight {
|
||||
craftBukkitPackageVersion.set("v1_21_R1") // also needs to be updated in MappingEnvironment
|
||||
@@ -94,6 +94,14 @@ paperweight {
|
||||
craftBukkitPackageVersion.set("v1_21_R3") // also needs to be updated in MappingEnvironment
|
||||
}
|
||||
|
||||
+
|
||||
@@ -1,23 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Paul <paul@technove.co>
|
||||
Date: Tue, 29 Jun 2021 02:24:23 -0500
|
||||
Subject: [PATCH] Pufferfish Skip cloning loot parameters
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootParams.java b/src/main/java/net/minecraft/world/level/storage/loot/LootParams.java
|
||||
index 37a0002bbe6539648db5219bb373e0404ae48dc0..ca0571d232e102c4b177a1ea44b96f5f0f440211 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootParams.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootParams.java
|
||||
@@ -21,8 +21,10 @@ public class LootParams {
|
||||
|
||||
public LootParams(ServerLevel world, Map<LootContextParam<?>, Object> parameters, Map<ResourceLocation, LootParams.DynamicDrop> dynamicDrops, float luck) {
|
||||
this.level = world;
|
||||
- this.params = parameters;
|
||||
- this.dynamicDrops = dynamicDrops;
|
||||
+ // Pufferfish start - use unmodifiable maps instead of immutable ones to skip the copy
|
||||
+ this.params = java.util.Collections.unmodifiableMap(parameters);
|
||||
+ this.dynamicDrops = java.util.Collections.unmodifiableMap(dynamicDrops);
|
||||
+ // Pufferfish end
|
||||
this.luck = luck;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 31 Jul 2024 13:30:56 +0800
|
||||
Date: Sat, 30 Nov 2024 12:07:11 +0800
|
||||
Subject: [PATCH] Gale Variable entity wake-up duration
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..fa30e8dc39a2d4bd1399e41230b307b1
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index c17e9782850fd88b9a46d31bf9075624ffc11709..e1f0aedbc42c6e969ba155c358f4ee30efd8ffe8 100644
|
||||
index 820145408fa2150820c4c14ea55bee23e7e9a366..57eb8bfb0e9d4a45d89eca75a2de219bff626bb5 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -75,28 +75,41 @@ public class ActivationRange
|
||||
@@ -74,28 +74,41 @@ public class ActivationRange
|
||||
if (entity.activationType == ActivationType.VILLAGER) {
|
||||
if (inactiveFor > config.wakeUpInactiveVillagersEvery && worldData.wakeupInactiveRemainingVillagers > 0) { // Folia - threaded regions
|
||||
worldData.wakeupInactiveRemainingVillagers--; // Folia - threaded regions
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Gale Optimize sun burn tick
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 6497ecce4a826776c487e0e2fcb077f21e02ecda..9b87aa41f03056721757348151b1119016421650 100644
|
||||
index 821fcf2bd1dacda191d7c8c17199069ebb9e73d3..9c29f99c9426db12231d7423ca24ca6fecf9c868 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -315,7 +315,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -274,7 +274,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public double xo;
|
||||
public double yo;
|
||||
public double zo;
|
||||
@@ -17,7 +17,7 @@ index 6497ecce4a826776c487e0e2fcb077f21e02ecda..9b87aa41f03056721757348151b11190
|
||||
private BlockPos blockPosition;
|
||||
private ChunkPos chunkPosition;
|
||||
private Vec3 deltaMovement;
|
||||
@@ -2124,9 +2124,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2227,9 +2227,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public float getLightLevelDependentMagicValue() {
|
||||
@@ -39,16 +39,16 @@ index 6497ecce4a826776c487e0e2fcb077f21e02ecda..9b87aa41f03056721757348151b11190
|
||||
this.absMoveTo(x, y, z);
|
||||
this.absRotateTo(yaw, pitch);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 84281b92b2c02c70702d43ebcf7afa85914e03fb..bc20ef314b20de38412522edcab99aaa4ba9ac32 100644
|
||||
index 4e587a5c59eb271ed31c5584bd665953ae82aa8a..5280e0bd88b39a2f1ca62b03ed2c54a89df4f212 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -1778,13 +1778,29 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@@ -1761,13 +1761,28 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
|
||||
protected void playAttackSound() {}
|
||||
|
||||
+ // Gale start - JettPack - optimize sun burn tick - cache eye blockpos
|
||||
+ private BlockPos cached_eye_blockpos;
|
||||
+ private int cached_position_hashcode;
|
||||
+ private net.minecraft.world.phys.Vec3 cached_position;
|
||||
+ // Gale end - JettPack - optimize sun burn tick - cache eye blockpos
|
||||
+
|
||||
public boolean isSunBurnTick() {
|
||||
@@ -56,10 +56,9 @@ index 84281b92b2c02c70702d43ebcf7afa85914e03fb..bc20ef314b20de38412522edcab99aaa
|
||||
- float f = this.getLightLevelDependentMagicValue();
|
||||
- BlockPos blockposition = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ());
|
||||
+ // Gale start - JettPack - optimize sun burn tick - optimizations and cache eye blockpos
|
||||
+ int positionHashCode = this.position.hashCode();
|
||||
+ if (this.cached_position_hashcode != positionHashCode) {
|
||||
+ if (this.cached_position != this.position) {
|
||||
+ this.cached_eye_blockpos = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ());
|
||||
+ this.cached_position_hashcode = positionHashCode;
|
||||
+ this.cached_position = this.position;
|
||||
+ }
|
||||
+
|
||||
+ float f = this.getLightLevelDependentMagicValue(cached_eye_blockpos); // Pass BlockPos to getBrightness
|
||||
@@ -1,79 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 31 Jul 2024 13:20:23 +0800
|
||||
Subject: [PATCH] Pufferfish Entity TTL
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/optimizations/EntityTTLOptimizationConfig.java b/src/main/java/me/earthme/luminol/config/modules/optimizations/EntityTTLOptimizationConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..15697d69659b6e1e776acf5094684b5f0c079b57
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/optimizations/EntityTTLOptimizationConfig.java
|
||||
@@ -0,0 +1,38 @@
|
||||
+package me.earthme.luminol.config.modules.optimizations;
|
||||
+
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import net.minecraft.core.registries.BuiltInRegistries;
|
||||
+import net.minecraft.world.entity.EntityType;
|
||||
+
|
||||
+import java.util.Locale;
|
||||
+
|
||||
+public class EntityTTLOptimizationConfig implements IConfigModule {
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.OPTIMIZATIONS;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "entity_time_outs";
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onLoaded(CommentedFileConfig config) {
|
||||
+ // Set some defaults
|
||||
+ this.get("optimizations.entity_timeouts.SNOWBALL", -1,config);
|
||||
+ this.get("optimizations.entity_timeouts.LLAMA_SPIT", -1,config);
|
||||
+ config.setComment("optimizations.entity_timeouts",
|
||||
+ """
|
||||
+ These values define a entity's maximum lifespan. If an
|
||||
+ entity is in this list and it has survived for longer than
|
||||
+ that number of ticks, then it will be removed. Setting a value to
|
||||
+ -1 disables this feature.""");
|
||||
+ for (EntityType<?> entityType : BuiltInRegistries.ENTITY_TYPE) {
|
||||
+ String type = EntityType.getKey(entityType).getPath().toUpperCase(Locale.ROOT);
|
||||
+ entityType.ttl = this.get("optimizations.entity_timeouts." + type, -1,config);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 87c2bb5794cf87a5f048779633de0d0bf2f16d5d..261bcb9cbb8bda07037f40883ddc5381948c66e1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -858,6 +858,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
+ // Pufferfish start - entity TTL
|
||||
+ if (type != EntityType.PLAYER && type.ttl >= 0 && this.tickCount >= type.ttl) {
|
||||
+ discard();
|
||||
+ return;
|
||||
+ }
|
||||
+ // Pufferfish end - entity TTL
|
||||
this.baseTick();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
index c74a01a8551457507441d266b6923b4248560abf..293ec464b1cb4db1734d0c059e59f60bfeb2b7eb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
@@ -325,6 +325,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||
private final EntityDimensions dimensions;
|
||||
private final float spawnDimensionsScale;
|
||||
private final FeatureFlagSet requiredFeatures;
|
||||
+ public int ttl = -1; // Pufferfish
|
||||
|
||||
private static <T extends Entity> EntityType<T> register(String id, EntityType.Builder type) { // CraftBukkit - decompile error
|
||||
return (EntityType) Registry.register(BuiltInRegistries.ENTITY_TYPE, id, (EntityType<T>) type.build(id)); // CraftBukkit - decompile error
|
||||
@@ -99,7 +99,7 @@ public class Main {
|
||||
```
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/util/Mth.java b/src/main/java/net/minecraft/util/Mth.java
|
||||
index f298cdfcf1539e467f57f9f7789de3cf2ca54665..3468b7fbc7440f220fce8039f237658a593df296 100644
|
||||
index ef93fc37759e0b54387c8a59adc2b19258cfeb7d..6b21782ad18cd5dbd1b9a59e5dc12c670c2a42fb 100644
|
||||
--- a/src/main/java/net/minecraft/util/Mth.java
|
||||
+++ b/src/main/java/net/minecraft/util/Mth.java
|
||||
@@ -58,18 +58,15 @@ public class Mth {
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 31 Jul 2024 13:38:04 +0800
|
||||
Date: Sat, 30 Nov 2024 12:13:26 +0800
|
||||
Subject: [PATCH] Gale Skip entity move if movement is zero
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 9b87aa41f03056721757348151b1119016421650..e20533b2ab9f39fc942271b704d644fb382376f7 100644
|
||||
index 9c29f99c9426db12231d7423ca24ca6fecf9c868..3b2bce1b5261a0efbbfcd7d38bf7f093d97df3a6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -324,6 +324,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -283,6 +283,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public float yRotO;
|
||||
public float xRotO;
|
||||
private AABB bb;
|
||||
@@ -16,10 +16,10 @@ index 9b87aa41f03056721757348151b1119016421650..e20533b2ab9f39fc942271b704d644fb
|
||||
public boolean onGround;
|
||||
public boolean horizontalCollision;
|
||||
public boolean verticalCollision;
|
||||
@@ -1139,6 +1140,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1189,6 +1190,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
//Luminol end
|
||||
|
||||
public void move(MoverType movementType, Vec3 movement) {
|
||||
public void move(MoverType type, Vec3 movement) {
|
||||
+ // Gale start - VMP - skip entity move if movement is zero
|
||||
+ if (!this.boundingBoxChanged && movement.equals(Vec3.ZERO)) {
|
||||
+ return;
|
||||
@@ -28,7 +28,7 @@ index 9b87aa41f03056721757348151b1119016421650..e20533b2ab9f39fc942271b704d644fb
|
||||
final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity
|
||||
// Paper start - detailed watchdog information
|
||||
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main");
|
||||
@@ -4981,6 +4987,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -5283,6 +5289,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AABB boundingBox) {
|
||||
@@ -1,73 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 4 Aug 2024 22:15:50 +0800
|
||||
Subject: [PATCH] Pufferfish Simpler ShapelessRecipes comparison for Vanilla
|
||||
|
||||
|
||||
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 213ee4aa988dd4c2a5a7be99b1d13f67338e5209..8e46753af60aa9fd8e4b4c0f955f7a55a77de314 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
+import net.minecraft.world.inventory.CraftingContainer;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
// CraftBukkit start
|
||||
@@ -25,8 +26,13 @@ public class ShapelessRecipe extends io.papermc.paper.inventory.recipe.RecipeBoo
|
||||
final CraftingBookCategory category;
|
||||
final ItemStack result;
|
||||
final NonNullList<Ingredient> ingredients;
|
||||
+ private final boolean isBukkit; // Pufferfish
|
||||
|
||||
+ // Pufferfish start
|
||||
public ShapelessRecipe(String group, CraftingBookCategory category, ItemStack result, NonNullList<Ingredient> ingredients) {
|
||||
+ this(group, category, result, ingredients, false);
|
||||
+ }
|
||||
+ public ShapelessRecipe(String group, CraftingBookCategory category, ItemStack result, NonNullList<Ingredient> ingredients, boolean isBukkit) { this.isBukkit = isBukkit; // Pufferfish end
|
||||
this.group = group;
|
||||
this.category = category;
|
||||
this.result = result;
|
||||
@@ -76,6 +82,28 @@ public class ShapelessRecipe extends io.papermc.paper.inventory.recipe.RecipeBoo
|
||||
}
|
||||
|
||||
public boolean matches(CraftingInput input, Level world) {
|
||||
+ // Pufferfish start
|
||||
+ if (!this.isBukkit) {
|
||||
+ java.util.List<Ingredient> 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 - unwrap ternary & better exact choice recipes
|
||||
if (input.ingredientCount() != this.ingredients.size()) {
|
||||
return false;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java
|
||||
index 96d772eb02f79f8c478f5e6f065e387aa7665b18..c5ce412f321b8b4f31cc042893659e213b081f29 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java
|
||||
@@ -45,6 +45,6 @@ public class CraftShapelessRecipe extends ShapelessRecipe implements CraftRecipe
|
||||
data.set(i, this.toNMS(ingred.get(i), true));
|
||||
}
|
||||
|
||||
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.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<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.ShapelessRecipe(this.getGroup(), CraftRecipe.getCategory(this.getCategory()), CraftItemStack.asNMSCopy(this.getResult()), data, true))); // Pufferfish
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Sparkly Paper Optimize canSee checks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 74524dcd4539a31e9d0037cd607ffbfce02f414c..9d6d0c8c2a869c088b7ece7f3390f620d2c348b9 100644
|
||||
index 74cd86aea1a82f169cb50dac14a8973c97cca88d..044d1787481eecdf41eaa932e418d748920ebef3 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1222,7 +1222,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1256,7 +1256,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Folia end - region threading
|
||||
|
||||
// CraftBukkit start - respect vanish API
|
||||
@@ -18,10 +18,10 @@ index 74524dcd4539a31e9d0037cd607ffbfce02f414c..9d6d0c8c2a869c088b7ece7f3390f620
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 77576c06ffc0a677b1bfb63d48d39fba2aa2050d..4dfc7186b7ee0f77e681911fc93edc455e7bf19f 100644
|
||||
index 1872b19dfefb40e6673fd2b8ddb8d3c384020073..bf9cf758c7aef50d34e2017665b6d3f4125228f5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -200,7 +200,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -206,7 +206,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
private boolean hasPlayedBefore = false;
|
||||
private final ConversationTracker conversationTracker = new ConversationTracker();
|
||||
private final Set<String> channels = new HashSet<String>();
|
||||
@@ -30,7 +30,7 @@ index 77576c06ffc0a677b1bfb63d48d39fba2aa2050d..4dfc7186b7ee0f77e681911fc93edc45
|
||||
private final Set<UUID> unlistedEntities = new HashSet<>(); // Paper - Add Listing API for Player
|
||||
private static final WeakHashMap<Plugin, WeakReference<Plugin>> pluginWeakReferences = new WeakHashMap<>();
|
||||
private int hash = 0;
|
||||
@@ -2257,9 +2257,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2278,9 +2278,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public boolean canSee(org.bukkit.entity.Entity entity) {
|
||||
@@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..6235ff18455a21695bdc2d65367558d3
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
|
||||
index e96f15814986109e5e947c7b3b210be6e56ba0ed..31354cbf344c222a8e6e892091ea30d81b8b2706 100644
|
||||
index 65d1af43b8bc740a9dc77dd8d5ba99de000fe57a..d2df220bb9d8b567314696582b71f86359e6ce6a 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/MapItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
|
||||
@@ -281,7 +281,7 @@ public class MapItem extends ComplexItem {
|
||||
@@ -280,7 +280,7 @@ public class MapItem extends Item {
|
||||
mapItemSavedData.tickCarriedBy(player, stack);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 4 Dec 2024 23:51:38 +0800
|
||||
Subject: [PATCH] SparklyPaper Skip "distanceToSqr" call in
|
||||
"ServerEntity#sendChanges" if the delta movement hasn't changed
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 103e2c414780be66324bcb9cd4ea539bbdfe12ad..3ea1ae600a730b1bb3488b79d145c65419687947 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -230,6 +230,8 @@ public class ServerEntity {
|
||||
|
||||
if (this.entity.hasImpulse || this.trackDelta || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) {
|
||||
Vec3 vec3d1 = this.entity.getDeltaMovement();
|
||||
+
|
||||
+ if (vec3d1 != this.lastSentMovement) { // SparklyPaper start - skip distanceToSqr call in ServerEntity#sendChanges if the delta movement hasn't changed
|
||||
double d0 = vec3d1.distanceToSqr(this.lastSentMovement);
|
||||
|
||||
if (d0 > 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) {
|
||||
@@ -244,6 +246,7 @@ public class ServerEntity {
|
||||
this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement));
|
||||
}
|
||||
}
|
||||
+ } // SparklyPaper end
|
||||
}
|
||||
|
||||
if (packet1 != null) {
|
||||
@@ -1,21 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Fri, 25 Oct 2024 00:09:17 +0800
|
||||
Date: Wed, 4 Dec 2024 23:53:03 +0800
|
||||
Subject: [PATCH] KioCG Chunk API and display of chunkhot in tpsbar
|
||||
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/ChunkSystem.java b/src/main/java/ca/spottedleaf/moonrise/common/util/ChunkSystem.java
|
||||
index 83b052dbf6d21775664b286518f3cef1d86e87d1..c6c5292e96ef610b6edbb9341fda97d4cdec30e3 100644
|
||||
index 30eb7fd0b83ad1626d337cb770fac3dda5202344..cbe8f1fce4327bcc2a677b3da268cf52fef90335 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/common/util/ChunkSystem.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/ChunkSystem.java
|
||||
@@ -113,6 +113,7 @@ public final class ChunkSystem {
|
||||
@@ -127,6 +127,7 @@ public final class ChunkSystem {
|
||||
}
|
||||
|
||||
public static void onChunkNotTicking(final LevelChunk chunk, final ChunkHolder holder) {
|
||||
+ chunk.getChunkHot().clear(); // KioCG
|
||||
chunk.getLevel().getCurrentWorldData().removeTickingChunk(chunk.moonrise$getChunkAndHolder()); // Folia - region threading
|
||||
((ChunkTickServerLevel)(ServerLevel)chunk.getLevel()).moonrise$removeChunkForPlayerTicking(chunk); // Moonrise - chunk tick iteration
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/com/kiocg/ChunkHot.java b/src/main/java/com/kiocg/ChunkHot.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..53b4397997bc9b9b9d88e48304b37a2590161906
|
||||
@@ -132,10 +132,10 @@ index aafb2f5052c7c8e5971a47308253badb3027093c..9fe7ac7ba83bbcc9a2a851a5cace4764
|
||||
public static int updateInterval = 15;
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/functions/GlobalServerTpsBar.java b/src/main/java/me/earthme/luminol/functions/GlobalServerTpsBar.java
|
||||
index 026807e0851d67c6d57e81f573ac1bf8fedc6109..c45f6bd60d1cf7a915aa6ceea07c0929507b86e2 100644
|
||||
index de2f03d6e771c09e8da2da454b7ec4a16c0a17ab..0b7347e8fdf995900221ee4aa4e97a4d260c6f9f 100644
|
||||
--- a/src/main/java/me/earthme/luminol/functions/GlobalServerTpsBar.java
|
||||
+++ b/src/main/java/me/earthme/luminol/functions/GlobalServerTpsBar.java
|
||||
@@ -138,7 +138,8 @@ public class GlobalServerTpsBar {
|
||||
@@ -128,7 +128,8 @@ public class GlobalServerTpsBar {
|
||||
TpsBarConfig.tpsBarFormat,
|
||||
Placeholder.component("tps",getTpsComponent(tps)),
|
||||
Placeholder.component("mspt",getMsptComponent(mspt)),
|
||||
@@ -145,7 +145,7 @@ index 026807e0851d67c6d57e81f573ac1bf8fedc6109..c45f6bd60d1cf7a915aa6ceea07c0929
|
||||
));
|
||||
bar.color(barColorFromTps(tps));
|
||||
bar.progress((float) Math.min((float)1,Math.max(mspt / 50,0)));
|
||||
@@ -180,6 +181,32 @@ public class GlobalServerTpsBar {
|
||||
@@ -170,6 +171,32 @@ public class GlobalServerTpsBar {
|
||||
return MiniMessage.miniMessage().deserialize(replaced,Placeholder.parsed("text", String.format("%.2f", mspt)));
|
||||
}
|
||||
|
||||
@@ -179,13 +179,13 @@ index 026807e0851d67c6d57e81f573ac1bf8fedc6109..c45f6bd60d1cf7a915aa6ceea07c0929
|
||||
if (mspt == -1){
|
||||
return BossBar.Color.valueOf(TpsBarConfig.tpsColors.get(3));
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 29103346dd3e5e69de260c95051c9447fda0da41..93cc0a7562dce407b486007a9dd33652d2b75b90 100644
|
||||
index 55bac6e6cccce6e0282936ac78bbe82628daa655..2cff9edf247587dffaac5405127de0afc17dc7c0 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1715,6 +1715,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1801,6 +1801,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
} finally { foliaProfiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.ENTITY_SCHEDULER_TICK); } // Folia - profiler
|
||||
}
|
||||
// Folia end - region threading
|
||||
|
||||
+ // KioCG start - ChunkHot
|
||||
+ final ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<net.minecraft.world.level.chunk.LevelChunk> chunks = new ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<>();
|
||||
+ if (region != null){
|
||||
@@ -209,10 +209,10 @@ index 29103346dd3e5e69de260c95051c9447fda0da41..93cc0a7562dce407b486007a9dd33652
|
||||
+ }
|
||||
+ }
|
||||
+ //KioCG end
|
||||
// Folia - region threading
|
||||
if (region == null) this.tickRateManager.tick(); // Folia - region threading
|
||||
this.tickChildren(shouldKeepTicking, region); // Folia - region threading
|
||||
@@ -1724,6 +1747,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
if (region == null && i - this.lastServerStatus >= MinecraftServer.STATUS_EXPIRE_TIME_NANOS) { // Folia - region threading
|
||||
@@ -1809,6 +1832,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
// Folia - region threading
|
||||
@@ -231,53 +231,53 @@ index 29103346dd3e5e69de260c95051c9447fda0da41..93cc0a7562dce407b486007a9dd33652
|
||||
+ }
|
||||
+ //KioCG end
|
||||
// Paper start - Incremental chunk and player saving
|
||||
final ProfilerFiller profiler = Profiler.get();
|
||||
int playerSaveInterval = io.papermc.paper.configuration.GlobalConfiguration.get().playerAutoSave.rate;
|
||||
if (playerSaveInterval < 0) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 3ebea71bbc6ced0d0a325c519436a0199666fafb..2f9ba0b4298206f458d7cd7ca73c132477a0d7b7 100644
|
||||
index 98aef7a3cfc759e4415df3a56b5fe01eb50b0428..f8dfaa6170962f5b06a0a8ccbf3d8677381babcf 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1377,6 +1377,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
@@ -1382,6 +1382,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
final int timerId = isActive ? entity.getType().tickTimerId : entity.getType().inactiveTickTimerId;
|
||||
final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle profiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler();
|
||||
profiler.startTimer(timerId);
|
||||
+ LevelChunk levelChunk = entity.shouldTickHot() ? this.getChunkIfLoaded(entity.moonrise$getSectionX(),entity.moonrise$getSectionZ()) : null; // KioCG
|
||||
+ if (levelChunk != null) levelChunk.getChunkHot().startTicking(); try { // KioCG
|
||||
// Folia end - timer
|
||||
try {
|
||||
// Paper end - timings
|
||||
@@ -1404,6 +1406,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
// Folia end - profiler
|
||||
if (isActive) { // Paper - EAR 2
|
||||
@@ -1399,6 +1401,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
} else { entity.inactiveTick(); } // Paper - EAR 2
|
||||
this.getProfiler().pop();
|
||||
} finally { timer.stopTiming(); profiler.stopTimer(timerId); } // Paper - timings // Folia - timer
|
||||
+ } finally { if (levelChunk != null) levelChunk.getChunkHot().stopTickingAndCount(); } // KioCG
|
||||
gameprofilerfiller.pop();
|
||||
} finally { profiler.stopTimer(timerId); } // Folia - timer
|
||||
+ } finally { if (levelChunk != null) levelChunk.getChunkHot().stopTickingAndCount(); } // KioCG
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -1432,6 +1435,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
@@ -1421,6 +1424,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
final int timerId = isActive ? passenger.getType().tickTimerId : passenger.getType().inactiveTickTimerId;
|
||||
final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle profiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler();
|
||||
profiler.startTimer(timerId);
|
||||
// Folia end - timer
|
||||
+ LevelChunk levelChunk = !(passenger instanceof Player) ? this.getChunkIfLoaded(passenger.blockPosition()) : null; // KioCG
|
||||
+ if (levelChunk != null) levelChunk.getChunkHot().startTicking(); try { // KioCG
|
||||
try {
|
||||
// Paper end
|
||||
// Folia end - profiler
|
||||
passenger.setOldPosAndRot();
|
||||
@@ -1472,6 +1477,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
@@ -1461,6 +1466,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
}
|
||||
|
||||
} finally { timer.stopTiming(); profiler.stopTimer(timerId); }// Paper - EAR2 timings // Folia - timer
|
||||
+ } finally { if (levelChunk != null) levelChunk.getChunkHot().stopTickingAndCount(); } // KioCG
|
||||
} finally { profiler.stopTimer(timerId); } // Folia - profiler
|
||||
+ } finally { if (levelChunk != null) levelChunk.getChunkHot().stopTickingAndCount(); } // KioCG
|
||||
}
|
||||
} else {
|
||||
passenger.stopRiding();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 8cfaa94da67bcdd5c3d30479379d384c20b4a1ac..8559d14e4136c9e70c4190db3eb04500c9e530f0 100644
|
||||
index c72bda7413d9a7ce763743d0efbd85257262477e..96880fffd92cff3f172a3ded55534eefbb0a740a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -339,6 +339,26 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
public boolean handlingMoveEvent = false;
|
||||
//Luminol end
|
||||
@@ -359,6 +359,26 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
}
|
||||
// Paper end - rewrite chunk system
|
||||
|
||||
+ // KioCG start - ChunkHot
|
||||
+ private volatile long nearbyChunkHot = 0;
|
||||
@@ -302,7 +302,7 @@ index 8cfaa94da67bcdd5c3d30479379d384c20b4a1ac..8559d14e4136c9e70c4190db3eb04500
|
||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
|
||||
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
||||
this.chatVisibility = ChatVisiblity.FULL;
|
||||
@@ -970,6 +990,12 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -1199,6 +1219,12 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
this.trackEnteredOrExitedLavaOnVehicle();
|
||||
this.updatePlayerAttributes();
|
||||
this.advancements.flushDirty(this);
|
||||
@@ -316,12 +316,12 @@ index 8cfaa94da67bcdd5c3d30479379d384c20b4a1ac..8559d14e4136c9e70c4190db3eb04500
|
||||
|
||||
private void updatePlayerAttributes() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||
index 1859477e96709368683fe5707327e92f56fbfc8e..4c4814094552fa4382b1cbe649f24f473cdbf22e 100644
|
||||
index 921527acc8624536f4a48e9fdf7fce370bc52c77..497de02dce0f397ce261b4d62777e11f67324bde 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||
@@ -449,4 +449,11 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
|
||||
public EntityDimensions getDimensions(Pose pose) {
|
||||
return EntityDimensions.scalable(this.getRadius() * 2.0F, 0.5F);
|
||||
@@ -481,4 +481,11 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
|
||||
public final boolean hurtServer(ServerLevel world, DamageSource source, float amount) {
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ // KioCG start
|
||||
@@ -332,23 +332,23 @@ index 1859477e96709368683fe5707327e92f56fbfc8e..4c4814094552fa4382b1cbe649f24f47
|
||||
+ // KioCG end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index e20533b2ab9f39fc942271b704d644fb382376f7..7c54abc8480b4184dc3712f02bd2ae2189ac0cc8 100644
|
||||
index b6aaa238626bc747379f991c17c279de52907083..3700f7c1893e9ccdcef04ae1fab5d7c97c5a91d7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -5860,4 +5860,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return ((net.minecraft.server.level.ServerChunkCache) level.getChunkSource()).isPositionTicking(this);
|
||||
@@ -6236,4 +6236,6 @@ 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
|
||||
+
|
||||
+ public boolean shouldTickHot() { return this.tickCount > 20 * 10 && this.isAlive(); } // KioCG
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LightningBolt.java b/src/main/java/net/minecraft/world/entity/LightningBolt.java
|
||||
index 4f701788bd21b61cad251a3a88f9bc416fb99051..86caa40a91ee0385bc32fd19d0fec6bd2f3634d2 100644
|
||||
index 12127b14babf646711d3a118416453c4f1ac1460..5929cd58066b1a8f305b411af8ac4abc688a5cc6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LightningBolt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LightningBolt.java
|
||||
@@ -288,4 +288,11 @@ public class LightningBolt extends Entity {
|
||||
public Stream<Entity> getHitEntities() {
|
||||
return this.hitEntities.stream().filter(Entity::isAlive);
|
||||
@@ -302,4 +302,11 @@ public class LightningBolt extends Entity {
|
||||
public final boolean hurtServer(ServerLevel world, DamageSource source, float amount) {
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ // KioCG start
|
||||
@@ -359,12 +359,12 @@ index 4f701788bd21b61cad251a3a88f9bc416fb99051..86caa40a91ee0385bc32fd19d0fec6bd
|
||||
+ // KioCG end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index bc20ef314b20de38412522edcab99aaa4ba9ac32..33a895183ddb34626a4d2b40b97ff9a5c7bbfb82 100644
|
||||
index 5280e0bd88b39a2f1ca62b03ed2c54a89df4f212..b6b5837df2bcd229425e27b513a47922748c01ff 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -1854,4 +1854,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
|
||||
return itemmonsteregg == null ? null : new ItemStack(itemmonsteregg);
|
||||
@@ -1855,4 +1855,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
public float[] getArmorDropChances() {
|
||||
return this.armorDropChances;
|
||||
}
|
||||
+
|
||||
+ // KioCG start
|
||||
@@ -375,10 +375,10 @@ index bc20ef314b20de38412522edcab99aaa4ba9ac32..33a895183ddb34626a4d2b40b97ff9a5
|
||||
+ // KioCG end
|
||||
}
|
||||
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 bbfc94237bbd546361cc4a7bde773c810e8c5d49..d9f48fe2bcf1a2e317e97046618c056b05643268 100644
|
||||
index 53a8d59681809da931d11ff76c202f950993a142..3a3cf979d79c270a5f873ff62b5618b832a34fed 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
|
||||
@@ -166,4 +166,11 @@ public class TraderLlama extends Llama {
|
||||
@@ -173,4 +173,11 @@ public class TraderLlama extends Llama {
|
||||
super.start();
|
||||
}
|
||||
}
|
||||
@@ -391,10 +391,10 @@ index bbfc94237bbd546361cc4a7bde773c810e8c5d49..d9f48fe2bcf1a2e317e97046618c056b
|
||||
+ // KioCG end
|
||||
}
|
||||
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 0af34e0f9c9696fbcb11b12fb27472ef17ad532a..08c4ae0830cd523eb2cbf7e65b6a5b8a5366d45e 100644
|
||||
index 1e77cce428d9e53142aaa2cf780b7f862d536eca..f5bad1a9f274cb5a1bdf54a4c575afaa4ab7328f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java
|
||||
@@ -326,4 +326,12 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
|
||||
@@ -327,4 +327,12 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
|
||||
return !pos.closerToCenterThan(this.trader.position(), proximityDistance);
|
||||
}
|
||||
}
|
||||
@@ -408,29 +408,30 @@ index 0af34e0f9c9696fbcb11b12fb27472ef17ad532a..08c4ae0830cd523eb2cbf7e65b6a5b8a
|
||||
+ // KioCG end
|
||||
}
|
||||
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 b3377ed06d703f54e01ba174e5a06dc928cdff96..80af7979f9a2078a6c40c958ced1d487b92542d8 100644
|
||||
index f2817f1c29431ef2c4a45dc9ef90f06d4982f7c9..77e607f35d1a76046869f5900321263927344e4c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -2516,4 +2516,12 @@ public abstract class Player extends LivingEntity {
|
||||
return this.message;
|
||||
}
|
||||
@@ -2447,6 +2447,13 @@ public abstract class Player extends LivingEntity {
|
||||
return this.abilities.flying ? false : super.onClimbable();
|
||||
}
|
||||
+
|
||||
+
|
||||
|
||||
+ // KioCG start
|
||||
+ @Override
|
||||
+ public boolean shouldTickHot() {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // KioCG end
|
||||
}
|
||||
+
|
||||
public static enum BedSleepingProblem {
|
||||
|
||||
NOT_POSSIBLE_HERE, NOT_POSSIBLE_NOW(Component.translatable("block.minecraft.bed.no_sleep")), TOO_FAR_AWAY(Component.translatable("block.minecraft.bed.too_far_away")), OBSTRUCTED(Component.translatable("block.minecraft.bed.obstructed")), OTHER_PROBLEM, NOT_SAFE(Component.translatable("block.minecraft.bed.not_safe"));
|
||||
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 2f0a40134ef2fcccf407a5381994c3454040097e..4abfdad701a91b9c20b22064adb943c7e3d5a9a1 100644
|
||||
index 7ccd7d6dc61948210ecb9c3acee8f1740e389106..04f3e62f41d4bf0fc5b98d24b72789e00110f626 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
@@ -437,4 +437,11 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
@@ -566,4 +566,11 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
|
||||
return DoubleDoubleImmutablePair.of(d0, d1);
|
||||
T create(ServerLevel world, LivingEntity shooter, ItemStack stack);
|
||||
}
|
||||
+
|
||||
+ // KioCG start
|
||||
@@ -441,53 +442,54 @@ index 2f0a40134ef2fcccf407a5381994c3454040097e..4abfdad701a91b9c20b22064adb943c7
|
||||
+ // KioCG 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 ea95a382561dcf2bb958a08351d493087a49336a..054587c3a072b0480a3cff0ef9148d708e600baf 100644
|
||||
index 6003e3495e61073c39928918b9d9f4c2e20f3a49..bb4053a89a737a0ba4a09afe821924967fbea004 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -92,6 +92,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
private final Int2ObjectMap<GameEventListenerRegistry> gameEventListenerRegistrySections;
|
||||
@@ -95,6 +95,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
private final LevelChunkTicks<Block> blockTicks;
|
||||
private final LevelChunkTicks<Fluid> fluidTicks;
|
||||
private LevelChunk.UnsavedListener unsavedListener;
|
||||
+ private final com.kiocg.ChunkHot chunkHot = new com.kiocg.ChunkHot(); public com.kiocg.ChunkHot getChunkHot() { return this.chunkHot; } // KioCG
|
||||
|
||||
public LevelChunk(Level world, ChunkPos pos) {
|
||||
this(world, pos, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, (LevelChunkSection[]) null, (LevelChunk.PostLoadProcessor) null, (BlendingData) null);
|
||||
@@ -1051,6 +1052,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
@@ -1085,6 +1086,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
gameprofilerfiller.push(this::getType);
|
||||
this.blockEntity.tickTimer.startTiming(); // Spigot
|
||||
+ LevelChunk.this.chunkHot.startTicking(); // KioCG
|
||||
profiler.startTimer(timerId); try { // Folia - profiler
|
||||
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
|
||||
|
||||
@@ -1081,6 +1083,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
} finally {
|
||||
this.blockEntity.tickTimer.stopTiming();
|
||||
// Spigot end
|
||||
+ LevelChunk.this.chunkHot.stopTickingAndCount(); // KioCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1100,7 +1102,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
}
|
||||
// Paper end - Remove the Block Entity if it's invalid
|
||||
}
|
||||
- } finally { profiler.stopTimer(timerId); } // Folia - profiler
|
||||
+ } finally { profiler.stopTimer(timerId); LevelChunk.this.chunkHot.stopTickingAndCount(); } // Folia - profiler // KioCG
|
||||
|
||||
gameprofilerfiller.pop();
|
||||
} catch (Throwable throwable) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java
|
||||
index e679b40b9628b0eb7152978ef641f9c918c4c8b2..bf9ae765242bb61d3e279893b0355d122cb1e985 100644
|
||||
index e414da8a51bb9b49c28a74eca166046cbee44835..ac22bb47836e97904729bad91ff75ce7abfb30b6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java
|
||||
@@ -63,7 +63,10 @@ public interface NeighborUpdater {
|
||||
@@ -73,7 +73,10 @@ public interface NeighborUpdater {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ net.minecraft.world.level.chunk.LevelChunk levelChunk = world.getChunkIfLoaded(pos); // KioCG
|
||||
+ if (levelChunk != null) levelChunk.getChunkHot().startTicking(); try { // KioCG
|
||||
state.handleNeighborChanged(world, pos, sourceBlock, sourcePos, notify);
|
||||
state.handleNeighborChanged(world, pos, sourceBlock, orientation, notify);
|
||||
+ } finally { if (levelChunk != null) levelChunk.getChunkHot().stopTickingAndCount(); } // KioCG
|
||||
// Spigot Start
|
||||
} catch (StackOverflowError ex) {
|
||||
world.lastPhysicsProblem = new BlockPos(pos);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
index 45e262308aebafa377a2353661acdd122933b99e..10b2261169d3cd10d736273fe7703f509fe2dffc 100644
|
||||
index c2bffe3450ee9f768e00a23ec09df74d7a06d49b..4791e013e8257f57b5db6f974dc05829b911cfa0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
@@ -436,4 +436,12 @@ public class CraftChunk implements Chunk {
|
||||
@@ -437,4 +437,12 @@ public class CraftChunk implements Chunk {
|
||||
static {
|
||||
Arrays.fill(FULL_LIGHT, (byte) 0xFF);
|
||||
}
|
||||
@@ -501,10 +503,10 @@ index 45e262308aebafa377a2353661acdd122933b99e..10b2261169d3cd10d736273fe7703f50
|
||||
+ // KioCG end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 4dfc7186b7ee0f77e681911fc93edc455e7bf19f..4fb1abfa81b02198c823d6e175bde611a321edd3 100644
|
||||
index bf9cf758c7aef50d34e2017665b6d3f4125228f5..7cb4389e1a03655d00cd19ad43019c5ff14785f9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -3599,4 +3599,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -3596,4 +3596,11 @@ 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
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 31 Jul 2024 14:30:23 +0800
|
||||
Date: Sat, 30 Nov 2024 12:24:00 +0800
|
||||
Subject: [PATCH] Purpur use alternative keep alive
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..43bbc2c30bdd3872a0179e0070403c3e
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
index ea99a4e39cdfb4eeebc299030f7768b9c684df4e..c9a298808d287a2f82e075536d8a79d2281f1ce2 100644
|
||||
index d01063b964a67ecff2998a9e02e7f37a9af88c84..1e72e96db43ab7ae2f1ed88a973a95543b791461 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -79,6 +79,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -80,6 +80,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
private long keepAliveChallenge;
|
||||
private long closedListenerTime;
|
||||
private boolean closed = false;
|
||||
@@ -42,7 +42,7 @@ index ea99a4e39cdfb4eeebc299030f7768b9c684df4e..c9a298808d287a2f82e075536d8a79d2
|
||||
private int latency;
|
||||
private volatile boolean suspendFlushingOnServerThread = false;
|
||||
public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks
|
||||
@@ -141,6 +142,16 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -148,6 +149,16 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
|
||||
@Override
|
||||
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
|
||||
@@ -59,7 +59,7 @@ index ea99a4e39cdfb4eeebc299030f7768b9c684df4e..c9a298808d287a2f82e075536d8a79d2
|
||||
//PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // CraftBukkit // Paper - handle ServerboundKeepAlivePacket async
|
||||
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
|
||||
int i = (int) (Util.getMillis() - this.keepAliveTime);
|
||||
@@ -266,6 +277,21 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -273,6 +284,21 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
long currentTime = Util.getMillis();
|
||||
long elapsedTime = currentTime - this.keepAliveTime;
|
||||
|
||||
@@ -81,11 +81,11 @@ index ea99a4e39cdfb4eeebc299030f7768b9c684df4e..c9a298808d287a2f82e075536d8a79d2
|
||||
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
|
||||
@@ -277,6 +303,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -284,6 +310,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
|
||||
+ } // Purpur end
|
||||
|
||||
this.server.getProfiler().pop();
|
||||
Profiler.get().pop();
|
||||
}
|
||||
@@ -1,428 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 31 Jul 2024 13:42:17 +0800
|
||||
Subject: [PATCH] Gale Faster chunk serialization
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..349618b7f544bf9a30e0796d4d9a26407a2b8329
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java
|
||||
@@ -0,0 +1,192 @@
|
||||
+// Gale - Lithium - faster chunk serialization
|
||||
+
|
||||
+package me.jellysquid.mods.lithium.common.world.chunk;
|
||||
+
|
||||
+import com.google.common.collect.ImmutableList;
|
||||
+import it.unimi.dsi.fastutil.HashCommon;
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2IntMap;
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.List;
|
||||
+import java.util.function.Predicate;
|
||||
+import net.minecraft.core.IdMap;
|
||||
+import net.minecraft.network.FriendlyByteBuf;
|
||||
+import net.minecraft.network.VarInt;
|
||||
+import net.minecraft.world.level.chunk.Palette;
|
||||
+import net.minecraft.world.level.chunk.PaletteResize;
|
||||
+
|
||||
+import static it.unimi.dsi.fastutil.Hash.FAST_LOAD_FACTOR;
|
||||
+
|
||||
+/**
|
||||
+ * Generally provides better performance over the vanilla {@link net.minecraft.world.level.chunk.HashMapPalette} when calling
|
||||
+ * {@link LithiumHashPalette#idFor(Object)} through using a faster backing map and reducing pointer chasing.
|
||||
+ */
|
||||
+public class LithiumHashPalette<T> implements Palette<T> {
|
||||
+ private static final int ABSENT_VALUE = -1;
|
||||
+
|
||||
+ private final IdMap<T> idList;
|
||||
+ private final PaletteResize<T> resizeHandler;
|
||||
+ private final int indexBits;
|
||||
+
|
||||
+ private final Reference2IntMap<T> table;
|
||||
+ private T[] entries;
|
||||
+ private int size = 0;
|
||||
+
|
||||
+ public LithiumHashPalette(IdMap<T> idList, PaletteResize<T> resizeHandler, int indexBits, T[] entries, Reference2IntMap<T> table, int size) {
|
||||
+ this.idList = idList;
|
||||
+ this.resizeHandler = resizeHandler;
|
||||
+ this.indexBits = indexBits;
|
||||
+ this.entries = entries;
|
||||
+ this.table = table;
|
||||
+ this.size = size;
|
||||
+ }
|
||||
+
|
||||
+ public LithiumHashPalette(IdMap<T> idList, int bits, PaletteResize<T> resizeHandler, List<T> list) {
|
||||
+ this(idList, bits, resizeHandler);
|
||||
+
|
||||
+ for (T t : list) {
|
||||
+ this.addEntry(t);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ public LithiumHashPalette(IdMap<T> idList, int bits, PaletteResize<T> resizeHandler) {
|
||||
+ this.idList = idList;
|
||||
+ this.indexBits = bits;
|
||||
+ this.resizeHandler = resizeHandler;
|
||||
+
|
||||
+ int capacity = 1 << bits;
|
||||
+
|
||||
+ this.entries = (T[]) new Object[capacity];
|
||||
+ this.table = new Reference2IntOpenHashMap<>(capacity, FAST_LOAD_FACTOR);
|
||||
+ this.table.defaultReturnValue(ABSENT_VALUE);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int idFor(T obj) {
|
||||
+ int id = this.table.getInt(obj);
|
||||
+
|
||||
+ if (id == ABSENT_VALUE) {
|
||||
+ id = this.computeEntry(obj);
|
||||
+ }
|
||||
+
|
||||
+ return id;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean maybeHas(Predicate<T> predicate) {
|
||||
+ for (int i = 0; i < this.size; ++i) {
|
||||
+ if (predicate.test(this.entries[i])) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ private int computeEntry(T obj) {
|
||||
+ int id = this.addEntry(obj);
|
||||
+
|
||||
+ if (id >= 1 << this.indexBits) {
|
||||
+ if (this.resizeHandler == null) {
|
||||
+ throw new IllegalStateException("Cannot grow");
|
||||
+ } else {
|
||||
+ id = this.resizeHandler.onResize(this.indexBits + 1, obj);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return id;
|
||||
+ }
|
||||
+
|
||||
+ private int addEntry(T obj) {
|
||||
+ int nextId = this.size;
|
||||
+
|
||||
+ if (nextId >= this.entries.length) {
|
||||
+ this.resize(this.size);
|
||||
+ }
|
||||
+
|
||||
+ this.table.put(obj, nextId);
|
||||
+ this.entries[nextId] = obj;
|
||||
+
|
||||
+ this.size++;
|
||||
+
|
||||
+ return nextId;
|
||||
+ }
|
||||
+
|
||||
+ private void resize(int neededCapacity) {
|
||||
+ this.entries = Arrays.copyOf(this.entries, HashCommon.nextPowerOfTwo(neededCapacity + 1));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public T valueFor(int id) {
|
||||
+ T[] entries = this.entries;
|
||||
+
|
||||
+ if (id >= 0 && id < entries.length) {
|
||||
+ return entries[id];
|
||||
+ }
|
||||
+
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void read(FriendlyByteBuf buf) {
|
||||
+ this.clear();
|
||||
+
|
||||
+ int entryCount = buf.readVarInt();
|
||||
+
|
||||
+ for (int i = 0; i < entryCount; ++i) {
|
||||
+ this.addEntry(this.idList.byId(buf.readVarInt()));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void write(FriendlyByteBuf buf) {
|
||||
+ int size = this.size;
|
||||
+ buf.writeVarInt(size);
|
||||
+
|
||||
+ for (int i = 0; i < size; ++i) {
|
||||
+ buf.writeVarInt(this.idList.getId(this.valueFor(i)));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getSerializedSize() {
|
||||
+ int size = VarInt.getByteSize(this.size);
|
||||
+
|
||||
+ for (int i = 0; i < this.size; ++i) {
|
||||
+ size += VarInt.getByteSize(this.idList.getId(this.valueFor(i)));
|
||||
+ }
|
||||
+
|
||||
+ return size;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getSize() {
|
||||
+ return this.size;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Palette<T> copy() {
|
||||
+ return new LithiumHashPalette<>(this.idList, this.resizeHandler, this.indexBits, this.entries.clone(), new Reference2IntOpenHashMap<>(this.table), this.size);
|
||||
+ }
|
||||
+
|
||||
+ private void clear() {
|
||||
+ Arrays.fill(this.entries, null);
|
||||
+ this.table.clear();
|
||||
+ this.size = 0;
|
||||
+ }
|
||||
+
|
||||
+ public List<T> getElements() {
|
||||
+ ImmutableList.Builder<T> builder = new ImmutableList.Builder<>();
|
||||
+ for (T entry : this.entries) {
|
||||
+ if (entry != null) {
|
||||
+ builder.add(entry);
|
||||
+ }
|
||||
+ }
|
||||
+ return builder.build();
|
||||
+ }
|
||||
+
|
||||
+ public static <A> Palette<A> create(int bits, IdMap<A> idList, PaletteResize<A> listener, List<A> list) {
|
||||
+ return new LithiumHashPalette<>(idList, bits, listener, list);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/util/BitStorage.java b/src/main/java/net/minecraft/util/BitStorage.java
|
||||
index 19661e106612b8e4e152085fb398db7bd06acc23..4fd45dc4dca29ac5f0be3b02d8ce17127bdc38cf 100644
|
||||
--- a/src/main/java/net/minecraft/util/BitStorage.java
|
||||
+++ b/src/main/java/net/minecraft/util/BitStorage.java
|
||||
@@ -21,6 +21,8 @@ public interface BitStorage extends ca.spottedleaf.moonrise.patches.block_counti
|
||||
|
||||
BitStorage copy();
|
||||
|
||||
+ <T> void compact(net.minecraft.world.level.chunk.Palette<T> srcPalette, net.minecraft.world.level.chunk.Palette<T> dstPalette, short[] out); // Gale - Lithium - faster chunk serialization
|
||||
+
|
||||
// Paper start - block counting
|
||||
// provide default impl in case mods implement this...
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java
|
||||
index 8acf2f2491a8d9d13392c5e89b2bd5c9918285e1..5ff7b2c9d97cb428b7a3a54bd53ab385afe92ce1 100644
|
||||
--- a/src/main/java/net/minecraft/util/SimpleBitStorage.java
|
||||
+++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java
|
||||
@@ -401,4 +401,45 @@ public class SimpleBitStorage implements BitStorage {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Gale start - Lithium - faster chunk serialization
|
||||
+ @Override
|
||||
+ public <T> void compact(net.minecraft.world.level.chunk.Palette<T> srcPalette, net.minecraft.world.level.chunk.Palette<T> dstPalette, short[] out) {
|
||||
+ if (this.size >= Short.MAX_VALUE) {
|
||||
+ throw new IllegalStateException("Array too large");
|
||||
+ }
|
||||
+
|
||||
+ if (this.size != out.length) {
|
||||
+ throw new IllegalStateException("Array size mismatch");
|
||||
+ }
|
||||
+
|
||||
+ short[] mappings = new short[(int) (this.mask + 1)];
|
||||
+
|
||||
+ int idx = 0;
|
||||
+
|
||||
+ for (long word : this.data) {
|
||||
+ long bits = word;
|
||||
+
|
||||
+ for (int elementIdx = 0; elementIdx < this.valuesPerLong; ++elementIdx) {
|
||||
+ int value = (int) (bits & this.mask);
|
||||
+ int remappedId = mappings[value];
|
||||
+
|
||||
+ if (remappedId == 0) {
|
||||
+ remappedId = dstPalette.idFor(srcPalette.valueFor(value)) + 1;
|
||||
+ mappings[value] = (short) remappedId;
|
||||
+ }
|
||||
+
|
||||
+ out[idx] = (short) (remappedId - 1);
|
||||
+ bits >>= this.bits;
|
||||
+
|
||||
+ ++idx;
|
||||
+
|
||||
+ if (idx >= this.size) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Gale end - Lithium - faster chunk serialization
|
||||
+
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
||||
index 15c5164d0ef41a978c16ee317fa73e97f2480207..60ffd244d5e1c528d908ee9a5dd2d8907a30bb24 100644
|
||||
--- a/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
||||
+++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
||||
@@ -12,6 +12,8 @@ public class ZeroBitStorage implements BitStorage {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
+ @Override public <T> void compact(net.minecraft.world.level.chunk.Palette<T> srcPalette, net.minecraft.world.level.chunk.Palette<T> dstPalette, short[] out) {} // Gale - Lithium - faster chunk serialization
|
||||
+
|
||||
@Override
|
||||
public final int getAndSet(int index, int value) { // Paper - Perf: Optimize SimpleBitStorage
|
||||
//Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper - Perf: Optimize SimpleBitStorage
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java b/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java
|
||||
index acae3eb30e0689048937f479dc3070f0688abdad..4b79f0474a9013dd4fdb68c6363ca1942ba8b007 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java
|
||||
@@ -1,5 +1,5 @@
|
||||
package net.minecraft.world.level.chunk;
|
||||
|
||||
-interface PaletteResize<T> {
|
||||
+public interface PaletteResize<T> { // Gale - Lithium - faster chunk serialization - package -> public
|
||||
int onResize(int newBits, T object);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
index 13d3c877b006a4975e7370713e3919c661e7890f..a2e0c9df771483904ffeaf6ef3bd3ab4b189fdb3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
@@ -25,6 +25,22 @@ import net.minecraft.util.ThreadingDetector;
|
||||
import net.minecraft.util.ZeroBitStorage;
|
||||
|
||||
public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainerRO<T> {
|
||||
+
|
||||
+ // Gale start - Lithium - faster chunk serialization
|
||||
+ private static final ThreadLocal<short[]> CACHED_ARRAY_4096 = ThreadLocal.withInitial(() -> new short[4096]);
|
||||
+ private static final ThreadLocal<short[]> CACHED_ARRAY_64 = ThreadLocal.withInitial(() -> new short[64]);
|
||||
+ private Optional<LongStream> asOptional(long[] data) {
|
||||
+ return Optional.of(Arrays.stream(data));
|
||||
+ }
|
||||
+ private short[] getOrCreate(int size) {
|
||||
+ return switch (size) {
|
||||
+ case 64 -> CACHED_ARRAY_64.get();
|
||||
+ case 4096 -> CACHED_ARRAY_4096.get();
|
||||
+ default -> new short[size];
|
||||
+ };
|
||||
+ }
|
||||
+ // Gale end - Lithium - faster chunk serialization
|
||||
+
|
||||
private static final int MIN_PALETTE_BITS = 0;
|
||||
private final PaletteResize<T> dummyPaletteResize = (newSize, added) -> 0;
|
||||
public final IdMap<T> registry;
|
||||
@@ -304,28 +320,54 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
public synchronized PalettedContainerRO.PackedData<T> pack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider) { // Paper - synchronize
|
||||
this.acquire();
|
||||
|
||||
- PalettedContainerRO.PackedData var12;
|
||||
+ // Gale start - Lithium - faster chunk serialization
|
||||
+ Optional<LongStream> data = Optional.empty();
|
||||
+ List<T> elements = null;
|
||||
try {
|
||||
- HashMapPalette<T> hashMapPalette = new HashMapPalette<>(idList, this.data.storage.getBits(), this.dummyPaletteResize);
|
||||
- int i = paletteProvider.size();
|
||||
- int[] is = new int[i];
|
||||
- this.data.storage.unpack(is);
|
||||
- swapPalette(is, id -> hashMapPalette.idFor(this.data.palette.valueFor(id)));
|
||||
- int j = paletteProvider.calculateBitsForSerialization(idList, hashMapPalette.getSize());
|
||||
- Optional<LongStream> optional;
|
||||
- if (j != 0) {
|
||||
- SimpleBitStorage simpleBitStorage = new SimpleBitStorage(j, i, is);
|
||||
- optional = Optional.of(Arrays.stream(simpleBitStorage.getRaw()));
|
||||
- } else {
|
||||
- optional = Optional.empty();
|
||||
+ // The palette that will be serialized
|
||||
+ me.jellysquid.mods.lithium.common.world.chunk.LithiumHashPalette<T> hashPalette = null;
|
||||
+
|
||||
+ final Palette<T> palette = this.data.palette();
|
||||
+ final BitStorage storage = this.data.storage();
|
||||
+ if (storage instanceof ZeroBitStorage || palette.getSize() == 1) {
|
||||
+ // If the palette only contains one entry, don't attempt to repack it.
|
||||
+ elements = List.of(palette.valueFor(0));
|
||||
+ } else if (palette instanceof me.jellysquid.mods.lithium.common.world.chunk.LithiumHashPalette<T> lithiumHashPalette) {
|
||||
+ hashPalette = lithiumHashPalette;
|
||||
}
|
||||
|
||||
- var12 = new PalettedContainerRO.PackedData<>(hashMapPalette.getEntries(), optional);
|
||||
+ if (elements == null) {
|
||||
+ me.jellysquid.mods.lithium.common.world.chunk.LithiumHashPalette<T> compactedPalette = new me.jellysquid.mods.lithium.common.world.chunk.LithiumHashPalette<>(idList, storage.getBits(), this.dummyPaletteResize);
|
||||
+ short[] array = this.getOrCreate(paletteProvider.size());
|
||||
+
|
||||
+ storage.compact(this.data.palette(), compactedPalette, array);
|
||||
+
|
||||
+ // If the palette didn't change during compaction, do a simple copy of the data array
|
||||
+ if (hashPalette != null && hashPalette.getSize() == compactedPalette.getSize() && storage.getBits() == paletteProvider.calculateBitsForSerialization(idList, hashPalette.getSize())) { // paletteSize can de-sync from palette - see https://github.com/CaffeineMC/lithium-fabric/issues/279
|
||||
+ data = this.asOptional(storage.getRaw().clone());
|
||||
+ elements = hashPalette.getElements();
|
||||
+ } else {
|
||||
+ int bits = paletteProvider.calculateBitsForSerialization(idList, compactedPalette.getSize());
|
||||
+ if (bits != 0) {
|
||||
+ // Re-pack the integer array as the palette has changed size
|
||||
+ SimpleBitStorage copy = new SimpleBitStorage(bits, array.length);
|
||||
+ for (int i = 0; i < array.length; ++i) {
|
||||
+ copy.set(i, array[i]);
|
||||
+ }
|
||||
+
|
||||
+ // We don't need to clone the data array as we are the sole owner of it
|
||||
+ data = this.asOptional(copy.getRaw());
|
||||
+ }
|
||||
+
|
||||
+ elements = compactedPalette.getElements();
|
||||
+ }
|
||||
+ }
|
||||
} finally {
|
||||
this.release();
|
||||
}
|
||||
|
||||
- return var12;
|
||||
+ return new PalettedContainerRO.PackedData<>(elements, data);
|
||||
+ // Gale end - Lithium - faster chunk serialization
|
||||
}
|
||||
|
||||
private static <T> void swapPalette(int[] is, IntUnaryOperator applier) {
|
||||
@@ -364,13 +406,33 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
|
||||
@Override
|
||||
public void count(PalettedContainer.CountConsumer<T> counter) {
|
||||
- if (this.data.palette.getSize() == 1) {
|
||||
- counter.accept(this.data.palette.valueFor(0), this.data.storage.getSize());
|
||||
- } else {
|
||||
- Int2IntOpenHashMap int2IntOpenHashMap = new Int2IntOpenHashMap();
|
||||
- this.data.storage.getAll(key -> int2IntOpenHashMap.addTo(key, 1));
|
||||
- int2IntOpenHashMap.int2IntEntrySet().forEach(entry -> counter.accept(this.data.palette.valueFor(entry.getIntKey()), entry.getIntValue()));
|
||||
+ // Gale start - Lithium - faster chunk serialization
|
||||
+ int len = this.data.palette().getSize();
|
||||
+
|
||||
+ // Do not allocate huge arrays if we're using a large palette
|
||||
+ if (len > 4096) {
|
||||
+ // VanillaCopy
|
||||
+ if (this.data.palette.getSize() == 1) {
|
||||
+ counter.accept(this.data.palette.valueFor(0), this.data.storage.getSize());
|
||||
+ } else {
|
||||
+ Int2IntOpenHashMap int2IntOpenHashMap = new Int2IntOpenHashMap();
|
||||
+ this.data.storage.getAll(key -> int2IntOpenHashMap.addTo(key, 1));
|
||||
+ int2IntOpenHashMap.int2IntEntrySet().forEach(entry -> counter.accept(this.data.palette.valueFor(entry.getIntKey()), entry.getIntValue()));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ short[] counts = new short[len];
|
||||
+
|
||||
+ this.data.storage().getAll(i -> counts[i]++);
|
||||
+
|
||||
+ for (int i = 0; i < counts.length; i++) {
|
||||
+ T obj = this.data.palette().valueFor(i);
|
||||
+
|
||||
+ if (obj != null) {
|
||||
+ counter.accept(obj, counts[i]);
|
||||
+ }
|
||||
}
|
||||
+ // Gale end - Lithium - faster chunk serialization
|
||||
}
|
||||
|
||||
static record Configuration<T>(Palette.Factory factory, int bits) {
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 31 Jul 2024 14:50:23 +0800
|
||||
Date: Sat, 30 Nov 2024 12:31:48 +0800
|
||||
Subject: [PATCH] Threaded region start tick and finished tick event
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java b/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||
index 4bfa83a6683970657eaaaaa265855f0d2e79a3a9..6bbc9a0fb94980cd201d7ddb7cb440fcee7786f4 100644
|
||||
index 056fb1ca7b07d5e713dcbd951830b14fc9025f4c..b67a76347f06686d684215c89259e764f8dd1604 100644
|
||||
--- a/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||
+++ b/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||
@@ -442,7 +442,7 @@ public final class TickRegionScheduler {
|
||||
@@ -401,7 +401,7 @@ public final class TickRegionScheduler {
|
||||
|
||||
final long scheduledStart = this.getScheduledStart();
|
||||
final long scheduledEnd = scheduledStart + TIME_BETWEEN_TICKS;
|
||||
@@ -17,7 +17,7 @@ index 4bfa83a6683970657eaaaaa265855f0d2e79a3a9..6bbc9a0fb94980cd201d7ddb7cb440fc
|
||||
synchronized (this) {
|
||||
this.currentTickData = new TickTime(
|
||||
lastTickStart, scheduledStart, tickStart, cpuStart,
|
||||
@@ -477,6 +477,7 @@ public final class TickRegionScheduler {
|
||||
@@ -436,6 +436,7 @@ public final class TickRegionScheduler {
|
||||
);
|
||||
|
||||
this.addTickTime(time);
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 31 Jul 2024 14:51:16 +0800
|
||||
Date: Sat, 30 Nov 2024 12:33:04 +0800
|
||||
Subject: [PATCH] Fix-MC-2025
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 7c54abc8480b4184dc3712f02bd2ae2189ac0cc8..2fa5029aa058a7dd8641013b0626a4b5083cdaec 100644
|
||||
index 2d9f75526240689facba1a4fbef7d40ef8299a1d..76f7479798b72cc9219ccb97b5c99e4645ce43d2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2625,6 +2625,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2774,6 +2774,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
nbttagcompound.putBoolean("Paper.FreezeLock", true);
|
||||
}
|
||||
// Paper end
|
||||
@@ -25,7 +25,7 @@ index 7c54abc8480b4184dc3712f02bd2ae2189ac0cc8..2fa5029aa058a7dd8641013b0626a4b5
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -2702,6 +2712,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2854,6 +2864,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.reapplyPosition();
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 31 Jul 2024 14:51:31 +0800
|
||||
Date: Sat, 30 Nov 2024 12:33:31 +0800
|
||||
Subject: [PATCH] FoliaPR Add TPS From Region
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 07c6f858596e4926397b467ef5e22cab7e7f999b..d030e8d8a532e906c664796e00eef80ad2a07d7a 100644
|
||||
index 20cf4ce4f73f681bdbe092d4693812800c953be9..4fe9d348b6f14224d4095dcd8ff0a16a1d61589c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -3070,6 +3070,42 @@ public final class CraftServer implements Server {
|
||||
@@ -3105,6 +3105,42 @@ public final class CraftServer implements Server {
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 4 Aug 2024 22:29:01 +0800
|
||||
Subject: [PATCH] SparklyPaper Skip "distanceToSqr" call in
|
||||
"ServerEntity#sendChanges" if the delta movement hasn't changed
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 8ea2f24695f5dad55e21f238b69442513e7a90c6..08270040b4bfc6a4a65453d0d997b78425ec7a8f 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -216,6 +216,8 @@ 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 (vec3d1 != this.lastSentMovement) { // SparklyPaper start - skip distanceToSqr call in ServerEntity#sendChanges if the delta movement hasn't changed
|
||||
double d0 = vec3d1.distanceToSqr(this.lastSentMovement);
|
||||
|
||||
if (d0 > 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) {
|
||||
@@ -230,6 +232,7 @@ public class ServerEntity {
|
||||
this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement));
|
||||
}
|
||||
}
|
||||
+ } // SparklyPaper end
|
||||
}
|
||||
|
||||
if (packet1 != null) {
|
||||
@@ -1,37 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sat, 2 Nov 2024 21:48:13 +0800
|
||||
Subject: [PATCH] Leaves Fix Incorrect Collision Behavior for Block Shape
|
||||
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
index 8e2a3d85b7fb78d4e7198c09f356acb51f5be1e0..7ce7da8f6a4e4ffd6e319fc340289ae6bcc0d5fe 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
@@ -56,6 +56,14 @@ public final class CollisionUtil {
|
||||
(box1.minZ - box2.maxZ) < -COLLISION_EPSILON && (box1.maxZ - box2.minZ) > COLLISION_EPSILON;
|
||||
}
|
||||
|
||||
+ // Leaves start
|
||||
+ public static boolean voxelShapeIntersectVanilla(final net.minecraft.world.phys.AABB box1, final net.minecraft.world.phys.AABB box2) {
|
||||
+ return box1.minX < box2.maxX && box1.maxX > box2.minX &&
|
||||
+ box1.minY < box2.maxY && box1.maxY > box2.minY &&
|
||||
+ box1.minZ < box2.maxZ && box1.maxZ > box2.minZ;
|
||||
+ }
|
||||
+ // Leaves end
|
||||
+
|
||||
// assume !isEmpty(target) && abs(source_move) >= COLLISION_EPSILON
|
||||
public static double collideX(final net.minecraft.world.phys.AABB target, final net.minecraft.world.phys.AABB source, final double source_move) {
|
||||
if ((source.minY - target.maxY) < -COLLISION_EPSILON && (source.maxY - target.minY) > COLLISION_EPSILON &&
|
||||
@@ -1700,7 +1708,10 @@ public final class CollisionUtil {
|
||||
net.minecraft.world.phys.AABB singleAABB = ((ca.spottedleaf.moonrise.patches.collisions.shape.CollisionVoxelShape)blockCollision).moonrise$getSingleAABBRepresentation();
|
||||
if (singleAABB != null) {
|
||||
singleAABB = singleAABB.move((double)blockX, (double)blockY, (double)blockZ);
|
||||
- if (!voxelShapeIntersect(aabb, singleAABB)) {
|
||||
+ // Leaves start - Fix incorrect collision behavior for block shape
|
||||
+ boolean isBlockShape = blockCollision == net.minecraft.world.phys.shapes.Shapes.block();
|
||||
+ if (isBlockShape && !voxelShapeIntersectVanilla(aabb, singleAABB) || !isBlockShape && !voxelShapeIntersect(aabb, singleAABB)) {
|
||||
+ // Leaves end - Fix incorrect collision behavior for block shape
|
||||
continue;
|
||||
}
|
||||
|
||||
16821
patches/todo/0051-C2ME-Native-math-noise-optimizations.patch
Normal file
16821
patches/todo/0051-C2ME-Native-math-noise-optimizations.patch
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user