Fix engine mode 2, again

This commit is contained in:
md_5 2013-07-28 15:58:10 +10:00
parent e5b7d37953
commit a8269a5119
1 changed files with 15 additions and 12 deletions

View File

@ -1,4 +1,4 @@
From 6af084ea3eec9318cd30adcfe34626bc2f9ab083 Mon Sep 17 00:00:00 2001 From 7c011c07c77395789c96298dd5745a74dec4c84d 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
@ -108,13 +108,12 @@ index a7afa55..1a60229 100644
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..f4b4794 index 0000000..0128d11
--- /dev/null --- /dev/null
+++ b/src/main/java/org/spigotmc/AntiXray.java +++ b/src/main/java/org/spigotmc/AntiXray.java
@@ -0,0 +1,183 @@ @@ -0,0 +1,186 @@
+package org.spigotmc; +package org.spigotmc;
+ +
+import gnu.trove.iterator.TIntIterator;
+import net.minecraft.server.Block; +import net.minecraft.server.Block;
+import net.minecraft.server.World; +import net.minecraft.server.World;
+ +
@ -126,7 +125,7 @@ index 0000000..f4b4794
+ /*========================================================================*/ + /*========================================================================*/
+ // Used to keep track of which blocks to obfuscate + // Used to keep track of which blocks to obfuscate
+ private final boolean[] obfuscateBlocks = new boolean[ Short.MAX_VALUE ]; + private final boolean[] obfuscateBlocks = new boolean[ Short.MAX_VALUE ];
+ private TIntIterator replacer; + private final boolean[] replaceBlocks = new boolean[ Short.MAX_VALUE ];
+ +
+ public AntiXray(SpigotWorldConfig config) + public AntiXray(SpigotWorldConfig config)
+ { + {
@ -135,6 +134,10 @@ index 0000000..f4b4794
+ { + {
+ obfuscateBlocks[id] = true; + obfuscateBlocks[id] = true;
+ } + }
+ for ( int id : config.xRayReplacements )
+ {
+ replaceBlocks[id] = true;
+ }
+ } + }
+ +
+ /** + /**
@ -223,12 +226,12 @@ index 0000000..f4b4794
+ buffer[index] = (byte) Block.STONE.id; + buffer[index] = (byte) Block.STONE.id;
+ break; + break;
+ case 2: + case 2:
+ if ( replacer == null || !replacer.hasNext() ) + if ( randomOre >= world.spigotConfig.xRayReplacements.size() )
+ { + {
+ replacer = world.spigotConfig.xRayReplacements.iterator(); + randomOre = 0;
+ } + }
+ // Replace with random ore. + // Replace with random ore.
+ buffer[index] = (byte) replacer.next(); + buffer[index] = world.spigotConfig.xRayReplacements.get( randomOre++ ).byteValue();
+ break; + break;
+ } + }
+ } + }
@ -296,7 +299,7 @@ index 0000000..f4b4794
+ } + }
+} +}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 3e66d79..84250dc 100644 index 3e66d79..c70055b 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -1,5 +1,8 @@ @@ -1,5 +1,8 @@
@ -316,7 +319,7 @@ index 3e66d79..84250dc 100644
+ public boolean antiXray; + public boolean antiXray;
+ public int engineMode; + public int engineMode;
+ public List<Integer> blocks; + public List<Integer> blocks;
+ public TIntSet xRayReplacements; + public List<Integer> xRayReplacements;
+ public AntiXray antiXrayInstance; + public AntiXray antiXrayInstance;
+ private void antiXray() + private void antiXray()
+ { + {
@ -336,10 +339,10 @@ index 3e66d79..84250dc 100644
+ } ) ) ; + } ) ) ;
+ log( "\tBlocks: " + blocks ); + log( "\tBlocks: " + blocks );
+ +
+ xRayReplacements = new TIntHashSet( getList( "anti-xray.replacements", Arrays.asList( new Integer[] + xRayReplacements = getList( "anti-xray.replacements", Arrays.asList( new Integer[]
+ { + {
+ 1, 3 + 1, 3
+ } ) ) ); + } ) );
+ +
+ antiXrayInstance = new AntiXray( this ); + antiXrayInstance = new AntiXray( this );
+ } + }