Show decorators, snippets and ground cover in the studio

Decorators get their own pattern view from the decorant module: each
biome's decorators from above, placed where their own noise allows.

The Palettes and Decorators views list the pack's snippet files in a
Snippets group, with the biomes that use each one, and mark entries
read from a snippet. PackResources gains snippetOf and snippets so a
module can tell where a settings value came from.

The 3D world draws what stands on the ground, such as grass and
flowers, as the block's own model. A plugin block that is solid on the
server but shown to players as a plant no longer counts as ground.
This commit is contained in:
piexel committed 2026-11-12 04:09:20 +01:00
1 parent 67063b02d7
commit 55f6a06f9f
30 files changed
+1172 -71

No files matched your search

@@ -0,0 +1,123 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.builtin.tooling;
import com.volmit.resource.PackSnippet;
import com.volmit.tooling.PatternEntry;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
/**
* The snippet files a pattern view lists after its biomes' entries (v3e's snippet folders): each of a file's entries
* once, with the biome entries that use it, so a shared palette is found in one place and a file nothing uses yet
* still shows.
*/
public final class SnippetUses {
private static final String GROUP = "Snippets";
private static final String KEY_PREFIX = "snippet:";
private static final char ENTRY_SEPARATOR = '#';
private static final int MOST_USES_LISTED = 8;
private static final int UNUSED_DEPTHS = 1;
private final Map<PackSnippet.Source, List<PatternEntry>> usesBySource = new LinkedHashMap<>();
/** Whether {@code key} names an entry of a snippet file, not a biome's. */
public static boolean isSnippetKey(String key) {
return key.startsWith(KEY_PREFIX);
}
/** The entry of a snippet file that {@code key} names; empty for a key that names none. */
public static Optional<PackSnippet.Source> sourceOf(String key) {
int entryStart = key.lastIndexOf(ENTRY_SEPARATOR);
if (!isSnippetKey(key) || entryStart <= KEY_PREFIX.length()) {
return Optional.empty();
}
try {
return Optional.of(new PackSnippet.Source(key.substring(KEY_PREFIX.length(), entryStart), Integer.parseInt(key.substring(entryStart + 1))));
} catch (IllegalArgumentException notAnEntry) {
return Optional.empty();
}
}
/** The line an entry read from a snippet file says so with. */
public static String factOf(PackSnippet.Source source) {
return "Snippet " + source.path();
}
/** Notes that the entry {@code user} places what {@code source} holds. */
public void use(PackSnippet.Source source, PatternEntry user) {
usesBySource.computeIfAbsent(source, unused -> new ArrayList<>()).add(user);
}
/** The first entry that uses {@code source}, which it is shown as; empty when nothing uses it. */
public Optional<PatternEntry> firstUseOf(PackSnippet.Source source) {
return Optional.ofNullable(usesBySource.get(source)).map(List::getFirst);
}
/**
* One entry for each thing the snippet files hold, in the order given; a file that could not be read is listed once.
*
* @param blocksOf the line naming the blocks a snippet's entry places
*/
public <T> List<PatternEntry> entries(List<PackSnippet<T>> snippets, Function<T, String> blocksOf) {
List<PatternEntry> entries = new ArrayList<>();
for (PackSnippet<T> snippet : snippets) {
if (snippet.entries().isEmpty()) {
entries.add(entryOf(new PackSnippet.Source(snippet.path(), 0), snippet.path(), List.of("Could not be read; the server log says why")));
continue;
}
for (int held = 0; held < snippet.entries().size(); held++) {
PackSnippet.Source source = new PackSnippet.Source(snippet.path(), held);
String name = snippet.entries().size() == 1 ? snippet.path() : snippet.path() + " · " + (held + 1);
List<String> facts = new ArrayList<>(List.of(blocksOf.apply(snippet.entries().get(held))));
facts.addAll(usesOf(source));
entries.add(entryOf(source, name, facts));
}
}
return entries;
}
private PatternEntry entryOf(PackSnippet.Source source, String name, List<String> facts) {
int depths = firstUseOf(source).map(PatternEntry::depths).orElse(UNUSED_DEPTHS);
return new PatternEntry(KEY_PREFIX + source.path() + ENTRY_SEPARATOR + source.entry(), name, Optional.of(GROUP), depths, facts);
}
private List<String> usesOf(PackSnippet.Source source) {
List<PatternEntry> uses = usesBySource.getOrDefault(source, List.of());
if (uses.isEmpty()) {
return List.of("Not used by any biome");
}
List<String> lines = new ArrayList<>();
lines.add(uses.size() == 1 ? "Used once, shown as placed there:" : "Used " + uses.size() + " times, shown as the first places it:");
uses.stream().limit(MOST_USES_LISTED).map(SnippetUses::nameOf).forEach(lines::add);
if (uses.size() > MOST_USES_LISTED) {
lines.add("and " + (uses.size() - MOST_USES_LISTED) + " more");
}
return lines;
}
private static String nameOf(PatternEntry user) {
return user.group().map(group -> group + " · " + user.name()).orElse(user.name());
}
}
@@ -24,6 +24,7 @@ import art.arcane.iris.modules.decorant.DecorateSettings;
import art.arcane.iris.engine.decorator.BiomeDecorators;
import art.arcane.iris.engine.decorator.DecoratedBiome;
import art.arcane.iris.engine.decorator.DecorationScene;
import art.arcane.iris.engine.decorator.DecoratorPatterns;
import art.arcane.iris.engine.decorator.IrisSeaFloorDecorator;
import art.arcane.iris.engine.decorator.IrisSeaSurfaceDecorator;
import art.arcane.iris.engine.decorator.IrisShoreLineDecorator;
@@ -61,6 +62,7 @@ public final class DecorantModule implements IrisModule, ModuleLifecycle {
registry.registerSettings(DecorantSettings.class);
registry.registerSettings(DecorateSettings.class);
registry.registerLifecycle(this);
setup.tooling().registerView(new DecoratorPatterns());
}
@Override
@@ -101,6 +101,28 @@ public final class BiomeDecorators {
return decorators.computeIfAbsent(biome.settings(), declared -> resolve(biome.key(), declared)).getOrDefault(part, NO_DECORATORS);
}
/** The decorator the biome lists at {@code index}, made ready as generation has it; null when it lists none there. */
ResolvedDecorator decoratorAt(DecoratedBiome biome, int index) {
if (biome == null || biome.settings() == null || index < 0 || index >= biome.settings().decorators().size()) {
return null;
}
Decorator declared = biome.settings().decorators().get(index);
if (declared == null) {
return null;
}
for (ResolvedDecorator resolved : decorators(biome, declared.partOf())) {
if (resolved.settings() == declared) {
return resolved;
}
}
return null;
}
/** A decorator no biome lists, made ready with a seed of its own, which {@code name} decides. */
ResolvedDecorator unlisted(String name, Decorator decorator) {
return ResolvedDecorator.of(decorator, resources, seedOf(name, 0), log, name);
}
/** Whether the biome has a decorator for {@code part}. */
public boolean hasDecorators(DecoratedBiome biome, DecorationPart part) {
return decorators(biome, part).length > 0;
@@ -0,0 +1,259 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.engine.decorator;
import art.arcane.iris.builtin.decorant.DecorantSettings;
import art.arcane.iris.builtin.decorant.DecorationPart;
import art.arcane.iris.builtin.decorant.Decorator;
import art.arcane.iris.builtin.tooling.SnippetUses;
import com.volmit.block.BlockSpec;
import com.volmit.block.BlockState;
import com.volmit.config.FeatureSettings;
import com.volmit.resource.PackResources;
import com.volmit.resource.PackSnippet;
import com.volmit.resource.ResourceId;
import com.volmit.tooling.BlockPattern;
import com.volmit.tooling.PatternArea;
import com.volmit.tooling.PatternEntry;
import com.volmit.tooling.PatternView;
import com.volmit.world.PackBiome;
import com.volmit.world.PackWorld;
import com.volmit.world.RunningWorld;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* The studio's Decorators view (v3e's palette explorer showed them beside the layers): each biome's decorators from
* above, the columns a decorator's own noise lets it place on and the block it picks there. A decorator is shown alone:
* in the world the biome's other decorators, the surface block and the slope decide between them.
*/
public final class DecoratorPatterns implements PatternView {
private static final ResourceId ID = ResourceId.parse("iris:decorant/decorators");
private static final char INDEX_SEPARATOR = '#';
private static final char ENTRY_SEED_SEPARATOR = '#';
private static final String MINECRAFT_PREFIX = "minecraft:";
private static final int ONE_BLOCK = 1;
private static final Map<DecorationPart, String> PLACES = Map.of(
DecorationPart.SHORE_LINE, "On the shore line",
DecorationPart.SEA_SURFACE, "On the sea's surface",
DecorationPart.SEA_FLOOR, "On the sea floor",
DecorationPart.CEILING, "On cave ceilings");
@Override
public ResourceId id() {
return ID;
}
@Override
public String label() {
return "Decorators";
}
@Override
public String description() {
return "Each biome's decorators from above, where they place and the blocks they pick";
}
@Override
public List<PatternEntry> entries(PackWorld world) {
Optional<RunningWorld> running = world.running();
if (running.isEmpty()) {
return List.of();
}
SnippetUses snippetUses = new SnippetUses();
List<PatternEntry> entries = new ArrayList<>(biomeEntries(world.resources(), running.get().settings(), snippetUses));
entries.addAll(snippetUses.entries(world.resources().snippets(Decorator.class), decorator -> blocksOf(decorator.palette())));
return entries;
}
@Override
public Optional<BlockPattern> pattern(PackWorld world, String key, int depth, PatternArea area) {
Optional<RunningWorld> running = world.running();
if (running.isEmpty() || depth < 0) {
return Optional.empty();
}
FeatureSettings settings = running.get().settings();
Optional<ResolvedDecorator> decorator = SnippetUses.isSnippetKey(key)
? SnippetUses.sourceOf(key).flatMap(source -> snippetDecorator(world, settings, source))
: biomeDecorator(world, settings, key);
if (decorator.isEmpty() && isUnreadableSnippet(world.resources(), key)) {
return Optional.of(BlockPattern.of(area.columns(), new BlockState[area.columns() * area.columns()]));
}
return decorator.map(placed -> patternOf(placed, depth, area));
}
// A file that could not be read is listed too, and places nothing.
private static boolean isUnreadableSnippet(PackResources resources, String key) {
return SnippetUses.sourceOf(key).stream().anyMatch(source -> resources.snippets(Decorator.class).stream()
.anyMatch(snippet -> snippet.path().equals(source.path()) && snippet.entries().isEmpty()));
}
private static List<PatternEntry> biomeEntries(PackResources resources, FeatureSettings settings, SnippetUses snippetUses) {
List<PackBiome> biomes = biomesByName(resources);
Map<String, Long> biomesByShownName = biomes.stream().collect(Collectors.groupingBy(PackBiome::name, Collectors.counting()));
List<PatternEntry> entries = new ArrayList<>();
for (PackBiome biome : biomes) {
String group = biomesByShownName.get(biome.name()) > 1 ? biome.name() + " (" + biome.id().path() + ")" : biome.name();
List<Decorator> decorators = settings.declaredBy(biome.id(), DecorantSettings.class).map(DecorantSettings::decorators).orElse(List.of());
for (int index = 0; index < decorators.size(); index++) {
Decorator decorator = decorators.get(index);
if (decorator == null || decorator.palette().isEmpty()) {
continue;
}
Optional<PackSnippet.Source> snippet = resources.snippetOf(decorator);
PatternEntry entry = entryOf(biome, index, decorator, group, snippet);
entries.add(entry);
snippet.ifPresent(source -> snippetUses.use(source, entry));
}
}
return entries;
}
private static List<PackBiome> biomesByName(PackResources resources) {
return resources.ids(PackResources.BIOMES).stream()
.map(id -> resources.find(PackResources.BIOMES, id))
.flatMap(Optional::stream)
.sorted(Comparator.comparing(PackBiome::name).thenComparing(biome -> biome.id().toString()))
.toList();
}
private static PatternEntry entryOf(PackBiome biome, int index, Decorator decorator, String group, Optional<PackSnippet.Source> snippet) {
String key = biome.id().toString() + INDEX_SEPARATOR + index;
List<String> facts = factsOf(decorator);
snippet.map(SnippetUses::factOf).ifPresent(facts::add);
return new PatternEntry(key, "Decorator " + (index + 1), Optional.of(group).filter(shown -> !shown.isBlank()), depthsOf(decorator), facts);
}
// A stack scaled to its cave has no height of its own to step through.
private static int depthsOf(Decorator decorator) {
return decorator.isStacking() && !decorator.scaleStack() ? decorator.stackMax() : ONE_BLOCK;
}
private static List<String> factsOf(Decorator decorator) {
List<String> facts = new ArrayList<>();
facts.add(blocksOf(decorator.palette()));
if (!decorator.topPalette().isEmpty()) {
facts.add("Topped with " + blocksOf(decorator.topPalette()));
}
facts.add("Chance " + decorator.chance() + ", " + decorator.style().style().toLowerCase(Locale.ROOT).replace('_', ' ')
+ " noise, zoom " + decorator.style().zoom());
if (decorator.isStacking()) {
facts.add(stackOf(decorator));
}
if (PLACES.containsKey(decorator.partOf())) {
facts.add(PLACES.get(decorator.partOf()));
}
if (!decorator.slopeCondition().isDefault()) {
facts.add("Only on slopes from " + decorator.slopeCondition().minimumSlope() + " to " + decorator.slopeCondition().maximumSlope()
+ "; shown everywhere here");
}
facts.add("Shown alone, without the biome's other decorators");
return facts;
}
private static String stackOf(Decorator decorator) {
String unit = decorator.scaleStack() ? "% of the cave's height" : " blocks";
if (decorator.stackMin() == decorator.stackMax()) {
return "Stacks " + decorator.stackMax() + unit;
}
return "Stacks " + decorator.stackMin() + " to " + decorator.stackMax() + unit;
}
private static String blocksOf(List<BlockSpec> palette) {
Map<String, Integer> weights = palette.stream()
.collect(Collectors.groupingBy(spec -> shortName(spec.block()), LinkedHashMap::new, Collectors.summingInt(BlockSpec::weight)));
return weights.entrySet().stream()
.map(entry -> entry.getValue() > 1 ? entry.getKey() + " ×" + entry.getValue() : entry.getKey())
.collect(Collectors.joining(", "));
}
private static String shortName(String block) {
return block.startsWith(MINECRAFT_PREFIX) ? block.substring(MINECRAFT_PREFIX.length()) : block;
}
private static Optional<ResolvedDecorator> biomeDecorator(PackWorld world, FeatureSettings settings, String key) {
int indexStart = key.lastIndexOf(INDEX_SEPARATOR);
if (indexStart < 1) {
return Optional.empty();
}
Optional<Integer> index = wholeNumber(key.substring(indexStart + 1));
Optional<ResourceId> biome = world.resources().ids(PackResources.BIOMES).stream()
.filter(id -> id.toString().equals(key.substring(0, indexStart)))
.findFirst();
if (index.isEmpty() || biome.isEmpty()) {
return Optional.empty();
}
Optional<DecorantSettings> declared = settings.declaredBy(biome.get(), DecorantSettings.class);
return declared.map(decorators -> BiomeDecorators.of(world)
.decoratorAt(new DecoratedBiome(BiomeDecorators.biomeKey(biome.get()), decorators, null), index.get()));
}
// A snippet's decorator is shown as the first biome that uses it places it; one nothing uses gets noise of its own.
private static Optional<ResolvedDecorator> snippetDecorator(PackWorld world, FeatureSettings settings, PackSnippet.Source source) {
SnippetUses snippetUses = new SnippetUses();
biomeEntries(world.resources(), settings, snippetUses);
Optional<PatternEntry> firstUse = snippetUses.firstUseOf(source);
if (firstUse.isPresent()) {
return biomeDecorator(world, settings, firstUse.get().key());
}
return world.resources().snippets(Decorator.class).stream()
.filter(snippet -> snippet.path().equals(source.path()))
.map(PackSnippet::entries)
.filter(held -> source.entry() < held.size())
.findFirst()
.map(held -> BiomeDecorators.of(world).unlisted(source.path() + ENTRY_SEED_SEPARATOR + source.entry(), held.get(source.entry())));
}
private static Optional<Integer> wholeNumber(String text) {
try {
return Optional.of(Integer.parseInt(text)).filter(number -> number >= 0);
} catch (NumberFormatException notANumber) {
return Optional.empty();
}
}
private static BlockPattern patternOf(ResolvedDecorator decorator, int depth, PatternArea area) {
BlockState[] blocks = new BlockState[area.columns() * area.columns()];
for (int row = 0; row < area.columns(); row++) {
for (int column = 0; column < area.columns(); column++) {
blocks[row * area.columns() + column] = blockAt(decorator, area.blockX(column), area.blockZ(row), depth);
}
}
return BlockPattern.of(area.columns(), blocks);
}
// The top of a stack takes the top palette, as generation gives it, and the rest the palette.
private static BlockState blockAt(ResolvedDecorator decorator, int x, int z, int depth) {
if (!decorator.passesChanceGate(x, z) || depth >= heightAt(decorator, x, z)) {
return null;
}
return depth == 0 && decorator.isStacking() ? decorator.pickTopBlock(x, z) : decorator.pickBlock(x, z);
}
private static int heightAt(ResolvedDecorator decorator, int x, int z) {
return decorator.isStacking() && !decorator.isScaleStack() ? decorator.stackHeight(x, z) : ONE_BLOCK;
}
}
@@ -20,11 +20,13 @@ package art.arcane.iris.modules.terrain;
import art.arcane.iris.builtin.IrisSeedPurposes;
import art.arcane.iris.builtin.terrain.PaletteLayer;
import art.arcane.iris.builtin.tooling.SnippetUses;
import art.arcane.volmlib.util.math.RNG;
import com.volmit.block.BlockSpec;
import com.volmit.block.BlockState;
import com.volmit.config.FeatureSettings;
import com.volmit.resource.PackResources;
import com.volmit.resource.PackSnippet;
import com.volmit.resource.ResourceId;
import com.volmit.tooling.BlockPattern;
import com.volmit.tooling.PatternArea;
@@ -78,8 +80,14 @@ public final class BiomePalettes implements PatternView {
if (running.isEmpty()) {
return List.of();
}
SnippetUses snippetUses = new SnippetUses();
List<PatternEntry> entries = new ArrayList<>(biomeEntries(world, running.get().settings(), snippetUses));
entries.addAll(snippetUses.entries(world.resources().snippets(PaletteLayer.class), BiomePalettes::blocksOf));
return entries;
}
private static List<PatternEntry> biomeEntries(PackWorld world, FeatureSettings settings, SnippetUses snippetUses) {
BiomeLayers layers = BiomeLayers.of(world);
FeatureSettings settings = running.get().settings();
List<PackBiome> biomes = biomesByName(world.resources());
Map<String, Long> biomesByShownName = biomes.stream().collect(Collectors.groupingBy(PackBiome::name, Collectors.counting()));
List<PatternEntry> entries = new ArrayList<>();
@@ -89,7 +97,10 @@ public final class BiomePalettes implements PatternView {
for (Kind kind : Kind.values()) {
List<PaletteLayer> palettes = kind.palettesOf(layers, layered, settings, biome.id());
for (int index = 0; index < palettes.size(); index++) {
entries.add(entryOf(biome, layered, kind, index, palettes.get(index), group));
Optional<PackSnippet.Source> snippet = world.resources().snippetOf(palettes.get(index));
PatternEntry entry = entryOf(biome, layered, kind, index, palettes.get(index), group, snippet);
entries.add(entry);
snippet.ifPresent(source -> snippetUses.use(source, entry));
}
}
}
@@ -98,6 +109,52 @@ public final class BiomePalettes implements PatternView {
@Override
public Optional<BlockPattern> pattern(PackWorld world, String key, int depth, PatternArea area) {
if (SnippetUses.isSnippetKey(key)) {
return SnippetUses.sourceOf(key).flatMap(source -> snippetPattern(world, source, depth, area));
}
return biomePattern(world, key, depth, area);
}
// A snippet's palette is shown as the first biome that uses it places it; one nothing uses has no place in a
// biome's stack, so it is picked block by block, as a wall is.
private Optional<BlockPattern> snippetPattern(PackWorld world, PackSnippet.Source source, int depth, PatternArea area) {
Optional<RunningWorld> running = world.running();
if (running.isEmpty()) {
return Optional.empty();
}
SnippetUses snippetUses = new SnippetUses();
biomeEntries(world, running.get().settings(), snippetUses);
Optional<PatternEntry> firstUse = snippetUses.firstUseOf(source);
if (firstUse.isPresent()) {
return biomePattern(world, firstUse.get().key(), depth, area);
}
return world.resources().snippets(PaletteLayer.class).stream()
.filter(snippet -> snippet.path().equals(source.path()))
.findFirst()
.map(snippet -> unusedSnippetPattern(world, snippet, source.entry(), depth, area, running.get().layout().fluidHeight()));
}
// A file that could not be read is listed too, and places nothing.
private static BlockPattern unusedSnippetPattern(PackWorld world, PackSnippet<PaletteLayer> snippet, int entry, int depth, PatternArea area,
int fluidHeight) {
if (entry >= snippet.entries().size()) {
return patternOf(area, (x, z, atDepth) -> null, depth);
}
ResolvedLayer layer = BiomeLayers.of(world).resolve(snippet.entries().get(entry));
return patternOf(area, Kind.singleBlocks(layer, new RNG(world.seed(IrisSeedPurposes.TERRAIN)), fluidHeight), depth);
}
private static BlockPattern patternOf(PatternArea area, ColumnPick pick, int depth) {
BlockState[] blocks = new BlockState[area.columns() * area.columns()];
for (int row = 0; row < area.columns(); row++) {
for (int column = 0; column < area.columns(); column++) {
blocks[row * area.columns() + column] = pick.at(area.blockX(column), area.blockZ(row), depth);
}
}
return BlockPattern.of(area.columns(), blocks);
}
private Optional<BlockPattern> biomePattern(PackWorld world, String key, int depth, PatternArea area) {
Optional<RunningWorld> running = world.running();
Optional<PaletteRef> ref = PaletteRef.parse(key, world.resources());
if (running.isEmpty() || ref.isEmpty()) {
@@ -113,13 +170,7 @@ public final class BiomePalettes implements PatternView {
}
ColumnPick pick = palette.kind().picker(world, layers, biome, palettes.get(palette.index()), palette.index(),
running.get().layout().fluidHeight());
BlockState[] blocks = new BlockState[area.columns() * area.columns()];
for (int row = 0; row < area.columns(); row++) {
for (int column = 0; column < area.columns(); column++) {
blocks[row * area.columns() + column] = pick.at(area.blockX(column), area.blockZ(row), depth);
}
}
return Optional.of(BlockPattern.of(area.columns(), blocks));
return Optional.of(patternOf(area, pick, depth));
}
private static List<PackBiome> biomesByName(PackResources resources) {
@@ -130,11 +181,13 @@ public final class BiomePalettes implements PatternView {
.toList();
}
private static PatternEntry entryOf(PackBiome biome, LayeredBiome layered, Kind kind, int index, PaletteLayer palette, String group) {
private static PatternEntry entryOf(PackBiome biome, LayeredBiome layered, Kind kind, int index, PaletteLayer palette, String group,
Optional<PackSnippet.Source> snippet) {
String key = biome.id() + String.valueOf(KIND_SEPARATOR) + kind.keyName + INDEX_SEPARATOR + index;
String name = kind.numbered ? kind.label + " " + (index + 1) : kind.label;
return new PatternEntry(key, name, Optional.of(group).filter(shown -> !shown.isBlank()), kind.depthsOf(palette),
kind.factsOf(palette, layered));
List<String> facts = kind.factsOf(palette, layered);
snippet.map(SnippetUses::factOf).ifPresent(facts::add);
return new PatternEntry(key, name, Optional.of(group).filter(shown -> !shown.isBlank()), kind.depthsOf(palette), facts);
}
private static String blocksOf(PaletteLayer palette) {
@@ -246,7 +299,7 @@ public final class BiomePalettes implements PatternView {
};
}
private static ColumnPick singleBlocks(ResolvedLayer layer, RNG random, int height) {
static ColumnPick singleBlocks(ResolvedLayer layer, RNG random, int height) {
return (x, z, depth) -> depth == 0 ? layer.get(random, SINGLE_BLOCK_SIGNATURE, x, height, z) : null;
}
}