PaperMC/CraftBukkit-Patches/0021-Track-Xray-timings.patch

61 lines
2.6 KiB
Diff

From 7b9729d3f63896d55a46055572f2f03e5b47695e Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 25 Jan 2013 13:15:42 +1100
Subject: [PATCH] Track Xray timings.
---
src/main/java/net/minecraft/server/Packet51MapChunk.java | 2 +-
src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/Packet51MapChunk.java b/src/main/java/net/minecraft/server/Packet51MapChunk.java
index 365116a..230dd62 100644
--- a/src/main/java/net/minecraft/server/Packet51MapChunk.java
+++ b/src/main/java/net/minecraft/server/Packet51MapChunk.java
@@ -46,7 +46,7 @@ public class Packet51MapChunk extends Packet {
this.d = chunkmap.c;
this.c = chunkmap.b;
- org.bukkit.craftbukkit.OrebfuscatorManager.obfuscate(chunk.x, chunk.z, i, chunkmap.a, chunk.world); // Spigot (Orebfuscator)
+ org.bukkit.craftbukkit.OrebfuscatorManager.obfuscateSync(chunk.x, chunk.z, i, chunkmap.a, chunk.world); // Spigot (Orebfuscator)
try {
this.inflatedBuffer = chunkmap.a;
diff --git a/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java b/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java
index 7178dfb..c0ee505 100644
--- a/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java
+++ b/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java
@@ -2,11 +2,14 @@ package org.bukkit.craftbukkit;
import net.minecraft.server.Block;
import net.minecraft.server.World;
+import org.bukkit.event.CustomTimingsHandler;
public class OrebfuscatorManager {
// Used to keep track of which blocks to obfuscate
private static boolean[] obfuscateBlocks = new boolean[Short.MAX_VALUE];
+ private static final CustomTimingsHandler obfuscate = new CustomTimingsHandler("xray - obfuscate");
+ private static final CustomTimingsHandler update = new CustomTimingsHandler("xray - update");
// Default blocks
static {
@@ -24,7 +27,15 @@ public class OrebfuscatorManager {
}
public static void updateNearbyBlocks(World world, int x, int y, int z) {
+ update.startTiming();
updateNearbyBlocks(world, x, y, z, world.getServer().orebfuscatorUpdateRadius);
+ update.stopTiming();
+ }
+
+ public static void obfuscateSync(int chunkX, int chunkY, int bitmask, byte[] buffer, World world) {
+ obfuscate.startTiming();
+ obfuscate(chunkX, chunkY, bitmask, buffer, world);
+ obfuscate.stopTiming();
}
public static void obfuscate(int chunkX, int chunkY, int bitmask, byte[] buffer, World world) {
--
1.8.1-rc2