From 180aad05decc7eefa87e4e45d6747c48f40e5361 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Mon, 17 Apr 2023 12:12:01 -0400 Subject: save --- .../tylermurphy/Minecraft/Gen/WorldGenerator.java | 112 +++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100755 src/main/java/net/tylermurphy/Minecraft/Gen/WorldGenerator.java (limited to 'src/main/java/net/tylermurphy/Minecraft/Gen/WorldGenerator.java') diff --git a/src/main/java/net/tylermurphy/Minecraft/Gen/WorldGenerator.java b/src/main/java/net/tylermurphy/Minecraft/Gen/WorldGenerator.java new file mode 100755 index 0000000..b912ccd --- /dev/null +++ b/src/main/java/net/tylermurphy/Minecraft/Gen/WorldGenerator.java @@ -0,0 +1,112 @@ +package net.tylermurphy.Minecraft.Gen; + +import net.tylermurphy.Minecraft.Chunk.Chunk; +import net.tylermurphy.Minecraft.Chunk.PerlinNoise; +import net.tylermurphy.Minecraft.Scene.World; + +public class WorldGenerator { + + private static int OCTAVES = 2; + private static int AMPLITUDE = 10; + private static int ROUGHNESS = 3; + + public static int generateHeight(int x, int z) { + float total = 0; + float d = (float) Math.pow(2, OCTAVES-1); + for(int i=0;i2 && top > 90) { + c.cubes[x][top+1][z] = 15; + c.cubes[x][top+2][z] = 15; + c.cubes[x][top+3][z] = 15; + } + } else { + if(n1*n2/n4*n3>2 && top > 90) { + if(x < 1 || x > 14 || z < 1 || z > 14) continue; + c.cubes[x][top+1][z] = 10; + c.cubes[x][top+2][z] = 10; + c.cubes[x][top+3][z] = 10; + + c.cubes[x-1][top+3][z] = 12; + c.cubes[x-1][top+3][z+1] = 12; + c.cubes[x][top+3][z+1] = 12; + c.cubes[x+1][top+3][z+1] = 12; + c.cubes[x+1][top+3][z] = 12; + c.cubes[x+1][top+3][z-1] = 12; + c.cubes[x][top+3][z-1] = 12; + c.cubes[x-1][top+3][z-1] = 12; + + c.cubes[x+1][top+4][z] = 12; + c.cubes[x-1][top+4][z] = 12; + c.cubes[x][top+4][z+1] = 12; + c.cubes[x][top+4][z-1] = 12; + c.cubes[x][top+4][z] = 12; + } + } + } + } + } + + public static void generate(Chunk c) { + generateLandscape(c); + generateNature(c); + } + +} -- cgit v1.2.3-freya