public int takePolyomino(Polyomino p){
        for (Block b:p.getContents()){
            if (contents[b.getLoc().y][b.getLoc().x]==null){
                contents[b.getLoc().y][b.getLoc().x] = b;
            }
        }
        p=null;
        int linesCleared=0;
        //Clearing rows:
        for (int i=contents.length-1; i>=0; i--){
            boolean fullRow=true;
            for (Block b:contents[i]){
                fullRow = fullRow && b!=null;
            }
            if (fullRow){
                linesCleared++;
                Block[][] temp = new Block[contents.length][contents[0].length];
                System.arraycopy(contents, 0, temp, 0, i);
                System.arraycopy(contents, i+1, temp, i, contents.length-i-1);
                contents=temp;
                for (int y=0; y+i<contents.length; y++){
                    for (Block b:contents[y+i]){
                        if (b!=null) b.translate(0, -1);
                    }
                }
            }
        }
        return linesCleared;
    }