Readded the Redwood Forest
This commit is contained in:
parent
17e9f65897
commit
067f6f5cac
4 changed files with 562 additions and 58 deletions
|
@ -1,68 +1,77 @@
|
||||||
package biomesoplenty.common.biomes;
|
package biomesoplenty.common.biomes;
|
||||||
|
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import java.util.HashMap;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenShrub;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||||
|
import biomesoplenty.api.BOPBlockHelper;
|
||||||
|
import biomesoplenty.common.world.features.WorldGenBOPTallGrass;
|
||||||
|
import biomesoplenty.common.world.features.trees.WorldGenRedwoodTree;
|
||||||
|
import biomesoplenty.common.world.features.trees.WorldGenRedwoodTree2;
|
||||||
|
|
||||||
public class BiomeGenRedwoodForest extends BOPBiome
|
public class BiomeGenRedwoodForest extends BOPBiome
|
||||||
{
|
{
|
||||||
|
|
||||||
public BiomeGenRedwoodForest(int par1)
|
public BiomeGenRedwoodForest(int id)
|
||||||
{
|
{
|
||||||
super(par1);
|
super(id);
|
||||||
/*
|
|
||||||
theBiomeDecorator = new BiomeDecoratorBOP(this);
|
|
||||||
customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator;
|
|
||||||
customBiomeDecorator.treesPerChunk = 75;
|
|
||||||
customBiomeDecorator.grassPerChunk = 16;
|
|
||||||
customBiomeDecorator.bushesPerChunk = 4;
|
|
||||||
customBiomeDecorator.berryBushesPerChunk = 1;
|
|
||||||
customBiomeDecorator.wheatGrassPerChunk = 7;
|
|
||||||
customBiomeDecorator.shrubsPerChunk = 10;
|
|
||||||
customBiomeDecorator.redwoodShrubsPerChunk = 100;
|
|
||||||
customBiomeDecorator.waterReedsPerChunk = 2;
|
|
||||||
customBiomeDecorator.generatePumpkins = false;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
this.theBiomeDecorator.treesPerChunk = 75;
|
||||||
* Gets a WorldGen appropriate for this biome.
|
this.theBiomeDecorator.grassPerChunk = 16;
|
||||||
*/
|
|
||||||
/*
|
|
||||||
@Override
|
|
||||||
public WorldGenerator getRandomWorldGenForTrees(Random par1Random)
|
|
||||||
{
|
|
||||||
return par1Random.nextInt(4) == 0 ? new WorldGenRedwoodTree(false) : (par1Random.nextInt(8) == 0 ? new WorldGenShrub(0,0) : new WorldGenRedwoodTree2(false));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void decorate(World par1World, Random par2Random, int par3, int par4)
|
|
||||||
{
|
|
||||||
super.decorate(par1World, par2Random, par3, par4);
|
|
||||||
int var5 = 3 + par2Random.nextInt(6);
|
|
||||||
|
|
||||||
for (int var6 = 0; var6 < var5; ++var6)
|
this.bopWorldFeatures.bushesPerChunk = 4;
|
||||||
{
|
this.bopWorldFeatures.berryBushesPerChunk = 1;
|
||||||
int var7 = par3 + par2Random.nextInt(16);
|
this.bopWorldFeatures.shrubsPerChunk = 10;
|
||||||
int var8 = par2Random.nextInt(28) + 4;
|
this.bopWorldFeatures.waterReedsPerChunk = 2;
|
||||||
int var9 = par4 + par2Random.nextInt(16);
|
this.bopWorldFeatures.generatePumpkins = false;
|
||||||
int var10 = par1World.getBlockId(var7, var8, var9);
|
}
|
||||||
|
|
||||||
Block block = Block.blocksList[var10];
|
@Override
|
||||||
if (block != null && block.isGenMineableReplaceable(par1World, var7, var8, var9, Block.stone.blockID))
|
//TODO: getRandomWorldGenForTrees()
|
||||||
{
|
public WorldGenAbstractTree func_150567_a(Random random)
|
||||||
par1World.setBlock(var7, var8, var9, Block.oreEmerald.blockID, 0, 2);
|
{
|
||||||
}
|
return random.nextInt(4) == 0 ? new WorldGenRedwoodTree(BOPBlockHelper.get("logs3"), BOPBlockHelper.get("colorizedLeaves1"), 0, 3, false, 40, 10) : (random.nextInt(8) == 0 ? new WorldGenShrub(0,0) : new WorldGenRedwoodTree2(BOPBlockHelper.get("logs3"), BOPBlockHelper.get("colorizedLeaves1"), 0, 3, false, 20, 15));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a WorldGen appropriate for this biome.
|
@Override
|
||||||
*/
|
public HashMap<WorldGenerator, Double> getWeightedWorldGenForGrass()
|
||||||
/*
|
{
|
||||||
@Override
|
HashMap<WorldGenerator, Double> grassMap = new HashMap();
|
||||||
public WorldGenerator getRandomWorldGenForGrass(Random par1Random)
|
|
||||||
{
|
grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 10), 0.5D);
|
||||||
return par1Random.nextInt(4) == 0 ? new WorldGenTallGrass(Block.tallGrass.blockID, 2) : new WorldGenTallGrass(Block.tallGrass.blockID, 1);
|
grassMap.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("foliage"), 11), 0.5D);
|
||||||
}
|
grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 2), 0.5D);
|
||||||
*/
|
grassMap.put(new WorldGenBOPTallGrass(Blocks.tallgrass, 1), 1D);
|
||||||
|
|
||||||
|
return grassMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void decorate(World world, Random random, int chunkX, int chunkZ)
|
||||||
|
{
|
||||||
|
super.decorate(world, random, chunkX, chunkZ);
|
||||||
|
int var5 = 12 + random.nextInt(6);
|
||||||
|
|
||||||
|
for (int var6 = 0; var6 < var5; ++var6)
|
||||||
|
{
|
||||||
|
int x = chunkX + random.nextInt(16);
|
||||||
|
int y = random.nextInt(28) + 4;
|
||||||
|
int z = chunkZ + random.nextInt(16);
|
||||||
|
|
||||||
|
//TODO: getBlock()
|
||||||
|
Block block = world.func_147439_a(x, y, z);
|
||||||
|
|
||||||
|
if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone))
|
||||||
|
{
|
||||||
|
//TODO: setBlock()
|
||||||
|
world.func_147465_d(x, y, z, BOPBlockHelper.get("gemOre"), 0, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ import biomesoplenty.common.biomes.BiomeGenPasture;
|
||||||
import biomesoplenty.common.biomes.BiomeGenPrairie;
|
import biomesoplenty.common.biomes.BiomeGenPrairie;
|
||||||
import biomesoplenty.common.biomes.BiomeGenQuagmire;
|
import biomesoplenty.common.biomes.BiomeGenQuagmire;
|
||||||
import biomesoplenty.common.biomes.BiomeGenRainforest;
|
import biomesoplenty.common.biomes.BiomeGenRainforest;
|
||||||
|
import biomesoplenty.common.biomes.BiomeGenRedwoodForest;
|
||||||
import biomesoplenty.common.biomes.BiomeGenSacredSprings;
|
import biomesoplenty.common.biomes.BiomeGenSacredSprings;
|
||||||
import biomesoplenty.common.biomes.BiomeGenShrubland;
|
import biomesoplenty.common.biomes.BiomeGenShrubland;
|
||||||
import biomesoplenty.common.biomes.BiomeGenThicket;
|
import biomesoplenty.common.biomes.BiomeGenThicket;
|
||||||
|
@ -131,7 +132,7 @@ public class BOPBiomes
|
||||||
registerBiome(new BOPBiomeListEntry(new BiomeGenPrairie(BOPConfigurationIDs.prairieID).setBiomeName("Prairie"), BOPBiomeTemperatureType.WARM));
|
registerBiome(new BOPBiomeListEntry(new BiomeGenPrairie(BOPConfigurationIDs.prairieID).setBiomeName("Prairie"), BOPBiomeTemperatureType.WARM));
|
||||||
registerBiome(new BOPBiomeListEntry(new BiomeGenQuagmire(BOPConfigurationIDs.quagmireID).setBiomeName("Quagmire"), BOPBiomeTemperatureType.WARM));
|
registerBiome(new BOPBiomeListEntry(new BiomeGenQuagmire(BOPConfigurationIDs.quagmireID).setBiomeName("Quagmire"), BOPBiomeTemperatureType.WARM));
|
||||||
registerBiome(new BOPBiomeListEntry(new BiomeGenRainforest(BOPConfigurationIDs.rainforestID).setBiomeName("Rainforest"), BOPBiomeTemperatureType.WARM));
|
registerBiome(new BOPBiomeListEntry(new BiomeGenRainforest(BOPConfigurationIDs.rainforestID).setBiomeName("Rainforest"), BOPBiomeTemperatureType.WARM));
|
||||||
/*registerBiome(new BOPBiomeListEntry(new BiomeGenRedwoodForest(BOPConfigurationIDs.redwoodForestID).setBiomeName("Redwood Forest"), BOPBiomeTemperatureType.WARM));*/
|
registerBiome(new BOPBiomeListEntry(new BiomeGenRedwoodForest(BOPConfigurationIDs.redwoodForestID).setBiomeName("Redwood Forest"), BOPBiomeTemperatureType.WARM));
|
||||||
registerBiome(new BOPBiomeListEntry(new BiomeGenSacredSprings(BOPConfigurationIDs.sacredSpringsID).setBiomeName("Sacred Springs"), BOPBiomeTemperatureType.WARM));
|
registerBiome(new BOPBiomeListEntry(new BiomeGenSacredSprings(BOPConfigurationIDs.sacredSpringsID).setBiomeName("Sacred Springs"), BOPBiomeTemperatureType.WARM));
|
||||||
/*registerBiome(new BOPBiomeListEntry(new BiomeGenSeasonalForest(BOPConfigurationIDs.seasonalForestID).setBiomeName("Seasonal Forest"), BOPBiomeTemperatureType.COOL));
|
/*registerBiome(new BOPBiomeListEntry(new BiomeGenSeasonalForest(BOPConfigurationIDs.seasonalForestID).setBiomeName("Seasonal Forest"), BOPBiomeTemperatureType.COOL));
|
||||||
registerBiome(new BOPBiomeListEntry(new BiomeGenShield(BOPConfigurationIDs.shieldID).setBiomeName("Shield"), BOPBiomeTemperatureType.COOL));*/
|
registerBiome(new BOPBiomeListEntry(new BiomeGenShield(BOPConfigurationIDs.shieldID).setBiomeName("Shield"), BOPBiomeTemperatureType.COOL));*/
|
||||||
|
|
|
@ -0,0 +1,260 @@
|
||||||
|
package biomesoplenty.common.world.features.trees;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import biomesoplenty.api.BOPBlockHelper;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockSapling;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
public class WorldGenRedwoodTree extends WorldGenAbstractTree
|
||||||
|
{
|
||||||
|
private final Block wood;
|
||||||
|
private final Block leaves;
|
||||||
|
|
||||||
|
private final int woodMeta;
|
||||||
|
private final int leavesMeta;
|
||||||
|
|
||||||
|
private final int minTreeHeight;
|
||||||
|
private final int randomTreeHeight;
|
||||||
|
|
||||||
|
public WorldGenRedwoodTree(Block wood, Block leaves, int woodMeta, int leavesMeta, boolean doBlockNotify, int minTreeHeight, int randomTreeHeight)
|
||||||
|
{
|
||||||
|
super(doBlockNotify);
|
||||||
|
|
||||||
|
this.wood = wood;
|
||||||
|
this.leaves = leaves;
|
||||||
|
|
||||||
|
this.woodMeta = woodMeta;
|
||||||
|
this.leavesMeta = leavesMeta;
|
||||||
|
|
||||||
|
this.minTreeHeight = minTreeHeight;
|
||||||
|
this.randomTreeHeight = randomTreeHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean generate(World world, Random random, int x, int y, int z)
|
||||||
|
{
|
||||||
|
int l = random.nextInt(this.randomTreeHeight) + this.minTreeHeight;
|
||||||
|
boolean flag = true;
|
||||||
|
|
||||||
|
if (y >= 1 && y + l + 1 <= 256)
|
||||||
|
{
|
||||||
|
byte b0;
|
||||||
|
int k1;
|
||||||
|
Block block;
|
||||||
|
|
||||||
|
for (int i1 = y; i1 <= y + 1 + l; ++i1)
|
||||||
|
{
|
||||||
|
b0 = 7;
|
||||||
|
|
||||||
|
if (i1 == y)
|
||||||
|
{
|
||||||
|
b0 = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i1 >= y + 1 + l - 2)
|
||||||
|
{
|
||||||
|
b0 = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j1 = x - b0; j1 <= x + b0 && flag; ++j1)
|
||||||
|
{
|
||||||
|
for (k1 = z - b0; k1 <= z + b0 && flag; ++k1)
|
||||||
|
{
|
||||||
|
if (i1 >= 0 && i1 < 256)
|
||||||
|
{
|
||||||
|
block = world.func_147439_a(j1, i1, k1);
|
||||||
|
|
||||||
|
if (!this.isReplaceable(world, j1, i1, k1))
|
||||||
|
{
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!flag)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
boolean isSoil = true;
|
||||||
|
boolean hasSpace = true;
|
||||||
|
|
||||||
|
for (int ix = -3; ix <= 3; ix++)
|
||||||
|
{
|
||||||
|
for (int iz = -3; iz <= 3; iz++)
|
||||||
|
{
|
||||||
|
Block block2 = world.func_147439_a(x + ix, y - 1, z + iz);
|
||||||
|
|
||||||
|
if (!block2.canSustainPlant(world, x + ix, y - 1, z + iz, ForgeDirection.UP, (BlockSapling)Blocks.sapling))
|
||||||
|
{
|
||||||
|
isSoil = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int ix = -3; ix <= 3; ix++)
|
||||||
|
{
|
||||||
|
for (int iy = 0; iy <= l; iy++)
|
||||||
|
{
|
||||||
|
for (int iz = -3; iz <= 3; iz++)
|
||||||
|
{
|
||||||
|
Block block2 = world.func_147439_a(x + ix, y + iy, z + iz);
|
||||||
|
|
||||||
|
if (!block2.isAir(world, x + ix, y + iy, z + iz))
|
||||||
|
{
|
||||||
|
hasSpace = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSoil && hasSpace && y < 256 - l - 1)
|
||||||
|
{
|
||||||
|
for (int ix = -3; ix <= 3; ix++)
|
||||||
|
{
|
||||||
|
for (int iz = -3; iz <= 3; iz++)
|
||||||
|
{
|
||||||
|
if (((ix != -3 && ix != 3) || (iz >= -1 && iz <= 1)) && ((iz != -3 && iz != 3) || (ix >= -1 && ix <= 1)))
|
||||||
|
{
|
||||||
|
Block block2 = world.func_147439_a(x + ix, y - 1, z + iz);
|
||||||
|
|
||||||
|
block2.onPlantGrow(world, x + ix, y - 1, z + iz, x + ix, y - 1, z + iz);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
b0 = 9;
|
||||||
|
byte b1 = 0;
|
||||||
|
int l1;
|
||||||
|
int i2;
|
||||||
|
int j2;
|
||||||
|
int i3;
|
||||||
|
|
||||||
|
for (k1 = y - b0 + l; k1 <= y + l; ++k1)
|
||||||
|
{
|
||||||
|
i3 = k1 - (y + l);
|
||||||
|
l1 = b1 + 1 - i3 / 4;
|
||||||
|
|
||||||
|
for (i2 = x - l1; i2 <= x + l1; ++i2)
|
||||||
|
{
|
||||||
|
j2 = i2 - x;
|
||||||
|
|
||||||
|
for (int k2 = z - l1; k2 <= z + l1; ++k2)
|
||||||
|
{
|
||||||
|
int l2 = k2 - z;
|
||||||
|
|
||||||
|
if (Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0 && i3 != 0)
|
||||||
|
{
|
||||||
|
Block block1 = world.func_147439_a(i2, k1, k2);
|
||||||
|
|
||||||
|
if (block1.isAir(world, i2, k1, k2) || block1.isLeaves(world, i2, k1, k2))
|
||||||
|
{
|
||||||
|
//TODO: setBlockAndMetadata()
|
||||||
|
this.func_150516_a(world, i2, k1, k2, this.leaves, this.leavesMeta);
|
||||||
|
this.func_150516_a(world, i2, k1 + 6, k2, this.leaves, this.leavesMeta);
|
||||||
|
this.func_150516_a(world, i2, k1 + 10, k2, this.leaves, this.leavesMeta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (k1 = 0; k1 < l; ++k1)
|
||||||
|
{
|
||||||
|
block = world.func_147439_a(x, y + k1, z);
|
||||||
|
|
||||||
|
if (block.isAir(world, x, y + k1, z) || block.isLeaves(world, x, y + k1, z))
|
||||||
|
{
|
||||||
|
//1
|
||||||
|
this.func_150516_a(world, x, y + (l), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (l + 1), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (l + 2), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (l + 3), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (l), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (l), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + k1, z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x - 1, y + k1, z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 1, y + k1, z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + k1, z - 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + k1, z + 1, this.wood, this.woodMeta);
|
||||||
|
|
||||||
|
//2
|
||||||
|
this.func_150516_a(world, x - 1, y + (k1 / 2), z - 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 1, y + (k1 / 2), z - 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x - 1, y + (k1 / 2), z + 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 1, y + (k1 / 2), z + 1, this.wood, this.woodMeta);
|
||||||
|
|
||||||
|
//3
|
||||||
|
this.func_150516_a(world, x - 2, y + (k1 / 4), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x - 2, y + (k1 / 4), z - 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x - 2, y + (k1 / 4), z + 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 2, y + (k1 / 4), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 2, y + (k1 / 4), z - 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 2, y + (k1 / 4), z + 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (k1 / 4), z - 2, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x - 1, y + (k1 / 4), z - 2, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 1, y + (k1 / 4), z - 2, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (k1 / 4), z + 2, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x - 1, y + (k1 / 4), z + 2, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 1, y + (k1 / 4), z + 2, this.wood, this.woodMeta);
|
||||||
|
|
||||||
|
//4
|
||||||
|
this.func_150516_a(world, x - 2, y + (k1 / 6), z - 2, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 2, y + (k1 / 6), z + 2, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 2, y + (k1 / 6), z - 2, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x - 2, y + (k1 / 6), z + 2, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x - 3, y + (k1 / 6), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 3, y + (k1 / 6), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (k1 / 6), z - 3, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (k1 / 6), z + 3, this.wood, this.woodMeta);
|
||||||
|
|
||||||
|
//5
|
||||||
|
this.func_150516_a(world, x - 3, y + (k1 / 8), z - 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x - 3, y + (k1 / 8), z + 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 3, y + (k1 / 8), z - 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 3, y + (k1 / 8), z + 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x - 1, y + (k1 / 8), z - 3, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 1, y + (k1 / 8), z - 3, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x - 1, y + (k1 / 8), z + 3, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 1, y + (k1 / 8), z + 3, this.wood, this.woodMeta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 90; ++i)
|
||||||
|
{
|
||||||
|
int randX = x + random.nextInt(8);
|
||||||
|
int randY = random.nextInt(50) + 70;
|
||||||
|
int randZ = z + random.nextInt(8);
|
||||||
|
new WorldGenBOPShrub(BOPBlockHelper.get("logs3"), BOPBlockHelper.get("colorizedLeaves1"), 0, 3, BOPBlockHelper.get("logs3")).generate(world, random, randX, randY, randZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,234 @@
|
||||||
|
package biomesoplenty.common.world.features.trees;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import biomesoplenty.api.BOPBlockHelper;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockSapling;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
public class WorldGenRedwoodTree2 extends WorldGenAbstractTree
|
||||||
|
{
|
||||||
|
private final Block wood;
|
||||||
|
private final Block leaves;
|
||||||
|
|
||||||
|
private final int woodMeta;
|
||||||
|
private final int leavesMeta;
|
||||||
|
|
||||||
|
private final int minTreeHeight;
|
||||||
|
private final int randomTreeHeight;
|
||||||
|
|
||||||
|
public WorldGenRedwoodTree2(Block wood, Block leaves, int woodMeta, int leavesMeta, boolean doBlockNotify, int minTreeHeight, int randomTreeHeight)
|
||||||
|
{
|
||||||
|
super(doBlockNotify);
|
||||||
|
|
||||||
|
this.wood = wood;
|
||||||
|
this.leaves = leaves;
|
||||||
|
|
||||||
|
this.woodMeta = woodMeta;
|
||||||
|
this.leavesMeta = leavesMeta;
|
||||||
|
|
||||||
|
this.minTreeHeight = minTreeHeight;
|
||||||
|
this.randomTreeHeight = randomTreeHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean generate(World world, Random random, int x, int y, int z)
|
||||||
|
{
|
||||||
|
int l = random.nextInt(this.randomTreeHeight) + this.minTreeHeight;
|
||||||
|
boolean flag = true;
|
||||||
|
|
||||||
|
if (y >= 1 && y + l + 1 <= 256)
|
||||||
|
{
|
||||||
|
byte b0;
|
||||||
|
int k1;
|
||||||
|
Block block;
|
||||||
|
|
||||||
|
for (int i1 = y; i1 <= y + 1 + l; ++i1)
|
||||||
|
{
|
||||||
|
b0 = 5;
|
||||||
|
|
||||||
|
if (i1 == y)
|
||||||
|
{
|
||||||
|
b0 = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i1 >= y + 1 + l - 2)
|
||||||
|
{
|
||||||
|
b0 = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j1 = x - b0; j1 <= x + b0 && flag; ++j1)
|
||||||
|
{
|
||||||
|
for (k1 = z - b0; k1 <= z + b0 && flag; ++k1)
|
||||||
|
{
|
||||||
|
if (i1 >= 0 && i1 < 256)
|
||||||
|
{
|
||||||
|
block = world.func_147439_a(j1, i1, k1);
|
||||||
|
|
||||||
|
if (!this.isReplaceable(world, j1, i1, k1))
|
||||||
|
{
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!flag)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
boolean isSoil = true;
|
||||||
|
boolean hasSpace = true;
|
||||||
|
|
||||||
|
for (int ix = -2; ix <= 2; ix++)
|
||||||
|
{
|
||||||
|
for (int iz = -2; iz <= 2; iz++)
|
||||||
|
{
|
||||||
|
Block block2 = world.func_147439_a(x + ix, y - 1, z + iz);
|
||||||
|
|
||||||
|
if (!block2.canSustainPlant(world, x + ix, y - 1, z + iz, ForgeDirection.UP, (BlockSapling)Blocks.sapling))
|
||||||
|
{
|
||||||
|
isSoil = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int ix = -2; ix <= 2; ix++)
|
||||||
|
{
|
||||||
|
for (int iy = 0; iy <= l; iy++)
|
||||||
|
{
|
||||||
|
for (int iz = -2; iz <= 2; iz++)
|
||||||
|
{
|
||||||
|
Block block2 = world.func_147439_a(x + ix, y + iy, z + iz);
|
||||||
|
|
||||||
|
if (!block2.isAir(world, x + ix, y + iy, z + iz))
|
||||||
|
{
|
||||||
|
hasSpace = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSoil && hasSpace && y < 256 - l - 1)
|
||||||
|
{
|
||||||
|
for (int ix = -2; ix <= 2; ix++)
|
||||||
|
{
|
||||||
|
for (int iz = -2; iz <= 3; iz++)
|
||||||
|
{
|
||||||
|
if (((ix != -2 && ix != 2) || (iz == 0)) && ((iz != -2 && iz != 2) || (ix == 0)))
|
||||||
|
{
|
||||||
|
Block block2 = world.func_147439_a(x + ix, y - 1, z + iz);
|
||||||
|
|
||||||
|
block2.onPlantGrow(world, x + ix, y - 1, z + iz, x + ix, y - 1, z + iz);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
b0 = 9;
|
||||||
|
byte b1 = 0;
|
||||||
|
int l1;
|
||||||
|
int i2;
|
||||||
|
int j2;
|
||||||
|
int i3;
|
||||||
|
|
||||||
|
for (k1 = y - b0 + l; k1 <= y + l; ++k1)
|
||||||
|
{
|
||||||
|
i3 = k1 - (y + l);
|
||||||
|
l1 = b1 + 1 - i3 / 6;
|
||||||
|
|
||||||
|
for (i2 = x - l1; i2 <= x + l1; ++i2)
|
||||||
|
{
|
||||||
|
j2 = i2 - x;
|
||||||
|
|
||||||
|
for (int k2 = z - l1; k2 <= z + l1; ++k2)
|
||||||
|
{
|
||||||
|
int l2 = k2 - z;
|
||||||
|
|
||||||
|
if (Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0 && i3 != 0)
|
||||||
|
{
|
||||||
|
Block block1 = world.func_147439_a(i2, k1, k2);
|
||||||
|
|
||||||
|
if (block1.isAir(world, i2, k1, k2) || block1.isLeaves(world, i2, k1, k2))
|
||||||
|
{
|
||||||
|
//TODO: setBlockAndMetadata()
|
||||||
|
this.func_150516_a(world, i2, k1, k2, this.leaves, this.leavesMeta);
|
||||||
|
this.func_150516_a(world, i2, k1 + 6, k2, this.leaves, this.leavesMeta);
|
||||||
|
this.func_150516_a(world, i2, k1 + 12, k2, this.leaves, this.leavesMeta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (k1 = 0; k1 < l; ++k1)
|
||||||
|
{
|
||||||
|
block = world.func_147439_a(x, y + k1, z);
|
||||||
|
|
||||||
|
if (block.isAir(world, x, y + k1, z) || block.isLeaves(world, x, y + k1, z))
|
||||||
|
{
|
||||||
|
//1
|
||||||
|
this.func_150516_a(world, x, y + (l), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (l + 1), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (l + 2), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (l + 3), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (l + 4), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (l + 5), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + k1, z, this.wood, this.woodMeta);
|
||||||
|
|
||||||
|
//2
|
||||||
|
this.func_150516_a(world, x - 1, y + (k1 / 2), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 1, y + (k1 / 2), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (k1 / 2), z - 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (k1 / 2), z + 1, this.wood, this.woodMeta);
|
||||||
|
|
||||||
|
//3
|
||||||
|
this.func_150516_a(world, x - 1, y + (k1 / 4), z - 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 1, y + (k1 / 4), z - 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x - 1, y + (k1 / 4), z + 1, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 1, y + (k1 / 4), z + 1, this.wood, this.woodMeta);
|
||||||
|
|
||||||
|
//4
|
||||||
|
this.func_150516_a(world, x - 2, y + (k1 / 8), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x + 2, y + (k1 / 8), z, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (k1 / 8), z - 2, this.wood, this.woodMeta);
|
||||||
|
this.func_150516_a(world, x, y + (k1 / 8), z + 2, this.wood, this.woodMeta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 90; ++i)
|
||||||
|
{
|
||||||
|
int randX = x + random.nextInt(8);
|
||||||
|
int randY = random.nextInt(50) + 70;
|
||||||
|
int randZ = z + random.nextInt(8);
|
||||||
|
new WorldGenBOPShrub(BOPBlockHelper.get("logs3"), BOPBlockHelper.get("colorizedLeaves1"), 0, 3, BOPBlockHelper.get("logs3")).generate(world, random, randX, randY, randZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue