summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorFearThe1337 <admin@fearthe1337.com>2014-12-18 22:09:25 +0100
committerThinkofdeath <thinkofdeath@spigotmc.org>2014-12-21 17:38:42 +0000
commit53fc3cf74f0c336f6a718b4c33e53a605887dd8a (patch)
treeaf6f978becfb98876de5250e2b7f6eac4fc62d2c /src/main/java
parentb6634d740973585499850325aa1288c17057f73e (diff)
downloadcraftbukkit-53fc3cf74f0c336f6a718b4c33e53a605887dd8a.tar
craftbukkit-53fc3cf74f0c336f6a718b4c33e53a605887dd8a.tar.gz
craftbukkit-53fc3cf74f0c336f6a718b4c33e53a605887dd8a.tar.lz
craftbukkit-53fc3cf74f0c336f6a718b4c33e53a605887dd8a.tar.xz
craftbukkit-53fc3cf74f0c336f6a718b4c33e53a605887dd8a.zip
Fix custom chunk generators. Fixes SPIGOT-193.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
index d47755a0..33af06d4 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
@@ -64,9 +64,9 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
}
char[] secBlkID = new char[4096]; // Allocate blk ID bytes
short[] bdata = xbtypes[sec];
- // Loop through data, 2 blocks at a time
for (int i = 0; i < bdata.length; i++) {
- secBlkID[i] = (char) ((int)bdata[i] << 4);
+ Block b = Block.getById(bdata[i]);
+ secBlkID[i] = (char) Block.d.b(b.getBlockData());
}
// Build chunk section
csect[sec] = new ChunkSection(sec << 4, true, secBlkID);
@@ -88,7 +88,8 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
char[] secBlkID = new char[4096]; // Allocate block ID bytes
for (int i = 0; i < secBlkID.length; i++) {
- secBlkID[i] = (char)(((int) btypes[sec][i]) << 4);
+ Block b = Block.getById(btypes[sec][i]);
+ secBlkID[i] = (char) Block.d.b(b.getBlockData());
}
csect[sec] = new ChunkSection(sec << 4, true, secBlkID);
}
@@ -123,7 +124,9 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
cs = csect[sec] = new ChunkSection(sec << 4, true);
csbytes = cs.getIdArray();
}
- csbytes[(cy << 8) | (cz << 4) | cx] = (char)((int)blk << 4);
+
+ Block b = Block.getById(blk);
+ csbytes[(cy << 8) | (cz << 4) | cx] = (char) Block.d.b(b.getBlockData());
}
}
}