Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
423f48684a | ||
|
|
c027a2e37f | ||
|
|
3ec9267550 | ||
|
|
57bd665a5e | ||
|
|
5faba7039e | ||
|
|
3d7011f7d7 | ||
|
|
74d3638155 | ||
|
|
2da29dfbc5 | ||
|
|
d422fc645c | ||
|
|
53851e72d4 | ||
|
|
7c618748c6 | ||
|
|
f63cf7c1fa | ||
|
|
ea9ab3f27c |
27
README.md
27
README.md
@@ -12,34 +12,43 @@
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
### Main additions
|
### Primary
|
||||||
- **Xymb Linear Format**: Saves about 50% of disk space in OW/Nether and 95% in The End.
|
- **Xymb Linear Format**: Saves about 50% of disk space in OW/Nether and 95% in The End.
|
||||||
- **Auto update**: Automatic upstream updates.
|
- **Auto update**: Automatic upstream updates.
|
||||||
|
|
||||||
|
### Notable
|
||||||
|
- **Optimize Hopper**: Enable/Disable Paper "Optimize Hopper" patch that break a lot of redstone farms.
|
||||||
|
- **Fix void trading**: Enable/Disable void trading.
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
region-format:
|
verbose: false
|
||||||
debug: false
|
gameplay:
|
||||||
|
server-mod-name: Kaiiju
|
||||||
network:
|
network:
|
||||||
send-null-entity-packets: true
|
send-null-entity-packets: true
|
||||||
alternate-keepalive: false
|
alternate-keepalive: false
|
||||||
gameplay:
|
region-format:
|
||||||
server-mod-name: Kaiiju
|
debug: false
|
||||||
world-settings:
|
world-settings:
|
||||||
default:
|
default:
|
||||||
|
gameplay:
|
||||||
|
shulker-box-drop-contents-when-destroyed: true
|
||||||
|
fix-void-trading: true
|
||||||
|
optimize-hoppers: true
|
||||||
|
tick-when-empty: true
|
||||||
region-format:
|
region-format:
|
||||||
format: LINEAR
|
format: ANVIL
|
||||||
linear:
|
linear:
|
||||||
compression-level: 1
|
compression-level: 1
|
||||||
crash-on-broken-symlink: true
|
crash-on-broken-symlink: true
|
||||||
gameplay:
|
config-version: 1
|
||||||
shulker-box-drop-contents-when-destroyed: true
|
|
||||||
```
|
```
|
||||||
|
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.
|
- **Static view distance**: Reduce RAM usage / Region size with a "static" view distance.
|
||||||
- **Linear timestamps**: Add chunk timestamps to linear region files.
|
|
||||||
- **Native world conversion**: Convert region file format at startup.
|
- **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.
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ group = dev.kaiijumc.kaiiju
|
|||||||
version = 1.19.4-R0.1-SNAPSHOT
|
version = 1.19.4-R0.1-SNAPSHOT
|
||||||
mcVersion = 1.19.4
|
mcVersion = 1.19.4
|
||||||
|
|
||||||
foliaRef = b97116b7b2236ca422150d93de5fd1fc8f08de17
|
foliaRef = 47105ea28e71d337c2683c7b7ae8228e61901cbb
|
||||||
|
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
Date: Fri, 10 Feb 2023 02:58:46 +0200
|
Date: Fri, 10 Feb 2023 02:58:46 +0200
|
||||||
Subject: [PATCH] Kaiiju Rebranding
|
Subject: [PATCH] Rebranding
|
||||||
|
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
@@ -48,7 +48,7 @@ index 58dc84b7b3b04c2d0b00fc5fac5303d3378b3467..a128b1fabd4aadfe26a8375903c0451d
|
|||||||
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
||||||
Map<String, Map<String, Integer>> map = new HashMap<>();
|
Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
index 719b0e318a85d4a1fb8f616deeb31193495b462e..751b2bc79d29cb21c38cf5d35e3711149ec7b011 100644
|
index 2ce29b6ccb9a3b520b8c1edf53aae2e9769ba252..f675fcae235a8c2722d9bba65d5e1292c5b76deb 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
@@ -19,10 +19,11 @@ import java.util.stream.StreamSupport;
|
@@ -19,10 +19,11 @@ import java.util.stream.StreamSupport;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
Date: Fri, 10 Feb 2023 05:53:10 +0200
|
Date: Fri, 10 Feb 2023 05:53:10 +0200
|
||||||
Subject: [PATCH] Kaiiju Configuration
|
Subject: [PATCH] Empty 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
|
||||||
@@ -432,7 +432,7 @@ index 7abd4f38ae59a6019137345af960fd60a3c7adf0..426777730f77664c69bd0a084a9323d7
|
|||||||
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 c7c682cd2d1498e6d6521ddd62acdc1168bfe152..53b9444ff6120628d23ad27fc87d9cd9bdf66648 100644
|
index afb3d0fa48b7fd6d273361c6dc32764b5d35c356..a3b4b49ca8612a61bc2e7a1e2d2e942e7ebe1883 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
|
||||||
@@ -167,6 +167,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
@@ -167,6 +167,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||||
@@ -453,7 +453,7 @@ index c7c682cd2d1498e6d6521ddd62acdc1168bfe152..53b9444ff6120628d23ad27fc87d9cd9
|
|||||||
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 b1680507c05547458e1199412ab97105b67f8973..d1468cb0ae1850719d40524dad9b14fbdb0f79a1 100644
|
index 176f3acec268dad80cc90029edd88e7a0c3e8885..48f946243af24a9d4847f6a7a59449136cf6ee83 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
|
||||||
@@ -1067,6 +1067,7 @@ public final class CraftServer implements Server {
|
@@ -1067,6 +1067,7 @@ public final class CraftServer implements Server {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
Date: Fri, 10 Feb 2023 20:03:58 +0200
|
Date: Fri, 10 Feb 2023 20:03:58 +0200
|
||||||
Subject: [PATCH] Kaiiju RegionFormat Configuration
|
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
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
Date: Fri, 10 Feb 2023 22:21:56 +0200
|
Date: Fri, 10 Feb 2023 22:21:56 +0200
|
||||||
Subject: [PATCH] Kaiiju RegionFormat Linear
|
Subject: [PATCH] Add Linear region format
|
||||||
|
|
||||||
|
Linear is a region file format that uses ZSTD compression instead of
|
||||||
|
ZLIB.
|
||||||
|
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
|
||||||
@@ -109,10 +112,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..245e3b1801c5f92054d9c0d0d8fc2a8fcfd6a1d4
|
index 0000000000000000000000000000000000000000..b7ce89429675bde7f037793305275f4bf89d0727
|
||||||
--- /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,328 @@
|
@@ -0,0 +1,337 @@
|
||||||
+package dev.kaiijumc.kaiiju.region;
|
+package dev.kaiijumc.kaiiju.region;
|
||||||
+
|
+
|
||||||
+import com.github.luben.zstd.ZstdInputStream;
|
+import com.github.luben.zstd.ZstdInputStream;
|
||||||
@@ -134,19 +137,22 @@ index 0000000000000000000000000000000000000000..245e3b1801c5f92054d9c0d0d8fc2a8f
|
|||||||
+import java.nio.file.StandardCopyOption;
|
+import java.nio.file.StandardCopyOption;
|
||||||
+import java.util.ArrayList;
|
+import java.util.ArrayList;
|
||||||
+import java.util.Arrays;
|
+import java.util.Arrays;
|
||||||
|
+import java.util.List;
|
||||||
+import java.util.concurrent.locks.ReentrantLock;
|
+import java.util.concurrent.locks.ReentrantLock;
|
||||||
+
|
+
|
||||||
+public class LinearRegionFile extends Thread implements AbstractRegionFile {
|
+public class LinearRegionFile extends Thread implements AbstractRegionFile {
|
||||||
+ private static long SUPERBLOCK = -4323716122432332390L;
|
+ private static final long SUPERBLOCK = -4323716122432332390L;
|
||||||
+ private static byte VERSION = 1;
|
+ private static final byte VERSION = 2;
|
||||||
+ private static int HEADER_SIZE = 32;
|
+ private static final int HEADER_SIZE = 32;
|
||||||
+ private static 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 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 Object markedToSaveLock = new Object();
|
+ private final Object markedToSaveLock = new Object();
|
||||||
+ private final ChunkStatus[] statuses = new ChunkStatus[1024];
|
+ private final ChunkStatus[] statuses = new ChunkStatus[1024];
|
||||||
+
|
+
|
||||||
@@ -186,11 +192,11 @@ index 0000000000000000000000000000000000000000..245e3b1801c5f92054d9c0d0d8fc2a8f
|
|||||||
+
|
+
|
||||||
+ long superBlock = rawDataStream.readLong();
|
+ long superBlock = rawDataStream.readLong();
|
||||||
+ if (superBlock != SUPERBLOCK)
|
+ if (superBlock != SUPERBLOCK)
|
||||||
+ throw new RuntimeException("Superblock invalid: " + superBlock + " file " + file);
|
+ throw new RuntimeException("Invalid superblock: " + superBlock + " file " + file);
|
||||||
+
|
+
|
||||||
+ byte version = rawDataStream.readByte();
|
+ byte version = rawDataStream.readByte();
|
||||||
+ if (version != VERSION)
|
+ if (!SUPPORTED_VERSIONS.contains(version))
|
||||||
+ throw new RuntimeException("Version invalid: " + version + " file " + file);
|
+ throw new RuntimeException("Invalid version: " + version + " file " + 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);
|
||||||
@@ -198,7 +204,7 @@ index 0000000000000000000000000000000000000000..245e3b1801c5f92054d9c0d0d8fc2a8f
|
|||||||
+ 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("File length invalid " + this.regionFile + " " + fileLength + " " + (HEADER_SIZE + dataCount + FOOTER_SIZE));
|
+ throw new IOException("Invalid file length: " + this.regionFile + " " + fileLength + " " + (HEADER_SIZE + dataCount + FOOTER_SIZE));
|
||||||
+
|
+
|
||||||
+ rawDataStream.skipBytes(8); // Skip data hash (Long): Unused.
|
+ rawDataStream.skipBytes(8); // Skip data hash (Long): Unused.
|
||||||
+
|
+
|
||||||
@@ -214,7 +220,7 @@ index 0000000000000000000000000000000000000000..245e3b1801c5f92054d9c0d0d8fc2a8f
|
|||||||
+ 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): Unimplemented TODO: Implement per-chunk timestamps
|
+ dataStream.skipBytes(4); // Skip timestamps (Int): Unused.
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ for(int i = 0; i < 1024; i++) {
|
+ for(int i = 0; i < 1024; i++) {
|
||||||
@@ -278,7 +284,7 @@ index 0000000000000000000000000000000000000000..245e3b1801c5f92054d9c0d0d8fc2a8f
|
|||||||
+ public synchronized void flush() throws IOException {
|
+ public synchronized void flush() throws IOException {
|
||||||
+ if(!isMarkedToSave()) return;
|
+ if(!isMarkedToSave()) return;
|
||||||
+
|
+
|
||||||
+ long timestamp = System.currentTimeMillis() / 1000L;
|
+ long timestamp = getTimestamp();
|
||||||
+ short chunkCount = 0;
|
+ short chunkCount = 0;
|
||||||
+
|
+
|
||||||
+ File tempFile = new File(regionFile.toString() + ".tmp");
|
+ File tempFile = new File(regionFile.toString() + ".tmp");
|
||||||
@@ -306,8 +312,8 @@ index 0000000000000000000000000000000000000000..245e3b1801c5f92054d9c0d0d8fc2a8f
|
|||||||
+ } else byteBuffers.add(null);
|
+ } else byteBuffers.add(null);
|
||||||
+ }
|
+ }
|
||||||
+ for(int i = 0; i < 1024; i++) {
|
+ for(int i = 0; i < 1024; i++) {
|
||||||
+ zstdDataStream.writeInt(this.bufferUncompressedSize[i]);
|
+ zstdDataStream.writeInt(this.bufferUncompressedSize[i]); // Write uncompressed size
|
||||||
+ zstdDataStream.writeInt(0); // TODO: IMPLEMENT PER CHUNK TIMESTAMPS
|
+ zstdDataStream.writeInt(this.chunkTimestamps[i]); // Write timestamp
|
||||||
+ }
|
+ }
|
||||||
+ for(int i = 0; i < 1024; i++) {
|
+ for(int i = 0; i < 1024; i++) {
|
||||||
+ if(byteBuffers.get(i) != null)
|
+ if(byteBuffers.get(i) != null)
|
||||||
@@ -349,12 +355,13 @@ index 0000000000000000000000000000000000000000..245e3b1801c5f92054d9c0d0d8fc2a8f
|
|||||||
+ b = new byte[compressedLength];
|
+ b = new byte[compressedLength];
|
||||||
+ System.arraycopy(compressed, 0, b, 0, compressedLength);
|
+ System.arraycopy(compressed, 0, b, 0, compressedLength);
|
||||||
+
|
+
|
||||||
+ this.buffer[getChunkIndex(pos.x, pos.z)] = b;
|
+ int index = getChunkIndex(pos.x, pos.z);
|
||||||
|
+ this.buffer[index] = b;
|
||||||
|
+ 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.regionFile);
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
+ markToSave();
|
+ markToSave();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@@ -407,6 +414,7 @@ index 0000000000000000000000000000000000000000..245e3b1801c5f92054d9c0d0d8fc2a8f
|
|||||||
+ int i = getChunkIndex(pos.x, pos.z);
|
+ int i = getChunkIndex(pos.x, pos.z);
|
||||||
+ this.buffer[i] = null;
|
+ this.buffer[i] = null;
|
||||||
+ this.bufferUncompressedSize[i] = 0;
|
+ this.bufferUncompressedSize[i] = 0;
|
||||||
|
+ this.chunkTimestamps[i] = getTimestamp();
|
||||||
+ markToSave();
|
+ markToSave();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@@ -427,6 +435,10 @@ index 0000000000000000000000000000000000000000..245e3b1801c5f92054d9c0d0d8fc2a8f
|
|||||||
+ return (x & 31) + ((z & 31) << 5);
|
+ return (x & 31) + ((z & 31) << 5);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ private static int getTimestamp() {
|
||||||
|
+ return (int) (System.currentTimeMillis() / 1000L);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ public boolean recalculateHeader() {
|
+ public boolean recalculateHeader() {
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
Date: Thu, 16 Feb 2023 01:38:59 +0200
|
Date: Thu, 16 Feb 2023 01:38:59 +0200
|
||||||
Subject: [PATCH] Kaiiju Network Configuration
|
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
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
Date: Thu, 16 Feb 2023 01:49:54 +0200
|
Date: Thu, 16 Feb 2023 01:49:54 +0200
|
||||||
Subject: [PATCH] Purpur Network SendNullEntityPackets
|
Subject: [PATCH] Send null entity packets
|
||||||
|
|
||||||
|
This is from Purpur. Don't send null entity packets.
|
||||||
|
|
||||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
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 7c6d43d8a360530344ef296f4477750c8a298607..ab08e11f13921163b8ff1ff51ff9e9b86d2b47c7 100644
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
Date: Fri, 31 Mar 2023 01:52:44 +0300
|
Date: Fri, 31 Mar 2023 01:52:44 +0300
|
||||||
Subject: [PATCH] Purpur Network AlternateKeepalive
|
Subject: [PATCH] Alternate Keepalive
|
||||||
|
|
||||||
|
Don't kick players because 1 keepalive is lost.
|
||||||
|
This patch is from Purpur.
|
||||||
|
|
||||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
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 ab08e11f13921163b8ff1ff51ff9e9b86d2b47c7..b42a3466f145a92608c8746fd4beb529b4a60b01 100644
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
Date: Sat, 8 Apr 2023 23:32:34 +0300
|
Date: Sat, 8 Apr 2023 23:32:34 +0300
|
||||||
Subject: [PATCH] Kaiiju Gameplay Configuration
|
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
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Xymb <xymb@endcrystal.me>
|
From: Xymb <xymb@endcrystal.me>
|
||||||
Date: Sat, 8 Apr 2023 23:38:13 +0300
|
Date: Sat, 8 Apr 2023 23:38:13 +0300
|
||||||
Subject: [PATCH] Kaiiju Gameplay ShulkerDropContentsWhenDestroyed
|
Subject: [PATCH] Shulker drop contents when destroyed
|
||||||
|
|
||||||
|
Don't drop shulker contents when shulker items are destroyed (by cactus,
|
||||||
|
lava..)
|
||||||
|
|
||||||
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 73d79fe0077b28db2f9e7fa13a1ae6eff9abd6a9..bac11b0e30a86d0689693ff129b53bcad7c2034c 100644
|
index 73d79fe0077b28db2f9e7fa13a1ae6eff9abd6a9..bac11b0e30a86d0689693ff129b53bcad7c2034c 100644
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
Date: Sun, 9 Apr 2023 17:06:46 +0300
|
Date: Sun, 9 Apr 2023 17:06:46 +0300
|
||||||
Subject: [PATCH] Purpur Gameplay ServerModName
|
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
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Xymb <xymb@endcrystal.me>
|
From: Xymb <xymb@endcrystal.me>
|
||||||
Date: Fri, 14 Apr 2023 02:12:58 +0200
|
Date: Fri, 14 Apr 2023 02:12:58 +0200
|
||||||
Subject: [PATCH] Kaiiju Linear CrashOnBrokenSymlink
|
Subject: [PATCH] Crash on broken symlink
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
@@ -42,7 +42,7 @@ index a62a1b281bd0b6ad7d59b45b9470d84f496f6539..7f87dfa131ab7d40a94cf6355765478f
|
|||||||
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 43503974433c4d1808b2acb2b79f46d640725dc0..73ac94eaebdeaa94c83f1f23b53e686d867e6f98 100644
|
index 5ad209fed6aef1992af0472ac0af0911d178a260..0ef89e0bc214364fd904c3e5022c660b32b2caaa 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
|
||||||
@@ -272,7 +272,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -272,7 +272,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
Date: Sun, 23 Apr 2023 15:34:30 +0300
|
Date: Sun, 23 Apr 2023 15:34:30 +0300
|
||||||
Subject: [PATCH] Purpur Gameplay FixVoidTrading
|
Subject: [PATCH] Toggle void trading
|
||||||
|
|
||||||
|
Don't close trading windows when the villager is unloaded.
|
||||||
|
You should set chunk-unloads to 0s in paper config file to enable void
|
||||||
|
trading. Or use Kaiivoid plugin.
|
||||||
|
|
||||||
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 0f0cfd958f7d2c6d2ca4192be1b986900a2bfa53..c267b0cd52448246c7701081028ff0986dde2fa2 100644
|
index 0f0cfd958f7d2c6d2ca4192be1b986900a2bfa53..c267b0cd52448246c7701081028ff0986dde2fa2 100644
|
||||||
220
patches/server/0013-Toggle-optimize-hoppers.patch
Normal file
220
patches/server/0013-Toggle-optimize-hoppers.patch
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
|
Date: Thu, 27 Apr 2023 03:49:08 +0300
|
||||||
|
Subject: [PATCH] Toggle optimize hoppers
|
||||||
|
|
||||||
|
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
|
||||||
|
index c267b0cd52448246c7701081028ff0986dde2fa2..2624e074e0a14f5e05aca8fa910b5e5d71f320a9 100644
|
||||||
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
|
@@ -148,9 +148,11 @@ public class KaiijuWorldConfig {
|
||||||
|
|
||||||
|
public boolean shulkerBoxDropContentsWhenDestroyed = true;
|
||||||
|
public boolean fixVoidTrading = true;
|
||||||
|
+ public boolean optimizeHoppers = true;
|
||||||
|
|
||||||
|
private void gameplaySettings() {
|
||||||
|
shulkerBoxDropContentsWhenDestroyed = getBoolean("gameplay.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||||
|
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
||||||
|
+ optimizeHoppers = getBoolean("gameplay.optimize-hoppers", optimizeHoppers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\ No newline at end of file
|
||||||
|
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 0134370081182260d578ee1d8a16d544c03b6a0d..555d86f0a9132c2292470c60f263e59082f0c26e 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
|
@@ -401,49 +401,51 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
|
if (HopperBlockEntity.isFullContainer(iinventory1, enumdirection)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
+ // Kaiiju start - Toggle paper broken redstone
|
||||||
|
// Paper start - replace logic; MAKE SURE TO CHECK FOR DIFFS ON UPDATES
|
||||||
|
- return hopperPush(world, iinventory1, enumdirection, hopper);
|
||||||
|
- // for (int i = 0; i < iinventory.getContainerSize(); ++i) {
|
||||||
|
- // if (!iinventory.getItem(i).isEmpty()) {
|
||||||
|
- // ItemStack itemstack = iinventory.getItem(i).copy();
|
||||||
|
- // // ItemStack itemstack1 = addItem(iinventory, iinventory1, iinventory.removeItem(i, 1), enumdirection);
|
||||||
|
-
|
||||||
|
- // // CraftBukkit start - Call event when pushing items into other inventories
|
||||||
|
- // CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.removeItem(i, world.spigotConfig.hopperAmount)); // Spigot
|
||||||
|
-
|
||||||
|
- // Inventory destinationInventory;
|
||||||
|
- // // Have to special case large chests as they work oddly
|
||||||
|
- // if (iinventory1 instanceof CompoundContainer) {
|
||||||
|
- // destinationInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest((CompoundContainer) iinventory1);
|
||||||
|
- // } else if (iinventory1.getOwner() != null) {
|
||||||
|
- // destinationInventory = iinventory1.getOwner().getInventory();
|
||||||
|
- // } else {
|
||||||
|
- // destinationInventory = new CraftInventory(iinventory);
|
||||||
|
- // }
|
||||||
|
-
|
||||||
|
- // InventoryMoveItemEvent event = new InventoryMoveItemEvent(iinventory.getOwner().getInventory(), oitemstack.clone(), destinationInventory, true);
|
||||||
|
- // world.getCraftServer().getPluginManager().callEvent(event);
|
||||||
|
- // if (event.isCancelled()) {
|
||||||
|
- // hopper.setItem(i, itemstack);
|
||||||
|
- // hopper.setCooldown(world.spigotConfig.hopperTransfer); // Spigot
|
||||||
|
- // return false;
|
||||||
|
- // }
|
||||||
|
- // int origCount = event.getItem().getAmount(); // Spigot
|
||||||
|
- // ItemStack itemstack1 = HopperBlockEntity.addItem(iinventory, iinventory1, CraftItemStack.asNMSCopy(event.getItem()), enumdirection);
|
||||||
|
+ if (world.kaiijuConfig.optimizeHoppers) return hopperPush(world, iinventory1, enumdirection, hopper);
|
||||||
|
+ for (int i = 0; i < iinventory.getContainerSize(); ++i) {
|
||||||
|
+ if (!iinventory.getItem(i).isEmpty()) {
|
||||||
|
+ ItemStack itemstack = iinventory.getItem(i).copy();
|
||||||
|
+ // ItemStack itemstack1 = addItem(iinventory, iinventory1, iinventory.removeItem(i, 1), enumdirection);
|
||||||
|
+
|
||||||
|
+ // CraftBukkit start - Call event when pushing items into other inventories
|
||||||
|
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.removeItem(i, world.spigotConfig.hopperAmount)); // Spigot
|
||||||
|
+
|
||||||
|
+ Inventory destinationInventory;
|
||||||
|
+ // Have to special case large chests as they work oddly
|
||||||
|
+ if (iinventory1 instanceof CompoundContainer) {
|
||||||
|
+ destinationInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest((CompoundContainer) iinventory1);
|
||||||
|
+ } else if (iinventory1.getOwner() != null) {
|
||||||
|
+ destinationInventory = iinventory1.getOwner().getInventory();
|
||||||
|
+ } else {
|
||||||
|
+ destinationInventory = new CraftInventory(iinventory);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(iinventory.getOwner().getInventory(), oitemstack.clone(), destinationInventory, true);
|
||||||
|
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||||
|
+ if (event.isCancelled()) {
|
||||||
|
+ hopper.setItem(i, itemstack);
|
||||||
|
+ hopper.setCooldown(world.spigotConfig.hopperTransfer); // Spigot
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ int origCount = event.getItem().getAmount(); // Spigot
|
||||||
|
+ ItemStack itemstack1 = HopperBlockEntity.addItem(iinventory, iinventory1, CraftItemStack.asNMSCopy(event.getItem()), enumdirection);
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
|
- // if (itemstack1.isEmpty()) {
|
||||||
|
- // iinventory1.setChanged();
|
||||||
|
- // return true;
|
||||||
|
- // }
|
||||||
|
+ if (itemstack1.isEmpty()) {
|
||||||
|
+ iinventory1.setChanged();
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- // itemstack.shrink(origCount - itemstack1.getCount()); // Spigot
|
||||||
|
- // iinventory.setItem(i, itemstack);
|
||||||
|
- // }
|
||||||
|
- // }
|
||||||
|
+ itemstack.shrink(origCount - itemstack1.getCount()); // Spigot
|
||||||
|
+ iinventory.setItem(i, itemstack);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- // return false;
|
||||||
|
+ return false;
|
||||||
|
// Paper end
|
||||||
|
+ // Kaiiju end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -467,6 +469,12 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
|
if (iinventory != null) {
|
||||||
|
Direction enumdirection = Direction.DOWN;
|
||||||
|
|
||||||
|
+ // Kaiiju start - toggle paper broken redstone
|
||||||
|
+ if (!world.kaiijuConfig.optimizeHoppers)
|
||||||
|
+ return HopperBlockEntity.isEmptyContainer(iinventory, enumdirection) ? false : HopperBlockEntity.getSlots(iinventory, enumdirection).anyMatch((i) -> {
|
||||||
|
+ return HopperBlockEntity.a(hopper, iinventory, i, enumdirection, world); // Spigot
|
||||||
|
+ });
|
||||||
|
+ // Kaiiju end
|
||||||
|
// Paper start - optimize hoppers and remove streams
|
||||||
|
worldData.skipPullModeEventFire = worldData.skipHopperEvents; // Folia - region threading
|
||||||
|
return !HopperBlockEntity.isEmptyContainer(iinventory, enumdirection) && anyMatch(iinventory, enumdirection, (item, i) -> {
|
||||||
|
@@ -499,48 +507,50 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
|
private static boolean a(Hopper ihopper, Container iinventory, int i, Direction enumdirection, Level world) { // Spigot
|
||||||
|
ItemStack itemstack = iinventory.getItem(i);
|
||||||
|
|
||||||
|
+ // Kaiiju start - toggle paper broken redstone
|
||||||
|
// Paper start - replace pull logic; MAKE SURE TO CHECK FOR DIFFS WHEN UPDATING
|
||||||
|
if (!itemstack.isEmpty() && HopperBlockEntity.canTakeItemFromContainer(ihopper, iinventory, itemstack, i, enumdirection)) { // If this logic changes, update above. this is left unused incase reflective plugins
|
||||||
|
- return hopperPull(world, ihopper, iinventory, itemstack, i);
|
||||||
|
- // ItemStack itemstack1 = itemstack.copy();
|
||||||
|
- // // ItemStack itemstack2 = addItem(iinventory, ihopper, iinventory.removeItem(i, 1), (EnumDirection) null);
|
||||||
|
- // // CraftBukkit start - Call event on collection of items from inventories into the hopper
|
||||||
|
- // CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.removeItem(i, world.spigotConfig.hopperAmount)); // Spigot
|
||||||
|
-
|
||||||
|
- // Inventory sourceInventory;
|
||||||
|
- // // Have to special case large chests as they work oddly
|
||||||
|
- // if (iinventory instanceof CompoundContainer) {
|
||||||
|
- // sourceInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest((CompoundContainer) iinventory);
|
||||||
|
- // } else if (iinventory.getOwner() != null) {
|
||||||
|
- // sourceInventory = iinventory.getOwner().getInventory();
|
||||||
|
- // } else {
|
||||||
|
- // sourceInventory = new CraftInventory(iinventory);
|
||||||
|
- // }
|
||||||
|
-
|
||||||
|
- // InventoryMoveItemEvent event = new InventoryMoveItemEvent(sourceInventory, oitemstack.clone(), ihopper.getOwner().getInventory(), false);
|
||||||
|
-
|
||||||
|
- // Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
- // if (event.isCancelled()) {
|
||||||
|
- // iinventory.setItem(i, itemstack1);
|
||||||
|
-
|
||||||
|
- // if (ihopper instanceof HopperBlockEntity) {
|
||||||
|
- // ((HopperBlockEntity) ihopper).setCooldown(world.spigotConfig.hopperTransfer); // Spigot
|
||||||
|
- // }
|
||||||
|
-
|
||||||
|
- // return false;
|
||||||
|
- // }
|
||||||
|
- // int origCount = event.getItem().getAmount(); // Spigot
|
||||||
|
- // ItemStack itemstack2 = HopperBlockEntity.addItem(iinventory, ihopper, CraftItemStack.asNMSCopy(event.getItem()), null);
|
||||||
|
- // // CraftBukkit end
|
||||||
|
-
|
||||||
|
- // if (itemstack2.isEmpty()) {
|
||||||
|
- // iinventory.setChanged();
|
||||||
|
- // return true;
|
||||||
|
- // }
|
||||||
|
-
|
||||||
|
- // itemstack1.shrink(origCount - itemstack2.getCount()); // Spigot
|
||||||
|
- // iinventory.setItem(i, itemstack1);
|
||||||
|
+ if (world.kaiijuConfig.optimizeHoppers) return hopperPull(world, ihopper, iinventory, itemstack, i);
|
||||||
|
+ ItemStack itemstack1 = itemstack.copy();
|
||||||
|
+ // ItemStack itemstack2 = addItem(iinventory, ihopper, iinventory.removeItem(i, 1), (EnumDirection) null);
|
||||||
|
+ // CraftBukkit start - Call event on collection of items from inventories into the hopper
|
||||||
|
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.removeItem(i, world.spigotConfig.hopperAmount)); // Spigot
|
||||||
|
+
|
||||||
|
+ Inventory sourceInventory;
|
||||||
|
+ // Have to special case large chests as they work oddly
|
||||||
|
+ if (iinventory instanceof CompoundContainer) {
|
||||||
|
+ sourceInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest((CompoundContainer) iinventory);
|
||||||
|
+ } else if (iinventory.getOwner() != null) {
|
||||||
|
+ sourceInventory = iinventory.getOwner().getInventory();
|
||||||
|
+ } else {
|
||||||
|
+ sourceInventory = new CraftInventory(iinventory);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(sourceInventory, oitemstack.clone(), ihopper.getOwner().getInventory(), false);
|
||||||
|
+
|
||||||
|
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
+ if (event.isCancelled()) {
|
||||||
|
+ iinventory.setItem(i, itemstack1);
|
||||||
|
+
|
||||||
|
+ if (ihopper instanceof HopperBlockEntity) {
|
||||||
|
+ ((HopperBlockEntity) ihopper).setCooldown(world.spigotConfig.hopperTransfer); // Spigot
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ int origCount = event.getItem().getAmount(); // Spigot
|
||||||
|
+ ItemStack itemstack2 = HopperBlockEntity.addItem(iinventory, ihopper, CraftItemStack.asNMSCopy(event.getItem()), null);
|
||||||
|
+ // CraftBukkit end
|
||||||
|
+
|
||||||
|
+ if (itemstack2.isEmpty()) {
|
||||||
|
+ iinventory.setChanged();
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ itemstack1.shrink(origCount - itemstack2.getCount()); // Spigot
|
||||||
|
+ iinventory.setItem(i, itemstack1);
|
||||||
|
// Paper end
|
||||||
|
+ // Kaiiju end
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
37
patches/server/0014-Toggle-tick-level-when-empty.patch
Normal file
37
patches/server/0014-Toggle-tick-level-when-empty.patch
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
|
Date: Thu, 4 May 2023 19:53:33 +0300
|
||||||
|
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
|
||||||
|
index 2624e074e0a14f5e05aca8fa910b5e5d71f320a9..b674bad0ace0aba53f1f3e76e6c891421aaac2a5 100644
|
||||||
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
|
@@ -149,10 +149,12 @@ public class KaiijuWorldConfig {
|
||||||
|
public boolean shulkerBoxDropContentsWhenDestroyed = true;
|
||||||
|
public boolean fixVoidTrading = true;
|
||||||
|
public boolean optimizeHoppers = true;
|
||||||
|
+ public boolean tickWhenEmpty = true;
|
||||||
|
|
||||||
|
private void gameplaySettings() {
|
||||||
|
shulkerBoxDropContentsWhenDestroyed = getBoolean("gameplay.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||||
|
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
||||||
|
optimizeHoppers = getBoolean("gameplay.optimize-hoppers", optimizeHoppers);
|
||||||
|
+ tickWhenEmpty = getBoolean("gameplay.tick-when-empty", tickWhenEmpty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
|
index 92cc38353d25f3749186dbc062402c9bafb25fca..2fcd607c8200ca88e8f56cbe26c275915d3bc74d 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
|
@@ -743,7 +743,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
|
timings.doSounds.stopTiming(); // Spigot
|
||||||
|
regionizedWorldData.setHandlingTick(false); // Folia - regionised ticking
|
||||||
|
gameprofilerfiller.pop();
|
||||||
|
- boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
|
||||||
|
+ boolean flag = kaiijuConfig.tickWhenEmpty || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Kaiiju - i don't think so
|
||||||
|
|
||||||
|
if (flag) {
|
||||||
|
this.resetEmptyTime();
|
||||||
@@ -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, 7 May 2023 20:04:06 +0300
|
||||||
|
Subject: [PATCH] Toggle break redstone on top of trap doors early
|
||||||
|
|
||||||
|
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
|
||||||
|
index b674bad0ace0aba53f1f3e76e6c891421aaac2a5..43c8e95454cfe831f69858eb3b520f9958280b54 100644
|
||||||
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||||
|
@@ -150,11 +150,13 @@ public class KaiijuWorldConfig {
|
||||||
|
public boolean fixVoidTrading = true;
|
||||||
|
public boolean optimizeHoppers = true;
|
||||||
|
public boolean tickWhenEmpty = true;
|
||||||
|
+ public boolean breakRedstoneOnTopOfTrapDoorsEarly = true;
|
||||||
|
|
||||||
|
private void gameplaySettings() {
|
||||||
|
shulkerBoxDropContentsWhenDestroyed = getBoolean("gameplay.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java
|
||||||
|
index 4bddb91e289bbfbc75d532e63f935d585e41fc43..f8dba24931bcfa28bde9cdec0201b591f29f9e09 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java
|
||||||
|
@@ -126,6 +126,7 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
boolean open = (Boolean) state.getValue(TrapDoorBlock.OPEN) != flag1; // Folia - break redstone on trapdoors early
|
||||||
|
+ if (world.kaiijuConfig.breakRedstoneOnTopOfTrapDoorsEarly) { // Kaiiju - trigger break redstone on trapdoors early
|
||||||
|
// Folia start - break redstone on trapdoors early
|
||||||
|
// note: this must run before any state for this block/its neighborus are written to the world
|
||||||
|
// we allow the redstone event to fire so that plugins can block
|
||||||
|
@@ -144,6 +145,7 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Folia end - break redstone on trapdoors early
|
||||||
|
+ } // Kaiiju - trigger break redstone on trapdoors early
|
||||||
|
if (open) { // Folia - break redstone on trapdoors early
|
||||||
|
state = (BlockState) state.setValue(TrapDoorBlock.OPEN, flag1);
|
||||||
|
this.playSound((Player) null, world, pos, flag1);
|
||||||
18
patches/server/0016-Fix-off-thread-raid-winners.patch
Normal file
18
patches/server/0016-Fix-off-thread-raid-winners.patch
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
|
Date: Tue, 9 May 2023 15:11:56 +0300
|
||||||
|
Subject: [PATCH] Fix off thread raid winners
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||||
|
index 359f1690497eac00899eb26c17308e0a6fe943ad..3cc320e854cbb9e70b6c63f1f950091c5195edae 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||||
|
@@ -404,6 +404,7 @@ public class Raid {
|
||||||
|
UUID uuid = (UUID) iterator.next();
|
||||||
|
Entity entity = this.level.getEntity(uuid);
|
||||||
|
|
||||||
|
+ if (!io.papermc.paper.util.TickThread.isTickThreadFor(entity)) continue; // Kaiiju - Prevent give effect to player off thread
|
||||||
|
if (entity instanceof LivingEntity && !entity.isSpectator()) {
|
||||||
|
LivingEntity entityliving = (LivingEntity) entity;
|
||||||
|
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
|
Date: Wed, 10 May 2023 16:30:38 +0300
|
||||||
|
Subject: [PATCH] Strip raytracing for EntityLiving#hasLineOfSight
|
||||||
|
|
||||||
|
This has been benchmarked on a huge gold farm.
|
||||||
|
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
|
||||||
|
index 49716190b784339b80c8a3ac8e5b13bc450284ee..440735caab3be903546638a3d01903720225c553 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
|
@@ -3612,7 +3612,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
|
Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ());
|
||||||
|
|
||||||
|
// Paper - diff on change - used in CraftLivingEntity#hasLineOfSight(Location) and CraftWorld#lineOfSightExists
|
||||||
|
- return vec3d1.distanceToSqr(vec3d) > 128D * 128D ? false : this.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)).getType() == HitResult.Type.MISS; // Paper - use distanceToSqr
|
||||||
|
+ return !(vec3d1.distanceToSqr(vec3d) > 128D * 128D) && this.level.rayTraceDirect(vec3d, vec3d1, net.minecraft.world.phys.shapes.CollisionContext.of(this)) == net.minecraft.world.phys.BlockHitResult.Type.MISS; // Paper - use distanceToSqr // Kaiiju - Pufferfish - Strip raytracing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java
|
||||||
|
index 2ee9e8e3c1a28c1823de8e1fe421cc1f3e72f384..d99d77536e4d49b53575ae30614c0ab5fdbd3f73 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/BlockGetter.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/BlockGetter.java
|
||||||
|
@@ -73,6 +73,17 @@ public interface BlockGetter extends LevelHeightAccessor {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Kaiiju start - Pufferfish - broken down variant of below rayTraceBlock, used by World#rayTraceDirect
|
||||||
|
+ @Nullable
|
||||||
|
+ default net.minecraft.world.phys.BlockHitResult.Type rayTraceBlockDirect(Vec3 vec3d, Vec3 vec3d1, BlockPos blockposition, BlockState iblockdata, net.minecraft.world.phys.shapes.CollisionContext voxelshapecoll) {
|
||||||
|
+ if (iblockdata.isAir()) return null;
|
||||||
|
+ VoxelShape voxelshape = ClipContext.Block.COLLIDER.get(iblockdata, this, blockposition, voxelshapecoll);
|
||||||
|
+ net.minecraft.world.phys.BlockHitResult movingobjectpositionblock = this.clipWithInteractionOverride(vec3d, vec3d1, blockposition, voxelshape, iblockdata);
|
||||||
|
+
|
||||||
|
+ return movingobjectpositionblock == null ? null : movingobjectpositionblock.getType();
|
||||||
|
+ }
|
||||||
|
+ // Kaiiju end
|
||||||
|
+
|
||||||
|
// CraftBukkit start - moved block handling into separate method for use by Block#rayTrace
|
||||||
|
default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) {
|
||||||
|
// Paper start - Prevent raytrace from loading chunks
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
|
index a3b4b49ca8612a61bc2e7a1e2d2e942e7ebe1883..933373aaa7b1fa07862e2146e079abe91d126263 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
|
@@ -433,6 +433,91 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Kaiiju start - Pufferfish - broken down method of raytracing for EntityLiving#hasLineOfSight, replaces IBlockAccess#rayTrace(RayTrace)
|
||||||
|
+ public net.minecraft.world.phys.BlockHitResult.Type rayTraceDirect(net.minecraft.world.phys.Vec3 vec3d, net.minecraft.world.phys.Vec3 vec3d1, net.minecraft.world.phys.shapes.CollisionContext voxelshapecoll) {
|
||||||
|
+ // most of this code comes from IBlockAccess#a(RayTrace, BiFunction, Function), but removes the needless functions
|
||||||
|
+ if (vec3d.equals(vec3d1)) {
|
||||||
|
+ return net.minecraft.world.phys.BlockHitResult.Type.MISS;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ double endX = Mth.lerp(-1.0E-7D, vec3d1.x, vec3d.x);
|
||||||
|
+ double endY = Mth.lerp(-1.0E-7D, vec3d1.y, vec3d.y);
|
||||||
|
+ double endZ = Mth.lerp(-1.0E-7D, vec3d1.z, vec3d.z);
|
||||||
|
+
|
||||||
|
+ double startX = Mth.lerp(-1.0E-7D, vec3d.x, vec3d1.x);
|
||||||
|
+ double startY = Mth.lerp(-1.0E-7D, vec3d.y, vec3d1.y);
|
||||||
|
+ double startZ = Mth.lerp(-1.0E-7D, vec3d.z, vec3d1.z);
|
||||||
|
+
|
||||||
|
+ int currentX = Mth.floor(startX);
|
||||||
|
+ int currentY = Mth.floor(startY);
|
||||||
|
+ int currentZ = Mth.floor(startZ);
|
||||||
|
+
|
||||||
|
+ BlockPos.MutableBlockPos currentBlock = new BlockPos.MutableBlockPos(currentX, currentY, currentZ);
|
||||||
|
+
|
||||||
|
+ LevelChunk chunk = this.getChunkIfLoaded(currentBlock);
|
||||||
|
+ if (chunk == null) {
|
||||||
|
+ return net.minecraft.world.phys.BlockHitResult.Type.MISS;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ net.minecraft.world.phys.BlockHitResult.Type initialCheck = this.rayTraceBlockDirect(vec3d, vec3d1, currentBlock, chunk.getBlockState(currentBlock), voxelshapecoll);
|
||||||
|
+
|
||||||
|
+ if (initialCheck != null) {
|
||||||
|
+ return initialCheck;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ double diffX = endX - startX;
|
||||||
|
+ double diffY = endY - startY;
|
||||||
|
+ double diffZ = endZ - startZ;
|
||||||
|
+
|
||||||
|
+ int xDirection = Mth.sign(diffX);
|
||||||
|
+ int yDirection = Mth.sign(diffY);
|
||||||
|
+ int zDirection = Mth.sign(diffZ);
|
||||||
|
+
|
||||||
|
+ double normalizedX = xDirection == 0 ? Double.MAX_VALUE : (double) xDirection / diffX;
|
||||||
|
+ double normalizedY = yDirection == 0 ? Double.MAX_VALUE : (double) yDirection / diffY;
|
||||||
|
+ double normalizedZ = zDirection == 0 ? Double.MAX_VALUE : (double) zDirection / diffZ;
|
||||||
|
+
|
||||||
|
+ double normalizedXDirection = normalizedX * (xDirection > 0 ? 1.0D - Mth.frac(startX) : Mth.frac(startX));
|
||||||
|
+ double normalizedYDirection = normalizedY * (yDirection > 0 ? 1.0D - Mth.frac(startY) : Mth.frac(startY));
|
||||||
|
+ double normalizedZDirection = normalizedZ * (zDirection > 0 ? 1.0D - Mth.frac(startZ) : Mth.frac(startZ));
|
||||||
|
+
|
||||||
|
+ net.minecraft.world.phys.BlockHitResult.Type result;
|
||||||
|
+
|
||||||
|
+ do {
|
||||||
|
+ if (normalizedXDirection > 1.0D && normalizedYDirection > 1.0D && normalizedZDirection > 1.0D) {
|
||||||
|
+ return net.minecraft.world.phys.BlockHitResult.Type.MISS;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (normalizedXDirection < normalizedYDirection) {
|
||||||
|
+ if (normalizedXDirection < normalizedZDirection) {
|
||||||
|
+ currentX += xDirection;
|
||||||
|
+ normalizedXDirection += normalizedX;
|
||||||
|
+ } else {
|
||||||
|
+ currentZ += zDirection;
|
||||||
|
+ normalizedZDirection += normalizedZ;
|
||||||
|
+ }
|
||||||
|
+ } else if (normalizedYDirection < normalizedZDirection) {
|
||||||
|
+ currentY += yDirection;
|
||||||
|
+ normalizedYDirection += normalizedY;
|
||||||
|
+ } else {
|
||||||
|
+ currentZ += zDirection;
|
||||||
|
+ normalizedZDirection += normalizedZ;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ currentBlock.set(currentX, currentY, currentZ);
|
||||||
|
+ if (chunk.getPos().x != currentBlock.getX() >> 4 || chunk.getPos().z != currentBlock.getZ() >> 4) {
|
||||||
|
+ chunk = this.getChunkIfLoaded(currentBlock);
|
||||||
|
+ if (chunk == null) {
|
||||||
|
+ return net.minecraft.world.phys.BlockHitResult.Type.MISS;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ result = this.rayTraceBlockDirect(vec3d, vec3d1, currentBlock, chunk.getBlockState(currentBlock), voxelshapecoll);
|
||||||
|
+ } while (result == null);
|
||||||
|
+
|
||||||
|
+ return result;
|
||||||
|
+ }
|
||||||
|
+ // Kaiiju end
|
||||||
|
+
|
||||||
|
public boolean isInWorldBounds(BlockPos pos) {
|
||||||
|
return pos.isInsideBuildHeightAndWorldBoundsHorizontal(this); // Paper - use better/optimized check
|
||||||
|
}
|
||||||
18
patches/server/0018-Fix-off-thread-spider-addEffect.patch
Normal file
18
patches/server/0018-Fix-off-thread-spider-addEffect.patch
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||||
|
Date: Wed, 10 May 2023 17:58:37 +0300
|
||||||
|
Subject: [PATCH] Fix off thread spider addEffect
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||||
|
index 0c36bb47bd7040f1544817810e1c87157cdaff96..29935d7cab5a61f48ed540c60152ad06f5e90d08 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||||
|
@@ -180,6 +180,7 @@ public class Spider extends Monster {
|
||||||
|
MobEffect mobeffectlist = entityspider_groupdataspider.effect;
|
||||||
|
|
||||||
|
if (mobeffectlist != null) {
|
||||||
|
+ if (io.papermc.paper.util.TickThread.isTickThreadFor(this)) // Kaiiju - Prevent give effect to spider off thread
|
||||||
|
this.addEffect(new MobEffectInstance(mobeffectlist, -1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user