Compare commits

..

48 Commits

Author SHA1 Message Date
Sofiane H. Djerbi
034cf1e6d6 Merge pull request #43 from KaiijuMC/update-upstream
Update Upstream (Folia)
2023-04-11 04:19:40 +03:00
kugge
118cabf45c Update Upstream (Folia) 2023-04-11 01:08:48 +00:00
Sofiane H. Djerbi
5562bd750f Merge pull request #42 from KaiijuMC/update-upstream
Update Upstream (Folia)
2023-04-11 02:17:39 +03:00
kugge
cedc442598 Update Upstream (Folia) 2023-04-10 23:07:20 +00:00
Sofiane H. Djerbi
35983edbd3 [skip ci] Quickfix uncommented line 2023-04-09 18:03:48 +03:00
Sofiane H. Djerbi
8664b137ca Merge pull request #40 from KaiijuMC/update-upstream
Update Upstream (Folia)
2023-04-09 17:38:44 +03:00
kugge
94d5a28cc4 Update Upstream (Folia) 2023-04-09 14:32:34 +00:00
Sofiane H. Djerbi
76890444db Adding Purpur custom server mod name 2023-04-09 17:17:26 +03:00
Sofiane H. Djerbi
08dd766899 Consistency fixes 2023-04-09 17:17:16 +03:00
Sofiane H. Djerbi
7fb8ff8fd0 Merge pull request #39 from xymb-endcrystalme/ver/1.19.4
Add option to drop contents of shulker items when destroyed.
2023-04-09 00:10:38 +03:00
Sofiane H. Djerbi
32e02629a9 Quickfix patching conventions
UPSTREAM-CATEGORY-OPTION (for future automation purposes)
Split configuration commits (tracking adding config options)
Use per world config if possible
2023-04-09 00:09:39 +03:00
Xymb
ef8af2f22a Add option to drop contents of shulker items when destroyed. 2023-04-08 18:48:31 +02:00
Xymb
23b264963e Ensure atomicity on Btrfs 2023-04-08 18:38:25 +02:00
Sofiane H. Djerbi
95e8ffed83 Merge pull request #36 from KaiijuMC/update-upstream
Update Upstream (Folia)
2023-04-04 09:52:38 +02:00
kugge
e2b32c0b66 Update Upstream (Folia) 2023-04-04 07:52:26 +00:00
Sofiane H. Djerbi
12d82f3aa5 Merge pull request #35 from KaiijuMC/update-upstream
Update Upstream (Folia)
2023-04-01 17:32:23 +02:00
kugge
e7b45be456 Update Upstream (Folia) 2023-04-01 15:10:51 +00:00
Sofiane H. Djerbi
48a3fc55b7 Merge pull request #34 from KaiijuMC/update-upstream
Update Upstream (Folia)
2023-04-01 15:53:23 +02:00
kugge
29b6a8d59d Update Upstream (Folia) 2023-04-01 13:14:40 +00:00
Sofiane H. Djerbi
f7a4bb691b Merge pull request #33 from KaiijuMC/update-upstream
Update Upstream (Folia)
2023-04-01 06:01:18 +02:00
kugge
34724b4471 Update Upstream (Folia) 2023-04-01 04:00:40 +00:00
Sofiane H. Djerbi
660e911bbb Merge pull request #32 from KaiijuMC/update-upstream
Update Upstream (Folia)
2023-04-01 05:38:52 +02:00
kugge
092e4ddbd8 Update Upstream (Folia) 2023-04-01 03:38:16 +00:00
Sofiane H. Djerbi
7fd3f17095 Update README.md 2023-04-01 03:32:09 +02:00
Sofiane H. Djerbi
53fdedd162 Merge pull request #31 from KaiijuMC/update-upstream
Update Upstream (Folia)
2023-04-01 03:29:09 +02:00
kugge
e0f78402c8 Update Upstream (Folia) 2023-04-01 01:28:30 +00:00
Sofiane H. Djerbi
d36d0dc5fc Sand duping need plugin 2023-04-01 04:22:05 +03:00
Sofiane H. Djerbi
f6246f3349 Dropped lithium support 2023-03-31 19:36:28 +03:00
Sofiane H. Djerbi
b35f17f3e6 Merge branch 'ver/1.19.4' of github.com:KaiijuMC/Kaiiju into ver/1.19.4 2023-03-31 07:49:48 +03:00
Sofiane H. Djerbi
bc3c1437a0 Custom multithreading config (Paper won't like that) 2023-03-31 07:30:09 +03:00
Sofiane H. Djerbi
1f2930b604 Merge pull request #30 from KaiijuMC/update-upstream
Update Upstream (Folia)
2023-03-31 00:54:13 +02:00
Sofiane H. Djerbi
602212daff Added alternate keepalive 2023-03-31 01:53:50 +03:00
kugge
152dbba7b0 Update Upstream (Folia) 2023-03-30 22:47:24 +00:00
Sofiane H. Djerbi
757de4f65f Update README.md 2023-03-31 00:39:04 +02:00
Sofiane H. Djerbi
af98564be2 Update README.md 2023-03-31 00:38:47 +02:00
Sofiane H. Djerbi
4d29274175 Merge branch 'ver/1.19.4' of github.com:KaiijuMC/Kaiiju into ver/1.19.4 2023-03-31 01:35:29 +03:00
Sofiane H. Djerbi
1c59e62414 Folia upstream github action 2023-03-31 01:33:47 +03:00
Sofiane H. Djerbi
d0103df33b Merge pull request #29 from KaiijuMC/dev/folia-1.19.4
Added purpur toggleable sand duping patch
2023-03-31 00:29:18 +02:00
Sofiane H. Djerbi
34977e4e8a Added purpur toggleable sand duping patch 2023-03-31 01:24:22 +03:00
Sofiane H. Djerbi
d2d7c120e5 Update upstream 2023-03-30 18:02:15 +03:00
Kugge
7239362b4d First working build 2023-03-30 03:53:14 +03:00
Kugge
83dc76521c Convert patches for folia 2023-03-30 02:52:27 +03:00
Sofiane H. Djerbi
51e1e75382 Folia test 2023-03-30 02:25:41 +03:00
Sofiane H. Djerbi
86c3a4e8de Merge branch 'ver/1.19.4' of github.com:KaiijuMC/Kaiiju into ver/1.19.4 2023-03-29 23:49:31 +03:00
Sofiane H. Djerbi
c40c8785cd Merge branch 'ver/1.19.4' of github.com:KaiijuMC/Kaiiju into ver/1.19.4 2023-03-29 23:49:18 +03:00
Sofiane H. Djerbi
e3a38f51cf Merge branch 'ver/1.19.4' of github.com:KaiijuMC/Kaiiju into ver/1.19.4 2023-03-29 05:11:20 +03:00
Sofiane H. Djerbi
b8868beac9 Merge pull request #26 from KaiijuMC/update-upstream
Update Upstream (Purpur)
2023-03-28 18:26:37 +02:00
kugge
835c7b10d8 Update Upstream (Purpur) 2023-03-28 15:18:51 +00:00
22 changed files with 386 additions and 1153 deletions

View File

@@ -1,4 +1,4 @@
name: Update Upstream (Purpur)
name: Update Upstream (Folia)
on:
schedule:
@@ -7,9 +7,7 @@ on:
jobs:
upstream:
runs-on: ubuntu-latest
steps:
- name: Checkout Git Repository
uses: actions/checkout@v2
@@ -22,7 +20,7 @@ jobs:
- name: Configure Git User Details
run: git config --global user.email "actions@github.com" && git config --global user.name "Github Actions"
- name: Update Upstream Commit Hash
run: ./gradlew purpurRefLatest --stacktrace
run: ./gradlew foliaRefLatest --stacktrace
- name: Apply Patches
run: ./gradlew applyPatches --stacktrace
- name: Build Paperclip jar
@@ -37,8 +35,8 @@ jobs:
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
commit-message: Update Upstream (Purpur)
commit-message: Update Upstream (Folia)
branch: update-upstream
delete-branch: true
title: 'Update Upstream (Purpur)'
title: 'Update Upstream (Folia)'
body: ''

View File

@@ -2,7 +2,7 @@
<div align="center">
<img src="https://github.com/kugge/Kaiiju/blob/ver/1.19.3/logo.png?" width="32%" height="32%"/>
<h1>Kaiiju</h1>
<h3>Designed for vanilla/anarchy servers</h3>
<h3>Folia fork, designed for vanilla/anarchy servers</h3>
[![License](https://img.shields.io/github/license/kugge/Kaiiju?style=for-the-badge&logo=github)](LICENSE)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/kugge/Kaiiju/build.yml?style=for-the-badge)](https://github.com/kugge/Kaiiju/actions)
@@ -14,12 +14,11 @@
### Additions
- **Xymb Linear Format**: Saves about 50% of disk space in OW and Nether and 95% in The End.
- **Lobotomize**: Lobotomize mobs and villagers without breaking vanilla mechanics.
- **Auto update**: Update upstream everyday.
### Roadmap
- **Lithium**: Implementation of Lithium server mixins.
- **C2ME**: Implementation of C2ME server mixins.
- **VMP**: Implementation of VMP server mixins.
- **Static view distance**: Reduce RAM usage with a "cached" view distance.
- **Native world conversion**: Convert region file format at startup
## Building

View File

@@ -58,12 +58,12 @@ paperweight {
remapRepo.set(paperMavenPublicUrl)
decompileRepo.set(paperMavenPublicUrl)
useStandardUpstream("Purpur") {
url.set(github("PurpurMC", "Purpur"))
ref.set(providers.gradleProperty("purpurRef"))
useStandardUpstream("Folia") {
url.set(github("PaperMC", "Folia"))
ref.set(providers.gradleProperty("foliaRef"))
withStandardPatcher {
baseName("Purpur")
baseName("Folia")
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
apiOutputDir.set(layout.projectDirectory.dir("kaiiju-api"))
@@ -73,9 +73,9 @@ paperweight {
}
}
tasks.register("purpurRefLatest") {
// Update the purpurRef in gradle.properties to be the latest commit.
val tempDir = layout.cacheDir("purpurRefLatest");
tasks.register("foliaRefLatest") {
// Update the foliaRef in gradle.properties to be the latest commit.
val tempDir = layout.cacheDir("foliaRefLatest");
val file = "gradle.properties";
doFirst {
@@ -83,15 +83,15 @@ paperweight {
val sha: String
)
val purpurLatestCommitJson = layout.cache.resolve("purpurLatestCommit.json");
download.get().download("https://api.github.com/repos/PurpurMC/Purpur/commits/ver/1.19.4", purpurLatestCommitJson);
val purpurLatestCommit = gson.fromJson<paper.libs.com.google.gson.JsonObject>(purpurLatestCommitJson)["sha"].asString;
val foliaLatestCommitJson = layout.cache.resolve("foliaLatestCommit.json");
download.get().download("https://api.github.com/repos/PaperMC/Folia/commits/master", foliaLatestCommitJson);
val foliaLatestCommit = gson.fromJson<paper.libs.com.google.gson.JsonObject>(foliaLatestCommitJson)["sha"].asString;
copy {
from(file)
into(tempDir)
filter { line: String ->
line.replace("purpurRef = .*".toRegex(), "purpurRef = $purpurLatestCommit")
line.replace("foliaRef = .*".toRegex(), "foliaRef = $foliaLatestCommit")
}
}
}

View File

@@ -2,7 +2,7 @@ group = dev.kaiijumc.kaiiju
version = 1.19.4-R0.1-SNAPSHOT
mcVersion = 1.19.4
purpurRef = f5a789d40bc8b55efaf69143067e76a9305354c5
foliaRef = 25e0cbdae46912d227a31703869594538b731931
org.gradle.caching=true
org.gradle.parallel=true

View File

@@ -5,12 +5,12 @@ Subject: [PATCH] Kaiiju Configuration
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index e0f69edf603c2ec99bc92b16b18912272cc41bd9..b2c8c18437537eb2ea91bdeb9f715e01a182fbcb 100644
index c230a10aff36f6b484d7e3963cbf8073f8676fb1..6b17fc3c788b745aa458eee82cace12e4728b6b5 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1983,6 +1983,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1971,6 +1971,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
}
// Purpur end
// Paper end
+ // Kaiiju start
+ @NotNull

View File

@@ -5,98 +5,97 @@ Subject: [PATCH] Kaiiju Rebranding
diff --git a/build.gradle.kts b/build.gradle.kts
index 22470f0ab8354a9f31a0f195f3fe80f2f5ee2f0e..845cf3838fc014e59b52c0ffa4cae1bc370d9b47 100644
index dd53b1ffaff8dbaea0cf21c489a90162a496a026..6dd416f65755ca0542e6661b8716672264120d59 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -7,8 +7,12 @@ plugins {
}
@@ -8,7 +8,7 @@ plugins {
dependencies {
- implementation(project(":purpur-api")) // Purpur
- implementation("io.papermc.paper:paper-mojangapi:1.19.4-R0.1-SNAPSHOT") // Purpur
+ implementation(project(":kaiiju-api")) // Purpur // Kaiiju
+ // Pufferfish start
+ implementation("io.papermc.paper:paper-mojangapi:1.19.4-R0.1-SNAPSHOT") {
+ exclude("io.papermc.paper", "paper-api")
+ }
+ // Pufferfish end
// Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0")
@@ -81,7 +85,7 @@ tasks.jar {
// Folia start
- implementation(project(":folia-api"))
+ implementation(project(":kaiiju-api")) // Kaiiju
implementation("io.papermc.paper:paper-mojangapi:1.19.3-R0.1-SNAPSHOT") {
exclude("io.papermc.paper", "paper-api")
}
@@ -66,7 +66,7 @@ tasks.jar {
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
- "Implementation-Version" to "git-Purpur-$implementationVersion", // Pufferfish // Purpur
+ "Implementation-Version" to "git-Kaiiju-$implementationVersion", // Pufferfish // Purpur // Kaiiju
- "Implementation-Version" to "git-Folia-$implementationVersion", // Folia
+ "Implementation-Version" to "git-Kaiiju-$implementationVersion", // Folia // Kaiiju
"Implementation-Vendor" to date, // Paper
"Specification-Title" to "Bukkit",
"Specification-Version" to project.version,
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
index 8cde30544e14f8fc2dac32966ae3c21f8cf3a551..f9e3659dee7171b37a07d9880d7b21857f87ff00 100644
index 58dc84b7b3b04c2d0b00fc5fac5303d3378b3467..a128b1fabd4aadfe26a8375903c0451d7a65983a 100644
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
@@ -593,7 +593,7 @@ public class Metrics {
boolean logFailedRequests = config.getBoolean("logFailedRequests", false);
// Only start Metrics, if it's enabled in the config
if (config.getBoolean("enabled", true)) {
- Metrics metrics = new Metrics("Purpur", serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur
+ Metrics metrics = new Metrics("Kaiiju", serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur // Kaiiju
- Metrics metrics = new Metrics("Folia", serverUUID, logFailedRequests, Bukkit.getLogger()); // Folia - we have our own bstats page
+ Metrics metrics = new Metrics("Kaiiju", serverUUID, logFailedRequests, Bukkit.getLogger()); // Folia - we have our own bstats page // Kaiiju
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
String minecraftVersion = Bukkit.getVersion();
@@ -603,7 +603,7 @@ public class Metrics {
metrics.addCustomChart(new Metrics.SingleLineChart("players", () -> Bukkit.getOnlinePlayers().size()));
metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() ? "bungee" : "offline"))); // Purpur
- metrics.addCustomChart(new Metrics.SimplePie("purpur_version", () -> (org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() != null) ? org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() : "unknown")); // Purpur
+ metrics.addCustomChart(new Metrics.SimplePie("kaiiju_version", () -> (org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() != null) ? org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() : "unknown")); // Purpur // Kaiiju
@@ -612,6 +612,7 @@ public class Metrics {
paperVersion = "unknown";
}
metrics.addCustomChart(new Metrics.SimplePie("folia_version", () -> paperVersion)); // Folia - we have our own bstats page
+ metrics.addCustomChart(new Metrics.SimplePie("kaiiju_version", () -> (org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() != null) ? org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() : "unknown")); // Kaiiju
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
index 462a6eed350fd660ddaf25d567bb6e97b77d0b2b..ecde56de475b5a69e2ad22c1cbe903e6f3d40466 100644
index 719b0e318a85d4a1fb8f616deeb31193495b462e..751b2bc79d29cb21c38cf5d35e3711149ec7b011 100644
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
@@ -20,7 +20,7 @@ import java.util.stream.StreamSupport;
@@ -19,10 +19,11 @@ import java.util.stream.StreamSupport;
public class PaperVersionFetcher implements VersionFetcher {
private static final java.util.regex.Pattern VER_PATTERN = java.util.regex.Pattern.compile("^([0-9\\.]*)\\-.*R"); // R is an anchor, will always give '-R' at end
// Purpur start
- private static final String DOWNLOAD_PAGE = "https://purpurmc.org/downloads";
+ private static final String DOWNLOAD_PAGE = "https://github.com/KaiijuMC/Kaiiju/releases"; // Kaiiju
private static int distance = -2; public int distance() { return distance; }
// Purpur end
- private static final String GITHUB_BRANCH_NAME = "master";
- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads";
+ // Kaiiju start
+ private static final String DOWNLOAD_PAGE = "https://github.com/KaiijuMC/Kaiiju/releases";
+ private static int distance = -2; public int distance() { return distance; }
+ // Kaiiju end
private static @Nullable String mcVer;
@@ -33,8 +33,8 @@ public class PaperVersionFetcher implements VersionFetcher {
-
@Override
public long getCacheTime() {
return 720000;
@@ -31,8 +32,8 @@ public class PaperVersionFetcher implements VersionFetcher {
@Nonnull
@Override
public Component getVersionMessage(@Nonnull String serverVersion) {
- String[] parts = serverVersion.substring("git-Purpur-".length()).split("[-\\s]"); // Purpur
- final Component updateMessage = getUpdateStatusMessage("PurpurMC/Purpur", "ver/" + getMinecraftVersion(), parts[0]); // Purpur
+ String[] parts = serverVersion.substring("git-Kaiiju-".length()).split("[-\\s]"); // Purpur // Kaiiju
+ final Component updateMessage = getUpdateStatusMessage("KaiijuMC/Kaiiju", "ver/" + getMinecraftVersion(), parts[0]); // Purpur // Kaiiju
- String[] parts = serverVersion.substring("git-Folia-".length()).split("[-\\s]"); // Folia
- final Component updateMessage = getUpdateStatusMessage("PaperMC/Folia", GITHUB_BRANCH_NAME, parts[0]); // Folia
+ String[] parts = serverVersion.substring("git-Kaiiju-".length()).split("[-\\s]"); // Folia // Kaiiju
+ final Component updateMessage = getUpdateStatusMessage("KaiijuMC/Kaiiju", "ver/" + getMinecraftVersion(), parts[0]); // Folia // Kaiiju
final Component history = getHistory();
return history != null ? Component.join(net.kyori.adventure.text.JoinConfiguration.separator(Component.newline()), history, updateMessage) : updateMessage; // Purpur
@@ -47,7 +47,7 @@ public class PaperVersionFetcher implements VersionFetcher {
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
@@ -45,7 +46,7 @@ public class PaperVersionFetcher implements VersionFetcher {
String result = matcher.group();
mcVer = result.substring(0, result.length() - 2); // strip 'R' anchor and trailing '-'
} else {
- org.bukkit.Bukkit.getLogger().warning("Unable to match version to pattern! Report to Purpur!"); // Purpur
+ org.bukkit.Bukkit.getLogger().warning("Unable to match version to pattern! Report to Kaiiju!"); // Purpur // Kaiiju
- org.bukkit.Bukkit.getLogger().warning("Unable to match version to pattern! Report to PaperMC!");
+ org.bukkit.Bukkit.getLogger().warning("Unable to match version to pattern! Report to KaiijuMC!"); // Kaiiju
org.bukkit.Bukkit.getLogger().warning("Pattern: " + VER_PATTERN.toString());
org.bukkit.Bukkit.getLogger().warning("Version: " + org.bukkit.Bukkit.getBukkitVersion());
}
@@ -58,6 +58,8 @@ public class PaperVersionFetcher implements VersionFetcher {
@@ -56,6 +57,8 @@ public class PaperVersionFetcher implements VersionFetcher {
private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) {
//int distance; // Purpur - use field
int distance;
+ // Kaiiju start - disable jenkins/api checking
+ /*
try {
int jenkinsBuild = Integer.parseInt(versionInfo);
distance = fetchDistanceFromSiteApi(jenkinsBuild, getMinecraftVersion());
@@ -65,6 +67,10 @@ public class PaperVersionFetcher implements VersionFetcher {
@@ -63,6 +66,10 @@ public class PaperVersionFetcher implements VersionFetcher {
versionInfo = versionInfo.replace("\"", "");
distance = fetchDistanceFromGitHub(repo, branch, versionInfo);
}
@@ -108,128 +107,124 @@ index 462a6eed350fd660ddaf25d567bb6e97b77d0b2b..ecde56de475b5a69e2ad22c1cbe903e6
switch (distance) {
case -1:
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
index 3cb56595822799926a8141e60a42f5d1edfc6de5..7ae1c10ebfb8b61e7d0fa63c96ff2dee98294f4d 100644
index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..1c7b5d91e914efbcfb50c6137c7760787e38ad94 100644
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
@@ -17,7 +17,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
@Override
protected LineReader buildReader(LineReaderBuilder builder) {
builder
- .appName("Purpur") // Purpur
+ .appName("Kaiiju") // Purpur // Kaiiju
- .appName("Paper")
+ .appName("Kaiiju") // Kaiiju
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
.completer(new ConsoleCommandCompleter(this.server))
.option(LineReader.Option.COMPLETE_IN_WORD, true);
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
index b5b6657e52e4f7a630229bd3ba433438af293e22..afda0d4198398de29a62159fae701b222969e9fa 100644
index abe37c7c3c6f5ab73afd738ec78f06d7e4d2ed96..52fc6bb99f6024273c7438d01314b576da66bd1a 100644
--- a/src/main/java/net/minecraft/CrashReport.java
+++ b/src/main/java/net/minecraft/CrashReport.java
@@ -125,7 +125,7 @@ public class CrashReport {
stringbuilder.append("---- Minecraft Crash Report ----\n");
// Purpur start
stringbuilder.append("// ");
- stringbuilder.append("// DO NOT REPORT THIS TO PAPER! REPORT TO PURPUR INSTEAD!");
+ stringbuilder.append("// DO NOT REPORT THIS TO PAPER/PURPUR! REPORT TO KAIIJU INSTEAD!"); // Kaiiju
// Purpur end
stringbuilder.append("// ");
stringbuilder.append(CrashReport.getErrorComment());
- stringbuilder.append("\n\n");
+ stringbuilder.append("// DO NOT REPORT THIS TO PAPER/FOLIA! REPORT TO KAIIJU INSTEAD!"); // Kaiiju
stringbuilder.append("Time: ");
stringbuilder.append(CrashReport.DATE_TIME_FORMATTER.format(ZonedDateTime.now()));
stringbuilder.append("\n");
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 46b9aed8ab46bd4bfdcf44a392ffc34e26da0f5f..f731de904f9228513624edffe7ef9763ef0fd8f7 100644
index f5721f6d719b7055fdccc81d5e67ed758e90cb10..0696ad97437726fd6a13badfe7db0617dfbfb1ad 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -930,7 +930,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -999,7 +999,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
shutdownThread = Thread.currentThread();
org.spigotmc.WatchdogThread.doStop(); // Paper
if (!isSameThread()) {
- MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO PURPUR)"); // Purpur
+ MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO KAIIJU)"); // Purpur // Kaiiju
if (false && !isSameThread()) { // Folia - region threading
- MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO PAPER)");
+ MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO KAIIJU)"); // Kaiiju
while (this.getRunningThread().isAlive()) {
this.getRunningThread().stop();
try {
@@ -1833,7 +1833,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
public String getServerModName() {
- return "Folia"; // Folia - Folia > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return "Kaiiju"; // Kaiiju - Kaiiju > // Folia - Folia > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
}
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index bc1a2df0a7ddaf030917e4723994464d77e55d02..c8641ee7cf081b86a461c640ccd70ec4fc39330b 100644
index 32c9b38036052649b7b5fb25d7c4a49fdd1ca972..176f3acec268dad80cc90029edd88e7a0c3e8885 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -256,7 +256,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {
- private final String serverName = "Purpur"; // Paper // Pufferfish // Purpur
+ private final String serverName = "Kaiiju"; // Paper // Pufferfish // Purpur // Kaiiju
- private final String serverName = "Folia"; // Folia // Paper
+ private final String serverName = "Kaiiju"; // Kaiiju // Folia // Paper
private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft");
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index cf7ba8724ab68f6955b5ebfa1ba46c4397da32b3..d5b65d6d0e8c8dea86c69b666448e6f6d7d4e9d6 100644
index bd115a08512e6f4c13bc30ce2b05c7378754754f..d1b0483448a42f2d790eae353904bf6890178e1b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -883,7 +883,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -891,7 +891,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return EntityCategory.WATER;
}
- throw new UnsupportedOperationException("Unsupported monster type: " + type + ". This is a bug, report this to Purpur."); // Purpur
+ throw new UnsupportedOperationException("Unsupported monster type: " + type + ". This is a bug, report this to Kaiiju."); // Purpur // Kaiiju
- throw new UnsupportedOperationException("Unsupported monster type: " + type + ". This is a bug, report this to Spigot.");
+ throw new UnsupportedOperationException("Unsupported monster type: " + type + ". This is a bug, report this to Kaiiju."); // Kaiiju
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 5402098dce0d64d3dceea51f248d7d366850a74f..2b7a67c339994c34296f7057ffc8822b4aa0036b 100644
index 9136fb30db749737e9f189d0901024fcad02e402..ac23657071ac5eb951706374ee16a4274728c5bd 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -504,7 +504,7 @@ public class CraftScheduler implements BukkitScheduler {
this.parsePending();
} else {
//this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
- task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Purpur"); // Paper // Purpur
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Kaiiju"); // Paper // Purpur // Kaiiju
- task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Paper"); // Paper
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Kaiiju"); // Paper // Kaiiju
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 99597258e8e88cd9e2c901c4ac3ff7faeeabee2b..6e863169f510332f659ac2a24f796ee32730cda7 100644
index e9b6ca3aa25e140467ae866d572483050ea3fa0e..5df2b0fceebaaa863f4f143c8f29e808b7f0c49b 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
@@ -11,7 +11,7 @@ public final class Versioning {
public static String getBukkitVersion() {
String result = "Unknown-Version";
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.purpurmc.purpur/purpur-api/pom.properties"); // Pufferfish // Purpur
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/dev.kaiijumc.kaiiju/kaiiju-api/pom.properties"); // Pufferfish // Purpur // Kaiiju
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/dev.folia/folia-api/pom.properties"); // Folia
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/dev.kaiijumc.kaiiju/kaiiju-api/pom.properties"); // Folia // Kaiiju
Properties properties = new Properties();
if (stream != null) {
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 0bcbe1f07ff8e552d2abd6e432af5710005acc04..c6f09e562dd0eb25f3e556627d07758a045d7409 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -227,7 +227,7 @@ public class PurpurConfig {
deathMessageOnlyBroadcastToAffectedPlayer = getBoolean("settings.broadcasts.death.only-broadcast-to-affected-player", deathMessageOnlyBroadcastToAffectedPlayer);
}
- public static String serverModName = "Purpur";
+ public static String serverModName = "Kaiiju"; // Kaiiju
private static void serverModName() {
serverModName = getString("settings.server-mod-name", serverModName);
}
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index a810bfd3b8d6bd4d8f2ef8797e4281ae4fe8a67f..7e92d77edb448f2ec818bf4b876d3df56d6362cc 100644
index e9fa7faaa4451e36b3908cbcbbe0baf213abde96..eea30035f7ce41f8f3c60afbbd255ae42166a306 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -155,14 +155,14 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
if (isLongTimeout) {
// Paper end
log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Purpur bug." ); // Paper // Purpur
+ log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Kaiiju bug." ); // Paper // Purpur // Kaiiju
- log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Paper bug." ); // Paper
+ log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Kaiiju bug." ); // Paper // Kaiiju
log.log( Level.SEVERE, "If you see a plugin in the Server thread dump below, then please report it to that author" );
log.log( Level.SEVERE, "\t *Especially* if it looks like HTTP or MySQL operations are occurring" );
log.log( Level.SEVERE, "If you see a world save or edit, then it means you did far more than your server can handle at once" );
log.log( Level.SEVERE, "\t If this is the case, consider increasing timeout-time in spigot.yml but note that this will replace the crash with LARGE lag spikes" );
- log.log( Level.SEVERE, "If you are unsure or still think this is a Purpur bug, please report this to https://github.com/PurpurMC/Purpur/issues" ); // Purpur
+ log.log( Level.SEVERE, "If you are unsure or still think this is a Kaiiju bug, please report this to https://github.com/KaiijuMC/Kaiiju/issues" ); // Purpur // Kaiiju
- log.log( Level.SEVERE, "If you are unsure or still think this is a Paper bug, please report this to https://github.com/PaperMC/Paper/issues" );
+ log.log( Level.SEVERE, "If you are unsure or still think this is a Kaiiju bug, please report this to https://github.com/KaiijuMC/Kaiiju/issues" ); // Kaiiju
log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
- log.log( Level.SEVERE, "Purpur version: " + Bukkit.getServer().getVersion() ); // Purpur
+ log.log( Level.SEVERE, "Kaiiju version: " + Bukkit.getServer().getVersion() ); // Purpur // Kaiiju
- log.log( Level.SEVERE, "Paper version: " + Bukkit.getServer().getVersion() );
+ log.log( Level.SEVERE, "Kaiiju version: " + Bukkit.getServer().getVersion() ); // Kaiiju
//
if ( net.minecraft.world.level.Level.lastPhysicsProblem != null )
{
@@ -237,14 +232,14 @@ index a810bfd3b8d6bd4d8f2ef8797e4281ae4fe8a67f..7e92d77edb448f2ec818bf4b876d3df5
// Paper end
} else
{
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PURPUR - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Purpur
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO KAIIJU - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Purpur // Kaiiju
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO KAIIJU - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Kaiiju
log.log(Level.SEVERE, "The server has not responded for " + (currentTime - lastTick) / 1000 + " seconds! Creating thread dump");
}
// Paper end - Different message for short timeout
log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Purpur!):" ); // Paper // Purpur
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Kaiiju!):" ); // Paper // Purpur // Kaiiju
- log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Kaiiju!):" ); // Paper // Kaiiju
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(isLongTimeout); // Paper // Paper - rewrite chunk system
this.dumpTickingInfo(); // Paper - log detailed tick information
WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
@@ -252,8 +247,8 @@ index a810bfd3b8d6bd4d8f2ef8797e4281ae4fe8a67f..7e92d77edb448f2ec818bf4b876d3df5
WatchdogThread.dumpThread( thread, log );
}
} else {
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PURPUR - THIS IS NOT A BUG OR A CRASH ---"); // Purpur
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO KAIIJU - THIS IS NOT A BUG OR A CRASH ---"); // Purpur // Kaiiju
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO KAIIJU - THIS IS NOT A BUG OR A CRASH ---"); // Kaiiju
}
log.log( Level.SEVERE, "------------------------------" );

View File

@@ -339,10 +339,10 @@ index 0000000000000000000000000000000000000000..dd4c3ca77acb3aeefc69b8eb948b8b20
\ No newline at end of file
diff --git a/src/main/java/dev/kaiijumc/kaiiju/command/KaiijuCommand.java b/src/main/java/dev/kaiijumc/kaiiju/command/KaiijuCommand.java
new file mode 100644
index 0000000000000000000000000000000000000000..0dde8879856f8882f2840b4b8bfb5aa0b3f06b91
index 0000000000000000000000000000000000000000..08a2375b90a2088e2bdfb3e316144677346a3dd6
--- /dev/null
+++ b/src/main/java/dev/kaiijumc/kaiiju/command/KaiijuCommand.java
@@ -0,0 +1,68 @@
@@ -0,0 +1,67 @@
+package dev.kaiijumc.kaiiju.command;
+
+import dev.kaiijumc.kaiiju.KaiijuConfig;
@@ -396,7 +396,6 @@ index 0000000000000000000000000000000000000000..0dde8879856f8882f2840b4b8bfb5aa0
+ KaiijuConfig.reload((File) console.options.valueOf("kaiiju-settings"));
+ for (ServerLevel level : console.getAllLevels()) {
+ level.kaiijuConfig.reload();
+ level.resetBreedingCooldowns();
+ }
+ console.server.reloadCount++;
+
@@ -413,13 +412,13 @@ index 0000000000000000000000000000000000000000..0dde8879856f8882f2840b4b8bfb5aa0
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 582467e3419c23446b20d3076fbfce22115250a8..429223724ee5f90cda8d15fa8095a2335a6eacba 100644
index 7abd4f38ae59a6019137345af960fd60a3c7adf0..426777730f77664c69bd0a084a9323d767ebc0ad 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -227,6 +227,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
org.purpurmc.purpur.PurpurConfig.registerCommands();
// Purpur end
@@ -218,6 +218,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
thread.start(); // Paper - start console thread after MinecraftServer.console & PaperConfig are initialized
io.papermc.paper.command.PaperCommands.registerCommands(this);
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics();
+ // Kaiiju start
+ try {
+ dev.kaiijumc.kaiiju.KaiijuConfig.init((java.io.File) options.valueOf("kaiiju-settings"));
@@ -433,57 +432,57 @@ index 582467e3419c23446b20d3076fbfce22115250a8..429223724ee5f90cda8d15fa8095a233
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
// Paper end
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index b8001bca2a33ec1e60566948a651400418a6e9e7..666b96835338d4407ef5093668055cbab5c3b6f2 100644
index c7c682cd2d1498e6d6521ddd62acdc1168bfe152..53b9444ff6120628d23ad27fc87d9cd9bdf66648 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -178,6 +178,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -167,6 +167,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper end
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur
+ public final dev.kaiijumc.kaiiju.KaiijuWorldConfig kaiijuConfig; // Kaiiju
+
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
public static BlockPos lastPhysicsProblem; // Spigot
private org.spigotmc.TickLimiter entityLimiter;
@@ -333,6 +335,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -294,6 +296,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper
this.purpurConfig = new org.purpurmc.purpur.PurpurWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // Purpur
+ this.kaiijuConfig = new dev.kaiijumc.kaiiju.KaiijuWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // Kaiiju
this.playerBreedingCooldowns = this.getNewBreedingCooldownCache(); // Purpur
this.generator = gen;
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index c8641ee7cf081b86a461c640ccd70ec4fc39330b..46dc1072e2237e8c9bb4ddbc7d6ca5aab0de4885 100644
index b1680507c05547458e1199412ab97105b67f8973..d1468cb0ae1850719d40524dad9b14fbdb0f79a1 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -971,6 +971,7 @@ public final class CraftServer implements Server {
@@ -1067,6 +1067,7 @@ public final class CraftServer implements Server {
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
this.console.paperConfigurations.reloadConfigs(this.console);
org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
+ dev.kaiijumc.kaiiju.KaiijuConfig.init((File) console.options.valueOf("kaiiju-settings")); // Kaiiju
for (ServerLevel world : this.console.getAllLevels()) {
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
@@ -987,6 +988,7 @@ public final class CraftServer implements Server {
@@ -1082,6 +1083,7 @@ public final class CraftServer implements Server {
}
}
world.spigotConfig.init(); // Spigot
world.purpurConfig.init(); // Purpur
+ world.kaiijuConfig.init(); // Kaiiju
}
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
@@ -1003,6 +1005,7 @@ public final class CraftServer implements Server {
@@ -1097,6 +1099,7 @@ public final class CraftServer implements Server {
this.reloadData();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
org.purpurmc.purpur.PurpurConfig.registerCommands(); // Purpur
+ dev.kaiijumc.kaiiju.KaiijuConfig.registerCommands(); // Kaiiju
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
@@ -2828,6 +2831,13 @@ public final class CraftServer implements Server {
@@ -2857,6 +2860,13 @@ public final class CraftServer implements Server {
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
}
// Purpur end
+ // Kaiiju start
+ @Override
@@ -496,12 +495,12 @@ index c8641ee7cf081b86a461c640ccd70ec4fc39330b..46dc1072e2237e8c9bb4ddbc7d6ca5aa
public void restart() {
org.spigotmc.RestartCommand.restart();
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index ab05f4151e6ec7404a85ddb3a141ed39d9ed86d7..f722c000ddff9718319d0cb07d18b6f4d9291309 100644
index 4966a1e3dd35357a8ea6a7d2944c84c9c3e9058e..79a004dda72365afddb80fcd730828e351d7cce1 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -187,6 +187,14 @@ public class Main {
.describedAs("Yml file");
// Purpur end
@@ -173,6 +173,14 @@ public class Main {
.describedAs("Jar file");
// Paper end
+ // Purpur Start
+ acceptsAll(asList("kaiiju", "kaiiju-settings"), "File for kaiiju settings")

View File

@@ -61,10 +61,10 @@ index dd4c3ca77acb3aeefc69b8eb948b8b202ff87a19..b194f4dbebcbbf5bb4e026a0169e2d24
}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f731de904f9228513624edffe7ef9763ef0fd8f7..5f3c0040fcc319a5e796cdadaffed3b31af4f0c7 100644
index 0696ad97437726fd6a13badfe7db0617dfbfb1ad..a7233bcc99e9bf148348ebb36bbb15b2eadb381f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -858,7 +858,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -897,7 +897,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper start - rewrite chunk system
worldserver.save((ProgressListener) null, flush, worldserver.noSave && !force, close);
if (flush) {
@@ -73,7 +73,7 @@ index f731de904f9228513624edffe7ef9763ef0fd8f7..5f3c0040fcc319a5e796cdadaffed3b3
}
// Paper end - rewrite chunk system
}
@@ -882,7 +882,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -921,7 +921,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
//MinecraftServer.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", worldserver2.getChunkSource().chunkMap.getStorageName()); // Paper - move up
}

View File

@@ -4,17 +4,15 @@ Date: Fri, 10 Feb 2023 22:21:56 +0200
Subject: [PATCH] Kaiiju RegionFormat Linear
Documentation: https://github.com/xymb-endcrystalme/LinearRegionFileFormatTools
Copyright xymb@endcrystal.me
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/build.gradle.kts b/build.gradle.kts
index d4f74093cb1bf46eb94e8a47c2fd6e8ee06980f0..9ff2d0cc6d1c6f17f656f0d46dbaf593032844c8 100644
index 6dd416f65755ca0542e6661b8716672264120d59..4686019a152114e63e997ee103fc8424b24b4581 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -13,6 +13,10 @@ dependencies {
exclude("io.papermc.paper", "paper-api")
}
// Pufferfish end
// Folia end
+ // Kaiiju start - Linear format
+ implementation("com.github.luben:zstd-jni:1.5.4-1")
+ implementation("org.lz4:lz4-java:1.8.0")
@@ -111,10 +109,10 @@ index 0000000000000000000000000000000000000000..dcfbabf54b19a4c29d5c95830242c5c2
+}
diff --git a/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
new file mode 100644
index 0000000000000000000000000000000000000000..f05d6313012560c32a3ec574b7169ec8e8930282
index 0000000000000000000000000000000000000000..32213e1f2432a2ee0c27331e83a04696d4cdd0cc
--- /dev/null
+++ b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
@@ -0,0 +1,334 @@
@@ -0,0 +1,336 @@
+package dev.kaiijumc.kaiiju.region;
+
+import com.github.luben.zstd.ZstdInputStream;
@@ -123,7 +121,6 @@ index 0000000000000000000000000000000000000000..f05d6313012560c32a3ec574b7169ec8
+import net.jpountz.lz4.LZ4Compressor;
+import net.jpountz.lz4.LZ4Factory;
+import net.jpountz.lz4.LZ4FastDecompressor;
+import net.jpountz.xxhash.XXHashFactory;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.world.level.ChunkPos;
+import net.minecraft.world.level.chunk.ChunkStatus;
@@ -329,11 +326,14 @@ index 0000000000000000000000000000000000000000..f05d6313012560c32a3ec574b7169ec8
+ byte[] compressed = zstdByteArray.toByteArray();
+
+ dataStream.writeInt(compressed.length);
+ dataStream.writeLong(XXHashFactory.fastestInstance().hash64().hash(compressed, 0, compressed.length, 0)); // TODO: Hash the contents, not the whole thing
+ dataStream.writeLong(0);
+
+ dataStream.write(compressed, 0, compressed.length);
+ dataStream.writeLong(SUPERBLOCK);
+
+ dataStream.flush();
+ fileStream.getFD().sync();
+ fileStream.getChannel().force(true); // Ensure atomicity on Btrfs
+ dataStream.close();
+
+ fileStream.close();
@@ -450,7 +450,7 @@ index 0000000000000000000000000000000000000000..f05d6313012560c32a3ec574b7169ec8
+ }
+}
diff --git a/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java b/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java
index a08cde4eefe879adcee7c4118bc38f98c5097ed0..1cfc20b7496f93aff1d6c2387dc5bb8bacab8dc8 100644
index 8a11e10b01fa012b2f98b1c193c53251e848f909..61001e76b38f8647b33e73b5cc15b4b6785cf49a 100644
--- a/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java
+++ b/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java
@@ -811,7 +811,7 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
@@ -462,17 +462,17 @@ index a08cde4eefe879adcee7c4118bc38f98c5097ed0..1cfc20b7496f93aff1d6c2387dc5bb8b
if (file == null) { // null if no regionfile exists
return Boolean.FALSE;
}
@@ -819,7 +819,7 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
return file.hasChunk(chunkPos) ? Boolean.TRUE : Boolean.FALSE;
});
} else {
@@ -824,7 +824,7 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
return Boolean.FALSE;
} // else: it either exists or is not known, fall back to checking the loaded region file
- return taskController.computeForRegionFileIfLoaded(chunkX, chunkZ, (final RegionFile file) -> {
+ return taskController.computeForRegionFileIfLoaded(chunkX, chunkZ, (final dev.kaiijumc.kaiiju.region.AbstractRegionFile file) -> { // Kaiiju
if (file == null) { // null if not loaded
// not sure at this point, let the I/O thread figure it out
return Boolean.TRUE;
}
@@ -1116,9 +1116,9 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
return !this.tasks.isEmpty();
@@ -1126,9 +1126,9 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
return this.getCache().doesRegionFileNotExistNoIO(new ChunkPos(chunkX, chunkZ));
}
- public <T> T computeForRegionFile(final int chunkX, final int chunkZ, final boolean existingOnly, final Function<RegionFile, T> function) {
@@ -483,7 +483,7 @@ index a08cde4eefe879adcee7c4118bc38f98c5097ed0..1cfc20b7496f93aff1d6c2387dc5bb8b
synchronized (cache) {
try {
regionFile = cache.getRegionFile(new ChunkPos(chunkX, chunkZ), existingOnly, true);
@@ -1131,19 +1131,19 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
@@ -1141,19 +1141,19 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
return function.apply(regionFile);
} finally {
if (regionFile != null) {
@@ -507,7 +507,7 @@ index a08cde4eefe879adcee7c4118bc38f98c5097ed0..1cfc20b7496f93aff1d6c2387dc5bb8b
}
}
@@ -1151,7 +1151,7 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
@@ -1161,7 +1161,7 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread {
return function.apply(regionFile);
} finally {
if (regionFile != null) {
@@ -537,10 +537,10 @@ index 513833c2ea23df5b079d157bc5cb89d5c9754c0b..a62a1b281bd0b6ad7d59b45b9470d84f
long expectedChunks = (long)regionFiles.length * (32L * 32L);
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 5d330c938aa0d707460b740ecf5c51d001c89c49..86dc7e23fb53f6ba8baff1aa0309af78b248844b 100644
index 6f12d91f73e04c25fb0bc9054dc7d49de16e614a..43503974433c4d1808b2acb2b79f46d640725dc0 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -294,7 +294,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -272,7 +272,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
@@ -548,8 +548,8 @@ index 5d330c938aa0d707460b740ecf5c51d001c89c49..86dc7e23fb53f6ba8baff1aa0309af78
+ super(world.getLevel().kaiijuConfig.regionFormatName, world.getLevel().kaiijuConfig.regionFormatLinearCompressionLevel, session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); // Kaiiju
// Paper - rewrite chunk system
this.tickingGenerated = new AtomicInteger();
this.playerMap = new PlayerMap();
@@ -339,7 +339,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
//this.playerMap = new PlayerMap(); // Folia - region threading
@@ -317,7 +317,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.lightEngine = new ThreadedLevelLightEngine(chunkProvider, this, this.level.dimensionType().hasSkyLight(), null, null); // Paper - rewrite chunk system
this.distanceManager = new ChunkMap.ChunkDistanceManager(executor, mainThreadExecutor);
this.overworldDataStorage = persistentStateManagerFactory;
@@ -558,7 +558,7 @@ index 5d330c938aa0d707460b740ecf5c51d001c89c49..86dc7e23fb53f6ba8baff1aa0309af78
this.setViewDistance(viewDistance);
// Paper start
this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
@@ -953,13 +953,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -849,13 +849,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper start - chunk status cache "api"
public ChunkStatus getChunkStatusOnDiskIfCached(ChunkPos chunkPos) {
@@ -574,7 +574,7 @@ index 5d330c938aa0d707460b740ecf5c51d001c89c49..86dc7e23fb53f6ba8baff1aa0309af78
if (regionFile == null || !regionFileCache.chunkExists(chunkPos)) {
return null;
@@ -977,7 +977,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -873,7 +873,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public void updateChunkStatusOnDisk(ChunkPos chunkPos, @Nullable CompoundTag compound) throws IOException {
@@ -584,10 +584,10 @@ index 5d330c938aa0d707460b740ecf5c51d001c89c49..86dc7e23fb53f6ba8baff1aa0309af78
regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkSerializer.getStatus(compound));
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 69ba84de4880a579c400b6daefdb98b44e9e28e8..83126ee9d737cf695c34e239c204fe8c4d02c243 100644
index acc8af33ad8534d812908b0feb9a1963ee2c64fb..20359c63b19c7e0c703ef1562fb774803d631c41 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -388,9 +388,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -425,9 +425,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
private final EntityRegionFileStorage entityStorage;
private static final class EntityRegionFileStorage extends net.minecraft.world.level.chunk.storage.RegionFileStorage {
@@ -599,7 +599,7 @@ index 69ba84de4880a579c400b6daefdb98b44e9e28e8..83126ee9d737cf695c34e239c204fe8c
}
protected void write(ChunkPos pos, net.minecraft.nbt.CompoundTag nbt) throws IOException {
@@ -583,7 +582,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -633,7 +632,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// CraftBukkit end
boolean flag2 = minecraftserver.forceSynchronousWrites();
DataFixer datafixer = minecraftserver.getFixerUpper();
@@ -659,10 +659,10 @@ index e0bfeebeaac1aaea64bc07cdfdf7790e3e43ca7b..469802b9c454c5e98c0a55ba89559d9d
try {
for (int i1 = 0; i1 < 32; ++i1) {
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
index 8950b220b9a3512cd4667beb7bdec0e82e07edc6..71b38521fd2039bb2ddfdc5dc89341282869ce30 100644
index 9c56304476b4fc841b5d7694232617586ebd8e84..f560aa13c6c8ffecb456f478687dc6a9eb5e8017 100644
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
@@ -57,8 +57,8 @@ public class PoiManager extends SectionStorage<PoiSection> {
@@ -59,8 +59,8 @@ public class PoiManager extends SectionStorage<PoiSection> {
// Paper end - rewrite chunk system
@@ -754,10 +754,10 @@ index dcfe090c269d4cbcc2eb1b6f85392848bb34656c..d42c320179ae055b8675d1ce6ce1788e
try (DataInputStream out = new DataInputStream(new java.io.BufferedInputStream(new InflaterInputStream(Files.newInputStream(file))))) {
return NbtIo.read((java.io.DataInput) out);
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0300335fb 100644
index 9633b01d2d961fd1403e353484d336376ef009eb..c9fbba6f709ed0540dcc22b41e50ce9d01a6381c 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -22,17 +22,25 @@ public class RegionFileStorage implements AutoCloseable {
@@ -22,9 +22,13 @@ public class RegionFileStorage implements AutoCloseable {
public static final String ANVIL_EXTENSION = ".mca";
private static final int MAX_CACHE_SIZE = 256;
@@ -772,6 +772,10 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0
private final boolean isChunkData; // Paper
@@ -57,11 +61,15 @@ public class RegionFileStorage implements AutoCloseable {
}
// Paper end - cache regionfile does not exist state
- protected RegionFileStorage(Path directory, boolean dsync) { // Paper - protected constructor
+ protected RegionFileStorage(String format, int linearCompression, Path directory, boolean dsync) { // Paper - protected constructor
// Paper start - add isChunkData param
@@ -787,7 +791,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0
this.isChunkData = isChunkData;
// Paper end - add isChunkData param
this.folder = directory;
@@ -42,7 +50,7 @@ public class RegionFileStorage implements AutoCloseable {
@@ -71,7 +79,7 @@ public class RegionFileStorage implements AutoCloseable {
// Paper start
public static @Nullable ChunkPos getRegionFileCoordinates(Path file) {
String fileName = file.getFileName().toString();
@@ -796,7 +800,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0
return null;
}
@@ -62,49 +70,68 @@ public class RegionFileStorage implements AutoCloseable {
@@ -91,29 +99,29 @@ public class RegionFileStorage implements AutoCloseable {
}
}
@@ -819,7 +823,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0
- public synchronized RegionFile getRegionFile(ChunkPos chunkcoordintpair, boolean existingOnly, boolean lock) throws IOException {
+ public synchronized dev.kaiijumc.kaiiju.region.AbstractRegionFile getRegionFile(ChunkPos chunkcoordintpair, boolean existingOnly, boolean lock) throws IOException { // Kaiiju
// Paper end
long i = ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ());
long i = ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()); final long regionPos = i; // Paper - OBFHELPER
- RegionFile regionfile = (RegionFile) this.regionCache.getAndMoveToFirst(i);
+ dev.kaiijumc.kaiiju.region.AbstractRegionFile regionfile = this.regionCache.getAndMoveToFirst(i); // Kaiiju
@@ -832,18 +836,21 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0
}
// Paper end
return regionfile;
} else {
@@ -124,28 +132,46 @@ public class RegionFileStorage implements AutoCloseable {
}
// Paper end - cache regionfile does not exist state
if (this.regionCache.size() >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.regionFileCacheSize) { // Paper - configurable
- ((RegionFile) this.regionCache.removeLast()).close();
+ this.regionCache.removeLast().close(); // Kaiiju
}
FileUtil.createDirectoriesSafe(this.folder);
// Paper - only create directory if not existing only - moved down
Path path = this.folder;
int j = chunkcoordintpair.getRegionX();
- Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca"); // Paper - diff on change
- if (existingOnly && !java.nio.file.Files.exists(path1)) return null; // CraftBukkit
- RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync, this.isChunkData); // Paper - allow for chunk regionfiles to regen header
- if (existingOnly && !java.nio.file.Files.exists(path1)) { // Paper start - cache regionfile does not exist state
- this.markNonExisting(regionPos);
- return null; // CraftBukkit
+ // Kaiiju start - Polyglot
+ //Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca"); // Paper - diff on change
+ Path path1;
@@ -852,17 +859,24 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0
+ Path linear = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".linear");
+ if (java.nio.file.Files.exists(anvil)) path1 = anvil;
+ else if (java.nio.file.Files.exists(linear)) path1 = linear;
+ else return null;
+ } else {
+ else {
+ this.markNonExisting(regionPos);
+ return null;
+ }
} else {
+ String extension = switch (this.format) {
+ case "LINEAR" -> "linear";
+ default -> "mca";
+ };
+ path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + "." + extension);
+ }
this.createRegionFile(regionPos);
}
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.regionFormatDebug)
+ org.bukkit.Bukkit.getLogger().info("[Region File Storage] Opening file " + path1 + " with format " + this.format + " (existingOnly = " + existingOnly + ")");
+ //if (existingOnly && !java.nio.file.Files.exists(path1)) return null; // CraftBukkit
+ org.bukkit.Bukkit.getLogger().info("Opening file " + path1 + " with format " + this.format + " (existingOnly = " + existingOnly + ")");
+
// Paper end - cache regionfile does not exist state
FileUtil.createDirectoriesSafe(this.folder); // Paper - only create directory if not existing only - moved from above
- RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync, this.isChunkData); // Paper - allow for chunk regionfiles to regen header
+ // Kaiiju end
+
+ dev.kaiijumc.kaiiju.region.AbstractRegionFile regionfile1 = dev.kaiijumc.kaiiju.region.AbstractRegionFileFactory.getAbstractRegionFile(this.linearCompression, path1, this.folder, this.sync, this.isChunkData); // Paper - allow for chunk regionfiles to regen header // Kaiiju
@@ -876,7 +890,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0
}
// Paper end
return regionfile1;
@@ -132,7 +159,7 @@ public class RegionFileStorage implements AutoCloseable {
@@ -173,7 +199,7 @@ public class RegionFileStorage implements AutoCloseable {
}
@@ -885,7 +899,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0
synchronized (regionfile) {
try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) {
CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z);
@@ -179,14 +206,14 @@ public class RegionFileStorage implements AutoCloseable {
@@ -220,14 +246,14 @@ public class RegionFileStorage implements AutoCloseable {
@Nullable
public CompoundTag read(ChunkPos pos) throws IOException {
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
@@ -902,7 +916,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0
// We add the regionfile parameter to avoid the potential deadlock (on fileLock) if we went back to obtain a regionfile
// if we decide to re-read
// Paper end
@@ -196,7 +223,7 @@ public class RegionFileStorage implements AutoCloseable {
@@ -237,7 +263,7 @@ public class RegionFileStorage implements AutoCloseable {
// Paper start
if (regionfile.isOversized(pos.x, pos.z)) {
@@ -911,7 +925,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0
return readOversizedChunk(regionfile, pos);
}
// Paper end
@@ -210,12 +237,12 @@ public class RegionFileStorage implements AutoCloseable {
@@ -251,12 +277,12 @@ public class RegionFileStorage implements AutoCloseable {
if (this.isChunkData) {
ChunkPos chunkPos = ChunkSerializer.getChunkCoordinate(nbttagcompound);
if (!chunkPos.equals(pos)) {
@@ -927,7 +941,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0
return null;
}
}
@@ -249,13 +276,13 @@ public class RegionFileStorage implements AutoCloseable {
@@ -290,13 +316,13 @@ public class RegionFileStorage implements AutoCloseable {
return nbttagcompound;
} finally { // Paper start
@@ -943,7 +957,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0
if (regionfile == null) {
return;
}
@@ -285,7 +312,7 @@ public class RegionFileStorage implements AutoCloseable {
@@ -326,7 +352,7 @@ public class RegionFileStorage implements AutoCloseable {
}
protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException {
@@ -952,7 +966,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0
if (nbt == null && regionfile == null) {
return;
}
@@ -335,7 +362,7 @@ public class RegionFileStorage implements AutoCloseable {
@@ -376,7 +402,7 @@ public class RegionFileStorage implements AutoCloseable {
}
// Paper end
} finally { // Paper start
@@ -961,7 +975,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0
} // Paper end
}
@@ -344,7 +371,7 @@ public class RegionFileStorage implements AutoCloseable {
@@ -385,7 +411,7 @@ public class RegionFileStorage implements AutoCloseable {
ObjectIterator objectiterator = this.regionCache.values().iterator();
while (objectiterator.hasNext()) {
@@ -970,7 +984,7 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..254bc0d853770ef36ff10bce92be37f0
try {
regionfile.close();
@@ -360,7 +387,7 @@ public class RegionFileStorage implements AutoCloseable {
@@ -401,7 +427,7 @@ public class RegionFileStorage implements AutoCloseable {
ObjectIterator objectiterator = this.regionCache.values().iterator();
while (objectiterator.hasNext()) {
@@ -995,10 +1009,10 @@ index 5561b8499a0503b850974b1dc309edfb80219549..414aa3ae00c2d28e754235e3e93b6b62
this.factory = factory;
this.fixerUpper = dataFixer;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index c6a3b59c65466f9f2b16cefe0059a6e5dd84044c..e9cca721fb065fe6ac715bbeef65343f528d0a42 100644
index 2ead9af36c4d41c61b68a960ff17e25894efeb2a..cba3411386b7a9f596017d021d08f30c78f0c52b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -552,7 +552,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -554,7 +554,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return true;
}

View File

@@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
Date: Sat, 11 Feb 2023 02:10:20 +0200
Subject: [PATCH] Kaiiju Lobotomize Configuration
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
index b194f4dbebcbbf5bb4e026a0169e2d24806b46ec..907fdfb368c87bfe7b4374bb0b5f49d5ff095339 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
@@ -143,4 +143,7 @@ public class KaiijuWorldConfig {
regionFormatLinearCompressionLevel = 1;
}
}
+
+ private void lobotomizeSettings() {
+ }
}
\ No newline at end of file

View File

@@ -1,358 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
Date: Sat, 11 Feb 2023 06:29:15 +0200
Subject: [PATCH] Kaiiju Lobotomize Animal
Inspired by "Lobotomized animals" by @KioProject123
Checks might be a nuisance to performance.
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
index 907fdfb368c87bfe7b4374bb0b5f49d5ff095339..b99b438b92587f23c77c5321d5d23e76dc5450de 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
@@ -144,6 +144,17 @@ public class KaiijuWorldConfig {
}
}
+ public boolean lobotomizeAnimalEnabled = false;
+ public int lobotomizeAnimalCheckInterval = 100;
+ public boolean lobotomizeAnimalCheckCanJump = true;
+ public boolean lobotomizeAnimalLookAtPlayer = false;
+ public boolean lobotomizeAnimalFloat = true;
+
private void lobotomizeSettings() {
+ lobotomizeAnimalEnabled = getBoolean("lobotomize.animal.enabled", lobotomizeAnimalEnabled);
+ lobotomizeAnimalCheckInterval = getInt("lobotomize.animal.check-interval", lobotomizeAnimalCheckInterval);
+ lobotomizeAnimalCheckCanJump = getBoolean("lobotomize.animal.check-can-jump", lobotomizeAnimalCheckCanJump);
+ lobotomizeAnimalLookAtPlayer = getBoolean("lobotomize.animal.look-at-player", lobotomizeAnimalLookAtPlayer);
+ lobotomizeAnimalFloat = getBoolean("lobotomize.animal.float", lobotomizeAnimalFloat);
}
}
\ No newline at end of file
diff --git a/src/main/java/dev/kaiijumc/kaiiju/entity/Lobotomized.java b/src/main/java/dev/kaiijumc/kaiiju/entity/Lobotomized.java
new file mode 100644
index 0000000000000000000000000000000000000000..14f085e75295882f52634622b40676295cd78d5f
--- /dev/null
+++ b/src/main/java/dev/kaiijumc/kaiiju/entity/Lobotomized.java
@@ -0,0 +1,73 @@
+package dev.kaiijumc.kaiiju.entity;
+
+import net.minecraft.core.BlockPos;
+import net.minecraft.world.entity.LivingEntity;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.level.block.state.BlockState;
+import net.minecraft.world.level.pathfinder.PathComputationType;
+
+public class Lobotomized {
+ private boolean isLobotomized = false;
+ private int notLobotomizedCount = 0;
+
+ public boolean isLobotomized() {
+ return this.isLobotomized;
+ }
+
+ public void setLobotomized(boolean b) {
+ this.isLobotomized = b;
+ }
+
+ public boolean checkLobotomized(LivingEntity entity) {
+ Level level = entity.getLevel();
+ int interval = level.kaiijuConfig.lobotomizeAnimalCheckInterval;
+ if (this.notLobotomizedCount > 3) {
+ // check half as often if not lobotomized for the last 3+ consecutive checks
+ interval *= 2;
+ }
+ if ((entity.getId() + entity.tickCount) % interval == 0) {
+ this.isLobotomized = entity.isOnGround() && !canTravelFrom(entity, level, entity.getBbHeight() <= 1.0F);
+
+ if (this.isLobotomized) {
+ this.notLobotomizedCount = 0;
+ } else {
+ this.notLobotomizedCount++;
+ }
+ }
+ return this.isLobotomized;
+ }
+
+ private boolean canTravelFrom(LivingEntity entity, Level level, boolean ignoreTop) {
+ BlockPos pos = new BlockPos(entity.getBlockX(), (int) (entity.getY() + 0.5D), entity.getBlockZ());
+ return canTravelTo(entity, pos.east(), level, ignoreTop)
+ || canTravelTo(entity, pos.west(), level, ignoreTop)
+ || canTravelTo(entity, pos.north(), level, ignoreTop)
+ || canTravelTo(entity, pos.south(), level, ignoreTop);
+ }
+
+ private boolean canTravelTo(LivingEntity entity, BlockPos pos, Level level, boolean ignoreTop) {
+ BlockState top;
+ // Check if mob can jump over block
+ if (level.kaiijuConfig.lobotomizeAnimalCheckCanJump && canJump(entity, level, ignoreTop)) {
+ top = level.getBlockStateIfLoaded(pos.above());
+ if (top == null) return false;
+ if (top.isPathfindable(level, pos, net.minecraft.world.level.pathfinder.PathComputationType.LAND)) {
+ if (ignoreTop) return true;
+ net.minecraft.world.level.block.state.BlockState above = level.getBlockState(pos.above(2));
+ if (above.isPathfindable(level, pos, net.minecraft.world.level.pathfinder.PathComputationType.LAND)) return true;
+ }
+ }
+ BlockState bottom = level.getBlockStateIfLoaded(pos);
+ if (bottom == null) return false; // Chunk not loaded
+ if (!bottom.isPathfindable(level, pos, PathComputationType.LAND)) return false;
+ if (ignoreTop) return true;
+ top = level.getBlockState(pos.above());
+ return top.isPathfindable(level, pos, PathComputationType.LAND);
+ }
+
+ private boolean canJump(LivingEntity entity, Level level, boolean ignoreTop) {
+ BlockPos pos = new BlockPos(entity.getBlockX(), (int) (entity.getY() + 2.5D), entity.getBlockZ());
+ net.minecraft.world.level.block.Block above = level.getBlockIfLoaded(pos);
+ return !above.hasCollision;
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 8d7c33e16f9eaec2120c5aad75172ff656d1bd17..52b09f9ff2a7bc36ae742a53c5141d7de03fb848 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -303,6 +303,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.brain = this.makeBrain(new Dynamic(dynamicopsnbt, (Tag) dynamicopsnbt.createMap((Map) ImmutableMap.of(dynamicopsnbt.createString("memories"), (Tag) dynamicopsnbt.emptyMap()))));
}
+ public boolean isLobotomized() { return false; } // Kaiiju
+
protected void initAttributes() {}// Purpur
public Brain<?> getBrain() {
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java
index 7093c62be53fe99ed9880fc8ddaa07440fe4f715..2acbb26af2c24b2f4c569d55e8ba44a068fd9d86 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java
@@ -16,6 +16,7 @@ public class FloatGoal extends Goal {
@Override
public boolean canUse() {
+ if (!this.mob.getLevel().kaiijuConfig.lobotomizeAnimalFloat && this.mob.isLobotomized()) return false; // Kaiiju
return this.mob.isInWater() && this.mob.getFluidHeight(FluidTags.WATER) > this.mob.getFluidJumpThreshold() || this.mob.isInLava();
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FollowParentGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FollowParentGoal.java
index a668d5263586f955a5656ac66bcc7fe8cc51fe00..c195e60a7773f106775cded4f1c3ed51a69ca2f5 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/FollowParentGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/FollowParentGoal.java
@@ -21,6 +21,7 @@ public class FollowParentGoal extends Goal {
@Override
public boolean canUse() {
+ if (this.animal.isLobotomized()) return false; // Kaiiju
if (this.animal.getAge() >= 0) {
return false;
} else {
@@ -51,6 +52,7 @@ public class FollowParentGoal extends Goal {
@Override
public boolean canContinueToUse() {
+ if (this.animal.isLobotomized()) return false; // Kaiiju
if (this.animal.getAge() >= 0) {
return false;
} else if (!this.parent.isAlive()) {
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java
index 8b189d7587303263efa1790066e5a83edd45f9d7..1304fc96834e4ce7156076fd893993a0aa75cbbc 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/LookAtPlayerGoal.java
@@ -48,6 +48,7 @@ public class LookAtPlayerGoal extends Goal {
@Override
public boolean canUse() {
+ if (!mob.getLevel().kaiijuConfig.lobotomizeAnimalLookAtPlayer && this.mob.isLobotomized()) return false; // Kaiiju
if (this.mob.getRandom().nextFloat() >= this.probability) {
return false;
} else {
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PanicGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/PanicGoal.java
index 268b7457c2a93af6d36c1c5f623c5856f94a7af1..f1469e424f7bdf4e5813f250c0eae673db0b9049 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/PanicGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/PanicGoal.java
@@ -29,6 +29,7 @@ public class PanicGoal extends Goal {
@Override
public boolean canUse() {
+ if (this.mob.isLobotomized()) return false; // Kaiiju
if (!this.shouldPanic()) {
return false;
} else {
@@ -81,6 +82,7 @@ public class PanicGoal extends Goal {
@Override
public boolean canContinueToUse() {
+ if (this.mob.isLobotomized()) return false; // Kaiiju
// CraftBukkit start - introduce a temporary timeout hack until this is fixed properly
if ((this.mob.tickCount - this.mob.lastHurtByMobTimestamp) > 100) {
this.mob.setLastHurtByMob((LivingEntity) null);
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java
index 216929c838446c3c14d9b9906ffa625ef35fcbc8..3ea2e7c44018ec63b8f17fd3e5e3a23e2b1f72e4 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java
@@ -35,6 +35,7 @@ public class RandomStrollGoal extends Goal {
@Override
public boolean canUse() {
+ if (this.mob.isLobotomized()) return false; // Kaiiju
if (this.mob.isVehicle()) {
return false;
} else {
@@ -68,6 +69,7 @@ public class RandomStrollGoal extends Goal {
@Override
public boolean canContinueToUse() {
+ if (this.mob.isLobotomized()) return false; // Kaiiju
return !this.mob.getNavigation().isDone() && !this.mob.isVehicle();
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/TemptGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/TemptGoal.java
index 2cbc9adc8e417def48be03d08174a5833068ec65..3234d5bf3b9ae01dbe8e26a0a3f21ff875fe6769 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/TemptGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/TemptGoal.java
@@ -43,6 +43,7 @@ public class TemptGoal extends Goal {
@Override
public boolean canUse() {
+ if (this.mob.isLobotomized()) return false; // Kaiiju
if (this.calmDown > 0) {
--this.calmDown;
return false;
@@ -67,6 +68,7 @@ public class TemptGoal extends Goal {
@Override
public boolean canContinueToUse() {
+ if (this.mob.isLobotomized()) return false; // Kaiiju
if (this.canScare()) {
if (this.mob.distanceToSqr((Entity) this.player) < 36.0D) {
if (this.player.distanceToSqr(this.px, this.py, this.pz) > 0.010000000000000002D) {
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index 6d127ed3da899851ca95b2be6792e2abca1aca12..31f98654389dc030b70ab38530d4a7be31686279 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -198,6 +198,7 @@ public abstract class PathNavigation {
// Paper end
public boolean moveTo(Entity entity, double speed) {
+ if (this.mob.isLobotomized()) return false; // Kaiiju
// Paper start - Pathfinding optimizations
if (this.pathfindFailures > 10 && this.path == null && net.minecraft.server.MinecraftServer.currentTick < this.lastFailure + 40) {
return false;
@@ -218,6 +219,7 @@ public abstract class PathNavigation {
}
public boolean moveTo(@Nullable Path path, double speed) {
+ if (this.mob.isLobotomized()) return false; // Kaiiju
if (path == null) {
this.path = null;
return false;
diff --git a/src/main/java/net/minecraft/world/entity/animal/Animal.java b/src/main/java/net/minecraft/world/entity/animal/Animal.java
index 2ac88f06ebb79e515cd9934ac1e3e2c8003d9e3c..d89c0db4c4173d8558dc4f8b15ddb5815ef7c09e 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Animal.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Animal.java
@@ -13,7 +13,6 @@ import net.minecraft.tags.BlockTags;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
-import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.AgeableMob;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.ExperienceOrb;
@@ -39,6 +38,7 @@ public abstract class Animal extends AgeableMob {
@Nullable
public UUID loveCause;
public ItemStack breedItem; // CraftBukkit - Add breedItem variable
+ protected dev.kaiijumc.kaiiju.entity.Lobotomized lobotomized = new dev.kaiijumc.kaiiju.entity.Lobotomized(); // Kaiiju
public abstract int getPurpurBreedTime(); // Purpur
protected Animal(EntityType<? extends Animal> type, Level world) {
@@ -74,8 +74,32 @@ public abstract class Animal extends AgeableMob {
}
}
+ this.lobotomized.checkLobotomized(this); // Kaiiju
}
+ // Kaiiju start
+ @Override
+ public void travel(net.minecraft.world.phys.Vec3 vec3) {
+ if (!this.isLobotomized() || net.minecraft.server.MinecraftServer.currentTick % 100 == 0) {
+ super.travel(vec3);
+ }
+ }
+
+ @Override
+ public boolean isCollidable(boolean ignoreClimbing) {
+ if (!this.isLobotomized() || net.minecraft.server.MinecraftServer.currentTick % 20 == 0) {
+ return super.isCollidable(ignoreClimbing);
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isLobotomized() {
+ if (!this.level.kaiijuConfig.lobotomizeAnimalEnabled) return false;
+ return this.lobotomized.isLobotomized();
+ }
+ // Kaiiju end
+
/* CraftBukkit start
// Function disabled as it has no special function anymore after
// setSitting is disabled.
@@ -102,6 +126,7 @@ public abstract class Animal extends AgeableMob {
if (this.loveCause != null) {
nbt.putUUID("LoveCause", this.loveCause);
}
+ nbt.putBoolean("Kaiiju.Lobotomized", this.lobotomized.isLobotomized()); // Kaiiju
}
@@ -115,6 +140,13 @@ public abstract class Animal extends AgeableMob {
super.readAdditionalSaveData(nbt);
this.inLove = nbt.getInt("InLove");
this.loveCause = nbt.hasUUID("LoveCause") ? nbt.getUUID("LoveCause") : null;
+ // Kaiiju start
+ boolean isLobotomized = nbt.getBoolean("Kaiiju.Lobotomized");
+ this.lobotomized.setLobotomized(isLobotomized);
+ if (isLobotomized) {
+ this.onGround = true;
+ }
+ // Kaiiju end
}
public static boolean checkAnimalSpawnRules(EntityType<? extends Animal> type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, RandomSource random) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index d47dc0c3fe8c2b80d7b7eb828a12af6eb32145e4..bb3a7efd11731d518cf8ef29f25c855bbbba0568 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -1042,6 +1042,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override
public boolean canBeeUse() {
+ if (Bee.this.isLobotomized()) return false; // Kaiiju
return Bee.this.remainingCooldownBeforeLocatingNewHive == 0 && !Bee.this.hasHive() && Bee.this.wantsToEnterHive();
}
@@ -1108,6 +1109,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override
public boolean canBeeUse() {
+ if (Bee.this.isLobotomized()) return false; // Kaiiju
return Bee.this.hivePos != null && !Bee.this.hasRestriction() && Bee.this.wantsToEnterHive() && !this.hasReachedTarget(Bee.this.hivePos) && Bee.this.level.getBlockState(Bee.this.hivePos).is(BlockTags.BEEHIVES);
}
@@ -1224,6 +1226,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override
public boolean canBeeUse() {
+ if (Bee.this.isLobotomized()) return false; // Kaiiju
return Bee.this.savedFlowerPos != null && !Bee.this.hasRestriction() && this.wantsToGoToKnownFlower() && Bee.this.isFlowerValid(Bee.this.savedFlowerPos) && !Bee.this.closerThan(Bee.this.savedFlowerPos, 2);
}
@@ -1276,6 +1279,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override
public boolean canBeeUse() {
+ if (Bee.this.isLobotomized()) return false; // Kaiiju
return Bee.this.getCropsGrownSincePollination() >= 10 ? false : (Bee.this.random.nextFloat() < 0.3F ? false : Bee.this.hasNectar() && Bee.this.isHiveValid());
}

View File

@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
Date: Thu, 16 Feb 2023 01:49:54 +0200
Subject: [PATCH] Purpur Network Send Null Entity Packets
Subject: [PATCH] Purpur Network SendNullEntityPackets
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -20,10 +20,10 @@ index 7c6d43d8a360530344ef296f4477750c8a298607..ab08e11f13921163b8ff1ff51ff9e9b8
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 6afee2a744a3498d4a0eee35f77cde444f73d12c..06439712c2bfd0e817d8b9d8c301dc0283eb3ef4 100644
index b7fd8e70413c38923d0719aff803449e392383ac..fc778cf828c42065a7928d2f920fc1442aa4d503 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -207,6 +207,11 @@ public class ServerEntity {
@@ -205,6 +205,11 @@ public class ServerEntity {
flag4 = true;
flag5 = true;
}
@@ -35,7 +35,7 @@ index 6afee2a744a3498d4a0eee35f77cde444f73d12c..06439712c2bfd0e817d8b9d8c301dc02
}
if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) {
@@ -281,6 +286,20 @@ public class ServerEntity {
@@ -279,6 +284,20 @@ public class ServerEntity {
}));
}

View File

@@ -1,168 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kugge <sofiane.djerbi38@gmail.com>
Date: Mon, 13 Feb 2023 00:53:40 +0100
Subject: [PATCH] Kaiiju Lobotomize Villager
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
index b99b438b92587f23c77c5321d5d23e76dc5450de..366948e447c0729389ec53286236a82cb57e97a2 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
@@ -149,6 +149,12 @@ public class KaiijuWorldConfig {
public boolean lobotomizeAnimalCheckCanJump = true;
public boolean lobotomizeAnimalLookAtPlayer = false;
public boolean lobotomizeAnimalFloat = true;
+ public boolean lobotomizeVillagerEnabled = false;
+ public int lobotomizeVillagerCheckInterval = 100;
+ public boolean lobotomizeVillagerCheckCanJump = true;
+ public boolean lobotomizeVillagerCheckOnBed = true;
+ public boolean lobotomizeVillagerCheckJobSite = true;
+ public boolean lobotomizeVillagerCheckBedNearby = true;
private void lobotomizeSettings() {
lobotomizeAnimalEnabled = getBoolean("lobotomize.animal.enabled", lobotomizeAnimalEnabled);
@@ -156,5 +162,11 @@ public class KaiijuWorldConfig {
lobotomizeAnimalCheckCanJump = getBoolean("lobotomize.animal.check-can-jump", lobotomizeAnimalCheckCanJump);
lobotomizeAnimalLookAtPlayer = getBoolean("lobotomize.animal.look-at-player", lobotomizeAnimalLookAtPlayer);
lobotomizeAnimalFloat = getBoolean("lobotomize.animal.float", lobotomizeAnimalFloat);
+ lobotomizeVillagerEnabled = getBoolean("lobotomize.villager.enabled", lobotomizeVillagerEnabled);
+ lobotomizeVillagerCheckInterval = getInt("lobotomize.villager.check-interval", lobotomizeVillagerCheckInterval);
+ lobotomizeVillagerCheckCanJump = getBoolean("lobotomize.villager.check-can-jump", lobotomizeVillagerCheckCanJump);
+ lobotomizeVillagerCheckOnBed = getBoolean("lobotomize.villager.check-on-bed", lobotomizeVillagerCheckOnBed);
+ lobotomizeVillagerCheckJobSite = getBoolean("lobotomize.villager.check-job-site", lobotomizeVillagerCheckJobSite);
+ lobotomizeVillagerCheckBedNearby = getBoolean("lobotomize.villager.check-bed-nearby", lobotomizeVillagerCheckBedNearby);
}
}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 26857b0e5134f56df47115031727e0ad68216bc6..ae629509eef3904abbb2e9881cd277b2e57f7c89 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -200,14 +200,14 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}
private boolean checkLobotomized() {
- int interval = this.level.purpurConfig.villagerLobotomizeCheckInterval;
+ int interval = this.level.kaiijuConfig.lobotomizeVillagerCheckInterval; // Kaiiju
if (this.notLobotomizedCount > 3) {
// check half as often if not lobotomized for the last 3+ consecutive checks
interval *= 2;
}
- if (this.level.getGameTime() % interval == 0) {
- // offset Y for short blocks like dirt_path/farmland TODO: check that it works
- this.isLobotomized = !canTravelFrom(this.getBlockPosBelowThatAffectsMyMovement());
+ if ((this.getId() + this.tickCount) % interval == 0) { // Kaiiju - Avoid check lags
+ // offset Y for short blocks like dirt_path/farmland
+ this.isLobotomized = needLobotomy(); // Kaiiju - Override
if (this.isLobotomized) {
this.notLobotomizedCount = 0;
@@ -219,8 +219,81 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}
private boolean canTravelFrom(BlockPos pos) {
- return canTravelTo(pos.east()) || canTravelTo(pos.west()) || canTravelTo(pos.north()) || canTravelTo(pos.south());
- }
+ return canInteractAt(pos.east()) || canInteractAt(pos.west()) || canInteractAt(pos.north()) || canInteractAt(pos.south()); // Kaiiju
+ }
+
+ // Kaiiju start - Customize canTravelTo checks
+ private boolean needLobotomy() {
+ if (this.isSleeping()) return false;
+ if (this.level.kaiijuConfig.lobotomizeVillagerCheckOnBed && isOnBed()) return false;
+ return !canTravelFrom(new BlockPos(this.getBlockX(), (int) (this.getY() + 0.5D), this.getBlockZ()));
+ }
+
+ private boolean canInteractAt(BlockPos pos) {
+ net.minecraft.world.level.block.state.BlockState top = null;
+ // STEP 1: CHECK IF MOB CAN MOVE
+ // A/ MOVE BY JUMPING
+ if (this.level.kaiijuConfig.lobotomizeVillagerCheckCanJump && this.canJump()) {
+ top = this.level.getBlockStateIfLoaded(pos.above());
+ if (top == null) return false;
+ if (top.isPathfindable(level, pos, net.minecraft.world.level.pathfinder.PathComputationType.LAND)) {
+ net.minecraft.world.level.block.state.BlockState above = this.level.getBlockState(pos.above(2));
+ if (above.isPathfindable(level, pos, net.minecraft.world.level.pathfinder.PathComputationType.LAND)) return true;
+ }
+ }
+ // B/ MOVE BY WALKING
+ net.minecraft.world.level.block.state.BlockState bottom = this.level.getBlockStateIfLoaded(pos);
+ if (bottom == null) return false;
+ net.minecraft.world.level.block.Block bottomBlock = bottom.getBlock();
+ // BED CHECK
+ if (isTallBlock(bottomBlock)) return false;
+ if (this.level.kaiijuConfig.lobotomizeVillagerCheckBedNearby && isBed(bottomBlock)) return true;
+ if (!bottom.isPathfindable(level, pos, net.minecraft.world.level.pathfinder.PathComputationType.LAND)) return false;
+ if (top == null) top = this.level.getBlockState(pos.above());
+ if (!top.isPathfindable(level, pos, net.minecraft.world.level.pathfinder.PathComputationType.LAND)) return false;
+ // STEP 2: IF ITS NEAR IS JOB SITE: LOBOTOMIZE
+ return !(this.level.kaiijuConfig.lobotomizeVillagerCheckJobSite && isAssociatedJobSite(bottomBlock, this.getVillagerData().getProfession()));
+ }
+
+ private boolean canJump() {
+ BlockPos pos = new BlockPos(this.getBlockX(), (int) (this.getY() + 2.5D), this.getBlockZ());
+ net.minecraft.world.level.block.Block above = this.level.getBlockIfLoaded(pos);
+ return !above.hasCollision;
+ }
+
+ private boolean isOnBed() {
+ BlockPos pos = new BlockPos(this.getBlockX(), (int) (this.getY() - 0.5D), this.getBlockZ());
+ net.minecraft.world.level.block.Block below = this.level.getBlockIfLoaded(pos);
+ return isBed(below);
+ }
+
+ private static boolean isBed(net.minecraft.world.level.block.Block block) {
+ return block instanceof net.minecraft.world.level.block.BedBlock;
+ }
+
+ private boolean isAssociatedJobSite(net.minecraft.world.level.block.Block block, VillagerProfession profession) {
+ if (this.lastTradedPlayer == null) return false;
+ return (block instanceof net.minecraft.world.level.block.BlastFurnaceBlock && profession == VillagerProfession.ARMORER) ||
+ (block instanceof net.minecraft.world.level.block.SmokerBlock && profession == VillagerProfession.BUTCHER) ||
+ (block instanceof net.minecraft.world.level.block.CartographyTableBlock && profession == VillagerProfession.CARTOGRAPHER) ||
+ (block instanceof net.minecraft.world.level.block.BrewingStandBlock && profession == VillagerProfession.CLERIC) ||
+ (block instanceof net.minecraft.world.level.block.ComposterBlock && profession == VillagerProfession.FARMER) ||
+ (block instanceof net.minecraft.world.level.block.BarrelBlock && profession == VillagerProfession.FISHERMAN) ||
+ (block instanceof net.minecraft.world.level.block.FletchingTableBlock && profession == VillagerProfession.FLETCHER) ||
+ (block instanceof net.minecraft.world.level.block.CauldronBlock && profession == VillagerProfession.LEATHERWORKER) ||
+ (block instanceof net.minecraft.world.level.block.LecternBlock && profession == VillagerProfession.LIBRARIAN) ||
+ (block instanceof net.minecraft.world.level.block.StonecutterBlock && profession == VillagerProfession.MASON) ||
+ (block instanceof net.minecraft.world.level.block.LoomBlock && profession == VillagerProfession.SHEPHERD) ||
+ (block instanceof net.minecraft.world.level.block.SmithingTableBlock && profession == VillagerProfession.TOOLSMITH) ||
+ (block instanceof net.minecraft.world.level.block.GrindstoneBlock && profession == VillagerProfession.WEAPONSMITH);
+ }
+
+ private static boolean isTallBlock(net.minecraft.world.level.block.Block block) {
+ return block instanceof net.minecraft.world.level.block.FenceBlock ||
+ block instanceof net.minecraft.world.level.block.FenceGateBlock ||
+ block instanceof net.minecraft.world.level.block.WallBlock;
+ }
+ // Kaiiju end
private boolean canTravelTo(BlockPos pos) {
net.minecraft.world.level.block.state.BlockState state = this.level.getBlockStateIfLoaded(pos);
@@ -337,7 +410,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
protected void mobTick(boolean inactive) {
//this.level.getProfiler().push("villagerBrain"); // Purpur
// Purpur start
- if (this.level.purpurConfig.villagerLobotomizeEnabled) {
+ if (this.level.kaiijuConfig.lobotomizeVillagerEnabled) { // Kaiiju - Override
// treat as inactive if lobotomized
inactive = inactive || checkLobotomized();
} else {
@@ -659,6 +732,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
if (this.assignProfessionWhenSpawned) {
nbt.putBoolean("AssignProfessionWhenSpawned", true);
}
+ nbt.putBoolean("Kaiiju.Lobotomized", this.isLobotomized()); // Kaiiju
}
@@ -699,6 +773,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
if (nbt.contains("AssignProfessionWhenSpawned")) {
this.assignProfessionWhenSpawned = nbt.getBoolean("AssignProfessionWhenSpawned");
}
+ this.isLobotomized = nbt.getBoolean("Kaiiju.Lobotomized"); // Kaiiju
}

View File

@@ -0,0 +1,71 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
Date: Fri, 31 Mar 2023 01:52:44 +0300
Subject: [PATCH] Purpur Network AlternateKeepalive
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index ab08e11f13921163b8ff1ff51ff9e9b86d2b47c7..b42a3466f145a92608c8746fd4beb529b4a60b01 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -200,8 +200,10 @@ public class KaiijuConfig {
}
public static boolean sendNullEntityPackets = true;
+ public static boolean alternateKeepAlive = false;
private static void networkSettings() {
sendNullEntityPackets = getBoolean("network.send-null-entity-packets", sendNullEntityPackets);
+ alternateKeepAlive = getBoolean("network.alternate-keepalive", alternateKeepAlive);
}
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4963e87adf11c9df90f0dd4b60d360a137c07bc9..5f73e794a248a4d11b58b169831622ca1f61aac6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -261,6 +261,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private long keepAliveTime = Util.getMillis();
private boolean keepAlivePending;
private long keepAliveChallenge;
+ private it.unimi.dsi.fastutil.longs.LongList keepAlives = new it.unimi.dsi.fastutil.longs.LongArrayList(); // Kaiiju
// CraftBukkit start - multithreaded fields
private final AtomicInteger chatSpamTickCount = new AtomicInteger();
private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits
@@ -352,6 +353,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
long currentTime = Util.getMillis();
long elapsedTime = currentTime - this.keepAliveTime;
+ // Kaiiju start
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.alternateKeepAlive) {
+ if (elapsedTime >= 1000L) { // 1 second
+ if (!processedDisconnect && keepAlives.size() * 1000L >= KEEPALIVE_LIMIT) {
+ LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName());
+ disconnect(Component.translatable("disconnect.timeout"), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT);
+ } else {
+ keepAliveTime = currentTime; // hijack this field for 1 second intervals
+ keepAlives.add(currentTime); // currentTime is ID
+ send(new ClientboundKeepAlivePacket(currentTime));
+ }
+ }
+ } else
+ // Kaiiju end
if (this.keepAlivePending) {
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
@@ -3534,6 +3549,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
+ // Kaiiju start
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.alternateKeepAlive) {
+ long id = packet.getId();
+ if (keepAlives.size() > 0 && keepAlives.contains(id)) {
+ int ping = (int) (Util.getMillis() - id);
+ player.latency = (player.latency * 3 + ping) / 4;
+ keepAlives.clear(); // we got a valid response, lets roll with it and forget the rest
+ }
+ } else
+ // Kaiiju end
//PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // CraftBukkit // Paper - This shouldn't be on the main thread
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
int i = (int) (Util.getMillis() - this.keepAliveTime);

View File

@@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
Date: Sat, 8 Apr 2023 23:32:34 +0300
Subject: [PATCH] Kaiiju Gameplay Configuration
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index b42a3466f145a92608c8746fd4beb529b4a60b01..6d0e1edfb7d3c020f70f6a194f16e836b462c4de 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -206,4 +206,7 @@ public class KaiijuConfig {
sendNullEntityPackets = getBoolean("network.send-null-entity-packets", sendNullEntityPackets);
alternateKeepAlive = getBoolean("network.alternate-keepalive", alternateKeepAlive);
}
+
+ private static void gameplaySettings() {
+ }
}
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
index b194f4dbebcbbf5bb4e026a0169e2d24806b46ec..73d79fe0077b28db2f9e7fa13a1ae6eff9abd6a9 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
@@ -143,4 +143,7 @@ public class KaiijuWorldConfig {
regionFormatLinearCompressionLevel = 1;
}
}
+
+ private void gameplaySettings() {
+ }
}
\ No newline at end of file

View File

@@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xymb <xymb@endcrystal.me>
Date: Sat, 8 Apr 2023 23:38:13 +0300
Subject: [PATCH] Kaiiju Gameplay ShulkerDropContentsWhenDestroyed
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
index 73d79fe0077b28db2f9e7fa13a1ae6eff9abd6a9..bac11b0e30a86d0689693ff129b53bcad7c2034c 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
@@ -144,6 +144,9 @@ public class KaiijuWorldConfig {
}
}
+ public boolean shulkerBoxDropContentsWhenDestroyed = true;
+
private void gameplaySettings() {
+ shulkerBoxDropContentsWhenDestroyed = getBoolean("gameplay.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
}
}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
index b0204af850ee182773ad458208cccd946ad148d5..cb67928eb9d493b4c43489aa06a5c0c947999dac 100644
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
@@ -288,7 +288,7 @@ public class BlockItem extends Item {
@Override
public void onDestroyed(ItemEntity entity) {
- if (this.block instanceof ShulkerBoxBlock) {
+ if (this.block instanceof ShulkerBoxBlock && entity.getLevel().kaiijuConfig.shulkerBoxDropContentsWhenDestroyed) { // Kaiiju
ItemStack itemstack = entity.getItem();
CompoundTag nbttagcompound = BlockItem.getBlockEntityData(itemstack);

View File

@@ -1,20 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
Date: Thu, 16 Feb 2023 21:28:49 +0200
Subject: [PATCH] Kaiiju Lithium Configuration
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index 6f16786e6107b9e9b52cdbd052c633e757fe351f..913f2f26b1d022e8a812af7caa5dfca5fa548782 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -204,4 +204,9 @@ public class KaiijuConfig {
private static void networkSettings() {
sendNullEntityPackets = getBoolean("network.send-null-entity-packets", sendNullEntityPackets);
}
+
+ public static boolean lithiumEnable = true;
+ private static void lithiumSettings() {
+ lithiumEnable = getBoolean("lithium.enable", lithiumEnable);
+ }
}

View File

@@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
Date: Sun, 9 Apr 2023 17:06:46 +0300
Subject: [PATCH] Purpur Gameplay ServerModName
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index 6d0e1edfb7d3c020f70f6a194f16e836b462c4de..9fb33b35b4d6842ca8597f77a4116e3983ebfbcb 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -207,6 +207,9 @@ public class KaiijuConfig {
alternateKeepAlive = getBoolean("network.alternate-keepalive", alternateKeepAlive);
}
+ public static String serverModName = "Kaiiju";
+
private static void gameplaySettings() {
+ serverModName = getString("gameplay.server-mod-name", serverModName);
}
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a7233bcc99e9bf148348ebb36bbb15b2eadb381f..865b022bb52d8d7b12355a01f3216a4ee8d4c045 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1833,7 +1833,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
public String getServerModName() {
- return "Kaiiju"; // Kaiiju - Kaiiju > // Folia - Folia > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return dev.kaiijumc.kaiiju.KaiijuConfig.serverModName; // Kaiiju - Kaiiju > // Folia - Folia > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
}
public SystemReport fillSystemReport(SystemReport details) {

View File

@@ -1,125 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
Date: Thu, 16 Feb 2023 21:34:37 +0200
Subject: [PATCH] Lithium Math FastUtil
Author: JellySquid
Licence: LGPL-3.0
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index 3a59a816fe35a0f329fbbde871dcb1933015990d..c044fc55f106e521bacf58424d1284069730bbf3 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -206,7 +206,9 @@ public class KaiijuConfig {
}
public static boolean lithiumEnable = true;
+ public static boolean lithiumMathFastUtil = true;
private static void lithiumSettings() {
lithiumEnable = getBoolean("lithium.enable", lithiumEnable);
+ lithiumMathFastUtil = getBoolean("lithium.math.fast-util", lithiumMathFastUtil) && lithiumEnable;
}
}
diff --git a/src/main/java/net/minecraft/core/AxisCycle.java b/src/main/java/net/minecraft/core/AxisCycle.java
index b5d8a60dc78a76c0a55bfc30cc49d26857bd914a..dd8d98acf21bb676e86f9befb45fd09e1b14a01d 100644
--- a/src/main/java/net/minecraft/core/AxisCycle.java
+++ b/src/main/java/net/minecraft/core/AxisCycle.java
@@ -35,6 +35,18 @@ public enum AxisCycle {
@Override
public Direction.Axis cycle(Direction.Axis axis) {
+ // Kaiiju start - Lithium
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathFastUtil){
+ switch (axis.ordinal()) {
+ case 0: //X
+ return Direction.Axis.Y;
+ case 1: //Y
+ return Direction.Axis.Z;
+ case 2: //Z
+ return Direction.Axis.X;
+ }
+ }
+ // Kaiiju end
return AXIS_VALUES[Math.floorMod(axis.ordinal() + 1, 3)];
}
@@ -56,6 +68,18 @@ public enum AxisCycle {
@Override
public Direction.Axis cycle(Direction.Axis axis) {
+ // Kaiiju start - Lithium
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathFastUtil){
+ switch (axis.ordinal()) {
+ case 0: //X
+ return Direction.Axis.Z;
+ case 1: //Y
+ return Direction.Axis.X;
+ case 2: //Z
+ return Direction.Axis.Y;
+ }
+ }
+ // Kaiiju end
return AXIS_VALUES[Math.floorMod(axis.ordinal() - 1, 3)];
}
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
index eaa620ad86abfb151b43f697973cbc731e2e5e92..e64a6f0d1b03c164d68ca8429d9f87c2dc90870a 100644
--- a/src/main/java/net/minecraft/core/Direction.java
+++ b/src/main/java/net/minecraft/core/Direction.java
@@ -192,6 +192,7 @@ public enum Direction implements StringRepresentable {
}
public Direction getOpposite() {
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathFastUtil) return VALUES[this.oppositeIndex]; // Kaiiju
return from3DDataValue(this.oppositeIndex);
}
@@ -454,6 +455,7 @@ public enum Direction implements StringRepresentable {
}
public static Direction getRandom(RandomSource random) {
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathFastUtil) return VALUES[random.nextInt(VALUES.length)]; // Kaiiju
return Util.getRandom(VALUES, random);
}
diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java
index 5b98d42b5d6bc07265fbb017e51a6281c148436a..e307429919ea4719dec89d7c7b54b888dd12b030 100644
--- a/src/main/java/net/minecraft/world/phys/AABB.java
+++ b/src/main/java/net/minecraft/world/phys/AABB.java
@@ -81,10 +81,36 @@ public class AABB {
}
public double min(Direction.Axis axis) {
+ // Kaiiju start - Lithium
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathFastUtil){
+ switch (axis.ordinal()) {
+ case 0: //X
+ return this.minX;
+ case 1: //Y
+ return this.minY;
+ case 2: //Z
+ return this.minZ;
+ }
+ throw new IllegalArgumentException();
+ }
+ // Kaiiju end
return axis.choose(this.minX, this.minY, this.minZ);
}
public double max(Direction.Axis axis) {
+ // Kaiiju start - Lithium
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathFastUtil){
+ switch (axis.ordinal()) {
+ case 0: //X
+ return this.maxX;
+ case 1: //Y
+ return this.maxY;
+ case 2: //Z
+ return this.maxZ;
+ }
+ throw new IllegalArgumentException();
+ }
+ // Kaiiju end
return axis.choose(this.maxX, this.maxY, this.maxZ);
}

View File

@@ -1,149 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
Date: Fri, 17 Feb 2023 00:34:31 +0200
Subject: [PATCH] Lithium Math SineLut
Author: JellySquid
Licence: LGPL-3.0
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index c044fc55f106e521bacf58424d1284069730bbf3..1fe1435b1cfe547ddbfccca01de580b8f0e59888 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -207,8 +207,10 @@ public class KaiijuConfig {
public static boolean lithiumEnable = true;
public static boolean lithiumMathFastUtil = true;
+ public static boolean lithiumMathSineLut = true;
private static void lithiumSettings() {
lithiumEnable = getBoolean("lithium.enable", lithiumEnable);
lithiumMathFastUtil = getBoolean("lithium.math.fast-util", lithiumMathFastUtil) && lithiumEnable;
+ lithiumMathSineLut = getBoolean("lithium.math.sine-lut", lithiumMathSineLut) && lithiumEnable;
}
}
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/math/CompactSineLUT.java b/src/main/java/me/jellysquid/mods/lithium/common/util/math/CompactSineLUT.java
new file mode 100644
index 0000000000000000000000000000000000000000..ccb45e94ea6d1a627df786fb88baec7edd1f2427
--- /dev/null
+++ b/src/main/java/me/jellysquid/mods/lithium/common/util/math/CompactSineLUT.java
@@ -0,0 +1,90 @@
+package me.jellysquid.mods.lithium.common.util.math;
+
+import net.minecraft.util.Mth;
+
+/**
+ * A replacement for the sine angle lookup table used in {@link MathHelper}, both reducing the size of LUT and improving
+ * the access patterns for common paired sin/cos operations.
+ *
+ * sin(-x) = -sin(x)
+ * ... to eliminate negative angles from the LUT.
+ *
+ * sin(x) = sin(pi/2 - x)
+ * ... to eliminate supplementary angles from the LUT.
+ *
+ * Using these identities allows us to reduce the LUT from 64K entries (256 KB) to just 16K entries (64 KB), enabling
+ * it to better fit into the CPU's caches at the expense of some cycles on the fast path. The implementation has been
+ * tightly optimized to avoid branching where possible and to use very quick integer operations.
+ *
+ * Generally speaking, reducing the size of a lookup table is always a good optimization, but since we need to spend
+ * extra CPU cycles trying to maintain parity with vanilla, there is the potential risk that this implementation ends
+ * up being slower than vanilla when the lookup table is able to be kept in cache memory.
+ *
+ * Unlike other "fast math" implementations, the values returned by this class are *bit-for-bit identical* with those
+ * from {@link MathHelper}. Validation is performed during runtime to ensure that the table is correct.
+ *
+ * @author coderbot16 Author of the original (and very clever) implementation in Rust:
+ * https://gitlab.com/coderbot16/i73/-/tree/master/i73-trig/src
+ * @author jellysquid3 Additional optimizations, port to Java
+ */
+public class CompactSineLUT {
+ private static final int[] SINE_TABLE_INT = new int[16384 + 1];
+ private static final float SINE_TABLE_MIDPOINT;
+
+ static {
+ final float[] SINE_TABLE = Mth.getSinTable();
+ // Copy the sine table, covering to raw int bits
+ for (int i = 0; i < SINE_TABLE_INT.length; i++) {
+ SINE_TABLE_INT[i] = Float.floatToRawIntBits(SINE_TABLE[i]);
+ }
+
+ SINE_TABLE_MIDPOINT = SINE_TABLE[SINE_TABLE.length / 2];
+
+ // Test that the lookup table is correct during runtime
+ for (int i = 0; i < SINE_TABLE.length; i++) {
+ float expected = SINE_TABLE[i];
+ float value = lookup(i);
+
+ if (expected != value) {
+ throw new IllegalArgumentException(String.format("LUT error at index %d (expected: %s, found: %s)", i, expected, value));
+ }
+ }
+ }
+
+ // [VanillaCopy] MathHelper#sin(float)
+ public static float sin(float f) {
+ return lookup((int) (f * 10430.378f) & 0xFFFF);
+ }
+
+ // [VanillaCopy] MathHelper#cos(float)
+ public static float cos(float f) {
+ return lookup((int) (f * 10430.378f + 16384.0f) & 0xFFFF);
+ }
+
+ private static float lookup(int index) {
+ // A special case... Is there some way to eliminate this?
+ if (index == 32768) {
+ return SINE_TABLE_MIDPOINT;
+ }
+
+ // Trigonometric identity: sin(-x) = -sin(x)
+ // Given a domain of 0 <= x <= 2*pi, just negate the value if x > pi.
+ // This allows the sin table size to be halved.
+ int neg = (index & 0x8000) << 16;
+
+ // All bits set if (pi/2 <= x), none set otherwise
+ // Extracts the 15th bit from 'half'
+ int mask = (index << 17) >> 31;
+
+ // Trigonometric identity: sin(x) = sin(pi/2 - x)
+ int pos = (0x8001 & mask) + (index ^ mask);
+
+ // Wrap the position in the table. Moving this down to immediately before the array access
+ // seems to help the Hotspot compiler optimize the bit math better.
+ pos &= 0x7fff;
+
+ // Fetch the corresponding value from the LUT and invert the sign bit as needed
+ // This directly manipulate the sign bit on the float bits to simplify logic
+ return Float.intBitsToFloat(SINE_TABLE_INT[pos] ^ neg);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/util/Mth.java b/src/main/java/net/minecraft/util/Mth.java
index a378a2ddd96e76925fa3409282d9606a86c72334..19531bb7e37d13bdffd43aebb6de105268119d2d 100644
--- a/src/main/java/net/minecraft/util/Mth.java
+++ b/src/main/java/net/minecraft/util/Mth.java
@@ -38,11 +38,24 @@ public class Mth {
private static final double[] ASIN_TAB = new double[257];
private static final double[] COS_TAB = new double[257];
+ public static float truncate(float value, float digits) {
+ float f = (float)Math.pow(10.0D, (double)digits);
+ return (float)((int)(value * f)) / f;
+ }
+
+ // Kaiiju start
+ public static float[] getSinTable() {
+ return SIN;
+ }
+ // Kaiiju end
+
public static float sin(float value) {
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathSineLut) return me.jellysquid.mods.lithium.common.util.math.CompactSineLUT.sin(value); // Kaiiju
return SIN[(int)(value * 10430.378F) & '\uffff'];
}
public static float cos(float value) {
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumMathSineLut) return me.jellysquid.mods.lithium.common.util.math.CompactSineLUT.cos(value); // Kaiiju
return SIN[(int)(value * 10430.378F + 16384.0F) & '\uffff'];
}

View File

@@ -1,102 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kugge <sofiane.djerbi38@gmail.com>
Date: Fri, 17 Feb 2023 19:43:55 +0100
Subject: [PATCH] Lithium Entity FastRetrieval
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
index 1fe1435b1cfe547ddbfccca01de580b8f0e59888..fd50b949135178a777abed362a0516591f5b9c98 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
@@ -208,9 +208,11 @@ public class KaiijuConfig {
public static boolean lithiumEnable = true;
public static boolean lithiumMathFastUtil = true;
public static boolean lithiumMathSineLut = true;
+ public static boolean lithiumEntityFastRetrieval = true;
private static void lithiumSettings() {
lithiumEnable = getBoolean("lithium.enable", lithiumEnable);
lithiumMathFastUtil = getBoolean("lithium.math.fast-util", lithiumMathFastUtil) && lithiumEnable;
lithiumMathSineLut = getBoolean("lithium.math.sine-lut", lithiumMathSineLut) && lithiumEnable;
+ lithiumEntityFastRetrieval = getBoolean("lithium.entity.fast-retrieval", lithiumEntityFastRetrieval) && lithiumEnable;
}
}
diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
index ee692b49c62f36287bf9d008861f5d47e0e42c00..e2f0aefb59864ef88cce22dde33f8a72a18fe829 100644
--- a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
+++ b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
@@ -41,6 +41,43 @@ public class EntitySectionStorage<T extends EntityAccess> {
int n = SectionPos.posToSectionCoord(box.maxY + 0.0D);
int o = SectionPos.posToSectionCoord(box.maxZ + 2.0D);
+ // Kaiiju start
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.lithiumEntityFastRetrieval) {
+ if (m >= j + 4 || o >= l + 4) {
+ // Vanilla is likely more optimized when shooting entities with TNT cannons over huge distances.
+ // Choosing a cutoff of 4 chunk size, as it becomes more likely that these entity sections do not exist when
+ // they are far away from the shot entity (player despawn range, position maybe not on the ground, etc.)
+ this.forEachAccessibleNonEmptySectionVanilla(j, k, l, m, n, o, consumer);
+ } else {
+ // Vanilla order of the AVL long set is sorting by ascending long value. The x, y, z positions are packed into
+ // a long with the x position's lowest 22 bits placed at the MSB.
+ // Therefore, the long is negative iff the 22nd bit of the x position is set, which happens iff the x position
+ // is negative. A positive x position will never have its 22nd bit set, as these big coordinates are far outside
+ // the world. y and z positions are treated as unsigned when sorting by ascending long value, as their sign bits
+ // are placed somewhere inside the packed long
+ for (int x = j; x <= m; x++) {
+ for (int z = Math.max(l, 0); z <= o; z++) {
+ if (this.forEachInColumn(x, k, n, z, consumer).shouldAbort()) {
+ this.forEachAccessibleNonEmptySectionVanilla(j, k, l, m, n, o, consumer);
+ return;
+ }
+ }
+ int bound = Math.min(-1, o);
+ for (int z = l; z <= bound; z++) {
+ if (this.forEachInColumn(x, k, n, z, consumer).shouldAbort()) {
+ this.forEachAccessibleNonEmptySectionVanilla(j, k, l, m, n, o, consumer);
+ return;
+ }
+ }
+ }
+ }
+ } else {
+ this.forEachAccessibleNonEmptySectionVanilla(j, k, l, m, n, o, consumer);
+ }
+ }
+
+ private void forEachAccessibleNonEmptySectionVanilla(int j, int k, int l, int n, int m, int o, AbortableIterationConsumer<EntitySection<T>> consumer) {
+ // Kaiiju end
for(int p = j; p <= m; ++p) {
long q = SectionPos.asLong(p, 0, 0);
long r = SectionPos.asLong(p, -1, -1);
@@ -60,6 +97,31 @@ public class EntitySectionStorage<T extends EntityAccess> {
}
}
+ // Kaiiju start
+ private AbortableIterationConsumer.Continuation forEachInColumn(int x, int k, int n, int z, AbortableIterationConsumer<EntitySection<T>> action) {
+ AbortableIterationConsumer.Continuation ret = AbortableIterationConsumer.Continuation.CONTINUE;
+ //y from negative to positive, but y is treated as unsigned
+ for (int y = Math.max(k, 0); y <= n; y++) {
+ if ((ret = this.consumeSection(SectionPos.asLong(x, y, z), action)).shouldAbort()) {
+ return ret;
+ }
+ }
+ int bound = Math.min(-1, n);
+ for (int y = k; y <= bound; y++) {
+ if ((ret = this.consumeSection(SectionPos.asLong(x, y, z), action)).shouldAbort()) {
+ return ret;
+ }
+ }
+ return ret;
+ }
+ private AbortableIterationConsumer.Continuation consumeSection(long pos, AbortableIterationConsumer<EntitySection<T>> action) {
+ EntitySection<T> entitySection = this.getSection(pos);
+ if (entitySection != null && 0 != entitySection.size() && entitySection.getStatus().isAccessible()) {
+ return action.accept(entitySection);
+ }
+ return AbortableIterationConsumer.Continuation.CONTINUE;
+ }
+ // Kaiiju end
public LongStream getExistingSectionPositionsInChunk(long chunkPos) {
int i = ChunkPos.getX(chunkPos);