Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c537605
rename MaterialSet
dfsek Dec 29, 2025
9c64353
rename MaterialSetLoader
dfsek Dec 29, 2025
b851b2f
start addon impl
dfsek Dec 29, 2025
4f672df
make either not bad
dfsek Dec 29, 2025
ef088dd
add basic functional types again
dfsek Dec 29, 2025
f684c60
experimenting with kinds and higher order types, not done yet
dfsek Dec 29, 2025
3777fda
Add 2-argument higher-order type and move kinds to their own package
dfsek Dec 29, 2025
e5d3018
fix functional utils
dfsek Dec 29, 2025
8bfff6b
redo maybe
dfsek Dec 29, 2025
f03f39f
implement Monad (Maybe a)
dfsek Dec 30, 2025
292be6b
add bifunctor
dfsek Dec 30, 2025
87e437f
finish either
dfsek Dec 30, 2025
7d3382e
more either stuff
dfsek Dec 30, 2025
d52cd0d
finish maybe
dfsek Dec 30, 2025
1670505
update most things to use new maybe and either
dfsek Dec 30, 2025
9a16336
convert a bunch of stuff to new APIs
dfsek Dec 30, 2025
cb08401
start working on error handling stuff
dfsek Dec 30, 2025
c4a3661
refactor createBlockState to use new error API
dfsek Dec 30, 2025
bdcd93f
refactor some stuff to use new errors
dfsek Dec 30, 2025
1bbedf5
fix refactor in mixin
dfsek Dec 30, 2025
2ad05cb
back ShortcutHolder with generic TypeLoader
dfsek Dec 30, 2025
efa4bf5
Generify shortcut configs to work on any type
dfsek Dec 30, 2025
998b647
add more api helpers
dfsek Dec 30, 2025
2215ea8
tinker with cloud
dfsek Dec 30, 2025
5dc9f41
only apply shortcut if loaded config is a string
dfsek Dec 30, 2025
8eb5a70
fallback to base loader if shortcut doesnt exist
dfsek Dec 30, 2025
eb6b370
add linkedlist
dfsek Jan 2, 2026
47bdd66
Make Pair a record
dfsek Jan 2, 2026
86bb4d5
implement Bifunctor Pair
dfsek Jan 2, 2026
9357b18
refactor some static methods to generic versions in BiFunctor
dfsek Jan 2, 2026
eae5a60
remove useless methods from Pair
dfsek Jan 2, 2026
966bcab
add more linkedlist methods
dfsek Jan 2, 2026
a5fe4d7
Add annotations
dfsek Jan 3, 2026
a66c2a0
Implement Monad Lazy
dfsek Jan 3, 2026
e706ef8
implement faster map on Lazy
dfsek Jan 3, 2026
df46c61
move Construct to FunctionUtils
dfsek Jan 3, 2026
53dafa4
rename IntToBooleanFunction to IntPredicate
dfsek Jan 3, 2026
e9d30b8
rename Lazy to Memo
dfsek Jan 3, 2026
b9af668
rename manifest-addon-loader to addon-loader-manifest
dfsek Jan 3, 2026
38a1571
fix RegistryTest
dfsek Jan 3, 2026
a9251fa
rename api-addon-loader addon-loader-api
dfsek Jan 3, 2026
b6d42fd
rename biome-query-api to api-biome-query
dfsek Jan 3, 2026
ac1258d
rename library-image to api-image
dfsek Jan 3, 2026
6a6a392
rename structure-block-shortcut to shortcut-block-structure
dfsek Jan 3, 2026
aa3fe18
rename palette-block-shortcut to shortcut-block-palette
dfsek Jan 3, 2026
65eb66c
add curry and uncurry functions
dfsek Jan 3, 2026
e6300df
implement a bunch of function utils
dfsek Jan 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public ApiAddon(Version version, String id) {
}

@Override
public Version getVersion() {
public Version version() {
return version;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public String getID() {
}

@Override
public Version getVersion() {
public Version version() {
return VERSION;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ public void initialize() {
}

@Override
public Map<String, VersionRange> getDependencies() {
public Map<String, VersionRange> dependencies() {
return manifest.getDependencies();
}

@Override
public Version getVersion() {
public Version version() {
return manifest.getVersion();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public String getID() {
}

@Override
public Version getVersion() {
public Version version() {
return VERSION;
}
}
5 changes: 5 additions & 0 deletions common/addons/api-biome-query/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version = version("1.0.0")

dependencies {
compileOnlyApi(project(":common:addons:addon-loader-manifest"))
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
schema-version: 1
contributors:
- Terra contributors
id: biome-query-api
id: api-biome-query
version: @VERSION@
entrypoints:
- "com.dfsek.terra.addons.biome.query.BiomeQueryAPIAddon"
Expand Down
7 changes: 7 additions & 0 deletions common/addons/api-image/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version = version("1.1.0")

dependencies {
compileOnlyApi(project(":common:addons:addon-loader-manifest"))


}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.dfsek.terra.addons.image.image.SuppliedImage;
import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.api.properties.Properties;
import com.dfsek.terra.api.util.generic.Lazy;
import com.dfsek.terra.api.util.generic.Memo;

import static com.dfsek.terra.api.util.cache.CacheUtils.CACHE_EXECUTOR;

Expand All @@ -41,7 +41,7 @@ public static Image load(String path, ConfigPack pack) throws IOException {
return new SuppliedImage(() -> images.cache.get(path));
} else {
// If images do not time out, image can be lazily loaded once instead of performing cache lookups for each image operation
Lazy<Image> lazyImage = Lazy.lazy(() -> images.cache.get(path));
Memo<Image> lazyImage = Memo.lazy(() -> images.cache.get(path));
return new SuppliedImage(lazyImage::value);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
schema-version: 1
contributors:
- Terra contributors
id: library-image
id: api-image
version: @VERSION@
entrypoints:
- "com.dfsek.terra.addons.image.ImageLibraryAddon"
Expand Down
4 changes: 2 additions & 2 deletions common/addons/biome-provider-extrusion/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version = version("1.0.0")

dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
compileOnlyApi(project(":common:addons:biome-query-api"))
compileOnlyApi(project(":common:addons:addon-loader-manifest"))
compileOnlyApi(project(":common:addons:api-biome-query"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.dfsek.terra.addons.biome.extrusion.utils.ExtrusionPipeline;
import com.dfsek.terra.addons.biome.extrusion.utils.ExtrusionPipelineFactory;
import com.dfsek.terra.api.util.Column;
import com.dfsek.terra.api.util.generic.data.types.Maybe;
import com.dfsek.terra.api.world.biome.Biome;
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;

Expand Down Expand Up @@ -39,11 +40,11 @@ public Biome getBiome(int x, int y, int z, long seed) {
public Column<Biome> getColumn(int x, int z, long seed, int min, int max) {
return delegate.getBaseBiome(x, z, seed)
.map(base -> (Column<Biome>) new BaseBiomeColumn(this, base, min, max, x, z, seed))
.orElseGet(() -> BiomeProvider.super.getColumn(x, z, seed, min, max));
.get(() -> BiomeProvider.super.getColumn(x, z, seed, min, max));
}

@Override
public Optional<Biome> getBaseBiome(int x, int z, long seed) {
public Maybe<Biome> getBaseBiome(int x, int z, long seed) {
return delegate.getBaseBiome(x, z, seed);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public ReplaceableBiome load(@NotNull AnnotatedType t, @NotNull Object c, @NotNu
return biomeRegistry
.getByID((String) c)
.map(ReplaceableBiome::of)
.orElseThrow(() -> new LoadException("No such biome: " + c, depthTracker));
.collectThrow(left -> new LoadException("No such biome: " + c + ": " + left, depthTracker));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ website:
docs: https://terra.polydev.org
license: MIT License
depends:
biome-query-api: "1.+"
api-biome-query: "1.+"
2 changes: 1 addition & 1 deletion common/addons/biome-provider-image/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# biome-provider-image-v2

Implements and registers the `IMAGE` biome provider, which
utilizes various config types provided by the `library-image` addon to
utilizes various config types provided by the `api-image` addon to
distribute biomes based on images.
4 changes: 2 additions & 2 deletions common/addons/biome-provider-image/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version = version("2.0.0")

dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
compileOnlyApi(project(":common:addons:library-image"))
compileOnlyApi(project(":common:addons:addon-loader-manifest"))
compileOnlyApi(project(":common:addons:api-image"))


}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import com.dfsek.terra.addons.image.colorsampler.ColorSampler;
import com.dfsek.terra.addons.image.converter.ColorConverter;
import com.dfsek.terra.api.util.generic.data.types.Maybe;
import com.dfsek.terra.api.world.biome.Biome;
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;

Expand Down Expand Up @@ -40,8 +41,8 @@ public Biome getBiome(int x, int z) {
}

@Override
public Optional<Biome> getBaseBiome(int x, int z, long seed) {
return Optional.of(getBiome(x, z));
public Maybe<Biome> getBaseBiome(int x, int z, long seed) {
return Maybe.just(getBiome(x, z));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ website:
docs: https://terra.polydev.org
license: MIT License
depends:
library-image: "1.+"
api-image: "1.+"
2 changes: 1 addition & 1 deletion common/addons/biome-provider-pipeline/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version = version("2.0.0")

dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
compileOnlyApi(project(":common:addons:addon-loader-manifest"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
package com.dfsek.terra.addons.biome.pipeline;

import com.dfsek.seismic.type.sampler.Sampler;

import com.dfsek.terra.api.util.generic.data.types.Maybe;

import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache;

Expand Down Expand Up @@ -106,8 +109,8 @@ public Iterable<Biome> getBiomes() {
}

@Override
public Optional<Biome> getBaseBiome(int x, int z, long seed) {
return Optional.of(getBiome(x, z, seed));
public Maybe<Biome> getBaseBiome(int x, int z, long seed) {
return Maybe.just(getBiome(x, z, seed));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.jetbrains.annotations.NotNull;

import java.lang.reflect.AnnotatedType;
import java.util.function.Function;

import com.dfsek.terra.addons.biome.pipeline.api.biome.PipelineBiome;
import com.dfsek.terra.api.registry.Registry;
Expand All @@ -27,6 +28,6 @@ public PipelineBiome load(@NotNull AnnotatedType t, @NotNull Object c, @NotNull
return biomeRegistry
.getByID((String) c)
.map(PipelineBiome::from)
.orElseGet(() -> PipelineBiome.placeholder((String) c));
.collect(left -> PipelineBiome.placeholder((String) c), Function.identity());
}
}
2 changes: 1 addition & 1 deletion common/addons/biome-provider-single/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version = version("1.0.0")

dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
compileOnlyApi(project(":common:addons:addon-loader-manifest"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,22 @@
package com.dfsek.terra.addons.biome.single;

import java.util.Collections;
import java.util.Optional;

import com.dfsek.terra.api.util.generic.data.types.Maybe;
import com.dfsek.terra.api.world.biome.Biome;
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;


public class SingleBiomeProvider implements BiomeProvider {
private final Biome biome;

public SingleBiomeProvider(Biome biome) {
this.biome = biome;
}
public record SingleBiomeProvider(Biome biome) implements BiomeProvider {

@Override
public Biome getBiome(int x, int y, int z, long seed) {
return biome;
}

@Override
public Optional<Biome> getBaseBiome(int x, int z, long seed) {
return Optional.of(biome);
public Maybe<Biome> getBaseBiome(int x, int z, long seed) {
return Maybe.just(biome);
}

@Override
Expand Down
5 changes: 0 additions & 5 deletions common/addons/biome-query-api/build.gradle.kts

This file was deleted.

2 changes: 1 addition & 1 deletion common/addons/chunk-generator-noise-3d/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version = version("1.2.1")

dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
compileOnlyApi(project(":common:addons:addon-loader-manifest"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ElevationInterpolator(long seed, int chunkX, int chunkZ, BiomeProvider pr
gens[x + 1 + smooth][z + 1 + smooth] =
provider
.getBaseBiome(bx, bz, seed)
.orElseGet(() -> provider.getBiome(bx, 0, bz, seed)) // kind of a hack
.get(() -> provider.getBiome(bx, 0, bz, seed)) // kind of a hack
.getContext()
.get(noisePropertiesKey);
}
Expand Down
2 changes: 1 addition & 1 deletion common/addons/command-addons/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version = version("1.0.0")

dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
compileOnlyApi(project(":common:addons:addon-loader-manifest"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void initialize() {
.append(" - ")
.append(addon.getID())
.append('@')
.append(addon.getVersion().getFormatted())
.append(addon.version().getFormatted())
.append('\n'));
context.sender().sendMessage(addons.toString());
})
Expand All @@ -52,10 +52,10 @@ public void initialize() {
BaseAddon addon = context.get("addon");
StringBuilder addonInfo = new StringBuilder("Addon ").append(addon.getID()).append('\n');

addonInfo.append("Version: ").append(addon.getVersion().getFormatted()).append('\n');
addonInfo.append("Version: ").append(addon.version().getFormatted()).append('\n');

addonInfo.append("Dependencies:\n");
addon.getDependencies().forEach((id, versions) -> addonInfo
addon.dependencies().forEach((id, versions) -> addonInfo
.append(" - ")
.append(id)
.append('@')
Expand Down
2 changes: 1 addition & 1 deletion common/addons/command-locate/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version = version("1.0.0")

dependencies {
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
compileOnlyApi(project(":common:addons:addon-loader-manifest"))
}
Loading