Use different replacement blocks for normal, nether and end worlds in Orebfuscator

This commit is contained in:
David 2014-04-26 13:52:20 +01:00 committed by md_5
parent 928f6e1ea3
commit 4d2b4b4822
1 changed files with 21 additions and 6 deletions

View File

@ -1,4 +1,4 @@
From 4721d9011f520f9764d8dd4d429e2d000f57a859 Mon Sep 17 00:00:00 2001 From ef9e06887f0d3836c29e13ae7927b23b9ad36bf1 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,10 +128,10 @@ index 6da7de6..2de7e62 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..8e69bff index 0000000..20ae98e
--- /dev/null --- /dev/null
+++ b/src/main/java/org/spigotmc/AntiXray.java +++ b/src/main/java/org/spigotmc/AntiXray.java
@@ -0,0 +1,212 @@ @@ -0,0 +1,227 @@
+package org.spigotmc; +package org.spigotmc;
+ +
+import gnu.trove.set.TByteSet; +import gnu.trove.set.TByteSet;
@ -139,6 +139,7 @@ index 0000000..8e69bff
+import net.minecraft.server.Block; +import net.minecraft.server.Block;
+import net.minecraft.server.Blocks; +import net.minecraft.server.Blocks;
+import net.minecraft.server.World; +import net.minecraft.server.World;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+ +
+public class AntiXray +public class AntiXray
+{ +{
@ -222,6 +223,20 @@ index 0000000..8e69bff
+ int startX = chunkX << 4; + int startX = chunkX << 4;
+ int startZ = chunkY << 4; + int startZ = chunkY << 4;
+ +
+ byte replaceWithTypeId;
+ switch ( world.getWorld().getEnvironment() )
+ {
+ case NETHER:
+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.NETHERRACK);
+ break;
+ case THE_END:
+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.WHITESTONE);
+ break;
+ default:
+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.STONE);
+ break;
+ }
+
+ // Chunks can have up to 16 sections + // Chunks can have up to 16 sections
+ for ( int i = 0; i < 16; i++ ) + for ( int i = 0; i < 16; i++ )
+ { + {
@ -259,8 +274,8 @@ index 0000000..8e69bff
+ switch ( world.spigotConfig.engineMode ) + switch ( world.spigotConfig.engineMode )
+ { + {
+ case 1: + case 1:
+ // Replace with stone + // Replace with replacement material
+ buffer[index] = 1; + buffer[index] = replaceWithTypeId;
+ break; + break;
+ case 2: + case 2:
+ // Replace with random ore. + // Replace with random ore.
@ -393,5 +408,5 @@ index 1814b4f..45b2aae 100644
+ } + }
} }
-- --
1.9.1 1.8.3.2