Fixed mob spawners being treated as solid blocks for the orebfuscator

Mob spawners are treated as solid blocks as far as the game is concerned for lighting and other tasks but for rendering they can be seen through, therefor we special case them so that the antixray doesn't show the fake blocks around them.
This commit is contained in:
Thinkofdeath 2014-04-03 10:50:48 +01:00
parent 710f33af71
commit 2bf205d5f9

View File

@ -1,4 +1,4 @@
From 843082121ed14c89160bebea30de24837bcc8f2b Mon Sep 17 00:00:00 2001 From 149f988a0165f036934d7f0fd527404b5a53a224 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:51:05 +1000 Date: Thu, 16 May 2013 18:51:05 +1000
Subject: [PATCH] Orebfuscator Subject: [PATCH] Orebfuscator
@ -128,15 +128,16 @@ index cbb4e77..106f27a 100644
public void b(int i, int j, int k, Block block, int l) { 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 diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java
new file mode 100644 new file mode 100644
index 0000000..3853903 index 0000000..8e69bff
--- /dev/null --- /dev/null
+++ b/src/main/java/org/spigotmc/AntiXray.java +++ b/src/main/java/org/spigotmc/AntiXray.java
@@ -0,0 +1,202 @@ @@ -0,0 +1,212 @@
+package org.spigotmc; +package org.spigotmc;
+ +
+import gnu.trove.set.TByteSet; +import gnu.trove.set.TByteSet;
+import gnu.trove.set.hash.TByteHashSet; +import gnu.trove.set.hash.TByteHashSet;
+import net.minecraft.server.Block; +import net.minecraft.server.Block;
+import net.minecraft.server.Blocks;
+import net.minecraft.server.World; +import net.minecraft.server.World;
+ +
+public class AntiXray +public class AntiXray
@ -324,7 +325,7 @@ index 0000000..3853903
+ +
+ private static boolean hasTransparentBlockAdjacent(World world, int x, int y, int z, int radius) + private static boolean hasTransparentBlockAdjacent(World world, int x, int y, int z, int radius)
+ { + {
+ return !world.getType(x, y, z).r() /* isSolidBlock */ + return !isSolidBlock(world.getType(x, y, z)) /* isSolidBlock */
+ || ( radius > 0 + || ( radius > 0
+ && ( hasTransparentBlockAdjacent( world, x + 1, y, z, radius - 1 ) + && ( hasTransparentBlockAdjacent( world, x + 1, y, z, radius - 1 )
+ || hasTransparentBlockAdjacent( world, x - 1, y, z, radius - 1 ) + || hasTransparentBlockAdjacent( world, x - 1, y, z, radius - 1 )
@ -333,6 +334,15 @@ index 0000000..3853903
+ || hasTransparentBlockAdjacent( world, x, y, z + 1, radius - 1 ) + || hasTransparentBlockAdjacent( world, x, y, z + 1, radius - 1 )
+ || hasTransparentBlockAdjacent( world, x, y, z - 1, radius - 1 ) ) ); + || hasTransparentBlockAdjacent( world, x, y, z - 1, radius - 1 ) ) );
+ } + }
+
+ private static boolean isSolidBlock(Block block) {
+ // Mob spawners are treated as solid blocks as far as the
+ // game is concerned for lighting and other tasks but for
+ // rendering they can be seen through therefor we special
+ // case them so that the antixray doesn't show the fake
+ // blocks around them.
+ return block.r() && block != Blocks.MOB_SPAWNER;
+ }
+} +}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 2ec047c..2c0501d 100644 index 2ec047c..2c0501d 100644