Added the flower field, improved weighted generation, fixed the colouring of damp and wheat grass
This commit is contained in:
parent
5ffd96b86d
commit
6564281943
|
@ -17,6 +17,7 @@ public class BOPBiomes
|
||||||
public static Optional<BiomeGenBase> alps = Optional.absent();
|
public static Optional<BiomeGenBase> alps = Optional.absent();
|
||||||
public static Optional<BiomeGenBase> arctic = Optional.absent();
|
public static Optional<BiomeGenBase> arctic = Optional.absent();
|
||||||
public static Optional<BiomeGenBase> crag = Optional.absent();
|
public static Optional<BiomeGenBase> crag = Optional.absent();
|
||||||
|
public static Optional<BiomeGenBase> flowerField = Optional.absent();
|
||||||
public static Optional<BiomeGenBase> originValley = Optional.absent();
|
public static Optional<BiomeGenBase> originValley = Optional.absent();
|
||||||
public static Optional<BiomeGenBase> steppe = Optional.absent();
|
public static Optional<BiomeGenBase> steppe = Optional.absent();
|
||||||
public static Optional<BiomeGenBase> thicket = Optional.absent();
|
public static Optional<BiomeGenBase> thicket = Optional.absent();
|
||||||
|
|
|
@ -23,10 +23,16 @@ import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
public class GeneratorWeighted extends GeneratorCustomizable
|
public class GeneratorWeighted extends GeneratorCustomizable
|
||||||
{
|
{
|
||||||
|
private int amountPerChunk;
|
||||||
private List<GeneratorWeightedEntry> weightedEntries = new ArrayList<GeneratorWeightedEntry>();
|
private List<GeneratorWeightedEntry> weightedEntries = new ArrayList<GeneratorWeightedEntry>();
|
||||||
|
|
||||||
public GeneratorWeighted() {}
|
public GeneratorWeighted() {}
|
||||||
|
|
||||||
|
public GeneratorWeighted(int amountPerChunk)
|
||||||
|
{
|
||||||
|
this.amountPerChunk = amountPerChunk;
|
||||||
|
}
|
||||||
|
|
||||||
public void add(int weight, IGenerator entry)
|
public void add(int weight, IGenerator entry)
|
||||||
{
|
{
|
||||||
entry.setStage(GeneratorStage.PARENT);
|
entry.setStage(GeneratorStage.PARENT);
|
||||||
|
@ -36,9 +42,12 @@ public class GeneratorWeighted extends GeneratorCustomizable
|
||||||
@Override
|
@Override
|
||||||
public void scatter(World world, Random random, BlockPos pos)
|
public void scatter(World world, Random random, BlockPos pos)
|
||||||
{
|
{
|
||||||
GeneratorWeightedEntry generator = (GeneratorWeightedEntry)WeightedRandom.getRandomItem(random, this.weightedEntries);
|
for (int i = 0; i < amountPerChunk; i++)
|
||||||
|
{
|
||||||
generator.scatter(world, random, pos);
|
GeneratorWeightedEntry generator = (GeneratorWeightedEntry)WeightedRandom.getRandomItem(random, this.weightedEntries);
|
||||||
|
|
||||||
|
generator.scatter(world, random, pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,12 +61,14 @@ public class GeneratorWeighted extends GeneratorCustomizable
|
||||||
@Override
|
@Override
|
||||||
public void writeToJson(JsonObject json, JsonSerializationContext context)
|
public void writeToJson(JsonObject json, JsonSerializationContext context)
|
||||||
{
|
{
|
||||||
|
json.addProperty("amount_per_chunk", this.amountPerChunk);
|
||||||
json.add("entries", context.serialize(this.weightedEntries));
|
json.add("entries", context.serialize(this.weightedEntries));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromJson(JsonObject json, JsonDeserializationContext context)
|
public void readFromJson(JsonObject json, JsonDeserializationContext context)
|
||||||
{
|
{
|
||||||
|
this.amountPerChunk = json.get("amount_per_chunk").getAsInt();
|
||||||
this.weightedEntries = context.deserialize(json.get("entries"), new TypeToken<List<GeneratorWeightedEntry>>() {}.getType());
|
this.weightedEntries = context.deserialize(json.get("entries"), new TypeToken<List<GeneratorWeightedEntry>>() {}.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright 2015, the Biomes O' Plenty Team
|
||||||
|
*
|
||||||
|
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||||
|
*
|
||||||
|
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
package biomesoplenty.common.biome.overworld;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockFlower.EnumFlowerType;
|
||||||
|
import net.minecraft.block.BlockTallGrass;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraftforge.common.BiomeManager.BiomeType;
|
||||||
|
import biomesoplenty.api.biome.BOPBiome;
|
||||||
|
import biomesoplenty.api.biome.generation.GeneratorStage;
|
||||||
|
import biomesoplenty.api.biome.generation.GeneratorWeighted;
|
||||||
|
import biomesoplenty.api.block.BOPBlocks;
|
||||||
|
import biomesoplenty.api.block.BOPPlantEnums.AllPlants;
|
||||||
|
import biomesoplenty.common.block.BlockBOPPlant;
|
||||||
|
import biomesoplenty.common.block.BlockGem;
|
||||||
|
import biomesoplenty.common.block.BlockGem.GemType;
|
||||||
|
import biomesoplenty.common.world.feature.GeneratorFlora;
|
||||||
|
import biomesoplenty.common.world.feature.GeneratorGrass;
|
||||||
|
import biomesoplenty.common.world.feature.GeneratorOreSingle;
|
||||||
|
|
||||||
|
public class BiomeGenFlowerField extends BOPBiome
|
||||||
|
{
|
||||||
|
private static final Height biomeHeight = new Height(0.125F, 0.05F);
|
||||||
|
|
||||||
|
public BiomeGenFlowerField()
|
||||||
|
{
|
||||||
|
this.setHeight(biomeHeight);
|
||||||
|
this.setColor(4044093);
|
||||||
|
this.setTemperatureRainfall(0.6F, 0.7F);
|
||||||
|
|
||||||
|
this.addWeight(BiomeType.WARM, 3);
|
||||||
|
|
||||||
|
GeneratorWeighted flowerGenerator = new GeneratorWeighted(999);
|
||||||
|
flowerGenerator.add(2, new GeneratorFlora(1, Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), EnumFlowerType.PINK_TULIP)));
|
||||||
|
flowerGenerator.add(5, new GeneratorFlora(1, Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), EnumFlowerType.WHITE_TULIP)));
|
||||||
|
flowerGenerator.add(7, new GeneratorFlora(1, Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), EnumFlowerType.ORANGE_TULIP)));
|
||||||
|
flowerGenerator.add(10, new GeneratorFlora(1, Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), EnumFlowerType.RED_TULIP)));
|
||||||
|
this.addGenerator("flowers", GeneratorStage.FLOWERS, flowerGenerator);
|
||||||
|
|
||||||
|
GeneratorWeighted grassGenerator = new GeneratorWeighted(35);
|
||||||
|
grassGenerator.add(1, new GeneratorGrass(1, BlockBOPPlant.getVariantState(AllPlants.WHEATGRASS)));
|
||||||
|
grassGenerator.add(1, new GeneratorGrass(1, BlockBOPPlant.getVariantState(AllPlants.DAMPGRASS)));
|
||||||
|
grassGenerator.add(1, new GeneratorGrass(1, Blocks.tallgrass.getDefaultState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.GRASS)));
|
||||||
|
this.addGenerator("grass", GeneratorStage.GRASS, grassGenerator);
|
||||||
|
|
||||||
|
this.addGenerator("peridot", GeneratorStage.SAND, new GeneratorOreSingle(BOPBlocks.gem_ore.getDefaultState().withProperty(BlockGem.VARIANT, GemType.PERIDOT), 12, 4, 32));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getGrassColorAtPos(BlockPos pos)
|
||||||
|
{
|
||||||
|
return 7390273;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFoliageColorAtPos(BlockPos pos)
|
||||||
|
{
|
||||||
|
return 7390273;
|
||||||
|
}
|
||||||
|
}
|
|
@ -44,9 +44,9 @@ public class BiomeGenOriginValley extends BOPBiome
|
||||||
BOPBlocks.leaves_2.getDefaultState().withProperty(BlockBOPLeaves.getVariantProperty(BlockBOPLeaves2.PAGENUM), AllTrees.ORIGIN));
|
BOPBlocks.leaves_2.getDefaultState().withProperty(BlockBOPLeaves.getVariantProperty(BlockBOPLeaves2.PAGENUM), AllTrees.ORIGIN));
|
||||||
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
|
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
|
||||||
|
|
||||||
GeneratorWeighted flowerGenerator = new GeneratorWeighted();
|
GeneratorWeighted flowerGenerator = new GeneratorWeighted(4);
|
||||||
flowerGenerator.add(8, new GeneratorFlora(4, BOPBlocks.flower2.getDefaultState().withProperty(BlockBOPFlower2.VARIANT, FlowerType.ROSE)));
|
flowerGenerator.add(8, new GeneratorFlora(1, BOPBlocks.flower2.getDefaultState().withProperty(BlockBOPFlower2.VARIANT, FlowerType.ROSE)));
|
||||||
flowerGenerator.add(10, new GeneratorFlora(4, Blocks.yellow_flower.getDefaultState()));
|
flowerGenerator.add(10, new GeneratorFlora(1, Blocks.yellow_flower.getDefaultState()));
|
||||||
this.addGenerator("flowers", GeneratorStage.FLOWERS, flowerGenerator);
|
this.addGenerator("flowers", GeneratorStage.FLOWERS, flowerGenerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,9 @@ public class BiomeGenThicket extends BOPBiome
|
||||||
|
|
||||||
this.addWeight(BiomeType.COOL, 5);
|
this.addWeight(BiomeType.COOL, 5);
|
||||||
|
|
||||||
GeneratorWeighted treeGenerator = new GeneratorWeighted();
|
GeneratorWeighted treeGenerator = new GeneratorWeighted(17);
|
||||||
treeGenerator.add(1, new GeneratorBasicTree(17, false, 4, 3, Blocks.log.getDefaultState(), Blocks.leaves.getDefaultState()));
|
treeGenerator.add(1, new GeneratorBasicTree(1, false, 4, 3, Blocks.log.getDefaultState(), Blocks.leaves.getDefaultState()));
|
||||||
treeGenerator.add(4, new GeneratorBush(17, Blocks.log.getDefaultState(), Blocks.leaves.getDefaultState()));
|
treeGenerator.add(4, new GeneratorBush(1, Blocks.log.getDefaultState(), Blocks.leaves.getDefaultState()));
|
||||||
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
|
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
|
||||||
|
|
||||||
this.addGenerator("gravel", GeneratorStage.SAND_PASS2, new GeneratorWaterside(6, 7, Blocks.gravel.getDefaultState()));
|
this.addGenerator("gravel", GeneratorStage.SAND_PASS2, new GeneratorWaterside(6, 7, Blocks.gravel.getDefaultState()));
|
||||||
|
|
|
@ -292,7 +292,7 @@ public abstract class BlockBOPPlant extends BlockDecoration implements IShearabl
|
||||||
{
|
{
|
||||||
case SHRUB: case LEAFPILE: case POISONIVY: case BUSH: case BERRYBUSH:
|
case SHRUB: case LEAFPILE: case POISONIVY: case BUSH: case BERRYBUSH:
|
||||||
return ColoringType.LIKE_LEAVES;
|
return ColoringType.LIKE_LEAVES;
|
||||||
case SHORTGRASS: case MEDIUMGRASS: case SPROUT: case KORU: case CLOVERPATCH:
|
case SHORTGRASS: case MEDIUMGRASS: case SPROUT: case KORU: case CLOVERPATCH: case WHEATGRASS: case DAMPGRASS:
|
||||||
return ColoringType.LIKE_GRASS;
|
return ColoringType.LIKE_GRASS;
|
||||||
default:
|
default:
|
||||||
return ColoringType.PLAIN;
|
return ColoringType.PLAIN;
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.apache.commons.io.FileUtils;
|
||||||
import biomesoplenty.common.biome.overworld.BiomeGenAlps;
|
import biomesoplenty.common.biome.overworld.BiomeGenAlps;
|
||||||
import biomesoplenty.common.biome.overworld.BiomeGenArctic;
|
import biomesoplenty.common.biome.overworld.BiomeGenArctic;
|
||||||
import biomesoplenty.common.biome.overworld.BiomeGenCrag;
|
import biomesoplenty.common.biome.overworld.BiomeGenCrag;
|
||||||
|
import biomesoplenty.common.biome.overworld.BiomeGenFlowerField;
|
||||||
import biomesoplenty.common.biome.overworld.BiomeGenOriginValley;
|
import biomesoplenty.common.biome.overworld.BiomeGenOriginValley;
|
||||||
import biomesoplenty.common.biome.overworld.BiomeGenSteppe;
|
import biomesoplenty.common.biome.overworld.BiomeGenSteppe;
|
||||||
import biomesoplenty.common.biome.overworld.BiomeGenThicket;
|
import biomesoplenty.common.biome.overworld.BiomeGenThicket;
|
||||||
|
@ -50,6 +51,7 @@ public class ModBiomes
|
||||||
alps = registerBiome(new BiomeGenAlps().setBiomeName("Alps"), "alps");
|
alps = registerBiome(new BiomeGenAlps().setBiomeName("Alps"), "alps");
|
||||||
arctic = registerBiome(new BiomeGenArctic().setBiomeName("Arctic"), "arctic");
|
arctic = registerBiome(new BiomeGenArctic().setBiomeName("Arctic"), "arctic");
|
||||||
crag = registerBiome(new BiomeGenCrag().setBiomeName("Crag"), "crag");
|
crag = registerBiome(new BiomeGenCrag().setBiomeName("Crag"), "crag");
|
||||||
|
flowerField = registerBiome(new BiomeGenFlowerField().setBiomeName("Flower Field"), "flower_field");
|
||||||
originValley = registerBiome(new BiomeGenOriginValley().setBiomeName("Origin Valley"), "origin_valley");
|
originValley = registerBiome(new BiomeGenOriginValley().setBiomeName("Origin Valley"), "origin_valley");
|
||||||
steppe = registerBiome(new BiomeGenSteppe().setBiomeName("Steppe"), "steppe");
|
steppe = registerBiome(new BiomeGenSteppe().setBiomeName("Steppe"), "steppe");
|
||||||
thicket = registerBiome(new BiomeGenThicket().setBiomeName("Thicket"), "thicket");
|
thicket = registerBiome(new BiomeGenThicket().setBiomeName("Thicket"), "thicket");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cross",
|
"parent": "block/tallgrass",
|
||||||
"textures": {
|
"textures": {
|
||||||
"cross": "biomesoplenty:blocks/dampgrass"
|
"cross": "biomesoplenty:blocks/dampgrass"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"parent": "block/cross",
|
"parent": "block/tallgrass",
|
||||||
"textures": {
|
"textures": {
|
||||||
"cross": "biomesoplenty:blocks/wheatgrass"
|
"cross": "biomesoplenty:blocks/wheatgrass"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue