More works

This commit is contained in:
nostalgic853
2022-11-18 23:42:32 +08:00
parent 269817cf9a
commit fef567e45d
25 changed files with 79 additions and 151 deletions

View File

@@ -10,7 +10,7 @@ Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java 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 5668e6fa7f560199c352dbed629dbc6897d468a7..5a17c5df95390120bdd36c86dcd14a334f3a7030 100644 index 1b7e38538881ba00ffdbe9226952627151532c5c..119e26e32654c834ff1158836ce56ba8985c09e8 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -315,19 +315,21 @@ public abstract class Player extends LivingEntity { @@ -315,19 +315,21 @@ public abstract class Player extends LivingEntity {

View File

@@ -9,7 +9,7 @@ Original license: MIT
Original project: https://github.com/Cryptite/Slice Original project: https://github.com/Cryptite/Slice
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 467f60dcbed645d773e7e3e042d2bbbd8f5bb589..89f2bffb6d3458f885e6098ea770c46867f6419d 100644 index 14b2c36049c91a8abfc545e2fb5e3d6f908370e8..77c00de9b94531f8136469e04e535a43829c0a60 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -271,6 +271,7 @@ public class ServerPlayer extends Player { @@ -271,6 +271,7 @@ public class ServerPlayer extends Player {

View File

@@ -14,7 +14,7 @@ doing questionable/buggy ones, and claiming breathtaking performance improvement
any of those Spigot forks! 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 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6f2518ec1be9af4fa00d719c50cbe64e4e57fcbc..9701a89149cc2bd7330b23c441b51677be0bdc18 100644 index 193b6621d6506a04bc1f9f23571aeb2e635d562c..7ef574008f413008427d075860c9eb5debeef4f4 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1195,7 +1195,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -1195,7 +1195,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {

View File

@@ -10,13 +10,14 @@ Let users decide if we should warn while running in offline mode
Let users decide if we should warn while running in proxy mode Let users decide if we should warn while running in proxy mode
diff --git a/src/main/java/cc/keyimc/keyi/KeyiConfig.java b/src/main/java/cc/keyimc/keyi/KeyiConfig.java diff --git a/src/main/java/cc/keyimc/keyi/KeyiConfig.java b/src/main/java/cc/keyimc/keyi/KeyiConfig.java
index 8b9a2f06b0a61cfdd493eeddde512f0abd17f49e..98705c4206906404fed31c87fb03737fe3771b0a 100644 index bc9403d002ef24e71be67a962d099f5d73db9540..5582c15a37fbbf74d2039ba15d67684f5294a46d 100644
--- a/src/main/java/cc/keyimc/keyi/KeyiConfig.java --- a/src/main/java/cc/keyimc/keyi/KeyiConfig.java
+++ b/src/main/java/cc/keyimc/keyi/KeyiConfig.java +++ b/src/main/java/cc/keyimc/keyi/KeyiConfig.java
@@ -133,6 +133,16 @@ public final class KeyiConfig { @@ -132,4 +132,14 @@ public final class KeyiConfig {
public static void reload() {
KeyiConfig.init((File) MinecraftServer.getServer().options.valueOf("keyi-settings")); KeyiConfig.init((File) MinecraftServer.getServer().options.valueOf("keyi-settings"));
} }
+
+ public static boolean enableRootUserWarning = true; + public static boolean enableRootUserWarning = true;
+ public static boolean enableOfflineModeWarning = true; + public static boolean enableOfflineModeWarning = true;
+ public static boolean enableProxyUnsafeWarning = true; + public static boolean enableProxyUnsafeWarning = true;
@@ -26,10 +27,8 @@ index 8b9a2f06b0a61cfdd493eeddde512f0abd17f49e..98705c4206906404fed31c87fb03737f
+ enableOfflineModeWarning = getBoolean("misc.enable-offline-mode-warning", enableOfflineModeWarning); + enableOfflineModeWarning = getBoolean("misc.enable-offline-mode-warning", enableOfflineModeWarning);
+ enableProxyUnsafeWarning = getBoolean("misc.enable-proxy-unsafe-warning", enableProxyUnsafeWarning); + enableProxyUnsafeWarning = getBoolean("misc.enable-proxy-unsafe-warning", enableProxyUnsafeWarning);
+ } + }
+ }
// Suki start - only refresh lootables for players \ No newline at end of file
public static boolean onlyRefreshForPlayers = false;
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index a9c4f1192f53fea55b2f5edc8a91b6911489e2d3..5420915b21bbd17eeaba2ba45e08399a3abe6952 100644 index a9c4f1192f53fea55b2f5edc8a91b6911489e2d3..5420915b21bbd17eeaba2ba45e08399a3abe6952 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java

View File

@@ -5,22 +5,21 @@ Subject: [PATCH] Add an option for tripwire duping
diff --git a/src/main/java/cc/keyimc/keyi/KeyiConfig.java b/src/main/java/cc/keyimc/keyi/KeyiConfig.java diff --git a/src/main/java/cc/keyimc/keyi/KeyiConfig.java b/src/main/java/cc/keyimc/keyi/KeyiConfig.java
index 98705c4206906404fed31c87fb03737fe3771b0a..c93bb951fd456af9e8f030b6f5c7989925c3556f 100644 index 5582c15a37fbbf74d2039ba15d67684f5294a46d..8884a2471b4b7c5cabf1c0c767710ba69c7ae4ec 100644
--- a/src/main/java/cc/keyimc/keyi/KeyiConfig.java --- a/src/main/java/cc/keyimc/keyi/KeyiConfig.java
+++ b/src/main/java/cc/keyimc/keyi/KeyiConfig.java +++ b/src/main/java/cc/keyimc/keyi/KeyiConfig.java
@@ -143,6 +143,12 @@ public final class KeyiConfig { @@ -142,4 +142,10 @@ public final class KeyiConfig {
enableOfflineModeWarning = getBoolean("misc.enable-offline-mode-warning", enableOfflineModeWarning);
enableProxyUnsafeWarning = getBoolean("misc.enable-proxy-unsafe-warning", enableProxyUnsafeWarning); enableProxyUnsafeWarning = getBoolean("misc.enable-proxy-unsafe-warning", enableProxyUnsafeWarning);
} }
+
+ public static boolean fixTripwireDuping = true; + public static boolean fixTripwireDuping = true;
+ +
+ private static void fixes() { + private static void fixes() {
+ fixTripwireDuping = getBoolean("fixes.fix-tripwire-duping", fixTripwireDuping); + fixTripwireDuping = getBoolean("fixes.fix-tripwire-duping", fixTripwireDuping);
+ } + }
+ }
// Suki start - only refresh lootables for players \ No newline at end of file
public static boolean onlyRefreshForPlayers = false;
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
index 004dce26ff073f1de52a84cd425c4f60fdab5e50..b37a5d643dc07eaa0808b972f43281f2e24d3394 100644 index 004dce26ff073f1de52a84cd425c4f60fdab5e50..b37a5d643dc07eaa0808b972f43281f2e24d3394 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java --- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java

View File

@@ -5,22 +5,21 @@ Subject: [PATCH] Add an option for spigot item merging mechanism
diff --git a/src/main/java/cc/keyimc/keyi/KeyiConfig.java b/src/main/java/cc/keyimc/keyi/KeyiConfig.java diff --git a/src/main/java/cc/keyimc/keyi/KeyiConfig.java b/src/main/java/cc/keyimc/keyi/KeyiConfig.java
index c93bb951fd456af9e8f030b6f5c7989925c3556f..2ccee00d230f4801c4ed4b80b8415a249e933133 100644 index 8884a2471b4b7c5cabf1c0c767710ba69c7ae4ec..4f08f2e40f5bc3bc5a87bf3a34945afdec65f288 100644
--- a/src/main/java/cc/keyimc/keyi/KeyiConfig.java --- a/src/main/java/cc/keyimc/keyi/KeyiConfig.java
+++ b/src/main/java/cc/keyimc/keyi/KeyiConfig.java +++ b/src/main/java/cc/keyimc/keyi/KeyiConfig.java
@@ -149,6 +149,12 @@ public final class KeyiConfig { @@ -148,4 +148,10 @@ public final class KeyiConfig {
private static void fixes() {
fixTripwireDuping = getBoolean("fixes.fix-tripwire-duping", fixTripwireDuping); fixTripwireDuping = getBoolean("fixes.fix-tripwire-duping", fixTripwireDuping);
} }
+
+ public static boolean useSpigotItemMergingMechanism = true; + public static boolean useSpigotItemMergingMechanism = true;
+ +
+ private static void performance() { + private static void performance() {
+ useSpigotItemMergingMechanism = getBoolean("performance.use-spigot-item-merging-mechanism", useSpigotItemMergingMechanism); + useSpigotItemMergingMechanism = getBoolean("performance.use-spigot-item-merging-mechanism", useSpigotItemMergingMechanism);
+ } + }
+ }
// Suki start - only refresh lootables for players \ No newline at end of file
public static boolean onlyRefreshForPlayers = false;
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index aa1c929d948cea8f6212330f922eb5f1d9b9bb97..bb72741300cedd1c37fc5611c6472292bdf245a1 100644 index aa1c929d948cea8f6212330f922eb5f1d9b9bb97..bb72741300cedd1c37fc5611c6472292bdf245a1 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Disable arrow despawn counter by default
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index daa437f3aaebed4d917fde65d75a8a941755a764..576a50c0279f5336d606b53aeb2ed76785e1d538 100644 index bb352ed86e4047e38ad27900f72fc0ddb741bf71..2cc8eeedfd5729fd324b10cb4b2a6298dad39e9d 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -116,7 +116,7 @@ public class PurpurWorldConfig { @@ -116,7 +116,7 @@ public class PurpurWorldConfig {

View File

@@ -7,7 +7,7 @@ Original code by PatinaMC, licensed under GNU General Public License v3.0
You can find the original code on https://github.com/PatinaMC/Patina You can find the original code on https://github.com/PatinaMC/Patina
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 882512d766bdd52fc6ada18db61d0e7e243ab039..a79aedc82328492629c1347b7154ab087e46d14a 100644 index 77c00de9b94531f8136469e04e535a43829c0a60..e633be38543a6eb4b2e0e1d834996400762b2536 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -387,7 +387,7 @@ public class ServerPlayer extends Player { @@ -387,7 +387,7 @@ public class ServerPlayer extends Player {

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) 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 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9701a89149cc2bd7330b23c441b51677be0bdc18..0032bd550a398c330e16db8081b8dc8ba21333d2 100644 index 7ef574008f413008427d075860c9eb5debeef4f4..83eece9c61f8316221a304f3dd69a7fe3cce3727 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -399,6 +399,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -399,6 +399,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -34,7 +34,7 @@ index 9701a89149cc2bd7330b23c441b51677be0bdc18..0032bd550a398c330e16db8081b8dc8b
// Paper start - detailed watchdog information // Paper start - detailed watchdog information
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main"); io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main");
synchronized (this.posLock) { synchronized (this.posLock) {
@@ -3821,6 +3829,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -3796,6 +3804,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} }
public final void setBoundingBox(AABB boundingBox) { public final void setBoundingBox(AABB boundingBox) {

View File

@@ -89,10 +89,10 @@ index e8efbbeece7e866c6c4d7489677d2d9e15fea4d0..8bc0cb9ad5bb4e76d962ff54305e2c08
PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet); PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet);
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11a61ec29b 100644 index 735e01c550d561aa21c3c8f7f34a495ec3a0ab67..13d86c1fba2377808a5ef1e2820db445383af156 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -330,13 +330,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -328,13 +328,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public MinecraftServer(OptionSet options, DataPackConfig datapackconfiguration, DynamicOps<Tag> registryreadops, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, Services services, ChunkProgressListenerFactory worldloadlistenerfactory) { public MinecraftServer(OptionSet options, DataPackConfig datapackconfiguration, DynamicOps<Tag> registryreadops, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, Services services, ChunkProgressListenerFactory worldloadlistenerfactory) {
super("Server"); super("Server");
SERVER = this; // Paper - better singleton SERVER = this; // Paper - better singleton
@@ -112,7 +112,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
this.status = new ServerStatus(); this.status = new ServerStatus();
this.random = RandomSource.create(); this.random = RandomSource.create();
this.port = -1; this.port = -1;
@@ -938,9 +938,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -936,9 +936,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
// Paper end // Paper end
// CraftBukkit end // CraftBukkit end
@@ -124,7 +124,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
MinecraftServer.LOGGER.info("Stopping server"); MinecraftServer.LOGGER.info("Stopping server");
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Shutdown and don't bother finishing Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Shutdown and don't bother finishing
@@ -1183,18 +1183,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1181,18 +1181,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
// Spigot end // Spigot end
@@ -148,7 +148,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
this.mayHaveDelayedTasks = true; this.mayHaveDelayedTasks = true;
// Purpur start - tps catchup // Purpur start - tps catchup
if (org.purpurmc.purpur.PurpurConfig.tpsCatchup) { if (org.purpurmc.purpur.PurpurConfig.tpsCatchup) {
@@ -1204,8 +1204,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1202,8 +1202,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
// Purpur end - tps catchup // Purpur end - tps catchup
this.waitUntilNextTick(); this.waitUntilNextTick();
@@ -159,7 +159,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
this.isReady = true; this.isReady = true;
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime); JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
} }
@@ -1366,7 +1366,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1364,7 +1364,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
public void doRunTask(TickTask ticktask) { // CraftBukkit - decompile error public void doRunTask(TickTask ticktask) { // CraftBukkit - decompile error
@@ -168,7 +168,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
super.doRunTask(ticktask); super.doRunTask(ticktask);
} }
@@ -1410,15 +1410,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1408,15 +1408,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public void onServerExit() {} public void onServerExit() {}
public void tickServer(BooleanSupplier shouldKeepTicking) { public void tickServer(BooleanSupplier shouldKeepTicking) {
@@ -187,7 +187,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
// Paper end // Paper end
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper
@@ -1451,7 +1451,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1449,7 +1449,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (playerSaveInterval < 0) { if (playerSaveInterval < 0) {
playerSaveInterval = autosavePeriod; playerSaveInterval = autosavePeriod;
} }
@@ -196,7 +196,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0; final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0;
try { try {
this.isSaving = true; this.isSaving = true;
@@ -1466,20 +1466,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1464,20 +1464,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally { } finally {
this.isSaving = false; this.isSaving = false;
} }
@@ -221,7 +221,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i; long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
this.averageTickTime = this.averageTickTime * 0.8F + (float) l / 1000000.0F * 0.19999999F; this.averageTickTime = this.averageTickTime * 0.8F + (float) l / 1000000.0F * 0.19999999F;
@@ -1492,31 +1492,31 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1490,31 +1490,31 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end // Paper end
this.frameTimer.logFrameDuration(i1 - i); this.frameTimer.logFrameDuration(i1 - i);
@@ -264,7 +264,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
// Send time updates to everyone, it will get the right time from the world the player is in. // Send time updates to everyone, it will get the right time from the world the player is in.
// Paper start - optimize time updates // Paper start - optimize time updates
for (final ServerLevel world : this.getAllLevels()) { for (final ServerLevel world : this.getAllLevels()) {
@@ -1536,10 +1536,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1534,10 +1534,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
} }
// Paper end // Paper end
@@ -276,7 +276,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
Iterator iterator = this.getAllLevels().iterator(); // Paper - move down Iterator iterator = this.getAllLevels().iterator(); // Paper - move down
while (iterator.hasNext()) { while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next(); ServerLevel worldserver = (ServerLevel) iterator.next();
@@ -1548,28 +1547,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1546,28 +1545,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worldserver.hasRidableMoveEvent = org.purpurmc.purpur.event.entity.RidableMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur worldserver.hasRidableMoveEvent = org.purpurmc.purpur.event.entity.RidableMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper
@@ -312,7 +312,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
} catch (Throwable throwable) { } catch (Throwable throwable) {
// Spigot Start // Spigot Start
CrashReport crashreport; CrashReport crashreport;
@@ -1585,33 +1584,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1583,33 +1582,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
throw new ReportedException(crashreport); throw new ReportedException(crashreport);
} }
@@ -358,7 +358,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
} }
public boolean isNetherEnabled() { public boolean isNetherEnabled() {
@@ -2259,7 +2258,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2257,7 +2256,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
public ProfilerFiller getProfiler() { public ProfilerFiller getProfiler() {
@@ -367,7 +367,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
return this.profiler; return this.profiler;
} }
@@ -2499,7 +2498,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2497,7 +2496,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit end // CraftBukkit end
private void startMetricsRecordingTick() { private void startMetricsRecordingTick() {
@@ -376,7 +376,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(Util.timeSource, this.isDedicatedServer()), Util.timeSource, Util.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> { this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(Util.timeSource, this.isDedicatedServer()), Util.timeSource, Util.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
this.executeBlocking(() -> { this.executeBlocking(() -> {
this.saveDebugReport(path.resolve("server")); this.saveDebugReport(path.resolve("server"));
@@ -2509,40 +2508,40 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2507,40 +2506,40 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.willStartRecordingMetrics = false; this.willStartRecordingMetrics = false;
} }
@@ -429,7 +429,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
} }
public Path getWorldPath(LevelResource worldSavePath) { public Path getWorldPath(LevelResource worldSavePath) {
@@ -2587,15 +2586,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2585,15 +2584,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
public boolean isTimeProfilerRunning() { public boolean isTimeProfilerRunning() {
@@ -448,7 +448,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
return EmptyProfileResults.EMPTY; return EmptyProfileResults.EMPTY;
} else { } else {
ProfileResults methodprofilerresults = this.debugCommandProfiler.stop(Util.getNanos(), this.tickCount); ProfileResults methodprofilerresults = this.debugCommandProfiler.stop(Util.getNanos(), this.tickCount);
@@ -2768,7 +2767,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2766,7 +2765,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return; return;
} }
@@ -457,15 +457,7 @@ index cb2fc1a77d8170772ec4595642d317b04652b293..04a8cc1ec44b474e1048ccb06b4a7c11
try { try {
for (;;) { for (;;) {
boolean moreTasks = this.tickMidTickTasks(); boolean moreTasks = this.tickMidTickTasks();
@@ -2788,14 +2787,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2793,7 +2792,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
double overuseCount = (double)overuse/(double)MAX_CHUNK_EXEC_TIME;
- long extraSleep = (long)carpetfixes.helpers.FastMath.round(overuseCount*CHUNK_TASK_QUEUE_BACKOFF_MIN_TIME); // Mirai
+ long extraSleep = (long)Math.round(overuseCount*CHUNK_TASK_QUEUE_BACKOFF_MIN_TIME);
lastMidTickExecute = currTime + extraSleep;
return;
} }
} }
} finally { } finally {
@@ -797,24 +789,10 @@ index 9d13ef8c597b9ca11280ad1d3249d13bbab4ac6f..0b75caca3f77980505d0689601d920fb
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e3557647c41c210 100644 index c888e654ab9449bfdc7dfe16078eb0786ae6c15e..71ff2cfc4aba6da71911ea717e3557647c41c210 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -229,13 +229,6 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -653,12 +653,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
return thr;
}
- // Mirai start
- @Override
- public ProfilerFiller getProfiler() {
- return this.getServer().getProfiler();
- }
- // Mirai end
-
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper
}
@@ -660,12 +653,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
} }
// Paper end - optimise checkDespawn // Paper end - optimise checkDespawn
@@ -830,7 +808,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
this.advanceWeatherCycle(); this.advanceWeatherCycle();
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
long j; long j;
@@ -692,32 +685,32 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -685,32 +685,32 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.updateSkyBrightness(); this.updateSkyBrightness();
this.tickTime(); this.tickTime();
@@ -879,7 +857,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
if (flag) { if (flag) {
@@ -725,24 +718,24 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -718,24 +718,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
if (flag || this.emptyTime++ < 300) { if (flag || this.emptyTime++ < 300) {
@@ -911,7 +889,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
if (true || this.chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(entity.chunkPosition().toLong())) { // Paper - now always true if in the ticking list if (true || this.chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(entity.chunkPosition().toLong())) { // Paper - now always true if in the ticking list
Entity entity1 = entity.getVehicle(); Entity entity1 = entity.getVehicle();
@@ -754,7 +747,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -747,7 +747,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.stopRiding(); entity.stopRiding();
} }
@@ -920,7 +898,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
// Pufferfish start - copied from this.guardEntityTick // Pufferfish start - copied from this.guardEntityTick
try { try {
this.tickNonPassenger(entity); // Pufferfish - changed this.tickNonPassenger(entity); // Pufferfish - changed
@@ -769,22 +762,22 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -762,22 +762,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper end // Paper end
} }
// Pufferfish end // Pufferfish end
@@ -950,7 +928,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
} }
@Override @Override
@@ -866,9 +859,9 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -859,9 +859,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
boolean flag = this.isRaining(); boolean flag = this.isRaining();
int j = chunkcoordintpair.getMinBlockX(); int j = chunkcoordintpair.getMinBlockX();
int k = chunkcoordintpair.getMinBlockZ(); int k = chunkcoordintpair.getMinBlockZ();
@@ -962,7 +940,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change
if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && /*this.random.nextInt(this.spigotConfig.thunderChance) == 0 &&*/ chunk.shouldDoLightning(this.random)) { // Spigot // Paper - disable thunder // Pufferfish - replace random with shouldDoLightning if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && /*this.random.nextInt(this.spigotConfig.thunderChance) == 0 &&*/ chunk.shouldDoLightning(this.random)) { // Spigot // Paper - disable thunder // Pufferfish - replace random with shouldDoLightning
@@ -900,7 +893,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -893,7 +893,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
} }
@@ -971,7 +949,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
if (!this.paperConfig().environment.disableIceAndSnow && (this.currentIceAndSnowTick++ & 15) == 0) { // Paper - Disable ice and snow // Paper - optimise random ticking // Pufferfish - optimize further random ticking if (!this.paperConfig().environment.disableIceAndSnow && (this.currentIceAndSnowTick++ & 15) == 0) { // Paper - Disable ice and snow // Paper - optimise random ticking // Pufferfish - optimize further random ticking
// Paper start - optimise chunk ticking // Paper start - optimise chunk ticking
this.getRandomBlockPosition(j, 0, k, 15, blockposition); this.getRandomBlockPosition(j, 0, k, 15, blockposition);
@@ -936,8 +929,8 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -929,8 +929,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
// Paper start - optimise random block ticking // Paper start - optimise random block ticking
@@ -982,7 +960,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
if (randomTickSpeed > 0) { if (randomTickSpeed > 0) {
LevelChunkSection[] sections = chunk.getSections(); LevelChunkSection[] sections = chunk.getSections();
int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this); int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
@@ -971,8 +964,8 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -964,8 +964,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
} }
// Paper end - optimise random block ticking // Paper end - optimise random block ticking
@@ -993,7 +971,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
} }
public Optional<BlockPos> findLightningRod(BlockPos pos) { public Optional<BlockPos> findLightningRod(BlockPos pos) {
@@ -1264,24 +1257,24 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1257,24 +1257,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot end // Spigot end
// Paper start- timings // Paper start- timings
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity); final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity);
@@ -1026,7 +1004,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
Iterator iterator = entity.getPassengers().iterator(); Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1304,17 +1297,17 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1297,17 +1297,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (passenger instanceof Player || this.entityTickList.contains(passenger)) { if (passenger instanceof Player || this.entityTickList.contains(passenger)) {
// Paper - EAR 2 // Paper - EAR 2
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger); final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger);
@@ -1050,7 +1028,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
// Paper start - EAR 2 // Paper start - EAR 2
if (isActive) { if (isActive) {
passenger.rideTick(); passenger.rideTick();
@@ -1326,7 +1319,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1319,7 +1319,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
vehicle.positionRider(passenger); vehicle.positionRider(passenger);
} }
// Paper end - EAR 2 // Paper end - EAR 2
@@ -1059,7 +1037,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
Iterator iterator = passenger.getPassengers().iterator(); Iterator iterator = passenger.getPassengers().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1335,7 +1328,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1328,7 +1328,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(passenger, entity2); this.tickPassenger(passenger, entity2);
} }
@@ -1068,7 +1046,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
} }
} else { } else {
passenger.stopRiding(); passenger.stopRiding();
@@ -1355,14 +1348,14 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1348,14 +1348,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld()));
} }
@@ -1086,7 +1064,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
// Copied from save() // Copied from save()
// CraftBukkit start - moved from MinecraftServer.saveChunks // CraftBukkit start - moved from MinecraftServer.saveChunks
@@ -1374,7 +1367,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1367,7 +1367,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.convertable.saveDataTag(this.server.registryHolder, this.serverLevelData, this.server.getPlayerList().getSingleplayerData()); this.convertable.saveDataTag(this.server.registryHolder, this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
} }
// CraftBukkit end // CraftBukkit end
@@ -1095,7 +1073,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
} }
// Paper end // Paper end
@@ -1388,7 +1381,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1381,7 +1381,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!savingDisabled) { if (!savingDisabled) {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
@@ -1104,7 +1082,7 @@ index 00fe84ae4fee41b365223f836c82e1688fe322ee..71ff2cfc4aba6da71911ea717e355764
if (progressListener != null) { if (progressListener != null) {
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel")); progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
} }
@@ -1398,11 +1391,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1391,11 +1391,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
progressListener.progressStage(Component.translatable("menu.savingChunks")); progressListener.progressStage(Component.translatable("menu.savingChunks"));
} }
@@ -1222,21 +1200,9 @@ index 7094701d213c73ba47ace806962244c10fdf4dda..fcdb9bde8e1605e30dde3e580491522d
} }
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index aa27ab72d30f917ea41045db16b6f59f1442ea77..09ae98db728bade8121587e9ded6f3ab98f3bb30 100644 index 0bb14272d024af90e7aef40f2f694e184af607d3..09ae98db728bade8121587e9ded6f3ab98f3bb30 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -117,9 +117,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public static final int TICKS_PER_DAY = 24000;
public static final int MAX_ENTITY_SPAWN_Y = 20000000;
public static final int MIN_ENTITY_SPAWN_Y = -20000000;
- protected final List<TickingBlockEntity> blockEntityTickers = me.jellysquid.mods.lithium.common.util.collections.HashedReferenceList.wrapper(Lists.newArrayList()); public final int getTotalTileEntityTickers() { return this.blockEntityTickers.size(); } // Paper // Jettpack - lithium: HashedReferenceList
+ protected final List<TickingBlockEntity> blockEntityTickers = Lists.newArrayList(); public final int getTotalTileEntityTickers() { return this.blockEntityTickers.size(); } // Paper
protected final NeighborUpdater neighborUpdater;
- private final List<TickingBlockEntity> pendingBlockEntityTickers = me.jellysquid.mods.lithium.common.util.collections.HashedReferenceList.wrapper(Lists.newArrayList()); // Jettpack - lithium: HashedReferenceList
+ private final List<TickingBlockEntity> pendingBlockEntityTickers = Lists.newArrayList();
private boolean tickingBlockEntities;
public final Thread thread;
private final boolean isDebug;
@@ -712,9 +712,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -712,9 +712,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
BlockState iblockdata2 = this.getBlockState(pos); BlockState iblockdata2 = this.getBlockState(pos);
@@ -1349,33 +1315,19 @@ index 50712b2222703fff01378e2ececb0fc0dba60b65..a182b3c804cf56855e15290f826fdebd
if (entityhuman != null) { if (entityhuman != null) {
double d2 = entityhuman.distanceToSqr(d0, (double) i, d1); double d2 = entityhuman.distanceToSqr(d0, (double) i, d1);
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 7249fe1d53c22d4164c68cb89b8df95e92873d1b..e0e4a924e926b086699998095a1abddd01d8c002 100644 index 2877441927de3aeba28f5c3dd876e2ae4c15797c..e0e4a924e926b086699998095a1abddd01d8c002 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -53,10 +53,6 @@ import net.minecraft.world.level.material.Fluids; @@ -930,7 +930,7 @@ public class LevelChunk extends ChunkAccess {
import net.minecraft.world.ticks.LevelChunkTicks;
import net.minecraft.world.ticks.TickContainerAccess;
import org.slf4j.Logger;
-// KeYi start
-import cc.keyimc.keyi.utils.FastRandom;
-import java.util.Random; // KeYi
-// KeYi end
public class LevelChunk extends ChunkAccess {
@@ -934,9 +930,9 @@ public class LevelChunk extends ChunkAccess {
this.chunkHolder.getEntityChunk().callEntitiesLoadEvent(); // Paper - rewrite chunk system this.chunkHolder.getEntityChunk().callEntitiesLoadEvent(); // Paper - rewrite chunk system
if (this.needsDecoration) { if (this.needsDecoration) {
- //try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper // Purpur - //try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper // Purpur
+ try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper + try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper
this.needsDecoration = false; this.needsDecoration = false;
- Random random = new FastRandom(); java.util.Random random = new java.util.Random();
+ java.util.Random random = new java.util.Random();
random.setSeed(this.level.getSeed()); random.setSeed(this.level.getSeed());
long xRand = random.nextLong() / 2L * 2L + 1L; @@ -950,7 +950,7 @@ public class LevelChunk extends ChunkAccess {
long zRand = random.nextLong() / 2L * 2L + 1L;
@@ -954,7 +950,7 @@ public class LevelChunk extends ChunkAccess {
} }
} }
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(this.bukkitChunk)); server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(this.bukkitChunk));
@@ -1384,7 +1336,7 @@ index 7249fe1d53c22d4164c68cb89b8df95e92873d1b..e0e4a924e926b086699998095a1abddd
} }
} }
} }
@@ -1313,10 +1309,10 @@ public class LevelChunk extends ChunkAccess { @@ -1309,10 +1309,10 @@ public class LevelChunk extends ChunkAccess {
if (LevelChunk.this.isTicking(blockposition)) { if (LevelChunk.this.isTicking(blockposition)) {
try { try {
@@ -1398,7 +1350,7 @@ index 7249fe1d53c22d4164c68cb89b8df95e92873d1b..e0e4a924e926b086699998095a1abddd
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
if (this.blockEntity.getType().isValid(iblockdata)) { if (this.blockEntity.getType().isValid(iblockdata)) {
@@ -1327,7 +1323,7 @@ public class LevelChunk extends ChunkAccess { @@ -1323,7 +1323,7 @@ public class LevelChunk extends ChunkAccess {
LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata}); LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata});
} }
@@ -1407,7 +1359,7 @@ index 7249fe1d53c22d4164c68cb89b8df95e92873d1b..e0e4a924e926b086699998095a1abddd
} catch (Throwable throwable) { } catch (Throwable throwable) {
if (throwable instanceof ThreadDeath) throw throwable; // Paper if (throwable instanceof ThreadDeath) throw throwable; // Paper
// Paper start - Prevent tile entity and entity crashes // Paper start - Prevent tile entity and entity crashes
@@ -1338,7 +1334,7 @@ public class LevelChunk extends ChunkAccess { @@ -1334,7 +1334,7 @@ public class LevelChunk extends ChunkAccess {
// Paper end // Paper end
// Spigot start // Spigot start
} finally { } finally {
@@ -1417,10 +1369,10 @@ index 7249fe1d53c22d4164c68cb89b8df95e92873d1b..e0e4a924e926b086699998095a1abddd
} }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index a57d633c439f66cb27209f56abf391e84bbb52c5..ef0f8c37308dc2fa97bff437319a850526e660c2 100644 index 3a67aaa39daf1fb86938f53e129aadfb686583b0..33accb56fbc00560e2f253a2150991331e515858 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -436,38 +436,7 @@ public final class CraftServer implements Server { @@ -435,38 +435,7 @@ public final class CraftServer implements Server {
if (!pluginFolder.exists()) { if (!pluginFolder.exists()) {
pluginFolder.mkdirs(); pluginFolder.mkdirs();
} }

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Use cached pool for mob spawning executor
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 04a8cc1ec44b474e1048ccb06b4a7c11a61ec29b..66843d7ca82c4be7f45b7b830f0d45d925a3d504 100644 index 13d86c1fba2377808a5ef1e2820db445383af156..ae95e3af64811f6f149a01b9715d8fdd2c2583fa 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -43,6 +43,7 @@ import java.util.Optional; @@ -43,6 +43,7 @@ import java.util.Optional;

View File

@@ -1,12 +1,12 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: nostalgic853 <yuu8583@proton.me> From: nostalgic853 <yuu8583@proton.me>
Date: Mon, 24 Oct 2022 10:52:07 +0800 Date: Fri, 18 Nov 2022 23:39:13 +0800
Subject: [PATCH] Use a faster random implementation Subject: [PATCH] Use a faster random implementation
diff --git a/src/main/java/cc/keyimc/keyi/utils/FastRandom.java b/src/main/java/cc/keyimc/keyi/utils/FastRandom.java diff --git a/src/main/java/cc/keyimc/keyi/utils/FastRandom.java b/src/main/java/cc/keyimc/keyi/utils/FastRandom.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..a9b3a467e7dbfdc78c11f04e6bb5a9642c20470c index 0000000000000000000000000000000000000000..ca75a84c2fe0b163f5618f408372b38e048ae2cd
--- /dev/null --- /dev/null
+++ b/src/main/java/cc/keyimc/keyi/utils/FastRandom.java +++ b/src/main/java/cc/keyimc/keyi/utils/FastRandom.java
@@ -0,0 +1,395 @@ @@ -0,0 +1,395 @@
@@ -423,29 +423,8 @@ index e5ea9f27a1936ed9e329e74317c91c5df89b9fbd..89a41d396162a1c2eb2df5192b0d888b
private long lastFill = -1; private long lastFill = -1;
private long nextRefill = -1; private long nextRefill = -1;
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/cached_blockpos_iteration/IterateOutwardsCache.java b/src/main/java/me/jellysquid/mods/lithium/common/cached_blockpos_iteration/IterateOutwardsCache.java
index a5d3aa309d3fdaab9e0fea2dfb91a080a3ac1193..384733b2b0bc7c5108ebdc725c0d13548bd349a3 100644
--- a/src/main/java/me/jellysquid/mods/lithium/common/cached_blockpos_iteration/IterateOutwardsCache.java
+++ b/src/main/java/me/jellysquid/mods/lithium/common/cached_blockpos_iteration/IterateOutwardsCache.java
@@ -6,6 +6,7 @@ import java.util.Iterator;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import net.minecraft.core.BlockPos;
+import cc.keyimc.keyi.utils.FastRandom; // KeYi
/**
* @author 2No2Name, original implemenation by SuperCoder7979 and Gegy1000
@@ -22,7 +23,7 @@ public class IterateOutwardsCache {
public IterateOutwardsCache(int capacity) {
this.capacity = capacity;
this.table = new ConcurrentHashMap<>(31);
- this.random = new Random();
+ this.random = new FastRandom(); // KeYi - use a faster random
}
private void fillPositionsWithIterateOutwards(LongList entry, int xRange, int yRange, int zRange) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 620173eef4c2f30a97a4c2f8049ea01fcc60d0b2..1ef5f03a332e832817be132bbbf3ac1021f085d1 100644 index e0e4a924e926b086699998095a1abddd01d8c002..f55584f7255012599fdce018b85e2e21e4660849 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -53,6 +53,10 @@ import net.minecraft.world.level.material.Fluids; @@ -53,6 +53,10 @@ import net.minecraft.world.level.material.Fluids;
@@ -461,7 +440,7 @@ index 620173eef4c2f30a97a4c2f8049ea01fcc60d0b2..1ef5f03a332e832817be132bbbf3ac10
@@ -932,7 +936,7 @@ public class LevelChunk extends ChunkAccess { @@ -932,7 +936,7 @@ public class LevelChunk extends ChunkAccess {
if (this.needsDecoration) { if (this.needsDecoration) {
//try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper // Purpur try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper
this.needsDecoration = false; this.needsDecoration = false;
- java.util.Random random = new java.util.Random(); - java.util.Random random = new java.util.Random();
+ Random random = new FastRandom(); + Random random = new FastRandom();
@@ -469,7 +448,7 @@ index 620173eef4c2f30a97a4c2f8049ea01fcc60d0b2..1ef5f03a332e832817be132bbbf3ac10
long xRand = random.nextLong() / 2L * 2L + 1L; long xRand = random.nextLong() / 2L * 2L + 1L;
long zRand = random.nextLong() / 2L * 2L + 1L; long zRand = random.nextLong() / 2L * 2L + 1L;
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index fc3442b4c7e1f22080fe6bf36d4fade162d6709e..7de2b353db5b76089c10cba826898bcd228f4ad9 100644 index dcfe090c269d4cbcc2eb1b6f85392848bb34656c..ef8909c9c13c8f46ec6d452f0d14c9a1119e0edf 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -26,6 +26,7 @@ import net.minecraft.nbt.CompoundTag; @@ -26,6 +26,7 @@ import net.minecraft.nbt.CompoundTag;
@@ -490,7 +469,7 @@ index fc3442b4c7e1f22080fe6bf36d4fade162d6709e..7de2b353db5b76089c10cba826898bcd
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index dabf1649f5bf14ec17dad6d43dcd7e2b7df255d3..ed754df76d3f86e2230c88ebb45125fe6af1e507 100644 index 41fafd4a1583e748d763439e8838739ec1ff8e1d..48c35afdbb8b08dbc1279bc57ea44bccb65b2a8a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -135,6 +135,7 @@ import org.bukkit.util.Consumer; @@ -135,6 +135,7 @@ import org.bukkit.util.Consumer;