diff --git a/src/shootergame/entity/EntityTnt.java b/src/shootergame/entity/EntityTnt.java index 0e361da..2c37972 100644 --- a/src/shootergame/entity/EntityTnt.java +++ b/src/shootergame/entity/EntityTnt.java @@ -104,9 +104,9 @@ public class EntityTnt extends EntityVertical // Is this entity alive if(e instanceof EntityAlive) { - // Kill the entity + // Add 1000 damage to the entity killed_entities = true; - e.kill(); + ((EntityAlive)e).removeHealth(10000); } } diff --git a/src/shootergame/world/layer/Layer.java b/src/shootergame/world/layer/Layer.java index d2e6b23..9c2fdcc 100644 --- a/src/shootergame/world/layer/Layer.java +++ b/src/shootergame/world/layer/Layer.java @@ -126,7 +126,9 @@ public class Layer // Create a unique seed specific to this chunk long cseed = new Random(pos.x).nextLong() + new Random(pos.y).nextLong() + seed; - chunks.set(pos, layergen.generateChunk(this, seed, new Random(cseed), pos)); + Chunk chunk = new Chunk(this, pos, rand); + chunks.set(pos, chunk); + layergen.generateChunk(chunk, this, seed, new Random(cseed), pos); } public void unloadChunk(Vec2i pos) { diff --git a/src/shootergame/world/layer/layergen/LayerGen.java b/src/shootergame/world/layer/layergen/LayerGen.java index 8546d49..22e228b 100644 --- a/src/shootergame/world/layer/layergen/LayerGen.java +++ b/src/shootergame/world/layer/layergen/LayerGen.java @@ -9,7 +9,7 @@ import shootergame.world.layer.Layer; public abstract class LayerGen implements IMap2D { - public abstract Chunk generateChunk(Layer layer, long seed, Random rand, Vec2i pos); + public abstract void generateChunk(Chunk chunk, Layer layer, long seed, Random rand, Vec2i pos); public abstract void spawnEntities(Layer layer, Random rand); @Override diff --git a/src/shootergame/world/layer/layergen/LayerGenCaves.java b/src/shootergame/world/layer/layergen/LayerGenCaves.java index caac5a6..ca2f3df 100644 --- a/src/shootergame/world/layer/layergen/LayerGenCaves.java +++ b/src/shootergame/world/layer/layergen/LayerGenCaves.java @@ -16,11 +16,8 @@ public class LayerGenCaves extends LayerGen { @Override - public Chunk generateChunk(Layer layer, long seed, Random rand, Vec2i c_pos) + public void generateChunk(Chunk chunk, Layer layer, long seed, Random rand, Vec2i c_pos) { - // Create a new chunk - Chunk chunk = new Chunk(layer, c_pos, rand); - // Is there going to be a portal in this chunk boolean portal = RandomHelpers.randrange(rand, 10) == 0; Vec2i portal_pos = null; @@ -56,9 +53,6 @@ public class LayerGenCaves extends LayerGen } } } - - // Send the chunk back - return chunk; } @Override diff --git a/src/shootergame/world/layer/layergen/LayerGenEarth.java b/src/shootergame/world/layer/layergen/LayerGenEarth.java index 5183640..7c36030 100644 --- a/src/shootergame/world/layer/layergen/LayerGenEarth.java +++ b/src/shootergame/world/layer/layergen/LayerGenEarth.java @@ -21,11 +21,8 @@ public class LayerGenEarth extends LayerGen { @Override - public Chunk generateChunk(Layer layer, long seed, Random rand, Vec2i c_pos) + public void generateChunk(Chunk chunk, Layer layer, long seed, Random rand, Vec2i c_pos) { - // Create the new chunk - Chunk chunk = new Chunk(layer, c_pos, rand); - // Is there going to be a portal in this chunk boolean portal = RandomHelpers.randrange(rand, 10) == 0; Vec2i portal_pos = null; @@ -68,9 +65,6 @@ public class LayerGenEarth extends LayerGen } } } - - // Send back the new chunk - return chunk; } @Override