mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-18 10:32:30 +00:00
commit
fa392b50f8
@ -9,6 +9,7 @@ import com.dfsek.terra.config.base.ConfigPack;
|
|||||||
import com.dfsek.terra.config.genconfig.biome.BiomeConfig;
|
import com.dfsek.terra.config.genconfig.biome.BiomeConfig;
|
||||||
import com.dfsek.terra.config.genconfig.biome.BiomeFloraConfig;
|
import com.dfsek.terra.config.genconfig.biome.BiomeFloraConfig;
|
||||||
import com.dfsek.terra.event.TreeGenerateEvent;
|
import com.dfsek.terra.event.TreeGenerateEvent;
|
||||||
|
import com.dfsek.terra.util.GlueList;
|
||||||
import org.apache.commons.math3.util.FastMath;
|
import org.apache.commons.math3.util.FastMath;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
@ -48,7 +49,7 @@ public class FloraPopulator extends GaeaBlockPopulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<Block> getValidTreeSpawnsAt(Chunk chunk, int x, int z, Range check) {
|
public static List<Block> getValidTreeSpawnsAt(Chunk chunk, int x, int z, Range check) {
|
||||||
List<Block> blocks = new ArrayList<>();
|
List<Block> blocks = new GlueList<>();
|
||||||
for(int y : check) {
|
for(int y : check) {
|
||||||
if(chunk.getBlock(x, y, z).getType().isSolid() && chunk.getBlock(x, y + 1, z).getType().isAir()) {
|
if(chunk.getBlock(x, y, z).getType().isSolid() && chunk.getBlock(x, y + 1, z).getType().isAir()) {
|
||||||
blocks.add(chunk.getBlock(x, y + 1, z));
|
blocks.add(chunk.getBlock(x, y + 1, z));
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.dfsek.terra.procgen;
|
package com.dfsek.terra.procgen;
|
||||||
|
|
||||||
|
import com.dfsek.terra.util.GlueList;
|
||||||
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
|
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.polydev.gaea.math.MathUtil;
|
import org.polydev.gaea.math.MathUtil;
|
||||||
@ -31,7 +32,7 @@ public class GridSpawn {
|
|||||||
public Vector getNearestSpawn(int x, int z, long seed) {
|
public Vector getNearestSpawn(int x, int z, long seed) {
|
||||||
int structureChunkX = x / (width + 2 * separation);
|
int structureChunkX = x / (width + 2 * separation);
|
||||||
int structureChunkZ = z / (width + 2 * separation);
|
int structureChunkZ = z / (width + 2 * separation);
|
||||||
List<Vector> zones = new ArrayList<>();
|
List<Vector> zones = new GlueList<>();
|
||||||
for(int xi = structureChunkX - 1; xi <= structureChunkX + 1; xi++) {
|
for(int xi = structureChunkX - 1; xi <= structureChunkX + 1; xi++) {
|
||||||
for(int zi = structureChunkZ - 1; zi <= structureChunkZ + 1; zi++) {
|
for(int zi = structureChunkZ - 1; zi <= structureChunkZ + 1; zi++) {
|
||||||
zones.add(getChunkSpawn(xi, zi, seed));
|
zones.add(getChunkSpawn(xi, zi, seed));
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package com.dfsek.terra.procgen.voxel;
|
package com.dfsek.terra.procgen.voxel;
|
||||||
|
|
||||||
|
import com.dfsek.terra.util.GlueList;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class VoxelGeometry {
|
public abstract class VoxelGeometry {
|
||||||
private final List<Vector> geometry = new ArrayList<>();
|
private final List<Vector> geometry = new GlueList<>();
|
||||||
|
|
||||||
public static VoxelGeometry getBlank() {
|
public static VoxelGeometry getBlank() {
|
||||||
return new VoxelGeometry() {
|
return new VoxelGeometry() {
|
||||||
|
@ -4,6 +4,7 @@ import com.dfsek.terra.Debug;
|
|||||||
import com.dfsek.terra.structure.Rotation;
|
import com.dfsek.terra.structure.Rotation;
|
||||||
import com.dfsek.terra.structure.Structure;
|
import com.dfsek.terra.structure.Structure;
|
||||||
import com.dfsek.terra.structure.StructureInfo;
|
import com.dfsek.terra.structure.StructureInfo;
|
||||||
|
import com.dfsek.terra.util.GlueList;
|
||||||
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
|
import it.unimi.dsi.util.XoRoShiRo128PlusPlusRandom;
|
||||||
import org.apache.commons.math3.util.FastMath;
|
import org.apache.commons.math3.util.FastMath;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
@ -48,7 +49,7 @@ public class EntityFeature implements Feature {
|
|||||||
|
|
||||||
int cx = info.getCenterX();
|
int cx = info.getCenterX();
|
||||||
int cz = info.getCenterZ();
|
int cz = info.getCenterZ();
|
||||||
List<Location> locations = new ArrayList<>();
|
List<Location> locations = new GlueList<>();
|
||||||
for(int i = 0; i < number; i++)
|
for(int i = 0; i < number; i++)
|
||||||
locations.add(origin.clone().add(x.get(random) - cx, y.get(random), z.get(random) - cz));
|
locations.add(origin.clone().add(x.get(random) - cx, y.get(random), z.get(random) - cz));
|
||||||
return locations;
|
return locations;
|
||||||
|
1050
src/main/java/com/dfsek/terra/util/GlueList.java
Normal file
1050
src/main/java/com/dfsek/terra/util/GlueList.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,4 @@
|
|||||||
|
import com.dfsek.terra.util.GlueList;
|
||||||
import org.apache.commons.math3.util.FastMath;
|
import org.apache.commons.math3.util.FastMath;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.polydev.gaea.math.FastNoiseLite;
|
import org.polydev.gaea.math.FastNoiseLite;
|
||||||
@ -13,7 +14,7 @@ class LookupGenerator {
|
|||||||
static void main(String[] args) throws InterruptedException {
|
static void main(String[] args) throws InterruptedException {
|
||||||
int dist = 4096;
|
int dist = 4096;
|
||||||
|
|
||||||
List<Double> vals = new ArrayList<>();
|
List<Double> vals = new GlueList<>();
|
||||||
FastNoiseLite noise = new FastNoiseLite();
|
FastNoiseLite noise = new FastNoiseLite();
|
||||||
noise.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
noise.setNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
|
||||||
noise.setFrequency(0.02f);
|
noise.setFrequency(0.02f);
|
||||||
@ -26,10 +27,10 @@ class LookupGenerator {
|
|||||||
|
|
||||||
int workerAmount = 16;
|
int workerAmount = 16;
|
||||||
|
|
||||||
List<Worker> workers = new ArrayList<>();
|
List<Worker> workers = new GlueList<>();
|
||||||
|
|
||||||
for(int i = 0; i < workerAmount; i++) {
|
for(int i = 0; i < workerAmount; i++) {
|
||||||
workers.add(new Worker(new ArrayList<>(), 5000000, noise));
|
workers.add(new Worker(new GlueList<>(), 5000000, noise));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Worker w : workers) {
|
for(Worker w : workers) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user