diff --git a/core/src/main/java/com/boydti/fawe/FaweCache.java b/core/src/main/java/com/boydti/fawe/FaweCache.java index d2a116ec..32cd1996 100644 --- a/core/src/main/java/com/boydti/fawe/FaweCache.java +++ b/core/src/main/java/com/boydti/fawe/FaweCache.java @@ -135,6 +135,34 @@ public class FaweCache { } static { + for (int i = 0; i < Character.MAX_VALUE; i++) { + int id = i >> 4; + int data = i & 0xf; + if (FaweCache.hasNBT(id)) { + CACHE_BLOCK[i] = new ImmutableNBTBlock(id, data); + } else if (FaweCache.hasData(id)) { + CACHE_BLOCK[i] = new ImmutableBlock(id, data); + } else { + CACHE_BLOCK[i] = new ImmutableDatalessBlock(id); + } + CACHE_ITEM[i] = new BaseItem(id, (short) data) { + + @Override + public void setData(short data) { + throw new IllegalStateException("Cannot set data"); + } + + @Override + public void setDamage(short data) { + throw new IllegalStateException("Cannot set data"); + } + + @Override + public void setType(int id) { + throw new IllegalStateException("Cannot set id"); + } + }; + } for (int i = 0; i < 256; i++) { CACHE_BIOME[i] = new BaseBiome(i) { @Override @@ -173,36 +201,9 @@ public class FaweCache { } } } - } catch (Throwable ignore) {} - for (int i = 0; i < Character.MAX_VALUE; i++) { - int id = i >> 4; - int data = i & 0xf; - if (FaweCache.hasNBT(id)) { - CACHE_BLOCK[i] = new ImmutableNBTBlock(id, data); - } else if (FaweCache.hasData(id)) { - CACHE_BLOCK[i] = new ImmutableBlock(id, data); - } else { - CACHE_BLOCK[i] = new ImmutableDatalessBlock(id); - } - CACHE_ITEM[i] = new BaseItem(id, (short) data) { - - @Override - public void setData(short data) { - throw new IllegalStateException("Cannot set data"); - } - - @Override - public void setDamage(short data) { - throw new IllegalStateException("Cannot set data"); - } - - @Override - public void setType(int id) { - throw new IllegalStateException("Cannot set id"); - } - }; + } catch (Throwable ignore) { + ignore.printStackTrace(); } - CACHE_COLOR[getCombined(0, 0)] = new Color(128, 128, 128); //Air CACHE_COLOR[getCombined(1, 0)] = new Color(180, 180, 180); //stone CACHE_COLOR[getCombined(2, 0)] = new Color(0, 225, 0); //grass diff --git a/core/src/main/java/com/boydti/fawe/object/brush/heightmap/HeightMap.java b/core/src/main/java/com/boydti/fawe/object/brush/heightmap/HeightMap.java index cf3024fd..142c1cf6 100644 --- a/core/src/main/java/com/boydti/fawe/object/brush/heightmap/HeightMap.java +++ b/core/src/main/java/com/boydti/fawe/object/brush/heightmap/HeightMap.java @@ -116,6 +116,7 @@ public interface HeightMap { } } } else { + int height = pos.getBlockY(); for (int x = -size; x <= size; x++) { int xx = centerX + x; mutablePos.mutX(xx); @@ -137,11 +138,10 @@ public interface HeightMap { raise = getHeight(-z, -x); break; } - int height; if (layers) { - height = session.getNearestSurfaceLayer(xx, zz, pos.getBlockY(), 0, maxY); + height = session.getNearestSurfaceLayer(xx, zz, height, 0, maxY); } else { - height = session.getNearestSurfaceTerrainBlock(xx, zz, pos.getBlockY(), 0, 255); + height = session.getNearestSurfaceTerrainBlock(xx, zz, height, 0, 255); } oldData[index] = height; if (height == 0) {