Check if chunk is loading before obfuscating.

By: md_5 <md_5@live.com.au>
This commit is contained in:
Spigot 2013-01-22 09:57:22 +11:00
parent 0d3f1faa0d
commit 59d1636638

View File

@ -1,4 +1,4 @@
From e54edb89cff47a39424a7c2407dd5b401457bef6 Mon Sep 17 00:00:00 2001 From 651726d8d8d2b340212ad898826e88b1a0f7fd8e Mon Sep 17 00:00:00 2001
From: lishid <lishid@gmail.com> From: lishid <lishid@gmail.com>
Date: Mon, 21 Jan 2013 16:59:04 +1100 Date: Mon, 21 Jan 2013 16:59:04 +1100
Subject: [PATCH] Add oreobfuscator for Spigot. Subject: [PATCH] Add oreobfuscator for Spigot.
@ -10,9 +10,9 @@ Subject: [PATCH] Add oreobfuscator for Spigot.
.../minecraft/server/PlayerInteractManager.java | 5 ++ .../minecraft/server/PlayerInteractManager.java | 5 ++
.../java/org/bukkit/craftbukkit/CraftServer.java | 9 +++ .../java/org/bukkit/craftbukkit/CraftServer.java | 9 +++
.../java/org/bukkit/craftbukkit/CraftWorld.java | 4 + .../java/org/bukkit/craftbukkit/CraftWorld.java | 4 +
.../bukkit/craftbukkit/OrebfuscatorManager.java | 92 ++++++++++++++++++++++ .../bukkit/craftbukkit/OrebfuscatorManager.java | 93 ++++++++++++++++++++++
src/main/resources/configurations/bukkit.yml | 5 ++ src/main/resources/configurations/bukkit.yml | 5 ++
8 files changed, 137 insertions(+), 1 deletion(-) 8 files changed, 138 insertions(+), 1 deletion(-)
create mode 100644 src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java create mode 100644 src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java
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
@ -166,10 +166,10 @@ index 856307f..4861609 100644
public int cactusGrowthModifier = 100; public int cactusGrowthModifier = 100;
diff --git a/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java b/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java diff --git a/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java b/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java
new file mode 100644 new file mode 100644
index 0000000..8d4d4d3 index 0000000..6d5a519
--- /dev/null --- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java +++ b/src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java
@@ -0,0 +1,92 @@ @@ -0,0 +1,93 @@
+package org.bukkit.craftbukkit; +package org.bukkit.craftbukkit;
+ +
+import net.minecraft.server.Block; +import net.minecraft.server.Block;
@ -253,6 +253,7 @@ index 0000000..8d4d4d3
+ +
+ private static boolean areAjacentBlocksTransparent(World world, int x, int y, int z, int radius) { + private static boolean areAjacentBlocksTransparent(World world, int x, int y, int z, int radius) {
+ return y > 0 && y <= world.getHeight() + return y > 0 && y <= world.getHeight()
+ && world.isLoaded(x, y, z)
+ && !Block.i(world.getTypeId(x, y, z)) + && !Block.i(world.getTypeId(x, y, z))
+ || (radius > 0 && (areAjacentBlocksTransparent(world, x, y + 1, z, radius - 1) + || (radius > 0 && (areAjacentBlocksTransparent(world, x, y + 1, z, radius - 1)
+ || areAjacentBlocksTransparent(world, x, y - 1, z, radius - 1) + || areAjacentBlocksTransparent(world, x, y - 1, z, radius - 1)