1729 lines
97 KiB
Diff
1729 lines
97 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: nostalgic853 <yuu8583@proton.me>
|
|
Date: Mon, 24 Oct 2022 23:28:07 +0800
|
|
Subject: [PATCH] Revert purpur "Remove Timings"
|
|
|
|
This reverts commit 0fb6171d
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
|
|
index 54ec7955ba394e82663b08972dd89f69a23593ac..8dc1d2d15d571d1603a41dee13681a87841f5e23 100644
|
|
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
|
|
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
|
|
@@ -901,9 +901,9 @@ public final class ChunkHolderManager {
|
|
}
|
|
|
|
public boolean processTicketUpdates() {
|
|
- //co.aikar.timings.MinecraftTimings.distanceManagerTick.startTiming(); try { // Paper - add timings for distance manager // Purpur
|
|
+ co.aikar.timings.MinecraftTimings.distanceManagerTick.startTiming(); try { // Paper - add timings for distance manager
|
|
return this.processTicketUpdates(true, true, null);
|
|
- //} finally { co.aikar.timings.MinecraftTimings.distanceManagerTick.stopTiming(); } // Paper - add timings for distance manager // Purpur
|
|
+ } finally { co.aikar.timings.MinecraftTimings.distanceManagerTick.stopTiming(); } // Paper - add timings for distance manager
|
|
}
|
|
|
|
private static final ThreadLocal<List<ChunkProgressionTask>> CURRENT_TICKET_UPDATE_SCHEDULING = new ThreadLocal<>();
|
|
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
|
|
index e3fcbdbbf1972c382cbfe69a86eddff3dee4fba2..f20faaec3f1fe311b3ac989be5a9148e2e3c59ad 100644
|
|
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
|
|
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
|
|
@@ -1748,7 +1748,7 @@ public final class NewChunkHolder {
|
|
boolean canSavePOI = !(chunk instanceof LevelChunk levelChunk && levelChunk.mustNotSave) && (poi != null && poi.isDirty());
|
|
boolean canSaveEntities = entities != null;
|
|
|
|
- //try (co.aikar.timings.Timing ignored = this.world.timings.chunkSave.startTiming()) { // Paper // Purpur
|
|
+ try (co.aikar.timings.Timing ignored = this.world.timings.chunkSave.startTiming()) { // Paper
|
|
if (canSaveChunk) {
|
|
canSaveChunk = this.saveChunk(chunk, unloading);
|
|
}
|
|
@@ -1762,7 +1762,7 @@ public final class NewChunkHolder {
|
|
this.lastEntityUnload = null;
|
|
}
|
|
}
|
|
- //} // Purpur
|
|
+ }
|
|
|
|
return executedUnloadTask | canSaveChunk | canSaveEntities | canSavePOI;
|
|
}
|
|
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
|
index a7f4b791894c5d8b7af4b0c067cf167b29272a27..54bca103347e89f116fb7fbf37449a32ac094286 100644
|
|
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
|
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
|
@@ -67,14 +67,14 @@ public class GlobalConfiguration extends ConfigurationPart {
|
|
|
|
@Override
|
|
public void postProcess() {
|
|
- /*// Pufferfish start // Purpur
|
|
+ // Pufferfish start
|
|
if (enabled && !reallyEnabled) {
|
|
Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] To improve performance, timings have been disabled by default");
|
|
Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] You can still use timings by using /timings on, but they will not start on server startup unless you set timings.really-enabled to true in paper.yml");
|
|
Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] If you would like to disable this message, either set timings.really-enabled to true or timings.enabled to false.");
|
|
}
|
|
enabled = reallyEnabled;
|
|
- */// Pufferfish end // Purpur
|
|
+ // Pufferfish end
|
|
MinecraftTimings.processConfig(this);
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
|
index e8efbbeece7e866c6c4d7489677d2d9e15fea4d0..8bc0cb9ad5bb4e76d962ff54305e2c08e279a17b 100644
|
|
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
|
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
|
|
@@ -47,9 +47,8 @@ public class PacketUtils {
|
|
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
|
|
if (listener.getConnection().isConnected()) {
|
|
co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
|
|
- //try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings // Purpur
|
|
+ try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings
|
|
packet.handle(listener);
|
|
- /* // Purpur
|
|
} catch (Exception exception) {
|
|
net.minecraft.network.Connection networkmanager = listener.getConnection();
|
|
String playerIP = io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : "<ip address withheld>"; // Paper
|
|
@@ -61,7 +60,7 @@ public class PacketUtils {
|
|
net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error");
|
|
networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), net.minecraft.network.PacketSendListener.thenRun(() -> networkmanager.disconnect(error)));
|
|
networkmanager.setReadOnly();
|
|
- } */ // Purpur
|
|
+ }
|
|
} else {
|
|
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
|
|
index ede16b015b9dde07a7346e0bffde53082145798b..bc80783d36d46fb138bfa6f2e5e84679db0a68c1 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -294,7 +294,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
public final double[] recentTps = new double[ 4 ]; // Purpur
|
|
// Spigot end
|
|
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations;
|
|
- public final org.sucraft.suki.configuration.SukiConfigurations sukiConfigurations; // Suki - Suki configuration
|
|
public static long currentTickLong = 0L; // Paper
|
|
public boolean lagging = false; // Purpur
|
|
protected boolean upnp = false; // Purpur
|
|
@@ -314,10 +313,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
thread.setUncaughtExceptionHandler((thread1, throwable) -> {
|
|
MinecraftServer.LOGGER.error("Uncaught exception in server thread", throwable);
|
|
});
|
|
- // Suki start - multithreading environment variables
|
|
- if (Integer.getInteger("suki.mainthreadpriority", -1) != -1 || Runtime.getRuntime().availableProcessors() > 4) {
|
|
- thread.setPriority(Integer.getInteger("suki.mainthreadpriority", 8));
|
|
- // Suki end - multithreading environment variables
|
|
+ if (Runtime.getRuntime().availableProcessors() > 4) {
|
|
+ thread.setPriority(8);
|
|
}
|
|
|
|
S s0 = serverFactory.apply(thread); // CraftBukkit - decompile error
|
|
@@ -331,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) {
|
|
super("Server");
|
|
SERVER = this; // Paper - better singleton
|
|
- //this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; // Purpur
|
|
- //this.profiler = this.metricsRecorder.getProfiler(); // Purpur
|
|
- /*this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur
|
|
+ this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
|
|
+ this.profiler = this.metricsRecorder.getProfiler();
|
|
+ this.onMetricsRecordingStopped = (methodprofilerresults) -> {
|
|
this.stopRecordingMetrics();
|
|
- };*/ // Purpur
|
|
- //this.onMetricsRecordingFinished = (path) -> { // Purpur
|
|
- //}; // Purpur
|
|
+ };
|
|
+ this.onMetricsRecordingFinished = (path) -> {
|
|
+ };
|
|
this.status = new ServerStatus();
|
|
this.random = RandomSource.create();
|
|
this.port = -1;
|
|
@@ -403,7 +400,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
// Paper end
|
|
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
|
|
this.paperConfigurations = services.paperConfigurations(); // Paper
|
|
- this.sukiConfigurations = services.sukiConfigurations(); // Suki - Suki configuration
|
|
}
|
|
// CraftBukkit end
|
|
|
|
@@ -940,9 +936,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
// Paper end
|
|
// CraftBukkit end
|
|
- /*if (this.metricsRecorder.isRecording()) { // Purpur
|
|
+ if (this.metricsRecorder.isRecording()) {
|
|
this.cancelRecordingMetrics();
|
|
- }*/ // Purpur
|
|
+ }
|
|
|
|
MinecraftServer.LOGGER.info("Stopping server");
|
|
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Shutdown and don't bother finishing
|
|
@@ -1185,18 +1181,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
// Spigot end
|
|
|
|
- /*if (this.debugCommandProfilerDelayStart) { // Purpur
|
|
+ if (this.debugCommandProfilerDelayStart) {
|
|
this.debugCommandProfilerDelayStart = false;
|
|
this.debugCommandProfiler = new MinecraftServer.TimeProfiler(Util.getNanos(), this.tickCount);
|
|
- }*/ // Purpur
|
|
+ }
|
|
|
|
//MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time
|
|
lastTick = curTime;
|
|
this.nextTickTime += 50L;
|
|
- //this.startMetricsRecordingTick(); // Purpur
|
|
- //this.profiler.push("tick"); // Purpur
|
|
+ this.startMetricsRecordingTick();
|
|
+ this.profiler.push("tick");
|
|
this.tickServer(this::haveTime);
|
|
- //this.profiler.popPush("nextTickWait"); // Purpur
|
|
+ this.profiler.popPush("nextTickWait");
|
|
this.mayHaveDelayedTasks = true;
|
|
// Purpur start - tps catchup
|
|
if (org.purpurmc.purpur.PurpurConfig.tpsCatchup) {
|
|
@@ -1206,8 +1202,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
// Purpur end - tps catchup
|
|
this.waitUntilNextTick();
|
|
- //this.profiler.pop(); // Purpur
|
|
- //this.endMetricsRecordingTick(); // Purpur
|
|
+ this.profiler.pop();
|
|
+ this.endMetricsRecordingTick();
|
|
this.isReady = true;
|
|
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
|
|
}
|
|
@@ -1368,7 +1364,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
|
|
public void doRunTask(TickTask ticktask) { // CraftBukkit - decompile error
|
|
- //this.getProfiler().incrementCounter("runTask"); // Purpur
|
|
+ this.getProfiler().incrementCounter("runTask");
|
|
super.doRunTask(ticktask);
|
|
}
|
|
|
|
@@ -1412,15 +1408,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
public void onServerExit() {}
|
|
|
|
public void tickServer(BooleanSupplier shouldKeepTicking) {
|
|
- //co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper // Purpur
|
|
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper
|
|
long i = Util.getNanos();
|
|
|
|
// Paper start - move oversleep into full server tick
|
|
- //isOversleep = true;MinecraftTimings.serverOversleep.startTiming(); // Purpur
|
|
+ isOversleep = true;MinecraftTimings.serverOversleep.startTiming();
|
|
this.managedBlock(() -> {
|
|
return !this.canOversleep();
|
|
});
|
|
- //isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); // Purpur
|
|
+ isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
|
|
// Paper end
|
|
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper
|
|
|
|
@@ -1453,7 +1449,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
if (playerSaveInterval < 0) {
|
|
playerSaveInterval = autosavePeriod;
|
|
}
|
|
- //this.profiler.push("save"); // Purpur
|
|
+ this.profiler.push("save");
|
|
final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0;
|
|
try {
|
|
this.isSaving = true;
|
|
@@ -1468,20 +1464,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
} finally {
|
|
this.isSaving = false;
|
|
}
|
|
- //this.profiler.pop(); // Purpur
|
|
+ this.profiler.pop();
|
|
// Paper end
|
|
io.papermc.paper.util.CachedLists.reset(); // Paper
|
|
// Paper start - move executeAll() into full server tick timing
|
|
- //try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) { // Purpur
|
|
+ try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) {
|
|
this.runAllTasks();
|
|
- //} // Purpur
|
|
+ }
|
|
// Paper end
|
|
// Paper start
|
|
long endTime = System.nanoTime();
|
|
long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
|
|
new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
|
|
// Paper end
|
|
- //this.profiler.push("tallying"); // Purpur
|
|
+ this.profiler.push("tallying");
|
|
long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
|
|
|
|
this.averageTickTime = this.averageTickTime * 0.8F + (float) l / 1000000.0F * 0.19999999F;
|
|
@@ -1494,31 +1490,31 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
// Paper end
|
|
|
|
this.frameTimer.logFrameDuration(i1 - i);
|
|
- //this.profiler.pop(); // Purpur
|
|
+ this.profiler.pop();
|
|
org.spigotmc.WatchdogThread.tick(); // Spigot
|
|
- //co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper // Purpur
|
|
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
|
|
}
|
|
|
|
public void tickChildren(BooleanSupplier shouldKeepTicking) {
|
|
- //MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper // Purpur
|
|
+ MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper
|
|
this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
|
|
- //MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper // Purpur
|
|
- //this.profiler.push("commandFunctions"); // Purpur
|
|
- //MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper // Purpur
|
|
+ MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper
|
|
+ this.profiler.push("commandFunctions");
|
|
+ MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper
|
|
this.getFunctions().tick();
|
|
- //MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot // Paper // Purpur
|
|
- //this.profiler.popPush("levels"); // Purpur
|
|
+ MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot // Paper
|
|
+ this.profiler.popPush("levels");
|
|
//Iterator iterator = this.getAllLevels().iterator(); // Paper - moved down
|
|
|
|
// CraftBukkit start
|
|
// Run tasks that are waiting on processing
|
|
- //MinecraftTimings.processQueueTimer.startTiming(); // Spigot // Purpur
|
|
+ MinecraftTimings.processQueueTimer.startTiming(); // Spigot
|
|
while (!this.processQueue.isEmpty()) {
|
|
this.processQueue.remove().run();
|
|
}
|
|
- //MinecraftTimings.processQueueTimer.stopTiming(); // Spigot // Purpur
|
|
+ MinecraftTimings.processQueueTimer.stopTiming(); // Spigot
|
|
|
|
- //MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper // Purpur
|
|
+ MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper
|
|
// Send time updates to everyone, it will get the right time from the world the player is in.
|
|
// Paper start - optimize time updates
|
|
for (final ServerLevel world : this.getAllLevels()) {
|
|
@@ -1538,10 +1534,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
}
|
|
// Paper end
|
|
- //MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper // Purpur
|
|
+ MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper
|
|
|
|
this.isIteratingOverLevels = true; // Paper
|
|
- net.minecraft.network.FriendlyByteBuf.hasItemSerializeEvent = org.purpurmc.purpur.event.packet.NetworkItemSerializeEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur
|
|
Iterator iterator = this.getAllLevels().iterator(); // Paper - move down
|
|
while (iterator.hasNext()) {
|
|
ServerLevel worldserver = (ServerLevel) iterator.next();
|
|
@@ -1550,28 +1545,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
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
|
|
|
|
- /*this.profiler.push(() -> { // Purpur
|
|
+ this.profiler.push(() -> {
|
|
return worldserver + " " + worldserver.dimension().location();
|
|
- });*/ // Purpur
|
|
+ });
|
|
/* Drop global time updates
|
|
if (this.tickCount % 20 == 0) {
|
|
- //this.profiler.push("timeSync"); // Purpur
|
|
+ this.profiler.push("timeSync");
|
|
this.playerList.broadcastAll(new PacketPlayOutUpdateTime(worldserver.getGameTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)), worldserver.dimension());
|
|
- //this.profiler.pop(); // Purpur
|
|
+ this.profiler.pop();
|
|
}
|
|
// CraftBukkit end */
|
|
|
|
- //this.profiler.push("tick"); // Purpur
|
|
+ this.profiler.push("tick");
|
|
|
|
try {
|
|
- //worldserver.timings.doTick.startTiming(); // Spigot // Purpur
|
|
+ worldserver.timings.doTick.startTiming(); // Spigot
|
|
worldserver.tick(shouldKeepTicking);
|
|
// Paper start
|
|
for (final io.papermc.paper.chunk.SingleThreadChunkRegionManager regionManager : worldserver.getChunkSource().chunkMap.regionManagers) {
|
|
regionManager.recalculateRegions();
|
|
}
|
|
// Paper end
|
|
- //worldserver.timings.doTick.stopTiming(); // Spigot // Purpur
|
|
+ worldserver.timings.doTick.stopTiming(); // Spigot
|
|
} catch (Throwable throwable) {
|
|
// Spigot Start
|
|
CrashReport crashreport;
|
|
@@ -1587,33 +1582,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
throw new ReportedException(crashreport);
|
|
}
|
|
|
|
- //this.profiler.pop(); // Purpur
|
|
- //this.profiler.pop(); // Purpur
|
|
+ this.profiler.pop();
|
|
+ this.profiler.pop();
|
|
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
|
|
}
|
|
this.isIteratingOverLevels = false; // Paper
|
|
|
|
- //this.profiler.popPush("connection"); // Purpur
|
|
- //MinecraftTimings.connectionTimer.startTiming(); // Spigot // Purpur
|
|
+ this.profiler.popPush("connection");
|
|
+ MinecraftTimings.connectionTimer.startTiming(); // Spigot
|
|
this.getConnection().tick();
|
|
- //MinecraftTimings.connectionTimer.stopTiming(); // Spigot // Purpur
|
|
- //this.profiler.popPush("players"); // Purpur
|
|
- //MinecraftTimings.playerListTimer.startTiming(); // Spigot // Paper // Purpur
|
|
+ MinecraftTimings.connectionTimer.stopTiming(); // Spigot
|
|
+ this.profiler.popPush("players");
|
|
+ MinecraftTimings.playerListTimer.startTiming(); // Spigot // Paper
|
|
this.playerList.tick();
|
|
- //MinecraftTimings.playerListTimer.stopTiming(); // Spigot // Paper // Purpur
|
|
+ MinecraftTimings.playerListTimer.stopTiming(); // Spigot // Paper
|
|
if (SharedConstants.IS_RUNNING_IN_IDE) {
|
|
GameTestTicker.SINGLETON.tick();
|
|
}
|
|
|
|
- //this.profiler.popPush("server gui refresh"); // Purpur
|
|
+ this.profiler.popPush("server gui refresh");
|
|
|
|
- //MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper // Purpur
|
|
+ MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper
|
|
for (int i = 0; i < this.tickables.size(); ++i) {
|
|
((Runnable) this.tickables.get(i)).run();
|
|
}
|
|
- //MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper // Purpur
|
|
+ MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper
|
|
|
|
- //this.profiler.pop(); // Purpur
|
|
+ this.profiler.pop();
|
|
}
|
|
|
|
public boolean isNetherEnabled() {
|
|
@@ -2261,7 +2256,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
|
|
public ProfilerFiller getProfiler() {
|
|
- if (true || gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Purpur
|
|
+ if (gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE;
|
|
return this.profiler;
|
|
}
|
|
|
|
@@ -2501,7 +2496,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
// CraftBukkit end
|
|
|
|
private void startMetricsRecordingTick() {
|
|
- if (false && this.willStartRecordingMetrics) { // Purpur
|
|
+ if (this.willStartRecordingMetrics) {
|
|
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(Util.timeSource, this.isDedicatedServer()), Util.timeSource, Util.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
|
|
this.executeBlocking(() -> {
|
|
this.saveDebugReport(path.resolve("server"));
|
|
@@ -2511,40 +2506,40 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
this.willStartRecordingMetrics = false;
|
|
}
|
|
|
|
- //this.profiler = SingleTickProfiler.decorateFiller(this.metricsRecorder.getProfiler(), SingleTickProfiler.createTickProfiler("Server")); // Purpur
|
|
- //this.metricsRecorder.startTick(); // Purpur
|
|
- //this.profiler.startTick(); // Purpur
|
|
+ this.profiler = SingleTickProfiler.decorateFiller(this.metricsRecorder.getProfiler(), SingleTickProfiler.createTickProfiler("Server"));
|
|
+ this.metricsRecorder.startTick();
|
|
+ this.profiler.startTick();
|
|
}
|
|
|
|
private void endMetricsRecordingTick() {
|
|
- //this.profiler.endTick(); // Purpur
|
|
- //this.metricsRecorder.endTick(); // Purpur
|
|
+ this.profiler.endTick();
|
|
+ this.metricsRecorder.endTick();
|
|
}
|
|
|
|
public boolean isRecordingMetrics() {
|
|
- return false; //this.metricsRecorder.isRecording(); // Purpur
|
|
+ return this.metricsRecorder.isRecording();
|
|
}
|
|
|
|
public void startRecordingMetrics(Consumer<ProfileResults> resultConsumer, Consumer<Path> dumpConsumer) {
|
|
- /*this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur
|
|
+ this.onMetricsRecordingStopped = (methodprofilerresults) -> {
|
|
this.stopRecordingMetrics();
|
|
resultConsumer.accept(methodprofilerresults);
|
|
};
|
|
this.onMetricsRecordingFinished = dumpConsumer;
|
|
- this.willStartRecordingMetrics = true;*/ // Purpur
|
|
+ this.willStartRecordingMetrics = true;
|
|
}
|
|
|
|
public void stopRecordingMetrics() {
|
|
- //this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; // Purpur
|
|
+ this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
|
|
}
|
|
|
|
public void finishRecordingMetrics() {
|
|
- //this.metricsRecorder.end(); // Purpur
|
|
+ this.metricsRecorder.end();
|
|
}
|
|
|
|
public void cancelRecordingMetrics() {
|
|
- //this.metricsRecorder.cancel(); // Purpur
|
|
- //this.profiler = this.metricsRecorder.getProfiler(); // Purpur
|
|
+ this.metricsRecorder.cancel();
|
|
+ this.profiler = this.metricsRecorder.getProfiler();
|
|
}
|
|
|
|
public Path getWorldPath(LevelResource worldSavePath) {
|
|
@@ -2589,15 +2584,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
|
|
public boolean isTimeProfilerRunning() {
|
|
- return false; //this.debugCommandProfilerDelayStart || this.debugCommandProfiler != null; // Purpur
|
|
+ return this.debugCommandProfilerDelayStart || this.debugCommandProfiler != null;
|
|
}
|
|
|
|
public void startTimeProfiler() {
|
|
- //this.debugCommandProfilerDelayStart = true; // Purpur
|
|
+ this.debugCommandProfilerDelayStart = true;
|
|
}
|
|
|
|
public ProfileResults stopTimeProfiler() {
|
|
- if (true || this.debugCommandProfiler == null) { // Purpur
|
|
+ if (this.debugCommandProfiler == null) {
|
|
return EmptyProfileResults.EMPTY;
|
|
} else {
|
|
ProfileResults methodprofilerresults = this.debugCommandProfiler.stop(Util.getNanos(), this.tickCount);
|
|
@@ -2770,7 +2765,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
return;
|
|
}
|
|
|
|
- //co.aikar.timings.MinecraftTimings.midTickChunkTasks.startTiming(); // Purpur
|
|
+ co.aikar.timings.MinecraftTimings.midTickChunkTasks.startTiming();
|
|
try {
|
|
for (;;) {
|
|
boolean moreTasks = this.tickMidTickTasks();
|
|
@@ -2790,14 +2785,14 @@ 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 {
|
|
- //co.aikar.timings.MinecraftTimings.midTickChunkTasks.stopTiming(); // Purpur
|
|
+ co.aikar.timings.MinecraftTimings.midTickChunkTasks.stopTiming();
|
|
}
|
|
}
|
|
// Paper end - execute chunk tasks mid tick
|
|
diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java
|
|
index 2986f110348b376bcdc64fa39b68885551663d4d..d1fa6b1edf733e15dfe9ecbf7ed639238ed43442 100644
|
|
--- a/src/main/java/net/minecraft/server/ServerFunctionManager.java
|
|
+++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java
|
|
@@ -88,7 +88,7 @@ public class ServerFunctionManager {
|
|
} else {
|
|
int i;
|
|
|
|
- try /*(co.aikar.timings.Timing timing = function.getTiming().startTiming())*/ { // Paper // Purpur
|
|
+ try (co.aikar.timings.Timing timing = function.getTiming().startTiming()) { // Paper
|
|
this.context = new ServerFunctionManager.ExecutionContext(tracer);
|
|
i = this.context.runTopCommand(function, source);
|
|
} finally {
|
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
index 3e7dd41555263e8361db08d1380c767fe0ba8886..d6c3db7234fa9b52e945cb004d8ae843aabf1302 100644
|
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
@@ -542,7 +542,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
}
|
|
|
|
public void handleConsoleInputs() {
|
|
- //MinecraftTimings.serverCommandTimer.startTiming(); // Spigot // Purpur
|
|
+ MinecraftTimings.serverCommandTimer.startTiming(); // Spigot
|
|
// Paper start - use proper queue
|
|
ConsoleInput servercommand;
|
|
while ((servercommand = this.serverCommandQueue.poll()) != null) {
|
|
@@ -559,7 +559,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
// CraftBukkit end
|
|
}
|
|
|
|
- //MinecraftTimings.serverCommandTimer.stopTiming(); // Spigot // Purpur
|
|
+ MinecraftTimings.serverCommandTimer.stopTiming(); // Spigot
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
index 3c99de7bc5b3c5159ad76f63d67877756f152385..a2a4965aec45f3ff83703b636e46f5c545cfb48e 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
@@ -606,20 +606,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
}
|
|
|
|
protected void tick(BooleanSupplier shouldKeepTicking) {
|
|
- //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // Purpur
|
|
+ ProfilerFiller gameprofilerfiller = this.level.getProfiler();
|
|
|
|
- //try (Timing ignored = this.level.timings.poiUnload.startTiming()) { // Paper // Purpur
|
|
- //gameprofilerfiller.push("poi"); // Purpur
|
|
+ try (Timing ignored = this.level.timings.poiUnload.startTiming()) { // Paper
|
|
+ gameprofilerfiller.push("poi");
|
|
this.poiManager.tick(shouldKeepTicking);
|
|
- //} // Paper // Purpur
|
|
- //gameprofilerfiller.popPush("chunk_unload"); // Purpur
|
|
+ } // Paper
|
|
+ gameprofilerfiller.popPush("chunk_unload");
|
|
if (!this.level.noSave()) {
|
|
- //try (Timing ignored = this.level.timings.chunkUnload.startTiming()) { // Paper // Purpur
|
|
+ try (Timing ignored = this.level.timings.chunkUnload.startTiming()) { // Paper
|
|
this.processUnloads(shouldKeepTicking);
|
|
- //} // Paper // Purpur
|
|
+ } // Paper
|
|
}
|
|
|
|
- //gameprofilerfiller.pop(); // Purpur
|
|
+ gameprofilerfiller.pop();
|
|
}
|
|
|
|
public boolean hasWork() {
|
|
@@ -1237,55 +1237,26 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
entity.tracker = null; // Paper - We're no longer tracked
|
|
}
|
|
|
|
- // petal start - multithreaded tracker
|
|
- private @Nullable host.bloom.tracker.MultithreadedTracker multithreadedTracker;
|
|
- private final java.util.concurrent.ConcurrentLinkedQueue<Runnable> trackerMainThreadTasks = new java.util.concurrent.ConcurrentLinkedQueue<>();
|
|
- private boolean tracking = false;
|
|
-
|
|
- public void runOnTrackerMainThread(final Runnable runnable) {
|
|
- if (this.tracking) {
|
|
- this.trackerMainThreadTasks.add(runnable);
|
|
- } else {
|
|
- runnable.run();
|
|
- }
|
|
- }
|
|
-
|
|
// Paper start - optimised tracker
|
|
private final void processTrackQueue() {
|
|
- if (true) {
|
|
- if (this.multithreadedTracker == null) {
|
|
- this.multithreadedTracker = new host.bloom.tracker.MultithreadedTracker(this.level.chunkSource.entityTickingChunks, this.trackerMainThreadTasks);
|
|
- }
|
|
-
|
|
- this.tracking = true;
|
|
- try {
|
|
- this.multithreadedTracker.tick();
|
|
- } finally {
|
|
- this.tracking = false;
|
|
- }
|
|
- return;
|
|
- }
|
|
- // petal end
|
|
-
|
|
this.level.timings.tracker1.startTiming();
|
|
- //this.level.timings.tracker1.startTiming(); // Purpur
|
|
try {
|
|
for (TrackedEntity tracker : this.entityMap.values()) {
|
|
// update tracker entry
|
|
tracker.updatePlayers(tracker.entity.getPlayersInTrackRange());
|
|
}
|
|
} finally {
|
|
- //this.level.timings.tracker1.stopTiming(); // Purpur
|
|
+ this.level.timings.tracker1.stopTiming();
|
|
}
|
|
|
|
|
|
- //this.level.timings.tracker2.startTiming(); // Purpur
|
|
+ this.level.timings.tracker2.startTiming();
|
|
try {
|
|
for (TrackedEntity tracker : this.entityMap.values()) {
|
|
tracker.serverEntity.sendChanges();
|
|
}
|
|
} finally {
|
|
- //this.level.timings.tracker2.stopTiming(); // Purpur
|
|
+ this.level.timings.tracker2.stopTiming();
|
|
}
|
|
}
|
|
// Paper end - optimised tracker
|
|
@@ -1300,7 +1271,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
List<ServerPlayer> list = Lists.newArrayList();
|
|
List<ServerPlayer> list1 = this.level.players();
|
|
ObjectIterator objectiterator = this.entityMap.values().iterator();
|
|
- //level.timings.tracker1.startTiming(); // Paper // Purpur
|
|
+ level.timings.tracker1.startTiming(); // Paper
|
|
|
|
ChunkMap.TrackedEntity playerchunkmap_entitytracker;
|
|
|
|
@@ -1325,17 +1296,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
playerchunkmap_entitytracker.serverEntity.sendChanges();
|
|
}
|
|
}
|
|
- //level.timings.tracker1.stopTiming(); // Paper // Purpur
|
|
+ level.timings.tracker1.stopTiming(); // Paper
|
|
|
|
if (!list.isEmpty()) {
|
|
objectiterator = this.entityMap.values().iterator();
|
|
|
|
- //level.timings.tracker2.startTiming(); // Paper // Purpur
|
|
+ level.timings.tracker2.startTiming(); // Paper
|
|
while (objectiterator.hasNext()) {
|
|
playerchunkmap_entitytracker = (ChunkMap.TrackedEntity) objectiterator.next();
|
|
playerchunkmap_entitytracker.updatePlayers(list);
|
|
}
|
|
- //level.timings.tracker2.stopTiming(); // Paper // Purpur
|
|
+ level.timings.tracker2.stopTiming(); // Paper
|
|
}
|
|
|
|
}
|
|
@@ -1491,11 +1462,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
public class TrackedEntity {
|
|
|
|
- public final ServerEntity serverEntity; // petal -> public
|
|
- public final Entity entity; // petal -> public
|
|
+ final ServerEntity serverEntity;
|
|
+ final Entity entity;
|
|
private final int range;
|
|
SectionPos lastSectionPos;
|
|
- public final Set<ServerPlayerConnection> seenBy = it.unimi.dsi.fastutil.objects.ReferenceSets.synchronize(new ReferenceOpenHashSet<>()); // Paper - optimise map impl // petal - sync
|
|
+ public final Set<ServerPlayerConnection> seenBy = new ReferenceOpenHashSet<>(); // Paper - optimise map impl
|
|
|
|
public TrackedEntity(Entity entity, int i, int j, boolean flag) {
|
|
this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, this.seenBy); // CraftBukkit
|
|
@@ -1507,7 +1478,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
// Paper start - use distance map to optimise tracker
|
|
com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> lastTrackerCandidates;
|
|
|
|
- public final void updatePlayers(com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> newTrackerCandidates) { // petal -> public
|
|
+ final void updatePlayers(com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> newTrackerCandidates) {
|
|
com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> oldTrackerCandidates = this.lastTrackerCandidates;
|
|
this.lastTrackerCandidates = newTrackerCandidates;
|
|
|
|
@@ -1579,7 +1550,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
}
|
|
|
|
public void removePlayer(ServerPlayer player) {
|
|
- //org.spigotmc.AsyncCatcher.catchOp("player tracker clear"); // Spigot // petal - we can remove async too
|
|
+ org.spigotmc.AsyncCatcher.catchOp("player tracker clear"); // Spigot
|
|
if (this.seenBy.remove(player.connection)) {
|
|
this.serverEntity.removePairing(player);
|
|
}
|
|
@@ -1587,7 +1558,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
}
|
|
|
|
public void updatePlayer(ServerPlayer player) {
|
|
- //org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot // petal - we can update async
|
|
+ org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot
|
|
if (player != this.entity) {
|
|
// Paper start - remove allocation of Vec3D here
|
|
// Vec3 vec3d = player.position().subtract(this.entity.position());
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
index cd5533c3c53215c9cc4be0b9097d76efbf5bd0c1..7266e6703d5cd0fea90ec88c74a7d4567f2420ae 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
@@ -430,16 +430,16 @@ public class ServerChunkCache extends ChunkSource {
|
|
return ifLoaded;
|
|
}
|
|
// Paper end
|
|
- //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // Purpur
|
|
+ ProfilerFiller gameprofilerfiller = this.level.getProfiler();
|
|
|
|
- //gameprofilerfiller.incrementCounter("getChunk"); // Purpur
|
|
+ gameprofilerfiller.incrementCounter("getChunk");
|
|
long k = ChunkPos.asLong(x, z);
|
|
|
|
ChunkAccess ichunkaccess;
|
|
|
|
// Paper - rewrite chunk system - there are no correct callbacks to remove items from cache in the new chunk system
|
|
|
|
- //gameprofilerfiller.incrementCounter("getChunkCacheMiss"); // Purpur
|
|
+ gameprofilerfiller.incrementCounter("getChunkCacheMiss");
|
|
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkFutureMainThread(x, z, leastStatus, create, true); // Paper
|
|
ServerChunkCache.MainThreadExecutor chunkproviderserver_b = this.mainThreadProcessor;
|
|
|
|
@@ -449,10 +449,10 @@ public class ServerChunkCache extends ChunkSource {
|
|
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.pushChunkWait(this.level, x1, z1); // Paper - rewrite chunk system
|
|
// Paper end
|
|
com.destroystokyo.paper.io.SyncLoadFinder.logSyncLoad(this.level, x1, z1); // Paper - sync load info
|
|
- //this.level.timings.syncChunkLoad.startTiming(); // Paper // Purpur
|
|
+ this.level.timings.syncChunkLoad.startTiming(); // Paper
|
|
chunkproviderserver_b.managedBlock(completablefuture::isDone);
|
|
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.popChunkWait(); // Paper - async chunk debug // Paper - rewrite chunk system
|
|
- //this.level.timings.syncChunkLoad.stopTiming(); // Paper // Purpur
|
|
+ this.level.timings.syncChunkLoad.stopTiming(); // Paper
|
|
} // Paper
|
|
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
|
|
return ichunkaccess1;
|
|
@@ -600,17 +600,17 @@ public class ServerChunkCache extends ChunkSource {
|
|
|
|
public void save(boolean flush) {
|
|
this.runDistanceManagerUpdates();
|
|
- //try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings // Purpur
|
|
+ try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings
|
|
this.chunkMap.saveAllChunks(flush);
|
|
- //} // Paper - Timings // Purpur
|
|
+ } // Paper - Timings
|
|
}
|
|
|
|
// Paper start - duplicate save, but call incremental
|
|
public void saveIncrementally() {
|
|
this.runDistanceManagerUpdates();
|
|
- //try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings // Purpur
|
|
+ try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings
|
|
this.chunkMap.saveIncrementally();
|
|
- //} // Paper - Timings // Purpur
|
|
+ } // Paper - Timings
|
|
}
|
|
// Paper end
|
|
|
|
@@ -627,36 +627,36 @@ public class ServerChunkCache extends ChunkSource {
|
|
// CraftBukkit start - modelled on below
|
|
public void purgeUnload() {
|
|
if (true) return; // Paper - tickets will be removed later, this behavior isn't really well accounted for by the chunk system
|
|
- //this.level.getProfiler().push("purge"); // Purpur
|
|
+ this.level.getProfiler().push("purge");
|
|
this.distanceManager.purgeStaleTickets();
|
|
this.runDistanceManagerUpdates();
|
|
- //this.level.getProfiler().popPush("unload"); // Purpur
|
|
+ this.level.getProfiler().popPush("unload");
|
|
this.chunkMap.tick(() -> true);
|
|
- //this.level.getProfiler().pop(); // Purpur
|
|
+ this.level.getProfiler().pop();
|
|
this.clearCache();
|
|
}
|
|
// CraftBukkit end
|
|
|
|
@Override
|
|
public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) {
|
|
- //this.level.getProfiler().push("purge"); // Purpur
|
|
- //this.level.timings.doChunkMap.startTiming(); // Spigot // Purpur
|
|
+ this.level.getProfiler().push("purge");
|
|
+ this.level.timings.doChunkMap.startTiming(); // Spigot
|
|
this.distanceManager.purgeStaleTickets();
|
|
this.runDistanceManagerUpdates();
|
|
- //this.level.timings.doChunkMap.stopTiming(); // Spigot // Purpur
|
|
- //this.level.getProfiler().popPush("chunks"); // Purpur
|
|
+ this.level.timings.doChunkMap.stopTiming(); // Spigot
|
|
+ this.level.getProfiler().popPush("chunks");
|
|
if (tickChunks) {
|
|
- //this.level.timings.chunks.startTiming(); // Paper - timings // Purpur
|
|
+ this.level.timings.chunks.startTiming(); // Paper - timings
|
|
this.chunkMap.playerChunkManager.tick(); // Paper - this is mostly is to account for view distance changes
|
|
this.tickChunks();
|
|
- //this.level.timings.chunks.stopTiming(); // Paper - timings // Purpur
|
|
+ this.level.timings.chunks.stopTiming(); // Paper - timings
|
|
}
|
|
|
|
- //this.level.timings.doChunkUnload.startTiming(); // Spigot // Purpur
|
|
- //this.level.getProfiler().popPush("unload"); // Purpur
|
|
+ this.level.timings.doChunkUnload.startTiming(); // Spigot
|
|
+ this.level.getProfiler().popPush("unload");
|
|
this.chunkMap.tick(shouldKeepTicking);
|
|
- //this.level.timings.doChunkUnload.stopTiming(); // Spigot // Purpur
|
|
- //this.level.getProfiler().pop(); // Purpur
|
|
+ this.level.timings.doChunkUnload.stopTiming(); // Spigot
|
|
+ this.level.getProfiler().pop();
|
|
this.clearCache();
|
|
}
|
|
|
|
@@ -702,15 +702,15 @@ public class ServerChunkCache extends ChunkSource {
|
|
}
|
|
// Paper end - optimize isOutisdeRange
|
|
LevelData worlddata = this.level.getLevelData();
|
|
- //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // Purpur
|
|
+ ProfilerFiller gameprofilerfiller = this.level.getProfiler();
|
|
|
|
- //gameprofilerfiller.push("pollingChunks"); // Purpur
|
|
+ gameprofilerfiller.push("pollingChunks");
|
|
this.level.resetIceAndSnowTick(); // Pufferfish - reset ice & snow tick random
|
|
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
|
|
boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
|
|
|
|
- //gameprofilerfiller.push("naturalSpawnCount"); // Purpur
|
|
- //this.level.timings.countNaturalMobs.startTiming(); // Paper - timings // Purpur
|
|
+ gameprofilerfiller.push("naturalSpawnCount");
|
|
+ this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
|
|
int l = this.distanceManager.getNaturalSpawnChunkCount();
|
|
// Paper start - per player mob spawning
|
|
NaturalSpawner.SpawnState spawnercreature_d; // moved down
|
|
@@ -731,16 +731,16 @@ public class ServerChunkCache extends ChunkSource {
|
|
// Pufferfish end
|
|
}
|
|
// Paper end
|
|
- //this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings // Purpur
|
|
+ this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
|
|
|
|
//this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously
|
|
- //gameprofilerfiller.popPush("filteringLoadedChunks"); // Purpur
|
|
+ gameprofilerfiller.popPush("filteringLoadedChunks");
|
|
// Paper - moved down
|
|
- //this.level.timings.chunkTicks.startTiming(); // Paper // Purpur
|
|
+ this.level.timings.chunkTicks.startTiming(); // Paper
|
|
|
|
// Paper - moved down
|
|
|
|
- //gameprofilerfiller.popPush("spawnAndTick"); // Purpur
|
|
+ gameprofilerfiller.popPush("spawnAndTick");
|
|
boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
|
|
|
|
// Paper - only shuffle if per-player mob spawning is disabled
|
|
@@ -790,17 +790,17 @@ public class ServerChunkCache extends ChunkSource {
|
|
}
|
|
}
|
|
// Paper end - optimise chunk tick iteration
|
|
- //this.level.timings.chunkTicks.stopTiming(); // Paper // Purpur
|
|
- //gameprofilerfiller.popPush("customSpawners"); // Purpur
|
|
+ this.level.timings.chunkTicks.stopTiming(); // Paper
|
|
+ gameprofilerfiller.popPush("customSpawners");
|
|
if (flag2) {
|
|
- //try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings // Purpur
|
|
+ try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings
|
|
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
|
|
- //} // Paper - timings // Purpur
|
|
+ } // Paper - timings
|
|
}
|
|
- //gameprofilerfiller.pop(); // Purpur
|
|
+ gameprofilerfiller.pop();
|
|
// Paper start - use set of chunks requiring updates, rather than iterating every single one loaded
|
|
- //gameprofilerfiller.popPush("broadcast"); // Purpur
|
|
- //this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing // Purpur
|
|
+ gameprofilerfiller.popPush("broadcast");
|
|
+ this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing
|
|
if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) {
|
|
ReferenceOpenHashSet<ChunkHolder> copy = this.chunkMap.needsChangeBroadcasting.clone();
|
|
this.chunkMap.needsChangeBroadcasting.clear();
|
|
@@ -812,8 +812,8 @@ public class ServerChunkCache extends ChunkSource {
|
|
}
|
|
}
|
|
}
|
|
- //this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing // Purpur
|
|
- //gameprofilerfiller.pop(); // Purpur
|
|
+ this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing
|
|
+ gameprofilerfiller.pop();
|
|
// Paper end - use set of chunks requiring updates, rather than iterating every single one loaded
|
|
// Paper start - controlled flush for entity tracker packets
|
|
List<net.minecraft.network.Connection> disabledFlushes = new java.util.ArrayList<>(this.level.players.size());
|
|
@@ -1024,7 +1024,7 @@ public class ServerChunkCache extends ChunkSource {
|
|
|
|
@Override
|
|
protected void doRunTask(Runnable task) {
|
|
- //ServerChunkCache.this.level.getProfiler().incrementCounter("runTask"); // Purpur
|
|
+ ServerChunkCache.this.level.getProfiler().incrementCounter("runTask");
|
|
super.doRunTask(task);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
index ba95c8ba2fdcb73065c2fc219f94528239751f33..55fe8b0f21f00b02e78257a64fd8d63980d50995 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -227,13 +227,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
return new Throwable(entity + " Added to world at " + new java.util.Date());
|
|
}
|
|
|
|
- // 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
|
|
}
|
|
@@ -533,7 +526,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
|
// Holder holder = worlddimension.typeHolder(); // CraftBukkit - decompile error
|
|
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
|
|
- super(iworlddataserver, resourcekey, worlddimension.typeHolder(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig)), spigotConfig -> minecraftserver.sukiConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig)), executor); // Paper - Async-Anti-Xray - Pass executor // Suki - Suki configuration
|
|
+ super(iworlddataserver, resourcekey, worlddimension.typeHolder(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig)), executor); // Paper - Async-Anti-Xray - Pass executor
|
|
this.pvpMode = minecraftserver.isPvpAllowed();
|
|
this.convertable = convertable_conversionsession;
|
|
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
|
|
@@ -658,12 +651,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
}
|
|
}
|
|
// Paper end - optimise checkDespawn
|
|
- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur
|
|
+ ProfilerFiller gameprofilerfiller = this.getProfiler();
|
|
|
|
this.handlingTick = true;
|
|
- //gameprofilerfiller.push("world border"); // Purpur
|
|
+ gameprofilerfiller.push("world border");
|
|
this.getWorldBorder().tick();
|
|
- //gameprofilerfiller.popPush("weather"); // Purpur
|
|
+ gameprofilerfiller.popPush("weather");
|
|
this.advanceWeatherCycle();
|
|
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
|
|
long j;
|
|
@@ -690,32 +683,32 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
|
|
this.updateSkyBrightness();
|
|
this.tickTime();
|
|
- //gameprofilerfiller.popPush("tickPending"); // Purpur
|
|
- //timings.scheduledBlocks.startTiming(); // Paper // Purpur
|
|
+ gameprofilerfiller.popPush("tickPending");
|
|
+ timings.scheduledBlocks.startTiming(); // Paper
|
|
if (!this.isDebug()) {
|
|
j = this.getGameTime();
|
|
- //gameprofilerfiller.push("blockTicks"); // Purpur
|
|
+ gameprofilerfiller.push("blockTicks");
|
|
this.blockTicks.tick(j, 65536, this::tickBlock);
|
|
- //gameprofilerfiller.popPush("fluidTicks"); // Purpur
|
|
+ gameprofilerfiller.popPush("fluidTicks");
|
|
this.fluidTicks.tick(j, 65536, this::tickFluid);
|
|
- //gameprofilerfiller.pop(); // Purpur
|
|
+ gameprofilerfiller.pop();
|
|
}
|
|
- //timings.scheduledBlocks.stopTiming(); // Paper // Purpur
|
|
+ timings.scheduledBlocks.stopTiming(); // Paper
|
|
|
|
- //gameprofilerfiller.popPush("raid"); // Purpur
|
|
- //this.timings.raids.startTiming(); // Paper - timings // Purpur
|
|
+ gameprofilerfiller.popPush("raid");
|
|
+ this.timings.raids.startTiming(); // Paper - timings
|
|
this.raids.tick();
|
|
- //this.timings.raids.stopTiming(); // Paper - timings // Purpur
|
|
- //gameprofilerfiller.popPush("chunkSource"); // Purpur
|
|
- //this.timings.chunkProviderTick.startTiming(); // Paper - timings // Purpur
|
|
+ this.timings.raids.stopTiming(); // Paper - timings
|
|
+ gameprofilerfiller.popPush("chunkSource");
|
|
+ this.timings.chunkProviderTick.startTiming(); // Paper - timings
|
|
this.getChunkSource().tick(shouldKeepTicking, true);
|
|
- //this.timings.chunkProviderTick.stopTiming(); // Paper - timings // Purpur
|
|
- //gameprofilerfiller.popPush("blockEvents"); // Purpur
|
|
- //timings.doSounds.startTiming(); // Spigot // Purpur
|
|
+ this.timings.chunkProviderTick.stopTiming(); // Paper - timings
|
|
+ gameprofilerfiller.popPush("blockEvents");
|
|
+ timings.doSounds.startTiming(); // Spigot
|
|
this.runBlockEvents();
|
|
- //timings.doSounds.stopTiming(); // Spigot // Purpur
|
|
+ timings.doSounds.stopTiming(); // Spigot
|
|
this.handlingTick = false;
|
|
- //gameprofilerfiller.pop(); // Purpur
|
|
+ gameprofilerfiller.pop();
|
|
boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
|
|
|
|
if (flag) {
|
|
@@ -723,24 +716,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
}
|
|
|
|
if (flag || this.emptyTime++ < 300) {
|
|
- //gameprofilerfiller.push("entities"); // Purpur
|
|
- //timings.tickEntities.startTiming(); // Spigot // Purpur
|
|
+ gameprofilerfiller.push("entities");
|
|
+ timings.tickEntities.startTiming(); // Spigot
|
|
if (this.dragonFight != null) {
|
|
- //gameprofilerfiller.push("dragonFight"); // Purpur
|
|
+ gameprofilerfiller.push("dragonFight");
|
|
this.dragonFight.tick();
|
|
- //gameprofilerfiller.pop(); // Purpur
|
|
+ gameprofilerfiller.pop();
|
|
}
|
|
|
|
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
|
- //timings.entityTick.startTiming(); // Spigot // Purpur
|
|
+ timings.entityTick.startTiming(); // Spigot
|
|
this.entityTickList.forEach((entity) -> {
|
|
if (!entity.isRemoved()) {
|
|
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
|
|
entity.discard();
|
|
} else {
|
|
- //gameprofilerfiller.push("checkDespawn"); // Purpur
|
|
+ gameprofilerfiller.push("checkDespawn");
|
|
entity.checkDespawn();
|
|
- //gameprofilerfiller.pop(); // Purpur
|
|
+ gameprofilerfiller.pop();
|
|
if (true || this.chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(entity.chunkPosition().toLong())) { // Paper - now always true if in the ticking list
|
|
Entity entity1 = entity.getVehicle();
|
|
|
|
@@ -752,7 +745,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
entity.stopRiding();
|
|
}
|
|
|
|
- //gameprofilerfiller.push("tick"); // Purpur
|
|
+ gameprofilerfiller.push("tick");
|
|
// Pufferfish start - copied from this.guardEntityTick
|
|
try {
|
|
this.tickNonPassenger(entity); // Pufferfish - changed
|
|
@@ -767,22 +760,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
// Paper end
|
|
}
|
|
// Pufferfish end
|
|
- //gameprofilerfiller.pop(); // Purpur
|
|
+ gameprofilerfiller.pop();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
- //timings.entityTick.stopTiming(); // Spigot // Purpur
|
|
- //timings.tickEntities.stopTiming(); // Spigot // Purpur
|
|
- //gameprofilerfiller.pop(); // Purpur
|
|
+ timings.entityTick.stopTiming(); // Spigot
|
|
+ timings.tickEntities.stopTiming(); // Spigot
|
|
+ gameprofilerfiller.pop();
|
|
this.tickBlockEntities();
|
|
}
|
|
|
|
- //gameprofilerfiller.push("entityManagement"); // Purpur
|
|
+ gameprofilerfiller.push("entityManagement");
|
|
//this.entityManager.tick(); // Paper - rewrite chunk system
|
|
- //gameprofilerfiller.popPush("gameEvents"); // Purpur
|
|
+ gameprofilerfiller.popPush("gameEvents");
|
|
this.sendGameEvents();
|
|
- //gameprofilerfiller.pop(); // Purpur
|
|
+ gameprofilerfiller.pop();
|
|
}
|
|
|
|
@Override
|
|
@@ -864,9 +857,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
boolean flag = this.isRaining();
|
|
int j = chunkcoordintpair.getMinBlockX();
|
|
int k = chunkcoordintpair.getMinBlockZ();
|
|
- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur
|
|
+ ProfilerFiller gameprofilerfiller = this.getProfiler();
|
|
|
|
- //gameprofilerfiller.push("thunder"); // Purpur
|
|
+ gameprofilerfiller.push("thunder");
|
|
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
|
|
@@ -898,7 +891,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
}
|
|
}
|
|
|
|
- //gameprofilerfiller.popPush("iceandsnow"); // Purpur
|
|
+ gameprofilerfiller.popPush("iceandsnow");
|
|
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
|
|
this.getRandomBlockPosition(j, 0, k, 15, blockposition);
|
|
@@ -934,8 +927,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
}
|
|
|
|
// Paper start - optimise random block ticking
|
|
- //gameprofilerfiller.popPush("randomTick"); // Purpur
|
|
- //timings.chunkTicksBlocks.startTiming(); // Paper // Purpur
|
|
+ gameprofilerfiller.popPush("randomTick");
|
|
+ timings.chunkTicksBlocks.startTiming(); // Paper
|
|
if (randomTickSpeed > 0) {
|
|
LevelChunkSection[] sections = chunk.getSections();
|
|
int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
|
|
@@ -969,8 +962,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
}
|
|
}
|
|
// Paper end - optimise random block ticking
|
|
- //timings.chunkTicksBlocks.stopTiming(); // Paper // Purpur
|
|
- //gameprofilerfiller.pop(); // Purpur
|
|
+ timings.chunkTicksBlocks.stopTiming(); // Paper
|
|
+ gameprofilerfiller.pop();
|
|
}
|
|
|
|
public Optional<BlockPos> findLightningRod(BlockPos pos) {
|
|
@@ -1262,24 +1255,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
// Spigot end
|
|
// Paper start- timings
|
|
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity);
|
|
- //timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper // Purpur
|
|
- //try { // Purpur
|
|
+ timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper
|
|
+ try {
|
|
// Paper end - timings
|
|
entity.setOldPosAndRot();
|
|
- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur
|
|
+ ProfilerFiller gameprofilerfiller = this.getProfiler();
|
|
|
|
++entity.tickCount;
|
|
- /*this.getProfiler().push(() -> { // Purpur
|
|
+ this.getProfiler().push(() -> {
|
|
return Registry.ENTITY_TYPE.getKey(entity.getType()).toString();
|
|
- });*/ // Purpur
|
|
- //gameprofilerfiller.incrementCounter("tickNonPassenger"); // Purpur
|
|
+ });
|
|
+ gameprofilerfiller.incrementCounter("tickNonPassenger");
|
|
if (isActive) { // Paper - EAR 2
|
|
TimingHistory.activatedEntityTicks++;
|
|
entity.tick();
|
|
entity.postTick(); // CraftBukkit
|
|
} else { entity.inactiveTick(); } // Paper - EAR 2
|
|
- //this.getProfiler().pop(); // Purpur
|
|
- //} finally { timer.stopTiming(); } // Paper - timings // Purpur
|
|
+ this.getProfiler().pop();
|
|
+ } finally { timer.stopTiming(); } // Paper - timings
|
|
Iterator iterator = entity.getPassengers().iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
@@ -1302,17 +1295,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
if (passenger instanceof Player || this.entityTickList.contains(passenger)) {
|
|
// Paper - EAR 2
|
|
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger);
|
|
- //co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper // Purpur
|
|
- //try { // Purpur
|
|
+ co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper
|
|
+ try {
|
|
// Paper end
|
|
passenger.setOldPosAndRot();
|
|
++passenger.tickCount;
|
|
- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur
|
|
+ ProfilerFiller gameprofilerfiller = this.getProfiler();
|
|
|
|
- /*gameprofilerfiller.push(() -> { // Purpur
|
|
+ gameprofilerfiller.push(() -> {
|
|
return Registry.ENTITY_TYPE.getKey(passenger.getType()).toString();
|
|
- });*/ // Purpur
|
|
- //gameprofilerfiller.incrementCounter("tickPassenger"); // Purpur
|
|
+ });
|
|
+ gameprofilerfiller.incrementCounter("tickPassenger");
|
|
// Paper start - EAR 2
|
|
if (isActive) {
|
|
passenger.rideTick();
|
|
@@ -1324,7 +1317,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
vehicle.positionRider(passenger);
|
|
}
|
|
// Paper end - EAR 2
|
|
- //gameprofilerfiller.pop(); // Purpur
|
|
+ gameprofilerfiller.pop();
|
|
Iterator iterator = passenger.getPassengers().iterator();
|
|
|
|
while (iterator.hasNext()) {
|
|
@@ -1333,7 +1326,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
this.tickPassenger(passenger, entity2);
|
|
}
|
|
|
|
- //} finally { timer.stopTiming(); }// Paper - EAR2 timings // Purpur
|
|
+ } finally { timer.stopTiming(); }// Paper - EAR2 timings
|
|
}
|
|
} else {
|
|
passenger.stopRiding();
|
|
@@ -1353,14 +1346,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld()));
|
|
}
|
|
|
|
- //try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) { // Purpur
|
|
+ try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) {
|
|
if (doFull) {
|
|
this.saveLevelData();
|
|
}
|
|
|
|
- //this.timings.worldSaveChunks.startTiming(); // Paper // Purpur
|
|
+ this.timings.worldSaveChunks.startTiming(); // Paper
|
|
if (!this.noSave()) chunkproviderserver.saveIncrementally();
|
|
- //this.timings.worldSaveChunks.stopTiming(); // Paper // Purpur
|
|
+ this.timings.worldSaveChunks.stopTiming(); // Paper
|
|
|
|
// Copied from save()
|
|
// CraftBukkit start - moved from MinecraftServer.saveChunks
|
|
@@ -1372,7 +1365,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
this.convertable.saveDataTag(this.server.registryHolder, this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
|
|
}
|
|
// CraftBukkit end
|
|
- //} // Purpur
|
|
+ }
|
|
}
|
|
// Paper end
|
|
|
|
@@ -1386,7 +1379,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
|
|
if (!savingDisabled) {
|
|
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
|
|
- //try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper // Purpur // Purpur
|
|
+ try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper
|
|
if (progressListener != null) {
|
|
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
|
|
}
|
|
@@ -1396,11 +1389,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
progressListener.progressStage(Component.translatable("menu.savingChunks"));
|
|
}
|
|
|
|
- //timings.worldSaveChunks.startTiming(); // Paper // Purpur
|
|
+ timings.worldSaveChunks.startTiming(); // Paper
|
|
if (!close) chunkproviderserver.save(flush); // Paper - rewrite chunk system
|
|
if (close) chunkproviderserver.close(true); // Paper - rewrite chunk system
|
|
- //timings.worldSaveChunks.stopTiming(); // Paper // Purpur
|
|
- //}// Paper // Purpur
|
|
+ timings.worldSaveChunks.stopTiming(); // Paper
|
|
+ }// Paper
|
|
// Paper - rewrite chunk system - entity saving moved into ChunkHolder
|
|
|
|
} else if (close) { chunkproviderserver.close(false); } // Paper - rewrite chunk system
|
|
@@ -1710,7 +1703,6 @@ 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/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 66c632f9a824e705420b9bb86de294f0e7305c50..4c5d7f00b68e4ec103a5841beaccfbdbef30f130 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -2612,7 +2612,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
}
|
|
}
|
|
// Paper End
|
|
- //co.aikar.timings.MinecraftTimings.playerCommandTimer.startTiming(); // Paper // Purpur
|
|
+ co.aikar.timings.MinecraftTimings.playerCommandTimer.startTiming(); // Paper
|
|
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
|
|
this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
|
|
|
|
@@ -2622,7 +2622,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
this.cserver.getPluginManager().callEvent(event);
|
|
|
|
if (event.isCancelled()) {
|
|
- //co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper // Purpur
|
|
+ co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper
|
|
return;
|
|
}
|
|
|
|
@@ -2635,7 +2635,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
return;
|
|
} finally {
|
|
- //co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper // Purpur
|
|
+ co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper
|
|
}
|
|
}
|
|
// CraftBukkit end
|
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
index 393281223cd7b638d55b22ded20413709c23135a..9985aa1d4f7b4424bc71abdb7f16548be5ada0b6 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -1287,7 +1287,7 @@ public abstract class PlayerList {
|
|
|
|
public void saveAll(int interval) {
|
|
net.minecraft.server.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
|
|
- //MinecraftTimings.savePlayers.startTiming(); // Paper // Purpur
|
|
+ MinecraftTimings.savePlayers.startTiming(); // Paper
|
|
int numSaved = 0;
|
|
long now = MinecraftServer.currentTick;
|
|
for (int i = 0; i < this.players.size(); ++i) {
|
|
@@ -1298,7 +1298,7 @@ public abstract class PlayerList {
|
|
}
|
|
// Paper end
|
|
}
|
|
- //MinecraftTimings.savePlayers.stopTiming(); // Paper // Purpur
|
|
+ MinecraftTimings.savePlayers.stopTiming(); // Paper
|
|
return null; }); // Paper - ensure main
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
|
|
index 8e3b06e1512ea4ee7b0de8294cfd624f47e260ee..eb5a332f0705dd2e5568749a22f2f318d68010d1 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
|
|
@@ -56,9 +56,9 @@ public abstract class Behavior<E extends LivingEntity> {
|
|
this.status = Behavior.Status.RUNNING;
|
|
int i = this.minDuration + world.getRandom().nextInt(this.maxDuration + 1 - this.minDuration);
|
|
this.endTimestamp = time + (long)i;
|
|
- //this.timing.startTiming(); // Paper - behavior timings // Purpur
|
|
+ this.timing.startTiming(); // Paper - behavior timings
|
|
this.start(world, entity, time);
|
|
- //this.timing.stopTiming(); // Paper - behavior timings // Purpur
|
|
+ this.timing.stopTiming(); // Paper - behavior timings
|
|
return true;
|
|
} else {
|
|
return false;
|
|
@@ -69,13 +69,13 @@ public abstract class Behavior<E extends LivingEntity> {
|
|
}
|
|
|
|
public final void tickOrStop(ServerLevel world, E entity, long time) {
|
|
- //this.timing.startTiming(); // Paper - behavior timings // Purpur
|
|
+ this.timing.startTiming(); // Paper - behavior timings
|
|
if (!this.timedOut(time) && this.canStillUse(world, entity, time)) {
|
|
this.tick(world, entity, time);
|
|
} else {
|
|
this.doStop(world, entity, time);
|
|
}
|
|
- //this.timing.stopTiming(); // Paper - behavior timings // Purpur
|
|
+ this.timing.stopTiming(); // Paper - behavior timings
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
|
|
index 7094701d213c73ba47ace806962244c10fdf4dda..fcdb9bde8e1605e30dde3e580491522d4b62cdc0 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
|
|
@@ -46,10 +46,10 @@ public abstract class Sensor<E extends LivingEntity> {
|
|
if (--this.timeToTick <= 0L) {
|
|
// Paper start - configurable sensor tick rate and timings
|
|
this.timeToTick = java.util.Objects.requireNonNullElse(world.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate);
|
|
- //this.timing.startTiming(); // Purpur
|
|
+ this.timing.startTiming();
|
|
// Paper end
|
|
this.doTick(world, entity);
|
|
- //this.timing.stopTiming(); // Paper - sensor timings // Purpur
|
|
+ this.timing.stopTiming(); // Paper - sensor timings
|
|
}
|
|
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index dc3f2b26e19619adf80827d26b95209ded973c2a..0c9f7f9ed3e24ddc6b963063723feb56422843c5 100644
|
|
--- a/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;
|
|
@@ -172,14 +172,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
return this.paperConfig;
|
|
}
|
|
// Paper end
|
|
- // Suki start - Suki configuration
|
|
- private final org.sucraft.suki.configuration.SukiWorldConfiguration sukiConfig;
|
|
|
|
- public org.sucraft.suki.configuration.SukiWorldConfiguration sukiConfig() {
|
|
- return this.sukiConfig;
|
|
- }
|
|
-
|
|
- // Suki end - Suki configuration
|
|
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
|
public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur
|
|
|
|
@@ -334,11 +327,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
@Override public final int getHeight() { return this.height; }
|
|
// Pufferfish end
|
|
|
|
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.function.Function<org.spigotmc.SpigotWorldConfig, org.sucraft.suki.configuration.SukiWorldConfiguration> sukiWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor // Suki - Suki configuration
|
|
+ protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor
|
|
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
|
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper
|
|
this.purpurConfig = new org.purpurmc.purpur.PurpurWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // Purpur
|
|
- this.sukiConfig = sukiWorldConfigCreator.apply(this.spigotConfig); // Suki - Suki configuration
|
|
this.playerBreedingCooldowns = this.getNewBreedingCooldownCache(); // Purpur
|
|
this.generator = gen;
|
|
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
|
|
@@ -720,9 +712,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
BlockState iblockdata2 = this.getBlockState(pos);
|
|
|
|
if ((flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock(this, pos) != iblockdata1.getLightBlock(this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) {
|
|
- //this.getProfiler().push("queueCheckLight"); // Purpur
|
|
+ this.getProfiler().push("queueCheckLight");
|
|
this.getChunkSource().getLightEngine().checkBlock(pos);
|
|
- //this.getProfiler().pop(); // Purpur
|
|
+ this.getProfiler().pop();
|
|
}
|
|
|
|
/*
|
|
@@ -999,18 +991,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
}
|
|
|
|
protected void tickBlockEntities() {
|
|
- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur
|
|
+ ProfilerFiller gameprofilerfiller = this.getProfiler();
|
|
|
|
- //gameprofilerfiller.push("blockEntities"); // Purpur
|
|
- //timings.tileEntityPending.startTiming(); // Spigot // Purpur
|
|
+ gameprofilerfiller.push("blockEntities");
|
|
+ timings.tileEntityPending.startTiming(); // Spigot
|
|
this.tickingBlockEntities = true;
|
|
if (!this.pendingBlockEntityTickers.isEmpty()) {
|
|
this.blockEntityTickers.addAll(this.pendingBlockEntityTickers);
|
|
this.pendingBlockEntityTickers.clear();
|
|
}
|
|
- //timings.tileEntityPending.stopTiming(); // Spigot // Purpur
|
|
+ timings.tileEntityPending.stopTiming(); // Spigot
|
|
|
|
- //timings.tileEntityTick.startTiming(); // Spigot // Purpur
|
|
+ timings.tileEntityTick.startTiming(); // Spigot
|
|
// Spigot start
|
|
// Iterator iterator = this.blockEntityTickers.iterator();
|
|
int tilesThisCycle = 0;
|
|
@@ -1043,10 +1035,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
}
|
|
this.blockEntityTickers.removeAll(toRemove);
|
|
|
|
- //timings.tileEntityTick.stopTiming(); // Spigot // Purpur
|
|
+ timings.tileEntityTick.stopTiming(); // Spigot
|
|
this.tickingBlockEntities = false;
|
|
co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper
|
|
- //gameprofilerfiller.pop(); // Purpur
|
|
+ gameprofilerfiller.pop();
|
|
spigotConfig.currentPrimedTnt = 0; // Spigot
|
|
}
|
|
|
|
@@ -1207,7 +1199,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
|
|
@Override
|
|
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
|
|
- //this.getProfiler().incrementCounter("getEntities"); // Purpur
|
|
+ this.getProfiler().incrementCounter("getEntities");
|
|
List<Entity> list = Lists.newArrayList();
|
|
((ServerLevel)this).getEntityLookup().getEntities(except, box, list, predicate); // Paper - optimise this call
|
|
return list;
|
|
@@ -1215,7 +1207,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
|
|
@Override
|
|
public <T extends Entity> List<T> getEntities(EntityTypeTest<Entity, T> filter, AABB box, Predicate<? super T> predicate) {
|
|
- //this.getProfiler().incrementCounter("getEntities"); // Purpur
|
|
+ this.getProfiler().incrementCounter("getEntities");
|
|
List<T> list = Lists.newArrayList();
|
|
|
|
// Paper start - optimise this call
|
|
@@ -1546,7 +1538,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
}
|
|
|
|
public ProfilerFiller getProfiler() {
|
|
- if (true || gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Pufferfish // Purpur
|
|
+ if (gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Pufferfish
|
|
return (ProfilerFiller) this.profiler.get();
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
|
index bca69d595ef0f18a5910cbd6f7e6f742830a0800..386ed2c102aaa3ec68e828e20fff6bfe0d8f7877 100644
|
|
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
|
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
|
@@ -131,8 +131,8 @@ public final class NaturalSpawner {
|
|
}
|
|
|
|
public static void spawnForChunk(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, boolean spawnAnimals, boolean spawnMonsters, boolean rareSpawn) {
|
|
- //world.getProfiler().push("spawner"); // Purpur
|
|
- //world.timings.mobSpawn.startTiming(); // Spigot // Purpur
|
|
+ world.getProfiler().push("spawner");
|
|
+ world.timings.mobSpawn.startTiming(); // Spigot
|
|
MobCategory[] aenumcreaturetype = NaturalSpawner.SPAWNING_CATEGORIES;
|
|
int i = aenumcreaturetype.length;
|
|
|
|
@@ -187,8 +187,8 @@ public final class NaturalSpawner {
|
|
}
|
|
}
|
|
|
|
- //world.timings.mobSpawn.stopTiming(); // Spigot // Purpur
|
|
- //world.getProfiler().pop(); // Purpur
|
|
+ world.timings.mobSpawn.stopTiming(); // Spigot
|
|
+ world.getProfiler().pop();
|
|
}
|
|
|
|
// Paper start
|
|
@@ -259,7 +259,7 @@ public final class NaturalSpawner {
|
|
blockposition_mutableblockposition.set(l, i, i1);
|
|
double d0 = (double) l + 0.5D;
|
|
double d1 = (double) i1 + 0.5D;
|
|
- Player entityhuman = (chunk instanceof LevelChunk) ? ((LevelChunk)chunk).findNearestPlayer(d0, i, d1, 576.0D, world.purpurConfig.mobSpawningIgnoreCreativePlayers ? net.minecraft.world.entity.EntitySelector.NO_CREATIVE_OR_SPECTATOR : net.minecraft.world.entity.EntitySelector.NO_SPECTATORS) : world.getNearestPlayer(d0, (double) i, d1, -1.0D, world.purpurConfig.mobSpawningIgnoreCreativePlayers); // Paper - use chunk's player cache to optimize search in range // Purpur
|
|
+ Player entityhuman = (chunk instanceof LevelChunk) ? ((LevelChunk)chunk).findNearestPlayer(d0, i, d1, 576.0D, net.minecraft.world.entity.EntitySelector.NO_SPECTATORS) : world.getNearestPlayer(d0, (double) i, d1, -1.0D, false); // Paper - use chunk's player cache to optimize search in range
|
|
|
|
if (entityhuman != null) {
|
|
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
|
|
index f01dd420e2ff4f87b00682681a4f7dbf05955d24..636c98d04eb4e14eab1fa208d9cb097e2ab7eef7 100644
|
|
--- a/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;
|
|
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 {
|
|
|
|
@@ -88,18 +84,7 @@ public class LevelChunk extends ChunkAccess {
|
|
private Supplier<ChunkHolder.FullChunkStatus> fullStatus;
|
|
@Nullable
|
|
private LevelChunk.PostLoadProcessor postLoad;
|
|
- // petal start
|
|
- private final GameEventDispatcher[] gameEventDispatcherSections;
|
|
- private static final int GAME_EVENT_DISPATCHER_RADIUS = 2;
|
|
-
|
|
- private static int getGameEventSectionIndex(int sectionIndex) {
|
|
- return sectionIndex + GAME_EVENT_DISPATCHER_RADIUS;
|
|
- }
|
|
-
|
|
- private static int getGameEventSectionLength(int sectionCount) {
|
|
- return sectionCount + (GAME_EVENT_DISPATCHER_RADIUS * 2);
|
|
- }
|
|
- // petal end
|
|
+ private final Int2ObjectMap<GameEventDispatcher> gameEventDispatcherSections;
|
|
private final LevelChunkTicks<Block> blockTicks;
|
|
private final LevelChunkTicks<Fluid> fluidTicks;
|
|
|
|
@@ -128,7 +113,7 @@ public class LevelChunk extends ChunkAccess {
|
|
this.tickersInLevel = Maps.newHashMap();
|
|
this.clientLightReady = false;
|
|
this.level = (ServerLevel) world; // CraftBukkit - type
|
|
- this.gameEventDispatcherSections = new GameEventDispatcher[getGameEventSectionLength(this.getSectionsCount())]; // petal
|
|
+ this.gameEventDispatcherSections = new Int2ObjectOpenHashMap();
|
|
Heightmap.Types[] aheightmap_type = Heightmap.Types.values();
|
|
int j = aheightmap_type.length;
|
|
|
|
@@ -461,23 +446,9 @@ public class LevelChunk extends ChunkAccess {
|
|
if (world instanceof ServerLevel) {
|
|
ServerLevel worldserver = (ServerLevel) world;
|
|
|
|
- // petal start
|
|
- int sectionIndex = getGameEventSectionIndex(this.getSectionIndexFromSectionY(ySectionCoord));
|
|
-
|
|
- // drop game events that are too far away (32 blocks) from loaded sections
|
|
- // this matches the highest radius of game events in the game
|
|
- if (sectionIndex < 0 || sectionIndex >= this.gameEventDispatcherSections.length) {
|
|
- return GameEventDispatcher.NOOP;
|
|
- }
|
|
-
|
|
- var dispatcher = this.gameEventDispatcherSections[sectionIndex];
|
|
-
|
|
- if (dispatcher == null) {
|
|
- dispatcher = this.gameEventDispatcherSections[sectionIndex] = new EuclideanGameEventDispatcher(worldserver);
|
|
- }
|
|
-
|
|
- return dispatcher;
|
|
- // petal end
|
|
+ return (GameEventDispatcher) this.gameEventDispatcherSections.computeIfAbsent(ySectionCoord, (j) -> {
|
|
+ return new EuclideanGameEventDispatcher(worldserver);
|
|
+ });
|
|
} else {
|
|
return super.getEventDispatcher(ySectionCoord);
|
|
}
|
|
@@ -841,7 +812,7 @@ public class LevelChunk extends ChunkAccess {
|
|
|
|
gameeventdispatcher.unregister(gameeventlistener);
|
|
if (gameeventdispatcher.isEmpty()) {
|
|
- this.gameEventDispatcherSections[getGameEventSectionIndex(this.getSectionIndexFromSectionY(i))] = null; // petal
|
|
+ this.gameEventDispatcherSections.remove(i);
|
|
}
|
|
}
|
|
}
|
|
@@ -959,9 +930,9 @@ public class LevelChunk extends ChunkAccess {
|
|
this.chunkHolder.getEntityChunk().callEntitiesLoadEvent(); // Paper - rewrite chunk system
|
|
|
|
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;
|
|
- Random random = new FastRandom();
|
|
+ java.util.Random random = new java.util.Random();
|
|
random.setSeed(this.level.getSeed());
|
|
long xRand = random.nextLong() / 2L * 2L + 1L;
|
|
long zRand = random.nextLong() / 2L * 2L + 1L;
|
|
@@ -979,7 +950,7 @@ public class LevelChunk extends ChunkAccess {
|
|
}
|
|
}
|
|
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(this.bukkitChunk));
|
|
- //} // Paper // Purpur
|
|
+ } // Paper
|
|
}
|
|
}
|
|
}
|
|
@@ -1321,10 +1292,10 @@ public class LevelChunk extends ChunkAccess {
|
|
|
|
if (LevelChunk.this.isTicking(blockposition)) {
|
|
try {
|
|
- //ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler(); // Purpur
|
|
+ ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler();
|
|
|
|
- //gameprofilerfiller.push(this::getType); // Purpur
|
|
- //this.blockEntity.tickTimer.startTiming(); // Spigot // Purpur
|
|
+ gameprofilerfiller.push(this::getType);
|
|
+ this.blockEntity.tickTimer.startTiming(); // Spigot
|
|
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
|
|
|
|
if (this.blockEntity.getType().isValid(iblockdata)) {
|
|
@@ -1335,7 +1306,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});
|
|
}
|
|
|
|
- //gameprofilerfiller.pop(); // Purpur
|
|
+ gameprofilerfiller.pop();
|
|
} catch (Throwable throwable) {
|
|
if (throwable instanceof ThreadDeath) throw throwable; // Paper
|
|
// Paper start - Prevent tile entity and entity crashes
|
|
@@ -1346,7 +1317,7 @@ public class LevelChunk extends ChunkAccess {
|
|
// Paper end
|
|
// Spigot start
|
|
} finally {
|
|
- //this.blockEntity.tickTimer.stopTiming(); // Purpur
|
|
+ this.blockEntity.tickTimer.stopTiming();
|
|
// Spigot end
|
|
}
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
|
index 5402098dce0d64d3dceea51f248d7d366850a74f..d1526ed7197b883e1d1f07baf285bf5eef4d20d5 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
|
@@ -516,10 +516,10 @@ public class CraftScheduler implements BukkitScheduler {
|
|
this.runners.remove(task.getTaskId());
|
|
}
|
|
}
|
|
- //MinecraftTimings.bukkitSchedulerFinishTimer.startTiming(); // Paper // Purpur
|
|
+ MinecraftTimings.bukkitSchedulerFinishTimer.startTiming(); // Paper
|
|
this.pending.addAll(temp);
|
|
temp.clear();
|
|
- //MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper // Purpur
|
|
+ MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper
|
|
//this.debugHead = this.debugHead.getNextHead(currentTick); // Paper
|
|
}
|
|
|
|
@@ -563,7 +563,7 @@ public class CraftScheduler implements BukkitScheduler {
|
|
}
|
|
|
|
void parsePending() { // Paper
|
|
- //if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.startTiming(); // Paper // Purpur
|
|
+ if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.startTiming(); // Paper
|
|
CraftTask head = this.head;
|
|
CraftTask task = head.getNext();
|
|
CraftTask lastTask = head;
|
|
@@ -582,7 +582,7 @@ public class CraftScheduler implements BukkitScheduler {
|
|
task.setNext(null);
|
|
}
|
|
this.head = lastTask;
|
|
- //if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.stopTiming(); // Paper // Purpur
|
|
+ if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.stopTiming(); // Paper
|
|
}
|
|
|
|
private boolean isReady(final int currentTick) {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
|
|
index 4f1cf281c4bf68c37982d390da8779dea78dab18..3f45bab0e9f7b3697e6d9d1092a1e6e579f7066f 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
|
|
@@ -96,13 +96,13 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
|
|
|
|
@Override
|
|
public void run() {
|
|
- //try (Timing ignored = timings.startTiming()) { // Paper // Purpur
|
|
+ try (Timing ignored = timings.startTiming()) { // Paper
|
|
if (this.rTask != null) {
|
|
this.rTask.run();
|
|
} else {
|
|
this.cTask.accept(this);
|
|
}
|
|
- //} // Paper // Purpur
|
|
+ } // Paper
|
|
}
|
|
|
|
long getCreatedAt() {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
|
|
index a6e9e503a496c18e2501b03ec84f4600c134a50c..138407c2d4b0bc55ddb9aac5d2aa3edadda090fb 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
|
|
@@ -115,7 +115,7 @@ public final class CraftScoreboardManager implements ScoreboardManager {
|
|
public void getScoreboardScores(ObjectiveCriteria criteria, String name, Consumer<Score> consumer) {
|
|
// Paper start - add timings for scoreboard search
|
|
// plugins leaking scoreboards will make this very expensive, let server owners debug it easily
|
|
- //co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.startTimingIfSync(); // Purpur
|
|
+ co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.startTimingIfSync();
|
|
try {
|
|
// Paper end - add timings for scoreboard search
|
|
for (CraftScoreboard scoreboard : this.scoreboards) {
|
|
@@ -123,7 +123,7 @@ public final class CraftScoreboardManager implements ScoreboardManager {
|
|
board.forAllObjectives(criteria, name, (score) -> consumer.accept(score));
|
|
}
|
|
} finally { // Paper start - add timings for scoreboard search
|
|
- //co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.stopTimingIfSync(); // Purpur
|
|
+ co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.stopTimingIfSync();
|
|
}
|
|
// Paper end - add timings for scoreboard search
|
|
}
|
|
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
|
index 937e3e783cf2f38b30024d29600eb4d042816058..6e87153e62db14b5bc8a984c6c9c61780d102083 100644
|
|
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
|
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
|
@@ -170,7 +170,7 @@ public class ActivationRange
|
|
*/
|
|
public static void activateEntities(Level world)
|
|
{
|
|
- //MinecraftTimings.entityActivationCheckTimer.startTiming(); // Purpur
|
|
+ MinecraftTimings.entityActivationCheckTimer.startTiming();
|
|
final int miscActivationRange = world.spigotConfig.miscActivationRange;
|
|
final int raiderActivationRange = world.spigotConfig.raiderActivationRange;
|
|
final int animalActivationRange = world.spigotConfig.animalActivationRange;
|
|
@@ -240,7 +240,7 @@ public class ActivationRange
|
|
}
|
|
// Paper end
|
|
}
|
|
- //MinecraftTimings.entityActivationCheckTimer.stopTiming(); // Purpur
|
|
+ MinecraftTimings.entityActivationCheckTimer.stopTiming();
|
|
}
|
|
|
|
/**
|