Compare commits
56 Commits
build-164
...
ver/1.20.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2b7aec8f7 | ||
|
|
ad96ea2b9b | ||
|
|
4d0e6c8304 | ||
|
|
3c182ae67e | ||
|
|
95b2d636ab | ||
|
|
52e80e540b | ||
|
|
9cb7ff8b84 | ||
|
|
5897fbdfa6 | ||
|
|
042f11d759 | ||
|
|
1271516e58 | ||
|
|
0648cb49c8 | ||
|
|
35a7588d6d | ||
|
|
dc4931389b | ||
|
|
eb6be9f290 | ||
|
|
6d12ac828a | ||
|
|
baf0a46d91 | ||
|
|
32a11498b4 | ||
|
|
8eb4a79492 | ||
|
|
f8abc46b5e | ||
|
|
1594847f93 | ||
|
|
fd71bdebd5 | ||
|
|
a3c8b4a2b7 | ||
|
|
d514f5744a | ||
|
|
dbd96e6e84 | ||
|
|
6669139413 | ||
|
|
4327944b97 | ||
|
|
b869fc44e0 | ||
|
|
423b2078e8 | ||
|
|
a6cd4d115e | ||
|
|
7e70bc76d9 | ||
|
|
fd509ffe21 | ||
|
|
28de4d3178 | ||
|
|
67b061cda6 | ||
|
|
243f57f124 | ||
|
|
c66ed11b44 | ||
|
|
4edf6f9cd3 | ||
|
|
09e0f58125 | ||
|
|
a95080aaff | ||
|
|
794ce3b533 | ||
|
|
40d552627b | ||
|
|
6b0aab7b0b | ||
|
|
3ca4adc05e | ||
|
|
5df1740ff7 | ||
|
|
5c9fc7f289 | ||
|
|
195dfd4e3a | ||
|
|
755fa2e6a4 | ||
|
|
6392fde2e4 | ||
|
|
589b5f62c3 | ||
|
|
1f0e0e1863 | ||
|
|
449d1e5653 | ||
|
|
349ae3bcce | ||
|
|
8c562b0616 | ||
|
|
6657b9cb08 | ||
|
|
3176184ca6 | ||
|
|
bc3e578199 | ||
|
|
8ead6a39e8 |
36
README.md
36
README.md
@@ -11,28 +11,40 @@
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
### Primary
|
|
||||||
- **Xymb Linear Format**: Saves about 50% of disk space in OW/Nether and 95% in The End.
|
|
||||||
- **Auto update**: Automatic upstream updates.
|
|
||||||
|
|
||||||
### Notable
|
### Notable
|
||||||
- **Entity throttling & removal**: Tweak entity tick frequency & max entity per region.
|
- **Xymb Linear Format**: A Region file format that reduces disk space usage by about 50%.
|
||||||
|
- **Async Pathfinding**: Petal async pathfinding fixed & reworked.
|
||||||
- **Technical Minecraft**: Enable Vanilla exploits such as sand duping, RNG manipulation...
|
- **Technical Minecraft**: Enable Vanilla exploits such as sand duping, RNG manipulation...
|
||||||
|
|
||||||
|
### Other
|
||||||
|
- **Small optimizations**: Increase server efficiency by disabling unnecessary features.
|
||||||
|
- **Commands**: Restore few commands that were previously removed by Folia.
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
region-format:
|
||||||
|
linear:
|
||||||
|
flush-frequency: 10
|
||||||
|
flush-max-threads: 1
|
||||||
network:
|
network:
|
||||||
send-null-entity-packets: true
|
send-null-entity-packets: true
|
||||||
alternate-keepalive: false
|
alternate-keepalive: false
|
||||||
|
kick-player-on-bad-packet: true
|
||||||
optimization:
|
optimization:
|
||||||
disable-vanish-api: false
|
disable-vanish-api: false
|
||||||
disable-player-stats: false
|
disable-player-stats: false
|
||||||
disable-arm-swing-event: false
|
disable-arm-swing-event: false
|
||||||
disable-ensure-tick-thread-check: false
|
async-path-processing:
|
||||||
|
enable: false
|
||||||
|
max-threads: 0
|
||||||
|
keepalive: 60
|
||||||
gameplay:
|
gameplay:
|
||||||
server-mod-name: Kaiiju
|
server-mod-name: Kaiiju
|
||||||
shared-random-for-players: true
|
shared-random-for-players: true
|
||||||
|
unsupported:
|
||||||
|
disable-ensure-tick-thread-checks: false
|
||||||
|
global-event-synchronization: false
|
||||||
world-settings:
|
world-settings:
|
||||||
default:
|
default:
|
||||||
region-format:
|
region-format:
|
||||||
@@ -42,25 +54,29 @@ world-settings:
|
|||||||
crash-on-broken-symlink: true
|
crash-on-broken-symlink: true
|
||||||
optimization:
|
optimization:
|
||||||
shulker-box-drop-contents-when-destroyed: true
|
shulker-box-drop-contents-when-destroyed: true
|
||||||
|
optimize-hoppers: true
|
||||||
|
tick-when-empty: true
|
||||||
enable-entity-throttling: false
|
enable-entity-throttling: false
|
||||||
disable-achievements: false
|
disable-achievements: false
|
||||||
disable-creatures-spawn-events: false
|
disable-creatures-spawn-events: false
|
||||||
disable-dolphin-swim-to-treasure: false
|
disable-dolphin-swim-to-treasure: false
|
||||||
gameplay:
|
gameplay:
|
||||||
fix-void-trading: true
|
fix-void-trading: true
|
||||||
optimize-hoppers: true
|
|
||||||
tick-when-empty: true
|
|
||||||
break-redstone-on-top-of-trap-doors-early: true
|
break-redstone-on-top-of-trap-doors-early: true
|
||||||
fix-tripwire-state-inconsistency: true
|
fix-tripwire-state-inconsistency: true
|
||||||
safe-teleportation: true
|
safe-teleportation: true
|
||||||
sand-duplication: false
|
sand-duplication: false
|
||||||
|
teleport-async-on-high-velocity: false
|
||||||
```
|
```
|
||||||
Documentation: [Kaiiju Wiki](https://github.com/KaiijuMC/Kaiiju/wiki/Configuration)
|
Documentation: [Kaiiju Wiki](https://github.com/KaiijuMC/Kaiiju/wiki/Configuration)
|
||||||
|
|
||||||
### Roadmap
|
### Roadmap
|
||||||
- **Static view distance**: Reduce RAM usage / Region size with a "static" view distance.
|
|
||||||
- **Native world conversion**: Convert region file format at startup.
|
|
||||||
- **Stash deduplication**: Make giant dupe stashes possible and lagless.
|
- **Stash deduplication**: Make giant dupe stashes possible and lagless.
|
||||||
|
- **Multithreaded Tracker**: Rework Petal multithreaded tracker.
|
||||||
|
|
||||||
|
## Open to contributions
|
||||||
|
- **Native world conversion**: Convert region file format at startup.
|
||||||
|
- **Performance patch**: Any significative performance patch.
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ group = dev.kaiijumc.kaiiju
|
|||||||
version = 1.20.1-R0.1-SNAPSHOT
|
version = 1.20.1-R0.1-SNAPSHOT
|
||||||
mcVersion = 1.20.1
|
mcVersion = 1.20.1
|
||||||
|
|
||||||
foliaRef = 7c6e2514d2ecd9f5f7db911aab29bfe7f373eb9e
|
foliaRef = edafbcef6884cffe493e62cd71f4957708fba7ff
|
||||||
|
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
org.gradle.parallel=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
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||||
index 1ef4cf3b19d58565e052829358eb5902f070ae02..490a70920dca1cfde4796cc2fb69fdb98942bbdc 100644
|
index b6a8217b97842cd07af24fadb21e0e44226e5bb9..ce7dcbc0709839457df357484620f21c3d7c19c5 100644
|
||||||
--- a/src/main/java/org/bukkit/Server.java
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
+++ b/src/main/java/org/bukkit/Server.java
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
@@ -2007,6 +2007,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
|
// Paper end
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ This has been benchmarked on a huge gold farm.
|
|||||||
Resulting in significative performance improvements.
|
Resulting in significative performance improvements.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index 511ec694f3336a5d7276d171dd2345ed2ea1acac..10c7f5c6fc0e5cb8aafbe125dd68635a37b7b1b9 100644
|
index f636bdf1075fa784ce7ee25478d4d94bacb05677..2da522f89a7c44208ca1ba9139efe723a519fabc 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
@@ -3663,7 +3663,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -3661,7 +3661,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ());
|
Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ());
|
||||||
|
|
||||||
// Paper - diff on change - used in CraftLivingEntity#hasLineOfSight(Location) and CraftWorld#lineOfSightExists
|
// Paper - diff on change - used in CraftLivingEntity#hasLineOfSight(Location) and CraftWorld#lineOfSightExists
|
||||||
19
patches/removed/0039-Fix-teleportAsync-rotation-API.patch
Normal file
19
patches/removed/0039-Fix-teleportAsync-rotation-API.patch
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: kugge <sofiane.djerbi38@gmail.com>
|
||||||
|
Date: Thu, 22 Jun 2023 20:32:58 +0200
|
||||||
|
Subject: [PATCH] Fix teleportAsync rotation API
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
|
index 76bcfda336e9cfa039d80ea3ccbebbc3d2b13f7f..24617b3994c0f148f1c17928e18aa1e1a784e6f5 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
|
@@ -1329,7 +1329,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||||
|
boolean success = nmsEntity.teleportAsync(
|
||||||
|
((CraftWorld)locationClone.getWorld()).getHandle(),
|
||||||
|
new net.minecraft.world.phys.Vec3(locationClone.getX(), locationClone.getY(), locationClone.getZ()),
|
||||||
|
- null, null, net.minecraft.world.phys.Vec3.ZERO,
|
||||||
|
+ locationClone.getYaw(), locationClone.getPitch(), net.minecraft.world.phys.Vec3.ZERO, // Kaiiju - fix teleportAsync() rotation
|
||||||
|
cause == null ? TeleportCause.UNKNOWN : cause,
|
||||||
|
Entity.TELEPORT_FLAG_LOAD_CHUNK | Entity.TELEPORT_FLAG_UNMOUNT, // preserve behavior with old API: dismount the entity so it can teleport
|
||||||
|
(Entity entityTp) -> {
|
||||||
@@ -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,10 +5,10 @@ Subject: [PATCH] Rebranding
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index 215366d7cc3720805d2dfde0662372ecede8383c..24f16ac70f993b9645ff01473633f542e57b0fc0 100644
|
index 9ee90bc753e65f9dd532f28ec75cc16bf16486c8..4ce50523b1d5f2110fa873f4d3cfc9839ad606c7 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -8,7 +8,7 @@ plugins {
|
@@ -14,7 +14,7 @@ val alsoShade: Configuration by configurations.creating
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// Folia start
|
// Folia start
|
||||||
@@ -17,7 +17,7 @@ index 215366d7cc3720805d2dfde0662372ecede8383c..24f16ac70f993b9645ff01473633f542
|
|||||||
implementation("io.papermc.paper:paper-mojangapi:1.19.3-R0.1-SNAPSHOT") {
|
implementation("io.papermc.paper:paper-mojangapi:1.19.3-R0.1-SNAPSHOT") {
|
||||||
exclude("io.papermc.paper", "paper-api")
|
exclude("io.papermc.paper", "paper-api")
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ tasks.jar {
|
@@ -76,7 +76,7 @@ tasks.jar {
|
||||||
attributes(
|
attributes(
|
||||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||||
"Implementation-Title" to "CraftBukkit",
|
"Implementation-Title" to "CraftBukkit",
|
||||||
@@ -27,7 +27,7 @@ index 215366d7cc3720805d2dfde0662372ecede8383c..24f16ac70f993b9645ff01473633f542
|
|||||||
"Specification-Title" to "Bukkit",
|
"Specification-Title" to "Bukkit",
|
||||||
"Specification-Version" to project.version,
|
"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
|
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
|
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
@@ -593,7 +593,7 @@ public class Metrics {
|
@@ -593,7 +593,7 @@ public class Metrics {
|
||||||
@@ -132,10 +132,10 @@ index abe37c7c3c6f5ab73afd738ec78f06d7e4d2ed96..52fc6bb99f6024273c7438d01314b576
|
|||||||
stringbuilder.append(CrashReport.DATE_TIME_FORMATTER.format(ZonedDateTime.now()));
|
stringbuilder.append(CrashReport.DATE_TIME_FORMATTER.format(ZonedDateTime.now()));
|
||||||
stringbuilder.append("\n");
|
stringbuilder.append("\n");
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index 11ff1bc559316da426070867f045720ebd8c1962..cc1a7c4d38874ec218f7151685ae6cc00295c2e4 100644
|
index 75eb95c330d6ab7ac1e4a69da13695bbd40f894e..a6f1068884669cfedfe8df40506b011b8b411489 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/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
|
@@ -994,7 +994,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
shutdownThread = Thread.currentThread();
|
shutdownThread = Thread.currentThread();
|
||||||
org.spigotmc.WatchdogThread.doStop(); // Paper
|
org.spigotmc.WatchdogThread.doStop(); // Paper
|
||||||
if (false && !isSameThread()) { // Folia - region threading
|
if (false && !isSameThread()) { // Folia - region threading
|
||||||
@@ -144,7 +144,7 @@ index 11ff1bc559316da426070867f045720ebd8c1962..cc1a7c4d38874ec218f7151685ae6cc0
|
|||||||
while (this.getRunningThread().isAlive()) {
|
while (this.getRunningThread().isAlive()) {
|
||||||
this.getRunningThread().stop();
|
this.getRunningThread().stop();
|
||||||
try {
|
try {
|
||||||
@@ -1812,7 +1812,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1811,7 +1811,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
public String getServerModName() {
|
public String getServerModName() {
|
||||||
@@ -154,10 +154,10 @@ index 11ff1bc559316da426070867f045720ebd8c1962..cc1a7c4d38874ec218f7151685ae6cc0
|
|||||||
|
|
||||||
public SystemReport fillSystemReport(SystemReport details) {
|
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
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 20af7484bf570d28cd9723fdbb1ec07657117367..753594551faa1bff4317386c3df927f486900dab 100644
|
index a8bf1f542ab20eb7c40c80b5e42b55982677373d..a96f743e479a05d3240884a3c0e871caec573bbe 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -261,7 +261,7 @@ import javax.annotation.Nullable; // Paper
|
@@ -265,7 +265,7 @@ import javax.annotation.Nullable; // Paper
|
||||||
import javax.annotation.Nonnull; // Paper
|
import javax.annotation.Nonnull; // Paper
|
||||||
|
|
||||||
public final class CraftServer implements Server {
|
public final class CraftServer implements Server {
|
||||||
@@ -167,10 +167,10 @@ index 20af7484bf570d28cd9723fdbb1ec07657117367..753594551faa1bff4317386c3df927f4
|
|||||||
private final String bukkitVersion = Versioning.getBukkitVersion();
|
private final String bukkitVersion = Versioning.getBukkitVersion();
|
||||||
private final Logger logger = Logger.getLogger("Minecraft");
|
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
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
index 564c72d6351721505dbffaf5af732db2dd3210ac..957ae18874710ad0e10f4210fc819fe555437c01 100644
|
index d2ab898c0f3902f5f0f9847232dac244b4095854..7c918d99c8629da0ef4242f0b6a1778a0fd696b6 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
@@ -886,7 +886,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
@@ -920,7 +920,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
return EntityCategory.WATER;
|
return EntityCategory.WATER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ index 0000000000000000000000000000000000000000..6fac162e0ec057af9f3336314d566355
|
|||||||
+}
|
+}
|
||||||
\ No newline at end of file
|
\ 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
|
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 c5dfd99a38a79fd19a2bf85fa297a28e40612b51..99b3db382a164fbe3afddb08f5317d463ceda765 100644
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
+++ b/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
|
@@ -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
|
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
||||||
// Paper end
|
// Paper end
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
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 916df0c8d263f90e04564c5f512fd5ed5eaaa6d5..5ffe01a20e929554b4bde0b6d453472261686f54 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||||
+++ b/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 {
|
@@ -166,6 +166,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||||
@@ -451,10 +451,10 @@ index 8cf4428d8140fd03f0ad8fa1d148a04d8caefda8..fb71843793e699b2ccfaa3b7e4c2bb7d
|
|||||||
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
|
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
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 753594551faa1bff4317386c3df927f486900dab..714db83db78d5bd66d8353bf9b8c4a6b1734fce4 100644
|
index a96f743e479a05d3240884a3c0e871caec573bbe..3167ef56973578bdeeee96d545b81d41629fe994 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -1094,6 +1094,7 @@ public final class CraftServer implements Server {
|
@@ -1098,6 +1098,7 @@ public final class CraftServer implements Server {
|
||||||
|
|
||||||
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||||
@@ -462,7 +462,7 @@ index 753594551faa1bff4317386c3df927f486900dab..714db83db78d5bd66d8353bf9b8c4a6b
|
|||||||
for (ServerLevel world : this.console.getAllLevels()) {
|
for (ServerLevel world : this.console.getAllLevels()) {
|
||||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
// 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))
|
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||||
@@ -1109,6 +1110,7 @@ public final class CraftServer implements Server {
|
@@ -1113,6 +1114,7 @@ public final class CraftServer implements Server {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
world.spigotConfig.init(); // Spigot
|
world.spigotConfig.init(); // Spigot
|
||||||
@@ -470,7 +470,7 @@ index 753594551faa1bff4317386c3df927f486900dab..714db83db78d5bd66d8353bf9b8c4a6b
|
|||||||
}
|
}
|
||||||
|
|
||||||
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||||
@@ -1124,6 +1126,7 @@ public final class CraftServer implements Server {
|
@@ -1128,6 +1130,7 @@ public final class CraftServer implements Server {
|
||||||
this.reloadData();
|
this.reloadData();
|
||||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||||
@@ -478,7 +478,7 @@ index 753594551faa1bff4317386c3df927f486900dab..714db83db78d5bd66d8353bf9b8c4a6b
|
|||||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||||
|
|
||||||
@@ -2893,6 +2896,13 @@ public final class CraftServer implements Server {
|
@@ -2975,6 +2978,13 @@ public final class CraftServer implements Server {
|
||||||
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,7 +493,7 @@ index 753594551faa1bff4317386c3df927f486900dab..714db83db78d5bd66d8353bf9b8c4a6b
|
|||||||
public void restart() {
|
public void restart() {
|
||||||
org.spigotmc.RestartCommand.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
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
index 717e292040ed7779eb4b6c5fa26665d3df9024e7..d8ca697663ace353e88bfabc8997b58230d3d811 100644
|
index 776b7fc26fe96b69be260bbd36efae147d988640..a090c16d53fcb220687a18aa37ca82663f4660c7 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
@@ -173,6 +173,14 @@ public class Main {
|
@@ -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
|
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
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
+++ b/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();
|
return builder.build();
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ public static boolean regionFormatDebug = false;
|
|
||||||
+
|
|
||||||
+ private static void regionFormatSettings() {
|
+ 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
|
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
|
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 a6f1068884669cfedfe8df40506b011b8b411489..7243443d4bf24ad0b32b8a76d9b8701cca8612a7 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/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
|
@@ -892,7 +892,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
// Paper start - rewrite chunk system
|
// Paper start - rewrite chunk system
|
||||||
worldserver.save((ProgressListener) null, flush, worldserver.noSave && !force, close);
|
worldserver.save((ProgressListener) null, flush, worldserver.noSave && !force, close);
|
||||||
if (flush) {
|
if (flush) {
|
||||||
@@ -97,7 +94,7 @@ index cc1a7c4d38874ec218f7151685ae6cc00295c2e4..06233380f7580726753de34c1fb23d63
|
|||||||
}
|
}
|
||||||
// Paper end - rewrite chunk system
|
// Paper end - rewrite chunk system
|
||||||
}
|
}
|
||||||
@@ -917,7 +917,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -916,7 +916,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
//MinecraftServer.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", worldserver2.getChunkSource().chunkMap.getStorageName()); // Paper - move up
|
//MinecraftServer.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", worldserver2.getChunkSource().chunkMap.getStorageName()); // Paper - move up
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ This format saves about 50% of disk space.
|
|||||||
Documentation: https://github.com/xymb-endcrystalme/LinearRegionFileFormatTools
|
Documentation: https://github.com/xymb-endcrystalme/LinearRegionFileFormatTools
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index 6d6b1973783604369c7ff95d552c43edf149a46a..a26cc214dccab8c9422f9a45e2a5eeda374c0ead 100644
|
index 4ce50523b1d5f2110fa873f4d3cfc9839ad606c7..99f31c4f5bf3064e483d5f387778c05742197e49 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -13,6 +13,10 @@ dependencies {
|
@@ -19,6 +19,10 @@ dependencies {
|
||||||
exclude("io.papermc.paper", "paper-api")
|
exclude("io.papermc.paper", "paper-api")
|
||||||
}
|
}
|
||||||
// Folia end
|
// Folia end
|
||||||
@@ -38,6 +38,34 @@ index f2c27e0ac65be4b75c1d86ef6fd45fdb538d96ac..00724993d0448454d14a47652b039b88
|
|||||||
|
|
||||||
public static final class InProgressWrite {
|
public static final class InProgressWrite {
|
||||||
public long writeCounter;
|
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
|
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
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..249303116d3cfadd078ebf0ae6e44bf99eed6a47
|
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
|
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
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4bf89d0727
|
index 0000000000000000000000000000000000000000..e40989889f3821bb7484fc0bae5d94b033013904
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java
|
||||||
@@ -0,0 +1,337 @@
|
@@ -0,0 +1,316 @@
|
||||||
+package dev.kaiijumc.kaiiju.region;
|
+package dev.kaiijumc.kaiiju.region;
|
||||||
+
|
+
|
||||||
+import com.github.luben.zstd.ZstdInputStream;
|
+import com.github.luben.zstd.ZstdInputStream;
|
||||||
@@ -138,65 +166,57 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
|||||||
+import java.util.ArrayList;
|
+import java.util.ArrayList;
|
||||||
+import java.util.Arrays;
|
+import java.util.Arrays;
|
||||||
+import java.util.List;
|
+import java.util.List;
|
||||||
|
+import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
+import java.util.concurrent.locks.ReentrantLock;
|
+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 long SUPERBLOCK = -4323716122432332390L;
|
||||||
+ private static final byte VERSION = 2;
|
+ private static final byte VERSION = 2;
|
||||||
+ private static final int HEADER_SIZE = 32;
|
+ private static final int HEADER_SIZE = 32;
|
||||||
+ private static final int FOOTER_SIZE = 8;
|
+ private static final int FOOTER_SIZE = 8;
|
||||||
+ private static final Logger LOGGER = LogUtils.getLogger();
|
+ private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
+ private static final List<Byte> SUPPORTED_VERSIONS = Arrays.asList((byte) 1, (byte) 2);
|
+ 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 byte[][] buffer = new byte[1024][];
|
||||||
+ private final int[] bufferUncompressedSize = new int[1024];
|
+ private final int[] bufferUncompressedSize = new int[1024];
|
||||||
+
|
+
|
||||||
+ private final int[] chunkTimestamps = 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 ChunkStatus[] statuses = new ChunkStatus[1024];
|
||||||
+
|
+
|
||||||
+ private final LZ4Compressor compressor;
|
+ private final LZ4Compressor compressor;
|
||||||
+ private final LZ4FastDecompressor decompressor;
|
+ private final LZ4FastDecompressor decompressor;
|
||||||
+
|
+
|
||||||
+ private boolean markedToSave = false;
|
|
||||||
+ private boolean close = false;
|
|
||||||
+
|
|
||||||
+ public final ReentrantLock fileLock = new ReentrantLock(true);
|
+ public final ReentrantLock fileLock = new ReentrantLock(true);
|
||||||
+ public Path regionFile;
|
|
||||||
+
|
|
||||||
+ private final int compressionLevel;
|
+ private final int compressionLevel;
|
||||||
+
|
+
|
||||||
+ public Path getRegionFile() {
|
+ private AtomicBoolean markedToSave = new AtomicBoolean(false);
|
||||||
+ return this.regionFile;
|
+ public boolean closed = false;
|
||||||
+ }
|
+ public Path path;
|
||||||
+
|
+
|
||||||
+ public ReentrantLock getFileLock() {
|
|
||||||
+ return this.fileLock;
|
|
||||||
+ }
|
|
||||||
+
|
+
|
||||||
+ public LinearRegionFile(Path file, int compression) throws IOException {
|
+ public LinearRegionFile(Path file, int compression) throws IOException {
|
||||||
+ this.regionFile = file;
|
+ this.path = file;
|
||||||
+ this.compressionLevel = compression;
|
+ this.compressionLevel = compression;
|
||||||
+
|
|
||||||
+ this.compressor = LZ4Factory.fastestInstance().fastCompressor();
|
+ this.compressor = LZ4Factory.fastestInstance().fastCompressor();
|
||||||
+ this.decompressor = LZ4Factory.fastestInstance().fastDecompressor();
|
+ this.decompressor = LZ4Factory.fastestInstance().fastDecompressor();
|
||||||
+
|
+
|
||||||
+ File regionFile = new File(this.regionFile.toString());
|
+ File regionFile = new File(this.path.toString());
|
||||||
+
|
+
|
||||||
+ Arrays.fill(this.bufferUncompressedSize, 0);
|
+ Arrays.fill(this.bufferUncompressedSize, 0);
|
||||||
+
|
+
|
||||||
+ if(regionFile.canRead()) {
|
+ if (!regionFile.canRead()) return;
|
||||||
+ FileInputStream fileStream = new FileInputStream(regionFile);
|
+
|
||||||
+ DataInputStream rawDataStream = new DataInputStream(fileStream);
|
+ try (FileInputStream fileStream = new FileInputStream(regionFile);
|
||||||
|
+ DataInputStream rawDataStream = new DataInputStream(fileStream)) {
|
||||||
+
|
+
|
||||||
+ long superBlock = rawDataStream.readLong();
|
+ long superBlock = rawDataStream.readLong();
|
||||||
+ if (superBlock != SUPERBLOCK)
|
+ if (superBlock != SUPERBLOCK)
|
||||||
+ throw new RuntimeException("Invalid superblock: " + superBlock + " file " + file);
|
+ throw new RuntimeException("Invalid superblock: " + superBlock + " in " + file);
|
||||||
+
|
+
|
||||||
+ byte version = rawDataStream.readByte();
|
+ byte version = rawDataStream.readByte();
|
||||||
+ if (!SUPPORTED_VERSIONS.contains(version))
|
+ 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.
|
+ // Skip newestTimestamp (Long) + Compression level (Byte) + Chunk count (Short): Unused.
|
||||||
+ rawDataStream.skipBytes(11);
|
+ rawDataStream.skipBytes(11);
|
||||||
@@ -204,7 +224,7 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
|||||||
+ int dataCount = rawDataStream.readInt();
|
+ int dataCount = rawDataStream.readInt();
|
||||||
+ long fileLength = file.toFile().length();
|
+ long fileLength = file.toFile().length();
|
||||||
+ if (fileLength != HEADER_SIZE + dataCount + FOOTER_SIZE)
|
+ 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.
|
+ rawDataStream.skipBytes(8); // Skip data hash (Long): Unused.
|
||||||
+
|
+
|
||||||
@@ -213,133 +233,124 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
|||||||
+
|
+
|
||||||
+ superBlock = rawDataStream.readLong();
|
+ superBlock = rawDataStream.readLong();
|
||||||
+ if (superBlock != SUPERBLOCK)
|
+ 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];
|
+ int[] starts = new int[1024];
|
||||||
+ for(int i = 0; i < 1024; i++) {
|
+ for (int i = 0; i < 1024; i++) {
|
||||||
+ starts[i] = dataStream.readInt();
|
+ starts[i] = dataStream.readInt();
|
||||||
+ dataStream.skipBytes(4); // Skip timestamps (Int): Unused.
|
+ dataStream.skipBytes(4); // Skip timestamps (Int): Unused.
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ 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);
|
|
||||||
+
|
|
||||||
+ int maxCompressedLength = this.compressor.maxCompressedLength(size);
|
|
||||||
+ byte[] compressed = new byte[maxCompressedLength];
|
|
||||||
+ int compressedLength = this.compressor.compress(b, 0, size, compressed, 0, maxCompressedLength);
|
|
||||||
+ b = new byte[compressedLength];
|
|
||||||
+ System.arraycopy(compressed, 0, b, 0, compressedLength);
|
|
||||||
+
|
|
||||||
+ this.buffer[i] = b;
|
|
||||||
+ this.bufferUncompressedSize[i] = size;
|
|
||||||
+ }
|
+ }
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ this.start();
|
|
||||||
+ }
|
|
||||||
+
|
+
|
||||||
+ private synchronized void markToSave() {
|
+ for (int i = 0; i < 1024; i++) {
|
||||||
+ synchronized(markedToSaveLock) {
|
+ if (starts[i] > 0) {
|
||||||
+ markedToSave = true;
|
+ int size = starts[i];
|
||||||
+ }
|
+ byte[] b = new byte[size];
|
||||||
+ }
|
+ dataStream.readFully(b, 0, size);
|
||||||
+
|
+
|
||||||
+ private synchronized boolean isMarkedToSave() {
|
+ int maxCompressedLength = this.compressor.maxCompressedLength(size);
|
||||||
+ synchronized(markedToSaveLock) {
|
+ byte[] compressed = new byte[maxCompressedLength];
|
||||||
+ if(markedToSave) {
|
+ int compressedLength = this.compressor.compress(b, 0, size, compressed, 0, maxCompressedLength);
|
||||||
+ markedToSave = false;
|
+ b = new byte[compressedLength];
|
||||||
+ return true;
|
+ System.arraycopy(compressed, 0, b, 0, compressedLength);
|
||||||
+ }
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
+
|
||||||
+ public void run() {
|
+ this.buffer[i] = b;
|
||||||
+ try {
|
+ this.bufferUncompressedSize[i] = size;
|
||||||
+ while(true) {
|
|
||||||
+ if(markedToSave) {
|
|
||||||
+ try {
|
|
||||||
+ flush();
|
|
||||||
+ } catch(IOException ex) {
|
|
||||||
+ LOGGER.error("Region file " + this.regionFile.toAbsolutePath() + " flush failed");
|
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ 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 Path getRegionFile() {
|
||||||
|
+ return this.path;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ 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 {
|
||||||
|
+ save();
|
||||||
|
+ } catch (IOException e) {
|
||||||
|
+ LOGGER.error("Failed to flush region file " + path.toAbsolutePath(), e);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean doesChunkExist(ChunkPos pos) throws Exception {
|
||||||
+ throw new Exception("doesChunkExist is a stub");
|
+ throw new Exception("doesChunkExist is a stub");
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public synchronized void flush() throws IOException {
|
+ private synchronized void save() throws IOException {
|
||||||
+ if(!isMarkedToSave()) return;
|
|
||||||
+
|
|
||||||
+ long timestamp = getTimestamp();
|
+ long timestamp = getTimestamp();
|
||||||
+ short chunkCount = 0;
|
+ short chunkCount = 0;
|
||||||
+
|
+
|
||||||
+ File tempFile = new File(regionFile.toString() + ".tmp");
|
+ File tempFile = new File(path.toString() + ".tmp");
|
||||||
+ FileOutputStream fileStream = new FileOutputStream(tempFile);
|
|
||||||
+
|
+
|
||||||
+ ByteArrayOutputStream zstdByteArray = new ByteArrayOutputStream();
|
+ try (FileOutputStream fileStream = new FileOutputStream(tempFile);
|
||||||
+ ZstdOutputStream zstdStream = new ZstdOutputStream(zstdByteArray, this.compressionLevel);
|
+ ByteArrayOutputStream zstdByteArray = new ByteArrayOutputStream();
|
||||||
+ zstdStream.setChecksum(true);
|
+ ZstdOutputStream zstdStream = new ZstdOutputStream(zstdByteArray, this.compressionLevel);
|
||||||
+ DataOutputStream zstdDataStream = new DataOutputStream(zstdStream);
|
+ DataOutputStream zstdDataStream = new DataOutputStream(zstdStream);
|
||||||
+ DataOutputStream dataStream = new DataOutputStream(fileStream);
|
+ DataOutputStream dataStream = new DataOutputStream(fileStream)) {
|
||||||
+
|
+
|
||||||
+ dataStream.writeLong(SUPERBLOCK);
|
+ dataStream.writeLong(SUPERBLOCK);
|
||||||
+ dataStream.writeByte(VERSION);
|
+ dataStream.writeByte(VERSION);
|
||||||
+ dataStream.writeLong(timestamp);
|
+ dataStream.writeLong(timestamp);
|
||||||
+ dataStream.writeByte(this.compressionLevel);
|
+ dataStream.writeByte(this.compressionLevel);
|
||||||
+
|
+
|
||||||
+ ArrayList<byte[]> byteBuffers = new ArrayList<>();
|
+ ArrayList<byte[]> byteBuffers = new ArrayList<>();
|
||||||
+ for(int i = 0; i < 1024; i++) {
|
+ for (int i = 0; i < 1024; i++) {
|
||||||
+ if(this.bufferUncompressedSize[i] != 0) {
|
+ if (this.bufferUncompressedSize[i] != 0) {
|
||||||
+ chunkCount += 1;
|
+ chunkCount += 1;
|
||||||
+ byte[] content = new byte[bufferUncompressedSize[i]];
|
+ byte[] content = new byte[bufferUncompressedSize[i]];
|
||||||
+ this.decompressor.decompress(buffer[i], 0, content, 0, bufferUncompressedSize[i]);
|
+ this.decompressor.decompress(buffer[i], 0, content, 0, bufferUncompressedSize[i]);
|
||||||
+
|
+
|
||||||
+ byteBuffers.add(content);
|
+ byteBuffers.add(content);
|
||||||
+ } else byteBuffers.add(null);
|
+ } else byteBuffers.add(null);
|
||||||
|
+ }
|
||||||
|
+ 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)
|
||||||
|
+ zstdDataStream.write(byteBuffers.get(i), 0, byteBuffers.get(i).length);
|
||||||
|
+ }
|
||||||
|
+ zstdDataStream.close();
|
||||||
|
+
|
||||||
|
+ dataStream.writeShort(chunkCount);
|
||||||
|
+
|
||||||
|
+ byte[] compressed = zstdByteArray.toByteArray();
|
||||||
|
+
|
||||||
|
+ dataStream.writeInt(compressed.length);
|
||||||
|
+ dataStream.writeLong(0);
|
||||||
|
+
|
||||||
|
+ dataStream.write(compressed, 0, compressed.length);
|
||||||
|
+ dataStream.writeLong(SUPERBLOCK);
|
||||||
|
+
|
||||||
|
+ dataStream.flush();
|
||||||
|
+ fileStream.getFD().sync();
|
||||||
|
+ fileStream.getChannel().force(true); // Ensure atomicity on Btrfs
|
||||||
+ }
|
+ }
|
||||||
+ for(int i = 0; i < 1024; i++) {
|
+ Files.move(tempFile.toPath(), this.path, StandardCopyOption.REPLACE_EXISTING);
|
||||||
+ 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)
|
|
||||||
+ zstdDataStream.write(byteBuffers.get(i), 0, byteBuffers.get(i).length);
|
|
||||||
+ }
|
|
||||||
+ zstdDataStream.close();
|
|
||||||
+
|
|
||||||
+ dataStream.writeShort(chunkCount);
|
|
||||||
+
|
|
||||||
+ byte[] compressed = zstdByteArray.toByteArray();
|
|
||||||
+
|
|
||||||
+ dataStream.writeInt(compressed.length);
|
|
||||||
+ dataStream.writeLong(0);
|
|
||||||
+
|
|
||||||
+ dataStream.write(compressed, 0, compressed.length);
|
|
||||||
+ dataStream.writeLong(SUPERBLOCK);
|
|
||||||
+
|
|
||||||
+ dataStream.flush();
|
|
||||||
+ fileStream.getFD().sync();
|
|
||||||
+ fileStream.getChannel().force(true); // Ensure atomicity on Btrfs
|
|
||||||
+ dataStream.close();
|
|
||||||
+
|
|
||||||
+ fileStream.close();
|
|
||||||
+ Files.move(tempFile.toPath(), this.regionFile, StandardCopyOption.REPLACE_EXISTING);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+
|
||||||
+ public void setStatus(int x, int z, ChunkStatus status) {
|
+ public void setStatus(int x, int z, ChunkStatus status) {
|
||||||
+ this.statuses[getChunkIndex(x, z)] = status;
|
+ this.statuses[getChunkIndex(x, z)] = status;
|
||||||
+ }
|
+ }
|
||||||
@@ -360,7 +371,7 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
|||||||
+ this.chunkTimestamps[index] = getTimestamp();
|
+ this.chunkTimestamps[index] = getTimestamp();
|
||||||
+ this.bufferUncompressedSize[getChunkIndex(pos.x, pos.z)] = uncompressedSize;
|
+ this.bufferUncompressedSize[getChunkIndex(pos.x, pos.z)] = uncompressedSize;
|
||||||
+ } catch (IOException e) {
|
+ } catch (IOException e) {
|
||||||
+ LOGGER.error("Chunk write IOException " + e + " " + this.regionFile);
|
+ LOGGER.error("Chunk write IOException " + e + " " + this.path);
|
||||||
+ }
|
+ }
|
||||||
+ markToSave();
|
+ markToSave();
|
||||||
+ }
|
+ }
|
||||||
@@ -370,7 +381,6 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private class ChunkBuffer extends ByteArrayOutputStream {
|
+ private class ChunkBuffer extends ByteArrayOutputStream {
|
||||||
+
|
|
||||||
+ private final ChunkPos pos;
|
+ private final ChunkPos pos;
|
||||||
+
|
+
|
||||||
+ public ChunkBuffer(ChunkPos chunkcoordintpair) {
|
+ public ChunkBuffer(ChunkPos chunkcoordintpair) {
|
||||||
@@ -423,12 +433,9 @@ index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4b
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void close() throws IOException {
|
+ public void close() throws IOException {
|
||||||
+ close = true;
|
+ if (closed) return;
|
||||||
+ try {
|
+ closed = true;
|
||||||
+ flush();
|
+ flush(); // sync
|
||||||
+ } catch(IOException e) {
|
|
||||||
+ throw new IOException("Region flush IOException " + e + " " + this.regionFile);
|
|
||||||
+ }
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private static int getChunkIndex(int x, int z) {
|
+ 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 void setOversized(int x, int z, boolean something) {}
|
||||||
+
|
+
|
||||||
+ public CompoundTag getOversizedData(int x, int z) throws IOException {
|
+ 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) {
|
+ public boolean isOversized(int x, int z) {
|
||||||
+ return false;
|
+ 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
|
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
|
index 8a11e10b01fa012b2f98b1c193c53251e848f909..61001e76b38f8647b33e73b5cc15b4b6785cf49a 100644
|
||||||
--- a/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java
|
--- a/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java
|
||||||
@@ -540,7 +598,7 @@ index 513833c2ea23df5b079d157bc5cb89d5c9754c0b..abf5e2a06af9853b58ac9107cd6e9787
|
|||||||
long expectedChunks = (long)regionFiles.length * (32L * 32L);
|
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
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
index 916bfdfb13d8f8093e1908a7c35344b83d0ee0ac..61c6bc2859235874aefac71e9e55162f0a89f29f 100644
|
index 6885961c7eaa07b8b25e48ca0e33e310379f6114..cb6b067d2ae8a11d8c75f2c7667145e0b7bd2b65 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
+++ b/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
|
@@ -269,7 +269,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
@@ -561,7 +619,7 @@ index 916bfdfb13d8f8093e1908a7c35344b83d0ee0ac..61c6bc2859235874aefac71e9e55162f
|
|||||||
this.setViewDistance(viewDistance);
|
this.setViewDistance(viewDistance);
|
||||||
// Paper start
|
// Paper start
|
||||||
this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
|
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
|
@@ -848,13 +848,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
|
|
||||||
// Paper start - chunk status cache "api"
|
// Paper start - chunk status cache "api"
|
||||||
public ChunkStatus getChunkStatusOnDiskIfCached(ChunkPos chunkPos) {
|
public ChunkStatus getChunkStatusOnDiskIfCached(ChunkPos chunkPos) {
|
||||||
@@ -577,7 +635,7 @@ index 916bfdfb13d8f8093e1908a7c35344b83d0ee0ac..61c6bc2859235874aefac71e9e55162f
|
|||||||
|
|
||||||
if (regionFile == null || !regionFileCache.chunkExists(chunkPos)) {
|
if (regionFile == null || !regionFileCache.chunkExists(chunkPos)) {
|
||||||
return null;
|
return null;
|
||||||
@@ -874,7 +874,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -872,7 +872,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateChunkStatusOnDisk(ChunkPos chunkPos, @Nullable CompoundTag compound) throws IOException {
|
public void updateChunkStatusOnDisk(ChunkPos chunkPos, @Nullable CompoundTag compound) throws IOException {
|
||||||
@@ -587,21 +645,21 @@ index 916bfdfb13d8f8093e1908a7c35344b83d0ee0ac..61c6bc2859235874aefac71e9e55162f
|
|||||||
regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkSerializer.getStatus(compound));
|
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
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index b126435b07572e7b8f41647a0179164b680e9e64..19fb8ca8a6f699ce596103070db726fcb427865e 100644
|
index cf8f93734121e5c1959959f0ba13ee4e6db31959..e6e985e8e2c7cccb2c3395ae3fbc30072e1d48f0 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -426,8 +426,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -453,8 +453,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
|
|
||||||
private static final class EntityRegionFileStorage extends net.minecraft.world.level.chunk.storage.RegionFileStorage {
|
private static final class EntityRegionFileStorage extends net.minecraft.world.level.chunk.storage.RegionFileStorage {
|
||||||
|
|
||||||
- public EntityRegionFileStorage(Path directory, boolean dsync) {
|
- public EntityRegionFileStorage(Path directory, boolean dsync) {
|
||||||
- super(directory, 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
|
+ super(format, linearCompression, directory, dsync); // Kaiiju
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void write(ChunkPos pos, net.minecraft.nbt.CompoundTag nbt) throws IOException {
|
protected void write(ChunkPos pos, net.minecraft.nbt.CompoundTag nbt) throws IOException {
|
||||||
@@ -666,7 +666,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -693,7 +693,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||||
@@ -611,12 +669,12 @@ index b126435b07572e7b8f41647a0179164b680e9e64..19fb8ca8a6f699ce596103070db726fc
|
|||||||
// this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage, this.entitySliceManager); // Paper // Paper - rewrite chunk system
|
// this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage, this.entitySliceManager); // Paper // Paper - rewrite chunk system
|
||||||
StructureTemplateManager structuretemplatemanager = minecraftserver.getStructureManager();
|
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
|
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
|
--- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||||
+++ b/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 {
|
@@ -61,7 +61,7 @@ public class WorldUpgrader {
|
||||||
private volatile int skipped;
|
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");
|
private volatile Component status = Component.translatable("optimizeWorld.stage.counting");
|
||||||
- public static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.mca$");
|
- 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
|
+ 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) {
|
public WorldUpgrader(LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, Registry<LevelStem> dimensionOptionsRegistry, boolean eraseCache) {
|
||||||
@@ -116,7 +116,12 @@ public class WorldUpgrader {
|
@@ -116,7 +116,12 @@ public class WorldUpgrader {
|
||||||
ResourceKey<LevelStem> resourcekey1 = (ResourceKey) iterator1.next(); // CraftBukkit
|
ResourceKey<Level> resourcekey1 = (ResourceKey) iterator1.next();
|
||||||
Path path = this.levelStorage.getDimensionPath((ResourceKey) null); // CraftBukkit
|
Path path = this.levelStorage.getDimensionPath(resourcekey1);
|
||||||
|
|
||||||
- builder1.put(resourcekey1, new ChunkStorage(path.resolve("region"), this.dataFixer, true));
|
- builder1.put(resourcekey1, new ChunkStorage(path.resolve("region"), this.dataFixer, true));
|
||||||
+ // Kaiiju start
|
+ // Kaiiju start
|
||||||
@@ -636,9 +694,9 @@ index e0bfeebeaac1aaea64bc07cdfdf7790e3e43ca7b..ac35e7eb8cb5f19391a18eb9d6b5ba26
|
|||||||
+ // Kaiiju end
|
+ // Kaiiju end
|
||||||
}
|
}
|
||||||
|
|
||||||
ImmutableMap<ResourceKey<LevelStem>, ChunkStorage> immutablemap1 = builder1.build(); // CraftBukkit
|
ImmutableMap<ResourceKey<Level>, ChunkStorage> immutablemap1 = builder1.build();
|
||||||
@@ -235,7 +240,7 @@ public class WorldUpgrader {
|
@@ -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 file1 = new File(file, "region");
|
||||||
File[] afile = file1.listFiles((file2, s) -> {
|
File[] afile = file1.listFiles((file2, s) -> {
|
||||||
- return s.endsWith(".mca");
|
- return s.endsWith(".mca");
|
||||||
@@ -693,7 +751,7 @@ 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
|
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 0c5ac12b1f395bba8b7fc50baf8e825ba6488f6c..ea4a4b3e91533790eff95c028285fbc5b8fd2cb8 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||||
+++ b/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;
|
@@ -27,7 +27,7 @@ import net.minecraft.nbt.NbtIo;
|
||||||
@@ -754,7 +812,7 @@ index dcfe090c269d4cbcc2eb1b6f85392848bb34656c..d42c320179ae055b8675d1ce6ce1788e
|
|||||||
try (DataInputStream out = new DataInputStream(new java.io.BufferedInputStream(new InflaterInputStream(Files.newInputStream(file))))) {
|
try (DataInputStream out = new DataInputStream(new java.io.BufferedInputStream(new InflaterInputStream(Files.newInputStream(file))))) {
|
||||||
return NbtIo.read((java.io.DataInput) out);
|
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
|
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 81554c321a78258ff78da3801f00d0fb90b9e113..e91e8aef8b63ea9d94e0ecb3e4a62655a8c77ce1 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
+++ b/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 {
|
@@ -22,9 +22,13 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
@@ -836,7 +894,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
|||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
return regionfile;
|
return regionfile;
|
||||||
@@ -126,28 +134,49 @@ public class RegionFileStorage implements AutoCloseable {
|
@@ -126,28 +134,45 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
}
|
}
|
||||||
// Paper end - cache regionfile does not exist state
|
// Paper end - cache regionfile does not exist state
|
||||||
if (this.regionCache.size() >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.regionFileCacheSize) { // Paper - configurable
|
if (this.regionCache.size() >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.regionFileCacheSize) { // Paper - configurable
|
||||||
@@ -874,10 +932,6 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
|||||||
+ // Kaiiju end
|
+ // Kaiiju end
|
||||||
this.createRegionFile(regionPos);
|
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
|
// Paper end - cache regionfile does not exist state
|
||||||
FileUtil.createDirectoriesSafe(this.folder); // Paper - only create directory if not existing only - moved from above
|
FileUtil.createDirectoriesSafe(this.folder); // Paper - only create directory if not existing only - moved from above
|
||||||
@@ -893,7 +947,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
|||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
return regionfile1;
|
return regionfile1;
|
||||||
@@ -175,7 +204,7 @@ public class RegionFileStorage implements AutoCloseable {
|
@@ -175,7 +200,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -902,7 +956,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
|||||||
synchronized (regionfile) {
|
synchronized (regionfile) {
|
||||||
try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) {
|
try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) {
|
||||||
CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z);
|
CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z);
|
||||||
@@ -222,14 +251,14 @@ public class RegionFileStorage implements AutoCloseable {
|
@@ -222,14 +247,14 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
@Nullable
|
@Nullable
|
||||||
public CompoundTag read(ChunkPos pos) throws IOException {
|
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
|
// 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
|
// 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
|
// if we decide to re-read
|
||||||
// Paper end
|
// Paper end
|
||||||
@@ -239,7 +268,7 @@ public class RegionFileStorage implements AutoCloseable {
|
@@ -239,7 +264,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
|
|
||||||
// Paper start
|
// Paper start
|
||||||
if (regionfile.isOversized(pos.x, pos.z)) {
|
if (regionfile.isOversized(pos.x, pos.z)) {
|
||||||
@@ -928,7 +982,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
|||||||
return readOversizedChunk(regionfile, pos);
|
return readOversizedChunk(regionfile, pos);
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
@@ -253,12 +282,12 @@ public class RegionFileStorage implements AutoCloseable {
|
@@ -253,12 +278,12 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
if (this.isChunkData) {
|
if (this.isChunkData) {
|
||||||
ChunkPos chunkPos = ChunkSerializer.getChunkCoordinate(nbttagcompound);
|
ChunkPos chunkPos = ChunkSerializer.getChunkCoordinate(nbttagcompound);
|
||||||
if (!chunkPos.equals(pos)) {
|
if (!chunkPos.equals(pos)) {
|
||||||
@@ -944,7 +998,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -292,13 +321,13 @@ public class RegionFileStorage implements AutoCloseable {
|
@@ -292,13 +317,13 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
|
|
||||||
return nbttagcompound;
|
return nbttagcompound;
|
||||||
} finally { // Paper start
|
} finally { // Paper start
|
||||||
@@ -960,7 +1014,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
|||||||
if (regionfile == null) {
|
if (regionfile == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -328,7 +357,7 @@ public class RegionFileStorage implements AutoCloseable {
|
@@ -328,7 +353,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException {
|
protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException {
|
||||||
@@ -969,7 +1023,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
|||||||
if (nbt == null && regionfile == null) {
|
if (nbt == null && regionfile == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -378,7 +407,7 @@ public class RegionFileStorage implements AutoCloseable {
|
@@ -378,7 +403,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
} finally { // Paper start
|
} finally { // Paper start
|
||||||
@@ -978,7 +1032,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
|||||||
} // Paper end
|
} // Paper end
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +416,7 @@ public class RegionFileStorage implements AutoCloseable {
|
@@ -387,7 +412,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
ObjectIterator objectiterator = this.regionCache.values().iterator();
|
ObjectIterator objectiterator = this.regionCache.values().iterator();
|
||||||
|
|
||||||
while (objectiterator.hasNext()) {
|
while (objectiterator.hasNext()) {
|
||||||
@@ -987,7 +1041,7 @@ index 81554c321a78258ff78da3801f00d0fb90b9e113..b35a6a7daf768af3bc453fe18deec823
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
regionfile.close();
|
regionfile.close();
|
||||||
@@ -403,7 +432,7 @@ public class RegionFileStorage implements AutoCloseable {
|
@@ -403,7 +428,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
ObjectIterator objectiterator = this.regionCache.values().iterator();
|
ObjectIterator objectiterator = this.regionCache.values().iterator();
|
||||||
|
|
||||||
while (objectiterator.hasNext()) {
|
while (objectiterator.hasNext()) {
|
||||||
@@ -1012,7 +1066,7 @@ index 5561b8499a0503b850974b1dc309edfb80219549..9394d191c56aab78e63fd3f283efedd6
|
|||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
this.fixerUpper = dataFixer;
|
this.fixerUpper = dataFixer;
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
index 23b8dde3cd185b372d4adc97201a422cebbbe804..6012ea6d3fb6e731ff491ef134085013c2c6075c 100644
|
index 2c19648e68c8d25bd295e2a37ce701bb3cf61e29..11ec1c94d432be7215728240f2cc1bfbdd27f836 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
+++ b/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 {
|
@@ -561,7 +561,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||||
|
|||||||
@@ -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
|
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
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
@@ -198,4 +198,7 @@ public class KaiijuConfig {
|
@@ -203,4 +203,7 @@ public class KaiijuConfig {
|
||||||
private static void regionFormatSettings() {
|
else
|
||||||
regionFormatDebug = getBoolean("region-format.debug", regionFormatDebug);
|
linearFlushThreads = Math.max(linearFlushThreads, 1);
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ private static void networkSettings() {
|
+ private static void networkSettings() {
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ Subject: [PATCH] Send null entity packets
|
|||||||
This is from Purpur. Don't 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
|
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
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
@@ -198,7 +198,10 @@ public class KaiijuConfig {
|
@@ -203,7 +203,10 @@ public class KaiijuConfig {
|
||||||
private static void regionFormatSettings() {
|
else
|
||||||
regionFormatDebug = getBoolean("region-format.debug", regionFormatDebug);
|
linearFlushThreads = Math.max(linearFlushThreads, 1);
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ public static boolean sendNullEntityPackets = true;
|
+ public static boolean sendNullEntityPackets = true;
|
||||||
@@ -21,7 +21,7 @@ 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
|
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 81d0b2933040a451441f660f9e46199ae3b111e3..cdbc4be679d7e096c1005eaf84b74c4877479c43 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
+++ b/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 {
|
@@ -201,6 +201,11 @@ public class ServerEntity {
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ Don't kick players because 1 keepalive is lost.
|
|||||||
This patch is from Purpur.
|
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
|
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
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
+++ b/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;
|
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
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 82ffef34b596a98faa245ba401e67add9d9ac7d0..b2ed157a17cada4887e543a23ee65642eb54637e 100644
|
index 678bba9d636a0eb34270a2d26b5b3d0d6d900115..564b2e668d50f05863080288d20bd54077588db9 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/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 long keepAliveTime = Util.getMillis();
|
||||||
private boolean keepAlivePending;
|
private boolean keepAlivePending;
|
||||||
private long keepAliveChallenge;
|
private long keepAliveChallenge;
|
||||||
@@ -33,7 +33,7 @@ index 82ffef34b596a98faa245ba401e67add9d9ac7d0..b2ed157a17cada4887e543a23ee65642
|
|||||||
// CraftBukkit start - multithreaded fields
|
// CraftBukkit start - multithreaded fields
|
||||||
private final AtomicInteger chatSpamTickCount = new AtomicInteger();
|
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
|
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 currentTime = Util.getMillis();
|
||||||
long elapsedTime = currentTime - this.keepAliveTime;
|
long elapsedTime = currentTime - this.keepAliveTime;
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ index 82ffef34b596a98faa245ba401e67add9d9ac7d0..b2ed157a17cada4887e543a23ee65642
|
|||||||
if (this.keepAlivePending) {
|
if (this.keepAlivePending) {
|
||||||
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
|
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
|
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
|
||||||
@@ -3514,6 +3529,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -3610,6 +3625,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
|
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Optimization Configuration
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
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 95b53b50606ea0ad47f407bebbb9e2bd445c0e66..8aab072a21b0775338b8235a84f5f675f385cf37 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
@@ -206,4 +206,7 @@ public class KaiijuConfig {
|
@@ -211,4 +211,7 @@ public class KaiijuConfig {
|
||||||
sendNullEntityPackets = getBoolean("network.send-null-entity-packets", sendNullEntityPackets);
|
sendNullEntityPackets = getBoolean("network.send-null-entity-packets", sendNullEntityPackets);
|
||||||
alternateKeepAlive = getBoolean("network.alternate-keepalive", alternateKeepAlive);
|
alternateKeepAlive = getBoolean("network.alternate-keepalive", alternateKeepAlive);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
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 8aab072a21b0775338b8235a84f5f675f385cf37..46ae5b84ee5b87b0ed0b93e920689e44288a50d2 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
@@ -209,4 +209,7 @@ public class KaiijuConfig {
|
@@ -214,4 +214,7 @@ public class KaiijuConfig {
|
||||||
|
|
||||||
private static void optimizationSettings() {
|
private static void optimizationSettings() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
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 46ae5b84ee5b87b0ed0b93e920689e44288a50d2..778de435ca3c13ccc2f2d86030e3529436a2d945 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
@@ -210,6 +210,9 @@ public class KaiijuConfig {
|
@@ -215,6 +215,9 @@ public class KaiijuConfig {
|
||||||
private static void optimizationSettings() {
|
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
|
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 7243443d4bf24ad0b32b8a76d9b8701cca8612a7..3a358d159532faaf29af0118ecbfc255d9610969 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/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
|
@@ -1811,7 +1811,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
public String getServerModName() {
|
public String getServerModName() {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ index abf5e2a06af9853b58ac9107cd6e9787c4185c66..389c68c0becd2f69dc1004d0b383f1a8
|
|||||||
long expectedChunks = (long)regionFiles.length * (32L * 32L);
|
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
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
index 61c6bc2859235874aefac71e9e55162f0a89f29f..24bd63c596c9f61f1e89ec5b001b7cb7a29a09ff 100644
|
index c4d28d887b4cc71dc713b1e3f46bc80f4484a95d..f50507ab85282d261985ce9b186581f5a7a50f79 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
+++ b/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
|
@@ -269,7 +269,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
@@ -64,21 +64,21 @@ index 61c6bc2859235874aefac71e9e55162f0a89f29f..24bd63c596c9f61f1e89ec5b001b7cb7
|
|||||||
// Paper start
|
// Paper start
|
||||||
this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
|
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
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 4774d3f357d62b0818b4713f8085d05be09eaa5c..1bbd8b475cdc57fb15ca05ffe122220a5539da10 100644
|
index e6e985e8e2c7cccb2c3395ae3fbc30072e1d48f0..ad896c8a3060f5c8d85a8b5707317de646bf9cae 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -426,8 +426,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -453,8 +453,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
|
|
||||||
private static final class EntityRegionFileStorage extends net.minecraft.world.level.chunk.storage.RegionFileStorage {
|
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
|
- super(format, linearCompression, directory, dsync); // Kaiiju
|
||||||
+ public EntityRegionFileStorage(dev.kaiijumc.kaiiju.region.RegionFileFormat format, int linearCompression, boolean linearCrashOnBrokenSymlink, Path directory, boolean 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
|
+ super(format, linearCompression, linearCrashOnBrokenSymlink, directory, dsync); // Kaiiju
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void write(ChunkPos pos, net.minecraft.nbt.CompoundTag nbt) throws IOException {
|
protected void write(ChunkPos pos, net.minecraft.nbt.CompoundTag nbt) throws IOException {
|
||||||
@@ -666,7 +666,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -693,7 +693,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||||
@@ -135,7 +135,7 @@ 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
|
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 e91e8aef8b63ea9d94e0ecb3e4a62655a8c77ce1..bbc6a0c70cbafbfa411ab418e4fec11ad101ae91 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
+++ b/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;
|
@@ -20,6 +20,7 @@ import net.minecraft.world.level.ChunkPos;
|
||||||
@@ -209,7 +209,7 @@ index b35a6a7daf768af3bc453fe18deec823f4b63a3a..8409293b3f329715d6dff3d455c6a484
|
|||||||
+ guardAgainstBrokenSymlinks(path1); // Kaiiju - Crash on broken symlink
|
+ guardAgainstBrokenSymlinks(path1); // Kaiiju - Crash on broken symlink
|
||||||
this.createRegionFile(regionPos);
|
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
|
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 9394d191c56aab78e63fd3f283efedd69384e323..dcfe4a285cc5865be3b0c1b8104b722895135dd0 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
||||||
|
|||||||
@@ -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
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 1bbd8b475cdc57fb15ca05ffe122220a5539da10..7f39e36037d55278d15399196459e51b885c5d1e 100644
|
index ad896c8a3060f5c8d85a8b5707317de646bf9cae..0df4672abb5e87587da8712b6febf6312e241cda 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -2838,7 +2838,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -2865,7 +2865,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
// Spigot Start
|
// Spigot Start
|
||||||
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
|
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
|
||||||
// Paper start
|
// Paper start
|
||||||
|
|||||||
@@ -6,25 +6,26 @@ Subject: [PATCH] Toggle optimize hoppers
|
|||||||
Paper optimize hoppers patch break a lot of technical redstone farms because of piston updates. (Example: twiti888 wood farm)
|
Paper optimize hoppers patch break a lot of technical redstone farms because of piston updates. (Example: twiti888 wood farm)
|
||||||
|
|
||||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
index 95ed6cb7b94797187d1011cab344e187b39d9193..72bcf8e35593bb54079b6cbd9238acdcd43c3e46 100644
|
index 95ed6cb7b94797187d1011cab344e187b39d9193..6d7356cc07da58b1cef8d8963e790251d765de2c 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
@@ -153,8 +153,10 @@ public class KaiijuWorldConfig {
|
@@ -147,9 +147,11 @@ public class KaiijuWorldConfig {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean shulkerBoxDropContentsWhenDestroyed = true;
|
||||||
|
+ public boolean optimizeHoppers = true;
|
||||||
|
|
||||||
|
private void optimizationSettings() {
|
||||||
|
shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||||
|
+ optimizeHoppers = getBoolean("optimization.optimize-hoppers", optimizeHoppers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean fixVoidTrading = true;
|
public boolean fixVoidTrading = true;
|
||||||
+ public boolean optimizeHoppers = true;
|
|
||||||
|
|
||||||
private void gameplaySettings() {
|
|
||||||
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
|
||||||
+ optimizeHoppers = getBoolean("gameplay.optimize-hoppers", optimizeHoppers);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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
|
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 81d8de7c80bac16d874faf990cb08f1556a46adc..0735ee186b4e81231201ef6f8ddb02995b64259d 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
+++ b/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)) {
|
if (HopperBlockEntity.isFullContainer(iinventory1, enumdirection)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@@ -113,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) {
|
if (iinventory != null) {
|
||||||
Direction enumdirection = Direction.DOWN;
|
Direction enumdirection = Direction.DOWN;
|
||||||
|
|
||||||
@@ -125,8 +126,8 @@ index 4825a74ce4893dafdb70ae1badf3d2e1930d01a1..762b763f271c3208b4f8a7e346897207
|
|||||||
+ // Kaiiju end
|
+ // Kaiiju end
|
||||||
// Paper start - optimize hoppers and remove streams
|
// Paper start - optimize hoppers and remove streams
|
||||||
worldData.skipPullModeEventFire = worldData.skipHopperEvents; // Folia - region threading
|
worldData.skipPullModeEventFire = worldData.skipHopperEvents; // Folia - region threading
|
||||||
return !HopperBlockEntity.isEmptyContainer(iinventory, enumdirection) && anyMatch(iinventory, enumdirection, (item, i) -> {
|
// merge container isEmpty check and move logic into one loop
|
||||||
@@ -499,48 +507,50 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@@ -571,48 +579,50 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
private static boolean a(Hopper ihopper, Container iinventory, int i, Direction enumdirection, Level world) { // Spigot
|
private static boolean a(Hopper ihopper, Container iinventory, int i, Direction enumdirection, Level world) { // Spigot
|
||||||
ItemStack itemstack = iinventory.getItem(i);
|
ItemStack itemstack = iinventory.getItem(i);
|
||||||
|
|
||||||
|
|||||||
@@ -5,26 +5,27 @@ Subject: [PATCH] Toggle tick level when empty
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
index 72bcf8e35593bb54079b6cbd9238acdcd43c3e46..9802039d34eb1717b712c9041fd9f602fccae236 100644
|
index 6d7356cc07da58b1cef8d8963e790251d765de2c..601b9867d839f4928ba993ee8f00df9c330a0fe3 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
@@ -154,9 +154,11 @@ public class KaiijuWorldConfig {
|
@@ -148,10 +148,12 @@ public class KaiijuWorldConfig {
|
||||||
|
|
||||||
public boolean fixVoidTrading = true;
|
public boolean shulkerBoxDropContentsWhenDestroyed = true;
|
||||||
public boolean optimizeHoppers = true;
|
public boolean optimizeHoppers = true;
|
||||||
+ public boolean tickWhenEmpty = true;
|
+ public boolean tickWhenEmpty = true;
|
||||||
|
|
||||||
private void gameplaySettings() {
|
private void optimizationSettings() {
|
||||||
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||||
optimizeHoppers = getBoolean("gameplay.optimize-hoppers", optimizeHoppers);
|
optimizeHoppers = getBoolean("optimization.optimize-hoppers", optimizeHoppers);
|
||||||
+ tickWhenEmpty = getBoolean("gameplay.tick-when-empty", tickWhenEmpty);
|
+ tickWhenEmpty = getBoolean("optimization.tick-when-empty", tickWhenEmpty);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
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
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 7f39e36037d55278d15399196459e51b885c5d1e..66509fa23bfcde70abd3917eb774cf48d5d6da93 100644
|
index 0df4672abb5e87587da8712b6febf6312e241cda..1818c5ae88c331fb900470436f72049165c9e9f4 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -798,7 +798,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -825,7 +825,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
timings.doSounds.stopTiming(); // Spigot
|
timings.doSounds.stopTiming(); // Spigot
|
||||||
regionizedWorldData.setHandlingTick(false); // Folia - regionised ticking
|
regionizedWorldData.setHandlingTick(false); // Folia - regionised ticking
|
||||||
gameprofilerfiller.pop();
|
gameprofilerfiller.pop();
|
||||||
|
|||||||
@@ -6,19 +6,17 @@ Subject: [PATCH] Toggle break redstone on top of trap doors early
|
|||||||
That patch break vanilla mechanics such as portal slicing.
|
That patch break vanilla mechanics such as portal slicing.
|
||||||
|
|
||||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
index 9802039d34eb1717b712c9041fd9f602fccae236..3355935bbf8059d8a539dcefb84e3c0785314ce2 100644
|
index 601b9867d839f4928ba993ee8f00df9c330a0fe3..e7ee85b09aa4438868e068551280b13e84cdfdb8 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
@@ -155,10 +155,12 @@ public class KaiijuWorldConfig {
|
@@ -157,8 +157,10 @@ public class KaiijuWorldConfig {
|
||||||
|
}
|
||||||
|
|
||||||
public boolean fixVoidTrading = true;
|
public boolean fixVoidTrading = true;
|
||||||
public boolean optimizeHoppers = true;
|
|
||||||
public boolean tickWhenEmpty = true;
|
|
||||||
+ public boolean breakRedstoneOnTopOfTrapDoorsEarly = true;
|
+ public boolean breakRedstoneOnTopOfTrapDoorsEarly = true;
|
||||||
|
|
||||||
private void gameplaySettings() {
|
private void gameplaySettings() {
|
||||||
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
||||||
optimizeHoppers = getBoolean("gameplay.optimize-hoppers", optimizeHoppers);
|
|
||||||
tickWhenEmpty = getBoolean("gameplay.tick-when-empty", tickWhenEmpty);
|
|
||||||
+ breakRedstoneOnTopOfTrapDoorsEarly = getBoolean("gameplay.break-redstone-on-top-of-trap-doors-early", breakRedstoneOnTopOfTrapDoorsEarly);
|
+ breakRedstoneOnTopOfTrapDoorsEarly = getBoolean("gameplay.break-redstone-on-top-of-trap-doors-early", breakRedstoneOnTopOfTrapDoorsEarly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Add SIMD utilities
|
|||||||
Patch from Pufferfish
|
Patch from Pufferfish
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index f213706442537201de0d74ca8a51cc93cb9d5220..1615346024037f2abe0fcfcfc5ea7713505bebca 100644
|
index 99f31c4f5bf3064e483d5f387778c05742197e49..d73a4d547ad7768513773535d8cf15619c8079b0 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -60,6 +60,12 @@ dependencies {
|
@@ -68,6 +68,12 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
val craftbukkitPackageVersion = "1_20_R1" // Paper
|
val craftbukkitPackageVersion = "1_20_R1" // Paper
|
||||||
@@ -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
|
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 778de435ca3c13ccc2f2d86030e3529436a2d945..cac747a46cccf8b115917a72340e9b81e7a437c9 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
@@ -211,8 +211,10 @@ public class KaiijuConfig {
|
@@ -216,8 +216,10 @@ public class KaiijuConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String serverModName = "Kaiiju";
|
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
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index deaf4b65b6c9f3dbab6578c25fb78ca84507f70b..cdf669fc1065632033fab4154f0113474b984152 100644
|
index fa35d2c1c8de225acd68e08f15976c92f7ab82aa..455f9aeac15123201d2677cdc8ba159d36229e91 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/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 {
|
@@ -567,6 +567,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||||
this.bb = Entity.INITIAL_AABB;
|
this.bb = Entity.INITIAL_AABB;
|
||||||
this.stuckSpeedMultiplier = Vec3.ZERO;
|
this.stuckSpeedMultiplier = Vec3.ZERO;
|
||||||
this.nextStep = 1.0F;
|
this.nextStep = 1.0F;
|
||||||
@@ -5,7 +5,7 @@ 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
|
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 7b664f32868028758d0c6ee1eaa82efcd83661d2..8b325c764df7003f8e6984a85267cd78fc7672ed 100644
|
index c5df121d6194a97b20dc390698991b9c72dba538..9990fccc741a139c57528f70157ae63dbe3fd8e8 100644
|
||||||
--- a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
--- a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||||
+++ b/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 {
|
@@ -485,7 +485,12 @@ public class RegionizedPlayerChunkLoader {
|
||||||
@@ -6,30 +6,28 @@ Subject: [PATCH] Toggle fix TripWire state inconsistency
|
|||||||
This allow string duplication
|
This allow string duplication
|
||||||
|
|
||||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
index 3355935bbf8059d8a539dcefb84e3c0785314ce2..5c87df0fd68e4971201836b6301d526378271af5 100644
|
index e7ee85b09aa4438868e068551280b13e84cdfdb8..8d7821d8b1a3615eaef1073d9dab690559b85f81 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
@@ -156,11 +156,13 @@ public class KaiijuWorldConfig {
|
@@ -158,9 +158,11 @@ public class KaiijuWorldConfig {
|
||||||
public boolean optimizeHoppers = true;
|
|
||||||
public boolean tickWhenEmpty = true;
|
public boolean fixVoidTrading = true;
|
||||||
public boolean breakRedstoneOnTopOfTrapDoorsEarly = true;
|
public boolean breakRedstoneOnTopOfTrapDoorsEarly = true;
|
||||||
+ public boolean fixTripWireStateInconsistency = true;
|
+ public boolean fixTripWireStateInconsistency = true;
|
||||||
|
|
||||||
private void gameplaySettings() {
|
private void gameplaySettings() {
|
||||||
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
||||||
optimizeHoppers = getBoolean("gameplay.optimize-hoppers", optimizeHoppers);
|
|
||||||
tickWhenEmpty = getBoolean("gameplay.tick-when-empty", tickWhenEmpty);
|
|
||||||
breakRedstoneOnTopOfTrapDoorsEarly = getBoolean("gameplay.break-redstone-on-top-of-trap-doors-early", breakRedstoneOnTopOfTrapDoorsEarly);
|
breakRedstoneOnTopOfTrapDoorsEarly = getBoolean("gameplay.break-redstone-on-top-of-trap-doors-early", breakRedstoneOnTopOfTrapDoorsEarly);
|
||||||
+ fixTripWireStateInconsistency = getBoolean("gameplay.fix-tripwire-state-inconsistency", fixTripWireStateInconsistency);
|
+ fixTripWireStateInconsistency = getBoolean("gameplay.fix-tripwire-state-inconsistency", fixTripWireStateInconsistency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
||||||
index 7f60175bf671d282c11e9084670d2bb900968255..baa6d2bb3a4bec920cb8b57cb08d706929985ea9 100644
|
index cb2ff8d94308c637a498d2737f86f6af4c9c1b83..84c407dfd19924d12f1c25addbb613e607445fd9 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
||||||
@@ -74,7 +74,7 @@ public class TripWireBlock extends Block {
|
@@ -78,7 +78,7 @@ public class TripWireBlock extends Block {
|
||||||
@Override
|
|
||||||
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
|
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
|
||||||
|
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent adjacent tripwires from updating
|
||||||
if (!moved && !state.is(newState.getBlock())) {
|
if (!moved && !state.is(newState.getBlock())) {
|
||||||
- this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true), true); // Paper - fix state inconsistency
|
- this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true), true); // Paper - fix state inconsistency
|
||||||
+ this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true), world.kaiijuConfig.fixTripWireStateInconsistency); // Paper - fix state inconsistency // Kaiiju - Toggle this
|
+ this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true), world.kaiijuConfig.fixTripWireStateInconsistency); // Paper - fix state inconsistency // Kaiiju - Toggle this
|
||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Entity ticking throttling & removal to prevent lag.
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index 1615346024037f2abe0fcfcfc5ea7713505bebca..d24f5fdc6a8c34774933a5cd8bfed8571299bd35 100644
|
index d73a4d547ad7768513773535d8cf15619c8079b0..f29c4621b3ab04aec026c9062c979a659d620738 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -17,6 +17,7 @@ dependencies {
|
@@ -23,6 +23,7 @@ dependencies {
|
||||||
implementation("com.github.luben:zstd-jni:1.5.4-1")
|
implementation("com.github.luben:zstd-jni:1.5.4-1")
|
||||||
implementation("org.lz4:lz4-java:1.8.0")
|
implementation("org.lz4:lz4-java:1.8.0")
|
||||||
// Kaiiju end
|
// Kaiiju end
|
||||||
@@ -252,17 +252,19 @@ index 0000000000000000000000000000000000000000..eb690efacf083e4ff3e321578b12c534
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
index 5c87df0fd68e4971201836b6301d526378271af5..ecae04b0cc317b154b29ca80a7246dc19e5d67ba 100644
|
index 8d7821d8b1a3615eaef1073d9dab690559b85f81..816db23fa64aab69e3034484c00645ebd0479978 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
@@ -147,9 +147,11 @@ public class KaiijuWorldConfig {
|
@@ -149,11 +149,13 @@ public class KaiijuWorldConfig {
|
||||||
}
|
|
||||||
|
|
||||||
public boolean shulkerBoxDropContentsWhenDestroyed = true;
|
public boolean shulkerBoxDropContentsWhenDestroyed = true;
|
||||||
|
public boolean optimizeHoppers = true;
|
||||||
|
public boolean tickWhenEmpty = true;
|
||||||
+ public boolean enableEntityThrottling = false;
|
+ public boolean enableEntityThrottling = false;
|
||||||
|
|
||||||
private void optimizationSettings() {
|
private void optimizationSettings() {
|
||||||
shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||||
|
optimizeHoppers = getBoolean("optimization.optimize-hoppers", optimizeHoppers);
|
||||||
|
tickWhenEmpty = getBoolean("optimization.tick-when-empty", tickWhenEmpty);
|
||||||
+ enableEntityThrottling = getBoolean("optimization.enable-entity-throttling", enableEntityThrottling);
|
+ enableEntityThrottling = getBoolean("optimization.enable-entity-throttling", enableEntityThrottling);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,10 +319,10 @@ index 991e4c19763a34a6fead88363e007c2d11aad836..24a2d3f496727790f63cb66a2534d442
|
|||||||
dev.kaiijumc.kaiiju.KaiijuConfig.registerCommands();
|
dev.kaiijumc.kaiiju.KaiijuConfig.registerCommands();
|
||||||
// Kaiiju end
|
// Kaiiju end
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 66509fa23bfcde70abd3917eb774cf48d5d6da93..8fd9e3cee5a671ef8425311371cde57449ef1d8e 100644
|
index 1818c5ae88c331fb900470436f72049165c9e9f4..7115a481bc8805333aa36af334132f98da9d8742 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -822,6 +822,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -849,6 +849,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
} // Folia end - region threading
|
} // Folia end - region threading
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,21 +330,21 @@ index 66509fa23bfcde70abd3917eb774cf48d5d6da93..8fd9e3cee5a671ef8425311371cde574
|
|||||||
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
||||||
timings.entityTick.startTiming(); // Spigot
|
timings.entityTick.startTiming(); // Spigot
|
||||||
regionizedWorldData.forEachTickingEntity((entity) -> { // Folia - regionised ticking
|
regionizedWorldData.forEachTickingEntity((entity) -> { // Folia - regionised ticking
|
||||||
@@ -844,6 +845,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -871,6 +872,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
entity.stopRiding();
|
entity.stopRiding();
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Kaiiju start
|
+ // Kaiiju start
|
||||||
+ if (kaiijuConfig.enableEntityThrottling) {
|
+ if (kaiijuConfig.enableEntityThrottling) {
|
||||||
+ dev.kaiijumc.kaiiju.KaiijuEntityThrottler.EntityThrottlerReturn throttle = regionizedWorldData.entityThrottler.tickLimiterShouldSkip(entity);
|
+ dev.kaiijumc.kaiiju.KaiijuEntityThrottler.EntityThrottlerReturn throttle = regionizedWorldData.entityThrottler.tickLimiterShouldSkip(entity);
|
||||||
+ if (throttle.remove) entity.remove(Entity.RemovalReason.DISCARDED);
|
+ if (throttle.remove && !entity.hasCustomName()) entity.remove(Entity.RemovalReason.DISCARDED);
|
||||||
+ if (throttle.skip) return;
|
+ if (throttle.skip) return;
|
||||||
+ }
|
+ }
|
||||||
+ // Kaiiju end
|
+ // Kaiiju end
|
||||||
gameprofilerfiller.push("tick");
|
gameprofilerfiller.push("tick");
|
||||||
this.guardEntityTick(this::tickNonPassenger, entity);
|
this.guardEntityTick(this::tickNonPassenger, entity);
|
||||||
gameprofilerfiller.pop();
|
gameprofilerfiller.pop();
|
||||||
@@ -851,6 +859,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -878,6 +886,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -351,7 +353,7 @@ index 66509fa23bfcde70abd3917eb774cf48d5d6da93..8fd9e3cee5a671ef8425311371cde574
|
|||||||
timings.tickEntities.stopTiming(); // Spigot
|
timings.tickEntities.stopTiming(); // Spigot
|
||||||
gameprofilerfiller.pop();
|
gameprofilerfiller.pop();
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
index d8ca697663ace353e88bfabc8997b58230d3d811..c3bb81238afeafa3d59147f21c60022052142977 100644
|
index a090c16d53fcb220687a18aa37ca82663f4660c7..adad8d0cfec6c1b2be2c11ce847f64a92d39e1ec 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
@@ -179,6 +179,11 @@ public class Main {
|
@@ -179,6 +179,11 @@ public class Main {
|
||||||
@@ -5,29 +5,27 @@ Subject: [PATCH] Toggle safe teleportation
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
index ecae04b0cc317b154b29ca80a7246dc19e5d67ba..68074cc41c1e4cd06f2562d44947b63722d5af50 100644
|
index 816db23fa64aab69e3034484c00645ebd0479978..7c6c74f95c2534624a928ccf6b0a4b9d2a5486ad 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
@@ -159,6 +159,7 @@ public class KaiijuWorldConfig {
|
@@ -161,10 +161,12 @@ public class KaiijuWorldConfig {
|
||||||
public boolean tickWhenEmpty = true;
|
public boolean fixVoidTrading = true;
|
||||||
public boolean breakRedstoneOnTopOfTrapDoorsEarly = true;
|
public boolean breakRedstoneOnTopOfTrapDoorsEarly = true;
|
||||||
public boolean fixTripWireStateInconsistency = true;
|
public boolean fixTripWireStateInconsistency = true;
|
||||||
+ public boolean safeTeleporting = true;
|
+ public boolean safeTeleporting = true;
|
||||||
|
|
||||||
private void gameplaySettings() {
|
private void gameplaySettings() {
|
||||||
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
||||||
@@ -166,5 +167,6 @@ public class KaiijuWorldConfig {
|
|
||||||
tickWhenEmpty = getBoolean("gameplay.tick-when-empty", tickWhenEmpty);
|
|
||||||
breakRedstoneOnTopOfTrapDoorsEarly = getBoolean("gameplay.break-redstone-on-top-of-trap-doors-early", breakRedstoneOnTopOfTrapDoorsEarly);
|
breakRedstoneOnTopOfTrapDoorsEarly = getBoolean("gameplay.break-redstone-on-top-of-trap-doors-early", breakRedstoneOnTopOfTrapDoorsEarly);
|
||||||
fixTripWireStateInconsistency = getBoolean("gameplay.fix-tripwire-state-inconsistency", fixTripWireStateInconsistency);
|
fixTripWireStateInconsistency = getBoolean("gameplay.fix-tripwire-state-inconsistency", fixTripWireStateInconsistency);
|
||||||
+ safeTeleporting = getBoolean("gameplay.safe-teleportation", safeTeleporting);
|
+ safeTeleporting = getBoolean("gameplay.safe-teleportation", safeTeleporting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index cdf669fc1065632033fab4154f0113474b984152..6941b28b7b5a7ab0e9c950cfa3a5ed224438a65c 100644
|
index 455f9aeac15123201d2677cdc8ba159d36229e91..4f8abe7cc8a687e7b55108a9b78b12a1f3deecd3 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -3953,6 +3953,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
@@ -3944,6 +3944,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||||
|
|
||||||
protected boolean tryEndPortal() {
|
protected boolean tryEndPortal() {
|
||||||
io.papermc.paper.util.TickThread.ensureTickThread(this, "Cannot portal entity async");
|
io.papermc.paper.util.TickThread.ensureTickThread(this, "Cannot portal entity async");
|
||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Toggle sand duplication
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
index 68074cc41c1e4cd06f2562d44947b63722d5af50..be32a516c1ee0f95790b8a96c465045ca4355c76 100644
|
index 7c6c74f95c2534624a928ccf6b0a4b9d2a5486ad..9f0095f2196133a8bcffd5306aa9ac0b99b2f8d7 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
@@ -160,6 +160,7 @@ public class KaiijuWorldConfig {
|
@@ -162,11 +162,13 @@ public class KaiijuWorldConfig {
|
||||||
public boolean breakRedstoneOnTopOfTrapDoorsEarly = true;
|
public boolean breakRedstoneOnTopOfTrapDoorsEarly = true;
|
||||||
public boolean fixTripWireStateInconsistency = true;
|
public boolean fixTripWireStateInconsistency = true;
|
||||||
public boolean safeTeleporting = true;
|
public boolean safeTeleporting = true;
|
||||||
@@ -16,7 +16,6 @@ index 68074cc41c1e4cd06f2562d44947b63722d5af50..be32a516c1ee0f95790b8a96c465045c
|
|||||||
|
|
||||||
private void gameplaySettings() {
|
private void gameplaySettings() {
|
||||||
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
||||||
@@ -168,5 +169,6 @@ public class KaiijuWorldConfig {
|
|
||||||
breakRedstoneOnTopOfTrapDoorsEarly = getBoolean("gameplay.break-redstone-on-top-of-trap-doors-early", breakRedstoneOnTopOfTrapDoorsEarly);
|
breakRedstoneOnTopOfTrapDoorsEarly = getBoolean("gameplay.break-redstone-on-top-of-trap-doors-early", breakRedstoneOnTopOfTrapDoorsEarly);
|
||||||
fixTripWireStateInconsistency = getBoolean("gameplay.fix-tripwire-state-inconsistency", fixTripWireStateInconsistency);
|
fixTripWireStateInconsistency = getBoolean("gameplay.fix-tripwire-state-inconsistency", fixTripWireStateInconsistency);
|
||||||
safeTeleporting = getBoolean("gameplay.safe-teleportation", safeTeleporting);
|
safeTeleporting = getBoolean("gameplay.safe-teleportation", safeTeleporting);
|
||||||
@@ -24,10 +23,10 @@ index 68074cc41c1e4cd06f2562d44947b63722d5af50..be32a516c1ee0f95790b8a96c465045c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
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 6e35afb9e5314de69e78d819913418ab144bec52..6cff3410c2851aeb808994a4bf830a0db32a9a37 100644
|
index 34b3541603b8cca16c7d62f3981d7ce3e8be0dbe..87d08f4d5bdec0ef96c0e4a91a2f595d2b0f0026 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||||
@@ -131,7 +131,7 @@ public class FallingBlockEntity extends Entity {
|
@@ -133,7 +133,7 @@ public class FallingBlockEntity extends Entity {
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
// Paper start - fix sand duping
|
// Paper start - fix sand duping
|
||||||
@@ -36,7 +35,7 @@ index 6e35afb9e5314de69e78d819913418ab144bec52..6cff3410c2851aeb808994a4bf830a0d
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Paper end - fix sand duping
|
// Paper end - fix sand duping
|
||||||
@@ -148,7 +148,7 @@ public class FallingBlockEntity extends Entity {
|
@@ -150,7 +150,7 @@ public class FallingBlockEntity extends Entity {
|
||||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||||
|
|
||||||
// Paper start - fix sand duping
|
// Paper start - fix sand duping
|
||||||
50
patches/server/0024-Vanilla-end-portal-teleportation.patch
Normal file
50
patches/server/0024-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 4f8abe7cc8a687e7b55108a9b78b12a1f3deecd3..7c57675adc33d7c5525cdf8ebfd696a0e756c9a7 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
@@ -4030,12 +4030,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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
@@ -4222,6 +4227,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(
|
||||||
|
@@ -4280,7 +4289,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
|
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 cadb91c7f5ef80aac8513f246fdf481947fa0a17..c1a2d67cb62af94c8bb4dff97f4fcb47542562dd 100644
|
||||||
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
|
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||||
+++ b/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 {
|
@@ -168,13 +168,19 @@ public final class MCUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int fastFloor(double x) {
|
public static int fastFloor(double x) {
|
||||||
@@ -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 6941b28b7b5a7ab0e9c950cfa3a5ed224438a65c..7dcba5ed8ad3cda9951c6193273261754e8ef63b 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
@@ -4041,10 +4041,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,10 +5,10 @@ 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
|
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 571c18117d7f85eddff31d535c09b46e0e9e4341..afaaa7fc06b4c0c1a355fdd3280003cfed40429e 100644
|
||||||
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||||
+++ b/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 {
|
@@ -463,14 +463,14 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||||
public class Chunks extends Post {
|
public class Chunks extends Post {
|
||||||
@Override
|
@Override
|
||||||
public void postProcess() {
|
public void postProcess() {
|
||||||
@@ -5,10 +5,10 @@ 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
|
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 cac747a46cccf8b115917a72340e9b81e7a437c9..a3c15f1009dad095b9411242e2d0347a6141984b 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
@@ -207,7 +207,10 @@ public class KaiijuConfig {
|
@@ -212,7 +212,10 @@ public class KaiijuConfig {
|
||||||
alternateKeepAlive = getBoolean("network.alternate-keepalive", alternateKeepAlive);
|
alternateKeepAlive = getBoolean("network.alternate-keepalive", alternateKeepAlive);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,17 +20,17 @@ index c934341c17caf4696065ac6c39bdfef570c62f13..f49510c999ce5241f26dc9ba90a6148b
|
|||||||
|
|
||||||
public static String serverModName = "Kaiiju";
|
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
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
index 24bd63c596c9f61f1e89ec5b001b7cb7a29a09ff..3fc2b4a91d2b9727972d6b43b6d2c04b1df3c698 100644
|
index 2b9ec3e7ddb5f5d18553bf82717405552f441f45..96ee7b65f292ac86ffa8c5d371e283eba9bd1133 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
+++ b/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
|
@@ -1362,7 +1362,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player);
|
// Folia end - region threading
|
||||||
|
|
||||||
// CraftBukkit start - respect vanish API
|
// 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
|
+ // Kaiiju start - don't respect vanish API >:D
|
||||||
+ boolean canSee = true;
|
+ 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
|
+ if (!io.papermc.paper.util.TickThread.isTickThreadFor(player) || !canSee) { // Folia - region threading
|
||||||
+ // Kaiiju end
|
+ // Kaiiju end
|
||||||
flag = false;
|
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
|
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 a3c15f1009dad095b9411242e2d0347a6141984b..8c872b2ad341f0105275209201fda03706535161 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
@@ -208,9 +208,11 @@ public class KaiijuConfig {
|
@@ -213,9 +213,11 @@ public class KaiijuConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean disableVanishApi = false;
|
public static boolean disableVanishApi = false;
|
||||||
@@ -21,10 +21,10 @@ index f49510c999ce5241f26dc9ba90a6148bf31467c7..b23f2df433d7ebc871f4009081c28ed9
|
|||||||
|
|
||||||
public static String serverModName = "Kaiiju";
|
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
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
index d58e8211fc765c61548ac2a180de87dd2934ba37..19642e7bf00dc9fdc157e70b4d6849a9898a2557 100644
|
index 7cb6a0b99c8e51f7f767b704071473c5d8bded7d..e0e7e0a2f60aff5bc8c625988860036722707da8 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
@@ -2081,6 +2081,7 @@ public class ServerPlayer extends Player {
|
@@ -2143,6 +2143,7 @@ public class ServerPlayer extends Player {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void awardStat(Stat<?> stat, int amount) {
|
public void awardStat(Stat<?> stat, int amount) {
|
||||||
@@ -5,27 +5,29 @@ Subject: [PATCH] Option to disable achievements
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
index be32a516c1ee0f95790b8a96c465045ca4355c76..27a0f1d81161adb86339f4b829c3628c1022271b 100644
|
index 9f0095f2196133a8bcffd5306aa9ac0b99b2f8d7..31d66bb2fcf4bb7262df2d8006e307fee92660ea 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
@@ -148,10 +148,12 @@ public class KaiijuWorldConfig {
|
@@ -150,12 +150,14 @@ public class KaiijuWorldConfig {
|
||||||
|
public boolean optimizeHoppers = true;
|
||||||
public boolean shulkerBoxDropContentsWhenDestroyed = true;
|
public boolean tickWhenEmpty = true;
|
||||||
public boolean enableEntityThrottling = false;
|
public boolean enableEntityThrottling = false;
|
||||||
+ public boolean disableAchievements = false;
|
+ public boolean disableAchievements = false;
|
||||||
|
|
||||||
private void optimizationSettings() {
|
private void optimizationSettings() {
|
||||||
shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||||
|
optimizeHoppers = getBoolean("optimization.optimize-hoppers", optimizeHoppers);
|
||||||
|
tickWhenEmpty = getBoolean("optimization.tick-when-empty", tickWhenEmpty);
|
||||||
enableEntityThrottling = getBoolean("optimization.enable-entity-throttling", enableEntityThrottling);
|
enableEntityThrottling = getBoolean("optimization.enable-entity-throttling", enableEntityThrottling);
|
||||||
+ disableAchievements = getBoolean("optimization.disable-achievements", disableAchievements);
|
+ disableAchievements = getBoolean("optimization.disable-achievements", disableAchievements);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean fixVoidTrading = true;
|
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
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
index 19642e7bf00dc9fdc157e70b4d6849a9898a2557..5e81fd3b1f88f33314f7b24b3e9ba2be21addd0c 100644
|
index e0e7e0a2f60aff5bc8c625988860036722707da8..6f1878a8a0c904322286079f500592a268a269e9 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
@@ -734,7 +734,7 @@ public class ServerPlayer extends Player {
|
@@ -792,7 +792,7 @@ public class ServerPlayer extends Player {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onInsideBlock(BlockState state) {
|
protected void onInsideBlock(BlockState state) {
|
||||||
@@ -34,7 +36,7 @@ index 19642e7bf00dc9fdc157e70b4d6849a9898a2557..5e81fd3b1f88f33314f7b24b3e9ba2be
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -781,9 +781,9 @@ public class ServerPlayer extends Player {
|
@@ -839,9 +839,9 @@ public class ServerPlayer extends Player {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ index 19642e7bf00dc9fdc157e70b4d6849a9898a2557..5e81fd3b1f88f33314f7b24b3e9ba2be
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.trackStartFallingPosition();
|
this.trackStartFallingPosition();
|
||||||
@@ -858,7 +858,7 @@ public class ServerPlayer extends Player {
|
@@ -916,7 +916,7 @@ public class ServerPlayer extends Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.tickCount % 20 == 0) {
|
if (this.tickCount % 20 == 0) {
|
||||||
@@ -55,7 +57,7 @@ index 19642e7bf00dc9fdc157e70b4d6849a9898a2557..5e81fd3b1f88f33314f7b24b3e9ba2be
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start - initialize oldLevel, fire PlayerLevelChangeEvent, and tick client-sided world border
|
// CraftBukkit start - initialize oldLevel, fire PlayerLevelChangeEvent, and tick client-sided world border
|
||||||
@@ -887,7 +887,7 @@ public class ServerPlayer extends Player {
|
@@ -945,7 +945,7 @@ public class ServerPlayer extends Player {
|
||||||
@Override
|
@Override
|
||||||
public void resetFallDistance() {
|
public void resetFallDistance() {
|
||||||
if (this.getHealth() > 0.0F && this.startingToFallPosition != null) {
|
if (this.getHealth() > 0.0F && this.startingToFallPosition != null) {
|
||||||
@@ -64,7 +66,7 @@ index 19642e7bf00dc9fdc157e70b4d6849a9898a2557..5e81fd3b1f88f33314f7b24b3e9ba2be
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.startingToFallPosition = null;
|
this.startingToFallPosition = null;
|
||||||
@@ -906,7 +906,7 @@ public class ServerPlayer extends Player {
|
@@ -964,7 +964,7 @@ public class ServerPlayer extends Player {
|
||||||
if (this.enteredLavaOnVehiclePosition == null) {
|
if (this.enteredLavaOnVehiclePosition == null) {
|
||||||
this.enteredLavaOnVehiclePosition = this.position();
|
this.enteredLavaOnVehiclePosition = this.position();
|
||||||
} else {
|
} else {
|
||||||
@@ -73,7 +75,7 @@ index 19642e7bf00dc9fdc157e70b4d6849a9898a2557..5e81fd3b1f88f33314f7b24b3e9ba2be
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1110,7 +1110,7 @@ public class ServerPlayer extends Player {
|
@@ -1168,7 +1168,7 @@ public class ServerPlayer extends Player {
|
||||||
|
|
||||||
this.handleTeamKill(s, s1, ObjectiveCriteria.TEAM_KILL);
|
this.handleTeamKill(s, s1, ObjectiveCriteria.TEAM_KILL);
|
||||||
this.handleTeamKill(s1, s, ObjectiveCriteria.KILLED_BY_TEAM);
|
this.handleTeamKill(s1, s, ObjectiveCriteria.KILLED_BY_TEAM);
|
||||||
@@ -82,7 +84,7 @@ index 19642e7bf00dc9fdc157e70b4d6849a9898a2557..5e81fd3b1f88f33314f7b24b3e9ba2be
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1228,7 +1228,7 @@ public class ServerPlayer extends Player {
|
@@ -1286,7 +1286,7 @@ public class ServerPlayer extends Player {
|
||||||
this.wonGame = false;
|
this.wonGame = false;
|
||||||
|
|
||||||
this.respawn((player) -> {
|
this.respawn((player) -> {
|
||||||
@@ -91,7 +93,7 @@ index 19642e7bf00dc9fdc157e70b4d6849a9898a2557..5e81fd3b1f88f33314f7b24b3e9ba2be
|
|||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1730,14 +1730,14 @@ public class ServerPlayer extends Player {
|
@@ -1787,14 +1787,14 @@ public class ServerPlayer extends Player {
|
||||||
maindimensionkey1 = resourcekey1;
|
maindimensionkey1 = resourcekey1;
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
@@ -109,7 +111,7 @@ index 19642e7bf00dc9fdc157e70b4d6849a9898a2557..5e81fd3b1f88f33314f7b24b3e9ba2be
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (maindimensionkey1 != Level.NETHER) { // CraftBukkit
|
if (maindimensionkey1 != Level.NETHER) { // CraftBukkit
|
||||||
@@ -1815,7 +1815,7 @@ public class ServerPlayer extends Player {
|
@@ -1872,7 +1872,7 @@ public class ServerPlayer extends Player {
|
||||||
{
|
{
|
||||||
Either<Player.BedSleepingProblem, Unit> either = super.startSleepInBed(blockposition, force).ifRight((unit) -> {
|
Either<Player.BedSleepingProblem, Unit> either = super.startSleepInBed(blockposition, force).ifRight((unit) -> {
|
||||||
this.awardStat(Stats.SLEEP_IN_BED);
|
this.awardStat(Stats.SLEEP_IN_BED);
|
||||||
@@ -118,7 +120,7 @@ index 19642e7bf00dc9fdc157e70b4d6849a9898a2557..5e81fd3b1f88f33314f7b24b3e9ba2be
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!this.serverLevel().canSleepThroughNights()) {
|
if (!this.serverLevel().canSleepThroughNights()) {
|
||||||
@@ -2101,7 +2101,7 @@ public class ServerPlayer extends Player {
|
@@ -2163,7 +2163,7 @@ public class ServerPlayer extends Player {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void triggerRecipeCrafted(Recipe<?> recipe, List<ItemStack> ingredients) {
|
public void triggerRecipeCrafted(Recipe<?> recipe, List<ItemStack> ingredients) {
|
||||||
@@ -127,7 +129,7 @@ index 19642e7bf00dc9fdc157e70b4d6849a9898a2557..5e81fd3b1f88f33314f7b24b3e9ba2be
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2230,14 +2230,14 @@ public class ServerPlayer extends Player {
|
@@ -2292,14 +2292,14 @@ public class ServerPlayer extends Player {
|
||||||
this.levitationStartPos = this.position();
|
this.levitationStartPos = this.position();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +146,7 @@ index 19642e7bf00dc9fdc157e70b4d6849a9898a2557..5e81fd3b1f88f33314f7b24b3e9ba2be
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2248,7 +2248,7 @@ public class ServerPlayer extends Player {
|
@@ -2310,7 +2310,7 @@ public class ServerPlayer extends Player {
|
||||||
this.levitationStartPos = null;
|
this.levitationStartPos = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +155,7 @@ index 19642e7bf00dc9fdc157e70b4d6849a9898a2557..5e81fd3b1f88f33314f7b24b3e9ba2be
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2808,7 +2808,7 @@ public class ServerPlayer extends Player {
|
@@ -2870,7 +2870,7 @@ public class ServerPlayer extends Player {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateUsingItem(ItemStack stack) {
|
protected void updateUsingItem(ItemStack stack) {
|
||||||
@@ -162,7 +164,7 @@ index 19642e7bf00dc9fdc157e70b4d6849a9898a2557..5e81fd3b1f88f33314f7b24b3e9ba2be
|
|||||||
super.updateUsingItem(stack);
|
super.updateUsingItem(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2837,7 +2837,7 @@ public class ServerPlayer extends Player {
|
@@ -2899,7 +2899,7 @@ public class ServerPlayer extends Player {
|
||||||
Entity entity = item.getOwner();
|
Entity entity = item.getOwner();
|
||||||
|
|
||||||
if (entity != null) {
|
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
|
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 8c872b2ad341f0105275209201fda03706535161..9b118a6e22264c88c0460016822b1920631fff85 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
@@ -209,10 +209,12 @@ public class KaiijuConfig {
|
@@ -214,10 +214,12 @@ public class KaiijuConfig {
|
||||||
|
|
||||||
public static boolean disableVanishApi = false;
|
public static boolean disableVanishApi = false;
|
||||||
public static boolean disablePlayerStats = false;
|
public static boolean disablePlayerStats = false;
|
||||||
@@ -22,10 +22,10 @@ index b23f2df433d7ebc871f4009081c28ed9054d91c7..ec71f3f52cb8f7931aabd94619d2e7a2
|
|||||||
|
|
||||||
public static String serverModName = "Kaiiju";
|
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
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index b2ed157a17cada4887e543a23ee65642eb54637e..a238a3f62a92748d1dfb11fcf8938d33409b7a0c 100644
|
index 564b2e668d50f05863080288d20bd54077588db9..78ac2b47335961b15a8dd8851d17b79c249bc275 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -2647,6 +2647,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -2705,6 +2705,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||||
if (this.player.isImmobile()) return; // CraftBukkit
|
if (this.player.isImmobile()) return; // CraftBukkit
|
||||||
this.player.resetLastActionTime();
|
this.player.resetLastActionTime();
|
||||||
@@ -33,7 +33,7 @@ index b2ed157a17cada4887e543a23ee65642eb54637e..a238a3f62a92748d1dfb11fcf8938d33
|
|||||||
// CraftBukkit start - Raytrace to look for 'rogue armswings'
|
// CraftBukkit start - Raytrace to look for 'rogue armswings'
|
||||||
float f1 = this.player.getXRot();
|
float f1 = this.player.getXRot();
|
||||||
float f2 = this.player.getYRot();
|
float f2 = this.player.getYRot();
|
||||||
@@ -2669,6 +2670,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -2737,6 +2738,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@@ -5,17 +5,19 @@ Subject: [PATCH] Option to disable creatures spawn events
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
index 27a0f1d81161adb86339f4b829c3628c1022271b..58b0725fea8d2216242a949b9ed2b3d9e93ef1f3 100644
|
index 31d66bb2fcf4bb7262df2d8006e307fee92660ea..c9830912019079369268bfbf2c95de18ad598f52 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
@@ -149,11 +149,13 @@ public class KaiijuWorldConfig {
|
@@ -151,6 +151,7 @@ public class KaiijuWorldConfig {
|
||||||
public boolean shulkerBoxDropContentsWhenDestroyed = true;
|
public boolean tickWhenEmpty = true;
|
||||||
public boolean enableEntityThrottling = false;
|
public boolean enableEntityThrottling = false;
|
||||||
public boolean disableAchievements = false;
|
public boolean disableAchievements = false;
|
||||||
+ public boolean disableCreaturesSpawnEvents = false;
|
+ public boolean disableCreaturesSpawnEvents = false;
|
||||||
|
|
||||||
private void optimizationSettings() {
|
private void optimizationSettings() {
|
||||||
shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||||
|
@@ -158,6 +159,7 @@ public class KaiijuWorldConfig {
|
||||||
|
tickWhenEmpty = getBoolean("optimization.tick-when-empty", tickWhenEmpty);
|
||||||
enableEntityThrottling = getBoolean("optimization.enable-entity-throttling", enableEntityThrottling);
|
enableEntityThrottling = getBoolean("optimization.enable-entity-throttling", enableEntityThrottling);
|
||||||
disableAchievements = getBoolean("optimization.disable-achievements", disableAchievements);
|
disableAchievements = getBoolean("optimization.disable-achievements", disableAchievements);
|
||||||
+ disableCreaturesSpawnEvents = getBoolean("optimization.disable-creatures-spawn-events", disableCreaturesSpawnEvents);
|
+ disableCreaturesSpawnEvents = getBoolean("optimization.disable-creatures-spawn-events", disableCreaturesSpawnEvents);
|
||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Option to disable dolphin swim to treasure
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
index 58b0725fea8d2216242a949b9ed2b3d9e93ef1f3..87887a6d266767fd46f4d65d89dfb9d853089db4 100644
|
index c9830912019079369268bfbf2c95de18ad598f52..e2fb7d7a7b3126d386b46442c115085d1974ac4e 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
@@ -150,12 +150,14 @@ public class KaiijuWorldConfig {
|
@@ -152,6 +152,7 @@ public class KaiijuWorldConfig {
|
||||||
public boolean enableEntityThrottling = false;
|
public boolean enableEntityThrottling = false;
|
||||||
public boolean disableAchievements = false;
|
public boolean disableAchievements = false;
|
||||||
public boolean disableCreaturesSpawnEvents = false;
|
public boolean disableCreaturesSpawnEvents = false;
|
||||||
@@ -16,6 +16,7 @@ index 58b0725fea8d2216242a949b9ed2b3d9e93ef1f3..87887a6d266767fd46f4d65d89dfb9d8
|
|||||||
|
|
||||||
private void optimizationSettings() {
|
private void optimizationSettings() {
|
||||||
shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||||
|
@@ -160,6 +161,7 @@ public class KaiijuWorldConfig {
|
||||||
enableEntityThrottling = getBoolean("optimization.enable-entity-throttling", enableEntityThrottling);
|
enableEntityThrottling = getBoolean("optimization.enable-entity-throttling", enableEntityThrottling);
|
||||||
disableAchievements = getBoolean("optimization.disable-achievements", disableAchievements);
|
disableAchievements = getBoolean("optimization.disable-achievements", disableAchievements);
|
||||||
disableCreaturesSpawnEvents = getBoolean("optimization.disable-creatures-spawn-events", disableCreaturesSpawnEvents);
|
disableCreaturesSpawnEvents = getBoolean("optimization.disable-creatures-spawn-events", disableCreaturesSpawnEvents);
|
||||||
@@ -24,10 +25,10 @@ index 58b0725fea8d2216242a949b9ed2b3d9e93ef1f3..87887a6d266767fd46f4d65d89dfb9d8
|
|||||||
|
|
||||||
public boolean fixVoidTrading = true;
|
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
|
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 501e6cb4aa83f81c1f657e41f4e7f11d19d46831..8240b8e27d5f5e941049f269718670db0510f497 100644
|
index 8448c5d778998390cf2b683f36e4e18ca7ffdc34..8438ae5194bba7cad22af5e350c5a288529cbcdb 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||||
@@ -160,7 +160,7 @@ public class Dolphin extends WaterAnimal {
|
@@ -164,7 +164,7 @@ public class Dolphin extends WaterAnimal {
|
||||||
protected void registerGoals() {
|
protected void registerGoals() {
|
||||||
this.goalSelector.addGoal(0, new BreathAirGoal(this));
|
this.goalSelector.addGoal(0, new BreathAirGoal(this));
|
||||||
this.goalSelector.addGoal(0, new TryFindWaterGoal(this));
|
this.goalSelector.addGoal(0, new TryFindWaterGoal(this));
|
||||||
18
patches/server/0036-Unsupported-configuration.patch
Normal file
18
patches/server/0036-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 9b118a6e22264c88c0460016822b1920631fff85..8232ff317f44c698cac94656e4a910d75b73f402 100644
|
||||||
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
|
@@ -229,4 +229,7 @@ public class KaiijuConfig {
|
||||||
|
serverModName = getString("gameplay.server-mod-name", serverModName);
|
||||||
|
sharedRandomForPlayers = getBoolean("gameplay.shared-random-for-players", sharedRandomForPlayers);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ private static void unsupportedSettings() {
|
||||||
|
+ }
|
||||||
|
}
|
||||||
@@ -5,32 +5,28 @@ 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
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
index ec71f3f52cb8f7931aabd94619d2e7a24491d7ad..900d319f4ddb17af2275c1a20824648b41d39aac 100644
|
index 8232ff317f44c698cac94656e4a910d75b73f402..12738605442b9cdd086b2b29ff372d12552993b8 100644
|
||||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
@@ -210,11 +210,13 @@ public class KaiijuConfig {
|
@@ -230,6 +230,9 @@ public class KaiijuConfig {
|
||||||
public static boolean disableVanishApi = false;
|
sharedRandomForPlayers = getBoolean("gameplay.shared-random-for-players", sharedRandomForPlayers);
|
||||||
public static boolean disablePlayerStats = false;
|
|
||||||
public static boolean disableArmSwingEvent = false;
|
|
||||||
+ public static boolean disableEnsureTickThreadCheck = 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);
|
|
||||||
+ disableEnsureTickThreadCheck = getBoolean("optimization.disable-ensure-tick-thread-check", disableEnsureTickThreadCheck);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
diff --git a/src/main/java/io/papermc/paper/util/TickThread.java b/src/main/java/io/papermc/paper/util/TickThread.java
|
||||||
index cb453dd110fc37fae75257a4576512126207763e..6d0c5aa38b6980c80c2021933c4758e2dabed9fd 100644
|
index cb453dd110fc37fae75257a4576512126207763e..492e6a512343001d3d772d2d8b427d2d84e89da5 100644
|
||||||
--- a/src/main/java/io/papermc/paper/util/TickThread.java
|
--- a/src/main/java/io/papermc/paper/util/TickThread.java
|
||||||
+++ b/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 {
|
@@ -46,6 +46,7 @@ public class TickThread extends Thread {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void ensureTickThread(final String reason) {
|
public static void ensureTickThread(final String reason) {
|
||||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadCheck) return; // Kaiiju
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
||||||
if (!isTickThread()) {
|
if (!isTickThread()) {
|
||||||
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||||
throw new IllegalStateException(reason);
|
throw new IllegalStateException(reason);
|
||||||
@@ -38,7 +34,7 @@ index cb453dd110fc37fae75257a4576512126207763e..6d0c5aa38b6980c80c2021933c4758e2
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void ensureTickThread(final ServerLevel world, final BlockPos pos, final String reason) {
|
public static void ensureTickThread(final ServerLevel world, final BlockPos pos, final String reason) {
|
||||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadCheck) return; // Kaiiju
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
||||||
if (!isTickThreadFor(world, pos)) {
|
if (!isTickThreadFor(world, pos)) {
|
||||||
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||||
throw new IllegalStateException(reason);
|
throw new IllegalStateException(reason);
|
||||||
@@ -46,7 +42,7 @@ index cb453dd110fc37fae75257a4576512126207763e..6d0c5aa38b6980c80c2021933c4758e2
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void ensureTickThread(final ServerLevel world, final ChunkPos pos, final String reason) {
|
public static void ensureTickThread(final ServerLevel world, final ChunkPos pos, final String reason) {
|
||||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadCheck) return; // Kaiiju
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
||||||
if (!isTickThreadFor(world, pos)) {
|
if (!isTickThreadFor(world, pos)) {
|
||||||
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||||
throw new IllegalStateException(reason);
|
throw new IllegalStateException(reason);
|
||||||
@@ -54,7 +50,7 @@ index cb453dd110fc37fae75257a4576512126207763e..6d0c5aa38b6980c80c2021933c4758e2
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void ensureTickThread(final ServerLevel world, final int chunkX, final int chunkZ, final String reason) {
|
public static void ensureTickThread(final ServerLevel world, final int chunkX, final int chunkZ, final String reason) {
|
||||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadCheck) return; // Kaiiju
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
||||||
if (!isTickThreadFor(world, chunkX, chunkZ)) {
|
if (!isTickThreadFor(world, chunkX, chunkZ)) {
|
||||||
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||||
throw new IllegalStateException(reason);
|
throw new IllegalStateException(reason);
|
||||||
@@ -62,7 +58,7 @@ index cb453dd110fc37fae75257a4576512126207763e..6d0c5aa38b6980c80c2021933c4758e2
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void ensureTickThread(final Entity entity, final String reason) {
|
public static void ensureTickThread(final Entity entity, final String reason) {
|
||||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadCheck) return; // Kaiiju
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
||||||
if (!isTickThreadFor(entity)) {
|
if (!isTickThreadFor(entity)) {
|
||||||
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||||
throw new IllegalStateException(reason);
|
throw new IllegalStateException(reason);
|
||||||
@@ -70,7 +66,7 @@ index cb453dd110fc37fae75257a4576512126207763e..6d0c5aa38b6980c80c2021933c4758e2
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void ensureTickThread(final ServerLevel world, final AABB aabb, final String reason) {
|
public static void ensureTickThread(final ServerLevel world, final AABB aabb, final String reason) {
|
||||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadCheck) return; // Kaiiju
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
||||||
if (!isTickThreadFor(world, aabb)) {
|
if (!isTickThreadFor(world, aabb)) {
|
||||||
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||||
throw new IllegalStateException(reason);
|
throw new IllegalStateException(reason);
|
||||||
@@ -78,7 +74,7 @@ index cb453dd110fc37fae75257a4576512126207763e..6d0c5aa38b6980c80c2021933c4758e2
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void ensureTickThread(final ServerLevel world, final double blockX, final double blockZ, final String reason) {
|
public static void ensureTickThread(final ServerLevel world, final double blockX, final double blockZ, final String reason) {
|
||||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadCheck) return; // Kaiiju
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
||||||
if (!isTickThreadFor(world, blockX, blockZ)) {
|
if (!isTickThreadFor(world, blockX, blockZ)) {
|
||||||
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||||
throw new IllegalStateException(reason);
|
throw new IllegalStateException(reason);
|
||||||
46
patches/server/0038-Don-t-kick-player-on-bad-packet.patch
Normal file
46
patches/server/0038-Don-t-kick-player-on-bad-packet.patch
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
|
Date: Sun, 2 Jul 2023 19:13:14 +0300
|
||||||
|
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 12738605442b9cdd086b2b29ff372d12552993b8..c0432bb14df86fe070c90deb33aa8c535cfe46f3 100644
|
||||||
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
|
@@ -206,10 +206,12 @@ public class KaiijuConfig {
|
||||||
|
|
||||||
|
public static boolean sendNullEntityPackets = true;
|
||||||
|
public static boolean alternateKeepAlive = false;
|
||||||
|
+ public static boolean kickPlayerOnBadPacket = true;
|
||||||
|
|
||||||
|
private static void networkSettings() {
|
||||||
|
sendNullEntityPackets = getBoolean("network.send-null-entity-packets", sendNullEntityPackets);
|
||||||
|
alternateKeepAlive = getBoolean("network.alternate-keepalive", alternateKeepAlive);
|
||||||
|
+ kickPlayerOnBadPacket = getBoolean("network.kick-player-on-bad-packet", kickPlayerOnBadPacket);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean disableVanishApi = false;
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||||
|
index f6ccb6eab566b44c3460376d46df1f2cf3d7b19d..13e5aeb0c04d27408ffbc6b11582426a7f2eb0f0 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||||
|
@@ -271,12 +271,18 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||||
|
ConnectionProtocol enumprotocol = this.getCurrentProtocol();
|
||||||
|
Packet<?> packet = enumprotocol == ConnectionProtocol.LOGIN ? new ClientboundLoginDisconnectPacket(ichatmutablecomponent) : new ClientboundDisconnectPacket(ichatmutablecomponent);
|
||||||
|
|
||||||
|
+ // Kaiiju start - Don't kick player on bad packet
|
||||||
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.kickPlayerOnBadPacket
|
||||||
|
+ || throwable instanceof io.netty.channel.unix.Errors.NativeIoException) {
|
||||||
|
+ // Kaiiju end
|
||||||
|
this.send((Packet) packet, PacketSendListener.thenRun(() -> {
|
||||||
|
this.disconnect(ichatmutablecomponent);
|
||||||
|
}));
|
||||||
|
this.setReadOnly();
|
||||||
|
+ } // Kaiiju - Don't kick player on bad packet
|
||||||
|
} else {
|
||||||
|
Connection.LOGGER.debug("Double fault", throwable);
|
||||||
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.kickPlayerOnBadPacket) // Kaiiju - Don't kick player on bad packet
|
||||||
|
this.disconnect(ichatmutablecomponent);
|
||||||
|
}
|
||||||
|
}
|
||||||
34
patches/server/0039-Skip-event-if-no-listeners.patch
Normal file
34
patches/server/0039-Skip-event-if-no-listeners.patch
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
|
||||||
|
Date: Sat, 8 Jul 2023 01:31:10 +0300
|
||||||
|
Subject: [PATCH] Skip event if no listeners
|
||||||
|
|
||||||
|
|
||||||
|
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 7ce9ebba8ce304d1f3f21d4f15ee5f3560d7700b..d0f6d4e6ab3a7a4bd6cb8e27c90c7c7300f204a5 100644
|
||||||
|
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||||
|
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||||
|
@@ -36,14 +36,21 @@ class PaperEventManager {
|
||||||
|
|
||||||
|
// SimplePluginManager
|
||||||
|
public void callEvent(@NotNull Event event) {
|
||||||
|
+ // Kaiiju start - Skip event of no listeners
|
||||||
|
+ HandlerList handlers = event.getHandlers();
|
||||||
|
+ RegisteredListener[] listeners = handlers.getRegisteredListeners();
|
||||||
|
+ if (listeners.length == 0) return;
|
||||||
|
+ // Kaiiju end
|
||||||
|
if (event.isAsynchronous() && this.server.isPrimaryThread()) {
|
||||||
|
throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously.");
|
||||||
|
} else if (!event.isAsynchronous() && !this.server.isPrimaryThread() && !this.server.isStopping()) {
|
||||||
|
throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously.");
|
||||||
|
}
|
||||||
|
|
||||||
|
- HandlerList handlers = event.getHandlers();
|
||||||
|
- RegisteredListener[] listeners = handlers.getRegisteredListeners();
|
||||||
|
+ // Kaiiju start - Moved up
|
||||||
|
+ //HandlerList handlers = event.getHandlers();
|
||||||
|
+ //RegisteredListener[] listeners = handlers.getRegisteredListeners();
|
||||||
|
+ // Kaiiju end
|
||||||
|
|
||||||
|
for (RegisteredListener registration : listeners) {
|
||||||
|
if (!registration.getPlugin().isEnabled()) {
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
|
Date: Sat, 8 Jul 2023 03:31:04 +0300
|
||||||
|
Subject: [PATCH] Teleport async if we cannot move entity off-main
|
||||||
|
|
||||||
|
Entities with huge velocity (100k+ velocity anarchy travel exploit) might disappear / crash the server because they travel a region each tick.
|
||||||
|
TODO: Entities with huge velocity still throw stacktraces because they are ticked in "null" regions.
|
||||||
|
|
||||||
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
|
index e2fb7d7a7b3126d386b46442c115085d1974ac4e..44f5540a6a5733cf6f10f6b04fc9611ac4e53685 100644
|
||||||
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
|
@@ -169,6 +169,7 @@ public class KaiijuWorldConfig {
|
||||||
|
public boolean fixTripWireStateInconsistency = true;
|
||||||
|
public boolean safeTeleporting = true;
|
||||||
|
public boolean sandDuplication = false;
|
||||||
|
+ public boolean teleportAsyncOnHighVelocity = false;
|
||||||
|
|
||||||
|
private void gameplaySettings() {
|
||||||
|
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
||||||
|
@@ -176,5 +177,6 @@ public class KaiijuWorldConfig {
|
||||||
|
fixTripWireStateInconsistency = getBoolean("gameplay.fix-tripwire-state-inconsistency", fixTripWireStateInconsistency);
|
||||||
|
safeTeleporting = getBoolean("gameplay.safe-teleportation", safeTeleporting);
|
||||||
|
sandDuplication = getBoolean("gameplay.sand-duplication", sandDuplication);
|
||||||
|
+ teleportAsyncOnHighVelocity = getBoolean("gameplay.teleport-async-on-high-velocity", teleportAsyncOnHighVelocity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
index 7c57675adc33d7c5525cdf8ebfd696a0e756c9a7..69abd1a59a5d2855c6dd264c0e8e483eccba0132 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
@@ -1127,7 +1127,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ try { // Kaiiju - Teleport async if we cannot move entity off-main
|
||||||
|
this.setPos(this.getX() + vec3d1.x, this.getY() + vec3d1.y, this.getZ() + vec3d1.z);
|
||||||
|
+ // Kaiiju start - Teleport async if we cannot move entity off-main
|
||||||
|
+ } catch (IllegalStateException e) {
|
||||||
|
+ if (this.level().kaiijuConfig.teleportAsyncOnHighVelocity)
|
||||||
|
+ this.teleportAsync((ServerLevel) this.level(), this.position().add(vec3d1),
|
||||||
|
+ this.getYRot(), this.getXRot(),
|
||||||
|
+ null, PlayerTeleportEvent.TeleportCause.UNKNOWN,
|
||||||
|
+ Entity.TELEPORT_FLAG_LOAD_CHUNK | Entity.TELEPORT_FLAG_TELEPORT_PASSENGERS,
|
||||||
|
+ null
|
||||||
|
+ );
|
||||||
|
+ else LOGGER.error("High velocity entity caused off-main setPos: ", e);
|
||||||
|
+ }
|
||||||
|
+ // Kaiiju end
|
||||||
|
}
|
||||||
|
|
||||||
|
this.level().getProfiler().pop();
|
||||||
|
@@ -3869,13 +3882,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||||
|
// check for same region
|
||||||
|
if (destination == this.level()) {
|
||||||
|
Vec3 currPos = this.position();
|
||||||
|
- if (
|
||||||
|
- destination.regioniser.getRegionAtUnsynchronised(
|
||||||
|
- io.papermc.paper.util.CoordinateUtils.getChunkX(currPos), io.papermc.paper.util.CoordinateUtils.getChunkZ(currPos)
|
||||||
|
- ) == destination.regioniser.getRegionAtUnsynchronised(
|
||||||
|
- io.papermc.paper.util.CoordinateUtils.getChunkX(pos), io.papermc.paper.util.CoordinateUtils.getChunkZ(pos)
|
||||||
|
- )
|
||||||
|
- ) {
|
||||||
|
+ // Kaiiju start - We shouldn't teleport when regions are null
|
||||||
|
+ io.papermc.paper.threadedregions.ThreadedRegionizer.ThreadedRegion<io.papermc.paper.threadedregions.TickRegions.TickRegionData,
|
||||||
|
+ io.papermc.paper.threadedregions.TickRegions.TickRegionSectionData>
|
||||||
|
+ currRegion = destination.regioniser.getRegionAtUnsynchronised(io.papermc.paper.util.CoordinateUtils.getChunkX(currPos), io.papermc.paper.util.CoordinateUtils.getChunkZ(currPos));
|
||||||
|
+ io.papermc.paper.threadedregions.ThreadedRegionizer.ThreadedRegion<io.papermc.paper.threadedregions.TickRegions.TickRegionData,
|
||||||
|
+ io.papermc.paper.threadedregions.TickRegions.TickRegionSectionData>
|
||||||
|
+ destRegion = destination.regioniser.getRegionAtUnsynchronised(io.papermc.paper.util.CoordinateUtils.getChunkX(pos), io.papermc.paper.util.CoordinateUtils.getChunkZ(pos));
|
||||||
|
+ if (currRegion == destRegion && currRegion != null) {
|
||||||
|
+ // Kaiiju end
|
||||||
|
EntityTreeNode passengerTree = this.detachPassengers();
|
||||||
|
// Note: The client does not accept position updates for controlled entities. So, we must
|
||||||
|
// perform a lot of tracker updates here to make it all work out.
|
||||||
19
patches/server/0041-Add-back-worldborder-command.patch
Normal file
19
patches/server/0041-Add-back-worldborder-command.patch
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
|
Date: Sun, 9 Jul 2023 19:17:40 +0300
|
||||||
|
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
|
||||||
|
--- 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 {
|
||||||
|
TitleCommand.register(this.dispatcher);
|
||||||
|
//TriggerCommand.register(this.dispatcher); // Folia - region threading - TODO later
|
||||||
|
WeatherCommand.register(this.dispatcher);
|
||||||
|
- //WorldBorderCommand.register(this.dispatcher); // Folia - region threading - TODO later
|
||||||
|
+ WorldBorderCommand.register(this.dispatcher); // Folia - region threading - TODO later // Kaiiju
|
||||||
|
if (JvmProfiler.INSTANCE.isAvailable()) {
|
||||||
|
JfrCommand.register(this.dispatcher);
|
||||||
|
}
|
||||||
19
patches/server/0042-Add-back-data-command.patch
Normal file
19
patches/server/0042-Add-back-data-command.patch
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
|
Date: Sun, 9 Jul 2023 19:18:42 +0300
|
||||||
|
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
|
||||||
|
--- 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 {
|
||||||
|
ClearInventoryCommands.register(this.dispatcher, commandRegistryAccess);
|
||||||
|
//CloneCommands.register(this.dispatcher, commandRegistryAccess); // Folia - region threading - TODO
|
||||||
|
DamageCommand.register(this.dispatcher, commandRegistryAccess);
|
||||||
|
- //DataCommands.register(this.dispatcher); // Folia - region threading - TODO
|
||||||
|
+ DataCommands.register(this.dispatcher); // Folia - region threading - TODO // Kaiiju
|
||||||
|
//DataPackCommand.register(this.dispatcher); // Folia - region threading - TODO
|
||||||
|
//DebugCommand.register(this.dispatcher); // Folia - region threading - TODO
|
||||||
|
DefaultGameModeCommands.register(this.dispatcher);
|
||||||
1314
patches/server/0043-Async-path-processing.patch
Normal file
1314
patches/server/0043-Async-path-processing.patch
Normal file
File diff suppressed because it is too large
Load Diff
50
patches/server/0044-Global-event-synchronization.patch
Normal file
50
patches/server/0044-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 7ae19ea532ee0d15774466899d33cb1f130bd9a7..dd6a9ca1c6a2feada31829d0c8ada4e67fdf0cf6 100644
|
||||||
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||||
|
@@ -248,8 +248,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