mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-22 08:10:40 +00:00
sort of working Minestom implementation
This commit is contained in:
@@ -36,7 +36,7 @@ public class NoiseFunction2 implements NoiseFunction {
|
||||
super(cacheSize);
|
||||
}
|
||||
|
||||
public double get(NoiseSampler noise, double x, double z) {
|
||||
public synchronized double get(NoiseSampler noise, double x, double z) {
|
||||
double xx = x >= 0 ? x * 2 : x * -2 - 1;
|
||||
double zz = z >= 0 ? z * 2 : z * -2 - 1;
|
||||
double key = (xx >= zz) ? (xx * xx + xx + zz) : (zz * zz + xx);
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.dfsek.terra.world.generation.math;
|
||||
|
||||
import com.dfsek.terra.api.TerraPlugin;
|
||||
import com.dfsek.terra.api.math.MathUtil;
|
||||
import com.dfsek.terra.api.platform.world.World;
|
||||
import com.dfsek.terra.world.TerraWorld;
|
||||
import com.dfsek.terra.world.generation.math.samplers.Sampler;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
@@ -11,10 +10,6 @@ import com.google.common.cache.LoadingCache;
|
||||
import net.jafama.FastMath;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class SamplerCache {
|
||||
private final LoadingCache<Long, Sampler> cache;
|
||||
|
||||
|
||||
@@ -21,6 +21,12 @@ public class FloraLayer extends PlaceableLayer<Flora> {
|
||||
@Override
|
||||
public void place(Chunk chunk, Vector2 coords) {
|
||||
Flora item = layer.get(noise, (chunk.getX() << 4) + coords.getX(), (chunk.getZ() << 4) + coords.getZ());
|
||||
item.getValidSpawnsAt(chunk, (int) coords.getX(), (int) coords.getZ(), level).forEach(block -> item.plant(block.getLocation()));
|
||||
item.getValidSpawnsAt(chunk, (int) coords.getX(), (int) coords.getZ(), level).forEach(block -> {
|
||||
try {
|
||||
item.plant(block.getLocation());
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.dfsek.terra.api.platform.block.BlockFace;
|
||||
import com.dfsek.terra.api.platform.block.data.Directional;
|
||||
import com.dfsek.terra.api.platform.block.data.MultipleFacing;
|
||||
import com.dfsek.terra.api.platform.block.data.Rotatable;
|
||||
import com.dfsek.terra.api.platform.handle.WorldHandle;
|
||||
import com.dfsek.terra.api.platform.world.Chunk;
|
||||
import com.dfsek.terra.api.util.FastRandom;
|
||||
import com.dfsek.terra.api.util.GlueList;
|
||||
@@ -94,7 +93,6 @@ public class TerraFlora implements Flora {
|
||||
|
||||
@Override
|
||||
public boolean plant(Location location) {
|
||||
WorldHandle handle = main.getWorldHandle();
|
||||
|
||||
boolean doRotation = testRotation.size() > 0;
|
||||
int size = floraPalette.getSize();
|
||||
|
||||
Reference in New Issue
Block a user