Compare commits

..

14 Commits

Author SHA1 Message Date
Helvetica Volubi 43036f971c feat: update Entity tick and removal limiter 2026-07-30 00:58:37 +08:00
Helvetica Volubi 25ce58c40d fix: fix folia nether portal ticket placement 2026-07-28 21:23:43 +08:00
Helvetica Volubi 106f1edb09 set release to stable cannel 2026-07-28 15:38:35 +08:00
Helvetica Volubi eea830188f update some optimizations from upstream 2026-07-28 15:37:41 +08:00
Helvetica Volubi f517cc0b8a feat: update b_linear format from upstream
Because of some reasons, this patch will be anonymous and hide the original commit address.
2026-07-28 02:03:00 +08:00
Helvetica Volubi d90c8567d3 [ci skip] simplify code 2026-07-28 01:29:59 +08:00
Helvetica Volubi 78b3a8a6e7 [ci skip] Use ComfreyWeight instead of HyacinthusWeight 2026-07-27 03:43:02 +08:00
Helvetica Volubi 2f93769135 [ci skip] Use ComfreyWeight instead of HyacinthusWeight 2026-07-27 03:32:49 +08:00
Helvetica Volubi 4e277ad91e [ci skip] Update clip version 2026-07-27 01:17:13 +08:00
Helvetica Volubi 1620687dba [ci skip] fix typo 2026-07-26 19:09:05 +08:00
Bacteriawa 7b7eb911c9 Update Folia 2026-07-26 17:16:36 +08:00
Helvetica Volubi 0724ba3fa9 fix: bind packetListenerImpl to Connection when place new photographer (#160) 2026-07-26 01:38:29 +08:00
Helvetica Volubi e6d6562f4f update zh_cn.json 2026-07-26 00:45:33 +08:00
Helvetica Volubi 580201740e fix: update references and add additional launch parameters in documentation 2026-07-25 21:33:59 +08:00
91 changed files with 3569 additions and 1793 deletions
+13 -3
View File
@@ -29,6 +29,12 @@
- 🔬 **生电功能增强** - 在 Folia 上实现更多生电内容(完整生电请使用 Fabric)
- 🛠️ **更多实用功能** - 持续添加有用的服务器功能
### 额外启动参数
- morninggloryclip.useMojangSource 强制服务端使用mojang源下载文件
- morninggloryclip.enable.mixin 启用服务器插件的mixin支持
## 📥 下载
### 稳定版本
@@ -62,7 +68,11 @@ repositories {
}
dependencies {
compileOnly("fun.bm.lophine:lophine-api:$VERSION")
compileOnly("fun.bm.lophine:lophine-api:26.2.build.+")
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(25))
}
```
@@ -79,8 +89,8 @@ dependencies {
<dependencies>
<dependency>
<groupId>fun.bm.lophine</groupId>
<artifactId>luminol-api</artifactId>
<version>$VERSION</version>
<artifactId>lophine-api</artifactId>
<version>[26.2.build,)</version>
</dependency>
</dependencies>
```
+12 -3
View File
@@ -29,6 +29,11 @@
- 🔬 **Redstone Enhancement** - More redstone functionality on Folia (use Fabric for complete redstone features)
- 🛠️ **More Useful Functions** - Continuously adding useful server features
### Additional Launch Parameters
- morninggloryclip.useMojangSource - Use Mojang's source for Minecraft Server
- morninggloryclip.enable.mixin - Enable mixin support for Leaves Plugin
## 📥 Download
### Stable Releases
@@ -62,7 +67,11 @@ repositories {
}
dependencies {
compileOnly("fun.bm.lophine:lophine-api:$VERSION")
compileOnly("fun.bm.lophine:lophine-api:26.2.build.+")
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(25))
}
```
@@ -79,8 +88,8 @@ dependencies {
<dependencies>
<dependency>
<groupId>fun.bm.lophine</groupId>
<artifactId>luminol-api</artifactId>
<version>$VERSION</version>
<artifactId>lophine-api</artifactId>
<version>[26.2.build,)</version>
<scope>provided</scope>
</dependency>
</dependencies>
+1 -1
View File
@@ -4,7 +4,7 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
java // TODO java launcher tasks
id("moe.luminolmc.hyacinthusweight.patcher")
id("fun.bm.comfreyweight.patcher")
}
paperweight {
+4 -4
View File
@@ -2,14 +2,14 @@ group=fun.bm.lophine
mcVersion=26.2
apiVersion=26.2
channel=STABLE
clipVersion=3.0.18
weightVersion=2.0.15
clipVersion=1.0.1
weightVersion=1.0.0
# true for release, false for skip release, pre for pre-release
release=pre
release=true
# true for push to repo, false for skip push repo, auto for detect by release value
pushRepo=auto
foliaRef=602048cb815db2ded68cca8cd43f480b983185a1
foliaRef=e48800d446d2bdeb24a8d31d671554440687e846
org.gradle.configuration-cache=true
org.gradle.caching=true
+2 -2
View File
@@ -5,7 +5,7 @@
`maven-publish`
idea
- id("io.papermc.paperweight.core")
+ id("moe.luminolmc.hyacinthusweight.core") // TODO Later - rebrand
+ id("fun.bm.comfreyweight.core")
id("io.papermc.fill.gradle") version "1.0.12"
}
@@ -15,7 +15,7 @@
dependencies {
mache("io.papermc:mache:26.2+build.1")
- paperclip("io.papermc:paperclip:3.0.4")
+ hyacinthusclip("moe.luminolmc:hyacinthusclip:${providers.gradleProperty("clipVersion").get()}") // TODO Later - rebrand
+ morninggloryclip("fun.bm:morninggloryclip:${providers.gradleProperty("clipVersion").get()}")
}
paperweight {
@@ -5,10 +5,10 @@ Subject: [PATCH] Luminol Config System
diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java
index a4d608d64b7d3477c9144d93547fd3b4f39a1b02..2a75f8fbd2e5f41ca138740319d34683915e3b5b 100644
index e2939cc39a8c103e4c4d7b01d39b5546486e4fbc..a557d488e4e289a61aeb9aed0cc133a0a7ce8f8c 100644
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -107,6 +107,7 @@ public class Main {
@@ -110,6 +110,7 @@ public class Main {
JvmProfiler.INSTANCE.start(Environment.SERVER);
}
@@ -5,7 +5,7 @@ Subject: [PATCH] Correct player respawn place
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index fbe0ef19bfabfc42d9e0e08e17b08159321b3804..44b3dfbf529630d8cca9a4270ae2a7c94c5a077c 100644
index 57f93d978fe48fdf6e77b7bfb9f1de060e1a8524..924d5f3236d9ba9836f39fc844392099df9cd25c 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -511,8 +511,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -43,7 +43,7 @@ index fbe0ef19bfabfc42d9e0e08e17b08159321b3804..44b3dfbf529630d8cca9a4270ae2a7c9
if (inChunk == null) {
continue;
}
@@ -2018,7 +2030,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1997,7 +2009,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
}
if (newLevel.dimension() == lastDimension) {
@@ -1,11 +1,14 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Sun, 28 Jun 2026 18:54:50 +0800
Subject: [PATCH] Configurable region format framework
Subject: [PATCH] Anonymous Object: Configurable region format framework
As requested by the original author, this patch will be anonymous and hide the original commit address.
This patch is used with permission from the original author.
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/io/ChunkSystemRegionFileStorage.java b/ca/spottedleaf/moonrise/patches/chunk_system/io/ChunkSystemRegionFileStorage.java
index a814512fcfb85312474ae2c2c21443843bf57831..2e084a5b28cbe4737f48c25e10af589213525362 100644
index a814512fcfb85312474ae2c2c21443843bf57831..9d69a022872e06b320bee46329cd8889f74fbbaa 100644
--- a/ca/spottedleaf/moonrise/patches/chunk_system/io/ChunkSystemRegionFileStorage.java
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/io/ChunkSystemRegionFileStorage.java
@@ -8,9 +8,9 @@ public interface ChunkSystemRegionFileStorage {
@@ -13,15 +16,15 @@ index a814512fcfb85312474ae2c2c21443843bf57831..2e084a5b28cbe4737f48c25e10af5892
public boolean moonrise$doesRegionFileNotExistNoIO(final int chunkX, final int chunkZ);
- public RegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ);
+ public abomination.IRegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ); // Luminol - Configurable region file format
+ public io.anonymous.anonymous.data.RegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ); // Anonymous - Configurable region file format
- public RegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException;
+ public abomination.IRegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException; // Luminol - Configurable region file format
+ public io.anonymous.anonymous.data.RegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException; // Anonymous - Configurable region file format
public MoonriseRegionFileIO.RegionDataController.WriteData moonrise$startWrite(
final int chunkX, final int chunkZ, final CompoundTag compound
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
index 3bb9b58ee97464687e348e23b99159226415c267..fc264727141c3897e6c06819b9713d4f6395baf0 100644
index 3bb9b58ee97464687e348e23b99159226415c267..4c3ad63f17bb4a04f982b36ad3f53d3c0f58bdb5 100644
--- a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
@@ -1273,7 +1273,7 @@ public final class MoonriseRegionFileIO {
@@ -29,7 +32,7 @@ index 3bb9b58ee97464687e348e23b99159226415c267..fc264727141c3897e6c06819b9713d4f
// Paper start - flush regionfiles on save
if (this.world.paperConfig().chunks.flushRegionsOnSave) {
- final RegionFile regionFile = this.regionDataController.getCache().moonrise$getRegionFileIfLoaded(this.chunkX, this.chunkZ);
+ final abomination.IRegionFile regionFile = this.regionDataController.getCache().moonrise$getRegionFileIfLoaded(this.chunkX, this.chunkZ); // Luminol - Add configurable region file
+ final io.anonymous.anonymous.data.RegionFile regionFile = this.regionDataController.getCache().moonrise$getRegionFileIfLoaded(this.chunkX, this.chunkZ); // Anonymous - Configurable region file format
if (regionFile != null) {
regionFile.flush();
} // else: evicted from cache, which should have called flush
@@ -38,12 +41,12 @@ index 3bb9b58ee97464687e348e23b99159226415c267..fc264727141c3897e6c06819b9713d4f
public static interface IORunnable {
- public void run(final RegionFile regionFile) throws IOException;
+ public void run(final abomination.IRegionFile regionFile) throws IOException; // Luminol - Configurable region file format
+ public void run(final io.anonymous.anonymous.data.RegionFile regionFile) throws IOException; // Anonymous - Configurable region file format
}
}
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java b/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java
index 51c126735ace8fdde89ad97b5cab62f244212db0..c7d4d944eb198ac53a3eeae717a25c7d5815c8c1 100644
index 51c126735ace8fdde89ad97b5cab62f244212db0..ea2f45964fb8c617f90938597c230b50d83744aa 100644
--- a/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java
@@ -8,5 +8,5 @@ public interface ChunkSystemChunkBuffer {
@@ -51,10 +54,10 @@ index 51c126735ace8fdde89ad97b5cab62f244212db0..c7d4d944eb198ac53a3eeae717a25c7d
public void moonrise$setWriteOnClose(final boolean value);
- public void moonrise$write(final RegionFile regionFile) throws IOException;
+ public void moonrise$write(final abomination.IRegionFile regionFile) throws IOException; // Luminol - Configurable region file format
+ public void moonrise$write(final io.anonymous.anonymous.data.RegionFile regionFile) throws IOException; // Anonymous - Configurable region file format
}
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index a49c46eb7df50fc3c5587a2c3668ab6edc887107..83b9aab16124ddcc416f7b4cd95084e1c64fe5b7 100644
index a49c46eb7df50fc3c5587a2c3668ab6edc887107..c74f76b46259204b33b69ad08bb03c81b8b36961 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -986,10 +986,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -62,16 +65,16 @@ index a49c46eb7df50fc3c5587a2c3668ab6edc887107..83b9aab16124ddcc416f7b4cd95084e1
for (ServerLevel level : this.getAllLevels()) {
String storageName = level.getChunkSource().chunkMap.getStorageName();
- LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", LEGACY_WORLD_NAMES_FOR_REALMS_LOG.getOrDefault(storageName, storageName));
+ LOGGER.info("ThreadedChunkStorage ({}): All chunks are saved", LEGACY_WORLD_NAMES_FOR_REALMS_LOG.getOrDefault(storageName, storageName)); // Luminol - configurable region format
+ LOGGER.info("ThreadedChunkStorage ({}): All chunks are saved", LEGACY_WORLD_NAMES_FOR_REALMS_LOG.getOrDefault(storageName, storageName)); // Anonymous - Configurable region format
}
- LOGGER.info("ThreadedAnvilChunkStorage: All dimensions are saved");
+ LOGGER.info("ThreadedChunkStorage: All dimensions are saved"); // Luminol - configurable region format
+ LOGGER.info("ThreadedChunkStorage: All dimensions are saved"); // Anonymous - configurable region format
}
return result;
diff --git a/net/minecraft/util/worldupdate/FileToUpgrade.java b/net/minecraft/util/worldupdate/FileToUpgrade.java
index a7f2cfa9277c898038f6b9e0a3401db51012b64c..db4dba8849eb27f8f84acc3297e342da4700d839 100644
index a7f2cfa9277c898038f6b9e0a3401db51012b64c..7b96f3ec2738875a3ed7aa34347c0f174b6579c5 100644
--- a/net/minecraft/util/worldupdate/FileToUpgrade.java
+++ b/net/minecraft/util/worldupdate/FileToUpgrade.java
@@ -4,5 +4,5 @@ import java.util.List;
@@ -79,10 +82,10 @@ index a7f2cfa9277c898038f6b9e0a3401db51012b64c..db4dba8849eb27f8f84acc3297e342da
import net.minecraft.world.level.chunk.storage.RegionFile;
-public record FileToUpgrade(RegionFile file, List<ChunkPos> chunksToUpgrade) {
+public record FileToUpgrade(abomination.IRegionFile file, List<ChunkPos> chunksToUpgrade) { // Luminol - Configurable region file format
+public record FileToUpgrade(io.anonymous.anonymous.data.RegionFile file, List<ChunkPos> chunksToUpgrade) { // Anonymous - Configurable region file format
}
diff --git a/net/minecraft/util/worldupdate/RegionStorageUpgrader.java b/net/minecraft/util/worldupdate/RegionStorageUpgrader.java
index b228cd6c54e8c8998923ab332882d99092769c67..140ef4959fa2fe5b9cd251955c93683e8e69d5ba 100644
index b228cd6c54e8c8998923ab332882d99092769c67..2dd3d0afd8f58e5e68a361dd38c95da06b4d133b 100644
--- a/net/minecraft/util/worldupdate/RegionStorageUpgrader.java
+++ b/net/minecraft/util/worldupdate/RegionStorageUpgrader.java
@@ -36,7 +36,7 @@ import org.slf4j.Logger;
@@ -90,7 +93,7 @@ index b228cd6c54e8c8998923ab332882d99092769c67..140ef4959fa2fe5b9cd251955c93683e
private static final Logger LOGGER = LogUtils.getLogger();
private static final String NEW_DIRECTORY_PREFIX = "new_";
- private static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.mca$");
+ private static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\." + me.earthme.luminol.config.modules.function.RegionFormatConfig.regionFormat.getArgument() + "$"); // Luminol - Configurable region file format
+ private static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\." + me.earthme.luminol.config.modules.function.RegionFormatConfig.regionFormat.getArgument() + "$"); // Anonymous - Configurable region file format
private final DataFixer dataFixer;
private final UpgradeProgress upgradeProgress;
private final String type;
@@ -99,8 +102,8 @@ index b228cd6c54e8c8998923ab332882d99092769c67..140ef4959fa2fe5b9cd251955c93683e
List<ChunkPos> chunkPositions = Lists.newArrayList();
- try (RegionFile regionSource = new RegionFile(info, regionFile.toPath(), regionFolder, true)) {
+ var regionFileInfo = new me.earthme.luminol.utils.RegionCreatorInfo(info, regionFile.toPath(), regionFolder, true); // Luminol - Configurable region file format
+ try (abomination.IRegionFile regionSource = me.earthme.luminol.config.modules.function.RegionFormatConfig.regionFormat.getCreator().create(regionFileInfo)) { // Luminol - Configurable region file format
+ var regionFileInfo = new io.anonymous.anonymous.utils.RegionCreatorInfo(info, regionFile.toPath(), regionFolder, true); // Anonymous - Configurable region file format
+ try (io.anonymous.anonymous.data.RegionFile regionSource = me.earthme.luminol.config.modules.function.RegionFormatConfig.regionFormat.getCreator().newFile(regionFileInfo)) { // Anonymous - Configurable region file format
for (int x = 0; x < 32; x++) {
for (int z = 0; z < 32; z++) {
ChunkPos pos = new ChunkPos(x + xOffset, z + zOffset);
@@ -109,12 +112,12 @@ index b228cd6c54e8c8998923ab332882d99092769c67..140ef4959fa2fe5b9cd251955c93683e
}
- private void onFileFinished(final RegionFile regionFile) {
+ private void onFileFinished(final abomination.IRegionFile regionFile) { // Luminol - Configurable region file format
+ private void onFileFinished(final io.anonymous.anonymous.data.RegionFile regionFile) { // Anonymous - Configurable region file format
if (this.recreateRegionFiles) {
if (this.previousWriteFuture != null) {
this.previousWriteFuture.join();
diff --git a/net/minecraft/world/level/chunk/storage/RegionFile.java b/net/minecraft/world/level/chunk/storage/RegionFile.java
index 3de7fd2b084c38e72d7a6bc416880a881f514ad3..d3350dee1d6d5bc15dcdfba3611f93addb767392 100644
index 3de7fd2b084c38e72d7a6bc416880a881f514ad3..821924f85a507589a039832be8657e1dc3c0ce0c 100644
--- a/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -22,7 +22,7 @@ import net.minecraft.world.level.ChunkPos;
@@ -122,7 +125,7 @@ index 3de7fd2b084c38e72d7a6bc416880a881f514ad3..d3350dee1d6d5bc15dcdfba3611f93ad
import org.slf4j.Logger;
-public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.storage.ChunkSystemRegionFile { // Paper - rewrite chunk system
+public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.storage.ChunkSystemRegionFile , abomination.IRegionFile{ // Paper - rewrite chunk system // Luminol - Configurable region file format
+public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.storage.ChunkSystemRegionFile , io.anonymous.anonymous.data.RegionFile{ // Paper - rewrite chunk system // Anonymous - Configurable region file format
private static final Logger LOGGER = LogUtils.getLogger();
public static final int MAX_CHUNK_SIZE = 500 * 1024 * 1024; // Paper - don't write garbage data to disk if writing serialization fails
private static final int SECTOR_BYTES = 4096;
@@ -131,7 +134,7 @@ index 3de7fd2b084c38e72d7a6bc416880a881f514ad3..d3350dee1d6d5bc15dcdfba3611f93ad
}
- boolean recalculateHeader() throws IOException {
+ public boolean recalculateHeader() throws IOException { // Luminol - Configurable region file format
+ public boolean recalculateHeader() throws IOException { // Anonymous - Configurable region file format
if (!this.canRecalcHeader) {
return false;
}
@@ -140,7 +143,7 @@ index 3de7fd2b084c38e72d7a6bc416880a881f514ad3..d3350dee1d6d5bc15dcdfba3611f93ad
}
- protected synchronized void write(final ChunkPos pos, final ByteBuffer data) throws IOException {
+ public synchronized void write(final ChunkPos pos, final ByteBuffer data) throws IOException { // Luminol - Configurable region file format
+ public synchronized void write(final ChunkPos pos, final ByteBuffer data) throws IOException { // Anonymous - Configurable region file format
int offsetIndex = getOffsetIndex(pos);
int offset = this.offsets.get(offsetIndex);
int sectorNumber = getSectorNumber(offset);
@@ -149,7 +152,7 @@ index 3de7fd2b084c38e72d7a6bc416880a881f514ad3..d3350dee1d6d5bc15dcdfba3611f93ad
@Override
- public final void moonrise$write(final RegionFile regionFile) throws IOException {
+ public final void moonrise$write(final abomination.IRegionFile regionFile) throws IOException { // Luminol - Configurable region file format
+ public final void moonrise$write(final io.anonymous.anonymous.data.RegionFile regionFile) throws IOException { // Anonymous - Configurable region file format
regionFile.write(this.pos, ByteBuffer.wrap(this.buf, 0, this.count));
}
// Paper end - rewrite chunk system
@@ -158,12 +161,12 @@ index 3de7fd2b084c38e72d7a6bc416880a881f514ad3..d3350dee1d6d5bc15dcdfba3611f93ad
}
- synchronized boolean isOversized(int x, int z) {
+ public synchronized boolean isOversized(int x, int z) { // Luminol - Configurable region file format
+ public synchronized boolean isOversized(int x, int z) { // Anonymous - Configurable region file format
return this.oversized[getChunkIndex(x, z)] == 1;
}
- synchronized void setOversized(int x, int z, boolean oversized) throws IOException {
+ public synchronized void setOversized(int x, int z, boolean oversized) throws IOException { // Luminol - Configurable region file format
+ public synchronized void setOversized(int x, int z, boolean oversized) throws IOException { // Anonymous - Configurable region file format
final int offset = getChunkIndex(x, z);
boolean previous = this.oversized[offset] == 1;
this.oversized[offset] = (byte) (oversized ? 1 : 0);
@@ -172,12 +175,12 @@ index 3de7fd2b084c38e72d7a6bc416880a881f514ad3..d3350dee1d6d5bc15dcdfba3611f93ad
}
- synchronized net.minecraft.nbt.CompoundTag getOversizedData(int x, int z) throws IOException {
+ public synchronized net.minecraft.nbt.CompoundTag getOversizedData(int x, int z) throws IOException { // Luminol - Configurable region file format
+ public synchronized net.minecraft.nbt.CompoundTag getOversizedData(int x, int z) throws IOException { // Anonymous - Configurable region file format
Path file = getOversizedFile(x, z);
try (DataInputStream out = new DataInputStream(new java.io.BufferedInputStream(new java.util.zip.InflaterInputStream(Files.newInputStream(file))))) {
return net.minecraft.nbt.NbtIo.read((java.io.DataInput) out);
diff --git a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977ebfb18517 100644
index 63b40c420030d935bb81a219fb33defe0946e21f..e0e19f091f6b85d7788259cfcc53cc3db848b68e 100644
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -19,7 +19,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
@@ -185,7 +188,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
public static final String ANVIL_EXTENSION = ".mca";
private static final int MAX_CACHE_SIZE = 256;
- private final Long2ObjectLinkedOpenHashMap<RegionFile> regionCache = new Long2ObjectLinkedOpenHashMap<>();
+ private final Long2ObjectLinkedOpenHashMap<abomination.IRegionFile> regionCache = new Long2ObjectLinkedOpenHashMap<>(); // Luminol - Configurable region file format
+ private final Long2ObjectLinkedOpenHashMap<io.anonymous.anonymous.data.RegionFile> regionCache = new Long2ObjectLinkedOpenHashMap<>(); // Anonymous - Configurable region file format
private final RegionStorageInfo info;
private final Path folder;
private final boolean sync;
@@ -194,7 +197,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
public static ChunkPos getRegionFileCoordinates(Path file) {
String fileName = file.getFileName().toString();
- if (!fileName.startsWith("r.") || !fileName.endsWith(".mca")) {
+ if (!fileName.startsWith("r.") || !fileName.endsWith(getExtensionName())) { // Luminol - Configurable region file format
+ if (!fileName.startsWith("r.") || !fileName.endsWith(getExtensionName())) { // Anonymous - Configurable region file format
return null;
}
@@ -203,32 +206,32 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
private final it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet nonExistingRegionFiles = new it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet();
private static String getRegionFileName(final int chunkX, final int chunkZ) {
- return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + ".mca";
+ return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + getExtensionName(); // Luminol - Configurable region file format
+ return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + getExtensionName(); // Anonymous - Configurable region file format
}
+ // Luminol start - Configurable region file format
+ public static abomination.IRegionFile createNew(RegionStorageInfo info, Path filePath, Path folder, boolean sync) throws IOException{
+ final me.earthme.luminol.enums.EnumRegionFormat regionFormat = me.earthme.luminol.config.modules.function.RegionFormatConfig.regionFormat;
+ // Anonymous start - Configurable region file format
+ public static io.anonymous.anonymous.data.RegionFile createNew(RegionStorageInfo info, Path filePath, Path folder, boolean sync) throws IOException{
+ final io.anonymous.anonymous.enums.EnumRegionFormat regionFormat = me.earthme.luminol.config.modules.function.RegionFormatConfig.regionFormat;
+ final String fullFileName = filePath.getFileName().toString();
+ final String[] fullNameSplit = fullFileName.split("\\.");
+ final String extensionName = fullNameSplit[fullNameSplit.length - 1];
+
+ if (!regionFormat.getArgument().equalsIgnoreCase(extensionName)) {
+ // delayed crash
+ // raise a delayed crash
+ io.papermc.paper.threadedregions.RegionizedServer.getInstance().addTask(() -> {
+ new RuntimeException("Invalid region file format: " + extensionName + " expected " + regionFormat.getArgument());
+ throw new RuntimeException("Invalid region file format: " + extensionName + " expected " + regionFormat.getArgument());
+ });
+
+
+ throw new IOException("Invalid region file format: " + extensionName + " expected " + regionFormat.getArgument());
+ }
+
+ return regionFormat.getCreator().create(new me.earthme.luminol.utils.RegionCreatorInfo(info, filePath, folder, sync));
+ return regionFormat.getCreator().newFile(new io.anonymous.anonymous.utils.RegionCreatorInfo(info, filePath, folder, sync));
+ }
+
+ public static String getExtensionName() {
+ return "." + me.earthme.luminol.config.modules.function.RegionFormatConfig.regionFormat.getArgument();
+ }
+ // Luminol end
+ // Anonymous end
private boolean doesRegionFilePossiblyExist(final long position) {
synchronized (this.nonExistingRegionFiles) {
@@ -237,17 +240,17 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
@Override
- public synchronized final RegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ) {
+ public synchronized final abomination.IRegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ) { // Luminol - Configurable region file format
+ public synchronized final io.anonymous.anonymous.data.RegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ) { // Anonymous - Configurable region file format
return this.regionCache.getAndMoveToFirst(ChunkPos.pack(chunkX >> REGION_SHIFT, chunkZ >> REGION_SHIFT));
}
@Override
- public synchronized final RegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException {
+ public synchronized final abomination.IRegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException { // Luminol - Configurable region file format
+ public synchronized final io.anonymous.anonymous.data.RegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException { // Anonymous - Configurable region file format
final long key = ChunkPos.pack(chunkX >> REGION_SHIFT, chunkZ >> REGION_SHIFT);
- RegionFile ret = this.regionCache.getAndMoveToFirst(key);
+ abomination.IRegionFile ret = this.regionCache.getAndMoveToFirst(key); // Luminol - Configurable region file format
+ io.anonymous.anonymous.data.RegionFile ret = this.regionCache.getAndMoveToFirst(key); // Anonymous - Configurable region file format
if (ret != null) {
return ret;
}
@@ -256,7 +259,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
FileUtil.createDirectoriesSafe(this.folder);
- ret = new RegionFile(this.info, regionPath, this.folder, this.sync);
+ ret = this.createNew(this.info, regionPath, this.folder, this.sync); // Luminol - Configurable region file format
+ ret = this.createNew(this.info, regionPath, this.folder, this.sync); // Anonymous - Configurable region file format
this.regionCache.putAndMoveToFirst(key, ret);
@@ -265,7 +268,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
final ChunkPos pos = new ChunkPos(chunkX, chunkZ);
- final RegionFile regionFile = this.getRegionFile(pos);
+ final abomination.IRegionFile regionFile = this.getRegionFile(pos); // Luminol - Configurable region file format
+ final io.anonymous.anonymous.data.RegionFile regionFile = this.getRegionFile(pos); // Anonymous - Configurable region file format
// note: not required to keep regionfile loaded after this call, as the write param takes a regionfile as input
// (and, the regionfile parameter is unused for writing until the write call)
@@ -274,7 +277,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
final ChunkPos pos = new ChunkPos(chunkX, chunkZ);
if (writeData.result() == ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController.WriteData.WriteResult.DELETE) {
- final RegionFile regionFile = this.moonrise$getRegionFileIfExists(chunkX, chunkZ);
+ final abomination.IRegionFile regionFile = this.moonrise$getRegionFileIfExists(chunkX, chunkZ); // Luminol - Configurable region file format
+ final io.anonymous.anonymous.data.RegionFile regionFile = this.moonrise$getRegionFileIfExists(chunkX, chunkZ); // Anonymous - Configurable region file format
if (regionFile != null) {
regionFile.clear(pos);
} // else: didn't exist
@@ -283,7 +286,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
final int chunkX, final int chunkZ
) throws IOException {
- final RegionFile regionFile = this.moonrise$getRegionFileIfExists(chunkX, chunkZ);
+ final abomination.IRegionFile regionFile = this.moonrise$getRegionFileIfExists(chunkX, chunkZ); // Luminol - Configurable region file format
+ final io.anonymous.anonymous.data.RegionFile regionFile = this.moonrise$getRegionFileIfExists(chunkX, chunkZ); // Anonymous - Configurable region file format
final DataInputStream input = regionFile == null ? null : regionFile.getChunkDataInputStream(new ChunkPos(chunkX, chunkZ));
@@ -292,7 +295,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
final ChunkPos pos = new ChunkPos(chunkX, chunkZ);
final ChunkPos headerChunkPos = SerializableChunkData.getChunkCoordinate(ret);
- final RegionFile regionFile = this.getRegionFile(pos);
+ final abomination.IRegionFile regionFile = this.getRegionFile(pos); // Luminol - Configurable region file format
+ final io.anonymous.anonymous.data.RegionFile regionFile = this.getRegionFile(pos); // Anonymous - Configurable region file format
if (regionFile.getRecalculateCount() != readData.recalculateCount()) {
return null;
@@ -301,7 +304,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
// Paper end - rewrite chunk system
// Paper start - rewrite chunk system
- public RegionFile getRegionFile(ChunkPos pos) throws IOException {
+ public abomination.IRegionFile getRegionFile(ChunkPos pos) throws IOException { // Luminol - Configurable region file format
+ public io.anonymous.anonymous.data.RegionFile getRegionFile(ChunkPos pos) throws IOException { // Anonymous - Configurable region file format
return this.getRegionFile(pos, false);
}
// Paper end - rewrite chunk system
@@ -310,7 +313,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
}
- @org.jetbrains.annotations.Contract("_, false -> !null") private @Nullable RegionFile getRegionFile(final ChunkPos pos, boolean existingOnly) throws IOException { // CraftBukkit
+ @org.jetbrains.annotations.Contract("_, false -> !null") private abomination.@Nullable IRegionFile getRegionFile(final ChunkPos pos, boolean existingOnly) throws IOException { // CraftBukkit // Luminol - Configurable region file format
+ @org.jetbrains.annotations.Contract("_, false -> !null") private io.anonymous.anonymous.data.RegionFile getRegionFile(final ChunkPos pos, boolean existingOnly) throws IOException { // CraftBukkit // Anonymous - Configurable region file format
// Paper start - rewrite chunk system
if (existingOnly) {
return this.moonrise$getRegionFileIfExists(pos.x(), pos.z());
@@ -319,7 +322,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
final long key = ChunkPos.pack(pos.x() >> REGION_SHIFT, pos.z() >> REGION_SHIFT);
- RegionFile ret = this.regionCache.getAndMoveToFirst(key);
+ abomination.IRegionFile ret = this.regionCache.getAndMoveToFirst(key); // Luminol - Configurable region file format
+ io.anonymous.anonymous.data.RegionFile ret = this.regionCache.getAndMoveToFirst(key); // Anonymous - Configurable region file format
if (ret != null) {
return ret;
}
@@ -328,7 +331,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
FileUtil.createDirectoriesSafe(this.folder);
- ret = new RegionFile(this.info, regionPath, this.folder, this.sync);
+ ret = this.createNew(this.info, regionPath, this.folder, this.sync); // Luminol - Configurable region file format
+ ret = this.createNew(this.info, regionPath, this.folder, this.sync); // Anonymous - Configurable region file format
this.regionCache.putAndMoveToFirst(key, ret);
@@ -337,7 +340,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
}
- private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {
+ private static CompoundTag readOversizedChunk(abomination.IRegionFile regionfile, ChunkPos chunkCoordinate) throws IOException { // Luminol - Configurable region file format
+ private static CompoundTag readOversizedChunk(io.anonymous.anonymous.data.RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException { // Anonymous - Configurable region file format
synchronized (regionfile) {
try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) {
CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x(), chunkCoordinate.z());
@@ -346,7 +349,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
public @Nullable CompoundTag read(final ChunkPos pos) throws IOException {
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
- RegionFile region = this.getRegionFile(pos, true);
+ abomination.IRegionFile region = this.getRegionFile(pos, true); // Luminol - Configurable region file format
+ io.anonymous.anonymous.data.RegionFile region = this.getRegionFile(pos, true); // Anonymous - Configurable region file format
if (region == null) {
return null;
}
@@ -355,7 +358,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
public void scanChunk(final ChunkPos pos, final StreamTagVisitor scanner) throws IOException {
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
- RegionFile region = this.getRegionFile(pos, true);
+ abomination.IRegionFile region = this.getRegionFile(pos, true); // Luminol - Configurable region file format
+ io.anonymous.anonymous.data.RegionFile region = this.getRegionFile(pos, true); // Anonymous - Configurable region file format
if (region == null) {
return;
}
@@ -364,7 +367,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
public void write(final ChunkPos pos, final @Nullable CompoundTag value) throws IOException {
if (!SharedConstants.DEBUG_DONT_SAVE_WORLD) {
- RegionFile region = this.getRegionFile(pos, value == null); // CraftBukkit // Paper - rewrite chunk system
+ abomination.IRegionFile region = this.getRegionFile(pos, value == null); // CraftBukkit // Paper - rewrite chunk system // Luminol - Configurable region file format
+ io.anonymous.anonymous.data.RegionFile region = this.getRegionFile(pos, value == null); // CraftBukkit // Paper - rewrite chunk system // Anonymous - Configurable region file format
// Paper start - rewrite chunk system
if (region == null) {
// if the RegionFile doesn't exist, no point in deleting from it
@@ -373,7 +376,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
synchronized (this) {
final ExceptionCollector<IOException> exceptionCollector = new ExceptionCollector<>();
- for (final RegionFile regionFile : this.regionCache.values()) {
+ for (final abomination.IRegionFile regionFile : this.regionCache.values()) { // Luminol - Configurable region file format
+ for (final io.anonymous.anonymous.data.RegionFile regionFile : this.regionCache.values()) { // Anonymous - Configurable region file format
try {
regionFile.close();
} catch (final IOException ex) {
@@ -382,7 +385,7 @@ index 63b40c420030d935bb81a219fb33defe0946e21f..2e67e69862cbf5d804de50193442977e
synchronized (this) {
final ExceptionCollector<IOException> exceptionCollector = new ExceptionCollector<>();
- for (final RegionFile regionFile : this.regionCache.values()) {
+ for (final abomination.IRegionFile regionFile : this.regionCache.values()) { // Luminol - Configurable region file format
+ for (final io.anonymous.anonymous.data.RegionFile regionFile : this.regionCache.values()) { // Anonymous - Configurable region file format
try {
regionFile.flush();
} catch (final IOException ex) {
@@ -6,10 +6,10 @@ Subject: [PATCH] Do not enable any debug subscriptions
Really this would really crash the server by accident when the operators used F3 + J or toggled the debug synchronizer
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 44b3dfbf529630d8cca9a4270ae2a7c94c5a077c..34cc36f6bdf435593d16f2e7af280a27be048280 100644
index 924d5f3236d9ba9836f39fc844392099df9cd25c..fe34f2e648df9fd1174522baa5913976104b8d04 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -3504,7 +3504,8 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -3483,7 +3483,8 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
}
public Set<DebugSubscription<?>> debugSubscriptions() {
@@ -6,10 +6,10 @@ Subject: [PATCH] Fix riding statistics desync
Referred to: https://github.com/CraftCanvasMC/Canvas/commit/057175b0c10d5a4d1d9059fd9d077750c32633b2
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 34cc36f6bdf435593d16f2e7af280a27be048280..98d1ab3aa8dfbe571371d01544da2750339ce988 100644
index fe34f2e648df9fd1174522baa5913976104b8d04..fee4749c7938779f63155297bf9c7aeb0ca21709 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -2537,7 +2537,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -2516,7 +2516,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
}
}
@@ -19,7 +19,7 @@ index 34cc36f6bdf435593d16f2e7af280a27be048280..98d1ab3aa8dfbe571371d01544da2750
int distance = Math.round((float)Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
Entity vehicle = this.getVehicle();
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index a2b57f62b745dd21e215f919d335f14f5cb1706f..2cf8bdf6c4ab04ab42829b7af5eb89e6bd509d7a 100644
index 07310ae30817fc88227355739074615969b48184..47eef926f57053ace7ea140261570c4970822062 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4198,7 +4198,13 @@ public abstract class Entity
@@ -9,7 +9,7 @@ Almost the same bug as:
https://github.com/PaperMC/Folia/pull/418 and https://github.com/PaperMC/Folia/issues/393
diff --git a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
index 501a0e89cc7bcfce6793f059b080b38666e0fb64..ad35eafa457f706879ba8a9c92b3a34e620ee2d6 100644
index d0dba5cc351903fb762e231a95f302479794185f..fb00f70505a6c548cd1311d7ea55c6a501e814e3 100644
--- a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
+++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
@@ -264,7 +264,8 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
@@ -46,7 +46,7 @@ index c6434ff2e5c211887c2e98c8462a49e0e1cb5b21..534f103234eb92571c664cbcfea4ce4e
} else {entity.inactiveTick();} // Paper - EAR 2
profiler.pop();
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 2cf8bdf6c4ab04ab42829b7af5eb89e6bd509d7a..a52d5c0ba970d666fd57e075d14350ff07401bac 100644
index 47eef926f57053ace7ea140261570c4970822062..7953b7ece0b5e3f41e85252cdfd8e400fab212ae 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -387,6 +387,7 @@ public abstract class Entity
@@ -5,7 +5,7 @@ Subject: [PATCH] Fix player auto saving ignores interval
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 98d1ab3aa8dfbe571371d01544da2750339ce988..264de9099b19779f20ad23c41d0967670759ae12 100644
index fee4749c7938779f63155297bf9c7aeb0ca21709..5668906866917f7bb6088ae16146d917d2b840b0 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -208,7 +208,7 @@ import org.slf4j.Logger;
@@ -6,7 +6,7 @@ Subject: [PATCH] Force disable builtin spark plugin
The spark passed down from paper has some memory leaking issue, so we fully removed it from the code to prevent that memory leaking issue.
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 83b9aab16124ddcc416f7b4cd95084e1c64fe5b7..7683c12d48d23dd43bce3d3b5633029c596930a5 100644
index c74f76b46259204b33b69ad08bb03c81b8b36961..cc8364891a5d2196e8809479db984b67b5bcb079 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -672,8 +672,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -29,7 +29,7 @@ index c1faaf7d514c23d756aa626fa93aabd8bb503463..0c5fb17e7cce18eac68183cc3b5de6fc
// If the event is cancelled we move the player back to their old location.
if (event.isCancelled()) {
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index a52d5c0ba970d666fd57e075d14350ff07401bac..72f89eaba2ca8b66fa07a6378d93917dec83c688 100644
index 7953b7ece0b5e3f41e85252cdfd8e400fab212ae..343e4bb41acfab4e50729aa5dbe2a071dac376a3 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4476,12 +4476,25 @@ public abstract class Entity
@@ -17,7 +17,7 @@ index b31b55f00e2ce1bd6c1011fe852bd1dbb37de524..75c36cbf86e56d4993169688a13f22cc
}
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 72f89eaba2ca8b66fa07a6378d93917dec83c688..6b7382f06a8c76b216b081e66789fe51466b1e29 100644
index 343e4bb41acfab4e50729aa5dbe2a071dac376a3..c04917f31585d9d670cc98cda8eb36187f4261d7 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4460,6 +4460,7 @@ public abstract class Entity
@@ -8,7 +8,7 @@ On folia, entity usually cannot move out of the tickregion, but sometimes it act
Reference from : https://github.com/KaiijuMC/Kaiiju/blob/ver/1.20.1/patches/server/0040-Teleport-async-if-we-cannot-move-entity-off-main.patch
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 6b7382f06a8c76b216b081e66789fe51466b1e29..8c909108a0c468f353837787188c12f907369b9b 100644
index c04917f31585d9d670cc98cda8eb36187f4261d7..9270b887448023b6ace2e7fae6b632755ce90600 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1163,6 +1163,19 @@ public abstract class Entity
@@ -33,7 +33,7 @@ index 13d7965fd4f99f0848b080349df41f8b1c31a19b..5b83f2edd6afe94c28bf491afab737e9
nmsEntity.stopRiding();
nmsEntity.teleportAsync(
diff --git a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
index ad35eafa457f706879ba8a9c92b3a34e620ee2d6..790c1bcf11150d31bf90c32345e4eb40de9a6a41 100644
index fb00f70505a6c548cd1311d7ea55c6a501e814e3..4df9a3356cfdee52761db47694e59779976840db 100644
--- a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
+++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
@@ -99,7 +99,7 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
@@ -228,7 +228,7 @@ index 5a72fa0d72bfdb927293abe921c57f6ae964a6ec..f8344f640f119e3865f2718d1abd0ede
private void uncaughtException(final Thread thread, final Throwable thr) {
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 7683c12d48d23dd43bce3d3b5633029c596930a5..ab61d18845827ac835edf92651d0b510358106ff 100644
index cc8364891a5d2196e8809479db984b67b5bcb079..7c67a8a6cf83ab80d3a8b37c5ff03e7a56497bc9 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -236,7 +236,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -275,10 +275,10 @@ index 534f103234eb92571c664cbcfea4ce4e990d3ea8..c4d9d890db784d376b876d70f0468df6
// CraftBukkit start
private final ResourceKey<LevelStem> typeKey;
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 264de9099b19779f20ad23c41d0967670759ae12..ab6229ee412cf2aa5affc87510230c587765080b 100644
index 5668906866917f7bb6088ae16146d917d2b840b0..4efbd0f840d74a3d96b28d38e48cba72d5c6fb9b 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1705,7 +1705,30 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1694,7 +1694,30 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
ServerLevel origin = this.level();
ServerPlayer.RespawnConfig respawnConfig = this.getRespawnConfig();
@@ -310,7 +310,7 @@ index 264de9099b19779f20ad23c41d0967670759ae12..ab6229ee412cf2aa5affc87510230c58
// modified based off PlayerList#respawn
@@ -1756,8 +1779,8 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1745,8 +1768,8 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
// now the respawn logic is complete
// last, call the function callback
@@ -429,7 +429,7 @@ index 48f51b0f94df3e59c9410129489c63a4287bc0bc..2682f8702785b1e501748a308c5e394b
private final Vec2 spawnAngle;
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 8c909108a0c468f353837787188c12f907369b9b..1dd0ce3f8af52f5ba0da1d6617489a0de2c971b2 100644
index 9270b887448023b6ace2e7fae6b632755ce90600..66ddbdb130867a508ba161a570d101dbe6353246 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -392,6 +392,9 @@ public abstract class Entity
@@ -495,7 +495,7 @@ index 8c909108a0c468f353837787188c12f907369b9b..1dd0ce3f8af52f5ba0da1d6617489a0d
return true;
}
@@ -4864,6 +4886,13 @@ public abstract class Entity
@@ -4868,6 +4890,13 @@ public abstract class Entity
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(initialPosition),
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkZ(initialPosition)
);
@@ -509,7 +509,7 @@ index 8c909108a0c468f353837787188c12f907369b9b..1dd0ce3f8af52f5ba0da1d6617489a0d
// first, remove entity/passengers from world
EntityTreeNode passengerTree = this.detachPassengers();
@@ -4921,6 +4950,10 @@ public abstract class Entity
@@ -4925,6 +4954,10 @@ public abstract class Entity
if (info.postTeleportTransition() != null) {
info.postTeleportTransition().onTransition(teleported);
}
@@ -53,3 +53,15 @@ index c4d9d890db784d376b876d70f0468df6edb75168..0641b98ef3298eb682ceae83f60b730f
} finally { foliaProfiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.ENTITY_TICK); } // Folia - profiler
if (this.paperConfig().unsupportedSettings.ticking.blockEntities) { // Paper - option to disable ticking
profiler.popPush("blockEntities");
diff --git a/net/minecraft/world/entity/EntityType.java b/net/minecraft/world/entity/EntityType.java
index 6efaa78faca15c7a48bdffb24480d1bac29f3ba8..31619890f1bd4f458b6f9a31fac8cefaafe09e8e 100644
--- a/net/minecraft/world/entity/EntityType.java
+++ b/net/minecraft/world/entity/EntityType.java
@@ -73,6 +73,7 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T>,
private final float spawnDimensionsScale;
private final FeatureFlagSet requiredFeatures;
private final boolean allowedInPeaceful;
+ public volatile dev.kaiijumc.kaiiju.KaiijuEntityLimits.EntityLimit entityLimit;
public static Identifier getKey(final EntityType<?> type) {
return BuiltInRegistries.ENTITY_TYPE.getKey(type);
@@ -8,10 +8,10 @@ As part of: Kaiiju (https://github.com/KaiijuMC/Kaiiju/blob/c2b7aec8f7b418a39a2e
Licensed under: GPL-3.0 (https://github.com/KaiijuMC/Kaiiju/blob/c2b7aec8f7b418a39a2ec408e6411e6f752379da/LICENSE)
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 1dd0ce3f8af52f5ba0da1d6617489a0de2c971b2..cf70a8e2fe2fe70bcdf71f8112479031d80d8b75 100644
index 66ddbdb130867a508ba161a570d101dbe6353246..df82f900580ad1b71960eab890a7a6215f578421 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4676,14 +4676,18 @@ public abstract class Entity
@@ -4676,15 +4676,19 @@ public abstract class Entity
targetPos, 16, // load 16 blocks to be safe from block physics
ca.spottedleaf.concurrentutil.util.Priority.HIGH,
(chunks) -> {
@@ -28,13 +28,14 @@ index 1dd0ce3f8af52f5ba0da1d6617489a0de2c971b2..cf70a8e2fe2fe70bcdf71f8112479031
portalInfoCompletable.complete(
new net.minecraft.world.level.portal.TeleportTransition(
- destination, Vec3.atBottomCenterOf(targetPos.below()), Vec3.ZERO, Direction.WEST.toYRot(), 0.0f,
- Relative.union(Relative.DELTA, Set.of(Relative.X_ROT)),
+ destination, finalPos, this.getDeltaMovement(), Direction.WEST.toYRot(), 0.0f, // Kaiiju - Vanilla end teleportation
false, false,
- Relative.union(Relative.DELTA, Set.of(Relative.X_ROT)),
+ /*Relative.union(Relative.DELTA, Set.of(Relative.X_ROT))*/Set.of(), // Kaiiju - Vanilla end teleportation
TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET),
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL
)
@@ -4698,11 +4702,15 @@ public abstract class Entity
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL,
TeleportTransition.PassengerTeleportationMode.POSITION_RIDER
@@ -4700,11 +4704,15 @@ public abstract class Entity
ca.spottedleaf.concurrentutil.util.Priority.HIGH,
(chunks) -> {
BlockPos adjustedSpawn = destination.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, spawnPos);
@@ -49,10 +50,10 @@ index 1dd0ce3f8af52f5ba0da1d6617489a0de2c971b2..cf70a8e2fe2fe70bcdf71f8112479031
new net.minecraft.world.level.portal.TeleportTransition(
- destination, Vec3.atBottomCenterOf(adjustedSpawn), Vec3.ZERO, 0.0f, 0.0f,
+ destination, finalPos, this.getDeltaMovement(), 0.0f, 0.0f, // Kaiiju - Vanilla end teleportation
false, false,
Relative.union(Relative.DELTA, Relative.ROTATION),
TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET),
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL
@@ -4881,6 +4889,10 @@ public abstract class Entity
@@ -4885,6 +4893,10 @@ public abstract class Entity
return false;
}
@@ -63,7 +64,7 @@ index 1dd0ce3f8af52f5ba0da1d6617489a0de2c971b2..cf70a8e2fe2fe70bcdf71f8112479031
Vec3 initialPosition = this.position();
ChunkPos initialPositionChunk = new ChunkPos(
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(initialPosition),
@@ -4955,9 +4967,14 @@ public abstract class Entity
@@ -4959,9 +4971,14 @@ public abstract class Entity
destination.levelUnloadStateLock.releaseRead();
// Luminol end
@@ -5,7 +5,7 @@ Subject: [PATCH] Add config for server mod name
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index ab61d18845827ac835edf92651d0b510358106ff..d4e31bb829451a687bf567fd0357f46fd7d46902 100644
index 7c67a8a6cf83ab80d3a8b37c5ff03e7a56497bc9..b2823c71ecb5e1f7a3c4c5b9f691d4cdb5419db3 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -2072,7 +2072,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -27,7 +27,7 @@ index 480b6b2405706fd4d7158d0e160adafd84099887..137389f7ee97fc3a15c8f5f87c058065
}
}
diff --git a/net/minecraft/world/level/block/EndPortalBlock.java b/net/minecraft/world/level/block/EndPortalBlock.java
index d42bb2a1721e4ab8c9956e18c3ca418b8d648c59..4f06daf619596d4116140b0710ea92c2c8552fc0 100644
index 123df098fa987030fe3789f36ff95aeee2979834..35b0632faf2709f65f731cd42e575ee967937254 100644
--- a/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/net/minecraft/world/level/block/EndPortalBlock.java
@@ -76,6 +76,12 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal {
@@ -5,7 +5,7 @@ Subject: [PATCH] Add config for vanilla random
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index cf70a8e2fe2fe70bcdf71f8112479031d80d8b75..17650e196f1e5b79765651bf302291873a4eb509 100644
index df82f900580ad1b71960eab890a7a6215f578421..39f2b44846c02796a3671a5dec75b7b34d8c488e 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -298,7 +298,7 @@ public abstract class Entity
@@ -5,7 +5,7 @@ Subject: [PATCH] Add force the data command to be enabled config
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
index bc9f6cc286536b87513de81855ad0b61cf787c84..afbaf2116930d72ebb0c77745d02115abab14dc4 100644
index 4ddb5e7ce3529466c3930caa9aa6b18158e9a63d..9b1dcfadd6d5ae868b087a18983d03e8bb86b56a 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -202,7 +202,9 @@ public class Commands {
@@ -6,7 +6,7 @@ Subject: [PATCH] Add back read-only datapack command & Fix datapack command
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
index afbaf2116930d72ebb0c77745d02115abab14dc4..6823c41c08ca1a1baf9257fc861ae97bbcbe3a50 100644
index 9b1dcfadd6d5ae868b087a18983d03e8bb86b56a..21f2b9866e1cf36421e10a945fb6fbaa251009ed 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -205,7 +205,7 @@ public class Commands {
@@ -19,7 +19,7 @@ index afbaf2116930d72ebb0c77745d02115abab14dc4..6823c41c08ca1a1baf9257fc861ae97b
DefaultGameModeCommands.register(this.dispatcher);
//DialogCommand.register(this.dispatcher, context); // Folia - region threading - TODO
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index d4e31bb829451a687bf567fd0357f46fd7d46902..4f292468194baae343eeb077362e51dcfb6c0df1 100644
index b2823c71ecb5e1f7a3c4c5b9f691d4cdb5419db3..a82cafadf2136d30ae7bca172062713a651373ac 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -2415,6 +2415,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -17,7 +17,7 @@ index 52dcbcf64c3a510d4a4524b7d0ee226d9a73511d..051d601e7e809518e8d82ae4ae325905
}
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 4f292468194baae343eeb077362e51dcfb6c0df1..f0a3fdaf7e9d342b472b3db42f5b59b0f6691b49 100644
index a82cafadf2136d30ae7bca172062713a651373ac..e43aa6daa8d4465764348be5b82be5f163ef0819 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1743,7 +1743,46 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -106,7 +106,7 @@ index 0641b98ef3298eb682ceae83f60b730f3bf90103..cea4bc7036dfd8777c151a0dd811fc13
}
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index ab6229ee412cf2aa5affc87510230c587765080b..f0c574e039f80ff0227239356de8d61ef06a0936 100644
index 4efbd0f840d74a3d96b28d38e48cba72d5c6fb9b..8e4bbb224d036cf9f33667aec57bbc339c9e8377 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -441,7 +441,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -183,10 +183,10 @@ index f03fa06c0ba56f7f5e1e45bc1568a490751efde3..eee1c14249addbf4714df733870da974
+ // KioCG end
}
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 17650e196f1e5b79765651bf302291873a4eb509..f218b7f6ce32d7ac959255e59c620d6fd420bf8e 100644
index 39f2b44846c02796a3671a5dec75b7b34d8c488e..fe0208815dbf53855d47956925b817570f6ae5b0 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -6468,4 +6468,6 @@ public abstract class Entity
@@ -6479,4 +6479,6 @@ public abstract class Entity
return ((ServerLevel) this.level()).isPositionEntityTicking(this.blockPosition());
}
// Paper end
@@ -100,7 +100,7 @@ index 58e557923dfe6cee39ec45e7f5aa43a5ded9f107..57a35d7a801621fc461e896eb2bba533
this.scheduler.regionFailed(this, false, thr);
// regionFailed will schedule a shutdown, so we should avoid letting this region tick further
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
index 6823c41c08ca1a1baf9257fc861ae97bbcbe3a50..0fa14f60310b063f419620539fd40898627b46b9 100644
index 21f2b9866e1cf36421e10a945fb6fbaa251009ed..aa7931c9b6dc3bba2c8dfecff8df2db302ad905b 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -259,7 +259,11 @@ public class Commands {
@@ -5,10 +5,10 @@ Subject: [PATCH] Add missing teleportation event APIs for folia
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index f0c574e039f80ff0227239356de8d61ef06a0936..093c48e2379c01f45277b88f6c1b19b107a46326 100644
index 8e4bbb224d036cf9f33667aec57bbc339c9e8377..4397f77d0169a3eefd347d3097657de4f6d37ef8 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1814,6 +1814,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1803,6 +1803,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
if (finalRespawnCompleteCallback != null) { // Luminol - Level hot unload apis
finalRespawnCompleteCallback.accept(ServerPlayer.this); // Luminol - Level hot unload apis
}
@@ -19,7 +19,7 @@ index f0c574e039f80ff0227239356de8d61ef06a0936..093c48e2379c01f45277b88f6c1b19b1
);
});
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index f218b7f6ce32d7ac959255e59c620d6fd420bf8e..2ae0cf7c9a4febfa79a9eab2f0e9309a61a78f56 100644
index fe0208815dbf53855d47956925b817570f6ae5b0..90b5d7806af8913735c4105b6e347bfdb78094e0 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4553,6 +4553,31 @@ public abstract class Entity
@@ -72,7 +72,7 @@ index f218b7f6ce32d7ac959255e59c620d6fd420bf8e..2ae0cf7c9a4febfa79a9eab2f0e9309a
// need to load chunks so we can create the platform
destination.moonrise$loadChunksAsync(
targetPos, 16, // load 16 blocks to be safe from block physics
@@ -4696,6 +4732,17 @@ public abstract class Entity
@@ -4698,6 +4734,17 @@ public abstract class Entity
);
} else {
BlockPos spawnPos = destination.getRespawnData().pos();
@@ -90,7 +90,7 @@ index f218b7f6ce32d7ac959255e59c620d6fd420bf8e..2ae0cf7c9a4febfa79a9eab2f0e9309a
// need to load chunk for heightmap
destination.moonrise$loadChunksAsync(
spawnPos, 0,
@@ -4751,7 +4798,17 @@ public abstract class Entity
@@ -4755,7 +4802,17 @@ public abstract class Entity
WorldBorder destinationBorder = destination.getWorldBorder();
double dimensionScale = net.minecraft.world.level.dimension.DimensionType.getTeleportationScale(origin.dimensionType(), destination.dimensionType());
BlockPos targetPos = destination.getWorldBorder().clampToBounds(this.getX() * dimensionScale, this.getY(), this.getZ() * dimensionScale);
@@ -108,7 +108,7 @@ index f218b7f6ce32d7ac959255e59c620d6fd420bf8e..2ae0cf7c9a4febfa79a9eab2f0e9309a
ca.spottedleaf.concurrentutil.completable.CallbackCompletable<BlockUtil.FoundRectangle> portalFound
= new ca.spottedleaf.concurrentutil.completable.CallbackCompletable<>();
@@ -4888,6 +4945,15 @@ public abstract class Entity
@@ -4892,6 +4949,15 @@ public abstract class Entity
if (!this.canPortalAsync(destination, takePassengers)) {
return false;
}
@@ -69,7 +69,7 @@ index f32d118e1e925b2155cef3fcdcb1e194c541e242..2d5d4170e1f45ae9113c37623b406686
// this is copy on write to allow packet processing to iterate safely
private final CopyOnWriteArrayList<ServerPlayer> localPlayers = new CopyOnWriteArrayList<>();
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index f0a3fdaf7e9d342b472b3db42f5b59b0f6691b49..ac49bcc53951c025de0160fd8afd319b1f3d1347 100644
index e43aa6daa8d4465764348be5b82be5f163ef0819..f4274e844018992bba7c32d2146198efc034631e 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1973,6 +1973,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -5,7 +5,7 @@ Subject: [PATCH] Add config for waypoint restoration
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
index 0fa14f60310b063f419620539fd40898627b46b9..9800ae1d3c49800b0c7342d43d696109b5b72cf4 100644
index aa7931c9b6dc3bba2c8dfecff8df2db302ad905b..c67ea715f02086e5a39cc5832ccdc0b32199db93 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -267,7 +267,7 @@ public class Commands {
@@ -18,7 +18,7 @@ index 0fa14f60310b063f419620539fd40898627b46b9..9800ae1d3c49800b0c7342d43d696109
WorldBorderCommand.register(this.dispatcher);
if (JvmProfiler.INSTANCE.isAvailable()) {
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index ac49bcc53951c025de0160fd8afd319b1f3d1347..c91902632d0e97b814e387454b119edb62b67413 100644
index f4274e844018992bba7c32d2146198efc034631e..42ee15c813761702031d5a63f0d080b135be2e0f 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -3127,8 +3127,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -47,7 +47,7 @@ index 402e2f01f2b3a8e9ce5c818f07581b4dab38fc26..a1c3f3e5c7c3f32e0bdead33ebd72c76
//this.updateSkyBrightness(); // Folia - region threading - delay until first tick
// Paper start - rewrite chunk system
diff --git a/net/minecraft/world/waypoints/WaypointTransmitter.java b/net/minecraft/world/waypoints/WaypointTransmitter.java
index 2866b750a28cc32c2913d3c1afee95f05956982c..f0b62f49382eb808dcd6b6b654b99b9f7763c342 100644
index 07af92310ee5c8bba04e6175b6faac629632e4de..79561456c3b0877974ae1519443ebf8bd07533da 100644
--- a/net/minecraft/world/waypoints/WaypointTransmitter.java
+++ b/net/minecraft/world/waypoints/WaypointTransmitter.java
@@ -76,7 +76,8 @@ public interface WaypointTransmitter extends Waypoint {
@@ -8,7 +8,7 @@ A part of Leaf(https://github.com/Winds-Studio/Leaf/blob/edb0504069139beaa6f39ef
License: https://github.com/Winds-Studio/Leaf/blob/edb0504069139beaa6f39efa4702370c2576b3fc/LICENSE.md
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index c91902632d0e97b814e387454b119edb62b67413..4b6f961e695155db1d6cc86496491017bf3a6383 100644
index 42ee15c813761702031d5a63f0d080b135be2e0f..1736816e26c255645d62696814cd539ee1ffed8d 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -217,7 +217,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -240,7 +240,7 @@ index 6e08d50794c4af4405f3e164a3fd46f376b3f78f..dd2d0940eece3e85078e574f66f71a4c
int getContainerSize();
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 2ae0cf7c9a4febfa79a9eab2f0e9309a61a78f56..6b3c691dcc9c9e4a8b2b43110aedd5d5131a9520 100644
index 90b5d7806af8913735c4105b6e347bfdb78094e0..0ba8f401c9cd0e15187b4faee78667c543fded92 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -324,7 +324,7 @@ public abstract class Entity
@@ -266,7 +266,7 @@ index 2ae0cf7c9a4febfa79a9eab2f0e9309a61a78f56..6b3c691dcc9c9e4a8b2b43110aedd5d5
if (copy instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon dragon) dragon.syncDragonPartsAfterTeleportTransform(); // Luminol - Sync dragon part when teleportation or firstly created
// vanilla code used to call remove _after_ copying, and some stuff is required to be after copy - so add hook here
// for example, clearing of inventory after switching dimensions
@@ -6140,8 +6142,29 @@ public abstract class Entity
@@ -6151,8 +6153,29 @@ public abstract class Entity
this.setBoundingBox(this.makeBoundingBox());
}
// Paper end - Block invalid positions and bounding box
@@ -10,7 +10,7 @@ VMP (https://github.com/RelativityMC/VMP-fabric)
Licensed under: MIT (https://opensource.org/licenses/MIT)
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 6b3c691dcc9c9e4a8b2b43110aedd5d5131a9520..d1298c499f6551d7a084f2d1ccd2a2b8b9a2475b 100644
index 0ba8f401c9cd0e15187b4faee78667c543fded92..ae0504263666103a588b6855cb27304582c38938 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1155,8 +1155,14 @@ public abstract class Entity
@@ -28,7 +28,7 @@ index 6b3c691dcc9c9e4a8b2b43110aedd5d5131a9520..d1298c499f6551d7a084f2d1ccd2a2b8
final Vec3 originalMovement = delta; // Paper - Expose pre-collision velocity
// Paper start - detailed watchdog information
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main");
@@ -5634,6 +5640,11 @@ public abstract class Entity
@@ -5645,6 +5651,11 @@ public abstract class Entity
}
public final void setBoundingBox(final AABB bb) {
@@ -20,7 +20,7 @@ As part of: Akarin (https://github.com/Akarin-project/Akarin)
Licensed under: GPL-3.0-only (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index d1298c499f6551d7a084f2d1ccd2a2b8b9a2475b..1888210d014f9c00316059a7ccce086dfb0e3a0f 100644
index ae0504263666103a588b6855cb27304582c38938..92cb0b1722bd5bcf9996c3f6b9b62c980b70e229 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -2441,8 +2441,8 @@ public abstract class Entity
@@ -7,7 +7,7 @@ License: GPL-3.0-only (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://github.com/GaleMC/Gale
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 1888210d014f9c00316059a7ccce086dfb0e3a0f..00bc928a19cb877698b34b7c039bee5fe8b5cda5 100644
index 92cb0b1722bd5bcf9996c3f6b9b62c980b70e229..43e07a3c98e80f874f55411beac39e215ffdc3cf 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1302,8 +1302,17 @@ public abstract class Entity
@@ -137,7 +137,7 @@ index 2e71a1cbabf3405e3e4fd5349a1784d895e7e60c..42de919064680b1a464d813976ca5e69
if (!itemStack.isEmpty()) {
slots.add(Pair.of(slot, itemStack.copy()));
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 093c48e2379c01f45277b88f6c1b19b107a46326..b4d8cc8b520266abe1921b5e990c34fce3f1d982 100644
index 4397f77d0169a3eefd347d3097657de4f6d37ef8..42e09148519596f95fc9c9c63df9c87e6ece3102 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1424,7 +1424,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -5,7 +5,7 @@ Subject: [PATCH] Server I18n
diff --git a/net/minecraft/locale/Language.java b/net/minecraft/locale/Language.java
index 47cd33bce908744e64356b585853d6a8ecf82443..9e6f89ac7cf730bfc3c15d5a4f648c550cf72e22 100644
index 47cd33bce908744e64356b585853d6a8ecf82443..bb4011d3c6a1d2a5aa66e68fe719cd5eea2c0dd2 100644
--- a/net/minecraft/locale/Language.java
+++ b/net/minecraft/locale/Language.java
@@ -37,6 +37,7 @@ public abstract class Language {
@@ -26,10 +26,10 @@ index 47cd33bce908744e64356b585853d6a8ecf82443..9e6f89ac7cf730bfc3c15d5a4f648c55
loadFromJson(stream, output);
} catch (IOException | JsonParseException e) {
diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java
index 2a75f8fbd2e5f41ca138740319d34683915e3b5b..0cc56b19d68f34994c9dbae578609eca7b7343cb 100644
index a557d488e4e289a61aeb9aed0cc133a0a7ce8f8c..ca349619bcdd0682c9d66d54fc55cac268fc443b 100644
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -158,6 +158,8 @@ public class Main {
@@ -167,6 +167,8 @@ public class Main {
return;
}
@@ -5,7 +5,7 @@ Subject: [PATCH] Add config to enable cross region damage trace
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index b4d8cc8b520266abe1921b5e990c34fce3f1d982..93c76c2faf75bf4901ecaba1e04d957d5ddddfca 100644
index 42e09148519596f95fc9c9c63df9c87e6ece3102..444753590d3bc96ce68e25a3834d7abb86e20f94 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1448,6 +1448,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -31,7 +31,7 @@ index 97c514673a454b752ab86b944fd143725ca8090d..ba91d40d6d91588a4b39abfefcb17a36
private final Reference2ReferenceOpenHashMap<RegionizedData<?>, Object> regionizedData = new Reference2ReferenceOpenHashMap<>();
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
index 9800ae1d3c49800b0c7342d43d696109b5b72cf4..f9a8c79640ed6ca381e4482eaeab6b23db59419f 100644
index c67ea715f02086e5a39cc5832ccdc0b32199db93..946094713bdb294d7d8beb03967b2a2488f5359b 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -299,7 +299,11 @@ public class Commands {
@@ -48,7 +48,7 @@ index 9800ae1d3c49800b0c7342d43d696109b5b72cf4..f9a8c79640ed6ca381e4482eaeab6b23
SaveOnCommand.register(this.dispatcher);
SetPlayerIdleTimeoutCommand.register(this.dispatcher);
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 4b6f961e695155db1d6cc86496491017bf3a6383..e7f7f7927fc1e2ce45ea5dbf7cc9ec19197c599f 100644
index 1736816e26c255645d62696814cd539ee1ffed8d..a0c285d2cb666d0f9bd0e859e0dac414254325c3 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1652,6 +1652,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -5,7 +5,7 @@ Subject: [PATCH] Add config to enable function command
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
index f9a8c79640ed6ca381e4482eaeab6b23db59419f..1b2d3e2c23e8e03ae25e85a60b6ef0528e627f61 100644
index 946094713bdb294d7d8beb03967b2a2488f5359b..3d9e8c5ba567efd363e0ed54059f67fbfe25e361 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -217,7 +217,11 @@ public class Commands {
@@ -5,7 +5,7 @@ Subject: [PATCH] Add config to enable scoreboard command
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
index 1b2d3e2c23e8e03ae25e85a60b6ef0528e627f61..916b5c8d524ffd7ccb953fe0f1cf020a1ea8dafb 100644
index 3d9e8c5ba567efd363e0ed54059f67fbfe25e361..6642288dde528899d9bce7ccd8d92a199e8975c8 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -246,7 +246,11 @@ public class Commands {
@@ -5,7 +5,7 @@ Subject: [PATCH] Add config to enable trigger command
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
index 916b5c8d524ffd7ccb953fe0f1cf020a1ea8dafb..03f3fe221b14f0317947d74e25049bcce2ebeb66 100644
index 6642288dde528899d9bce7ccd8d92a199e8975c8..77d7d83cc781baf19593227d20b827bf0be6ed28 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -274,7 +274,11 @@ public class Commands {
@@ -18,7 +18,7 @@ index 163999d50213e0167eb09f0eae883388849f28fa..5196431f52e81608a5575f8a262cd5c8
double rangeY = level.paperConfig().entities.trackingRangeY.get(this.entity, -1);
if (rangeY != -1) {
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 00bc928a19cb877698b34b7c039bee5fe8b5cda5..db7281fcf1f4dc878a87ef9b8f24f2f9da12238a 100644
index 43e07a3c98e80f874f55411beac39e215ffdc3cf..cddf44f5da5cba5603dcff4913b4658dcfcc48db 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -164,7 +164,7 @@ public abstract class Entity
@@ -30,7 +30,7 @@ index 00bc928a19cb877698b34b7c039bee5fe8b5cda5..db7281fcf1f4dc878a87ef9b8f24f2f9
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
static boolean isLevelAtLeast(ValueInput input, int level) {
@@ -6579,4 +6579,48 @@ public abstract class Entity
@@ -6590,4 +6590,48 @@ public abstract class Entity
// Paper end
public boolean shouldTickHot() { return this.tickCount > 20 * 10 && this.isAlive(); } // KioCG
@@ -80,10 +80,10 @@ index 00bc928a19cb877698b34b7c039bee5fe8b5cda5..db7281fcf1f4dc878a87ef9b8f24f2f9
+ // Lophine end - Add config to enable raytracing tracker
}
diff --git a/net/minecraft/world/entity/EntityType.java b/net/minecraft/world/entity/EntityType.java
index 6efaa78faca15c7a48bdffb24480d1bac29f3ba8..8a328a41673a3d720f0b1a5de8ce049e360fac1b 100644
index 31619890f1bd4f458b6f9a31fac8cefaafe09e8e..50643bd0b546a1ff70031ea39e2610f219ef8a79 100644
--- a/net/minecraft/world/entity/EntityType.java
+++ b/net/minecraft/world/entity/EntityType.java
@@ -84,6 +84,11 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T>,
@@ -85,6 +85,11 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T>,
public final int passengerTickTimerId;
public final int passengerInactiveTickTimerId;
// Folia end - profiler
@@ -5,7 +5,7 @@ Subject: [PATCH] Spawn invulnerable time
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 93c76c2faf75bf4901ecaba1e04d957d5ddddfca..2985d5e2dde049a999a39f6edbb6696332f6d822 100644
index 444753590d3bc96ce68e25a3834d7abb86e20f94..e64db3045ebf08600283a47960005827c1920f94 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -245,6 +245,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -36,7 +36,7 @@ index 08e253662a2c183c0ab53a51cc07485cff33bf2c..1bd678d668a1febc129f4cb4d0d95ea2
};
}
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index e7f7f7927fc1e2ce45ea5dbf7cc9ec19197c599f..1f13f7b016b4256e92989d83003a983d6ba1c750 100644
index a0c285d2cb666d0f9bd0e859e0dac414254325c3..9614a22c4b67e5e3a46e46fa69d22c136d4beb4b 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -2016,6 +2016,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -33,7 +33,7 @@ index d2e9d46bbd9ee4ce45419b11499d7a7bc50f0219..848967dbe41694411603ef369cfdc3a0
private final java.util.concurrent.atomic.AtomicBoolean disconnectionHandled = new java.util.concurrent.atomic.AtomicBoolean(false); // Folia - region threading - may be called concurrently during configuration stage
private int receivedPackets;
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 1f13f7b016b4256e92989d83003a983d6ba1c750..f76e40f8bbea076ad620f7525d4d8666603a5175 100644
index 9614a22c4b67e5e3a46e46fa69d22c136d4beb4b..5bc6baf2a13b78f65e5851a22ca79dbcaed957b2 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -296,6 +296,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -344,7 +344,7 @@ index cb11830c2f399c9706b20f8104686dc0d9b686f9..1c4c67410849f844946e4883585910fc
ServerLevel.this.updateSleepingPlayerList();
}
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 2985d5e2dde049a999a39f6edbb6696332f6d822..64943c193ae73795ddf8222a6f71ea5eb1705fe2 100644
index e64db3045ebf08600283a47960005827c1920f94..a3d3a602ab86e27ae0c6e6207384dc0043279d47 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -232,7 +232,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -377,7 +377,7 @@ index 2985d5e2dde049a999a39f6edbb6696332f6d822..64943c193ae73795ddf8222a6f71ea5e
AABB aabb = new AABB(this.blockPosition()).inflate(32.0, 10.0, 32.0);
this.level()
.getEntitiesOfClass(Mob.class, aabb, EntitySelector.NO_SPECTATORS)
@@ -2161,6 +2161,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -2140,6 +2140,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.lastSentHealth = -1.0F;
this.lastSentFood = -1;
this.teleportSpectators(transition, oldLevel);
@@ -542,7 +542,7 @@ index ca1e635b0fdf3d0d17447b43a558fe030536d297..ed50484ca24ef24b1e5bef9f6369dfa4
public @Nullable ServerPlayer getPlayer(final String playerName) {
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index db7281fcf1f4dc878a87ef9b8f24f2f9da12238a..b11637543c3ef8650ad5c65c2cab8a1cb6e95158 100644
index cddf44f5da5cba5603dcff4913b4658dcfcc48db..9eaed81a330a22e7fd6585cd286ec61371e97272 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1263,7 +1263,7 @@ public abstract class Entity
@@ -88,7 +88,7 @@ index 6c05b9276bdc267a36376f6c64592a50e4b2b36e..21d2c97b3d1e1d29c9de02b6acd58985
result.add(player);
if (result.size() >= limit) {
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index f76e40f8bbea076ad620f7525d4d8666603a5175..77bbc527b017c2ac42ebe4638457caf32868e3f6 100644
index 5bc6baf2a13b78f65e5851a22ca79dbcaed957b2..803faa6b80a42d16687ea8b109973938d02f4a36 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1909,7 +1909,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -311,7 +311,7 @@ index 1c4c67410849f844946e4883585910fc8fe97048..08a6fc0e58d61b1765e704c500b3aec6
}
// Leaves end - skip
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f8501255adc 100644
index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..575b4eabcaac48ae87b69dd037493ebfe0a1212c 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -129,6 +129,7 @@ public abstract class PlayerList {
@@ -330,12 +330,12 @@ index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f85
int count = this.usersCountedAgainstLimit.size();
if (count >= limit) {
return false;
@@ -221,6 +223,123 @@ public abstract class PlayerList {
@@ -221,6 +223,124 @@ public abstract class PlayerList {
abstract public void loadAndSaveFiles(); // Paper - fix converting txt to json file; moved from DedicatedPlayerList constructor
+ // Leaves start - replay mod api
+ public void placeNewPhotographer(Connection connection, org.leavesmc.leaves.replay.ServerPhotographer player, ServerLevel worldserver) {
+ public void placeNewPhotographer(org.leavesmc.leaves.replay.Recorder connection, org.leavesmc.leaves.replay.ServerPhotographer player, ServerLevel worldserver) {
+ player.isRealPlayer = true; // Paper
+ player.loginTime = System.currentTimeMillis(); // Paper
+
@@ -347,6 +347,7 @@ index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f85
+ LevelData worlddata = worldserver1.getLevelData();
+
+ ServerGamePacketListenerImpl playerconnection = new ServerGamePacketListenerImpl(this.server, connection, player, CommonListenerCookie.createInitial(player.gameProfile, false));
+ connection.bind(playerconnection);
+ GameRules gamerules = worldserver1.getGameRules();
+ boolean flag = gamerules.get(GameRules.IMMEDIATE_RESPAWN);
+ boolean flag1 = gamerules.get(GameRules.REDUCED_DEBUG_INFO);
@@ -454,7 +455,7 @@ index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f85
public void placeNewPlayer(final Connection connection, final ServerPlayer player, final CommonListenerCookie cookie) {
player.isRealPlayer = true; // Paper
player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed
@@ -295,6 +414,7 @@ public abstract class PlayerList {
@@ -295,6 +415,7 @@ public abstract class PlayerList {
// player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); // CraftBukkit - replaced with loop below
this.players.add(player);
@@ -462,7 +463,7 @@ index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f85
this.playersByName.put(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT), player); // Spigot
this.playersByUUID.put(player.getUUID(), player);
// this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player))); // CraftBukkit - replaced with loop below
@@ -510,6 +630,7 @@ public abstract class PlayerList {
@@ -510,6 +631,7 @@ public abstract class PlayerList {
}
protected void save(final ServerPlayer player) {
@@ -470,7 +471,7 @@ index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f85
if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit
player.lastSave = System.nanoTime(); // Folia - region threading - changed to nanoTime tracking
this.playerIo.save(player);
@@ -524,6 +645,48 @@ public abstract class PlayerList {
@@ -524,6 +646,48 @@ public abstract class PlayerList {
}
}
@@ -519,7 +520,7 @@ index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f85
public net.kyori.adventure.text.@Nullable Component remove(final ServerPlayer player) { // CraftBukkit - return string // Paper - return Component
// Paper start - Fix kick event leave message not being sent
return this.remove(player, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? player.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(player.getDisplayName())));
@@ -597,6 +760,7 @@ public abstract class PlayerList {
@@ -597,6 +761,7 @@ public abstract class PlayerList {
player.getBukkitEntity().packetProcessor.close(); // Folia - region threading
player.getAdvancements().clearTriggers();
this.players.remove(player);
@@ -527,7 +528,7 @@ index ed50484ca24ef24b1e5bef9f6369dfa4b30c359c..64a87785048e103c10f6453e97a37f85
this.playersByName.remove(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
if (me.earthme.luminol.config.modules.misc.UsernameCheckConfig.allowOldPlayersJoin) this.playedPlayers.remove(player.getGameProfile().name()); // Leaf - Configurable vanilla username check
this.server.getCustomBossEvents().onPlayerDisconnect(player);
@@ -910,15 +1074,15 @@ public abstract class PlayerList {
@@ -910,15 +1075,15 @@ public abstract class PlayerList {
}
public String[] getPlayerNamesArray() {
@@ -36,7 +36,7 @@ index 20fa23988efbfb50c664fa48cc823adbe8e6ce58..1a95ccd745f4789225d711ab6fe497c6
throw PacketUtils.makeReportedException(e, this.packet, this.listener);
}
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 77bbc527b017c2ac42ebe4638457caf32868e3f6..6ba62c5c6af4fc060442de8dfb069d5fe8ac0c69 100644
index 803faa6b80a42d16687ea8b109973938d02f4a36..6c5cdfebb3a362c51b3b940397e10536dc67afc8 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1998,11 +1998,30 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -98,7 +98,7 @@ index ae88e57974f631ff2494c35d6e02049ba5d38014..6b8073023833fc9e99684944802dc594
}
}
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 64943c193ae73795ddf8222a6f71ea5eb1705fe2..4034b4b9bd5e567b882169b5b1e17f75b64ba8db 100644
index a3d3a602ab86e27ae0c6e6207384dc0043279d47..70f7cb6b38a90ca337bd52c18fa7bfd4016b552c 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1111,6 +1111,12 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -115,7 +115,7 @@ index 64943c193ae73795ddf8222a6f71ea5eb1705fe2..4034b4b9bd5e567b882169b5b1e17f75
CrashReport report = CrashReport.forThrowable(t, "Ticking player");
CrashReportCategory category = report.addCategory("Player being ticked");
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index b11637543c3ef8650ad5c65c2cab8a1cb6e95158..426e033e033147f5db6c2d9c96ab13af0fc553a8 100644
index 9eaed81a330a22e7fd6585cd286ec61371e97272..acc9caf8559cd341ea17d3b58f13cdac7de18564 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1522,8 +1522,18 @@ public abstract class Entity
@@ -128,7 +128,7 @@ index 8cc4fe9feb57902a4b9a6a26e6175ac00a2cef65..9ab1a812e43145120859734075e2ac99
// Paper start - fix converting txt to json file; moved from constructor
}
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 4034b4b9bd5e567b882169b5b1e17f75b64ba8db..4c53b688ed6b26ca7231841f3235f9a824416bba 100644
index 70f7cb6b38a90ca337bd52c18fa7bfd4016b552c..9a6f18fd0eb7e2aef174b25d14cfd0f5a3ade6af 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -260,6 +260,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -139,7 +139,7 @@ index 4034b4b9bd5e567b882169b5b1e17f75b64ba8db..4c53b688ed6b26ca7231841f3235f9a8
private @Nullable Vec3 startingToFallPosition;
private @Nullable Vec3 enteredNetherPosition;
private @Nullable Vec3 enteredLavaOnVehiclePosition;
@@ -2168,7 +2169,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -2147,7 +2148,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.lastSentFood = -1;
this.teleportSpectators(transition, oldLevel);
// Leaves start - bot support
@@ -148,7 +148,7 @@ index 4034b4b9bd5e567b882169b5b1e17f75b64ba8db..4c53b688ed6b26ca7231841f3235f9a8
this.server.getBotList().bots.forEach(bot -> bot.sendFakeDataIfNeed(this, true)); // Leaves - render bot
}
// Leaves end - bot support
@@ -2805,6 +2806,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -2784,6 +2785,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.setShoulderEntityRight(oldPlayer.getShoulderEntityRight());
this.setLastDeathLocation(oldPlayer.getLastDeathLocation());
this.waypointIcon().copyFrom(oldPlayer.waypointIcon());
@@ -160,7 +160,7 @@ index 4034b4b9bd5e567b882169b5b1e17f75b64ba8db..4c53b688ed6b26ca7231841f3235f9a8
}
private void transferInventoryXpAndScore(final Player oldPlayer) {
@@ -3084,6 +3090,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -3063,6 +3069,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.particleStatus = information.particleStatus();
this.getEntityData().set(DATA_PLAYER_MODE_CUSTOMISATION, (byte)information.modelCustomisation());
this.getEntityData().set(DATA_PLAYER_MAIN_HAND, information.mainHand());
@@ -268,10 +268,10 @@ index 77b9cd3d14eddc735d9131597916405fde4230ec..b23a47380fb1178696dc49e35d2c3d7d
} else {
LOGGER.warn("Player {} was dropping items too fast in creative mode, ignoring.", this.player.getPlainTextName());
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index 64a87785048e103c10f6453e97a37f8501255adc..432a6dfff8e45eccea653b0d4cf04956edec6d98 100644
index 575b4eabcaac48ae87b69dd037493ebfe0a1212c..516561a25d28f2c7bcc3e71c5f2f9da99c2899c3 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -279,7 +279,7 @@ public abstract class PlayerList {
@@ -280,7 +280,7 @@ public abstract class PlayerList {
// org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); // Leaves - protocol
// Leaves start - bot support
@@ -280,7 +280,7 @@ index 64a87785048e103c10f6453e97a37f8501255adc..432a6dfff8e45eccea653b0d4cf04956
org.leavesmc.leaves.bot.ServerBot bot = this.server.getBotList().getBotByName(player.getScoreboardName());
if (bot != null) {
this.server.getBotList().removeBot(bot, org.leavesmc.leaves.event.bot.BotRemoveEvent.RemoveReason.INTERNAL, player.getBukkitEntity(), false, false);
@@ -441,7 +441,7 @@ public abstract class PlayerList {
@@ -442,7 +442,7 @@ public abstract class PlayerList {
org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); // Leaves - protocol
// Leaves start - bot support
@@ -289,7 +289,7 @@ index 64a87785048e103c10f6453e97a37f8501255adc..432a6dfff8e45eccea653b0d4cf04956
org.leavesmc.leaves.bot.ServerBot bot = this.server.getBotList().getBotByName(player.getScoreboardName());
if (bot != null) {
this.server.getBotList().removeBot(bot, org.leavesmc.leaves.event.bot.BotRemoveEvent.RemoveReason.INTERNAL, player.getBukkitEntity(), false, false);
@@ -969,7 +969,7 @@ public abstract class PlayerList {
@@ -970,7 +970,7 @@ public abstract class PlayerList {
).callEvent();
// Paper end
// Leaves start - bot support
@@ -40,7 +40,7 @@ index 57a35d7a801621fc461e896eb2bba533d9d5bc1b..ae424c8931a2f82c6c8d4ddd8422a2c1
}
// Luminol end - Add a config to enable tick command
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
index 03f3fe221b14f0317947d74e25049bcce2ebeb66..6882e85fb6413e5c346c189a82b69f3e408aafba 100644
index 77d7d83cc781baf19593227d20b827bf0be6ed28..82af03649c7537274aa54ed942e4aae589b97888 100644
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -268,7 +268,7 @@ public class Commands {
@@ -21,10 +21,10 @@ index dd17339fe2f9d7660b20eed05b61d6231302aa82..d997e4f7ae6ee4e81f5fffe874f2895d
}
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 4c53b688ed6b26ca7231841f3235f9a824416bba..cef9c7887332b91e2466a97a5250db81f7af0dcf 100644
index 9a6f18fd0eb7e2aef174b25d14cfd0f5a3ade6af..b43bbe461500782a75a49c9238bd4d4d81448d09 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -2360,7 +2360,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -2339,7 +2339,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
public boolean isInvulnerableTo(final ServerLevel level, final DamageSource source) {
// Paper start - disable player cramming
return (super.isInvulnerableTo(level, source) || this.isChangingDimension() && !source.is(DamageTypes.ENDER_PEARL) || !this.connection.hasClientLoaded())
@@ -5,7 +5,7 @@ Subject: [PATCH] Restore vanilla ender pearl loading
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index cef9c7887332b91e2466a97a5250db81f7af0dcf..a17212c1910ce9490fe8df8c4ef507e25b89c545 100644
index b43bbe461500782a75a49c9238bd4d4d81448d09..68e36ad03325cd6348dc4bbab37409b70bee6023 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -277,7 +277,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -51,7 +51,7 @@ index cef9c7887332b91e2466a97a5250db81f7af0dcf..a17212c1910ce9490fe8df8c4ef507e2
}
}
@@ -3568,11 +3570,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -3547,11 +3549,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
}
public void registerEnderPearl(final ThrownEnderpearl enderPearl) {
@@ -66,10 +66,10 @@ index cef9c7887332b91e2466a97a5250db81f7af0dcf..a17212c1910ce9490fe8df8c4ef507e2
public Set<ThrownEnderpearl> getEnderPearls() {
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index 432a6dfff8e45eccea653b0d4cf04956edec6d98..835c13ff69592951261f917ad999d9a7689e802c 100644
index 516561a25d28f2c7bcc3e71c5f2f9da99c2899c3..eb652157ef25e83b897f52aff3c49c09c6f656c8 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -748,11 +748,13 @@ public abstract class PlayerList {
@@ -749,11 +749,13 @@ public abstract class PlayerList {
player.unRide();
for (ThrownEnderpearl enderpearl : player.getEnderPearls()) {
@@ -89,7 +89,7 @@ index 432a6dfff8e45eccea653b0d4cf04956edec6d98..835c13ff69592951261f917ad999d9a7
level.removePlayerImmediately(player, Entity.RemovalReason.UNLOADED_WITH_PLAYER);
diff --git a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
index 790c1bcf11150d31bf90c32345e4eb40de9a6a41..7409b452567608dbdb36ac686791e604a267fb6a 100644
index 4df9a3356cfdee52761db47694e59779976840db..3e6844a468d8e6c9cf3b0bd23e21a3cabc9b7f51 100644
--- a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
+++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
@@ -31,7 +31,11 @@ import net.minecraft.world.phys.Vec3;
@@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Tue, 28 Jul 2026 15:08:10 +0800
Subject: [PATCH] Anonymous Object: Fix wrong variable passing in
RegionizedWorldData
As requested by the original author, this patch will be anonymous and hide the original commit address.
This patch is used with permission from the original author.
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/io/papermc/paper/threadedregions/RegionizedWorldData.java b/io/papermc/paper/threadedregions/RegionizedWorldData.java
index 3a50e625160d0dad6bd8fa534b719087dae7881d..20439c632044ae9b4358bfba309b378b3de98601 100644
--- a/io/papermc/paper/threadedregions/RegionizedWorldData.java
+++ b/io/papermc/paper/threadedregions/RegionizedWorldData.java
@@ -841,7 +841,7 @@ public final class RegionizedWorldData {
}
public void setTickingBlockEntities(final boolean to) {
- this.tickingBlockEntities = true;
+ this.tickingBlockEntities = to; // Anonymous - Fix wrong variable passing in RegionizedWorldData
}
public List<TickingBlockEntity> getBlockEntityTickers() {
@@ -0,0 +1,25 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Tue, 28 Jul 2026 15:08:28 +0800
Subject: [PATCH] Anonymous Object: Fix wrong variable passing in
ThreadedRegionizer
As requested by the original author, this patch will be anonymous and hide the original commit address.
This patch is used with permission from the original author.
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/io/papermc/paper/threadedregions/ThreadedRegionizer.java b/io/papermc/paper/threadedregions/ThreadedRegionizer.java
index a346b96500ae859e9469c80e2ff6b39c4d3d0b52..73e0aeb5a5e9bdd1f275dd64d1fffa32c389052d 100644
--- a/io/papermc/paper/threadedregions/ThreadedRegionizer.java
+++ b/io/papermc/paper/threadedregions/ThreadedRegionizer.java
@@ -755,8 +755,8 @@ public final class ThreadedRegionizer<R extends ThreadedRegionizer.ThreadedRegio
final int x1 = CoordinateUtils.getChunkX(k1);
final int x2 = CoordinateUtils.getChunkX(k2);
- final int z1 = CoordinateUtils.getChunkZ(x1);
- final int z2 = CoordinateUtils.getChunkZ(x2);
+ final int z1 = CoordinateUtils.getChunkZ(k1); // Anonymous - Fix wrong variable passing in ThreadedRegionizer
+ final int z2 = CoordinateUtils.getChunkZ(k2); // Anonymous - Fix wrong variable passing in ThreadedRegionizer
final int zCompare = Integer.compare(z1, z2);
if (zCompare != 0) {
@@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Tue, 28 Jul 2026 15:08:42 +0800
Subject: [PATCH] Anonymous Object: Fix wrong ticket update determination in
RegionizedTaskQueue
As requested by the original author, this patch will be anonymous and hide the original commit address.
This patch is used with permission from the original author.
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/io/papermc/paper/threadedregions/RegionizedTaskQueue.java b/io/papermc/paper/threadedregions/RegionizedTaskQueue.java
index b264dbd13a392cde3f24ff75c0034985fda68ccc..fe0a6bd90cba4869a0ee11723832f2dee5039f62 100644
--- a/io/papermc/paper/threadedregions/RegionizedTaskQueue.java
+++ b/io/papermc/paper/threadedregions/RegionizedTaskQueue.java
@@ -289,14 +289,17 @@ public final class RegionizedTaskQueue {
boolean executeTickTasks = allowedTickTasks > 0;
boolean executeChunkTasks = allowedChunkTasks > 0;
boolean executeGlobalTasks = true;
+ boolean processedChunkTask = false; // Anonymous - Fix wrong ticket update determination in RegionizedTaskQueue
do {
executeTickTasks = executeTickTasks && allowedTickTasks-- > 0 && tickTaskQueue.executeTask();
executeChunkTasks = executeChunkTasks && allowedChunkTasks-- > 0 && chunkTaskQueue.executeTask();
executeGlobalTasks = executeGlobalTasks && this.worldRegionTaskData.executeGlobalChunkTask();
+
+ processedChunkTask |= (executeChunkTasks | executeGlobalTasks); // Anonymous - Fix wrong ticket update determination in RegionizedTaskQueue
} while (executeTickTasks | executeChunkTasks | executeGlobalTasks);
- if (allowedChunkTasks > 0) {
+ if (processedChunkTask) { // Anonymous - Fix wrong ticket update determination in RegionizedTaskQueue
// if we executed chunk tasks, we should try to process ticket updates for full status changes
this.worldRegionTaskData.world.moonrise$getChunkTaskScheduler().chunkHolderManager.processTicketUpdates();
}
@@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Tue, 28 Jul 2026 15:09:06 +0800
Subject: [PATCH] Anonymous Object: Lithium optimized collections for
WeightedList
As requested by the original author, this patch will be anonymous and hide the original commit address.
This patch is used with permission from the original author.
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/net/minecraft/util/random/WeightedList.java b/net/minecraft/util/random/WeightedList.java
index a8481259e42aa116e29bccd1e30fdfd91f51a8cc..49a558d6021db2d57eb2596206ea459fd33485e0 100644
--- a/net/minecraft/util/random/WeightedList.java
+++ b/net/minecraft/util/random/WeightedList.java
@@ -23,7 +23,7 @@ public class WeightedList<E> { // Paper - non-final
private final WeightedList.@Nullable Selector<E> selector;
protected WeightedList(final List<? extends Weighted<E>> items) { // Paper - protected
- this.items = List.copyOf(items);
+ this.items = items.size() > 4 ? new net.caffeinemc.mods.lithium.common.util.collections.HashedReferenceList(items) : new it.unimi.dsi.fastutil.objects.ReferenceArrayList<>(items); // Anonymous - Lithium optimized collections for WeightedList
this.totalWeight = WeightedRandom.getTotalWeight(items, Weighted::weight);
if (this.totalWeight == 0) {
this.selector = null;
@@ -0,0 +1,282 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Tue, 28 Jul 2026 15:09:19 +0800
Subject: [PATCH] Anonymous Object: Lithium optimized non poi block searching
As requested by the original author, this patch will be anonymous and hide the original commit address.
This patch is used with permission from the original author.
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
index c6e9b155c2341c13d569f28f54f0c1d2d7313676..927635518c51375315390877d582b32fc38748df 100644
--- a/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
+++ b/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
@@ -5,7 +5,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.PathfinderMob;
import net.minecraft.world.level.LevelReader;
-public abstract class MoveToBlockGoal extends Goal {
+public abstract class MoveToBlockGoal extends Goal implements net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.LithiumMoveToBlockGoal { // Anonymous - Lithium Optimizes move to block goal
private static final int GIVE_UP_TICKS = 1200;
private static final int STAY_TICKS = 1200;
private static final int INTERVAL_TICKS = 200;
@@ -133,4 +133,167 @@ public abstract class MoveToBlockGoal extends Goal {
}
protected abstract boolean isValidTarget(LevelReader level, BlockPos pos);
+ // Anonymous start - Lithium Optimizes move to block goal
+ /**
+ * Finds the nearest block matching the predicates.
+ * <p>
+ * Side effect: The matching block position is stored in the blockPos field.
+ *
+ * @return Whether a matching block was found.
+ */
+ @Override
+ public boolean lithium$findNearestBlock(java.util.function.Predicate<net.minecraft.world.level.block.state.BlockState> requiredBlock, java.util.function.BiPredicate<net.minecraft.world.level.chunk.ChunkAccess,
+ BlockPos.MutableBlockPos> lithium$isValidTarget, final boolean shouldChunkLoad) {
+ //Center of the search starts 1 block below the mob's block position
+ BlockPos center = this.mob.blockPosition().offset(0,-1,0);
+
+ //Range is +-(searchRange - 1), +-verticalSearchRange, +-(searchRange - 1)
+ //Cache ChunkAccesses - getting them is surprisingly expensive - and track whether subchunks have the block
+ final LevelReader levelReader = this.mob.level();
+ net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.CheckAndCacheBlockChecker checker = new net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.CheckAndCacheBlockChecker(center,
+ this.searchRange-1, this.verticalSearchRange,
+ levelReader, requiredBlock, shouldChunkLoad);
+ it.unimi.dsi.fastutil.longs.LongArrayList sortedChunksMaybeWithBlock = new it.unimi.dsi.fastutil.longs.LongArrayList(checker.getChunkSize());
+ checker.initializeChunks(sortedChunksMaybeWithBlock::addLast);
+
+ if (checker.shouldStop()) {
+ return false; //No chunks with the target block - return early
+ }
+
+ final int minY = net.caffeinemc.mods.lithium.common.util.Pos.BlockCoord.getMinY(levelReader);
+ final int maxY = net.caffeinemc.mods.lithium.common.util.Pos.BlockCoord.getMaxYInclusive(levelReader);
+
+ // Prefer chunk aware search because it also cuts iterations inside "empty" chunk sections
+ if(!checker.hasUnloadedPossibleChunks()){
+ return this.lithium$chunkAwareSearch(center, lithium$isValidTarget, checker, sortedChunksMaybeWithBlock, minY, maxY);
+ }
+
+ // Use vanilla search because unordered search may observably alter chunk-loading behavior
+ return this.lithium$vanillaOrderSearch(center, lithium$isValidTarget, checker, minY, maxY);
+ }
+
+ private boolean lithium$vanillaOrderSearch(BlockPos center,
+ java.util.function.BiPredicate<net.minecraft.world.level.chunk.ChunkAccess, BlockPos.MutableBlockPos> lithium$isValidTarget,
+ net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.CheckAndCacheBlockChecker checker, final int minY, final int maxY) {
+ BlockPos.MutableBlockPos currentPos = new BlockPos.MutableBlockPos();
+ final int centerY = center.getY();
+
+ for (int layer = this.verticalSearchStart; layer <= this.verticalSearchRange; layer = layer > 0 ? -layer : 1 - layer) {
+ final int y = centerY + layer;
+
+ // Layer outside of build limit - skip
+ // Note: this is likely to be hit because farms where this lags tend to be built at world floor
+ if (y < minY || y > maxY) {
+ continue;
+ }
+
+ for (int ring = 0; ring < this.searchRange; ring++) {
+ for (int dX = 0; dX <= ring; dX = dX > 0 ? -dX : 1 - dX) {
+ for (int dZ = dX < ring && dX > -ring ? ring : 0; dZ <= ring; dZ = dZ > 0 ? -dZ : 1 - dZ) {
+ currentPos.setWithOffset(center, dX, layer, dZ);
+ if (this.mob.isWithinHome(currentPos) && checker.checkPosition(currentPos)) {
+ // ChunkAccess is always loaded at this point
+ net.minecraft.world.level.chunk.ChunkAccess chunkAccess = checker.getCachedChunkAccess(currentPos);
+ if (lithium$isValidTarget.test(chunkAccess, currentPos)){
+ this.blockPos = currentPos;
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private boolean lithium$chunkAwareSearch(BlockPos center,
+ java.util.function.BiPredicate<net.minecraft.world.level.chunk.ChunkAccess, BlockPos.MutableBlockPos> lithium$isValidTarget,
+ net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.CheckAndCacheBlockChecker checker, it.unimi.dsi.fastutil.longs.LongArrayList sortedChunksMaybeWithBlock,
+ final int minY, final int maxY) {
+ // Sort chunks by lowest sort order - has the earliest searched position
+ // Note: In this search order, the closest point normally is also the closest point in the search
+ sortedChunksMaybeWithBlock.sort((chunkLong0, chunkLong1) ->
+ net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.NonPOISearchDistances.MoveToBlockGoalDistances.getMinimumSortOrderOfChunk(center, chunkLong0)
+ - net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.NonPOISearchDistances.MoveToBlockGoalDistances.getMinimumSortOrderOfChunk(center, chunkLong1)
+ );
+
+ java.util.function.Predicate<net.minecraft.world.level.block.state.BlockState> requiredBlock = checker.blockStatePredicate;
+ final int minSectionY = checker.minSectionY;
+
+ BlockPos.MutableBlockPos foundPos = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos currentPos = new BlockPos.MutableBlockPos();
+
+ // Same layer order as vanilla - saves iterations if targets are found in the first layer
+ for (int layer = this.verticalSearchStart; layer <= this.verticalSearchRange; layer = layer > 0 ? -layer : 1 - layer) {
+ final int y = center.getY() + layer;
+
+ // Layer outside of build limit - skip
+ // Note: this is likely to be hit because farms where this lags tend to be built at world floor
+ if (y < minY || y > maxY) {
+ continue;
+ }
+
+ final int chunkY = net.minecraft.core.SectionPos.blockToSectionCoord(y);
+ final int ySectionIndex = chunkY - minSectionY;
+
+ int closestFound = Integer.MAX_VALUE;
+ int ringMax = this.searchRange - 1;
+
+ // Iterate through slices of chunks that may have the target blockState
+ for (long chunkPos: sortedChunksMaybeWithBlock) {
+ final int chunkX = net.minecraft.world.level.ChunkPos.getX(chunkPos);
+ final int chunkZ = net.minecraft.world.level.ChunkPos.getZ(chunkPos);
+
+ // Break since no subsequent chunks can be closer
+ if (closestFound < net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.NonPOISearchDistances.MoveToBlockGoalDistances.getMinimumSortOrderOfChunk(center, chunkX, chunkZ)) {
+ break;
+ }
+
+ // Skip if the current subchunk does not have the block
+ if (!checker.checkCachedSection(chunkX, chunkY, chunkZ)) {
+ continue;
+ }
+
+ net.minecraft.world.level.chunk.ChunkAccess chunkAccess = checker.getCachedChunkAccess(chunkPos);
+ // If ChunkSection may have close enough targets, iterate layer in Paletted Container (x then z) order
+ final int chunkBlockX = net.minecraft.core.SectionPos.sectionToBlockCoord(chunkX);
+ int xMin = Math.max(center.getX() - ringMax, chunkBlockX);
+ int xMax = Math.min(center.getX() + ringMax, chunkBlockX + 15);
+ final int chunkBlockZ = net.minecraft.core.SectionPos.sectionToBlockCoord(chunkZ);
+ int zMin = Math.max(center.getZ() - ringMax, chunkBlockZ);
+ int zMax = Math.min(center.getZ() + ringMax, chunkBlockZ + 15);
+ net.minecraft.world.level.chunk.LevelChunkSection levelChunkSection = chunkAccess.getSections()[ySectionIndex];
+ for (int z = zMin; z <= zMax; z++) {
+ for (int x = xMin; x <= xMax; x++) {
+ int dX = x - center.getX();
+ int dZ = z - center.getZ();
+ int ring = net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.NonPOISearchDistances.MoveToBlockGoalDistances.getRing(dX, dZ);
+ int currentDistance = net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.NonPOISearchDistances.MoveToBlockGoalDistances.getVanillaSortOrderInt(ring, dX, dZ);
+ if (currentDistance < closestFound
+ && this.mob.isWithinHome(currentPos.set(x, y, z))
+ && requiredBlock.test(levelChunkSection.getBlockState(x & 15, y & 15, z & 15))
+ && lithium$isValidTarget.test(chunkAccess, currentPos)) {
+ // Constrain search size when we find a valid target
+ ringMax = ring;
+ xMin = Math.max(center.getX() - ringMax, chunkBlockX);
+ xMax = Math.min(center.getX() + ringMax, chunkBlockX + 15);
+ zMax = Math.min(center.getZ() + ringMax, chunkBlockZ + 15);
+ foundPos.set(x, y, z);
+ closestFound = currentDistance;
+ }
+ }
+ }
+ }
+
+ if (closestFound < Integer.MAX_VALUE) {
+ // Vanilla uses the mutable pos, no need to create immutable copy
+ this.blockPos = foundPos;
+ return true;
+ }
+ }
+
+ return false;
+ }
+ // Anonymous end - Lithium Optimizes move to block goal
}
diff --git a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
index ff0f99d4b560a1c0721885b0eba5bd5ab2087bd7..99c076ee2fe0d8294398c5ef1f24a95da5eee89c 100644
--- a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
+++ b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
@@ -25,6 +25,19 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
private final Mob removerMob;
private int ticksSinceReachedGoal;
private static final int WAIT_AFTER_BLOCK_FOUND = 20;
+ // Anonymous start - Lithium Optimize remove block goal
+ private static final java.util.function.BiPredicate<ChunkAccess, BlockPos.MutableBlockPos> IS_VALID_TARGET_ABOVE_BIPREDICATE =
+ RemoveBlockGoal::lithium$isValidTargetAbove;
+ //Split check condition in order to use maybeHas
+ private boolean lithium$isValidTargetBlock(net.minecraft.world.level.block.state.BlockState blockState){
+ return blockState.is(this.blockToRemove);
+ }
+
+ private static boolean lithium$isValidTargetAbove(ChunkAccess chunkAccess, BlockPos.MutableBlockPos mutable) {
+ return chunkAccess.getBlockState(mutable.move(0, 1, 0)).isAir()
+ && chunkAccess.getBlockState(mutable.move(0, 1, 0)).isAir();
+ }
+ // Anonymous end - Lithium Optimize remove block goal
public RemoveBlockGoal(final Block blockToRemove, final PathfinderMob mob, final double speedModifier, final int verticalSearchRange) {
super(mob, speedModifier, 24, verticalSearchRange);
@@ -39,7 +52,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
} else if (this.nextStartTick > 0) {
this.nextStartTick--;
return false;
- } else if (this.findNearestBlock()) {
+ } else if (((net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.LithiumMoveToBlockGoal) this).lithium$findNearestBlock(this::lithium$isValidTargetBlock, IS_VALID_TARGET_ABOVE_BIPREDICATE, false)) { // Anonymous - Lithium Optimize remove block goal
this.nextStartTick = reducedTickDelay(20);
return true;
} else {
diff --git a/net/minecraft/world/entity/ai/sensing/HoglinSpecificSensor.java b/net/minecraft/world/entity/ai/sensing/HoglinSpecificSensor.java
index 7022679c84e184999b416e06d1af2cc2500cb12b..78743515ff2afd1ea1f06432f33f41a03fc7988b 100644
--- a/net/minecraft/world/entity/ai/sensing/HoglinSpecificSensor.java
+++ b/net/minecraft/world/entity/ai/sensing/HoglinSpecificSensor.java
@@ -16,6 +16,14 @@ import net.minecraft.world.entity.monster.hoglin.Hoglin;
import net.minecraft.world.entity.monster.piglin.Piglin;
public class HoglinSpecificSensor extends Sensor<Hoglin> {
+ // Anonymous start - Lithium Optimizes Hoglin repellent search.
+ private static final java.util.function.Predicate<net.minecraft.world.level.block.state.BlockState> IS_VALID_REPELLENT_PREDICATE =
+ HoglinSpecificSensor::lithium$isValidRepellent;
+
+ private static boolean lithium$isValidRepellent(net.minecraft.world.level.block.state.BlockState blockState) {
+ return blockState.is(BlockTags.HOGLIN_REPELLENTS);
+ }
+ // Anonymous end - Lithium Optimizes Hoglin repellent search.
@Override
public Set<MemoryModuleType<?>> requires() {
return ImmutableSet.of(
@@ -30,8 +38,8 @@ public class HoglinSpecificSensor extends Sensor<Hoglin> {
@Override
protected void doTick(final ServerLevel level, final Hoglin body) {
- Brain<?> brain = body.getBrain();
- brain.setMemory(MemoryModuleType.NEAREST_REPELLENT, this.findNearestRepellent(level, body));
+ Brain<?> brain = body.getBrain();;
+ brain.setMemory(MemoryModuleType.NEAREST_REPELLENT, net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.CommonBlockSearchesCheckAndCache.blockPosFindClosestMatch(level, body, 8, 4, IS_VALID_REPELLENT_PREDICATE, true)); // Anonymous - Lithium Optimizes Hoglin repellent search.
Optional<Piglin> adultPiglin = Optional.empty();
int adultPiglinCount = 0;
List<Hoglin> adultHoglins = Lists.newArrayList();
diff --git a/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java b/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java
index 060a53da799a3036a343cc6f1d73e3e5ca4b7af9..8594f559a5c8f5957348f7178464d5e9c5abc5ff 100644
--- a/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java
+++ b/net/minecraft/world/entity/ai/sensing/PiglinSpecificSensor.java
@@ -26,6 +26,15 @@ import net.minecraft.world.level.block.CampfireBlock;
import net.minecraft.world.level.block.state.BlockState;
public class PiglinSpecificSensor extends Sensor<LivingEntity> {
+ // Anonymous start - Lithium Optimizes Piglin repellent search.
+ private static final java.util.function.Predicate<BlockState> IS_VALID_REPELLENT_PREDICATE =
+ PiglinSpecificSensor::lithium$isValidRepellent;
+ private static boolean lithium$isValidRepellent(BlockState blockState){
+ final boolean isPiglinRepellent = blockState.is(BlockTags.PIGLIN_REPELLENTS);
+ return isPiglinRepellent && blockState.is(Blocks.SOUL_CAMPFIRE) ?
+ CampfireBlock.isLitCampfire(blockState) : isPiglinRepellent;
+ }
+ // Anonymous end - Lithium Optimizes Piglin repellent search.
@Override
public Set<MemoryModuleType<?>> requires() {
return ImmutableSet.of(
@@ -47,7 +56,7 @@ public class PiglinSpecificSensor extends Sensor<LivingEntity> {
@Override
protected void doTick(final ServerLevel level, final LivingEntity body) {
Brain<?> brain = body.getBrain();
- brain.setMemory(MemoryModuleType.NEAREST_REPELLENT, findNearestRepellent(level, body));
+ brain.setMemory(MemoryModuleType.NEAREST_REPELLENT, net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.CommonBlockSearchesCheckAndCache.blockPosFindClosestMatch(level, body, 8, 4, IS_VALID_REPELLENT_PREDICATE, true)); // Anonymous - Lithium Optimizes Piglin repellent search.
Optional<Mob> nemesis = Optional.empty();
Optional<Hoglin> huntableHoglin = Optional.empty();
Optional<Hoglin> babyHoglin = Optional.empty();
@@ -0,0 +1,69 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Tue, 28 Jul 2026 20:40:01 +0800
Subject: [PATCH] Anonymous Object: Fix folia nether portal ticket placement
As requested by the original author, this patch will be anonymous and hide the original commit address.
This patch is used with permission from the original author.
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/net/minecraft/util/BlockUtil.java b/net/minecraft/util/BlockUtil.java
index ea93ac07ec6d4e83d1d0904daf721132e2bbecc3..4252672ad2aaf03d50e5ea6a681e9964fd9a6137 100644
--- a/net/minecraft/util/BlockUtil.java
+++ b/net/minecraft/util/BlockUtil.java
@@ -138,12 +138,20 @@ public class BlockUtil {
public final BlockPos minCorner;
public final int axis1Size;
public final int axis2Size;
+ public BlockPos foundOrigin; // Anonymous - Fix folia nether portal ticket placement
public FoundRectangle(final BlockPos minCorner, final int axis1Size, final int axis2Size) {
this.minCorner = minCorner;
this.axis1Size = axis1Size;
this.axis2Size = axis2Size;
+ this.foundOrigin = minCorner; // Anonymous - Fix folia nether portal ticket placement - prevent edge conditions(idk if someone would do this so just prevent it)
}
+ // Anonymous start - Fix folia nether portal ticket placement
+ public FoundRectangle withFoundOrigin(BlockPos origin) {
+ this.foundOrigin = origin;
+ return this;
+ }
+ // Anonymous end
}
public static class IntBounds {
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index acc9caf8559cd341ea17d3b58f13cdac7de18564..489011f9af49fa3407038bd2f00439443307d179 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4851,7 +4851,7 @@ public abstract class Entity
portalInfoCompletable.complete(
new TeleportTransition(destination, Vec3.atCenterOf(targetPos), Vec3.ZERO,
90.0f, 0.0f,
- TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET))
+ TeleportTransition.PLAY_PORTAL_SOUND.then(ent -> ent.placePortalTicket(targetPos))) // Anonymous - Fix folia nether portal ticket placement
);
return;
}
@@ -4863,7 +4863,7 @@ public abstract class Entity
portalInfoCompletable.complete(
net.minecraft.world.level.block.NetherPortalBlock.createDimensionTransition(
destination, portal, originalPortalDirection, relativePos,
- Entity.this, TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET)
+ Entity.this, TeleportTransition.PLAY_PORTAL_SOUND.then(ent -> ent.placePortalTicket(portal.foundOrigin)) // Anonymous - Fix folia nether portal ticket placement
)
);
}
diff --git a/net/minecraft/world/level/block/NetherPortalBlock.java b/net/minecraft/world/level/block/NetherPortalBlock.java
index 29fc9521c2c8333c999647dd833899393a838064..e8d2b52a3948755c8d3912a4ad1204cea5f78674 100644
--- a/net/minecraft/world/level/block/NetherPortalBlock.java
+++ b/net/minecraft/world/level/block/NetherPortalBlock.java
@@ -204,7 +204,7 @@ public class NetherPortalBlock extends Block implements Portal {
return BlockUtil.getLargestRectangleAround(found, portalState.getValue(BlockStateProperties.HORIZONTAL_AXIS), 21, Direction.Axis.Y, 21, (pos) -> {
return world.getBlockStateFromEmptyChunk(pos) == portalState;
- });
+ }).withFoundOrigin(found); // Anonymous - Fix folia nether portal ticket placement
}
// Folia end - region threading
@@ -148,10 +148,10 @@ index f5373786032b3f1db8e6c0c928c781998b2fe194..ca6be9faab3f93da7e91bf73997111b7
CraftParticle.createParticleParam(particle, data), // Particle
force,
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index efcb8b97cd685e1243c770bf3e8daf03615abb1d..4722e027ed5869516adddf696ac030fd84df834d 100644
index 00749be3b16fd09c6b952c93631c808ff5657f20..0f6378ca80bea5d4d7f1cb7d788a57390bc27c59 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -128,6 +128,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -130,6 +130,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return new CraftHumanEntity(server, (net.minecraft.world.entity.player.Player) entity);
}
@@ -54,10 +54,10 @@ index 7fd08dac549261c50cf5723ef380ba90ea0da56f..7cfa9a5a1629c3af1e1105b137cbfc4c
+ // Leaves end - replay mod api
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 4722e027ed5869516adddf696ac030fd84df834d..4d20f07ff4bf782e938ac990e2b9aaeb90b92db1 100644
index 0f6378ca80bea5d4d7f1cb7d788a57390bc27c59..610e19b82919f05b0ebf20854e0f9b4a77a2b063 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -129,6 +129,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -131,6 +131,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
if (entity instanceof org.leavesmc.leaves.bot.ServerBot bot) { return new org.leavesmc.leaves.entity.bot.CraftBot(server, bot); }
@@ -4,6 +4,7 @@ import ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO;
import com.github.luben.zstd.ZstdInputStream;
import com.github.luben.zstd.ZstdOutputStream;
import com.mojang.logging.LogUtils;
import io.anonymous.anonymous.data.RegionFile;
import net.jpountz.lz4.LZ4Compressor;
import net.jpountz.lz4.LZ4Factory;
import net.jpountz.lz4.LZ4FastDecompressor;
@@ -26,7 +27,7 @@ import java.util.concurrent.locks.ReentrantLock;
// LinearRegionFile_implementation_version_0_5byXymb
// Just gonna use this string to inform other forks about updates ;-)
public class LinearRegionFile implements IRegionFile {
public class LinearRegionFile implements RegionFile {
private static final long SUPERBLOCK = 0xc3ff13183cca9d9aL;
private static final byte VERSION = 3;
private static final int HEADER_SIZE = 27;
@@ -489,15 +490,15 @@ public class LinearRegionFile implements IRegionFile {
public DataOutputStream getChunkDataOutputStream(ChunkPos pos) {
openRegionFile();
openBucket(pos.x(), pos.z());
return new DataOutputStream(new BufferedOutputStream(new LinearRegionFile.ChunkBuffer(pos)));
return new DataOutputStream(new BufferedOutputStream(new ChunkBuffer(pos)));
}
@Override
public MoonriseRegionFileIO.RegionDataController.WriteData moonrise$startWrite(CompoundTag data, ChunkPos pos) throws IOException {
final DataOutputStream out = this.getChunkDataOutputStream(pos);
return new ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController.WriteData(
data, ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController.WriteData.WriteResult.WRITE,
return new MoonriseRegionFileIO.RegionDataController.WriteData(
data, MoonriseRegionFileIO.RegionDataController.WriteData.WriteResult.WRITE,
out, regionFile -> out.close()
);
}
@@ -21,5 +21,4 @@ public final class MathUtilities {
int i = (int) d;
return d > (double) i ? i + 1 : i;
}
}
@@ -19,51 +19,35 @@ package dev.kaiijumc.kaiiju;
import com.google.common.base.Throwables;
import com.mojang.logging.LogUtils;
import io.github.classgraph.ClassGraph;
import io.github.classgraph.ClassInfo;
import io.github.classgraph.ScanResult;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import net.minecraft.world.entity.Entity;
import net.minecraft.core.Holder;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.Identifier;
import net.minecraft.world.entity.EntityType;
import org.bukkit.Bukkit;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.jspecify.annotations.NonNull;
import org.slf4j.Logger;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.logging.Level;
@SuppressWarnings("unused")
public class KaiijuEntityLimits {
private static final Logger LOGGER = LogUtils.getLogger();
private static final File CONFIG_FOLDER = new File("luminol_config");
private static final File CONFIG_FOLDER = new File("shiroha_config");
protected static final String HEADER =
"Per region entity limits for Kaiiju.\n"
+ "If there are more of particular entity type in a region than limit, entity ticking will be throttled.\n"
+ "Example: for Wither limit 100 & 300 Withers in a region -> 100 Withers tick every tick & every Wither ticks every 3 ticks.\n"
+ "Available entities: GlowSquid, Ambient, Bat, Animal, Bee, Cat, Chicken, Cod, Cow, Dolphin, Fish, FishSchool, Fox, Golem, IronGolem, "
+ "MushroomCow, Ocelot, Panda, Parrot, Perchable, Pig, PolarBear, PufferFish, Rabbit, Salmon, Sheep, Snowman, Squid, TropicalFish, Turtle, "
+ "WaterAnimal, Wolf, Allay, Axolotl, Camel, Frog, Tadpole, Goat, Horse, HorseAbstract, HorseChestedAbstract, HorseDonkey, HorseMule, "
+ "HorseSkeleton, HorseZombie, Llama, LlamaTrader, Sniffer, EnderCrystal, EnderDragon, Wither, ArmorStand, Hanging, ItemFrame, Leash, "
+ "Painting, GlowItemFrame, FallingBlock, Item, TNTPrimed, Blaze, CaveSpider, Creeper, Drowned, Enderman, Endermite, Evoker, Ghast, "
+ "GiantZombie, Guardian, GuardianElder, IllagerAbstract, IllagerIllusioner, IllagerWizard, MagmaCube, Monster, MonsterPatrolling, Phantom, "
+ "ZombifiedPiglin, Pillager, Ravager, Shulker, Silverfish, Skeleton, SkeletonAbstract, SkeletonStray, SkeletonWither, Slime, Spider, Strider, Vex, "
+ "Vindicator, Witch, Zoglin, Zombie, ZombieHusk, ZombieVillager, Hoglin, Piglin, PiglinAbstract, PiglinBrute, Warden, Villager, "
+ "VillagerTrader, Arrow, DragonFireball, Egg, EnderPearl, EnderSignal, EvokerFangs, Fireball, FireballFireball, Fireworks, FishingHook, "
+ "LargeFireball, LlamaSpit, Potion, Projectile, ProjectileThrowable, ShulkerBullet, SmallFireball, Snowball, SpectralArrow, ThrownExpBottle, "
+ "ThrownTrident, TippedArrow, WitherSkull, Raider, ChestBoat, Boat, MinecartAbstract, MinecartChest, MinecartCommandBlock, MinecartContainer, "
+ "MinecartFurnace, MinecartHopper, MinecartMobSpawner, MinecartRideable, MinecartTNT\n";
+ "Entity names are named under the registry of minecraft's entity type";
protected static final File ENTITY_LIMITS_FILE = new File(CONFIG_FOLDER, "kaiiju_entity_limits.yml");
public static YamlConfiguration entityLimitsConfig;
public static boolean enabled = false;
protected static Map<Class<? extends Entity>, EntityLimit> entityLimits;
static final String ENTITY_PREFIX = "Entity";
public static void init() {
init(true);
}
@@ -84,8 +68,9 @@ public class KaiijuEntityLimits {
entityLimitsConfig.options().header(HEADER);
entityLimitsConfig.options().copyDefaults(true);
entityLimitsConfig.set("enabled", enabled);
entityLimitsConfig.set("Axolotl.limit", 1000);
entityLimitsConfig.set("Axolotl.removal", 2000);
entityLimitsConfig.set("axolotl.limit", 1000);
entityLimitsConfig.set("axolotl.removal", 2000);
try {
entityLimitsConfig.save(ENTITY_LIMITS_FILE);
} catch (IOException ex) {
@@ -96,62 +81,42 @@ public class KaiijuEntityLimits {
enabled = entityLimitsConfig.getBoolean("enabled");
entityLimits = new Object2ObjectOpenHashMap<>();
try (ScanResult scanResult = new ClassGraph().enableAllInfo().acceptPackages("net.minecraft.world.entity").scan()) {
Map<String, ClassInfo> entityClasses = new HashMap<>();
for (ClassInfo classInfo : scanResult.getAllClasses()) {
Class<?> entityClass = Class.forName(classInfo.getName());
if (Entity.class.isAssignableFrom(entityClass)) {
String entityName = extractEntityName(entityClass.getSimpleName());
entityClasses.put(entityName, classInfo);
}
}
for (String key : entityLimitsConfig.getKeys(false)) {
if (key.equals("enabled")) {
continue;
}
if (!entityClasses.containsKey(key)) {
LOGGER.error("Unknown entity '" + key + "' in kaiiju-entity-limits.yml, skipping");
continue;
}
int limit = entityLimitsConfig.getInt(key + ".limit");
int removal = entityLimitsConfig.getInt(key + ".removal");
if (limit < 1) {
LOGGER.error(key + " has a limit less than the minimum of 1, ignoring");
continue;
}
if (removal <= limit && removal != -1) {
LOGGER.error(key + " has a removal limit that is less than or equal to its limit, setting removal to limit * 10");
removal = limit * 10;
}
entityLimits.put((Class<? extends Entity>) Class.forName(entityClasses.get(key).getName()), new EntityLimit(limit, removal));
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
if (!enabled) {
return;
}
}
public static EntityLimit getEntityLimit(Entity entity) {
return entityLimits.get(entity.getClass());
}
for (String key : entityLimitsConfig.getKeys(false)) {
if (key.equals("enabled")) {
continue;
}
private static String extractEntityName(String input) {
int prefixLength = ENTITY_PREFIX.length();
final Optional<Holder.Reference<EntityType<?>>> lookup = BuiltInRegistries.ENTITY_TYPE.get(Identifier.fromNamespaceAndPath(Identifier.DEFAULT_NAMESPACE, key));
if (lookup.isEmpty()) {
LOGGER.error("Unknown entity '{}' in kaiiju-entity-limits.yml, skipping", key);
continue;
}
if (input.length() <= prefixLength || !input.startsWith(ENTITY_PREFIX)) {
return input;
} else {
return input.substring(prefixLength);
final EntityType<?> value = lookup.get().value();
int limit = entityLimitsConfig.getInt(key + ".limit");
int removal = entityLimitsConfig.getInt(key + ".removal");
if (limit < 1) {
LOGGER.error("{} has a limit less than the minimum of 1, ignoring", key);
continue;
}
if (removal <= limit && removal != -1) {
LOGGER.error("{} has a removal limit that is less than or equal to its limit, setting removal to limit * 10", key);
removal = limit * 10;
}
value.entityLimit = new EntityLimit(limit, removal);
}
}
public record EntityLimit(int limit, int removal) {
@Override
public String toString() {
public @NonNull String toString() {
return "EntityLimit{limit=" + limit + ", removal=" + removal + "}";
}
}
@@ -45,7 +45,8 @@ public class KaiijuEntityThrottler {
public EntityThrottlerReturn tickLimiterShouldSkip(Entity entity) {
EntityThrottlerReturn retVal = new EntityThrottlerReturn();
if (entity.isRemoved()) return retVal;
KaiijuEntityLimits.EntityLimit entityLimit = KaiijuEntityLimits.getEntityLimit(entity);
KaiijuEntityLimits.EntityLimit entityLimit = entity.getType().entityLimit;
if (entityLimit != null) {
TickInfo tickInfo = entityLimitTickInfoMap.computeIfAbsent(entityLimit, el -> {
@@ -6,7 +6,6 @@ import me.earthme.luminol.config.ConfigsInstance;
import me.earthme.luminol.config.IConfigModule;
import me.earthme.luminol.config.flags.ConfigClassInfo;
import me.earthme.luminol.config.flags.ConfigInfo;
import me.earthme.luminol.config.flags.DoNotLoad;
import me.earthme.luminol.config.flags.HotReloadUnsupported;
import me.earthme.luminol.enums.EnumConfigCategory;
@@ -16,46 +15,15 @@ public class GlobalEntitiesCounter implements IConfigModule {
@ConfigInfo(name = "version")
public static GlobalEntitiesCounterType type = GlobalEntitiesCounterType.DISABLED;
@DoNotLoad
private static boolean enabled;
@DoNotLoad
private static boolean async;
@DoNotLoad
private static boolean defaultModule;
public static boolean isEnabled() {
return enabled;
return type.isEnabled();
}
public static boolean isAsync() {
return async;
return type.isAsync();
}
public static boolean isDefaultModule() {
return defaultModule;
}
@Override
public void beforeFinalLoad() {
ConfigsInstance configsInstance = ConfigManager.getConfigs("lophine");
try {
Boolean enabled0 = configsInstance.getConfigOrigin("experiment.global_entities_counter.enabled");
Boolean async0 = configsInstance.getConfigOrigin("experiment.global_entities_counter.async");
if (enabled0 != null) {
if (enabled0) {
if (async0 != null && async0) {
type = GlobalEntitiesCounterType.DEFAULT_ASYNC;
} else {
type = GlobalEntitiesCounterType.DEFAULT_SYNC;
}
}
}
configsInstance.removeConfig("experiment.global_entities_counter.enabled");
configsInstance.removeConfig("experiment.global_entities_counter.async");
} catch (Exception ignored) {
}
enabled = type != GlobalEntitiesCounterType.DISABLED;
async = type == GlobalEntitiesCounterType.DEFAULT_ASYNC;
defaultModule = type == GlobalEntitiesCounterType.DEFAULT_SYNC || type == GlobalEntitiesCounterType.DEFAULT_ASYNC;
return type.isDefaultModule();
}
}
@@ -1,8 +1,30 @@
package fun.bm.lophine.enums;
public enum GlobalEntitiesCounterType {
DISABLED,
DEFAULT_SYNC,
DEFAULT_ASYNC,
PRECISE
DISABLED(false, false, false),
DEFAULT_SYNC(true, false, true),
DEFAULT_ASYNC(true, true, true),
PRECISE(true, false, false);
private boolean enabled;
private boolean async;
private boolean defaultModule;
private GlobalEntitiesCounterType(boolean enabled, boolean async, boolean defaultModule) {
this.enabled = enabled;
this.async = async;
this.defaultModule = defaultModule;
}
public boolean isEnabled() {
return enabled;
}
public boolean isAsync() {
return async;
}
public boolean isDefaultModule() {
return defaultModule;
}
}
@@ -23,7 +23,6 @@ import io.sentry.Breadcrumb;
import io.sentry.Sentry;
import io.sentry.SentryEvent;
import io.sentry.SentryLevel;
import io.sentry.protocol.Message;
import io.sentry.protocol.User;
import me.earthme.luminol.config.modules.misc.SentryConfig;
import org.apache.logging.log4j.Level;
@@ -67,9 +66,6 @@ public class PufferfishSentryAppender extends AbstractAppender {
private void logException(LogEvent e) {
SentryEvent event = new SentryEvent(e.getThrown());
Message sentryMessage = new Message();
sentryMessage.setMessage(e.getMessage().getFormattedMessage());
event.setThrowable(e.getThrown());
event.setLevel(getLevel(e.getLevel()));
event.setLogger(e.getLoggerName());
@@ -26,10 +26,6 @@ public class SentryManager {
private static final Logger logger = LogManager.getLogger(SentryManager.class);
private SentryManager() {
}
private static boolean initialized = false;
public static synchronized void init(Level logLevel) {
@@ -1,10 +1,9 @@
package me.earthme.luminol.utils;
package io.anonymous.anonymous.data;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.mojang.logging.LogUtils;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectArraySet;
import me.earthme.luminol.data.BufferedLinearRegionFile;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
@@ -1,4 +1,5 @@
package abomination;
package io.anonymous.anonymous.data;
import ca.spottedleaf.moonrise.patches.chunk_system.storage.ChunkSystemRegionFile;
import net.minecraft.nbt.CompoundTag;
@@ -10,7 +11,7 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.file.Path;
public interface IRegionFile extends ChunkSystemRegionFile, AutoCloseable {
public interface RegionFile extends ChunkSystemRegionFile, AutoCloseable {
Path getPath();
DataInputStream getChunkDataInputStream(ChunkPos pos) throws IOException;
@@ -39,5 +40,5 @@ public interface IRegionFile extends ChunkSystemRegionFile, AutoCloseable {
default int getRecalculateCount() {
return 0;
} // Luminol - Configurable region file format
} // Anonymous - Configurable region file format
}
@@ -1,9 +1,9 @@
package me.earthme.luminol.enums;
package io.anonymous.anonymous.enums;
import abomination.LinearRegionFile;
import me.earthme.luminol.config.modules.function.RegionFormatConfig;
import me.earthme.luminol.data.BufferedLinearRegionFile;
import me.earthme.luminol.utils.IRegionCreateFunction;
import io.anonymous.anonymous.data.BufferedLinearRegionFile;
import io.anonymous.anonymous.utils.RegionFileFactory;
import net.minecraft.world.level.chunk.storage.RegionFile;
public enum EnumRegionFormat {
@@ -12,14 +12,14 @@ public enum EnumRegionFormat {
B_LINEAR("b_linear", (info) -> new BufferedLinearRegionFile(info.filePath(), RegionFormatConfig.linearCompressionLevel, RegionFormatConfig.blinearFlusher));
private final String argument;
private final IRegionCreateFunction creator;
private final RegionFileFactory creator;
EnumRegionFormat(String argument, IRegionCreateFunction creator) {
EnumRegionFormat(String argument, RegionFileFactory creator) {
this.argument = argument;
this.creator = creator;
}
public IRegionCreateFunction getCreator() {
public RegionFileFactory getCreator() {
return this.creator;
}
@@ -1,4 +1,4 @@
package me.earthme.luminol.utils;
package io.anonymous.anonymous.utils;
import net.minecraft.world.level.chunk.storage.RegionStorageInfo;
@@ -0,0 +1,10 @@
package io.anonymous.anonymous.utils;
import io.anonymous.anonymous.data.RegionFile;
import java.io.IOException;
@FunctionalInterface
public interface RegionFileFactory {
RegionFile newFile(RegionCreatorInfo info) throws IOException;
}
@@ -9,8 +9,8 @@ import me.earthme.luminol.config.flags.ConfigInfo;
import me.earthme.luminol.config.flags.DoNotLoad;
import me.earthme.luminol.config.flags.HotReloadUnsupported;
import me.earthme.luminol.enums.EnumConfigCategory;
import me.earthme.luminol.enums.EnumRegionFormat;
import me.earthme.luminol.utils.BufferedLinearRegionFileFlusher;
import io.anonymous.anonymous.enums.EnumRegionFormat;
import io.anonymous.anonymous.data.BufferedLinearRegionFileFlusher;
import net.minecraft.server.MinecraftServer;
import org.jetbrains.annotations.Nullable;
@@ -163,7 +163,7 @@ public final class AutoUpdateHelper {
if (finalJarPath.equals(stagedJar)) {
LOGGER.info(
"Downloaded the latest Lophine jar to {} and refreshed auto_update/core.path for Hyacinthusclip. Please restart your server.",
"Downloaded the latest Lophine jar to {} and refreshed auto_update/core.path for Clip. Please restart your server.",
finalJarPath.toAbsolutePath()
);
} else {
@@ -1,10 +0,0 @@
package me.earthme.luminol.utils;
import abomination.IRegionFile;
import java.io.IOException;
@FunctionalInterface
public interface IRegionCreateFunction {
IRegionFile create(RegionCreatorInfo info) throws IOException;
}
@@ -0,0 +1,159 @@
/*
* This file is part of Lithium
*
* Lithium is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Lithium is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Lithium. If not, see <https://www.gnu.org/licenses/>.
*/
package net.caffeinemc.mods.lithium.common.ai.non_poi_block_search;
import net.caffeinemc.mods.lithium.common.util.collections.FixedChunkAccessSectionBitBuffer;
import net.minecraft.core.BlockPos;
import net.minecraft.core.SectionPos;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.LevelChunkSection;
import net.minecraft.world.level.chunk.status.ChunkStatus;
import java.util.function.Consumer;
import java.util.function.Predicate;
/**
* This is intended to be used to optimize Non-POI block searches by pre-checking the ChunkSections, getting the
* ChunkAccesses which then allows for returning early or only calling getBlockState in possible ChunkSections.
* <p>
* Note: Please correctly specify shouldChunkLoad based on whether the getBlockState in vanilla can chunk load or not.
* The default in game is that it can. Setting it to true will mean that the search will assume that unloaded chunks
* may have the target and will chunk load then search them if and when it reaches it.
*
* @author jcw780
*/
public class CheckAndCacheBlockChecker {
private final FixedChunkAccessSectionBitBuffer chunkSections2MaybeContainsMatchingBlock;
private final LevelReader levelReader;
public final boolean shouldChunkLoad;
public final Predicate<BlockState> blockStatePredicate;
private int unloadedPossibleChunkSections = 0;
public final int minSectionY;
public CheckAndCacheBlockChecker(BlockPos origin, int horizontalRangeInclusive, int verticalRangeInclusive, LevelReader levelReader,
Predicate<BlockState> blockStatePredicate, boolean shouldChunkLoad) {
this.chunkSections2MaybeContainsMatchingBlock = new FixedChunkAccessSectionBitBuffer(origin, horizontalRangeInclusive, verticalRangeInclusive);
this.levelReader = levelReader;
this.shouldChunkLoad = shouldChunkLoad;
this.blockStatePredicate = blockStatePredicate;
this.minSectionY = levelReader.getMinSectionY();
}
public void initializeChunks() {
this.initializeChunks(null);
}
public void initializeChunks(Consumer<Long> chunkCollector) {
final boolean nullChunkCollector = chunkCollector == null;
for (long chunkPos : this.chunkSections2MaybeContainsMatchingBlock.getChunkPosInRange()) {
int x = ChunkPos.getX(chunkPos);
int z = ChunkPos.getZ(chunkPos);
boolean chunkMaybeHas = false;
//Never load chunks in the first pass to avoid observably altering chunk loading behavior
//Otherwise full region will be loaded vs partial region if the search finds the block early.
ChunkAccess chunkAccess = levelReader.getChunk(x, z, ChunkStatus.FULL, false);
if (chunkAccess != null) {
this.chunkSections2MaybeContainsMatchingBlock.setChunkAccess(chunkPos, chunkAccess);
for (int y : this.chunkSections2MaybeContainsMatchingBlock.getSectionYInRange()) {
chunkMaybeHas = this.checkChunkSection(chunkAccess, x, y, z) || chunkMaybeHas;
}
} else if (this.shouldChunkLoad) {
/* If the search may chunk load then it is possible that target blocks may be revealed when the search
* reaches it. Since we cannot load the chunks and check now, we cannot definitively exclude subchunks
* inside the chunk. This means that we must flag subchunks that are within build limit - otherwise air
* anyway - for the search.
*/
for (int y : this.chunkSections2MaybeContainsMatchingBlock.getSectionYInRange()) {
this.chunkSections2MaybeContainsMatchingBlock.setChunkSectionStatus(SectionPos.asLong(x, y, z),
!levelReader.isOutsideBuildHeight(SectionPos.sectionToBlockCoord(y)));
++this.unloadedPossibleChunkSections;
}
chunkMaybeHas = true;
}
if (!nullChunkCollector && chunkMaybeHas) {
chunkCollector.accept(chunkPos);
}
}
}
public int getChunkSize(){
return this.chunkSections2MaybeContainsMatchingBlock.numChunks;
}
public boolean hasUnloadedPossibleChunks(){
return this.unloadedPossibleChunkSections > 0;
}
private boolean checkChunkSection(ChunkAccess chunkAccess, int chunkX, int chunkY, int chunkZ) {
final int chunkSectionYIndex = chunkY - this.minSectionY;
LevelChunkSection[] chunkSections = chunkAccess.getSections();
if (chunkSectionYIndex >= 0
&& chunkSectionYIndex < chunkSections.length
&& chunkSections[chunkSectionYIndex].maybeHas(blockStatePredicate)) {
this.chunkSections2MaybeContainsMatchingBlock.setChunkSectionStatus(
SectionPos.asLong(chunkX, chunkY, chunkZ), true);
return true;
}
return false;
}
public boolean checkCachedSection(int chunkX, int chunkY, int chunkZ) {
return this.chunkSections2MaybeContainsMatchingBlock.getChunkSectionBit(chunkX, chunkY, chunkZ);
}
public ChunkAccess getCachedChunkAccess(long chunkPos) {
return this.chunkSections2MaybeContainsMatchingBlock.getChunkAccess(chunkPos);
}
public ChunkAccess getCachedChunkAccess(BlockPos blockPos) {
return this.chunkSections2MaybeContainsMatchingBlock.getChunkAccess(blockPos);
}
public boolean shouldStop(){
return this.chunkSections2MaybeContainsMatchingBlock.hasNoTrueChunkSections();
}
public boolean checkPosition(BlockPos blockPos) {
if(!this.chunkSections2MaybeContainsMatchingBlock.getChunkSectionBit(blockPos)) return false;
ChunkAccess chunkAccess = this.chunkSections2MaybeContainsMatchingBlock.getChunkAccess(blockPos);
if(chunkAccess == null) {
if (!this.shouldChunkLoad) {
return false;
}
final int chunkX = SectionPos.blockToSectionCoord(blockPos.getX());
final int chunkY = SectionPos.blockToSectionCoord(blockPos.getY());
final int chunkZ = SectionPos.blockToSectionCoord(blockPos.getZ());
chunkAccess = levelReader.getChunk(chunkX, chunkZ, ChunkStatus.FULL, true);
//this chunkAccess cannot be null and reach here because it should throw earlier
assert chunkAccess != null;
this.chunkSections2MaybeContainsMatchingBlock.setChunkAccess(blockPos, chunkAccess);
if (!checkChunkSection(chunkAccess, chunkX, chunkY, chunkZ)) {
--this.unloadedPossibleChunkSections;
return false;
}
}
return blockStatePredicate.test(chunkAccess.getBlockState(blockPos));
}
}
@@ -0,0 +1,48 @@
/*
* This file is part of Lithium
*
* Lithium is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Lithium is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Lithium. If not, see <https://www.gnu.org/licenses/>.
*/
package net.caffeinemc.mods.lithium.common.ai.non_poi_block_search;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.state.BlockState;
import java.util.Optional;
import java.util.function.Predicate;
/**
* Uses CheckAndCacheBlockChecker to improve common block searches
*/
public class CommonBlockSearchesCheckAndCache {
/**
* Optimizes BlockPos::findClosestMatch
* [Vanilla Copy] search order and chunk-loading - even though the latter is unlikely to be observable in vanilla.
*/
public static Optional<BlockPos> blockPosFindClosestMatch(LevelReader levelReader, LivingEntity livingEntity,
int horizontalRange, int verticalRange,
Predicate<BlockState> blockStatePredicate,
boolean shouldChunkLoad){
BlockPos mobPos = livingEntity.blockPosition();
CheckAndCacheBlockChecker checker = new CheckAndCacheBlockChecker(
mobPos, horizontalRange, verticalRange, levelReader, blockStatePredicate, shouldChunkLoad);
checker.initializeChunks();
if(checker.shouldStop()) {
return Optional.empty();
}
return BlockPos.findClosestMatch(mobPos, horizontalRange, verticalRange, checker::checkPosition);
}
}
@@ -0,0 +1,30 @@
/*
* This file is part of Lithium
*
* Lithium is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Lithium is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Lithium. If not, see <https://www.gnu.org/licenses/>.
*/
package net.caffeinemc.mods.lithium.common.ai.non_poi_block_search;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
import java.util.function.BiPredicate;
import java.util.function.Predicate;
public interface LithiumMoveToBlockGoal {
boolean lithium$findNearestBlock(Predicate<BlockState> requiredBlock,
BiPredicate<ChunkAccess, BlockPos.MutableBlockPos> lithium$isValidTarget,
final boolean shouldChunkLoad);
}
@@ -0,0 +1,68 @@
/*
* This file is part of Lithium
*
* Lithium is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Lithium is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Lithium. If not, see <https://www.gnu.org/licenses/>.
*/
package net.caffeinemc.mods.lithium.common.ai.non_poi_block_search;
import net.caffeinemc.mods.lithium.common.util.Distances;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.ChunkPos;
public class NonPOISearchDistances {
public static class MoveToBlockGoalDistances {
public static int getMinimumSortOrderOfChunk(BlockPos center, final long chunkPos) {
return getMinimumSortOrderOfChunk(center, ChunkPos.getX(chunkPos), ChunkPos.getZ(chunkPos));
}
public static int getMinimumSortOrderOfChunk(BlockPos center, final int chunkX, final int chunkZ) {
final int dX = Distances.getClosestBlockCoordInSection(center.getX(), chunkX) - center.getX();
final int dZ = Distances.getClosestBlockCoordInSection(center.getZ(), chunkZ) - center.getZ();
//This will always get the closest one due to the nature of the search
return getVanillaSortOrderInt(getRing(dX, dZ), dX, dZ);
}
public static int getRing(final int dX, final int dZ){
return Math.max(Math.abs(dX), Math.abs(dZ));
}
/**
* Sort order function for 1 layer of MoveToBlockGoal findNearestBlock
* This is equivalent to:
* int withinRingX = Math.abs(dX) * 2 - (dX > 0 ? 1 : 0);
* int withinRingZ = Math.abs(dZ) * 2 - (dZ > 0 ? 1 : 0);
* return ring << 16 | withinRingX << 8 | withinRingZ;
* <p>
* This works because the search prioritizes in order of:
* 1. The distance of y from the center - Not used
* 2. Whether y is - or + (+ is closer) - Not used
* 3. The square ring that the block is in (outer is further)
* 4. The distance of x from the center
* 5. Whether x is - or + (+ is closer)
* 6. The distance of z from the center
* 7. Whether z is - or + (+ is closer)
* <p>
* Note: The bit-packing only works for horizontal search ranges of <=128.
* You can convert to longs if you somehow exceed that, but also seriously consider POIs instead.
*
* @param ring Which square ring the block is at relative to the center
* @param dX Relative x position of the block to the center
* @param dZ Relative z position of the block to the center
*/
public static int getVanillaSortOrderInt(final int ring, final int dX, final int dZ) {
return (ring << 16 | Math.abs(dX) << 9 | Math.abs(dZ) << 1) - ((dX > 0 ? 1 : 0) << 8 | (dZ > 0 ? 1 : 0));
}
}
}
@@ -0,0 +1,83 @@
/*
* This file is part of Lithium
*
* Lithium is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Lithium is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Lithium. If not, see <https://www.gnu.org/licenses/>.
*/
package net.caffeinemc.mods.lithium.common.util;
import net.minecraft.core.BlockPos;
import net.minecraft.core.SectionPos;
public class Distances {
public static long getMinChunkToBlockDistanceL2Sq(BlockPos origin, int chunkX, int chunkZ) {
int chunkMinX = SectionPos.sectionToBlockCoord(chunkX);
int chunkMinZ = SectionPos.sectionToBlockCoord(chunkZ);
int xDistance = origin.getX() - chunkMinX;
if (xDistance > 0) {
xDistance = Math.max(0, xDistance - 15);
}
int zDistance = origin.getZ() - chunkMinZ;
if (zDistance > 0) {
zDistance = Math.max(0, zDistance - 15);
}
return (long) xDistance * (long) xDistance + (long) zDistance * (long) zDistance;
}
public static BlockPos getClosestPosInChunk(BlockPos origin, int chunkX, int chunkZ) {
int closestX = getClosestBlockCoordInSection(origin.getX(), chunkX);
int closestZ = getClosestBlockCoordInSection(origin.getZ(), chunkZ);
return new BlockPos(closestX, origin.getY(), closestZ);
}
public static boolean isWithinCubeRadius(BlockPos origin, int radius, BlockPos pos) {
return Math.abs(pos.getX() - origin.getX()) <= radius &&
Math.abs(pos.getZ() - origin.getZ()) <= radius;
}
public static boolean isWithinSphereRadius(BlockPos origin, long radiusSq, BlockPos pos) {
return distanceSq(origin, pos) <= radiusSq;
}
public static int getClosestBlockCoordInSection(int blockCoord, int sectionCoord) {
final int minBlockInSection = SectionPos.sectionToBlockCoord(sectionCoord);
return Math.min(Math.max(blockCoord, minBlockInSection), minBlockInSection + 15);
}
public static long getMinSectionDistanceSq(BlockPos origin, int chunkX, int chunkY, int chunkZ) {
int originX = origin.getX(), originY = origin.getY(), originZ = origin.getZ();
long distX = getClosestBlockCoordInSection(originX, chunkX) - originX;
long distY = getClosestBlockCoordInSection(originY, chunkY) - originY;
long distZ = getClosestBlockCoordInSection(originZ, chunkZ) - originZ;
return distX * distX + distY * distY + distZ * distZ;
}
public static long distanceSq(BlockPos a, BlockPos b) {
long dx = a.getX() - b.getX();
long dy = a.getY() - b.getY();
long dz = a.getZ() - b.getZ();
return dx * dx + dy * dy + dz * dz;
}
public static int distanceSqInt(BlockPos a, BlockPos b) {
int dx = a.getX() - b.getX();
int dy = a.getY() - b.getY();
int dz = a.getZ() - b.getZ();
// Check overflows to avoid silent incorrect results
return Math.addExact(Math.addExact(Math.multiplyExact(dx, dx), Math.multiplyExact(dy, dy)), Math.multiplyExact(dz, dz));
}
}
@@ -0,0 +1,109 @@
/*
* This file is part of Lithium
*
* Lithium is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Lithium is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Lithium. If not, see <https://www.gnu.org/licenses/>.
*/
package net.caffeinemc.mods.lithium.common.util;
import net.minecraft.core.SectionPos;
import net.minecraft.world.level.LevelHeightAccessor;
public class Pos {
public static class BlockCoord {
public static int getYSize(LevelHeightAccessor view) {
return view.getHeight();
}
public static int getMinY(LevelHeightAccessor view) {
return view.getMinY();
}
public static int getMaxYInclusive(LevelHeightAccessor view) {
return view.getMaxY();
}
public static int getMaxYExclusive(LevelHeightAccessor view) {
return view.getMaxY() + 1;
}
public static int getMaxInSectionCoord(int sectionCoord) {
return 15 + getMinInSectionCoord(sectionCoord);
}
public static int getMaxYInSectionIndex(LevelHeightAccessor view, int sectionIndex){
return getMaxInSectionCoord(SectionYCoord.fromSectionIndex(view, sectionIndex));
}
public static int getMinInSectionCoord(int sectionCoord) {
return SectionPos.sectionToBlockCoord(sectionCoord);
}
public static int getMinYInSectionIndex(LevelHeightAccessor view, int sectionIndex) {
return getMinInSectionCoord(SectionYCoord.fromSectionIndex(view, sectionIndex));
}
}
public static class ChunkCoord {
public static int fromBlockCoord(int blockCoord) {
return SectionPos.blockToSectionCoord(blockCoord);
}
public static int fromBlockSize(int i) {
return i >> 4; //same method as fromBlockCoord, just be clear about coord/size semantic difference
}
}
public static class SectionYCoord {
public static int getNumYSections(LevelHeightAccessor view) {
return view.getSectionsCount();
}
public static int getMinYSection(LevelHeightAccessor view) {
return view.getMinSectionY();
}
public static int getMaxYSectionInclusive(LevelHeightAccessor view) {
return view.getMaxSectionY();
}
public static int getMaxYSectionExclusive(LevelHeightAccessor view) {
return view.getMaxSectionY() + 1;
}
public static int fromSectionIndex(LevelHeightAccessor view, int sectionCoord) {
return sectionCoord + SectionYCoord.getMinYSection(view);
}
public static int fromBlockCoord(int blockCoord) {
return SectionPos.blockToSectionCoord(blockCoord);
}
}
public static class SectionYIndex {
public static int getNumYSections(LevelHeightAccessor view) {
return view.getSectionsCount();
}
public static int getMinYSectionIndex(LevelHeightAccessor view) {
return 0;
}
public static int getMaxYSectionIndexInclusive(LevelHeightAccessor view) {
return view.getSectionsCount() - 1;
}
public static int getMaxYSectionIndexExclusive(LevelHeightAccessor view) {
return view.getSectionsCount();
}
public static int fromSectionCoord(LevelHeightAccessor view, int sectionCoord) {
return sectionCoord - SectionYCoord.getMinYSection(view);
}
public static int fromBlockCoord(LevelHeightAccessor view, int blockCoord) {
return fromSectionCoord(view, SectionPos.blockToSectionCoord(blockCoord));
}
}
}
@@ -0,0 +1,189 @@
/*
* This file is part of Lithium
*
* Lithium is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Lithium is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Lithium. If not, see <https://www.gnu.org/licenses/>.
*/
package net.caffeinemc.mods.lithium.common.util.collections;
import it.unimi.dsi.fastutil.ints.IntIterable;
import it.unimi.dsi.fastutil.ints.IntIterator;
import it.unimi.dsi.fastutil.longs.LongIterable;
import it.unimi.dsi.fastutil.longs.LongIterator;
import net.minecraft.core.BlockPos;
import net.minecraft.core.SectionPos;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.chunk.ChunkAccess;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Collections;
public class FixedChunkAccessSectionBitBuffer {
public final int xMin, yMin, zMin;
public final int xLength, yLength, zLength, numChunks, numSections;
public final BitSet chunkSectionBits;
public final ArrayList<ChunkAccess> chunkAccesses;
public FixedChunkAccessSectionBitBuffer(int x0, int x1, int y0, int y1, int z0, int z1) {
this.xMin = Math.min(x0, x1);
this.yMin = Math.min(y0, y1);
this.zMin = Math.min(z0, z1);
this.xLength = Math.max(x0, x1) - this.xMin + 1;
this.yLength = Math.max(y0, y1) - this.yMin + 1;
this.zLength = Math.max(z0, z1) - this.zMin + 1;
this.numChunks = xLength * zLength;
this.numSections = yLength * xLength * zLength;
this.chunkSectionBits = new BitSet(numSections);
this.chunkAccesses = new ArrayList<>(Collections.nCopies(xLength * zLength,null));
}
public FixedChunkAccessSectionBitBuffer(BlockPos center, int horizontalRangeInclusive, int verticalRangeInclusive) {
this(SectionPos.blockToSectionCoord(center.getX() - horizontalRangeInclusive),
SectionPos.blockToSectionCoord(center.getX() + horizontalRangeInclusive),
SectionPos.blockToSectionCoord(center.getY() - verticalRangeInclusive),
SectionPos.blockToSectionCoord(center.getY() + verticalRangeInclusive),
SectionPos.blockToSectionCoord(center.getZ() - horizontalRangeInclusive),
SectionPos.blockToSectionCoord(center.getZ() + horizontalRangeInclusive)
);
}
public int getSectionIndex(int x, int y, int z) {
int dx = x - this.xMin;
int dy = y - this.yMin;
int dz = z - this.zMin;
return (dx * this.zLength + dz) * this.yLength + dy;
}
public int getSectionIndex(long sectionPos) {
return this.getSectionIndex(
SectionPos.x(sectionPos),
SectionPos.y(sectionPos),
SectionPos.z(sectionPos)
);
}
public boolean getChunkSectionBit(BlockPos blockPos) {
return this.getChunkSectionBit(SectionPos.blockToSectionCoord(blockPos.getX()), SectionPos.blockToSectionCoord(blockPos.getY()), SectionPos.blockToSectionCoord(blockPos.getZ()));
}
public boolean getChunkSectionBit(int chunkX, int chunkY, int chunkZ) {
return this.chunkSectionBits.get(this.getSectionIndex(chunkX, chunkY, chunkZ));
}
public void setChunkSectionStatus(long sectionPos, boolean value) {
this.chunkSectionBits.set(this.getSectionIndex(sectionPos), value);
}
public int getChunkIndex(int x, int z) {
int dx = x - this.xMin;
int dz = z - this.zMin;
return dx * this.zLength + dz;
}
public int getChunkIndex(long chunkPos) {
return this.getChunkIndex(ChunkPos.getX(chunkPos), ChunkPos.getZ(chunkPos));
}
public ChunkAccess getChunkAccess(long chunkPos){
return this.chunkAccesses.get(this.getChunkIndex(chunkPos));
}
public ChunkAccess getChunkAccess(BlockPos blockPos){
return this.getChunkAccess(ChunkPos.pack(blockPos));
}
public void setChunkAccess(long chunkPos, ChunkAccess chunkAccess) {
this.chunkAccesses.set(this.getChunkIndex(chunkPos), chunkAccess);
}
public void setChunkAccess(BlockPos blockPos, ChunkAccess chunkAccess) {
this.setChunkAccess(ChunkPos.pack(blockPos), chunkAccess);
}
public boolean hasNoTrueChunkSections(){
return this.chunkSectionBits.nextSetBit(0) == -1;
}
public LongIterable getChunkPosInRange() {
return new LongIterable() {
@Override
public @NotNull LongIterator iterator(){
return getChunkPosInRangeIterator();
}
};
}
public LongIterator getChunkPosInRangeIterator() {
final int xMin = this.xMin;
final int xMax = this.xMin + this.xLength - 1;
final int zMin = this.zMin;
final int zMax = this.zMin + this.zLength - 1;
return new LongIterator() {
int x = xMin;
int z = zMin;
@Override
public long nextLong () {
long result = ChunkPos.pack(x, z);
if (z < zMax) {
z++;
} else {
z = zMin;
x++;
}
return result;
}
@Override
public boolean hasNext(){
return x <= xMax;
}
};
}
public IntIterable getSectionYInRange() {
return new IntIterable() {
@Override
public @NotNull IntIterator iterator(){
return getSectionYInRangeIterator();
}
};
}
public IntIterator getSectionYInRangeIterator() {
final int yMin = this.yMin;
final int yLimit = yMin + this.yLength;
return new IntIterator() {
int y = yMin;
@Override
public int nextInt(){
return y++;
}
@Override
public boolean hasNext(){
return y < yLimit;
}
};
}
}
@@ -0,0 +1,293 @@
/*
* This file is part of Lithium
*
* Lithium is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Lithium is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Lithium. If not, see <https://www.gnu.org/licenses/>.
*/
package net.caffeinemc.mods.lithium.common.util.collections;
import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
import it.unimi.dsi.fastutil.objects.ReferenceArrayList;
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
import org.jetbrains.annotations.NotNull;
import java.util.*;
/**
* Wraps a {@link List} with a hash table which provides O(1) lookups for {@link Collection#contains(Object)}. The type
* contained by this list must use reference-equality semantics.
*/
@SuppressWarnings("SuspiciousMethodCalls")
public class HashedReferenceList<T> implements List<T> {
private final ReferenceArrayList<T> list;
private final Reference2IntOpenHashMap<T> counter;
public HashedReferenceList(Collection<T> list) {
this.list = new ReferenceArrayList<>();
this.list.addAll(list);
this.counter = new Reference2IntOpenHashMap<>();
this.counter.defaultReturnValue(0);
for (T obj : this.list) {
this.counter.addTo(obj, 1);
}
}
@Override
public int size() {
return this.list.size();
}
@Override
public boolean isEmpty() {
return this.list.isEmpty();
}
@Override
public boolean contains(Object o) {
return this.counter.containsKey(o);
}
@Override
public Iterator<T> iterator() {
return this.listIterator();
}
@Override
public Object[] toArray() {
return this.list.toArray();
}
@Override
public <T1> T1[] toArray(T1 @NotNull [] a) {
return this.list.toArray(a);
}
@Override
public boolean add(T t) {
this.trackReferenceAdded(t);
return this.list.add(t);
}
@Override
public boolean remove(Object o) {
this.trackReferenceRemoved(o);
return this.list.remove(o);
}
@Override
public boolean containsAll(Collection<?> c) {
for (Object obj : c) {
if (!this.counter.containsKey(obj)) {
return false;
}
}
return true;
}
@Override
public boolean addAll(Collection<? extends T> c) {
for (T obj : c) {
this.trackReferenceAdded(obj);
}
return this.list.addAll(c);
}
@Override
public boolean addAll(int index, Collection<? extends T> c) {
for (T obj : c) {
this.trackReferenceAdded(obj);
}
return this.list.addAll(index, c);
}
@Override
public boolean removeAll(@NotNull Collection<?> c) {
if (this.size() >= 2 && c.size() > 4 && c instanceof List) {
//HashReferenceList uses reference equality, so using ReferenceOpenHashSet is fine
c = new ReferenceOpenHashSet<>(c);
}
this.counter.keySet().removeAll(c);
return this.list.removeAll(c);
}
@Override
public boolean retainAll(@NotNull Collection<?> c) {
this.counter.keySet().retainAll(c);
return this.list.retainAll(c);
}
@Override
public void clear() {
this.counter.clear();
this.list.clear();
}
@Override
public T get(int index) {
return this.list.get(index);
}
@Override
public T set(int index, T element) {
T prev = this.list.set(index, element);
if (prev != element) {
if (prev != null) {
this.trackReferenceRemoved(prev);
}
this.trackReferenceAdded(element);
}
return prev;
}
@Override
public void add(int index, T element) {
this.trackReferenceAdded(element);
this.list.add(index, element);
}
@Override
public T remove(int index) {
T prev = this.list.remove(index);
if (prev != null) {
this.trackReferenceRemoved(prev);
}
return prev;
}
@Override
public int indexOf(Object o) {
return this.list.indexOf(o);
}
@Override
public int lastIndexOf(Object o) {
return this.list.lastIndexOf(o);
}
@Override
public ListIterator<T> listIterator() {
return this.listIterator(0);
}
@Override
public ListIterator<T> listIterator(int index) {
return new ListIterator<>() {
private final ListIterator<T> inner = HashedReferenceList.this.list.listIterator(index);
@Override
public boolean hasNext() {
return this.inner.hasNext();
}
@Override
public T next() {
return this.inner.next();
}
@Override
public boolean hasPrevious() {
return this.inner.hasPrevious();
}
@Override
public T previous() {
return this.inner.previous();
}
@Override
public int nextIndex() {
return this.inner.nextIndex();
}
@Override
public int previousIndex() {
return this.inner.previousIndex();
}
@Override
public void remove() {
int last = this.previousIndex();
if (last == -1) {
throw new NoSuchElementException();
}
T prev = HashedReferenceList.this.get(last);
if (prev != null) {
HashedReferenceList.this.trackReferenceRemoved(prev);
}
this.inner.remove();
}
@Override
public void set(T t) {
int last = this.previousIndex();
if (last == -1) {
throw new NoSuchElementException();
}
T prev = HashedReferenceList.this.get(last);
if (prev != t) {
if (prev != null) {
HashedReferenceList.this.trackReferenceRemoved(prev);
}
HashedReferenceList.this.trackReferenceAdded(t);
}
this.inner.remove();
}
@Override
public void add(T t) {
HashedReferenceList.this.trackReferenceAdded(t);
this.inner.add(t);
}
};
}
@Override
public List<T> subList(int fromIndex, int toIndex) {
return this.list.subList(fromIndex, toIndex);
}
private void trackReferenceAdded(T t) {
this.counter.addTo(t, 1);
}
@SuppressWarnings("unchecked")
private void trackReferenceRemoved(Object o) {
if (this.counter.addTo((T) o, -1) <= 1) {
this.counter.removeInt(o);
}
}
}
@@ -14,7 +14,7 @@ public class ServerFeatureManager implements FeatureManager {
availableFeatures.add(FAKEPLAYER); // Lophine - fakeplayer support
availableFeatures.add(PHOTOGRAPHER); // Lophine - Replay Mod API support
availableFeatures.add(UPDATE_SUPPRESSION_EVENT); // Lophine - update suppression event support
if (Boolean.getBoolean("leavesclip.enable.mixin") || Boolean.getBoolean("hyacinthusclip.enable.mixin")) {
if (Boolean.getBoolean("morninggloryclip.enable.mixin")) {
availableFeatures.add(MIXIN);
}
}
@@ -41,6 +41,7 @@ import net.minecraft.network.protocol.game.*;
import net.minecraft.network.protocol.login.ClientboundLoginFinishedPacket;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.RegistryLayer;
import net.minecraft.server.network.ServerGamePacketListenerImpl;
import net.minecraft.server.packs.repository.KnownPack;
import net.minecraft.tags.TagNetworkSerialization;
import net.minecraft.world.entity.EntityTypes;
@@ -94,6 +95,11 @@ public class Recorder extends Connection {
this.channel = new LocalChannel();
}
public void bind(ServerGamePacketListenerImpl listener) {
this.packetListener = listener;
}
public void start() {
startTime = System.currentTimeMillis();
@@ -1,10 +1,10 @@
{
"lophine.experiment.command.function_command_enabled.comment": "允许使用 function 令",
"lophine.experiment.command.save_all_command.enabled.comment": "允许使用 save-all 令",
"lophine.experiment.command.save_all_command.log_all_process.comment": "将 save-all 令的全部过程记录到控制台",
"lophine.experiment.command.function_command_enabled.comment": "允许使用 function 令",
"lophine.experiment.command.save_all_command.enabled.comment": "允许使用 save-all 令",
"lophine.experiment.command.save_all_command.log_all_process.comment": "将 save-all 令的全部过程记录到控制台",
"lophine.experiment.command.save_all_command.save_all_command_timeout.comment": "区块报告保存超时前允许的最大保存秒数。",
"lophine.experiment.command.scoreboard_command_enabled.comment": "允许使用 scoreboard 令",
"lophine.experiment.command.trigger_command_enabled.comment": "允许使用 trigger 令",
"lophine.experiment.command.scoreboard_command_enabled.comment": "允许使用 scoreboard 令",
"lophine.experiment.command.trigger_command_enabled.comment": "允许使用 trigger 令",
"lophine.experiment.entity_damage_source_trace.enabled.comment": "允许跨不同区域调度器跟踪伤害来源。",
"lophine.experiment.global_entities_counter.version.comment": "DISABLED\nDEFAULT_SYNC:使用同步计数器模块启用原版全局实体计数器。\nDEFAULT_ASYNC:使用异步计数器模块启用原版全局实体计数器。\nPRECISE:使用增量计数启用精确生物容量计算。用事件驱动的实时更新替代周期性全量扫描。\n\n你需要在 paper-world-defaults.yml 或 paper-world.yml 中将 per-player-mob-spawns 设置为 false",
"lophine.fixes.update-suppression-crash-fix.enabled.comment": "防止由更新抑制导致的崩溃",
@@ -15,7 +15,7 @@
"lophine.function.fakeplayer.always-send-data.comment": "始终为假人发送数据",
"lophine.function.fakeplayer.cache-skin.comment": "为假人使用皮肤缓存",
"lophine.function.fakeplayer.enable-locator-bar.comment": "为假人启用定位栏",
"lophine.function.fakeplayer.enabled.comment": "启用假人功能(/bot 令)",
"lophine.function.fakeplayer.enabled.comment": "启用假人功能(/bot 令)",
"lophine.function.fakeplayer.limit.comment": "允许的假人最大数量",
"lophine.function.fakeplayer.manual-save-and-load.comment": "允许手动保存和加载假人",
"lophine.function.fakeplayer.modify-config.comment": "允许修改假人配置",
@@ -30,7 +30,7 @@
"lophine.function.fakeplayer.use-action.comment": "允许假人执行动作",
"lophine.function.language.allow_auto_reset_comments.comment": "如果包中包含对应语言的配置文件注释文件,\n则使用相关内容自动重新加载配置文件注释。\n\n警告:这会删除原有注释!",
"lophine.function.language.full_blocking_load.comment": "加载本地化语言时,是否允许阻塞服务器加载。\n如果你只想在终端中显示本地化语言,\n需要启用此项。\n\n警告:这可能会降低启动速度!",
"lophine.function.language.lang.comment": "请使用 https://minecraft.wiki/w/Language 中的键\n格式示例:en_us zh_cn zh_hk zh_tw\n注意:如果你想编辑 carpet 系统的语言,\n请在 carpet 配置文件中编辑。",
"lophine.function.language.lang.comment": "请使用 https://zh.minecraft.wiki/w/Language 中实际使用的的语言代码\n格式示例:en_us zh_cn zh_hk zh_tw\n注意:如果你想编辑 carpet 系统的语言,\n请在 carpet 配置文件中编辑。",
"lophine.function.protocol.alternative_block_placement.enabled.comment": "指定精确放置协议类型\nNONE 禁用精确放置协议\nCARPET 精确放置协议第 2 版\nCARPET_FIX 增强版精确放置协议第 2 版(需要客户端安装 MasaGadget\nLITEMATICA 精确放置协议第 3 版",
"lophine.function.protocol.appleskin.enabled.comment": "启用 AppleSkin 协议支持",
"lophine.function.protocol.appleskin.sync-tick-interval.comment": "设置 AppleSkin 同步频率(单位:游戏刻)",
@@ -50,8 +50,8 @@
"lophine.misc.disable-check.disable-op-fly-check.comment": "禁用对管理员飞行检查的检测",
"lophine.misc.disable-check.disable-op-move-check.comment": "禁用对管理员移动检查的检测",
"lophine.misc.item-entity.follow-tick-sequence-merge.comment": "由于 Paper 修改了合并半径,\n当合并半径较大且包含大量物品堆卡在异常位置时,\n单个物品可能永远无法到达目标位置。\n此配置项用于修复该行为,但是请注意,启用此碰撞箱后的行为是非原版的。",
"lophine_carpet.carpet.fakeplayer.commandPlayer.comment": "启用 /player 令。\n如果要启用 /bot 令,请查看 lophine 全局配置。",
"lophine_carpet.carpet.fakeplayer.comment": "将 Carpet 假人兼容映射到 Lophine 假人。\ncommandPlayer 当前由 Lophine 的 /bot 令接口提供支持。",
"lophine_carpet.carpet.fakeplayer.commandPlayer.comment": "启用 /player 令。\n如果要启用 /bot 令,请查看 lophine 全局配置。",
"lophine_carpet.carpet.fakeplayer.comment": "将 Carpet 假人兼容映射到 Lophine 假人。\ncommandPlayer 当前由 Lophine 的 /bot 令接口提供支持。",
"lophine_carpet.carpet.fakeplayer.fakePlayerAutoFish.comment": "让手持钓鱼竿的假人自动抛竿并收竿。",
"lophine_carpet.carpet.fakeplayer.fakePlayerAutoReplaceTool.comment": "切换假人的自动工具替换。",
"lophine_carpet.carpet.fakeplayer.fakePlayerAutoReplenishment.comment": "切换假人的自动堆叠补货。",
@@ -70,7 +70,7 @@
"lophine_carpet.carpet.general.blockPlacementIgnoreEntity.comment": "允许创造模式玩家在不检查实体碰撞的情况下放置方块。",
"lophine_carpet.carpet.general.carpetAlwaysSetDefault.comment": "Lophine 配置加载器的兼容标志;它已在预加载期间将默认值写入兼容配置。",
"lophine_carpet.carpet.general.clientSettingsLostOnRespawnFix.comment": "玩家重生后重新应用其最后已知的客户端设置。",
"lophine_carpet.carpet.general.commandTick.comment": "启用 tick 令支持。",
"lophine_carpet.carpet.general.commandTick.comment": "启用 tick 令支持。",
"lophine_carpet.carpet.general.comment": "由现有 Lophine 功能提供支持的 Carpet/AMS/TIS/Org 兼容规则。\n这里只暴露已经有可用服务端实现的规则。",
"lophine_carpet.carpet.general.creativeNoClip.comment": "是否启用创造飞行无碰撞。\n启用后,创造模式玩家飞行时不会与方块碰撞。\n这允许他们无阻碍地穿过方块。",
"lophine_carpet.carpet.general.creativeNoItemCooldown.comment": "跳过创造模式玩家的物品冷却应用。",
@@ -78,8 +78,8 @@
"lophine_carpet.carpet.general.creativeOpenContainerForcibly.comment": "允许创造模式玩家强制打开被阻挡的箱子、末影箱和潜影盒。",
"lophine_carpet.carpet.general.ctrlQCraftingFix.comment": "Ctrl+Q 合成修复的兼容标志;该修复已存在于当前菜单代码中。",
"lophine_carpet.carpet.general.defaultLoggers.comment": "Carpet 的玩家默认日志订阅。\n示例:[\"tps\", \"mob_caps\", \"counter white\"]",
"lophine_carpet.carpet.general.disableBlazeFire.comment": "禁用烈焰人火球造成的火。",
"lophine_carpet.carpet.general.disableGhastFire.comment": "禁用恶魂火球造成的的火。",
"lophine_carpet.carpet.general.disableBlazeFire.comment": "禁用烈焰人火球生成火。",
"lophine_carpet.carpet.general.disableGhastFire.comment": "禁用恶魂火球生成火。",
"lophine_carpet.carpet.general.dustTrapdoorReintroduced.comment": "是否重新引入 1.20 前的机制:\n红石粉不会连接到打开的活板门上的相邻红石粉\n1.20.2 前机制:红石粉、红石中继器、\n红石比较器在收到来自下方的状态更新时不会检查附着。",
"lophine_carpet.carpet.general.entityInstantDeathRemoval.comment": "移除死亡生物实体被丢弃前正常的 20gt 延迟。",
"lophine_carpet.carpet.general.explosionNoBlockDamage.comment": "让爆炸伤害实体但不破坏方块。",
@@ -106,7 +106,7 @@
"lophine_carpet.carpet.general.shulkerGolem.comment": "允许在潜影盒上方放置雕刻南瓜来召唤潜影贝。",
"lophine_carpet.carpet.general.simpleInGameCalculator.comment": "将以 `=` 开头的聊天消息作为简单计算器表达式求值,并私下回复。",
"lophine_carpet.carpet.general.syncServerMsptMetricsData.comment": "通过 TISCM 协议通道广播实时 MSPT 数据。",
"lophine_carpet.carpet.general.tickCommandPermission.comment": "覆盖 `/tick` 令权限等级。\n接受 0..4 范围内的值,其中 2 匹配旧 Carpet 行为,3 保持原版。",
"lophine_carpet.carpet.general.tickCommandPermission.comment": "覆盖 `/tick` 令权限等级。\n接受 0..4 范围内的值,其中 2 匹配旧 Carpet 行为,3 保持原版。",
"lophine_carpet.carpet.general.tickFreezeCommandToggleable.comment": "当服务器已冻结时执行 `/tick freeze`,使其切换回运行状态。",
"lophine_carpet.carpet.general.tiscmNetworkProtocol.comment": "在 `tiscm:network/v1` 上启用原生 Carpet TIS Addition 网络通道。",
"lophine_carpet.carpet.general.tntDoNotUpdate.comment": "防止 TNT 首次放置时检查红石能量。",
@@ -123,7 +123,7 @@
"lophine_carpet.carpet.hopper_counter.hopperCounters.comment": "启用现有的羊毛漏斗计数器实现。",
"lophine_carpet.carpet.hopper_counter.hopperCountersUnlimitedSpeed.comment": "移除计数器的漏斗传输速度限制。\n仅在启用 hopperCounters 时生效。",
"luminol.experiment.command.enable_command_block.comment": "强制启用命令方块。\n注意:由于一些线程问题,可能导致服务器崩溃!!!\n除非你知道自己在做什么,否则不要启用!!!",
"luminol.experiment.command.enable_waypoints_and_waypoint_command.comment": "启用路径点和路径点命令。\n警告:仍在测试中",
"luminol.experiment.command.enable_waypoints_and_waypoint_command.comment": "启用路径点和 waypoint 指令。\n警告:仍在测试中",
"luminol.experiment.disable_async_catchers.enabled.comment": "禁用异步捕获器,以防止某些声称支持 Folia 但逻辑有问题的插件导致崩溃。\n注意:如果错误调用 getChunkAt,可能导致区域死锁!\n参见:https://github.com/PaperMC/Folia/issues/280,该问题已在 Folia 中解决(https://github.com/PaperMC/Folia/commit/2e7bc0721af95196c85500c7bb136aeea0bc12ce\n除非你知道自己在做什么,否则不要启用!!!",
"luminol.experiment.disable_entity_exception_catchers.enabled.comment": "如果启用此配置,实体 tick 出错时服务器会直接崩溃,而不是移除实体以保持服务器运行。\n它可以防止实体消失,但可能导致更多服务器崩溃。\n除非你知道自己在做什么,否则不要启用!!!",
"luminol.fixes.allow_unsafe_teleportation.enabled.comment": "启用后允许非玩家实体进入末地传送门。\n如果你想使用刷沙,请开启此项。\n警告:这可能导致一些不安全问题,可在此了解更多:https://github.com/PaperMC/Folia/issues/297",
@@ -134,7 +134,7 @@
"luminol.fixes.force_cleanup_drop_non_owned_entity_memory_module.enabled_for_entity.comment": "启用后,实体的大脑会清理类型为 entity 且不属于当前 tickregion 的记忆",
"luminol.fixes.force_cleanup_drop_non_owned_entity_memory_module.enabled_for_position_tracker.comment": "启用后,实体的大脑会清理类型为 position_tracker 且不属于当前 tickregion 的记忆",
"luminol.fixes.item_multitask.enabled.comment": "防止服务器在方块交互或快捷栏槽位变化期间\n打断物品状态。",
"luminol.fixes.long_command_support.enabled.comment": "某些长令可以通过对话框命令运行,\n但 Paper 已禁止这样做。\n启用此项以修复该问题。",
"luminol.fixes.long_command_support.enabled.comment": "某些长令可以通过 dialog 指令生成的gui运行,\n但 Paper 已禁止这样做。\n启用此项以修复该问题。",
"luminol.fixes.pathfinding_fixes.break_down_pathfinding_when_out_of_region.comment": "当寻路触碰到当前 tick 区域外的方块时,重新计算路径或停止寻路",
"luminol.fixes.pathfinding_fixes.do_not_pathfind_to_not_owned_targets.comment": "当目标位于当前 tick 区域外时跳过对该目标的寻路",
"luminol.fixes.poi_range_fixes.do_not_compete_poi_if_unloaded.comment": "如果 POI 未加载,则不要竞争该 POI\n相关:https://github.com/PaperMC/Folia/issues/292",
+2 -2
View File
@@ -9,8 +9,8 @@ pluginManagement {
}
plugins {
id("moe.luminolmc.hyacinthusweight.patcher") version weightVersion
id("moe.luminolmc.hyacinthusweight.core") version weightVersion
id("fun.bm.comfreyweight.patcher") version weightVersion
id("fun.bm.comfreyweight.core") version weightVersion
}
}