Made metadata get checked when decided whether a plant can generate in a position. Fixes #11
This commit is contained in:
parent
a6ef09ee02
commit
024d5025a6
7 changed files with 106 additions and 7 deletions
|
@ -54,7 +54,7 @@ import biomesoplenty.worldgen.WorldGenBadlands4;
|
|||
import biomesoplenty.worldgen.WorldGenBoneSpine;
|
||||
import biomesoplenty.worldgen.WorldGenBoneSpine2;
|
||||
import biomesoplenty.worldgen.WorldGenBoulder;
|
||||
import biomesoplenty.worldgen.WorldGenBush;
|
||||
import biomesoplenty.worldgen.WorldGenBOPBush;
|
||||
import biomesoplenty.worldgen.WorldGenCanyon;
|
||||
import biomesoplenty.worldgen.WorldGenCanyonGrass;
|
||||
import biomesoplenty.worldgen.WorldGenCattail;
|
||||
|
@ -418,7 +418,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator
|
|||
plantDeadGen = new WorldGenBOPFlowers(Blocks.plants.get().blockID, 0);
|
||||
plantDesertGen = new WorldGenBOPFlowers(Blocks.plants.get().blockID, 1);
|
||||
thornGen = new WorldGenBOPFlowers(Blocks.plants.get().blockID, 5);
|
||||
bushGen = new WorldGenBush(Blocks.foliage.get().blockID, 4);
|
||||
bushGen = new WorldGenBOPBush(Blocks.foliage.get().blockID, 4);
|
||||
berryBushGen = new WorldGenBOPFlowers(Blocks.foliage.get().blockID, 8);
|
||||
tinyCactusGen = new WorldGenBOPFlowers(Blocks.flowers.get().blockID, 11);
|
||||
aloeGen = new WorldGenBOPFlowers(Blocks.flowers.get().blockID, 12);
|
||||
|
@ -429,7 +429,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator
|
|||
duneGrassGen = new WorldGenBOPFlowers(Blocks.plants.get().blockID, 3);
|
||||
holyTallGrassGen = new WorldGenBOPFlowers(Blocks.plants.get().blockID, 4);
|
||||
desertSproutsGen = new WorldGenBOPFlowers(Blocks.plants.get().blockID, 2);
|
||||
poisonIvyGen = new WorldGenBush(Blocks.foliage.get().blockID, 7);
|
||||
poisonIvyGen = new WorldGenBOPBush(Blocks.foliage.get().blockID, 7);
|
||||
sunflowerGen = new WorldGenSunflower(Blocks.flowers.get().blockID, 13);
|
||||
promisedWillowGen = new WorldGenPromisedWillow();
|
||||
netherVineGen = new WorldGenNetherVines();
|
||||
|
|
|
@ -5,9 +5,9 @@ import java.util.Random;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.gen.feature.WorldGenTallGrass;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import biomesoplenty.api.Blocks;
|
||||
import biomesoplenty.worldgen.WorldGenBOPTallGrass;
|
||||
|
||||
public class BiomeGenPasture extends BiomeGenBase
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ public class BiomeGenPasture extends BiomeGenBase
|
|||
@Override
|
||||
public WorldGenerator getRandomWorldGenForGrass(Random par1Random)
|
||||
{
|
||||
return new WorldGenTallGrass(Blocks.plants.get().blockID, 6);
|
||||
return new WorldGenBOPTallGrass(Blocks.plants.get().blockID, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.world.biome.BiomeGenBase;
|
|||
import net.minecraft.world.gen.feature.WorldGenTallGrass;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import biomesoplenty.api.Blocks;
|
||||
import biomesoplenty.worldgen.WorldGenBOPTallGrass;
|
||||
|
||||
public class BiomeGenPastureMeadow extends BiomeGenBase
|
||||
{
|
||||
|
@ -51,7 +52,7 @@ public class BiomeGenPastureMeadow extends BiomeGenBase
|
|||
@Override
|
||||
public WorldGenerator getRandomWorldGenForGrass(Random par1Random)
|
||||
{
|
||||
return par1Random.nextInt(8) == 0 ? new WorldGenTallGrass(Blocks.plants.get().blockID, 6) : new WorldGenTallGrass(Block.tallGrass.blockID, 1);
|
||||
return par1Random.nextInt(8) == 0 ? new WorldGenTallGrass(Blocks.plants.get().blockID, 6) : new WorldGenBOPTallGrass(Block.tallGrass.blockID, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.world.biome.BiomeGenBase;
|
|||
import net.minecraft.world.gen.feature.WorldGenTallGrass;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import biomesoplenty.api.Blocks;
|
||||
import biomesoplenty.worldgen.WorldGenBOPTallGrass;
|
||||
|
||||
public class BiomeGenPastureThin extends BiomeGenBase
|
||||
{
|
||||
|
@ -50,7 +51,7 @@ public class BiomeGenPastureThin extends BiomeGenBase
|
|||
@Override
|
||||
public WorldGenerator getRandomWorldGenForGrass(Random par1Random)
|
||||
{
|
||||
return par1Random.nextInt(3) == 0 ? new WorldGenTallGrass(Block.tallGrass.blockID, 1) : new WorldGenTallGrass(Blocks.plants.get().blockID, 6);
|
||||
return par1Random.nextInt(3) == 0 ? new WorldGenTallGrass(Block.tallGrass.blockID, 1) : new WorldGenBOPTallGrass(Blocks.plants.get().blockID, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -109,6 +109,8 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
|
|||
return blockID == Blocks.holyGrass.get().blockID;
|
||||
else if (metadata == 5)
|
||||
return blockID == Block.grass.blockID || blockID == Block.dirt.blockID || blockID == Block.slowSand.blockID;
|
||||
else if (metadata == 6)
|
||||
return blockID == Block.grass.blockID || blockID == Block.dirt.blockID;
|
||||
else if (metadata == 7)
|
||||
return blockID == Block.grass.blockID;
|
||||
else if (metadata == 8)
|
||||
|
@ -150,6 +152,9 @@ public class BlockBOPPlant extends BlockFlower implements IShearable
|
|||
|
||||
case 5: // Thorns
|
||||
return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.slowSand.blockID;
|
||||
|
||||
case 6: // Barley
|
||||
return id == Block.grass.blockID || id == Block.dirt.blockID;
|
||||
|
||||
case 7: // Cattail
|
||||
return id != Block.grass.blockID ? false : (world.getBlockMaterial(x - 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x + 1, y - 1, z) == Material.water ? true : (world.getBlockMaterial(x, y - 1, z - 1) == Material.water ? true : world.getBlockMaterial(x, y - 1, z + 1) == Material.water)));
|
||||
|
|
40
src/minecraft/biomesoplenty/worldgen/WorldGenBOPBush.java
Normal file
40
src/minecraft/biomesoplenty/worldgen/WorldGenBOPBush.java
Normal file
|
@ -0,0 +1,40 @@
|
|||
package biomesoplenty.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
public class WorldGenBOPBush extends WorldGenerator
|
||||
{
|
||||
/** The ID of the plant block used in this plant generator. */
|
||||
private int plantBlockId;
|
||||
private int plantBlockMeta;
|
||||
|
||||
public WorldGenBOPBush(int par1, int meta)
|
||||
{
|
||||
plantBlockId = par1;
|
||||
plantBlockMeta = meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
|
||||
{
|
||||
for (int var6 = 0; var6 < 64; ++var6)
|
||||
{
|
||||
int x = par3 + par2Random.nextInt(8) - par2Random.nextInt(8);
|
||||
int y = par4 + par2Random.nextInt(4) - par2Random.nextInt(4);
|
||||
int z = par5 + par2Random.nextInt(8) - par2Random.nextInt(8);
|
||||
|
||||
if (par1World.isAirBlock(x, y, z) && !par1World.provider.hasNoSky && Block.blocksList[plantBlockId].canPlaceBlockOnSide(par1World, x, y, z, 1, new ItemStack(plantBlockId, 1, plantBlockMeta)))
|
||||
{
|
||||
par1World.setBlock(x, y, z, plantBlockId, plantBlockMeta, 2);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package biomesoplenty.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
public class WorldGenBOPTallGrass extends WorldGenerator
|
||||
{
|
||||
/** Stores ID for WorldGenTallGrass */
|
||||
private int tallGrassID;
|
||||
private int tallGrassMetadata;
|
||||
|
||||
public WorldGenBOPTallGrass(int par1, int par2)
|
||||
{
|
||||
this.tallGrassID = par1;
|
||||
this.tallGrassMetadata = par2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
|
||||
{
|
||||
int l;
|
||||
|
||||
Block block = null;
|
||||
do
|
||||
{
|
||||
block = Block.blocksList[par1World.getBlockId(par3, par4, par5)];
|
||||
if (block != null && !block.isLeaves(par1World, par3, par4, par5))
|
||||
{
|
||||
break;
|
||||
}
|
||||
par4--;
|
||||
} while (par4 > 0);
|
||||
|
||||
for (int i1 = 0; i1 < 128; ++i1)
|
||||
{
|
||||
int j1 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8);
|
||||
int k1 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4);
|
||||
int l1 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8);
|
||||
|
||||
if (par1World.isAirBlock(j1, k1, l1) && Block.blocksList[tallGrassID].canPlaceBlockOnSide(par1World, j1, k1, l1, 1, new ItemStack(tallGrassID, 1, tallGrassMetadata)))
|
||||
{
|
||||
par1World.setBlock(j1, k1, l1, this.tallGrassID, this.tallGrassMetadata, 2);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue