From 5853595fee7d649ff476267640795569eb24fa88 Mon Sep 17 00:00:00 2001 From: halotroop2288 Date: Sat, 29 Feb 2020 16:40:55 -0800 Subject: [PATCH 1/9] This method does adds more data than it saves. --- .../com/github/halotroop/litecraft/Litecraft.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/github/halotroop/litecraft/Litecraft.java b/src/main/java/com/github/halotroop/litecraft/Litecraft.java index f18c1dc..d1fa997 100644 --- a/src/main/java/com/github/halotroop/litecraft/Litecraft.java +++ b/src/main/java/com/github/halotroop/litecraft/Litecraft.java @@ -135,16 +135,13 @@ public class Litecraft extends Game Input.addPressCallback(Keybind.EXIT, this::exit); Input.addInitialPressCallback(Keybind.FULLSCREEN, Window::fullscreen); Input.addInitialPressCallback(Keybind.WIREFRAME, GingerRegister.getInstance()::toggleWireframe); - Input.addPressCallback(Keybind.MOVE_FORWARD, () -> this.movePlayer(RelativeDirection.FORWARD)); - Input.addPressCallback(Keybind.MOVE_BACKWARD, () -> this.movePlayer(RelativeDirection.BACKWARD)); - Input.addPressCallback(Keybind.STRAFE_LEFT, () -> this.movePlayer(RelativeDirection.LEFT)); - Input.addPressCallback(Keybind.STRAFE_RIGHT, () -> this.movePlayer(RelativeDirection.RIGHT)); - Input.addPressCallback(Keybind.FLY_UP, () -> this.movePlayer(RelativeDirection.UP)); - Input.addPressCallback(Keybind.FLY_DOWN, () -> this.movePlayer(RelativeDirection.DOWN)); + Input.addPressCallback(Keybind.MOVE_FORWARD, () -> this.player.move(RelativeDirection.FORWARD)); + Input.addPressCallback(Keybind.MOVE_BACKWARD, () -> this.player.move(RelativeDirection.BACKWARD)); + Input.addPressCallback(Keybind.STRAFE_LEFT, () -> this.player.move(RelativeDirection.LEFT)); + Input.addPressCallback(Keybind.STRAFE_RIGHT, () -> this.player.move(RelativeDirection.RIGHT)); + Input.addPressCallback(Keybind.FLY_UP, () -> this.player.move(RelativeDirection.UP)); + Input.addPressCallback(Keybind.FLY_DOWN, () -> this.player.move(RelativeDirection.DOWN)); } - - private void movePlayer(RelativeDirection direction) - { this.player.move(direction); } private void setupWindow() { From 804dc2471e43c393e242b2eb9dc61d23c4810513 Mon Sep 17 00:00:00 2001 From: halotroop2288 Date: Sat, 29 Feb 2020 17:53:11 -0800 Subject: [PATCH 2/9] Made chunks add blocks next to all non-full cubes to the render list Instead of just ones that are next to air. --- .../litecraft/types/block/Blocks.java | 9 +++++++++ .../halotroop/litecraft/world/Chunk.java | 20 ++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java b/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java index 1d6774e..6d9443c 100644 --- a/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java +++ b/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java @@ -4,6 +4,7 @@ import com.github.halotroop.litecraft.types.block.Block.Properties; public final class Blocks { +<<<<<<< Upstream, based on branch 'liteCraft' of https://github.com/halotroop/Ginger3D.git public static final Block AIR = new Block(new Properties("air").visible(false)); public static final Block GRASS = new Block(new Properties("block/cubes/soil/grass/grass_top.png").canCaveCarve(true)); public static final Block DIRT = new Block("block/cubes/soil/dirt.png", new Properties("dirt").canCaveCarve(true)); @@ -12,6 +13,14 @@ public final class Blocks public static final Block GRANITE = new Block("block/cubes/stone/basic/granite.png", new Properties("granite").canCaveCarve(true)); public static final Block GNEISS = new Block("block/cubes/stone/basic/gneiss.png", new Properties("gneiss").canCaveCarve(true)); +======= + public static final Block AIR = new Block(new Properties("air").visible(false).fullCube(false)); + public static final Block DIRT = new Block("block/cubes/soil/dirt.png", new Properties("dirt")); + public static final Block ANDESITE = new Block("block/cubes/stone/basic/andesite.png", new Properties("andesite")); + public static final Block DIORITE = new Block("block/cubes/stone/basic/diorite.png", new Properties("diorite")); + public static final Block GRANITE = new Block("block/cubes/stone/basic/granite.png", new Properties("granite")); + public static final Block GNEISS = new Block("block/cubes/stone/basic/gneiss.png", new Properties("gneiss")); +>>>>>>> 56b16c1 Made chunks add blocks next to all non-full cubes to the render list public static Block init() { return AIR; diff --git a/src/main/java/com/github/halotroop/litecraft/world/Chunk.java b/src/main/java/com/github/halotroop/litecraft/world/Chunk.java index b81040e..82df46a 100644 --- a/src/main/java/com/github/halotroop/litecraft/world/Chunk.java +++ b/src/main/java/com/github/halotroop/litecraft/world/Chunk.java @@ -82,25 +82,17 @@ public class Chunk implements BlockAccess, WorldGenConstants, SODSerializable { BlockInstance block = getBlockInstance(x, y, z); + // Why are we deliberately rendering blocks on the outside of the chunk??? if (x == 0 || x == CHUNK_SIZE - 1 || z == 0 || z == CHUNK_SIZE - 1 || y == 0 || y == CHUNK_SIZE - 1) { renderedBlocks[index(x, y, z)] = block; continue; } - // check for air. Yes this is stupid, TODO fix this - try { - if (getBlockInstance(x - 1, y, z).getModel() == null || getBlockInstance(x + 1, y, z).getModel() == null || - getBlockInstance(x, y - 1, z).getModel() == null || getBlockInstance(x, y + 1, z).getModel() == null || - getBlockInstance(x, y, z - 1).getModel() == null || getBlockInstance(x, y, z + 1).getModel() == null) - { - renderedBlocks[index(x, y, z)] = block; - } - } - catch (NullPointerException e) - { // this seems to be a hotspot for errors - e.printStackTrace(); // so I can add a debug breakpoint on this line - throw e; // e - } + // Check for non-full-cubes around the block + if ((!getBlock(x - 1, y, z).isFullCube() || !getBlock(x + 1, y, z).isFullCube() || !getBlock(x, y - 1, z).isFullCube() + || !getBlock(x, y + 1, z).isFullCube() || !getBlock(x, y, z - 1).isFullCube() || !getBlock(x, y, z + 1).isFullCube())) + renderedBlocks[index(x, y, z)] = block; + } blockRenderer.render(renderedBlocks); } From 2af1a71ab574f0097e132f811e0b25ba269cc2d4 Mon Sep 17 00:00:00 2001 From: halotroop2288 Date: Sat, 29 Feb 2020 18:03:08 -0800 Subject: [PATCH 3/9] Moved stuff around --- .../github/halotroop/litecraft/Litecraft.java | 20 +++++++++++++++++++ .../hydos/ginger/engine/api/Ginger.java | 2 -- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/halotroop/litecraft/Litecraft.java b/src/main/java/com/github/halotroop/litecraft/Litecraft.java index d1fa997..95f7bba 100644 --- a/src/main/java/com/github/halotroop/litecraft/Litecraft.java +++ b/src/main/java/com/github/halotroop/litecraft/Litecraft.java @@ -71,6 +71,7 @@ public class Litecraft extends Game @Override public void render() { +<<<<<<< Upstream, based on branch 'liteCraft' of https://github.com/halotroop/Ginger3D.git fps += 1; // This section updates the debug stats once per real-time second, regardless of how many frames have been rendered if (System.currentTimeMillis() > frameTimer + 1000) { @@ -83,6 +84,10 @@ public class Litecraft extends Game /** * And now, the actual rendering: */ +======= + fps+=1; + updateDebugStats(); +>>>>>>> 4b249f6 Moved stuff around // Render shadows GingerRegister.getInstance().masterRenderer.renderShadowMap(data.entities, data.lights.get(0)); // If there's a world, render it! @@ -93,9 +98,24 @@ public class Litecraft extends Game Window.swapBuffers(); } + // Updates the debug stats once per real-time second, regardless of how many frames have been rendered + private void updateDebugStats() + { + if (System.currentTimeMillis() > frameTimer + 1000) + { + this.dbgStats.set(fps, ups, tps, threadWaitlist); + this.fps=0; + this.ups=0; + this.tps=0; + this.frameTimer += 1000; + } + } + public void update() { Input.invokeAllListeners(); + data.player.updateMovement(); + data.camera.updateMovement(); } private void setupConstants() diff --git a/src/main/java/com/github/hydos/ginger/engine/api/Ginger.java b/src/main/java/com/github/hydos/ginger/engine/api/Ginger.java index 2fd730d..ff6c567 100644 --- a/src/main/java/com/github/hydos/ginger/engine/api/Ginger.java +++ b/src/main/java/com/github/hydos/ginger/engine/api/Ginger.java @@ -134,8 +134,6 @@ public class Ginger public void update(GameData data) { registry.game.update(); - data.player.updateMovement(); - data.camera.updateMovement(); picker.update(); GingerUtils.update(); ParticleMaster.update(data.camera); From d66e0bda90bb09a5a7113e6390708c05ef826385 Mon Sep 17 00:00:00 2001 From: halotroop2288 Date: Sat, 29 Feb 2020 18:11:44 -0800 Subject: [PATCH 4/9] Simpler boolean setting for cave carving blocks --- .../halotroop/litecraft/types/block/Block.java | 6 +++--- .../halotroop/litecraft/types/block/Blocks.java | 15 +++------------ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/github/halotroop/litecraft/types/block/Block.java b/src/main/java/com/github/halotroop/litecraft/types/block/Block.java index 6a785fb..179111e 100644 --- a/src/main/java/com/github/halotroop/litecraft/types/block/Block.java +++ b/src/main/java/com/github/halotroop/litecraft/types/block/Block.java @@ -11,7 +11,7 @@ public class Block { // add properties to this builder! private boolean visible = true; private boolean fullCube = true; - private boolean canCaveCarve = false; + private boolean canCaveCarve = true; private final String identifier; public Properties(String identifier) @@ -29,9 +29,9 @@ public class Block return this; } - public Properties canCaveCarve(boolean canCaveCarve) + public Properties cannotCarveCave() { - this.canCaveCarve = canCaveCarve; + this.canCaveCarve = false; return this; } } diff --git a/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java b/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java index 6d9443c..e2637c4 100644 --- a/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java +++ b/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java @@ -4,23 +4,14 @@ import com.github.halotroop.litecraft.types.block.Block.Properties; public final class Blocks { -<<<<<<< Upstream, based on branch 'liteCraft' of https://github.com/halotroop/Ginger3D.git - public static final Block AIR = new Block(new Properties("air").visible(false)); - public static final Block GRASS = new Block(new Properties("block/cubes/soil/grass/grass_top.png").canCaveCarve(true)); - public static final Block DIRT = new Block("block/cubes/soil/dirt.png", new Properties("dirt").canCaveCarve(true)); - public static final Block ANDESITE = new Block("block/cubes/stone/basic/andesite.png", new Properties("andesite").canCaveCarve(true)); - public static final Block DIORITE = new Block("block/cubes/stone/basic/diorite.png", new Properties("diorite").canCaveCarve(true)); - public static final Block GRANITE = new Block("block/cubes/stone/basic/granite.png", new Properties("granite").canCaveCarve(true)); - public static final Block GNEISS = new Block("block/cubes/stone/basic/gneiss.png", new Properties("gneiss").canCaveCarve(true)); - -======= - public static final Block AIR = new Block(new Properties("air").visible(false).fullCube(false)); + public static final Block AIR = new Block(new Properties("air").visible(false).fullCube(false).cannotCarveCave()); + public static final Block GRASS = new Block(new Properties("block/cubes/soil/grass/grass_top.png")); public static final Block DIRT = new Block("block/cubes/soil/dirt.png", new Properties("dirt")); public static final Block ANDESITE = new Block("block/cubes/stone/basic/andesite.png", new Properties("andesite")); public static final Block DIORITE = new Block("block/cubes/stone/basic/diorite.png", new Properties("diorite")); public static final Block GRANITE = new Block("block/cubes/stone/basic/granite.png", new Properties("granite")); public static final Block GNEISS = new Block("block/cubes/stone/basic/gneiss.png", new Properties("gneiss")); ->>>>>>> 56b16c1 Made chunks add blocks next to all non-full cubes to the render list + public static Block init() { return AIR; From 9c46f2a9b5ba6fd73e05c45910e99efbb2700963 Mon Sep 17 00:00:00 2001 From: halotroop2288 Date: Sat, 29 Feb 2020 18:12:15 -0800 Subject: [PATCH 5/9] Moved debug stuff --- .../github/halotroop/litecraft/Litecraft.java | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/github/halotroop/litecraft/Litecraft.java b/src/main/java/com/github/halotroop/litecraft/Litecraft.java index 95f7bba..5de4a52 100644 --- a/src/main/java/com/github/halotroop/litecraft/Litecraft.java +++ b/src/main/java/com/github/halotroop/litecraft/Litecraft.java @@ -71,23 +71,9 @@ public class Litecraft extends Game @Override public void render() { -<<<<<<< Upstream, based on branch 'liteCraft' of https://github.com/halotroop/Ginger3D.git fps += 1; // This section updates the debug stats once per real-time second, regardless of how many frames have been rendered if (System.currentTimeMillis() > frameTimer + 1000) - { - this.dbgStats.set(fps, ups, tps, threadWaitlist); - this.fps = 0; - this.ups = 0; - this.tps = 0; - this.frameTimer += 1000; - } - /** - * And now, the actual rendering: - */ -======= - fps+=1; updateDebugStats(); ->>>>>>> 4b249f6 Moved stuff around // Render shadows GingerRegister.getInstance().masterRenderer.renderShadowMap(data.entities, data.lights.get(0)); // If there's a world, render it! @@ -101,14 +87,11 @@ public class Litecraft extends Game // Updates the debug stats once per real-time second, regardless of how many frames have been rendered private void updateDebugStats() { - if (System.currentTimeMillis() > frameTimer + 1000) - { - this.dbgStats.set(fps, ups, tps, threadWaitlist); - this.fps=0; - this.ups=0; - this.tps=0; - this.frameTimer += 1000; - } + this.dbgStats.set(fps, ups, tps, threadWaitlist); + this.fps=0; + this.ups=0; + this.tps=0; + this.frameTimer += 1000; } public void update() From e3b5b54489ced43379e2e3877165eee30ff2be34 Mon Sep 17 00:00:00 2001 From: valoeghese Date: Sun, 1 Mar 2020 16:27:25 +1300 Subject: [PATCH 6/9] cave carve threshold --- .../halotroop/litecraft/types/block/Block.java | 15 ++++++++------- .../halotroop/litecraft/types/block/Blocks.java | 14 +++++++------- .../litecraft/world/gen/CavesModifier.java | 14 +++++--------- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/github/halotroop/litecraft/types/block/Block.java b/src/main/java/com/github/halotroop/litecraft/types/block/Block.java index 179111e..0b5e564 100644 --- a/src/main/java/com/github/halotroop/litecraft/types/block/Block.java +++ b/src/main/java/com/github/halotroop/litecraft/types/block/Block.java @@ -11,7 +11,7 @@ public class Block { // add properties to this builder! private boolean visible = true; private boolean fullCube = true; - private boolean canCaveCarve = true; + private float caveCarveThreshold = -1f; // cannot carve private final String identifier; public Properties(String identifier) @@ -29,15 +29,16 @@ public class Block return this; } - public Properties cannotCarveCave() + public Properties caveCarveThreshold(float threshold) { - this.canCaveCarve = false; + this.caveCarveThreshold = threshold; return this; } } public final TexturedModel model; - private final boolean visible, fullCube, canCaveCarve; + private final boolean visible, fullCube; + private final float caveCarveThreshold; public final String identifier; public boolean isFullCube() @@ -46,8 +47,8 @@ public class Block public boolean isVisible() { return this.visible; } - public boolean canCaveCarve() - { return this.canCaveCarve; } + public float getCaveCarveThreshold() + { return this.caveCarveThreshold; } protected Block(Properties properties) { this((TexturedModel) null, properties); } @@ -61,7 +62,7 @@ public class Block this.visible = properties.visible; this.fullCube = properties.fullCube; this.identifier = properties.identifier; - this.canCaveCarve = properties.canCaveCarve; + this.caveCarveThreshold = properties.caveCarveThreshold; IDENTIFIER_TO_BLOCK.put(this.identifier, this); } diff --git a/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java b/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java index e2637c4..0828252 100644 --- a/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java +++ b/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java @@ -4,13 +4,13 @@ import com.github.halotroop.litecraft.types.block.Block.Properties; public final class Blocks { - public static final Block AIR = new Block(new Properties("air").visible(false).fullCube(false).cannotCarveCave()); - public static final Block GRASS = new Block(new Properties("block/cubes/soil/grass/grass_top.png")); - public static final Block DIRT = new Block("block/cubes/soil/dirt.png", new Properties("dirt")); - public static final Block ANDESITE = new Block("block/cubes/stone/basic/andesite.png", new Properties("andesite")); - public static final Block DIORITE = new Block("block/cubes/stone/basic/diorite.png", new Properties("diorite")); - public static final Block GRANITE = new Block("block/cubes/stone/basic/granite.png", new Properties("granite")); - public static final Block GNEISS = new Block("block/cubes/stone/basic/gneiss.png", new Properties("gneiss")); + public static final Block AIR = new Block(new Properties("air").visible(false).fullCube(false)); + public static final Block GRASS = new Block(new Properties("block/cubes/soil/grass/grass_top.png").caveCarveThreshold(0.11f)); + public static final Block DIRT = new Block("block/cubes/soil/dirt.png", new Properties("dirt").caveCarveThreshold(0.12f)); + public static final Block ANDESITE = new Block("block/cubes/stone/basic/andesite.png", new Properties("andesite").caveCarveThreshold(0.15f)); + public static final Block DIORITE = new Block("block/cubes/stone/basic/diorite.png", new Properties("diorite").caveCarveThreshold(0.18f)); + public static final Block GRANITE = new Block("block/cubes/stone/basic/granite.png", new Properties("granite").caveCarveThreshold(0.17f)); + public static final Block GNEISS = new Block("block/cubes/stone/basic/gneiss.png", new Properties("gneiss").caveCarveThreshold(0.14f)); public static Block init() { diff --git a/src/main/java/com/github/halotroop/litecraft/world/gen/CavesModifier.java b/src/main/java/com/github/halotroop/litecraft/world/gen/CavesModifier.java index c1d26e8..5b809da 100644 --- a/src/main/java/com/github/halotroop/litecraft/world/gen/CavesModifier.java +++ b/src/main/java/com/github/halotroop/litecraft/world/gen/CavesModifier.java @@ -2,7 +2,7 @@ package com.github.halotroop.litecraft.world.gen; import java.util.Random; -import com.github.halotroop.litecraft.types.block.Blocks; +import com.github.halotroop.litecraft.types.block.*; import com.github.halotroop.litecraft.util.noise.OctaveSimplexNoise; import com.github.halotroop.litecraft.world.BlockAccess; import com.github.halotroop.litecraft.world.gen.modifier.WorldModifier; @@ -10,7 +10,6 @@ import com.github.halotroop.litecraft.world.gen.modifier.WorldModifier; public class CavesModifier implements WorldModifier, WorldGenConstants { private OctaveSimplexNoise caveNoise; - private static final double THRESHOLD = 0.1; // @Override public void initialize(long seed) @@ -81,14 +80,11 @@ public class CavesModifier implements WorldModifier, WorldGenConstants { int totalX = subX + scTotalX; // calculate whether to replace block with air - // if the noise is within the threshold for caves - if (-THRESHOLD < lerpNoise && lerpNoise < THRESHOLD) + // if the noise is within the threshold for that block for caves + float threshold = world.getBlock(totalX, totalY, totalZ).getCaveCarveThreshold(); + if (-threshold < lerpNoise && lerpNoise < threshold) { - // if the cave can carve into the block - if (world.getBlock(totalX, totalY, totalZ).canCaveCarve()) - { - world.setBlock(totalX, totalY, totalZ, Blocks.AIR); - } + world.setBlock(totalX, totalY, totalZ, Blocks.AIR); } // add progress to the noise lerpNoise += lerpProg; From 6e678a0c9dcecc473d8ed3e3dbec4aa7623c0fa4 Mon Sep 17 00:00:00 2001 From: valoeghese Date: Sun, 1 Mar 2020 16:32:09 +1300 Subject: [PATCH 7/9] cave stoff --- .../github/halotroop/litecraft/types/block/Blocks.java | 10 +++++----- .../halotroop/litecraft/world/gen/CavesModifier.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java b/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java index 0828252..8065a7c 100644 --- a/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java +++ b/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java @@ -5,12 +5,12 @@ import com.github.halotroop.litecraft.types.block.Block.Properties; public final class Blocks { public static final Block AIR = new Block(new Properties("air").visible(false).fullCube(false)); - public static final Block GRASS = new Block(new Properties("block/cubes/soil/grass/grass_top.png").caveCarveThreshold(0.11f)); + public static final Block GRASS = new Block(new Properties("block/cubes/soil/grass/grass_top.png").caveCarveThreshold(0.12f)); public static final Block DIRT = new Block("block/cubes/soil/dirt.png", new Properties("dirt").caveCarveThreshold(0.12f)); - public static final Block ANDESITE = new Block("block/cubes/stone/basic/andesite.png", new Properties("andesite").caveCarveThreshold(0.15f)); - public static final Block DIORITE = new Block("block/cubes/stone/basic/diorite.png", new Properties("diorite").caveCarveThreshold(0.18f)); - public static final Block GRANITE = new Block("block/cubes/stone/basic/granite.png", new Properties("granite").caveCarveThreshold(0.17f)); - public static final Block GNEISS = new Block("block/cubes/stone/basic/gneiss.png", new Properties("gneiss").caveCarveThreshold(0.14f)); + public static final Block ANDESITE = new Block("block/cubes/stone/basic/andesite.png", new Properties("andesite").caveCarveThreshold(0.11f)); + public static final Block DIORITE = new Block("block/cubes/stone/basic/diorite.png", new Properties("diorite").caveCarveThreshold(0.08f)); + public static final Block GRANITE = new Block("block/cubes/stone/basic/granite.png", new Properties("granite").caveCarveThreshold(0.09f)); + public static final Block GNEISS = new Block("block/cubes/stone/basic/gneiss.png", new Properties("gneiss").caveCarveThreshold(0.12f)); public static Block init() { diff --git a/src/main/java/com/github/halotroop/litecraft/world/gen/CavesModifier.java b/src/main/java/com/github/halotroop/litecraft/world/gen/CavesModifier.java index 5b809da..c64ffb4 100644 --- a/src/main/java/com/github/halotroop/litecraft/world/gen/CavesModifier.java +++ b/src/main/java/com/github/halotroop/litecraft/world/gen/CavesModifier.java @@ -15,7 +15,7 @@ public class CavesModifier implements WorldModifier, WorldGenConstants public void initialize(long seed) { Random rand = new Random(seed); - this.caveNoise = new OctaveSimplexNoise(rand, 1, 45.0, 1.0, 1.0); + this.caveNoise = new OctaveSimplexNoise(rand, 1, 43.0, 1.0, 1.0); } @Override From 4cff7b5d644f5cacaeb48dd0d09ca5ceafb5c7d5 Mon Sep 17 00:00:00 2001 From: valoeghese Date: Sun, 1 Mar 2020 16:41:15 +1300 Subject: [PATCH 8/9] please fix caves super --- .../halotroop/litecraft/types/block/Blocks.java | 12 ++++++------ .../halotroop/litecraft/world/gen/CavesModifier.java | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java b/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java index 8065a7c..d215f77 100644 --- a/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java +++ b/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java @@ -5,12 +5,12 @@ import com.github.halotroop.litecraft.types.block.Block.Properties; public final class Blocks { public static final Block AIR = new Block(new Properties("air").visible(false).fullCube(false)); - public static final Block GRASS = new Block(new Properties("block/cubes/soil/grass/grass_top.png").caveCarveThreshold(0.12f)); - public static final Block DIRT = new Block("block/cubes/soil/dirt.png", new Properties("dirt").caveCarveThreshold(0.12f)); - public static final Block ANDESITE = new Block("block/cubes/stone/basic/andesite.png", new Properties("andesite").caveCarveThreshold(0.11f)); - public static final Block DIORITE = new Block("block/cubes/stone/basic/diorite.png", new Properties("diorite").caveCarveThreshold(0.08f)); - public static final Block GRANITE = new Block("block/cubes/stone/basic/granite.png", new Properties("granite").caveCarveThreshold(0.09f)); - public static final Block GNEISS = new Block("block/cubes/stone/basic/gneiss.png", new Properties("gneiss").caveCarveThreshold(0.12f)); + public static final Block GRASS = new Block(new Properties("block/cubes/soil/grass/grass_top.png").caveCarveThreshold(0.04f)); + public static final Block DIRT = new Block("block/cubes/soil/dirt.png", new Properties("dirt").caveCarveThreshold(0.04f)); + public static final Block ANDESITE = new Block("block/cubes/stone/basic/andesite.png", new Properties("andesite").caveCarveThreshold(0.08f)); + public static final Block DIORITE = new Block("block/cubes/stone/basic/diorite.png", new Properties("diorite").caveCarveThreshold(0.05f)); + public static final Block GRANITE = new Block("block/cubes/stone/basic/granite.png", new Properties("granite").caveCarveThreshold(0.06f)); + public static final Block GNEISS = new Block("block/cubes/stone/basic/gneiss.png", new Properties("gneiss").caveCarveThreshold(0.09f)); public static Block init() { diff --git a/src/main/java/com/github/halotroop/litecraft/world/gen/CavesModifier.java b/src/main/java/com/github/halotroop/litecraft/world/gen/CavesModifier.java index c64ffb4..a1edd57 100644 --- a/src/main/java/com/github/halotroop/litecraft/world/gen/CavesModifier.java +++ b/src/main/java/com/github/halotroop/litecraft/world/gen/CavesModifier.java @@ -15,7 +15,7 @@ public class CavesModifier implements WorldModifier, WorldGenConstants public void initialize(long seed) { Random rand = new Random(seed); - this.caveNoise = new OctaveSimplexNoise(rand, 1, 43.0, 1.0, 1.0); + this.caveNoise = new OctaveSimplexNoise(rand, 2, 65.0, 1.0, 1.0); } @Override @@ -35,8 +35,8 @@ public class CavesModifier implements WorldModifier, WorldGenConstants { int scOffsetY = subChunkY << 2; // sub chunk offset y int scTotalY = scOffsetY + chunkStartY; - double scSampleY = (double) scTotalY * 2.0; - double scUpperYOffset = 4.0 * 2.0; + double scSampleY = (double) scTotalY * 1.5; // squish caves along y axis a bit + double scUpperYOffset = 4.0 * 1.5; // calculate noise at each corner of the cube [lower|upper][south|north][west|east] double noiseLSW = this.caveNoise.sample(scTotalX, scSampleY, scTotalZ); // base = lower south west double noiseUSW = this.caveNoise.sample(scTotalX, scSampleY + scUpperYOffset, scTotalZ); From 2768e05d48371fb6f50c6ecedfd16affd79d5ebf Mon Sep 17 00:00:00 2001 From: valoeghese Date: Sun, 1 Mar 2020 17:07:50 +1300 Subject: [PATCH 9/9] move cave modifier to modifier package --- .../litecraft/world/gen/{ => modifier}/CavesModifier.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename src/main/java/com/github/halotroop/litecraft/world/gen/{ => modifier}/CavesModifier.java (96%) diff --git a/src/main/java/com/github/halotroop/litecraft/world/gen/CavesModifier.java b/src/main/java/com/github/halotroop/litecraft/world/gen/modifier/CavesModifier.java similarity index 96% rename from src/main/java/com/github/halotroop/litecraft/world/gen/CavesModifier.java rename to src/main/java/com/github/halotroop/litecraft/world/gen/modifier/CavesModifier.java index a1edd57..b1de6cf 100644 --- a/src/main/java/com/github/halotroop/litecraft/world/gen/CavesModifier.java +++ b/src/main/java/com/github/halotroop/litecraft/world/gen/modifier/CavesModifier.java @@ -1,11 +1,11 @@ -package com.github.halotroop.litecraft.world.gen; +package com.github.halotroop.litecraft.world.gen.modifier; import java.util.Random; import com.github.halotroop.litecraft.types.block.*; import com.github.halotroop.litecraft.util.noise.OctaveSimplexNoise; import com.github.halotroop.litecraft.world.BlockAccess; -import com.github.halotroop.litecraft.world.gen.modifier.WorldModifier; +import com.github.halotroop.litecraft.world.gen.WorldGenConstants; public class CavesModifier implements WorldModifier, WorldGenConstants {