mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 00:15:35 +00:00
Merge branch 'dev/1.20.2' into dev/folia
This commit is contained in:
commit
d49b9ccad5
@ -1,7 +1,7 @@
|
||||
object Versions {
|
||||
object Libraries {
|
||||
const val tectonic = "4.2.0"
|
||||
const val paralithic = "0.7.0"
|
||||
const val tectonic = "4.2.1"
|
||||
const val paralithic = "0.7.1"
|
||||
const val strata = "1.3.2"
|
||||
|
||||
const val cloud = "1.8.4"
|
||||
@ -14,14 +14,14 @@ object Versions {
|
||||
const val apacheText = "1.10.0"
|
||||
const val jafama = "2.3.2"
|
||||
const val apacheIO = "2.14.0"
|
||||
const val guava = "32.1.2-jre"
|
||||
const val guava = "32.1.3-jre"
|
||||
const val asm = "9.5"
|
||||
const val snakeYml = "2.2"
|
||||
}
|
||||
}
|
||||
|
||||
object Fabric {
|
||||
const val fabricAPI = "0.89.3+${Mod.minecraft}"
|
||||
const val fabricAPI = "0.90.0+${Mod.minecraft}"
|
||||
}
|
||||
|
||||
object Quilt {
|
||||
@ -33,8 +33,8 @@ object Versions {
|
||||
const val mixin = "0.12.5+mixin.0.8.5"
|
||||
|
||||
const val minecraft = "1.20.2"
|
||||
const val yarn = "$minecraft+build.2"
|
||||
const val fabricLoader = "0.14.22"
|
||||
const val yarn = "$minecraft+build.4"
|
||||
const val fabricLoader = "0.14.23"
|
||||
|
||||
const val architecuryLoom = "1.3.357"
|
||||
const val architecturyPlugin = "3.4.146"
|
||||
|
@ -1,4 +1,4 @@
|
||||
version = version("1.1.0")
|
||||
version = version("1.2.0")
|
||||
|
||||
dependencies {
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||
|
@ -155,6 +155,16 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
|
||||
return biomeProvider.getBiome(x, y, z, world.getSeed()).getContext().get(paletteInfoPropertyKey).paletteHolder().getPalette(y);
|
||||
}
|
||||
|
||||
public double getSlant(int x, int y, int z, WorldProperties world, BiomeProvider biomeProvider) {
|
||||
int fdX = FastMath.floorMod(x, 16);
|
||||
int fdZ = FastMath.floorMod(z, 16);
|
||||
return biomeProvider.getBiome(x, y, z, world.getSeed())
|
||||
.getContext()
|
||||
.get(paletteInfoPropertyKey)
|
||||
.slantHolder()
|
||||
.calculateSlant(samplerCache.get(x, z, world, biomeProvider), fdX, y, fdZ);
|
||||
}
|
||||
|
||||
public SamplerProvider samplerProvider() {
|
||||
return samplerCache;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public class TopLocator implements Locator {
|
||||
|
||||
@Override
|
||||
public BinaryColumn getSuitableCoordinates(Column<?> column) {
|
||||
for(int y : search) {
|
||||
for(int y = search.getMax(); y >= search.getMin(); y--) {
|
||||
if(column.getBlock(y).isAir() && !column.getBlock(y - 1).isAir()) {
|
||||
return new BinaryColumn(y, y + 1, yi -> true);
|
||||
}
|
||||
|
13
common/addons/config-number-predicate/build.gradle.kts
Normal file
13
common/addons/config-number-predicate/build.gradle.kts
Normal file
@ -0,0 +1,13 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
version = version("1.0.0")
|
||||
|
||||
dependencies {
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||
api("com.dfsek", "paralithic", Versions.Libraries.paralithic)
|
||||
}
|
||||
|
||||
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
relocate("com.dfsek.paralithic", "com.dfsek.terra.addons.numberpredicate.lib.paralithic")
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.dfsek.terra.addons.numberpredicate;
|
||||
|
||||
import com.dfsek.paralithic.Expression;
|
||||
import com.dfsek.paralithic.eval.parser.Parser;
|
||||
import com.dfsek.paralithic.eval.parser.Scope;
|
||||
import com.dfsek.paralithic.eval.tokenizer.ParseException;
|
||||
import com.dfsek.tectonic.api.depth.DepthTracker;
|
||||
import com.dfsek.tectonic.api.exception.LoadException;
|
||||
import com.dfsek.tectonic.api.loader.ConfigLoader;
|
||||
import com.dfsek.tectonic.api.loader.type.TypeLoader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.reflect.AnnotatedType;
|
||||
import java.util.function.DoublePredicate;
|
||||
|
||||
|
||||
public class DoublePredicateLoader implements TypeLoader<DoublePredicate> {
|
||||
@Override
|
||||
public DoublePredicate load(@NotNull AnnotatedType annotatedType, @NotNull Object o, @NotNull ConfigLoader configLoader,
|
||||
DepthTracker depthTracker) throws LoadException {
|
||||
if (o instanceof String expressionString) {
|
||||
Scope scope = new Scope();
|
||||
scope.addInvocationVariable("value");
|
||||
try {
|
||||
Expression expression = new Parser().parse(expressionString, scope);
|
||||
return d -> expression.evaluate(d) != 0; // Paralithic expressions treat '!= 0' as true
|
||||
} catch(ParseException e) {
|
||||
throw new LoadException("Failed to parse double predicate expression", e, depthTracker);
|
||||
}
|
||||
} else {
|
||||
throw new LoadException("Double predicates must be defined as a string. E.g. 'value > 3'", depthTracker);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Polyhedral Development
|
||||
*
|
||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||
* reference the LICENSE file in this module's root directory.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.addons.numberpredicate;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.DoublePredicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.dfsek.terra.addons.manifest.api.AddonInitializer;
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.event.events.config.pack.ConfigPackPreLoadEvent;
|
||||
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
||||
import com.dfsek.terra.api.inject.annotations.Inject;
|
||||
|
||||
public class NumberPredicateAddon implements AddonInitializer {
|
||||
|
||||
@Inject
|
||||
private Platform plugin;
|
||||
|
||||
@Inject
|
||||
private BaseAddon addon;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
plugin.getEventManager()
|
||||
.getHandler(FunctionalEventHandler.class)
|
||||
.register(addon, ConfigPackPreLoadEvent.class)
|
||||
.then(event -> event.getPack().applyLoader(DoublePredicate.class, new DoublePredicateLoader()))
|
||||
.priority(50)
|
||||
.failThrough();
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
schema-version: 1
|
||||
contributors:
|
||||
- Terra contributors
|
||||
id: config-number-predicate
|
||||
version: @VERSION@
|
||||
entrypoints:
|
||||
- "com.dfsek.terra.addons.numberpredicate.NumberPredicateAddon"
|
||||
website:
|
||||
issues: https://github.com/PolyhedralDev/Terra/issues
|
||||
source: https://github.com/PolyhedralDev/Terra
|
||||
docs: https://terra.polydev.org
|
||||
license: MIT License
|
6
common/addons/locator-slant-noise-3d/build.gradle.kts
Normal file
6
common/addons/locator-slant-noise-3d/build.gradle.kts
Normal file
@ -0,0 +1,6 @@
|
||||
version = version("1.0.0")
|
||||
|
||||
dependencies {
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||
compileOnlyApi(project(":common:addons:chunk-generator-noise-3d"))
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.dfsek.terra.addon.feature.locator.slant;
|
||||
|
||||
import com.dfsek.terra.addons.chunkgenerator.generation.NoiseChunkGenerator3D;
|
||||
import com.dfsek.terra.api.structure.feature.BinaryColumn;
|
||||
import com.dfsek.terra.api.structure.feature.Locator;
|
||||
import com.dfsek.terra.api.world.World;
|
||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||
import com.dfsek.terra.api.world.chunk.generation.util.Column;
|
||||
|
||||
import java.util.function.DoublePredicate;
|
||||
|
||||
|
||||
public class SlantLocator implements Locator {
|
||||
|
||||
private final DoublePredicate predicate;
|
||||
|
||||
public SlantLocator(DoublePredicate predicate) {
|
||||
this.predicate = predicate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinaryColumn getSuitableCoordinates(Column<?> column) {
|
||||
return column.newBinaryColumn(y -> {
|
||||
int x = column.getX();
|
||||
int z = column.getZ();
|
||||
World world = column.getWorld();
|
||||
NoiseChunkGenerator3D generator = (NoiseChunkGenerator3D) world.getGenerator();
|
||||
BiomeProvider biomeProvider = world.getBiomeProvider();
|
||||
return predicate.test(generator.getSlant(x, y, z, world, biomeProvider));
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.dfsek.terra.addon.feature.locator.slant;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
|
||||
import com.dfsek.terra.addons.manifest.api.AddonInitializer;
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.event.events.config.pack.ConfigPackPreLoadEvent;
|
||||
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
||||
import com.dfsek.terra.api.inject.annotations.Inject;
|
||||
import com.dfsek.terra.api.structure.feature.Locator;
|
||||
import com.dfsek.terra.api.util.reflection.TypeKey;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
||||
public class SlantLocatorAddon implements AddonInitializer {
|
||||
|
||||
public static final TypeKey<Supplier<ObjectTemplate<Locator>>> LOCATOR_TOKEN = new TypeKey<>() {
|
||||
};
|
||||
|
||||
@Inject
|
||||
private Platform platform;
|
||||
|
||||
@Inject
|
||||
private BaseAddon addon;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
platform.getEventManager()
|
||||
.getHandler(FunctionalEventHandler.class)
|
||||
.register(addon, ConfigPackPreLoadEvent.class)
|
||||
.priority(1)
|
||||
.then(event -> event.getPack().getOrCreateRegistry(LOCATOR_TOKEN).register(addon.key("SLANT"), SlantLocatorTemplate::new))
|
||||
.failThrough();
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.dfsek.terra.addon.feature.locator.slant;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
|
||||
import com.dfsek.terra.api.structure.feature.Locator;
|
||||
|
||||
import java.util.function.DoublePredicate;
|
||||
|
||||
|
||||
public class SlantLocatorTemplate implements ObjectTemplate<Locator> {
|
||||
|
||||
@Value("condition")
|
||||
private DoublePredicate predicate;
|
||||
|
||||
@Override
|
||||
public Locator get() {
|
||||
return new SlantLocator(predicate);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
schema-version: 1
|
||||
contributors:
|
||||
- Terra contributors
|
||||
id: locator-slant-noise-3d
|
||||
version: @VERSION@
|
||||
entrypoints:
|
||||
- "com.dfsek.terra.addon.feature.locator.slant.SlantLocatorAddon"
|
||||
website:
|
||||
issues: https://github.com/PolyhedralDev/Terra/issues
|
||||
source: https://github.com/PolyhedralDev/Terra
|
||||
docs: https://terra.polydev.org
|
||||
license: MIT License
|
||||
depends:
|
||||
chunk-generator-noise-3d: "[1.2.0,2.0.0)"
|
Loading…
x
Reference in New Issue
Block a user