Both Holy and Magic Saplings now require Holy Grass in order to be planted

This commit is contained in:
Adubbz 2013-04-01 18:41:26 +11:00
parent 22c9b3d3cc
commit 9e9a254804
2 changed files with 23 additions and 0 deletions

View file

@ -44,6 +44,17 @@ public class BlockHolySapling extends BlockSapling
return this.blockIcon[0]; return this.blockIcon[0];
} }
/**
* Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants.
*/
@Override
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
{
Block soil = blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) &&
(soil != null && soil.blockID == mod_BiomesOPlenty.holyGrass.blockID);
}
/** /**
* Ticks the block if it's been scheduled * Ticks the block if it's been scheduled
*/ */

View file

@ -19,6 +19,7 @@ import net.minecraft.world.gen.feature.WorldGenerator;
import tdwp_ftw.biomesop.worldgen.WorldGenMystic2; import tdwp_ftw.biomesop.worldgen.WorldGenMystic2;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraftforge.common.ForgeDirection;
public class BlockMagicSapling extends BlockSapling public class BlockMagicSapling extends BlockSapling
{ {
@ -44,6 +45,17 @@ public class BlockMagicSapling extends BlockSapling
return this.blockIcon[0]; return this.blockIcon[0];
} }
/**
* Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants.
*/
@Override
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
{
Block soil = blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) &&
(soil != null && soil.blockID == mod_BiomesOPlenty.holyGrass.blockID);
}
/** /**
* Ticks the block if it's been scheduled * Ticks the block if it's been scheduled
*/ */