Preparations for our custom GenLayerBiome

This commit is contained in:
Adubbz 2019-01-14 22:19:11 +11:00
parent b1d67034dc
commit 518e6ffe47
3 changed files with 24 additions and 9 deletions

View File

@ -66,7 +66,7 @@ public class BiomeMapColours
biomeColours.put(11, 0xFFCCAA);*/
// Climate colours. See the values in BOPClimates
biomeColours.put(0, 0xF3F3F3);
/*biomeColours.put(0, 0xF3F3F3);
biomeColours.put(1, 0xCFE2F3);
biomeColours.put(2, 0xA2C4C9);
biomeColours.put(3, 0x45818E);
@ -79,7 +79,7 @@ public class BiomeMapColours
biomeColours.put(10, 0xEDFFB7);
biomeColours.put(11, 0xFCE39D);
biomeColours.put(12, 0xFFFBE0);
biomeColours.put(13, 0xA6947F);
biomeColours.put(13, 0xA6947F);*/
}
public static int getBiomeMapColour(int biomeId)

View File

@ -9,6 +9,7 @@ package biomesoplenty.client.util;
import biomesoplenty.common.world.BOPLayerUtil;
import biomesoplenty.common.world.BOPWorldSettings;
import biomesoplenty.common.world.layer.traits.IBOPContextExtended;
import biomesoplenty.common.world.layer.traits.LazyAreaLayerContextBOP;
import com.google.common.collect.ImmutableList;
import net.minecraft.init.Biomes;
@ -17,6 +18,7 @@ import net.minecraft.world.WorldType;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.provider.BiomeProviderType;
import net.minecraft.world.biome.provider.OverworldBiomeProviderSettings;
import net.minecraft.world.gen.IContextExtended;
import net.minecraft.world.gen.LazyAreaLayerContext;
import net.minecraft.world.gen.OverworldGenSettings;
import net.minecraft.world.gen.area.AreaDimension;
@ -29,6 +31,7 @@ import org.lwjgl.opengl.GL11;
import org.lwjgl.system.MemoryStack;
import java.nio.IntBuffer;
import java.util.function.LongFunction;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL13.GL_TEXTURE0;
@ -162,15 +165,15 @@ public class GenLayerVisualizer
OverworldGenSettings settings = settingsProvider.getGeneratorSettings();
int[] aint = new int[1];
ImmutableList<IAreaFactory<LazyArea>> factoryList = BOPLayerUtil.createAreaFactories(WorldType.DEFAULT, settings, (seedModifier) -> {
LongFunction<IBOPContextExtended<LazyArea>> contextFactory = (seedModifier) -> {
++aint[0];
return new LazyAreaLayerContextBOP(1, aint[0], 0, seedModifier);
});
};
IAreaFactory<LazyArea> biomeAreaFactory = BOPLayerUtil.createClimateFactory((seedModifier) -> {
++aint[0];
return new LazyAreaLayerContextBOP(1, aint[0], 348234231, seedModifier);
}, new BOPWorldSettings());
IAreaFactory<LazyArea> landAreaFactory = BOPLayerUtil.createInitialLandAndSeaFactory(contextFactory);
//IAreaFactory<LazyArea> biomeAreaFactory = BOPLayerUtil.createBiomeFactory(landAreaFactory, WorldType.DEFAULT, settings, new BOPWorldSettings(), contextFactory);
IAreaFactory<LazyArea> biomeAreaFactory = BOPLayerUtil.createAreaFactories(WorldType.DEFAULT, settings, contextFactory).get(0);
AreaDimension areaDimension = new AreaDimension(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);
LazyArea area = biomeAreaFactory.make(areaDimension);

View File

@ -33,7 +33,11 @@ public class BOPLayerUtil
factory = GenLayerAddIsland.INSTANCE.apply(contextFactory.apply(50L), factory);
factory = GenLayerAddIsland.INSTANCE.apply(contextFactory.apply(70L), factory);
factory = GenLayerRemoveTooMuchOcean.INSTANCE.apply(contextFactory.apply(2L), factory);
factory = GenLayerAddSnow.INSTANCE.<T>apply((IContextExtended)contextFactory.apply(2L), factory);
factory = GenLayerAddIsland.INSTANCE.apply(contextFactory.apply(3L), factory);
factory = GenLayerEdge.CoolWarm.INSTANCE.apply(contextFactory.apply(2L), factory);
factory = GenLayerEdge.HeatIce.INSTANCE.apply(contextFactory.apply(2L), factory);
factory = GenLayerEdge.Special.INSTANCE.apply(contextFactory.apply(3L), factory);
factory = GenLayerZoom.NORMAL.apply(contextFactory.apply(2002L), factory);
factory = GenLayerZoom.NORMAL.apply(contextFactory.apply(2003L), factory);
factory = GenLayerAddIsland.INSTANCE.apply(contextFactory.apply(4L), factory);
@ -86,6 +90,14 @@ public class BOPLayerUtil
return GenLayerClimate.INSTANCE.apply(contextFactory.apply(103L), temperatureFactory, rainfallFactory);
}
public static <T extends IArea, C extends IContextExtended<T>> IAreaFactory<T> createBiomeFactory(IAreaFactory<T> landSeaAreaFactory, WorldType worldType, OverworldGenSettings settings, BOPWorldSettings bopWorldSettings, LongFunction<C> contextFactory)
{
IAreaFactory<T> biomeFactory = (new GenLayerBiome(worldType, settings)).apply(contextFactory.apply(200L), landSeaAreaFactory);
biomeFactory = LayerUtil.repeat(1000L, GenLayerZoom.NORMAL, biomeFactory, 2, contextFactory);
biomeFactory = GenLayerBiomeEdge.INSTANCE.apply(contextFactory.apply(1000L), biomeFactory);
return biomeFactory;
}
public static <T extends IArea, C extends IContextExtended<T>> ImmutableList<IAreaFactory<T>> createAreaFactories(WorldType worldType, OverworldGenSettings settings, LongFunction<C> contextFactory)
{
// Create the initial land and sea layer. Is also responsible for adding deep oceans
@ -110,7 +122,7 @@ public class BOPLayerUtil
riverAndSubBiomesInitFactory = LayerUtil.repeat(1000L, GenLayerZoom.NORMAL, riverAndSubBiomesInitFactory, 2, contextFactory);
// Allocate the biomes
IAreaFactory<T> biomesFactory = worldType.getBiomeLayer(landSeaFactory, settings, contextFactory);
IAreaFactory<T> biomesFactory = createBiomeFactory(landSeaFactory, worldType, settings, new BOPWorldSettings(), contextFactory);
biomesFactory = GenLayerHills.INSTANCE.apply(contextFactory.apply(1000L), biomesFactory, riverAndSubBiomesInitFactory);
// Develop the rivers branch