Skip to content

Commit

Permalink
Tarma root: generalise canBlockStay()
Browse files Browse the repository at this point in the history
Use super.canBlockStay(): implies usage of EnumPlantType.Cave, forcing
it to only be placable on solid block

Addtionally add canPlaceBlockOn() requirement: Force it to use the same
blocks (atm cobblestone and stone)
  • Loading branch information
EoD committed Nov 2, 2015
1 parent a833799 commit 29df973
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/am2/blocks/BlockTarmaRoot.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z){
return EnumPlantType.Cave;
}

//EoD: restrict Tarma Roots growth by the blocks in canPlaceBlockOn()
@Override
public boolean canBlockStay(World par1World, int par2, int par3, int par4){
Block block = par1World.getBlock(par2, par3 - 1, par4);
return block == Blocks.stone || block == Blocks.cobblestone;
public boolean canBlockStay(World worldIn, int x, int y, int z){
return canPlaceBlockOn(worldIn.getBlock(x, y - 1, z)) && super.canBlockStay(worldIn, x, y, z);
}

@Override
Expand Down

0 comments on commit 29df973

Please sign in to comment.