From c4e23a8384e778274d26054c9f7451613765dbcc Mon Sep 17 00:00:00 2001 From: Cheeserolls Date: Sun, 7 Jun 2015 18:52:26 +0100 Subject: [PATCH] Minor adjustments to Marsh and Chaparral --- .../biome/overworld/BiomeGenChaparral.java | 4 ++-- .../common/biome/overworld/BiomeGenMarsh.java | 16 ++++++++++++---- .../common/block/BlockBOPPlant.java | 6 ++++-- .../biomesoplenty/common/block/BlockCoral.java | 7 +++---- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenChaparral.java b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenChaparral.java index 54d2b9611..8ab1e70c2 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenChaparral.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenChaparral.java @@ -19,6 +19,7 @@ import biomesoplenty.api.biome.generation.GeneratorStage; import biomesoplenty.api.biome.generation.GeneratorWeighted; import biomesoplenty.common.enums.BOPGems; import biomesoplenty.common.enums.BOPPlants; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.world.feature.GeneratorDoubleFlora; import biomesoplenty.common.world.feature.GeneratorFlora; import biomesoplenty.common.world.feature.GeneratorGrass; @@ -46,8 +47,7 @@ public class BiomeGenChaparral extends BOPBiome this.spawnableCreatureList.add(new SpawnListEntry(EntityHorse.class, 1, 2, 6)); // stone patches - // TODO: make the generator only run at the surface? - this.addGenerator("stone_patches", GeneratorStage.SAND, (new GeneratorSplotches.Builder()).amountPerChunk(15).replace(Blocks.grass).with(Blocks.stone.getDefaultState()).splotchSize(15).create()); + this.addGenerator("stone_patches", GeneratorStage.SAND, (new GeneratorSplotches.Builder()).amountPerChunk(2).splotchSize(15).replace(this.topBlock).with(Blocks.stone.getDefaultState()).scatterYMethod(ScatterYMethod.AT_SURFACE).create()); // flowers GeneratorWeighted flowerGenerator = new GeneratorWeighted(0.5F); diff --git a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenMarsh.java b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenMarsh.java index 66b422d1d..e82dd8a61 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenMarsh.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenMarsh.java @@ -10,6 +10,7 @@ package biomesoplenty.common.biome.overworld; import net.minecraft.block.BlockDoublePlant; import net.minecraft.block.BlockTallGrass; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.monster.EntitySlime; import net.minecraft.init.Blocks; import net.minecraftforge.common.BiomeManager.BiomeType; @@ -17,15 +18,19 @@ import biomesoplenty.api.biome.BOPBiome; import biomesoplenty.api.biome.generation.GeneratorStage; import biomesoplenty.api.biome.generation.GeneratorWeighted; import biomesoplenty.api.block.BOPBlocks; +import biomesoplenty.common.block.BlockBOPDirt; +import biomesoplenty.common.block.BlockBOPGrass; import biomesoplenty.common.block.BlockBOPLilypad; import biomesoplenty.common.block.BlockCoral; import biomesoplenty.common.block.BlockMud; import biomesoplenty.common.enums.BOPGems; import biomesoplenty.common.enums.BOPPlants; +import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.world.feature.GeneratorDoubleFlora; import biomesoplenty.common.world.feature.GeneratorFlora; import biomesoplenty.common.world.feature.GeneratorGrass; import biomesoplenty.common.world.feature.GeneratorOreSingle; +import biomesoplenty.common.world.feature.GeneratorSplotches; import biomesoplenty.common.world.feature.GeneratorWaterside; public class BiomeGenMarsh extends BOPBiome @@ -35,8 +40,7 @@ public class BiomeGenMarsh extends BOPBiome // TODO: should there be foliage colors / water colors? public BiomeGenMarsh() - { - + { // terrain // TODO: the terrain seems to generate a bit higher than expected with these numbers. this.bopMinHeight = 56; @@ -44,6 +48,10 @@ public class BiomeGenMarsh extends BOPBiome this.sidewaysNoiseAmount = 0.0D; this.setOctaveWeights(5, 5, 0, 0, 1, 1); + IBlockState mud = BOPBlocks.mud.getDefaultState().withProperty(BlockMud.VARIANT, BlockMud.MudType.MUD); + this.topBlock = BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.SILTY); + this.fillerBlock = BOPBlocks.dirt.getDefaultState().withProperty(BlockBOPDirt.VARIANT, BlockBOPDirt.BOPDirtType.SILTY); + this.seaFloorBlock = mud; this.setColor(0x66A06E); this.setTemperatureRainfall(0.5F, 0.9F); @@ -54,10 +62,10 @@ public class BiomeGenMarsh extends BOPBiome this.spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 10, 1, 3)); // TODO: find a way to make the lakes shallower - // TODO: put splotches of mud on the bottom? Either using a new GeneratorSplotches or perhaps by adding a lake parameter // mud - this.addGenerator("mud", GeneratorStage.SAND_PASS2, (new GeneratorWaterside.Builder()).amountPerChunk(8).maxRadius(7).with(BOPBlocks.mud.getDefaultState().withProperty(BlockMud.VARIANT, BlockMud.MudType.MUD)).create()); + this.addGenerator("mud", GeneratorStage.SAND_PASS2, (new GeneratorWaterside.Builder()).amountPerChunk(8).maxRadius(7).with(mud).create()); + this.addGenerator("mud_patches", GeneratorStage.SAND_PASS2, (new GeneratorSplotches.Builder()).amountPerChunk(1).splotchSize(12).replace(this.topBlock).with(mud).scatterYMethod(ScatterYMethod.AT_SURFACE).create()); // other plants this.addGenerator("koru", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.1F).with(BOPPlants.KORU).create()); diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java b/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java index a3843c70d..6c1b9e67b 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java @@ -378,6 +378,7 @@ public class BlockBOPPlant extends BlockDecoration implements IShearable // That looks bonkers to me, so I'm ignoring it for now - need to ask the others boolean onFertile = (adjacentBlock == Blocks.dirt || adjacentBlock == BOPBlocks.dirt || adjacentBlock == Blocks.mycelium || adjacentBlock == Blocks.grass); + boolean onMud = (adjacentBlock == BOPBlocks.mud && adjacentBlockState.getValue(BlockMud.VARIANT) == BlockMud.MudType.MUD); boolean onDry = (adjacentBlock == BOPBlocks.hard_dirt || adjacentBlock == Blocks.hardened_clay || adjacentBlock == Blocks.sand || adjacentBlock == BOPBlocks.hard_sand || adjacentBlock == Blocks.soul_sand); boolean onSand = (adjacentBlock == Blocks.sand || adjacentBlock == Blocks.soul_sand); boolean onGrass = (adjacentBlock == Blocks.grass); @@ -413,7 +414,7 @@ public class BlockBOPPlant extends BlockDecoration implements IShearable return onFertile || onSand; case CATTAIL: boolean hasWater = (world.getBlockState(pos.add(-1, -1, 0)).getBlock().getMaterial() == Material.water || world.getBlockState(pos.add(1,-1,0)).getBlock().getMaterial() == Material.water || world.getBlockState(pos.add(0,-1,-1)).getBlock().getMaterial() == Material.water || world.getBlockState(pos.add(0,-1,1)).getBlock().getMaterial() == Material.water); - return onGrass && hasWater; + return (onMud || onGrass) && hasWater; case RIVERCANE: boolean onSelf = ( (adjacentBlock instanceof BlockBOPPlant) && ((BOPPlants) adjacentBlockState.getValue(((BlockBOPPlant)adjacentBlock).variantProperty) == BOPPlants.RIVERCANE) ); return onSelf || onFertile; @@ -421,8 +422,9 @@ public class BlockBOPPlant extends BlockDecoration implements IShearable return (adjacentBlock == Blocks.soul_sand); case REED: // reed needs the ground block to be water, but the block below that to NOT be water - // TODO: reed is gonna have some trickiness with placing, implement as lily variation instead? return (adjacentBlock == Blocks.water && world.getBlockState(pos.down().down()).getBlock() != Blocks.water); + case SHORTGRASS: case MEDIUMGRASS: case DAMPGRASS: case WILDRICE: + return onFertile || onMud; default: return onFertile; } diff --git a/src/main/java/biomesoplenty/common/block/BlockCoral.java b/src/main/java/biomesoplenty/common/block/BlockCoral.java index f38541461..ecee99a67 100644 --- a/src/main/java/biomesoplenty/common/block/BlockCoral.java +++ b/src/main/java/biomesoplenty/common/block/BlockCoral.java @@ -9,7 +9,6 @@ package biomesoplenty.common.block; import static net.minecraft.block.BlockLiquid.LEVEL; -import biomesoplenty.api.block.BOPBlocks; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; @@ -111,12 +110,12 @@ public class BlockCoral extends BlockDecoration public boolean canBlockStay(World world, BlockPos pos, IBlockState state) { Block ground = world.getBlockState(pos.down()).getBlock(); + Material groundMaterial = ground.getMaterial(); Block cover = world.getBlockState(pos.up()).getBlock(); boolean hasWater = (cover == Blocks.water || cover == Blocks.flowing_water); - boolean hasEarth = (ground == Blocks.dirt || ground == BOPBlocks.dirt || ground == BOPBlocks.mud || ground == Blocks.sand || ground == Blocks.sponge || ground == Blocks.stone || ground == Blocks.clay || ground == Blocks.gravel); - - return hasWater && hasEarth; + boolean hasEarth = (groundMaterial == Material.ground || groundMaterial == Material.sand || groundMaterial == Material.clay); + return hasWater && (hasEarth || ground == Blocks.sponge); } }