Cleanup comments on orebfuscator patch

This commit is contained in:
md_5 2013-05-16 18:16:30 +10:00
parent 5aa5d164a2
commit 24da21efb1

View File

@ -1,82 +1,83 @@
From ce7c0ac39044dfe8ad145cb765c21ef9a855bb44 Mon Sep 17 00:00:00 2001 From a2ab3c1fe4df52ead3920ec9d29bfd4e93b1344d 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:09:28 +1000 Date: Thu, 16 May 2013 18:16:02 +1000
Subject: [PATCH] Orebfuscator Subject: [PATCH] Orebfuscator
Implement lightweight orebfuscator to Spigot Implement lightweight orebfuscator to Spigot
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 17d837d..ecc52b9 100644 index 17d837d..d38eb4d 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -94,6 +94,7 @@ public class EntityFallingBlock extends Entity { @@ -94,6 +94,7 @@ public class EntityFallingBlock extends Entity {
} }
this.world.setAir(i, j, k); this.world.setAir(i, j, k);
+ org.spigotmc.OrebfuscatorManager.updateNearbyBlocks(world, i, j, k); // Spigot (Orebfuscator) + org.spigotmc.OrebfuscatorManager.updateNearbyBlocks(world, i, j, k); // Spigot
} }
if (this.onGround) { if (this.onGround) {
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index ef220c1..63f43b8 100644 index ef220c1..ae1cee9 100644
--- a/src/main/java/net/minecraft/server/Explosion.java --- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -240,6 +240,7 @@ public class Explosion { @@ -240,6 +240,7 @@ public class Explosion {
j = chunkposition.y; j = chunkposition.y;
k = chunkposition.z; k = chunkposition.z;
l = this.world.getTypeId(i, j, k); l = this.world.getTypeId(i, j, k);
+ org.spigotmc.OrebfuscatorManager.updateNearbyBlocks(world, i, j, k); // Spigot (Orebfuscator) + org.spigotmc.OrebfuscatorManager.updateNearbyBlocks(world, i, j, k); // Spigot
if (flag) { if (flag) {
double d0 = (double) ((float) i + this.world.random.nextFloat()); double d0 = (double) ((float) i + this.world.random.nextFloat());
double d1 = (double) ((float) j + this.world.random.nextFloat()); double d1 = (double) ((float) j + this.world.random.nextFloat());
diff --git a/src/main/java/net/minecraft/server/Packet51MapChunk.java b/src/main/java/net/minecraft/server/Packet51MapChunk.java diff --git a/src/main/java/net/minecraft/server/Packet51MapChunk.java b/src/main/java/net/minecraft/server/Packet51MapChunk.java
index d11c0ea..6967b74 100644 index d11c0ea..7711629 100644
--- a/src/main/java/net/minecraft/server/Packet51MapChunk.java --- a/src/main/java/net/minecraft/server/Packet51MapChunk.java
+++ b/src/main/java/net/minecraft/server/Packet51MapChunk.java +++ b/src/main/java/net/minecraft/server/Packet51MapChunk.java
@@ -46,6 +46,7 @@ public class Packet51MapChunk extends Packet { @@ -46,6 +46,7 @@ public class Packet51MapChunk extends Packet {
this.d = chunkmap.c; this.d = chunkmap.c;
this.c = chunkmap.b; this.c = chunkmap.b;
+ org.spigotmc.OrebfuscatorManager.obfuscateSync(chunk.x, chunk.z, i, chunkmap.a, chunk.world); // Spigot (Orebfuscator) + org.spigotmc.OrebfuscatorManager.obfuscateSync(chunk.x, chunk.z, i, chunkmap.a, chunk.world); // Spigot
try { try {
this.inflatedBuffer = chunkmap.a; this.inflatedBuffer = chunkmap.a;
diff --git a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java diff --git a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
index 129dc4f..b7ffab5 100644 index 129dc4f..7312e36 100644
--- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java --- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
+++ b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java +++ b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
@@ -28,6 +28,7 @@ public class Packet56MapChunkBulk extends Packet { @@ -28,6 +28,7 @@ public class Packet56MapChunkBulk extends Packet {
} }
}; };
// CraftBukkit end // CraftBukkit end
+ private World world; // Spigot (Orebfuscator) Keep track of world + private World world; // Spigot
public Packet56MapChunkBulk() {} public Packet56MapChunkBulk() {}
@@ -46,6 +47,8 @@ public class Packet56MapChunkBulk extends Packet { @@ -46,12 +47,17 @@ public class Packet56MapChunkBulk extends Packet {
Chunk chunk = (Chunk) list.get(k); Chunk chunk = (Chunk) list.get(k);
ChunkMap chunkmap = Packet51MapChunk.a(chunk, true, '\uffff'); ChunkMap chunkmap = Packet51MapChunk.a(chunk, true, '\uffff');
+ world = chunk.world; // Spigot (Orebfuscator) + // Spigot start
+ /* Spigot (Orebfuscator) - Don't use the build buffer yet. Copy to it more efficiently once the chunk is obfuscated + world = chunk.world;
+ /*
if (buildBuffer.length < j + chunkmap.a.length) { if (buildBuffer.length < j + chunkmap.a.length) {
byte[] abyte = new byte[j + chunkmap.a.length]; byte[] abyte = new byte[j + chunkmap.a.length];
@@ -53,7 +56,7 @@ public class Packet56MapChunkBulk extends Packet { System.arraycopy(buildBuffer, 0, abyte, 0, buildBuffer.length);
buildBuffer = abyte; buildBuffer = abyte;
} }
+ */
+ // Spigot end
- System.arraycopy(chunkmap.a, 0, buildBuffer, j, chunkmap.a.length); System.arraycopy(chunkmap.a, 0, buildBuffer, j, chunkmap.a.length);
+ System.arraycopy(chunkmap.a, 0, buildBuffer, j, chunkmap.a.length); */
j += chunkmap.a.length; j += chunkmap.a.length;
this.c[k] = chunk.x; @@ -81,6 +87,22 @@ public class Packet56MapChunkBulk extends Packet {
this.d[k] = chunk.z; if (this.buffer != null) {
@@ -82,6 +85,21 @@ public class Packet56MapChunkBulk extends Packet {
return; return;
} }
+ // Spigot start
+ // Spigot (Orebfuscator) start - Obfuscate chunks
+ int finalBufferSize = 0; + int finalBufferSize = 0;
+ // Obfuscate all sections
+ for (int i = 0; i < a.length; i++) { + for (int i = 0; i < a.length; i++) {
+ org.spigotmc.OrebfuscatorManager.obfuscate(c[i], d[i], a[i], inflatedBuffers[i], world); + org.spigotmc.OrebfuscatorManager.obfuscate(c[i], d[i], a[i], inflatedBuffers[i], world);
+ finalBufferSize += inflatedBuffers[i].length; + finalBufferSize += inflatedBuffers[i].length;
@ -89,10 +90,10 @@ index 129dc4f..b7ffab5 100644
+ System.arraycopy(inflatedBuffers[i], 0, buildBuffer, bufferLocation, inflatedBuffers[i].length); + System.arraycopy(inflatedBuffers[i], 0, buildBuffer, bufferLocation, inflatedBuffers[i].length);
+ bufferLocation += inflatedBuffers[i].length; + bufferLocation += inflatedBuffers[i].length;
+ } + }
+ // Spigot (Orebfuscator) end + // Spigot end
Deflater deflater = localDeflater.get(); Deflater deflater = localDeflater.get();
deflater.reset(); deflater.reset();
deflater.setInput(this.buildBuffer);
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index 1243d1d..e45bcd2 100644 index 1243d1d..e45bcd2 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java