- update n2d package

- smarter snow placement
- tweaks to default settings
This commit is contained in:
dags- 2020-06-13 18:17:31 +01:00
parent 38dc1c9261
commit d6df3dd168
18 changed files with 52 additions and 32 deletions

2
Engine

@ -1 +1 @@
Subproject commit 86578fa35c0c296487d1aac675b55d4eb994cde7
Subproject commit 148a59d8ec0f555e61b6e13526aedd3bc193d427

View File

@ -27,9 +27,9 @@ package com.terraforged.api.biome.modifier;
import com.terraforged.core.Seed;
import com.terraforged.core.cell.Cell;
import com.terraforged.world.climate.Climate;
import com.terraforged.n2d.Module;
import com.terraforged.n2d.Source;
import com.terraforged.world.climate.Climate;
import net.minecraft.world.biome.Biome;
public abstract class AbstractMaxHeightModifier extends AbstractOffsetModifier {

View File

@ -8,10 +8,10 @@ import com.terraforged.biome.map.set.BiomeTypeSet;
import com.terraforged.biome.map.set.RiverSet;
import com.terraforged.biome.map.set.TemperatureSet;
import com.terraforged.core.cell.Cell;
import com.terraforged.n2d.util.NoiseUtil;
import com.terraforged.world.biome.BiomeType;
import com.terraforged.world.heightmap.Levels;
import com.terraforged.world.terrain.TerrainType;
import com.terraforged.n2d.util.NoiseUtil;
import net.minecraft.world.biome.Biome;
import java.util.Arrays;

View File

@ -4,8 +4,8 @@ import com.google.gson.JsonElement;
import com.terraforged.biome.map.defaults.DefaultBiome;
import com.terraforged.biome.provider.BiomeHelper;
import com.terraforged.core.cell.Cell;
import com.terraforged.util.ListUtils;
import com.terraforged.n2d.util.NoiseUtil;
import com.terraforged.util.ListUtils;
import net.minecraft.world.biome.Biome;
import java.util.Collections;

View File

@ -27,9 +27,9 @@ package com.terraforged.biome.modifier;
import com.terraforged.core.Seed;
import com.terraforged.core.cell.Cell;
import com.terraforged.world.climate.Climate;
import com.terraforged.n2d.Module;
import com.terraforged.n2d.Source;
import com.terraforged.world.climate.Climate;
import net.minecraft.world.biome.Biome;
public abstract class AbstractMaxHeightModifier extends AbstractOffsetModifier {

View File

@ -3,11 +3,11 @@ package com.terraforged.biome.modifier;
import com.terraforged.api.biome.modifier.BiomeModifier;
import com.terraforged.biome.map.BiomeMap;
import com.terraforged.core.cell.Cell;
import com.terraforged.n2d.Module;
import com.terraforged.n2d.Source;
import com.terraforged.world.GeneratorContext;
import com.terraforged.world.biome.BiomeType;
import com.terraforged.world.terrain.Terrains;
import com.terraforged.n2d.Module;
import com.terraforged.n2d.Source;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;

View File

@ -29,9 +29,9 @@ import com.terraforged.biome.ModBiomes;
import com.terraforged.biome.map.BiomeMap;
import com.terraforged.biome.map.BiomeMapBuilder;
import com.terraforged.biome.map.BiomePredicate;
import com.terraforged.n2d.util.Vec2f;
import com.terraforged.world.biome.BiomeData;
import com.terraforged.world.biome.BiomeType;
import com.terraforged.n2d.util.Vec2f;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;

View File

@ -4,10 +4,10 @@ import com.terraforged.api.chunk.surface.Surface;
import com.terraforged.api.chunk.surface.SurfaceContext;
import com.terraforged.core.Seed;
import com.terraforged.core.util.Variance;
import com.terraforged.world.geology.Strata;
import com.terraforged.n2d.Module;
import com.terraforged.n2d.Source;
import com.terraforged.n2d.util.NoiseUtil;
import com.terraforged.world.geology.Strata;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;

View File

@ -32,12 +32,12 @@ import com.terraforged.biome.provider.BiomeProvider;
import com.terraforged.biome.provider.DesertBiomes;
import com.terraforged.chunk.TerraContext;
import com.terraforged.core.cell.Cell;
import com.terraforged.world.heightmap.Levels;
import com.terraforged.world.terrain.Terrains;
import com.terraforged.n2d.Module;
import com.terraforged.n2d.Source;
import com.terraforged.n2d.func.CellFunc;
import com.terraforged.n2d.util.NoiseUtil;
import com.terraforged.world.heightmap.Levels;
import com.terraforged.world.terrain.Terrains;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;

View File

@ -3,9 +3,9 @@ package com.terraforged.biome.surface;
import com.terraforged.api.chunk.surface.Surface;
import com.terraforged.api.chunk.surface.SurfaceContext;
import com.terraforged.api.material.state.States;
import com.terraforged.world.GeneratorContext;
import com.terraforged.n2d.Module;
import com.terraforged.n2d.Source;
import com.terraforged.world.GeneratorContext;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.world.gen.Heightmap;

View File

@ -30,10 +30,10 @@ import com.terraforged.api.chunk.surface.SurfaceContext;
import com.terraforged.api.material.state.States;
import com.terraforged.chunk.TerraContext;
import com.terraforged.core.cell.Cell;
import com.terraforged.world.heightmap.Levels;
import com.terraforged.n2d.Module;
import com.terraforged.n2d.Source;
import com.terraforged.n2d.util.NoiseUtil;
import com.terraforged.world.heightmap.Levels;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;

View File

@ -26,11 +26,11 @@
package com.terraforged.feature;
import com.google.common.collect.ImmutableSet;
import com.terraforged.n2d.util.NoiseUtil;
import it.unimi.dsi.fastutil.longs.LongIterator;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectList;
import it.unimi.dsi.fastutil.objects.ObjectListIterator;
import com.terraforged.n2d.util.NoiseUtil;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;

View File

@ -3,6 +3,7 @@ package com.terraforged.feature.feature;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.SnowyDirtBlock;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
@ -39,12 +40,12 @@ public class FreezeLayer extends Feature<NoFeatureConfig> {
pos2.setPos(pos1).move(Direction.DOWN, 1);
Biome biome = world.getBiome(pos1);
boolean freezesHere = freeze(world, biome, pos1, pos2, false);
boolean freezesHere = freeze(world, biome, pos1, pos2, false, false);
if (y1 != y2) {
pos1.setPos(x, y2, z);
pos2.setPos(pos1).move(Direction.DOWN, 1);
freeze(world, biome, pos1, pos2, freezesHere);
freeze(world, biome, pos1, pos2, freezesHere, true);
}
}
}
@ -52,7 +53,7 @@ public class FreezeLayer extends Feature<NoFeatureConfig> {
return true;
}
private boolean freeze(IWorld world, Biome biome, BlockPos.Mutable top, BlockPos below, boolean force) {
private boolean freeze(IWorld world, Biome biome, BlockPos.Mutable top, BlockPos below, boolean force, boolean ground) {
boolean hasFrozen = false;
if (biome.doesWaterFreeze(world, below, false)) {
world.setBlockState(below, Blocks.ICE.getDefaultState(), 2);
@ -61,20 +62,39 @@ public class FreezeLayer extends Feature<NoFeatureConfig> {
if (force || biome.doesSnowGenerate(world, top)) {
hasFrozen = true;
world.setBlockState(top, Blocks.SNOW.getDefaultState(), 2);
// mark block below as snowy if supported
BlockState stateUnder = world.getBlockState(below);
if (stateUnder.has(SnowyDirtBlock.SNOWY)) {
world.setBlockState(below, stateUnder.with(SnowyDirtBlock.SNOWY, true), 2);
if (stateUnder.getBlock() == Blocks.AIR) {
return false;
}
// remove floating blocks above
top.move(Direction.UP, 1);
if (!world.isAirBlock(top)) {
world.setBlockState(top, Blocks.AIR.getDefaultState(), 2);
if (ground) {
if (BlockTags.LOGS.contains(stateUnder.getBlock())) {
return false;
}
BlockState above = world.getBlockState(top.up());
if (BlockTags.LOGS.contains(above.getBlock()) || BlockTags.LEAVES.contains(above.getBlock())) {
return false;
}
setSnow(world, top, below, stateUnder);
if (above.getBlock() != Blocks.AIR) {
world.setBlockState(top, Blocks.AIR.getDefaultState(), 2);
}
} else {
setSnow(world, top, below, stateUnder);
}
}
return hasFrozen;
}
private void setSnow(IWorld world, BlockPos pos1, BlockPos pos2, BlockState below) {
world.setBlockState(pos1, Blocks.SNOW.getDefaultState(), 2);
if (below.has(SnowyDirtBlock.SNOWY)) {
world.setBlockState(pos2, below.with(SnowyDirtBlock.SNOWY, true), 2);
}
}
}

View File

@ -34,12 +34,12 @@ import com.terraforged.core.region.Region;
import com.terraforged.core.region.Size;
import com.terraforged.core.region.gen.RegionGenerator;
import com.terraforged.core.settings.Settings;
import com.terraforged.n2d.util.NoiseUtil;
import com.terraforged.util.nbt.NBTHelper;
import com.terraforged.world.GeneratorContext;
import com.terraforged.world.continent.MutableVeci;
import com.terraforged.world.heightmap.Levels;
import com.terraforged.world.terrain.Terrains;
import com.terraforged.n2d.util.NoiseUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.FontRenderer;

View File

@ -26,8 +26,8 @@
package com.terraforged.gui.preview;
import com.terraforged.core.cell.Cell;
import com.terraforged.world.heightmap.Levels;
import com.terraforged.n2d.util.NoiseUtil;
import com.terraforged.world.heightmap.Levels;
import java.awt.*;

View File

@ -28,8 +28,8 @@ package com.terraforged.material.geology;
import com.terraforged.api.material.geology.StrataConfig;
import com.terraforged.api.material.geology.StrataGenerator;
import com.terraforged.material.Materials;
import com.terraforged.world.geology.Strata;
import com.terraforged.n2d.Source;
import com.terraforged.world.geology.Strata;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;

View File

@ -30,10 +30,10 @@ import com.terraforged.api.material.geology.StrataConfig;
import com.terraforged.chunk.TerraContext;
import com.terraforged.core.Seed;
import com.terraforged.material.Materials;
import com.terraforged.world.geology.Geology;
import com.terraforged.world.geology.Strata;
import com.terraforged.n2d.Module;
import com.terraforged.n2d.Source;
import com.terraforged.world.geology.Geology;
import com.terraforged.world.geology.Strata;
import net.minecraft.block.BlockState;
import net.minecraft.world.biome.Biome;

View File

@ -28,9 +28,9 @@ package com.terraforged.util.setup;
import com.terraforged.Log;
import com.terraforged.api.event.SetupEvent;
import com.terraforged.core.Seed;
import com.terraforged.world.geology.Strata;
import com.terraforged.n2d.Source;
import com.terraforged.n2d.source.Builder;
import com.terraforged.world.geology.Strata;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.world.biome.Biomes;