mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-08-29 21:30:43 +00:00
rename main parameters/fields to platform
This commit is contained in:
+4
-3
@@ -1,5 +1,7 @@
|
||||
package com.dfsek.terra.addons.carver;
|
||||
|
||||
import com.dfsek.terra.api.Platform;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
@@ -11,7 +13,6 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.dfsek.terra.addons.carver.carving.Worm;
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.util.MathUtil;
|
||||
import com.dfsek.terra.api.util.PopulationUtil;
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
@@ -25,9 +26,9 @@ public class CarverCache {
|
||||
private final LoadingCache<Long, List<Worm.WormPoint>> cache;
|
||||
private final UserDefinedCarver carver;
|
||||
|
||||
public CarverCache(World w, Platform main, UserDefinedCarver carver) {
|
||||
public CarverCache(World w, Platform platform, UserDefinedCarver carver) {
|
||||
this.carver = carver;
|
||||
cache = CacheBuilder.newBuilder().maximumSize(main.getTerraConfig().getCarverCacheSize())
|
||||
cache = CacheBuilder.newBuilder().maximumSize(platform.getTerraConfig().getCarverCacheSize())
|
||||
.build(new CacheLoader<>() {
|
||||
@Override
|
||||
public List<Worm.WormPoint> load(@NotNull Long key) {
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ public class CarverFactory implements ConfigFactory<CarverTemplate, UserDefinedC
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDefinedCarver build(CarverTemplate config, Platform main) throws LoadException {
|
||||
public UserDefinedCarver build(CarverTemplate config, Platform platform) throws LoadException {
|
||||
double[] start = { config.getStartX(), config.getStartY(), config.getStartZ() };
|
||||
double[] mutate = { config.getMutateX(), config.getMutateY(), config.getMutateZ() };
|
||||
List<String> radius = Arrays.asList(config.getRadMX(), config.getRadMY(), config.getRadMZ());
|
||||
@@ -29,7 +29,7 @@ public class CarverFactory implements ConfigFactory<CarverTemplate, UserDefinedC
|
||||
UserDefinedCarver carver;
|
||||
try {
|
||||
carver = new UserDefinedCarver(config.getHeight(), config.getLength(), start, mutate, radius, new Scope(), hash,
|
||||
config.getCutTop(), config.getCutBottom(), config, main);
|
||||
config.getCutTop(), config.getCutBottom(), config, platform);
|
||||
} catch(ParseException e) {
|
||||
throw new LoadException("Unable to parse radius equations", e);
|
||||
}
|
||||
|
||||
+5
-5
@@ -22,16 +22,16 @@ import com.dfsek.terra.api.world.generator.GenerationStage;
|
||||
public class CavePopulator implements GenerationStage, Chunkified {
|
||||
private static final Map<BlockType, BlockState> shiftStorage = new HashMap<>();
|
||||
// Persist BlockData created for shifts, to avoid re-calculating each time.
|
||||
private final Platform main;
|
||||
private final Platform platform;
|
||||
|
||||
public CavePopulator(Platform main) {
|
||||
this.main = main;
|
||||
public CavePopulator(Platform platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
@SuppressWarnings("try")
|
||||
@Override
|
||||
public void populate(@NotNull World world, @NotNull Chunk chunk) {
|
||||
try(ProfileFrame ignore = main.getProfiler().profile("carving")) {
|
||||
try(ProfileFrame ignore = platform.getProfiler().profile("carving")) {
|
||||
Random random = PopulationUtil.getRandom(chunk);
|
||||
WorldConfig config = world.getConfig();
|
||||
if(config.disableCarving()) return;
|
||||
@@ -40,7 +40,7 @@ public class CavePopulator implements GenerationStage, Chunkified {
|
||||
CarverTemplate template = c.getConfig();
|
||||
Map<Vector3, BlockState> shiftCandidate = new HashMap<>();
|
||||
c.carve(chunk.getX(), chunk.getZ(), world, (v, type) -> {
|
||||
try(ProfileFrame ignored = main.getProfiler().profile("carving:" + c.getConfig().getID())) {
|
||||
try(ProfileFrame ignored = platform.getProfiler().profile("carving:" + c.getConfig().getID())) {
|
||||
BlockState m = chunk.getBlock(v.getBlockX(), v.getBlockY(), v.getBlockZ());
|
||||
BlockType re = m.getBlockType();
|
||||
switch(type) {
|
||||
|
||||
+4
-4
@@ -34,13 +34,13 @@ public class UserDefinedCarver extends Carver {
|
||||
private final Expression zRad;
|
||||
|
||||
private final Map<Long, CarverCache> cacheMap = new ConcurrentHashMap<>();
|
||||
private final Platform main;
|
||||
private final Platform platform;
|
||||
private double step = 2;
|
||||
private Range recalc = new ConstantRange(8, 10);
|
||||
private double recalcMagnitude = 3;
|
||||
|
||||
public UserDefinedCarver(Range height, Range length, double[] start, double[] mutate, List<String> radii, Scope parent, long hash,
|
||||
int topCut, int bottomCut, CarverTemplate config, Platform main) throws ParseException {
|
||||
int topCut, int bottomCut, CarverTemplate config, Platform platform) throws ParseException {
|
||||
super(height.getMin(), height.getMax());
|
||||
this.length = length;
|
||||
this.start = start;
|
||||
@@ -49,7 +49,7 @@ public class UserDefinedCarver extends Carver {
|
||||
this.topCut = topCut;
|
||||
this.bottomCut = bottomCut;
|
||||
this.config = config;
|
||||
this.main = main;
|
||||
this.platform = platform;
|
||||
|
||||
Parser p = new Parser();
|
||||
|
||||
@@ -74,7 +74,7 @@ public class UserDefinedCarver extends Carver {
|
||||
@Override
|
||||
public void carve(int chunkX, int chunkZ, World w, BiConsumer<Vector3, CarvingType> consumer) {
|
||||
synchronized(cacheMap) {
|
||||
CarverCache cache = cacheMap.computeIfAbsent(w.getSeed(), world -> new CarverCache(w, main, this));
|
||||
CarverCache cache = cacheMap.computeIfAbsent(w.getSeed(), world -> new CarverCache(w, platform, this));
|
||||
int carvingRadius = getCarvingRadius();
|
||||
for(int x = chunkX - carvingRadius; x <= chunkX + carvingRadius; x++) {
|
||||
for(int z = chunkZ - carvingRadius; z <= chunkZ + carvingRadius; z++) {
|
||||
|
||||
Reference in New Issue
Block a user