diff --git a/src/projectzombie/display/DisplayLighting.java b/src/projectzombie/display/DisplayLighting.java index 8299c77..611a28d 100755 --- a/src/projectzombie/display/DisplayLighting.java +++ b/src/projectzombie/display/DisplayLighting.java @@ -228,6 +228,7 @@ public class DisplayLighting public static void updateLighting() { Lighting lighting = getLighting(); + Layer layer = Main.world.getLayer(); // Copy the pixels float[] pixels = new float[lighting.p.length]; @@ -235,7 +236,17 @@ public class DisplayLighting pixels[i] = lighting.p[i]; } - Layer layer = Main.world.getLayer(); + for(int x2=0;x2 implements Iterable> } // Loop over the elements - for(Map2DElement e : this.elements) + for(int i=0;i e = this.elements.get(i); + + if(e == null) { + continue; + } + // Send back the object if these positions are the same if(e.pos.equal(pos)) { element_last = e; diff --git a/src/projectzombie/world/chunk/Chunk.java b/src/projectzombie/world/chunk/Chunk.java index 345d30d..63f0948 100755 --- a/src/projectzombie/world/chunk/Chunk.java +++ b/src/projectzombie/world/chunk/Chunk.java @@ -99,6 +99,8 @@ public class Chunk implements IBdfClassManager short[] tf = nl.get("tilesFront").getShortArray(); byte[] mb = nl.get("metaBack").getByteArray(); byte[] mf = nl.get("metaFront").getByteArray(); + byte[] a_t = nl.get("temperature").getByteArray(); + byte[] a_h = nl.get("humidity").getByteArray(); for(int i=0;i tpos.distance(new Vec2i(0, 0)) / 10 - 1.25) { chunk.setBackTile(Tiles.STONE.getDefaultState(), tpos); diff --git a/src/projectzombie/world/layer/layergen/LayerGenCaves.java b/src/projectzombie/world/layer/layergen/LayerGenCaves.java index c9e0817..115b474 100755 --- a/src/projectzombie/world/layer/layergen/LayerGenCaves.java +++ b/src/projectzombie/world/layer/layergen/LayerGenCaves.java @@ -87,6 +87,9 @@ public class LayerGenCaves extends LayerGen double temperature = getTemperatureStatic(layer, new Vec2d(cx, cy)); double humidity = getHumidity(layer, new Vec2d(cx, cy)); + chunk.setTemperature(pos, temperature); + chunk.setHumidity(pos, humidity); + // Get the noise value and the position vector double noise_n = 100 - MathHelpers.positive( layer.noise_gens[2].eval(cx/16.0, cy/16.0) * 100 ); double noise_c = layer.noise_gens[3].eval(cx/32.0, cy/32.0); diff --git a/src/projectzombie/world/layer/layergen/LayerGenEarth.java b/src/projectzombie/world/layer/layergen/LayerGenEarth.java index f765c73..f84ad99 100755 --- a/src/projectzombie/world/layer/layergen/LayerGenEarth.java +++ b/src/projectzombie/world/layer/layergen/LayerGenEarth.java @@ -65,14 +65,14 @@ public class LayerGenEarth extends LayerGen layer.noise_gens = new NoiseGenerator[] { - new NoiseGeneratorSimplex(rand, 4), // Temperature - new NoiseGeneratorSimplex(rand, 4), // Humidity + new NoiseGeneratorSimplex(rand, 64), // Temperature + new NoiseGeneratorSimplex(rand, 64), // Humidity - new NoiseGeneratorSimplex(lrand), // Wind - new NoiseGeneratorSimplex(lrand), // Wind - new NoiseGeneratorSimplex(lrand, 4), // Water - new NoiseGeneratorSimplex(lrand), // Rocks - new NoiseGeneratorSimplex(lrand), // Offset + new NoiseGeneratorSimplex(lrand), // Wind + new NoiseGeneratorSimplex(lrand), // Wind + new NoiseGeneratorSimplex(lrand, 4), // Water + new NoiseGeneratorSimplex(lrand), // Rocks + new NoiseGeneratorSimplex(lrand), // Offset }; } @@ -91,12 +91,16 @@ public class LayerGenEarth extends LayerGen for(int y=0;y (1 - humidity) * 1.5) { - chunk.setFrontTile(Tiles.WATER.getDefaultState(), pos.toInt()); + chunk.setFrontTile(Tiles.WATER.getDefaultState(), tpos); } else @@ -105,41 +109,41 @@ public class LayerGenEarth extends LayerGen if(temperature < 0.35) { - chunk.setBackTile(Tiles.SNOW.getDefaultState(), pos.toInt()); + chunk.setBackTile(Tiles.SNOW.getDefaultState(), tpos); rock_type = (byte)1; if(rand.nextDouble() > MathHelpers.map(humidity, 0, 1, 0.99, 0.8)) { - chunk.setFrontTile(new TileState(Tiles.TREE, (byte)1), pos.toInt()); + chunk.setFrontTile(new TileState(Tiles.TREE, (byte)1), tpos); } } else if(temperature > 0.65 && humidity < 0.5) { - chunk.setBackTile(Tiles.SAND.getDefaultState(), pos.toInt()); + chunk.setBackTile(Tiles.SAND.getDefaultState(), tpos); rock_type = (byte)2; if(rand.nextDouble() > MathHelpers.map(humidity, 0, 0.5, 0.98, 0.95)) { - chunk.setFrontTile(Tiles.CACTUS.getDefaultState(), pos.toInt()); + chunk.setFrontTile(Tiles.CACTUS.getDefaultState(), tpos); } } else { - chunk.setBackTile(Tiles.GRASS.getDefaultState(), pos.toInt()); + chunk.setBackTile(Tiles.GRASS.getDefaultState(), tpos); if(rand.nextDouble() > MathHelpers.map(humidity, 0, 1, 0.99, 0.9)) { - chunk.setFrontTile(Tiles.TREE.getDefaultState(), pos.toInt()); + chunk.setFrontTile(Tiles.TREE.getDefaultState(), tpos); } if(rand.nextDouble() > 0.9) { - chunk.setFrontTile(Tiles.TALL_GRASS.getDefaultState(), pos.toInt()); + chunk.setFrontTile(Tiles.TALL_GRASS.getDefaultState(), tpos); } if(temperature > 0.7 && humidity > 0.7 && Math.random() > 0.9998) { - chunk.setFrontTile(Tiles.HEMP.getDefaultState(), pos.toInt()); + chunk.setFrontTile(Tiles.HEMP.getDefaultState(), tpos); while(Math.random() < 0.8) { chunk.setFrontTile(Tiles.HEMP.getDefaultState(), - pos.toInt().add(new Vec2d( + tpos.add(new Vec2d( MathHelpers.map(Math.random(), 0, 1, -2, 3), MathHelpers.map(Math.random(), 0, 1, -2, 3)).toInt())); } @@ -147,7 +151,7 @@ public class LayerGenEarth extends LayerGen } if(rand.nextDouble() > 0.98) { - chunk.setFrontTile(new TileState(Tiles.ROCK, rock_type), pos.toInt()); + chunk.setFrontTile(new TileState(Tiles.ROCK, rock_type), tpos); } } } diff --git a/src/projectzombie/world/layer/layergen/LayerGenLavaCaves.java b/src/projectzombie/world/layer/layergen/LayerGenLavaCaves.java index 07e5449..b1bec15 100755 --- a/src/projectzombie/world/layer/layergen/LayerGenLavaCaves.java +++ b/src/projectzombie/world/layer/layergen/LayerGenLavaCaves.java @@ -57,8 +57,6 @@ public class LayerGenLavaCaves extends LayerGen RandomHelpers.randrange(rand, 16)); } - - // Loop over the chunk for(int x=0;x 60 || noise_n < 20) { chunk.setBackTile(Tiles.STONE.getDefaultState(), tpos); }