Add Petal patches + refactor configuration

This commit is contained in:
Arthur Blanchot
2022-07-21 19:36:05 +02:00
parent 83dc60224d
commit 70131e856d
93 changed files with 1907 additions and 1724 deletions

View File

@@ -2,7 +2,7 @@ group=wtf.etil.mirai
version=1.19-R0.1-SNAPSHOT
mcVersion=1.19
packageVersion=1_19_R1
pufferfishRef=ddbd29beb796b7878b8344543cf784794fd164eb
pufferfishRef=f6aa872dbfbb7c36c81d2043f4997c41fc0d065d
org.gradle.caching=true
org.gradle.caching.debug=false
@@ -10,4 +10,4 @@ org.gradle.configureondemand=true
org.gradle.parallel=true
org.gradle.vfs.watch=false
org.gradle.daemon=false
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Djdk.nio.maxCachedBufferSize=262144
org.gradle.jvmargs=-Dfile.encoding=UTF-8

Binary file not shown.

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

6
gradlew vendored
View File

@@ -205,6 +205,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

14
gradlew.bat vendored
View File

@@ -14,7 +14,7 @@
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,7 +25,7 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Mirai Configuration
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index e756edf56995f4552387c2e1082307eb3dd48bb3..58bb08e35e26400f967af89bfe963b23bc4ff79d 100644
index 56e261efa654e4a6872ccea28f0461df13845d13..b3421340e3cd0c091f6db2e1cb1b2f3201079a7e 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1922,6 +1922,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1937,6 +1937,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
}
// Paper end

View File

@@ -7,10 +7,10 @@ Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 3506a7fa07ee6e53704b1df8d8d2bb08704bfc37..920b55c2b9f0209490271ce416c05f7a7d8e9b13 100644
index 92a1462261029e804da73da2743bbd68e57841e9..89babe7bec9eee5034aada0907de8d1d805bcdfe 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2380,6 +2380,16 @@ public final class Bukkit {
@@ -2397,6 +2397,16 @@ public final class Bukkit {
return server.isStopping();
}
@@ -28,10 +28,10 @@ index 3506a7fa07ee6e53704b1df8d8d2bb08704bfc37..920b55c2b9f0209490271ce416c05f7a
* Returns the {@link com.destroystokyo.paper.entity.ai.MobGoals} manager
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 58bb08e35e26400f967af89bfe963b23bc4ff79d..932fea11c30ddea6e7a3bf9d4ff516a8f792849c 100644
index b3421340e3cd0c091f6db2e1cb1b2f3201079a7e..7a202fb00f0f81de8c657d60a4d0fd9d3d653e58 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2081,6 +2081,26 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2096,6 +2096,26 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
boolean isStopping();

View File

@@ -24,10 +24,10 @@ index 419aec56b0e3fa8bcec2ea7f340caa3456b57d00..8530d926931a54ed1300c40cd1e0908b
}
}
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index aed2209b66f11a0d03473cf19437f3da0e9e573a..1e482ee08b2c0b155ac0a64f0913155f9612b83f 100644
index 6aba652af2b2f054ad22c77e4e59f0ed3eddc685..8c9b19888430421a8cdef91d707fb43efc7b15ea 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -648,11 +648,15 @@ public final class SimplePluginManager implements PluginManager {
@@ -653,11 +653,15 @@ public final class SimplePluginManager implements PluginManager {
@Override
public void callEvent(@NotNull Event event) {
// Paper - replace callEvent by merging to below method

View File

@@ -7,10 +7,10 @@ Original code by Titaniumtown, licensed under GNU General Public License v3.0
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 1e482ee08b2c0b155ac0a64f0913155f9612b83f..c525e93712ceea029ed50237932d998610249205 100644
index 8c9b19888430421a8cdef91d707fb43efc7b15ea..a18724748aca4032981f1123055a9abefa77d9e1 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -647,6 +647,13 @@ public final class SimplePluginManager implements PluginManager {
@@ -652,6 +652,13 @@ public final class SimplePluginManager implements PluginManager {
*/
@Override
public void callEvent(@NotNull Event event) {
@@ -24,7 +24,7 @@ index 1e482ee08b2c0b155ac0a64f0913155f9612b83f..c525e93712ceea029ed50237932d9986
// Paper - replace callEvent by merging to below method
// KTP start - optimize spigot event bus
final boolean isAsync = event.isAsynchronous();
@@ -658,8 +665,8 @@ public final class SimplePluginManager implements PluginManager {
@@ -663,8 +670,8 @@ public final class SimplePluginManager implements PluginManager {
}
// KTP end - optimize spigot event bus

View File

@@ -6,10 +6,10 @@ Subject: [PATCH] Suspected plugins report
Added "Suspected Plugins" to Watchdog, crash reports and exception messages
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index c525e93712ceea029ed50237932d998610249205..434d7c02001d16e542fd892ded23085fcf9e78a2 100644
index a18724748aca4032981f1123055a9abefa77d9e1..cd09dcb1a41cbea5ef9f726281a82b7d362efacb 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -618,7 +618,11 @@ public final class SimplePluginManager implements PluginManager {
@@ -623,7 +623,11 @@ public final class SimplePluginManager implements PluginManager {
// Paper start
private void handlePluginException(String msg, Throwable ex, Plugin plugin) {
gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
@@ -22,7 +22,7 @@ index c525e93712ceea029ed50237932d998610249205..434d7c02001d16e542fd892ded23085f
gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin)));
}
@@ -692,7 +696,11 @@ public final class SimplePluginManager implements PluginManager {
@@ -697,7 +701,11 @@ public final class SimplePluginManager implements PluginManager {
gg.pufferfish.pufferfish.sentry.SentryContext.setEventContext(event, registration); // Pufferfish
// Paper start - error reporting
String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName();
@@ -35,7 +35,7 @@ index c525e93712ceea029ed50237932d998610249205..434d7c02001d16e542fd892ded23085f
gg.pufferfish.pufferfish.sentry.SentryContext.removeEventContext(); // Pufferfish
if (!(event instanceof com.destroystokyo.paper.event.server.ServerExceptionEvent)) { // We don't want to cause an endless event loop
callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event)));
@@ -978,4 +986,10 @@ public final class SimplePluginManager implements PluginManager {
@@ -983,4 +991,10 @@ public final class SimplePluginManager implements PluginManager {
}
// Paper end

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Mirai Branding Changes
diff --git a/build.gradle.kts b/build.gradle.kts
index a4a146d9c3e07bdf941d81147ca31daf4689a687..fb0da758cce2c7022aa23dfb3dc62f29513ba6a9 100644
index 74c91f79576e85618fefb79be8d313ba871701c7..17867a1cbf2e4aec601b2bc836a2b3a808feb5b7 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -9,7 +9,7 @@ plugins {
@@ -69,7 +69,7 @@ index b0390eedb507d27426d1e1d73bd4ab63aec89ebe..509a9a5326d94200ca3d7a83ae47c6bb
.completer(new ConsoleCommandCompleter(this.server))
.option(LineReader.Option.COMPLETE_IN_WORD, true);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e96ff8b13b1237d7c70359b78e4d72938877191f..fc3d65885cc704f807ddcb07561b4a529827166c 100644
index 7fd7c3be306d93201a61bb616f8c09cb066d4204..e995aa81665bdf582f753acec3f0584f0060c851 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1656,7 +1656,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -82,10 +82,10 @@ index e96ff8b13b1237d7c70359b78e4d72938877191f..fc3d65885cc704f807ddcb07561b4a52
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 33218552405c526955d30031469d3044c724dde3..008e8cdb9bc17bbdcd4886fca8a50311262e457e 100644
index b5de069683a615be9b9b33c3d8e61e46bbbec8e3..2aece16c65245337e59f7b08d6fcd76916055fc2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -245,7 +245,7 @@ import javax.annotation.Nullable; // Paper
@@ -246,7 +246,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {

File diff suppressed because it is too large Load Diff

View File

@@ -8,51 +8,40 @@ This patch includes code from the lithium project under the GNU Lesser General P
Original code by Titaniumtown, licensed under GNU General Public License v3.0
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
index 8ec20f17a3f8c39ae3ebf3fb630f98b35283ba88..bb220f27f5d472514d9a1620a40ed50fcb31ae16 100644
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -218,7 +218,7 @@ public class PaperCommand extends Command {
case "version":
Command ver = MinecraftServer.getServer().server.getCommandMap().getCommand("version");
if (ver != null) {
- ver.execute(sender, commandLabel, new String[0]);
+ ver.execute(sender, commandLabel, me.titaniumtown.Constants.EMPTY_string_arr); // JettPack
break;
}
// else - fall through to default
diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
index 0133ea6feb1ab88f021f66855669f58367e7420b..027b9a6a917aae43357c7a7b5595e6cf64fdbd22 100644
index 0133ea6feb1ab88f021f66855669f58367e7420b..5f4ad69862b24b568b9e907563289624d196d6ea 100644
--- a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
+++ b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
@@ -17,9 +17,7 @@ public final class EntityList implements Iterable<Entity> {
@@ -17,9 +17,9 @@ public final class EntityList implements Iterable<Entity> {
this.entityToIndex.defaultReturnValue(Integer.MIN_VALUE);
}
- protected static final Entity[] EMPTY_LIST = new Entity[0];
-
+ //protected static final Entity[] EMPTY_LIST = new Entity[0]; // JettPack
- protected Entity[] entities = EMPTY_LIST;
+ protected Entity[] entities = me.titaniumtown.Constants.EMPTY_entity_arr; // JettPack
protected int count;
public int size() {
diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java
index 277cfd9d1e8fff5d9b5e534b75c3c5162d58b0b7..52ec153be9d7177102dd137dfc356e29173f62bd 100644
index 277cfd9d1e8fff5d9b5e534b75c3c5162d58b0b7..093170c13b3980791373fb240c9ec6c5adfc1519 100644
--- a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java
+++ b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java
@@ -20,9 +20,7 @@ public final class IBlockDataList {
@@ -20,9 +20,9 @@ public final class IBlockDataList {
this.map.defaultReturnValue(Long.MAX_VALUE);
}
- private static final long[] EMPTY_LIST = new long[0];
-
+ //private static final long[] EMPTY_LIST = new long[0]; // JettPack
- private long[] byIndex = EMPTY_LIST;
+ private long[] byIndex = me.titaniumtown.Constants.EMPTY_long_arr; // JettPack
private int size;
public static int getLocationKey(final int x, final int y, final int z) {
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
index 47b5f75d9f27cf3ab947fd1f69cbd609fb9f2749..d3cdf40330a99af729412a7a537ec705c16cc327 100644
index 85882eeb86d7b74db0219aa65783946d8083885d..06bcf27bf42ad1b6259999c25fe7ae80eab1263e 100644
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
@@ -63,7 +63,7 @@ public final class ChunkEntitySlices {
@@ -64,15 +53,16 @@ index 47b5f75d9f27cf3ab947fd1f69cbd609fb9f2749..d3cdf40330a99af729412a7a537ec705
}
// Paper end - optimise CraftChunk#getEntities
@@ -189,7 +189,6 @@ public final class ChunkEntitySlices {
@@ -189,7 +189,7 @@ public final class ChunkEntitySlices {
protected static final class BasicEntityList<E extends Entity> {
- protected static final Entity[] EMPTY = new Entity[0];
+ //protected static final Entity[] EMPTY = new Entity[0]; // JettPack
protected static final int DEFAULT_CAPACITY = 4;
protected E[] storage;
@@ -200,7 +199,7 @@ public final class ChunkEntitySlices {
@@ -200,7 +200,7 @@ public final class ChunkEntitySlices {
}
public BasicEntityList(final int cap) {
@@ -81,7 +71,7 @@ index 47b5f75d9f27cf3ab947fd1f69cbd609fb9f2749..d3cdf40330a99af729412a7a537ec705
}
public boolean isEmpty() {
@@ -212,7 +211,7 @@ public final class ChunkEntitySlices {
@@ -212,7 +212,7 @@ public final class ChunkEntitySlices {
}
private void resize() {
@@ -92,15 +82,17 @@ index 47b5f75d9f27cf3ab947fd1f69cbd609fb9f2749..d3cdf40330a99af729412a7a537ec705
this.storage = Arrays.copyOf(this.storage, this.storage.length * 2);
diff --git a/src/main/java/me/titaniumtown/Constants.java b/src/main/java/me/titaniumtown/Constants.java
new file mode 100644
index 0000000000000000000000000000000000000000..1a39467fcbb849c79bea21a020b4270a2850e02c
index 0000000000000000000000000000000000000000..60bf30759a26c04c0f79ba739426aab1de955243
--- /dev/null
+++ b/src/main/java/me/titaniumtown/Constants.java
@@ -0,0 +1,14 @@
@@ -0,0 +1,16 @@
+package me.titaniumtown;
+
+import net.minecraft.core.BlockPos;
+
+public final class Constants {
+ private Constants() {}
+
+ public static final Object[] EMPTY_object_arr = new Object[0];
+ public static final int[] EMPTY_int_arr = new int[0];
+ public static final int[] ZERO_int_arr = new int[]{0};
@@ -217,7 +209,7 @@ index 0a843e0afbcb1af8e2641515eb244b791b819b8c..c420ce5c1bebdb0abe273d73a61a15e5
OptionSpec<Integer> optionspec11 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1, new Integer[0]);
OptionSpec<String> optionspec12 = optionparser.accepts("serverId").withRequiredArg();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fc3d65885cc704f807ddcb07561b4a529827166c..ed25891919bbd372b042f343d3b3360fb1654ca3 100644
index e995aa81665bdf582f753acec3f0584f0060c851..f895903aaf0a69c65947c91f7f486f04991434d8 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1371,8 +1371,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -232,10 +224,10 @@ index fc3d65885cc704f807ddcb07561b4a529827166c..ed25891919bbd372b042f343d3b3360f
ImageIO.write(bufferedimage, "PNG", bytearrayoutputstream);
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 1eb912ad97f9663bf6bd336ad739f2552b0a5c9b..9901ffe9de585a73e9ef32c700b1e8702f8786d3 100644
index 871bce7f5acc1b9a058496f41d962ec2e724f620..f4569f8e53fc22a8a580fcaebbe773b497c11304 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -303,7 +303,7 @@ public class ServerEntity {
@@ -307,7 +307,7 @@ public class ServerEntity {
if (this.entity instanceof LivingEntity) {
List<Pair<EquipmentSlot, ItemStack>> list = Lists.newArrayList();
@@ -245,7 +237,7 @@ index 1eb912ad97f9663bf6bd336ad739f2552b0a5c9b..9901ffe9de585a73e9ef32c700b1e870
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index d0cfbaf3fd5573f33ad3afc47a35157c0da5233a..1936cd779223f0ca7f6fa266725560fef40c3653 100644
index 32a39a150a3d2bbae95a726901f3f46363e34ecf..7b80dfb72b191bd86e5e4443efc87713814b6c4c 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -871,7 +871,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -267,7 +259,7 @@ index d0cfbaf3fd5573f33ad3afc47a35157c0da5233a..1936cd779223f0ca7f6fa266725560fe
return ret;
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 60373551c49386652de286127636b61f31e88527..ab084c7590ff777889dccbbb821bb099cdd7e215 100644
index 0960025c64fe2e8c055fcbf6e695ff90c1f41cd9..f4e12d6a122dc66505289651de105cfac5dd7b86 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -385,7 +385,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -433,10 +425,10 @@ index e8e60ea8b9e97ed87be78752f398ab25ba8e9a1b..9980df9128dfc51f2afbca8f4aa2031e
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
index 7fe5908020c4577c1e4d6c00af382cf536351d96..5bad71b56b45085c01ae2b0ab95067c85cad1f61 100644
index cff0ed9ae6e79f84870343e43574f384dd73ea88..79f5390cbbe014687010b110bcf572bdcff3339d 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
@@ -227,7 +227,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
@@ -233,7 +233,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
return;
}
// CraftBukkit end
@@ -512,10 +504,10 @@ index 2f9f15d99f8b31e9f13f7f32378b2a9e09bcb5e5..b9579e3d1610ddcb5251baa2dd9462e0
@Override
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index a26799f92db1699d2d5173e2e93be29273e1a317..a4e29b171a4f47bafdc9ff278ca00a071b4269c0 100644
index a2a0bc4874a031c964a5cdb5bc26494cd01351eb..670e2ae1ef532089c0ba76d96f6ca23535599b1d 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1522,7 +1522,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1521,7 +1521,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public org.bukkit.entity.Entity[] getChunkEntities(int chunkX, int chunkZ) {
io.papermc.paper.world.ChunkEntitySlices slices = this.entitySliceManager.getChunk(chunkX, chunkZ);
if (slices == null) {

View File

@@ -7,7 +7,7 @@ Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ed25891919bbd372b042f343d3b3360fb1654ca3..a9bb700ae1496e3c23a19b62fcc4233c18a0209d 100644
index f895903aaf0a69c65947c91f7f486f04991434d8..d8099a9bac8a6dc48e1096a4d0a56abfad969cd1 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1117,6 +1117,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -30,10 +30,10 @@ index ed25891919bbd372b042f343d3b3360fb1654ca3..a9bb700ae1496e3c23a19b62fcc4233c
this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTime = Math.max(Util.getMillis() + 50L, this.nextTickTime);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 14e18cf8cfbacf6cf505c6905518c3156a9f34ce..1156c758afc83a7a39910af97649cd6e5e1a70ae 100644
index 2aece16c65245337e59f7b08d6fcd76916055fc2..6275c857948dbda98fbfefbeec0843f3c42f9f40 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2896,6 +2896,12 @@ public final class CraftServer implements Server {
@@ -2902,6 +2902,12 @@ public final class CraftServer implements Server {
public CraftPotionBrewer getPotionBrewer() {
return this.potionBrewer;
}

View File

@@ -26,18 +26,18 @@ index 4030818ff51eca95e1c2ec38c7eca5bff79a0a4a..348fadecea776f2aea24664d340ce095
public void updateEntireScoreboard(ServerScoreboard scoreboard, ServerPlayer player) {
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index 5b30b329959811f99f13f32166574f90e765bcb1..ce82453b1ee3514cfbe10b94184d1c210867bed9 100644
index 50ec3059c0af3ebf561394f542d8fff1f5d66e9d..10bcda92607b04b255819a6c70358131e97baa1a 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -184,6 +184,9 @@ public class MiraiConfig {
@@ -131,4 +131,10 @@ public class MiraiConfig {
return config.getStringList(key);
}
// Mirai - settings below
-
+ public static boolean logPlayerLoginLoc = true;
+ public static boolean logPlayerLoginLoc;
+ private static void logPlayerLoc() {
+ logPlayerLoginLoc = getBoolean("log-player-login-location", logPlayerLoginLoc);
+ logPlayerLoginLoc = getBoolean("log-player-login-location", true,
+ "Whether or not player login location should be written in logs.");
+ }
+
}
\ No newline at end of file

View File

@@ -18,16 +18,18 @@ index 41c9f074203915c31c1ae7a160ce509c13383f84..ce56e8ca4b4f866eddcf0849c3b53928
public BeehiveBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntityType.BEEHIVE, pos, state);
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index ce82453b1ee3514cfbe10b94184d1c210867bed9..667eaabe95e9b44cad64dd5aba5ac693f4d726ed 100644
index 10bcda92607b04b255819a6c70358131e97baa1a..2849478bde14769d1202ca15ecaa8a341f1043a3 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -189,4 +189,9 @@ public class MiraiConfig {
logPlayerLoginLoc = getBoolean("log-player-login-location", logPlayerLoginLoc);
@@ -137,4 +137,11 @@ public class MiraiConfig {
"Whether or not player login location should be written in logs.");
}
+ public static int maxBees = 3;
+ public static int maxBees;
+ private static void maximumBees() {
+ maxBees = getInt("max-bees-in-hive", maxBees);
+ maxBees = getInt("max-bees-in-hive", 3,
+ "This value defines how many bees can fit in a hive.",
+ "Allowing more bees in a hive can reduce the number of ticking hives.");
+ }
+
}

View File

@@ -59,7 +59,7 @@ index c0fdc5a79107f8694a514a12d5526bd431fc45e9..eeb20c5b9365a04db45e738793f6c10a
public static Runnable once(Runnable run) {
AtomicBoolean ran = new AtomicBoolean(false);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 513b333a7bf8f68a2528e31d9a5e658b107b6469..e6e16685aff8266c1edd7d6e3a16e65f4dfb5162 100644
index e8aeaa1d629d3fe870bbe1c0bacbebd4fb81275e..9f6520d57840b40d506df141bdf755d593b64c27 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1017,6 +1017,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
@@ -78,7 +78,7 @@ index 513b333a7bf8f68a2528e31d9a5e658b107b6469..e6e16685aff8266c1edd7d6e3a16e65f
this.runAllTasks();
}
// Paper end
@@ -2721,6 +2723,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
@@ -2716,6 +2718,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
return;
}

View File

@@ -7,10 +7,10 @@ Original code by Titaniumtown, licensed under GNU General Public License v3.0
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 3e232156774b9df5be318dc6dc5035b326f1f1b3..43ae13cc8c3c1e7ed183d11fccba3ba3af14c8f4 100644
index ea461ff0b13a3ccba2f0ed02b9268712eaf728c1..6d98648934c23cd99694718ff52474fcba76bab4 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -402,7 +402,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -394,7 +394,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
BufferedWriter bufferedwriter = Files.newBufferedWriter(file);
try {

View File

@@ -7,11 +7,11 @@ Original code by Titaniumtown, licensed under GNU General Public License v3.0
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index c81520efe726efa7d6ac61c37f8eadc3cda5bc97..083b68897759640ca041a9d781b7ba7a07e5f8df 100644
index 1fded3a30eb934f7826d5e47659983e5b6691600..e69be14b25f2a8686473da5806c4930469e2074b 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -177,8 +177,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -176,8 +176,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
public static BlockPos lastPhysicsProblem; // Spigot
- private org.spigotmc.TickLimiter entityLimiter;
@@ -21,7 +21,7 @@ index c81520efe726efa7d6ac61c37f8eadc3cda5bc97..083b68897759640ca041a9d781b7ba7a
private int tileTickPosition;
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here
@@ -372,8 +372,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -371,8 +371,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// CraftBukkit end
timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper
@@ -33,23 +33,22 @@ index c81520efe726efa7d6ac61c37f8eadc3cda5bc97..083b68897759640ca041a9d781b7ba7a
this.entitySliceManager = new io.papermc.paper.world.EntitySliceManager((ServerLevel)this); // Paper
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index bbf15fbb889670e57bd86377590a1b3abe80b96d..5a16e64d1555a74acca98966f1a6b2269280f366 100644
index bbf15fbb889670e57bd86377590a1b3abe80b96d..ce61f9e8a835bc5e2d3815e337ed9785f9d06f04 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -435,6 +435,7 @@ public class SpigotWorldConfig
this.hangingTickFrequency = this.getInt( "hanging-tick-frequency", 100 );
}
+ /* // JettPack - remove tick limiter
+ /* JettPack - remove tick limiter
public int tileMaxTickTime;
public int entityMaxTickTime;
private void maxTickTimes()
@@ -442,7 +443,7 @@ public class SpigotWorldConfig
this.tileMaxTickTime = this.getInt("max-tick-time.tile", 50);
@@ -443,6 +444,7 @@ public class SpigotWorldConfig
this.entityMaxTickTime = this.getInt("max-tick-time.entity", 50);
this.log("Tile Max Tick Time: " + this.tileMaxTickTime + "ms Entity max Tick Time: " + this.entityMaxTickTime + "ms");
- }
+ }*/
}
+ */
public int thunderChance;
private void thunderChance()

View File

@@ -7,7 +7,7 @@ Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ab084c7590ff777889dccbbb821bb099cdd7e215..1329314774a15be493703dac0031e8849865295f 100644
index f4e12d6a122dc66505289651de105cfac5dd7b86..8058c98db187aa4525d30ac4bd1e70c6babdaa87 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -342,7 +342,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -29,18 +29,20 @@ index ab084c7590ff777889dccbbb821bb099cdd7e215..1329314774a15be493703dac0031e884
this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_VEHICLE); // Paper - use configurable kick message & kick event cause
return;
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index 667eaabe95e9b44cad64dd5aba5ac693f4d726ed..8740dbbc4068ad329eb53ee13683a77903fe6d02 100644
index 2849478bde14769d1202ca15ecaa8a341f1043a3..7ff2d1e0124757401b4e70158bbe5ada18614aa3 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -194,4 +194,11 @@ public class MiraiConfig {
maxBees = getInt("max-bees-in-hive", maxBees);
@@ -144,4 +144,13 @@ public class MiraiConfig {
"Allowing more bees in a hive can reduce the number of ticking hives.");
}
+ public static boolean checkFlying = true;
+ public static boolean checkVehicleFlying = true;
+ public static boolean checkFlying;
+ public static boolean checkVehicleFlying;
+ private static void flightChecks() {
+ checkFlying = getBoolean("checks.flight", checkFlying);
+ checkVehicleFlying = getBoolean("checks.vehicle-flight", checkVehicleFlying);
+ checkFlying = getBoolean("checks.flight", true,
+ "Whether or not vanilla anticheat should check for players flying.");
+ checkVehicleFlying = getBoolean("checks.vehicle-flight", true,
+ "Whether or not vanilla anticheat should check for passengers flying.");
+ }
+
}

View File

@@ -48,10 +48,10 @@ index db4b6d7fe91c1a071a833db842f664ec6ba51932..7502f715849fdefc96ad9808cd2070d3
public void broadcastAll(Packet<?> packet) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index abcce6bd0b32d0188751393a6f56f2e82530912c..97dab75ac1ec2b22ac00392b6b22f63fab70b17f 100644
index 287520f91e22309e1268be1940e0fafb628980a9..384d00b9e5767752ecee946c9c596ff0927b8364 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1729,7 +1729,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1736,7 +1736,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public boolean canSee(org.bukkit.entity.Entity entity) {

View File

@@ -1,21 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 15 Dec 2019 12:53:59 -0600
Subject: [PATCH] Disable outdated build check
Original code by PurpurMC, licensed under MIT
You can find the original code on https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index dab3d736ae60b255b3151ddcf2b5832c14ecef53..92331bc1893142345a5e70cc6a0c64fdb17f4b74 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -270,7 +270,7 @@ public class Main {
System.setProperty(TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper
}
- if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
+ if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { // Purpur
Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper
Calendar deadline = Calendar.getInstance();

View File

@@ -7,7 +7,7 @@ Original code by PurpurMC, licensed under MIT
You can find the original code on https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 9901ffe9de585a73e9ef32c700b1e8702f8786d3..aa1bd3423829900729d413a5f98f4a0b9aaf6135 100644
index f4569f8e53fc22a8a580fcaebbe773b497c11304..104b4f9165f417c4f71aa526e918c8e47f1c905d 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -181,6 +181,7 @@ public class ServerEntity {
@@ -40,18 +40,19 @@ index 9901ffe9de585a73e9ef32c700b1e8702f8786d3..aa1bd3423829900729d413a5f98f4a0b
+
public void removePairing(ServerPlayer player) {
this.entity.stopSeenByPlayer(player);
player.connection.send(new ClientboundRemoveEntitiesPacket(new int[]{this.entity.getId()}));
// Pufferfish start - ensure main thread
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index 8740dbbc4068ad329eb53ee13683a77903fe6d02..0d5ebaad9c3dcedf6554e41074ecaff7659ff510 100644
index 7ff2d1e0124757401b4e70158bbe5ada18614aa3..15121a29de7a5b6b6ae062449221ad586ead655e 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -201,4 +201,9 @@ public class MiraiConfig {
checkVehicleFlying = getBoolean("checks.vehicle-flight", checkVehicleFlying);
@@ -153,4 +153,10 @@ public class MiraiConfig {
"Whether or not vanilla anticheat should check for passengers flying.");
}
+ public static boolean dontSendUselessEntityPackets = true;
+ private static void dontSendUselessEntityPackets() {
+ dontSendUselessEntityPackets = getBoolean("dont-send-useless-entity-packets", dontSendUselessEntityPackets);
+ public static boolean dontSendUselessEntityPackets;
+ private static void uselessEntityPackets() {
+ dontSendUselessEntityPackets = getBoolean("dont-send-useless-entity-packets", true,
+ "Whether or not server should send entity packets with null movements.");
+ }
+
}

View File

@@ -7,10 +7,10 @@ Original code by PurpurMC, licensed under MIT
You can find the original code on https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index e6d25ab2e7e19d9fb993fdad6f650212f560cc1d..a277646003fbec7e4bc8ca301a0934eeeac1151d 100644
index beab9f74ba3c3ef294485ee74daf165475d29566..f85573a6ea0b670bb42252b17bcf88969f5521b4 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1870,6 +1870,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1871,6 +1871,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.yRotO = this.getYRot();
this.xRotO = this.getXRot();
this.setYHeadRot(yaw); // Paper - Update head rotation

View File

@@ -7,7 +7,7 @@ Original code by PurpurMC, licensed under MIT
You can find the original code on https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a3b5b52f7e597dc128281eb8ff9c60e0836bab98..531cbee70d491adf5dee3b7c3ee10d0859506245 100644
index fc37001445d50f88bc274eb501914d9db49dce40..785e9e9b4408c1193cb3680a3b55f90a8f0d5b0a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -245,6 +245,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -58,16 +58,18 @@ index a3b5b52f7e597dc128281eb8ff9c60e0836bab98..531cbee70d491adf5dee3b7c3ee10d08
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
int i = (int) (Util.getMillis() - this.keepAliveTime);
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index 0d5ebaad9c3dcedf6554e41074ecaff7659ff510..954bc508fea71af719c3203f0d4c93125976fdb8 100644
index 15121a29de7a5b6b6ae062449221ad586ead655e..eda02eabbdb3c8d2cfe8c524fe9f5dfcca1089d8 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -206,4 +206,9 @@ public class MiraiConfig {
dontSendUselessEntityPackets = getBoolean("dont-send-useless-entity-packets", dontSendUselessEntityPackets);
@@ -159,4 +159,11 @@ public class MiraiConfig {
"Whether or not server should send entity packets with null movements.");
}
+ public static boolean useAlternateKeepAlive = true;
+ private static void useAlternateKeepAlive() {
+ useAlternateKeepAlive = getBoolean("use-alternate-keepalive", useAlternateKeepAlive);
+ public static boolean useAlternateKeepAlive;
+ private static void alternateKeepAlive() {
+ useAlternateKeepAlive = getBoolean("use-alternate-keepalive", true,
+ "Whether or not server should use an alternative keepalive algorithm.",
+ "This can drastically reduce players timeouts due to a bad connection.");
+ }
+
}

View File

@@ -7,31 +7,33 @@ Original code by PurpurMC, licensed under MIT
You can find the original code on https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index de0513b38e5fa0138f1cee6bb633561be12449fc..ef0625c0f860eeedcdc1e3b8801e15631c76cb7a 100644
index de0513b38e5fa0138f1cee6bb633561be12449fc..c0325b9cb56dc09c005c277a8fdc5970b78093f8 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -185,6 +185,7 @@ public class PlayerAdvancements {
@@ -184,7 +184,7 @@ public class PlayerAdvancements {
if (advancement == null) {
// CraftBukkit start
if (entry.getKey().getNamespace().equals("minecraft")) {
+ if (!wtf.etil.mirai.MiraiConfig.loggerSuppressIgnoredAdvancementWarnings) // Purpur
- if (entry.getKey().getNamespace().equals("minecraft")) {
+ if (!wtf.etil.mirai.MiraiConfig.loggerSuppressIgnoredAdvancementWarnings && entry.getKey().getNamespace().equals("minecraft")) { // Purpur
PlayerAdvancements.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.file);
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
index f000c822ed4563b5b840936852bc7d8e030763e3..d37ba3fec0e4011629a5fbc88d377d52267ad395 100644
index f000c822ed4563b5b840936852bc7d8e030763e3..4538e459f35d2e08fbacee71cec142a2db4b1371 100644
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -293,6 +293,7 @@ public class WorldGenRegion implements WorldGenLevel {
@@ -294,7 +294,7 @@ public class WorldGenRegion implements WorldGenLevel {
return true;
} else {
+ if (!wtf.etil.mirai.MiraiConfig.loggerSuppressSetBlockFarChunk) // Purpur
// Paper start
if (!hasSetFarWarned) {
- if (!hasSetFarWarned) {
+ if (!wtf.etil.mirai.MiraiConfig.loggerSuppressSetBlockFarChunk && !hasSetFarWarned) { // Purpur
Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + pos + ", status: " + this.generatingStatus + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get()));
hasSetFarWarned = true;
if (this.getServer() != null && this.getServer().isDebugging()) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 531cbee70d491adf5dee3b7c3ee10d0859506245..3c2fc286a481fad43a3c545485ef229760b4cacf 100644
index 785e9e9b4408c1193cb3680a3b55f90a8f0d5b0a..aa5d0865f4d3c1e68f9fc06e49bea8889318371d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2182,7 +2182,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -40,18 +42,19 @@ index 531cbee70d491adf5dee3b7c3ee10d0859506245..3c2fc286a481fad43a3c545485ef2297
} else {
- if (this.isChatExpired(instant)) {
+ if (!wtf.etil.mirai.MiraiConfig.loggerSuppressSentExpiredChat && this.isChatExpired(instant)) { // Purpur
ServerGamePacketListenerImpl.LOGGER.warn("{} sent expired chat: '{}'. Is the client/server system time unsynchronized?", this.player.getName().getString(), s);
ServerGamePacketListenerImpl.LOGGER.warn("{} sent expired chat: '{}'. Is the client/server system time unsynchronized? c: {} s: {}", this.player.getName().getString(), s, instant.getEpochSecond(), Instant.now().getEpochSecond()); // Paper
}
diff --git a/src/main/java/net/minecraft/stats/ServerRecipeBook.java b/src/main/java/net/minecraft/stats/ServerRecipeBook.java
index d13ed3069e944d138442ea440ac3eaf8d44c18d3..c19367bdad3997aa7aac609762f9cf731433adfc 100644
index d13ed3069e944d138442ea440ac3eaf8d44c18d3..f87a9e76f098300f68f62ced69cf1c49aef32b69 100644
--- a/src/main/java/net/minecraft/stats/ServerRecipeBook.java
+++ b/src/main/java/net/minecraft/stats/ServerRecipeBook.java
@@ -122,6 +122,7 @@ public class ServerRecipeBook extends RecipeBook {
@@ -121,7 +121,7 @@ public class ServerRecipeBook extends RecipeBook {
ResourceLocation minecraftkey = new ResourceLocation(s);
Optional<? extends Recipe<?>> optional = recipeManager.byKey(minecraftkey);
if (!optional.isPresent()) {
+ if (!wtf.etil.mirai.MiraiConfig.loggerSuppressUnrecognizedRecipeErrors) // Purpur
- if (!optional.isPresent()) {
+ if (!wtf.etil.mirai.MiraiConfig.loggerSuppressUnrecognizedRecipeErrors && !optional.isPresent()) { // Purpur
ServerRecipeBook.LOGGER.error("Tried to load unrecognized recipe: {} removed now.", minecraftkey);
} else {
handler.accept((Recipe) optional.get());
@@ -68,24 +71,34 @@ index b2a15c986c7500a0ce227a54cb61ec3f5378f6f3..d243af83f3159d8a4d56d08dab022b31
if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDebugging()) {
new Exception().printStackTrace();
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index 954bc508fea71af719c3203f0d4c93125976fdb8..8d3dcc1ebacd86412858680a9b3f8c018890b02b 100644
index eda02eabbdb3c8d2cfe8c524fe9f5dfcca1089d8..65a77864c368545c14d1bb28fb0a91323e286158 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -211,4 +211,17 @@ public class MiraiConfig {
useAlternateKeepAlive = getBoolean("use-alternate-keepalive", useAlternateKeepAlive);
@@ -166,4 +166,27 @@ public class MiraiConfig {
"This can drastically reduce players timeouts due to a bad connection.");
}
+ public static boolean loggerSuppressInitLegacyMaterialError = true;
+ public static boolean loggerSuppressIgnoredAdvancementWarnings = true;
+ public static boolean loggerSuppressUnrecognizedRecipeErrors = true;
+ public static boolean loggerSuppressSetBlockFarChunk = true;
+ public static boolean loggerSuppressSentExpiredChat = true;
+ public static boolean loggerSuppressInitLegacyMaterialError;
+ public static boolean loggerSuppressIgnoredAdvancementWarnings;
+ public static boolean loggerSuppressUnrecognizedRecipeErrors;
+ public static boolean loggerSuppressSetBlockFarChunk;
+ public static boolean loggerSuppressSentExpiredChat;
+ private static void loggerSettings() {
+ loggerSuppressInitLegacyMaterialError = getBoolean("logger.suppress-init-legacy-material-errors", loggerSuppressInitLegacyMaterialError);
+ loggerSuppressIgnoredAdvancementWarnings = getBoolean("logger.suppress-ignored-advancement-warnings", loggerSuppressIgnoredAdvancementWarnings);
+ loggerSuppressUnrecognizedRecipeErrors = getBoolean("logger.suppress-unrecognized-recipe-errors", loggerSuppressUnrecognizedRecipeErrors);
+ loggerSuppressSetBlockFarChunk = getBoolean("logger.suppress-setblock-in-far-chunk-errors", loggerSuppressSetBlockFarChunk);
+ loggerSuppressSentExpiredChat = getBoolean("logger.suppress-sent-expired-chat", loggerSuppressSentExpiredChat);
+ loggerSuppressInitLegacyMaterialError = getBoolean("logger.suppress-init-legacy-material-errors", true,
+ "Whether or not server should stop saying",
+ "'Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!'");
+ loggerSuppressIgnoredAdvancementWarnings = getBoolean("logger.suppress-ignored-advancement-warnings", true,
+ "Whether or not server should stop saying",
+ "'Ignored advancement '{}' in progress file {} - it doesn't exist anymore?'");
+ loggerSuppressUnrecognizedRecipeErrors = getBoolean("logger.suppress-unrecognized-recipe-errors", true,
+ "Whether or not server should stop saying",
+ "'Tried to load unrecognized recipe: {} removed now.'");
+ loggerSuppressSetBlockFarChunk = getBoolean("logger.suppress-setblock-in-far-chunk-errors", true,
+ "Whether or not server should stop saying",
+ "'Detected setBlock in a far chunk.'");
+ loggerSuppressSentExpiredChat = getBoolean("logger.suppress-sent-expired-chat", true,
+ "Whether or not server should stop saying",
+ "'{} sent expired chat: '{}'. Is the client/server system time unsynchronized?'");
+ }
+
}

View File

@@ -29,7 +29,7 @@ index fa56cd09102a89692b42f1d14257990508c5c720..f9251183df72ddc56662fd3f02acf216
setListData(vector);
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e6e16685aff8266c1edd7d6e3a16e65f4dfb5162..a578b872a357b19236ef1217344d3cdeffc64f9b 100644
index 9f6520d57840b40d506df141bdf755d593b64c27..11b0d23783fed5d96bd96c24adfc9a7f353a18b3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -287,7 +287,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
@@ -71,10 +71,10 @@ index e6e16685aff8266c1edd7d6e3a16e65f4dfb5162..a578b872a357b19236ef1217344d3cde
tickSection = curTime;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 1156c758afc83a7a39910af97649cd6e5e1a70ae..6378bd16b985a36d8226f5eeee55f2c580f44739 100644
index 6275c857948dbda98fbfefbeec0843f3c42f9f40..9c1ad2fc51e7cf15aa4e6591cb2b7f4a455a6df3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2677,6 +2677,7 @@ public final class CraftServer implements Server {
@@ -2683,6 +2683,7 @@ public final class CraftServer implements Server {
@Override
public double[] getTPS() {
return new double[] {

View File

@@ -19,10 +19,10 @@ index 226a3a698e3863296481753434a716a793cb5d51..f5aca2054dcad52301b9b99e44fbd372
// CraftBukkit end
this.setLevel(worldserver);
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index a277646003fbec7e4bc8ca301a0934eeeac1151d..0317d540944f92b3486459f1db4dd3c2b4631a21 100644
index f85573a6ea0b670bb42252b17bcf88969f5521b4..884ff7229c9f2ecc9f204c488617b37543a0b033 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2856,12 +2856,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2865,12 +2865,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return Vec3.directionFromRotation(this.getRotationVector());
}
@@ -39,16 +39,18 @@ index a277646003fbec7e4bc8ca301a0934eeeac1151d..0317d540944f92b3486459f1db4dd3c2
this.isInsidePortal = true;
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index 8d3dcc1ebacd86412858680a9b3f8c018890b02b..718f8979bb801edc6310e58376f412a2c66b13a4 100644
index 65a77864c368545c14d1bb28fb0a91323e286158..3bb4fa37604543df1f3bf036fdd824ac7f87fa24 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -224,4 +224,9 @@ public class MiraiConfig {
loggerSuppressSentExpiredChat = getBoolean("logger.suppress-sent-expired-chat", loggerSuppressSentExpiredChat);
@@ -189,4 +189,11 @@ public class MiraiConfig {
"'{} sent expired chat: '{}'. Is the client/server system time unsynchronized?'");
}
+ public static boolean playerFixStuckPortal = false;
+ private static void FixStuckPortal() {
+ playerFixStuckPortal = getBoolean("player-fix-stuck-in-portal", playerFixStuckPortal);
+ public static boolean playerFixStuckPortal;
+ private static void fixStuckPortal() {
+ playerFixStuckPortal = getBoolean("player-fix-stuck-in-portal", false,
+ "Whether or not players can reset portal cooldown by",
+ "walking to another block in case they are stuck.");
+ }
+
}

View File

@@ -7,10 +7,10 @@ Original code by PurpurMC, licensed under MIT
You can find the original code on https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0317d540944f92b3486459f1db4dd3c2b4631a21..c89a3ea4a60180cd76d5b49cc0c8df975ebf4b22 100644
index 884ff7229c9f2ecc9f204c488617b37543a0b033..324c8f33355626712e2b7e0c0ca1ed3235727dc1 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2861,7 +2861,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2870,7 +2870,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (this.isOnPortalCooldown()) {
if (!(wtf.etil.mirai.MiraiConfig.playerFixStuckPortal && this instanceof Player && !pos.equals(portalPos))) // Purpur
this.setPortalCooldown();
@@ -19,7 +19,7 @@ index 0317d540944f92b3486459f1db4dd3c2b4631a21..c89a3ea4a60180cd76d5b49cc0c8df97
if (!this.level.isClientSide && !pos.equals(this.portalEntrancePos)) {
this.portalEntrancePos = pos.immutable();
portalPos = BlockPos.ZERO; // Purpur
@@ -3527,7 +3527,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3535,7 +3535,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public boolean canChangeDimensions() {
@@ -29,16 +29,17 @@ index 0317d540944f92b3486459f1db4dd3c2b4631a21..c89a3ea4a60180cd76d5b49cc0c8df97
public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index 718f8979bb801edc6310e58376f412a2c66b13a4..ceaa59b1da54daefe36cac93bfa7e8e7285203f0 100644
index 3bb4fa37604543df1f3bf036fdd824ac7f87fa24..3b9108f0cb4c6ee9fbdae34168445d78a8b4f651 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -229,4 +229,9 @@ public class MiraiConfig {
playerFixStuckPortal = getBoolean("player-fix-stuck-in-portal", playerFixStuckPortal);
@@ -196,4 +196,10 @@ public class MiraiConfig {
"walking to another block in case they are stuck.");
}
+ public static boolean entitiesCanUsePortals = true;
+ public static boolean entitiesCanUsePortals;
+ private static void entitiesPortal() {
+ entitiesCanUsePortals = getBoolean("entities-can-use-portals", entitiesCanUsePortals);
+ entitiesCanUsePortals = getBoolean("entities-can-use-portals", true,
+ "Whether or not entities should be able to use portals.");
+ }
+
}

View File

@@ -9,10 +9,10 @@ Original code by RelativityMC, licensed under MIT
You can find the original code on https://github.com/RelativityMC/VMP-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c89a3ea4a60180cd76d5b49cc0c8df975ebf4b22..fadf8ab93cd9c4a4644e06d3b77dba0aaea1f421 100644
index 324c8f33355626712e2b7e0c0ca1ed3235727dc1..ecc62a9e5379f7f9f0973f5d7d6e91bc93fb8d4c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -299,6 +299,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -300,6 +300,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public float yRotO;
public float xRotO;
private AABB bb;
@@ -20,7 +20,7 @@ index c89a3ea4a60180cd76d5b49cc0c8df975ebf4b22..fadf8ab93cd9c4a4644e06d3b77dba0a
public boolean onGround;
public boolean horizontalCollision;
public boolean verticalCollision;
@@ -1031,6 +1032,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1032,6 +1033,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// Paper end - detailed watchdog information
public void move(MoverType movementType, Vec3 movement) {
@@ -33,7 +33,7 @@ index c89a3ea4a60180cd76d5b49cc0c8df975ebf4b22..fadf8ab93cd9c4a4644e06d3b77dba0a
// Paper start - detailed watchdog information
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main");
synchronized (this.posLock) {
@@ -3732,6 +3739,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3740,6 +3747,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public final void setBoundingBox(AABB boundingBox) {

View File

@@ -7,10 +7,10 @@ Original code by Cryptite, licensed under MIT
You can find the original code on https://github.com/Cryptite/Slice
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index fadf8ab93cd9c4a4644e06d3b77dba0aaea1f421..e80ea887fc80b009c1cdced06de21f013689cfa4 100644
index ecc62a9e5379f7f9f0973f5d7d6e91bc93fb8d4c..d17c483b229df2a08b804521426472f1e7651bc8 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -877,7 +877,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -878,7 +878,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.checkOutOfWorld();
if (!this.level.isClientSide) {

View File

@@ -133,10 +133,10 @@ index 1d88edfd09a909044f6e3175af652914b4d06311..9031fb0e8c589b759549f4197772b6c9
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index aa1bd3423829900729d413a5f98f4a0b9aaf6135..d03fd8927eebb8df8697cdf7383f66b0b6576d5b 100644
index 104b4f9165f417c4f71aa526e918c8e47f1c905d..0423dff716fdd4f60b792e24a4a5a33d150e734d 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -379,7 +379,19 @@ public class ServerEntity {
@@ -383,7 +383,19 @@ public class ServerEntity {
SynchedEntityData datawatcher = this.entity.getEntityData();
if (datawatcher.isDirty()) {
@@ -158,10 +158,10 @@ index aa1bd3423829900729d413a5f98f4a0b9aaf6135..d03fd8927eebb8df8697cdf7383f66b0
if (this.entity instanceof LivingEntity) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index e80ea887fc80b009c1cdced06de21f013689cfa4..139884cead5a6d9d5b5990943e5a4ab4336ad22a 100644
index d17c483b229df2a08b804521426472f1e7651bc8..fb8fb1332b88427b7340fdeeff2024455f73f502 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3118,7 +3118,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3127,7 +3127,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID);
return;
}
@@ -184,10 +184,10 @@ index cd9cbfa5ef94994b3f7f2ecdde843620e7e6c071..b22e4068407f3012b62683abd0605098
public void startAutoSpinAttack(int riptideTicks) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 97dab75ac1ec2b22ac00392b6b22f63fab70b17f..78c42ea7bbf790cd14372d423f9999152d90fb12 100644
index 384d00b9e5767752ecee946c9c596ff0927b8364..d99c748bf5aa362d8a2cfb021a19960bf0f35ead 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2199,7 +2199,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2206,7 +2206,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.sendHealthUpdate();
}
}

View File

@@ -17,16 +17,18 @@ index 2341a5a249d455628165fc6ba508fc6d70c3dbfb..5a144c724eb6045909febf1fe3236717
blockEntity.oRot = blockEntity.rot;
Player player = world.getNearestPlayer((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 3.0D, false);
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index ceaa59b1da54daefe36cac93bfa7e8e7285203f0..d2519c1d1e87dc367b631ac1ea2d5d51af2ebb84 100644
index 3b9108f0cb4c6ee9fbdae34168445d78a8b4f651..e34fa6934a59fbead5ba4f4329a20507378e727a 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -234,4 +234,9 @@ public class MiraiConfig {
entitiesCanUsePortals = getBoolean("entities-can-use-portals", entitiesCanUsePortals);
@@ -202,4 +202,11 @@ public class MiraiConfig {
"Whether or not entities should be able to use portals.");
}
+ public static boolean bookAnimationTick = false;
+ public static boolean bookAnimationTick;
+ private static void bookTicking() {
+ bookAnimationTick = getBoolean("enchantment-table-book-animation-tick", bookAnimationTick);
+ bookAnimationTick = getBoolean("enchantment-table-book-animation-tick", false,
+ "Whether or not server should animate enchantment table book.",
+ "Disabling it can save MSPT, especially with quite a lot of enchantment tables.");
+ }
+
}

View File

@@ -1,34 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Etil <81570777+etil2jz@users.noreply.github.com>
Date: Mon, 3 Jan 2022 16:03:27 +0100
Subject: [PATCH] Configurable server metrics
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 43ae13cc8c3c1e7ed183d11fccba3ba3af14c8f4..95aa98a95cc46c4cf90822bf1a22404ab753c9dc 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -222,7 +222,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash);
thread.start(); // Paper - start console thread after MinecraftServer.console & PaperConfig are initialized
io.papermc.paper.command.PaperCommands.registerCommands(this);
- com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics();
+ if (wtf.etil.mirai.MiraiConfig.serverMetrics) com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Mirai - configurable server metrics
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
// Paper end
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index d2519c1d1e87dc367b631ac1ea2d5d51af2ebb84..4ef25b6203371b9c22275e1015ea75d870acf8da 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -239,4 +239,9 @@ public class MiraiConfig {
bookAnimationTick = getBoolean("enchantment-table-book-animation-tick", bookAnimationTick);
}
+ public static boolean serverMetrics = true;
+ private static void allowServerMetrics() {
+ serverMetrics = getBoolean("enable-server-metrics", serverMetrics);
+ }
+
}
\ No newline at end of file

View File

@@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 1936cd779223f0ca7f6fa266725560fef40c3653..20d9fe4a88c49a9952eb06ee37dbaa0f2908b0a9 100644
index 7b80dfb72b191bd86e5e4443efc87713814b6c4c..05b895c79accf2f10f54a9868e6b9c10e1e5e687 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -222,6 +222,13 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@@ -309,7 +309,7 @@ index acae3eb30e0689048937f479dc3070f0688abdad..9c2b79655f2c63a208c7087d5d897db0
int onResize(int newBits, T object);
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
index 08e1309e618377d170c446a1568c21b7bf4e5683..0b4f66d0ef963d6f47b20469b7a1e3f6c3da7c83 100644
index 18c4f815888fee0c85ebbb485d21063ce0d143fb..59bb7c4ca7202cf80493dcc8da1233c89c5cde40 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -22,8 +22,23 @@ import net.minecraft.util.Mth;
@@ -336,7 +336,7 @@ index 08e1309e618377d170c446a1568c21b7bf4e5683..0b4f66d0ef963d6f47b20469b7a1e3f6
private static final int MIN_PALETTE_BITS = 0;
private final PaletteResize<T> dummyPaletteResize = (newSize, added) -> {
return 0;
@@ -298,30 +313,54 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -299,30 +314,54 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
public synchronized PalettedContainerRO.PackedData<T> pack(IdMap<T> idMap, PalettedContainer.Strategy strategy) { // Paper - synchronize
this.acquire();
@@ -408,7 +408,7 @@ index 08e1309e618377d170c446a1568c21b7bf4e5683..0b4f66d0ef963d6f47b20469b7a1e3f6
}
private static <T> void swapPalette(int[] is, IntUnaryOperator intUnaryOperator) {
@@ -361,17 +400,37 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -362,17 +401,37 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@Override
public void count(PalettedContainer.CountConsumer<T> counter) {

View File

@@ -42,20 +42,23 @@ index f5aca2054dcad52301b9b99e44fbd3723aabdad7..f120e10679d38f3db22315f16a00622a
// CraftBukkit start - initialize oldLevel, fire PlayerLevelChangeEvent, and tick client-sided world border
if (this.oldLevel == -1) {
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index 4ef25b6203371b9c22275e1015ea75d870acf8da..4ace3c19551ea1cc5079d0570f5f0e70f1cae6a5 100644
index e34fa6934a59fbead5ba4f4329a20507378e727a..6fb5f2f9bb1dc881eff5bc4a6edfcb1d3c7dc161 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -244,4 +244,13 @@ public class MiraiConfig {
serverMetrics = getBoolean("enable-server-metrics", serverMetrics);
@@ -209,4 +209,16 @@ public class MiraiConfig {
"Disabling it can save MSPT, especially with quite a lot of enchantment tables.");
}
+ public static boolean criterionTriggerEnterBlock = true;
+ public static boolean criterionTriggerTick = true;
+ public static boolean criterionTriggerLocation = true;
+ public static boolean criterionTriggerEnterBlock;
+ public static boolean criterionTriggerTick;
+ public static boolean criterionTriggerLocation;
+ private static void criterionTriggers() {
+ criterionTriggerEnterBlock = getBoolean("criterion-trigger.enter-block", criterionTriggerEnterBlock);
+ criterionTriggerTick = getBoolean("criterion-trigger.tick", criterionTriggerTick);
+ criterionTriggerLocation = getBoolean("criterion-trigger.location", criterionTriggerLocation);
+ criterionTriggerEnterBlock = getBoolean("criterion-trigger.enter-block", true,
+ "Whether or not server should listen to block enter triggers.");
+ criterionTriggerTick = getBoolean("criterion-trigger.tick", true,
+ "Whether or not server should listen to tick triggers.");
+ criterionTriggerLocation = getBoolean("criterion-trigger.location", true,
+ "Whether or not server should listen to location triggers.");
+ }
+
}

View File

@@ -600,10 +600,10 @@ index 0000000000000000000000000000000000000000..178fc249777c9997e9586ffe099e54c9
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 139884cead5a6d9d5b5990943e5a4ab4336ad22a..4279b170440faf28a061360d40ed6303d8cc1a97 100644
index fb8fb1332b88427b7340fdeeff2024455f73f502..9d453f71b85be15b5889636569f93cc66efd6a52 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -153,9 +153,29 @@ import org.bukkit.event.entity.EntityPoseChangeEvent;
@@ -154,9 +154,29 @@ import org.bukkit.event.entity.EntityPoseChangeEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.plugin.PluginManager;
// CraftBukkit end

View File

@@ -7,10 +7,10 @@ Original code by Titaniumtown, licensed under GNU General Public License v3.0
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4279b170440faf28a061360d40ed6303d8cc1a97..9fc77dc845fc993ebb9d96f9af107f7e1e8e8a39 100644
index 9d453f71b85be15b5889636569f93cc66efd6a52..ecc7085ecb33f4a2bc08b49ca0889ca41a015c8c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1890,12 +1890,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1891,12 +1891,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
}
@@ -30,7 +30,7 @@ index 4279b170440faf28a061360d40ed6303d8cc1a97..9fc77dc845fc993ebb9d96f9af107f7e
public void absMoveTo(double x, double y, double z, float yaw, float pitch) {
this.absMoveTo(x, y, z);
this.setYRot(yaw % 360.0F);
@@ -4317,6 +4323,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4325,6 +4331,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
// Paper end - block invalid positions

View File

@@ -7,7 +7,7 @@ Original code by PurpurMC, licensed under MIT
You can find the original code on https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index e134963fa97ea886c7cf4af8ab0ba53b6010fe41..1b731114520a1607b5c42774d86d9ed51f21da3f 100644
index b7f56d1909272bb02591b6e08aed78943ab96ba1..c67c7ba95537ff39bf4a4f4c490698b49dcb0849 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1826,7 +1826,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

View File

@@ -12,14 +12,15 @@ doing questionable/buggy ones, and claiming breathtaking performance improvement
any of those Spigot forks!
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9fc77dc845fc993ebb9d96f9af107f7e1e8e8a39..6b4370f8dffdaebb861ec59d0dad3fe54c696083 100644
index ecc7085ecb33f4a2bc08b49ca0889ca41a015c8c..c7c4f4489f9226d87b6d9f0f77d25806e8d80b75 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1224,7 +1224,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1225,7 +1225,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
this.tryCheckInsideBlocks();
- float f2 = this.getBlockSpeedFactor();
+ // NFT-Worlds start
+ float f2;
+ if (wtf.etil.mirai.MiraiConfig.fastSpeedCheck) {
+ if (this.getDeltaMovement().x == 0 && this.getDeltaMovement().z == 0) {
@@ -30,20 +31,23 @@ index 9fc77dc845fc993ebb9d96f9af107f7e1e8e8a39..6b4370f8dffdaebb861ec59d0dad3fe5
+ } else {
+ f2 = this.getBlockSpeedFactor();
+ }
+ // NFT-Worlds stop
this.setDeltaMovement(this.getDeltaMovement().multiply((double) f2, 1.0D, (double) f2));
// Paper start - remove expensive streams from here
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index 4ace3c19551ea1cc5079d0570f5f0e70f1cae6a5..4da53712474506e80c265ee38e1e1e88f51e3ec9 100644
index 6fb5f2f9bb1dc881eff5bc4a6edfcb1d3c7dc161..04d08c44f56a4af207b8240ca1d9d34790ead16d 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -253,4 +253,9 @@ public class MiraiConfig {
criterionTriggerLocation = getBoolean("criterion-trigger.location", criterionTriggerLocation);
@@ -221,4 +221,11 @@ public class MiraiConfig {
"Whether or not server should listen to location triggers.");
}
+ public static boolean fastSpeedCheck = true;
+ public static boolean fastSpeedCheck;
+ private static void speedCheck() {
+ fastSpeedCheck = getBoolean("fast-speed-check", fastSpeedCheck);
+ fastSpeedCheck = getBoolean("fast-speed-check", true,
+ "Whether or not server should use a faster method",
+ "to check when entity delta movement is null.");
+ }
+
}

View File

@@ -106,7 +106,7 @@ index 0000000000000000000000000000000000000000..c99eff34c1be07508c88fe9525c3ae1a
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
index d37ba3fec0e4011629a5fbc88d377d52267ad395..4967605f46a58ad9888c6a997f950f50d1bd5d1e 100644
index 4538e459f35d2e08fbacee71cec142a2db4b1371..d9444afba8c65c9e1591726e0e1c7ba7b6749ff0 100644
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -53,6 +53,7 @@ import net.minecraft.world.phys.Vec3;

View File

@@ -9,7 +9,7 @@ Original code by RelativityMC, licensed under MIT
You can find the original code on https://github.com/RelativityMC/VMP-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 1b731114520a1607b5c42774d86d9ed51f21da3f..3b70c7fc90b9495536a5eaf35a9c5483bd42ec55 100644
index c67c7ba95537ff39bf4a4f4c490698b49dcb0849..a596cbae5981953aa0813ddfedb4cd3677e3d8f6 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -114,6 +114,7 @@ import org.bukkit.craftbukkit.generator.CustomChunkGenerator;

View File

@@ -9,10 +9,10 @@ Original license: GNU Lesser General Public License v3.0
Original project: https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6b4370f8dffdaebb861ec59d0dad3fe54c696083..20d6e75850bb5b7c19dabce78c20e484956fa2f6 100644
index c7c4f4489f9226d87b6d9f0f77d25806e8d80b75..5dc113137840ffe943f4f9c9f50a78b57d990af1 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2606,39 +2606,64 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2617,39 +2617,64 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return !this.isRemoved();
}

View File

@@ -5,10 +5,28 @@ Subject: [PATCH] Optimize default values for configs
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
index a125abc75ed2bbd905c8fdec442416a45264f531..70b100822193486a63c84bda23398ae8aac3a51d 100644
index 09827eaa9f6adf49385a33aa60b3a6bf4005a982..49fa028efe1a34d9f37b95866c0824fcf210f338 100644
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
@@ -216,8 +216,10 @@ public class PufferfishConfig {
@@ -216,7 +216,7 @@ public class PufferfishConfig {
public static boolean enableAsyncEntityTracker;
public static boolean enableAsyncEntityTrackerInitialized;
private static void asyncEntityTracker() {
- boolean temp = getBoolean("enable-async-entity-tracker", false,
+ boolean temp = getBoolean("enable-async-entity-tracker", true, // Mirai - optimize default values for configs
"Whether or not async entity tracking should be enabled.");
if (!enableAsyncEntityTrackerInitialized) {
enableAsyncEntityTrackerInitialized = true;
@@ -227,7 +227,7 @@ public class PufferfishConfig {
public static boolean enableAsyncPathfinding;
public static boolean enableAsyncPathfindingInitialized;
private static void asyncPathfinding() {
- boolean temp = getBoolean("enable-async-pathfinding", false,
+ boolean temp = getBoolean("enable-async-pathfinding", true, // Mirai - optimize default values for configs
"Whether or not async pathfinding should be enabled.");
if (!enableAsyncPathfindingInitialized) {
enableAsyncPathfindingInitialized = true;
@@ -238,8 +238,10 @@ public class PufferfishConfig {
public static int maxProjectileLoadsPerTick;
public static int maxProjectileLoadsPerProjectile;
private static void projectileLoading() {
@@ -21,7 +39,7 @@ index a125abc75ed2bbd905c8fdec442416a45264f531..70b100822193486a63c84bda23398ae8
setComment("projectile", "Optimizes projectile settings");
}
@@ -235,10 +237,10 @@ public class PufferfishConfig {
@@ -257,10 +259,10 @@ public class PufferfishConfig {
"This value determines how far away an entity has to be",
"from the player to start being effected by DEAR.");
startDistanceSquared = startDistance * startDistance;
@@ -69,7 +87,7 @@ index bc72131afa1ae9986ee311a9b371e97c8feb38f8..c54341d03a1ef78d075236968a000e00
public boolean useDimensionTypeForCustomSpawners = false;
public boolean strictAdvancementDimensionCheck = false;
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
index 32f0cd29d1198fe320d10ccfe0b02f8632ac12aa..d503fd87f968354c1473dbe1679a6071dee523fc 100644
index e2c612dd55fcb2769fb06f7878b8d0873f2be139..102468a21cd8386f6505b8e3982349c1e7a9943b 100644
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
@@ -114,8 +114,10 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -85,15 +103,6 @@ index 32f0cd29d1198fe320d10ccfe0b02f8632ac12aa..d503fd87f968354c1473dbe1679a6071
}
public Spawning spawning;
@@ -174,7 +176,7 @@ public class WorldConfiguration extends ConfigurationPart {
public boolean allChunksAreSlimeChunks = false;
@Constraint(Constraints.BelowZeroDoubleToDefault.class)
public DoubleOrDefault skeletonHorseThunderSpawnChance = DoubleOrDefault.USE_DEFAULT;
- public boolean ironGolemsCanSpawnInAir = false;
+ public boolean ironGolemsCanSpawnInAir = true; // Mirai - optimize default values for configs
public boolean countAllMobsForSpawning = false;
public int monsterSpawnMaxLightLevel = -1;
public DuplicateUUID duplicateUuid;
@@ -198,8 +200,10 @@ public class WorldConfiguration extends ConfigurationPart {
public Behavior behavior;
@@ -137,7 +146,7 @@ index 32f0cd29d1198fe320d10ccfe0b02f8632ac12aa..d503fd87f968354c1473dbe1679a6071
public boolean allowPlayerCrammingDamage = false;
}
@@ -399,18 +403,34 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -399,18 +403,33 @@ public class WorldConfiguration extends ConfigurationPart {
public class Chunks extends ConfigurationPart {
public AutosavePeriod autoSaveInterval = AutosavePeriod.def();
@@ -151,7 +160,7 @@ index 32f0cd29d1198fe320d10ccfe0b02f8632ac12aa..d503fd87f968354c1473dbe1679a6071
+ public Duration delayChunkUnloadsBy = Duration.of("5s");
+ // Mirai end
public Reference2IntMap<EntityType<?>> entityPerChunkSaveLimit = Util.make(new Reference2IntOpenHashMap<>(Registry.ENTITY_TYPE.size()), map -> {
map.defaultReturnValue(-1);
- map.defaultReturnValue(-1);
- map.put(EntityType.EXPERIENCE_ORB, -1);
- map.put(EntityType.SNOWBALL, -1);
- map.put(EntityType.ENDER_PEARL, -1);
@@ -181,7 +190,7 @@ index 32f0cd29d1198fe320d10ccfe0b02f8632ac12aa..d503fd87f968354c1473dbe1679a6071
});
}
@@ -424,11 +444,22 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -424,11 +443,22 @@ public class WorldConfiguration extends ConfigurationPart {
public TickRates tickRates;
public class TickRates extends ConfigurationPart {
@@ -209,7 +218,7 @@ index 32f0cd29d1198fe320d10ccfe0b02f8632ac12aa..d503fd87f968354c1473dbe1679a6071
}
@Setting(FeatureSeedsGeneration.FEATURE_SEEDS_KEY)
@@ -436,7 +467,7 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -436,7 +466,7 @@ public class WorldConfiguration extends ConfigurationPart {
public class FeatureSeeds extends ConfigurationPart.Post {
@Setting(FeatureSeedsGeneration.GENERATE_KEY)
@@ -218,7 +227,7 @@ index 32f0cd29d1198fe320d10ccfe0b02f8632ac12aa..d503fd87f968354c1473dbe1679a6071
@Setting(FeatureSeedsGeneration.FEATURES_KEY)
public Reference2LongMap<Holder<ConfiguredFeature<?, ?>>> features = new Reference2LongOpenHashMap<>();
@@ -450,9 +481,9 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -450,9 +480,9 @@ public class WorldConfiguration extends ConfigurationPart {
public class Misc extends ConfigurationPart {
public int lightQueueSize = 20;
@@ -244,7 +253,7 @@ index 5d162f59fc5ef9adf7fa762b137bbcfca745d9c5..c7c8a77e3af96720434e361b04186d57
public static double movedWronglyThreshold;
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 5a16e64d1555a74acca98966f1a6b2269280f366..75584d048d6fe154fc80e5132e72b03fd707d104 100644
index ce61f9e8a835bc5e2d3815e337ed9785f9d06f04..217c8f8364ba8d1e509dea9ec0de4b6832db8a51 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -150,14 +150,14 @@ public class SpigotWorldConfig
@@ -286,11 +295,10 @@ index 5a16e64d1555a74acca98966f1a6b2269280f366..75584d048d6fe154fc80e5132e72b03f
- public int miscActivationRange = 16;
+ public int miscActivationRange = 8;
// Paper start
- public int flyingMonsterActivationRange = 32;
public int flyingMonsterActivationRange = 32;
- public int waterActivationRange = 16;
- public int villagerActivationRange = 32;
- public int wakeUpInactiveAnimals = 4;
+ public int flyingMonsterActivationRange = 48;
+ public int waterActivationRange = 8;
+ public int villagerActivationRange = 16;
+ public int wakeUpInactiveAnimals = 2;

View File

@@ -27,16 +27,18 @@ index 67b88da702b780f79c0496cb17f1e6f1f8dd6c2b..712707da510977bfa1ce4b991fd8a8f5
// CraftBukkit start
java.util.Collection<MapDecoration> icons = new java.util.ArrayList<MapDecoration>();
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index 4da53712474506e80c265ee38e1e1e88f51e3ec9..ea398d72cdbec80add81971f3cf34b750e9448ae 100644
index 04d08c44f56a4af207b8240ca1d9d34790ead16d..0e1ff578af49eaa44508119b16fae67744041150 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -258,4 +258,9 @@ public class MiraiConfig {
fastSpeedCheck = getBoolean("fast-speed-check", fastSpeedCheck);
@@ -228,4 +228,11 @@ public class MiraiConfig {
"to check when entity delta movement is null.");
}
+ public static int mapUpdateInterval = 5;
+ public static int mapUpdateInterval;
+ private static void mapUpdate() {
+ mapUpdateInterval = getInt("map-update-interval", mapUpdateInterval);
+ mapUpdateInterval = getInt("map-update-interval", 5,
+ "This value defines how often a map refresh, in tick.",
+ "A second is 20 ticks.");
+ }
+
}

View File

@@ -8,10 +8,10 @@ Original license: GPLv3
Original project: https://github.com/Akarin-project/Akarin
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 20d6e75850bb5b7c19dabce78c20e484956fa2f6..c5dd7a8f8bf3f294266d17eea3a09c0ed7866957 100644
index 5dc113137840ffe943f4f9c9f50a78b57d990af1..a02b8f64502326efa758bfa3bb861dc0a77dec65 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2006,8 +2006,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2009,8 +2009,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public void playerTouch(Player player) {}
public void push(Entity entity) {

View File

@@ -7,10 +7,10 @@ Original license: GPLv3
Original project: https://github.com/Electroid/SportPaper
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index d03fd8927eebb8df8697cdf7383f66b0b6576d5b..adbc648ab5465b3808b19481650170a8cb57ace3 100644
index 0423dff716fdd4f60b792e24a4a5a33d150e734d..bcaa1033f570b1934a770bc51b3a49ef634abcf1 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -342,8 +342,10 @@ public class ServerEntity {
@@ -346,8 +346,10 @@ public class ServerEntity {
}
// CraftBukkit start - Fix for nonsensical head yaw

View File

@@ -7,7 +7,7 @@ Original license: GPLv3
Original project: https://github.com/Electroid/SportPaper
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 20d9fe4a88c49a9952eb06ee37dbaa0f2908b0a9..da074718d933e5460f126bc5c24ba18765e776eb 100644
index 05b895c79accf2f10f54a9868e6b9c10e1e5e687..50daf0762ae2eded8e5e42db12bcdb06ed183225 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1539,6 +1539,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@@ -10,7 +10,7 @@ Copyright (c) 2020 Fx Morin
diff --git a/src/main/java/carpetfixes/helpers/FastMath.java b/src/main/java/carpetfixes/helpers/FastMath.java
new file mode 100644
index 0000000000000000000000000000000000000000..409475deb22ae19d77c9125531ede823997bb452
index 0000000000000000000000000000000000000000..2f48a1c71356f7ebc00aaa44b28f6e10b2de1dee
--- /dev/null
+++ b/src/main/java/carpetfixes/helpers/FastMath.java
@@ -0,0 +1,59 @@
@@ -73,27 +73,9 @@ index 0000000000000000000000000000000000000000..409475deb22ae19d77c9125531ede823
+ }
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
index bb220f27f5d472514d9a1620a40ed50fcb31ae16..9ec0d9c79413654436082aef93c416e7d7fb9125 100644
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -734,12 +734,12 @@ public class PaperCommand extends Command {
++relitChunks[0];
sender.getBukkitEntity().sendMessage(text().color(DARK_AQUA).append(
text("Relit chunk ", BLUE), text(chunkPos.toString()),
- text(", progress: ", BLUE), text((int)(Math.round(100.0 * (double)(relitChunks[0])/(double)pending[0])) + "%")
+ text(", progress: ", BLUE), text((int)(carpetfixes.helpers.FastMath.round(100.0 * (double)(relitChunks[0])/(double)pending[0])) + "%") // Mirai
));
},
(int totalRelit) -> {
final long end = System.nanoTime();
- final long diff = Math.round(1.0e-6*(end - start));
+ final long diff = carpetfixes.helpers.FastMath.round(1.0e-6*(end - start)); // Mirai
sender.getBukkitEntity().sendMessage(text().color(DARK_AQUA).append(
text("Relit ", BLUE), text(totalRelit),
text(" chunks. Took ", BLUE), text(diff + "ms")
\ No newline at end of file
diff --git a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
index f9251183df72ddc56662fd3f02acf21641a2200c..525bbe1a07025179cb32d9182fdde1d472b5852e 100644
index f9251183df72ddc56662fd3f02acf21641a2200c..ea1bad145e529ac36bf335cf4d5339b2d88b282f 100644
--- a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
+++ b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
@@ -81,6 +81,6 @@ public class RAMDetails extends JList<String> {
@@ -101,11 +83,11 @@ index f9251183df72ddc56662fd3f02acf21641a2200c..525bbe1a07025179cb32d9182fdde1d4
private static String format(double tps) {
- return ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 );
+ return ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( carpetfixes.helpers.FastMath.round( tps * 100.0 ) / 100.0, 20.0 ); // Mirai
+ return ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( carpetfixes.helpers.FastMath.round( tps * 100.0 ) / 100.0, 20.0 );
}
}
diff --git a/src/main/java/com/destroystokyo/paper/gui/RAMGraph.java b/src/main/java/com/destroystokyo/paper/gui/RAMGraph.java
index c3e54da4ab6440811aab2f9dd1e218802ac13285..db1319c51a5410ee106d023fce759f1e390872e2 100644
index c3e54da4ab6440811aab2f9dd1e218802ac13285..2a38ea32f2d4a01be556fdf11254d5910c54f997 100644
--- a/src/main/java/com/destroystokyo/paper/gui/RAMGraph.java
+++ b/src/main/java/com/destroystokyo/paper/gui/RAMGraph.java
@@ -128,7 +128,7 @@ public class RAMGraph extends JComponent {
@@ -113,12 +95,12 @@ index c3e54da4ab6440811aab2f9dd1e218802ac13285..db1319c51a5410ee106d023fce759f1e
graphics.fillOval(m.x - 2, 100 - used - 2, 5, 5);
setToolTipText(String.format("<html><body>Used: %s mb (%s%%)<br/>%s</body></html>",
- Math.round(data.getUsedMem() / 1024F / 1024F),
+ carpetfixes.helpers.FastMath.round(data.getUsedMem() / 1024F / 1024F), // Mirai
+ carpetfixes.helpers.FastMath.round(data.getUsedMem() / 1024F / 1024F),
used, getTime(m.x)));
}
}
diff --git a/src/main/java/gg/pufferfish/pufferfish/flare/collectors/TPSCollector.java b/src/main/java/gg/pufferfish/pufferfish/flare/collectors/TPSCollector.java
index 40447d00aefb5ffedb8a2ee87155a04088f0649f..633a6e313174244cf13ed89b53893ea5900e2828 100644
index 40447d00aefb5ffedb8a2ee87155a04088f0649f..31cc0a29e89e79f616b3ee329a5528961edaa2de 100644
--- a/src/main/java/gg/pufferfish/pufferfish/flare/collectors/TPSCollector.java
+++ b/src/main/java/gg/pufferfish/pufferfish/flare/collectors/TPSCollector.java
@@ -25,7 +25,7 @@ public class TPSCollector extends LiveCollector {
@@ -127,12 +109,12 @@ index 40447d00aefb5ffedb8a2ee87155a04088f0649f..633a6e313174244cf13ed89b53893ea5
- this.report(TPS, Math.min(20D, Math.round(Bukkit.getServer().getTPS()[0] * 100d) / 100d));
- this.report(MSPT, (double) Math.round(mspt * 100d) / 100d);
+ this.report(TPS, Math.min(20D, carpetfixes.helpers.FastMath.round(Bukkit.getServer().getTPS()[0] * 100d) / 100d)); // Mirai
+ this.report(MSPT, (double) carpetfixes.helpers.FastMath.round(mspt * 100d) / 100d); // Mirai
+ this.report(TPS, Math.min(20D, carpetfixes.helpers.FastMath.round(Bukkit.getServer().getTPS()[0] * 100d) / 100d));
+ this.report(MSPT, (double) carpetfixes.helpers.FastMath.round(mspt * 100d) / 100d);
}
}
diff --git a/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
index b53402903eb6845df361daf6b05a668608ad7b63..0d43afcdd5db346d0ddf82e06bad5b219721715c 100644
index b53402903eb6845df361daf6b05a668608ad7b63..df60ee5ec4f98e815499dd1dfe94a0b62d1f1fbf 100644
--- a/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
+++ b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
@@ -387,11 +387,11 @@ public final class PlayerChunkLoader {
@@ -140,30 +122,62 @@ index b53402903eb6845df361daf6b05a668608ad7b63..0d43afcdd5db346d0ddf82e06bad5b21
protected long getTargetSendPerPlayerAddend() {
- return GlobalConfiguration.get().chunkLoading.targetPlayerChunkSendRate <= 1.0 ? 0L : (long)Math.round(1.0e9 / GlobalConfiguration.get().chunkLoading.targetPlayerChunkSendRate);
+ return GlobalConfiguration.get().chunkLoading.targetPlayerChunkSendRate <= 1.0 ? 0L : (long)carpetfixes.helpers.FastMath.round(1.0e9 / GlobalConfiguration.get().chunkLoading.targetPlayerChunkSendRate); // Mirai
+ return GlobalConfiguration.get().chunkLoading.targetPlayerChunkSendRate <= 1.0 ? 0L : (long)carpetfixes.helpers.FastMath.round(1.0e9 / GlobalConfiguration.get().chunkLoading.targetPlayerChunkSendRate);
}
protected long getMaxSendAddend() {
- return GlobalConfiguration.get().chunkLoading.globalMaxChunkSendRate <= 1.0 ? 0L : (long)Math.round(1.0e9 / GlobalConfiguration.get().chunkLoading.globalMaxChunkSendRate);
+ return GlobalConfiguration.get().chunkLoading.globalMaxChunkSendRate <= 1.0 ? 0L : (long)carpetfixes.helpers.FastMath.round(1.0e9 / GlobalConfiguration.get().chunkLoading.globalMaxChunkSendRate); // Mirai
+ return GlobalConfiguration.get().chunkLoading.globalMaxChunkSendRate <= 1.0 ? 0L : (long)carpetfixes.helpers.FastMath.round(1.0e9 / GlobalConfiguration.get().chunkLoading.globalMaxChunkSendRate);
}
public void onChunkPlayerTickReady(final int chunkX, final int chunkZ) {
diff --git a/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java b/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
index 68645bbbab9b4225048b647252d8f462028a9c84..725f532ce4479cf059b3f749eb01372179056581 100644
--- a/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
+++ b/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
@@ -105,12 +105,12 @@ public final class FixLightCommand implements PaperSubcommand {
++relitChunks[0];
sender.getBukkitEntity().sendMessage(text().color(DARK_AQUA).append(
text("Relit chunk ", BLUE), text(chunkPos.toString()),
- text(", progress: ", BLUE), text((int) (Math.round(100.0 * (double) (relitChunks[0]) / (double) pending[0])) + "%")
+ text(", progress: ", BLUE), text((int) (carpetfixes.helpers.FastMath.round(100.0 * (double) (relitChunks[0]) / (double) pending[0])) + "%")
));
},
(int totalRelit) -> {
final long end = System.nanoTime();
- final long diff = Math.round(1.0e-6 * (end - start));
+ final long diff = carpetfixes.helpers.FastMath.round(1.0e-6 * (end - start));
sender.getBukkitEntity().sendMessage(text().color(DARK_AQUA).append(
text("Relit ", BLUE), text(totalRelit),
text(" chunks. Took ", BLUE), text(diff + "ms")
diff --git a/src/main/java/io/papermc/paper/command/subcommands/VersionCommand.java b/src/main/java/io/papermc/paper/command/subcommands/VersionCommand.java
index ae60bd96b5284d54676d8e7e4dd5d170b526ec1e..2344ea858eda8e54c2eb3ccbdad464ed5934650c 100644
--- a/src/main/java/io/papermc/paper/command/subcommands/VersionCommand.java
+++ b/src/main/java/io/papermc/paper/command/subcommands/VersionCommand.java
@@ -14,7 +14,7 @@ public final class VersionCommand implements PaperSubcommand {
public boolean execute(final CommandSender sender, final String subCommand, final String[] args) {
final @Nullable Command ver = MinecraftServer.getServer().server.getCommandMap().getCommand("version");
if (ver != null) {
- ver.execute(sender, "paper", new String[0]);
+ ver.execute(sender, "paper", me.titaniumtown.Constants.EMPTY_string_arr); // JettPack
}
return true;
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a578b872a357b19236ef1217344d3cdeffc64f9b..d565a12648d92b1d446a3b8b38b1e92520954254 100644
index 11b0d23783fed5d96bd96c24adfc9a7f353a18b3..834ad81056c5a22921495c22d410bdf11666b87e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2749,7 +2749,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
@@ -2744,7 +2744,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
}
double overuseCount = (double)overuse/(double)MAX_CHUNK_EXEC_TIME;
- long extraSleep = (long)Math.round(overuseCount*CHUNK_TASK_QUEUE_BACKOFF_MIN_TIME);
+ long extraSleep = (long)carpetfixes.helpers.FastMath.round(overuseCount*CHUNK_TASK_QUEUE_BACKOFF_MIN_TIME); // Mirai
+ long extraSleep = (long)carpetfixes.helpers.FastMath.round(overuseCount*CHUNK_TASK_QUEUE_BACKOFF_MIN_TIME);
lastMidTickExecute = currTime + extraSleep;
return;
diff --git a/src/main/java/net/minecraft/server/gui/StatsComponent.java b/src/main/java/net/minecraft/server/gui/StatsComponent.java
index 88f10d729aa1e0a01790521821d691a0ecd373a2..45b2aa542969798a5a3b73af78de21ccc57bcca1 100644
index 88f10d729aa1e0a01790521821d691a0ecd373a2..df2c8dffd626eab0e03b1b62940a52fa83f6edaf 100644
--- a/src/main/java/net/minecraft/server/gui/StatsComponent.java
+++ b/src/main/java/net/minecraft/server/gui/StatsComponent.java
@@ -88,7 +88,7 @@ public class StatsComponent extends JComponent {
@@ -171,7 +185,7 @@ index 88f10d729aa1e0a01790521821d691a0ecd373a2..45b2aa542969798a5a3b73af78de21cc
// Paper - start Add tps entry
private static String format(double tps) {
- return (( tps > 21.0 ) ? "*" : "") + Math.min(Math.round(tps * 100.0) / 100.0, 20.0); // only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
+ return (( tps > 21.0 ) ? "*" : "") + Math.min(carpetfixes.helpers.FastMath.round(tps * 100.0) / 100.0, 20.0); // only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise // Mirai
+ return (( tps > 21.0 ) ? "*" : "") + Math.min(carpetfixes.helpers.FastMath.round(tps * 100.0) / 100.0, 20.0); // only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
}
// Paper end
}
@@ -188,7 +202,7 @@ index a4a6885bea59210192e8a2ce8834372275e7ceb3..6fb805ba6afa000e215e4b7c8da29bf5
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 10fe0a33e7d2663e27413b3affe035e91de37255..64f268e7b0d7029c330036817db4ce086bd336a6 100644
index 10fe0a33e7d2663e27413b3affe035e91de37255..af8012ad3acb294806a18b6aa4fadb1d3fec6b33 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1496,7 +1496,7 @@ public abstract class LivingEntity extends Entity {
@@ -196,7 +210,7 @@ index 10fe0a33e7d2663e27413b3affe035e91de37255..64f268e7b0d7029c330036817db4ce08
CriteriaTriggers.ENTITY_HURT_PLAYER.trigger((ServerPlayer) this, source, f1, amount, flag);
if (f2 > 0.0F && f2 < 3.4028235E37F) {
- ((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, Math.round(f2 * 10.0F));
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, carpetfixes.helpers.FastMath.round(f2 * 10.0F)); // Mirai
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, carpetfixes.helpers.FastMath.round(f2 * 10.0F));
}
}
@@ -205,10 +219,10 @@ index 10fe0a33e7d2663e27413b3affe035e91de37255..64f268e7b0d7029c330036817db4ce08
if (f3 > 0.0F && f3 < 3.4028235E37F) {
if (this instanceof ServerPlayer) {
- ((ServerPlayer) this).awardStat(Stats.DAMAGE_RESISTED, Math.round(f3 * 10.0F));
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F)); // Mirai
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F));
} else if (source.getEntity() instanceof ServerPlayer) {
- ((ServerPlayer) source.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, Math.round(f3 * 10.0F));
+ ((ServerPlayer) source.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F)); // Mirai
+ ((ServerPlayer) source.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F));
}
}
}
@@ -217,10 +231,10 @@ index 10fe0a33e7d2663e27413b3affe035e91de37255..64f268e7b0d7029c330036817db4ce08
if (f3 > 0.0F && f3 < 3.4028235E37F) {
if (this instanceof ServerPlayer) {
- ((ServerPlayer) this).awardStat(Stats.DAMAGE_RESISTED, Math.round(f3 * 10.0F));
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F)); // Mirai
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F));
} else if (damagesource.getEntity() instanceof ServerPlayer) {
- ((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, Math.round(f3 * 10.0F));
+ ((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F)); // Mirai
+ ((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F));
}
}
}
@@ -229,11 +243,11 @@ index 10fe0a33e7d2663e27413b3affe035e91de37255..64f268e7b0d7029c330036817db4ce08
if (f2 > 0.0F && f2 < 3.4028235E37F && this instanceof net.minecraft.world.entity.player.Player) {
- ((net.minecraft.world.entity.player.Player) this).awardStat(Stats.DAMAGE_ABSORBED, Math.round(f2 * 10.0F));
+ ((net.minecraft.world.entity.player.Player) this).awardStat(Stats.DAMAGE_ABSORBED, carpetfixes.helpers.FastMath.round(f2 * 10.0F)); // Mirai
+ ((net.minecraft.world.entity.player.Player) this).awardStat(Stats.DAMAGE_ABSORBED, carpetfixes.helpers.FastMath.round(f2 * 10.0F));
}
if (f2 > 0.0F && f2 < 3.4028235E37F && damagesource.getEntity() instanceof ServerPlayer) {
- ((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_ABSORBED, Math.round(f2 * 10.0F));
+ ((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_ABSORBED, carpetfixes.helpers.FastMath.round(f2 * 10.0F)); // Mirai
+ ((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_ABSORBED, carpetfixes.helpers.FastMath.round(f2 * 10.0F));
}
if (f > 0 || !human) {
@@ -242,7 +256,7 @@ index 10fe0a33e7d2663e27413b3affe035e91de37255..64f268e7b0d7029c330036817db4ce08
((net.minecraft.world.entity.player.Player) this).causeFoodExhaustion(damagesource.getFoodExhaustion(), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.DAMAGED); // CraftBukkit - EntityExhaustionEvent
if (f < 3.4028235E37F) {
- ((net.minecraft.world.entity.player.Player) this).awardStat(Stats.DAMAGE_TAKEN, Math.round(f * 10.0F));
+ ((net.minecraft.world.entity.player.Player) this).awardStat(Stats.DAMAGE_TAKEN, carpetfixes.helpers.FastMath.round(f * 10.0F)); // Mirai
+ ((net.minecraft.world.entity.player.Player) this).awardStat(Stats.DAMAGE_TAKEN, carpetfixes.helpers.FastMath.round(f * 10.0F));
}
}
// CraftBukkit end
@@ -251,11 +265,11 @@ index 10fe0a33e7d2663e27413b3affe035e91de37255..64f268e7b0d7029c330036817db4ce08
f2 = (float) -event.getDamage(DamageModifier.BLOCKING);
if (f2 > 0.0F && f2 < 3.4028235E37F) {
- ((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, Math.round(originalDamage * 10.0F));
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, carpetfixes.helpers.FastMath.round(originalDamage * 10.0F)); // Mirai
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, carpetfixes.helpers.FastMath.round(originalDamage * 10.0F));
}
}
@@ -3007,10 +3007,12 @@ public abstract class LivingEntity extends Entity {
@@ -3007,10 +3007,10 @@ public abstract class LivingEntity extends Entity {
this.level.getProfiler().push("rangeChecks");
// Paper start - Stop large pitch and yaw changes from crashing the server
@@ -263,17 +277,15 @@ index 10fe0a33e7d2663e27413b3affe035e91de37255..64f268e7b0d7029c330036817db4ce08
- this.yBodyRotO += Math.round((this.yBodyRot - this.yBodyRotO) / 360.0F) * 360.0F;
- this.xRotO += Math.round((this.getXRot() - this.xRotO) / 360.0F) * 360.0F;
- this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F;
+ // Mirai start
+ this.yRotO += carpetfixes.helpers.FastMath.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F;
+ this.yBodyRotO += carpetfixes.helpers.FastMath.round((this.yBodyRot - this.yBodyRotO) / 360.0F) * 360.0F;
+ this.xRotO += carpetfixes.helpers.FastMath.round((this.getXRot() - this.xRotO) / 360.0F) * 360.0F;
+ this.yHeadRotO += carpetfixes.helpers.FastMath.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F;
+ // Mirai end
// Paper end
this.level.getProfiler().pop();
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 8d465c3ca7af2a804a4c178f054063d6a1a5ddad..c8fb4679d11c1e046bbe5483f72a7b74f0a36713 100644
index 8d465c3ca7af2a804a4c178f054063d6a1a5ddad..4e520a7c5bdf0eb3830905859ea106396fa79653 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1086,7 +1086,7 @@ public abstract class Player extends LivingEntity {
@@ -281,7 +293,7 @@ index 8d465c3ca7af2a804a4c178f054063d6a1a5ddad..c8fb4679d11c1e046bbe5483f72a7b74
if (f2 > 0.0F && f2 < 3.4028235E37F) {
- this.awardStat(Stats.DAMAGE_ABSORBED, Math.round(f2 * 10.0F));
+ this.awardStat(Stats.DAMAGE_ABSORBED, carpetfixes.helpers.FastMath.round(f2 * 10.0F)); // Mirai
+ this.awardStat(Stats.DAMAGE_ABSORBED, carpetfixes.helpers.FastMath.round(f2 * 10.0F));
}
if (f != 0.0F) {
@@ -290,7 +302,7 @@ index 8d465c3ca7af2a804a4c178f054063d6a1a5ddad..c8fb4679d11c1e046bbe5483f72a7b74
this.getCombatTracker().recordDamage(damagesource, f3, f);
if (f < 3.4028235E37F) {
- this.awardStat(Stats.DAMAGE_TAKEN, Math.round(f * 10.0F));
+ this.awardStat(Stats.DAMAGE_TAKEN, carpetfixes.helpers.FastMath.round(f * 10.0F)); // Mirai
+ this.awardStat(Stats.DAMAGE_TAKEN, carpetfixes.helpers.FastMath.round(f * 10.0F));
}
}
@@ -299,7 +311,7 @@ index 8d465c3ca7af2a804a4c178f054063d6a1a5ddad..c8fb4679d11c1e046bbe5483f72a7b74
float f5 = f3 - ((LivingEntity) target).getHealth();
- this.awardStat(Stats.DAMAGE_DEALT, Math.round(f5 * 10.0F));
+ this.awardStat(Stats.DAMAGE_DEALT, carpetfixes.helpers.FastMath.round(f5 * 10.0F)); // Mirai
+ this.awardStat(Stats.DAMAGE_DEALT, carpetfixes.helpers.FastMath.round(f5 * 10.0F));
if (j > 0) {
// CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), target.getBukkitEntity(), j * 4);
@@ -308,21 +320,21 @@ index 8d465c3ca7af2a804a4c178f054063d6a1a5ddad..c8fb4679d11c1e046bbe5483f72a7b74
if (this.isSwimming()) {
- i = Math.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F); // Mirai
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
if (i > 0) {
this.awardStat(Stats.SWIM_ONE_CM, i);
this.causeFoodExhaustion(level.spigotConfig.swimMultiplier * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.SWIM); // CraftBukkit - EntityExhaustionEvent // Spigot
}
} else if (this.isEyeInFluid(FluidTags.WATER)) {
- i = Math.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F); // Mirai
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
if (i > 0) {
this.awardStat(Stats.WALK_UNDER_WATER_ONE_CM, i);
this.causeFoodExhaustion(level.spigotConfig.swimMultiplier * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_UNDERWATER); // CraftBukkit - EntityExhaustionEvent // Spigot
}
} else if (this.isInWater()) {
- i = Math.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F); // Mirai
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
if (i > 0) {
this.awardStat(Stats.WALK_ON_WATER_ONE_CM, i);
this.causeFoodExhaustion(level.spigotConfig.swimMultiplier * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_ON_WATER); // CraftBukkit - EntityExhaustionEvent // Spigot
@@ -330,11 +342,11 @@ index 8d465c3ca7af2a804a4c178f054063d6a1a5ddad..c8fb4679d11c1e046bbe5483f72a7b74
} else if (this.onClimbable()) {
if (dy > 0.0D) {
- this.awardStat(Stats.CLIMB_ONE_CM, (int) Math.round(dy * 100.0D));
+ this.awardStat(Stats.CLIMB_ONE_CM, (int) carpetfixes.helpers.FastMath.round(dy * 100.0D)); // Mirai
+ this.awardStat(Stats.CLIMB_ONE_CM, (int) carpetfixes.helpers.FastMath.round(dy * 100.0D));
}
} else if (this.onGround) {
- i = Math.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F); // Mirai
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
if (i > 0) {
if (this.isSprinting()) {
this.awardStat(Stats.SPRINT_ONE_CM, i);
@@ -343,11 +355,11 @@ index 8d465c3ca7af2a804a4c178f054063d6a1a5ddad..c8fb4679d11c1e046bbe5483f72a7b74
}
} else if (this.isFallFlying()) {
- i = Math.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F); // Mirai
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
this.awardStat(Stats.AVIATE_ONE_CM, i);
} else {
- i = Math.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F); // Mirai
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
if (i > 25) {
this.awardStat(Stats.FLY_ONE_CM, i);
}
@@ -356,7 +368,7 @@ index 8d465c3ca7af2a804a4c178f054063d6a1a5ddad..c8fb4679d11c1e046bbe5483f72a7b74
public void checkRidingStatistics(double dx, double dy, double dz) {
if (this.isPassenger()) {
- int i = Math.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
+ int i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F); // Mirai
+ int i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
if (i > 0) {
Entity entity = this.getVehicle();
@@ -365,12 +377,12 @@ index 8d465c3ca7af2a804a4c178f054063d6a1a5ddad..c8fb4679d11c1e046bbe5483f72a7b74
} else {
if (fallDistance >= 2.0F) {
- this.awardStat(Stats.FALL_ONE_CM, (int) Math.round((double) fallDistance * 100.0D));
+ this.awardStat(Stats.FALL_ONE_CM, (int) carpetfixes.helpers.FastMath.round((double) fallDistance * 100.0D)); // Mirai
+ this.awardStat(Stats.FALL_ONE_CM, (int) carpetfixes.helpers.FastMath.round((double) fallDistance * 100.0D));
}
return super.causeFallDamage(fallDistance, damageMultiplier, damageSource);
diff --git a/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java b/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java
index 16504b8be08064e61b013fa943f692816612cbd0..38f6759501dcc2a0adb9608a9f639c2411acf277 100644
index 16504b8be08064e61b013fa943f692816612cbd0..c5b39234822626b4ff948464409ca415250619e9 100644
--- a/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java
@@ -62,7 +62,7 @@ public class DaylightDetectorBlock extends BaseEntityBlock {
@@ -378,12 +390,12 @@ index 16504b8be08064e61b013fa943f692816612cbd0..38f6759501dcc2a0adb9608a9f639c24
f += (f1 - f) * 0.2F;
- i = Math.round((float) i * Mth.cos(f));
+ i = carpetfixes.helpers.FastMath.round((float) i * Mth.cos(f)); // Mirai
+ i = carpetfixes.helpers.FastMath.round((float) i * Mth.cos(f));
}
i = Mth.clamp(i, (int) 0, (int) 15);
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index 264ca51c2f2a5ff69688372b71ad7355366bac1a..22114707a850079e4adcc31775824ccb33c456b1 100644
index 264ca51c2f2a5ff69688372b71ad7355366bac1a..01fcbe8445de6d024b17c205d9363faa6b2dfa39 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -249,8 +249,8 @@ public abstract class ChunkGenerator {
@@ -392,13 +404,13 @@ index 264ca51c2f2a5ff69688372b71ad7355366bac1a..22114707a850079e4adcc31775824ccb
double d1 = (double) (4 * i + i * i1 * 6) + (randomsource.nextDouble() - 0.5D) * (double) i * 2.5D;
- int k1 = (int) Math.round(Math.cos(d0) * d1);
- int l1 = (int) Math.round(Math.sin(d0) * d1);
+ int k1 = (int) carpetfixes.helpers.FastMath.round(Math.cos(d0) * d1); // Mirai
+ int l1 = (int) carpetfixes.helpers.FastMath.round(Math.sin(d0) * d1); // Mirai
+ int k1 = (int) carpetfixes.helpers.FastMath.round(Math.cos(d0) * d1);
+ int l1 = (int) carpetfixes.helpers.FastMath.round(Math.sin(d0) * d1);
BiomeSource worldchunkmanager = this.biomeSource;
int i2 = SectionPos.sectionToBlockCoord(k1, 8);
int j2 = SectionPos.sectionToBlockCoord(l1, 8);
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java
index 31918fa2eb38e42a5ea5366e559f25ea9d7d59ae..fe0bcd4295e96556d1c5282d6acc426980697675 100644
index 31918fa2eb38e42a5ea5366e559f25ea9d7d59ae..f512f1e0c46b96f831fdea3073e57c6bfd9c69eb 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java
+++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java
@@ -61,7 +61,7 @@ public class LootingEnchantFunction extends LootItemConditionalFunction {
@@ -406,12 +418,12 @@ index 31918fa2eb38e42a5ea5366e559f25ea9d7d59ae..fe0bcd4295e96556d1c5282d6acc4269
float f = (float) i * this.value.getFloat(context);
- stack.grow(Math.round(f));
+ stack.grow(carpetfixes.helpers.FastMath.round(f)); // Mirai
+ stack.grow(carpetfixes.helpers.FastMath.round(f));
if (this.hasLimit() && stack.getCount() > this.limit) {
stack.setCount(this.limit);
}
diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
index 731c7dd15f131dc124be6af8f342b122cb89491b..24a82111a5485da1e3903977d0519e9ed502f34d 100644
index 731c7dd15f131dc124be6af8f342b122cb89491b..3ca1a2599a211374cb95e73fdc8c8b3069496660 100644
--- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
+++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
@@ -59,8 +59,8 @@ public final class Shapes {
@@ -420,13 +432,13 @@ index 731c7dd15f131dc124be6af8f342b122cb89491b..24a82111a5485da1e3903977d0519e9e
double e = max * (double)j;
- boolean bl = Math.abs(d - (double)Math.round(d)) < 1.0E-7D * (double)j;
- boolean bl2 = Math.abs(e - (double)Math.round(e)) < 1.0E-7D * (double)j;
+ boolean bl = Math.abs(d - (double)carpetfixes.helpers.FastMath.round(d)) < 1.0E-7D * (double)j; // Mirai
+ boolean bl2 = Math.abs(e - (double)carpetfixes.helpers.FastMath.round(e)) < 1.0E-7D * (double)j; // Mirai
+ boolean bl = Math.abs(d - (double)carpetfixes.helpers.FastMath.round(d)) < 1.0E-7D * (double)j;
+ boolean bl2 = Math.abs(e - (double)carpetfixes.helpers.FastMath.round(e)) < 1.0E-7D * (double)j;
if (bl && bl2) {
return i;
}
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
index 0ecac76577eb440a0c3104ef4603acec826c474d..26ff7f68dacad945095d794c1def4752e0775abb 100644
index 0ecac76577eb440a0c3104ef4603acec826c474d..4813bd6de894d0566e8631d8c71915c38c1da0f8 100644
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
@@ -52,7 +52,7 @@ public class TicksPerSecondCommand extends Command
@@ -434,23 +446,25 @@ index 0ecac76577eb440a0c3104ef4603acec826c474d..26ff7f68dacad945095d794c1def4752
{
return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString()
- + ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); // Paper - only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
+ + ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( carpetfixes.helpers.FastMath.round( tps * 100.0 ) / 100.0, 20.0 ); // Paper - only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise // Mirai
+ + ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( carpetfixes.helpers.FastMath.round( tps * 100.0 ) / 100.0, 20.0 ); // Paper - only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
}
// Yatopia start - Last tick time API
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index ea398d72cdbec80add81971f3cf34b750e9448ae..db805105fd2a9befb1f4e4fd4b917207ca7d82e5 100644
index 0e1ff578af49eaa44508119b16fae67744041150..58464d609824c52bd297e9c242c2957e1545c172 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -263,4 +263,11 @@ public class MiraiConfig {
mapUpdateInterval = getInt("map-update-interval", mapUpdateInterval);
@@ -235,4 +235,13 @@ public class MiraiConfig {
"A second is 20 ticks.");
}
+ public static boolean optimizedRound = true;
+ public static boolean optimizedHypot = true;
+ public static boolean optimizedRound;
+ public static boolean optimizedHypot;
+ private static void fastMath() {
+ optimizedRound = getBoolean("optimize-math-round", optimizedRound);
+ optimizedHypot = getBoolean("optimize-math-hypot", optimizedHypot);
+ optimizedRound = getBoolean("optimize-math-round", true,
+ "Whether or not Math.round should be replaced by a faster version.");
+ optimizedHypot = getBoolean("optimize-math-hypot", true,
+ "Whether or not Math.hypot should be replaced by a faster version.");
+ }
+
}

View File

@@ -0,0 +1,135 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: peaches94 <peachescu94@gmail.com>
Date: Sun, 10 Jul 2022 13:29:20 -0500
Subject: [PATCH] reduce work done by game event system
Original license: GPLv3
Original project: https://github.com/Bloom-host/Petal
1. going into game event dispatching can be expensive so run the checks before dispatching
2. euclideangameeventdispatcher is not used concurrently so we ban that usage for improved performance with allays
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 50daf0762ae2eded8e5e42db12bcdb06ed183225..fa51185762cf68b9f086d278db2f1d1441315344 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1617,6 +1617,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (chunk != null) {
for (int j2 = k; j2 <= j1; ++j2) {
flag |= chunk.getEventDispatcher(j2).walkListeners(event, emitterPos, emitter, (gameeventlistener, vec3d1) -> {
+ if (!gameeventlistener.listensToEvent(event, emitter)) return; // petal - if they don't listen, ignore
(gameeventlistener.handleEventsImmediately() ? list : this.gameEventMessages).add(new GameEvent.Message(event, emitterPos, emitter, gameeventlistener, vec3d1));
});
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
index 22c309343299e60ed8028229b7f134109001ff35..d5947d29295ddc93ba8ac1c0fc61f7badad582c4 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
@@ -85,6 +85,13 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi
}
}
+ // petal start
+ @Override
+ public boolean listensToEvent(GameEvent gameEvent, GameEvent.Context context) {
+ return !this.isRemoved() && gameEvent == GameEvent.ENTITY_DIE && context.sourceEntity() instanceof LivingEntity;
+ }
+ // petal end
+
public static void serverTick(Level world, BlockPos pos, BlockState state, SculkCatalystBlockEntity blockEntity) {
org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverride = blockEntity.getBlockPos(); // CraftBukkit - SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep.
blockEntity.sculkSpreader.updateCursors(world, pos, world.getRandom(), true);
diff --git a/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventDispatcher.java b/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventDispatcher.java
index 0dd708ebe81f73710de51215529c05ec61837dd3..f5b402efa86f824c460db8cac20c1c2b090f82d0 100644
--- a/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventDispatcher.java
+++ b/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventDispatcher.java
@@ -13,8 +13,8 @@ import net.minecraft.world.phys.Vec3;
public class EuclideanGameEventDispatcher implements GameEventDispatcher {
private final List<GameEventListener> listeners = Lists.newArrayList();
- private final Set<GameEventListener> listenersToRemove = Sets.newHashSet();
- private final List<GameEventListener> listenersToAdd = Lists.newArrayList();
+ //private final Set<GameEventListener> listenersToRemove = Sets.newHashSet(); // petal - not necessary
+ //private final List<GameEventListener> listenersToAdd = Lists.newArrayList(); // petal
private boolean processing;
private final ServerLevel level;
@@ -30,7 +30,7 @@ public class EuclideanGameEventDispatcher implements GameEventDispatcher {
@Override
public void register(GameEventListener listener) {
if (this.processing) {
- this.listenersToAdd.add(listener);
+ throw new java.util.ConcurrentModificationException(); // petal - disallow concurrent modification
} else {
this.listeners.add(listener);
}
@@ -41,7 +41,7 @@ public class EuclideanGameEventDispatcher implements GameEventDispatcher {
@Override
public void unregister(GameEventListener listener) {
if (this.processing) {
- this.listenersToRemove.add(listener);
+ throw new java.util.ConcurrentModificationException(); // petal - disallow concurrent modification
} else {
this.listeners.remove(listener);
}
@@ -58,7 +58,7 @@ public class EuclideanGameEventDispatcher implements GameEventDispatcher {
while(iterator.hasNext()) {
GameEventListener gameEventListener = iterator.next();
- if (this.listenersToRemove.remove(gameEventListener)) {
+ if (false) { // petal - disallow concurrent modification
iterator.remove();
} else {
Optional<Vec3> optional = getPostableListenerPosition(this.level, pos, gameEventListener);
@@ -72,6 +72,8 @@ public class EuclideanGameEventDispatcher implements GameEventDispatcher {
this.processing = false;
}
+ // petal start
+ /*
if (!this.listenersToAdd.isEmpty()) {
this.listeners.addAll(this.listenersToAdd);
this.listenersToAdd.clear();
@@ -81,6 +83,8 @@ public class EuclideanGameEventDispatcher implements GameEventDispatcher {
this.listeners.removeAll(this.listenersToRemove);
this.listenersToRemove.clear();
}
+ */
+ // petal end
return bl;
}
diff --git a/src/main/java/net/minecraft/world/level/gameevent/GameEventListener.java b/src/main/java/net/minecraft/world/level/gameevent/GameEventListener.java
index e5601afe8b739da518f36ae306f5e0cb252238f0..bc8f04424c5e8c416d6988f0e06d8cadbb400ca7 100644
--- a/src/main/java/net/minecraft/world/level/gameevent/GameEventListener.java
+++ b/src/main/java/net/minecraft/world/level/gameevent/GameEventListener.java
@@ -12,4 +12,10 @@ public interface GameEventListener {
int getListenerRadius();
boolean handleGameEvent(ServerLevel world, GameEvent.Message event);
+
+ // petal start - add check for seeing if this listener cares about an event
+ default boolean listensToEvent(net.minecraft.world.level.gameevent.GameEvent gameEvent, net.minecraft.world.level.gameevent.GameEvent.Context context) {
+ return true;
+ }
+ // petal end
}
diff --git a/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationListener.java b/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationListener.java
index e45f54534bbf054eaf0008546ff459d4c11ddd50..e49d0d1c2a539fcd7e75262c4010475193964287 100644
--- a/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationListener.java
+++ b/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationListener.java
@@ -162,6 +162,13 @@ public class VibrationListener implements GameEventListener {
return true;
}
+ // petal start
+ @Override
+ public boolean listensToEvent(GameEvent gameEvent, GameEvent.Context context) {
+ return this.receivingEvent == null && gameEvent.is(this.config.getListenableEvents());
+ }
+ // petal end
+
public interface VibrationListenerConfig {
default TagKey<GameEvent> getListenableEvents() {

View File

@@ -0,0 +1,49 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: peaches94 <peachescu94@gmail.com>
Date: Sun, 10 Jul 2022 15:44:38 -0500
Subject: [PATCH] reduce sensor work
Original license: GPLv3
Original project: https://github.com/Bloom-host/Petal
this patch is focused around the sensors used for ai
delete the line of sight cache less often and use a faster nearby comparison
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index af8012ad3acb294806a18b6aa4fadb1d3fec6b33..c4c32d3f2ee242e3fdd9d57270b8a9d938014351 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -998,12 +998,14 @@ public abstract class LivingEntity extends Entity {
}
if (entity != null) {
- ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
+ // petal start - only do itemstack lookup if we need to
+ //ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
EntityType<?> entitytypes = entity.getType();
- if (entitytypes == EntityType.SKELETON && itemstack.is(Items.SKELETON_SKULL) || entitytypes == EntityType.ZOMBIE && itemstack.is(Items.ZOMBIE_HEAD) || entitytypes == EntityType.CREEPER && itemstack.is(Items.CREEPER_HEAD)) {
+ if (entitytypes == EntityType.SKELETON && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.SKELETON_SKULL) || entitytypes == EntityType.ZOMBIE && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.ZOMBIE_HEAD) || entitytypes == EntityType.CREEPER && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.CREEPER_HEAD)) {
d0 *= 0.5D;
}
+ // petal end
}
return d0;
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index a60cca663da4200d482c19d0b41a9514825a1e9b..c39ceda8e9314dd8338ade29d92baa0c8173d2c9 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -849,10 +849,10 @@ public abstract class Mob extends LivingEntity {
return;
}
// Paper end
+ int i = this.level.getServer().getTickCount() + this.getId(); // petal - move up
this.level.getProfiler().push("sensing");
- this.sensing.tick();
+ if (i % 10 == 0) this.sensing.tick(); // petal - only refresh line of sight cache every half second
this.level.getProfiler().pop();
- int i = this.level.getServer().getTickCount() + this.getId();
if (i % 2 != 0 && this.tickCount > 1) {
this.level.getProfiler().push("targetSelector");