Compare commits

...

14 Commits

Author SHA1 Message Date
MrHua269
27cd8d6cdb Updated Upstream(Folia) 2024-12-03 16:42:17 +00:00
MrHua269
af556ab869 [ci skip]Changed maven repo link 2024-12-01 08:44:54 +08:00
MrHua269
4e8d54e073 Publish to snapshot repo 2024-12-01 08:39:28 +08:00
MrHua269
f8559b9ca6 Use https(x) 2024-12-01 08:29:55 +08:00
MrHua269
bc5a83c69c Use moliatopia maven repo 2024-12-01 08:21:08 +08:00
MrHua269
6a8df3771b Fix config for username checks 2024-11-30 23:02:49 +08:00
MrHua269
ff4fdcc7d1 Kaiiju Entity tick and removal limiter 2024-11-30 21:04:54 +08:00
Dreeam
94ae8e3ce0 Skip publish if failed 2024-11-30 01:32:08 -05:00
MrHua269
f1dfac26d8 Fix misplaced chunk hot counters 2024-11-30 14:17:55 +08:00
MrHua269
5d9dfc3e17 Fix NPE 2024-11-30 13:32:17 +08:00
MrHua269
ca44ba98a5 Dropped useless patch 2024-11-30 12:54:01 +08:00
MrHua269
27298b865c [ci skip]Removed useless files 2024-11-30 12:41:36 +08:00
MrHua269
bcea80b4d1 Updated workflow 2024-11-30 12:40:22 +08:00
MrHua269
d20e0b1940 Updated Upstream(Folia) 2024-11-30 12:36:35 +08:00
66 changed files with 885 additions and 1660 deletions

View File

@@ -1,72 +1,73 @@
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 }} [![download](https://img.shields.io/github/downloads/LuminolMC/${{ env.project_id }}/${{ env.tag }}/total?color=red&style=flat-square)](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.3
on:
push:
branches: [ "dev/1.21.3" ]
pull_request:
branches: [ "de/1.21.3" ]
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
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 }} [![download](https://img.shields.io/github/downloads/LuminolMC/${{ env.project_id }}/${{ env.tag }}/total?color=red&style=flat-square)](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

View File

@@ -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>
```

View File

@@ -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>
```

View File

@@ -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.5"
}
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
@@ -101,7 +101,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")

View File

@@ -1,13 +1,13 @@
group = me.earthme.luminol
version = 1.21.1-R0.1-SNAPSHOT
version = 1.21.3-R0.1-SNAPSHOT
foliaCommit = 2e7bc0721af95196c85500c7bb136aeea0bc12ce
foliaCommit = e1601057b3e8131127788aafc8f4e80b800556c3
org.gradle.caching = true
org.gradle.parallel = true
org.gradle.vfs.watch = false
org.gradle.jvmargs = -Xmx3G
mcVersion = 1.21.1
mcVersion = 1.21.3
GroupMCV = 1.21
preVersion = true
preVersion = true

View File

@@ -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

View File

@@ -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

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Pufferfish SIMD Utilities
diff --git a/build.gradle.kts b/build.gradle.kts
index e7c96be769fde8375b9a1b128cc7ce474144d16d..73e0b4a9af5803198e42fa74af5b05654d9a934a 100644
index e29e5024fa693baae469d47fe77b57118f14627c..46a4af5eb9a12a3263e6d73867f6a905a6c85e64 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -131,6 +131,13 @@ val generateApiVersioningFile by tasks.registering {
@@ -148,6 +148,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> {
@@ -207,6 +214,7 @@ tasks.withType<Javadoc> {
into("build/docs/javadoc")
}
}

View File

@@ -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

View File

@@ -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: Sat, 30 Nov 2024 11:15:18 +0800
Subject: [PATCH] Fix build
diff --git a/build.gradle.kts b/build.gradle.kts
index eb2f9941b24af591f1e56339b97f5284a765cf81..32bfe781e5298e5ad1bd2ed4471fb824c49f0ab4 100644
index 142714c7d47eb5de937ad385c81968148a7e4828..a4b74fabc9f5a57c8897794e69855f2f3f82f986 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
// 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+
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Rebrand to Luminol
diff --git a/build.gradle.kts b/build.gradle.kts
index 28726c59088d98923b9ecb3221ca254385d142fd..f07a002ab51a4aadfea65c3258406edc19b5078e 100644
index a4b74fabc9f5a57c8897794e69855f2f3f82f986..623816729867d0bee60075c00334e2011795049a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -85,14 +85,14 @@ tasks.jar {
@@ -99,14 +99,14 @@ tasks.jar {
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",

View File

@@ -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: Sat, 30 Nov 2024 11:22:17 +0800
Subject: [PATCH] Empty config file base
diff --git a/build.gradle.kts b/build.gradle.kts
index de5a43db5f0c7c507c492db8789ad2d4a4cff3c8..f657ee64810d1c02a967b9262b95fbc65eb3fce2 100644
index 623816729867d0bee60075c00334e2011795049a..fcc16a93482527b364c8ba1da5cb659b35fdfd4e 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
// 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+
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
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
@@ -576,10 +576,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

View File

@@ -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 ce51c9e98aabf6d4a2a5c8c4eff80608c0dc9bd3..aa395491cba3f26eefb0e3bb7e51bd4348953f3e 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() {

View File

@@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..22f3c6c70e4287f1bdd0b18f87f57efe
+ }
+}
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
index cd1af13c91b215d896618fa0f2790da1a53ea80a..ea9f783ccecefc81bfe97ab91bd8dc494860d318 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.
@@ -2907,7 +2907,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
// Paper start - Fix merchant inventory not closing on entity removal

View File

@@ -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 8203bc134888a57056a6cb301beb9ff21983716f..cac7453f83be82671fb21c8712ff190b234a6ae0 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 {
@@ -435,7 +435,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 403cced72fa043a9084afb5bb8fa037ccb511d41..f8e40758e6aed473a06cce18f20e727e44a06436 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

View File

@@ -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 451d4cf162e39acd7ed215f82a5a84f6be6e166a..d98a86e911c6b6bc181d5148e806e2452cb1c6f4 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;

View File

@@ -346,10 +346,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 +358,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 68a88928a3aae9d2ea6cd18088ede0a54c31d0d2..8148cbbea2de545e538ce81b51de3919ba11ef59 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
@@ -329,7 +329,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 +371,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 b2ae1de0b18a7b5c684b04e3f81fdf071e013c61..5eb2432cb0a43afee70be081a8e05aaf35de4859 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 {
@@ -2405,6 +2405,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
handle.expToDrop = data.getInt("expToDrop");
handle.keepLevel = data.getBoolean("keepLevel");
}
@@ -384,7 +384,7 @@ index 12a2da086f249b3dbd61e5749b9856a2fce9ac7b..b954a5a3d8c589a0261202f21f1430c8
}
}
@@ -2414,6 +2417,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2426,6 +2429,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
data.putLong("lastPlayed", System.currentTimeMillis());
data.putString("lastKnownName", handle.getScoreboardName());

View File

@@ -306,10 +306,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 +318,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 8148cbbea2de545e538ce81b51de3919ba11ef59..3f4518b29c9f0c4ad9561bde2ffded8404608cae 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
@@ -330,6 +330,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 +330,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 5eb2432cb0a43afee70be081a8e05aaf35de4859..566c404acfced53414f3d0facd22d03b71841587 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 {
@@ -2408,6 +2408,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
//Luminol start - Tpsbar
getHandle().isTpsBarVisible = data.getBoolean("tpsbarVisible");
//Luminol end
@@ -343,7 +343,7 @@ index b954a5a3d8c589a0261202f21f1430c8790e874a..77576c06ffc0a677b1bfb63d48d39fba
}
}
@@ -2420,6 +2423,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2432,6 +2435,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
//Luminol start - Tpsbar
data.putBoolean("tpsbarVisible",handle.isTpsBarVisible);
//Luminol end

View File

@@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..c7e4724cc4ab8d911bcaf0106c098b26
+ }
+}
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
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,
@@ -44,3 +44,25 @@ index 8098b1a447a7c054e15edc09d2fa50e48f73e926..b6a65bdddc8eaf64931d9aa3f4801dc8
&& 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;
}

View File

@@ -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

View File

@@ -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 3d96f7ae648b47cc7494578d9776e7ea6dee0964..6161137e2249d592e2b6c7e0b94b7163b55788c7 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
@@ -1537,7 +1537,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
try {
tickConsumer.accept(entity);
} catch (Throwable throwable) {

View File

@@ -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 5358a0d5a4d4b1ab1c3b300ed04061bc9dc1ff37..61726ff1fecb1e153a95328c37787dd2070ff0c4 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
@@ -1165,9 +1165,24 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
}
Entity entity = this.getCamera();

View File

@@ -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 d98a86e911c6b6bc181d5148e806e2452cb1c6f4..403585b38a2d8bc1e25fa8e3e4014470a65461b9 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
@@ -1173,6 +1173,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
@@ -1183,6 +1187,32 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.moveStartZ = this.getZ();
this.moveVector = movement;
}

View File

@@ -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;

View File

@@ -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 aa395491cba3f26eefb0e3bb7e51bd4348953f3e..420b0f22bb58cab43ff4b707bd40823ab2cad9bd 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
@@ -808,8 +808,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end - Configurable player collision
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
@@ -32,16 +32,16 @@ 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");
@@ -1125,7 +1125,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
this.server.waitForAsyncTasksShutdown(); // Paper - Wait for Async Tasks during shutdown
}
@@ -1345,7 +1345,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
@@ -50,29 +50,48 @@ index b6489f9da0bf08e5801be1ce668a422610d2b393..db48812e886bc0110a1e098a98a67a52
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;
@@ -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 a8975cee866cf2c617b6d4976df71e5c20cf0e3d..ac180d082b05f2a5fa557b49e3d34e81e4957766 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);

View File

@@ -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

View File

@@ -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";
+ }
+}

View File

@@ -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 403585b38a2d8bc1e25fa8e3e4014470a65461b9..39ce6a8cd2713379712a0795bb372c7be31c45c6 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
@@ -4424,13 +4425,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),
+ destination, Vec3.atBottomCenterOf(targetPos.below()), this.getDeltaMovement(), 90.0f, 0.0f, // Kaiiju - Vanilla end teleportation
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
@@ -4626,6 +4632,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);
@@ -4690,9 +4700,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
info.postTeleportTransition().onTransition(teleported);
}
- if (teleportComplete != null) {

View File

@@ -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);
}
}

View File

@@ -0,0 +1,330 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <wangxyper@163.com>
Date: Sat, 30 Nov 2024 20:29:38 +0800
Subject: [PATCH] Kaiiju Entity tick and removal limiter
diff --git a/build.gradle.kts b/build.gradle.kts
index fcc16a93482527b364c8ba1da5cb659b35fdfd4e..bdff148efc08334708cd58f7af4b87d6a07ef69f 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
// Paper start
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
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 f15015e7ea2b4bc68f3d93ff9bb54da46389c098..8c96d9ece6fac543b1aef39565f8c47e6b27068f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -810,6 +810,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
@@ -831,6 +832,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();
@@ -838,6 +846,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

View File

@@ -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 bd2d62f73e4f1fa1e655012d04e104acca5db198..b136a3d32198cf0e3127966bffbac73315c78f8a 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
@@ -938,12 +938,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();

View File

@@ -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 b63393c131f736cd51666c675ac18918e038eca6..f9a4ba5cc7c1029a5201e140c80648d07ca80936 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 {
@@ -2139,6 +2139,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;

View File

@@ -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 48dcd2bc12ce1d08cc5195bff5460dc0dd9902d3..c7153cfec847fca4ce5d9ec729628aed5bed11be 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 {
@@ -307,11 +307,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);
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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 522fa33311b433f8c0eff4cb10dd80128f3c96d7..3a832be7d14276f38f1a35ca9f9a540be7b7d1b4 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);
}

View File

@@ -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: Sat, 30 Nov 2024 11:58:37 +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 8c96d9ece6fac543b1aef39565f8c47e6b27068f..230b448d8dd5c49e2cd45d9f06a439912402d914 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
@@ -815,6 +815,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 39ce6a8cd2713379712a0795bb372c7be31c45c6..8d0aae7ae8abec5eac1357a1ea28df0cddab2f36 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 0d18403c6c25555f78e2d6810520839f30258c8e..85865f13404c70fa44ee95968ec1511cba2e3efe 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 b136a3d32198cf0e3127966bffbac73315c78f8a..34500f330f51e4c2c7b2b99ba57b0574ee3b266d 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
@@ -247,10 +247,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
@@ -947,16 +947,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,152 @@ 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 05c3d43fafc781e2c2d762dd5f509753df8da3b3..94692082aa85d7e4e52a4e16bb5e49b0bf6eb93f 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
@@ -219,11 +219,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 36846ba6b6c7494c745ebd8b221479a9d02ff318..3461c7150fc44ee608169aa993f6ff44d4c978be 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 6ea90e54759dbeab025e0a1896ee834ea9986427..3f625cb9b1237ca8f782bca2f182dfe72853bd96 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 {
@@ -156,10 +156,12 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
return (Brain<Hoglin>)super.getBrain();
}
+ private int behaviorTick; // Pufferfish
@Override
protected void customServerAiStep() {
this.level().getProfiler().push("hoglinBrain");
protected void customServerAiStep(ServerLevel world) {
ProfilerFiller profilerFiller = Profiler.get();
profilerFiller.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);
profilerFiller.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 e04d2c5e75dc774fe893a552474fdb8045c32693..d1870bf4c01c846a721480eb6611a67db9b98d02 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
@@ -304,11 +304,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 6180019da58b19d2595da508aed3196af922d587..457f9f6bf6a8e8f2e0b4246a0589e344756370d2 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 d33dc470850acdc0cecfbad7f7990a9deb57edaf..75d214a828d30fb7f81a510b115ca14071e6294a 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 +319,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 +355,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 +377,7 @@ index 2d26c8109cb942d1856455fd0239290ee1142eb3..c17e9782850fd88b9a46d31bf9075624
+ entity.activatedPriority = 1;
+ }
+ // Pufferfish end
+
}
// Paper end
}

View File

@@ -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 {
}
}

View File

@@ -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;
}

View File

@@ -1,36 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <wangxyper@163.com>
Date: Sun, 4 Aug 2024 22:15:50 +0800
Date: Sat, 30 Nov 2024 11:59:52 +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
index 12f95bee2a69fd5df7c4a165537e01299e60c5f6..d7ce86752e4138cdd3844b3374609753aa20f9ea 100644
--- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
@@ -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;
@@ -31,8 +31,13 @@ public class ShapelessRecipe implements CraftingRecipe {
final List<Ingredient> ingredients;
@Nullable
private PlacementInfo placementInfo;
+ private final boolean isBukkit; // Pufferfish
+ // Pufferfish start
public ShapelessRecipe(String group, CraftingBookCategory category, ItemStack result, NonNullList<Ingredient> ingredients) {
public ShapelessRecipe(String group, CraftingBookCategory category, ItemStack result, List<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
+ public ShapelessRecipe(String group, CraftingBookCategory category, ItemStack result, List<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
@@ -80,6 +85,28 @@ public class ShapelessRecipe implements CraftingRecipe {
}
public boolean matches(CraftingInput input, Level world) {
@@ -56,18 +48,18 @@ index 213ee4aa988dd4c2a5a7be99b1d13f67338e5209..8e46753af60aa9fd8e4b4c0f955f7a55
+ }
+ // Pufferfish end
+
// Paper start - unwrap ternary & better exact choice recipes
// Paper start - Improve exact choice recipe ingredients & unwrap ternary
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
index 7c989318dc7ad89bb0d9143fcaac1e4bba6f5907..143a4d4efcc989ed4a4c73cc304e1978ad8f0699 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));
@@ -44,6 +44,6 @@ public class CraftShapelessRecipe extends ShapelessRecipe implements CraftRecipe
data.add(this.toNMS(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
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftRecipe.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.ShapelessRecipe(this.getGroup(), CraftRecipe.getCategory(this.getCategory()), CraftItemStack.asNMSCopy(this.getResult()), data)));
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftRecipe.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.ShapelessRecipe(this.getGroup(), CraftRecipe.getCategory(this.getCategory()), CraftItemStack.asNMSCopy(this.getResult()), data, true))); // Pufferfish
}
}

View File

@@ -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 34500f330f51e4c2c7b2b99ba57b0574ee3b266d..8082fb0d0793743ee6123f4bb5c6d79b078d5f86 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
@@ -243,11 +243,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
return this.lookControl;
}

View File

@@ -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 f9a4ba5cc7c1029a5201e140c80648d07ca80936..c079466246af4345e185faf96043ec148fdea2a8 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;
@@ -482,7 +482,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 244e38db508efa3eebebb6392c4ebb0805367baf..d62c0d3c2bd5df5ee908bdcfdffaae9ce780810f 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
@@ -152,6 +152,13 @@ public class WitherBoss extends Monster implements RangedAttackMob {
this.bossEvent.setName(this.getDisplayName());
}

View File

@@ -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;
}

View File

@@ -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: Sat, 30 Nov 2024 12:06:01 +0800
Subject: [PATCH] Pufferfish SIMD Utilities
diff --git a/build.gradle.kts b/build.gradle.kts
index 7b11c45914392c01b4d28b104f80e6ed34eb9955..5ea6cccfde29132356548e847be4a1720b64998d 100644
index bdff148efc08334708cd58f7af4b87d6a07ef69f..0345be6306b2d81987709c3feb31e2d7fb2f254f 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
@@ -88,6 +88,14 @@ paperweight {
craftBukkitPackageVersion.set("v1_21_R2") // also needs to be updated in MappingEnvironment
}
+

View File

@@ -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

View File

@@ -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

View File

@@ -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 8d0aae7ae8abec5eac1357a1ea28df0cddab2f36..537187df8f400f8625216b0fc21cd19c3bf28e85 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
@@ -2204,9 +2204,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
/** @deprecated */
@Deprecated
public float getLightLevelDependentMagicValue() {
@@ -39,10 +39,10 @@ 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 8082fb0d0793743ee6123f4bb5c6d79b078d5f86..0e0b971c93cdfd8cfae8019c4710f72fdd096c6a 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
@@ -1766,13 +1766,29 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
protected void playAttackSound() {}

View File

@@ -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 {

View File

@@ -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 537187df8f400f8625216b0fc21cd19c3bf28e85..75182b1f12ed5ad0ff541aee28b40a72b783230d 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
@@ -1181,6 +1182,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
@@ -5245,6 +5251,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public final void setBoundingBox(AABB boundingBox) {

View File

@@ -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 ad6d635971d0f5d23c923b1dc83c0b18e8f4a94a..926e070e3b3f1a8ce8a9c668e39239a837b35b0e 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 566c404acfced53414f3d0facd22d03b71841587..611caf02205a7a97aa1175ab6250124d547bd071 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 {
@@ -205,7 +205,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 {
@@ -2269,9 +2269,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public boolean canSee(org.bukkit.entity.Entity entity) {

View File

@@ -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 58f3c9598301a5b34142ddf958aa7a4db634be3d..c002b449688981c192468fb210e8fd9ef3f91553 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);
}

View File

@@ -0,0 +1,28 @@
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 90eb4927fa51ce3df86aa7b6c71f49150a03e337..f4590eb0eef02a425056e73e7dc71328b8a5f773 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.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) {
@@ -244,6 +246,7 @@ public class ServerEntity {
this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement));
}
}
+ } // SparklyPaper end
}
if (packet1 != null) {

View File

@@ -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();
}

View File

@@ -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) {

View File

@@ -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: Sat, 30 Nov 2024 12:28:45 +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
@@ -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 420b0f22bb58cab43ff4b707bd40823ab2cad9bd..968f96e6fa971ad06b2a961071f1f80bc6dcfe97 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 71a8aa164d48ec632c8dcb24ff0073e26b67bb9e..c95c731cdcf02a338a6a437c0195d6f5f267fefb 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.
@@ -1381,6 +1381,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
@@ -1398,6 +1400,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.
@@ -1420,6 +1423,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.
@@ -1460,6 +1465,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 61726ff1fecb1e153a95328c37787dd2070ff0c4..dbf97cb39362e907dcde7b773c902fec3256d56a 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
@@ -361,6 +361,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
@@ -1202,6 +1222,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 7eba7c0e7b8d2795abbe96b3d86a9c1a3b6b74a6..9187de83c6639a34b5725ec5c0cb8d6c30b913eb 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);
@@ -465,4 +465,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 75182b1f12ed5ad0ff541aee28b40a72b783230d..e2b7daa6a9af849b49e75a4329b53cca559d1ea9 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);
@@ -6202,4 +6202,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 0e0b971c93cdfd8cfae8019c4710f72fdd096c6a..983f5c4188db04b98a60a43f9d890335551ab39b 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);
@@ -1861,4 +1861,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 7b43fcf86984cc200f34c189e7a547996416f379..b4918895a3530836410b56124d9b2ca9091111ba 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 e00bcd424d500aa4b76d0fd88eb4b9558d3aece5..d8db54d4f7bbffac216d702cb50f066c7a9b89c2 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;
}
@@ -2420,6 +2420,13 @@ public abstract class Player extends LivingEntity {
return true;
}
+
+
+ // 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 3a832be7d14276f38f1a35ca9f9a540be7b7d1b4..c26253fee6eeaca010f9232f387c77e17dd79a9f 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 {
@@ -578,4 +578,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,50 +442,51 @@ 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 4bccb94cf953ebd4dfd4f1620ad1784ef235356f..38308b3b25ef421d6379b18506764819aa14ca1d 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;
@@ -94,6 +94,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
@@ -1080,6 +1081,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
}
}
}
@@ -1095,7 +1097,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 0074bc0e7147dc3a8c538e796f14ac9bf8725896..90b2bfd12236fce24ddcc48b00e0121f40676d88 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 {
@@ -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 01aca615a7fe4baa38d4020f7f3ccd63539fe546..2912d1a4b8b1926429655af76c5da8fde77a1759 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 {
@@ -3611,4 +3611,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

View File

@@ -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);

View File

@@ -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 e2b7daa6a9af849b49e75a4329b53cca559d1ea9..e560cf681642252e381a71f5abe8fd2572b163ed 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
@@ -2751,6 +2751,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
@@ -2829,6 +2839,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.reapplyPosition();
}

View File

@@ -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 ac180d082b05f2a5fa557b49e3d34e81e4957766..5cc71c882dba16034c976f8e6eb98a1616b67030 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 {
};
}

View File

@@ -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) {

View File

@@ -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;
}