BiomesOPlenty/common/biomesoplenty/worldgen/WorldGenMoss.java

46 lines
1.1 KiB
Java
Raw Normal View History

2013-05-03 13:00:44 +00:00
package biomesoplenty.worldgen;
import java.util.Random;
import net.minecraft.util.Direction;
import net.minecraft.util.Facing;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import biomesoplenty.api.Blocks;
2013-05-03 13:00:44 +00:00
public class WorldGenMoss extends WorldGenerator
{
2013-05-31 10:34:02 +00:00
@Override
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
{
int var6 = par3;
2013-05-03 13:00:44 +00:00
2013-05-31 10:34:02 +00:00
for (int var7 = par5; par4 < 80; ++par4)
{
if (par1World.isAirBlock(par3, par4, par5))
{
for (int var8 = 2; var8 <= 5; ++var8)
{
if (Blocks.moss.get().canPlaceBlockOnSide(par1World, par3, par4, par5, var8))
{
2013-09-22 02:26:41 +00:00
int var999 = par2Random.nextInt(4);
2013-09-20 23:16:51 +00:00
if (var999 == 0)
{
par1World.setBlock(par3, par4, par5, Blocks.moss.get().blockID, 1 << Direction.facingToDirection[Facing.oppositeSide[var8]], 2);
}
2013-05-31 10:34:02 +00:00
break;
}
}
}
else
{
par3 = var6 + par2Random.nextInt(4) - par2Random.nextInt(4);
par5 = var7 + par2Random.nextInt(4) - par2Random.nextInt(4);
}
}
2013-05-03 13:00:44 +00:00
2013-05-31 10:34:02 +00:00
return true;
}
2013-05-03 13:00:44 +00:00
}