ObjectsAt.placedBy: the biomes and regions whose settings place an object

This commit is contained in:
piexel committed 2026-10-09 20:51:05 +02:00
1 parent 46676fd99b
commit ba96e0cbc2
4 files changed
+48 -8

No files matched your search

@@ -1,10 +1,11 @@
package com.volmit.service;
import com.volmit.world.PackWorld;
import java.util.Objects;
import java.util.Set;
/** Which pack objects a module places in a chunk, predicted without generating it. The host's object search and its
* studio tools ask every provider and use all the keys together.
/** Which pack objects a module places, predicted without generating anything. The host's object search and its
* studio tools ask every provider and use all the answers together.
*/
@Service(Providers.ALL)
public interface ObjectsAt {
@@ -15,4 +16,26 @@ public interface ObjectsAt {
* there.
*/
Set<String> objectsAt(PackWorld world, int chunkX, int chunkZ);
/**
* The biomes and regions of {@code world}'s layout whose own settings make this module place the object
* {@code objectKey}. The host finds the areas where the object can appear from these: a biome counts for the areas
* it generates in and, through its children, for the areas of the biomes inside it, so a provider names only the
* layout entries that place the object themselves. Only biomes and regions the dimension can reach are named.
*/
PlacedBy placedBy(PackWorld world, String objectKey);
/** Layout entries that place an object, named by the keys packs write ({@code land/plains}, {@code temperate}). */
record PlacedBy(Set<String> biomes, Set<String> regions) {
public static final PlacedBy NOTHING = new PlacedBy(Set.of(), Set.of());
public PlacedBy {
biomes = Set.copyOf(Objects.requireNonNull(biomes, "biomes"));
regions = Set.copyOf(Objects.requireNonNull(regions, "regions"));
}
public boolean isEmpty() {
return biomes.isEmpty() && regions.isEmpty();
}
}
}