Removed the triples with pairs again. Need to find a system to remove chunks efficiently
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
//https://www.redblobgames.com/maps/terrain-from-noise/
|
//https://www.redblobgames.com/maps/terrain-from-noise/
|
||||||
package com.mygdx.game.Dimension;
|
package com.mygdx.game.Dimension;
|
||||||
|
|
||||||
import com.github.czyzby.kiwi.util.tuple.immutable.Triple;
|
import com.github.czyzby.kiwi.util.tuple.immutable.Pair;
|
||||||
import com.mygdx.game.OpenSimplexNoise;
|
import com.mygdx.game.OpenSimplexNoise;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -9,7 +9,7 @@ import java.util.HashMap;
|
|||||||
import static com.mygdx.game.Restrictions.*;
|
import static com.mygdx.game.Restrictions.*;
|
||||||
|
|
||||||
public class Chunks {
|
public class Chunks {
|
||||||
public static HashMap<Triple<Integer, Integer, Integer>, Block> blocks = new HashMap<>();
|
public static HashMap<Pair<Integer, Integer>, Block> blocks = new HashMap<>();
|
||||||
private long seed = 1;
|
private long seed = 1;
|
||||||
|
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ public class Chunks {
|
|||||||
//Going from start of selected chunk to end of selected chunk in x and y
|
//Going from start of selected chunk to end of selected chunk in x and y
|
||||||
for (int i = startX; i != endX; i++){
|
for (int i = startX; i != endX; i++){
|
||||||
for (int j = startY; j != endY; j++) {
|
for (int j = startY; j != endY; j++) {
|
||||||
blocks.put(new Triple<Integer, Integer, Integer>(i, j, 0), getTerrain(i, j));
|
blocks.put(new Pair<>(i, j), getTerrain(i, j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.mygdx.game.Dimension;
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
import com.github.czyzby.kiwi.util.tuple.immutable.Triple;
|
import com.github.czyzby.kiwi.util.tuple.immutable.Pair;
|
||||||
import com.mygdx.game.Character.InputController;
|
import com.mygdx.game.Character.InputController;
|
||||||
import com.mygdx.game.Character.Mouse;
|
import com.mygdx.game.Character.Mouse;
|
||||||
import com.mygdx.game.Restrictions;
|
import com.mygdx.game.Restrictions;
|
||||||
@@ -19,7 +19,7 @@ public class WorldRenderer implements Restrictions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void drawWorld(Batch batch) {
|
public void drawWorld(Batch batch) {
|
||||||
for (Triple<Integer, 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;
|
int drawingLocationX = chunkpair.getFirst() << TILE_SHIFT;
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ public class Main extends ApplicationAdapter {
|
|||||||
|
|
||||||
Mouse mouse = new Mouse();
|
Mouse mouse = new Mouse();
|
||||||
gui = new GUI(mouse,fitViewport);
|
gui = new GUI(mouse,fitViewport);
|
||||||
|
|
||||||
worldRenderer = new WorldRenderer(mouse);
|
worldRenderer = new WorldRenderer(mouse);
|
||||||
batch = new SpriteBatch();
|
batch = new SpriteBatch();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user