initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
40
java/src/game/worldgen/foliage/WorldGenFlowers.java
Executable file
40
java/src/game/worldgen/foliage/WorldGenFlowers.java
Executable file
|
@ -0,0 +1,40 @@
|
|||
package game.worldgen.foliage;
|
||||
|
||||
import game.block.BlockFlower;
|
||||
import game.rng.Random;
|
||||
import game.world.BlockPos;
|
||||
import game.world.State;
|
||||
import game.world.WorldServer;
|
||||
import game.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenFlowers extends FeatureGenerator
|
||||
{
|
||||
private BlockFlower flower;
|
||||
private State field_175915_b;
|
||||
|
||||
public WorldGenFlowers(BlockFlower p_i45632_1_, BlockFlower.EnumFlowerType p_i45632_2_)
|
||||
{
|
||||
this.setGeneratedBlock(p_i45632_1_, p_i45632_2_);
|
||||
}
|
||||
|
||||
public void setGeneratedBlock(BlockFlower p_175914_1_, BlockFlower.EnumFlowerType p_175914_2_)
|
||||
{
|
||||
this.flower = p_175914_1_;
|
||||
this.field_175915_b = p_175914_1_.getState().withProperty(p_175914_1_.getTypeProperty(), p_175914_2_);
|
||||
}
|
||||
|
||||
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
for (int i = 0; i < 64; ++i)
|
||||
{
|
||||
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
|
||||
|
||||
if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 511) && this.flower.canBlockStay(worldIn, blockpos, this.field_175915_b))
|
||||
{
|
||||
worldIn.setState(blockpos, this.field_175915_b, 2);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue