initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
27
java/src/game/worldgen/foliage/WorldGenPumpkin.java
Executable file
27
java/src/game/worldgen/foliage/WorldGenPumpkin.java
Executable file
|
@ -0,0 +1,27 @@
|
|||
package game.worldgen.foliage;
|
||||
|
||||
import game.block.BlockPumpkin;
|
||||
import game.init.Blocks;
|
||||
import game.rng.Random;
|
||||
import game.world.BlockPos;
|
||||
import game.world.Facing;
|
||||
import game.world.WorldServer;
|
||||
import game.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenPumpkin extends FeatureGenerator
|
||||
{
|
||||
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.getState(blockpos.down()).getBlock() == Blocks.grass && Blocks.pumpkin.canPlaceBlockAt(worldIn, blockpos))
|
||||
{
|
||||
worldIn.setState(blockpos, Blocks.pumpkin.getState().withProperty(BlockPumpkin.FACING, Facing.Plane.HORIZONTAL.random(rand)), 2);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue