Compare commits
5 Commits
1.21.4-40a
...
1.21.5-cd8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd8a4e11dc | ||
|
|
c69087ba64 | ||
|
|
784ce10986 | ||
|
|
25b9e3f213 | ||
|
|
4855a4f76f |
@@ -2,7 +2,7 @@ group = me.earthme.luminol
|
|||||||
version=1.21.5-R0.1-SNAPSHOT
|
version=1.21.5-R0.1-SNAPSHOT
|
||||||
mcVersion=1.21.5
|
mcVersion=1.21.5
|
||||||
|
|
||||||
foliaRef=77316d48f7d96ed7812cf36036fb85d790d20e6e
|
foliaRef=dfa3ca475215e9c496e5aa6629f1897f93f7a7d4
|
||||||
|
|
||||||
org.gradle.configuration-cache=true
|
org.gradle.configuration-cache=true
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val log4jPlugins = sourceSets.create("log4jPlugins") {
|
val log4jPlugins = sourceSets.create("log4jPlugins") {
|
||||||
@@ -153,7 +_,14 @@
|
@@ -153,12 +_,20 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -64,6 +64,12 @@
|
|||||||
implementation("ca.spottedleaf:concurrentutil:0.0.3")
|
implementation("ca.spottedleaf:concurrentutil:0.0.3")
|
||||||
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
|
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
|
||||||
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
|
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
|
||||||
|
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||||
|
implementation("net.kyori:adventure-text-serializer-ansi:4.21.0") // Keep in sync with adventureVersion from Paper-API build file
|
||||||
|
+ implementation("net.openhft:affinity:3.23.3") // Luminol
|
||||||
|
runtimeConfiguration(sourceSets.main.map { it.runtimeClasspath })
|
||||||
|
|
||||||
|
/*
|
||||||
@@ -217,26 +_,33 @@
|
@@ -217,26 +_,33 @@
|
||||||
implementation("me.lucko:spark-paper:1.10.133-20250413.112336-1")
|
implementation("me.lucko:spark-paper:1.10.133-20250413.112336-1")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: MrHua269 <mrhua269@gmail.com>
|
||||||
|
Date: Sun, 15 Jun 2025 16:58:05 +0800
|
||||||
|
Subject: [PATCH] Do not fire pre creature spawn event unless some plugin is
|
||||||
|
listening it
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java
|
||||||
|
index f324a74a191d3fe3e270556d07c4543ec34e0195..2fb36cba4cda3f7b84efae9cba6bed2394fb0457 100644
|
||||||
|
--- a/net/minecraft/world/level/NaturalSpawner.java
|
||||||
|
+++ b/net/minecraft/world/level/NaturalSpawner.java
|
||||||
|
@@ -360,16 +360,18 @@ public final class NaturalSpawner {
|
||||||
|
) {
|
||||||
|
EntityType<?> entityType = data.type();
|
||||||
|
// Paper start - PreCreatureSpawnEvent
|
||||||
|
- com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
|
||||||
|
- org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, level),
|
||||||
|
- org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(entityType), org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL
|
||||||
|
- );
|
||||||
|
- if (!event.callEvent()) {
|
||||||
|
- if (event.shouldAbortSpawn()) {
|
||||||
|
- return PreSpawnStatus.ABORT;
|
||||||
|
+ if (com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent.getHandlerList().getRegisteredListeners().length != 0) { // Luminol - Do not fire pre creature spawn event unless some plugin is listening it
|
||||||
|
+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
|
||||||
|
+ org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, level),
|
||||||
|
+ org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(entityType), org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL
|
||||||
|
+ );
|
||||||
|
+ if (!event.callEvent()) {
|
||||||
|
+ if (event.shouldAbortSpawn()) {
|
||||||
|
+ return PreSpawnStatus.ABORT;
|
||||||
|
+ }
|
||||||
|
+ return PreSpawnStatus.CANCELLED;
|
||||||
|
}
|
||||||
|
- return PreSpawnStatus.CANCELLED;
|
||||||
|
- }
|
||||||
|
+ } // Luminol - Do not fire pre creature spawn event unless some plugin is listening it
|
||||||
|
final boolean success = entityType.getCategory() != MobCategory.MISC
|
||||||
|
// Paper end - PreCreatureSpawnEvent
|
||||||
|
&& (
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: MrHua269 <mrhua269@gmail.com>
|
|
||||||
Date: Thu, 5 Jun 2025 21:11:31 +0800
|
|
||||||
Subject: [PATCH] Fix off region thrown egg new entity creating
|
|
||||||
|
|
||||||
should set pos before so that we could correctly modify the entity's other attribute on-region without triggering the async catchers
|
|
||||||
|
|
||||||
diff --git a/net/minecraft/world/entity/projectile/ThrownEgg.java b/net/minecraft/world/entity/projectile/ThrownEgg.java
|
|
||||||
index 73ec34b43f3fb2aa3edc3f1cb48a923d1fa32036..5760ae39e8c452b8291353ed59ce7f8ef4d43dc1 100644
|
|
||||||
--- a/net/minecraft/world/entity/projectile/ThrownEgg.java
|
|
||||||
+++ b/net/minecraft/world/entity/projectile/ThrownEgg.java
|
|
||||||
@@ -97,12 +97,13 @@ public class ThrownEgg extends ThrowableItemProjectile {
|
|
||||||
for (int i1 = 0; i1 < i; i1++) {
|
|
||||||
net.minecraft.world.entity.Entity chicken = newEntityType.create(this.level(), net.minecraft.world.entity.EntitySpawnReason.TRIGGERED); // CraftBukkit
|
|
||||||
if (chicken != null) {
|
|
||||||
+ chicken.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F); // Luminol - Fix off region thrown egg - move up
|
|
||||||
// CraftBukkit start
|
|
||||||
if (chicken.getBukkitEntity() instanceof org.bukkit.entity.Ageable ageable) {
|
|
||||||
ageable.setBaby();
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
- chicken.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
|
|
||||||
+ // chicken.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F); // Luminol - Fix off region thrown egg - move up
|
|
||||||
// CraftBukkit start
|
|
||||||
if (chicken instanceof Chicken realChicken) {
|
|
||||||
Optional.ofNullable(this.getItem().get(DataComponents.CHICKEN_VARIANT))
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
|
||||||
|
Date: Tue, 9 Nov 2077 00:00:00 +0800
|
||||||
|
Subject: [PATCH] Cpu affinity
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/io/papermc/paper/threadedregions/TickRegionScheduler.java b/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||||
|
index fa6b8d756195c1b430cc11214a901bd42eebc98d..0357792de0ed8ec9058d1847c8b45c33ff365af6 100644
|
||||||
|
--- a/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||||
|
+++ b/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||||
|
@@ -49,6 +49,25 @@ public final class TickRegionScheduler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Thread newThread(final Runnable run) {
|
||||||
|
+ // Luminol start - cpu affinity
|
||||||
|
+ if (me.earthme.luminol.config.modules.misc.CpuAffinityConfig.cpuAffinityEnabled) {
|
||||||
|
+ Runnable affinityRunnable = new Runnable() {
|
||||||
|
+ private boolean affinitySet = false;
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void run() {
|
||||||
|
+ if (!this.affinitySet) {
|
||||||
|
+ this.affinitySet = true;
|
||||||
|
+ net.openhft.affinity.Affinity.setAffinity(me.earthme.luminol.config.modules.misc.CpuAffinityConfig.tickRegionAffinityBitSet);
|
||||||
|
+ }
|
||||||
|
+ run.run();
|
||||||
|
+ }
|
||||||
|
+ };
|
||||||
|
+ final Thread ret = new TickThreadRunner(affinityRunnable, "Region Scheduler Thread #" + this.idGenerator.getAndIncrement());
|
||||||
|
+ ret.setUncaughtExceptionHandler(TickRegionScheduler.this::uncaughtException);
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+ // Luminol end - cpu affinity
|
||||||
|
final Thread ret = new TickThreadRunner(run, "Region Scheduler Thread #" + this.idGenerator.getAndIncrement());
|
||||||
|
ret.setUncaughtExceptionHandler(TickRegionScheduler.this::uncaughtException);
|
||||||
|
return ret;
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/CpuAffinityConfig.java
|
||||||
|
@@ -1,0 +_,77 @@
|
||||||
|
+package me.earthme.luminol.config.modules.misc;
|
||||||
|
+
|
||||||
|
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||||
|
+import com.mojang.logging.LogUtils;
|
||||||
|
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||||
|
+import me.earthme.luminol.config.IConfigModule;
|
||||||
|
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||||
|
+import me.earthme.luminol.config.flags.DoNotLoad;
|
||||||
|
+import net.openhft.affinity.Affinity;
|
||||||
|
+import org.slf4j.Logger;
|
||||||
|
+
|
||||||
|
+import java.util.BitSet;
|
||||||
|
+import java.util.List;
|
||||||
|
+
|
||||||
|
+public class CpuAffinityConfig implements IConfigModule {
|
||||||
|
+ @ConfigInfo(baseName = "enabled")
|
||||||
|
+ public static boolean cpuAffinityEnabled = false;
|
||||||
|
+ @ConfigInfo(baseName = "tickregion_affinity")
|
||||||
|
+ public static List<String> tickRegionAffinity = Affinity.getAffinity()
|
||||||
|
+ .stream()
|
||||||
|
+ .mapToObj(String::valueOf)
|
||||||
|
+ .toList();
|
||||||
|
+
|
||||||
|
+ @DoNotLoad
|
||||||
|
+ private static boolean inited = false;
|
||||||
|
+ @DoNotLoad
|
||||||
|
+ private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
+ @DoNotLoad
|
||||||
|
+ public static BitSet tickRegionAffinityBitSet;
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public EnumConfigCategory getCategory() {
|
||||||
|
+ return EnumConfigCategory.MISC;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public String getBaseName() {
|
||||||
|
+ return "cpu_affinity";
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void onLoaded(CommentedFileConfig configInstance) {
|
||||||
|
+ if (!cpuAffinityEnabled) return;
|
||||||
|
+
|
||||||
|
+ tickRegionAffinityBitSet = parseAffinity(tickRegionAffinity);
|
||||||
|
+ LOGGER.info("Tick region thread now bound to: {}", tickRegionAffinityBitSet);
|
||||||
|
+
|
||||||
|
+ if (!inited) {
|
||||||
|
+ inited = true;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private BitSet parseAffinity(List<String> affinity) {
|
||||||
|
+ int maxAvailable = Runtime.getRuntime().availableProcessors();
|
||||||
|
+ BitSet affinitySet = new BitSet(affinity.size());
|
||||||
|
+ affinity.stream()
|
||||||
|
+ .mapToInt(str -> {
|
||||||
|
+ try {
|
||||||
|
+ return Integer.parseInt(str);
|
||||||
|
+ } catch (NumberFormatException ignored) {
|
||||||
|
+ LOGGER.warn("Unable to parse cpu id {} to a valid number, falling back to 0.", str);
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ })
|
||||||
|
+ .distinct()
|
||||||
|
+ .filter(cpuId -> {
|
||||||
|
+ if (cpuId >= 0 && cpuId < maxAvailable) {
|
||||||
|
+ return true;
|
||||||
|
+ } else {
|
||||||
|
+ LOGGER.warn("Invalid cpu id {}, ignoring.", cpuId);
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ })
|
||||||
|
+ .forEach(affinitySet::set);
|
||||||
|
+ return affinitySet;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/me/earthme/luminol/data/BufferedLinearRegionFile.java
|
+++ b/src/main/java/me/earthme/luminol/data/BufferedLinearRegionFile.java
|
||||||
@@ -1,0 +_,629 @@
|
@@ -1,0 +_,631 @@
|
||||||
+package me.earthme.luminol.data;
|
+package me.earthme.luminol.data;
|
||||||
+
|
+
|
||||||
+import abomination.IRegionFile;
|
+import abomination.IRegionFile;
|
||||||
@@ -213,6 +213,8 @@
|
|||||||
+ this.currentAcquiredIndex = tempChannel.size();
|
+ this.currentAcquiredIndex = tempChannel.size();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ this.channel.close();
|
||||||
|
+
|
||||||
+ Files.move(
|
+ Files.move(
|
||||||
+ new File(this.filePath.toString() + ".tmp").toPath(),
|
+ new File(this.filePath.toString() + ".tmp").toPath(),
|
||||||
+ this.filePath,
|
+ this.filePath,
|
||||||
|
|||||||
Reference in New Issue
Block a user