Compare commits
21 Commits
build-208
...
dev/1.20.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68de640693 | ||
|
|
daf406eff3 | ||
|
|
5c08f71070 | ||
|
|
236822d92f | ||
|
|
2223418370 | ||
|
|
c2b7aec8f7 | ||
|
|
ad96ea2b9b | ||
|
|
4d0e6c8304 | ||
|
|
3c182ae67e | ||
|
|
95b2d636ab | ||
|
|
52e80e540b | ||
|
|
9cb7ff8b84 | ||
|
|
5897fbdfa6 | ||
|
|
042f11d759 | ||
|
|
1271516e58 | ||
|
|
0648cb49c8 | ||
|
|
35a7588d6d | ||
|
|
dc4931389b | ||
|
|
eb6be9f290 | ||
|
|
6d12ac828a | ||
|
|
baf0a46d91 |
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@@ -16,7 +16,6 @@ jobs:
|
||||
cache: 'gradle'
|
||||
distribution: 'graalvm'
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
version: 'latest'
|
||||
- name: Configure Git User Details
|
||||
run: |
|
||||
git config --global user.email "actions@github.com" && git config --global user.name "Github Actions"
|
||||
|
||||
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
@@ -16,7 +16,6 @@ jobs:
|
||||
cache: 'gradle'
|
||||
distribution: 'graalvm'
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
version: 'latest'
|
||||
- name: Configure Git User Details
|
||||
run: |
|
||||
git config --global user.email "actions@github.com" && git config --global user.name "Github Actions"
|
||||
|
||||
6
.github/workflows/upstream.yml
vendored
6
.github/workflows/upstream.yml
vendored
@@ -10,9 +10,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Git Repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v2.5.0
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
cache: 'gradle'
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
- name: Rebuild Patches
|
||||
run: ./gradlew rebuildPatches --stacktrace
|
||||
- name: Upload Paperclip jar
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kaiiju.jar
|
||||
path: build/libs/kaiiju-paperclip-*-reobf.jar
|
||||
|
||||
31
README.md
31
README.md
@@ -23,34 +23,30 @@
|
||||
### Configuration
|
||||
|
||||
```yaml
|
||||
region-format:
|
||||
linear:
|
||||
flush-frequency: 10
|
||||
flush-max-threads: 1
|
||||
network:
|
||||
send-null-entity-packets: true
|
||||
alternate-keepalive: false
|
||||
kick-player-on-bad-packet: true
|
||||
gameplay:
|
||||
server-mod-name: Kaiiju
|
||||
shared-random-for-players: true
|
||||
region-format:
|
||||
debug: false
|
||||
optimization:
|
||||
disable-vanish-api: false
|
||||
disable-player-stats: false
|
||||
disable-arm-swing-event: false
|
||||
disable-ensure-tick-thread-checks: false
|
||||
async-path-processing:
|
||||
enable: false
|
||||
max-threads: 0
|
||||
keepalive: 60
|
||||
queue-capacity: 700
|
||||
gameplay:
|
||||
server-mod-name: Kaiiju
|
||||
shared-random-for-players: true
|
||||
unsupported:
|
||||
disable-ensure-tick-thread-checks: false
|
||||
global-event-synchronization: false
|
||||
world-settings:
|
||||
default:
|
||||
gameplay:
|
||||
fix-void-trading: true
|
||||
break-redstone-on-top-of-trap-doors-early: true
|
||||
fix-tripwire-state-inconsistency: true
|
||||
safe-teleportation: true
|
||||
sand-duplication: false
|
||||
teleport-async-on-high-velocity: false
|
||||
region-format:
|
||||
format: ANVIL
|
||||
linear:
|
||||
@@ -64,6 +60,13 @@ world-settings:
|
||||
disable-achievements: false
|
||||
disable-creatures-spawn-events: false
|
||||
disable-dolphin-swim-to-treasure: false
|
||||
gameplay:
|
||||
fix-void-trading: true
|
||||
break-redstone-on-top-of-trap-doors-early: true
|
||||
fix-tripwire-state-inconsistency: true
|
||||
safe-teleportation: true
|
||||
sand-duplication: false
|
||||
teleport-async-on-high-velocity: false
|
||||
```
|
||||
Documentation: [Kaiiju Wiki](https://github.com/KaiijuMC/Kaiiju/wiki/Configuration)
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.papermc.paperweight.util.constants.*
|
||||
plugins {
|
||||
java
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1"
|
||||
id("io.papermc.paperweight.patcher") version "1.5.4"
|
||||
id("io.papermc.paperweight.patcher") version "1.5.7"
|
||||
}
|
||||
|
||||
allprojects {
|
||||
@@ -85,7 +85,7 @@ tasks.register("foliaRefLatest") {
|
||||
)
|
||||
|
||||
val foliaLatestCommitJson = layout.cache.resolve("foliaLatestCommit.json");
|
||||
download.get().download("https://api.github.com/repos/PaperMC/Folia/commits/master", foliaLatestCommitJson);
|
||||
download.get().download("https://api.github.com/repos/PaperMC/Folia/commits/dev/1.20.2", foliaLatestCommitJson);
|
||||
val foliaLatestCommit = gson.fromJson<paper.libs.com.google.gson.JsonObject>(foliaLatestCommitJson)["sha"].asString;
|
||||
|
||||
copy {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
group = dev.kaiijumc.kaiiju
|
||||
version = 1.20.1-R0.1-SNAPSHOT
|
||||
mcVersion = 1.20.1
|
||||
version = 1.20.2-R0.1-SNAPSHOT
|
||||
mcVersion = 1.20.2
|
||||
|
||||
foliaRef = b2d7bdb0bb5c841b4ccd096c0181664664ce97b1
|
||||
foliaRef = 84aecdc64afc48e73fffe01f6055c453567f2027
|
||||
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Kaiiju Configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 57d4789c1eb00cb376adce31ece2b6672c4a12a9..aba8170a8254558b33a5ac6635c30c5cc7e39296 100644
|
||||
index b6a8217b97842cd07af24fadb21e0e44226e5bb9..ce7dcbc0709839457df357484620f21c3d7c19c5 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2030,6 +2030,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2121,6 +2121,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
}
|
||||
// Paper end
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ Don't kick players because 1 keepalive is lost.
|
||||
This patch is from Purpur.
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index ab08e11f13921163b8ff1ff51ff9e9b86d2b47c7..b42a3466f145a92608c8746fd4beb529b4a60b01 100644
|
||||
index 47e23a196ae5e44600a64184b69141c00235baca..95b53b50606ea0ad47f407bebbb9e2bd445c0e66 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 {
|
||||
@@ -205,8 +205,10 @@ public class KaiijuConfig {
|
||||
}
|
||||
|
||||
public static boolean sendNullEntityPackets = true;
|
||||
@@ -22,10 +22,10 @@ index ab08e11f13921163b8ff1ff51ff9e9b86d2b47c7..b42a3466f145a92608c8746fd4beb529
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index b2feaea169fa9d3977c3dfdfdf3dea9283f5d854..1ab0d3e0653028b7d93177c28c1f532d8b10b1b1 100644
|
||||
index 678bba9d636a0eb34270a2d26b5b3d0d6d900115..564b2e668d50f05863080288d20bd54077588db9 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -263,6 +263,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -265,6 +265,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
private long keepAliveTime = Util.getMillis();
|
||||
private boolean keepAlivePending;
|
||||
private long keepAliveChallenge;
|
||||
@@ -33,7 +33,7 @@ index b2feaea169fa9d3977c3dfdfdf3dea9283f5d854..1ab0d3e0653028b7d93177c28c1f532d
|
||||
// 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
|
||||
@@ -355,6 +356,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -357,6 +358,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
long currentTime = Util.getMillis();
|
||||
long elapsedTime = currentTime - this.keepAliveTime;
|
||||
|
||||
@@ -54,7 +54,7 @@ index b2feaea169fa9d3977c3dfdfdf3dea9283f5d854..1ab0d3e0653028b7d93177c28c1f532d
|
||||
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
|
||||
@@ -3523,6 +3538,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -3610,6 +3625,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
@Override
|
||||
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Don't kick player on bad packet
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index fa2a763e5784e7dae02c94a13751cbf746b6eee8..ebfa9e1dcca5ea8272e796f0409902d92b59ee76 100644
|
||||
index 12738605442b9cdd086b2b29ff372d12552993b8..c0432bb14df86fe070c90deb33aa8c535cfe46f3 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -201,10 +201,12 @@ public class KaiijuConfig {
|
||||
@@ -206,10 +206,12 @@ public class KaiijuConfig {
|
||||
|
||||
public static boolean sendNullEntityPackets = true;
|
||||
public static boolean alternateKeepAlive = false;
|
||||
@@ -0,0 +1,458 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Sauve <paul@technove.co>
|
||||
Date: Tue, 1 Aug 2023 03:38:09 +0200
|
||||
Subject: [PATCH] Improve container checking with a bitset
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/structs/ItemListWithBitset.java b/src/main/java/dev/kaiijumc/kaiiju/structs/ItemListWithBitset.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ee32b7c4a1ae1e23149694ecba5ab7bd347d6ca6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/structs/ItemListWithBitset.java
|
||||
@@ -0,0 +1,114 @@
|
||||
+package dev.kaiijumc.kaiiju.structs;
|
||||
+
|
||||
+
|
||||
+import net.minecraft.core.NonNullList;
|
||||
+import net.minecraft.world.item.ItemStack;
|
||||
+import org.apache.commons.lang.Validate;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.AbstractList;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.List;
|
||||
+
|
||||
+public class ItemListWithBitset extends AbstractList<ItemStack> {
|
||||
+ public static ItemListWithBitset fromList(List<ItemStack> list) {
|
||||
+ if (list instanceof ItemListWithBitset ours) {
|
||||
+ return ours;
|
||||
+ }
|
||||
+ return new ItemListWithBitset(list);
|
||||
+ }
|
||||
+
|
||||
+ private static ItemStack[] createArray(int size) {
|
||||
+ ItemStack[] array = new ItemStack[size];
|
||||
+ Arrays.fill(array, ItemStack.EMPTY);
|
||||
+ return array;
|
||||
+ }
|
||||
+
|
||||
+ private final ItemStack[] items;
|
||||
+
|
||||
+ private long bitSet = 0;
|
||||
+ private final long allBits;
|
||||
+
|
||||
+ private static class OurNonNullList extends NonNullList<ItemStack> {
|
||||
+ protected OurNonNullList(List<ItemStack> delegate) {
|
||||
+ super(delegate, ItemStack.EMPTY);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public final NonNullList<ItemStack> nonNullList = new OurNonNullList(this);
|
||||
+
|
||||
+ private ItemListWithBitset(List<ItemStack> list) {
|
||||
+ this(list.size());
|
||||
+
|
||||
+ for (int i = 0; i < list.size(); i++) {
|
||||
+ this.set(i, list.get(i));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public ItemListWithBitset(int size) {
|
||||
+ Validate.isTrue(size < Long.BYTES * 8, "size is too large");
|
||||
+
|
||||
+ this.items = createArray(size);
|
||||
+ this.allBits = ((1L << size) - 1);
|
||||
+ }
|
||||
+
|
||||
+ public boolean isCompletelyEmpty() {
|
||||
+ return this.bitSet == 0;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasFullStacks() {
|
||||
+ return (this.bitSet & this.allBits) == allBits;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ItemStack set(int index, @NotNull ItemStack itemStack) {
|
||||
+ ItemStack existing = this.items[index];
|
||||
+
|
||||
+ this.items[index] = itemStack;
|
||||
+
|
||||
+ if (itemStack == ItemStack.EMPTY) {
|
||||
+ this.bitSet &= ~(1L << index);
|
||||
+ } else {
|
||||
+ this.bitSet |= 1L << index;
|
||||
+ }
|
||||
+
|
||||
+ return existing;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public ItemStack get(int var0) {
|
||||
+ return this.items[var0];
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int size() {
|
||||
+ return this.items.length;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void clear() {
|
||||
+ Arrays.fill(this.items, ItemStack.EMPTY);
|
||||
+ }
|
||||
+
|
||||
+ // these are unsupported for block inventories which have a static size
|
||||
+ @Override
|
||||
+ public void add(int var0, ItemStack var1) {
|
||||
+ throw new UnsupportedOperationException();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ItemStack remove(int var0) {
|
||||
+ throw new UnsupportedOperationException();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String toString() {
|
||||
+ return "ItemListWithBitset{" +
|
||||
+ "items=" + Arrays.toString(items) +
|
||||
+ ", bitSet=" + Long.toString(bitSet, 2) +
|
||||
+ ", allBits=" + Long.toString(allBits, 2) +
|
||||
+ ", size=" + this.items.length +
|
||||
+ '}';
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/CompoundContainer.java b/src/main/java/net/minecraft/world/CompoundContainer.java
|
||||
index 241fec02e6869c638d3a160819b32173a081467b..62848ca68f532fa14241320df76d180c13072c34 100644
|
||||
--- a/src/main/java/net/minecraft/world/CompoundContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/CompoundContainer.java
|
||||
@@ -64,6 +64,23 @@ public class CompoundContainer implements Container {
|
||||
this.container2 = second;
|
||||
}
|
||||
|
||||
+ // Kaiiju start - airplane - improve container checking with a bitset
|
||||
+ @Override
|
||||
+ public boolean hasEmptySlot(net.minecraft.core.Direction enumdirection) {
|
||||
+ return this.container1.hasEmptySlot(null) || this.container2.hasEmptySlot(null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCompletelyFull(net.minecraft.core.Direction enumdirection) {
|
||||
+ return this.container1.isCompletelyFull(null) && this.container2.isCompletelyFull(null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCompletelyEmpty(net.minecraft.core.Direction enumdirection) {
|
||||
+ return this.container1.isCompletelyEmpty(null) && this.container2.isCompletelyEmpty(null);
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
+
|
||||
@Override
|
||||
public int getContainerSize() {
|
||||
return this.container1.getContainerSize() + this.container2.getContainerSize();
|
||||
diff --git a/src/main/java/net/minecraft/world/Container.java b/src/main/java/net/minecraft/world/Container.java
|
||||
index 04b1531572e8fff1e46fe1c94e7fc863841e0f66..ac1e21a4fc210424ea57c247d03914c54129de9c 100644
|
||||
--- a/src/main/java/net/minecraft/world/Container.java
|
||||
+++ b/src/main/java/net/minecraft/world/Container.java
|
||||
@@ -13,6 +13,63 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
// CraftBukkit end
|
||||
|
||||
public interface Container extends Clearable {
|
||||
+ // Kaiiju start - airplane - allow the inventory to override and optimize these frequent calls
|
||||
+ default boolean hasEmptySlot(@org.jetbrains.annotations.Nullable net.minecraft.core.Direction enumdirection) { // there is a slot with 0 items in it
|
||||
+ if (this instanceof WorldlyContainer worldlyContainer) {
|
||||
+ for (int i : worldlyContainer.getSlotsForFace(enumdirection)) {
|
||||
+ if (this.getItem(i).isEmpty()) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ int size = this.getContainerSize();
|
||||
+ for (int i = 0; i < size; i++) {
|
||||
+ if (this.getItem(i).isEmpty()) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ default boolean isCompletelyFull(@org.jetbrains.annotations.Nullable net.minecraft.core.Direction enumdirection) { // every stack is maxed
|
||||
+ if (this instanceof WorldlyContainer worldlyContainer) {
|
||||
+ for (int i : worldlyContainer.getSlotsForFace(enumdirection)) {
|
||||
+ ItemStack itemStack = this.getItem(i);
|
||||
+ if (itemStack.getCount() < itemStack.getMaxStackSize()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ int size = this.getContainerSize();
|
||||
+ for (int i = 0; i < size; i++) {
|
||||
+ ItemStack itemStack = this.getItem(i);
|
||||
+ if (itemStack.getCount() < itemStack.getMaxStackSize()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ default boolean isCompletelyEmpty(@org.jetbrains.annotations.Nullable net.minecraft.core.Direction enumdirection) {
|
||||
+ if (this instanceof WorldlyContainer worldlyContainer) {
|
||||
+ for (int i : worldlyContainer.getSlotsForFace(enumdirection)) {
|
||||
+ if (!this.getItem(i).isEmpty()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ int size = this.getContainerSize();
|
||||
+ for (int i = 0; i < size; i++) {
|
||||
+ if (!this.getItem(i).isEmpty()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
|
||||
int LARGE_MAX_STACK_SIZE = 64;
|
||||
int DEFAULT_DISTANCE_LIMIT = 8;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
index 272095d7a09ab41227d741172735f66fd2798ce1..1f2e2d7726abd63bb46697697c91696387c819a2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
@@ -28,6 +28,7 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
public abstract class AbstractMinecartContainer extends AbstractMinecart implements ContainerEntity {
|
||||
|
||||
private NonNullList<ItemStack> itemStacks;
|
||||
+ private dev.kaiijumc.kaiiju.structs.ItemListWithBitset itemStacksOptimized; // Kaiiju - airplane - implement ItemListWithBitset
|
||||
@Nullable
|
||||
public ResourceLocation lootTable;
|
||||
public long lootTableSeed;
|
||||
@@ -89,12 +90,18 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||
|
||||
protected AbstractMinecartContainer(EntityType<?> type, Level world) {
|
||||
super(type, world);
|
||||
- this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); // CraftBukkit - SPIGOT-3513
|
||||
+ // Kaiiju start - airplane - use ItemListWithBitset
|
||||
+ this.itemStacksOptimized = new dev.kaiijumc.kaiiju.structs.ItemListWithBitset(this.getContainerSize()); // CraftBukkit - SPIGOT-3513
|
||||
+ this.itemStacks = this.itemStacksOptimized.nonNullList;
|
||||
+ // Kaiiju end
|
||||
}
|
||||
|
||||
protected AbstractMinecartContainer(EntityType<?> type, double x, double y, double z, Level world) {
|
||||
super(type, world, x, y, z);
|
||||
- this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); // CraftBukkit - SPIGOT-3513
|
||||
+ // Kaiiju start - airplane - use ItemListWithBitset
|
||||
+ this.itemStacksOptimized = new dev.kaiijumc.kaiiju.structs.ItemListWithBitset(this.getContainerSize()); // CraftBukkit - SPIGOT-3513
|
||||
+ this.itemStacks = this.itemStacksOptimized.nonNullList;
|
||||
+ // Kaiiju end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -156,6 +163,10 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||
protected void readAdditionalSaveData(CompoundTag nbt) {
|
||||
super.readAdditionalSaveData(nbt);
|
||||
this.lootableData.loadNbt(nbt); // Paper
|
||||
+ // Kaiiju start - airplane - use ItemListWithBitset
|
||||
+ this.itemStacksOptimized = new dev.kaiijumc.kaiiju.structs.ItemListWithBitset(this.getContainerSize()); // CraftBukkit - SPIGOT-3513
|
||||
+ this.itemStacks = this.itemStacksOptimized.nonNullList;
|
||||
+ // Kaiiju end
|
||||
this.readChestVehicleSaveData(nbt);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
||||
index a71414397bd45ee7bcacfeef0041d80dfa25f114..67f69540e6c217070f8d2af8908d4eb6f2b5c1c1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
||||
@@ -31,6 +31,7 @@ import org.bukkit.entity.HumanEntity;
|
||||
public class ChestBlockEntity extends RandomizableContainerBlockEntity implements LidBlockEntity {
|
||||
|
||||
private static final int EVENT_SET_OPEN_COUNT = 1;
|
||||
+ private dev.kaiijumc.kaiiju.structs.ItemListWithBitset optimizedItems; // Kaiiju - airplane - implement ItemListWithBitset
|
||||
private NonNullList<ItemStack> items;
|
||||
public final ContainerOpenersCounter openersCounter;
|
||||
private final ChestLidController chestLidController;
|
||||
@@ -65,9 +66,14 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ private final boolean isNative = getClass().equals(ChestBlockEntity.class); // Kaiiju - airplane
|
||||
+
|
||||
protected ChestBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
- this.items = NonNullList.withSize(27, ItemStack.EMPTY);
|
||||
+ // Kaiiju start - airplane - use ItemListWithBitset
|
||||
+ this.optimizedItems = new dev.kaiijumc.kaiiju.structs.ItemListWithBitset(27);
|
||||
+ this.items = this.optimizedItems.nonNullList;
|
||||
+ // Kaiiju end
|
||||
this.openersCounter = new ContainerOpenersCounter() {
|
||||
@Override
|
||||
protected void onOpen(Level world, BlockPos pos, BlockState state) {
|
||||
@@ -98,6 +104,23 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
||||
this.chestLidController = new ChestLidController();
|
||||
}
|
||||
|
||||
+ // Kaiiju start - airplane - improve container checking with a bitset
|
||||
+ @Override
|
||||
+ public boolean hasEmptySlot(Direction enumdirection) {
|
||||
+ return isNative ? !this.optimizedItems.hasFullStacks() : super.hasEmptySlot(enumdirection);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCompletelyFull(Direction enumdirection) {
|
||||
+ return isNative ? this.optimizedItems.hasFullStacks() && super.isCompletelyFull(enumdirection) : super.isCompletelyFull(enumdirection);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCompletelyEmpty(Direction enumdirection) {
|
||||
+ return isNative && this.optimizedItems.isCompletelyEmpty() || super.isCompletelyEmpty(enumdirection);
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
+
|
||||
public ChestBlockEntity(BlockPos pos, BlockState state) {
|
||||
this(BlockEntityType.CHEST, pos, state);
|
||||
}
|
||||
@@ -115,7 +138,10 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
||||
@Override
|
||||
public void load(CompoundTag nbt) {
|
||||
super.load(nbt);
|
||||
- this.items = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY);
|
||||
+ // Kaiiju start - airplane - use ItemListWithBitset
|
||||
+ this.optimizedItems = new dev.kaiijumc.kaiiju.structs.ItemListWithBitset(this.getContainerSize());
|
||||
+ this.items = this.optimizedItems.nonNullList;
|
||||
+ // Kaiiju end
|
||||
if (!this.tryLoadLootTable(nbt)) {
|
||||
ContainerHelper.loadAllItems(nbt, this.items);
|
||||
}
|
||||
@@ -187,7 +213,10 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
||||
|
||||
@Override
|
||||
protected void setItems(NonNullList<ItemStack> list) {
|
||||
- this.items = list;
|
||||
+ // Kaiiju start - airplane - use ItemListWithBitset
|
||||
+ this.optimizedItems = dev.kaiijumc.kaiiju.structs.ItemListWithBitset.fromList(list);
|
||||
+ this.items = this.optimizedItems.nonNullList;
|
||||
+ // Kaiiju end
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index 8781a7cebf66007158286f265e2adbaf40c1d2ff..6d55a6687060bdb6b2286e294d09ef0093b1625e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -48,6 +48,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
public static final int MOVE_ITEM_SPEED = 8;
|
||||
public static final int HOPPER_CONTAINER_SIZE = 5;
|
||||
private NonNullList<ItemStack> items;
|
||||
+ private dev.kaiijumc.kaiiju.structs.ItemListWithBitset optimizedItems; // Kaiiju - airplane - implement ItemListWithBitset
|
||||
private int cooldownTime;
|
||||
private long tickedGameTime;
|
||||
|
||||
@@ -83,14 +84,37 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
|
||||
public HopperBlockEntity(BlockPos pos, BlockState state) {
|
||||
super(BlockEntityType.HOPPER, pos, state);
|
||||
- this.items = NonNullList.withSize(5, ItemStack.EMPTY);
|
||||
+ // Kaiiju start - airplane - use ItemListWithBitset
|
||||
+ this.optimizedItems = new dev.kaiijumc.kaiiju.structs.ItemListWithBitset(5);
|
||||
+ this.items = this.optimizedItems.nonNullList;
|
||||
+ // Kaiiju end
|
||||
this.cooldownTime = -1;
|
||||
}
|
||||
|
||||
+ // Kaiiju start - airplane - improve container checking with a bitset
|
||||
+ @Override
|
||||
+ public boolean hasEmptySlot(Direction enumdirection) {
|
||||
+ return !this.optimizedItems.hasFullStacks();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCompletelyFull(Direction enumdirection) {
|
||||
+ return this.optimizedItems.hasFullStacks() && super.isCompletelyFull(enumdirection);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCompletelyEmpty(Direction enumdirection) {
|
||||
+ return this.optimizedItems.isCompletelyEmpty() || super.isCompletelyEmpty(enumdirection);
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
+
|
||||
@Override
|
||||
public void load(CompoundTag nbt) {
|
||||
super.load(nbt);
|
||||
- this.items = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY);
|
||||
+ // Kaiiju start - airplane - use ItemListWithBitset
|
||||
+ this.optimizedItems = new dev.kaiijumc.kaiiju.structs.ItemListWithBitset(this.getContainerSize());
|
||||
+ this.items = this.optimizedItems.nonNullList;
|
||||
+ // Kaiiju end
|
||||
if (!this.tryLoadLootTable(nbt)) {
|
||||
ContainerHelper.loadAllItems(nbt, this.items);
|
||||
}
|
||||
@@ -162,7 +186,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
flag = HopperBlockEntity.ejectItems(world, pos, state, (Container) blockEntity, blockEntity); // CraftBukkit
|
||||
}
|
||||
|
||||
- if (!blockEntity.inventoryFull()) {
|
||||
+ if (!blockEntity.optimizedItems.hasFullStacks() || !blockEntity.inventoryFull()) { // Kaiiju - airplane
|
||||
flag |= booleansupplier.getAsBoolean();
|
||||
}
|
||||
|
||||
@@ -456,11 +480,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
}
|
||||
|
||||
private static boolean isFullContainer(Container inventory, Direction direction) {
|
||||
- return allMatch(inventory, direction, STACK_SIZE_TEST); // Paper - no streams
|
||||
+ return inventory.isCompletelyFull(direction); // Kaiiju - airplane - use bitsets
|
||||
}
|
||||
|
||||
private static boolean isEmptyContainer(Container inv, Direction facing) {
|
||||
- return allMatch(inv, facing, IS_EMPTY_TEST);
|
||||
+ return inv.isCompletelyEmpty(facing); // Kaiiju - airplane - use bitsets
|
||||
}
|
||||
|
||||
public static boolean suckInItems(Level world, Hopper hopper) {
|
||||
@@ -650,7 +674,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
|
||||
if (HopperBlockEntity.canPlaceItemInContainer(to, stack, slot, side)) {
|
||||
boolean flag = false;
|
||||
- boolean flag1 = to.isEmpty();
|
||||
+ boolean flag1 = to.isCompletelyEmpty(side); // Kaiiju - airplane - use bitsets
|
||||
|
||||
if (itemstack1.isEmpty()) {
|
||||
// Spigot start - SPIGOT-6693, InventorySubcontainer#setItem
|
||||
@@ -845,7 +869,10 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
|
||||
@Override
|
||||
protected void setItems(NonNullList<ItemStack> list) {
|
||||
- this.items = list;
|
||||
+ // Kaiiju start - airplane - use ItemListWithBitset
|
||||
+ this.optimizedItems = dev.kaiijumc.kaiiju.structs.ItemListWithBitset.fromList(list);
|
||||
+ this.items = this.optimizedItems.nonNullList;
|
||||
+ // Kaiiju end
|
||||
}
|
||||
|
||||
public static void entityInside(Level world, BlockPos pos, BlockState state, Entity entity, HopperBlockEntity blockEntity) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||
index 081691f9710ff1115e4308f79ed49fbc38941193..648e28c5fba5c62e65f83fbb5ebc8836ffb166a9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||
@@ -95,14 +95,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
this.unpackLootTable((Player)null);
|
||||
- // Paper start
|
||||
- for (final ItemStack itemStack : this.getItems()) {
|
||||
- if (!itemStack.isEmpty()) {
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
- return true;
|
||||
- // Paper end
|
||||
+ return this.isCompletelyEmpty(null); // Kaiiju - airplane - use super
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Rebranding
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 93f9abd2169a48a4fd32f712c68be7b49b034e83..6d1d7a99a9ab2f165970d7da33702c16d7b18fd8 100644
|
||||
index 0dbcd376ab443af4853f0a02612866d71c5e9164..b374c8caf62db3e1325a3cb01bdd890a835541af 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -14,7 +14,7 @@ val alsoShade: Configuration by configurations.creating
|
||||
@@ -27,7 +27,7 @@ index 93f9abd2169a48a4fd32f712c68be7b49b034e83..6d1d7a99a9ab2f165970d7da33702c16
|
||||
"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 58dc84b7b3b04c2d0b00fc5fac5303d3378b3467..a128b1fabd4aadfe26a8375903c0451d7a65983a 100644
|
||||
index cb60d58d4a7556dd896f31d0cd249f860bb3ef84..c9ccc016044f2b179c291d9d5b2a43967cca119a 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 {
|
||||
@@ -119,7 +119,7 @@ index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..1c7b5d91e914efbcfb50c6137c776078
|
||||
.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 abe37c7c3c6f5ab73afd738ec78f06d7e4d2ed96..52fc6bb99f6024273c7438d01314b576da66bd1a 100644
|
||||
index 1d714d3eff11ed14f218656008190017494d4830..d39859f19afc4372999782a209f3836c6397f6d2 100644
|
||||
--- a/src/main/java/net/minecraft/CrashReport.java
|
||||
+++ b/src/main/java/net/minecraft/CrashReport.java
|
||||
@@ -125,7 +125,7 @@ public class CrashReport {
|
||||
@@ -132,10 +132,10 @@ index abe37c7c3c6f5ab73afd738ec78f06d7e4d2ed96..52fc6bb99f6024273c7438d01314b576
|
||||
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 355acd1dd3b2e9f2a086a8d95928cdebbf63d06f..7e5645d9cb64ce17f60c85619f5640c8de4b1e86 100644
|
||||
index 2f2a8a0c05024115f3b7bd69ae400fadff2f36c5..4d13cfdb642a67a5db20b1567868f24a37d949c3 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -995,7 +995,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -982,7 +982,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
shutdownThread = Thread.currentThread();
|
||||
org.spigotmc.WatchdogThread.doStop(); // Paper
|
||||
if (false && !isSameThread()) { // Folia - region threading
|
||||
@@ -144,7 +144,7 @@ index 355acd1dd3b2e9f2a086a8d95928cdebbf63d06f..7e5645d9cb64ce17f60c85619f5640c8
|
||||
while (this.getRunningThread().isAlive()) {
|
||||
this.getRunningThread().stop();
|
||||
try {
|
||||
@@ -1812,7 +1812,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1833,7 +1833,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
@@ -154,10 +154,10 @@ index 355acd1dd3b2e9f2a086a8d95928cdebbf63d06f..7e5645d9cb64ce17f60c85619f5640c8
|
||||
|
||||
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 23556931a812ed9b2dac5b4b4712961c2d9aa025..20c9e368bd4cb67591447395cf3c775e145a0ba5 100644
|
||||
index a50a9ffda4875061fb8840873115119f334f0519..66723512de9b9fc92cdeeabb2cf96aa5fad10aaa 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -264,7 +264,7 @@ import javax.annotation.Nullable; // Paper
|
||||
@@ -267,7 +267,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
@@ -167,7 +167,7 @@ index 23556931a812ed9b2dac5b4b4712961c2d9aa025..20c9e368bd4cb67591447395cf3c775e
|
||||
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 fae85d064bcea3589a69483ec6ac6c4cca73ad9a..895945b56fb75cf4ac0429b1d9263a78c2d523a1 100644
|
||||
index 28062755016008d0796676119fdd53d4a3947e20..b4d25d15797d37e644e85c5d2ba6211434a1ecbe 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -920,7 +920,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
@@ -206,7 +206,7 @@ index e9b6ca3aa25e140467ae866d572483050ea3fa0e..5df2b0fceebaaa863f4f143c8f29e808
|
||||
|
||||
if (stream != null) {
|
||||
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
index 98fba0288be9ed2cb18ffba5cf81148157dd4fcf..9c1477cfa1a8074c4b3b8a365bb03c44eaa62972 100644
|
||||
index 50c72e5db369a180f425eaaa0411cb8871bc3463..c556a1368ca089aad9d7f2f422924fea140e728d 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
|
||||
|
||||
@@ -410,7 +410,7 @@ index 0000000000000000000000000000000000000000..6fac162e0ec057af9f3336314d566355
|
||||
+}
|
||||
\ 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 78ada86028bac06b62a7d70776a29705a3b11a06..ee75d828174ac1c84931bc087472fefd76073bdb 100644
|
||||
index a9fe3d1c0fc217bd32e884c9e75c906d8b4bf967..dcf8fd8ab06b10ecffae7332bc7e1a941b6a27a1 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -218,6 +218,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -430,7 +430,7 @@ index 78ada86028bac06b62a7d70776a29705a3b11a06..ee75d828174ac1c84931bc087472fefd
|
||||
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 8cf4428d8140fd03f0ad8fa1d148a04d8caefda8..fb71843793e699b2ccfaa3b7e4c2bb7d4826a706 100644
|
||||
index 0ff6764c747ee6258ab9d722b48c24f0ddb2afdf..08f9e5d89a56c50d477437bd8ff15758fc7621cc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -166,6 +166,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -442,7 +442,7 @@ index 8cf4428d8140fd03f0ad8fa1d148a04d8caefda8..fb71843793e699b2ccfaa3b7e4c2bb7d
|
||||
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||
public static BlockPos lastPhysicsProblem; // Spigot
|
||||
private org.spigotmc.TickLimiter entityLimiter;
|
||||
@@ -293,6 +295,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -233,6 +235,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
|
||||
@@ -451,10 +451,10 @@ index 8cf4428d8140fd03f0ad8fa1d148a04d8caefda8..fb71843793e699b2ccfaa3b7e4c2bb7d
|
||||
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 20c9e368bd4cb67591447395cf3c775e145a0ba5..f421a150a7448362572c476fd50718f0c879e43d 100644
|
||||
index 66723512de9b9fc92cdeeabb2cf96aa5fad10aaa..86148da7878e8cf832eff299cbb3120a7a385a4f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1097,6 +1097,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1080,6 +1080,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
@@ -462,7 +462,7 @@ index 20c9e368bd4cb67591447395cf3c775e145a0ba5..f421a150a7448362572c476fd50718f0
|
||||
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))
|
||||
@@ -1112,6 +1113,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1095,6 +1096,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
}
|
||||
world.spigotConfig.init(); // Spigot
|
||||
@@ -470,7 +470,7 @@ index 20c9e368bd4cb67591447395cf3c775e145a0ba5..f421a150a7448362572c476fd50718f0
|
||||
}
|
||||
|
||||
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||
@@ -1127,6 +1129,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1110,6 +1112,7 @@ public final class CraftServer implements Server {
|
||||
this.reloadData();
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
@@ -478,7 +478,7 @@ index 20c9e368bd4cb67591447395cf3c775e145a0ba5..f421a150a7448362572c476fd50718f0
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
@@ -2907,6 +2910,13 @@ public final class CraftServer implements Server {
|
||||
@@ -2957,6 +2960,13 @@ public final class CraftServer implements Server {
|
||||
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ index 20c9e368bd4cb67591447395cf3c775e145a0ba5..f421a150a7448362572c476fd50718f0
|
||||
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 daed278d1bcf84ee42749f24e311b22b70015d79..1f194f5324ab5efc5ae11d248dd09f875624559c 100644
|
||||
index e4cacb17f56c618bef19e1165c07aac86af61150..d29fe7ac0c68b2d57a0c6b6d06bbb4436bfc4c14 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -173,6 +173,14 @@ public class Main {
|
||||
|
||||
@@ -5,18 +5,15 @@ Subject: [PATCH] Region format configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index 7da7e0aeb5eac9ac73a3570e716f1ceb11fd7027..b86c90cc3601e666998cfa12f44515f605bb53eb 100644
|
||||
index 7da7e0aeb5eac9ac73a3570e716f1ceb11fd7027..f08bcc9ae1770fa847d8a5e873a554bef5485100 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -192,4 +192,10 @@ public class KaiijuConfig {
|
||||
@@ -192,4 +192,7 @@ public class KaiijuConfig {
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
+
|
||||
+ public static boolean regionFormatDebug = false;
|
||||
+
|
||||
+ private static void regionFormatSettings() {
|
||||
+ regionFormatDebug = getBoolean("region-format.debug", regionFormatDebug);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -85,10 +82,10 @@ index 0000000000000000000000000000000000000000..7164d9cd03186f0657783f83de3d6435
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index cc1a7c4d38874ec218f7151685ae6cc00295c2e4..06233380f7580726753de34c1fb23d6347c9ac94 100644
|
||||
index 356f1fd44df5a9cf77655f788650415cadab53e1..84242c7cdbeccda4c9a23e0376daf80ce221e504 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -893,7 +893,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -880,7 +880,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// Paper start - rewrite chunk system
|
||||
worldserver.save((ProgressListener) null, flush, worldserver.noSave && !force, close);
|
||||
if (flush) {
|
||||
@@ -97,7 +94,7 @@ index cc1a7c4d38874ec218f7151685ae6cc00295c2e4..06233380f7580726753de34c1fb23d63
|
||||
}
|
||||
// Paper end - rewrite chunk system
|
||||
}
|
||||
@@ -917,7 +917,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -904,7 +904,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
//MinecraftServer.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", worldserver2.getChunkSource().chunkMap.getStorageName()); // Paper - move up
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ This format saves about 50% of disk space.
|
||||
Documentation: https://github.com/xymb-endcrystalme/LinearRegionFileFormatTools
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 6d1d7a99a9ab2f165970d7da33702c16d7b18fd8..164678d8c7f0a0a66adc957a86849fa927b7cb73 100644
|
||||
index b374c8caf62db3e1325a3cb01bdd890a835541af..7dd84de137e863cfc20582c1451a03ef6e4e495a 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -19,6 +19,10 @@ dependencies {
|
||||
@@ -38,6 +38,34 @@ index f2c27e0ac65be4b75c1d86ef6fd45fdb538d96ac..00724993d0448454d14a47652b039b88
|
||||
|
||||
public static final class InProgressWrite {
|
||||
public long writeCounter;
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index f08bcc9ae1770fa847d8a5e873a554bef5485100..b7f43cce80742aa0cd523e930772ff84946f3eef 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -15,7 +15,6 @@ import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
-import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -193,6 +192,15 @@ public class KaiijuConfig {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
+ public static int linearFlushFrequency = 10;
|
||||
+ public static int linearFlushThreads = 1;
|
||||
+
|
||||
private static void regionFormatSettings() {
|
||||
+ linearFlushFrequency = getInt("region-format.linear.flush-frequency", linearFlushFrequency);
|
||||
+ linearFlushThreads = getInt("region-format.linear.flush-max-threads", linearFlushThreads);
|
||||
+ if (linearFlushThreads < 0)
|
||||
+ linearFlushThreads = Math.max(Runtime.getRuntime().availableProcessors() + linearFlushThreads, 1);
|
||||
+ else
|
||||
+ linearFlushThreads = Math.max(linearFlushThreads, 1);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/region/AbstractRegionFile.java b/src/main/java/dev/kaiijumc/kaiiju/region/AbstractRegionFile.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..249303116d3cfadd078ebf0ae6e44bf99eed6a47
|
||||
@@ -112,10 +140,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..b7ce89429675bde7f037793305275f4bf89d0727
|
||||
index 0000000000000000000000000000000000000000..e40989889f3821bb7484fc0bae5d94b033013904
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
|
||||
@@ -0,0 +1,337 @@
|
||||
@@ -0,0 +1,316 @@
|
||||
+package dev.kaiijumc.kaiiju.region;
|
||||
+
|
||||
+import com.github.luben.zstd.ZstdInputStream;
|
||||
@@ -138,65 +166,57 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.List;
|
||||
+import java.util.concurrent.atomic.AtomicBoolean;
|
||||
+import java.util.concurrent.locks.ReentrantLock;
|
||||
+
|
||||
+public class LinearRegionFile extends Thread implements AbstractRegionFile {
|
||||
+public class LinearRegionFile implements AbstractRegionFile, AutoCloseable {
|
||||
+ private static final long SUPERBLOCK = -4323716122432332390L;
|
||||
+ private static final byte VERSION = 2;
|
||||
+ private static final int HEADER_SIZE = 32;
|
||||
+ private static final int FOOTER_SIZE = 8;
|
||||
+ private static final Logger LOGGER = LogUtils.getLogger();
|
||||
+ private static final List<Byte> SUPPORTED_VERSIONS = Arrays.asList((byte) 1, (byte) 2);
|
||||
+
|
||||
+ private static final LinearRegionFileFlusher linearRegionFileFlusher = new LinearRegionFileFlusher();
|
||||
+
|
||||
+ private final byte[][] buffer = new byte[1024][];
|
||||
+ private final int[] bufferUncompressedSize = new int[1024];
|
||||
+
|
||||
+ private final int[] chunkTimestamps = new int[1024];
|
||||
+ private final Object markedToSaveLock = new Object();
|
||||
+ private final ChunkStatus[] statuses = new ChunkStatus[1024];
|
||||
+
|
||||
+ private final LZ4Compressor compressor;
|
||||
+ private final LZ4FastDecompressor decompressor;
|
||||
+
|
||||
+ private boolean markedToSave = false;
|
||||
+ private boolean close = false;
|
||||
+
|
||||
+ public final ReentrantLock fileLock = new ReentrantLock(true);
|
||||
+ public Path regionFile;
|
||||
+
|
||||
+ private final int compressionLevel;
|
||||
+
|
||||
+ public Path getRegionFile() {
|
||||
+ return this.regionFile;
|
||||
+ }
|
||||
+ private AtomicBoolean markedToSave = new AtomicBoolean(false);
|
||||
+ public boolean closed = false;
|
||||
+ public Path path;
|
||||
+
|
||||
+ public ReentrantLock getFileLock() {
|
||||
+ return this.fileLock;
|
||||
+ }
|
||||
+
|
||||
+ public LinearRegionFile(Path file, int compression) throws IOException {
|
||||
+ this.regionFile = file;
|
||||
+ this.path = file;
|
||||
+ this.compressionLevel = compression;
|
||||
+
|
||||
+ this.compressor = LZ4Factory.fastestInstance().fastCompressor();
|
||||
+ this.decompressor = LZ4Factory.fastestInstance().fastDecompressor();
|
||||
+
|
||||
+ File regionFile = new File(this.regionFile.toString());
|
||||
+ File regionFile = new File(this.path.toString());
|
||||
+
|
||||
+ Arrays.fill(this.bufferUncompressedSize, 0);
|
||||
+
|
||||
+ if(regionFile.canRead()) {
|
||||
+ FileInputStream fileStream = new FileInputStream(regionFile);
|
||||
+ DataInputStream rawDataStream = new DataInputStream(fileStream);
|
||||
+ if (!regionFile.canRead()) return;
|
||||
+
|
||||
+ try (FileInputStream fileStream = new FileInputStream(regionFile);
|
||||
+ DataInputStream rawDataStream = new DataInputStream(fileStream)) {
|
||||
+
|
||||
+ long superBlock = rawDataStream.readLong();
|
||||
+ if (superBlock != SUPERBLOCK)
|
||||
+ throw new RuntimeException("Invalid superblock: " + superBlock + " file " + file);
|
||||
+ throw new RuntimeException("Invalid superblock: " + superBlock + " in " + file);
|
||||
+
|
||||
+ byte version = rawDataStream.readByte();
|
||||
+ if (!SUPPORTED_VERSIONS.contains(version))
|
||||
+ throw new RuntimeException("Invalid version: " + version + " file " + file);
|
||||
+ throw new RuntimeException("Invalid version: " + version + " in " + file);
|
||||
+
|
||||
+ // Skip newestTimestamp (Long) + Compression level (Byte) + Chunk count (Short): Unused.
|
||||
+ rawDataStream.skipBytes(11);
|
||||
@@ -204,7 +224,7 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
||||
+ int dataCount = rawDataStream.readInt();
|
||||
+ long fileLength = file.toFile().length();
|
||||
+ if (fileLength != HEADER_SIZE + dataCount + FOOTER_SIZE)
|
||||
+ throw new IOException("Invalid file length: " + this.regionFile + " " + fileLength + " " + (HEADER_SIZE + dataCount + FOOTER_SIZE));
|
||||
+ throw new IOException("Invalid file length: " + this.path + " " + fileLength + " " + (HEADER_SIZE + dataCount + FOOTER_SIZE));
|
||||
+
|
||||
+ rawDataStream.skipBytes(8); // Skip data hash (Long): Unused.
|
||||
+
|
||||
@@ -213,18 +233,18 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
||||
+
|
||||
+ superBlock = rawDataStream.readLong();
|
||||
+ if (superBlock != SUPERBLOCK)
|
||||
+ throw new IOException("Footer superblock invalid " + this.regionFile);
|
||||
+ throw new IOException("Footer superblock invalid " + this.path);
|
||||
+
|
||||
+ DataInputStream dataStream = new DataInputStream(new ZstdInputStream(new ByteArrayInputStream(rawCompressed)));
|
||||
+ try (DataInputStream dataStream = new DataInputStream(new ZstdInputStream(new ByteArrayInputStream(rawCompressed)))) {
|
||||
+
|
||||
+ int[] starts = new int[1024];
|
||||
+ for(int i = 0; i < 1024; i++) {
|
||||
+ for (int i = 0; i < 1024; i++) {
|
||||
+ starts[i] = dataStream.readInt();
|
||||
+ dataStream.skipBytes(4); // Skip timestamps (Int): Unused.
|
||||
+ }
|
||||
+
|
||||
+ for(int i = 0; i < 1024; i++) {
|
||||
+ if(starts[i] > 0) {
|
||||
+ for (int i = 0; i < 1024; i++) {
|
||||
+ if (starts[i] > 0) {
|
||||
+ int size = starts[i];
|
||||
+ byte[] b = new byte[size];
|
||||
+ dataStream.readFully(b, 0, size);
|
||||
@@ -240,61 +260,53 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ this.start();
|
||||
+ }
|
||||
+
|
||||
+ private synchronized void markToSave() {
|
||||
+ synchronized(markedToSaveLock) {
|
||||
+ markedToSave = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private synchronized boolean isMarkedToSave() {
|
||||
+ synchronized(markedToSaveLock) {
|
||||
+ if(markedToSave) {
|
||||
+ markedToSave = false;
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ public Path getRegionFile() {
|
||||
+ return this.path;
|
||||
+ }
|
||||
+
|
||||
+ public void run() {
|
||||
+ public ReentrantLock getFileLock() {
|
||||
+ return this.fileLock;
|
||||
+ }
|
||||
+
|
||||
+ public void flush() throws IOException {
|
||||
+ if (isMarkedToSave()) flushWrapper(); // sync
|
||||
+ }
|
||||
+
|
||||
+ private void markToSave() {
|
||||
+ linearRegionFileFlusher.scheduleSave(this);
|
||||
+ markedToSave.set(true);
|
||||
+ }
|
||||
+
|
||||
+ public boolean isMarkedToSave() {
|
||||
+ return markedToSave.getAndSet(false);
|
||||
+ }
|
||||
+
|
||||
+ public void flushWrapper() {
|
||||
+ try {
|
||||
+ while(true) {
|
||||
+ if(markedToSave) {
|
||||
+ try {
|
||||
+ flush();
|
||||
+ } catch(IOException ex) {
|
||||
+ LOGGER.error("Region file " + this.regionFile.toAbsolutePath() + " flush failed");
|
||||
+ save();
|
||||
+ } catch (IOException e) {
|
||||
+ LOGGER.error("Failed to flush region file " + path.toAbsolutePath(), e);
|
||||
+ }
|
||||
+ }
|
||||
+ for(int i = 0 ; i < 100 ; i++) {
|
||||
+ Thread.sleep(100);
|
||||
+ if(close) return;
|
||||
+ }
|
||||
+ }
|
||||
+ } catch(InterruptedException ignored) {}
|
||||
+ }
|
||||
+
|
||||
+ public synchronized boolean doesChunkExist(ChunkPos pos) throws Exception {
|
||||
+ public boolean doesChunkExist(ChunkPos pos) throws Exception {
|
||||
+ throw new Exception("doesChunkExist is a stub");
|
||||
+ }
|
||||
+
|
||||
+ public synchronized void flush() throws IOException {
|
||||
+ if(!isMarkedToSave()) return;
|
||||
+
|
||||
+ private synchronized void save() throws IOException {
|
||||
+ long timestamp = getTimestamp();
|
||||
+ short chunkCount = 0;
|
||||
+
|
||||
+ File tempFile = new File(regionFile.toString() + ".tmp");
|
||||
+ FileOutputStream fileStream = new FileOutputStream(tempFile);
|
||||
+ File tempFile = new File(path.toString() + ".tmp");
|
||||
+
|
||||
+ try (FileOutputStream fileStream = new FileOutputStream(tempFile);
|
||||
+ ByteArrayOutputStream zstdByteArray = new ByteArrayOutputStream();
|
||||
+ ZstdOutputStream zstdStream = new ZstdOutputStream(zstdByteArray, this.compressionLevel);
|
||||
+ zstdStream.setChecksum(true);
|
||||
+ DataOutputStream zstdDataStream = new DataOutputStream(zstdStream);
|
||||
+ DataOutputStream dataStream = new DataOutputStream(fileStream);
|
||||
+ DataOutputStream dataStream = new DataOutputStream(fileStream)) {
|
||||
+
|
||||
+ dataStream.writeLong(SUPERBLOCK);
|
||||
+ dataStream.writeByte(VERSION);
|
||||
@@ -302,8 +314,8 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
||||
+ dataStream.writeByte(this.compressionLevel);
|
||||
+
|
||||
+ ArrayList<byte[]> byteBuffers = new ArrayList<>();
|
||||
+ for(int i = 0; i < 1024; i++) {
|
||||
+ if(this.bufferUncompressedSize[i] != 0) {
|
||||
+ for (int i = 0; i < 1024; i++) {
|
||||
+ if (this.bufferUncompressedSize[i] != 0) {
|
||||
+ chunkCount += 1;
|
||||
+ byte[] content = new byte[bufferUncompressedSize[i]];
|
||||
+ this.decompressor.decompress(buffer[i], 0, content, 0, bufferUncompressedSize[i]);
|
||||
@@ -311,12 +323,12 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
||||
+ byteBuffers.add(content);
|
||||
+ } else byteBuffers.add(null);
|
||||
+ }
|
||||
+ for(int i = 0; i < 1024; i++) {
|
||||
+ for (int i = 0; i < 1024; i++) {
|
||||
+ zstdDataStream.writeInt(this.bufferUncompressedSize[i]); // Write uncompressed size
|
||||
+ zstdDataStream.writeInt(this.chunkTimestamps[i]); // Write timestamp
|
||||
+ }
|
||||
+ for(int i = 0; i < 1024; i++) {
|
||||
+ if(byteBuffers.get(i) != null)
|
||||
+ for (int i = 0; i < 1024; i++) {
|
||||
+ if (byteBuffers.get(i) != null)
|
||||
+ zstdDataStream.write(byteBuffers.get(i), 0, byteBuffers.get(i).length);
|
||||
+ }
|
||||
+ zstdDataStream.close();
|
||||
@@ -334,11 +346,10 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
||||
+ dataStream.flush();
|
||||
+ fileStream.getFD().sync();
|
||||
+ fileStream.getChannel().force(true); // Ensure atomicity on Btrfs
|
||||
+ dataStream.close();
|
||||
+
|
||||
+ fileStream.close();
|
||||
+ Files.move(tempFile.toPath(), this.regionFile, StandardCopyOption.REPLACE_EXISTING);
|
||||
+ }
|
||||
+ Files.move(tempFile.toPath(), this.path, StandardCopyOption.REPLACE_EXISTING);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ public void setStatus(int x, int z, ChunkStatus status) {
|
||||
+ this.statuses[getChunkIndex(x, z)] = status;
|
||||
@@ -360,7 +371,7 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
||||
+ this.chunkTimestamps[index] = getTimestamp();
|
||||
+ this.bufferUncompressedSize[getChunkIndex(pos.x, pos.z)] = uncompressedSize;
|
||||
+ } catch (IOException e) {
|
||||
+ LOGGER.error("Chunk write IOException " + e + " " + this.regionFile);
|
||||
+ LOGGER.error("Chunk write IOException " + e + " " + this.path);
|
||||
+ }
|
||||
+ markToSave();
|
||||
+ }
|
||||
@@ -370,7 +381,6 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
||||
+ }
|
||||
+
|
||||
+ private class ChunkBuffer extends ByteArrayOutputStream {
|
||||
+
|
||||
+ private final ChunkPos pos;
|
||||
+
|
||||
+ public ChunkBuffer(ChunkPos chunkcoordintpair) {
|
||||
@@ -423,12 +433,9 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
||||
+ }
|
||||
+
|
||||
+ public void close() throws IOException {
|
||||
+ close = true;
|
||||
+ try {
|
||||
+ flush();
|
||||
+ } catch(IOException e) {
|
||||
+ throw new IOException("Region flush IOException " + e + " " + this.regionFile);
|
||||
+ }
|
||||
+ if (closed) return;
|
||||
+ closed = true;
|
||||
+ flush(); // sync
|
||||
+ }
|
||||
+
|
||||
+ private static int getChunkIndex(int x, int z) {
|
||||
@@ -446,13 +453,64 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
||||
+ public void setOversized(int x, int z, boolean something) {}
|
||||
+
|
||||
+ public CompoundTag getOversizedData(int x, int z) throws IOException {
|
||||
+ throw new IOException("getOversizedData is a stub " + this.regionFile);
|
||||
+ throw new IOException("getOversizedData is a stub " + this.path);
|
||||
+ }
|
||||
+
|
||||
+ public boolean isOversized(int x, int z) {
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFileFlusher.java b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFileFlusher.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a5731e37aa63004476dd6db67191d5be6ce480be
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFileFlusher.java
|
||||
@@ -0,0 +1,45 @@
|
||||
+package dev.kaiijumc.kaiiju.region;
|
||||
+
|
||||
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
+import java.util.Queue;
|
||||
+import java.util.concurrent.*;
|
||||
+import dev.kaiijumc.kaiiju.KaiijuConfig;
|
||||
+import org.bukkit.Bukkit;
|
||||
+
|
||||
+public class LinearRegionFileFlusher {
|
||||
+ private final Queue<LinearRegionFile> savingQueue = new LinkedBlockingQueue<>();
|
||||
+ private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(
|
||||
+ new ThreadFactoryBuilder()
|
||||
+ .setNameFormat("linear-flush-scheduler")
|
||||
+ .build()
|
||||
+ );
|
||||
+ private final ExecutorService executor = Executors.newFixedThreadPool(
|
||||
+ KaiijuConfig.linearFlushThreads,
|
||||
+ new ThreadFactoryBuilder()
|
||||
+ .setNameFormat("linear-flusher-%d")
|
||||
+ .build()
|
||||
+ );
|
||||
+
|
||||
+ public LinearRegionFileFlusher() {
|
||||
+ Bukkit.getLogger().info("Using " + KaiijuConfig.linearFlushThreads + " threads for linear region flushing.");
|
||||
+ scheduler.scheduleAtFixedRate(this::pollAndFlush, 0L, KaiijuConfig.linearFlushFrequency, TimeUnit.SECONDS);
|
||||
+ }
|
||||
+
|
||||
+ public void scheduleSave(LinearRegionFile regionFile) {
|
||||
+ if (savingQueue.contains(regionFile)) return;
|
||||
+ savingQueue.add(regionFile);
|
||||
+ }
|
||||
+
|
||||
+ private void pollAndFlush() {
|
||||
+ while (!savingQueue.isEmpty()) {
|
||||
+ LinearRegionFile regionFile = savingQueue.poll();
|
||||
+ if (!regionFile.closed && regionFile.isMarkedToSave())
|
||||
+ executor.execute(regionFile::flushWrapper);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void shutdown() {
|
||||
+ executor.shutdown();
|
||||
+ scheduler.shutdown();
|
||||
+ }
|
||||
+}
|
||||
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 8a11e10b01fa012b2f98b1c193c53251e848f909..61001e76b38f8647b33e73b5cc15b4b6785cf49a 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java
|
||||
@@ -540,11 +598,11 @@ index 513833c2ea23df5b079d157bc5cb89d5c9754c0b..abf5e2a06af9853b58ac9107cd6e9787
|
||||
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 25fe439c8d1e88a86e85ac9a4761425d98ee6c4f..c4d28d887b4cc71dc713b1e3f46bc80f4484a95d 100644
|
||||
index 0f7e53dbac964391763bf6b380e65ce955a8a7a5..5868be332437cfa2cf21d48c02ba0bb73255b365 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -269,7 +269,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end
|
||||
@@ -210,7 +210,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end - optimise chunk tick iteration
|
||||
|
||||
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) {
|
||||
- super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
|
||||
@@ -552,16 +610,16 @@ index 25fe439c8d1e88a86e85ac9a4761425d98ee6c4f..c4d28d887b4cc71dc713b1e3f46bc80f
|
||||
// Paper - rewrite chunk system
|
||||
this.tickingGenerated = new AtomicInteger();
|
||||
//this.playerMap = new PlayerMap(); // Folia - region threading
|
||||
@@ -314,7 +314,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -255,7 +255,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;
|
||||
- this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, iregistrycustom, world);
|
||||
+ this.poiManager = new PoiManager(this.level.kaiijuConfig.regionFormatName, this.level.kaiijuConfig.regionFormatLinearCompressionLevel, path.resolve("poi"), dataFixer, dsync, iregistrycustom, world); // Kaiiju
|
||||
this.setViewDistance(viewDistance);
|
||||
this.setServerViewDistance(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);
|
||||
@@ -850,13 +850,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -818,13 +818,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
|
||||
// Paper start - chunk status cache "api"
|
||||
public ChunkStatus getChunkStatusOnDiskIfCached(ChunkPos chunkPos) {
|
||||
@@ -577,7 +635,7 @@ index 25fe439c8d1e88a86e85ac9a4761425d98ee6c4f..c4d28d887b4cc71dc713b1e3f46bc80f
|
||||
|
||||
if (regionFile == null || !regionFileCache.chunkExists(chunkPos)) {
|
||||
return null;
|
||||
@@ -874,7 +874,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -842,7 +842,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
|
||||
public void updateChunkStatusOnDisk(ChunkPos chunkPos, @Nullable CompoundTag compound) throws IOException {
|
||||
@@ -587,21 +645,21 @@ index 25fe439c8d1e88a86e85ac9a4761425d98ee6c4f..c4d28d887b4cc71dc713b1e3f46bc80f
|
||||
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 cf8f93734121e5c1959959f0ba13ee4e6db31959..4c587f783f4c2207e4e1a1f4596c8f50e997d541 100644
|
||||
index 02937e40d429f42643f77b17c04277be535dc434..3e2c14b9acc9e5bec70055646387b51f0be43105 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -453,8 +453,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -451,8 +451,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
private static final class EntityRegionFileStorage extends net.minecraft.world.level.chunk.storage.RegionFileStorage {
|
||||
|
||||
- public EntityRegionFileStorage(Path directory, boolean dsync) {
|
||||
- super(directory, dsync);
|
||||
+ public EntityRegionFileStorage(String format, int linearCompression, Path directory, boolean dsync) { // Kaiiju
|
||||
+ public EntityRegionFileStorage(dev.kaiijumc.kaiiju.region.RegionFileFormat format, int linearCompression, Path directory, boolean dsync) { // Kaiiju
|
||||
+ super(format, linearCompression, directory, dsync); // Kaiiju
|
||||
}
|
||||
|
||||
protected void write(ChunkPos pos, net.minecraft.nbt.CompoundTag nbt) throws IOException {
|
||||
@@ -693,7 +693,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -808,7 +808,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
// CraftBukkit end
|
||||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||
@@ -611,12 +669,12 @@ index cf8f93734121e5c1959959f0ba13ee4e6db31959..4c587f783f4c2207e4e1a1f4596c8f50
|
||||
// this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage, this.entitySliceManager); // Paper // Paper - rewrite chunk system
|
||||
StructureTemplateManager structuretemplatemanager = minecraftserver.getStructureManager();
|
||||
diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
index e0bfeebeaac1aaea64bc07cdfdf7790e3e43ca7b..ac35e7eb8cb5f19391a18eb9d6b5ba26769ce2f6 100644
|
||||
index e16ef1b7c0bfe6d6194c09f6787a50fd9b28f55e..3b02b7905fd16be28ba986302c1f99dfb5eb2ab8 100644
|
||||
--- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
+++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
@@ -61,7 +61,7 @@ public class WorldUpgrader {
|
||||
private volatile int skipped;
|
||||
private final Object2FloatMap<ResourceKey<LevelStem>> progressMap = Object2FloatMaps.synchronize(new Object2FloatOpenCustomHashMap(Util.identityStrategy())); // CraftBukkit
|
||||
private final Object2FloatMap<ResourceKey<Level>> progressMap = Object2FloatMaps.synchronize(new Object2FloatOpenCustomHashMap(Util.identityStrategy()));
|
||||
private volatile Component status = Component.translatable("optimizeWorld.stage.counting");
|
||||
- public static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.mca$");
|
||||
+ public static Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.(linear | mca)$"); // Kaiiju
|
||||
@@ -624,8 +682,8 @@ index e0bfeebeaac1aaea64bc07cdfdf7790e3e43ca7b..ac35e7eb8cb5f19391a18eb9d6b5ba26
|
||||
|
||||
public WorldUpgrader(LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, Registry<LevelStem> dimensionOptionsRegistry, boolean eraseCache) {
|
||||
@@ -116,7 +116,12 @@ public class WorldUpgrader {
|
||||
ResourceKey<LevelStem> resourcekey1 = (ResourceKey) iterator1.next(); // CraftBukkit
|
||||
Path path = this.levelStorage.getDimensionPath((ResourceKey) null); // CraftBukkit
|
||||
ResourceKey<Level> resourcekey1 = (ResourceKey) iterator1.next();
|
||||
Path path = this.levelStorage.getDimensionPath(resourcekey1);
|
||||
|
||||
- builder1.put(resourcekey1, new ChunkStorage(path.resolve("region"), this.dataFixer, true));
|
||||
+ // Kaiiju start
|
||||
@@ -636,9 +694,9 @@ index e0bfeebeaac1aaea64bc07cdfdf7790e3e43ca7b..ac35e7eb8cb5f19391a18eb9d6b5ba26
|
||||
+ // Kaiiju end
|
||||
}
|
||||
|
||||
ImmutableMap<ResourceKey<LevelStem>, ChunkStorage> immutablemap1 = builder1.build(); // CraftBukkit
|
||||
ImmutableMap<ResourceKey<Level>, ChunkStorage> immutablemap1 = builder1.build();
|
||||
@@ -235,7 +240,7 @@ public class WorldUpgrader {
|
||||
File file = this.levelStorage.getDimensionPath((ResourceKey) null).toFile(); // CraftBukkit
|
||||
File file = this.levelStorage.getDimensionPath(world).toFile();
|
||||
File file1 = new File(file, "region");
|
||||
File[] afile = file1.listFiles((file2, s) -> {
|
||||
- return s.endsWith(".mca");
|
||||
@@ -693,10 +751,10 @@ index 8ebecb588058da174b0e0e19e54fcddfeeca1422..1d880f27dd147da683fc30ed6f1bfa43
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
index dcfe090c269d4cbcc2eb1b6f85392848bb34656c..d42c320179ae055b8675d1ce6ce1788ecafb8e9d 100644
|
||||
index 9248769e6d357f6eec68945fd7700e79b2942c41..024870a31469c40cd680be0399ce0e0e73839a0f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
@@ -27,7 +27,7 @@ import net.minecraft.nbt.NbtIo;
|
||||
@@ -26,7 +26,7 @@ import net.minecraft.nbt.NbtIo; // Paper
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -705,8 +763,8 @@ index dcfe090c269d4cbcc2eb1b6f85392848bb34656c..d42c320179ae055b8675d1ce6ce1788e
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final int SECTOR_BYTES = 4096;
|
||||
@@ -51,6 +51,16 @@ public class RegionFile implements AutoCloseable {
|
||||
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper
|
||||
@@ -50,6 +50,16 @@ public class RegionFile implements AutoCloseable {
|
||||
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(); // Paper
|
||||
public final Path regionFile; // Paper
|
||||
|
||||
+ // Kaiiju start - Abstract getters
|
||||
@@ -722,7 +780,7 @@ index dcfe090c269d4cbcc2eb1b6f85392848bb34656c..d42c320179ae055b8675d1ce6ce1788e
|
||||
// Paper start - try to recover from RegionFile header corruption
|
||||
private static long roundToSectors(long bytes) {
|
||||
long sectors = bytes >>> 12; // 4096 = 2^12
|
||||
@@ -129,7 +139,7 @@ public class RegionFile implements AutoCloseable {
|
||||
@@ -128,7 +138,7 @@ public class RegionFile implements AutoCloseable {
|
||||
}
|
||||
|
||||
// note: only call for CHUNK regionfiles
|
||||
@@ -731,7 +789,7 @@ index dcfe090c269d4cbcc2eb1b6f85392848bb34656c..d42c320179ae055b8675d1ce6ce1788e
|
||||
if (!this.canRecalcHeader) {
|
||||
return false;
|
||||
}
|
||||
@@ -955,10 +965,10 @@ public class RegionFile implements AutoCloseable {
|
||||
@@ -954,10 +964,10 @@ public class RegionFile implements AutoCloseable {
|
||||
private static int getChunkIndex(int x, int z) {
|
||||
return (x & 31) + (z & 31) * 32;
|
||||
}
|
||||
@@ -744,7 +802,7 @@ index dcfe090c269d4cbcc2eb1b6f85392848bb34656c..d42c320179ae055b8675d1ce6ce1788e
|
||||
final int offset = getChunkIndex(x, z);
|
||||
boolean previous = this.oversized[offset] == 1;
|
||||
this.oversized[offset] = (byte) (oversized ? 1 : 0);
|
||||
@@ -997,7 +1007,7 @@ public class RegionFile implements AutoCloseable {
|
||||
@@ -996,7 +1006,7 @@ public class RegionFile implements AutoCloseable {
|
||||
return this.regionFile.getParent().resolve(this.regionFile.getFileName().toString().replaceAll("\\.mca$", "") + "_oversized_" + x + "_" + z + ".nbt");
|
||||
}
|
||||
|
||||
@@ -754,10 +812,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 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823f4b63a3a 100644
|
||||
index db571f658f636cdda1dcdbaffa0c4da67fae11ad..21537b14c6c6789da3db04577f1c93998397678d 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,9 +22,13 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -21,9 +21,13 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
|
||||
public static final String ANVIL_EXTENSION = ".mca";
|
||||
private static final int MAX_CACHE_SIZE = 256;
|
||||
@@ -772,7 +830,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
||||
private final boolean isChunkData; // Paper
|
||||
|
||||
// Paper start - cache regionfile does not exist state
|
||||
@@ -56,11 +60,15 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -55,11 +59,15 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
}
|
||||
// Paper end - cache regionfile does not exist state
|
||||
|
||||
@@ -791,7 +849,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
||||
this.isChunkData = isChunkData;
|
||||
// Paper end - add isChunkData param
|
||||
this.folder = directory;
|
||||
@@ -71,7 +79,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -70,7 +78,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@Nullable
|
||||
public static ChunkPos getRegionFileCoordinates(Path file) {
|
||||
String fileName = file.getFileName().toString();
|
||||
@@ -800,10 +858,10 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -93,29 +101,29 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
// Paper end
|
||||
@@ -90,29 +98,29 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
// Paper start
|
||||
- public synchronized RegionFile getRegionFileIfLoaded(ChunkPos chunkcoordintpair) {
|
||||
+ public synchronized dev.kaiijumc.kaiiju.region.AbstractRegionFile getRegionFileIfLoaded(ChunkPos chunkcoordintpair) { // Kaiiju
|
||||
return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()));
|
||||
@@ -836,7 +894,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
||||
}
|
||||
// Paper end
|
||||
return regionfile;
|
||||
@@ -126,28 +134,49 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -123,28 +131,45 @@ 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
|
||||
@@ -874,10 +932,6 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
||||
+ // Kaiiju end
|
||||
this.createRegionFile(regionPos);
|
||||
}
|
||||
+ // Kaiiju start - Polyglot
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.regionFormatDebug)
|
||||
+ org.bukkit.Bukkit.getLogger().info("Opening file " + path1 + " with format " + this.format + " (existingOnly = " + existingOnly + ")");
|
||||
+ // Kaiiju end
|
||||
+
|
||||
// Paper end - cache regionfile does not exist state
|
||||
FileUtil.createDirectoriesSafe(this.folder); // Paper - only create directory if not existing only - moved from above
|
||||
@@ -893,7 +947,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
||||
}
|
||||
// Paper end
|
||||
return regionfile1;
|
||||
@@ -175,7 +204,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -172,7 +197,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
}
|
||||
|
||||
|
||||
@@ -902,7 +956,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
||||
synchronized (regionfile) {
|
||||
try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) {
|
||||
CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z);
|
||||
@@ -222,14 +251,14 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -219,14 +244,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
|
||||
@@ -919,7 +973,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
||||
// 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
|
||||
@@ -239,7 +268,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -236,7 +261,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
|
||||
// Paper start
|
||||
if (regionfile.isOversized(pos.x, pos.z)) {
|
||||
@@ -928,7 +982,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
||||
return readOversizedChunk(regionfile, pos);
|
||||
}
|
||||
// Paper end
|
||||
@@ -253,12 +282,12 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -250,12 +275,12 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
if (this.isChunkData) {
|
||||
ChunkPos chunkPos = ChunkSerializer.getChunkCoordinate(nbttagcompound);
|
||||
if (!chunkPos.equals(pos)) {
|
||||
@@ -944,7 +998,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -292,13 +321,13 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -289,13 +314,13 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
|
||||
return nbttagcompound;
|
||||
} finally { // Paper start
|
||||
@@ -960,7 +1014,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
||||
if (regionfile == null) {
|
||||
return;
|
||||
}
|
||||
@@ -328,7 +357,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -325,7 +350,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
}
|
||||
|
||||
protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException {
|
||||
@@ -969,7 +1023,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
||||
if (nbt == null && regionfile == null) {
|
||||
return;
|
||||
}
|
||||
@@ -378,7 +407,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -375,7 +400,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
}
|
||||
// Paper end
|
||||
} finally { // Paper start
|
||||
@@ -978,7 +1032,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
||||
} // Paper end
|
||||
}
|
||||
|
||||
@@ -387,7 +416,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -384,7 +409,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
ObjectIterator objectiterator = this.regionCache.values().iterator();
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
@@ -987,7 +1041,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
||||
|
||||
try {
|
||||
regionfile.close();
|
||||
@@ -403,7 +432,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -400,7 +425,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
ObjectIterator objectiterator = this.regionCache.values().iterator();
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
@@ -997,7 +1051,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
||||
regionfile.flush();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
||||
index 5561b8499a0503b850974b1dc309edfb80219549..9394d191c56aab78e63fd3f283efedd69384e323 100644
|
||||
index 4aac1979cf57300825a999c876fcf24d3170e68e..3b96582f15d0985b670b5b5a1548800dee2154f4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
||||
@@ -47,8 +47,8 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
|
||||
@@ -1012,10 +1066,10 @@ index 5561b8499a0503b850974b1dc309edfb80219549..9394d191c56aab78e63fd3f283efedd6
|
||||
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 723ae4b75c84fe952377c02d42cf7a710f7047ea..1bda5bf6d69bd3b7ceda03c48760629b1366e792 100644
|
||||
index b8f10ad8687f047f2b6705d47a91831e77d6b3b4..8882347b5b878c9c8cc1760941f2a153e967f780 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -561,7 +561,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -560,7 +560,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@ Subject: [PATCH] Network configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index b86c90cc3601e666998cfa12f44515f605bb53eb..7c6d43d8a360530344ef296f4477750c8a298607 100644
|
||||
index b7f43cce80742aa0cd523e930772ff84946f3eef..fa829cef4033625470dfae29ddf777e6c5ab8c55 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -198,4 +198,7 @@ public class KaiijuConfig {
|
||||
private static void regionFormatSettings() {
|
||||
regionFormatDebug = getBoolean("region-format.debug", regionFormatDebug);
|
||||
@@ -203,4 +203,7 @@ public class KaiijuConfig {
|
||||
else
|
||||
linearFlushThreads = Math.max(linearFlushThreads, 1);
|
||||
}
|
||||
+
|
||||
+ private static void networkSettings() {
|
||||
|
||||
@@ -6,12 +6,12 @@ Subject: [PATCH] Send null entity packets
|
||||
This is from Purpur. Don't send null entity packets.
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index 7c6d43d8a360530344ef296f4477750c8a298607..ab08e11f13921163b8ff1ff51ff9e9b86d2b47c7 100644
|
||||
index fa829cef4033625470dfae29ddf777e6c5ab8c55..47e23a196ae5e44600a64184b69141c00235baca 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -198,7 +198,10 @@ public class KaiijuConfig {
|
||||
private static void regionFormatSettings() {
|
||||
regionFormatDebug = getBoolean("region-format.debug", regionFormatDebug);
|
||||
@@ -203,7 +203,10 @@ public class KaiijuConfig {
|
||||
else
|
||||
linearFlushThreads = Math.max(linearFlushThreads, 1);
|
||||
}
|
||||
+
|
||||
+ public static boolean sendNullEntityPackets = true;
|
||||
@@ -21,10 +21,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 6670e657e08e130f7e0368f418379fd1ece00cdf..5558d87ef182f82be7877455dd027082c6a80632 100644
|
||||
index 892a334d1b1c0784ed6838d1aa066403998b9a9f..eab1b19323f588030834b9a4cecd515c817f79d1 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -201,6 +201,11 @@ public class ServerEntity {
|
||||
@@ -198,6 +198,11 @@ public class ServerEntity {
|
||||
flag4 = true;
|
||||
flag5 = true;
|
||||
}
|
||||
@@ -36,7 +36,7 @@ index 6670e657e08e130f7e0368f418379fd1ece00cdf..5558d87ef182f82be7877455dd027082
|
||||
}
|
||||
|
||||
if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) {
|
||||
@@ -273,6 +278,20 @@ public class ServerEntity {
|
||||
@@ -270,6 +275,20 @@ public class ServerEntity {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@ Subject: [PATCH] Optimization Configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index b42a3466f145a92608c8746fd4beb529b4a60b01..7b56cc1275319cf07a4a25280e0ff900bdca8afa 100644
|
||||
index 47e23a196ae5e44600a64184b69141c00235baca..90d97f3e0500a38e64ec0b88b2cab6ef28640c10 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 {
|
||||
@@ -209,4 +209,7 @@ public class KaiijuConfig {
|
||||
private static void networkSettings() {
|
||||
sendNullEntityPackets = getBoolean("network.send-null-entity-packets", sendNullEntityPackets);
|
||||
alternateKeepAlive = getBoolean("network.alternate-keepalive", alternateKeepAlive);
|
||||
}
|
||||
+
|
||||
+ private static void optimizationSettings() {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Gameplay Configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index 7b56cc1275319cf07a4a25280e0ff900bdca8afa..fdc4cdbf34ed10f6523dceac7c1931d3ca4eb522 100644
|
||||
index 90d97f3e0500a38e64ec0b88b2cab6ef28640c10..859c2ac4e46b840f9552d1ccbf9409c9666e84de 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -209,4 +209,7 @@ public class KaiijuConfig {
|
||||
@@ -212,4 +212,7 @@ public class KaiijuConfig {
|
||||
|
||||
private static void optimizationSettings() {
|
||||
}
|
||||
@@ -22,7 +22,7 @@ index 05f9c01131e78927d88f1170c3eda4adf25ac8ba..55dcbb48450b24f80e0a04bedeb54f64
|
||||
|
||||
private void gameplaySettings() {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
index ebee8de2ed831755b6fd154f6cc77ac993839bb9..ce5faefe3b67087509833800f0472f14131f2011 100644
|
||||
index e483186a5292b3b53bfb1af4d56f55fcc1a6106c..a178bb3a1810c39c0131ccedb926d61b761a4b0e 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 {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Server mod name
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index fdc4cdbf34ed10f6523dceac7c1931d3ca4eb522..e1f50adfa216320bc53b460d11666064cb58c969 100644
|
||||
index 859c2ac4e46b840f9552d1ccbf9409c9666e84de..2aa40f154c48ee7558b0efdc3bf26e205bb9f799 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -210,6 +210,9 @@ public class KaiijuConfig {
|
||||
@@ -213,6 +213,9 @@ public class KaiijuConfig {
|
||||
private static void optimizationSettings() {
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ index fdc4cdbf34ed10f6523dceac7c1931d3ca4eb522..e1f50adfa216320bc53b460d11666064
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 06233380f7580726753de34c1fb23d6347c9ac94..1b3f895b51b634ee9cf69cdbbfd7a1e600de16f0 100644
|
||||
index ef9a17e9b9cd2866374aa22c5ec7c5b46b06e341..211868046f442f316f419734c03b2fa535bad196 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1812,7 +1812,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1833,7 +1833,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
@@ -42,11 +42,11 @@ index abf5e2a06af9853b58ac9107cd6e9787c4185c66..389c68c0becd2f69dc1004d0b383f1a8
|
||||
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 c4d28d887b4cc71dc713b1e3f46bc80f4484a95d..f50507ab85282d261985ce9b186581f5a7a50f79 100644
|
||||
index 90991db650d2f0e9a3f7b00bb5b7586ade003bb0..c0ee91a1f333434a2529429d670b62a83aeeb7b2 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -269,7 +269,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end
|
||||
@@ -210,7 +210,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end - optimise chunk tick iteration
|
||||
|
||||
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) {
|
||||
- super(world.getLevel().kaiijuConfig.regionFormatName, world.getLevel().kaiijuConfig.regionFormatLinearCompressionLevel, session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); // Kaiiju
|
||||
@@ -54,31 +54,31 @@ index c4d28d887b4cc71dc713b1e3f46bc80f4484a95d..f50507ab85282d261985ce9b186581f5
|
||||
// Paper - rewrite chunk system
|
||||
this.tickingGenerated = new AtomicInteger();
|
||||
//this.playerMap = new PlayerMap(); // Folia - region threading
|
||||
@@ -314,7 +314,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -255,7 +255,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;
|
||||
- this.poiManager = new PoiManager(this.level.kaiijuConfig.regionFormatName, this.level.kaiijuConfig.regionFormatLinearCompressionLevel, path.resolve("poi"), dataFixer, dsync, iregistrycustom, world); // Kaiiju
|
||||
+ this.poiManager = new PoiManager(this.level.kaiijuConfig.regionFormatName, this.level.kaiijuConfig.regionFormatLinearCompressionLevel, this.level.kaiijuConfig.linearCrashOnBrokenSymlink, path.resolve("poi"), dataFixer, dsync, iregistrycustom, world); // Kaiiju
|
||||
this.setViewDistance(viewDistance);
|
||||
this.setServerViewDistance(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);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 4c587f783f4c2207e4e1a1f4596c8f50e997d541..ad896c8a3060f5c8d85a8b5707317de646bf9cae 100644
|
||||
index eb7a06f4d0e87d8cba86c7eccf2c1fa02ad503d2..95e4ea89dbffb72322506e5e6c79e3605e2f9593 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -453,8 +453,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -451,8 +451,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
private static final class EntityRegionFileStorage extends net.minecraft.world.level.chunk.storage.RegionFileStorage {
|
||||
|
||||
- public EntityRegionFileStorage(String format, int linearCompression, Path directory, boolean dsync) { // Kaiiju
|
||||
- public EntityRegionFileStorage(dev.kaiijumc.kaiiju.region.RegionFileFormat format, int linearCompression, Path directory, boolean dsync) { // Kaiiju
|
||||
- super(format, linearCompression, directory, dsync); // Kaiiju
|
||||
+ public EntityRegionFileStorage(dev.kaiijumc.kaiiju.region.RegionFileFormat format, int linearCompression, boolean linearCrashOnBrokenSymlink, Path directory, boolean dsync) { // Kaiiju
|
||||
+ super(format, linearCompression, linearCrashOnBrokenSymlink, directory, dsync); // Kaiiju
|
||||
}
|
||||
|
||||
protected void write(ChunkPos pos, net.minecraft.nbt.CompoundTag nbt) throws IOException {
|
||||
@@ -693,7 +693,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -808,7 +808,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
// CraftBukkit end
|
||||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||
@@ -88,7 +88,7 @@ index 4c587f783f4c2207e4e1a1f4596c8f50e997d541..ad896c8a3060f5c8d85a8b5707317de6
|
||||
// this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage, this.entitySliceManager); // Paper // Paper - rewrite chunk system
|
||||
StructureTemplateManager structuretemplatemanager = minecraftserver.getStructureManager();
|
||||
diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
index ac35e7eb8cb5f19391a18eb9d6b5ba26769ce2f6..a9c6ca7c621bb2431bcf0ae879b192f748bf931b 100644
|
||||
index 3b02b7905fd16be28ba986302c1f99dfb5eb2ab8..d7838a09a7d5a9a3401b1a90bc893f0ac886a70f 100644
|
||||
--- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
+++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
@@ -120,7 +120,8 @@ public class WorldUpgrader {
|
||||
@@ -135,10 +135,10 @@ index 1d880f27dd147da683fc30ed6f1bfa43ecdb7d93..41598adf6d49a44bcaadfff379722146
|
||||
}
|
||||
|
||||
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 b35a6a7daf768af3bc453fe18deec823f4b63a3a..8409293b3f329715d6dff3d455c6a484d5b133ee 100644
|
||||
index 21537b14c6c6789da3db04577f1c93998397678d..93d0a6f635544b3a86111e1854a27cfdd8aee7b4 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
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.world.level.ChunkPos;
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.world.level.ChunkPos;
|
||||
|
||||
public class RegionFileStorage implements AutoCloseable {
|
||||
|
||||
@@ -146,7 +146,7 @@ index b35a6a7daf768af3bc453fe18deec823f4b63a3a..8409293b3f329715d6dff3d455c6a484
|
||||
public static final String ANVIL_EXTENSION = ".mca";
|
||||
private static final int MAX_CACHE_SIZE = 256;
|
||||
public final Long2ObjectLinkedOpenHashMap<dev.kaiijumc.kaiiju.region.AbstractRegionFile> regionCache = new Long2ObjectLinkedOpenHashMap(); // Kaiiju
|
||||
@@ -28,6 +29,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -27,6 +28,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
// Kaiiju start - Per world chunk format
|
||||
public final dev.kaiijumc.kaiiju.region.RegionFileFormat format;
|
||||
public final int linearCompression;
|
||||
@@ -154,7 +154,7 @@ index b35a6a7daf768af3bc453fe18deec823f4b63a3a..8409293b3f329715d6dff3d455c6a484
|
||||
// Kaiiju end
|
||||
private final boolean isChunkData; // Paper
|
||||
|
||||
@@ -60,14 +62,15 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -59,14 +61,15 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
}
|
||||
// Paper end - cache regionfile does not exist state
|
||||
|
||||
@@ -173,7 +173,7 @@ index b35a6a7daf768af3bc453fe18deec823f4b63a3a..8409293b3f329715d6dff3d455c6a484
|
||||
// Kaiiju end
|
||||
this.isChunkData = isChunkData;
|
||||
// Paper end - add isChunkData param
|
||||
@@ -111,6 +114,20 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -108,6 +111,20 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
return regionfile != null ? regionfile.hasChunk(pos) : false;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ index b35a6a7daf768af3bc453fe18deec823f4b63a3a..8409293b3f329715d6dff3d455c6a484
|
||||
public synchronized dev.kaiijumc.kaiiju.region.AbstractRegionFile getRegionFile(ChunkPos chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit // Kaiiju
|
||||
return this.getRegionFile(chunkcoordintpair, existingOnly, false);
|
||||
}
|
||||
@@ -146,6 +163,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -143,6 +160,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
if (existingOnly) {
|
||||
Path anvil = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca");
|
||||
Path linear = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".linear");
|
||||
@@ -202,16 +202,16 @@ index b35a6a7daf768af3bc453fe18deec823f4b63a3a..8409293b3f329715d6dff3d455c6a484
|
||||
if (java.nio.file.Files.exists(anvil)) path1 = anvil;
|
||||
else if (java.nio.file.Files.exists(linear)) path1 = linear;
|
||||
else {
|
||||
@@ -161,6 +179,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -158,6 +176,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
};
|
||||
path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + "." + extension);
|
||||
// Kaiiju end
|
||||
+ guardAgainstBrokenSymlinks(path1); // Kaiiju - Crash on broken symlink
|
||||
this.createRegionFile(regionPos);
|
||||
}
|
||||
// Kaiiju start - Polyglot
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
||||
index 9394d191c56aab78e63fd3f283efedd69384e323..dcfe4a285cc5865be3b0c1b8104b722895135dd0 100644
|
||||
index 3b96582f15d0985b670b5b5a1548800dee2154f4..e8f1be83ff75045d4d57a43f1899efee7bd47183 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
||||
@@ -47,8 +47,8 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
|
||||
@@ -22,10 +22,10 @@ index f3f824d0ab1a2a72825c40b67192386479a0b34c..95ed6cb7b94797187d1011cab344e187
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index ad896c8a3060f5c8d85a8b5707317de646bf9cae..0df4672abb5e87587da8712b6febf6312e241cda 100644
|
||||
index 383e500ec098d671442f81bba6742ee44ca64450..3950b404482b0c6244141301e6ee3b4013327b2b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2865,7 +2865,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -3016,7 +3016,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
// Spigot Start
|
||||
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
|
||||
// Paper start
|
||||
@@ -22,10 +22,10 @@ index 95ed6cb7b94797187d1011cab344e187b39d9193..6d7356cc07da58b1cef8d8963e790251
|
||||
|
||||
public boolean fixVoidTrading = true;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index 4825a74ce4893dafdb70ae1badf3d2e1930d01a1..762b763f271c3208b4f8a7e346897207ec5beb6c 100644
|
||||
index 97858b410769f95e4a8d8acd757216ffe06f8cf4..036683a0ea4df0fe2bd7aca434471d3de0c07710 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -401,49 +401,51 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -441,49 +441,51 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
if (HopperBlockEntity.isFullContainer(iinventory1, enumdirection)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -114,7 +114,7 @@ index 4825a74ce4893dafdb70ae1badf3d2e1930d01a1..762b763f271c3208b4f8a7e346897207
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -467,6 +469,12 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -525,6 +527,12 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
if (iinventory != null) {
|
||||
Direction enumdirection = Direction.DOWN;
|
||||
|
||||
@@ -126,8 +126,8 @@ index 4825a74ce4893dafdb70ae1badf3d2e1930d01a1..762b763f271c3208b4f8a7e346897207
|
||||
+ // Kaiiju end
|
||||
// Paper start - optimize hoppers and remove streams
|
||||
worldData.skipPullModeEventFire = worldData.skipHopperEvents; // Folia - region threading
|
||||
return !HopperBlockEntity.isEmptyContainer(iinventory, enumdirection) && anyMatch(iinventory, enumdirection, (item, i) -> {
|
||||
@@ -499,48 +507,50 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
// merge container isEmpty check and move logic into one loop
|
||||
@@ -573,48 +581,50 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
private static boolean a(Hopper ihopper, Container iinventory, int i, Direction enumdirection, Level world) { // Spigot
|
||||
ItemStack itemstack = iinventory.getItem(i);
|
||||
|
||||
@@ -22,10 +22,10 @@ index 6d7356cc07da58b1cef8d8963e790251d765de2c..601b9867d839f4928ba993ee8f00df9c
|
||||
|
||||
public boolean fixVoidTrading = true;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 0df4672abb5e87587da8712b6febf6312e241cda..1818c5ae88c331fb900470436f72049165c9e9f4 100644
|
||||
index 3950b404482b0c6244141301e6ee3b4013327b2b..ca065f1600713a7f509e54580c625287e94d1e40 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -825,7 +825,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -942,7 +942,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
timings.doSounds.stopTiming(); // Spigot
|
||||
regionizedWorldData.setHandlingTick(false); // Folia - regionised ticking
|
||||
gameprofilerfiller.pop();
|
||||
@@ -6,13 +6,13 @@ Subject: [PATCH] Add SIMD utilities
|
||||
Patch from Pufferfish
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 164678d8c7f0a0a66adc957a86849fa927b7cb73..a151ca3a0803a5e653674e51e8d41a2f38b1f3df 100644
|
||||
index 07efc7e9593f619c3b71bb3936077a66a0f2964d..8aa2f328f7fe3d85f7ddf05fa0259061eb950fff 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -68,6 +68,12 @@ dependencies {
|
||||
}
|
||||
|
||||
val craftbukkitPackageVersion = "1_20_R1" // Paper
|
||||
val craftbukkitPackageVersion = "1_20_R2" // Paper
|
||||
+// Kaiiju start - Pufferfish - SIMD utilities
|
||||
+tasks.withType<JavaCompile> {
|
||||
+ val compilerArgs = options.compilerArgs
|
||||
@@ -128,7 +128,7 @@ index 0000000000000000000000000000000000000000..758fa97304a32bf17935c86dc03cbf50
|
||||
+}
|
||||
\ 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 ee75d828174ac1c84931bc087472fefd76073bdb..991e4c19763a34a6fead88363e007c2d11aad836 100644
|
||||
index dcf8fd8ab06b10ecffae7332bc7e1a941b6a27a1..31397e53ab76266356c7582280d264c0f1df2504 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -225,6 +225,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Toggle shared random for players
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index e1f50adfa216320bc53b460d11666064cb58c969..c934341c17caf4696065ac6c39bdfef570c62f13 100644
|
||||
index 2aa40f154c48ee7558b0efdc3bf26e205bb9f799..23b43de57a07b2b7b180f1aabd17e7e30830b521 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -211,8 +211,10 @@ public class KaiijuConfig {
|
||||
@@ -214,8 +214,10 @@ public class KaiijuConfig {
|
||||
}
|
||||
|
||||
public static String serverModName = "Kaiiju";
|
||||
@@ -20,10 +20,10 @@ index e1f50adfa216320bc53b460d11666064cb58c969..c934341c17caf4696065ac6c39bdfef5
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 27b57db24587337ccdce29e492052ca419863323..fc6279a39fd5e1bd02b2d9e77f451cd9ba1baf78 100644
|
||||
index e1b6673729e71bdc929bc7b76983108a59e55891..01d1360d7e3a31b985f24f825d304ae75a99814c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -566,6 +566,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -555,6 +555,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.bb = Entity.INITIAL_AABB;
|
||||
this.stuckSpeedMultiplier = Vec3.ZERO;
|
||||
this.nextStep = 1.0F;
|
||||
@@ -5,11 +5,11 @@ Subject: [PATCH] Kick player instead of crashing
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java b/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
index c5df121d6194a97b20dc390698991b9c72dba538..9990fccc741a139c57528f70157ae63dbe3fd8e8 100644
|
||||
index 07abf5a326cc7aa8a449b74bd7ac8a43b98528c0..eb875ee3d5bcbf90719eafc1c873189f1bfc26dd 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
@@ -485,7 +485,12 @@ public class RegionizedPlayerChunkLoader {
|
||||
new ChunkPos(chunkX, chunkZ), new MutableObject<>(), false, true); // unloaded, loaded
|
||||
@@ -484,7 +484,12 @@ public class RegionizedPlayerChunkLoader {
|
||||
PlayerChunkSender.sendChunk(this.player.connection, this.world, this.world.getChunkIfLoaded(chunkX, chunkZ));
|
||||
return;
|
||||
}
|
||||
- throw new IllegalStateException();
|
||||
@@ -23,10 +23,10 @@ index c5df121d6194a97b20dc390698991b9c72dba538..9990fccc741a139c57528f70157ae63d
|
||||
|
||||
private void sendUnloadChunk(final int chunkX, final int chunkZ) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
index 18f438eec03cabc1614ab807081cff6b18fb09a8..df3869d7aee9c1c880319251b40879c8802c72b4 100644
|
||||
index 047e817eae19800d146970a3ab44913ea1d17c89..59858f2dc91ab50fff99f2f23eedfb99207b29cf 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
@@ -129,7 +129,12 @@ public class ChunkHolder {
|
||||
@@ -102,7 +102,12 @@ public class ChunkHolder {
|
||||
|
||||
public void addPlayer(ServerPlayer player) {
|
||||
if (!this.playersSentChunkTo.add(player)) {
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Entity ticking throttling & removal to prevent lag.
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index a151ca3a0803a5e653674e51e8d41a2f38b1f3df..30da22816eecfce179d365fa4de2b979438a302a 100644
|
||||
index 5e79a464c912466952547cc294557821b6ff3576..6557a587f51f421b477557b17883578542fa1baf 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -23,6 +23,7 @@ dependencies {
|
||||
@@ -290,11 +290,11 @@ index 6fac162e0ec057af9f3336314d5663554cef0490..efecc7e132c67577577c99bfcf98e2b4
|
||||
level.kaiijuConfig.reload();
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/RegionizedWorldData.java b/src/main/java/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
index 65c4e158d81ac5c5788cf4dcb379061aebd23dcd..223bf699d76e53b131b47256df288db60141fd9e 100644
|
||||
index 7ca275826609bcf96f103a8c50beaa47c3b4068b..e895fad608e3a166cf9c800f16edb59bf9a42947 100644
|
||||
--- a/src/main/java/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
+++ b/src/main/java/io/papermc/paper/threadedregions/RegionizedWorldData.java
|
||||
@@ -296,6 +296,7 @@ public final class RegionizedWorldData {
|
||||
private final ReferenceList<Entity> allEntities = new ReferenceList<>();
|
||||
@@ -331,6 +331,7 @@ public final class RegionizedWorldData {
|
||||
private final ReferenceList<Entity> toProcessTrackingUnloading = new ReferenceList<>();
|
||||
private final IteratorSafeOrderedReferenceSet<Entity> entityTickList = new IteratorSafeOrderedReferenceSet<>();
|
||||
private final IteratorSafeOrderedReferenceSet<Mob> navigatingMobs = new IteratorSafeOrderedReferenceSet<>();
|
||||
+ public final dev.kaiijumc.kaiiju.KaiijuEntityThrottler entityThrottler = new dev.kaiijumc.kaiiju.KaiijuEntityThrottler(); // Kaiiju
|
||||
@@ -302,7 +302,7 @@ index 65c4e158d81ac5c5788cf4dcb379061aebd23dcd..223bf699d76e53b131b47256df288db6
|
||||
// block ticking
|
||||
private final ObjectLinkedOpenHashSet<BlockEventData> blockEvents = new ObjectLinkedOpenHashSet<>();
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 991e4c19763a34a6fead88363e007c2d11aad836..24a2d3f496727790f63cb66a2534d4423555fa3c 100644
|
||||
index 31397e53ab76266356c7582280d264c0f1df2504..4d077e459f385f86a0f35dd72d4fdc3a37961da9 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -225,6 +225,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -319,22 +319,18 @@ index 991e4c19763a34a6fead88363e007c2d11aad836..24a2d3f496727790f63cb66a2534d442
|
||||
dev.kaiijumc.kaiiju.KaiijuConfig.registerCommands();
|
||||
// Kaiiju end
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
<<<<<<< Updated upstream
|
||||
index 1818c5ae88c331fb900470436f72049165c9e9f4..7938ce423422c1a2cb72a9b2e45c7bbb6f20ec91 100644
|
||||
=======
|
||||
index 245c3e63588379f51780963ba91bc6bf0a3feda6..6efc8b37d4ee929522f5646c972565b99aa45de3 100644
|
||||
>>>>>>> Stashed changes
|
||||
index ca065f1600713a7f509e54580c625287e94d1e40..6a3964d3120dfd98c7a434dc86e221aeebcb0145 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -849,6 +849,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
} // Folia end - region threading
|
||||
@@ -968,6 +968,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
} finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.DRAGON_FIGHT_TICK); } // Folia - profiler
|
||||
}
|
||||
|
||||
+ if (kaiijuConfig.enableEntityThrottling) regionizedWorldData.entityThrottler.tickLimiterStart(); // Kaiiju
|
||||
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
||||
timings.entityTick.startTiming(); // Spigot
|
||||
regionizedWorldData.forEachTickingEntity((entity) -> { // Folia - regionised ticking
|
||||
@@ -871,6 +872,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.ENTITY_TICK); try { // Folia - profiler
|
||||
@@ -991,6 +992,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
entity.stopRiding();
|
||||
}
|
||||
|
||||
@@ -348,16 +344,16 @@ index 245c3e63588379f51780963ba91bc6bf0a3feda6..6efc8b37d4ee929522f5646c972565b9
|
||||
gameprofilerfiller.push("tick");
|
||||
this.guardEntityTick(this::tickNonPassenger, entity);
|
||||
gameprofilerfiller.pop();
|
||||
@@ -878,6 +886,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
@@ -999,6 +1007,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
});
|
||||
} finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.ENTITY_TICK); } // Folia - profiler
|
||||
+ if (kaiijuConfig.enableEntityThrottling) regionizedWorldData.entityThrottler.tickLimiterFinish(regionizedWorldData); // Kaiiju
|
||||
timings.entityTick.stopTiming(); // Spigot
|
||||
timings.tickEntities.stopTiming(); // Spigot
|
||||
gameprofilerfiller.pop();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index 1f194f5324ab5efc5ae11d248dd09f875624559c..641d27bdc711f5d1cdf39637f8ad032d46575216 100644
|
||||
index d29fe7ac0c68b2d57a0c6b6d06bbb4436bfc4c14..b0e08392520fe21ef7b2dd66272da68411887223 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -179,6 +179,11 @@ public class Main {
|
||||
@@ -22,10 +22,10 @@ index 816db23fa64aab69e3034484c00645ebd0479978..7c6c74f95c2534624a928ccf6b0a4b9d
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 0c50b516d0ff1c2812a877b57148f01861f8027f..b971f35b69a930dddcf603207f524dc95e09f0fd 100644
|
||||
index 01d1360d7e3a31b985f24f825d304ae75a99814c..f1f7a9b358eed87279f46eb49729214aaa8df6b3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3943,6 +3943,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4015,6 +4015,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
protected boolean tryEndPortal() {
|
||||
io.papermc.paper.util.TickThread.ensureTickThread(this, "Cannot portal entity async");
|
||||
@@ -23,7 +23,7 @@ index 7c6c74f95c2534624a928ccf6b0a4b9d2a5486ad..9f0095f2196133a8bcffd5306aa9ac0b
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 34b3541603b8cca16c7d62f3981d7ce3e8be0dbe..87d08f4d5bdec0ef96c0e4a91a2f595d2b0f0026 100644
|
||||
index 31b59d7d439dbbd79605e5d078cbc9131b786ad9..629b12dbf855b6faa23a2fdf876cfd49e9228dc3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -133,7 +133,7 @@ public class FallingBlockEntity extends Entity {
|
||||
50
patches/server/0023-Vanilla-end-portal-teleportation.patch
Normal file
50
patches/server/0023-Vanilla-end-portal-teleportation.patch
Normal file
@@ -0,0 +1,50 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||
Date: Fri, 19 May 2023 03:38:03 +0300
|
||||
Subject: [PATCH] Vanilla end portal teleportation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index f1f7a9b358eed87279f46eb49729214aaa8df6b3..3dc840bf74e12a9e757a2adaa1d0b22d68ac3d26 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -4101,12 +4101,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
targetPos, 16, // load 16 blocks to be safe from block physics
|
||||
ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.HIGH,
|
||||
(chunks) -> {
|
||||
- ServerLevel.makeObsidianPlatform(destination, null, targetPos);
|
||||
+ //ServerLevel.makeObsidianPlatform(destination, null, targetPos); // Kaiiju - Vanilla end teleportation - moved down
|
||||
|
||||
+ // Kaiiju start - Vanilla end teleportation
|
||||
+ Vec3 finalPos;
|
||||
+ if (this instanceof Player) finalPos = Vec3.atBottomCenterOf(targetPos.below());
|
||||
+ else finalPos = Vec3.atBottomCenterOf(targetPos);
|
||||
+ // Kaiiju end
|
||||
// the portal obsidian is placed at targetPos.y - 2, so if we want to place the entity
|
||||
// on the obsidian, we need to spawn at targetPos.y - 1
|
||||
portalInfoCompletable.complete(
|
||||
- new PortalInfo(Vec3.atBottomCenterOf(targetPos.below()), Vec3.ZERO, 90.0f, 0.0f, destination, null)
|
||||
+ new PortalInfo(finalPos, this.getDeltaMovement(), 90.0f, 0.0f, destination, null) // Kaiiju - Vanilla end teleportation
|
||||
);
|
||||
}
|
||||
);
|
||||
@@ -4293,6 +4298,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
if (!this.canPortalAsync(takePassengers)) {
|
||||
return false;
|
||||
}
|
||||
+ // Kaiiju start - sync end platform spawning & entity teleportation
|
||||
+ final java.util.function.Consumer<Entity> tpComplete = type == PortalType.END && destination.getTypeKey() == LevelStem.END ?
|
||||
+ e -> ServerLevel.makeObsidianPlatform(destination, null, ServerLevel.END_SPAWN_POINT) : teleportComplete;
|
||||
+ // Kaiiju end
|
||||
|
||||
Vec3 initialPosition = this.position();
|
||||
ChunkPos initialPositionChunk = new ChunkPos(
|
||||
@@ -4351,7 +4360,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
// place
|
||||
passengerTree.root.placeInAsync(
|
||||
originWorld, destination, Entity.TELEPORT_FLAG_LOAD_CHUNK | (takePassengers ? Entity.TELEPORT_FLAG_TELEPORT_PASSENGERS : 0L),
|
||||
- passengerTree, teleportComplete
|
||||
+ passengerTree, tpComplete // Kaiiju - vanilla end teleportation
|
||||
);
|
||||
});
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Use Math.floor instead of fastfloor
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
index 38441121cf7cdc1d64ef9fc17ae76dc16fbf96f2..3f76e1bc0c08775353d22b7d928536aba9c8ad1d 100644
|
||||
index 2d6fc460c850c6d515794d2fa29324a448a985d1..d86355506a216389642d00bc0e0c6718ee2d0486 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
@@ -164,13 +164,19 @@ public final class MCUtil {
|
||||
@@ -166,13 +166,19 @@ public final class MCUtil {
|
||||
}
|
||||
|
||||
public static int fastFloor(double x) {
|
||||
@@ -5,12 +5,12 @@ Subject: [PATCH] Allow user to enable moving into unloaded chunks
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
index a00201eca053ef69b8d903fdb9538444baf85465..bb9f088e3b7b90ab38d794433fc5d30d39e12c76 100644
|
||||
index 1e3ae1cb466b4757ce7fc0bd0201190230756bcc..8cf64c784d1768275b94fd1e4125c7c8742b3d5d 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
@@ -415,14 +415,14 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public class Chunks extends Post {
|
||||
@Override
|
||||
@@ -473,14 +473,14 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
// Folia start - region threading - force prevent moving into unloaded chunks
|
||||
@PostProcess
|
||||
public void postProcess() {
|
||||
- this.preventMovingIntoUnloadedChunks = true;
|
||||
+ //this.preventMovingIntoUnloadedChunks = true; // Kaiiju - Don't
|
||||
@@ -1,27 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||
Date: Fri, 19 May 2023 03:38:03 +0300
|
||||
Subject: [PATCH] Vanilla end portal teleportation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index b971f35b69a930dddcf603207f524dc95e09f0fd..135573308662845ecc73fde1c620345e1f372538 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -4031,10 +4031,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
(chunks) -> {
|
||||
ServerLevel.makeObsidianPlatform(destination, null, targetPos);
|
||||
|
||||
+ // Kaiiju start - Vanilla end teleportation
|
||||
+ Vec3 finalPos;
|
||||
+ if (this instanceof Player) finalPos = Vec3.atBottomCenterOf(targetPos.below());
|
||||
+ else finalPos = Vec3.atBottomCenterOf(targetPos);
|
||||
+ // Kaiiju end
|
||||
// the portal obsidian is placed at targetPos.y - 2, so if we want to place the entity
|
||||
// on the obsidian, we need to spawn at targetPos.y - 1
|
||||
portalInfoCompletable.complete(
|
||||
- new PortalInfo(Vec3.atBottomCenterOf(targetPos.below()), Vec3.ZERO, 90.0f, 0.0f, destination, null)
|
||||
+ new PortalInfo(finalPos, this.getDeltaMovement(), 90.0f, 0.0f, destination, null) // Kaiiju - Vanilla end teleportation
|
||||
);
|
||||
}
|
||||
);
|
||||
@@ -5,28 +5,28 @@ Subject: [PATCH] Don't spam recipe changes on update
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
index acc49f66bf34e2507d0ee6fec0a56b11bfc68f46..6c705189b84542db584039763821b222df03e5d1 100644
|
||||
index e38e2e5a7ddba9c140f362021b6be0b0974f7cd1..4cb589f03a7652238e70a9ef76c8cafd84ecc5d6 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
@@ -147,7 +147,7 @@ public class PlayerAdvancements {
|
||||
if (advancement == null) {
|
||||
// CraftBukkit start
|
||||
if (entry.getKey().getNamespace().equals("minecraft")) {
|
||||
- PlayerAdvancements.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.playerSavePath);
|
||||
+ //PlayerAdvancements.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.playerSavePath); // Kaiiju - We already know, don't spam.
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -200,7 +200,7 @@ public class PlayerAdvancements {
|
||||
|
||||
if (advancementholder == null) {
|
||||
if (!minecraftkey.getNamespace().equals("minecraft")) return; // CraftBukkit
|
||||
- PlayerAdvancements.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", minecraftkey, this.playerSavePath);
|
||||
+ //PlayerAdvancements.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", minecraftkey, this.playerSavePath); // Kaiiju - We already know, don't spam.
|
||||
} else {
|
||||
this.startProgress(advancementholder, advancementprogress);
|
||||
this.progressChanged.add(advancementholder);
|
||||
diff --git a/src/main/java/net/minecraft/stats/ServerRecipeBook.java b/src/main/java/net/minecraft/stats/ServerRecipeBook.java
|
||||
index ea29e07a105f3ba6a878bdccf36e7eaf66280280..8bbb5feea4190344fd6b3a3ae9f1c3cae578b9a6 100644
|
||||
index 4103ddf16164e3992fef0765d368282572537e29..fe69cd06457ada65ced4ee32b815360a435e6c55 100644
|
||||
--- a/src/main/java/net/minecraft/stats/ServerRecipeBook.java
|
||||
+++ b/src/main/java/net/minecraft/stats/ServerRecipeBook.java
|
||||
@@ -125,7 +125,7 @@ public class ServerRecipeBook extends RecipeBook {
|
||||
Optional<? extends Recipe<?>> optional = recipeManager.byKey(minecraftkey);
|
||||
Optional<RecipeHolder<?>> optional = recipeManager.byKey(minecraftkey);
|
||||
|
||||
if (!optional.isPresent()) {
|
||||
if (optional.isEmpty()) {
|
||||
- ServerRecipeBook.LOGGER.error("Tried to load unrecognized recipe: {} removed now.", minecraftkey);
|
||||
+ //ServerRecipeBook.LOGGER.error("Tried to load unrecognized recipe: {} removed now.", minecraftkey); // Kaiiju - We already know, don't spam.
|
||||
} else {
|
||||
handler.accept((Recipe) optional.get());
|
||||
handler.accept((RecipeHolder) optional.get());
|
||||
}
|
||||
@@ -5,11 +5,11 @@ Subject: [PATCH] Option to disable vanish api
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index c934341c17caf4696065ac6c39bdfef570c62f13..f49510c999ce5241f26dc9ba90a6148bf31467c7 100644
|
||||
index 23b43de57a07b2b7b180f1aabd17e7e30830b521..59b41c29f42072ec2d3ba03b09e0ead897800ee1 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -207,7 +207,10 @@ public class KaiijuConfig {
|
||||
alternateKeepAlive = getBoolean("network.alternate-keepalive", alternateKeepAlive);
|
||||
@@ -210,7 +210,10 @@ public class KaiijuConfig {
|
||||
sendNullEntityPackets = getBoolean("network.send-null-entity-packets", sendNullEntityPackets);
|
||||
}
|
||||
|
||||
+ public static boolean disableVanishApi = false;
|
||||
@@ -20,17 +20,17 @@ index c934341c17caf4696065ac6c39bdfef570c62f13..f49510c999ce5241f26dc9ba90a6148b
|
||||
|
||||
public static String serverModName = "Kaiiju";
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index f50507ab85282d261985ce9b186581f5a7a50f79..4fb7ee801173c3f4621d7f09fcefe7c24da5f001 100644
|
||||
index 04e249699e1c1a82d4c94b94b815ffa8fd97a99e..fbb0723ebd7dfef04252de694dc29b979c563452 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1350,7 +1350,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player);
|
||||
@@ -1376,7 +1376,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Folia end - region threading
|
||||
|
||||
// CraftBukkit start - respect vanish API
|
||||
- if (!io.papermc.paper.util.TickThread.isTickThreadFor(player) || !player.getBukkitEntity().canSee(this.entity.getBukkitEntity())) { // Folia - region threading
|
||||
- if (flag && (!io.papermc.paper.util.TickThread.isTickThreadFor(player) || !player.getBukkitEntity().canSee(this.entity.getBukkitEntity()))) { // Folia - region threading
|
||||
+ // Kaiiju start - don't respect vanish API >:D
|
||||
+ boolean canSee = true;
|
||||
+ if (!dev.kaiijumc.kaiiju.KaiijuConfig.disableVanishApi) canSee = player.getBukkitEntity().canSee(this.entity.getBukkitEntity());
|
||||
+ if (flag && !dev.kaiijumc.kaiiju.KaiijuConfig.disableVanishApi) canSee = player.getBukkitEntity().canSee(this.entity.getBukkitEntity());
|
||||
+ if (!io.papermc.paper.util.TickThread.isTickThreadFor(player) || !canSee) { // Folia - region threading
|
||||
+ // Kaiiju end
|
||||
flag = false;
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Option to disable player stats
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index f49510c999ce5241f26dc9ba90a6148bf31467c7..b23f2df433d7ebc871f4009081c28ed9054d91c7 100644
|
||||
index 59b41c29f42072ec2d3ba03b09e0ead897800ee1..b11a329ead2347917d24d932c9a1a826d288f5b6 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 {
|
||||
@@ -211,9 +211,11 @@ public class KaiijuConfig {
|
||||
}
|
||||
|
||||
public static boolean disableVanishApi = false;
|
||||
@@ -21,10 +21,10 @@ index f49510c999ce5241f26dc9ba90a6148bf31467c7..b23f2df433d7ebc871f4009081c28ed9
|
||||
|
||||
public static String serverModName = "Kaiiju";
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index febd0ba72922462364eb65243640dcb693129e21..428da29b343eea9df25e5d719d5162faf0d9d7e5 100644
|
||||
index 42ff3d94ee451ced69c1059f0dbd45085489a60d..374dc5fd0ad15ace5314f2b9c675d1770a43f45a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -2139,6 +2139,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -2144,6 +2144,7 @@ public class ServerPlayer extends Player {
|
||||
|
||||
@Override
|
||||
public void awardStat(Stat<?> stat, int amount) {
|
||||
@@ -24,10 +24,10 @@ index 9f0095f2196133a8bcffd5306aa9ac0b99b2f8d7..31d66bb2fcf4bb7262df2d8006e307fe
|
||||
|
||||
public boolean fixVoidTrading = true;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 428da29b343eea9df25e5d719d5162faf0d9d7e5..ad5830f419321e0f901d58a18bba7b970de567aa 100644
|
||||
index 374dc5fd0ad15ace5314f2b9c675d1770a43f45a..0a65f35f247a39e89d64721499162b419475da4f 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -792,7 +792,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -800,7 +800,7 @@ public class ServerPlayer extends Player {
|
||||
|
||||
@Override
|
||||
protected void onInsideBlock(BlockState state) {
|
||||
@@ -36,7 +36,7 @@ index 428da29b343eea9df25e5d719d5162faf0d9d7e5..ad5830f419321e0f901d58a18bba7b97
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -839,9 +839,9 @@ public class ServerPlayer extends Player {
|
||||
@@ -847,9 +847,9 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ index 428da29b343eea9df25e5d719d5162faf0d9d7e5..ad5830f419321e0f901d58a18bba7b97
|
||||
}
|
||||
|
||||
this.trackStartFallingPosition();
|
||||
@@ -916,7 +916,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -924,7 +924,7 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
|
||||
if (this.tickCount % 20 == 0) {
|
||||
@@ -57,7 +57,7 @@ index 428da29b343eea9df25e5d719d5162faf0d9d7e5..ad5830f419321e0f901d58a18bba7b97
|
||||
}
|
||||
|
||||
// CraftBukkit start - initialize oldLevel, fire PlayerLevelChangeEvent, and tick client-sided world border
|
||||
@@ -945,7 +945,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -953,7 +953,7 @@ public class ServerPlayer extends Player {
|
||||
@Override
|
||||
public void resetFallDistance() {
|
||||
if (this.getHealth() > 0.0F && this.startingToFallPosition != null) {
|
||||
@@ -66,7 +66,7 @@ index 428da29b343eea9df25e5d719d5162faf0d9d7e5..ad5830f419321e0f901d58a18bba7b97
|
||||
}
|
||||
|
||||
this.startingToFallPosition = null;
|
||||
@@ -964,7 +964,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -972,7 +972,7 @@ public class ServerPlayer extends Player {
|
||||
if (this.enteredLavaOnVehiclePosition == null) {
|
||||
this.enteredLavaOnVehiclePosition = this.position();
|
||||
} else {
|
||||
@@ -75,7 +75,7 @@ index 428da29b343eea9df25e5d719d5162faf0d9d7e5..ad5830f419321e0f901d58a18bba7b97
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1168,7 +1168,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -1176,7 +1176,7 @@ public class ServerPlayer extends Player {
|
||||
|
||||
this.handleTeamKill(s, s1, ObjectiveCriteria.TEAM_KILL);
|
||||
this.handleTeamKill(s1, s, ObjectiveCriteria.KILLED_BY_TEAM);
|
||||
@@ -84,7 +84,7 @@ index 428da29b343eea9df25e5d719d5162faf0d9d7e5..ad5830f419321e0f901d58a18bba7b97
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1286,7 +1286,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -1294,7 +1294,7 @@ public class ServerPlayer extends Player {
|
||||
this.wonGame = false;
|
||||
|
||||
this.respawn((player) -> {
|
||||
@@ -120,16 +120,16 @@ index 428da29b343eea9df25e5d719d5162faf0d9d7e5..ad5830f419321e0f901d58a18bba7b97
|
||||
});
|
||||
|
||||
if (!this.serverLevel().canSleepThroughNights()) {
|
||||
@@ -2159,7 +2159,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -2164,7 +2164,7 @@ public class ServerPlayer extends Player {
|
||||
|
||||
@Override
|
||||
public void triggerRecipeCrafted(Recipe<?> recipe, List<ItemStack> ingredients) {
|
||||
- CriteriaTriggers.RECIPE_CRAFTED.trigger(this, recipe.getId(), ingredients);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.RECIPE_CRAFTED.trigger(this, recipe.getId(), ingredients); // Kaiiju
|
||||
public void triggerRecipeCrafted(RecipeHolder<?> recipe, List<ItemStack> ingredients) {
|
||||
- CriteriaTriggers.RECIPE_CRAFTED.trigger(this, recipe.id(), ingredients);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.RECIPE_CRAFTED.trigger(this, recipe.id(), ingredients); // Kaiiju
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2288,14 +2288,14 @@ public class ServerPlayer extends Player {
|
||||
@@ -2293,14 +2293,14 @@ public class ServerPlayer extends Player {
|
||||
this.levitationStartPos = this.position();
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ index 428da29b343eea9df25e5d719d5162faf0d9d7e5..ad5830f419321e0f901d58a18bba7b97
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2306,7 +2306,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -2311,7 +2311,7 @@ public class ServerPlayer extends Player {
|
||||
this.levitationStartPos = null;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ index 428da29b343eea9df25e5d719d5162faf0d9d7e5..ad5830f419321e0f901d58a18bba7b97
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2866,7 +2866,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -2856,7 +2856,7 @@ public class ServerPlayer extends Player {
|
||||
|
||||
@Override
|
||||
protected void updateUsingItem(ItemStack stack) {
|
||||
@@ -164,7 +164,7 @@ index 428da29b343eea9df25e5d719d5162faf0d9d7e5..ad5830f419321e0f901d58a18bba7b97
|
||||
super.updateUsingItem(stack);
|
||||
}
|
||||
|
||||
@@ -2895,7 +2895,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -2885,7 +2885,7 @@ public class ServerPlayer extends Player {
|
||||
Entity entity = item.getOwner();
|
||||
|
||||
if (entity != null) {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Option to disable arm swing event
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index b23f2df433d7ebc871f4009081c28ed9054d91c7..ec71f3f52cb8f7931aabd94619d2e7a24491d7ad 100644
|
||||
index b11a329ead2347917d24d932c9a1a826d288f5b6..2f3827441987528d79d9268002c7a7671faff429 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -209,10 +209,12 @@ public class KaiijuConfig {
|
||||
@@ -212,10 +212,12 @@ public class KaiijuConfig {
|
||||
|
||||
public static boolean disableVanishApi = false;
|
||||
public static boolean disablePlayerStats = false;
|
||||
@@ -22,10 +22,10 @@ index b23f2df433d7ebc871f4009081c28ed9054d91c7..ec71f3f52cb8f7931aabd94619d2e7a2
|
||||
|
||||
public static String serverModName = "Kaiiju";
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 1ab0d3e0653028b7d93177c28c1f532d8b10b1b1..86e14f3d853d6134b7d7b3770107529de8ac2c91 100644
|
||||
index 10ce902a1ce857db5376c8318ba0e67b53883873..4e87165f0a155ace79d9c249c5546951db00dc39 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2656,6 +2656,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -2536,6 +2536,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.resetLastActionTime();
|
||||
@@ -33,7 +33,7 @@ index 1ab0d3e0653028b7d93177c28c1f532d8b10b1b1..86e14f3d853d6134b7d7b3770107529d
|
||||
// CraftBukkit start - Raytrace to look for 'rogue armswings'
|
||||
float f1 = this.player.getXRot();
|
||||
float f2 = this.player.getYRot();
|
||||
@@ -2678,6 +2679,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -2568,6 +2569,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
|
||||
if (event.isCancelled()) return;
|
||||
// CraftBukkit end
|
||||
@@ -25,11 +25,11 @@ index 31d66bb2fcf4bb7262df2d8006e307fee92660ea..c9830912019079369268bfbf2c95de18
|
||||
|
||||
public boolean fixVoidTrading = true;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index af35fd63b090aa3d89bc60cb9cb7694b5f502681..e5dded0363b14608e834e63e678563b1423d66e7 100644
|
||||
index 72a5973c6e150533ec70496d72b53c80a142eef7..891edd228699915f165ddf3ca4fcee502874780d 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -486,21 +486,29 @@ public class ServerChunkCache extends ChunkSource {
|
||||
chunkRange = (chunkRange > viewDistance) ? (byte)viewDistance : chunkRange;
|
||||
@@ -540,7 +540,11 @@ public class ServerChunkCache extends ChunkSource {
|
||||
chunkRange = (chunkRange > viewDistance) ? viewDistance : chunkRange;
|
||||
chunkRange = (chunkRange > DistanceManager.MOB_SPAWN_RANGE) ? DistanceManager.MOB_SPAWN_RANGE : chunkRange;
|
||||
|
||||
- com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(player.getBukkitEntity(), (byte)chunkRange);
|
||||
@@ -39,25 +39,26 @@ index af35fd63b090aa3d89bc60cb9cb7694b5f502681..e5dded0363b14608e834e63e678563b1
|
||||
+ event = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(player.getBukkitEntity(), (byte)chunkRange);
|
||||
+ // Kaiiju end
|
||||
event.callEvent();
|
||||
if (event.isCancelled() || event.getSpawnRadius() < 0) { // Folia - region threading
|
||||
player.lastEntitySpawnRadiusSquared = -1.0; player.playerNaturallySpawnedEvent = null; // Folia - region threading
|
||||
if (event.isCancelled() || event.getSpawnRadius() < 0) {
|
||||
regionizedWorldData.mobSpawnMap.remove(player); // Folia - region threading
|
||||
@@ -548,14 +552,18 @@ public class ServerChunkCache extends ChunkSource {
|
||||
player.lastEntitySpawnRadiusSquared = -1.0;
|
||||
continue;
|
||||
}
|
||||
+ // Kaiiju start - disable creatures spawn events
|
||||
+ chunkRange = Math.min(event.getSpawnRadius(), 32);
|
||||
+ chunkRange = Math.min(event.getSpawnRadius(), DistanceManager.MOB_SPAWN_RANGE);
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
|
||||
- int range = Math.min(event.getSpawnRadius(), 32); // limit to max view distance
|
||||
+ int range = chunkRange; // limit to max view distance // Kaiiju
|
||||
int chunkX = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX());
|
||||
int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ());
|
||||
- int range = Math.min(event.getSpawnRadius(), DistanceManager.MOB_SPAWN_RANGE); // limit to max spawn range
|
||||
+ int range = chunkRange; // limit to max spawn range // Kaiiju
|
||||
int chunkX = io.papermc.paper.util.CoordinateUtils.getChunkCoordinate(player.getX());
|
||||
int chunkZ = io.papermc.paper.util.CoordinateUtils.getChunkCoordinate(player.getZ());
|
||||
|
||||
regionizedWorldData.mobSpawnMap.addOrUpdate(player, chunkX, chunkZ, range); // Folia - region threading
|
||||
player.lastEntitySpawnRadiusSquared = (double)((range << 4) * (range << 4)); // used in anyPlayerCloseEnoughForSpawning
|
||||
- player.playerNaturallySpawnedEvent = event;
|
||||
+ if (!this.level.kaiijuConfig.disableCreaturesSpawnEvents) player.playerNaturallySpawnedEvent = event; // Kaiiju
|
||||
}
|
||||
// Paper end - optimize isOutisdeRange
|
||||
LevelData worlddata = this.level.getLevelData();
|
||||
// Paper end - optimise chunk tick iteration
|
||||
|
||||
@@ -25,7 +25,7 @@ index c9830912019079369268bfbf2c95de18ad598f52..e2fb7d7a7b3126d386b46442c115085d
|
||||
|
||||
public boolean fixVoidTrading = true;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
index 4ec6dc8ddcb940091956fdf014f43832db287d8d..770c3c26702d4136df6b8f891f4949f364b62a1b 100644
|
||||
index 8448c5d778998390cf2b683f36e4e18ca7ffdc34..8438ae5194bba7cad22af5e350c5a288529cbcdb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
@@ -164,7 +164,7 @@ public class Dolphin extends WaterAnimal {
|
||||
18
patches/server/0034-Unsupported-configuration.patch
Normal file
18
patches/server/0034-Unsupported-configuration.patch
Normal file
@@ -0,0 +1,18 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Kugge <sofiane.djerbi38@gmail.com>
|
||||
Date: Mon, 28 Aug 2023 16:30:36 +0200
|
||||
Subject: [PATCH] Unsupported configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index 2f3827441987528d79d9268002c7a7671faff429..b0515b073f30f6b3417b28b7fb2242e9ca309354 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -227,4 +227,7 @@ public class KaiijuConfig {
|
||||
serverModName = getString("gameplay.server-mod-name", serverModName);
|
||||
sharedRandomForPlayers = getBoolean("gameplay.shared-random-for-players", sharedRandomForPlayers);
|
||||
}
|
||||
+
|
||||
+ private static void unsupportedSettings() {
|
||||
+ }
|
||||
}
|
||||
@@ -5,25 +5,21 @@ Subject: [PATCH] Option to disable ensure tick thread checks
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index ec71f3f52cb8f7931aabd94619d2e7a24491d7ad..fa2a763e5784e7dae02c94a13751cbf746b6eee8 100644
|
||||
index b0515b073f30f6b3417b28b7fb2242e9ca309354..2f5520f66da082dc1bc1f17ef3d7ed75bcf436fd 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -210,11 +210,13 @@ public class KaiijuConfig {
|
||||
public static boolean disableVanishApi = false;
|
||||
public static boolean disablePlayerStats = false;
|
||||
public static boolean disableArmSwingEvent = false;
|
||||
+ public static boolean disableEnsureTickThreadChecks = false;
|
||||
|
||||
private static void optimizationSettings() {
|
||||
disableVanishApi = getBoolean("optimization.disable-vanish-api", disableVanishApi);
|
||||
disablePlayerStats = getBoolean("optimization.disable-player-stats", disablePlayerStats);
|
||||
disableArmSwingEvent = getBoolean("optimization.disable-arm-swing-event", disableArmSwingEvent);
|
||||
+ disableEnsureTickThreadChecks = getBoolean("optimization.disable-ensure-tick-thread-checks", disableEnsureTickThreadChecks);
|
||||
@@ -228,6 +228,9 @@ public class KaiijuConfig {
|
||||
sharedRandomForPlayers = getBoolean("gameplay.shared-random-for-players", sharedRandomForPlayers);
|
||||
}
|
||||
|
||||
public static String serverModName = "Kaiiju";
|
||||
+ public static boolean disableEnsureTickThreadChecks = false;
|
||||
+
|
||||
private static void unsupportedSettings() {
|
||||
+ disableEnsureTickThreadChecks = getBoolean("unsupported.disable-ensure-tick-thread-checks", disableEnsureTickThreadChecks);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/util/TickThread.java b/src/main/java/io/papermc/paper/util/TickThread.java
|
||||
index cb453dd110fc37fae75257a4576512126207763e..492e6a512343001d3d772d2d8b427d2d84e89da5 100644
|
||||
index c6b3c747d4c9792c3b690af4d45b13d2b05039ee..6da5a1e6e2ab7493d24e7f79f601499cb30e5c3c 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/TickThread.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/TickThread.java
|
||||
@@ -46,6 +46,7 @@ public class TickThread extends Thread {
|
||||
@@ -26,10 +26,10 @@ index e2fb7d7a7b3126d386b46442c115085d1974ac4e..44f5540a6a5733cf6f10f6b04fc9611a
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 135573308662845ecc73fde1c620345e1f372538..812b2c216003b8decedef1353acab1b44d146e08 100644
|
||||
index 3dc840bf74e12a9e757a2adaa1d0b22d68ac3d26..2d87c5f7c3d63a274fc3f104ee6d29849754c485 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1126,7 +1126,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1115,7 +1115,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ index 135573308662845ecc73fde1c620345e1f372538..812b2c216003b8decedef1353acab1b4
|
||||
}
|
||||
|
||||
this.level().getProfiler().pop();
|
||||
@@ -3868,13 +3881,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3940,13 +3953,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
// check for same region
|
||||
if (destination == this.level()) {
|
||||
Vec3 currPos = this.position();
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add back worldborder command
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 681cd79ce24fe5d952e987d46e2fd8df07a0f8a1..68af43ed4d667648df0e45ffc899d3e4b7b1a69d 100644
|
||||
index 4f6bd2d88219ac82c4d08c35231e5d3314f87110..21e2a55c3c9023718f51fdb2d3a321eceb2aa7ca 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -199,7 +199,7 @@ public class Commands {
|
||||
@@ -202,7 +202,7 @@ public class Commands {
|
||||
TitleCommand.register(this.dispatcher);
|
||||
//TriggerCommand.register(this.dispatcher); // Folia - region threading - TODO later
|
||||
WeatherCommand.register(this.dispatcher);
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add back data command
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 68af43ed4d667648df0e45ffc899d3e4b7b1a69d..44576310cc5b89c287b0ab7ba1a99d76b67f33dd 100644
|
||||
index 21e2a55c3c9023718f51fdb2d3a321eceb2aa7ca..034c64df1fd1f58a01535183753f94899c50df2b 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -148,7 +148,7 @@ public class Commands {
|
||||
@@ -150,7 +150,7 @@ public class Commands {
|
||||
ClearInventoryCommands.register(this.dispatcher, commandRegistryAccess);
|
||||
//CloneCommands.register(this.dispatcher, commandRegistryAccess); // Folia - region threading - TODO
|
||||
DamageCommand.register(this.dispatcher, commandRegistryAccess);
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Async path processing
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index ebfa9e1dcca5ea8272e796f0409902d92b59ee76..6be4abdd16f2d57a80dbe175a91ff304fd17a7db 100644
|
||||
index 2f5520f66da082dc1bc1f17ef3d7ed75bcf436fd..15cdfc9bf0e4a12f1f3e9e8c224f7a5bacd9bfc7 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -12,6 +12,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@@ -16,24 +16,21 @@ index ebfa9e1dcca5ea8272e796f0409902d92b59ee76..6be4abdd16f2d57a80dbe175a91ff304
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
@@ -213,12 +214,28 @@ public class KaiijuConfig {
|
||||
@@ -213,11 +214,25 @@ public class KaiijuConfig {
|
||||
public static boolean disableVanishApi = false;
|
||||
public static boolean disablePlayerStats = false;
|
||||
public static boolean disableArmSwingEvent = false;
|
||||
public static boolean disableEnsureTickThreadChecks = false;
|
||||
+ public static boolean asyncPathProcessing = false;
|
||||
+ public static int asyncPathProcessingMaxThreads = 0;
|
||||
+ public static int asyncPathProcessingKeepalive = 60;
|
||||
+ public static int asyncPathProcessingQueueCapacity = 4096;
|
||||
|
||||
private static void optimizationSettings() {
|
||||
disableVanishApi = getBoolean("optimization.disable-vanish-api", disableVanishApi);
|
||||
disablePlayerStats = getBoolean("optimization.disable-player-stats", disablePlayerStats);
|
||||
disableArmSwingEvent = getBoolean("optimization.disable-arm-swing-event", disableArmSwingEvent);
|
||||
disableEnsureTickThreadChecks = getBoolean("optimization.disable-ensure-tick-thread-checks", disableEnsureTickThreadChecks);
|
||||
+ asyncPathProcessing = getBoolean("optimization.async-path-processing.enable", asyncPathProcessing);
|
||||
+ asyncPathProcessingMaxThreads = getInt("optimization.async-path-processing.max-threads", asyncPathProcessingMaxThreads);
|
||||
+ asyncPathProcessingKeepalive = getInt("optimization.async-path-processing.keepalive", asyncPathProcessingKeepalive);
|
||||
+ asyncPathProcessingQueueCapacity = getInt("optimization.async-path-processing.queue-capacity", asyncPathProcessingQueueCapacity);
|
||||
+ if (asyncPathProcessingMaxThreads < 0)
|
||||
+ asyncPathProcessingMaxThreads = Math.max(Runtime.getRuntime().availableProcessors() + asyncPathProcessingMaxThreads, 1);
|
||||
+ else if (asyncPathProcessingMaxThreads == 0)
|
||||
@@ -340,7 +337,7 @@ index 0000000000000000000000000000000000000000..6b91852238f80d236fc44f766b115267
|
||||
+}
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/path/AsyncPathProcessor.java b/src/main/java/dev/kaiijumc/kaiiju/path/AsyncPathProcessor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a6de8906d1629c60523c02681379ccdcaa22b588
|
||||
index 0000000000000000000000000000000000000000..2a54fa6d733cb5d406fd218161448197515be7fb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/path/AsyncPathProcessor.java
|
||||
@@ -0,0 +1,53 @@
|
||||
@@ -348,6 +345,7 @@ index 0000000000000000000000000000000000000000..a6de8906d1629c60523c02681379ccdc
|
||||
+
|
||||
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
+
|
||||
+import dev.kaiijumc.kaiiju.KaiijuConfig;
|
||||
+import net.minecraft.world.level.pathfinder.Path;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
+
|
||||
@@ -364,10 +362,9 @@ index 0000000000000000000000000000000000000000..a6de8906d1629c60523c02681379ccdc
|
||||
+
|
||||
+ private static final Executor pathProcessingExecutor = new ThreadPoolExecutor(
|
||||
+ 1,
|
||||
+ dev.kaiijumc.kaiiju.KaiijuConfig.asyncPathProcessingMaxThreads,
|
||||
+ dev.kaiijumc.kaiiju.KaiijuConfig.asyncPathProcessingKeepalive,
|
||||
+ TimeUnit.SECONDS,
|
||||
+ new ArrayBlockingQueue<>(dev.kaiijumc.kaiiju.KaiijuConfig.asyncPathProcessingQueueCapacity),
|
||||
+ KaiijuConfig.asyncPathProcessingMaxThreads,
|
||||
+ KaiijuConfig.asyncPathProcessingKeepalive, TimeUnit.SECONDS,
|
||||
+ new LinkedBlockingQueue<>(),
|
||||
+ new ThreadFactoryBuilder()
|
||||
+ .setNameFormat("petal-path-processor-%d")
|
||||
+ .setPriority(Thread.NORM_PRIORITY - 2)
|
||||
@@ -399,10 +396,10 @@ index 0000000000000000000000000000000000000000..a6de8906d1629c60523c02681379ccdc
|
||||
+}
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/path/NodeEvaluatorCache.java b/src/main/java/dev/kaiijumc/kaiiju/path/NodeEvaluatorCache.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..121eda164714650f76bb6c8495ef375d8a00d812
|
||||
index 0000000000000000000000000000000000000000..3213fed7cea3ebfc364f4d6603b95f4263222c76
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/path/NodeEvaluatorCache.java
|
||||
@@ -0,0 +1,42 @@
|
||||
@@ -0,0 +1,45 @@
|
||||
+package dev.kaiijumc.kaiiju.path;
|
||||
+
|
||||
+import net.minecraft.world.level.pathfinder.NodeEvaluator;
|
||||
@@ -419,13 +416,13 @@ index 0000000000000000000000000000000000000000..121eda164714650f76bb6c8495ef375d
|
||||
+ private static final Map<NodeEvaluatorFeatures, ConcurrentLinkedQueue<NodeEvaluator>> threadLocalNodeEvaluators = new ConcurrentHashMap<>();
|
||||
+ private static final Map<NodeEvaluator, NodeEvaluatorGenerator> nodeEvaluatorToGenerator = new ConcurrentHashMap<>();
|
||||
+
|
||||
+ private static @NotNull Queue<NodeEvaluator> getDequeForGenerator(@NotNull NodeEvaluatorFeatures nodeEvaluatorFeatures) {
|
||||
+ private static @NotNull Queue<NodeEvaluator> getQueueForFeatures(@NotNull NodeEvaluatorFeatures nodeEvaluatorFeatures) {
|
||||
+ return threadLocalNodeEvaluators.computeIfAbsent(nodeEvaluatorFeatures, (key) -> new ConcurrentLinkedQueue<>());
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull NodeEvaluator takeNodeEvaluator(@NotNull NodeEvaluatorGenerator generator, @NotNull NodeEvaluator localNodeEvaluator) {
|
||||
+ final NodeEvaluatorFeatures nodeEvaluatorFeatures = NodeEvaluatorFeatures.fromNodeEvaluator(localNodeEvaluator);
|
||||
+ NodeEvaluator nodeEvaluator = getDequeForGenerator(nodeEvaluatorFeatures).poll();
|
||||
+ NodeEvaluator nodeEvaluator = getQueueForFeatures(nodeEvaluatorFeatures).poll();
|
||||
+
|
||||
+ if (nodeEvaluator == null) {
|
||||
+ nodeEvaluator = generator.generate(nodeEvaluatorFeatures);
|
||||
@@ -437,13 +434,16 @@ index 0000000000000000000000000000000000000000..121eda164714650f76bb6c8495ef375d
|
||||
+ }
|
||||
+
|
||||
+ public static void returnNodeEvaluator(@NotNull NodeEvaluator nodeEvaluator) {
|
||||
+ final NodeEvaluatorFeatures nodeEvaluatorFeatures = NodeEvaluatorFeatures.fromNodeEvaluator(nodeEvaluator);
|
||||
+ final var generator = nodeEvaluatorToGenerator.remove(nodeEvaluator);
|
||||
+ final NodeEvaluatorGenerator generator = nodeEvaluatorToGenerator.remove(nodeEvaluator);
|
||||
+ Validate.notNull(generator, "NodeEvaluator already returned");
|
||||
+
|
||||
+ getDequeForGenerator(nodeEvaluatorFeatures).offer(nodeEvaluator);
|
||||
+ final NodeEvaluatorFeatures nodeEvaluatorFeatures = NodeEvaluatorFeatures.fromNodeEvaluator(nodeEvaluator);
|
||||
+ getQueueForFeatures(nodeEvaluatorFeatures).offer(nodeEvaluator);
|
||||
+ }
|
||||
+
|
||||
+ public static void removeNodeEvaluator(@NotNull NodeEvaluator nodeEvaluator) {
|
||||
+ nodeEvaluatorToGenerator.remove(nodeEvaluator);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/path/NodeEvaluatorFeatures.java b/src/main/java/dev/kaiijumc/kaiiju/path/NodeEvaluatorFeatures.java
|
||||
new file mode 100644
|
||||
@@ -513,22 +513,22 @@ index 0000000000000000000000000000000000000000..130d61324679c8600faa52255f3ad99f
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index a8b23b1594d2b39568c68c93a8a1b936457672bc..8bd27e1a60c1a92350f4954764ea17914959e6dc 100644
|
||||
index 8d6a2966ebf5ff5813575f5451cceaddace53b4c..8d99d82a9ddfedd9aa59db56de55b0c270718e43 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -294,6 +294,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
@@ -295,6 +295,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||
@Nullable
|
||||
@Override
|
||||
public LivingEntity getTarget() {
|
||||
+ if (!io.papermc.paper.util.TickThread.isTickThreadFor(this)) return this.target; // Kaiiju - for the async path processor
|
||||
+ if (Thread.currentThread().getName().contains("petal-path-processor")) return this.target; // Kaiiju - Don't reset target when async pathfinding!
|
||||
// Folia start - region threading
|
||||
if (!io.papermc.paper.util.TickThread.isTickThreadFor(this.target)) {
|
||||
if (this.target != null && (!io.papermc.paper.util.TickThread.isTickThreadFor(this.target) || this.target.isRemoved())) {
|
||||
this.target = null;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||
index d4c91e0a0c64fcb7f1145de3f30134cb1f1f8ee6..ef5ec638bcd88df6eb93746868e863dbe0d11677 100644
|
||||
index 8f8b29f80d1573981ccffd207dd6e0941e71a352..501cb2a9fed1eaa2be529e9118827032cd7e0302 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||
@@ -67,6 +67,40 @@ public class AcquirePoi {
|
||||
@@ -68,6 +68,40 @@ public class AcquirePoi {
|
||||
io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes);
|
||||
Set<Pair<Holder<PoiType>, BlockPos>> set = new java.util.HashSet<>(poiposes);
|
||||
// Paper end - optimise POI access
|
||||
@@ -569,7 +569,7 @@ index d4c91e0a0c64fcb7f1145de3f30134cb1f1f8ee6..ef5ec638bcd88df6eb93746868e863db
|
||||
Path path = findPathToPois(entity, set);
|
||||
if (path != null && path.canReach()) {
|
||||
BlockPos blockPos = path.getTarget();
|
||||
@@ -88,6 +122,7 @@ public class AcquirePoi {
|
||||
@@ -89,6 +123,7 @@ public class AcquirePoi {
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -578,7 +578,7 @@ index d4c91e0a0c64fcb7f1145de3f30134cb1f1f8ee6..ef5ec638bcd88df6eb93746868e863db
|
||||
return true;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java b/src/main/java/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java
|
||||
index 98bf17441da3169d49de55fe89d79ebe250a2b7e..df85430912bb00cef1994ded357ca93680f0650d 100644
|
||||
index 98bf17441da3169d49de55fe89d79ebe250a2b7e..5f3b38830c786deed161bdd2efd2d3c4071d34ec 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java
|
||||
@@ -21,6 +21,7 @@ public class MoveToTargetSink extends Behavior<Mob> {
|
||||
@@ -589,19 +589,19 @@ index 98bf17441da3169d49de55fe89d79ebe250a2b7e..df85430912bb00cef1994ded357ca936
|
||||
@Nullable
|
||||
private BlockPos lastTargetPos;
|
||||
private float speedModifier;
|
||||
@@ -42,7 +43,10 @@ public class MoveToTargetSink extends Behavior<Mob> {
|
||||
@@ -42,9 +43,10 @@ public class MoveToTargetSink extends Behavior<Mob> {
|
||||
Brain<?> brain = entity.getBrain();
|
||||
WalkTarget walkTarget = brain.getMemory(MemoryModuleType.WALK_TARGET).get();
|
||||
boolean bl = this.reachedTarget(entity, walkTarget);
|
||||
- if (!bl && this.tryComputePath(entity, walkTarget, world.getGameTime())) {
|
||||
+ // Kaiiju start - petal - async path processing means we can't know if the path is reachable here
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.asyncPathProcessing && !bl) return true;
|
||||
+ else if (!dev.kaiijumc.kaiiju.KaiijuConfig.asyncPathProcessing && !bl && this.tryComputePath(entity, walkTarget, world.getGameTime())) {
|
||||
+ // Kaiiju end
|
||||
+ if (!dev.kaiijumc.kaiiju.KaiijuConfig.asyncPathProcessing && !bl && this.tryComputePath(entity, walkTarget, world.getGameTime())) { // Kaiiju - petal - async path processing means we can't know if the path is reachable here
|
||||
this.lastTargetPos = walkTarget.getTarget().currentBlockPosition();
|
||||
return true;
|
||||
+ } else if (dev.kaiijumc.kaiiju.KaiijuConfig.asyncPathProcessing && !bl) { return true; // Kaiiju - async pathfinding
|
||||
} else {
|
||||
@@ -58,6 +62,7 @@ public class MoveToTargetSink extends Behavior<Mob> {
|
||||
brain.eraseMemory(MemoryModuleType.WALK_TARGET);
|
||||
if (bl) {
|
||||
@@ -58,6 +60,7 @@ public class MoveToTargetSink extends Behavior<Mob> {
|
||||
|
||||
@Override
|
||||
protected boolean canStillUse(ServerLevel world, Mob entity, long time) {
|
||||
@@ -609,7 +609,7 @@ index 98bf17441da3169d49de55fe89d79ebe250a2b7e..df85430912bb00cef1994ded357ca936
|
||||
if (this.path != null && this.lastTargetPos != null) {
|
||||
Optional<WalkTarget> optional = entity.getBrain().getMemory(MemoryModuleType.WALK_TARGET);
|
||||
boolean bl = optional.map(MoveToTargetSink::isWalkTargetSpectator).orElse(false);
|
||||
@@ -82,12 +87,74 @@ public class MoveToTargetSink extends Behavior<Mob> {
|
||||
@@ -82,12 +85,68 @@ public class MoveToTargetSink extends Behavior<Mob> {
|
||||
|
||||
@Override
|
||||
protected void start(ServerLevel serverLevel, Mob mob, long l) {
|
||||
@@ -648,7 +648,8 @@ index 98bf17441da3169d49de55fe89d79ebe250a2b7e..df85430912bb00cef1994ded357ca936
|
||||
+ if (!canReach) {
|
||||
+ Optional<WalkTarget> walkTarget = brain.getMemory(MemoryModuleType.WALK_TARGET);
|
||||
+
|
||||
+ if (walkTarget.isPresent()) {
|
||||
+ if (!walkTarget.isPresent()) return;
|
||||
+
|
||||
+ BlockPos blockPos = walkTarget.get().getTarget().currentBlockPosition();
|
||||
+ Vec3 vec3 = DefaultRandomPos.getPosTowards((PathfinderMob)mob, 10, 7, Vec3.atBottomCenterOf(blockPos), (float)Math.PI / 2F);
|
||||
+ if (vec3 != null) {
|
||||
@@ -659,13 +660,6 @@ index 98bf17441da3169d49de55fe89d79ebe250a2b7e..df85430912bb00cef1994ded357ca936
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // we failed, erase and move on
|
||||
+ brain.eraseMemory(MemoryModuleType.WALK_TARGET);
|
||||
+ this.path = null;
|
||||
+
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ mob.getBrain().setMemory(MemoryModuleType.PATH, this.path);
|
||||
+ mob.getNavigation().moveTo(this.path, this.speedModifier);
|
||||
+ }
|
||||
@@ -674,7 +668,7 @@ index 98bf17441da3169d49de55fe89d79ebe250a2b7e..df85430912bb00cef1994ded357ca936
|
||||
+ Brain<?> brain = mob.getBrain();
|
||||
+
|
||||
+ if (path != null && this.lastTargetPos != null && brain.hasMemoryValue(MemoryModuleType.WALK_TARGET)) {
|
||||
+ WalkTarget walkTarget = brain.getMemory(MemoryModuleType.WALK_TARGET).get();
|
||||
+ WalkTarget walkTarget = brain.getMemory(MemoryModuleType.WALK_TARGET).get(); // we know isPresent = true
|
||||
+ if (walkTarget.getTarget().currentBlockPosition().distSqr(this.lastTargetPos) > 4.0D) {
|
||||
+ this.start(serverLevel, mob, l);
|
||||
+ }
|
||||
@@ -684,7 +678,7 @@ index 98bf17441da3169d49de55fe89d79ebe250a2b7e..df85430912bb00cef1994ded357ca936
|
||||
Path path = mob.getNavigation().getPath();
|
||||
Brain<?> brain = mob.getBrain();
|
||||
if (this.path != path) {
|
||||
@@ -103,7 +170,23 @@ public class MoveToTargetSink extends Behavior<Mob> {
|
||||
@@ -103,7 +162,23 @@ public class MoveToTargetSink extends Behavior<Mob> {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -761,7 +755,7 @@ index 6771f2dc974317b6b152288bf41d1a95bc78a8e4..7a641747b17164b09bb8483cda7f69d1
|
||||
Node node = path.getNode(i);
|
||||
this.doorPos = new BlockPos(node.x, node.y + 1, node.z);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/AmphibiousPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/AmphibiousPathNavigation.java
|
||||
index 97bd4c9f83257c8c54694110d369d0487e4df9f9..f0772715cb806ae0a9d035ba8edb14de742c38a2 100644
|
||||
index 9d3b32c852d660356e0f16d4cc10072b1c603e64..7d511c669912ed07d986567ee013880e97212656 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/AmphibiousPathNavigation.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/AmphibiousPathNavigation.java
|
||||
@@ -12,10 +12,26 @@ public class AmphibiousPathNavigation extends PathNavigation {
|
||||
@@ -792,7 +786,7 @@ index 97bd4c9f83257c8c54694110d369d0487e4df9f9..f0772715cb806ae0a9d035ba8edb14de
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java
|
||||
index acd0b946cab86eb173e713535194d3a9347c7d48..8d3f5f8793b2ebf132b79374c14f0c408aae8a2d 100644
|
||||
index 027eef4ace908147285c8d72b612d16e4f925672..7eb6e8c5afbc9106cb93574dafb8b3f417cc894c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java
|
||||
@@ -16,10 +16,26 @@ public class FlyingPathNavigation extends PathNavigation {
|
||||
@@ -831,10 +825,10 @@ index acd0b946cab86eb173e713535194d3a9347c7d48..8d3f5f8793b2ebf132b79374c14f0c40
|
||||
if (!this.isDone()) {
|
||||
if (this.canUpdatePath()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
|
||||
index 71934af2dc4d209a9fbccfd36b5f2815ec196892..96357530e99bc0b36c1de74bedc1bd7038b91b5a 100644
|
||||
index c065d372ac5f1663db3c521e996ee03669d0bc31..4914260dc9090a25f1f95f69b46d196d512e13ce 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
|
||||
@@ -21,10 +21,26 @@ public class GroundPathNavigation extends PathNavigation {
|
||||
@@ -23,10 +23,26 @@ public class GroundPathNavigation extends PathNavigation {
|
||||
super(entity, world);
|
||||
}
|
||||
|
||||
@@ -862,7 +856,7 @@ index 71934af2dc4d209a9fbccfd36b5f2815ec196892..96357530e99bc0b36c1de74bedc1bd70
|
||||
}
|
||||
|
||||
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 2549b81eb5fa1a021edac960170f5e0d513dae97..477c9eba278bfa88f0358514bb3c609e154fde80 100644
|
||||
index 147057bfd67d56857b5d3ab1ebd0f0a0c1793a9c..a500cb56f6c55868447b04ca8020e1819cb57a35 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
|
||||
@@ -152,6 +152,10 @@ public abstract class PathNavigation {
|
||||
@@ -933,7 +927,7 @@ index 2549b81eb5fa1a021edac960170f5e0d513dae97..477c9eba278bfa88f0358514bb3c609e
|
||||
Vec3 vec3 = this.getTempMobPos();
|
||||
this.maxDistanceToWaypoint = this.mob.getBbWidth() > 0.75F ? this.mob.getBbWidth() / 2.0F : 0.75F - this.mob.getBbWidth() / 2.0F;
|
||||
Vec3i vec3i = this.path.getNextNodePos();
|
||||
@@ -438,7 +462,7 @@ public abstract class PathNavigation {
|
||||
@@ -434,7 +458,7 @@ public abstract class PathNavigation {
|
||||
public boolean shouldRecomputePath(BlockPos pos) {
|
||||
if (this.hasDelayedRecomputation) {
|
||||
return false;
|
||||
@@ -943,7 +937,7 @@ index 2549b81eb5fa1a021edac960170f5e0d513dae97..477c9eba278bfa88f0358514bb3c609e
|
||||
Vec3 vec3 = new Vec3(((double)node.x + this.mob.getX()) / 2.0D, ((double)node.y + this.mob.getY()) / 2.0D, ((double)node.z + this.mob.getZ()) / 2.0D);
|
||||
return pos.closerToCenterThan(vec3, (double)(this.path.getNodeCount() - this.path.getNextNodeIndex()));
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java
|
||||
index 87887916ff2f685346699989ba30c35ef7e5715f..e8b8abb31678517a89774d42710fe0973ce76f98 100644
|
||||
index ee8543afbbd681bf327a353530a7a635aa5ef592..0192e41a07ce529849c528575deaff7af575236f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java
|
||||
@@ -15,10 +15,26 @@ public class WaterBoundPathNavigation extends PathNavigation {
|
||||
@@ -1012,10 +1006,10 @@ index 8db20db72cd51046213625fac46c35854c59ec5d..acb6969e9672e93efe753eb295a8f35a
|
||||
}
|
||||
}
|
||||
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 55026e1731e41b4e3e4c6a8fef5d96a32051a556..b6895ecaba0ccd14a033c055ae28d20baf43c45b 100644
|
||||
index a5ae46b30c24812f5e3ef66eb748e92f2867add8..0b0bd2f496ef74804fcb43da160f5447786d878d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
@@ -1072,7 +1072,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
@@ -1077,7 +1077,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
} else {
|
||||
Bee.this.pathfindRandomlyTowards(Bee.this.hivePos);
|
||||
}
|
||||
@@ -1024,7 +1018,7 @@ index 55026e1731e41b4e3e4c6a8fef5d96a32051a556..b6895ecaba0ccd14a033c055ae28d20b
|
||||
boolean flag = this.pathfindDirectlyTowards(Bee.this.hivePos);
|
||||
|
||||
if (!flag) {
|
||||
@@ -1134,7 +1134,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
@@ -1139,7 +1139,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
} else {
|
||||
Path pathentity = Bee.this.navigation.getPath();
|
||||
|
||||
@@ -1034,10 +1028,10 @@ index 55026e1731e41b4e3e4c6a8fef5d96a32051a556..b6895ecaba0ccd14a033c055ae28d20b
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
||||
index 203691417e208b9e023e5f8c3b76993db2747ba8..e6b3f7d144db77a81798669a3a28f5e53856b507 100644
|
||||
index 5000ebc5f19dee72a86360062b822aecd60beb47..e975db0e5ebeb19cf24786052ea068293d5b2f5b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
||||
@@ -381,6 +381,17 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
|
||||
@@ -388,6 +388,17 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
|
||||
super(frog, world);
|
||||
}
|
||||
|
||||
@@ -1055,7 +1049,7 @@ index 203691417e208b9e023e5f8c3b76993db2747ba8..e6b3f7d144db77a81798669a3a28f5e5
|
||||
@Override
|
||||
public boolean canCutCorner(BlockPathTypes nodeType) {
|
||||
return nodeType != BlockPathTypes.WATER_BORDER && super.canCutCorner(nodeType);
|
||||
@@ -390,6 +401,11 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
|
||||
@@ -397,6 +408,11 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
|
||||
protected PathFinder createPathFinder(int range) {
|
||||
this.nodeEvaluator = new Frog.FrogNodeEvaluator(true);
|
||||
this.nodeEvaluator.setCanPassDoors(true);
|
||||
@@ -1089,10 +1083,10 @@ index 991d728db2a3b64316fc2102cf3aee470327a62e..c99de04d082f7f9b08d25730460385c4
|
||||
|
||||
if (blockposition != null) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Strider.java b/src/main/java/net/minecraft/world/entity/monster/Strider.java
|
||||
index ebf54d6e36fdee2833250816fae14195ac45eb67..367618db763f2f931451db4ead3d599ebd3bf5a2 100644
|
||||
index 61162ecd43dc5e6f7898daecdec49f444e6d869b..eabea65620b5ebcdf9b24d9c3eb57ce9540200a4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Strider.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Strider.java
|
||||
@@ -565,10 +565,26 @@ public class Strider extends Animal implements ItemSteerable, Saddleable {
|
||||
@@ -563,10 +563,26 @@ public class Strider extends Animal implements ItemSteerable, Saddleable {
|
||||
super(entity, world);
|
||||
}
|
||||
|
||||
@@ -1120,10 +1114,10 @@ index ebf54d6e36fdee2833250816fae14195ac45eb67..367618db763f2f931451db4ead3d599e
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
index 97b763431bc5015448ee7a26a340635a932c950b..48109aebe34cbdfac3eceffb1c20aa84aca542fe 100644
|
||||
index b2bc3a832c310448046ccde37a04918aa6d63197..acdddee63fe4363785648b2d4512d93097b8ce65 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
@@ -600,6 +600,16 @@ public class Warden extends Monster implements VibrationSystem {
|
||||
@@ -601,6 +601,16 @@ public class Warden extends Monster implements VibrationSystem {
|
||||
protected PathFinder createPathFinder(int range) {
|
||||
this.nodeEvaluator = new WalkNodeEvaluator();
|
||||
this.nodeEvaluator.setCanPassDoors(true);
|
||||
@@ -1140,11 +1134,35 @@ index 97b763431bc5015448ee7a26a340635a932c950b..48109aebe34cbdfac3eceffb1c20aa84
|
||||
return new PathFinder(this.nodeEvaluator, range) {
|
||||
@Override
|
||||
protected float distance(Node a, Node b) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
||||
index d5fe3b8e2f5a8899f6afeb0600764284a617f261..4f15b9e4b1aba5375a2572ff28cea4e3d96eb82d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
||||
@@ -238,6 +238,7 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
+ if (Thread.currentThread().getName().contains("petal-path-processor")) return Shapes.block(); // Kaiiju - async pathfinding - we cannot get block entities
|
||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||
return blockEntity instanceof ShulkerBoxBlockEntity ? Shapes.create(((ShulkerBoxBlockEntity)blockEntity).getBoundingBox(state)) : Shapes.block();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java b/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java
|
||||
index e941a4ce35c1bcc84836d04fb97cb1e7f292ae42..26f3c25f2dfda5f7c6213746efa8b883b655d2e1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java
|
||||
@@ -102,6 +102,7 @@ public class MovingPistonBlock extends BaseEntityBlock {
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
+ if (Thread.currentThread().getName().contains("petal-path-processor")) return Shapes.empty(); // Kaiiju - async pathfinding - we cannot get block entities
|
||||
PistonMovingBlockEntity pistonMovingBlockEntity = this.getBlockEntity(world, pos);
|
||||
return pistonMovingBlockEntity != null ? pistonMovingBlockEntity.getCollisionShape(world, pos) : Shapes.empty();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Path.java b/src/main/java/net/minecraft/world/level/pathfinder/Path.java
|
||||
index 2a335f277bd0e4b8ad0f60d8226eb8aaa80a871f..b2c3c459fae7d0cb5ef0fcbc2ff0e61c7b952087 100644
|
||||
index eea4c932d909145e7af848cf76e3f49dbb2deff2..7160459ec8ba81f66a85082a1fe7b06377180afa 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/Path.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/Path.java
|
||||
@@ -30,6 +30,17 @@ public class Path {
|
||||
@@ -27,6 +27,17 @@ public class Path {
|
||||
this.reached = reachesTarget;
|
||||
}
|
||||
|
||||
@@ -1162,7 +1180,7 @@ index 2a335f277bd0e4b8ad0f60d8226eb8aaa80a871f..b2c3c459fae7d0cb5ef0fcbc2ff0e61c
|
||||
public void advance() {
|
||||
++this.nextNodeIndex;
|
||||
}
|
||||
@@ -104,6 +115,7 @@ public class Path {
|
||||
@@ -101,6 +112,7 @@ public class Path {
|
||||
}
|
||||
|
||||
public boolean sameAs(@Nullable Path o) {
|
||||
@@ -1171,10 +1189,10 @@ index 2a335f277bd0e4b8ad0f60d8226eb8aaa80a871f..b2c3c459fae7d0cb5ef0fcbc2ff0e61c
|
||||
return false;
|
||||
} else if (o.nodes.size() != this.nodes.size()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||
index d23481453717f715124156b5d83f6448f720d049..d4cc2a5f99f8445be9a63c279e28032f11a91304 100644
|
||||
index d23481453717f715124156b5d83f6448f720d049..7be397d884ec091e0f51ae48ee2c83b6f0e486ea 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||
@@ -24,37 +24,77 @@ public class PathFinder {
|
||||
@@ -24,37 +24,80 @@ public class PathFinder {
|
||||
public final NodeEvaluator nodeEvaluator;
|
||||
private static final boolean DEBUG = false;
|
||||
private final BinaryHeap openSet = new BinaryHeap();
|
||||
@@ -1207,11 +1225,7 @@ index d23481453717f715124156b5d83f6448f720d049..d4cc2a5f99f8445be9a63c279e28032f
|
||||
+ Node node = nodeEvaluator.getStart();
|
||||
+ // Kaiiju end
|
||||
if (node == null) {
|
||||
+ // Kaiiju start - petal - handle nodeEvaluatorGenerator
|
||||
+ if (this.nodeEvaluatorGenerator != null) {
|
||||
+ dev.kaiijumc.kaiiju.path.NodeEvaluatorCache.returnNodeEvaluator(nodeEvaluator);
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
+ dev.kaiijumc.kaiiju.path.NodeEvaluatorCache.removeNodeEvaluator(nodeEvaluator); // Kaiiju - petal - handle nodeEvaluatorGenerator
|
||||
return null;
|
||||
} else {
|
||||
// Paper start - remove streams - and optimize collection
|
||||
@@ -1227,12 +1241,16 @@ index d23481453717f715124156b5d83f6448f720d049..d4cc2a5f99f8445be9a63c279e28032f
|
||||
+ // Kaiiju start - petal - async path processing
|
||||
+ if (this.nodeEvaluatorGenerator == null) {
|
||||
+ // run sync :(
|
||||
+ return this.findPath(nodeEvaluator, world.getProfiler(), node, map, followRange, distance, rangeMultiplier);
|
||||
+ dev.kaiijumc.kaiiju.path.NodeEvaluatorCache.removeNodeEvaluator(nodeEvaluator);
|
||||
+ return this.findPath(world.getProfiler(), node, map, followRange, distance, rangeMultiplier);
|
||||
+ }
|
||||
+
|
||||
+ return new dev.kaiijumc.kaiiju.path.AsyncPath(Lists.newArrayList(), positions, () -> {
|
||||
+ try {
|
||||
+ return this.processPath(nodeEvaluator, node, map, followRange, distance, rangeMultiplier);
|
||||
+ } catch (Exception e) {
|
||||
+ e.printStackTrace();
|
||||
+ return null;
|
||||
+ } finally {
|
||||
+ nodeEvaluator.done();
|
||||
+ dev.kaiijumc.kaiiju.path.NodeEvaluatorCache.returnNodeEvaluator(nodeEvaluator);
|
||||
@@ -1245,24 +1263,26 @@ index d23481453717f715124156b5d83f6448f720d049..d4cc2a5f99f8445be9a63c279e28032f
|
||||
- @Nullable
|
||||
+ //@Nullable // Kaiiju - Always not null
|
||||
// Paper start - optimize collection
|
||||
- private Path findPath(ProfilerFiller profiler, Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
|
||||
+ private Path findPath(NodeEvaluator nodeEvaluator, ProfilerFiller profiler, Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
|
||||
private Path findPath(ProfilerFiller profiler, Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
|
||||
profiler.push("find_path");
|
||||
profiler.markForCharting(MetricCategory.PATH_FINDING);
|
||||
+ // Kaiiju start - petal - split pathfinding into the original sync method for compat and processing for delaying
|
||||
+ try {
|
||||
+ return this.processPath(this.nodeEvaluator, startNode, positions, followRange, distance, rangeMultiplier);
|
||||
+ } catch (Exception e) {
|
||||
+ e.printStackTrace();
|
||||
+ return null;
|
||||
+ } finally {
|
||||
+ nodeEvaluator.done();
|
||||
+ this.nodeEvaluator.done();
|
||||
+ }
|
||||
+ }
|
||||
+ private synchronized Path processPath(NodeEvaluator nodeEvaluator, Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) { // sync to only use the caching functions in this class on a single thread
|
||||
+ private synchronized @org.jetbrains.annotations.NotNull Path processPath(NodeEvaluator nodeEvaluator, Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) { // sync to only use the caching functions in this class on a single thread
|
||||
+ org.apache.commons.lang3.Validate.isTrue(!positions.isEmpty()); // ensure that we have at least one position, which means we'll always return a path
|
||||
+ // Kaiiju end
|
||||
// Set<Target> set = positions.keySet();
|
||||
startNode.g = 0.0F;
|
||||
startNode.h = this.getBestH(startNode, positions); // Paper - optimize collection
|
||||
@@ -91,7 +131,7 @@ public class PathFinder {
|
||||
@@ -91,7 +134,7 @@ public class PathFinder {
|
||||
}
|
||||
|
||||
if (!(node.distanceTo(startNode) >= followRange)) {
|
||||
@@ -1271,6 +1291,14 @@ index d23481453717f715124156b5d83f6448f720d049..d4cc2a5f99f8445be9a63c279e28032f
|
||||
|
||||
for(int l = 0; l < k; ++l) {
|
||||
Node node2 = this.neighbors[l];
|
||||
@@ -123,6 +166,7 @@ public class PathFinder {
|
||||
if (best == null || comparator.compare(path, best) < 0)
|
||||
best = path;
|
||||
}
|
||||
+ //noinspection ConstantConditions // Kaiiju - petal - ignore this warning, we know that the above loop always runs at least once since positions is not empty
|
||||
return best;
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java
|
||||
index 0e2b14e7dfedf209d63279c81723fd7955122d78..079b278e2e262af433bb5bd0c12b3d8db4fa12fc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java
|
||||
50
patches/server/0041-Global-event-synchronization.patch
Normal file
50
patches/server/0041-Global-event-synchronization.patch
Normal file
@@ -0,0 +1,50 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Xymb <xymb@endcrystal.me>
|
||||
Date: Mon, 28 Aug 2023 16:57:55 +0200
|
||||
Subject: [PATCH] Global event synchronization
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index 15cdfc9bf0e4a12f1f3e9e8c224f7a5bacd9bfc7..e8c4d6529a47ea18ec3ce1a95ae057ee82a20370 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -244,8 +244,10 @@ public class KaiijuConfig {
|
||||
}
|
||||
|
||||
public static boolean disableEnsureTickThreadChecks = false;
|
||||
+ public static boolean globalEventSynchronization = false;
|
||||
|
||||
private static void unsupportedSettings() {
|
||||
disableEnsureTickThreadChecks = getBoolean("unsupported.disable-ensure-tick-thread-checks", disableEnsureTickThreadChecks);
|
||||
+ globalEventSynchronization = getBoolean("unsupported.global-event-synchronization", globalEventSynchronization);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/lock/GlobalPluginSynchronizer.java b/src/main/java/dev/kaiijumc/kaiiju/lock/GlobalPluginSynchronizer.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..406b241c8d4998b9977a43b8c1b628c7a27a927d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/lock/GlobalPluginSynchronizer.java
|
||||
@@ -0,0 +1,5 @@
|
||||
+package dev.kaiijumc.kaiiju.lock;
|
||||
+
|
||||
+public class GlobalPluginSynchronizer {
|
||||
+ public static final Object lock = new Object();
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||
index d0f6d4e6ab3a7a4bd6cb8e27c90c7c7300f204a5..03b8f704de1e9a798391297d3daf3c49bf599a56 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||
@@ -58,6 +58,13 @@ class PaperEventManager {
|
||||
}
|
||||
|
||||
try {
|
||||
+ // Kaiiju start - Global Event Synchronization
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.globalEventSynchronization) {
|
||||
+ synchronized (dev.kaiijumc.kaiiju.lock.GlobalPluginSynchronizer.lock) {
|
||||
+ registration.callEvent(event);
|
||||
+ }
|
||||
+ } else
|
||||
+ // Kaiiju end
|
||||
registration.callEvent(event);
|
||||
} catch (AuthorNagException ex) {
|
||||
Plugin plugin = registration.getPlugin();
|
||||
Reference in New Issue
Block a user