mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
[Anti XRay] Don't trigger updates on the clicked block - fixes block lag caused when mining ores quickly.
This commit is contained in:
parent
e881f8990f
commit
a144cc905b
@ -1,4 +1,4 @@
|
||||
From 68276a3d08af1b9ebe3cc824c77ff7216c10cf35 Mon Sep 17 00:00:00 2001
|
||||
From c436351acab50d84569551262783648c617ad71e Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Thu, 16 May 2013 18:51:05 +1000
|
||||
Subject: [PATCH] Orebfuscator
|
||||
@ -108,7 +108,7 @@ index a7afa55..1a60229 100644
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java
|
||||
new file mode 100644
|
||||
index 0000000..48c8a99
|
||||
index 0000000..c165304
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/AntiXray.java
|
||||
@@ -0,0 +1,204 @@
|
||||
@ -167,7 +167,7 @@ index 0000000..48c8a99
|
||||
+ if ( world.spigotConfig.antiXray )
|
||||
+ {
|
||||
+ update.startTiming();
|
||||
+ updateNearbyBlocks( world, x, y, z, 2 ); // 2 is the radius, we shouldn't change it as that would make it exponentially slower
|
||||
+ updateNearbyBlocks( world, x, y, z, 2, false ); // 2 is the radius, we shouldn't change it as that would make it exponentially slower
|
||||
+ update.stopTiming();
|
||||
+ }
|
||||
+ }
|
||||
@ -264,7 +264,7 @@ index 0000000..48c8a99
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void updateNearbyBlocks(World world, int x, int y, int z, int radius)
|
||||
+ private void updateNearbyBlocks(World world, int x, int y, int z, int radius, boolean updateSelf)
|
||||
+ {
|
||||
+ // If the block in question is loaded
|
||||
+ if ( world.isLoaded( x, y, z ) )
|
||||
@ -273,7 +273,7 @@ index 0000000..48c8a99
|
||||
+ int id = world.getTypeId( x, y, z );
|
||||
+
|
||||
+ // See if it needs update
|
||||
+ if ( obfuscateBlocks[id] )
|
||||
+ if ( updateSelf && obfuscateBlocks[id] )
|
||||
+ {
|
||||
+ // Send the update
|
||||
+ world.notify( x, y, z );
|
||||
@ -282,12 +282,12 @@ index 0000000..48c8a99
|
||||
+ // Check other blocks for updates
|
||||
+ if ( radius > 0 )
|
||||
+ {
|
||||
+ updateNearbyBlocks( world, x + 1, y, z, radius - 1 );
|
||||
+ updateNearbyBlocks( world, x - 1, y, z, radius - 1 );
|
||||
+ updateNearbyBlocks( world, x, y + 1, z, radius - 1 );
|
||||
+ updateNearbyBlocks( world, x, y - 1, z, radius - 1 );
|
||||
+ updateNearbyBlocks( world, x, y, z + 1, radius - 1 );
|
||||
+ updateNearbyBlocks( world, x, y, z - 1, radius - 1 );
|
||||
+ updateNearbyBlocks( world, x + 1, y, z, radius - 1, true );
|
||||
+ updateNearbyBlocks( world, x - 1, y, z, radius - 1, true );
|
||||
+ updateNearbyBlocks( world, x, y + 1, z, radius - 1, true );
|
||||
+ updateNearbyBlocks( world, x, y - 1, z, radius - 1, true );
|
||||
+ updateNearbyBlocks( world, x, y, z + 1, radius - 1, true );
|
||||
+ updateNearbyBlocks( world, x, y, z - 1, radius - 1, true );
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
Loading…
Reference in New Issue
Block a user