Archiviert
13
0

Hopefully fix the AntiXray this time. Thanks to @geNAZt for helping

Dieser Commit ist enthalten in:
Thinkofdeath 2014-02-05 21:40:15 +00:00
Ursprung 9746d9bfc6
Commit 7c1dbb44a5

Datei anzeigen

@ -1,4 +1,4 @@
From af77f1fa0985f52d888dfd1d6302aa41d0dc786d Mon Sep 17 00:00:00 2001 From dd8fba0627e568fbfc40eefb307583ccf28864e4 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Thu, 16 May 2013 18:51:05 +1000 Date: Thu, 16 May 2013 18:51:05 +1000
Subject: [PATCH] Orebfuscator Subject: [PATCH] Orebfuscator
@ -128,10 +128,10 @@ index 5b0875d..1aca7f6 100644
public void b(int i, int j, int k, Block block, int l) { public void b(int i, int j, int k, Block block, int l) {
diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java
new file mode 100644 new file mode 100644
index 0000000..297fae8 index 0000000..3853903
--- /dev/null --- /dev/null
+++ b/src/main/java/org/spigotmc/AntiXray.java +++ b/src/main/java/org/spigotmc/AntiXray.java
@@ -0,0 +1,200 @@ @@ -0,0 +1,202 @@
+package org.spigotmc; +package org.spigotmc;
+ +
+import gnu.trove.set.TByteSet; +import gnu.trove.set.TByteSet;
@ -237,6 +237,7 @@ index 0000000..297fae8
+ // For some reason we can get too far ahead of ourselves (concurrent modification on bulk chunks?) so if we do, just abort and move on + // For some reason we can get too far ahead of ourselves (concurrent modification on bulk chunks?) so if we do, just abort and move on
+ if ( index >= buffer.length ) + if ( index >= buffer.length )
+ { + {
+ index++;
+ continue; + continue;
+ } + }
+ // Grab the block ID in the buffer. + // Grab the block ID in the buffer.
@ -245,13 +246,14 @@ index 0000000..297fae8
+ // Check if the block should be obfuscated + // Check if the block should be obfuscated
+ if ( obfuscateBlocks[blockId] ) + if ( obfuscateBlocks[blockId] )
+ { + {
+ // TODO: Don't really understand this, but if radius is not 0 and the world isn't loaded, bail out + // The world isn't loaded, bail out
+ if ( initialRadius != 0 && !isLoaded( world, startX + x, ( i << 4 ) + y, startZ + z, initialRadius ) ) + if ( !isLoaded( world, startX + x, ( i << 4 ) + y, startZ + z, initialRadius ) )
+ { + {
+ index++;
+ continue; + continue;
+ } + }
+ // On the otherhand, if radius is 0, or the nearby blocks are all non air, we can obfuscate + // On the otherhand, if radius is 0, or the nearby blocks are all non air, we can obfuscate
+ if ( initialRadius == 0 || !hasTransparentBlockAdjacent( world, startX + x, ( i << 4 ) + y, startZ + z, initialRadius ) ) + if ( !hasTransparentBlockAdjacent( world, startX + x, ( i << 4 ) + y, startZ + z, initialRadius ) )
+ { + {
+ switch ( world.spigotConfig.engineMode ) + switch ( world.spigotConfig.engineMode )
+ { + {
@ -311,13 +313,13 @@ index 0000000..297fae8
+ private static boolean isLoaded(World world, int x, int y, int z, int radius) + private static boolean isLoaded(World world, int x, int y, int z, int radius)
+ { + {
+ return world.isLoaded( x, y, z ) + return world.isLoaded( x, y, z )
+ || ( radius > 0 + && ( radius == 0 ||
+ && ( isLoaded( world, x + 1, y, z, radius - 1 ) + ( isLoaded( world, x + 1, y, z, radius - 1 )
+ || isLoaded( world, x - 1, y, z, radius - 1 ) + && isLoaded( world, x - 1, y, z, radius - 1 )
+ || isLoaded( world, x, y + 1, z, radius - 1 ) + && isLoaded( world, x, y + 1, z, radius - 1 )
+ || isLoaded( world, x, y - 1, z, radius - 1 ) + && isLoaded( world, x, y - 1, z, radius - 1 )
+ || isLoaded( world, x, y, z + 1, radius - 1 ) + && isLoaded( world, x, y, z + 1, radius - 1 )
+ || isLoaded( world, x, y, z - 1, radius - 1 ) ) ); + && isLoaded( world, x, y, z - 1, radius - 1 ) ) );
+ } + }
+ +
+ private static boolean hasTransparentBlockAdjacent(World world, int x, int y, int z, int radius) + private static boolean hasTransparentBlockAdjacent(World world, int x, int y, int z, int radius)
@ -381,5 +383,5 @@ index d4e8bf4..b9399ad 100644
+ } + }
} }
-- --
1.8.3.2 1.8.4.msysgit.0