Made the WorldRenderer class a bit smaller by removing redundant methods
This commit is contained in:
@@ -27,7 +27,7 @@ public class Chunks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double noise1(double nx, double ny) {
|
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;
|
return gen1.eval(nx, ny)/2 + 0.5;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,26 +20,20 @@ public class WorldRenderer implements Restrictions {
|
|||||||
|
|
||||||
public void drawWorld(Batch batch) {
|
public void drawWorld(Batch batch) {
|
||||||
for (Pair<Integer, Integer> chunkpair : Chunks.blocks.keySet()) {
|
for (Pair<Integer, Integer> chunkpair : Chunks.blocks.keySet()) {
|
||||||
|
|
||||||
String name = Chunks.blocks.get(chunkpair).getName();
|
String name = Chunks.blocks.get(chunkpair).getName();
|
||||||
int drawingLocationX = chunkpair.getFirst() << TILE_SHIFT;
|
batch.draw(
|
||||||
int drawingLocationY = chunkpair.getSecond() << TILE_SHIFT;
|
BlockMaterials.getTexture(name),
|
||||||
|
chunkpair.getFirst() << TILE_SHIFT,
|
||||||
batch.draw(BlockMaterials.getTexture(name), drawingLocationX, drawingLocationY);
|
chunkpair.getSecond() << TILE_SHIFT
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(SpriteBatch batch) {
|
public void render(SpriteBatch batch) {
|
||||||
try {
|
drawWorld(batch);
|
||||||
drawWorld(batch);
|
|
||||||
}catch (Exception ignored){}
|
|
||||||
|
|
||||||
inputController.handleInput();
|
inputController.handleInput();
|
||||||
batch.setProjectionMatrix(cam.combined);
|
batch.setProjectionMatrix(cam.combined);
|
||||||
cam.update();
|
cam.update();
|
||||||
mouse.render(batch);
|
mouse.render(batch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ public class Main extends ApplicationAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose () {
|
public void dispose () {
|
||||||
worldRenderer.dispose();
|
|
||||||
gui.dispose();
|
gui.dispose();
|
||||||
batch.dispose();
|
batch.dispose();
|
||||||
Player.textureAtlas.dispose();
|
Player.textureAtlas.dispose();
|
||||||
|
|||||||
Reference in New Issue
Block a user