Examples of canSustainPlant()


Examples of net.minecraft.block.Block.canSustainPlant()

    Block target = getPlantedBlock();
    Block ground = worldObj.getBlock(bc.x, bc.y - 1, bc.z);
    IPlantable plantable = (IPlantable) getPlantedBlock();
    if(target.canPlaceBlockAt(worldObj, bc.x, bc.y, bc.z) &&
        target.canBlockStay(worldObj, bc.x, bc.y, bc.z) &&
        (ground.canSustainPlant(worldObj, bc.x, bc.y - 1, bc.z, ForgeDirection.UP, plantable) || ignoreSustainCheck)) {
      return true;
    }
    return false;
  }
View Full Code Here

Examples of net.minecraft.block.Block.canSustainPlant()

  protected boolean canPlant(World worldObj, BlockCoord bc) {
    Block ground = worldObj.getBlock(bc.x, bc.y - 1, bc.z);
    IPlantable plantable = (IPlantable) sapling;
    if(sapling.canPlaceBlockAt(worldObj, bc.x, bc.y, bc.z) &&
        sapling.canBlockStay(worldObj, bc.x, bc.y, bc.z) &&
        ground.canSustainPlant(worldObj, bc.x, bc.y - 1, bc.z, ForgeDirection.UP, plantable)) {
      return true;
    }
    return false;
  }
View Full Code Here

Examples of net.minecraft.block.Block.canSustainPlant()

  protected boolean canPlant(World worldObj, BlockCoord bc, IPlantable plantable) {
    Block target = plantable.getPlant(null, 0, 0, 0);
    Block ground = worldObj.getBlock(bc.x, bc.y - 1, bc.z);
    if(target != null && target.canPlaceBlockAt(worldObj, bc.x, bc.y, bc.z) &&
        target.canBlockStay(worldObj, bc.x, bc.y, bc.z) &&
        ground.canSustainPlant(worldObj, bc.x, bc.y - 1, bc.z, ForgeDirection.UP, plantable)) {
      return true;
    }
    return false;
  }
View Full Code Here

Examples of net.minecraft.block.Block.canSustainPlant()

    {
        int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]};
        int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
        Block block = this.worldObj.getBlock(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);

        boolean isSoil = block.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Blocks.sapling);
        if (!isSoil)
        {
            return false;
        }
        else
View Full Code Here

Examples of net.minecraft.block.Block.canSustainPlant()

        }
        else if (player.canPlayerEdit(xPos, yPos, zPos, side, stack) && player.canPlayerEdit(xPos, yPos + 1, zPos, side, stack))
        {
            Block soil = world.getBlock(xPos, yPos, zPos);

            if (soil != null && soil.canSustainPlant(world, xPos, yPos, zPos, ForgeDirection.UP, this) && world.isAirBlock(xPos, yPos + 1, zPos))
            {
                world.setBlock(xPos, yPos + 1, zPos, this.blockType, stack.getItemDamage() * 4, 3);
                --stack.stackSize;
                return true;
            }
View Full Code Here

Examples of net.minecraft.block.Block.canSustainPlant()

        if (!world.isAirBlock(x, y, z))
        {
            return false;
        }
        return (_plantedBlockId.canPlaceBlockAt(world, x, y, z) && _plantedBlockId.canBlockStay(world, x, y, z))
                || (_plantedBlockId instanceof IPlantable &&  groundId != null &&  groundId.canSustainPlant(world, x, y, z, ForgeDirection.UP,
                        ((IPlantable_plantedBlockId)));
    }

    @Override
    public void prePlant (World world, int x, int y, int z, ItemStack stack)
View Full Code Here

Examples of net.minecraft.block.Block.canSustainPlant()

    @Override
    public boolean canBePlantedHere (World world, int x, int y, int z, ItemStack stack)
    {
        Block groundBlock = world.getBlock(x, y - 1, z);

        return (groundBlock != null && groundBlock.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (IPlantable) NContent.berryBush) && world.isAirBlock(x, y, z));
    }

    @Override
    public int getMeta (ItemStack i)
    {
View Full Code Here

Examples of net.minecraft.block.Block.canSustainPlant()

            if (!world.isAirBlock(x, y, z))
            {
                return false;
            }
            return (groundId == Blocks.dirt || groundId == Blocks.grass || groundId == Blocks.farmland || (_plantedBlockId instanceof IPlantable
                    && groundId != null && groundId.canSustainPlant(world, x, y, z, ForgeDirection.UP, ((IPlantable) _plantedBlockId))));
        }
        return false;
    }

    @Override
View Full Code Here

Examples of net.minecraft.block.Block.canSustainPlant()

        }

        if (yPos >= 1 && yPos + height + 1 <= 256)
        {
            Block soil = world.getBlock(xPos, yPos - 1, zPos);
            boolean isSoil = (soil != null && soil.canSustainPlant(world, xPos, yPos - 1, zPos, ForgeDirection.UP, NContent.rareSapling));

            if (isSoil)
            {
                if (!checkClear(world, xPos, yPos, zPos, height))
                    return false;
View Full Code Here

Examples of net.minecraft.block.Block.canSustainPlant()

                return false;
            }
            else
            {
                Block soil = world.getBlock(xPos, yPos - 1, zPos);
                boolean isSoil = (soil != null && soil.canSustainPlant(world, xPos, yPos - 1, zPos, ForgeDirection.UP, (NSaplingBlock) NContent.floraSapling)) || soil == Blocks.netherrack;

                if (isSoil && yPos < 256 - treeHeight - 1)
                {
                    soil.onPlantGrow(world, xPos, yPos - 1, zPos, xPos, yPos, zPos);
                    b0 = 3;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.