Use correct bitmask variable for orebfuscator

This commit is contained in:
md_5 2014-02-01 10:42:59 +11:00
parent 31f53fbbbe
commit 12358efad3

View file

@ -1,4 +1,4 @@
From ed7b1fa657976910f496b8cdcaf25e38aecc3f26 Mon Sep 17 00:00:00 2001
From b1f48210131c8ca7b879452ca7b60a4bd578a826 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
@ -49,14 +49,14 @@ index 09b34e9..e80d8b9 100644
try {
this.buffer = chunkmap.a;
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
index bf3a139..ce44ad6 100644
index bf3a139..fc92026 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
@@ -43,6 +43,7 @@ public class PacketPlayOutMapChunkBulk extends Packet {
for (int k = 0; k < i; ++k) {
Chunk chunk = (Chunk) list.get(k);
ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, '\uffff');
+ chunk.world.spigotConfig.antiXrayInstance.obfuscate(chunk.locX, chunk.locZ, i, chunkmap.a, chunk.world); // Spigot
+ chunk.world.spigotConfig.antiXrayInstance.obfuscate(chunk.locX, chunk.locZ, chunkmap.b, chunkmap.a, chunk.world); // Spigot
if (buildBuffer.length < j + chunkmap.a.length) {
byte[] abyte = new byte[j + chunkmap.a.length];
@ -86,7 +86,7 @@ index 5b0875d..1aca7f6 100644
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
new file mode 100644
index 0000000..ab01d3b
index 0000000..8230ff1
--- /dev/null
+++ b/src/main/java/org/spigotmc/AntiXray.java
@@ -0,0 +1,188 @@
@ -149,7 +149,7 @@ index 0000000..ab01d3b
+ /**
+ * Removes all non exposed ores from the chunk buffer.
+ */
+ public void obfuscate(int chunkX, int chunkY, int bitmask, byte[] buffer, World world)
+ public void obfuscate(int chunkX, int chunkZ, int bitmask, byte[] buffer, World world)
+ {
+ // If the world is marked as obfuscated
+ if ( world.spigotConfig.antiXray )
@ -164,7 +164,7 @@ index 0000000..ab01d3b
+
+ // Chunk corner X and Z blocks
+ int startX = chunkX << 4;
+ int startZ = chunkY << 4;
+ int startZ = chunkZ << 4;
+
+ // Chunks can have up to 16 sections
+ for ( int i = 0; i < 16; i++ )