Skip to content
Permalink
Browse files

Replaced temperature. Lots of tweaks and fixes to tree generation; it…

… seems to be working mostly as intended. Also deleted the three GenLayers that are no longer used: EVT, Trees, and Rain. PH is currently unused, stability and drainage can probably be replaced with a similar system to rainfall.
  • Loading branch information...
alcatrazEscapee committed Aug 5, 2018
1 parent afe5c24 commit 105e82c194a16206906a557e6234a8454f828c96
Showing with 106 additions and 858 deletions.
  1. +6 −7 src/main/java/net/dries007/tfc/client/ClientEvents.java
  2. +17 −9 src/main/java/net/dries007/tfc/objects/biomes/BiomeDecoratorTFC.java
  3. +23 −4 src/main/java/net/dries007/tfc/world/classic/CalenderTFC.java
  4. +5 −3 src/main/java/net/dries007/tfc/world/classic/ChunkGenTFC.java
  5. +43 −130 src/main/java/net/dries007/tfc/world/classic/ClimateTFC.java
  6. +2 −9 src/main/java/net/dries007/tfc/world/classic/chunkdata/ChunkDataTFC.java
  7. +0 −72 src/main/java/net/dries007/tfc/world/classic/genlayers/datalayers/evt/GenEVTLayer.java
  8. +0 −94 src/main/java/net/dries007/tfc/world/classic/genlayers/datalayers/evt/GenLayerAddEVT.java
  9. +0 −48 src/main/java/net/dries007/tfc/world/classic/genlayers/datalayers/evt/GenLayerEVTInit.java
  10. +0 −58 src/main/java/net/dries007/tfc/world/classic/genlayers/datalayers/evt/GenLayerEVTMix.java
  11. +0 −94 src/main/java/net/dries007/tfc/world/classic/genlayers/datalayers/rain/GenLayerAddRain.java
  12. +0 −42 src/main/java/net/dries007/tfc/world/classic/genlayers/datalayers/rain/GenLayerRainInit.java
  13. +0 −58 src/main/java/net/dries007/tfc/world/classic/genlayers/datalayers/rain/GenLayerRainMix.java
  14. +0 −72 src/main/java/net/dries007/tfc/world/classic/genlayers/datalayers/rain/GenRainLayerTFC.java
  15. +0 −67 src/main/java/net/dries007/tfc/world/classic/genlayers/datalayers/tree/GenLayerAddTree.java
  16. +0 −39 src/main/java/net/dries007/tfc/world/classic/genlayers/datalayers/tree/GenLayerTreeInit.java
  17. +0 −50 src/main/java/net/dries007/tfc/world/classic/genlayers/datalayers/tree/GenTreeLayer.java
  18. +2 −0 src/main/java/net/dries007/tfc/world/classic/worldgen/WorldGenTallPlant.java
  19. +8 −2 src/main/java/net/dries007/tfc/world/classic/worldgen/WorldGenTrees.java
@@ -39,6 +39,7 @@
import net.dries007.tfc.util.CapabilityItemSize;
import net.dries007.tfc.util.IMetalObject;
import net.dries007.tfc.world.classic.CalenderTFC;
import net.dries007.tfc.world.classic.ClimateTFC;
import net.dries007.tfc.world.classic.chunkdata.ChunkDataProvider;
import net.dries007.tfc.world.classic.chunkdata.ChunkDataTFC;

@@ -88,17 +89,17 @@ public static void onRenderGameOverlayText(RenderGameOverlayEvent.Text event)
if (data == null || !data.isInitialized()) list.add("No data ?!");
else
{
list.add(String.format("%sTemps: Base: %s%.1f°%s Bio: %s%.1f°%s Height adjusted: %s%.1f°",
list.add(String.format("%sTemps: Base: %s%.1f°%s Biome Avg: %s%.1f°%s Actual: %s%.1f°",
GRAY, WHITE, data.getBaseTemp(), GRAY,
WHITE, data.getAverageTemp(), GRAY,
WHITE, data.getAverageTemp() // todo: replace with height adjusted
WHITE, ClimateTFC.getHeightAdjustedTemp(mc.world, blockpos) // todo: replace with height adjusted
));
list.add(String.format("%sTime: %s%02d:%02d %04d/%02d/%02d",
GRAY, WHITE,
CalenderTFC.getHourOfDay(),
CalenderTFC.getMinuteOfHour(),
CalenderTFC.getTotalYears(),
CalenderTFC.getMonthOfYear(),
CalenderTFC.getMonthOfYear().id(),
CalenderTFC.getDayOfMonth()
)
);
@@ -110,11 +111,9 @@ public static void onRenderGameOverlayText(RenderGameOverlayEvent.Text event)
list.add(GRAY + "Flora Diversity: " + WHITE + data.getFloraDiversity());

list.add(GRAY + "Valid Trees: ");
data.getValidTrees().forEach(t -> list.add(WHITE + t.name + " (" + t.dominance + ")"));
data.getValidTrees().forEach(t -> list.add(String.format("%s %s (%.1f)", WHITE, t.name, t.dominance)));

//list.add(GRAY + "Rocks: " + WHITE + data.getRockLayer1(x, z).name + ", " + data.getRockLayer2(x, z).name + ", " + data.getRockLayer3(x, z).name);
//list.add(GRAY + "EVT: " + WHITE + data.getEvtLayer(x, z).name);
//list.add(GRAY + "Rainfall: " + WHITE + data.getRainfallLayer(x, z).name);
//list.add(GRAY + "Stability: " + WHITE + data.getStabilityLayer(x, z).name);
//list.add(GRAY + "Drainage: " + WHITE + data.getDrainageLayer(x, z).name);
//list.add(GRAY + "Sea level offset: " + WHITE + data.getSeaLevelOffset(x, z));
@@ -124,7 +123,7 @@ public static void onRenderGameOverlayText(RenderGameOverlayEvent.Text event)
//list.add(GRAY + "Rock at feet: " + WHITE + data.getRockLayerHeight(x, blockpos.getY(), z).name);

// list.add("");
data.getOresSpawned().stream().map(String::valueOf).forEach(list::add);
//data.getOresSpawned().stream().map(String::valueOf).forEach(list::add);
}
}
}
@@ -6,6 +6,7 @@
package net.dries007.tfc.objects.biomes;

import java.util.Random;
import javax.annotation.ParametersAreNonnullByDefault;

import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
@@ -17,6 +18,7 @@
import net.dries007.tfc.world.classic.chunkdata.ChunkDataTFC;
import net.dries007.tfc.world.classic.worldgen.*;

@ParametersAreNonnullByDefault
public class BiomeDecoratorTFC extends BiomeDecorator
{
private final int lilyPadPerChunk;
@@ -51,6 +53,13 @@ public BiomeDecoratorTFC(int lilyPadPerChunk, int waterPlantsPerChunk)
@Override
public void decorate(final World world, final Random rng, final Biome biome, final BlockPos chunkPos)
{
ChunkDataTFC data = ChunkDataTFC.get(world, chunkPos);
if (data == null || !data.isInitialized()) return;

final float temperature = ClimateTFC.getHeightAdjustedBiomeTemp(world, chunkPos);
final float rainfall = ChunkDataTFC.getRainfall(world, chunkPos);
final float floraDensity = data.getFloraDensity(); // Use for various plant based decoration (tall grass, those vanilla jungle shrub things, etc.)

this.chunkPos = chunkPos;
// todo: settings for all the rarities?

@@ -70,7 +79,7 @@ public void decorate(final World world, final Random rng, final Biome biome, fin

final BlockPos p2 = world.getHeight(chunkPos.add(rng.nextInt(16) + 8, 0, rng.nextInt(16) + 8));

if (ClimateTFC.getBioTemperatureHeight(world, p2) >= 25) //todo: make less likely as temp goes down?
if (ClimateTFC.getHeightAdjustedBiomeTemp(world, p2) >= 20 + rng.nextFloat() * 5f)
reedGen.generate(world, rng, p2);
}

@@ -79,20 +88,19 @@ public void decorate(final World world, final Random rng, final Biome biome, fin
pumpkinGen.generate(world, rng, world.getHeight(chunkPos.add(rng.nextInt(16) + 8, 0, rng.nextInt(16) + 8)));
}

for (int i = 0; i < cactiPerChunk; i++)
if (temperature > 20f && rainfall < 100f + 25f * rng.nextFloat())
{
final BlockPos p2 = world.getHeight(chunkPos.add(rng.nextInt(16) + 8, 0, rng.nextInt(16) + 8));

float temperature = ClimateTFC.getBioTemperatureHeight(world, p2);
float rainfall = ChunkDataTFC.getRainfall(world, p2);
if (temperature > 20 && rainfall < 125)
cactusGen.generate(world, rng, p2); //todo: make less likely as water moves out of range?
for (int i = 0; i < cactiPerChunk; i++)
{
final BlockPos p2 = world.getHeight(chunkPos.add(rng.nextInt(16) + 8, 0, rng.nextInt(16) + 8));
cactusGen.generate(world, rng, p2);
}
}

for (int i = 0; i < waterPlantsPerChunk; i++)
{
final BlockPos p2 = world.getPrecipitationHeight(chunkPos.add(rng.nextInt(16) + 8, 0, rng.nextInt(16) + 8));
if (ClimateTFC.getBioTemperatureHeight(world, p2) >= 7)
if (ClimateTFC.getHeightAdjustedBiomeTemp(world, p2) >= 7)
waterplantGen.generate(world, rng, p2);
}
}
@@ -78,9 +78,9 @@ public static int getDayOfMonth()
return (int) ((time / TICKS_IN_DAY) % daysInMonth);
}

public static int getMonthOfYear()
public static Month getMonthOfYear()
{
return (int) ((time / ticksInMonth) % 12);
return Month.getById((int) ((time / ticksInMonth) % 12));
}

public static void reload()
@@ -136,8 +136,13 @@ public static void onTickWorldTick(TickEvent.WorldTickEvent event)

public static float getAverageTempMod() { return averageTempMod; }

final int index;
final float tMod;
public static Month getById(int id)
{
return Arrays.stream(Month.values()).filter(m -> m.index == id).findFirst().orElse(MARCH);
}

private final int index;
private final float tMod;

Month(int index, float tMod)
{
@@ -148,5 +153,19 @@ public static void onTickWorldTick(TickEvent.WorldTickEvent event)
public int id() { return index; }

public float getTempMod() { return tMod; }

public Month next()
{
if (this == FEBRUARY)
return MARCH;
return Month.getById(this.index + 1);
}

public Month previous()
{
if (this == MARCH)
return FEBRUARY;
return Month.getById(this.index - 1);
}
}
}
@@ -9,6 +9,7 @@
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;

import com.google.common.collect.ImmutableList;
import net.minecraft.block.BlockFalling;
@@ -29,6 +30,7 @@
import net.minecraft.world.gen.NoiseGeneratorPerlin;
import net.minecraft.world.gen.layer.IntCache;

import mcp.MethodsReturnNonnullByDefault;
import net.dries007.tfc.ConfigTFC;
import net.dries007.tfc.objects.Rock;
import net.dries007.tfc.objects.biomes.BiomesTFC;
@@ -52,6 +54,8 @@
* todo: Find out how to make ocean bottoms not so super flat.
*/
@SuppressWarnings("ConstantConditions")
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
public class ChunkGenTFC implements IChunkGenerator
{
public static final DataLayer[] ROCK_LAYER_1 = new DataLayer[] {SHALE, CLAYSTONE, ROCKSALT, LIMESTONE, CONGLOMERATE, DOLOMITE, CHERT, CHALK, RHYOLITE, BASALT, ANDESITE, DACITE, QUARTZITE, SLATE, PHYLLITE, SCHIST, GNEISS, MARBLE, GRANITE, DIORITE, GABBRO};
@@ -532,8 +536,6 @@ private void replaceBlocksForBiomeHigh(int chunkX, int chunkZ, ChunkPrimer inp,
IBlockState surfaceBlock = rock1.block.getVariant(rainfall + 1.3 * rand.nextGaussian() >= 150f ? Rock.Type.GRASS : Rock.Type.DRY_GRASS).getDefaultState();
IBlockState subSurfaceBlock = rock1.block.getVariant(Rock.Type.DIRT).getDefaultState();

final float bioTemp = ClimateTFC.getBioTemperature(seed, z, rainfall);

if (BiomesTFC.isBeachBiome(getBiomeOffset(x - 1, z)) || BiomesTFC.isBeachBiome(getBiomeOffset(x + 1, z)) || BiomesTFC.isBeachBiome(getBiomeOffset(x, z + 1)) || BiomesTFC.isBeachBiome(getBiomeOffset(x, z - 1)))
{
if (!BiomesTFC.isBeachBiome(getBiomeOffset(x, z))) cliffMap[colIndex] = true;
@@ -546,7 +548,7 @@ private void replaceBlocksForBiomeHigh(int chunkX, int chunkZ, ChunkPrimer inp,
* HIGH PART (yOffset is used)
*/

float temp = ClimateTFC.adjustHeightToTemp(y + yOffset, bioTemp);
float temp = ClimateTFC.adjustTempByHeight(y + yOffset, averageTemp);
if (BiomesTFC.isBeachBiome(biome) && y + yOffset > seaLevel + h && inp.getBlockState(x, y + yOffset, z) == STONE)
{
inp.setBlockState(x, y + yOffset, z, AIR);

0 comments on commit 105e82c

Please sign in to comment.
You can’t perform that action at this time.