restore slightly derpy steepness calculation... for now

This commit is contained in:
dags- 2020-03-09 21:22:19 +00:00
parent c344ddb137
commit 3982553360
5 changed files with 13 additions and 11 deletions

View File

@ -56,8 +56,8 @@ public class Steepness implements Filter, Filter.Visitor {
@Override @Override
public void visit(Filterable<?> cellMap, Cell cell, int cx, int cz) { public void visit(Filterable<?> cellMap, Cell cell, int cx, int cz) {
float totalHeightDif = 0F; float totalHeightDif = 0F;
for (int dz = -radius; dz <= radius; dz++) { for (int dz = -1; dz <= 2; dz++) {
for (int dx = -radius; dx <= radius; dx++) { for (int dx = -1; dx <= 2; dx++) {
if (dx == 0 && dz == 0) { if (dx == 0 && dz == 0) {
continue; continue;
} }

View File

@ -45,7 +45,7 @@ public class WorldFilters {
this.settings = context.settings.filters; this.settings = context.settings.filters;
this.erosion = new Erosion(context.settings, context.levels); this.erosion = new Erosion(context.settings, context.levels);
this.smoothing = new Smoothing(context.settings, context.levels); this.smoothing = new Smoothing(context.settings, context.levels);
this.steepness = new Steepness(2, 10F, context.terrain); this.steepness = new Steepness(1, 10F, context.terrain);
} }
public void apply(Region region) { public void apply(Region region) {

View File

@ -64,11 +64,15 @@ public class BiomeProvider extends AbstractBiomeProvider {
this.modifierManager = SetupHooks.setup(new BiomeModifierManager(context, biomeMap), context.copy()); this.modifierManager = SetupHooks.setup(new BiomeModifierManager(context, biomeMap), context.copy());
} }
public Cell<Terrain> lookupPos(int x, int z) {
return worldLookup.getCell(x, z);
}
@Override @Override
public Biome getNoiseBiome(int x, int y, int z) { public Biome getNoiseBiome(int x, int y, int z) {
x = (x << 2); x = (x << 2);
z = (z << 2); z = (z << 2);
return getBiome(worldLookup.getCell(x, z), x, z); return getBiome(lookupPos(x, z), x, z);
} }
@Override @Override

View File

@ -27,18 +27,18 @@ package com.terraforged.mod.chunk.test;
import com.terraforged.core.world.terrain.Terrain; import com.terraforged.core.world.terrain.Terrain;
import com.terraforged.core.world.terrain.Terrains; import com.terraforged.core.world.terrain.Terrains;
import com.terraforged.mod.biome.ModBiomes;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
public class Test { public class Test {
public static boolean fixedBiome = true; public static boolean fixedBiome = true;
public static Terrain getTerrainType(Terrains terrains) { public static Terrain getTerrainType(Terrains terrains) {
return terrains.dales; return terrains.mountains;
} }
public static Biome getBiome() { public static Biome getBiome() {
return Biomes.PLAINS; return ModBiomes.TAIGA_SCRUB;
} }
} }

View File

@ -108,16 +108,14 @@ public class TerraCommand {
} }
private static int query(CommandContext<CommandSource> context) throws CommandSyntaxException { private static int query(CommandContext<CommandSource> context) throws CommandSyntaxException {
TerraContext terraContext = getContext(context).orElseThrow(() -> createException( getContext(context).orElseThrow(() -> createException(
"Invalid world type", "Invalid world type",
"This command can only be run in a TerraForged world!" "This command can only be run in a TerraForged world!"
)); ));
BlockPos pos = context.getSource().asPlayer().getPosition(); BlockPos pos = context.getSource().asPlayer().getPosition();
WorldGenerator worldGenerator = terraContext.factory.get();
BiomeProvider biomeProvider = getBiomeProvider(context); BiomeProvider biomeProvider = getBiomeProvider(context);
Cell<Terrain> cell = new Cell<>(); Cell<Terrain> cell = biomeProvider.lookupPos(pos.getX(), pos.getZ());
worldGenerator.getHeightmap().apply(cell, pos.getX(), pos.getZ());
Biome biome = biomeProvider.getBiome(cell, pos.getX(), pos.getZ()); Biome biome = biomeProvider.getBiome(cell, pos.getX(), pos.getZ());
context.getSource().sendFeedback( context.getSource().sendFeedback(
new StringTextComponent("Terrain=" + cell.tag.getName() + ", Biome=" + biome.getRegistryName()), new StringTextComponent("Terrain=" + cell.tag.getName() + ", Biome=" + biome.getRegistryName()),