Skip to content

Commit

Permalink
Progress Push. Requires Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Andromander committed Feb 22, 2018
1 parent 40a95a4 commit f6ded3f
Show file tree
Hide file tree
Showing 15 changed files with 202 additions and 63 deletions.
29 changes: 28 additions & 1 deletion src/main/java/androsa/gaiadimension/biomes/GDBiomeBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraft.world.gen.feature.WorldGenTallGrass;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class GDBiomeBase extends Biome {

private int grassColor = -1;
private int foliageColor = -1;
protected static final IBlockState STONE_GAIA = GDBlocks.gaiaStone.getDefaultState();
protected static final IBlockState GRAVEL_PLACE = GDBlocks.hematiteBlock.getDefaultState();
protected List<SpawnListEntry> undergroundMonsterList;

public GDBiomeBase(BiomeProperties props) {
Expand Down Expand Up @@ -52,6 +55,30 @@ protected GDBiomeDecorator getGDBiomeDecorator() {
return (GDBiomeDecorator) this.decorator;
}

public final GDBiomeBase setFoliageColors(int grassColor, int foliageColor) {
this.grassColor = grassColor;
this.foliageColor = foliageColor;
return this;
}

@Override
@SideOnly(Side.CLIENT)
public int getGrassColorAtPos(BlockPos pos) {
if (this.foliageColor < 0) {
return super.getGrassColorAtPos(pos);
}
return this.grassColor;
}

@Override
@SideOnly(Side.CLIENT)
public int getFoliageColorAtPos(BlockPos pos) {
if (this.foliageColor < 0) {
return super.getGrassColorAtPos(pos);
}
return this.foliageColor;
}

@Override
public void genTerrainBlocks(World world, Random rand, ChunkPrimer primer, int x, int z, double noiseVal) {
this.genGaiaBiomeTerrain(world, rand, primer, x, z, noiseVal);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/androsa/gaiadimension/biomes/GDBiomes.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class GDBiomes {
public static final Biome pinkAgateForest;
@ObjectHolder("blue_agate_forest")
public static final Biome blueAgateForest;
@ObjectHolder("green_agate_forest")
@ObjectHolder("green_agate_jungle")
public static final Biome greenAgateForest;
@ObjectHolder("purple_agate_forest")
public static final Biome purpleAgateForest;
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/androsa/gaiadimension/biomes/GDBiomesRegister.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ public static void onRegisterBiomes(Register<Biome> event) {
),
Type.FOREST
);

biomes.register(
"green_agate_jungle",
new GDGreenAgateJungle(
new BiomeProperties("Green Agate Jungle")
.setTemperature(0.75F)
.setRainfall(0)
.setHeightVariation(0.2F)
),
Type.JUNGLE
);
/*
biomes.register(
"crystal plains",
Expand All @@ -36,6 +47,7 @@ public static void onRegisterBiomes(Register<Biome> event) {
),
Type.PLAINS
);
*/
biomes.register(
"mineral_reservoir",
Expand All @@ -48,6 +60,18 @@ public static void onRegisterBiomes(Register<Biome> event) {
),
Type.OCEAN
);

biomes.register(
"mineral_river",
new GDMineralRiver(
new BiomeProperties("Mineral River")
.setTemperature(0.5F)
.setRainfall(0)
.setBaseHeight(-0.5F)
.setHeightVariation(0)
),
Type.RIVER
);
}

private static class BiomeRegistry {
Expand Down
49 changes: 49 additions & 0 deletions src/main/java/androsa/gaiadimension/biomes/GDGreenAgateJungle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package androsa.gaiadimension.biomes;

import androsa.gaiadimension.block.GDCrystalBloom;
import androsa.gaiadimension.block.GDCrystalGrowth;
import androsa.gaiadimension.registry.GDBlocks;
import androsa.gaiadimension.world.GDGenCrystalBloom;
import androsa.gaiadimension.world.GDGenCrystalGrowth;
import androsa.gaiadimension.world.GDGenGreenAgateTree;
import androsa.gaiadimension.world.GDGenNoTrees;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
import net.minecraft.world.gen.feature.WorldGenTrees;
import net.minecraft.world.gen.feature.WorldGenerator;

import java.util.Random;

public class GDGreenAgateJungle extends GDBiomeBase {

private WorldGenTrees GaiaGenGreenTrees;

public GDGreenAgateJungle(Biome.BiomeProperties props) {
super(props);

GaiaGenGreenTrees = new GDGenGreenAgateTree(false);

topBlock = GDBlocks.glitterGrass.getDefaultState();
fillerBlock = GDBlocks.heavySoil.getDefaultState();
}

@Override
public WorldGenAbstractTree getRandomTreeFeature(Random par1Random) {
return par1Random.nextInt(10) == 0 ? new GDGenNoTrees() : par1Random.nextInt(2) == 0 ? GaiaGenGreenTrees : new GDGenNoTrees();
}

@Override
public WorldGenerator getRandomWorldGenForGrass(Random rand) {

//TODO: Find a way to not generate poppies and dandelions
if (rand.nextInt(16) == 0) {
if (rand.nextInt(4) == 0) {
return new GDGenCrystalBloom(GDCrystalBloom.CrystalBloomVariant.OUZIUM);
} else {
return new GDGenCrystalBloom(GDCrystalBloom.CrystalBloomVariant.THISCUS);
}
} else {
return new GDGenCrystalGrowth(GDCrystalGrowth.CrystalGrowthVariant.GREEN);
}
}
}
36 changes: 36 additions & 0 deletions src/main/java/androsa/gaiadimension/biomes/GDMineralRiver.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package androsa.gaiadimension.biomes;

import androsa.gaiadimension.registry.GDBlocks;
import net.minecraft.block.BlockBush;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenBush;

import java.util.Random;

public class GDMineralRiver extends GDBiomeBase {

public GDMineralRiver(BiomeProperties props) {
super(props);
spawnableCreatureList.clear();

topBlock = GDBlocks.glitterGrass.getDefaultState();
fillerBlock = GDBlocks.heavySoil.getDefaultState();
}

@Override
public void decorate(World world, Random rand, BlockPos pos) {
for (int l3 = 0; l3 < 4; ++l3) {
if (rand.nextInt(4) == 0) {
int i4 = rand.nextInt(16) + 8;
int k8 = rand.nextInt(16) + 8;
int j12 = world.getHeight(pos.add(i4, 0, k8)).getY() * 2;

if (j12 > 0) {
int k15 = rand.nextInt(j12);
new WorldGenBush((BlockBush)GDBlocks.crystalBloom).generate(world, rand, pos.add(i4, k15, k8));
}
}
}
}
}
29 changes: 8 additions & 21 deletions src/main/java/androsa/gaiadimension/biomes/GDPinkAgateForest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@
import androsa.gaiadimension.world.GDGenCrystalGrowth;
import androsa.gaiadimension.world.GDGenNoTrees;
import androsa.gaiadimension.world.GDGenPinkAgateTree;
import net.minecraft.block.BlockBush;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
import net.minecraft.world.gen.feature.WorldGenBush;
import net.minecraft.world.gen.feature.WorldGenTrees;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.Random;

Expand All @@ -31,23 +28,7 @@ public GDPinkAgateForest(Biome.BiomeProperties props) {
topBlock = GDBlocks.glitterGrass.getDefaultState();
fillerBlock = GDBlocks.heavySoil.getDefaultState();
}
/*
@Override
public void decorate(World par1World, Random par2Random, BlockPos pos) {
for (int l3 = 0; l3 < 4; ++l3) {
if (par2Random.nextInt(4) == 0) {
int i4 = par2Random.nextInt(16) + 8;
int k8 = par2Random.nextInt(16) + 8;
int j12 = par1World.getHeight(pos.add(14, 0, k8)).getY() * 2;

if (j12 > 0) {
int k15 = par2Random.nextInt(j12);
new WorldGenBush((BlockBush)GDBlocks.crystalGrowth).generate(par1World, par2Random, pos.add(i4, k15, k8));
}
}
}
}
*/
@Override
public WorldGenAbstractTree getRandomTreeFeature(Random par1Random) {
return par1Random.nextInt(5) == 0 ? new GDGenNoTrees() : par1Random.nextInt(3) == 0 ? GaiaGenPinkTrees : new GDGenNoTrees();
Expand All @@ -67,4 +48,10 @@ public WorldGenerator getRandomWorldGenForGrass(Random rand) {
return new GDGenCrystalGrowth(GDCrystalGrowth.CrystalGrowthVariant.PINK);
}
}

@Override
@SideOnly(Side.CLIENT)
public int getGrassColorAtPos(BlockPos pos) {
return 0xFF0000;
}
}
15 changes: 10 additions & 5 deletions src/main/java/androsa/gaiadimension/block/GDGlitterGrass.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
package androsa.gaiadimension.block;

import androsa.gaiadimension.registry.GDBlocks;
import androsa.gaiadimension.registry.GDFluids;
import androsa.gaiadimension.registry.GDTabs;
import androsa.gaiadimension.registry.ModelRegisterCallback;
import androsa.gaiadimension.registry.*;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeColorHelper;
import net.minecraft.world.border.IBorderListener;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.Random;

public class GDGlitterGrass extends Block implements ModelRegisterCallback {
public class GDGlitterGrass extends Block implements ModelRegisterCallback, IColouredBlock {

public GDGlitterGrass() {
super(Material.GRASS);
Expand All @@ -47,6 +47,11 @@ else if (world.getLightFromNeighbors(pos.up()) >= 9)
}
}

@Override
public int getColorMultiplier(IBlockState state, IBlockAccess access, BlockPos pos, int tintIndex) {
return access != null && pos != null ? BiomeColorHelper.getGrassColorAtPos(access, pos) : ColorizerGrass.getGrassColor(0.5D, 1.0D);
}

@Override
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) {
boolean hasWater = world.getBlockState(pos.east()).getMaterial() == Material.WATER ||
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/androsa/gaiadimension/registry/IColouredBlock.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package androsa.gaiadimension.registry;

import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;

import javax.annotation.Nullable;

public interface IColouredBlock {
int getColorMultiplier(IBlockState state, @Nullable IBlockAccess access, @Nullable BlockPos pos, int tintIndex);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public GDBiomeProvider(World world) {
getBiomesToSpawnIn().clear();
getBiomesToSpawnIn().add(GDBiomes.pinkAgateForest);
// getBiomesToSpawnIn().add(GDBiomes.blueAgateForest);
// getBiomesToSpawnIn().add(GDBiomes.greenAgateForest);
getBiomesToSpawnIn().add(GDBiomes.greenAgateForest);
// getBiomesToSpawnIn().add(GDBiomes.purpleAgateForest);
// getBiomesToSpawnIn().add(GDBiomes.crystalPlains);

Expand All @@ -32,9 +32,9 @@ private void makeLayers(long seed) {
biomes = new GenLayerZoom(1004, biomes);
biomes = new GenLayerZoom(1005, biomes);

// GenLayer riverLayer = new GenLayerGDRiver(1L, biomes);
// riverLayer = new GenLayerSmooth(7000L, riverLayer);
// biomes = new GenLayerGDRiverMix(100L, biomes, riverLayer);
GenLayer riverLayer = new GenLayerGDRiver(1L, biomes);
riverLayer = new GenLayerSmooth(7000L, riverLayer);
biomes = new GenLayerGDRiverMix(100L, biomes, riverLayer);

//oof, I like Voronoi. Looks cool
GenLayer genlayervoronoizoom = new GenLayerVoronoiZoom(10L, biomes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class GenLayerGDBiomes extends GenLayer {
protected Biome commonBiomes[] = (new Biome[]{
GDBiomes.pinkAgateForest,
// GDBiomes.blueAgateForest,
// GDBiomes.greenAgateForest,
GDBiomes.greenAgateForest,
// GDBiomes.purpleAgateForest,
// GDBiomes.crystalPlains
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
"transform": "forge:default-item"
},
"variants": {
"inventory_thiscus": [{ "model": "builtin/generated", "textures": {"layer0": "gaiadimension:blocks/thiscus" }}],
"inventory_ouzium": [{ "model": "builtin/generated", "textures": {"layer0": "gaiadimension:blocks/ouzium" }}],
"inventory_varloom": [{ "model": "builtin/generated", "textures": {"layer0": "gaiadimension:blocks/thiscus" }}],
"inventory_corrupt_varloom": [{ "model": "builtin/generated", "textures": {"layer0": "gaiadimension:blocks/thiscus" }}],
"inventory_missingno": [{ "model": "builtin/generated", "textures": {"layer0": "gaiadimension:blocks/missingno" }}],
"inventory_thiscus": [{ "model": "builtin/generated", "textures": {"layer0": "gaiadimension:blocks/thiscus" }}],
"inventory_ouzium": [{ "model": "builtin/generated", "textures": {"layer0": "gaiadimension:blocks/ouzium" }}],
"inventory_varloom": [{ "model": "builtin/generated", "textures": {"layer0": "gaiadimension:blocks/varloom" }}],
"inventory_corrupt_varloom": [{ "model": "builtin/generated", "textures": {"layer0": "gaiadimension:blocks/corrupt_varloom" }}],
"inventory_missingno": [{ "model": "builtin/generated", "textures": {"layer0": "gaiadimension:blocks/missingno" }}],

"variant=thiscus": [{ "model": "cross", "textures": {"cross": "gaiadimension:blocks/thiscus" }}],
"variant=ouzium": [{ "model": "cross", "textures": {"cross": "gaiadimension:blocks/ouzium" }}],
"variant=varloom": [{ "model": "cross", "textures": {"cross": "gaiadimension:blocks/thiscus" }}],
"variant=corrupt_varloom": [{ "model": "cross", "textures": {"cross": "gaiadimension:blocks/thiscus" }}],
"variant=missingno": [{ "model": "cross", "textures": {"cross": "gaiadimension:blocks/missingno" }}]
"variant=thiscus": [{ "model": "cross", "textures": {"cross": "gaiadimension:blocks/thiscus" }}],
"variant=ouzium": [{ "model": "cross", "textures": {"cross": "gaiadimension:blocks/ouzium" }}],
"variant=varloom": [{ "model": "cross", "textures": {"cross": "gaiadimension:blocks/varloom" }}],
"variant=corrupt_varloom": [{ "model": "cross", "textures": {"cross": "gaiadimension:blocks/corrupt_varloom" }}],
"variant=missingno": [{ "model": "cross", "textures": {"cross": "gaiadimension:blocks/missingno" }}]
}
}
Loading

0 comments on commit f6ded3f

Please sign in to comment.