Compare commits
12 Commits
build-156
...
dev/improv
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31c6a8e270 | ||
|
|
6657b9cb08 | ||
|
|
3176184ca6 | ||
|
|
bc3e578199 | ||
|
|
8ead6a39e8 | ||
|
|
78ce8c44b0 | ||
|
|
570012207d | ||
|
|
3ced21898b | ||
|
|
47ffdcfec9 | ||
|
|
cb48e11a50 | ||
|
|
47979cce0c | ||
|
|
5ee903fe44 |
23
README.md
23
README.md
@@ -1,4 +1,3 @@
|
||||
|
||||
<div align="center">
|
||||
<img src="https://github.com/kugge/Kaiiju/blob/ver/1.19.3/logo.png?" width="32%" height="32%"/>
|
||||
<h1>Kaiiju</h1>
|
||||
@@ -17,19 +16,20 @@
|
||||
- **Auto update**: Automatic upstream updates.
|
||||
|
||||
### Notable
|
||||
- **Optimize Hopper**: Enable/Disable Paper "Optimize Hopper" patch that break a lot of redstone farms.
|
||||
- **Entity throttling & removal**: Tweak entity tick frequency & max entity per region.
|
||||
- **Sand duplication**: Toggle sand duplication on Folia.
|
||||
- **Technical Minecraft**: Enable Vanilla exploits such as sand duping, RNG manipulation...
|
||||
|
||||
### Configuration
|
||||
|
||||
```yaml
|
||||
verbose: false
|
||||
region-format:
|
||||
debug: false
|
||||
network:
|
||||
send-null-entity-packets: true
|
||||
alternate-keepalive: false
|
||||
optimization:
|
||||
disable-vanish-api: false
|
||||
disable-player-stats: false
|
||||
disable-arm-swing-event: false
|
||||
disable-ensure-tick-thread-checks: false
|
||||
gameplay:
|
||||
server-mod-name: Kaiiju
|
||||
shared-random-for-players: true
|
||||
@@ -40,13 +40,20 @@ world-settings:
|
||||
linear:
|
||||
compression-level: 1
|
||||
crash-on-broken-symlink: true
|
||||
gameplay:
|
||||
optimization:
|
||||
shulker-box-drop-contents-when-destroyed: true
|
||||
enable-entity-throttling: false
|
||||
disable-achievements: false
|
||||
disable-creatures-spawn-events: false
|
||||
disable-dolphin-swim-to-treasure: false
|
||||
gameplay:
|
||||
fix-void-trading: true
|
||||
optimize-hoppers: true
|
||||
tick-when-empty: true
|
||||
break-redstone-on-top-of-trap-doors-early: true
|
||||
config-version: 1
|
||||
fix-tripwire-state-inconsistency: true
|
||||
safe-teleportation: true
|
||||
sand-duplication: false
|
||||
```
|
||||
Documentation: [Kaiiju Wiki](https://github.com/KaiijuMC/Kaiiju/wiki/Configuration)
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||
Date: Sat, 8 Apr 2023 23:32:34 +0300
|
||||
Subject: [PATCH] Gameplay Configuration
|
||||
From: kugge <sofiane.djerbi38@gmail.com>
|
||||
Date: Wed, 21 Jun 2023 17:26:24 +0200
|
||||
Subject: [PATCH] Optimization Configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index b42a3466f145a92608c8746fd4beb529b4a60b01..6d0e1edfb7d3c020f70f6a194f16e836b462c4de 100644
|
||||
index b42a3466f145a92608c8746fd4beb529b4a60b01..7b56cc1275319cf07a4a25280e0ff900bdca8afa 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -206,4 +206,7 @@ public class KaiijuConfig {
|
||||
@@ -13,11 +13,11 @@ index b42a3466f145a92608c8746fd4beb529b4a60b01..6d0e1edfb7d3c020f70f6a194f16e836
|
||||
alternateKeepAlive = getBoolean("network.alternate-keepalive", alternateKeepAlive);
|
||||
}
|
||||
+
|
||||
+ private static void gameplaySettings() {
|
||||
+ private static void optimizationSettings() {
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
index a6e7af5f4148e067660e9f5beeacde3a59a1de9c..6a700b5b15da394f42461b59f85eb8918c2121ad 100644
|
||||
index a6e7af5f4148e067660e9f5beeacde3a59a1de9c..6bd14857e0b0ef233f17f1a6e3e0fb313d59f641 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -143,4 +143,7 @@ public class KaiijuWorldConfig {
|
||||
@@ -25,6 +25,6 @@ index a6e7af5f4148e067660e9f5beeacde3a59a1de9c..6a700b5b15da394f42461b59f85eb891
|
||||
}
|
||||
}
|
||||
+
|
||||
+ private void gameplaySettings() {
|
||||
+ private void optimizationSettings() {
|
||||
+ }
|
||||
}
|
||||
30
patches/server/0009-Gameplay-Configuration.patch
Normal file
30
patches/server/0009-Gameplay-Configuration.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
|
||||
Date: Sat, 8 Apr 2023 23:32:34 +0300
|
||||
Subject: [PATCH] Gameplay Configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index 7b56cc1275319cf07a4a25280e0ff900bdca8afa..fdc4cdbf34ed10f6523dceac7c1931d3ca4eb522 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -209,4 +209,7 @@ public class KaiijuConfig {
|
||||
|
||||
private static void optimizationSettings() {
|
||||
}
|
||||
+
|
||||
+ private static void gameplaySettings() {
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
index 6bd14857e0b0ef233f17f1a6e3e0fb313d59f641..05f9c01131e78927d88f1170c3eda4adf25ac8ba 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -146,4 +146,7 @@ public class KaiijuWorldConfig {
|
||||
|
||||
private void optimizationSettings() {
|
||||
}
|
||||
+
|
||||
+ private void gameplaySettings() {
|
||||
+ }
|
||||
}
|
||||
@@ -7,19 +7,20 @@ 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
|
||||
index 6a700b5b15da394f42461b59f85eb8918c2121ad..c3347922439153bb4377d322fc3da2d16255d885 100644
|
||||
index 05f9c01131e78927d88f1170c3eda4adf25ac8ba..55dcbb48450b24f80e0a04bedeb54f64e94ebb9e 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -144,6 +144,9 @@ public class KaiijuWorldConfig {
|
||||
@@ -144,7 +144,10 @@ public class KaiijuWorldConfig {
|
||||
}
|
||||
}
|
||||
|
||||
+ public boolean shulkerBoxDropContentsWhenDestroyed = true;
|
||||
+
|
||||
private void gameplaySettings() {
|
||||
+ shulkerBoxDropContentsWhenDestroyed = getBoolean("gameplay.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||
private void optimizationSettings() {
|
||||
+ shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||
}
|
||||
}
|
||||
|
||||
private void gameplaySettings() {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
index ebee8de2ed831755b6fd154f6cc77ac993839bb9..ce5faefe3b67087509833800f0472f14131f2011 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
@@ -5,11 +5,11 @@ Subject: [PATCH] Server mod name
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index 6d0e1edfb7d3c020f70f6a194f16e836b462c4de..9fb33b35b4d6842ca8597f77a4116e3983ebfbcb 100644
|
||||
index fdc4cdbf34ed10f6523dceac7c1931d3ca4eb522..e1f50adfa216320bc53b460d11666064cb58c969 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -207,6 +207,9 @@ public class KaiijuConfig {
|
||||
alternateKeepAlive = getBoolean("network.alternate-keepalive", alternateKeepAlive);
|
||||
@@ -210,6 +210,9 @@ public class KaiijuConfig {
|
||||
private static void optimizationSettings() {
|
||||
}
|
||||
|
||||
+ public static String serverModName = "Kaiiju";
|
||||
@@ -5,7 +5,7 @@ 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
|
||||
index c3347922439153bb4377d322fc3da2d16255d885..6f785078ca5123eb06913f95183475584116ebf5 100644
|
||||
index 55dcbb48450b24f80e0a04bedeb54f64e94ebb9e..f3f824d0ab1a2a72825c40b67192386479a0b34c 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -127,6 +127,7 @@ public class KaiijuWorldConfig {
|
||||
@@ -64,7 +64,7 @@ index 61c6bc2859235874aefac71e9e55162f0a89f29f..24bd63c596c9f61f1e89ec5b001b7cb7
|
||||
// Paper start
|
||||
this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 19fb8ca8a6f699ce596103070db726fcb427865e..44c6d7484a87523e635492053b326f819b8f71c5 100644
|
||||
index 4774d3f357d62b0818b4713f8085d05be09eaa5c..1bbd8b475cdc57fb15ca05ffe122220a5539da10 100644
|
||||
--- a/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 {
|
||||
@@ -8,22 +8,21 @@ 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
|
||||
index 6f785078ca5123eb06913f95183475584116ebf5..a2eaa6d58ff7cbb88716d26996d2842cddfee560 100644
|
||||
index f3f824d0ab1a2a72825c40b67192386479a0b34c..95ed6cb7b94797187d1011cab344e187b39d9193 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -147,8 +147,10 @@ public class KaiijuWorldConfig {
|
||||
@@ -152,6 +152,9 @@ public class KaiijuWorldConfig {
|
||||
shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||
}
|
||||
|
||||
public boolean shulkerBoxDropContentsWhenDestroyed = true;
|
||||
+ public boolean fixVoidTrading = true;
|
||||
|
||||
+
|
||||
private void gameplaySettings() {
|
||||
shulkerBoxDropContentsWhenDestroyed = getBoolean("gameplay.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||
+ fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 44c6d7484a87523e635492053b326f819b8f71c5..6f9ae8348f250d27931910de3a387922e24c7757 100644
|
||||
index 1bbd8b475cdc57fb15ca05ffe122220a5539da10..7f39e36037d55278d15399196459e51b885c5d1e 100644
|
||||
--- a/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 {
|
||||
@@ -6,23 +6,23 @@ 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 a2eaa6d58ff7cbb88716d26996d2842cddfee560..01f194cfbd6f0e371f410c94aaecf1595acb22d8 100644
|
||||
index 95ed6cb7b94797187d1011cab344e187b39d9193..6d7356cc07da58b1cef8d8963e790251d765de2c 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 {
|
||||
@@ -147,9 +147,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);
|
||||
private void optimizationSettings() {
|
||||
shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||
+ optimizeHoppers = getBoolean("optimization.optimize-hoppers", optimizeHoppers);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean fixVoidTrading = true;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index 0134370081182260d578ee1d8a16d544c03b6a0d..555d86f0a9132c2292470c60f263e59082f0c26e 100644
|
||||
index 4825a74ce4893dafdb70ae1badf3d2e1930d01a1..762b763f271c3208b4f8a7e346897207ec5beb6c 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
|
||||
@@ -5,24 +5,24 @@ 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 01f194cfbd6f0e371f410c94aaecf1595acb22d8..657a56a8cfa134943f8503e413b4eaf592a83854 100644
|
||||
index 6d7356cc07da58b1cef8d8963e790251d765de2c..601b9867d839f4928ba993ee8f00df9c330a0fe3 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 {
|
||||
@@ -148,10 +148,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);
|
||||
private void optimizationSettings() {
|
||||
shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||
optimizeHoppers = getBoolean("optimization.optimize-hoppers", optimizeHoppers);
|
||||
+ 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
|
||||
index 15087f575427ecdeee105060575fb6b6741f4586..a4d9c586f096a885b33840e8c1a7406821afb4df 100644
|
||||
index 7f39e36037d55278d15399196459e51b885c5d1e..66509fa23bfcde70abd3917eb774cf48d5d6da93 100644
|
||||
--- a/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 {
|
||||
@@ -6,20 +6,17 @@ 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 657a56a8cfa134943f8503e413b4eaf592a83854..ab56f61e9f77f743caabbd49d1e028e8ce296355 100644
|
||||
index 601b9867d839f4928ba993ee8f00df9c330a0fe3..e7ee85b09aa4438868e068551280b13e84cdfdb8 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 {
|
||||
@@ -157,8 +157,10 @@ 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);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ 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..089c7bc00b8b4354d795cd864dc2c310bcf6de86 100644
|
||||
index 05432184077752b1d0cb764a5e39ed875748b2d6..74a68ae68e3c774a63d0a5478dfcda6e7894a514 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
@@ -180,7 +180,9 @@ public class Spider extends Monster {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Toggle shared random for players
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index 9fb33b35b4d6842ca8597f77a4116e3983ebfbcb..51a49fc98147eef7bb50e7a2c71e0e8ed75e3dd6 100644
|
||||
index e1f50adfa216320bc53b460d11666064cb58c969..c934341c17caf4696065ac6c39bdfef570c62f13 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -208,8 +208,10 @@ public class KaiijuConfig {
|
||||
@@ -211,8 +211,10 @@ public class KaiijuConfig {
|
||||
}
|
||||
|
||||
public static String serverModName = "Kaiiju";
|
||||
@@ -20,7 +20,7 @@ index 9fb33b35b4d6842ca8597f77a4116e3983ebfbcb..51a49fc98147eef7bb50e7a2c71e0e8e
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index e8c2d4f647b01dfaebccd5a2fa330594bbbcb74f..532cb2aab7617319ffa0606b75b62f2414eabdb3 100644
|
||||
index deaf4b65b6c9f3dbab6578c25fb78ca84507f70b..cdf669fc1065632033fab4154f0113474b984152 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -566,6 +566,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -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
|
||||
index 5788fc92976c7704bb48dde91b5c9d403abc5cf0..9e7a93c862c8c237a706258b3a3b3d00ddec47e8 100644
|
||||
index 7b664f32868028758d0c6ee1eaa82efcd83661d2..8b325c764df7003f8e6984a85267cd78fc7672ed 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
@@ -485,7 +485,12 @@ public class RegionizedPlayerChunkLoader {
|
||||
@@ -6,20 +6,17 @@ Subject: [PATCH] Toggle fix TripWire state inconsistency
|
||||
This allow string duplication
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
index ab56f61e9f77f743caabbd49d1e028e8ce296355..c344ceee85cd7fe3d8e68df49e7e57db497a5c4b 100644
|
||||
index e7ee85b09aa4438868e068551280b13e84cdfdb8..8d7821d8b1a3615eaef1073d9dab690559b85f81 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -151,6 +151,7 @@ public class KaiijuWorldConfig {
|
||||
public boolean optimizeHoppers = true;
|
||||
public boolean tickWhenEmpty = true;
|
||||
@@ -158,9 +158,11 @@ public class KaiijuWorldConfig {
|
||||
|
||||
public boolean fixVoidTrading = true;
|
||||
public boolean breakRedstoneOnTopOfTrapDoorsEarly = true;
|
||||
+ public boolean fixTripWireStateInconsistency = true;
|
||||
|
||||
private void gameplaySettings() {
|
||||
shulkerBoxDropContentsWhenDestroyed = getBoolean("gameplay.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||
@@ -158,5 +159,6 @@ public class KaiijuWorldConfig {
|
||||
optimizeHoppers = getBoolean("gameplay.optimize-hoppers", optimizeHoppers);
|
||||
tickWhenEmpty = getBoolean("gameplay.tick-when-empty", tickWhenEmpty);
|
||||
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
||||
breakRedstoneOnTopOfTrapDoorsEarly = getBoolean("gameplay.break-redstone-on-top-of-trap-doors-early", breakRedstoneOnTopOfTrapDoorsEarly);
|
||||
+ fixTripWireStateInconsistency = getBoolean("gameplay.fix-tripwire-state-inconsistency", fixTripWireStateInconsistency);
|
||||
}
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Entity ticking throttling & removal to prevent lag.
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index e611fb1c25b8287b334c078f93d0fa2f32f5cb39..8340143a97c93c651c1ae424d3969729694ae981 100644
|
||||
index 1615346024037f2abe0fcfcfc5ea7713505bebca..d24f5fdc6a8c34774933a5cd8bfed8571299bd35 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -17,6 +17,7 @@ dependencies {
|
||||
@@ -18,7 +18,7 @@ index e611fb1c25b8287b334c078f93d0fa2f32f5cb39..8340143a97c93c651c1ae424d3969729
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityLimits.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityLimits.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..887ea85ca2a03796bfa5bf62f27d1a7abd7fbc29
|
||||
index 0000000000000000000000000000000000000000..9fc0823faa2a27a470adb24d688b2f9e60f628eb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityLimits.java
|
||||
@@ -0,0 +1,139 @@
|
||||
@@ -86,16 +86,16 @@ index 0000000000000000000000000000000000000000..887ea85ca2a03796bfa5bf62f27d1a7a
|
||||
+ try {
|
||||
+ entityLimitsConfig.load(ENTITY_LIMITS_FILE);
|
||||
+ } catch (InvalidConfigurationException ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not load kaiiju_entity_limits.yml, please correct your syntax errors", ex);
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not load kaiiju-entity-limits.yml, please correct your syntax errors", ex);
|
||||
+ throw Throwables.propagate(ex);
|
||||
+ } catch (IOException ignore) {}
|
||||
+ } else {
|
||||
+ if (setup) {
|
||||
+ entityLimitsConfig.options().header(HEADER);
|
||||
+ entityLimitsConfig.options().copyDefaults(true);
|
||||
+ entityLimitsConfig.set("Wither.limit", 1000);
|
||||
+ entityLimitsConfig.set("Wither.tick-throttle", 1000);
|
||||
+ entityLimitsConfig.set("Wither.removal", 5000);
|
||||
+ entityLimitsConfig.set("Axolotl.limit", 1000);
|
||||
+ entityLimitsConfig.set("Axolotl.tick-throttle", 1000);
|
||||
+ entityLimitsConfig.set("Axolotl.removal", 5000);
|
||||
+ try {
|
||||
+ entityLimitsConfig.save(ENTITY_LIMITS_FILE);
|
||||
@@ -121,19 +121,19 @@ index 0000000000000000000000000000000000000000..887ea85ca2a03796bfa5bf62f27d1a7a
|
||||
+ LOGGER.error("Unknown entity '" + key + "' in kaiiju-entity-limits.yml, skipping");
|
||||
+ continue;
|
||||
+ }
|
||||
+ int limit = entityLimitsConfig.getInt(key + ".limit");
|
||||
+ int tickThrottle = entityLimitsConfig.getInt(key + ".tick-throttle");
|
||||
+ int removal = entityLimitsConfig.getInt(key + ".removal");
|
||||
+
|
||||
+ if (limit < 1) {
|
||||
+ LOGGER.error(key + " has a limit less than the minimum of 1, ignoring");
|
||||
+ if (tickThrottle < 1) {
|
||||
+ LOGGER.error(key + " has a tick-throttle less than the minimum of 1, ignoring");
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (removal <= limit && removal != -1) {
|
||||
+ if (removal <= tickThrottle && removal != -1) {
|
||||
+ LOGGER.error(key + " has a removal limit that is less than or equal to its limit, setting removal to limit * 10");
|
||||
+ removal = limit * 10;
|
||||
+ removal = tickThrottle * 10;
|
||||
+ }
|
||||
+
|
||||
+ entityLimits.put((Class<? extends Entity>) Class.forName(entityClasses.get(key).getName()), new EntityLimit(limit, removal));
|
||||
+ entityLimits.put((Class<? extends Entity>) Class.forName(entityClasses.get(key).getName()), new EntityLimit(tickThrottle, removal));
|
||||
+ }
|
||||
+ } catch (ClassNotFoundException e) {
|
||||
+ e.printStackTrace();
|
||||
@@ -154,10 +154,10 @@ index 0000000000000000000000000000000000000000..887ea85ca2a03796bfa5bf62f27d1a7a
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public record EntityLimit(int limit, int removal) {
|
||||
+ public record EntityLimit(int tickThrottle, int removal) {
|
||||
+ @Override
|
||||
+ public String toString() {
|
||||
+ return "EntityLimit{limit=" + limit + ", removal=" + removal + "}";
|
||||
+ return "EntityLimit{tickThrottle=" + tickThrottle + ", removal=" + removal + "}";
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
@@ -252,24 +252,23 @@ index 0000000000000000000000000000000000000000..eb690efacf083e4ff3e321578b12c534
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
index c344ceee85cd7fe3d8e68df49e7e57db497a5c4b..2cc57d5a759ac3edcd2c3724f7f7b022b3e42f0f 100644
|
||||
index 8d7821d8b1a3615eaef1073d9dab690559b85f81..816db23fa64aab69e3034484c00645ebd0479978 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -152,6 +152,7 @@ public class KaiijuWorldConfig {
|
||||
@@ -149,11 +149,13 @@ public class KaiijuWorldConfig {
|
||||
public boolean shulkerBoxDropContentsWhenDestroyed = true;
|
||||
public boolean optimizeHoppers = true;
|
||||
public boolean tickWhenEmpty = true;
|
||||
public boolean breakRedstoneOnTopOfTrapDoorsEarly = true;
|
||||
public boolean fixTripWireStateInconsistency = true;
|
||||
+ public boolean enableEntityThrottling = false;
|
||||
|
||||
private void gameplaySettings() {
|
||||
shulkerBoxDropContentsWhenDestroyed = getBoolean("gameplay.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||
@@ -160,5 +161,6 @@ public class KaiijuWorldConfig {
|
||||
tickWhenEmpty = getBoolean("gameplay.tick-when-empty", tickWhenEmpty);
|
||||
breakRedstoneOnTopOfTrapDoorsEarly = getBoolean("gameplay.break-redstone-on-top-of-trap-doors-early", breakRedstoneOnTopOfTrapDoorsEarly);
|
||||
fixTripWireStateInconsistency = getBoolean("gameplay.fix-tripwire-state-inconsistency", fixTripWireStateInconsistency);
|
||||
+ enableEntityThrottling = getBoolean("gameplay.enable-entity-throttling", enableEntityThrottling);
|
||||
private void optimizationSettings() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean fixVoidTrading = true;
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/command/KaiijuCommand.java b/src/main/java/dev/kaiijumc/kaiiju/command/KaiijuCommand.java
|
||||
index 6fac162e0ec057af9f3336314d5663554cef0490..efecc7e132c67577577c99bfcf98e2b4ddae14ab 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/command/KaiijuCommand.java
|
||||
@@ -320,7 +319,7 @@ index 991e4c19763a34a6fead88363e007c2d11aad836..24a2d3f496727790f63cb66a2534d442
|
||||
dev.kaiijumc.kaiiju.KaiijuConfig.registerCommands();
|
||||
// Kaiiju end
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index a4d9c586f096a885b33840e8c1a7406821afb4df..240cb8ebc611cae345f6f4a9d22ab8796f28d591 100644
|
||||
index 66509fa23bfcde70abd3917eb774cf48d5d6da93..8fd9e3cee5a671ef8425311371cde57449ef1d8e 100644
|
||||
--- a/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 {
|
||||
@@ -5,21 +5,19 @@ 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
|
||||
index 2cc57d5a759ac3edcd2c3724f7f7b022b3e42f0f..915ac0ab2fc4ee2cdeeaac821a28ed861f9e6c12 100644
|
||||
index 816db23fa64aab69e3034484c00645ebd0479978..7c6c74f95c2534624a928ccf6b0a4b9d2a5486ad 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -153,6 +153,7 @@ public class KaiijuWorldConfig {
|
||||
@@ -161,10 +161,12 @@ public class KaiijuWorldConfig {
|
||||
public boolean fixVoidTrading = true;
|
||||
public boolean breakRedstoneOnTopOfTrapDoorsEarly = true;
|
||||
public boolean fixTripWireStateInconsistency = true;
|
||||
public boolean enableEntityThrottling = false;
|
||||
+ public boolean safeTeleporting = true;
|
||||
|
||||
private void gameplaySettings() {
|
||||
shulkerBoxDropContentsWhenDestroyed = getBoolean("gameplay.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||
@@ -162,5 +163,6 @@ public class KaiijuWorldConfig {
|
||||
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
||||
breakRedstoneOnTopOfTrapDoorsEarly = getBoolean("gameplay.break-redstone-on-top-of-trap-doors-early", breakRedstoneOnTopOfTrapDoorsEarly);
|
||||
fixTripWireStateInconsistency = getBoolean("gameplay.fix-tripwire-state-inconsistency", fixTripWireStateInconsistency);
|
||||
enableEntityThrottling = getBoolean("gameplay.enable-entity-throttling", enableEntityThrottling);
|
||||
+ safeTeleporting = getBoolean("gameplay.safe-teleportation", safeTeleporting);
|
||||
}
|
||||
}
|
||||
@@ -5,20 +5,19 @@ 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
|
||||
index 915ac0ab2fc4ee2cdeeaac821a28ed861f9e6c12..91749e471488233dd4f2515b1ff51331dea90f53 100644
|
||||
index 7c6c74f95c2534624a928ccf6b0a4b9d2a5486ad..9f0095f2196133a8bcffd5306aa9ac0b99b2f8d7 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -154,6 +154,7 @@ public class KaiijuWorldConfig {
|
||||
@@ -162,11 +162,13 @@ public class KaiijuWorldConfig {
|
||||
public boolean breakRedstoneOnTopOfTrapDoorsEarly = true;
|
||||
public boolean fixTripWireStateInconsistency = true;
|
||||
public boolean enableEntityThrottling = false;
|
||||
public boolean safeTeleporting = true;
|
||||
+ public boolean sandDuplication = false;
|
||||
|
||||
private void gameplaySettings() {
|
||||
shulkerBoxDropContentsWhenDestroyed = getBoolean("gameplay.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||
@@ -164,5 +165,6 @@ public class KaiijuWorldConfig {
|
||||
fixVoidTrading = getBoolean("gameplay.fix-void-trading", fixVoidTrading);
|
||||
breakRedstoneOnTopOfTrapDoorsEarly = getBoolean("gameplay.break-redstone-on-top-of-trap-doors-early", breakRedstoneOnTopOfTrapDoorsEarly);
|
||||
fixTripWireStateInconsistency = getBoolean("gameplay.fix-tripwire-state-inconsistency", fixTripWireStateInconsistency);
|
||||
enableEntityThrottling = getBoolean("gameplay.enable-entity-throttling", enableEntityThrottling);
|
||||
safeTeleporting = getBoolean("gameplay.safe-teleportation", safeTeleporting);
|
||||
+ sandDuplication = getBoolean("gameplay.sand-duplication", sandDuplication);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Xymb <xymb@endcrystal.me>
|
||||
Date: Sat, 17 Jun 2023 19:52:29 +0300
|
||||
Subject: [PATCH] Swap distanceToSqr and EntitySelector
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
||||
index b1a6a66ed02706c1adc36dcedfa415f5a24a25a0..bed6f316f4186895fd2e72ff114c4db1e0f53cf1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/EntityGetter.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
||||
@@ -147,9 +147,10 @@ public interface EntityGetter {
|
||||
// Paper start
|
||||
default boolean hasNearbyAlivePlayerThatAffectsSpawning(double x, double y, double z, double range) {
|
||||
for (Player player : this.getLocalPlayers()) { // Folia - region threading
|
||||
- if (EntitySelector.PLAYER_AFFECTS_SPAWNING.test(player)) { // combines NO_SPECTATORS and LIVING_ENTITY_STILL_ALIVE with an "affects spawning" check
|
||||
+ if (true || EntitySelector.PLAYER_AFFECTS_SPAWNING.test(player)) { // combines NO_SPECTATORS and LIVING_ENTITY_STILL_ALIVE with an "affects spawning" check // Kaiiju - Move this down
|
||||
double distanceSqr = player.distanceToSqr(x, y, z);
|
||||
if (range < 0.0D || distanceSqr < range * range) {
|
||||
+ if (EntitySelector.PLAYER_AFFECTS_SPAWNING.test(player)) // Kaiiju
|
||||
return true;
|
||||
}
|
||||
}
|
||||
46
patches/server/0027-Swap-distanceToSqr-and-target-test.patch
Normal file
46
patches/server/0027-Swap-distanceToSqr-and-target-test.patch
Normal file
@@ -0,0 +1,46 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Xymb <xymb@endcrystal.me>
|
||||
Date: Sat, 17 Jun 2023 19:52:29 +0300
|
||||
Subject: [PATCH] Swap distanceToSqr and target test
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
||||
index b1a6a66ed02706c1adc36dcedfa415f5a24a25a0..97a5eca200fd606d6102e40f9b8c32c2e7652cf9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/EntityGetter.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
||||
@@ -99,9 +99,9 @@ public interface EntityGetter {
|
||||
Player player = null;
|
||||
|
||||
for(Player player2 : this.getLocalPlayers()) { // Folia - region threading
|
||||
- if (targetPredicate == null || targetPredicate.test(player2)) {
|
||||
+ if (true || targetPredicate == null || targetPredicate.test(player2)) { // Kaiiju - Move this down
|
||||
double e = player2.distanceToSqr(x, y, z);
|
||||
- if ((maxDistance < 0.0D || e < maxDistance * maxDistance) && (d == -1.0D || e < d)) {
|
||||
+ if ((maxDistance < 0.0D || e < maxDistance * maxDistance) && (d == -1.0D || e < d) && (targetPredicate == null || targetPredicate.test(player2))) { // Kaiiju
|
||||
d = e;
|
||||
player = player2;
|
||||
}
|
||||
@@ -147,9 +147,10 @@ public interface EntityGetter {
|
||||
// Paper start
|
||||
default boolean hasNearbyAlivePlayerThatAffectsSpawning(double x, double y, double z, double range) {
|
||||
for (Player player : this.getLocalPlayers()) { // Folia - region threading
|
||||
- if (EntitySelector.PLAYER_AFFECTS_SPAWNING.test(player)) { // combines NO_SPECTATORS and LIVING_ENTITY_STILL_ALIVE with an "affects spawning" check
|
||||
+ if (true || EntitySelector.PLAYER_AFFECTS_SPAWNING.test(player)) { // combines NO_SPECTATORS and LIVING_ENTITY_STILL_ALIVE with an "affects spawning" check // Kaiiju - Move this down
|
||||
double distanceSqr = player.distanceToSqr(x, y, z);
|
||||
if (range < 0.0D || distanceSqr < range * range) {
|
||||
+ if (EntitySelector.PLAYER_AFFECTS_SPAWNING.test(player)) // Kaiiju
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -199,9 +200,9 @@ public interface EntityGetter {
|
||||
T livingEntity = null;
|
||||
|
||||
for(T livingEntity2 : entityList) {
|
||||
- if (targetPredicate.test(entity, livingEntity2)) {
|
||||
+ if (true || targetPredicate.test(entity, livingEntity2)) { // Kaiiju - Move this down
|
||||
double e = livingEntity2.distanceToSqr(x, y, z);
|
||||
- if (d == -1.0D || e < d) {
|
||||
+ if ((d == -1.0D || e < d) && targetPredicate.test(entity, livingEntity2)) { // Kaiiju
|
||||
d = e;
|
||||
livingEntity = livingEntity2;
|
||||
}
|
||||
38
patches/server/0033-Option-to-disable-vanish-api.patch
Normal file
38
patches/server/0033-Option-to-disable-vanish-api.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Xymb <xymb@endcrystal.me>
|
||||
Date: Thu, 22 Jun 2023 00:14:47 +0200
|
||||
Subject: [PATCH] Option to disable vanish api
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index c934341c17caf4696065ac6c39bdfef570c62f13..f49510c999ce5241f26dc9ba90a6148bf31467c7 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -207,7 +207,10 @@ public class KaiijuConfig {
|
||||
alternateKeepAlive = getBoolean("network.alternate-keepalive", alternateKeepAlive);
|
||||
}
|
||||
|
||||
+ public static boolean disableVanishApi = false;
|
||||
+
|
||||
private static void optimizationSettings() {
|
||||
+ disableVanishApi = getBoolean("optimization.disable-vanish-api", disableVanishApi);
|
||||
}
|
||||
|
||||
public static String serverModName = "Kaiiju";
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 24bd63c596c9f61f1e89ec5b001b7cb7a29a09ff..3fc2b4a91d2b9727972d6b43b6d2c04b1df3c698 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1350,7 +1350,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player);
|
||||
|
||||
// CraftBukkit start - respect vanish API
|
||||
- if (!io.papermc.paper.util.TickThread.isTickThreadFor(player) || !player.getBukkitEntity().canSee(this.entity.getBukkitEntity())) { // Folia - region threading
|
||||
+ // Kaiiju start - don't respect vanish API >:D
|
||||
+ boolean canSee = true;
|
||||
+ if (!dev.kaiijumc.kaiiju.KaiijuConfig.disableVanishApi) canSee = player.getBukkitEntity().canSee(this.entity.getBukkitEntity());
|
||||
+ if (!io.papermc.paper.util.TickThread.isTickThreadFor(player) || !canSee) { // Folia - region threading
|
||||
+ // Kaiiju end
|
||||
flag = false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
34
patches/server/0034-Option-to-disable-player-stats.patch
Normal file
34
patches/server/0034-Option-to-disable-player-stats.patch
Normal file
@@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Xymb <xymb@endcrystal.me>
|
||||
Date: Thu, 22 Jun 2023 00:17:57 +0200
|
||||
Subject: [PATCH] Option to disable player stats
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index f49510c999ce5241f26dc9ba90a6148bf31467c7..b23f2df433d7ebc871f4009081c28ed9054d91c7 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -208,9 +208,11 @@ public class KaiijuConfig {
|
||||
}
|
||||
|
||||
public static boolean disableVanishApi = false;
|
||||
+ public static boolean disablePlayerStats = false;
|
||||
|
||||
private static void optimizationSettings() {
|
||||
disableVanishApi = getBoolean("optimization.disable-vanish-api", disableVanishApi);
|
||||
+ disablePlayerStats = getBoolean("optimization.disable-player-stats", disablePlayerStats);
|
||||
}
|
||||
|
||||
public static String serverModName = "Kaiiju";
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index d58e8211fc765c61548ac2a180de87dd2934ba37..19642e7bf00dc9fdc157e70b4d6849a9898a2557 100644
|
||||
--- a/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 {
|
||||
|
||||
@Override
|
||||
public void awardStat(Stat<?> stat, int amount) {
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disablePlayerStats) return; // Kaiiju - Disable player stats
|
||||
this.stats.increment(this, stat, amount);
|
||||
this.level().getCraftServer().getScoreboardManager().getScoreboardScores(stat, this.getScoreboardName(), (scoreboardscore) -> { // CraftBukkit - Get our scores instead
|
||||
scoreboardscore.add(amount);
|
||||
175
patches/server/0035-Option-to-disable-achievements.patch
Normal file
175
patches/server/0035-Option-to-disable-achievements.patch
Normal file
@@ -0,0 +1,175 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Xymb <xymb@endcrystal.me>
|
||||
Date: Thu, 22 Jun 2023 00:32:36 +0200
|
||||
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
|
||||
index 9f0095f2196133a8bcffd5306aa9ac0b99b2f8d7..31d66bb2fcf4bb7262df2d8006e307fee92660ea 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -150,12 +150,14 @@ public class KaiijuWorldConfig {
|
||||
public boolean optimizeHoppers = true;
|
||||
public boolean tickWhenEmpty = true;
|
||||
public boolean enableEntityThrottling = false;
|
||||
+ public boolean disableAchievements = false;
|
||||
|
||||
private void optimizationSettings() {
|
||||
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);
|
||||
+ disableAchievements = getBoolean("optimization.disable-achievements", disableAchievements);
|
||||
}
|
||||
|
||||
public boolean fixVoidTrading = true;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 19642e7bf00dc9fdc157e70b4d6849a9898a2557..5e81fd3b1f88f33314f7b24b3e9ba2be21addd0c 100644
|
||||
--- a/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 {
|
||||
|
||||
@Override
|
||||
protected void onInsideBlock(BlockState state) {
|
||||
- CriteriaTriggers.ENTER_BLOCK.trigger(this, state);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.ENTER_BLOCK.trigger(this, state); // Kaiiju
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -781,9 +781,9 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
}
|
||||
|
||||
- CriteriaTriggers.TICK.trigger(this);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.TICK.trigger(this); // Kaiiju
|
||||
if (this.levitationStartPos != null) {
|
||||
- CriteriaTriggers.LEVITATION.trigger(this, this.levitationStartPos, this.tickCount - this.levitationStartTime);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.LEVITATION.trigger(this, this.levitationStartPos, this.tickCount - this.levitationStartTime); // Kaiiju
|
||||
}
|
||||
|
||||
this.trackStartFallingPosition();
|
||||
@@ -858,7 +858,7 @@ public class ServerPlayer extends Player {
|
||||
}
|
||||
|
||||
if (this.tickCount % 20 == 0) {
|
||||
- CriteriaTriggers.LOCATION.trigger(this);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.LOCATION.trigger(this); // Kaiiju
|
||||
}
|
||||
|
||||
// CraftBukkit start - initialize oldLevel, fire PlayerLevelChangeEvent, and tick client-sided world border
|
||||
@@ -887,7 +887,7 @@ public class ServerPlayer extends Player {
|
||||
@Override
|
||||
public void resetFallDistance() {
|
||||
if (this.getHealth() > 0.0F && this.startingToFallPosition != null) {
|
||||
- CriteriaTriggers.FALL_FROM_HEIGHT.trigger(this, this.startingToFallPosition);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.FALL_FROM_HEIGHT.trigger(this, this.startingToFallPosition); // Kaiiju
|
||||
}
|
||||
|
||||
this.startingToFallPosition = null;
|
||||
@@ -906,7 +906,7 @@ public class ServerPlayer extends Player {
|
||||
if (this.enteredLavaOnVehiclePosition == null) {
|
||||
this.enteredLavaOnVehiclePosition = this.position();
|
||||
} else {
|
||||
- CriteriaTriggers.RIDE_ENTITY_IN_LAVA_TRIGGER.trigger(this, this.enteredLavaOnVehiclePosition);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.RIDE_ENTITY_IN_LAVA_TRIGGER.trigger(this, this.enteredLavaOnVehiclePosition); // Kaiiju
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1110,7 +1110,7 @@ public class ServerPlayer extends Player {
|
||||
|
||||
this.handleTeamKill(s, s1, ObjectiveCriteria.TEAM_KILL);
|
||||
this.handleTeamKill(s1, s, ObjectiveCriteria.KILLED_BY_TEAM);
|
||||
- CriteriaTriggers.PLAYER_KILLED_ENTITY.trigger(this, entityKilled, damageSource);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.PLAYER_KILLED_ENTITY.trigger(this, entityKilled, damageSource); // Kaiiju
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1228,7 +1228,7 @@ public class ServerPlayer extends Player {
|
||||
this.wonGame = false;
|
||||
|
||||
this.respawn((player) -> {
|
||||
- CriteriaTriggers.CHANGED_DIMENSION.trigger(player, Level.END, Level.OVERWORLD);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.CHANGED_DIMENSION.trigger(player, Level.END, Level.OVERWORLD); // Kaiiju
|
||||
}, true);
|
||||
}
|
||||
|
||||
@@ -1730,14 +1730,14 @@ public class ServerPlayer extends Player {
|
||||
maindimensionkey1 = resourcekey1;
|
||||
}
|
||||
// Paper end
|
||||
- CriteriaTriggers.CHANGED_DIMENSION.trigger(this, maindimensionkey, maindimensionkey1);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.CHANGED_DIMENSION.trigger(this, maindimensionkey, maindimensionkey1); // Kaiiju
|
||||
if (maindimensionkey != resourcekey || maindimensionkey1 != resourcekey1) {
|
||||
- CriteriaTriggers.CHANGED_DIMENSION.trigger(this, resourcekey, resourcekey1);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.CHANGED_DIMENSION.trigger(this, resourcekey, resourcekey1); // Kaiiju
|
||||
}
|
||||
|
||||
if (maindimensionkey == Level.NETHER && maindimensionkey1 == Level.OVERWORLD && this.enteredNetherPosition != null) {
|
||||
// CraftBukkit end
|
||||
- CriteriaTriggers.NETHER_TRAVEL.trigger(this, this.enteredNetherPosition);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.NETHER_TRAVEL.trigger(this, this.enteredNetherPosition); // Kaiiju
|
||||
}
|
||||
|
||||
if (maindimensionkey1 != Level.NETHER) { // CraftBukkit
|
||||
@@ -1815,7 +1815,7 @@ public class ServerPlayer extends Player {
|
||||
{
|
||||
Either<Player.BedSleepingProblem, Unit> either = super.startSleepInBed(blockposition, force).ifRight((unit) -> {
|
||||
this.awardStat(Stats.SLEEP_IN_BED);
|
||||
- CriteriaTriggers.SLEPT_IN_BED.trigger(this);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.SLEPT_IN_BED.trigger(this); // Kaiiju
|
||||
});
|
||||
|
||||
if (!this.serverLevel().canSleepThroughNights()) {
|
||||
@@ -2101,7 +2101,7 @@ public class ServerPlayer extends Player {
|
||||
|
||||
@Override
|
||||
public void triggerRecipeCrafted(Recipe<?> recipe, List<ItemStack> ingredients) {
|
||||
- CriteriaTriggers.RECIPE_CRAFTED.trigger(this, recipe.getId(), ingredients);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.RECIPE_CRAFTED.trigger(this, recipe.getId(), ingredients); // Kaiiju
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2230,14 +2230,14 @@ public class ServerPlayer extends Player {
|
||||
this.levitationStartPos = this.position();
|
||||
}
|
||||
|
||||
- CriteriaTriggers.EFFECTS_CHANGED.trigger(this, source);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.EFFECTS_CHANGED.trigger(this, source); // Kaiiju
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEffectUpdated(MobEffectInstance effect, boolean reapplyEffect, @Nullable Entity source) {
|
||||
super.onEffectUpdated(effect, reapplyEffect, source);
|
||||
this.connection.send(new ClientboundUpdateMobEffectPacket(this.getId(), effect));
|
||||
- CriteriaTriggers.EFFECTS_CHANGED.trigger(this, source);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.EFFECTS_CHANGED.trigger(this, source); // Kaiiju
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2248,7 +2248,7 @@ public class ServerPlayer extends Player {
|
||||
this.levitationStartPos = null;
|
||||
}
|
||||
|
||||
- CriteriaTriggers.EFFECTS_CHANGED.trigger(this, (Entity) null);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.EFFECTS_CHANGED.trigger(this, (Entity) null); // Kaiiju
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2808,7 +2808,7 @@ public class ServerPlayer extends Player {
|
||||
|
||||
@Override
|
||||
protected void updateUsingItem(ItemStack stack) {
|
||||
- CriteriaTriggers.USING_ITEM.trigger(this, stack);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.USING_ITEM.trigger(this, stack); // Kaiiju
|
||||
super.updateUsingItem(stack);
|
||||
}
|
||||
|
||||
@@ -2837,7 +2837,7 @@ public class ServerPlayer extends Player {
|
||||
Entity entity = item.getOwner();
|
||||
|
||||
if (entity != null) {
|
||||
- CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_PLAYER.trigger(this, item.getItem(), entity);
|
||||
+ if (!this.level().kaiijuConfig.disableAchievements) CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_PLAYER.trigger(this, item.getItem(), entity); // Kaiiju
|
||||
}
|
||||
|
||||
}
|
||||
43
patches/server/0036-Option-to-disable-arm-swing-event.patch
Normal file
43
patches/server/0036-Option-to-disable-arm-swing-event.patch
Normal file
@@ -0,0 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Xymb <xymb@endcrystal.me>
|
||||
Date: Thu, 22 Jun 2023 00:37:27 +0200
|
||||
Subject: [PATCH] Option to disable arm swing event
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index b23f2df433d7ebc871f4009081c28ed9054d91c7..ec71f3f52cb8f7931aabd94619d2e7a24491d7ad 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -209,10 +209,12 @@ public class KaiijuConfig {
|
||||
|
||||
public static boolean disableVanishApi = false;
|
||||
public static boolean disablePlayerStats = false;
|
||||
+ public static boolean disableArmSwingEvent = 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);
|
||||
}
|
||||
|
||||
public static String serverModName = "Kaiiju";
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index b2ed157a17cada4887e543a23ee65642eb54637e..a238a3f62a92748d1dfb11fcf8938d33409b7a0c 100644
|
||||
--- a/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
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.resetLastActionTime();
|
||||
+ if (!dev.kaiijumc.kaiiju.KaiijuConfig.disableArmSwingEvent) { // Kaiiju
|
||||
// CraftBukkit start - Raytrace to look for 'rogue armswings'
|
||||
float f1 = this.player.getXRot();
|
||||
float f2 = this.player.getYRot();
|
||||
@@ -2669,6 +2670,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
if (event.isCancelled()) return;
|
||||
// CraftBukkit end
|
||||
+ } // Kaiiju
|
||||
this.player.swing(packet.getHand());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Xymb <xymb@endcrystal.me>
|
||||
Date: Thu, 22 Jun 2023 00:47:57 +0200
|
||||
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
|
||||
index 31d66bb2fcf4bb7262df2d8006e307fee92660ea..c9830912019079369268bfbf2c95de18ad598f52 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -151,6 +151,7 @@ public class KaiijuWorldConfig {
|
||||
public boolean tickWhenEmpty = true;
|
||||
public boolean enableEntityThrottling = false;
|
||||
public boolean disableAchievements = false;
|
||||
+ public boolean disableCreaturesSpawnEvents = false;
|
||||
|
||||
private void optimizationSettings() {
|
||||
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);
|
||||
disableAchievements = getBoolean("optimization.disable-achievements", disableAchievements);
|
||||
+ disableCreaturesSpawnEvents = getBoolean("optimization.disable-creatures-spawn-events", disableCreaturesSpawnEvents);
|
||||
}
|
||||
|
||||
public boolean fixVoidTrading = true;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index af35fd63b090aa3d89bc60cb9cb7694b5f502681..e5dded0363b14608e834e63e678563b1423d66e7 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -486,21 +486,29 @@ public class ServerChunkCache extends ChunkSource {
|
||||
chunkRange = (chunkRange > viewDistance) ? (byte)viewDistance : chunkRange;
|
||||
chunkRange = (chunkRange > DistanceManager.MOB_SPAWN_RANGE) ? DistanceManager.MOB_SPAWN_RANGE : chunkRange;
|
||||
|
||||
- com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(player.getBukkitEntity(), (byte)chunkRange);
|
||||
+ // Kaiiju start - disable creatures spawn events
|
||||
+ com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event = null;
|
||||
+ if (!this.level.kaiijuConfig.disableCreaturesSpawnEvents) {
|
||||
+ event = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(player.getBukkitEntity(), (byte)chunkRange);
|
||||
+ // Kaiiju end
|
||||
event.callEvent();
|
||||
if (event.isCancelled() || event.getSpawnRadius() < 0) { // Folia - region threading
|
||||
player.lastEntitySpawnRadiusSquared = -1.0; player.playerNaturallySpawnedEvent = null; // Folia - region threading
|
||||
regionizedWorldData.mobSpawnMap.remove(player); // Folia - region threading
|
||||
continue;
|
||||
}
|
||||
+ // Kaiiju start - disable creatures spawn events
|
||||
+ chunkRange = Math.min(event.getSpawnRadius(), 32);
|
||||
+ }
|
||||
+ // Kaiiju end
|
||||
|
||||
- int range = Math.min(event.getSpawnRadius(), 32); // limit to max view distance
|
||||
+ int range = chunkRange; // limit to max view distance // Kaiiju
|
||||
int chunkX = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX());
|
||||
int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ());
|
||||
|
||||
regionizedWorldData.mobSpawnMap.addOrUpdate(player, chunkX, chunkZ, range); // Folia - region threading
|
||||
player.lastEntitySpawnRadiusSquared = (double)((range << 4) * (range << 4)); // used in anyPlayerCloseEnoughForSpawning
|
||||
- player.playerNaturallySpawnedEvent = event;
|
||||
+ if (!this.level.kaiijuConfig.disableCreaturesSpawnEvents) player.playerNaturallySpawnedEvent = event; // Kaiiju
|
||||
}
|
||||
// Paper end - optimize isOutisdeRange
|
||||
LevelData worlddata = this.level.getLevelData();
|
||||
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Xymb <xymb@endcrystal.me>
|
||||
Date: Thu, 22 Jun 2023 00:52:00 +0200
|
||||
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
|
||||
index c9830912019079369268bfbf2c95de18ad598f52..e2fb7d7a7b3126d386b46442c115085d1974ac4e 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
|
||||
@@ -152,6 +152,7 @@ public class KaiijuWorldConfig {
|
||||
public boolean enableEntityThrottling = false;
|
||||
public boolean disableAchievements = false;
|
||||
public boolean disableCreaturesSpawnEvents = false;
|
||||
+ public boolean disableDolphinSwimToTreasure = false;
|
||||
|
||||
private void optimizationSettings() {
|
||||
shulkerBoxDropContentsWhenDestroyed = getBoolean("optimization.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
|
||||
@@ -160,6 +161,7 @@ public class KaiijuWorldConfig {
|
||||
enableEntityThrottling = getBoolean("optimization.enable-entity-throttling", enableEntityThrottling);
|
||||
disableAchievements = getBoolean("optimization.disable-achievements", disableAchievements);
|
||||
disableCreaturesSpawnEvents = getBoolean("optimization.disable-creatures-spawn-events", disableCreaturesSpawnEvents);
|
||||
+ disableDolphinSwimToTreasure = getBoolean("optimization.disable-dolphin-swim-to-treasure", disableDolphinSwimToTreasure);
|
||||
}
|
||||
|
||||
public boolean fixVoidTrading = true;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
index 501e6cb4aa83f81c1f657e41f4e7f11d19d46831..8240b8e27d5f5e941049f269718670db0510f497 100644
|
||||
--- a/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 {
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new BreathAirGoal(this));
|
||||
this.goalSelector.addGoal(0, new TryFindWaterGoal(this));
|
||||
- this.goalSelector.addGoal(1, new Dolphin.DolphinSwimToTreasureGoal(this));
|
||||
+ if (!this.level().kaiijuConfig.disableDolphinSwimToTreasure) this.goalSelector.addGoal(1, new Dolphin.DolphinSwimToTreasureGoal(this)); // Kaiiju
|
||||
this.goalSelector.addGoal(2, new Dolphin.DolphinSwimWithPlayerGoal(this, 4.0D));
|
||||
this.goalSelector.addGoal(4, new RandomSwimmingGoal(this, 1.0D, 10));
|
||||
this.goalSelector.addGoal(4, new RandomLookAroundGoal(this));
|
||||
@@ -0,0 +1,84 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Xymb <xymb@endcrystal.me>
|
||||
Date: Thu, 22 Jun 2023 00:55:17 +0200
|
||||
Subject: [PATCH] Option to disable ensure tick thread checks
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
index ec71f3f52cb8f7931aabd94619d2e7a24491d7ad..fa2a763e5784e7dae02c94a13751cbf746b6eee8 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
||||
@@ -210,11 +210,13 @@ public class KaiijuConfig {
|
||||
public static boolean disableVanishApi = false;
|
||||
public static boolean disablePlayerStats = false;
|
||||
public static boolean disableArmSwingEvent = false;
|
||||
+ public static boolean disableEnsureTickThreadChecks = false;
|
||||
|
||||
private static void optimizationSettings() {
|
||||
disableVanishApi = getBoolean("optimization.disable-vanish-api", disableVanishApi);
|
||||
disablePlayerStats = getBoolean("optimization.disable-player-stats", disablePlayerStats);
|
||||
disableArmSwingEvent = getBoolean("optimization.disable-arm-swing-event", disableArmSwingEvent);
|
||||
+ disableEnsureTickThreadChecks = getBoolean("optimization.disable-ensure-tick-thread-checks", disableEnsureTickThreadChecks);
|
||||
}
|
||||
|
||||
public static String serverModName = "Kaiiju";
|
||||
diff --git a/src/main/java/io/papermc/paper/util/TickThread.java b/src/main/java/io/papermc/paper/util/TickThread.java
|
||||
index cb453dd110fc37fae75257a4576512126207763e..492e6a512343001d3d772d2d8b427d2d84e89da5 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/TickThread.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/TickThread.java
|
||||
@@ -46,6 +46,7 @@ public class TickThread extends Thread {
|
||||
*/
|
||||
@Deprecated
|
||||
public static void ensureTickThread(final String reason) {
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
||||
if (!isTickThread()) {
|
||||
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
throw new IllegalStateException(reason);
|
||||
@@ -53,6 +54,7 @@ public class TickThread extends Thread {
|
||||
}
|
||||
|
||||
public static void ensureTickThread(final ServerLevel world, final BlockPos pos, final String reason) {
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
||||
if (!isTickThreadFor(world, pos)) {
|
||||
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
throw new IllegalStateException(reason);
|
||||
@@ -60,6 +62,7 @@ public class TickThread extends Thread {
|
||||
}
|
||||
|
||||
public static void ensureTickThread(final ServerLevel world, final ChunkPos pos, final String reason) {
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
||||
if (!isTickThreadFor(world, pos)) {
|
||||
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
throw new IllegalStateException(reason);
|
||||
@@ -67,6 +70,7 @@ public class TickThread extends Thread {
|
||||
}
|
||||
|
||||
public static void ensureTickThread(final ServerLevel world, final int chunkX, final int chunkZ, final String reason) {
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
||||
if (!isTickThreadFor(world, chunkX, chunkZ)) {
|
||||
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
throw new IllegalStateException(reason);
|
||||
@@ -74,6 +78,7 @@ public class TickThread extends Thread {
|
||||
}
|
||||
|
||||
public static void ensureTickThread(final Entity entity, final String reason) {
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
||||
if (!isTickThreadFor(entity)) {
|
||||
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
throw new IllegalStateException(reason);
|
||||
@@ -81,6 +86,7 @@ public class TickThread extends Thread {
|
||||
}
|
||||
|
||||
public static void ensureTickThread(final ServerLevel world, final AABB aabb, final String reason) {
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
||||
if (!isTickThreadFor(world, aabb)) {
|
||||
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
throw new IllegalStateException(reason);
|
||||
@@ -88,6 +94,7 @@ public class TickThread extends Thread {
|
||||
}
|
||||
|
||||
public static void ensureTickThread(final ServerLevel world, final double blockX, final double blockZ, final String reason) {
|
||||
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
||||
if (!isTickThreadFor(world, blockX, blockZ)) {
|
||||
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
throw new IllegalStateException(reason);
|
||||
19
patches/server/0040-Fix-teleportAsync-rotation-API.patch
Normal file
19
patches/server/0040-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) -> {
|
||||
416
patches/server/0041-Stashes.patch
Normal file
416
patches/server/0041-Stashes.patch
Normal file
@@ -0,0 +1,416 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: kugge <sofiane.djerbi38@gmail.com>
|
||||
Date: Sun, 25 Jun 2023 12:51:07 +0200
|
||||
Subject: [PATCH] Stashes
|
||||
|
||||
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityLimits.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityLimits.java
|
||||
index 9fc0823faa2a27a470adb24d688b2f9e60f628eb..a6dd123915434f9fea22e95adab5c805ce069dee 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityLimits.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityLimits.java
|
||||
@@ -2,11 +2,10 @@ package dev.kaiijumc.kaiiju;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
-import java.util.Map;
|
||||
+import java.util.Arrays;import java.util.List;import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
-import com.google.common.base.Throwables;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import io.github.classgraph.ClassGraph;
|
||||
import io.github.classgraph.ClassInfo;
|
||||
@@ -23,11 +22,11 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
public class KaiijuEntityLimits {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
||||
- protected static final String HEADER =
|
||||
- "Per region entity limits for Kaiiju.\n"
|
||||
- + "If there are more of particular entity type in a region than limit, entity ticking will be throttled.\n"
|
||||
- + "Example: for Wither limit 100 & 300 Withers in a region -> 100 Withers tick every tick & every Wither ticks every 3 ticks.\n"
|
||||
- + "Available entities: GlowSquid, Ambient, Bat, Animal, Bee, Cat, Chicken, Cod, Cow, Dolphin, Fish, FishSchool, Fox, Golem, IronGolem, "
|
||||
+ protected static final List<String> HEADER = Arrays.asList(
|
||||
+ "Per region entity limits for Kaiiju.",
|
||||
+ "If there are more of particular entity type in a region than limit, entity ticking will be throttled.",
|
||||
+ "Example: for Wither limit 100 & 300 Withers in a region -> 100 Withers tick every tick & every Wither ticks every 3 ticks.",
|
||||
+ "Available entities: GlowSquid, Ambient, Bat, Animal, Bee, Cat, Chicken, Cod, Cow, Dolphin, Fish, FishSchool, Fox, Golem, IronGolem,"
|
||||
+ "MushroomCow, Ocelot, Panda, Parrot, Perchable, Pig, PolarBear, PufferFish, Rabbit, Salmon, Sheep, Snowman, Squid, TropicalFish, Turtle, "
|
||||
+ "WaterAnimal, Wolf, Allay, Axolotl, Camel, Frog, Tadpole, Goat, Horse, HorseAbstract, HorseChestedAbstract, HorseDonkey, HorseMule, "
|
||||
+ "HorseSkeleton, HorseZombie, Llama, LlamaTrader, Sniffer, EnderCrystal, EnderDragon, Wither, ArmorStand, Hanging, ItemFrame, Leash, "
|
||||
@@ -38,8 +37,7 @@ public class KaiijuEntityLimits {
|
||||
+ "VillagerTrader, Arrow, DragonFireball, Egg, EnderPearl, EnderSignal, EvokerFangs, Fireball, FireballFireball, Fireworks, FishingHook, "
|
||||
+ "LargeFireball, LlamaSpit, Potion, Projectile, ProjectileThrowable, ShulkerBullet, SmallFireball, Snowball, SpectralArrow, ThrownExpBottle, "
|
||||
+ "ThrownTrident, TippedArrow, WitherSkull, Raider, ChestBoat, Boat, MinecartAbstract, MinecartChest, MinecartCommandBlock, MinecartContainer, "
|
||||
- + "MinecartFurnace, MinecartHopper, MinecartMobSpawner, MinecartRideable, MinecartTNT\n";
|
||||
- protected static File ENTITY_LIMITS_FILE;
|
||||
+ + "MinecartFurnace, MinecartHopper, MinecartMobSpawner, MinecartRideable, MinecartTNT");
|
||||
public static YamlConfiguration entityLimitsConfig;
|
||||
|
||||
protected static Map<Class<? extends Entity>, EntityLimit> entityLimits;
|
||||
@@ -54,36 +52,37 @@ public class KaiijuEntityLimits {
|
||||
init(entityLimitsFile, false);
|
||||
}
|
||||
|
||||
- private static void init(File entityLimitsFile, boolean setup) {
|
||||
- ENTITY_LIMITS_FILE = entityLimitsFile;
|
||||
- entityLimitsConfig = new YamlConfiguration();
|
||||
+ private static void setDefaultEntityLimits(YamlConfiguration config) {
|
||||
+ config.options().setHeader(HEADER);
|
||||
+ config.options().copyDefaults(true);
|
||||
+ config.set("Wither.brain-throttle", 50);
|
||||
+ config.set("Wither.tick-throttle", 100);
|
||||
+ config.set("Wither.removal", 500);
|
||||
+ config.set("Axolotl.brain-throttle", 100);
|
||||
+ config.set("Axolotl.tick-throttle", 200);
|
||||
+ config.set("Axolotl.removal", 1000);
|
||||
+ }
|
||||
|
||||
- if (entityLimitsFile.exists()) {
|
||||
- try {
|
||||
- entityLimitsConfig.load(ENTITY_LIMITS_FILE);
|
||||
- } catch (InvalidConfigurationException ex) {
|
||||
- Bukkit.getLogger().log(Level.SEVERE, "Could not load kaiiju-entity-limits.yml, please correct your syntax errors", ex);
|
||||
- throw Throwables.propagate(ex);
|
||||
- } catch (IOException ignore) {}
|
||||
- } else {
|
||||
- if (setup) {
|
||||
- entityLimitsConfig.options().header(HEADER);
|
||||
- entityLimitsConfig.options().copyDefaults(true);
|
||||
- entityLimitsConfig.set("Wither.tick-throttle", 1000);
|
||||
- entityLimitsConfig.set("Wither.removal", 5000);
|
||||
- entityLimitsConfig.set("Axolotl.tick-throttle", 1000);
|
||||
- entityLimitsConfig.set("Axolotl.removal", 5000);
|
||||
- try {
|
||||
- entityLimitsConfig.save(ENTITY_LIMITS_FILE);
|
||||
- } catch (IOException ex) {
|
||||
- Bukkit.getLogger().log(Level.SEVERE, "Could not save " + ENTITY_LIMITS_FILE, ex);
|
||||
- }
|
||||
- }
|
||||
+ private static void saveEntityLimitsConfig(File entityLimitsFile) {
|
||||
+ try {
|
||||
+ entityLimitsConfig.save(entityLimitsFile);
|
||||
+ } catch (IOException ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not save " + entityLimitsFile, ex);
|
||||
}
|
||||
+ }
|
||||
|
||||
- entityLimits = new Object2ObjectOpenHashMap<>();
|
||||
+ private static void loadEntityLimitsConfig(File entityLimitsFile) {
|
||||
+ try {
|
||||
+ entityLimitsConfig.load(entityLimitsFile);
|
||||
+ } catch (InvalidConfigurationException ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not load kaiiju-entity-limits.yml, please correct your syntax errors", ex);
|
||||
+ throw new RuntimeException(ex);
|
||||
+ } catch (IOException ignore) {}
|
||||
+ }
|
||||
+
|
||||
+ private static Map<String, ClassInfo> scanEntityClasses() {
|
||||
+ Map<String, ClassInfo> entityClasses = new HashMap<>();
|
||||
try (ScanResult scanResult = new ClassGraph().enableAllInfo().acceptPackages("net.minecraft.world.entity").scan()) {
|
||||
- Map<String, ClassInfo> entityClasses = new HashMap<>();
|
||||
for (ClassInfo classInfo : scanResult.getAllClasses()) {
|
||||
Class<?> entityClass = Class.forName(classInfo.getName());
|
||||
if (Entity.class.isAssignableFrom(entityClass)) {
|
||||
@@ -91,28 +90,42 @@ public class KaiijuEntityLimits {
|
||||
entityClasses.put(entityName, classInfo);
|
||||
}
|
||||
}
|
||||
+ } catch (ClassNotFoundException e) {
|
||||
+ e.printStackTrace();
|
||||
+ }
|
||||
+ return entityClasses;
|
||||
+ }
|
||||
|
||||
- for (String key : entityLimitsConfig.getKeys(false)) {
|
||||
- if (!entityClasses.containsKey(key)) {
|
||||
- LOGGER.error("Unknown entity '" + key + "' in kaiiju-entity-limits.yml, skipping");
|
||||
- continue;
|
||||
- }
|
||||
- int tickThrottle = entityLimitsConfig.getInt(key + ".tick-throttle");
|
||||
- int removal = entityLimitsConfig.getInt(key + ".removal");
|
||||
+ private static void init(File entityLimitsFile, boolean setup) {
|
||||
+ entityLimitsConfig = new YamlConfiguration();
|
||||
+
|
||||
+ if (entityLimitsFile.exists()) {
|
||||
+ loadEntityLimitsConfig(entityLimitsFile);
|
||||
+ } else if (setup) {
|
||||
+ setDefaultEntityLimits(entityLimitsConfig);
|
||||
+ saveEntityLimitsConfig(entityLimitsFile);
|
||||
+ }
|
||||
+
|
||||
+ entityLimits = new Object2ObjectOpenHashMap<>();
|
||||
+ Map<String, ClassInfo> entityClasses = scanEntityClasses();
|
||||
|
||||
- if (tickThrottle < 1) {
|
||||
- LOGGER.error(key + " has a tick-throttle less than the minimum of 1, ignoring");
|
||||
- continue;
|
||||
- }
|
||||
- if (removal <= tickThrottle && removal != -1) {
|
||||
- LOGGER.error(key + " has a removal limit that is less than or equal to its limit, setting removal to limit * 10");
|
||||
- removal = tickThrottle * 10;
|
||||
- }
|
||||
|
||||
- entityLimits.put((Class<? extends Entity>) Class.forName(entityClasses.get(key).getName()), new EntityLimit(tickThrottle, removal));
|
||||
+ for (String key : entityLimitsConfig.getKeys(false)) {
|
||||
+ if (!entityClasses.containsKey(key)) {
|
||||
+ LOGGER.error("Unknown entity '" + key + "' in kaiiju-entity-limits.yml, skipping");
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ int brainThrottle = entityLimitsConfig.getInt(key + ".brain-throttle");
|
||||
+ int tickThrottle = entityLimitsConfig.getInt(key + ".tick-throttle");
|
||||
+ int removal = entityLimitsConfig.getInt(key + ".removal");
|
||||
+
|
||||
+ try {
|
||||
+ entityLimits.put((Class<? extends Entity>) Class.forName(entityClasses.get(key).getName()),
|
||||
+ new EntityLimit(brainThrottle, tickThrottle, removal));
|
||||
+ } catch (ClassNotFoundException e) {
|
||||
+ e.printStackTrace();
|
||||
}
|
||||
- } catch (ClassNotFoundException e) {
|
||||
- e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,10 +143,12 @@ public class KaiijuEntityLimits {
|
||||
}
|
||||
}
|
||||
|
||||
- public record EntityLimit(int tickThrottle, int removal) {
|
||||
+ public record EntityLimit(int brainThrottle, int tickThrottle, int removal) {
|
||||
@Override
|
||||
public String toString() {
|
||||
- return "EntityLimit{tickThrottle=" + tickThrottle + ", removal=" + removal + "}";
|
||||
+ return "EntityLimit{brainThrottle=" + brainThrottle
|
||||
+ + ", tickThrottle=" + tickThrottle
|
||||
+ + ", removal=" + removal + "}";
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityThrottler.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityThrottler.java
|
||||
index eb690efacf083e4ff3e321578b12c534e6a40196..a89a421db9cd06bb165afd1ec28fac9b02e9b5a5 100644
|
||||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityThrottler.java
|
||||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuEntityThrottler.java
|
||||
@@ -1,79 +1,84 @@
|
||||
package dev.kaiijumc.kaiiju;
|
||||
|
||||
+import io.papermc.paper.threadedregions.RegionizedWorldData;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
-import io.papermc.paper.threadedregions.RegionizedWorldData;
|
||||
+import java.util.Map;
|
||||
|
||||
public class KaiijuEntityThrottler {
|
||||
private static class TickInfo {
|
||||
int currentTick;
|
||||
int continueFrom;
|
||||
+ int continueFromBrain;
|
||||
int toTick;
|
||||
+ int toTickBrain;
|
||||
int toRemove;
|
||||
}
|
||||
|
||||
- public static class EntityThrottlerReturn {
|
||||
- public boolean skip;
|
||||
- public boolean remove;
|
||||
+ public record EntityThrottlerReturn(boolean skipBrain, boolean skipTick, boolean remove) {
|
||||
+ public EntityThrottlerReturn() {
|
||||
+ this(false, false, false);
|
||||
+ }
|
||||
}
|
||||
|
||||
- private final Object2ObjectOpenHashMap<KaiijuEntityLimits.EntityLimit, TickInfo> entityLimitTickInfoMap = new Object2ObjectOpenHashMap<>();
|
||||
+ private final Map<KaiijuEntityLimits.EntityLimit, TickInfo> entityLimitTickInfoMap = new Object2ObjectOpenHashMap<>();
|
||||
+ private final Map<KaiijuEntityLimits.EntityLimit, EntityThrottlerReturn> entityLimitReturnMap = new Object2ObjectOpenHashMap<>();
|
||||
|
||||
public void tickLimiterStart() {
|
||||
- for (TickInfo tickInfo : entityLimitTickInfoMap.values()) {
|
||||
- tickInfo.currentTick = 0;
|
||||
- }
|
||||
+ entityLimitTickInfoMap.values().forEach(tickInfo -> tickInfo.currentTick = 0);
|
||||
}
|
||||
|
||||
- public EntityThrottlerReturn tickLimiterShouldSkip(Entity entity) {
|
||||
- EntityThrottlerReturn retVal = new EntityThrottlerReturn();
|
||||
- if (entity.isRemoved()) return retVal;
|
||||
+ public EntityThrottlerReturn tickLimiterShouldSkip(Entity entity, boolean compute) {
|
||||
+ if (entity.isRemoved()) return new EntityThrottlerReturn(true, true, true);
|
||||
KaiijuEntityLimits.EntityLimit entityLimit = KaiijuEntityLimits.getEntityLimit(entity);
|
||||
|
||||
- if (entityLimit != null) {
|
||||
- TickInfo tickInfo = entityLimitTickInfoMap.computeIfAbsent(entityLimit, el -> {
|
||||
- TickInfo newTickInfo = new TickInfo();
|
||||
- newTickInfo.toTick = entityLimit.limit();
|
||||
- return newTickInfo;
|
||||
- });
|
||||
+ if (entityLimit == null) return new EntityThrottlerReturn();
|
||||
|
||||
- tickInfo.currentTick++;
|
||||
- if (tickInfo.currentTick <= tickInfo.toRemove && entityLimit.removal() > 0) {
|
||||
- retVal.skip = false;
|
||||
- retVal.remove = true;
|
||||
- return retVal;
|
||||
- }
|
||||
+ TickInfo tickInfo = entityLimitTickInfoMap.computeIfAbsent(entityLimit, el -> {
|
||||
+ TickInfo newTickInfo = new TickInfo();
|
||||
+ newTickInfo.toTick = entityLimit.tickThrottle();
|
||||
+ return newTickInfo;
|
||||
+ });
|
||||
|
||||
- if (tickInfo.currentTick < tickInfo.continueFrom) {
|
||||
- retVal.skip = true;
|
||||
- return retVal;
|
||||
- }
|
||||
- if (tickInfo.currentTick - tickInfo.continueFrom < tickInfo.toTick) {
|
||||
- retVal.skip = false;
|
||||
- return retVal;
|
||||
- }
|
||||
- retVal.skip = true;
|
||||
- return retVal;
|
||||
- } else {
|
||||
- retVal.skip = false;
|
||||
- return retVal;
|
||||
+ if (compute) {
|
||||
+ tickInfo.currentTick++;
|
||||
+ entityLimitReturnMap.put(entityLimit, processTickInfo(tickInfo, entityLimit));
|
||||
}
|
||||
+
|
||||
+ return entityLimitReturnMap.get(entityLimit);
|
||||
+ }
|
||||
+
|
||||
+ public EntityThrottlerReturn processTickInfo(TickInfo tickInfo, KaiijuEntityLimits.EntityLimit entityLimit) {
|
||||
+ if (tickInfo.currentTick <= tickInfo.toRemove && entityLimit.removal() > 0) // Remove
|
||||
+ return new EntityThrottlerReturn(false, false, true);
|
||||
+
|
||||
+ if (tickInfo.currentTick < tickInfo.continueFrom) // Skip tick
|
||||
+ return new EntityThrottlerReturn(false, true, false);
|
||||
+
|
||||
+ if (tickInfo.currentTick - tickInfo.continueFrom < tickInfo.toTick) // Don't skip
|
||||
+ return new EntityThrottlerReturn();
|
||||
+
|
||||
+ return new EntityThrottlerReturn(false, true, false);
|
||||
}
|
||||
|
||||
- public void tickLimiterFinish(RegionizedWorldData regionizedWorldData) {
|
||||
+ public void tickLimiterFinish() {
|
||||
for (var entry : entityLimitTickInfoMap.entrySet()) {
|
||||
KaiijuEntityLimits.EntityLimit entityLimit = entry.getKey();
|
||||
TickInfo tickInfo = entry.getValue();
|
||||
|
||||
- int additionals = 0;
|
||||
+ int additionalsTick = 0;
|
||||
+ int additionalsBrain = 0;
|
||||
int nextContinueFrom = tickInfo.continueFrom + tickInfo.toTick;
|
||||
+
|
||||
if (nextContinueFrom >= tickInfo.currentTick) {
|
||||
- additionals = entityLimit.limit() - (tickInfo.currentTick - tickInfo.continueFrom);
|
||||
+ additionalsTick = entityLimit.tickThrottle() - (tickInfo.currentTick - tickInfo.continueFrom);
|
||||
+ additionalsBrain = entityLimit.brainThrottle() - (tickInfo.currentTick - tickInfo.continueFrom);
|
||||
nextContinueFrom = 0;
|
||||
}
|
||||
- tickInfo.continueFrom = nextContinueFrom;
|
||||
- tickInfo.toTick = entityLimit.limit() + additionals;
|
||||
|
||||
+ tickInfo.continueFrom = nextContinueFrom;
|
||||
+ tickInfo.toTick = entityLimit.tickThrottle() + additionalsTick;
|
||||
+ tickInfo.toTickBrain = entityLimit.brainThrottle() + additionalsBrain;
|
||||
if (tickInfo.toRemove == 0 && tickInfo.currentTick > entityLimit.removal()) {
|
||||
tickInfo.toRemove = tickInfo.currentTick - entityLimit.removal();
|
||||
} else if (tickInfo.toRemove != 0) {
|
||||
@@ -81,4 +86,30 @@ public class KaiijuEntityThrottler {
|
||||
}
|
||||
}
|
||||
}
|
||||
+ public void tickLimiterFinish() {
|
||||
+ for (var entry : entityLimitTickInfoMap.entrySet()) {
|
||||
+ KaiijuEntityLimits.EntityLimit entityLimit = entry.getKey();
|
||||
+ TickInfo tickInfo = entry.getValue();
|
||||
+
|
||||
+ int additionalsTick = 0;
|
||||
+ int additionalsBrain = 0;
|
||||
+ int nextContinueFromTick = tickInfo.continueFrom + tickInfo.toTick;
|
||||
+ int nextContinueFromBrain = tickInfo.continueFromBrain + tickInfo.toTickBrain;
|
||||
+
|
||||
+ if (nextContinueFromTick >= tickInfo.currentTick) {
|
||||
+ additionalsTick = entityLimit.tickThrottle() - tickDiff;
|
||||
+ nextContinueFromTick = 0;
|
||||
+ }
|
||||
+ if (nextContinueFromBrain >= tickInfo.currentTick) {
|
||||
+ additionalsBrain = entityLimit.brainThrottle() - tickDiff;
|
||||
+ int tickDiff = tickInfo.currentTick - tickInfo.continueFrom;
|
||||
+ }
|
||||
+
|
||||
+ tickInfo.continueFrom = nextContinueFromTick;
|
||||
+ tickInfo.toTick = entityLimit.tickThrottle() + additionalsTick;
|
||||
+ tickInfo.toTickBrain = entityLimit.brainThrottle() + additionalsBrain;
|
||||
+ tickInfo.toRemove = (tickInfo.toRemove == 0 && tickInfo.currentTick > entityLimit.removal()) ? tickInfo.currentTick - entityLimit.removal() : 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 8fd9e3cee5a671ef8425311371cde57449ef1d8e..7d29574850329205c7f989094f4e762197ccffd0 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -14,7 +14,6 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectIterator;
|
||||
-import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
@@ -132,12 +131,9 @@ import net.minecraft.world.level.chunk.storage.EntityStorage;
|
||||
import net.minecraft.world.level.dimension.BuiltinDimensionTypes;
|
||||
import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.dimension.end.EndDragonFight;
|
||||
-import net.minecraft.world.level.entity.EntityPersistentStorage;
|
||||
-import net.minecraft.world.level.entity.EntityTickList;
|
||||
import net.minecraft.world.level.entity.EntityTypeTest;
|
||||
import net.minecraft.world.level.entity.LevelCallback;
|
||||
import net.minecraft.world.level.entity.LevelEntityGetter;
|
||||
-import net.minecraft.world.level.entity.PersistentEntitySectionManager;
|
||||
import net.minecraft.world.level.gameevent.DynamicGameEventListener;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.gameevent.GameEventDispatcher;
|
||||
@@ -168,15 +164,13 @@ import org.bukkit.Location;
|
||||
import org.bukkit.WeatherType;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.generator.CustomWorldChunkManager;
|
||||
-import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
import org.bukkit.craftbukkit.util.WorldUUID;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.server.MapInitializeEvent;
|
||||
import org.bukkit.event.weather.LightningStrikeEvent;
|
||||
-import org.bukkit.event.world.GenericGameEvent;
|
||||
import org.bukkit.event.world.TimeSkipEvent;
|
||||
// CraftBukkit end
|
||||
-import it.unimi.dsi.fastutil.ints.IntArrayList; // Paper
|
||||
+
|
||||
|
||||
public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
@@ -848,8 +842,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
// Kaiiju start
|
||||
if (kaiijuConfig.enableEntityThrottling) {
|
||||
dev.kaiijumc.kaiiju.KaiijuEntityThrottler.EntityThrottlerReturn throttle = regionizedWorldData.entityThrottler.tickLimiterShouldSkip(entity);
|
||||
- if (throttle.remove) entity.remove(Entity.RemovalReason.DISCARDED);
|
||||
- if (throttle.skip) return;
|
||||
+ if (throttle.remove) {
|
||||
+ entity.remove(Entity.RemovalReason.DISCARDED);
|
||||
+ return;
|
||||
+ }
|
||||
+ if (throttle.skipTick) return;
|
||||
}
|
||||
// Kaiiju end
|
||||
gameprofilerfiller.push("tick");
|
||||
@@ -859,7 +856,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
}
|
||||
});
|
||||
- if (kaiijuConfig.enableEntityThrottling) regionizedWorldData.entityThrottler.tickLimiterFinish(regionizedWorldData); // Kaiiju
|
||||
+ if (kaiijuConfig.enableEntityThrottling) regionizedWorldData.entityThrottler.tickLimiterFinish(); // Kaiiju
|
||||
timings.entityTick.stopTiming(); // Spigot
|
||||
timings.tickEntities.stopTiming(); // Spigot
|
||||
gameprofilerfiller.pop();
|
||||
Reference in New Issue
Block a user