Compare commits

..

30 Commits

Author SHA1 Message Date
a7957715f6 Merge remote-tracking branch 'origin/master' 2024-12-23 12:50:14 +08:00
fdaa6eb50a add Optimize for FurnitureCore plugin 2024-12-23 12:49:35 +08:00
8b15cd17c9 update readme 2024-12-20 00:56:18 +08:00
510b6c1673 update readme 2024-12-20 00:41:31 +08:00
95d2b8f2f5 fix zombie pig wrong beheavior 2024-12-19 17:48:59 +08:00
0561727a9d fix zombie pig wrong beheavior
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 3s
2024-12-19 17:42:21 +08:00
728c929e0b fix zombie pig wrong beheavior
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 0s
2024-12-18 21:32:27 +08:00
d93e4c4f29 fix bugs
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 1s
2024-12-17 16:55:32 +08:00
e5f83913a6 fix server crash because of deadlock
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 2s
2024-12-17 16:47:01 +08:00
473f5c3846 fix failed main thread check: Accessing poi chunk off-main
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 3s
2024-12-17 14:57:01 +08:00
ce0165a4cd update folia 8af1aef1
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 17m21s
2024-12-16 15:50:49 +08:00
fcc4491271 fix NearestBedSensor:72 error
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 6m21s
2024-12-16 13:15:36 +08:00
c8be161e64 optimize async pathfinding
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 20m18s
2024-12-16 10:43:10 +08:00
c97bc87f8d fix async pathfinding
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 10m55s
2024-12-14 22:10:36 +08:00
4d497fa77e fix UnsupportedOperationException when async pathfinding
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 4m28s
2024-12-13 11:35:56 +08:00
81b8544f67 add async path finding
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 5m34s
2024-12-12 23:17:15 +08:00
2bd64a2bc9 update folia upstream 1.21.4
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 1s
2024-12-09 16:05:51 +08:00
70be4fd488 update folia upstream
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 5m13s
2024-12-09 15:18:01 +08:00
864485cf97 modify DAB
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 5m17s
2024-12-06 11:59:16 +08:00
e6dd37d09b add DAB (Dynamic Activation Brain) from puffish. 2024-12-06 00:07:59 +08:00
bba3ffc415 Fix can't sand-dup.
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 5m24s
2024-12-05 07:27:20 +00:00
097fd1b5a7 modify README.md 2024-12-05 12:31:13 +08:00
22118800a7 update folia 1.21.3
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 4m39s
2024-12-05 03:24:17 +00:00
10bfedf6e6 update folia 1.21.3 2024-12-05 03:23:30 +00:00
83e1fe4058 update folia upstream 2e7bc0721af95196c85500c7bb136aeea0bc12ce
All checks were successful
Java CI-CD with Gradle / build (push) Successful in 18m3s
2024-11-19 08:08:30 +00:00
25386e9085 update upstream folia 88e0907cadf2358e1d3e06222c0a97722ca4ce12
All checks were successful
Java CI-CD with Gradle / build (push) Successful in 15m6s
2024-09-03 15:29:18 +08:00
c1aaac3395 update folia upstream 11e6f61697
All checks were successful
Java CI-CD with Gradle / build (push) Successful in 16m55s
2024-08-29 13:16:15 +08:00
db1bc015e2 update upstream folia
All checks were successful
Java CI-CD with Gradle / build (push) Successful in 20m38s
2024-08-18 12:32:47 +08:00
7cebc29f20 expand gradle.properties jvm ram usage
All checks were successful
Java CI-CD with Gradle / build (push) Successful in 13m49s
2024-08-15 17:35:10 +08:00
041ae7d4c7 update upstream folia
Some checks failed
Java CI-CD with Gradle / build (push) Failing after 34m6s
2024-08-15 16:51:15 +08:00
13 changed files with 1957 additions and 84 deletions

View File

@ -30,7 +30,7 @@ jobs:
- name: "Build Mojmap"
run: ./gradlew createMojmapPaperclipJar
- name: "Copy jar to staging"
run: mkdir staging && cp build/libs/DeerFolia-paperclip-*.jar staging/
run: mkdir staging && cp build/libs/DeerFolia-paperclip-*-mojmap.jar staging/
- name: "Rename file to DeerFolia-{git tag name}.jar"
run: |
GIT_TAG=$(git describe --tags --abbrev=0)

View File

@ -33,7 +33,11 @@ jobs:
- name: "Build Mojmap"
run: ./gradlew createMojmapPaperclipJar
- name: "Copy jar to staging"
run: mkdir staging && cp build/libs/*.jar staging
run: mkdir staging && cp build/libs/DeerFolia-paperclip-*-mojmap.jar staging/
- name: "Rename file to DeerFolia-{git tag name}.jar"
run: |
GIT_TAG=$(git describe --tags --abbrev=0)
mv staging/*.jar staging/DeerFolia-$GIT_TAG.jar
- uses: "softprops/action-gh-release@v2"
if: startsWith(github.ref, 'refs/tags/')
with:

View File

@ -4,23 +4,62 @@ DeerFolia 是一个基于 [Folia](https://papermc.io/software/folia) 的 Minecra
而 Folia 是由 [Paper](https://papermc.io/software/paper) 修改而来Paper 核心修复了很多原版 Minecraft 的有趣特性,由于 Folia 直接继承自 Paper因此也同时继承了这些消失的特性。这也是为什么很多服主选择了 Purpur不过 Purpur 官方已经明确表示不会基于 Folia 开发一个新的具备原版特性的分支。
<div style="text-align: center;">
<img src="https://ssl.lunadeer.cn:14437/i/2024/04/01/660a164f1873d.png" alt="" width="70%">
</div>
## 本分支相比于其他 Folia 分支有何特点?
### 1. 最小修改:在还原原版机制的基础上保持对 Folia 及上游 Paper 相关补丁的最小修改避免潜在的意外bug
### 2. 无需配置:不引入任何自定义的配置,虽然这意味着本分支的特性无法自行开关,但同时也减轻了部署负担,不用去理解额外的配置内容;
### 2. 最少配置:尽可能减少自定义的配置,减轻了部署负担,不用面对复杂的配置内容;
### 3. 性能优化:在 Folia 基础上引入更多的优化,进步一提升单个 region 的性能;
## 此分支特性
- 还原了 [刷沙机制](patches/server/0003-Allow-sand-duplication.patch)(虽然 paper 已支持刷沙,但由于 folia 的特性paper 的刷沙开关在 folia 是无效的);
- [Dynamic Activation of Brain (Pufferfish)](patches/server/0005-Dynamic-Activation-Brain.patch)
- [Async Path Finding (Pufferfish)](patches/server/0006-Async-Pathfinding.patch)
- ~~还原了 [虚空交易](https://ssl.lunadeer.cn:14446/zhangyuheng/DeerFolia/src/branch/master/patches/server/0002-Allow-void-trading.patch)~~(疑似已被 mojang 官方修复);
- 还原了 [刷沙机制](https://ssl.lunadeer.cn:14446/zhangyuheng/DeerFolia/src/branch/master/patches/server/0003-Sand-duplication.patch)(虽然 paper 已支持刷沙,但由于 folia 的特性paper 的刷沙开关在 folia 是无效的);
- 还原了 [刷线机制](https://ssl.lunadeer.cn:14446/zhangyuheng/DeerFolia/src/branch/master/patches/server/0004-Allow-tripwire-duplication.patch)paper 已支持刷线,此分支补丁为强制开启此特性);
- ~~还原了 [刷线机制](https://ssl.lunadeer.cn:14446/zhangyuheng/DeerFolia/src/branch/master/patches/server/0004-Allow-tripwire-duplication.patch)~~mojang已在1.21.3修复);
## 额外配置
### Dynamic Activation of Brain
通过动态调整实体的激活频率,减少了不必要的计算,提升了服务器的性能。
```yaml
# config/paper-global.yml
dynamic-activation-brain:
activation-distance-mod: 8
dear-enabled: true
maximum-activation-prio: 20
start-distance: 12
```
- `dear-enabled`:是否启用;
- `activation-distance-mod`:递减倍数;
- `maximum-activation-prio`最大停顿如果设置为20则表示无论多远每20tick都至少计算一次
- `start-distance`:开始递减的距离;
> 如果刷怪塔收到影响可以尝试减少 `activation-distance-mod` 或者增加 `start-distance`
> 通常情况下,`activation-distance-mod` 推荐设置为 7 或 8`start-distance` 推荐设置为 12。
### Async Path Finding
引入异步路径查找和相关的机制,提升了路径查找的性能和响应速度。
```yaml
# config/paper-global.yml
async-pathfinding:
async-pathfinding-keepalive: 60
async-pathfinding-max-threads: 20
enabled: true
```
- `enabled`:是否启用;
- `async-pathfinding-keepalive`:单个线程最大活跃时间;
- `async-pathfinding-max-threads`:用于异步寻路的线程池大小;
> 线程池本质上为虚拟线程与cpu物理核心无关。过少的线程池大小可能会对性能提升不明显过多通常不会有明显的负面影响但是可能会影响java的GC。
> 推荐 `async-pathfinding-max-threads` 为 10-20 之间。
## 如何自行编译

View File

@ -3,7 +3,7 @@ import io.papermc.paperweight.util.*
plugins {
java
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("io.papermc.paperweight.patcher") version "1.7.1"
id("io.papermc.paperweight.patcher") version "1.7.7"
}
allprojects {
@ -29,7 +29,7 @@ repositories {
}
dependencies {
remapper("net.fabricmc:tiny-remapper:0.10.2:fat")
remapper("net.fabricmc:tiny-remapper:0.10.3:fat")
decompiler("org.vineflower:vineflower:1.10.1")
paperclip("io.papermc:paperclip:3.0.3")
}

View File

@ -1,9 +1,11 @@
group = cn.lunadeer
version = 1.21.1-R0.1-SNAPSHOT
mcVersion = 1.21.1
version = 1.21.4-R0.1-SNAPSHOT
mcVersion = 1.21.4
foliaRef = e402f963b5c4d42921a67c4e789e1718635c8a83
foliaRef = 8af1aef1f14630ede6575a72632e7f943d8fb903
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.vfs.watch=false
org.gradle.vfs.watch=false
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2560m

View File

@ -5,19 +5,19 @@ Subject: [PATCH] Rebranding
diff --git a/build.gradle.kts b/build.gradle.kts
index f0a90d13a17160cd363d54d494add4f6433b4758..e4c5df72efcdd81ffe7dd0344f7f1c20ae62acc1 100644
index 8d2b5fec6fe27dca3ce01ba1ce50506179fc3b4d..d6d09ba35cd286831d2069885376f0a7c7c5730a 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(":deer-folia-api")) // Folia
+ implementation(project(":deer-folia-api")) // Folia // DeerFolia
implementation("ca.spottedleaf:concurrentutil:0.0.2") // Paper - Add ConcurrentUtil dependency
// Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0")
@@ -84,14 +84,14 @@ tasks.jar {
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
@@ -100,14 +100,14 @@ tasks.jar {
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
@ -37,10 +37,10 @@ index f0a90d13a17160cd363d54d494add4f6433b4758..e4c5df72efcdd81ffe7dd0344f7f1c20
"Build-Time" to Instant.now().toString(),
"Git-Branch" to gitBranch, // Paper
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
index cb60d58d4a7556dd896f31d0cd249f860bb3ef84..bad1284f624a25ec9aeb0c5ce67c4ec6fecdd031 100644
index f5ff71e31516327be71924926938f1c9f0e503df..1baf3f278e393ead60caf062a718f621e289046d 100644
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
@@ -593,7 +593,7 @@ public class Metrics {
@@ -592,7 +592,7 @@ public class Metrics {
boolean logFailedRequests = config.getBoolean("logFailedRequests", false);
// Only start Metrics, if it's enabled in the config
if (config.getBoolean("enabled", true)) {
@ -49,7 +49,7 @@ index cb60d58d4a7556dd896f31d0cd249f860bb3ef84..bad1284f624a25ec9aeb0c5ce67c4ec6
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
String minecraftVersion = Bukkit.getVersion();
@@ -612,6 +612,10 @@ public class Metrics {
@@ -611,6 +611,10 @@ public class Metrics {
paperVersion = "unknown";
}
metrics.addCustomChart(new Metrics.SimplePie("folia_version", () -> paperVersion)); // Folia - we have our own bstats page
@ -106,10 +106,10 @@ index 29bd788ae8bc61c1e62a4f84b9e259931a7041ce..133d9974c5db973029750a08cac50665
private static Component getUpdateStatusMessage(final String repo, final ServerBuildInfo build) {
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..d5c8b196c1282eecd74ce046242700b57cfde140 100644
index 6ee39b534b8d992655bc0cef3c299d12cbae0034..8fd162b6441ca1a6ee779d898ee854dc5b1343c5 100644
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
@@ -17,7 +17,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
@@ -20,7 +20,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
@Override
protected LineReader buildReader(LineReaderBuilder builder) {
builder
@ -166,10 +166,10 @@ index b24265573fdef5d9a964bcd76146f34542c420cf..806fffca351879e327fd642e364b8828
public SystemReport getSystemReport() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 40689256711cc94a806ca1da346f4f62eda31526..e88da47c58204d650a75f90816a68b1588332b87 100644
index e40665cead218502b44dd49051a53326ed94f061..cf0eb91b9fd76e6d21544042973f69a9b5810e0b 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -177,7 +177,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
@@ -289,7 +289,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
// Paper start
private static void printOversizedLog(String msg, Path file, int x, int z) {
@ -179,13 +179,13 @@ index 40689256711cc94a806ca1da346f4f62eda31526..e88da47c58204d650a75f90816a68b15
private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 5a24902b735cbd64dd5cd5ad46b096c4bdfa799f..6c7bc7e2c76eb5d96a8ab04f7c91ea9dcc8017ed 100644
index fad85bea8643a3a88ec5c4194de7a5060e81c136..03858588a5da20ecd5bb824c39f4cea68c25ae4c 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -492,7 +492,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -491,7 +491,7 @@ public class CraftScheduler implements BukkitScheduler {
this.parsePending();
} else {
// this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
// this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(this.currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
- task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Paper"); // Paper
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to DeerFolia"); // Paper // DeerFolia
// We don't need to parse pending
@ -205,7 +205,7 @@ index e9b6ca3aa25e140467ae866d572483050ea3fa0e..4b84eb8ceb719bb6b4dc281b32c5b67b
if (stream != null) {
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index f7a4fee9bb25ff256dc2e5ea26bfbceca6a49167..e071112059905fc1898fd3435dce49ff7f8ff244 100644
index 64e0acf28fc241b16a7bc8d3807062fd7758ed7f..3eb75a0fbe82e6f5efc774149e3f965cc5b6b250 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -96,7 +96,7 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Allow void trading
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0166d6bd686d68ffdcc42e908b0d1aa41a3bffdf..8da76a7383e080c54d4af6905c0732298f03847f 100644
index 07037eb601f9dcae2cad5f3e3d5f9a0ac142b68a..6ddbf123eb06e481fda87b621534cf5b2137f0f2 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2813,10 +2813,11 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -2916,10 +2916,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
// Spigot end
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message

View File

@ -5,12 +5,12 @@ Subject: [PATCH] Allow sand duplication
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 7a102b4e90fbc09b8653e5b566299efe24a04cf6..4d5fcff9bb860542502f7d15a86cd14dc9cca5fa 100644
index c450b1115985109b43a0bf5eefae7c47c92f91c0..db6d3e4489832c60f0293e23c77c42adb37f5754 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4186,13 +4186,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4428,13 +4428,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);
+ // DeerFolia start - Vanilla end teleportation
@ -23,13 +23,13 @@ index 7a102b4e90fbc09b8653e5b566299efe24a04cf6..4d5fcff9bb860542502f7d15a86cd14d
// 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, // DeerFolia Vanilla end teleportation
DimensionTransition.PLAY_PORTAL_SOUND.then(DimensionTransition.PLACE_PORTAL_TICKET),
+ destination, finalPos, this.getDeltaMovement(), 90.0f, 0.0f, // DeerFolia Vanilla end teleportation
TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET),
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL
)
@@ -4389,6 +4394,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4630,6 +4635,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (!this.canPortalAsync(destination, takePassengers)) {
return false;
}
@ -41,8 +41,8 @@ index 7a102b4e90fbc09b8653e5b566299efe24a04cf6..4d5fcff9bb860542502f7d15a86cd14d
Vec3 initialPosition = this.position();
ChunkPos initialPositionChunk = new ChunkPos(
@@ -4453,9 +4463,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
info.postDimensionTransition().onTransition(teleported);
@@ -4694,9 +4704,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
info.postTeleportTransition().onTransition(teleported);
}
- if (teleportComplete != null) {
@ -59,7 +59,7 @@ index 7a102b4e90fbc09b8653e5b566299efe24a04cf6..4d5fcff9bb860542502f7d15a86cd14d
);
});
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..6512ac412ad48196e5decc47ccbf01c759a290eb 100644
index a498cdbe42df3161c35b2a1652dfa63693366bd6..f8474c511226a48be060c109e8ed3aeb879c5718 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 {
@ -72,21 +72,19 @@ index 5d6b1a63a2a213f8a4e81c5e574847007a82007b..6512ac412ad48196e5decc47ccbf01c7
public boolean autoExpire = true; // Paper - Expand FallingBlock API
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 58e15d7a5f7997a7aec9edaa5d211807b2b1ef6b..6d769f57242c2454cc19255197db70b9a9cf68ca 100644
index 45b8ac1418864ea32bd625b0d57fcec288ea5b0c..988c619d7696f7c9a3984095865136cccc789331 100644
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
@@ -70,6 +70,14 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal {
world.getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) return; // Paper - make cancellable
@@ -77,6 +77,12 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal {
// CraftBukkit end
+
+ // DeerFolia start - Sand duplication
+ if (!(entity instanceof net.minecraft.world.entity.player.Player)) {
+ entity.endPortalLogicAsync(pos);
+ return;
+ }
+ // DeerFolia end - Sand duplication
+
if (!world.isClientSide && world.dimension() == Level.END && entity instanceof ServerPlayer) {
ServerPlayer entityplayer = (ServerPlayer) entity;
// Folia - region threading - do not show credits
+ // DeerFolia start - unsafe teleportation
+ if (!(entity instanceof net.minecraft.world.entity.player.Player)) {
+ entity.endPortalLogicAsync(pos);
+ }
+ // DeerFolia end
+
entity.setAsInsidePortal(this, pos);
}

View File

@ -1,22 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: zhangyuheng <zhangyuheng@lunadeer.cn>
Date: Tue, 4 Jun 2024 09:40:57 +0800
Subject: [PATCH] Allow tripwire duplication
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..2e26a14faf95cf71fad2121b40de60b275be5dfc 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
@@ -202,8 +202,10 @@ 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 (world.getBlockState(blockposition2).is(Blocks.TRIPWIRE) || io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowTripwireDisarmingExploits) { // DeerFolia // Paper - Fix tripwire disarming not working as intended
world.setBlock(blockposition2, (BlockState) iblockdata4.trySetValue(TripWireHookBlock.ATTACHED, flag4), 3);
+ if (!world.getBlockState(blockposition2).isAir()) {
+ ;
}
}
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Modify tps command to show more details
diff --git a/src/main/java/io/papermc/paper/threadedregions/TickRegions.java b/src/main/java/io/papermc/paper/threadedregions/TickRegions.java
index b1c07e582dbf0a203cf734fdbcd8387a422af3a6..44d0d1bae314fba86d2d8ba36241bc77a9c2b21f 100644
index 988fe74578065c9464f5639e5cc6af79619edef5..cc09bfad668f9a4f5de7fe20cd6b363f60a8a72d 100644
--- a/src/main/java/io/papermc/paper/threadedregions/TickRegions.java
+++ b/src/main/java/io/papermc/paper/threadedregions/TickRegions.java
@@ -2,6 +2,7 @@ package io.papermc.paper.threadedregions;

View File

@ -0,0 +1,370 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: zhangyuheng <zhangyuheng@lunadeer.cn>
Date: Fri, 6 Dec 2024 00:02:28 +0800
Subject: [PATCH] Dynamic Activation Brain
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 4ed27c10b432ceebf4447ab8007bc3a1be09a06e..44cd9a9467441035a26bba3f48c4ca7c21b181a7 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -368,4 +368,14 @@ public class GlobalConfiguration extends ConfigurationPart {
}
}
// Folia end - threaded regions
+
+ // DeerFolia start - puffish DAB (Dynamic Activation Brain)
+ public DynamicActivationBrain dynamicActivationBrain;
+ public class DynamicActivationBrain extends ConfigurationPart {
+ public boolean dearEnabled = true;
+ public int startDistance = 12;
+ public int maximumActivationPrio = 20;
+ public int activationDistanceMod = 8;
+ }
+ // DeerFolia end - puffish DAB
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 6ddbf123eb06e481fda87b621534cf5b2137f0f2..dd082229682801fad556161e93f6a556c611e145 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -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; // DeerFolia - puffish DAB
if (!entity.isRemoved()) {
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 db6d3e4489832c60f0293e23c77c42adb37f5754..402f7c8e62ed8a0d93d59b8f0a53c3686b46d23f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -7,6 +7,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.collect.UnmodifiableIterator;
import com.mojang.logging.LogUtils;
+import io.papermc.paper.configuration.GlobalConfiguration;
import it.unimi.dsi.fastutil.doubles.DoubleList;
import it.unimi.dsi.fastutil.doubles.DoubleListIterator;
import it.unimi.dsi.fastutil.floats.FloatArraySet;
@@ -389,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; // DeerFolia - puffish DAB
+ public int activatedPriority = GlobalConfiguration.get().dynamicActivationBrain.maximumActivationPrio; // DeerFolia - puffish DAB
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 635c9c7a8c8307c2bc845a8e1f24aacb526a3c92..8ba58332020bd2aa35eca7f688392c3f651917b1 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -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; // DeerFolia - puffish DAB
@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 e48728723e9f765099fc1cea8e6a2baa48d7fc75..89d5e5ced79ce7369edf62ff1d9ef929a750e3ab 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -235,10 +235,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Override
public void inactiveTick() {
super.inactiveTick();
- if (this.goalSelector.inactiveTick()) {
+ if (this.goalSelector.inactiveTick(this.activatedPriority, true)) { // DeerFolia - puffish DAB
this.goalSelector.tick();
}
- if (this.targetSelector.inactiveTick()) {
+ if (this.targetSelector.inactiveTick(this.activatedPriority, true)) { // DeerFolia - puffish DAB
this.targetSelector.tick();
}
}
@@ -939,16 +939,20 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
if (i % 2 != 0 && this.tickCount > 1) {
gameprofilerfiller.push("targetSelector");
+ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // DeerFolia - puffish DAB
this.targetSelector.tickRunningGoals(false);
gameprofilerfiller.pop();
gameprofilerfiller.push("goalSelector");
+ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // DeerFolia - puffish DAB
this.goalSelector.tickRunningGoals(false);
gameprofilerfiller.pop();
} else {
gameprofilerfiller.push("targetSelector");
+ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // DeerFolia - puffish DAB
this.targetSelector.tick();
gameprofilerfiller.pop();
gameprofilerfiller.push("goalSelector");
+ if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // DeerFolia - puffish DAB
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..65139a44567bc50cffaf04a0416ce6b4d61219f7 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) {
+ // DeerFolia start - puffish DAB
+ if (entity.nextGolemPanic < 0) entity.nextGolemPanic = time + 100;
+ if (--entity.nextGolemPanic < time) {
+ entity.nextGolemPanic = -1;
+ // DeerFolia end - puffish DAB
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 29ae74339a4831ccef3d01e8054931715ba192ad..802ae2e01c3e26d86cebf279bdb847c46e422b6c 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
@@ -1,6 +1,7 @@
package net.minecraft.world.entity.ai.goal;
import com.google.common.annotations.VisibleForTesting;
+import io.papermc.paper.configuration.GlobalConfiguration;
import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet;
import java.util.EnumMap;
import java.util.EnumSet;
@@ -38,10 +39,16 @@ public class GoalSelector {
}
// Paper start - EAR 2
- public boolean inactiveTick() {
+ // DeerFolia start - puffish DAB
+ // public boolean inactiveTick() {
+ public boolean inactiveTick(int tickRate, boolean inactive) {
+ if (inactive && !GlobalConfiguration.get().dynamicActivationBrain.dearEnabled) tickRate = 4; // reset to Paper's
+ tickRate = Math.min(tickRate, 3);
this.curRate++;
- return this.curRate % 3 == 0; // TODO newGoalRate was already unused in 1.20.4, check if this is correct
+ // return this.curRate % 3 == 0; // TODO newGoalRate was already unused in 1.20.4, check if this is correct
+ return this.curRate % tickRate == 0; // TODO newGoalRate was already unused in 1.20.4, check if this is correct
}
+ // DeerFolia end
public boolean hasTasks() {
for (WrappedGoal task : this.availableGoals) {
if (task.isRunning()) {
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 b86f638390d386c838318a4d9b6571ac5514df8f..d74173ab9b17a8e1ce85a443a0a63538f049255a 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
@@ -223,11 +223,13 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
return 0.4F;
}
+ private int behaviorTick = 0; // DeerFolia - puffish DAB
@Override
protected void customServerAiStep(ServerLevel world) {
ProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.push("allayBrain");
+ if (this.behaviorTick++ % this.activatedPriority == 0) // DeerFolia - puffish DAB
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 31b10cd404b672d7ce21c2107d8f83e32de26ef4..9774e36d0c212e9bc9ac5cf0d0c1f6939bda6a75 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
@@ -292,11 +292,13 @@ public class Axolotl extends Animal implements VariantHolder<Axolotl.Variant>, B
return true;
}
+ private int behaviorTick = 0; // DeerFolia - puffish DAB
@Override
protected void customServerAiStep(ServerLevel world) {
ProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.push("axolotlBrain");
+ if (this.behaviorTick++ % this.activatedPriority == 0) // DeerFolia - puffish DAB
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 ca04e5d829331551a2c2f44e223ff05c6ce04e76..f16a6f29813365cb530b2b4ef3471ebd20aa5e1c 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
@@ -184,10 +184,12 @@ public class Frog extends Animal implements VariantHolder<Holder<FrogVariant>> {
.ifPresent(this::setVariant);
}
+ private int behaviorTick = 0; // DeerFolia - puffish DAB
@Override
protected void customServerAiStep(ServerLevel world) {
ProfilerFiller profilerFiller = Profiler.get();
profilerFiller.push("frogBrain");
+ if (this.behaviorTick++ % this.activatedPriority == 0) // DeerFolia - puffish DAB
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 48ac8c3f6e00c3c2dc67b6c994be7c0ac6dfcf81..effdc51327576e959760966e6b726def893f3208 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,11 +83,13 @@ public class Tadpole extends AbstractFish {
return SoundEvents.TADPOLE_FLOP;
}
+ private int behaviorTick = 0; // DeerFolia - puffish DAB
@Override
protected void customServerAiStep(ServerLevel world) {
ProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.push("tadpoleBrain");
+ if (this.behaviorTick++ % this.activatedPriority == 0) // DeerFolia - puffish DAB
this.getBrain().tick(world, this);
gameprofilerfiller.pop();
gameprofilerfiller.push("tadpoleActivityUpdate");
diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
index 76aca47d8638d5c37c57d3a59fa7f8ceaa5a53b4..b3a66b2686abc09d41e333e4d43c9493258839e6 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
@@ -192,11 +192,13 @@ public class Goat extends Animal {
return (Brain<Goat>) super.getBrain(); // CraftBukkit - decompile error
}
+ private int behaviorTick = 0; // DeerFolia - puffish DAB
@Override
protected void customServerAiStep(ServerLevel world) {
ProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.push("goatBrain");
+ if (this.behaviorTick++ % this.activatedPriority == 0) // DeerFolia - puffish DAB
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 92270912ef26924f611a1df7cb3d5b485b0a262d..fee4535bc3ee385e5309cb4abf9966692f30f4ae 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
@@ -138,11 +138,13 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
return (Brain<Hoglin>) super.getBrain(); // CraftBukkit - decompile error
}
+ private int behaviorTick = 0; // DeerFolia - puffish DAB
@Override
protected void customServerAiStep(ServerLevel world) {
ProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.push("hoglinBrain");
+ if (this.behaviorTick++ % this.activatedPriority == 0) // DeerFolia - puffish DAB
this.getBrain().tick(world, this);
gameprofilerfiller.pop();
HoglinAi.updateActivity(this);
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
index 2121d2a2e1aa1d0f0390cc515317096431f6dcb0..4b2181889d041a0b39f3590210e01686637fd7d7 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
@@ -307,11 +307,13 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
return !this.cannotHunt;
}
+ private int behaviorTick = 0; // DeerFolia - puffish DAB
@Override
protected void customServerAiStep(ServerLevel world) {
ProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.push("piglinBrain");
+ if (this.behaviorTick++ % this.activatedPriority == 0) // DeerFolia - puffish DAB
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 c47ed605f0822effd58df4f875297ed015e1e57e..ba9dd96a1d0547e728f2b6d7ddaaff9093a9bce0 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
@@ -275,11 +275,13 @@ public class Warden extends Monster implements VibrationSystem {
}
+ private int behaviorTick = 0; // DeerFolia - puffish DAB
@Override
protected void customServerAiStep(ServerLevel world) {
ProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.push("wardenBrain");
+ if (this.behaviorTick++ % this.activatedPriority == 0) // DeerFolia - puffish DAB
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 07f50048e9748b28178847ad470b8b2ce37e0eea..0c95a80d278b4abe9a84088941e39ef030f7427c 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -142,6 +142,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
return holder.is(PoiTypes.MEETING);
});
+ public long nextGolemPanic = -1; // DeerFolia - puffish DAB
+
public Villager(EntityType<? extends Villager> entityType, Level world) {
this(entityType, world, VillagerType.PLAINS);
}
@@ -245,6 +247,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}
// Spigot End
+ private int behaviorTick = 0; // DeerFolia - puffish DAB
@Override
protected void customServerAiStep(ServerLevel world) {
// Paper start - EAR 2
@@ -255,7 +258,12 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
ProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.push("villagerBrain");
- if (!inactive) this.getBrain().tick(world, this);
+ // DeerFolia start - puffish DAB
+ // if (!inactive) this.getBrain().tick(world, this);
+ if (!inactive && this.behaviorTick++ % this.activatedPriority == 0) {
+ this.getBrain().tick((ServerLevel) this.level(), this); // Paper
+ }
+ // DeerFolia end - puffish DAB
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 f2f5eb1a443ac411539e1c87eec60e76682b82fa..56be9e6822827310c05a8593db8ef4985d369ce9 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -1,5 +1,6 @@
package org.spigotmc;
+import io.papermc.paper.configuration.GlobalConfiguration;
import net.minecraft.core.BlockPos;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerChunkCache;
@@ -230,6 +231,24 @@ public class ActivationRange
}
// Paper end - Configurable marker ticking
ActivationRange.activateEntity(entity, bbByType); // Folia - threaded regions
+ // DeerFolia start - puffish DAB
+ if (GlobalConfiguration.get().dynamicActivationBrain.dearEnabled && entity.getType().dabEnabled) {
+ if (!entity.activatedPriorityReset) {
+ entity.activatedPriorityReset = true;
+ entity.activatedPriority = GlobalConfiguration.get().dynamicActivationBrain.maximumActivationPrio;
+ }
+ net.minecraft.world.phys.Vec3 playerVec = player.position();
+ net.minecraft.world.phys.Vec3 entityVec = entity.position();
+ double diffX = playerVec.x - entityVec.x, diffY = playerVec.y - entityVec.y, diffZ = playerVec.z - entityVec.z;
+ int squaredDistance = (int) (diffX * diffX + diffY * diffY + diffZ * diffZ);
+ int startDistance = GlobalConfiguration.get().dynamicActivationBrain.startDistance;
+ entity.activatedPriority = squaredDistance > startDistance * startDistance ?
+ Math.max(1, Math.min(squaredDistance >> GlobalConfiguration.get().dynamicActivationBrain.activationDistanceMod, entity.activatedPriority)) :
+ 1;
+ } else {
+ entity.activatedPriority = 1;
+ }
+ // DeerFolia end - puffish DAB
}
// Paper end
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: zhangyuheng <zhangyuheng@lunadeer.cn>
Date: Mon, 23 Dec 2024 11:42:32 +0800
Subject: [PATCH] Optimize for FurnitureCore plugin
diff --git a/src/main/java/cn/lunadeer/FurnitureCore.java b/src/main/java/cn/lunadeer/FurnitureCore.java
new file mode 100644
index 0000000000000000000000000000000000000000..b8219e467119770289b16ad068a31b3587300aa3
--- /dev/null
+++ b/src/main/java/cn/lunadeer/FurnitureCore.java
@@ -0,0 +1,9 @@
+package cn.lunadeer;
+
+import org.bukkit.NamespacedKey;
+
+import java.util.Locale;
+
+public class FurnitureCore {
+ public static NamespacedKey key = new NamespacedKey("FurnitureCore".toLowerCase(Locale.ROOT), "furniture");
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index dd082229682801fad556161e93f6a556c611e145..9bdaed9b01ac647e2b83b0315791ffac07fa991d 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -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
+ if (entity.getBukkitEntity().getPersistentDataContainer().has(cn.lunadeer.FurnitureCore.key)) return; // DeerFolia - FurnitureCore - don't tick furniture entities
entity.activatedPriorityReset = false; // DeerFolia - puffish DAB
if (!entity.isRemoved()) {
if (!tickratemanager.isEntityFrozen(entity)) {