Compare commits
30 Commits
1.21.4-e17
...
dev/per-vi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bf442f684 | ||
|
|
2e0339ccb4 | ||
|
|
8638f9a3c6 | ||
|
|
607b2231d3 | ||
|
|
4b89df11d1 | ||
|
|
6b9cfbec8c | ||
|
|
311c77bb16 | ||
|
|
40eb62013f | ||
|
|
1853680393 | ||
|
|
d3bdaaebb1 | ||
|
|
8441adc237 | ||
|
|
d75b16f37c | ||
|
|
977ea4ce36 | ||
|
|
417f856689 | ||
|
|
f9ac643183 | ||
|
|
dbcf43399f | ||
|
|
2e85aaf801 | ||
|
|
7bd5c4ecc4 | ||
|
|
56e7949273 | ||
|
|
7a2129c45c | ||
|
|
eb49a31dad | ||
|
|
f2fa3514bd | ||
|
|
83c54e3134 | ||
|
|
021c3666f7 | ||
|
|
860e9fbaf5 | ||
|
|
1a6a70069c | ||
|
|
1f0fc01a6e | ||
|
|
c20bbf9842 | ||
|
|
93e4d4eea1 | ||
|
|
efc5adae8b |
12
.github/dependabot.yml
vendored
12
.github/dependabot.yml
vendored
@@ -1,12 +0,0 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
# Enable version updates for github actions
|
||||
- package-ecosystem: "github-actions" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
13
.github/workflows/build_1.21.4.yml
vendored
13
.github/workflows/build_1.21.4.yml
vendored
@@ -1,10 +1,10 @@
|
||||
name: Luminol CI - dev/1.21.4-hardfork
|
||||
name: Luminol CI - dev/per-virtual-thread-tickregion
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "dev/1.21.4-hardfork" ]
|
||||
branches: [ "dev/per-virtual-thread-tickregion" ]
|
||||
pull_request:
|
||||
branches: [ "dev/1.21.4-hardfork" ]
|
||||
branches: [ "dev/per-virtual-thread-tickregion" ]
|
||||
|
||||
permissions: write-all
|
||||
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
uses: "actions/upload-artifact@v4"
|
||||
with:
|
||||
name: "${{ env.project_id_b }} CI Artifacts"
|
||||
path: "luminol-server/build/libs/*-paperclip.jar"
|
||||
path: "luminol-server/build/libs/*-paperclip-*-mojmap.jar"
|
||||
- name: SetENV
|
||||
if: github.event_name != 'pull_request'
|
||||
run: sh scripts/SetENV.sh
|
||||
@@ -52,6 +52,11 @@ jobs:
|
||||
tag: ${{ env.tag }}
|
||||
name: ${{ env.project_id_b }} ${{ env.mcversion }} - ${{ env.commit_id }}
|
||||
body: |
|
||||
> [!CAUTION]
|
||||
> 🚨You are trying to download experimental builds!
|
||||
> **<u>DO NOT</u>** use these builds in production, as there may be many bugs and corruption issues.
|
||||
> Please report any and all issues you encounter!
|
||||
|
||||
📦Version: `${{ env.mcversion }}` | Commit ${{ env.commit_id }} [](https://github.com/LuminolMC/${{ env.project_id }}/download/${{ env.tag }}/${{ env.jar }})
|
||||
This release is automatically compiled by GitHub Actions
|
||||
### Commit Message
|
||||
|
||||
@@ -2,7 +2,7 @@ group = me.earthme.luminol
|
||||
version=1.21.4-R0.1-SNAPSHOT
|
||||
mcVersion=1.21.4
|
||||
|
||||
foliaRef=cd49d650b27aa329358593a84ef77444538ef014
|
||||
foliaRef=80ab57dcbe5fa96cc2f7fe34ecba94162d8dd5e9
|
||||
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.caching=true
|
||||
|
||||
@@ -186,10 +186,10 @@ index 0000000000000000000000000000000000000000..ecde4462b08d701b8bff9f26902f1775
|
||||
+ RegionStats getRegionStats();
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index bff01411f4b2d3ecd9e6d807c3f450d72c108323..1d74f4814d5c87d6cd1320634e5610cac16d32c5 100644
|
||||
index 015d852d5a0c01042a2153a6916d408660356c59..c7b6f3f6c42746297816c0650571990f565d5e68 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -4437,4 +4437,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
@@ -4432,4 +4432,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Sun, 6 Apr 2025 10:42:47 +0800
|
||||
Subject: [PATCH] Leaves Fix SculkCatalyst exp skip
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
|
||||
index 42ffb81708b327f765ba3235fdd1ab69cd7589fd..0a7e37420f8d024ffba1fd1c52edc50c10408e6e 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
|
||||
@@ -25,17 +25,25 @@ public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Ca
|
||||
private float deathSoundVolume;
|
||||
private float deathSoundPitch;
|
||||
// Paper end
|
||||
+ private int rewardExp; // Leaves - exp fix
|
||||
|
||||
public EntityDeathEvent(@NotNull final LivingEntity entity, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops) {
|
||||
this(entity, damageSource, drops, 0);
|
||||
}
|
||||
|
||||
public EntityDeathEvent(@NotNull final LivingEntity what, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp) {
|
||||
+ // Leaves start - exp fix
|
||||
+ this(what, damageSource, drops, droppedExp, droppedExp);
|
||||
+ }
|
||||
+
|
||||
+ public EntityDeathEvent(@NotNull final LivingEntity what, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp, final int rewardExp) {
|
||||
super(what);
|
||||
this.damageSource = damageSource;
|
||||
this.drops = drops;
|
||||
this.dropExp = droppedExp;
|
||||
+ this.rewardExp = rewardExp;
|
||||
}
|
||||
+ // Leaves end - exp fix
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -75,6 +83,7 @@ public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Ca
|
||||
*/
|
||||
public void setDroppedExp(int exp) {
|
||||
this.dropExp = exp;
|
||||
+ this.rewardExp = exp; // Leaves - exp fix
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,4 +235,14 @@ public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Ca
|
||||
this.deathSoundPitch = pitch;
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ // Leaves start - exp fix
|
||||
+ public int getRewardExp() {
|
||||
+ return rewardExp;
|
||||
+ }
|
||||
+
|
||||
+ public void setRewardExp(int rewardExp) {
|
||||
+ this.rewardExp = rewardExp;
|
||||
+ }
|
||||
+ // Leaves end - exp fix
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sat, 22 Mar 2025 17:36:17 +0800
|
||||
Subject: [PATCH] Luminol config base
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java
|
||||
index 9aa664537cc37e44db46d5a2a64ae3116938c681..8d6a6534a134e99e5ee2652d7b0c858d538e69bd 100644
|
||||
--- a/net/minecraft/server/Main.java
|
||||
+++ b/net/minecraft/server/Main.java
|
||||
@@ -108,6 +108,7 @@ public class Main {
|
||||
JvmProfiler.INSTANCE.start(Environment.SERVER);
|
||||
}
|
||||
|
||||
+ me.earthme.luminol.config.LuminolConfig.preLoadConfig(); // Luminol - Luminol config
|
||||
io.papermc.paper.plugin.PluginInitializerManager.load(optionSet); // Paper
|
||||
Bootstrap.bootStrap();
|
||||
Bootstrap.validate();
|
||||
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index e3b7184e20bda4983ee1fc5463d91ca0cdd8ec1f..375f4a59333ee1d75fb1acb8c2cbada7866bd48e 100644
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -212,6 +212,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
|
||||
+ me.earthme.luminol.config.LuminolConfig.finalizeLoadConfig(); //Luminol - load config file
|
||||
+ me.earthme.luminol.config.LuminolConfig.setupLatch(); //Luminol - load config file
|
||||
this.server.spark.enableEarlyIfRequested(); // Paper - spark
|
||||
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
|
||||
if (this.convertOldUsers()) {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add config for server mod name
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index faf72dd6dff74296c73cb058aaabd1f9f475a072..46375fa81b36b89b79c22f0a7ac6d610ab1183d4 100644
|
||||
index be82a6b43b1f0c644c53d08a6e16bc2876c8c1e0..9261d83f28af5e057d060741ab900f8cde8f992b 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1967,7 +1967,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1968,7 +1968,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
@@ -17,10 +17,10 @@ index 8d67b4629c69d3039b199aaad45533d1acde114e..f7bfeca4b11b9860241d5eb80b6df420
|
||||
((ca.spottedleaf.moonrise.patches.chunk_tick_iteration.ChunkTickServerLevel)(ServerLevel)chunk.getLevel()).moonrise$removeChunkForPlayerTicking(chunk); // Moonrise - chunk tick iteration
|
||||
}
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 46375fa81b36b89b79c22f0a7ac6d610ab1183d4..f2124edb487b1d5f6bdc7fa086814f870724363a 100644
|
||||
index 9261d83f28af5e057d060741ab900f8cde8f992b..fc088edaa36e7e68ddd23c57e351ef3b31ed5ad8 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1665,7 +1665,44 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1666,7 +1666,44 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// Folia end - region threading
|
||||
//this.tickCount++; // Folia - region threading
|
||||
//this.tickRateManager.tick(); // Folia - region threading
|
||||
@@ -118,7 +118,7 @@ index f2d2ddfd964bff914e41c0b4150fe1aad7866ebf..7defcd15c44601bfd2f7f55046038693
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 42987d278bf4abbad9d63485a1050f4abc3e7367..3bc0fc1d411d3c5e206695510ec9288ffbf8c277 100644
|
||||
index dbf9231b1f01576906b90a3ddf0bf2cbbeb4590a..b17ace9118c94a756fa2901621c6b2b9bd9e5764 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -400,7 +400,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Add config to disable entity tick catchers
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
|
||||
index dafd90502937019b616ac0a79465e1dbc578cf66..96daa716aa06de31b2867f09833ac8e77b6314c4 100644
|
||||
index 78f4dd7032d18b8e020a4576e4ac012c1d472e67..120e25ca0544980d1bfc1498e1386f965dae7044 100644
|
||||
--- a/net/minecraft/world/level/Level.java
|
||||
+++ b/net/minecraft/world/level/Level.java
|
||||
@@ -1547,6 +1547,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
@@ -1,25 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 10:39:35 +0800
|
||||
Subject: [PATCH] Add fix for off region adult following ai behavior
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java b/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
|
||||
index a9be3acbf4ea52d2988347abfa6f4f8c02b1da26..751f3dde8e6bc2c0365e8672f5079af0379a69de 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
|
||||
@@ -25,6 +25,14 @@ public class BabyFollowAdult {
|
||||
return false;
|
||||
} else {
|
||||
LivingEntity ageableMob = instance.get(nearestVisibleAdult); // CraftBukkit - type
|
||||
+
|
||||
+ // Luminol start - Fix off world entity following which caused async issue
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(ageableMob)) {
|
||||
+ nearestVisibleAdult.erase();
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Luminol end
|
||||
+
|
||||
if (mob.closerThan(ageableMob, followRange.getMaxValue() + 1) && !mob.closerThan(ageableMob, followRange.getMinValue())) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(mob, ageableMob, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FOLLOW_LEADER);
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Kercute <A3167717663@hotmail.com>
|
||||
Date: Sun, 16 Mar 2025 23:31:41 +0800
|
||||
Subject: [PATCH] Add force the data command to be enabled config
|
||||
Subject: [PATCH] Add experiment config for force enabling data command
|
||||
|
||||
|
||||
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
|
||||
@@ -55,7 +55,7 @@ index 51c126735ace8fdde89ad97b5cab62f244212db0..c7d4d944eb198ac53a3eeae717a25c7d
|
||||
+ public void moonrise$write(final abomination.IRegionFile regionFile) throws IOException; // Luminol - Configurable region file format
|
||||
}
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index f2124edb487b1d5f6bdc7fa086814f870724363a..ed00a29daccfee1d631bef27c0a3a4ae83140018 100644
|
||||
index fc088edaa36e7e68ddd23c57e351ef3b31ed5ad8..5d709b3b47702e7607dafa4a38380c801b228e2d 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -986,10 +986,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -0,0 +1,512 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sun, 6 Apr 2025 12:51:11 +0800
|
||||
Subject: [PATCH] Add feature: per virtual thread per tickregion
|
||||
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/PerThreadSchedulerPool.java b/io/papermc/paper/threadedregions/PerThreadSchedulerPool.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b49b4b02c3d38174a0bb8d171e1f1e65320bdeca
|
||||
--- /dev/null
|
||||
+++ b/io/papermc/paper/threadedregions/PerThreadSchedulerPool.java
|
||||
@@ -0,0 +1,183 @@
|
||||
+package io.papermc.paper.threadedregions;
|
||||
+
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2ObjectLinkedOpenHashMap;
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2ObjectMaps;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.Arrays;
|
||||
+import java.util.concurrent.ThreadFactory;
|
||||
+import java.util.concurrent.atomic.AtomicBoolean;
|
||||
+import java.util.concurrent.locks.LockSupport;
|
||||
+
|
||||
+public class PerThreadSchedulerPool {
|
||||
+ private final ThreadFactory factory;
|
||||
+ private final COWArrayList<Worker> workers = new COWArrayList<>(Worker.class);
|
||||
+ private final Reference2ObjectMap<ScheduledTaskThreadPool.SchedulableTick, Worker> task2Workers = Reference2ObjectMaps.synchronize(new Reference2ObjectLinkedOpenHashMap<>());
|
||||
+
|
||||
+ public PerThreadSchedulerPool(ThreadFactory factory) {
|
||||
+ this.factory = factory;
|
||||
+ }
|
||||
+
|
||||
+ public void schedule(ScheduledTaskThreadPool.SchedulableTick task) {
|
||||
+ final Worker cretedWorker = new Worker(this.factory, task);
|
||||
+
|
||||
+ this.task2Workers.put(task, cretedWorker);
|
||||
+ this.workers.add(cretedWorker);
|
||||
+
|
||||
+ cretedWorker.active();
|
||||
+ }
|
||||
+
|
||||
+ public void notifyTasks(ScheduledTaskThreadPool.SchedulableTick task) {
|
||||
+ final Worker target = this.task2Workers.get(task);
|
||||
+
|
||||
+ if (target == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ target.notifyToTask();
|
||||
+ }
|
||||
+
|
||||
+ public void halt() {
|
||||
+ final Worker[] workers = this.workers.getArray();
|
||||
+
|
||||
+ for (Worker worker : workers) {
|
||||
+ worker.shutdown();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public int getTotalThreadCount() {
|
||||
+ return this.workers.getArray().length;
|
||||
+ }
|
||||
+
|
||||
+ public Thread[] getAllAliveThreads() {
|
||||
+ return Arrays.stream(this.workers.getArray()).map(Worker::getOwner).toArray(Thread[]::new);
|
||||
+ }
|
||||
+
|
||||
+ public boolean join(long timeoutNanos) {
|
||||
+ long deadline = System.nanoTime() + timeoutNanos;
|
||||
+
|
||||
+ for (;;) {
|
||||
+ final Worker[] workers = this.workers.getArray();
|
||||
+
|
||||
+ if (workers.length == 0) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ Thread.yield();
|
||||
+ LockSupport.parkNanos(1);
|
||||
+
|
||||
+ if (System.nanoTime() > deadline) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public final class Worker implements Runnable {
|
||||
+ private final Thread thread;
|
||||
+ private final ScheduledTaskThreadPool.SchedulableTick task;
|
||||
+
|
||||
+ private final AtomicBoolean shutdown = new AtomicBoolean(false);
|
||||
+ private final AtomicBoolean running = new AtomicBoolean(true);
|
||||
+
|
||||
+ public Worker(@NotNull ThreadFactory threadFactory, ScheduledTaskThreadPool.SchedulableTick task) {
|
||||
+ this.thread = threadFactory.newThread(this);
|
||||
+ this.task = task;
|
||||
+
|
||||
+ if (!this.task.setScheduled()) {
|
||||
+ throw new IllegalArgumentException("Task is already scheduled");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void run() {
|
||||
+ TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.set(new TickThreadRunnerDataCarrier());
|
||||
+
|
||||
+ master_loop:
|
||||
+ for (;;) {
|
||||
+ if (!this.task.isScheduled() || this.shutdown.get()) {
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ final long deadline = this.task.getScheduledStart();
|
||||
+
|
||||
+ for (;; ) {
|
||||
+ final long currTime = System.nanoTime();
|
||||
+
|
||||
+ if (currTime >= deadline) {
|
||||
+ // we will use it in setting to ticking state
|
||||
+ // containing cas operations so we need to process the fallback
|
||||
+ if (this.task.upgradeToScheduledTasks()) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ final boolean hasTasks = this.task.hasTasks(); // check for tasks
|
||||
+
|
||||
+ if (hasTasks) {
|
||||
+ // containing cas operations so we need to process the fallback
|
||||
+ if (!this.task.upgradeToScheduledTasks()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ // task sate and run tasks
|
||||
+ final boolean taskProcessed = this.task.tasks(() -> System.nanoTime() >= deadline);
|
||||
+
|
||||
+ // containing cas operations so we need to process the fallback
|
||||
+ // also might be cancelled
|
||||
+ if (!taskProcessed) {
|
||||
+ // check for cancelled
|
||||
+ continue master_loop;
|
||||
+ }else {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ Thread.yield();
|
||||
+ LockSupport.parkNanos(1_000L);
|
||||
+ }
|
||||
+
|
||||
+ boolean ticked = this.task.tick();
|
||||
+
|
||||
+ if (!ticked) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.remove();
|
||||
+ PerThreadSchedulerPool.this.task2Workers.remove(this.task);
|
||||
+ PerThreadSchedulerPool.this.workers.remove(this);
|
||||
+ this.running.set(false);
|
||||
+ }
|
||||
+
|
||||
+ public void active() {
|
||||
+ this.thread.start();
|
||||
+ }
|
||||
+
|
||||
+ public Thread getOwner() {
|
||||
+ return this.thread;
|
||||
+ }
|
||||
+
|
||||
+ public void notifyToTask() {
|
||||
+ LockSupport.unpark(this.thread);
|
||||
+ }
|
||||
+
|
||||
+ public boolean running() {
|
||||
+ return this.running.get();
|
||||
+ }
|
||||
+
|
||||
+ public void shutdown() {
|
||||
+ this.shutdown.set(true);
|
||||
+ LockSupport.unpark(this.thread);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static class TickThreadRunnerDataCarrier {
|
||||
+ ThreadedRegionizer.ThreadedRegion<TickRegions.TickRegionData, TickRegions.TickRegionSectionData> currentTickingRegion;
|
||||
+ RegionizedWorldData currentTickingWorldRegionizedData;
|
||||
+ ScheduledTaskThreadPool.SchedulableTick currentTickingTask;
|
||||
+ ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle profiler = ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle.NO_OP_HANDLE;
|
||||
+
|
||||
+ public static final ThreadLocal<TickThreadRunnerDataCarrier> CARRIER_THREAD_LOCAL = new ThreadLocal<>();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java b/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java
|
||||
index 5c591b0d6eac45d6094ce44bf62ad976bf995e66..2f61f72087ea07e8d29bf6d5c264e217b20eb377 100644
|
||||
--- a/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java
|
||||
+++ b/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java
|
||||
@@ -402,7 +402,7 @@ public final class ScheduledTaskThreadPool {
|
||||
|
||||
private volatile ScheduledTickTask task;
|
||||
|
||||
- private int getStateVolatile() {
|
||||
+ public int getStateVolatile() { // Luminol - Per thread for tickregion
|
||||
return (int)STATE_HANDLE.getVolatile(this);
|
||||
}
|
||||
|
||||
@@ -414,23 +414,23 @@ public final class ScheduledTaskThreadPool {
|
||||
return (int)STATE_HANDLE.compareAndExchange(this, expect, update);
|
||||
}
|
||||
|
||||
- private boolean isScheduled() {
|
||||
+ public boolean isScheduled() { // Luminol - Per thread for tickregion
|
||||
return this.getStateVolatile() == STATE_SCHEDULED;
|
||||
}
|
||||
|
||||
- private boolean upgradeToScheduledTasks() {
|
||||
+ public boolean upgradeToScheduledTasks() { // Luminol - Per thread for tickregion
|
||||
return STATE_SCHEDULED == this.compareAndExchangeStateVolatile(STATE_SCHEDULED, STATE_SCHEDULED_TASKS);
|
||||
}
|
||||
|
||||
- private boolean setScheduled() {
|
||||
+ public boolean setScheduled() { // Luminol - Per thread for tickregion
|
||||
return STATE_UNSCHEDULED == this.compareAndExchangeStateVolatile(STATE_UNSCHEDULED, STATE_SCHEDULED);
|
||||
}
|
||||
|
||||
- private boolean setScheduledTasks() {
|
||||
+ public boolean setScheduledTasks() { // Luminol - Per thread for tickregion
|
||||
return STATE_UNSCHEDULED == this.compareAndExchangeStateVolatile(STATE_UNSCHEDULED, STATE_SCHEDULED_TASKS);
|
||||
}
|
||||
|
||||
- private boolean cancel() {
|
||||
+ public boolean cancel() { // Luminol - Per thread for tickregion
|
||||
for (int currState = this.getStateVolatile();;) {
|
||||
switch (currState) {
|
||||
case STATE_UNSCHEDULED: {
|
||||
@@ -544,14 +544,14 @@ public final class ScheduledTaskThreadPool {
|
||||
}
|
||||
}
|
||||
|
||||
- protected final long getScheduledStart() {
|
||||
+ public final long getScheduledStart() { // Luminol - Per thread for tickregion
|
||||
return this.scheduledStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* If this task is scheduled, then this may only be invoked during {@link #runTick()}
|
||||
*/
|
||||
- protected final void setScheduledStart(final long value) {
|
||||
+ public final void setScheduledStart(final long value) { // Luminol - Per thread for tickregion
|
||||
this.scheduledStart = value;
|
||||
}
|
||||
|
||||
@@ -565,7 +565,7 @@ public final class ScheduledTaskThreadPool {
|
||||
*/
|
||||
public abstract boolean runTick();
|
||||
|
||||
- private boolean tick() {
|
||||
+ public boolean tick() { // Luminol - Per thread for tickregion
|
||||
if (!this.markTicking()) {
|
||||
return false;
|
||||
}
|
||||
@@ -610,7 +610,7 @@ public final class ScheduledTaskThreadPool {
|
||||
*/
|
||||
public abstract boolean runTasks(final BooleanSupplier canContinue);
|
||||
|
||||
- private boolean tasks(final BooleanSupplier canContinue) {
|
||||
+ public boolean tasks(final BooleanSupplier canContinue) { // Luminol - Per thread for tickregion
|
||||
if (!this.markTasks()) {
|
||||
return false;
|
||||
}
|
||||
@@ -692,12 +692,12 @@ public final class ScheduledTaskThreadPool {
|
||||
private Thread thread;
|
||||
|
||||
// no scheduled ticks
|
||||
- private static final int STATE_IDLE = 1 << 0;
|
||||
- private static final int STATE_WAITING = 1 << 1;
|
||||
- private static final int STATE_TASKS = 1 << 2;
|
||||
- private static final int STATE_INTERRUPT = 1 << 3;
|
||||
- private static final int STATE_TICKING = 1 << 4;
|
||||
- private static final int STATE_HALTED = 1 << 5;
|
||||
+ public static final int STATE_IDLE = 1 << 0; // Luminol - Per thread for tickregion
|
||||
+ public static final int STATE_WAITING = 1 << 1; // Luminol - Per thread for tickregion
|
||||
+ public static final int STATE_TASKS = 1 << 2; // Luminol - Per thread for tickregion
|
||||
+ public static final int STATE_INTERRUPT = 1 << 3; // Luminol - Per thread for tickregion
|
||||
+ public static final int STATE_TICKING = 1 << 4; // Luminol - Per thread for tickregion
|
||||
+ public static final int STATE_HALTED = 1 << 5; // Luminol - Per thread for tickregion
|
||||
private volatile int state = STATE_INTERRUPT; // set to INTERRUPT initially so that tasks may be stolen on start
|
||||
private static final VarHandle STATE_HANDLE = ConcurrentUtil.getVarHandle(TickThreadRunner.class, "state", int.class);
|
||||
|
||||
@@ -720,7 +720,7 @@ public final class ScheduledTaskThreadPool {
|
||||
STATE_HANDLE.setVolatile(this, value);
|
||||
}
|
||||
|
||||
- private int compareAndExchangeStateVolatile(final int expect, final int update) {
|
||||
+ public int compareAndExchangeStateVolatile(final int expect, final int update) { // Luminol - Per thread for tickregion
|
||||
return (int)STATE_HANDLE.compareAndExchange(this, expect, update);
|
||||
}
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/TickRegionScheduler.java b/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||
index a8608e8bed64a4da4ed340ab3837b082d6715437..fc14f5780effce99a9768a1ffbb338e61228b252 100644
|
||||
--- a/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||
+++ b/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||
@@ -40,65 +40,92 @@ public final class TickRegionScheduler {
|
||||
}
|
||||
// Folia end - watchdog
|
||||
|
||||
- private final ScheduledTaskThreadPool scheduler;
|
||||
+ private final PerThreadSchedulerPool scheduler; // Luminol - Per thread for tickregion
|
||||
|
||||
public TickRegionScheduler() {
|
||||
- this.scheduler = new ScheduledTaskThreadPool(new ThreadFactory() {
|
||||
+ this.scheduler = new PerThreadSchedulerPool(new ThreadFactory() { // Luminol - Per thread for tickregion
|
||||
private final AtomicInteger idGenerator = new AtomicInteger();
|
||||
|
||||
@Override
|
||||
public Thread newThread(final Runnable run) {
|
||||
- final Thread ret = new TickThreadRunner(run, "Region Scheduler Thread #" + this.idGenerator.getAndIncrement());
|
||||
- ret.setUncaughtExceptionHandler(TickRegionScheduler.this::uncaughtException);
|
||||
+ //final Thread ret = new TickThreadRunner(run, "Region Scheduler Thread #" + this.idGenerator.getAndIncrement()); // Luminol - Per thread for tickregion
|
||||
+ // Luminol start - Per thread for tickregion
|
||||
+ final Thread ret = Thread.ofVirtual()
|
||||
+ .name("Region Scheduler Thread #" + this.idGenerator.getAndIncrement())
|
||||
+ .uncaughtExceptionHandler(TickRegionScheduler.this::uncaughtException)
|
||||
+ .factory()
|
||||
+ .newThread(() -> {
|
||||
+ try {
|
||||
+ run.run();
|
||||
+ }finally {
|
||||
+ TickThread.VIRTUAL_TICK_THREAD_GROUP.remove(Thread.currentThread());
|
||||
+ }
|
||||
+ });
|
||||
+ TickThread.VIRTUAL_TICK_THREAD_GROUP.add(ret);
|
||||
+ // Luminol end
|
||||
return ret;
|
||||
}
|
||||
- }, TimeUnit.MILLISECONDS.toNanos(3L), TimeUnit.MILLISECONDS.toNanos(2L));
|
||||
+ }); // Luminol - Per thread for tickregion
|
||||
}
|
||||
|
||||
public void setThreads(final int threads) {
|
||||
- this.scheduler.setCoreThreads(threads);
|
||||
+ //this.scheduler.setCoreThreads(threads); // Luminol - Per thread for tickregion
|
||||
}
|
||||
|
||||
public int getTotalThreadCount() {
|
||||
- return this.scheduler.getAliveThreads().length;
|
||||
+ return this.scheduler.getTotalThreadCount(); // Luminol - Per thread for tickregion
|
||||
}
|
||||
|
||||
private static void setTickingRegion(final ThreadedRegionizer.ThreadedRegion<TickRegions.TickRegionData, TickRegions.TickRegionSectionData> region) {
|
||||
- final Thread currThread = Thread.currentThread();
|
||||
+ /*final Thread currThread = Thread.currentThread();
|
||||
if (!(currThread instanceof TickThreadRunner tickThreadRunner)) {
|
||||
throw new IllegalStateException("Must be tick thread runner");
|
||||
+ }*/
|
||||
+ var carrier = PerThreadSchedulerPool.TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.get(); // Luminol - Per thread for tickregion
|
||||
+ // Luminol start - Per thread for tickregion
|
||||
+ if (carrier == null) {
|
||||
+ throw new IllegalStateException("Must be tick thread runner");
|
||||
}
|
||||
- if (region != null && tickThreadRunner.currentTickingRegion != null) {
|
||||
+ // Luminol end
|
||||
+ var currentTickingRegion = carrier.currentTickingRegion; // Luminol - Per thread for tickregion
|
||||
+ if (region != null && currentTickingRegion != null) { // Luminol - Per thread for tickregion
|
||||
throw new IllegalStateException("Trying to double set ticking region!");
|
||||
}
|
||||
- if (region == null && tickThreadRunner.currentTickingRegion == null) {
|
||||
+ if (region == null && currentTickingRegion == null) { // Luminol - Per thread for tickregion
|
||||
throw new IllegalStateException("Trying to double unset ticking region!");
|
||||
}
|
||||
- tickThreadRunner.currentTickingRegion = region;
|
||||
+ carrier.currentTickingRegion = region; // Luminol - Per thread for tickregion
|
||||
if (region != null) {
|
||||
- tickThreadRunner.currentTickingWorldRegionizedData = region.regioniser.world.worldRegionData.get();
|
||||
+ carrier.currentTickingWorldRegionizedData = region.regioniser.world.worldRegionData.get(); // Luminol - Per thread for tickregion
|
||||
// Folia start - profiler
|
||||
final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle profiler = region.getData().profiler;
|
||||
- tickThreadRunner.profiler = profiler == null ? ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle.NO_OP_HANDLE : profiler;
|
||||
+ carrier.profiler = profiler == null ? ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle.NO_OP_HANDLE : profiler; // Luminol - Per thread for tickregion
|
||||
// Folia end - profiler
|
||||
} else {
|
||||
- tickThreadRunner.currentTickingWorldRegionizedData = null;
|
||||
- tickThreadRunner.profiler = ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle.NO_OP_HANDLE; // Folia - profiler
|
||||
+ carrier.currentTickingWorldRegionizedData = null;// Luminol - Per thread for tickregion
|
||||
+ carrier.profiler = ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle.NO_OP_HANDLE; // Folia - profiler // Luminol - Per thread for tickregion
|
||||
}
|
||||
}
|
||||
|
||||
private static void setTickTask(final ScheduledTaskThreadPool.SchedulableTick task) {
|
||||
- final Thread currThread = Thread.currentThread();
|
||||
+ /*final Thread currThread = Thread.currentThread(); // Luminol - Per thread for tickregion
|
||||
if (!(currThread instanceof TickThreadRunner tickThreadRunner)) {
|
||||
throw new IllegalStateException("Must be tick thread runner");
|
||||
+ }*/ // Luminol - Per thread for tickregion
|
||||
+ var carrier = PerThreadSchedulerPool.TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.get(); // Luminol - Per thread for tickregion
|
||||
+ // Luminol start - Per thread for tickregion
|
||||
+ if (carrier == null) {
|
||||
+ throw new IllegalStateException("Must be tick thread runner");
|
||||
}
|
||||
- if (task != null && tickThreadRunner.currentTickingTask != null) {
|
||||
+ // Luminol end
|
||||
+ final ScheduledTaskThreadPool.SchedulableTick last = carrier.currentTickingTask; // Luminol - Per thread for tickregion
|
||||
+ if (task != null && last != null) { // Luminol - Per thread for tickregion
|
||||
throw new IllegalStateException("Trying to double set ticking task!");
|
||||
}
|
||||
- if (task == null && tickThreadRunner.currentTickingTask == null) {
|
||||
+ if (task == null && last == null) { // Luminol - Per thread for tickregion
|
||||
throw new IllegalStateException("Trying to double unset ticking task!");
|
||||
}
|
||||
- tickThreadRunner.currentTickingTask = task;
|
||||
+ carrier.currentTickingTask = task;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,11 +133,17 @@ public final class TickRegionScheduler {
|
||||
* If this thread is not a TickThread, then returns {@code null}.
|
||||
*/
|
||||
public static ThreadedRegionizer.ThreadedRegion<TickRegions.TickRegionData, TickRegions.TickRegionSectionData> getCurrentRegion() {
|
||||
- final Thread currThread = Thread.currentThread();
|
||||
+ /*final Thread currThread = Thread.currentThread(); // Luminol - Per thread for tickregion
|
||||
if (!(currThread instanceof TickThreadRunner tickThreadRunner)) {
|
||||
return RegionShutdownThread.getRegion();
|
||||
+ }*/ // Luminol - Per thread for tickregion
|
||||
+ // Luminol start - Per thread for tickregion
|
||||
+ var carrier = PerThreadSchedulerPool.TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.get();
|
||||
+ if (carrier == null) {
|
||||
+ return RegionShutdownThread.getRegion();
|
||||
}
|
||||
- return tickThreadRunner.currentTickingRegion;
|
||||
+ // Luminol end
|
||||
+ return carrier.currentTickingRegion; // Luminol - Per thread for tickregion
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,11 +152,17 @@ public final class TickRegionScheduler {
|
||||
* If this thread is not a TickThread, then returns {@code null}.
|
||||
*/
|
||||
public static RegionizedWorldData getCurrentRegionizedWorldData() {
|
||||
- final Thread currThread = Thread.currentThread();
|
||||
+ /*final Thread currThread = Thread.currentThread(); // Luminol - Per thread for tickregion
|
||||
if (!(currThread instanceof TickThreadRunner tickThreadRunner)) {
|
||||
return RegionShutdownThread.getWorldData();
|
||||
+ }*/ // Luminol - Per thread for tickregion
|
||||
+ // Luminol start - Per thread for tickregion
|
||||
+ var carrier = PerThreadSchedulerPool.TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.get();
|
||||
+ if (carrier == null) {
|
||||
+ return RegionShutdownThread.getWorldData();
|
||||
}
|
||||
- return tickThreadRunner.currentTickingWorldRegionizedData;
|
||||
+ // Luminol end
|
||||
+ return carrier.currentTickingWorldRegionizedData; // Luminol - Per thread for tickregion
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,20 +170,32 @@ public final class TickRegionScheduler {
|
||||
* If this thread is not a TickThread, then returns {@code null}.
|
||||
*/
|
||||
public static ScheduledTaskThreadPool.SchedulableTick getCurrentTickingTask() {
|
||||
- final Thread currThread = Thread.currentThread();
|
||||
+ /*final Thread currThread = Thread.currentThread(); // Luminol - Per thread for tickregion
|
||||
if (!(currThread instanceof TickThreadRunner tickThreadRunner)) {
|
||||
return null;
|
||||
+ }*/ // Luminol - Per thread for tickregion
|
||||
+ // Luminol start - Per thread for tickregion
|
||||
+ var carrier = PerThreadSchedulerPool.TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.get();
|
||||
+ if (carrier == null) {
|
||||
+ return null;
|
||||
}
|
||||
- return tickThreadRunner.currentTickingTask;
|
||||
+ // Luminol end
|
||||
+ return carrier.currentTickingTask;
|
||||
}
|
||||
|
||||
// Folia start - profiler
|
||||
public static ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle getProfiler() {
|
||||
- final Thread currThread = Thread.currentThread();
|
||||
- if (!(currThread instanceof TickThreadRunner tickThreadRunner)) {
|
||||
+ /*final Thread currThread = Thread.currentThread(); // Luminol - Per thread for tickregion
|
||||
+ if (!(currThread instanceof TickThreadRunner)) { // Luminol - Per thread for tickregion
|
||||
+ return ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle.NO_OP_HANDLE;
|
||||
+ }*/ // Luminol - Per thread for tickregion
|
||||
+ // Luminol start - Per thread for tickregion
|
||||
+ var carrier = PerThreadSchedulerPool.TickThreadRunnerDataCarrier.CARRIER_THREAD_LOCAL.get();
|
||||
+ if (carrier == null) {
|
||||
return ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle.NO_OP_HANDLE;
|
||||
}
|
||||
- return tickThreadRunner.profiler;
|
||||
+ // Luminol end
|
||||
+ return carrier.profiler; // Luminol - Per thread for tickregion
|
||||
}
|
||||
// Folia end - profiler
|
||||
|
||||
@@ -171,14 +222,14 @@ public final class TickRegionScheduler {
|
||||
public boolean halt(final boolean sync, final long maxWaitNS) {
|
||||
this.scheduler.halt();
|
||||
if (!sync) {
|
||||
- return this.scheduler.getAliveThreads().length == 0;
|
||||
+ return this.scheduler.getTotalThreadCount() == 0; // Luminol - Per thread for tickregion
|
||||
}
|
||||
|
||||
- return this.scheduler.join(maxWaitNS == 0L ? 0L : Math.max(1L, TimeUnit.NANOSECONDS.toMillis(maxWaitNS)));
|
||||
+ return this.scheduler.join(maxWaitNS == 0L ? 0L : Math.max(1L, maxWaitNS)); // Luminol - Per thread for tickregion
|
||||
}
|
||||
|
||||
void dumpAliveThreadTraces(final String reason) {
|
||||
- for (final Thread thread : this.scheduler.getAliveThreads()) {
|
||||
+ for (final Thread thread : this.scheduler.getAllAliveThreads()) { // Luminol - Per thread for tickregion
|
||||
if (thread.isAlive()) {
|
||||
TraceUtil.dumpTraceForThread(thread, reason);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Fri, 4 Apr 2025 08:17:32 +0800
|
||||
Subject: [PATCH] Correct isWatched method in ScheduledTaskThreadPool
|
||||
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java b/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java
|
||||
index 2f61f72087ea07e8d29bf6d5c264e217b20eb377..3694b01f0dc04f6de2df1d926a9208f5711a3a8b 100644
|
||||
--- a/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java
|
||||
+++ b/io/papermc/paper/threadedregions/ScheduledTaskThreadPool.java
|
||||
@@ -1229,7 +1229,7 @@ public final class ScheduledTaskThreadPool {
|
||||
}
|
||||
|
||||
public boolean isWatched() {
|
||||
- return (boolean)TAKEN_HANDLE.getVolatile(this);
|
||||
+ return (boolean)WATCHED_HANDLE.getVolatile(this); // Luminol - Try fixing scheduling call issue
|
||||
}
|
||||
|
||||
public long getLastTaskNotify() {
|
||||
@@ -1,11 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 11:00:49 +0800
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sat, 22 Mar 2025 17:36:44 +0800
|
||||
Subject: [PATCH] Force disable builtin spark plugin
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index ed00a29daccfee1d631bef27c0a3a4ae83140018..330af9f4de1c72387326816065350e71fe546efe 100644
|
||||
index 5d709b3b47702e7607dafa4a38380c801b228e2d..c2027b8d4a5f9fccacb93ba108e34c36285aec7b 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -783,8 +783,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -65,7 +65,7 @@ index ed00a29daccfee1d631bef27c0a3a4ae83140018..330af9f4de1c72387326816065350e71
|
||||
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) {
|
||||
@@ -1743,7 +1744,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1744,7 +1745,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
|
||||
@@ -5,6 +5,25 @@ Subject: [PATCH] Fix a series issue around entity memory typed GlobalPos and
|
||||
WalkTarget
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java b/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
|
||||
index a9be3acbf4ea52d2988347abfa6f4f8c02b1da26..751f3dde8e6bc2c0365e8672f5079af0379a69de 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
|
||||
@@ -25,6 +25,14 @@ public class BabyFollowAdult {
|
||||
return false;
|
||||
} else {
|
||||
LivingEntity ageableMob = instance.get(nearestVisibleAdult); // CraftBukkit - type
|
||||
+
|
||||
+ // Luminol start - Fix off world entity following which caused async issue
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(ageableMob)) {
|
||||
+ nearestVisibleAdult.erase();
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Luminol end
|
||||
+
|
||||
if (mob.closerThan(ageableMob, followRange.getMaxValue() + 1) && !mob.closerThan(ageableMob, followRange.getMinValue())) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(mob, ageableMob, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FOLLOW_LEADER);
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java b/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
|
||||
index 2664d72c3b6906d0505df2e63c0e5075eba9461b..f03c3c512ea48c2a89eebae62484922d28e4f831 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
|
||||
@@ -0,0 +1,20 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sat, 22 Mar 2025 20:48:24 +0800
|
||||
Subject: [PATCH] Use the correct list length while generating tick report
|
||||
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/TickData.java b/io/papermc/paper/threadedregions/TickData.java
|
||||
index 0383e4dcd611a7568597f46308060f3d7288a564..f53c37d047856f1569b6f637c54ebad03c42006e 100644
|
||||
--- a/io/papermc/paper/threadedregions/TickData.java
|
||||
+++ b/io/papermc/paper/threadedregions/TickData.java
|
||||
@@ -178,7 +178,8 @@ public final class TickData {
|
||||
} else {
|
||||
long totalTickTime = 0L;
|
||||
long totalCpuTime = 0L;
|
||||
- for (int k = 0, len2 = collapsedData.size(); k < len2; ++k) {
|
||||
+ //for (int k = 0, len2 = collapsedData.size(); k < len2; ++k) {
|
||||
+ for (int k = 0, len2 = toCollapse.size(); k < len2; ++k) { // Luminol - Use the correct list length
|
||||
final TickRegionScheduler.TickTime time = toCollapse.get(k);
|
||||
totalTickTime += time.tickLength();
|
||||
totalCpuTime += time.supportCPUTime() ? time.tickCpuTime() : 0L;
|
||||
@@ -0,0 +1,124 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sun, 23 Mar 2025 15:51:35 +0800
|
||||
Subject: [PATCH] Try rewriting update queue polling
|
||||
|
||||
|
||||
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ThreadedTicketLevelPropagator.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ThreadedTicketLevelPropagator.java
|
||||
index 310a8f80debadd64c2d962ebf83b7d0505ce6e42..59d77f04fd0f1c7b7af0314e533b72e1858a7e21 100644
|
||||
--- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ThreadedTicketLevelPropagator.java
|
||||
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ThreadedTicketLevelPropagator.java
|
||||
@@ -151,6 +151,15 @@ public abstract class ThreadedTicketLevelPropagator {
|
||||
private boolean performUpdate(final Section section, final UpdateQueue.UpdateQueueNode node, final Propagator propagator,
|
||||
final ReentrantAreaLock ticketLock, final ReentrantAreaLock schedulingLock,
|
||||
final List<ChunkProgressionTask> scheduledTasks, final List<NewChunkHolder> changedFullStatus) {
|
||||
+ // Luminol - Try rewriting update queue polling
|
||||
+ if (section == null) {
|
||||
+ if (node != null) {
|
||||
+ this.updateQueue.remove(node);
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Luminol end
|
||||
+
|
||||
final int sectionX = section.sectionX;
|
||||
final int sectionZ = section.sectionZ;
|
||||
|
||||
@@ -334,6 +343,7 @@ public abstract class ThreadedTicketLevelPropagator {
|
||||
|
||||
// finished
|
||||
if (node != null) {
|
||||
+ node.releaseUpdating(); // Luminol - Try rewriting update queue polling
|
||||
this.updateQueue.remove(node);
|
||||
}
|
||||
|
||||
@@ -468,7 +478,8 @@ public abstract class ThreadedTicketLevelPropagator {
|
||||
}
|
||||
}
|
||||
|
||||
- public UpdateQueueNode acquireNextOrWait(final long maxOrder) {
|
||||
+ // Luminol start - Try rewriting update queue polling
|
||||
+ /*public UpdateQueueNode acquireNextOrWait(final long maxOrder) {
|
||||
final List<UpdateQueueNode> blocking = new ArrayList<>();
|
||||
|
||||
node_search:
|
||||
@@ -502,8 +513,63 @@ public abstract class ThreadedTicketLevelPropagator {
|
||||
await(blocking.get(0));
|
||||
}
|
||||
|
||||
+ return null;
|
||||
+ }*/
|
||||
+
|
||||
+ public UpdateQueueNode acquireNextOrWait(final long maxOrder) {
|
||||
+ UpdateQueueNode firstConflict = null;
|
||||
+ UpdateQueueNode prevProcessed = null;
|
||||
+
|
||||
+ for (UpdateQueueNode curr = this.getHeadAcquire(); curr != null && curr.order <= maxOrder; curr = curr.getNextVolatile()) {
|
||||
+ if (curr.getSectionVolatile() == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (!curr.tryAcquireUpdating()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (curr.getSectionVolatile() == null) {
|
||||
+ curr.releaseUpdating();
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ boolean hasConflict = false;
|
||||
+ for (UpdateQueueNode checked = prevProcessed; checked != null; checked = checked.getNextVolatile()) {
|
||||
+ if (checked != curr && curr.intersects(checked)) {
|
||||
+ hasConflict = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (hasConflict) {
|
||||
+ if (firstConflict == null) {
|
||||
+ firstConflict = curr;
|
||||
+ }
|
||||
+ curr.releaseUpdating();
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (firstConflict != null) {
|
||||
+ this.append(firstConflict);
|
||||
+ }
|
||||
+
|
||||
+ if (prevProcessed == null) {
|
||||
+ prevProcessed = curr;
|
||||
+ } else {
|
||||
+ prevProcessed.setNextPlain(curr);
|
||||
+ }
|
||||
+
|
||||
+ return curr;
|
||||
+ }
|
||||
+
|
||||
+ if (firstConflict != null) {
|
||||
+ this.append(firstConflict);
|
||||
+ }
|
||||
+
|
||||
return null;
|
||||
}
|
||||
+ // Luminol end
|
||||
|
||||
public UpdateQueueNode peek() {
|
||||
for (UpdateQueueNode head = this.getHeadOpaque(), curr = head;;) {
|
||||
@@ -689,6 +755,15 @@ public abstract class ThreadedTicketLevelPropagator {
|
||||
private final boolean getAndSetUpdatingVolatile(final boolean value) {
|
||||
return (boolean)UPDATING_HANDLE.getAndSet(this, value);
|
||||
}
|
||||
+ // Luminol - Try rewriting update queue polling
|
||||
+ public final boolean tryAcquireUpdating() {
|
||||
+ return (boolean) UPDATING_HANDLE.compareAndSet(this, false, true);
|
||||
+ }
|
||||
+
|
||||
+ public final void releaseUpdating() {
|
||||
+ UPDATING_HANDLE.setVolatile(this, false);
|
||||
+ }
|
||||
+ // Luminol end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Kaiiju Entity tick and removal limiter
|
||||
|
||||
|
||||
diff --git a/io/papermc/paper/threadedregions/RegionizedWorldData.java b/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
index c6e487a4c14e6b82533881d01f32349b9ae28728..2c747cb8a724cd25c9d724908f92b320741600de 100644
|
||||
index b8f1f042342d3fed5fa26df0de07e8e2b0937130..4d9837f11da4dc59fdb945fdb4849c4d1519f5dc 100644
|
||||
--- a/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
+++ b/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
@@ -354,6 +354,7 @@ public final class RegionizedWorldData {
|
||||
@@ -358,6 +358,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
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Purpur Use alternative keep alive
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
index 79fe336adf35f4f007461ed050e6301764fe7fc3..a5b805b98cf138eabfb06f4ff202462be60c2995 100644
|
||||
index f7f89695f40e4aff39d324e6a7948a8a3a8c04b3..bceef2e8cd9a84ca32f17085839dff0232f2ee31 100644
|
||||
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -41,6 +41,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -16,7 +16,7 @@ index 79fe336adf35f4f007461ed050e6301764fe7fc3..a5b805b98cf138eabfb06f4ff202462b
|
||||
private int latency;
|
||||
private volatile boolean suspendFlushingOnServerThread = false;
|
||||
// CraftBukkit start
|
||||
@@ -130,6 +131,16 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -131,6 +132,16 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
|
||||
@Override
|
||||
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
|
||||
@@ -33,7 +33,7 @@ index 79fe336adf35f4f007461ed050e6301764fe7fc3..a5b805b98cf138eabfb06f4ff202462b
|
||||
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
|
||||
int i = (int)(Util.getMillis() - this.keepAliveTime);
|
||||
this.latency = (this.latency * 3 + i) / 4;
|
||||
@@ -254,7 +265,22 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -255,7 +266,22 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
// Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings
|
||||
// This should effectively place the keepalive handling back to "as it was" before 1.12.2
|
||||
final long elapsedTime = millis - this.keepAliveTime;
|
||||
@@ -57,7 +57,7 @@ index 79fe336adf35f4f007461ed050e6301764fe7fc3..a5b805b98cf138eabfb06f4ff202462b
|
||||
if (this.keepAlivePending) {
|
||||
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
|
||||
this.disconnect(TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
|
||||
@@ -267,6 +293,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -268,6 +294,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
this.send(new ClientboundKeepAlivePacket(this.keepAliveChallenge));
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Fri, 18 Apr 2025 22:04:20 +0800
|
||||
Subject: [PATCH] Leaf Smart sort entities in NearestLivingEntitySensor
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java b/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
|
||||
index b0c5e41fefc7c9adf1a61bd5b52861736657d37e..b91c4aa042f6ac10e402bcf16a03d24d6dafec86 100644
|
||||
--- a/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
|
||||
+++ b/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
|
||||
@@ -13,18 +13,107 @@ import net.minecraft.world.entity.ai.memory.NearestVisibleLivingEntities;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
|
||||
public class NearestLivingEntitySensor<T extends LivingEntity> extends Sensor<T> {
|
||||
+
|
||||
+ // Leaf start - Optimized entity sorting with buffer reuse
|
||||
+ private static final int SMALL_ARRAY_THRESHOLD = 2;
|
||||
+ private final ThreadLocal<LivingEntity[]> entityBuffer = ThreadLocal.withInitial(() -> new LivingEntity[0]);
|
||||
+ private final ThreadLocal<long[]> bitsBuffer = ThreadLocal.withInitial(() -> new long[0]);
|
||||
+
|
||||
@Override
|
||||
protected void doTick(ServerLevel level, T entity) {
|
||||
- double attributeValue = entity.getAttributeValue(Attributes.FOLLOW_RANGE);
|
||||
- AABB aabb = entity.getBoundingBox().inflate(attributeValue, attributeValue, attributeValue);
|
||||
- List<LivingEntity> entitiesOfClass = level.getEntitiesOfClass(
|
||||
- LivingEntity.class, aabb, matchableEntity -> matchableEntity != entity && matchableEntity.isAlive()
|
||||
+ double range = entity.getAttributeValue(Attributes.FOLLOW_RANGE);
|
||||
+ double rangeSqr = range * range;
|
||||
+ AABB aabb = entity.getBoundingBox().inflate(range, range, range);
|
||||
+
|
||||
+ List<LivingEntity> entities = level.getEntitiesOfClass(
|
||||
+ LivingEntity.class, aabb, e -> e != entity && e.isAlive() && entity.distanceToSqr(e) <= rangeSqr
|
||||
);
|
||||
- entitiesOfClass.sort(Comparator.comparingDouble(entity::distanceToSqr));
|
||||
+
|
||||
+ LivingEntity[] sorted = smartSort(entities, entity);
|
||||
+ List<LivingEntity> sortedList = java.util.Arrays.asList(sorted);
|
||||
+
|
||||
Brain<?> brain = entity.getBrain();
|
||||
- brain.setMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES, entitiesOfClass);
|
||||
- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, new NearestVisibleLivingEntities(level, entity, entitiesOfClass));
|
||||
+ brain.setMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES, sortedList);
|
||||
+ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES,
|
||||
+ new NearestVisibleLivingEntities(level, entity, sortedList));
|
||||
+ }
|
||||
+
|
||||
+ private LivingEntity[] smartSort(List<LivingEntity> entities, T reference) {
|
||||
+ int size = entities.size();
|
||||
+ if (size <= 1) return entities.toArray(new LivingEntity[0]);
|
||||
+
|
||||
+ LivingEntity[] entityBufferArray = this.entityBuffer.get();
|
||||
+ long[] bitsBufferArray = this.bitsBuffer.get();
|
||||
+ if (entityBufferArray.length < size) {
|
||||
+ entityBufferArray = new LivingEntity[size];
|
||||
+ entityBuffer.set(entityBufferArray);
|
||||
+
|
||||
+ bitsBufferArray = new long[size];
|
||||
+ bitsBuffer.set(bitsBufferArray);
|
||||
+ }
|
||||
+
|
||||
+ for (int i = 0; i < size; i++) {
|
||||
+ LivingEntity e = entities.get(i);
|
||||
+ entityBufferArray[i] = e;
|
||||
+ bitsBufferArray[i] = Double.doubleToRawLongBits(reference.distanceToSqr(e));
|
||||
+ }
|
||||
+
|
||||
+ fastRadixSort(entityBufferArray, bitsBufferArray, 0, size - 1, 62);
|
||||
+
|
||||
+ return java.util.Arrays.copyOf(entityBufferArray, size);
|
||||
+ }
|
||||
+
|
||||
+ private void fastRadixSort(LivingEntity[] ents, long[] bits, int low, int high, int bit) {
|
||||
+ if (bit < 0 || low >= high) return;
|
||||
+
|
||||
+ if (high - low <= SMALL_ARRAY_THRESHOLD) {
|
||||
+ insertionSort(ents, bits, low, high);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ int i = low, j = high;
|
||||
+ final long mask = 1L << bit;
|
||||
+
|
||||
+ while (i <= j) {
|
||||
+ while (i <= j && (bits[i] & mask) == 0) i++;
|
||||
+ while (i <= j && (bits[j] & mask) != 0) j--;
|
||||
+
|
||||
+ if (i < j) {
|
||||
+ swap(ents, bits, i++, j--);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (low < j) fastRadixSort(ents, bits, low, j, bit - 1);
|
||||
+ if (i < high) fastRadixSort(ents, bits, i, high, bit - 1);
|
||||
+ }
|
||||
+
|
||||
+ private void insertionSort(LivingEntity[] ents, long[] bits, int low, int high) {
|
||||
+ for (int i = low + 1; i <= high; i++) {
|
||||
+ int j = i;
|
||||
+ LivingEntity e = ents[j];
|
||||
+ long b = bits[j];
|
||||
+
|
||||
+ while (j > low && bits[j - 1] > b) {
|
||||
+ ents[j] = ents[j - 1];
|
||||
+ bits[j] = bits[j - 1];
|
||||
+ j--;
|
||||
+ }
|
||||
+
|
||||
+ ents[j] = e;
|
||||
+ bits[j] = b;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void swap(LivingEntity[] ents, long[] bits, int a, int b) {
|
||||
+ LivingEntity te = ents[a];
|
||||
+ ents[a] = ents[b];
|
||||
+ ents[b] = te;
|
||||
+
|
||||
+ long tb = bits[a];
|
||||
+ bits[a] = bits[b];
|
||||
+ bits[b] = tb;
|
||||
}
|
||||
+ // Leaf end - Optimized entity sorting with buffer reuse
|
||||
|
||||
@Override
|
||||
public Set<MemoryModuleType<?>> requires() {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add missing teleportation apis for folia
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 3bc0fc1d411d3c5e206695510ec9288ffbf8c277..c2562b8f7ca3bc815a5abe5ae00a6fe1654b002d 100644
|
||||
index b17ace9118c94a756fa2901621c6b2b9bd9e5764..8a728a3af515da522cd5fab1e731bbc0607f0596 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1661,6 +1661,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -1660,6 +1660,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
if (respawnComplete != null) {
|
||||
respawnComplete.accept(ServerPlayer.this);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
||||
Date: Sun, 13 Apr 2025 11:07:04 +0800
|
||||
Subject: [PATCH] Disable Heightmap Warning
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/levelgen/Heightmap.java b/net/minecraft/world/level/levelgen/Heightmap.java
|
||||
index 3b27bcfbbe0529d1526adc30760c846b4011645f..95747ae41cea0d4b577c58ef44959a18e0a46672 100644
|
||||
--- a/net/minecraft/world/level/levelgen/Heightmap.java
|
||||
+++ b/net/minecraft/world/level/levelgen/Heightmap.java
|
||||
@@ -123,7 +123,8 @@ public class Heightmap {
|
||||
if (raw.length == data.length) {
|
||||
System.arraycopy(data, 0, raw, 0, data.length);
|
||||
} else {
|
||||
- LOGGER.warn("Ignoring heightmap data for chunk " + chunk.getPos() + ", size does not match; expected: " + raw.length + ", got: " + data.length);
|
||||
+ if (!me.earthme.luminol.config.modules.misc.DisableHeightmapWarnConfig.enabled)
|
||||
+ LOGGER.warn("Ignoring heightmap data for chunk " + chunk.getPos() + ", size does not match; expected: " + raw.length + ", got: " + data.length);
|
||||
primeHeightmaps(chunk, EnumSet.of(type));
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Sun, 6 Apr 2025 10:42:45 +0800
|
||||
Subject: [PATCH] Leaves Fix SculkCatalyst exp skip
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index 2293c3db45e9ecce4e0d4b2f87b8e90228e44d94..658aa09aecf8d64145feedb82dc9be2a55201450 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -293,6 +293,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
protected float appliedScale = 1.0F;
|
||||
// CraftBukkit start
|
||||
public int expToDrop;
|
||||
+ public int expToReward; // Leaves - exp fix
|
||||
public ArrayList<DefaultDrop> drops = new ArrayList<>(); // Paper - Restore vanilla drops behavior
|
||||
public final org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
|
||||
public boolean collides = true;
|
||||
@@ -1761,6 +1762,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
entity.killedEntity((ServerLevel) this.level(), this);
|
||||
}
|
||||
this.gameEvent(GameEvent.ENTITY_DIE);
|
||||
+ if (!this.wasExperienceConsumed()) this.dropExperience((ServerLevel) this.level(), damageSource.getEntity()); // Leaves - exp fix
|
||||
} else {
|
||||
this.dead = false;
|
||||
this.setHealth((float) deathEvent.getReviveHealth());
|
||||
@@ -1835,7 +1837,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.drops = new ArrayList<>();
|
||||
// this.dropEquipment(level); // CraftBukkit - moved up
|
||||
// CraftBukkit end
|
||||
- this.dropExperience(level, damageSource.getEntity());
|
||||
+ // this.dropExperience(level, damageSource.getEntity()); // Leaves - exp fix
|
||||
return deathEvent; // Paper
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
index bd6693af6412fb08a28ca9a71d5c70d54f72c6e6..8c2e35d087150fb0fc67c7457a4af9298f4b41e1 100644
|
||||
--- a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
@@ -96,8 +96,7 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi
|
||||
public boolean handleGameEvent(ServerLevel level, Holder<GameEvent> gameEvent, GameEvent.Context context, Vec3 pos) {
|
||||
if (gameEvent.is(GameEvent.ENTITY_DIE) && context.sourceEntity() instanceof LivingEntity livingEntity) {
|
||||
if (!livingEntity.wasExperienceConsumed()) {
|
||||
- DamageSource lastDamageSource = livingEntity.getLastDamageSource();
|
||||
- int experienceReward = livingEntity.getExperienceReward(level, Optionull.map(lastDamageSource, DamageSource::getEntity));
|
||||
+ int experienceReward = livingEntity.expToReward; // Leaves - exp fix
|
||||
if (livingEntity.shouldDropExperience() && experienceReward > 0) {
|
||||
this.sculkSpreader.addCursors(BlockPos.containing(pos.relative(Direction.UP, 0.5)), experienceReward);
|
||||
this.tryAwardItSpreadsAdvancement(level, livingEntity);
|
||||
@@ -21,83 +21,10 @@ index 80f17f33f670018240c854df589cf90cdeab6e70..8672757a4d5fb5c247599782fece6b8d
|
||||
if (raidAt == null || raidAt.getRaidOmenLevel() < raidAt.getMaxRaidOmenLevel()) {
|
||||
serverPlayer.addEffect(new MobEffectInstance(MobEffects.RAID_OMEN, 600, amplifier));
|
||||
diff --git a/net/minecraft/world/entity/raid/Raid.java b/net/minecraft/world/entity/raid/Raid.java
|
||||
index 2f45befbb50645f1bfb5961ad725f3670ff0d592..4e2ec7f7946a70b676393f090c5ce6219314c3da 100644
|
||||
index 2f45befbb50645f1bfb5961ad725f3670ff0d592..84c6eb2c27510938f590f6c6baa5a94c4c08c4ad 100644
|
||||
--- a/net/minecraft/world/entity/raid/Raid.java
|
||||
+++ b/net/minecraft/world/entity/raid/Raid.java
|
||||
@@ -109,6 +109,12 @@ public class Raid {
|
||||
private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry PDC_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry();
|
||||
public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(PDC_TYPE_REGISTRY);
|
||||
// Paper end
|
||||
+ // Luminol Start - Raid revert
|
||||
+ private boolean flagForceWin = false;
|
||||
+ private boolean flag274911 = false;
|
||||
+ private int freshTick = 0;
|
||||
+ private int retryTimes = 0;
|
||||
+ // Luminol End - Raid revert
|
||||
|
||||
// Folia start - make raids thread-safe
|
||||
public boolean ownsRaid() {
|
||||
@@ -270,7 +276,36 @@ public class Raid {
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
- if (!this.isStopped()) {
|
||||
+ // Luminol Start - Raid revert
|
||||
+ if (this.flag274911) {
|
||||
+ if (this.freshTick == 20) {
|
||||
+ if (this.waveSpawnPos.isPresent() && !this.level.isPositionEntityTicking(this.waveSpawnPos.get())) {
|
||||
+ this.waveSpawnPos = this.getValidSpawnPos();
|
||||
+ }
|
||||
+
|
||||
+ BlockPos blockPos = this.waveSpawnPos.orElseGet(() -> this.findRandomSpawnPos(20));
|
||||
+ if (blockPos != null && retryTimes < 3) {
|
||||
+ this.started = true;
|
||||
+ this.spawnGroup(blockPos);
|
||||
+ this.retryTimes = 0;
|
||||
+ } else if (retryTimes == 3) {
|
||||
+ this.waveSpawnPos = Optional.empty();
|
||||
+ this.groupsSpawned++;
|
||||
+ this.retryTimes = 0;
|
||||
+ } else {
|
||||
+ this.retryTimes++;
|
||||
+ }
|
||||
+ if (!this.hasMoreWaves()) {
|
||||
+ this.flag274911 = false;
|
||||
+ this.flagForceWin = true;
|
||||
+ }
|
||||
+ this.freshTick = 0;
|
||||
+ } else {
|
||||
+ this.freshTick++;
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ if (!this.isStopped() || this.flagForceWin) { // Luminol End - Raid revert
|
||||
if (this.status == Raid.RaidStatus.ONGOING) {
|
||||
boolean flag = this.active;
|
||||
this.active = this.level.hasChunkAt(this.center);
|
||||
@@ -288,6 +323,12 @@ public class Raid {
|
||||
return;
|
||||
}
|
||||
|
||||
+ // Luminol Start - Raid revert
|
||||
+ if (me.earthme.luminol.config.modules.misc.RaidChangesConfig.revert_274911 && this.waveSpawnPos.isPresent() && this.center.distSqr(this.waveSpawnPos.get()) >= 12544) {
|
||||
+ this.flag274911 = true;
|
||||
+ }
|
||||
+ // Luminol End - Raid revert
|
||||
+
|
||||
if (!this.level.isVillage(this.center)) {
|
||||
this.moveRaidCenterToNearbyVillageSection();
|
||||
}
|
||||
@@ -379,7 +420,7 @@ public class Raid {
|
||||
}
|
||||
}
|
||||
|
||||
- if (this.isStarted() && !this.hasMoreWaves() && totalRaidersAlive == 0) {
|
||||
+ if (this.flagForceWin || (this.isStarted() && !this.hasMoreWaves() && totalRaidersAlive == 0)) { // Luminol - Raid revert
|
||||
if (this.postRaidTicks < 40) {
|
||||
this.postRaidTicks++;
|
||||
} else {
|
||||
@@ -674,7 +715,7 @@ public class Raid {
|
||||
@@ -674,7 +674,7 @@ public class Raid {
|
||||
int i2 = this.center.getX() + Mth.floor(Mth.cos(f2) * 32.0F * f) + this.level.random.nextInt(3) * Mth.floor(f);
|
||||
int i3 = this.center.getZ() + Mth.floor(Mth.sin(f2) * 32.0F * f) + this.level.random.nextInt(3) * Mth.floor(f);
|
||||
int height = this.level.getHeight(Heightmap.Types.WORLD_SURFACE, i2, i3);
|
||||
@@ -107,7 +34,7 @@ index 2f45befbb50645f1bfb5961ad725f3670ff0d592..4e2ec7f7946a70b676393f090c5ce621
|
||||
if (!this.level.isVillage(mutableBlockPos) || i <= 7) {
|
||||
int i4 = 10;
|
||||
diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java
|
||||
index 7c385baae81b9a987c0e1e4deb017884600331bc..262291eaeb9bc250affeda67957588d14ec1eebc 100644
|
||||
index 7c385baae81b9a987c0e1e4deb017884600331bc..a0d86c3cc86da734a3cd10d554aaecb5c0b82e59 100644
|
||||
--- a/net/minecraft/world/entity/raid/Raider.java
|
||||
+++ b/net/minecraft/world/entity/raid/Raider.java
|
||||
@@ -125,6 +125,43 @@ public abstract class Raider extends PatrollingMonster {
|
||||
@@ -154,15 +81,6 @@ index 7c385baae81b9a987c0e1e4deb017884600331bc..262291eaeb9bc250affeda67957588d1
|
||||
}
|
||||
|
||||
super.die(cause);
|
||||
@@ -153,7 +190,7 @@ public abstract class Raider extends PatrollingMonster {
|
||||
}
|
||||
|
||||
public boolean hasRaid() {
|
||||
- return this.level() instanceof ServerLevel serverLevel && (this.getCurrentRaid() != null || serverLevel.getRaidAt(this.blockPosition()) != null);
|
||||
+ return !me.earthme.luminol.config.modules.misc.RaidChangesConfig.self_check && (this.level() instanceof ServerLevel serverLevel && (this.getCurrentRaid() != null || serverLevel.getRaidAt(this.blockPosition()) != null)); // Leaves - Disable raid self check
|
||||
}
|
||||
|
||||
public boolean hasActiveRaid() {
|
||||
diff --git a/net/minecraft/world/item/component/OminousBottleAmplifier.java b/net/minecraft/world/item/component/OminousBottleAmplifier.java
|
||||
index 318f24d67be4daf6993ba547da0540be9c221a75..9a6820fce3977419fd81d802720c318ac15d07c4 100644
|
||||
--- a/net/minecraft/world/item/component/OminousBottleAmplifier.java
|
||||
@@ -1,90 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bacteriawa <A3167717663@hotmail.com>
|
||||
Date: Thu, 7 Nov 2024 21:50:47 +0100
|
||||
Subject: [PATCH] Lithium: fast util
|
||||
|
||||
This patch is based on the following mixins:
|
||||
* "net/caffeinemc/mods/lithium/mixin/math/fast_util/DirectionMixin.java"
|
||||
* "net/caffeinemc/mods/lithium/mixin/math/fast_util/AABBMixin.java"
|
||||
By: 2No2Name <2No2Name@web.de>
|
||||
As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
||||
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||
|
||||
diff --git a/net/minecraft/core/Direction.java b/net/minecraft/core/Direction.java
|
||||
index 216f97207dac88cc1dc3df59c6ee8a62c7614b4a..3a76b1ec8570e4c9f328e9d362b41057b092be45 100644
|
||||
--- a/net/minecraft/core/Direction.java
|
||||
+++ b/net/minecraft/core/Direction.java
|
||||
@@ -217,7 +217,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa
|
||||
}
|
||||
|
||||
public Direction getOpposite() {
|
||||
- return this.opposite; // Paper - optimise collisions
|
||||
+ return VALUES[this.oppositeIndex]; // Leaf - Lithium - fast util
|
||||
}
|
||||
|
||||
public Direction getClockWise(Direction.Axis axis) {
|
||||
@@ -350,7 +350,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa
|
||||
}
|
||||
|
||||
public static Direction getRandom(RandomSource random) {
|
||||
- return Util.getRandom(VALUES, random);
|
||||
+ return VALUES[random.nextInt(VALUES.length)]; // Leaf - Lithium - fast util
|
||||
}
|
||||
|
||||
public static Direction getApproximateNearest(double x, double y, double z) {
|
||||
diff --git a/net/minecraft/world/phys/AABB.java b/net/minecraft/world/phys/AABB.java
|
||||
index 85148858db1fd5e9da8bbdde4b0d84110d80e373..82fb85089336f874349fa87e7cb9c14ab087ad8b 100644
|
||||
--- a/net/minecraft/world/phys/AABB.java
|
||||
+++ b/net/minecraft/world/phys/AABB.java
|
||||
@@ -18,6 +18,15 @@ public class AABB {
|
||||
public final double maxY;
|
||||
public final double maxZ;
|
||||
|
||||
+ // Leaf start - Lithium - fast util
|
||||
+ static {
|
||||
+ assert Direction.Axis.X.ordinal() == 0;
|
||||
+ assert Direction.Axis.Y.ordinal() == 1;
|
||||
+ assert Direction.Axis.Z.ordinal() == 2;
|
||||
+ assert Direction.Axis.values().length == 3;
|
||||
+ }
|
||||
+ // Leaf end - Lithium - fast util
|
||||
+
|
||||
public AABB(double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||
this.minX = Math.min(x1, x2);
|
||||
this.minY = Math.min(y1, y2);
|
||||
@@ -79,11 +88,33 @@ public class AABB {
|
||||
}
|
||||
|
||||
public double min(Direction.Axis axis) {
|
||||
- return axis.choose(this.minX, this.minY, this.minZ);
|
||||
+ // Leaf start - Lithium - fast util
|
||||
+ switch (axis.ordinal()) {
|
||||
+ case 0: //X
|
||||
+ return this.minX;
|
||||
+ case 1: //Y
|
||||
+ return this.minY;
|
||||
+ case 2: //Z
|
||||
+ return this.minZ;
|
||||
+ }
|
||||
+
|
||||
+ throw new IllegalArgumentException();
|
||||
+ // Leaf end - Lithium - fast util
|
||||
}
|
||||
|
||||
public double max(Direction.Axis axis) {
|
||||
- return axis.choose(this.maxX, this.maxY, this.maxZ);
|
||||
+ // Leaf start - Lithium - fast util
|
||||
+ switch (axis.ordinal()) {
|
||||
+ case 0: //X
|
||||
+ return this.maxX;
|
||||
+ case 1: //Y
|
||||
+ return this.maxY;
|
||||
+ case 2: //Z
|
||||
+ return this.maxZ;
|
||||
+ }
|
||||
+
|
||||
+ throw new IllegalArgumentException();
|
||||
+ // Leaf end - Lithium - fast util
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,33 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: kidofcubes <kidofcubes@gmail.com>
|
||||
Date: Fri, 8 Nov 2024 00:22:44 +0800
|
||||
Subject: [PATCH] Lithium: Skip unnecessary calculations if player is not
|
||||
flying or swing
|
||||
|
||||
This patch is based on the following mixins:
|
||||
* "net/caffeinemc/mods/lithium/mixin/entity/fast_elytra_check/LivingEntityMixin.java"
|
||||
* "net/caffeinemc/mods/lithium/mixin/entity/fast_hand_swing/LivingEntityMixin.java"
|
||||
By: 2No2Name <2No2Name@web.de>
|
||||
As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
||||
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index 658aa09aecf8d64145feedb82dc9be2a55201450..1df158d30622ea71fcc937140c682d0e994d54c1 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2644,6 +2644,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
protected void updateSwingTime() {
|
||||
+ if (!this.swinging && this.swingTime == 0) return; // Leaf - Lithium - entity.fast_hand_swing
|
||||
int currentSwingDuration = this.getCurrentSwingDuration();
|
||||
if (this.swinging) {
|
||||
this.swingTime++;
|
||||
@@ -3569,6 +3570,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
protected void updateFallFlying() {
|
||||
this.checkSlowFallDistance();
|
||||
if (!this.level().isClientSide) {
|
||||
+ if (!this.isFallFlying() && this.fallFlyTicks == 0) return; // Leaf - Lithium - entity.fast_elytra_check
|
||||
if (!this.canGlide()) {
|
||||
if (this.getSharedFlag(7) != false && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit
|
||||
this.setSharedFlag(7, false);
|
||||
@@ -1,45 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sat, 19 Apr 2025 20:38:20 +0800
|
||||
Subject: [PATCH] Fully removed player teleport event and entity teleport event
|
||||
call
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index a107d9ee24d0e39ce3e3e09bf27af1ea4ae35b96..e786177f9e36c1dfb0cdcfc641ab2e36d42f2451 100644
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1764,7 +1764,7 @@ public class ServerGamePacketListenerImpl
|
||||
final io.papermc.paper.entity.TeleportFlag.Relative flag = org.bukkit.craftbukkit.entity.CraftPlayer.deltaRelativeToAPI(relativeArgument);
|
||||
if (flag != null) relativeFlags.add(flag);
|
||||
}
|
||||
- PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause, java.util.Set.copyOf(relativeFlags));
|
||||
+ /*PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause, java.util.Set.copyOf(relativeFlags)); // Luminol - Fully remove EntityTeleportEvent and PlayerTeleportEvent
|
||||
// Paper end - Teleport API
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
|
||||
@@ -1773,9 +1773,10 @@ public class ServerGamePacketListenerImpl
|
||||
to = event.isCancelled() ? event.getFrom() : event.getTo();
|
||||
posMoveRotation = new PositionMoveRotation(CraftLocation.toVec3D(to), Vec3.ZERO, to.getYaw(), to.getPitch());
|
||||
}
|
||||
+ */ // Luminol - Fully remove EntityTeleportEvent and PlayerTeleportEvent
|
||||
|
||||
this.internalTeleport(posMoveRotation, relatives);
|
||||
- return !event.isCancelled(); // CraftBukkit - Return event status
|
||||
+ return true; //!event.isCancelled(); // CraftBukkit - Return event status // Luminol - Fully remove EntityTeleportEvent and PlayerTeleportEvent
|
||||
}
|
||||
|
||||
public void teleport(Location dest) {
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index 6258b008ad3e00d41e9f3014572d6f7a06b1847c..1981f8e9e158ba7874dd3c9bde127654d56170ce 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -4226,7 +4226,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.setPos(x1, y1, z1);
|
||||
|
||||
if (flag) {
|
||||
- if (!(this instanceof ServerPlayer)) {
|
||||
+ if (!(this instanceof ServerPlayer) && false) { // Luminol - Fully remove EntityTeleportEvent and PlayerTeleportEvent
|
||||
EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.level().getWorld(), x1, y1, z1), new Location(this.level().getWorld(), x, d, z));
|
||||
this.level().getCraftServer().getPluginManager().callEvent(teleport);
|
||||
if (!teleport.isCancelled() && teleport.getTo() != null) { // Paper
|
||||
@@ -1,10 +0,0 @@
|
||||
--- a/net/minecraft/server/Main.java
|
||||
+++ b/net/minecraft/server/Main.java
|
||||
@@ -108,6 +_,7 @@
|
||||
JvmProfiler.INSTANCE.start(Environment.SERVER);
|
||||
}
|
||||
|
||||
+ me.earthme.luminol.config.LuminolConfig.preLoadConfig(); // Luminol - Luminol config
|
||||
io.papermc.paper.plugin.PluginInitializerManager.load(optionSet); // Paper
|
||||
Bootstrap.bootStrap();
|
||||
Bootstrap.validate();
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -212,6 +_,8 @@
|
||||
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
|
||||
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
|
||||
// Paper end - initialize global and world-defaults configuration
|
||||
+ me.earthme.luminol.config.LuminolConfig.finalizeLoadConfig(); //Luminol - load config file
|
||||
+ me.earthme.luminol.config.LuminolConfig.setupLatch(); //Luminol - load config file
|
||||
this.server.spark.enableEarlyIfRequested(); // Paper - spark
|
||||
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
|
||||
if (this.convertOldUsers()) {
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <wangxyper@163.com>
|
||||
Date: Tue, 11 Feb 2025 11:57:22 +0800
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sat, 22 Mar 2025 09:24:55 +0800
|
||||
Subject: [PATCH] Add tpsbar with chunkhot membar and region bar
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ index de8b9048c8395c05b8688bc9d984b8ad680f15b3..f42692cd4f0154705c3d5b030d281cfc
|
||||
+ // 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 ac878520dc4aaa0e6a1ce8de0982d60a8397bc15..af20bc3b9cfb056beca0a341e209a4cc5e869da3 100644
|
||||
index 512ef437119041b33b62ef4675bdd1b27fd9a403..628211a282ef0553a0229b6cadacd2727d967873 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2401,6 +2401,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2442,6 +2442,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
handle.expToDrop = data.getInt("expToDrop");
|
||||
handle.keepLevel = data.getBoolean("keepLevel");
|
||||
}
|
||||
@@ -41,7 +41,7 @@ index ac878520dc4aaa0e6a1ce8de0982d60a8397bc15..af20bc3b9cfb056beca0a341e209a4cc
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2422,6 +2431,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2463,6 +2472,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
data.putLong("lastPlayed", System.currentTimeMillis());
|
||||
data.putString("lastKnownName", handle.getScoreboardName());
|
||||
|
||||
@@ -57,7 +57,7 @@ index ac878520dc4aaa0e6a1ce8de0982d60a8397bc15..af20bc3b9cfb056beca0a341e209a4cc
|
||||
// Paper start - persist for use in offline save data
|
||||
if (!nbttagcompound.contains("Paper")) {
|
||||
nbttagcompound.put("Paper", new CompoundTag());
|
||||
@@ -3631,4 +3649,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -3672,4 +3690,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void setSimplifyContainerDesyncCheck(final boolean simplifyContainerDesyncCheck) {
|
||||
this.simplifyContainerDesyncCheck = simplifyContainerDesyncCheck;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sun, 6 Apr 2025 12:51:21 +0800
|
||||
Subject: [PATCH] Add feature: per virtual thread per tickregion
|
||||
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
||||
index 4efa1c057ae6cfdea7889c372bd62dc14637daa0..061492a0e172e03a0f78e4bbbec1c7010d51e207 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
||||
@@ -18,6 +18,9 @@ import org.slf4j.LoggerFactory;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class TickThread extends Thread {
|
||||
+ // Luminol start - Bypass virtual threads
|
||||
+ public static final java.util.Set<Thread> VIRTUAL_TICK_THREAD_GROUP = java.util.Collections.newSetFromMap(it.unimi.dsi.fastutil.objects.Reference2ObjectMaps.synchronize(new it.unimi.dsi.fastutil.objects.Reference2ObjectLinkedOpenHashMap<>()));
|
||||
+ // Luminol end
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TickThread.class);
|
||||
|
||||
@@ -138,12 +141,13 @@ public class TickThread extends Thread {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
+ @Deprecated // Luminol
|
||||
public static TickThread getCurrentTickThread() {
|
||||
return (TickThread)Thread.currentThread();
|
||||
}
|
||||
|
||||
public static boolean isTickThread() {
|
||||
- return Thread.currentThread() instanceof TickThread;
|
||||
+ return Thread.currentThread() instanceof TickThread || VIRTUAL_TICK_THREAD_GROUP.contains(Thread.currentThread()); // Luminol - Bypass some virtual threads
|
||||
}
|
||||
|
||||
public static boolean isShutdownThread() {
|
||||
@@ -18,7 +18,7 @@ index a0b84535a9d3833d4df692b85b272f145559dd80..c2ba46408b5ad727d7a17f21d47b2898
|
||||
return;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index ae7ee8c67a71b0bc319d8079094b1806fc3e305a..07e59bbfa94103d610ec63e695e51a961cd6eec5 100644
|
||||
index 1a1d44c2aa89d8c7f9ec431b5b04d4c6e93a9d55..98d7542ead38ce48886c8f8dfe9a89f963d0c3fd 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -314,7 +314,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] SparklyPaper Optimize canSee checks
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index af20bc3b9cfb056beca0a341e209a4cc5e869da3..91dd18a874ea83bed83983ecfa52decce2b163a5 100644
|
||||
index 628211a282ef0553a0229b6cadacd2727d967873..583c2acc6d620b4411c65c2b285d323d7c9c1b98 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -210,7 +210,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -17,7 +17,7 @@ index af20bc3b9cfb056beca0a341e209a4cc5e869da3..91dd18a874ea83bed83983ecfa52decc
|
||||
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;
|
||||
@@ -2265,9 +2265,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2306,9 +2306,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public boolean canSee(org.bukkit.entity.Entity entity) {
|
||||
@@ -23,7 +23,7 @@ index f42692cd4f0154705c3d5b030d281cfc333803ed..39cc976f65f826a00e2e637c139f9134
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 07e59bbfa94103d610ec63e695e51a961cd6eec5..9c7a5d0a94417a65788330b7239aa746006407fa 100644
|
||||
index 98d7542ead38ce48886c8f8dfe9a89f963d0c3fd..4cf38c929e6ccce7f25ed842d65e41913d49ccf6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1423,7 +1423,11 @@ public final class CraftServer implements Server {
|
||||
@@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Sun, 6 Apr 2025 10:42:46 +0800
|
||||
Subject: [PATCH] Leaves Fix SculkCatalyst exp skip
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index bef7a026676ab59a84fc33c8af50ad2b9447fd8c..0a678458bcee4ced98d2880821dbff302f59b7f6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -991,7 +991,7 @@ public class CraftEventFactory {
|
||||
CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
|
||||
CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource);
|
||||
CraftWorld world = (CraftWorld) entity.getWorld();
|
||||
- EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward(world.getHandle(), damageSource.getEntity())); // Paper - Restore vanilla drops behavior
|
||||
+ EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward(world.getHandle(), damageSource.getEntity()), victim.getExperienceReward(world.getHandle(), damageSource.getEntity())); // Paper - Restore vanilla drops behavior // Leaves - exp fix
|
||||
populateFields(victim, event); // Paper - make cancellable
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@@ -1002,6 +1002,7 @@ public class CraftEventFactory {
|
||||
playDeathSound(victim, event);
|
||||
// Paper end
|
||||
victim.expToDrop = event.getDroppedExp();
|
||||
+ victim.expToReward = event.getRewardExp(); // Leaves - exp fix
|
||||
lootCheck.run(); // Paper - advancement triggers before destroying items
|
||||
|
||||
// Paper start - Restore vanilla drops behavior
|
||||
@@ -1037,6 +1038,7 @@ public class CraftEventFactory {
|
||||
victim.newLevel = event.getNewLevel();
|
||||
victim.newTotalExp = event.getNewTotalExp();
|
||||
victim.expToDrop = event.getDroppedExp();
|
||||
+ victim.expToReward = event.getRewardExp(); // Leaves - exp fix
|
||||
victim.newExp = event.getNewExp();
|
||||
|
||||
// Paper start - Restore vanilla drops behavior
|
||||
@@ -1,25 +0,0 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/DisableHeightmapWarnConfig.java
|
||||
@@ -1,0 +_,22 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class DisableHeightmapWarnConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled", comments =
|
||||
+ """
|
||||
+ Disable heightmap-check's warning""")
|
||||
+ public static boolean enabled = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.MISC;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "heightmap_warn_disable";
|
||||
+ }
|
||||
+}
|
||||
@@ -1,6 +1,6 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/RaidChangesConfig.java
|
||||
@@ -1,0 +_,52 @@
|
||||
@@ -1,0 +_,41 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
@@ -10,39 +10,28 @@
|
||||
+public class RaidChangesConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "allow-bad-omen-trigger-raid", comments =
|
||||
+ """
|
||||
+ Allow players with ominous signs to skip a\s
|
||||
+ 30-second cooldown and trigger attacks directly""")
|
||||
+ Allow players with ominous signs to\s
|
||||
+ skip a 30-second cooldown and trigger\s
|
||||
+ attacks directly""")
|
||||
+ public static boolean trigger = false;
|
||||
+
|
||||
+ @ConfigInfo(baseName = "give-bad-omen-when-kill-patrol-leader", comments =
|
||||
+ """
|
||||
+ Enable players to obtain an ominous omen\s
|
||||
+ effect when killing the patrol team captain""")
|
||||
+ Enable players to obtain an ominous\s
|
||||
+ omen effect when killing the patrol\s
|
||||
+ team captain""")
|
||||
+ public static boolean effect = false;
|
||||
+
|
||||
+ @ConfigInfo(baseName = "bad-omen-infinite", comments =
|
||||
+ """
|
||||
+ Enable bad omen effect infinite time
|
||||
+ --- this config is not old version's function""")
|
||||
+ Enable bad omen effect infinite time.""")
|
||||
+ public static boolean infinite = false;
|
||||
+
|
||||
+ @ConfigInfo(baseName = "skip-height-check", comments =
|
||||
+ """
|
||||
+ Disable y <= 96 check""")
|
||||
+ disable y <= 96 check.""")
|
||||
+ public static boolean height_check = false;
|
||||
+
|
||||
+ @ConfigInfo(baseName = "skip-self-raid-check", comments =
|
||||
+ """
|
||||
+ Disable raid self check\s
|
||||
+ --- this config is not old version's function""")
|
||||
+ public static boolean self_check = false;
|
||||
+
|
||||
+ @ConfigInfo(baseName = "revert-274911", comments =
|
||||
+ """
|
||||
+ Revert MC-274911(hard-revert)
|
||||
+ --- maybe have some bugs""")
|
||||
+ public static boolean revert_274911 = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.MISC;
|
||||
|
||||
Reference in New Issue
Block a user