From 7ec0d5eb5ce0e9aa62b83d49510ad376d80e769f Mon Sep 17 00:00:00 2001 From: Solargale Date: Thu, 9 Apr 2020 10:55:46 -0600 Subject: [PATCH] Made the WorldRenderer class a bit smaller by removing redundant methods --- core/src/com/mygdx/game/Dimension/Chunks.java | 2 +- .../mygdx/game/Dimension/WorldRenderer.java | 18 ++++++------------ core/src/com/mygdx/game/Main.java | 1 - 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/core/src/com/mygdx/game/Dimension/Chunks.java b/core/src/com/mygdx/game/Dimension/Chunks.java index a453267..63b6072 100644 --- a/core/src/com/mygdx/game/Dimension/Chunks.java +++ b/core/src/com/mygdx/game/Dimension/Chunks.java @@ -27,7 +27,7 @@ public class Chunks { } public double noise1(double nx, double ny) { - OpenSimplexNoise gen1 = new OpenSimplexNoise(seed); + OpenSimplexNoise gen1 = new OpenSimplexNoise(seed+1); return gen1.eval(nx, ny)/2 + 0.5; } diff --git a/core/src/com/mygdx/game/Dimension/WorldRenderer.java b/core/src/com/mygdx/game/Dimension/WorldRenderer.java index 387aaae..be4bd09 100644 --- a/core/src/com/mygdx/game/Dimension/WorldRenderer.java +++ b/core/src/com/mygdx/game/Dimension/WorldRenderer.java @@ -20,26 +20,20 @@ public class WorldRenderer implements Restrictions { public void drawWorld(Batch batch) { for (Pair chunkpair : Chunks.blocks.keySet()) { - String name = Chunks.blocks.get(chunkpair).getName(); - int drawingLocationX = chunkpair.getFirst() << TILE_SHIFT; - int drawingLocationY = chunkpair.getSecond() << TILE_SHIFT; - - batch.draw(BlockMaterials.getTexture(name), drawingLocationX, drawingLocationY); + batch.draw( + BlockMaterials.getTexture(name), + chunkpair.getFirst() << TILE_SHIFT, + chunkpair.getSecond() << TILE_SHIFT + ); } } public void render(SpriteBatch batch) { - try { - drawWorld(batch); - }catch (Exception ignored){} - + drawWorld(batch); inputController.handleInput(); batch.setProjectionMatrix(cam.combined); cam.update(); mouse.render(batch); } - - public void dispose() { - } } diff --git a/core/src/com/mygdx/game/Main.java b/core/src/com/mygdx/game/Main.java index 2007e10..dc8bd9e 100644 --- a/core/src/com/mygdx/game/Main.java +++ b/core/src/com/mygdx/game/Main.java @@ -68,7 +68,6 @@ public class Main extends ApplicationAdapter { @Override public void dispose () { - worldRenderer.dispose(); gui.dispose(); batch.dispose(); Player.textureAtlas.dispose();