Revert changes to orebfuscator radius

This commit is contained in:
md_5 2013-05-16 17:56:35 +10:00
parent 195739fcd6
commit 03ddea9fb6

View File

@ -1,4 +1,4 @@
From 8639462ceb382a8d29919d16524a1c8c22ceaf10 Mon Sep 17 00:00:00 2001 From 06974f3e2abe579c6790c1e22b17ec6c444e2361 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Sat, 23 Mar 2013 10:58:17 +1100 Date: Sat, 23 Mar 2013 10:58:17 +1100
Subject: [PATCH] Add oreobfuscator for Spigot. Subject: [PATCH] Add oreobfuscator for Spigot.
@ -29,44 +29,17 @@ index ef220c1..63f43b8 100644
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..2fcd7f7 100644 index d11c0ea..6967b74 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
@@ -36,7 +36,7 @@ public class Packet51MapChunk extends Packet { @@ -46,6 +46,7 @@ public class Packet51MapChunk extends Packet {
}
// Spigot end
- public Packet51MapChunk(Chunk chunk, boolean flag, int i) {
+ public Packet51MapChunk(Chunk chunk, boolean flag, int i, int obfuscate) { // Spigot (Orebfuscator) - added argument
this.lowPriority = true;
this.a = chunk.x;
this.b = chunk.z;
@@ -46,7 +46,11 @@ 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)
+ // Spigot start - Orebfuscator
+ if (obfuscate > 0) {
+ org.spigotmc.OrebfuscatorManager.obfuscateSync(chunk.x, chunk.z, i, chunkmap.a, chunk.world, obfuscate);
+ }
+ // Spigot end
try { try {
this.inflatedBuffer = chunkmap.a; this.inflatedBuffer = chunkmap.a;
deflater.setInput(chunkmap.a, 0, chunkmap.a.length);
@@ -57,6 +61,12 @@ public class Packet51MapChunk extends Packet {
deflater.end();
}
}
+
+ // Spigot start - add new default constructor to support new orebfuscator arg.
+ public Packet51MapChunk(Chunk chunk, boolean flag, int i) {
+ this(chunk, flag, i, 1);
+ }
+ // Spigot end
public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOException
this.a = datainputstream.readInt();
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..9f8afe3 100644 index 129dc4f..9f8afe3 100644
--- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java --- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
@ -120,19 +93,6 @@ index 129dc4f..9f8afe3 100644
Deflater deflater = localDeflater.get(); Deflater deflater = localDeflater.get();
deflater.reset(); deflater.reset();
deflater.setInput(this.buildBuffer); deflater.setInput(this.buildBuffer);
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index 20f8e8a..3792638 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -117,7 +117,7 @@ class PlayerChunk {
if (this.dirtyCount == 64) {
i = this.location.x * 16;
j = this.location.z * 16;
- this.sendAll(new Packet51MapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); // CraftBukkit - send everything (including biome) if all sections flagged
+ this.sendAll(new Packet51MapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f, PlayerChunkMap.a(this.playerChunkMap).getServer().orebfuscatorUpdateRadius)); // Spigot (Orebfuscator) - CraftBukkit - send everything (including biome) if all sections flagged
for (k = 0; k < 16; ++k) {
if ((this.f & 1 << k) != 0) {
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..1a31112 100644 index 1243d1d..1a31112 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
@ -218,10 +178,10 @@ index 67477f4..c4eea4d 100644
} }
diff --git a/src/main/java/org/spigotmc/OrebfuscatorManager.java b/src/main/java/org/spigotmc/OrebfuscatorManager.java diff --git a/src/main/java/org/spigotmc/OrebfuscatorManager.java b/src/main/java/org/spigotmc/OrebfuscatorManager.java
new file mode 100644 new file mode 100644
index 0000000..be9233c index 0000000..f1eee2b
--- /dev/null --- /dev/null
+++ b/src/main/java/org/spigotmc/OrebfuscatorManager.java +++ b/src/main/java/org/spigotmc/OrebfuscatorManager.java
@@ -0,0 +1,146 @@ @@ -0,0 +1,139 @@
+package org.spigotmc; +package org.spigotmc;
+ +
+import java.util.ArrayList; +import java.util.ArrayList;
@ -263,22 +223,15 @@ index 0000000..be9233c
+ update.stopTiming(); + update.stopTiming();
+ } + }
+ +
+ public static void obfuscateSync(int chunkX, int chunkY, int bitmask, byte[] buffer, World world, int initRadius) { + public static void obfuscateSync(int chunkX, int chunkY, int bitmask, byte[] buffer, World world) {
+ obfuscate.startTiming(); + obfuscate.startTiming();
+ obfuscate(chunkX, chunkY, bitmask, buffer, world, initRadius); + obfuscate(chunkX, chunkY, bitmask, buffer, world);
+ obfuscate.stopTiming(); + obfuscate.stopTiming();
+ } + }
+ +
+ public static void obfuscateSync(int chunkX, int chunkY, int bitmask, byte[] buffer, World world) {
+ obfuscateSync(chunkX, chunkY, bitmask, buffer, world, 1);
+ }
+
+ public static void obfuscate(int chunkX, int chunkY, int bitmask, byte[] buffer, World world) { + public static void obfuscate(int chunkX, int chunkY, int bitmask, byte[] buffer, World world) {
+ obfuscate(chunkX, chunkY, bitmask, buffer, world, 1); + if (world.getServer().orebfuscatorEnabled && world.getWorld().obfuscated) {
+ } + int initialRadius = 1;
+
+ public static void obfuscate(int chunkX, int chunkY, int bitmask, byte[] buffer, World world, int initialRadius) {
+ if (world.getWorld().obfuscated) {
+ int index = 0; + int index = 0;
+ int startX = chunkX << 4; + int startX = chunkX << 4;
+ int startZ = chunkY << 4; + int startZ = chunkY << 4;