Added bamboo saplings, bonemeal now creates the appropriate giant flowers when used on red and yellow flowers
This commit is contained in:
parent
ae8be6fed8
commit
604d875f22
6 changed files with 499 additions and 0 deletions
Binary file not shown.
After Width: | Height: | Size: 392 B |
172
src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooSapling.java
Normal file
172
src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooSapling.java
Normal file
|
@ -0,0 +1,172 @@
|
||||||
|
package tdwp_ftw.biomesop.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockSapling;
|
||||||
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.Icon;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||||
|
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
|
||||||
|
import tdwp_ftw.biomesop.worldgen.WorldGenBambooTree;
|
||||||
|
import tdwp_ftw.biomesop.worldgen.WorldGenBambooTree2;
|
||||||
|
import tdwp_ftw.biomesop.worldgen.WorldGenOminous1;
|
||||||
|
|
||||||
|
public class BlockBambooSapling extends BlockSapling
|
||||||
|
{
|
||||||
|
public static final String[] WOOD_TYPES = new String[] {"dark"};
|
||||||
|
private Icon[] blockIcon = new Icon[1];
|
||||||
|
|
||||||
|
public BlockBambooSapling(int par1)
|
||||||
|
{
|
||||||
|
super(par1);
|
||||||
|
float var3 = 0.4F;
|
||||||
|
this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var3 * 2.0F, 0.5F + var3);
|
||||||
|
this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerIcons(IconRegister par1IconRegister)
|
||||||
|
{
|
||||||
|
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:bamboosapling");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Icon getBlockTextureFromSideAndMetadata(int par1, int par2)
|
||||||
|
{
|
||||||
|
return this.blockIcon[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ticks the block if it's been scheduled
|
||||||
|
*/
|
||||||
|
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
|
||||||
|
{
|
||||||
|
if (!par1World.isRemote)
|
||||||
|
{
|
||||||
|
super.updateTick(par1World, par2, par3, par4, par5Random);
|
||||||
|
|
||||||
|
if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9 && par5Random.nextInt(7) == 0)
|
||||||
|
{
|
||||||
|
int var6 = par1World.getBlockMetadata(par2, par3, par4);
|
||||||
|
|
||||||
|
if ((var6 & 8) == 0)
|
||||||
|
{
|
||||||
|
par1World.setBlock(par2, par3, par4, var6 | 8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.growTree(par1World, par2, par3, par4, par5Random);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
|
||||||
|
*/
|
||||||
|
/*public int getBlockTextureFromSideAndMetadata(int par1, int par2)
|
||||||
|
{
|
||||||
|
par2 &= 3;
|
||||||
|
return par2 == 1 ? 63 : (par2 == 2 ? 79 : (par2 == 3 ? 30 : super.getBlockTextureFromSideAndMetadata(par1, par2)));
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to grow a sapling into a tree
|
||||||
|
*/
|
||||||
|
public void growTree(World par1World, int par2, int par3, int par4, Random par5Random)
|
||||||
|
{
|
||||||
|
int var6 = par1World.getBlockMetadata(par2, par3, par4) & 3;
|
||||||
|
Object var7 = null;
|
||||||
|
int var8 = 0;
|
||||||
|
int var9 = 0;
|
||||||
|
int var99 = par5Random.nextInt(8);
|
||||||
|
boolean var10 = false;
|
||||||
|
|
||||||
|
for (var8 = 0; var8 >= -1; --var8)
|
||||||
|
{
|
||||||
|
for (var9 = 0; var9 >= -1; --var9)
|
||||||
|
{
|
||||||
|
if (this.isSameSapling(par1World, par2 + var8, par3, par4 + var9, 0) && this.isSameSapling(par1World, par2 + var8 + 1, par3, par4 + var9, 0) && this.isSameSapling(par1World, par2 + var8, par3, par4 + var9 + 1, 0) && this.isSameSapling(par1World, par2 + var8 + 1, par3, par4 + var9 + 1, 0))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (var7 != null)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (var7 == null)
|
||||||
|
{
|
||||||
|
var9 = 0;
|
||||||
|
var8 = 0;
|
||||||
|
var99 = par5Random.nextInt(8);
|
||||||
|
|
||||||
|
if (var99 == 0)
|
||||||
|
{
|
||||||
|
var7 = new WorldGenBambooTree(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var7 = new WorldGenBambooTree2(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (var10)
|
||||||
|
{
|
||||||
|
par1World.setBlock(par2 + var8, par3, par4 + var9, 0);
|
||||||
|
par1World.setBlock(par2 + var8 + 1, par3, par4 + var9, 0);
|
||||||
|
par1World.setBlock(par2 + var8, par3, par4 + var9 + 1, 0);
|
||||||
|
par1World.setBlock(par2 + var8 + 1, par3, par4 + var9 + 1, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
par1World.setBlock(par2, par3, par4, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!((WorldGenerator)var7).generate(par1World, par5Random, par2 + var8, par3, par4 + var9))
|
||||||
|
{
|
||||||
|
if (var10)
|
||||||
|
{
|
||||||
|
par1World.setBlock(par2 + var8, par3, par4 + var9, this.blockID, var6, 2);
|
||||||
|
par1World.setBlock(par2 + var8 + 1, par3, par4 + var9, this.blockID, var6, 2);
|
||||||
|
par1World.setBlock(par2 + var8, par3, par4 + var9 + 1, this.blockID, var6, 2);
|
||||||
|
par1World.setBlock(par2 + var8 + 1, par3, par4 + var9 + 1, this.blockID, var6, 2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
par1World.setBlock(par2, par3, par4, this.blockID, var6, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if the same sapling is present at the given location.
|
||||||
|
*/
|
||||||
|
public boolean isSameSapling(World par1World, int par2, int par3, int par4, int par5)
|
||||||
|
{
|
||||||
|
return par1World.getBlockId(par2, par3, par4) == this.blockID && (par1World.getBlockMetadata(par2, par3, par4) & 3) == par5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines the damage on the item the block drops. Used in cloth and wood.
|
||||||
|
*/
|
||||||
|
public int damageDropped(int par1)
|
||||||
|
{
|
||||||
|
return par1 & 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
|
||||||
|
*/
|
||||||
|
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||||
|
{
|
||||||
|
par3List.add(new ItemStack(par1, 1, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -107,6 +107,7 @@ public class BOPBlocks {
|
||||||
public static Block smolderingGrass;
|
public static Block smolderingGrass;
|
||||||
public static Block cragRock;
|
public static Block cragRock;
|
||||||
public static Block quicksand;
|
public static Block quicksand;
|
||||||
|
public static Block bambooSapling;
|
||||||
|
|
||||||
//Redwood
|
//Redwood
|
||||||
public static Block redwoodPlank;
|
public static Block redwoodPlank;
|
||||||
|
@ -282,6 +283,7 @@ public class BOPBlocks {
|
||||||
smolderingGrass = (BlockSmolderingGrass)(new BlockSmolderingGrass(BOPConfiguration.smolderingGrassID)).setHardness(0.6F).setLightValue(0.25F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("smolderingGrass");
|
smolderingGrass = (BlockSmolderingGrass)(new BlockSmolderingGrass(BOPConfiguration.smolderingGrassID)).setHardness(0.6F).setLightValue(0.25F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("smolderingGrass");
|
||||||
cragRock = (new BlockCragRock(BOPConfiguration.cragRockID)).setHardness(1.0F).setStepSound(Block.soundGravelFootstep).setUnlocalizedName("cragRock");
|
cragRock = (new BlockCragRock(BOPConfiguration.cragRockID)).setHardness(1.0F).setStepSound(Block.soundGravelFootstep).setUnlocalizedName("cragRock");
|
||||||
quicksand = (new BlockQuicksand(BOPConfiguration.quicksandID)).setHardness(0.3F).setStepSound(Block.soundSandFootstep).setUnlocalizedName("quicksand");
|
quicksand = (new BlockQuicksand(BOPConfiguration.quicksandID)).setHardness(0.3F).setStepSound(Block.soundSandFootstep).setUnlocalizedName("quicksand");
|
||||||
|
bambooSapling = (new BlockBambooSapling(BOPConfiguration.bambooSaplingID)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("bambooSapling");
|
||||||
|
|
||||||
//Redwood
|
//Redwood
|
||||||
redwoodPlank = (new BlockRedwoodPlank(BOPConfiguration.redwoodPlankID)).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("redwoodPlank");
|
redwoodPlank = (new BlockRedwoodPlank(BOPConfiguration.redwoodPlankID)).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("redwoodPlank");
|
||||||
|
@ -458,6 +460,7 @@ public class BOPBlocks {
|
||||||
GameRegistry.registerBlock(smolderingGrass, "smolderingGrass");
|
GameRegistry.registerBlock(smolderingGrass, "smolderingGrass");
|
||||||
GameRegistry.registerBlock(cragRock, "cragRock");
|
GameRegistry.registerBlock(cragRock, "cragRock");
|
||||||
GameRegistry.registerBlock(quicksand, "quicksand");
|
GameRegistry.registerBlock(quicksand, "quicksand");
|
||||||
|
GameRegistry.registerBlock(bambooSapling, "bambooSapling");
|
||||||
|
|
||||||
GameRegistry.registerBlock(redwoodPlank, "redwoodPlank");
|
GameRegistry.registerBlock(redwoodPlank, "redwoodPlank");
|
||||||
GameRegistry.registerBlock(redwoodWood, "redwoodWood");
|
GameRegistry.registerBlock(redwoodWood, "redwoodWood");
|
||||||
|
@ -833,6 +836,7 @@ public class BOPBlocks {
|
||||||
LanguageRegistry.addName(smolderingGrass, "Smoldering Grass");
|
LanguageRegistry.addName(smolderingGrass, "Smoldering Grass");
|
||||||
LanguageRegistry.addName(cragRock, "Crag Rock");
|
LanguageRegistry.addName(cragRock, "Crag Rock");
|
||||||
LanguageRegistry.addName(quicksand, "Quicksand");
|
LanguageRegistry.addName(quicksand, "Quicksand");
|
||||||
|
LanguageRegistry.addName(bambooSapling, "Bamboo Sapling");
|
||||||
|
|
||||||
LanguageRegistry.addName(redwoodPlank, "Redwood Wood Planks");
|
LanguageRegistry.addName(redwoodPlank, "Redwood Wood Planks");
|
||||||
LanguageRegistry.addName(redwoodWood, "Redwood Wood");
|
LanguageRegistry.addName(redwoodWood, "Redwood Wood");
|
||||||
|
|
|
@ -194,6 +194,7 @@ public class BOPConfiguration {
|
||||||
public static int smolderingGrassID;
|
public static int smolderingGrassID;
|
||||||
public static int cragRockID;
|
public static int cragRockID;
|
||||||
public static int quicksandID;
|
public static int quicksandID;
|
||||||
|
public static int bambooSaplingID;
|
||||||
|
|
||||||
//Redwood
|
//Redwood
|
||||||
public static int redwoodPlankID;
|
public static int redwoodPlankID;
|
||||||
|
@ -671,6 +672,7 @@ public class BOPConfiguration {
|
||||||
algaeID = config.getBlock("Algae ID", 392, null).getInt();
|
algaeID = config.getBlock("Algae ID", 392, null).getInt();
|
||||||
smolderingGrassID = config.getBlock("Smoldering Grass ID", 393, null).getInt();
|
smolderingGrassID = config.getBlock("Smoldering Grass ID", 393, null).getInt();
|
||||||
quicksandID = config.getBlock("Quicksand ID", 394, null).getInt();
|
quicksandID = config.getBlock("Quicksand ID", 394, null).getInt();
|
||||||
|
bambooSaplingID = config.getBlock("Bamboo Sapling ID", 395, null).getInt();
|
||||||
|
|
||||||
// Get Item ID's
|
// Get Item ID's
|
||||||
shroomPowderID = config.getItem("Shroom Powder ID", 1001, null).getInt();
|
shroomPowderID = config.getItem("Shroom Powder ID", 1001, null).getInt();
|
||||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraftforge.event.ForgeSubscribe;
|
||||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||||
import tdwp_ftw.biomesop.blocks.BlockAcaciaSapling;
|
import tdwp_ftw.biomesop.blocks.BlockAcaciaSapling;
|
||||||
import tdwp_ftw.biomesop.blocks.BlockAppleSapling;
|
import tdwp_ftw.biomesop.blocks.BlockAppleSapling;
|
||||||
|
import tdwp_ftw.biomesop.blocks.BlockBambooSapling;
|
||||||
import tdwp_ftw.biomesop.blocks.BlockBrownSapling;
|
import tdwp_ftw.biomesop.blocks.BlockBrownSapling;
|
||||||
import tdwp_ftw.biomesop.blocks.BlockDarkSapling;
|
import tdwp_ftw.biomesop.blocks.BlockDarkSapling;
|
||||||
import tdwp_ftw.biomesop.blocks.BlockFirSapling;
|
import tdwp_ftw.biomesop.blocks.BlockFirSapling;
|
||||||
|
@ -22,6 +23,8 @@ import tdwp_ftw.biomesop.blocks.BlockWhiteSapling;
|
||||||
import tdwp_ftw.biomesop.blocks.BlockWillowSapling;
|
import tdwp_ftw.biomesop.blocks.BlockWillowSapling;
|
||||||
import tdwp_ftw.biomesop.blocks.BlockYellowSapling;
|
import tdwp_ftw.biomesop.blocks.BlockYellowSapling;
|
||||||
import tdwp_ftw.biomesop.configuration.BOPBlocks;
|
import tdwp_ftw.biomesop.configuration.BOPBlocks;
|
||||||
|
import tdwp_ftw.biomesop.worldgen.WorldGenGiantFlowerRed;
|
||||||
|
import tdwp_ftw.biomesop.worldgen.WorldGenGiantFlowerYellow;
|
||||||
|
|
||||||
public class BonemealUse
|
public class BonemealUse
|
||||||
{
|
{
|
||||||
|
@ -251,6 +254,47 @@ public class BonemealUse
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.ID == BOPBlocks.bambooSapling.blockID)
|
||||||
|
{
|
||||||
|
event.setResult(Result.ALLOW);
|
||||||
|
|
||||||
|
if (!event.world.isRemote)
|
||||||
|
{
|
||||||
|
if ((double)event.world.rand.nextFloat() < 0.45D)
|
||||||
|
{
|
||||||
|
((BlockBambooSapling)BOPBlocks.bambooSapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.ID == Block.plantRed.blockID)
|
||||||
|
{
|
||||||
|
event.setResult(Result.ALLOW);
|
||||||
|
|
||||||
|
if (!event.world.isRemote)
|
||||||
|
{
|
||||||
|
if ((double)event.world.rand.nextFloat() < 0.45D)
|
||||||
|
{
|
||||||
|
WorldGenGiantFlowerRed worldgengiantflowerred = new WorldGenGiantFlowerRed();
|
||||||
|
worldgengiantflowerred.generate(event.world, event.world.rand, event.X, event.Y - 1, event.Z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.ID == Block.plantYellow.blockID)
|
||||||
|
{
|
||||||
|
event.setResult(Result.ALLOW);
|
||||||
|
|
||||||
|
if (!event.world.isRemote)
|
||||||
|
{
|
||||||
|
if ((double)event.world.rand.nextFloat() < 0.45D)
|
||||||
|
{
|
||||||
|
WorldGenGiantFlowerYellow worldgengiantfloweryellow = new WorldGenGiantFlowerYellow();
|
||||||
|
worldgengiantfloweryellow.generate(event.world, event.world.rand, event.X, event.Y - 1, event.Z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (event.ID == BOPBlocks.holyGrass.blockID)
|
if (event.ID == BOPBlocks.holyGrass.blockID)
|
||||||
{
|
{
|
||||||
int var13 = event.X;
|
int var13 = event.X;
|
||||||
|
|
|
@ -0,0 +1,277 @@
|
||||||
|
package tdwp_ftw.biomesop.worldgen;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||||
|
import tdwp_ftw.biomesop.configuration.BOPBlocks;
|
||||||
|
|
||||||
|
public class WorldGenBambooTree2 extends WorldGenerator
|
||||||
|
{
|
||||||
|
/** The minimum height of a generated tree. */
|
||||||
|
private final int minTreeHeight;
|
||||||
|
|
||||||
|
/** True if this tree should grow Vines. */
|
||||||
|
private final boolean vinesGrow;
|
||||||
|
|
||||||
|
/** The metadata value of the wood to use in tree generation. */
|
||||||
|
private final int metaWood;
|
||||||
|
|
||||||
|
/** The metadata value of the leaves to use in tree generation. */
|
||||||
|
private final int metaLeaves;
|
||||||
|
|
||||||
|
public WorldGenBambooTree2(boolean par1)
|
||||||
|
{
|
||||||
|
this(par1, 18, 0, 0, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorldGenBambooTree2(boolean par1, int par2, int par3, int par4, boolean par5)
|
||||||
|
{
|
||||||
|
super(par1);
|
||||||
|
this.minTreeHeight = par2;
|
||||||
|
this.metaWood = par3;
|
||||||
|
this.metaLeaves = par4;
|
||||||
|
this.vinesGrow = par5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean generate(World par1World, Random par2Random, int X, int Y, int Z)
|
||||||
|
{
|
||||||
|
int var6 = par2Random.nextInt(3) + this.minTreeHeight - 7;
|
||||||
|
boolean var7 = true;
|
||||||
|
|
||||||
|
if (Y >= 1 && Y + var6 + 1 <= 256)
|
||||||
|
{
|
||||||
|
int var8;
|
||||||
|
byte var9;
|
||||||
|
int var11;
|
||||||
|
int var12;
|
||||||
|
|
||||||
|
for (var8 = Y; var8 <= Y + 1 + var6; ++var8)
|
||||||
|
{
|
||||||
|
var9 = 1;
|
||||||
|
|
||||||
|
if (var8 == Y)
|
||||||
|
{
|
||||||
|
var9 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (var8 >= Y + 1 + var6 - 2)
|
||||||
|
{
|
||||||
|
var9 = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int var10 = X - var9; var10 <= X + var9 && var7; ++var10)
|
||||||
|
{
|
||||||
|
for (var11 = Z - var9; var11 <= Z + var9 && var7; ++var11)
|
||||||
|
{
|
||||||
|
if (var8 >= 0 && var8 < 256)
|
||||||
|
{
|
||||||
|
var12 = par1World.getBlockId(var10, var8, var11);
|
||||||
|
|
||||||
|
if (var12 != 0 && var12 != BOPBlocks.bambooLeaves.blockID && var12 != Block.grass.blockID && var12 != Block.dirt.blockID && var12 != BOPBlocks.bamboo.blockID)
|
||||||
|
{
|
||||||
|
var7 = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var7 = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!var7)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var8 = par1World.getBlockId(X, Y - 1, Z);
|
||||||
|
|
||||||
|
if ((var8 == Block.grass.blockID || var8 == Block.dirt.blockID) && Y < 256 - var6 - 1)
|
||||||
|
{
|
||||||
|
var9 = 3;
|
||||||
|
byte var18 = 0;
|
||||||
|
int var13;
|
||||||
|
int var14;
|
||||||
|
int var15;
|
||||||
|
|
||||||
|
for (var11 = Y - var9 + var6; var11 <= Y + var6; ++var11)
|
||||||
|
{
|
||||||
|
var12 = var11 - (Y + var6);
|
||||||
|
var13 = var18 + 1 - var12 / 3;
|
||||||
|
|
||||||
|
for (var14 = X - var13; var14 <= X + var13; ++var14)
|
||||||
|
{
|
||||||
|
var15 = var14 - X;
|
||||||
|
|
||||||
|
for (int var16 = Z - var13; var16 <= Z + var13; ++var16)
|
||||||
|
{
|
||||||
|
int var17 = var16 - Z;
|
||||||
|
|
||||||
|
if ((Math.abs(var15) != var13 || Math.abs(var17) != var13 || par2Random.nextInt(2) != 0 && var12 != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var14, var11, var16)])
|
||||||
|
{
|
||||||
|
this.setBlockAndMetadata(par1World, var14, var11, var16, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var11 = 0; var11 < var6; ++var11)
|
||||||
|
{
|
||||||
|
var12 = par1World.getBlockId(X, Y + var11, Z);
|
||||||
|
|
||||||
|
if (var12 == 0 || var12 == BOPBlocks.bambooLeaves.blockID)
|
||||||
|
{
|
||||||
|
this.setBlockAndMetadata(par1World, X, Y + var11, Z, BOPBlocks.bamboo.blockID, 0);
|
||||||
|
|
||||||
|
this.setBlockAndMetadata(par1World, X - 1, Y + (var6 - 4), Z, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X + 1, Y + (var6 - 4), Z, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X, Y + (var6 - 4), Z - 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X, Y + (var6 - 4), Z + 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
|
||||||
|
this.setBlockAndMetadata(par1World, X - 1, Y + (var6 - 5), Z + 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X - 1, Y + (var6 - 5), Z - 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X + 1, Y + (var6 - 5), Z + 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X + 1, Y + (var6 - 5), Z - 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X - 1, Y + (var6 - 5), Z, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X + 1, Y + (var6 - 5), Z, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X, Y + (var6 - 5), Z - 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X, Y + (var6 - 5), Z + 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
|
||||||
|
this.setBlockAndMetadata(par1World, X - 1, Y + (var6 - 6), Z, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X + 1, Y + (var6 - 6), Z, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X, Y + (var6 - 6), Z - 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X, Y + (var6 - 6), Z + 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
|
||||||
|
this.setBlockAndMetadata(par1World, X - 1, Y + (var6 - 7), Z + 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X - 1, Y + (var6 - 7), Z - 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X + 1, Y + (var6 - 7), Z + 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X + 1, Y + (var6 - 7), Z - 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X - 1, Y + (var6 - 7), Z, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X + 1, Y + (var6 - 7), Z, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X, Y + (var6 - 7), Z - 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X, Y + (var6 - 7), Z + 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
|
||||||
|
this.setBlockAndMetadata(par1World, X - 1, Y + (var6 - 8), Z, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X + 1, Y + (var6 - 8), Z, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X, Y + (var6 - 8), Z - 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
this.setBlockAndMetadata(par1World, X, Y + (var6 - 8), Z + 1, BOPBlocks.bambooLeaves.blockID, 0);
|
||||||
|
|
||||||
|
if (this.vinesGrow && var11 > 0)
|
||||||
|
{
|
||||||
|
if (par2Random.nextInt(3) > 0 && par1World.isAirBlock(X - 1, Y + var11, Z))
|
||||||
|
{
|
||||||
|
this.setBlockAndMetadata(par1World, X - 1, Y + var11, Z, Block.vine.blockID, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (par2Random.nextInt(3) > 0 && par1World.isAirBlock(X + 1, Y + var11, Z))
|
||||||
|
{
|
||||||
|
this.setBlockAndMetadata(par1World, X + 1, Y + var11, Z, Block.vine.blockID, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (par2Random.nextInt(3) > 0 && par1World.isAirBlock(X, Y + var11, Z - 1))
|
||||||
|
{
|
||||||
|
this.setBlockAndMetadata(par1World, X, Y + var11, Z - 1, Block.vine.blockID, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (par2Random.nextInt(3) > 0 && par1World.isAirBlock(X, Y + var11, Z + 1))
|
||||||
|
{
|
||||||
|
this.setBlockAndMetadata(par1World, X, Y + var11, Z + 1, Block.vine.blockID, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.vinesGrow)
|
||||||
|
{
|
||||||
|
for (var11 = Y - 3 + var6; var11 <= Y + var6; ++var11)
|
||||||
|
{
|
||||||
|
var12 = var11 - (Y + var6);
|
||||||
|
var13 = 2 - var12 / 2;
|
||||||
|
|
||||||
|
for (var14 = X - var13; var14 <= X + var13; ++var14)
|
||||||
|
{
|
||||||
|
for (var15 = Z - var13; var15 <= Z + var13; ++var15)
|
||||||
|
{
|
||||||
|
if (par1World.getBlockId(var14, var11, var15) == BOPBlocks.bambooLeaves.blockID)
|
||||||
|
{
|
||||||
|
if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var14 - 1, var11, var15) == 0)
|
||||||
|
{
|
||||||
|
this.growVines(par1World, var14 - 1, var11, var15, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var14 + 1, var11, var15) == 0)
|
||||||
|
{
|
||||||
|
this.growVines(par1World, var14 + 1, var11, var15, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var14, var11, var15 - 1) == 0)
|
||||||
|
{
|
||||||
|
this.growVines(par1World, var14, var11, var15 - 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var14, var11, var15 + 1) == 0)
|
||||||
|
{
|
||||||
|
this.growVines(par1World, var14, var11, var15 + 1, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (par2Random.nextInt(5) == 0 && var6 > 5)
|
||||||
|
{
|
||||||
|
for (var11 = 0; var11 < 2; ++var11)
|
||||||
|
{
|
||||||
|
for (var12 = 0; var12 < 4; ++var12)
|
||||||
|
{
|
||||||
|
if (par2Random.nextInt(4 - var11) == 0)
|
||||||
|
{
|
||||||
|
var13 = par2Random.nextInt(3);
|
||||||
|
this.setBlockAndMetadata(par1World, X + Direction.offsetX[Direction.footInvisibleFaceRemap[var12]], Y + var6 - 5 + var11, Z + Direction.offsetZ[Direction.footInvisibleFaceRemap[var12]], Block.cocoaPlant.blockID, var13 << 2 | var12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grows vines downward from the given block for a given length. Args: World, x, starty, z, vine-length
|
||||||
|
*/
|
||||||
|
private void growVines(World par1World, int par2, int par3, int par4, int par5)
|
||||||
|
{
|
||||||
|
this.setBlockAndMetadata(par1World, par2, par3, par4, Block.vine.blockID, par5);
|
||||||
|
int var6 = 4;
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
--par3;
|
||||||
|
|
||||||
|
if (par1World.getBlockId(par2, par3, par4) != 0 || var6 <= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setBlockAndMetadata(par1World, par2, par3, par4, Block.vine.blockID, par5);
|
||||||
|
--var6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue