mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 22:31:52 +00:00
Merge remote-tracking branch 'origin/ver/6.2.0' into biomestuff
This commit is contained in:
@@ -72,19 +72,15 @@
|
|||||||
|
|
||||||
- [ ] Bug Fix <!-- Anything which fixes an issue in Terra. -->
|
- [ ] Bug Fix <!-- Anything which fixes an issue in Terra. -->
|
||||||
- [ ] Build system <!-- Anything which pretain to the build system. -->
|
- [ ] Build system <!-- Anything which pretain to the build system. -->
|
||||||
- [ ]
|
- [ ] Documentation <!-- Anything which adds or improves documentation for existing features. -->
|
||||||
Documentation <!-- Anything which adds or improves documentation for existing features. -->
|
|
||||||
- [ ] New Feature <!-- Anything which adds new functionality to Terra. -->
|
- [ ] New Feature <!-- Anything which adds new functionality to Terra. -->
|
||||||
- [ ] Performance <!-- Anything which is imrpoves the performance of Terra. -->
|
- [ ] Performance <!-- Anything which is imrpoves the performance of Terra. -->
|
||||||
- [ ]
|
- [ ] Refactoring <!-- Anything which does not add any new code, only moves code around. -->
|
||||||
Refactoring <!-- Anything which does not add any new code, only moves code around. -->
|
- [ ] Repository <!-- Anything which affects the repository. Eg. changes to the `README.md` file. -->
|
||||||
- [ ]
|
|
||||||
Repository <!-- Anything which affects the repository. Eg. changes to the `README.md` file. -->
|
|
||||||
- [ ] Revert <!-- Anything which reverts previous commits. -->
|
- [ ] Revert <!-- Anything which reverts previous commits. -->
|
||||||
- [ ] Style <!-- Anything which updates style. -->
|
- [ ] Style <!-- Anything which updates style. -->
|
||||||
- [ ] Tests <!-- Anything which adds or updates tests. -->
|
- [ ] Tests <!-- Anything which adds or updates tests. -->
|
||||||
- [ ]
|
- [ ] Translation <!-- Anything which is internationalizing the Terra program to other languages. -->
|
||||||
Translation <!-- Anything which is internationalizing the Terra program to other languages. -->
|
|
||||||
|
|
||||||
#### Compatiblity
|
#### Compatiblity
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
preRelease(true)
|
preRelease(true)
|
||||||
|
|
||||||
versionProjects(":common:api", version("6.1.0"))
|
versionProjects(":common:api", version("6.1.1"))
|
||||||
versionProjects(":common:implementation", version("6.1.0"))
|
versionProjects(":common:implementation", version("6.1.1"))
|
||||||
versionProjects(":platforms", version("6.1.0"))
|
versionProjects(":platforms", version("6.1.1"))
|
||||||
|
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
version = version("1.0.0")
|
version = version("1.1.0")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||||
|
|||||||
+5
-3
@@ -73,15 +73,17 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
|
|||||||
int cx = xOrig + x;
|
int cx = xOrig + x;
|
||||||
int cz = zOrig + z;
|
int cz = zOrig + z;
|
||||||
|
|
||||||
Biome biome = biomeProvider.getBiome(cx, 0, cz, seed);
|
|
||||||
|
|
||||||
|
BlockState data;
|
||||||
|
for(int y = world.getMaxHeight() - 1; y >= world.getMinHeight(); y--) {
|
||||||
|
Biome biome = biomeProvider.getBiome(cx, y, cz, seed);
|
||||||
|
|
||||||
PaletteInfo paletteInfo = biome.getContext().get(PaletteInfo.class);
|
PaletteInfo paletteInfo = biome.getContext().get(PaletteInfo.class);
|
||||||
|
|
||||||
int sea = paletteInfo.seaLevel();
|
int sea = paletteInfo.seaLevel();
|
||||||
Palette seaPalette = paletteInfo.ocean();
|
Palette seaPalette = paletteInfo.ocean();
|
||||||
|
|
||||||
BlockState data;
|
|
||||||
for(int y = world.getMaxHeight() - 1; y >= world.getMinHeight(); y--) {
|
|
||||||
if(sampler.sample(x, y, z) > 0) {
|
if(sampler.sample(x, y, z) > 0) {
|
||||||
if(carver.sample(x, y, z) <= 0) {
|
if(carver.sample(x, y, z) <= 0) {
|
||||||
data = PaletteUtil.getPalette(x, y, z, sampler, paletteInfo, paletteLevel).get(paletteLevel, cx, y, cz,
|
data = PaletteUtil.getPalette(x, y, z, sampler, paletteInfo, paletteLevel).get(paletteLevel, cx, y, cz,
|
||||||
|
|||||||
+6
-7
@@ -7,15 +7,15 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation;
|
package com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation;
|
||||||
|
|
||||||
|
import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
|
||||||
|
import com.dfsek.terra.api.util.mutable.MutableInteger;
|
||||||
|
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties;
|
|
||||||
import com.dfsek.terra.api.util.mutable.MutableInteger;
|
|
||||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to abstract away the Interpolators needed to generate a chunk.<br>
|
* Class to abstract away the Interpolators needed to generate a chunk.<br>
|
||||||
@@ -55,7 +55,8 @@ public class ChunkInterpolator {
|
|||||||
|
|
||||||
for(int x = 0; x < 5; x++) {
|
for(int x = 0; x < 5; x++) {
|
||||||
for(int z = 0; z < 5; z++) {
|
for(int z = 0; z < 5; z++) {
|
||||||
BiomeNoiseProperties generationSettings = provider.getBiome(xOrigin + (x << 2), 0, zOrigin + (z << 2), seed)
|
for(int y = 0; y < size + 1; y++) {
|
||||||
|
BiomeNoiseProperties generationSettings = provider.getBiome(xOrigin + (x << 2), (y << 2) + min, zOrigin + (z << 2), seed)
|
||||||
.getContext()
|
.getContext()
|
||||||
.get(BiomeNoiseProperties.class);
|
.get(BiomeNoiseProperties.class);
|
||||||
Map<BiomeNoiseProperties, MutableInteger> genMap = new HashMap<>();
|
Map<BiomeNoiseProperties, MutableInteger> genMap = new HashMap<>();
|
||||||
@@ -72,8 +73,6 @@ public class ChunkInterpolator {
|
|||||||
g -> new MutableInteger(0)).increment(); // Increment by 1
|
g -> new MutableInteger(0)).increment(); // Increment by 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int y = 0; y < size + 1; y++) {
|
|
||||||
noiseStorage[x][z][y] = computeNoise(genMap, (x << 2) + xOrigin, (y << 2) + this.min, (z << 2) + zOrigin);
|
noiseStorage[x][z][y] = computeNoise(genMap, (x << 2) + xOrigin, (y << 2) + this.min, (z << 2) + zOrigin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.dfsek.terra.api.util;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.util.function.IntObjConsumer;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
|
||||||
|
public interface Column<T> {
|
||||||
|
int getMinY();
|
||||||
|
|
||||||
|
int getMaxY();
|
||||||
|
|
||||||
|
T get(int y);
|
||||||
|
|
||||||
|
default void forEach(Consumer<T> consumer) {
|
||||||
|
for(int y = getMinY(); y < getMaxY(); y++) {
|
||||||
|
consumer.accept(get(y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default void forEach(IntObjConsumer<T> consumer) {
|
||||||
|
for(int y = getMinY(); y < getMaxY(); y++) {
|
||||||
|
consumer.accept(y, get(y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<? extends T> asList() {
|
||||||
|
List<T> list = new ArrayList<>();
|
||||||
|
forEach((Consumer<T>) list::add);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package com.dfsek.terra.api.util.function;
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface IntObjConsumer<T> {
|
||||||
|
void accept(int i, T obj);
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.dfsek.terra.api.world.biome.generation;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.util.Column;
|
||||||
|
import com.dfsek.terra.api.world.biome.Biome;
|
||||||
|
|
||||||
|
|
||||||
|
class BiomeColumn implements Column<Biome> {
|
||||||
|
private final BiomeProvider biomeProvider;
|
||||||
|
private final int min;
|
||||||
|
private final int max;
|
||||||
|
|
||||||
|
private final int x;
|
||||||
|
private final int z;
|
||||||
|
private final long seed;
|
||||||
|
|
||||||
|
protected BiomeColumn(BiomeProvider biomeProvider, int min, int max, int x, int z, long seed) {
|
||||||
|
this.biomeProvider = biomeProvider;
|
||||||
|
this.min = min;
|
||||||
|
this.max = max;
|
||||||
|
this.x = x;
|
||||||
|
this.z = z;
|
||||||
|
this.seed = seed;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinY() {
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxY() {
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Biome get(int y) {
|
||||||
|
return biomeProvider.getBiome(x, y, z, seed);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.api.world.biome.generation;
|
package com.dfsek.terra.api.world.biome.generation;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.util.Column;
|
||||||
import com.dfsek.terra.api.util.vector.Vector3;
|
import com.dfsek.terra.api.util.vector.Vector3;
|
||||||
import com.dfsek.terra.api.util.vector.Vector3Int;
|
import com.dfsek.terra.api.util.vector.Vector3Int;
|
||||||
import com.dfsek.terra.api.world.biome.Biome;
|
import com.dfsek.terra.api.world.biome.Biome;
|
||||||
@@ -62,6 +63,14 @@ public interface BiomeProvider {
|
|||||||
return getBiome(vector3.getX(), vector3.getY(), vector3.getZ(), seed);
|
return getBiome(vector3.getX(), vector3.getY(), vector3.getZ(), seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default Column<Biome> getColumn(int x, int z, int min, int max, long seed) {
|
||||||
|
return new BiomeColumn(this, min, max, x, z, seed);
|
||||||
|
}
|
||||||
|
|
||||||
|
default Column<Biome> getColumn(int x, int z, WorldProperties properties) {
|
||||||
|
return getColumn(x, z, properties.getMinHeight(), properties.getMaxHeight(), properties.getSeed());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all biomes this {@link BiomeProvider} is capable of generating in the world.
|
* Get all biomes this {@link BiomeProvider} is capable of generating in the world.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -244,12 +244,13 @@ public abstract class AbstractPlatform implements Platform {
|
|||||||
String resourceYaml = IOUtils.toString(resourcesConfig, StandardCharsets.UTF_8);
|
String resourceYaml = IOUtils.toString(resourcesConfig, StandardCharsets.UTF_8);
|
||||||
Map<String, List<String>> resources = new Yaml().load(resourceYaml);
|
Map<String, List<String>> resources = new Yaml().load(resourceYaml);
|
||||||
resources.forEach((dir, entries) -> entries.forEach(entry -> {
|
resources.forEach((dir, entries) -> entries.forEach(entry -> {
|
||||||
String resourcePath = dir + File.separatorChar + entry;
|
String resourceClassPath = dir + "/" + entry;
|
||||||
|
String resourcePath = resourceClassPath.replace('/', File.separatorChar);
|
||||||
File resource = new File(getDataFolder(), resourcePath);
|
File resource = new File(getDataFolder(), resourcePath);
|
||||||
if(resource.exists())
|
if(resource.exists())
|
||||||
return; // dont overwrite
|
return; // dont overwrite
|
||||||
|
|
||||||
try(InputStream is = getClass().getResourceAsStream("/" + resourcePath)) {
|
try(InputStream is = getClass().getResourceAsStream("/" + resourceClassPath)) {
|
||||||
if(is == null) {
|
if(is == null) {
|
||||||
logger.error("Resource {} doesn't exist on the classpath!", resourcePath);
|
logger.error("Resource {} doesn't exist on the classpath!", resourcePath);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
debug: false
|
|
||||||
data-save: PT6M
|
|
||||||
language: "en_us"
|
|
||||||
fail-type: SHUTDOWN
|
|
||||||
dump-default: true
|
|
||||||
biome-search-resolution: 4
|
|
||||||
cache-size: 384
|
|
||||||
master-disable:
|
|
||||||
caves: false
|
|
||||||
Reference in New Issue
Block a user