implementation compiles now

This commit is contained in:
dfsek
2021-07-04 19:59:46 -07:00
parent e9dc7d3db6
commit 54f4722297
26 changed files with 47 additions and 303 deletions

View File

@@ -1,13 +1,13 @@
package com.dfsek.terra.api.util;
import com.dfsek.terra.api.world.biome.Generator;
import com.dfsek.terra.api.world.generator.Palette;
import com.dfsek.terra.api.world.generator.Sampler;
import com.dfsek.terra.api.world.palette.slant.SlantHolder;
import com.dfsek.terra.config.templates.BiomeTemplate;
public final class PaletteUtil {
public static Palette getPalette(int x, int y, int z, BiomeTemplate c, Sampler sampler) {
public static Palette getPalette(int x, int y, int z, Generator c, Sampler sampler) {
/*
SlantHolder slant = c.getSlant();
if(slant != null) {
double slope = MathUtil.derivative(sampler, x, y, z);
@@ -16,6 +16,8 @@ public final class PaletteUtil {
}
}
return c.getPalette().getPalette(y);
*/
return c.getPaletteSettings().getPalette(y);
}
}

View File

@@ -2,9 +2,7 @@ package com.dfsek.terra.commands;
import com.dfsek.terra.api.command.CommandManager;
import com.dfsek.terra.api.command.exception.MalformedCommandException;
import com.dfsek.terra.commands.biome.BiomeCommand;
import com.dfsek.terra.commands.profiler.ProfileCommand;
import com.dfsek.terra.addons.structure.command.structure.StructureCommand;
public final class CommandUtil {
public static void registerAll(CommandManager manager) throws MalformedCommandException {
@@ -14,6 +12,6 @@ public final class CommandUtil {
manager.register("version", VersionCommand.class);
manager.register("getblock", GetBlockCommand.class);
manager.register("packs", PacksCommand.class);
manager.register("biome", BiomeCommand.class);
}
}

View File

@@ -1,45 +0,0 @@
package com.dfsek.terra.commands.biome;
import com.dfsek.terra.api.TerraPlugin;
import com.dfsek.terra.api.command.CommandTemplate;
import com.dfsek.terra.api.command.annotation.Command;
import com.dfsek.terra.api.command.annotation.Subcommand;
import com.dfsek.terra.api.command.annotation.type.PlayerCommand;
import com.dfsek.terra.api.command.annotation.type.WorldCommand;
import com.dfsek.terra.api.entity.CommandSender;
import com.dfsek.terra.api.entity.Player;
import com.dfsek.terra.api.injection.annotations.Inject;
import com.dfsek.terra.api.world.biome.UserDefinedBiome;
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
import com.dfsek.terra.config.lang.LangUtil;
@Command(
subcommands = {
@Subcommand(
value = "info",
aliases = {"i"},
clazz = BiomeInfoCommand.class
),
@Subcommand(
value = "locate",
aliases = {"l"},
clazz = BiomeLocateCommand.class
)
},
usage = "/terra biome"
)
@WorldCommand
@PlayerCommand
public class BiomeCommand implements CommandTemplate {
@Inject
private TerraPlugin main;
@Override
public void execute(CommandSender sender) {
Player player = (Player) sender;
BiomeProvider provider = main.getWorld(player.world()).getBiomeProvider();
UserDefinedBiome biome = (UserDefinedBiome) provider.getBiome(player.position());
LangUtil.send("command.biome.in", sender, biome.getID());
}
}

View File

@@ -1,58 +0,0 @@
package com.dfsek.terra.commands.biome;
import com.dfsek.terra.api.command.CommandTemplate;
import com.dfsek.terra.api.command.annotation.Argument;
import com.dfsek.terra.api.command.annotation.Command;
import com.dfsek.terra.api.command.annotation.inject.ArgumentTarget;
import com.dfsek.terra.api.entity.CommandSender;
import com.dfsek.terra.api.structure.ConfiguredStructure;
import com.dfsek.terra.api.world.biome.TerraBiome;
import com.dfsek.terra.api.world.biome.UserDefinedBiome;
import com.dfsek.terra.commands.biome.arg.BiomeArgumentParser;
import com.dfsek.terra.commands.biome.tab.BiomeTabCompleter;
import com.dfsek.terra.config.templates.BiomeTemplate;
import com.dfsek.terra.world.population.items.TerraStructure;
import java.util.List;
@Command(
arguments = {
@Argument(
value = "biome",
tabCompleter = BiomeTabCompleter.class,
argumentParser = BiomeArgumentParser.class
)
}
)
public class BiomeInfoCommand implements CommandTemplate {
@ArgumentTarget("biome")
private TerraBiome biome;
@Override
public void execute(CommandSender sender) {
sender.sendMessage("Biome info for \"" + biome.getID() + "\".");
sender.sendMessage("Vanilla biome: " + biome.getVanillaBiomes());
if(biome instanceof UserDefinedBiome) {
BiomeTemplate bio = ((UserDefinedBiome) biome).getConfig();
if(bio.getExtended().size() == 0) {
sender.sendMessage("No Parent Biomes");
} else {
sender.sendMessage("------Parent Biomes-----");
bio.getExtended().forEach(id -> sender.sendMessage(" - " + id));
}
List<ConfiguredStructure> structureConfigs = bio.getStructures();
if(structureConfigs.size() == 0) {
sender.sendMessage("No Structures");
} else {
sender.sendMessage("-------Structures-------");
for(TerraStructure c : structureConfigs) {
sender.sendMessage(" - " + c.getTemplate().getID());
}
}
}
}
}

View File

@@ -1,77 +0,0 @@
package com.dfsek.terra.commands.biome;
import com.dfsek.terra.api.TerraPlugin;
import com.dfsek.terra.api.command.CommandTemplate;
import com.dfsek.terra.api.command.annotation.Argument;
import com.dfsek.terra.api.command.annotation.Command;
import com.dfsek.terra.api.command.annotation.Switch;
import com.dfsek.terra.api.command.annotation.inject.ArgumentTarget;
import com.dfsek.terra.api.command.annotation.inject.SwitchTarget;
import com.dfsek.terra.api.command.annotation.type.PlayerCommand;
import com.dfsek.terra.api.command.annotation.type.WorldCommand;
import com.dfsek.terra.api.command.arg.IntegerArgumentParser;
import com.dfsek.terra.api.entity.CommandSender;
import com.dfsek.terra.api.entity.Player;
import com.dfsek.terra.api.injection.annotations.Inject;
import com.dfsek.terra.api.vector.Vector3;
import com.dfsek.terra.api.world.biome.TerraBiome;
import com.dfsek.terra.api.world.locate.AsyncBiomeFinder;
import com.dfsek.terra.commands.biome.arg.BiomeArgumentParser;
import com.dfsek.terra.commands.biome.tab.BiomeTabCompleter;
import com.dfsek.terra.config.lang.LangUtil;
import java.util.Locale;
@PlayerCommand
@WorldCommand
@Command(
arguments = {
@Argument(
value = "biome",
tabCompleter = BiomeTabCompleter.class,
argumentParser = BiomeArgumentParser.class
),
@Argument(
value = "radius",
required = false,
defaultValue = "1000",
argumentParser = IntegerArgumentParser.class
)
},
switches = {
@Switch(
value = "teleport",
aliases = {"t", "tp"}
)
}
)
public class BiomeLocateCommand implements CommandTemplate {
@ArgumentTarget("radius")
private Integer radius;
@ArgumentTarget("biome")
private TerraBiome biome;
@SwitchTarget("teleport")
private boolean teleport;
@Inject
private TerraPlugin main;
@Override
public void execute(CommandSender sender) {
Player player = (Player) sender;
new Thread(new AsyncBiomeFinder(main.getWorld(player.world()).getBiomeProvider(), biome, player.position().clone().multiply((1D / main.getTerraConfig().getBiomeSearchResolution())), player.world(), 0, radius, location -> {
if(location != null) {
sender.sendMessage(String.format("The nearest %s is at [%d, ~, %d] (%.1f blocks away)", biome.getID().toLowerCase(Locale.ROOT), location.getBlockX(), location.getBlockZ(), location.add(new Vector3(0, player.position().getY(), 0)).distance(player.position())));
if(teleport) {
main.runPossiblyUnsafeTask(() -> player.position(new Vector3(location.getX(), player.position().getY(), location.getZ())));
}
} else LangUtil.send("command.biome.unable-to-locate", sender);
}, main), "Biome Location Thread").start();
}
}

View File

@@ -1,19 +0,0 @@
package com.dfsek.terra.commands.biome.arg;
import com.dfsek.terra.api.TerraPlugin;
import com.dfsek.terra.api.command.arg.ArgumentParser;
import com.dfsek.terra.api.entity.CommandSender;
import com.dfsek.terra.api.entity.Player;
import com.dfsek.terra.api.injection.annotations.Inject;
import com.dfsek.terra.api.world.biome.TerraBiome;
public class BiomeArgumentParser implements ArgumentParser<TerraBiome> {
@Inject
private TerraPlugin main;
@Override
public TerraBiome parse(CommandSender sender, String arg) {
Player player = (Player) sender;
return main.getWorld(player.world()).getConfig().getRegistry(TerraBiome.class).get(arg);
}
}

View File

@@ -1,22 +0,0 @@
package com.dfsek.terra.commands.biome.tab;
import com.dfsek.terra.api.TerraPlugin;
import com.dfsek.terra.api.command.tab.TabCompleter;
import com.dfsek.terra.api.entity.CommandSender;
import com.dfsek.terra.api.entity.Player;
import com.dfsek.terra.api.injection.annotations.Inject;
import com.dfsek.terra.api.world.biome.TerraBiome;
import java.util.List;
import java.util.stream.Collectors;
public class BiomeTabCompleter implements TabCompleter {
@Inject
private TerraPlugin main;
@Override
public List<String> complete(CommandSender sender) {
Player player = (Player) sender;
return main.getWorld(player.world()).getConfig().getRegistry(TerraBiome.class).entries().stream().map(TerraBiome::getID).collect(Collectors.toList());
}
}

View File

@@ -8,18 +8,11 @@ import com.dfsek.terra.api.tectonic.LoaderRegistrar;
import com.dfsek.terra.api.util.ProbabilityCollection;
import com.dfsek.terra.api.util.Range;
import com.dfsek.terra.api.util.collections.MaterialSet;
import com.dfsek.terra.api.util.seeded.SourceSeeded;
import com.dfsek.terra.api.util.seeded.StageSeeded;
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
import com.dfsek.terra.api.world.biome.generation.pipeline.BiomeSource;
import com.dfsek.terra.config.loaders.LinkedHashMapLoader;
import com.dfsek.terra.config.loaders.MaterialSetLoader;
import com.dfsek.terra.config.loaders.ProbabilityCollectionLoader;
import com.dfsek.terra.config.loaders.RangeLoader;
import com.dfsek.terra.config.loaders.config.biome.BiomeProviderBuilderLoader;
import com.dfsek.terra.config.loaders.config.biome.SourceBuilderLoader;
import com.dfsek.terra.config.loaders.config.biome.StageBuilderLoader;
import com.dfsek.terra.config.loaders.config.biome.templates.source.NoiseSourceTemplate;
import java.util.LinkedHashMap;
@@ -35,12 +28,7 @@ public class GenericLoaders implements LoaderRegistrar {
registry.registerLoader(ProbabilityCollection.class, new ProbabilityCollectionLoader())
.registerLoader(Range.class, new RangeLoader())
.registerLoader(MaterialSet.class, new MaterialSetLoader())
.registerLoader(NoiseSourceTemplate.class, NoiseSourceTemplate::new)
.registerLoader(LinkedHashMap.class, new LinkedHashMapLoader())
.registerLoader(SourceSeeded.class, new SourceBuilderLoader())
.registerLoader(StageSeeded.class, new StageBuilderLoader())
.registerLoader(BiomeProvider.BiomeProviderBuilder.class, new BiomeProviderBuilderLoader())
.registerLoader(BiomeProvider.Type.class, (t, object, cf) -> BiomeProvider.Type.valueOf((String) object))
.registerLoader(BiomeSource.Type.class, (t, object, cf) -> BiomeSource.Type.valueOf((String) object));
if(main != null) {

View File

@@ -1,21 +0,0 @@
package com.dfsek.terra.config.loaders.config;
import com.dfsek.tectonic.loading.ConfigLoader;
import com.dfsek.tectonic.loading.TypeLoader;
import com.dfsek.terra.api.math.range.ConstantRange;
import com.dfsek.terra.api.util.Range;
import com.dfsek.terra.addons.ore.ores.OreConfig;
import java.lang.reflect.Type;
import java.util.Map;
@SuppressWarnings("unchecked")
public class OreConfigLoader implements TypeLoader<OreConfig> {
@Override
public OreConfig load(Type type, Object o, ConfigLoader configLoader) {
Map<String, Integer> map = (Map<String, Integer>) o;
Range amount = new ConstantRange(map.get("min"), map.get("max"));
Range height = new ConstantRange(map.get("min-height"), map.get("max-height"));
return new OreConfig(amount, height);
}
}

View File

@@ -1,26 +0,0 @@
package com.dfsek.terra.config.loaders.config;
import com.dfsek.tectonic.exception.LoadException;
import com.dfsek.tectonic.loading.ConfigLoader;
import com.dfsek.tectonic.loading.TypeLoader;
import com.dfsek.terra.addons.ore.ores.Ore;
import com.dfsek.terra.addons.ore.ores.OreConfig;
import com.dfsek.terra.addons.ore.ores.OreHolder;
import java.lang.reflect.Type;
import java.util.Map;
@SuppressWarnings("unchecked")
public class OreHolderLoader implements TypeLoader<OreHolder> {
@Override
public OreHolder load(Type type, Object o, ConfigLoader configLoader) throws LoadException {
OreHolder holder = new OreHolder();
Map<String, Object> map = (Map<String, Object>) o;
for(Map.Entry<String, Object> entry : map.entrySet()) {
holder.add(configLoader.loadClass(Ore.class, entry.getKey()), configLoader.loadClass(OreConfig.class, entry.getValue()), entry.getKey());
}
return holder;
}
}

View File

@@ -1,34 +0,0 @@
package com.dfsek.terra.config.loaders.config;
import com.dfsek.tectonic.exception.LoadException;
import com.dfsek.tectonic.loading.ConfigLoader;
import com.dfsek.tectonic.loading.TypeLoader;
import com.dfsek.terra.api.util.ProbabilityCollection;
import com.dfsek.terra.api.util.Range;
import com.dfsek.terra.api.util.seeded.NoiseSeeded;
import com.dfsek.terra.api.world.Tree;
import com.dfsek.terra.config.loaders.Types;
import com.dfsek.terra.noise.samplers.noise.random.WhiteNoiseSampler;
import com.dfsek.terra.addons.tree.tree.TreeLayer;
import java.lang.reflect.Type;
import java.util.Map;
@SuppressWarnings("unchecked")
public class TreeLayerLoader implements TypeLoader<TreeLayer> {
@Override
public TreeLayer load(Type type, Object o, ConfigLoader configLoader) throws LoadException {
Map<String, Object> map = (Map<String, Object>) o;
double density = ((Number) map.get("density")).doubleValue();
Range range = configLoader.loadClass(Range.class, map.get("y"));
if(range == null) throw new LoadException("Tree range unspecified");
ProbabilityCollection<Tree> items = (ProbabilityCollection<Tree>) configLoader.loadType(Types.TREE_PROBABILITY_COLLECTION_TYPE, map.get("items"));
if(map.containsKey("distribution")) {
NoiseSeeded noise = configLoader.loadClass(NoiseSeeded.class, map.get("distribution"));
return new TreeLayer(density, range, items, noise.apply(2403L));
}
return new TreeLayer(density, range, items, new WhiteNoiseSampler(2403));
}
}

View File

@@ -1,35 +0,0 @@
package com.dfsek.terra.config.loaders.config.biome;
import com.dfsek.tectonic.exception.LoadException;
import com.dfsek.tectonic.loading.ConfigLoader;
import com.dfsek.tectonic.loading.TypeLoader;
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
import com.dfsek.terra.config.loaders.config.biome.templates.provider.BiomePipelineTemplate;
import com.dfsek.terra.config.loaders.config.biome.templates.provider.ImageProviderTemplate;
import com.dfsek.terra.config.loaders.config.biome.templates.provider.SingleBiomeProviderTemplate;
import java.lang.reflect.Type;
import java.util.Map;
@SuppressWarnings("unchecked")
public class BiomeProviderBuilderLoader implements TypeLoader<BiomeProvider.BiomeProviderBuilder> {
public BiomeProviderBuilderLoader() {
}
@Override
public BiomeProvider.BiomeProviderBuilder load(Type t, Object c, ConfigLoader loader) throws LoadException { // TODO: clean this up
Map<String, Object> map = (Map<String, Object>) c;
switch(loader.loadClass(BiomeProvider.Type.class, map.get("type"))) {
case IMAGE:
return loader.loadClass(ImageProviderTemplate.class, map);
case PIPELINE:
return loader.loadClass(BiomePipelineTemplate.class, map);
case SINGLE:
return loader.loadClass(SingleBiomeProviderTemplate.class, map);
}
throw new LoadException("No such biome provider type: " + map.get("type"));
}
}

View File

@@ -1,26 +0,0 @@
package com.dfsek.terra.config.loaders.config.biome;
import com.dfsek.tectonic.exception.LoadException;
import com.dfsek.tectonic.loading.ConfigLoader;
import com.dfsek.tectonic.loading.TypeLoader;
import com.dfsek.terra.api.util.seeded.SourceSeeded;
import com.dfsek.terra.api.world.biome.generation.pipeline.BiomeSource;
import com.dfsek.terra.config.loaders.config.biome.templates.source.NoiseSourceTemplate;
import java.lang.reflect.Type;
import java.util.Map;
@SuppressWarnings("unchecked")
public class SourceBuilderLoader implements TypeLoader<SourceSeeded> {
@Override
public SourceSeeded load(Type t, Object c, ConfigLoader loader) throws LoadException {
Map<String, Object> source = (Map<String, Object>) c;
BiomeSource.Type type = loader.loadClass(BiomeSource.Type.class, source.get("type"));
if(type == BiomeSource.Type.NOISE) {
return loader.loadClass(NoiseSourceTemplate.class, source);
}
throw new LoadException("No such loader type: " + type);
}
}

View File

@@ -3,10 +3,8 @@ package com.dfsek.terra.config.loaders.config.biome.templates.provider;
import com.dfsek.tectonic.annotations.Default;
import com.dfsek.tectonic.annotations.Value;
import com.dfsek.tectonic.loading.object.ObjectTemplate;
import com.dfsek.terra.api.noise.NoiseSampler;
import com.dfsek.terra.api.util.seeded.NoiseSeeded;
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
import com.dfsek.terra.noise.samplers.noise.ConstantSampler;
public abstract class BiomeProviderTemplate implements ObjectTemplate<BiomeProvider.BiomeProviderBuilder>, BiomeProvider.BiomeProviderBuilder {
@Value("resolution")

View File

@@ -1,21 +0,0 @@
package com.dfsek.terra.config.loaders.config.biome.templates.source;
import com.dfsek.tectonic.annotations.Value;
import com.dfsek.terra.api.util.ProbabilityCollection;
import com.dfsek.terra.api.util.seeded.NoiseSeeded;
import com.dfsek.terra.api.world.biome.generation.pipeline.BiomeSource;
import com.dfsek.terra.addons.biome.pipeline.source.RandomSource;
import com.dfsek.terra.api.util.seeded.BiomeBuilder;
public class NoiseSourceTemplate extends SourceTemplate {
@Value("noise")
private NoiseSeeded noise;
@Value("biomes")
private ProbabilityCollection<BiomeBuilder> biomes;
@Override
public BiomeSource apply(Long seed) {
return new RandomSource(biomes.map((biome) -> biome.apply(seed), false), noise.apply(seed));
}
}

View File

@@ -1,11 +0,0 @@
package com.dfsek.terra.config.loaders.config.biome.templates.source;
import com.dfsek.tectonic.loading.object.ObjectTemplate;
import com.dfsek.terra.api.util.seeded.SourceSeeded;
public abstract class SourceTemplate implements ObjectTemplate<SourceSeeded>, SourceSeeded {
@Override
public SourceSeeded get() {
return this;
}
}

View File

@@ -256,9 +256,10 @@ public class ConfigPackImpl implements ConfigPack {
return (CheckedRegistry<T>) registryMap.getOrDefault(clazz, ImmutablePair.ofNull()).getRight();
}
@SuppressWarnings("unchecked")
@Override
public <T> CheckedRegistry<T> getCheckedRegistry(Class<T> clazz) throws IllegalStateException {
return null;
return (CheckedRegistry<T>) registryMap.getOrDefault(clazz, ImmutablePair.ofNull()).getRight();
}
@SuppressWarnings("unchecked")
@@ -273,6 +274,7 @@ public class ConfigPackImpl implements ConfigPack {
registry
.registerLoader(ConfigType.class, configTypeRegistry)
.registerLoader(BufferedImage.class, new BufferedImageLoader(loader));
registryMap.forEach((clazz, reg) -> registry.registerLoader(clazz, reg.getLeft()));
loaders.forEach(registry::registerLoader);
objectLoaders.forEach((t, l) -> registry.registerLoader(t, (TemplateProvider<ObjectTemplate<Object>>) ((Object) l)));
}

View File

@@ -27,8 +27,8 @@ public class TerraWorldImpl implements TerraWorld {
this.world = w;
config = (WorldConfigImpl) c.toWorldConfig(this);
this.provider = config.getProvider();
air = main.getWorldHandle().createBlockData("minecraft:air");
main.getEventManager().callEvent(new TerraWorldLoadEvent(this, c));
this.air = main.getWorldHandle().air();
safe = true;
}
@@ -58,7 +58,7 @@ public class TerraWorldImpl implements TerraWorld {
@Override
public BlockState getUngeneratedBlock(int x, int y, int z) {
TerraBiome biome = provider.getBiome(x, z);
Palette palette = biome.getGenerator(world).getPalette(y);
Palette palette = biome.getGenerator(world).getPaletteSettings().getPalette(y);
Sampler sampler = config.getSamplerCache().get(x, z);
int fdX = FastMath.floorMod(x, 16);
int fdZ = FastMath.floorMod(z, 16);
@@ -70,9 +70,9 @@ public class TerraWorldImpl implements TerraWorld {
else level = 0;
}
return palette.get(level, x, y, z);
} else if(y <= biome.getConfig().getSeaLevel()) {
} /* else if(y <= biome.getConfig().getSeaLevel()) {
return biome.getConfig().getOceanPalette().get(biome.getConfig().getSeaLevel() - y, x, y, z);
} else return air;
} */else return air;
}
@Override

View File

@@ -14,16 +14,14 @@ import com.dfsek.terra.api.vector.Vector3;
import com.dfsek.terra.api.world.BiomeGrid;
import com.dfsek.terra.api.world.TerraWorld;
import com.dfsek.terra.api.world.World;
import com.dfsek.terra.api.world.biome.Generator;
import com.dfsek.terra.api.world.biome.TerraBiome;
import com.dfsek.terra.api.world.biome.UserDefinedBiome;
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
import com.dfsek.terra.api.world.generator.ChunkData;
import com.dfsek.terra.api.world.generator.Palette;
import com.dfsek.terra.api.world.generator.Sampler;
import com.dfsek.terra.api.world.generator.TerraBlockPopulator;
import com.dfsek.terra.api.world.generator.TerraChunkGenerator;
import com.dfsek.terra.api.world.palette.PaletteImpl;
import com.dfsek.terra.config.templates.BiomeTemplate;
import com.dfsek.terra.world.Carver;
import com.dfsek.terra.world.carving.NoiseCarver;
import com.dfsek.terra.world.generation.math.samplers.Sampler3D;
@@ -37,7 +35,6 @@ import java.util.Random;
public class DefaultChunkGenerator3D implements TerraChunkGenerator {
private final ConfigPack configPack;
private final TerraPlugin main;
private final PaletteImpl.Singleton blank;
private final List<TerraBlockPopulator> blockPopulators = new ArrayList<>();
private final Carver carver;
@@ -47,7 +44,6 @@ public class DefaultChunkGenerator3D implements TerraChunkGenerator {
this.main = main;
carver = new NoiseCarver(new ConstantRange(0, 255), main.getWorldHandle().createBlockData("minecraft:air"), main);
blank = new PaletteImpl.Singleton(main.getWorldHandle().createBlockData("minecraft:air"));
}
@Override
@@ -81,26 +77,26 @@ public class DefaultChunkGenerator3D implements TerraChunkGenerator {
int cz = zOrig + z;
TerraBiome b = grid.getBiome(cx, cz);
BiomeTemplate c = ((UserDefinedBiome) b).getConfig();
Generator g = b.getGenerator(world);
int sea = c.getSeaLevel();
Palette seaPalette = c.getOceanPalette();
//int sea = c.getSeaLevel();
//Palette seaPalette = c.getOceanPalette();
boolean justSet = false;
BlockState data = null;
for(int y = world.getMaxHeight() - 1; y >= world.getMinHeight(); y--) {
if(sampler.sample(x, y, z) > 0) {
justSet = true;
data = PaletteUtil.getPalette(x, y, z, c, sampler).get(paletteLevel, cx, y, cz);
data = PaletteUtil.getPalette(x, y, z, g, sampler).get(paletteLevel, cx, y, cz);
chunk.setBlock(x, y, z, data);
paletteLevel++;
} else if(y <= sea) {
} /*else if(y <= sea) {
chunk.setBlock(x, y, z, seaPalette.get(sea - y, x + xOrig, y, z + zOrig));
justSet = false;
paletteLevel = 0;
} else {
} */else {
justSet = false;
paletteLevel = 0;