Fix update radius, so I can update my radius to see ores

very far away for no apparent reason I type this very long
 commit message that serves nobody elses purpose except
 Bacon ipsum dolor sit amet pancetta kielbasa turducken
 boudin. Andouille fatback doner hamburger t-bone beef
 brisket chicken turkey. Prosciutto sausage drumstick
 kielbasa, jerky ham tongue brisket venison pork loin
 fatback chuck. Drumstick short loin biltong tenderloin,
 tongue hamburger swine chicken bresaola doner filet mignon.
 Kielbasa jowl filet mignon boudin shankle pork. Capicola
 tri-tip venison, ham hock sirloin filet mignon chuck ham
 pork belly pastrami jerky prosciutto.
This commit is contained in:
SuPaH sPii 2013-04-03 17:10:41 -05:00
parent acc7e2172b
commit c77d70f8ea

View File

@ -1,4 +1,4 @@
From 9696c811feedfc323045c56e77271795de9328c1 Mon Sep 17 00:00:00 2001
From 2f62fafb59381927864261a0c2b4cb4062cbddac Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 23 Mar 2013 10:58:17 +1100
Subject: [PATCH] Add oreobfuscator for Spigot.
@ -6,15 +6,16 @@ Subject: [PATCH] Add oreobfuscator for Spigot.
---
.../net/minecraft/server/EntityFallingBlock.java | 1 +
src/main/java/net/minecraft/server/Explosion.java | 1 +
.../net/minecraft/server/Packet51MapChunk.java | 1 +
.../net/minecraft/server/Packet56MapChunkBulk.java | 21 +++-
.../net/minecraft/server/Packet51MapChunk.java | 14 +-
.../net/minecraft/server/Packet56MapChunkBulk.java | 21 ++-
.../java/net/minecraft/server/PlayerChunk.java | 2 +-
.../minecraft/server/PlayerInteractManager.java | 5 +
.../java/org/bukkit/craftbukkit/CraftServer.java | 7 +
.../java/org/bukkit/craftbukkit/CraftWorld.java | 4 +
src/main/java/org/bukkit/craftbukkit/Spigot.java | 9 ++
.../java/org/spigotmc/OrebfuscatorManager.java | 139 ++++++++++++++++++++
.../java/org/spigotmc/OrebfuscatorManager.java | 146 +++++++++++++++++++++
src/main/resources/configurations/bukkit.yml | 7 +
10 files changed, 194 insertions(+), 1 deletions(-)
11 files changed, 213 insertions(+), 4 deletions(-)
create mode 100644 src/main/java/org/spigotmc/OrebfuscatorManager.java
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@ -42,17 +43,44 @@ index b43953a..b907562 100644
double d0 = (double) ((float) i + 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
index b51d90c..9c21129 100644
index b51d90c..84dbb88 100644
--- a/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 {
@@ -36,7 +36,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.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 {
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
index 129dc4f..9f8afe3 100644
--- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
@ -106,6 +134,19 @@ index 129dc4f..9f8afe3 100644
Deflater deflater = localDeflater.get();
deflater.reset();
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
index 91bed16..8af36ca 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
@ -191,10 +232,10 @@ index db46037..4097568 100644
}
diff --git a/src/main/java/org/spigotmc/OrebfuscatorManager.java b/src/main/java/org/spigotmc/OrebfuscatorManager.java
new file mode 100644
index 0000000..768b74c
index 0000000..d168c55
--- /dev/null
+++ b/src/main/java/org/spigotmc/OrebfuscatorManager.java
@@ -0,0 +1,139 @@
@@ -0,0 +1,146 @@
+package org.spigotmc;
+
+import java.util.ArrayList;
@ -236,15 +277,22 @@ index 0000000..768b74c
+ update.stopTiming();
+ }
+
+ public static void obfuscateSync(int chunkX, int chunkY, int bitmask, byte[] buffer, World world) {
+ public static void obfuscateSync(int chunkX, int chunkY, int bitmask, byte[] buffer, World world, int initRadius) {
+ obfuscate.startTiming();
+ obfuscate(chunkX, chunkY, bitmask, buffer, world);
+ obfuscate(chunkX, chunkY, bitmask, buffer, world, initRadius);
+ 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) {
+ obfuscate(chunkX, chunkY, bitmask, buffer, world, 1);
+ }
+
+ public static void obfuscate(int chunkX, int chunkY, int bitmask, byte[] buffer, World world, int initialRadius) {
+ if (world.getServer().orebfuscatorEnabled && world.getWorld().obfuscated) {
+ int initialRadius = 1;
+ int index = 0;
+ int startX = chunkX << 4;
+ int startZ = chunkY << 4;
@ -350,5 +398,5 @@ index 9b85e13..a63dc22 100644
+ - world_the_end
+ blocks: [1, 5, 14, 15, 16, 21, 48, 49, 54, 56, 73, 74, 82, 129, 130]
--
1.7.0.4
1.8.1-rc2